A graph result powers faster structured language decoding
Breaking the Space Barrier and its Application to Language Model Inference · arXiv:2610.09139

In plain words
The paper combines a math result about paths through graphs with stcon, a system for making language models follow formats such as JSON. The system checks which next pieces of text keep an answer valid, and does those checks on the graphics chip rather than making the main processor do extra work.
On one tested laptop, it decoded six JSON tasks faster than a comparison system. That result covers the tested models, tasks, and setup; it does not show that every model answer is correct.
The research
When an app requires JSON or typed tool arguments, the decoder must check each next token against the format. On a laptop, those CPU checks can make the GPU wait; the question is whether the format can be enforced without paying that repeated delay.
The paper turns a few-path graph result into an MLX decoder that recomputes format masks on the GPU and guarantees valid constrained outputs.
The authors pair a deterministic format-checking machine with a tree of token prefixes. Since each token follows one path through that tree, stcon can recompute allowed-token masks on the GPU instead of storing a large state-by-token table.
In the same MLX loop and with the same model and kernels, stcon decoded six JSON extractions with Qwen3.5-2B 1.28 times faster than llguidance fast-forward. This supports a speed advantage for the tested decoding setup.
The timing and other measurements come from one Apple M2 Pro, one model family, six JSON schemas, four recursive schemas, and greedy decoding. The recursive-format support accepts only certain grammars and caps nesting at 64 levels.
What the evidence shows
- The decoding cost
The paper introduces stcon, an engine for language models that must produce structured outputs such as JSON or typed tool calls. A decoder has to check each next token against the required format. If those checks run on the CPU, the GPU can wait during laptop inference, adding work at every step.
- A tree replaces the table
Stcon represents each token as a path through a vocabulary trie, paired with a deterministic machine that tracks whether the format remains valid.
Because each trie node has one parent and one resulting machine state, the engine can recompute the allowed-token mask on the GPU instead of storing a table for every state and token.
- A separate graph result
The paper also proves a result for total few-path reachability: deciding whether a graph connects two points while checking that every pair has at most a given number of walks. The algorithm must handle arbitrary graphs, including ones that violate the few-walk condition. The result establishes small-space classical algorithms for this problem.
- Faster on six extractions
In a matched MLX comparison on one Apple M2 Pro, stcon decoded six JSON extractions with Qwen3.5-2B 1.28 times faster than llguidance fast-forward.
The comparison used the same prompts, model, precision, greedy decoding, and matrix kernels, so it tests the effect of changing how the format constraint is handled in that setup.
- Two targeted checks
Separate controls tested validity under token limits and fidelity to unconstrained answers. The budget rule yielded valid JSON for all 90 evaluated feasible schema-and-limit cases, versus 3 of 90 without it.
A tokenizer-aware split had higher mean agreement than plain masking, though agreement measures matching the unconstrained answer, not factual correctness.