arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.04397cs.SEcs.IR
收藏

上下文即服务:为LLM生成的开发者文档揭示跨文件依赖链

Context-as-AI-Service: Surfacing Cross-File Dependency Chains for LLM-Generated Developer Documentation

Meta Platforms, Inc.(Meta平台公司)

Ameya Gawde, Vyzantinos Repantis, Harshvardhan Singh, Lucy Moys

AI总结:

提出Context-as-a-Service (CaaS)检索层,通过索引代码库并支持关键词与语义搜索,帮助LLM代理在生成或审查文档时追踪跨文件依赖链,实验表明CaaS能发现基线遗漏的错误并减少时间和输入令牌消耗。

摘要:

LLM代理越来越多地编写和维护开发者文档,但其有用性和准确性通常依赖于不易追踪的依赖链。即使有更多文件在上下文中,代理仍需决定追踪哪些跨文件依赖。我们提出Context-as-a-Service (CaaS),这是一个检索层,LLM代理在审查或生成文档时查询它以在整个代码库中寻找证据。CaaS索引源代码、API参考和上游文档,然后使代理能够通过结合关键词和语义搜索的工具调用查询索引。我们在一个生产SDK上使用Claude Sonnet 4.6在两个案例研究中评估CaaS:改进核心源文件中的API参考注释和验证LLM生成的教程。在两个研究中,基线已经拥有普通的仓库工具,如文件读取、关键词搜索和符号导航。CaaS在其上添加了一个检索层,因此比较隔离了添加的检索而非基本的仓库访问。在API参考审查中,CaaS增强的代理产生了与基线相同的5个缺失文档修复,并发现了基线遗漏的4个发现:2个跨文件事实错误和2个未充分说明的API注释。在教程验证中,它发现了一个可执行错误、一个API使用改进和两个基线管道未捕获的缺失前提。这些发现需要跨实用文件、框架内部、使用示例、测试和组件创建逻辑追踪非明显的依赖链。在每种条件下运行五次,添加CaaS在两个任务中减少了22%至34%的挂钟时间,并降低了输入令牌使用量。

英文摘要:

LLM agents increasingly write and maintain developer documentation, but usefulness and accuracy often rely on dependency chains that are not obvious to follow. Even with more files in context, the agent must still decide which cross-file dependencies to trace. We present Context-as-AI-Service (CAIS), a retrieval layer that LLM agents query to find evidence across the codebase as they review or generate documentation. CAIS indexes source code, API references, and upstream documentation, then enables agents to query the index through tool calls that combine keyword and semantic search. We evaluate CAIS in two case studies using Claude Sonnet 4.6 on a production SDK: improving API reference comments in a core source file and validating an LLM-generated tutorial. In both studies, the baseline already had ordinary repository tools such as file reads, keyword search, and symbol navigation. CAIS adds a retrieval layer on top, so the comparison isolates added retrieval rather than basic repository access. In the API-reference review, the CAIS-augmented agent produced the same 5 missing-documentation fixes as the baseline and surfaced 4 findings the baseline missed: 2 cross-file factual errors and 2 underspecified API comments. In the tutorial validation, it surfaced 1 executable bug, 1 API-usage improvement, and 2 missing prerequisites that the baseline pipeline did not catch. These findings required tracing non-obvious dependency chains across utility files, framework internals, usage examples, tests, and component-creation logic. Over five runs per condition, adding CAIS reduced wall-clock time by 22% to 34% across the two tasks and lowered input-token usage.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑