Researchers identify a gap between how a class of AI code models is trained and how they actually behave, then show two training recipes that let a code model write in any order.
A new preprint shows that an AI coding model can write or fill in code in non-sequential order and still match the performance of today's left-to-right code models. The difference between how this class of models is trained and how it actually behaves has a name: positional uncertainty.
The paper, "From Interface to Inference: Eliciting Any-Order Inference from Any-Order Models," comes from a co-first-author team at the University of Texas at Austin and Harvard. It targets a class of AI models called masked diffusion models. Where a standard language model writes one token at a time from left to right, a masked diffusion model treats generation like a sketch: it starts from a mostly-blank canvas and fills in many blanks at once, repeating until the picture is complete. The training objective is any-order: the model is rewarded for getting each token right regardless of where on the canvas it lands.
The team's punchline is the interface-inference gap, the distance between a model's training objective and the interface it actually exposes. Their masked-diffusion training recipe explicitly rewards correctness independent of position, so the matching inference interface should be any-order too. In practice, it is not.
A masked diffusion model trained on a fixed canvas can know what should appear in a code snippet without knowing where to put it. The model can learn that a function needs an import, a class, and a return statement while still being unable to say which of them belongs on line one. At inference time the model has to commit to a layout, and that commit is the order the user sees. The paper's central claim is that the gap is not a property of the architecture; it is a property of the training recipe.
The team proposes two complementary fixes. FlexMDM is insertion-based: instead of starting from a blank canvas and filling in tokens at fixed positions, it starts from a short anchor and inserts new pieces wherever they fit. The design is closer in spirit to how a programmer refactors by adding a missing import or a forgotten edge case than to writing a file from scratch. LatentMDM, also called LP-MDM, keeps the visible canvas but lets the model pick positions in a continuous latent space and snap them to discrete token locations only at the end. Both designs treat position as a learnable output rather than a hidden assumption, and the paper reports that they induce distinct any-order behaviors when the model is asked to fill in pieces out of sequence.
A 7B-parameter FlexMDM, fine-tuned from an open base model called Dream-Coder-7B-Base, was evaluated on Python code generation. A 125M-parameter LatentMDM was tested on GSM8K, a standard grade-school math word-problem benchmark used to probe reasoning. In both settings, the authors report gains on pass@k, the share of generated samples that pass the unit tests, and on any-order metrics that measure whether the model can place correct code or reasoning in the right slot when asked to do so out of order. The released FlexMDM checkpoint is published on the Hugging Face Hub as yuyuanchen0/flexmdm, and the full training, data, and evaluation pipeline is open-sourced at the authors' GitHub repository.
What the paper does not claim is part of the result. The authors do not benchmark against frontier proprietary code models. The Python evaluation is a code-generation benchmark, not a multi-file repository task. The GSM8K math evaluation is a reasoning probe on grade-school problems, not a measure of general coding ability. Insertion-based training is also more expensive than a single forward pass, and the paper does not hide that cost. The interface-inference gap is the lens, not a closed door: the authors are explicit that any-order training alone does not automatically close it.
For anyone watching the AI coding market, the interesting question is no longer whether the next model will be bigger. It is whether the left-to-right order a coding assistant writes in is the only order it can produce. The preprint's answer is: probably not, but you have to design for it. Whether the FlexMDM and LatentMDM checkpoints travel from a 7B Python model to the assistant in your editor is a separate downstream question, the kind this paper opens without pretending to settle.