[错误] 使用 JSON Schema 模式时, xgrammar GrammarMatcher 会在无效令牌 ID 下崩溃 (Qwen3-0.6B)
Description
When using response_format with type: "json_object" (both with and without a schema constraint), the xgrammar GrammarMatcher crashes with an invalid token id. The issue is reproducible with the Qwen3-0.6B-q4f16_1-MLC model. The crash occurs in two scenarios: JSON Schema mode (type: "json_object" + schema): crashes frequently with complex input. JSON Mode (type: "json_object" without schema): also reproducible, especially with longer or more descriptive prompts. Chinese input triggers the crash most frequently — prompts like "发光塑料青蛙玩具,适合6岁以下小朋友,安全无毒" have a high crash rate. However, English input can also trigger the same crash occasionally at a lower rate. This suggests the issue is not strictly language-specific, but rather related to how xgrammar handles certain token sequences under grammar-guided decoding.
内容来源: mlc-ai/web-llm