arXiv:2608.16068cs.CLcs.AI2026-08

让大模型代理更听话:用约束优化提示词,提升任务成功率和合规性。

CAPO: Constraint-Aware Prompt Optimization for LLM Agents

论文配图:CAPO: Constraint-Aware Prompt Optimization for LLM Agents
图 1 · 摘自论文原文
  • 基于池的重写与自适应约束加权,联合优化提示词以满足操作约束。
  • 在多个代理基准上,任务成功率显著提升,且能稳定达到可行操作点。
  • 适用于不同规模模型,尤其适合缺乏标注数据的场景,可快速部署。

大语言模型作为依赖系统提示词调用工具完成任务的智能体,需满足工具使用恰当、提示简洁、路径清晰及安全格式合规等要求。但对多数实践者而言,构建领域专用监督数据进行后训练难以实现。本文提出CAPO(Constraint-Aware Prompt Optimization),一种结合池化重写与自适应约束加权的原始-对偶优化方法,可在显式操作约束下优化系统提示词。在多个代理基准测试中,CAPO 更可靠地达到经验上可行的操作点,并提升任务性能。该方法还可推广至助手类任务,在输出格式、安全与隐私约束下表现优异。进一步提出DCAPO(动态训练的CAPO),通过池化GRPO训练反馈与对偶条件重写器,同时保持任务智能体不变。在不同规模任务智能体上,DCAPO 在所有评估领域均生成可行提示,且任务准确率不低于或优于基线。代理分析揭示了有限池与离散重写误差如何影响不精确的原始-对偶过程。

原文摘要 · Abstract (English)

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.

提示优化大模型代理约束学习自动化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。