← 首页|学术|CAPO: Constraint-Aware Prompt Optimization for LLM Agents
cs.CL, cs.AI · 2608.16068 · 2026/08/17

CAPO: Constraint-Aware Prompt Optimization for LLM Agents

Dong, Victor Ye, Pryzant, Reid, Liu, Yi, Jiao, Jian
TL;DR:CAPO 用原-对偶方法把系统提示词当作可优化对象:池化改写 + 自适应约束加权,在显式操作约束(工具使用、简洁、安全/格式策略)下优化 prompt;无需领域监督数据做 post-training。

🎯 问题

agent 部署对系统提示词有硬性操作约束(正确用工具、prompt 与解法路径简洁、符合安全与格式策略),但多数实践者没有领域监督数据去 post-train 模型满足这些约束。

🔬 方法

CAPO(Constraint-Aware Prompt Optimization):池化改写 + 自适应约束加权的原-对偶方法;把约束违反作为显式项迭代优化系统提示词;可推广到 assistant 式评测与输出长度控制。
章节结构(全文标题提取):
1 Introduction
2 Related Work
3 Threshold-Constrained Prompt Optimization
4 Capo: Primal–Dual Search with a Frozen Rewriter
5 DCAPO: Learning the Rewriter
6 Surrogate Analysis of Discrete Rewrites
7 Experiments
8 Limitations
9 Conclusion

📊 结果

在 agentic benchmark 上更可靠到达经验可行的工作点,同时提升任务性能;对输出约束类任务也有效。

💡 与研究方向关联

系统提示词层的「约束满足」优化——agent 部署工程里不重新训练、只调 prompt 的务实路线;对 duplex 场景下「既要实时响应又要遵守安全/格式策略」的双重约束有迁移价值。

📝 原文摘要

▶ 原文摘要 Abstract
Large language models (LLMs) are increasingly deployed as agents that rely on system prompts to use tools and complete tasks. Such deployments impose distinct operational requirements, including appropriate tool use, concise prompts and solution paths, and compliance with safety and formatting policies. For many practitioners, however, assembling domain-specific supervised data to post-train models to meet these requirements is infeasible. We introduce CAPO (Constraint-Aware Prompt Optimization), a primal-dual method that combines pool-based rewrites with adaptive constraint weighting to optimize system prompts under explicit operational constraints. Across agentic benchmarks, CAPO more reliably reaches empirically feasible operating points while improving task performance. CAPO also generalizes beyond agentic settings, achieving strong results on assistant-style evaluations with output-format and safety/privacy constraints. We further introduce DCAPO (Dynamically Trained CAPO), which trains a feedback- and dual-conditioned rewriter with pool-based GRPO while keeping the task agent frozen. Across task agents of different sizes, DCAPO produces a feasible prompt in every evaluated domain and matches or improves the task accuracy achieved by the evaluated baselines. A surrogate analysis characterizes how finite-pool and discrete-rewrite errors enter the inexact primal-dual procedure.
Deep Read · 2026-08-19高松灯 / Agent 日报 · Agent 架构与推理
Prompt优化约束优化原对偶系统提示词