高召回配置反而降低代码修复成功率,揭示了检索优化的陷阱。
The Recall Trap: A Recall-Maximizing Retriever Configuration Reduces Issue Resolution in Fixed-Budget Code Context
- 通过固定上下文槽位,对比去重开关对代码修复的影响。
- 关闭文件去重后,单次修复率提升7.6个百分点(39.2%→46.8%)。
- 提示工程师应按任务目标而非检索指标调整配置。
代码助手中的检索组件通常以召回率@k为优化目标,但下游任务表现未必随之提升。本文在SWE-bench Verified上开展受控实验,将检索结果固定为12个槽位的上下文包,禁用搜索工具,仅切换一个标志(每文件仅保留一个块的去重)。该标志开启时召回率更高(0.878 vs 0.806),但关闭后修复成功率反而上升:gpt-5.6-sol提升7.6个百分点(39.2%→46.8%,n=500,McNemar精确p=0.0003),Qwen3.6-27B复现也提升3.6个百分点(n=499,p=0.0133),且在仓库分组推理下依然有效。效果与块内锚点密度相关,随机抽样控制排除了选择偏差。该现象在词法BM25检索器上逆转(-3.2pp),在无限制读取代理中未出现,跨四语言测试(SWE-PolyBench, N=617)中虽呈正向但不显著(+2.6pp, p=0.056),表明存在边界而非普遍适用。在固定预算下,建议避免硬性按文件去重,并根据任务设计A/B策略,而非盲目追求检索指标。
原文摘要 · Abstract (English)
Retrieval components for code assistants are tuned against retrieval metrics: a configuration that raises recall@k is adopted, and downstream task success is assumed to follow. We report a controlled case study in code repair, not a new phenomenon but a deployed-flag, execution-graded instance of the known relevance-diversity and objective-mismatch tradeoff (Levy et al., 2025). On SWE-bench Verified we inject a retriever's hits as a fixed 12-slot context pack with no search tools and toggle one flag (one-chunk-per-file deduplication) on an otherwise identical stack. The flag is the higher-recall configuration (gold file present in 0.878 of served packs against 0.806 disabled), yet disabling it, trading file breadth for within-file depth, raises the single-shot resolve rate: gpt-5.6-sol +7.6pp (39.2% to 46.8%, n=500, McNemar exact p=0.0003), and a pre-registered open-weights replication any reviewer can re-run (Qwen3.6-27B, +3.6pp, n=499, p=0.0133); both survive repository-clustered inference. The gain tracks within-file anchor dose, and a random-chunk control refutes an argmax-selection artifact. We map where it holds: it reverses on a lexical BM25 retriever (-3.2pp, significant cross-paradigm interaction), is not detected under unrestricted-Read agents (a powered null), and across four languages (SWE-PolyBench, N=617) is positive but not significant (+2.6pp, p=0.056), a mapped boundary rather than a confirmed extension. Operationally, at a tight fixed budget: do not hard-deduplicate by file, and A/B packing policies against the task, not the metric the flag was tuned to.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。