Research Papers 论文研究 5h ago Updated 38m ago 更新于 38分钟前 48

Agents Don't Paginate: First-Chunk Selection for LLM Tool Responses 代理不分页:LLM工具响应的首块选择

LLM coding agents (Claude Code, Cursor, Copilot, Aider) rarely request pagination despite tool responses routinely exceeding per-turn token budgets; session logs show zero agent-initiated second-chunk requests Raising precision-at-1 (p₁)—the rate the needed item appears first in the initial chunk—does not systematically improve downstream agent accuracy, with per-model deltas under 3 percentage points and no statistical significance Adding file-metadata signals to a keyword scorer actually degra 编程代理(如Claude Code、Cursor等)接收的工具响应常超出单轮token预算,但实际日志显示代理几乎从不主动请求分页 提高首chunk中目标项排名(p₁)并不能系统性地提升下游准确率,差异不足3个百分点且无统计显著性 添加文件元数据信号反而降低p₁达4.8个百分点(p=0.001),证明复杂信号可能干扰排序效果 无参数关键词评分器可将p₁从24.2%提升至35.0%(p=3.9×10⁻⁸),但这一排名提升对最终答案无实质影响

65
Hot 热度
72
Quality 质量
68
Impact 影响力

Analysis 深度分析

TL;DR

  • LLM coding agents (Claude Code, Cursor, Copilot, Aider) rarely request pagination despite tool responses routinely exceeding per-turn token budgets; session logs show zero agent-initiated second-chunk requests
  • Raising precision-at-1 (p₁)—the rate the needed item appears first in the initial chunk—does not systematically improve downstream agent accuracy, with per-model deltas under 3 percentage points and no statistical significance
  • Adding file-metadata signals to a keyword scorer actually degrades p₁ by 4.8 p.p. (p = 0.001), suggesting metadata complexity harms simple retrieval
  • A parameter-free keyword scorer significantly improves p₁ from 24.2% to 35.0% (+10.8 p.p., p = 3.9 × 10⁻⁸), but this rank-1 gain does not translate to end-to-end accuracy improvements
  • Agents recover the gold item from anywhere within the first chunk, meaning first-chunk inclusion—not the item's rank within that chunk—is what determines downstream performance

Why It Matters

This research challenges a common assumption in the AI engineering community: that optimizing the ordering of tool responses (putting the most relevant item first) will meaningfully improve agent performance. For practitioners building or tuning coding agents, the findings suggest that efforts should focus on ensuring the relevant information is present within the first chunk rather than expending resources on sophisticated ranking or pagination mechanisms.

Technical Details

  • The study treats first-chunk selection as a 0/1 knapsack problem, comparing six value functions across 500 SWE-bench Verified tasks to evaluate how well different scoring strategies place the gold item first
  • A single-turn file-localisation probe was conducted on five language models with 4,800 LLM calls, measuring p₁ (precision-at-1) as the primary metric for first-chunk quality
  • The keyword scorer is parameter-free and achieves a baseline p₁ of 35.0%, rising to 35.8% with a fallback to the tool's native ordering when no keyword matches are found
  • Four file-metadata signals (added as an enhancement to the keyword scorer) were tested but found to hurt p₁ by 4.8 p.p. with paired significance (p = 0.001)
  • The experimental design explicitly notes this is not an end-to-end resolve-rate test, but rather a focused probe into whether first-chunk ranking quality propagates to downstream accuracy

Industry Insight

  • Agent designers should prioritize ensuring comprehensive first-chunk inclusion over complex ranking algorithms; the marginal cost of chunk expansion may be lower than the engineering effort spent on precision-at-1 optimization
  • Pagination features in tool protocols (like MCP) are effectively dead code for current LLM coding agents, suggesting protocol designers could deprioritize pagination UX and focus on chunk-sizing strategies instead
  • The negative result on metadata enrichment implies that simpler retrieval signals often outperform feature-combined approaches in agent tool-response contexts, a principle that may generalize beyond coding agents to other tool-use scenarios

TL;DR

  • 编程代理(如Claude Code、Cursor等)接收的工具响应常超出单轮token预算,但实际日志显示代理几乎从不主动请求分页
  • 提高首chunk中目标项排名(p₁)并不能系统性地提升下游准确率,差异不足3个百分点且无统计显著性
  • 添加文件元数据信号反而降低p₁达4.8个百分点(p=0.001),证明复杂信号可能干扰排序效果
  • 无参数关键词评分器可将p₁从24.2%提升至35.0%(p=3.9×10⁻⁸),但这一排名提升对最终答案无实质影响

为什么值得看

本文为AI代理系统设计提供了反直觉的实证证据:优化首chunk排序的"排名1"指标并不能转化为实际性能提升,这对当前代理系统的工具响应处理策略具有重要修正意义。研究揭示了代理实际行为与理论假设之间的差距,为后续工具调用优化指明了更务实的方向。

技术解析

  • 研究场景:基于LLM的编程代理(Claude Code、Cursor、OpenAI Codex、GitHub Copilot、Aider)在处理工具响应时面临token预算限制,标准方案是分页,但MCP中间件日志显示零代理主动请求第二chunk
  • 评估指标:定义precision-at-1(p₁)为黄金项在首chunk中排第一的概率,作为核心评估指标
  • 实验设计:将首chunk选择建模为0/1背包问题,在500个SWE-bench Verified任务上比较六种价值函数,并在五个语言模型上进行单轮文件定位测试(共4800次LLM调用)
  • 关键发现:提高p₁对下游准确率无显著影响(各模型差异<3 p.p.,符号不一致,无统计显著性),因为代理能从chunk中任意位置恢复目标项
  • 参数优化结果:无参数关键词评分器将p₁从24.2%提升至35.0%(+10.8 p.p.),加入回退机制后达35.8%,但这一排名提升不转化为实际性能增益

行业启示

  • 重新评估优化目标:当前代理系统过度优化首chunk排序(p₁),但实际代理能从chunk内任意位置提取信息,应转向优化chunk整体包含率而非排名
  • 简化信号策略:添加复杂元数据信号(如文件元数据)反而降低排序效果,提示在工具响应排序中"少即是多",简单启发式方法可能优于复杂模型
  • 关注端到端性能:排名指标(rank-1)与最终代理性能脱节,行业应建立更贴近实际使用场景的评估体系,避免局部优化陷阱

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Agent Agent LLM 大模型 Research 科学研究 Code Generation 代码生成