arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.12926cs.AI
收藏

迈向更具上下文能力的智能体:一种 Extractor-Generator 优化框架

Towards more Contextual Agents: An extractor-Generator Optimization Framework

CGI(CGI公司);CNRS(法国国家科学研究中心)

Mourad Aouini, Jinan Loubani

AI总结:

针对 LLM 智能体在专业领域缺乏上下文知识、手工优化提示词成本高的问题,提出 Extractor-Generator 框架,自动提取示例特征并迭代改进提示词,显著提升上下文适应与任务性能。

摘要:

基于大型语言模型(LLM)的智能体已在各类通用应用中解决复杂任务方面取得显著成功。然而,其性能在特定上下文场景中往往会下降,例如专业行业或研究领域;在这些场景中,缺乏领域相关知识会导致结果不精确或次优。为应对这一挑战,本文提出一种系统性方法,通过优化底层提示词来增强基于 LLM 的智能体的上下文适应能力;提示词是控制智能体行为、角色和交互的关键组件。为特定上下文任务手工编写优化提示词既耗费人力、容易出错,又缺乏可扩展性。在本文中,我们提出一个 Extractor-Generator 框架,旨在自动化优化具备上下文能力的基于 LLM 的智能体。该方法通过两个关键阶段运行:(i)从包含金标准输入-输出示例的数据集中提取特征;(ii)通过高层优化策略生成提示词,该策略迭代识别表现不佳的案例并应用自我改进技术。该框架使提示词能够在多样化输入上实现更精确的泛化,从而显著提升提示词适应性,尤其适用于特定上下文任务;在这些任务中,保持语义一致性并最小化错误传播对于可靠性能至关重要。尽管该方法最初是围绕单阶段工作流开发的,但它可以自然扩展到多阶段工作流,从而在各类基于智能体的系统中具有广泛适用性。实证评估表明,我们的框架显著提升了经过提示词优化的智能体性能,为具备上下文能力的基于 LLM 的智能体提供了一种结构化且高效的方法。

英文摘要:

Large Language Model (LLM)-based agents have demonstrated remarkable success in solving complex tasks across a wide range of general-purpose applications. However, their performance often degrades in context-specific scenarios, such as specialized industries or research domains, where the absence of domain-relevant knowledge leads to imprecise or suboptimal outcomes. To address this challenge, our work introduces a systematic approach to enhance the contextual adaptability of LLM-based agents by optimizing their underlying prompts-critical components that govern agent behavior, roles, and interactions. Manually crafting optimized prompts for context-specific tasks is labor-intensive, error-prone, and lacks scalability. In this work, we introduce an Extractor-Generator framework designed to automate the optimization of contextual LLM-based agents. Our method operates through two key stages: (i) feature extraction from a dataset of gold-standard input-output examples, and (ii) prompt generation via a high-level optimization strategy that iteratively identifies underperforming cases and applies self-improvement techniques. This framework substantially improves prompt adaptability by enabling more precise generalization across diverse inputs, particularly in context-specific tasks where maintaining semantic consistency and minimizing error propagation are critical for reliable performance. Although developed with single-stage workflows in mind, the approach naturally extends to multi-stage workflows, offering broad applicability across various agent-based systems. Empirical evaluations demonstrate that our framework significantly enhances the performance of prompt-optimized agents, providing a structured and efficient approach to contextual LLM-based agents.

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

↑