用检索代替动态生成,低成本构建专业大模型代理
LLM Agents Factory: Retrieval of Domain-Specific LLM Agents

- 从2万多个预设代理中通过语义搜索匹配所需角色
- 在MMLU等数据集上准确率超越非代理基线,推理成本降低120倍
- 适合工业级应用,兼顾效率与可控性
大型语言模型代理通过将任务分解为专业化角色行为提升性能,但实时设计代理存在计算开销大、不稳定的问题。为此,我们提出LLM Agents Factory,一个基于检索的框架,利用超过2万条预先定义的代理档案,按需构建领域特定且基于维基百科的代理。该框架支持两种模式:(1) 通过语义搜索检索代理档案;(2) 将其蒸馏为轻量级微调模型,直接生成代理。在单代理场景下对MMLU、BIG-bench和BIG-bench Hard的实验表明,我们的检索式代理构建方法在准确性上超越非代理基线,并在使用1200亿参数骨干模型时达到AutoGen的生成质量,但推理成本显著降低。研究揭示,从结构化代理库中检索是动态生成的高效、准确且可控替代方案,满足工业应用严苛需求。代码与代理库已开源于https://huggingface.co/frontier-ai/llm-agent-factory。
原文摘要 · Abstract (English)
Large language model (LLM) agents improve task performance by decomposing problems into role-specialized behaviors. However, their practical deployment is often limited by the computational cost and instability associated with the on-the-fly agent design for each user request. To address this, we present LLM Agents Factory, a retrieval-based framework that constructs domain-specific and Wikipedia-grounded agents on demand using a base of over 20K predetermined agent profiles. Our framework supports two modes: (1) agent profile retrieval via semantic search and (2) distillation into a compact model fine-tuned for direct agent generation. Experiments on MMLU, BIG-bench, and BIG-bench Hard in a single-agent scenario demonstrate that our retrieval-based agent construction surpasses non-agent baselines in accuracy while matching AutoGen generation quality with a 120B backbone at a substantially lower inference cost. Our work reveals that retrieval from a structured agent repository provides a cost-efficient, accurate, and controllable alternative to dynamic agent generation, responding to the strict demands of industrial applications. We provide the implementation code and the agent base in https://huggingface.co/frontier-ai/llm-agent-factory.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。