arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.07295cs.SEcs.LGcs.PL
收藏

IterGen:支持回溯的迭代式语义感知结构化LLM生成

IterGen: Iterative Semantic-aware Structured LLM Generation with Backtracking

University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校)

Shubham Ugare, Rohan Gumaste, Tarun Suresh, Gagandeep Singh, Sasa Misailovic

AI总结:

针对LLM结构化生成库不支持回溯的问题,提出IterGen库,通过符号到位置映射和KV缓存维护实现前后移动的迭代式语法引导生成,有效减少隐私泄露并提升SQL和Vega-Lite查询准确性。

摘要:

大型语言模型(LLM)被广泛用于自然语言和代码生成等任务,但其输出常出现幻觉、毒性和错误结果等问题。当前的结构化LLM生成库依赖从左到右的解码,不支持回溯,限制了在生成过程中纠正或改进输出的能力。为此,我们引入了IterGen,这是一个用户友好的迭代式、语法引导的LLM生成库,允许用户根据语法符号在生成的输出中前后移动。通过利用符号到位置的映射并维护键值(KV)缓存状态,IterGen确保了高效且结构化的生成,同时允许在过程中进行纠正。我们在两个重要应用中展示了IterGen的有效性:减少LLM输出中的隐私泄露,以及提高LLM生成的SQL和Vega-Lite查询的准确性。我们的代码和附加资源可在https://structuredllm.com获取。

英文摘要:

Large Language Models (LLMs) are widely used for tasks such as natural language and code generation, but their outputs often suffer from issues like hallucination, toxicity, and incorrect results. Current libraries for structured LLM generation rely on left-to-right decoding without support for backtracking, limiting the ability to correct or refine outputs mid-generation. To address this, we introduce IterGen, a user-friendly library for iterative, grammar-guided LLM generation that enables users to move both forward and backward within the generated output based on grammar symbols. By leveraging a symbol-to-position mapping and maintaining the key-value (KV) cache state, IterGen ensures efficient and structured generation while allowing for corrections during the process. We demonstrate IterGen's effectiveness in two important applications: reducing privacy leakage in LLM outputs and improving the accuracy of LLM-generated SQL and Vega-Lite queries. Our code and additional resources are available at https://structuredllm.com.

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

↑