Code and results for Formats, Rules, and Clusters: What Makes Structured Outputs Decodable in Few Diffusion Steps.
We train small masked diffusion language models (4.9M parameters) from scratch on a single laptop and study which representations of structured outputs (programs, plans) can be generated in very few model passes (2 to 32).
Main findings:
- A model-free count of decisions forced by a representation's rules depends on the decision order and does not predict model behavior.
- Rule-assisted decoding needs a joint consistency check of the cells committed in one pass, not only per-position constraints.
- A dataflow block language (typed ports, linear wiring) keeps producing novel working programs at 4 to 8 passes where Python ASTs do not, but does not improve correctness when completing unseen programs.
- For plans, compact output formats yield 6 to 10 times more correct plans than JSON; fixed-width slots add a smaller gain, largest at 2 passes.
- With a correct skeleton, all clusters of a long plan decoded in parallel in 2 passes are correct far more often than flat decoding (46 to 53% vs 8 to 13% at 4 passes); learning the skeleton is the bottleneck.
src/phase0/ code: Earley engine with holes (C kernel + Python reference), decision-count simulation,
block language (lang, translator, interpreter), synthetic data, models, decoding with rules,
plan tasks (E9, E10)
tests/ unit tests (engine agrees with the Python reference; rules never force a wrong cell; round trips)
results/ all result files used in the paper (JSON / JSONL)
paper/ LaTeX source, figures and the script that generates them
REPRODUCE.md command for every experiment and table
uv sync
uv run pytest -q
Requires Python 3.12+, uv, a C compiler (the Earley kernel is compiled on first import) and PyTorch (MPS or CUDA optional; CPU works but is slow).
MIT, see LICENSE.