动态挑选最相关示例,提升大模型代理推理稳定性与效率
DICE: Dynamic In-Context Example Selection in LLM Agents via Efficient Knowledge Transfer
- 基于因果分析分解示例知识,区分可迁移与不可迁移部分
- 每步推理动态选择最优示例,理论保证性能提升
- 无需训练即可接入现有框架,适用多种任务场景
基于大语言模型的智能体通过上下文学习(ICL)在复杂推理和工具使用任务中表现出强大能力。然而,现有研究表明,ICL效果高度依赖示范样本的选择,不当示例常导致性能不稳定甚至下降。尽管已有研究探索过示例选择,但多采用启发式或任务特定设计,缺乏跨推理步骤的通用、理论基础判断标准。为此,本文提出DICE:一种针对智能体任务的动态上下文示例选择框架,从因果视角将示范知识分解为可迁移与不可迁移成分,揭示后者可能引入虚假依赖而损害泛化能力。我们进一步提出分步选择准则,并提供性能提升的理论保证。DICE是通用、框架无关的解决方案,可作为无额外训练成本的插件模块集成至现有智能体系统。在多个领域上的大量实验验证了方法的有效性与普适性,凸显了有原则、上下文感知的示例选择对鲁棒高效大模型代理的重要性。
原文摘要 · Abstract (English)
Large language model-based agents, empowered by in-context learning (ICL), have demonstrated strong capabilities in complex reasoning and tool-use tasks. However, existing works have shown that the effectiveness of ICL is highly sensitive to the choice of demonstrations, with suboptimal examples often leading to unstable or degraded performance. While prior work has explored example selection, including in some agentic or multi-step settings, existing approaches typically rely on heuristics or task-specific designs and lack a general, theoretically grounded criterion for what constitutes an effective demonstration across reasoning steps. Therefore, it is non-trivial to develop a principled, general-purpose method for selecting demonstrations that consistently benefit agent performance. In this paper, we address this challenge with DICE, Dynamic In-Context Example Selection for LLM Agents, a theoretically grounded ICL framework for agentic tasks that selects the most relevant demonstrations at each step of reasoning. Our approach decomposes demonstration knowledge into transferable and non-transferable components through a causal lens, showing how the latter can introduce spurious dependencies that impair generalization. We further propose a stepwise selection criterion with a formal guarantee of improved agent performance. Importantly, DICE is a general, framework-agnostic solution that can be integrated as a plug-in module into existing agentic frameworks without any additional training cost. Extensive experiments across diverse domains demonstrate our method's effectiveness and generality, highlighting the importance of principled, context-aware demo selection for robust and efficient LLM agents.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。