arXiv:2505.17612cs.CLcs.AI2025-05NeurIPS被引 44

让小模型学会用检索和代码工具解决复杂任务

Distilling LLM Agent into Small Models with Retrieval and Code Tools

  • 用大模型的推理路径+检索与代码工具,教小模型完整解题
  • 0.5B小模型在多个任务上媲美3B大模型微调效果
  • 适合想部署轻量级智能体的研究者和开发者

大语言模型在复杂推理任务中表现优异,但计算成本高,难以实际部署。现有方法通过教师模型的思维链轨迹对小语言模型(sLMs)进行知识蒸馏,但在需要罕见事实或精确计算的场景下,小模型因能力有限常产生幻觉。本文提出代理蒸馏框架,将基于大模型的智能体的完整任务求解行为(包括推理、检索与代码工具使用)迁移至小模型。我们从两个方面改进:一是引入“首思前缀”提示策略提升教师生成轨迹质量;二是提出自一致动作生成机制,增强测试时鲁棒性。在八个涵盖事实性与数学领域的推理任务上评估,涵盖域内与域外泛化。结果表明,0.5B、1.5B、3B参数的小模型性能可媲美经思维链蒸馏微调的1.5B、3B、7B大模型,验证了代理蒸馏在构建实用、工具使用型小智能体方面的潜力。代码已开源。

原文摘要 · Abstract (English)

Large language models (LLMs) excel at complex reasoning tasks but remain computationally expensive, limiting their practical deployment. To address this, recent works have focused on distilling reasoning capabilities into smaller language models (sLMs) using chain-of-thought (CoT) traces from teacher LLMs. However, this approach struggles in scenarios requiring rare factual knowledge or precise computation, where sLMs often hallucinate due to limited capability. In this work, we propose Agent Distillation, a framework for transferring not only reasoning capability but full task-solving behavior from LLM-based agents into sLMs with retrieval and code tools. We improve agent distillation along two complementary axes: (1) we introduce a prompting method called first-thought prefix to enhance the quality of teacher-generated trajectories; and (2) we propose a self-consistent action generation for improving test-time robustness of small agents. We evaluate our method on eight reasoning tasks across factual and mathematical domains, covering both in-domain and out-of-domain generalization. Our results show that sLMs as small as 0.5B, 1.5B, 3B parameters can achieve performance competitive with next-tier larger 1.5B, 3B, 7B models fine-tuned using CoT distillation, demonstrating the potential of agent distillation for building practical, tool-using small agents. Our code is available at https://github.com/Nardien/agent-distillation.

模型蒸馏智能体小模型工具使用

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