AI RESEARCH

XGrammar-2: Efficient Dynamic Structured Generation Engine for Agentic LLMs

arXiv CS.AI

ArXi:2601.04426v2 Announce Type: replace Modern LLM agents increasingly rely on dynamic structured generation, such as tool calling and response protocols. Unlike traditional structured generation with static structures, these workloads vary both across requests and within a request, posing new challenges to existing engines. We present XGrammar-2, a structured generation engine for dynamic agentic workloads. Our design is based on two key ideas: first-class for tag-triggered structure switching, and fine-grained reuse across requests with different output structures. Concretely, XGrammar-2.