用AI自动生成和优化代码库索引,让大模型找代码更准。
Libra: Training the Environment for Agentic Information Retrieval

- 通过大模型生成查询并修复索引,实现环境自动进化。
- 在12个代码库上使定位准确率持续提升,对数级增长。
- 优化后的索引可零样本适配不同模型和任务。
在大规模代码库中精确定位信息是智能体式大模型系统的核心挑战。尽管基于合成数据的训练已成功用于优化大模型,但对智能体工作环境(即代码库本身)的数据驱动优化仍关注不足。为此,我们提出Libra,一种自演化的框架,将可变的‘目录’(作为可导航索引的层级化Markdown文件)引入代码库。Libra运行一个由大模型驱动的优化循环:提示生成器产生合成查询,冻结的求解器通过导航目录尝试解答,而修复器则根据求解失败情况重写目录。在12个SWE-bench Lite代码库上的评估表明,这种环境修复带来了持续且对数级的代码定位准确率提升。此外,这些环境改进可零样本迁移至不同大模型和问题集。虽然本文重点研究该系统的通用行为,但也证明,仅配备Libra优化目录的极简编码智能体性能超越现有最优基线。代码与数据已在GitHub及Hugging Face公开。
原文摘要 · Abstract (English)
Information localization within massive repositories is a cornerstone of agentic LLM systems. While synthetic data-driven optimization has proven successful in training LLMs, little attention has been paid to optimizing the agent's working environment (the repository itself) in a data-driven manner. To bridge this gap, we present Libra, a self-evolving framework that introduces mutable "catalogs" (hierarchical Markdown files serving as navigable indices) into the repository. Libra runs an LLM-driven optimization loop where a Prompter generates synthetic queries, a frozen Solver attempts to resolve them by navigating the catalogs, and a Healer rewrites the catalogs in response to the Solver's localization failures. Evaluations across 12 SWE-bench Lite repositories demonstrate that this environmental healing yields continual, logarithmic improvements in code localization accuracy. Furthermore, these environmental improvements transfer zero-shot across different LLMs and problem sets. Although the focus of this paper is to study the general behavior of such a system, we also demonstrate that a minimalist coding agent equipped with Libra-optimized catalogs outperforms state-of-the-art baselines. Code is available at https://github.com/salesforce-misc/Libra and data at https://huggingface.co/datasets/Salesforce/Libra.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。