arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2312.13382cs.CLcs.AIcs.PL
收藏

DSPy Assertions:用于自优化语言模型流水线的计算约束

DSPy Assertions: Computational Constraints for Self-Refining Language Model Pipelines

University of California, Berkeley(加州大学伯克利分校);Stanford University(斯坦福大学)

Arnav Singhvi, Manish Shetty, Shangyin Tan, Christopher Potts, Koushik Sen, Matei Zaharia, Omar Khattab

AI总结:

该研究提出LM Assertions编程结构并集成到DSPy编程模型,配套编译与推理自优化策略,实验验证其可显著提升LM约束遵从度与下游任务性能。

摘要:

将语言模型(LM)调用以可组合模块的形式串联,正在催生一种全新的编程范式,但要确保LM遵守重要约束,仍依赖启发式的“提示工程”。我们提出了LM Assertions(语言模型断言),这是一种用于表达LM需满足的计算约束的编程结构。我们将该结构集成到近期推出的面向LM的DSPy编程模型中,并提出了新的策略,使DSPy能够将带有LM Assertions的程序编译为更可靠、更准确的系统。我们还提出了在推理阶段利用断言实现LM自动自优化的策略。我们针对文本生成任务开展了四项不同的案例研究,结果表明LM Assertions不仅提升了对既定规则的遵从度,还改善了下游任务性能,约束通过率最高提升164%,高质量响应的生成数量最多增加37%。我们的LM Assertions参考实现已集成到DSPy中,可访问https://github.com/stanfordnlp/dspy获取。

英文摘要:

Chaining language model (LM) calls as composable modules is fueling a new way of programming, but ensuring LMs adhere to important constraints requires heuristic "prompt engineering". We introduce LM Assertions, a programming construct for expressing computational constraints that LMs should satisfy. We integrate our constructs into the recent DSPy programming model for LMs, and present new strategies that allow DSPy to compile programs with LM Assertions into more reliable and accurate systems. We also propose strategies to use assertions at inference time for automatic self-refinement with LMs. We report on four diverse case studies for text generation and find that LM Assertions improve not only compliance with imposed rules but also downstream task performance, passing constraints up to 164% more often and generating up to 37% more higher-quality responses. Our reference implementation of LM Assertions is integrated into DSPy at https://github.com/stanfordnlp/dspy

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

↑