Optimal Skill Selection for LLM Agents with Provable Bicriteria Guarantees
让AI编程智能体挑选该装入哪些技能文档,并从数学上保证接近最优的方法
像Codex或Claude Code这样的编程智能体在执行任务时,会把预先写好的技能文档装入容量有限的上下文窗口来获得特定能力,但现有做法只是给每个技能单独打相关性分数、取前几名塞进去,导致重复或无关的技能白白占用宝贵的token空间,甚至拖累表现。研究团队把技能选择重新定义为一个优化问题:在固定的token预算内,最大化覆盖任务所需能力带来的收益,同时扣除上下文长度的代价,并提出了一个多项式时间算法Best Prefix Selection(BPS),首次给出了这类问题可证明的性能保证。在一个经过污染控制的编程基准测试中,BPS的任务成功率达到0.73,超过了现有的技能路由器、文本检索器和智能体自身选择方式(0.20到0.52),同时比表现最强的现有路由器少用28%的token。
他们做了什么
- 编程智能体需要从技能库中挑选文档装入LLM有限的上下文窗口,但现有方法对每个技能独立打分、用取前几名或贪心打包的方式组合,无法保证选出的集合质量或控制成本
- 研究团队构建了一个结构化目标函数:每个技能在若干潜在能力维度上提供供给,每个查询在这些维度上有需求,同一能力维度的重复供给收益递减,而覆盖不同能力维度则互补增益,这个收益再减去与token长度成正比的代价
- 他们设计了BPS算法,先枚举少量种子组合,再按每token收益最高的贪心方式逐步扩展成链条,并记录链条上出现过的每一个可行子集,最后从中选出目标函数值最高的那个
- 研究证明了该算法在多项式时间内达到一种双准则近似保证:收益方面至少达到最优解的(1-1/e)比例,而代价方面完全不打折扣(系数为1),其中收益系数(1-1/e)已是多项式时间算法能达到的最优水平
- 仅用任务成功与否的执行记录拟合模型,就能以99.6%的准确率还原出隐藏的技能-能力对应关系;在污染控制的BigCodeBench变体测试中,BPS取得0.73的成功率,远超现有基线方法的0.20至0.52

| tj | ∈argmaxi∈T∖{t1,⋯,tj−1}G^(i∣{t1,⋯,tj−1}), | (13) | ||
|---|---|---|---|---|
| mj | :=G^(tj∣{t1,⋯,tj−1}),∀j∈[|T|]. |

为什么重要
随着AI智能体所用的技能库/工具库越来越庞大,该往有限上下文里装什么已成为决定任务表现和成本的关键瓶颈,这项研究首次解释了简单的相关性排序为何会失败,并给出了首个有理论保证的选择算法。对于开发智能体框架的人来说,这一原理可以在减少上下文浪费的同时提高任务成功率。
本文术语
- 技能文档(skill document) · 教会LLM智能体如何完成特定任务的可复用说明文件
- 上下文窗口(context window) · LLM一次能处理的最大文本量,以token计量
- 次模函数(submodular function) · 已选项目越多,新增项目带来的边际收益就越小的一类函数
- 双准则近似(bicriteria approximation) · 同时对两个不同目标(这里是收益和成本)分别给出近似比例保证的方法
- 背包约束(knapsack constraint) · 要求所选内容总量不超过固定预算的限制,类似往有限承重的背包里装东西
论文原文摘要(英文)
Loading reusable skill documents into a bounded context window is now the primary way large language model (LLM) agents acquire task-specific capabilities, which makes skill selection a first-order determinant of task performance and token cost. Yet current agents score skills independently by semantic relevance and assemble the set by top-$k$ or greedy packing, with no quality guarantee or cost awareness on the selected set. As a result, redundant or poorly chosen skills waste scarce context tokens and can even degrade performance. We give the first model of how the selected skill set shapes execution outcomes and cast skill selection as an optimization problem: choose a skill set under a hard token budget to maximize a monotone submodular benefit minus context penalty. For this problem, we develop Best Prefix Selection (BPS), a polynomial-time algorithm, and prove, to our knowledge, the first performance guarantee for skill selection: a bicriteria $(1-1/e,1)$ approximation whose benefit coefficient is optimal in polynomial time. On a contamination-controlled BigCodeBench variant, BPS outperforms all the baselines, reaching $0.73$ measured task success versus $0.20$--$0.52$ for released skill routers, text retrievers, and the executor's own selection, on $28\%$ fewer tokens than the strongest released router.
在 arXiv 阅读最新论文
- LoRA-GA$^2$: Low Rank Adaptation with Multi-step Gradient Adaptive Alignment在正式微调前先偷看几步训练的梯度,让LoRA的初始化更聪明
- Remember, Verify, or Ask? Cross-Family Evaluation of Memory Commitment in LLM AgentsAI助手在该向你提问的时候,却更愿意自己去核实事实
- Robust Incomplete Multimodal Sentiment Analysis via Iterative Proxy Correction文本信息缺失或损坏时,这个AI不靠一次性猜测,而是反复修正猜测结果,从而更准确地判断情绪
- Generating Diverse Personas for User Simulators to Test Interview Dialogue Systems要测试访谈式对话系统需要大量不同性格的虚拟用户,这项研究用大语言模型自动生成这些虚拟用户人设
- Rethinking Patch Based Multivariate Time Series Forecasting with Semantic Structured Partitioning别再机械切分时间序列,按语义把它切成有意义的块
- Reliable Financial Named Entity Recognition under Domain ShiftAI在正式文件里学到的自信,一到推特上就变得不可信
- Bringing analytic rigor to agentic AI for science: The Brain Researcher platform for neuroimaging data analysis让AI分析脑影像数据时,把“为什么这个结论可信”也一并记录下来
- GenMatch: An End-to-End Generative Matching Framework for Micro-View Order-Dispatching in Ride-Hailing滴滴把打车派单从预测-计算-匹配三段式流程改成一次生成完成,线上效果提升明显
METAL LAB 最新报道
图片来源: Yu Chen et al., arXiv:2608.19993, cc-by-nc-sa-4.0