Autoregressive (AR) generative models naturally generate variable-length sequences but are inherently slow due to their left-to-right sequential nature. Non-autoregressive (NAR) models, like discrete diffusion or flow matching, attempt to solve this by generating tokens in parallel. However, current NAR models struggle with variable lengths, often imposing rigid, token-wise structures. They typically start with a fixed-length sequence of "mask" or "noise" tokens and iteratively replace them, relying on awkward workarounds like excessive padding which makes models overconfident in predicting padding tokens.
To overcome these limitations, researchers propose Edit Flows, a non-autoregressive model that natively supports variable-length sequences by defining a discrete flow over sequences through edit operations: insertions, deletions, and substitutions.
How Edit Flows Work
Instead of modeling independent token-wise changes at absolute positions, Edit Flows uses a Continuous-Time Markov Chain (CTMC) over full sequences. The model predicts the rate (probability) of inserting, deleting, or substituting a token relative to the current sequence state.
Tractable Training via Auxiliary Alignments
Directly training a model on sequence-level edits is mathematically intractable because there are countless paths of edits to transform one sequence into another. The authors solve this using an extension of Discrete Flow Matching. They introduce an auxiliary alignment process using a special "blank" token ($\epsilon$).
By aligning the source and target sequences with these blanks, they create a tractable training objective that the model can learn from, without ever exposing the blank tokens to the model during actual generation. Interestingly, even when trained with suboptimal alignments, the model naturally learns to prefer generation paths that require the fewest edits—the discrete equivalent of minimizing kinetic energy in continuous flow matching.
Localized Edit Operations
For long sequences, independent edits can result in noisy, disconnected chunks of text. The authors introduce a "Localized Edit Flow" variant where the occurrence of an edit operation incites nearby edits. This encourages the model to generate locally consistent subsequences, which is vital for structured data like code.
Key Insights and Performance
The models (ranging from 280M to 1.3B parameters based on the Llama architecture) were trained and evaluated on image captioning, text benchmarks, and code generation.
- Relative > Absolute: Shifting from absolute token positions to position-relative edits aligns much better with the actual structure of sequence data, freeing the model from the constraints of fixed-length masking.
- High Token Efficiency: Because Edit Flows don't waste compute processing massive blocks of padding tokens (unlike Mask DFM), they are highly compute-efficient. In experiments, Edit Flows ingested 3$\times$ more training data per iteration than Mask DFM using the exact same compute and memory budget.
- Image Captioning: Edit Flows outperformed both the Mask DFM baseline and the standard Autoregressive baseline (e.g., 108.1 CIDEr for Edit Flows vs. 95.5 for AR and 95.6 for Mask DFM).
- Code Generation: Localized Edit Flows achieved a massive 138% relative improvement over the Mask DFM baseline on the MBPP benchmark (14.8 Pass@1 vs 6.2 Pass@1). It even beat a Mask DFM model given the oracle ground-truth sequence length.
- Text Generation: Edit Flows significantly outperformed Mask DFM across all zero-shot text benchmarks (e.g., 49.0 vs 38.3 on HellaSwag), though it still slightly trails the Autoregressive baseline (49.5).
Limitations and Future Work
While Edit Flows effectively close the gap between NAR and AR models, AR models still hold a slight edge in pure text and code generation. The pre-training configuration inherently favored AR models, which see all possible prefix contexts during training, whereas the Edit Flows model was only conditioned on a random subset of the input.
Furthermore, text benchmarks evaluate likelihood estimation rather than actual text generation quality. Because NAR models lack a closed-form expression for likelihood, the authors had to rely on a noisy estimate (ELBO). Future work will likely focus on designing training pipelines and benchmarks specifically tailored for NAR paradigms.
Summary updated