arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2611.02297cs.LGcs.AI
收藏

FactorSpec:将精确关系约束作为推测草稿进行服务

FactorSpec: Serving Exact Relational Constraints as Speculative Drafts

University of Connecticut(康涅狄格大学)

Jianchang Su, Dawei Xiang, Wei Zhang

AI总结:

FactorSpec将精确关系约束作为推测草稿服务,通过因子图编译约束、确定令牌草稿及并行计算掩码,在SGLang和vLLM中提升解码速度与有效记录服务量,优于n元语法草稿器及仅语法基线。

摘要:

推测解码通过生成草稿令牌供目标模型一次验证来加速大语言模型(LLM)服务,其增益随目标接受的草稿数量增加而提升。结构化输出应是理想情况,因为记录的很多内容由其字段间的关系决定:行程的天数由其城市停留时间和航班决定。然而,服务引擎通过从提示或学习头部生成草稿文本,仅通过语法掩码强制语法,模型需满足这些关系却会违反:在NATURAL PLAN的行程问题上,Qwen3-8B生成有效行程的比例为10%,重试时命名违反关系的比例提升至14%。我们提出FactorSpec,它将精确关系约束编译为带有精确可行性检查的因子图,将约束确定的每个令牌作为确定项生成草稿,根据请求选择宽度进行验证,在GPU运行时于调度器外的工作进程中计算掩码。在SGLang中,其草稿每验证步骤可生成多达10.5个令牌,是最快n元语法草稿器的1.9倍,解码速度比按负载调优的推测器快1.43倍,仅需语法掩码的成本;在vLLM中也表现领先。由于每条记录均有效,其每GPU秒服务的有效记录数是仅语法基线的13.9倍。

英文摘要:

Speculative decoding speeds up LLM serving by drafting tokens that the target model verifies in one pass, and its gain grows with the drafts the target accepts. Structured outputs should be an ideal case, because much of a record follows from relations among its fields: an itinerary's days follow from its cities' stays and flights. Serving engines, however, draft such text by proposing it from the prompt or a learned head, and their grammar masks enforce only syntax, so the model must satisfy the relations, which it violates: on NATURAL PLAN's trip problems, Qwen3-8B writes a valid itinerary for 10%, and retries that name the violated relation raise this to 14%. We present FactorSpec, which serves exact relational constraints as speculative drafts. FactorSpec compiles a JSON Schema and its relations into a factor graph with an exact feasibility check, drafts every token the constraint determines as certain, verifies each request at a width chosen for it, and computes the masks in worker processes outside the scheduler while the GPU runs. In SGLang, its drafts yield up to 10.5 tokens per verify step, up to 1.9x those of the fastest n-gram drafter, and it decodes up to 1.43x faster than speculators tuned per load, at a grammar mask's cost; it also leads in vLLM. Because every record is also valid, it serves up to 13.9x the valid records per GPU-second of syntax-only baselines.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑