用在线学习选最佳编程生成方案,提升成功率并降本。
Online Prompt Selection for Program Synthesis
- 用多臂赌博机动态选最优模型与提示组合。
- 比单个最佳解法多解决37.2%的查询任务。
- 适合不熟悉模型性能的用户快速高效求解。
大型语言模型(LLMs)在程序合成领域表现优异,但其效果并非普遍适用。不同任务、模型和提示方式下,表现差异显著,有时符号求解器反而更优。用户面临的关键挑战是:何时使用LLM、选择哪个模型及如何提示。非专家若选错,将导致结果差、耗时长,甚至产生高昂的API调用成本。本文将此问题建模为在线学习问题,采用多臂赌博机算法,动态选择最优的符号求解器或LLM+提示组合,以最大化奖励函数(如求解速度、任务完成率或成本控制)。我们实现该方法名为CYANEA,评估基于文献中的排名函数合成、语法引导合成竞赛数据集以及由SMT问题生成的新未见查询。实验表明,CYANEA比最佳单一求解器多解决37.2%的查询,且结果接近虚拟最优解的96%。
原文摘要 · Abstract (English)
Large Language Models (LLMs) demonstrate impressive capabilities in the domain of program synthesis. This level of performance is not, however, universal across all tasks, all LLMs and all prompting styles. There are many areas where one LLM dominates, one prompting style dominates, or where calling a symbolic solver is a better choice than an LLM. A key challenge for the user then, is to identify not only when an LLM is the right choice of solver, and the appropriate LLM to call for a given synthesis task, but also the right way to call it. A non-expert user who makes the wrong choice, incurs a cost both in terms of results (number of tasks solved, and the time it takes to solve them) and financial cost, if using a closed-source language model via a commercial API. We frame this choice as an online learning problem. We use a multi-armed bandit algorithm to select which symbolic solver, or LLM and prompt combination to deploy in order to maximize a given reward function (which may prioritize solving time, number of synthesis tasks solved, or financial cost of solving). We implement an instance of this approach, called CYANEA, and evaluate it on synthesis queries from the literature in ranking function synthesis, from the syntax-guided synthesis competition, and fresh, unseen queries generated from SMT problems. CYANEA solves 37.2% more queries than the best single solver and achieves results within 4% of the virtual best solver.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。