Conversation
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动
词元是模型一次处理的文本单位。词元掩码是生成每个词元时用于排除不合法候选的布尔结果。原实现让所有工作线程在同一个结果表上加锁并插入。本改动让每个工作线程写入自己的结果表,全部任务完成后再把表节点移动合并,避免热点锁和串行内存分配。
本请求保持主分支原有的“每个状态一个任务”,没有带入历史实验中单独无明确收益的相同缓存键任务分组。本请求依赖 #790、#791 和 #792;当前分支保留这些前置提交,需要审查的独立提交是
4e7aeaa1。单项性能
结构标签是把触发文本、函数参数规则和结束文本组合起来的生成约束。JSON Schema 是描述 JSON 数据结构及字段约束的规则。允许词元集合生成时间是生成每一步筛选合法词元所需的平均时间。
收益集中在大型结构标签;小型结构标签有明显回退,评审重点是是否应为任务数量增加启用阈值。
143.810 毫秒组合
历史完整候选在固定 400 函数结构标签、32 个编译线程和 15 个稳定样本下得到:
llguidance 是另一个用于语法约束生成的实现,这里作为外部参考。XGrammar 快 7.485 毫秒,即 4.95%。
该历史组合包含 #781、#783、#784、#785、#790、#791、#792 和本请求对应的优化。历史候选还包含相同缓存键任务分组;后续四类输入实验没有证明该分组有明确收益,因此本请求已排除它。143.810 毫秒是完整组合的历史实测结果,不应解读为本请求单独或本请求只加 #783 的结果。
正确性