New Method Enables Constrained Decoding for Diffusion Language Models.

Meihua Dang, Stefano Ermon· July 9, 2026 View original

Key takeaways

  • A new algorithm enables constrained decoding for diffusion language models.
  • It guarantees outputs adhere to structures like JSON schemas using finite automata.
  • The method significantly improves accuracy in tasks like function calling and text-to-SQL.
  • It expands the practical application of diffusion models for enterprise use cases.

Who benefits

Software DevelopmentAI/ML PlatformsData ScienceFinanceLegal Tech

Summary

A novel algorithm allows diffusion language models to generate outputs strictly adhering to specified structures like JSON schemas. This method ensures constraint satisfaction by viewing finite automata as graphical models, significantly improving accuracy in tasks like function calling and math reasoning.

Constrained decoding is a critical requirement for Large Language Models (LLMs), ensuring that their generated outputs conform to specific formats, such as JSON schema for function calls. While existing systems are designed for autoregressive models that generate text left-to-right, diffusion language models present a challenge because they sample multiple positions simultaneously. Researchers have developed an exact and tractable algorithm to enable constrained decoding for diffusion language models. This approach samples from a constrained mean-field posterior under any constraint expressible as a finite automaton. By treating finite automata as graphical models, the method achieves tractable representations of the constrained distribution, guaranteeing constraint satisfaction. The algorithm supports both greedy and sampling-based decoding, is compatible with parallel and block-wise decoding, and uses depth-reduction techniques to reduce sampling depth. Empirical evaluations on models like Dream-7B and LLaDA-8B show substantial accuracy gains in tasks such as function calling, planning, text-to-SQL, and math reasoning, with minimal inference overhead. For instance, Dream-7B's greedy decoding accuracy on BFCL-Live improved from 63.9% to 71.5%.

Why it matters

This breakthrough allows diffusion models to be used reliably in applications requiring structured outputs, expanding their utility beyond creative generation to more precise, task-oriented functions crucial for enterprise integration.

How to implement this in your domain

  1. 1Evaluate diffusion language models for tasks requiring structured outputs, leveraging this new constrained decoding method.
  2. 2Integrate diffusion models with this technique into systems that need to generate code, API calls, or structured data.
  3. 3Experiment with the algorithm to improve accuracy in existing LLM applications like function calling or text-to-SQL.
  4. 4Consider adopting diffusion models for tasks where autoregressive models struggle with constraint satisfaction.

Original post by Meihua Dang, Stefano Ermon

"arXiv:2607.07026v1 Announce Type: new Abstract: Constrained decoding is essential for serving LLMs, ensuring that generated outputs follow specific structures such as JSON schema-formatted function calls. Existing systems are designed for autoregressive models and assume left-to-…"

View on X

Originally posted by Meihua Dang, Stefano Ermon on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses