Abstract
Autoregressive models (ARMs), which predict subsequent tokens one-by-one "from left to right," have achieved significant success across a wide range of sequence generation tasks. However, they struggle to accurately represent sequences that require satisfying sophisticated constraints or whose sequential dependencies are better addressed by out-of-order generation. Masked Diffusion Models (MDMs) address some of these limitations, but the process of unmasking multiple tokens simultaneously in MDMs can introduce incoherences, and MDMs cannot handle arbitrary infilling constraints when the number of tokens to be filled in is not known in advance. In this work, we introduce Insertion Language Models (ILMs), which learn to insert tokens at arbitrary positions in a sequence -- that is, they select jointly both the position and the vocabulary element to be inserted. By inserting tokens one at a time, ILMs can represent strong dependencies between tokens, and their ability to generate sequences in arbitrary order allows them to accurately model sequences where token dependencies do not follow a left-to-right sequential structure. To train ILMs, we propose a tailored network parameterization and use a simple denoising objective. Our empirical evaluation demonstrates that ILMs outperform both ARMs and MDMs on common planning tasks. Furthermore, we show that ILMs outperform MDMs and perform on par with ARMs in an unconditional text generation task while offering greater flexibility than MDMs in arbitrary-length text infilling.
Introduction
Most modern AI text generation relies on Autoregressive Models (ARMs), which predict tokens in a strict left-to-right fashion. While successful, this approach struggles with tasks requiring "lookahead" or complex planning, as the model is forced to commit to the beginning of a sequence before the end is resolved. Masked Diffusion Models (MDMs) attempted to fix this by predicting multiple missing tokens at once. However, MDMs face hurdles with incoherence—where simultaneous predictions contradict each other—and rigidity, as they typically require knowing the exact number of missing tokens in advance.
Insertion Language Models (ILMs)
We introduce Insertion Language Models (ILMs), which move beyond the left-to-right constraint by learning to insert tokens at any position in a sequence. Instead of predicting the next token, the model jointly predicts a vocabulary element and a position to insert it.
As illustrated in Figure 1, ILMs combine the strengths of both ARMs and MDMs. They support flexible generation order while maintaining the ability to generate sequences of arbitrary length. By inserting tokens one at a time, ILMs allow the model to "see" its previous choices, preserving strong dependencies and avoiding the incoherence issues inherent in simultaneous unmasking.
Training and Architecture
ILMs are trained using a "denoising by dropping" objective. During training, random tokens are dropped from a full sequence, and the model learns to re-insert them. The architecture uses a standard Transformer backbone with a specialized "insertion head" that produces logits for every possible gap between existing tokens. A dedicated binary classifier (using a special <stp> token) signals when the sequence is complete, enabling zero-shot infilling of unknown lengths.
Empirical Evaluation
The researchers evaluated ILMs across three categories: synthetic planning (Star Graphs), logic puzzles (Zebra Puzzles), and natural language (LM1B and TinyStories).
Key Results
ILMs demonstrated significant superiority in tasks requiring non-linear planning and constraint satisfaction.
As shown in Table 1 (Figure 6), ILMs achieved 99.1% sequence accuracy on the "Hard" Star Graph task, where ARMs and MDMs plummeted to 23.0% and 21.0%, respectively. In Zebra Puzzles, ILMs reached 90.0% accuracy, outperforming both baselines. In unconditional text generation, ILMs were competitive with ARMs and significantly outperformed MDMs. Furthermore, ILMs showed much lower error rates in variable-length infilling tasks compared to MDMs.
Discussion
A key insight is the "Hardest First" strategy: in planning tasks, ILMs naturally learn to generate the most constrained parts of a sequence (like junction nodes) first, regardless of their final position. This allows the model to resolve the most difficult dependencies before filling in the rest.
Limitations and Future Work
Despite their strengths, ILMs currently lack support for standard Key-Value (KV) caching because the sequence changes at every step, leading to slower inference. Additionally, while competitive, ILMs still perform slightly worse than ARMs on raw text when trained for the same number of steps. Future work will focus on scaling ILMs to larger datasets and developing efficient caching mechanisms for non-sequential insertions.
Conclusion
Insertion Language Models provide a robust framework for sequence generation that breaks the left-to-right barrier. By enabling arbitrary-position insertions, ILMs excel at complex planning and flexible infilling, offering a promising direction for more capable and versatile language models.
Summary updated