From Interface to Inference: Eliciting Any-Order Inference from Any-Order Models
This paper addresses the gap between the any-order training interface and inference capabilities of masked diffusion models by proposing insertion-based and latent-space approaches that resolve positional uncertainty, thereby enabling native any-order inference and improving performance on discrete reasoning tasks like code generation and math problems.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are trying to teach a robot how to write a story or solve a math problem. For a long time, the best way to do this was to teach the robot to speak one word at a time, strictly from left to right, like a human reading a book. This is called "autoregressive" generation. It works well, but it's a bit rigid. If the robot makes a mistake in the first sentence, it has to keep writing the rest of the story based on that mistake, or it has to start all over again. It can't easily jump back to fix the beginning while writing the middle, the way a human editor does.
Recently, scientists discovered a new type of AI called a "Masked Diffusion Model." Think of this like a "fill-in-the-blanks" game. Instead of writing words one by one, the AI looks at a sentence where some words are hidden (masked) and tries to guess what they are. Because it can look at any hidden word at any time, it should be able to jump around, fix the beginning, then the end, then the middle, in any order it wants. This is called "any-order inference." It sounds like the perfect tool for complex tasks like coding, where programmers often jump between the big picture and tiny details. But here is the catch: just because the AI can jump around doesn't mean it does.
This paper investigates why these powerful "fill-in-the-blank" robots often get stuck in a rut, acting just like the old "left-to-right" robots despite having the freedom to do otherwise. The authors, a team of researchers from the University of Texas at Austin and Harvard University, discovered a hidden trap called "positional uncertainty." They found that while the AI might know what word it needs (like a specific function in a computer program), it gets confused about where that word should go in the final sentence. Because it's unsure of the location, it plays it safe and fills in the blanks in a boring, predictable order, missing out on the creative, non-linear thinking it was supposed to be good at.
To fix this, the researchers didn't just tweak the robot's confidence; they gave it two new superpowers. The first is like giving the robot a pair of scissors and a glue stick. Instead of being stuck with a fixed number of blank spaces, the robot can now insert new blank spaces wherever it needs them, shifting the whole sentence around to make room for new ideas. The second superpower is like teaching the robot to think in "chunks" or "paragraphs" instead of individual words. Instead of guessing one letter at a time, it guesses whole blocks of meaning at once, allowing it to decide which big idea to build next without getting lost in the details.
The team tested these ideas on computer coding and math problems. They found that by using these new methods, the robots actually started thinking more like human programmers, jumping back and forth between different parts of the code to refine their work. This led to better results, with the robots solving more problems correctly than before. The paper suggests that to get AI to truly reason like a human, we need to design models that don't just have the ability to jump around, but are built in a way that makes jumping around the natural, easy choice.
The Problem: The "Fixed Canvas" Trap
The researchers started by looking at why these "fill-in-the-blank" models (Masked Diffusion Models, or MDMs) weren't living up to their hype. In theory, an MDM should be able to reveal any hidden token in a sequence at any time. If you ask it to write a Python program, it should be able to write the function name, then jump to the loop, then go back to the variable definition, all in a chaotic, human-like order.
However, when they watched the models in action, they saw something disappointing. Even though the models had the freedom to choose any order, they almost always chose to fill in the blanks from left to right, just like the old-fashioned robots. The authors call this "causal collapse." It's as if the robot has a map of the whole city but decides to walk down the street one block at a time anyway, ignoring all the shortcuts.
The paper argues that this isn't just a bad habit; it's a fundamental flaw in how these models are built. The issue is positional uncertainty. Imagine you are building a LEGO castle. You know you need a "tower" piece. But you don't know exactly where the tower goes yet because you haven't built the walls around it. If you try to place the tower now, you might put it in the wrong spot.
In a standard MDM, the "canvas" (the sequence of tokens) is fixed. The model has to decide: "Do I put the word 'return' here, or here, or here?" If the model knows it needs a 'return' statement but isn't sure if it belongs inside a loop or after it, its confidence gets split across all those possible spots. Because the confidence is spread out, the model feels "less sure" about placing that 'return' statement than it does about placing a simple word that clearly follows the one before it. So, to be safe, it just fills in the easy, local words first, effectively locking itself into a left-to-right order. The paper shows that this happens even when the model is very smart; the fixed grid of the canvas forces it to make premature commitments.
The Solution 1: FlexMDM (The Scissors and Glue)
To fix the "where do I put this?" problem, the first solution is called FlexMDM. This approach changes the rules of the game by removing the fixed canvas.
Imagine you are writing a story on a piece of paper, but instead of being stuck with the lines you started with, you have a magical eraser and a glue stick. If you write a sentence and realize you need a new paragraph in the middle, you can magically insert a new line of space right there. The words you wrote earlier can slide over to make room.
FlexMDM does exactly this. It allows the model to insert new tokens (or masks) during the generation process. When the model decides to reveal a token, it doesn't have to commit to a permanent spot in the final sequence. Later, if the model decides it needs more space or a different structure, it can insert new gaps, and the previously revealed tokens will shift to their new, correct positions.
This simple change breaks the "positional uncertainty" trap. The model no longer has to worry about "Is this the right spot?" because the spot can move. The researchers found that this allowed the model to generate code in a much more human-like way. Instead of finishing one line completely before starting the next, the model could draft a function name, then jump to write a loop, then go back to fill in the details of the function. They measured this by looking at the "tree" structure of the code and found that FlexMDM was much more likely to jump between different branches of the code, whereas the standard model just marched straight down one path.
In their tests, they fine-tuned a 7-billion-parameter model (Dream-Coder) to use this method. On coding benchmarks like HumanEval and MBPP, this new "flexible" model performed better than the original, especially when they allowed it to generate multiple attempts (Pass@16). It showed that by letting the model rearrange the canvas, it could explore more creative solutions.
The Solution 2: LatentMDM (Thinking in Chunks)
The second solution, LatentMDM, takes a different approach. Instead of fighting with the position of individual words, it changes the level at which the model thinks.
Imagine you are trying to describe a movie to a friend. If you try to describe it word-for-word ("The man walked, then he stopped, then he looked..."), it's hard to get the big picture. But if you describe it in "scenes" or "chunks" ("First, the hero enters the room. Then, he sees the villain. Finally, they fight."), it's much easier to jump around. You can say, "Let's talk about the fight scene first," without worrying about the exact words used in the entrance scene.
LatentMDM does this by grouping tokens into semantic segments (like lines of code or logical blocks) and treating each segment as a single unit in a "latent space" (a compressed, abstract representation of meaning). Instead of guessing one token at a time, the model guesses which segment to reveal next.
This shifts the "positional uncertainty" from the level of individual words to the level of whole ideas. The model doesn't have to worry about whether a specific word goes in slot 5 or slot 6; it just decides, "I'm going to write the 'loop' segment next." Because the segments are coarser, the model can be much more confident about the order of the ideas, even if the exact words inside them are still being figured out.
The researchers trained a smaller 125-million-parameter model from scratch using this method on a math dataset called TinyGSM. They found that this model could actually choose to reveal segments in a non-left-to-right order, something the standard models couldn't do effectively. In fact, LatentMDM outperformed standard models and even some larger autoregressive models on math problems, all while running faster. This suggests that by thinking in "chunks," the model can navigate the solution space more efficiently, finding the right path without getting stuck in the details.
What This Means
The paper concludes that having the interface for any-order inference (the ability to pick any blank) isn't enough. The model's internal mechanics must also support it. If the model is stuck on a fixed grid of words, it will naturally collapse into a left-to-right order because it's too scared to make a mistake about where things go.
By either making the grid flexible (FlexMDM) or thinking in bigger chunks (LatentMDM), the researchers showed that AI can truly break free from the "left-to-right" habit. These models don't just generate text; they generate it with a structure that mimics how humans actually think and build complex things—jumping back and forth, refining ideas, and exploring different paths before settling on a final solution.
The authors are careful to note that these are promising steps, not a final solution to all AI reasoning problems. They tested these ideas primarily on coding and math, and while the results were strong, they suggest that more work is needed to see if these "any-order" behaviors work for other types of tasks or at larger scales. But the core message is clear: to build AI that reasons like a human, we need to stop forcing it to write like a typewriter and start letting it think like an architect.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.