用动态示范提升大模型在决策任务中的表现,效果媲美训练过的专用模型。
Leveraging In-Context Learning for Language Model Agents
- 通过大模型重试机制自动标注智能体任务的解题轨迹,实现高效数据生成。
- 选择相似任务的轨迹作为示范,使模型性能、可靠性与效率显著提升。
- 用小片段替代完整轨迹示范,大幅降低推理开销,适合资源受限场景。
上下文学习(ICL)结合动态选择的示范,将大语言模型(LLMs)的提示灵活性与训练数据利用能力相结合。尽管在预测和生成任务中表现优异,但在需要序列决策的智能体任务中应用仍具挑战——不仅需规模化标注长轨迹、选择示范,还需明确示范内容及展示时机与位置。为此,我们提出一种算法:利用带重试的大模型自动高效标注智能体任务的解题轨迹。实验表明,选择相似任务的轨迹作为示范,能显著提升模型性能、可靠性、鲁棒性与效率。然而,完整轨迹示范带来较大推理开销。我们发现,每步仅使用小段轨迹片段即可有效缓解该问题。此外,由大模型生成的示范可提升小模型表现,甚至使基于ICL的智能体媲美更昂贵的训练型智能体。结果表明,经合理设计,ICL同样适用于复杂智能体任务。
原文摘要 · Abstract (English)
In-context learning (ICL) with dynamically selected demonstrations combines the flexibility of prompting large language models (LLMs) with the ability to leverage training data to improve performance. While ICL has been highly successful for prediction and generation tasks, leveraging it for agentic tasks that require sequential decision making is challenging -- one must think not only about how to annotate long trajectories at scale and how to select demonstrations, but also what constitutes demonstrations, and when and where to show them. To address this, we first propose an algorithm that leverages an LLM with retries along with demonstrations to automatically and efficiently annotate agentic tasks with solution trajectories. We then show that set-selection of trajectories of similar tasks as demonstrations significantly improves performance, reliability, robustness, and efficiency of LLM agents. However, trajectory demonstrations have a large inference cost overhead. We show that this can be mitigated by using small trajectory snippets at every step instead of an additional trajectory. We find that demonstrations obtained from larger models (in the annotation phase) also improve smaller models, and that ICL agents can even rival costlier trained agents. Thus, our results reveal that ICL, with careful use, can be very powerful for agentic tasks as well.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。