Constrained Decoding for Diffusion Language Models via Efficient Inference over Finite Automata

· Source: Machine Learning · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering · Depth: Expert, quick

Summary

This paper introduces an exact and tractable algorithm for constrained decoding in diffusion language models, addressing a limitation where existing methods designed for autoregressive models fail due to simultaneous position sampling. The new approach leverages finite automata, viewing them as graphical models, to enable efficient inference over the constrained mean-field posterior. It guarantees constraint satisfaction by construction, supports various decoding strategies, and reduces sampling depth from linear to logarithmic using depth-reduction techniques. Empirical evaluations on Dream-7B and LLaDA-8B demonstrate substantial accuracy improvements across tasks like function calling (xLAM, BFCL), planning (Sudoku, Countdown), text-to-SQL (Spider), and math reasoning (GSM-Symbolic). For instance, Dream-7B's greedy decoding accuracy on BFCL-Live improved from 63.9% to 71.5%, with under 5% wall-clock overhead.

Key takeaway

For machine learning engineers developing applications with diffusion language models, this algorithm offers a critical solution for enforcing structured outputs. If your current diffusion LM struggles with tasks requiring specific formats like JSON schema or SQL queries, implementing this finite automaton-based constrained decoding can significantly boost accuracy and reliability. You can expect substantial performance gains on tasks like function calling and text-to-SQL with minimal inference overhead, making diffusion models viable for more complex, constraint-driven applications.

Key insights

A new algorithm enables exact constrained decoding for diffusion LMs using finite automata, ensuring structured outputs.

Principles

Method

The algorithm views finite automata as graphical models to represent constrained distributions. It performs efficient inference over the mean-field posterior, reducing sampling depth from linear to logarithmic using arithmetic circuit theory.

In practice

Topics

Best for: Research Scientist, AI Scientist, Machine Learning Engineer, NLP Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Machine Learning.