
A research fork of CALM in PyTorch that generates continuous vectors instead of tokens. An autoencoder compresses a K-token patch into one latent and an autoregressive model predicts the next latent, so a single step emits K tokens, behind three interchangeable heads: energy, diffusion and flow matching. Quality is scored with BrierLM, a likelihood-free metric built for exactly this.
The two stages are separable, and that is the point. An autoencoder learns to compress K tokens into one continuous latent and reconstruct them. An autoregressive model then works entirely in latent space, predicting the next vector instead of the next token, behind an energy head, a diffusion head or a flow-matching head. A token-level baseline ships beside them so every comparison has something to be a comparison against. The worked configuration is a patch of four, a latent of 128, hidden size 1,024 and sixteen layers over the Llama 3 tokenizer.
Evaluation had to be rebuilt, because a model that emits continuous vectors has no token likelihood to read. BrierLM decodes two independent latent samples, scores their agreement and calibration, and aggregates across four orders.
The fork's own work is adaptive patching, and it is three ideas. Adaptive patch length maps boundary entropy onto one-, two-, four- or eight-token patches, spending narrow patches where the model is least certain and wide ones where text is predictable. Uncertainty-aware refinement turns that into explicit accept, resample or split decisions. Cross-granularity consistency distils a token-level teacher into the decoded patches through a temperature-scaled KL objective. Each primitive has tests and a script that prints the decisions the policy makes.
One optimisation sits where this architecture ordinarily leaks time. Below temperature one, decoded patch candidates are counted and sampled on the device instead of being copied into Python tuples, so generation stops paying a host round trip per step.