Efficient and Asymptotically Unbiased Constrained Decoding for Large Language Models

Haotian Ye, Himanshu Jain, Chong You, Ananda Theertha Suresh, Haowei Lin +2 more
4/12/2025
cs.CL

No official code found. Best implementation: YWolfeee/Large-Scale-Selection-for-LLMs (4 stars, last commit 2025-03-11).

Abstract

In real-world applications of large language models, outputs are often required to be confined: selecting items from predefined product or document sets, generating phrases that comply with safety standards, or conforming to specialized formatting styles. To control the generation, constrained decoding has been widely adopted. However, existing prefix-tree-based constrained decoding is inefficient under GPU-based model inference paradigms, and it introduces unintended biases into the output distribution. This paper introduces Dynamic Importance Sampling for Constrained Decoding (DISC) with GPU-based Parallel Prefix-Verification (PPV), a novel algorithm that leverages dynamic importance sampling to achieve theoretically guaranteed asymptotic unbiasedness and overcomes the inefficiency of prefix-tree. Extensive experiments demonstrate the superiority of our method over existing methods in both efficiency and output quality. These results highlight the potential of our methods to improve constrained generation in applications where adherence to specific constraints is essential.

View on arXivView PDF

Code Implementations(1)

AISTATS 2025: Efficient and Asymptotically Unbiased Constrained Decoding for Large Language Models

40Shell, PythonMar 11, 20251 years ago

Similar Papers

Cite this paper

@article{ye2025efficient,
  title  = {Efficient and Asymptotically Unbiased Constrained Decoding for Large Language Models},
  author = {Haotian Ye and Himanshu Jain and Chong You and Ananda Theertha Suresh and Haowei Lin and James Zou and Felix Yu},
  year   = {2025},
  eprint = {2504.09135},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2504.09135v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2504.09135.svg)](https://codeofpaper.com/paper/2504.09135)

Discussion