跳到正文
EasyXiv 检索
投稿 关于 登录

按回车检索 · 直接输入编号(如 1706.03762)可跳转到论文

计算机科学 > 计算与语言

arXiv:2407.08103 (cs)
[提交于 2024年7月11日 (v1),最后修订于 2024年7月12日 (此版本, v2)]

标题:Automata-based constraints for language model decoding

作者:Terry Koo, Frederick Liu, Luheng He
查看论文《Automata-based constraints for language model decoding》的 PDF
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读
摘要:Language models (LMs) are often expected to generate strings in some formal language; for example, structured data, API calls, or code snippets. Although LMs can be tuned to improve their adherence to formal syntax, this does not guarantee conformance, especially with smaller LMs suitable for large-scale deployment. In addition, tuning requires significant resources, making it impractical for uncommon or task-specific formats. To prevent downstream parsing errors we would ideally constrain the LM to only produce valid output, but this is severely complicated by tokenization, which is typically both ambiguous and misaligned with the formal grammar. We solve these issues through the application of automata theory, deriving an efficient closed-form solution for the regular languages, a broad class of formal languages with many practical applications, including API calls or schema-guided JSON and YAML. We also discuss pragmatic extensions for coping with the issue of high branching factor, and extend our techniques to deterministic context-free languages, which similarly admit an efficient closed-form solution. Previous work on this topic (Willard and Louf, 2023) layers bespoke solutions onto automata, leading to problems with speed, correctness, and extensibility. Instead, we reformulate the entire task in terms of automata so we can leverage well-studied and well-optimized algorithms. Our system compiles constraints ~7,000x faster, is provably correct, and can be extended in a modular fashion.
评论: COLM 2024 Camera-ready version, responding to feedback from reviewers
主题: 计算与语言 (cs.CL); 形式语言与自动机理论 (cs.FL)
引用方式: arXiv:2407.08103 [cs.CL]
  (或者 arXiv:2407.08103v2 [cs.CL] 对于此版本)
  https://doi.org/10.48550/arXiv.2407.08103

提交历史

来自:Terry Koo
[v1] 2024年7月11日 星期四 00:25:01 UTC
[v2] 2024年7月12日 星期五 01:02:43 UTC
全文链接:

访问论文:

  • 查看原文 PDF
  • 中文 PDF (下批处理)
  • EasyResearch 阅读
  • TeX 源文件
  • arXiv 原文页面
查看许可

当前浏览上下文:

cs.CL
< 上一篇   |   下一篇 >
最新 | 近期 | 2024-07
切换浏览方式为:
cs
cs.FL

参考文献与引用

  • Google Scholar
  • Semantic Scholar

BibTeX 格式的引用

EasyXiv 是独立运营的中文预印本站点,与 arXiv 及康奈尔大学无隶属关系。 论文元数据与原文来自 arXiv.org,感谢 arXiv 提供开放获取服务。
关于 · 帮助 · 投稿指南 · 版权 · arXiv 原站