cs.AIMay 28, 2026

Accelerating Constrained Decoding with Token Space Compression

Authors: Michael SullivanAlexander Koller

Organizations: Department of Language Science and Technology Saarland Informatics Campus Saarland University, Saarbrücken, Germany

Abstract

To guarantee that an LLM's outputs conform to a specified structure, context-free grammar (CFG) decoding engines force the selection of next tokens that produce strings that conform to a given CFG. While current CFG-constrained decoding engines are highly optimized, the inherent costs arising from the massive per-step search space -- i.e. the entire token vocabulary -- result in intractably high overhead for more complex CFGs: precisely the situation where CFG engines are most useful. In this paper, we introduce CFGzip, an offline technique for compressing the token search space, which massively reduces CFG engine overhead. In experiments, we report latency reduction of up to two orders of magnitude when CFGzip is used with a SoTA grammar engine, yielding an up to 7.5x speedup in total constrained generation time: with CFGzip, constrained decoding is now feasible at scale for complex CFGs.

Explore similar work

CardsList
  1. Grammar-Aligned Decoding

    May 31, 2024Kanghee Park, Jiayu Wang, Taylor Berg-Kirkpatrick +2Large Language Model GenerationCode Generation

  2. Entropy Gate: Entropy Quenching for Near-Lossless Token Compression in LLM Pipelines

    Jun 2, 2026Justice Owusu Agyemang, Jerry John Kponyo, Kwame Opuni-Boachie Obour Agyekum +3Token CompressionContext Compression