arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2605.14362cs.SEcs.AI
收藏

在最大有效上下文窗口约束下的正确性感知仓库过滤

Correctness-Aware Repository Filtering Under Maximum Effective Context Window Constraints

Independent Researcher(独立研究者)

Shweta Mishra

AI总结:

本文提出一种正确性感知的上下文卫生框架,通过预执行的大小基 heuristic 过滤器在 tokenization 前拦截仓库扫描,实现低开销的上下文优化,提升代码分析准确性。

摘要:

上下文窗口效率是基于大语言模型(LLM)的开发者工具中的实际限制。Paulsen [12] 显示,所有测试模型在达到其宣传的上下文限制之前都会在准确性上下降,这使上下文构建成为一个质量问题,而不仅仅是成本问题。现代软件仓库通常包含大量非代码艺术制品,如编译数据集、二进制模型权重、压缩的 JavaScript 包和数GB的日志文件,这些内容会超出上下文窗口并推挤任务相关的源代码。我们提出了一个正确性感知的上下文卫生框架:一个预执行、基于大小的启发式过滤器,在 tokenization 之前拦截仓库扫描,仅使用操作系统级别的 stat() 元数据,具有亚毫秒级的开销。语义检索方法如 RepoCoder、GraphRAG 和基于 AST 的分块需要索引构建和查询时间推理才能做出任何过滤决策。相比之下,我们的框架不需要索引,并且每文件的运行时间低于 0.01 毫秒。在 10 个真实的开源仓库(22,046 个文件,5 种语言)上,所提出的 SizeFilter 在 θ=1 MB 时实现了 79.6%(±13.2%)的平均 token 减少,开销为 0.30 毫秒:HybridFilter 实现了 89.3%(±9.0%)的最低方差。对 2,688 个文件的 token 密度研究确认了强线性相关性(Pearson r=0.997,k=0.250 tokens/byte)。有限范围的评估(18 个任务,CodeLlama-7B-Instruct)显示,过滤后的文件级准确性为 72%,而基准下为 25%;幻觉频率从 61% 降至 17%。所有代码和数据都已发布以供可重复性。

英文摘要:

Context window efficiency is a practical constraint in large language model (LLM)-based developer tools. Paulsen [12] shows that all tested models degrade in accuracy well before their advertised context limits the Maximum Effective Context Window (MECW) which makes context construction a quality problem, not just a cost one. Modern software repositories routinely contain large non-code artifacts compiled datasets, binary model weights, minified JavaScript bundles, and gigabyte-scale log files that overflow the context window and push out task-relevant source code. We present a correctness-aware context hygiene framework: a pre-execution, size-based heuristic filter that intercepts repository scans before tokenization, using only OS-level stat() metadata with sub-millisecond overhead. Semantic retrieval approaches such as RepoCoder, GraphRAG, and AST-based chunking require index construction and query-time inference before any filtering decision is reached. Our framework, by contrast, requires no indexing and operates at <0.01 ms per file decision. Across 10 real open-source repositories (22,046 files, 5 languages), the proposed SizeFilter at θ=1 MB achieves 79.6% (\pm13.2%) mean token reduction at 0.30 ms overhead: the HybridFilter achieves 89.3% (\pm9.0%) the lowest variance of any filter evaluated. A token-density study across 2,688 files confirms a strong linear correlation (Pearson r=0.997, k=0.250 tokens/byte). A limited-scope evaluation (18 tasks, CodeLlama-7B-Instruct) yields 72% file-level accuracy under filtering versus 25% at baseline; hallucination frequency declines from 61% to 17%. All code and data are released for reproducibility.

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

↑