IdleSpec: Exploiting Idle Time via Speculative Planning for LLM Agents

agent 2605.22154
speculative-planningidle-time-computeagent-inferencethompson-samplingtool-usetest-time-scaling

§1 TL;DR #

IdleSpec 在 LLM Agent 工具执行等待期间并行运行推测性规划(progressive + recovery 双策略),通过 Thompson 采样自适应选择策略并在 observation 到达后以 reference 方式聚合 draft candidates。GAIA+FRAMES 上 Gemini-2.5-Flash 达 55.6% 平均准确率(+5.1%),MLE-Bench Any Medal 率 +9.1%,延迟开销接近零。

§2 Q1 / Q2 / Q3 #

Q1 痛点: LLM Agent 多步推理循环中,工具执行(web 搜索、代码运行、API 调用)产生大量等待时间(idle time)。以 MLE-Bench 为例,工具执行时间是推理时间的 12.5× 以上(Figure 2(a))。现有方法要么将 idle time 视为不可避免的开销(vanilla agent),要么提出受限方案:Sleep-Time Compute 仅利用了 GAIA 上 13.7% 的 idle time 且假设未来查询可预测,在小模型上反而导致性能下降(Qwen3.5-4B: 33.2→29.4)。单模式推测方法(Speculative Agent Execution、Interactive Speculation)假设当前轨迹将成功,不处理 observation uncertainty。

Q2 方法: IdleSpec 通过三阶段循环利用 idle time:(a) Idle-Time Drafting — 工具执行期间迭代生成 plan candidates,从 Beta 分布 Thompson 采样选择 Progressive(假设 observation 成功,推进当前路径)或 Recovery(假设当前路径失败,探索替代方案)策略;(b) Draft Aggregation — observation 到达后,将所有 candidates 作为 reference(非硬约束)聚合进下一步推理;(c) Posterior Update — binary forecast 信号更新 Beta 分布 $(\alpha, \beta)$,使策略分布逐步适应任务状态。

核心技术壁垒: 将 observation uncertainty 建模为 exploitation-exploration 问题并用 Beta-Bernoulli Thompson sampling 求解。关键洞察是 idle time 期间无法预知 observation 结果(可能成功也可能失败),因此需同时准备两种 draft。单一策略均表现不佳(Table 6(a): Prog-only 44.7 vs Rec-only 44.0 vs dual 48.2),缺乏对 observation uncertainty 的覆盖。Thompson sampling 相比 random(63.3)和 direct forecast(60.7)更优(65.3),其随机探索成分避免了 forecast 错误的放大。

Q3 结果: 跨三个 benchmark(GAIA、FRAMES、MLE-Bench)和三种模型(Gemini-2.5-Flash、Gemma4-E4B、Qwen3.5-4B)一致性提升。Gemini-2.5-Flash 平均 +5.1%,Qwen3.5-4B +6.8%,Gemma4-E4B +4.6%。MLE-Bench Any Medal 率 36.4→45.5%(+9.1%)。延迟开销接近 1×(idle tokens 与工具执行并行生成,不占用关键路径)。

§3 架构 / 方法图 #

Figure 1: IdleSpec overview — three-phase speculative planning loop

Paper Figure 1: IdleSpec 三阶段概览。左侧 Idle-Time Drafting 展示 agent 在等待 observation 期间从策略分布中采样 Progressive/Recovery 策略并生成 plan candidates;中间 Plan Candidate Set 收集所有 drafts;右侧 Draft Aggregation 在 observation 到达后聚合 candidates 生成下一步 action 并输出 forecast 信号。Strategy Sampling with Posterior Updates 闭环连接 forecast → 策略分布更新。

IdleSpec 的核心循环分解为三个阶段:

Phase (a) Idle-Time Drafting: Agent 发起工具调用后进入等待。IdleSpec 启动迭代 drafting:每轮从当前 $\mathrm{Beta}(\alpha, \beta)$ 分布采样 $\hat{p}$,若 $\hat{p} > 0.5$ 选择 Progressive 策略,否则选择 Recovery 策略。Progressive prompt 要求模型假设当前工具调用成功并规划下一步;Recovery prompt 要求模型假设当前路径受阻并提出替代方案。Drafting 持续到工具返回 observation(idle-aware termination),最终得到候选集:

$$\mathcal{D}_{\text{final}} = \mathcal{D}_{\text{prog}} \cup \mathcal{D}_{\text{rec}}, \quad |\mathcal{D}_{\text{final}}| \leq K = 5$$

Phase (b) Draft Aggregation: Observation 到达后,agent 将全部 candidates 作为 reference 输入(非强制约束),由模型自主综合或改进,生成最终 action。Reference-based 聚合显著优于 Best-of-N(59.3)和 Mandatory(57.3)方式(Reference: 65.3, Table 6(b))。

Phase (c) Posterior Update: 每步结束后,agent 生成 binary forecast $\ell \in \{\text{Prog}, \text{Rec}\}$,据此更新 Beta 后验:

$$(\alpha, \beta) \leftarrow \begin{cases} (\alpha+1, \beta), & \text{if } \ell = \text{Prog} \\ (\alpha, \beta+1), & \text{if } \ell = \text{Rec} \end{cases}$$

初始化 $\alpha = \beta = 1$(uniform prior)。这是标准的 Beta-Bernoulli 共轭更新 + Thompson sampling,自然平衡 exploitation 与 exploration。

Figure 2: Idle time analysis across benchmarks

Paper Figure 2: (a) 工具执行时间占总时间 81%–92.6%,远超推理时间;(b) 单次工具调用时长呈长尾分布,均值约 7s reasoning time 虚线左侧仍有大量可用 budget;(c) 三种 idle-time 策略对比,仅 Planning 在所有难度级别上一致优于 vanilla。

Figure 2(a) 的关键发现:idle time 在三个 benchmark 上占据绝对主导(81%–92.6%),这是 IdleSpec 能够工作的物理前提。Figure 2(c) 直接支持方法选择——Summarization 和 Reflection 在 observation 到达前提交了不完整的解释(reflection 在 GAIA L3 上甚至显著低于 vanilla),而 Planning 通过条件化表述("if A holds, do X; otherwise Y")天然容忍 uncertainty。

§4 作者证明 #

无形式化作者证明 — 仅实证。

IdleSpec 没有 formal convergence 或 success-rate guarantee。Beta-Bernoulli Thompson sampling 的 regret bound 由经典 bandit 文献保证,但论文未将其扩展到 agent task 的 success-rate model。以下为 6 项验证性检查:

#检查项结果
1Planning 优于其他 idle-time 策略Figure 2(c): Planning 在所有 GAIA 难度级别和 avg 上均 ≥ vanilla;Summarization/Reflection 在 L3 显著下降
2Dual drafting 优于 single-modeTable 6(a): Prog+Rec 48.2 avg vs Prog-only 44.7 vs Rec-only 44.0
3Reference 聚合优于替代方案Table 6(b): Ref 65.3 vs Best-of-N 59.3 vs Mandatory 57.3
4Thompson sampling 优于替代选择策略Table 6(c): Adaptive 65.3 vs Random 63.3 vs Forecast-Direct 60.7
5跨模型一致性Table 1: Gemini-2.5-Flash +5.1%, Gemma4-E4B +4.6%, Qwen3.5-4B +6.8% — 增益方向一致
6Idle time 长度与增益正相关Table 5: Low ultra-short group +7.0%, Medium +6.0%, High +0.0% — 单调关系成立

可被形式化的方向:给定 observation uncertainty 模型(e.g. 工具返回的成功概率分布),证明 progressive/recovery 混合策略的 regret bound 优于 pure strategy。

Agent 维度补充:

§5 实验与数据 #

主实验:GAIA + FRAMES #

Table 1: Results on General Agent Benchmarks

Paper Table 1: 三种模型在 GAIA(L1/L2/L3)和 FRAMES 上的准确率(%)。IdleSpec(绿色高亮行)在所有 model × benchmark 组合上取得最优。

核心数据点:

Sleep-Time Compute 在 Qwen3.5-4B 上的失败机制:该方法在 idle time 期间自由生成 auxiliary context,小模型容易产生 hallucination 并传播到后续推理链。IdleSpec 的 reference-based 聚合机制使模型可以忽略低质量 draft,避免了 hallucination 传播。

MLE-Bench(长 horizon 任务) #

MLE-Bench Lite(22 competitions,24h budget/task,Gemini-2.5-Flash): IdleSpec 实现 Any Medal 率 45.5%(Vanilla 36.4,+9.1%)。Made Submission 率从 86.4% 提升至 95.5%,Valid Submission 从 77.3% 至 86.4%。Sleep-Time Compute 在 Gold 率上反而低于 Vanilla(13.6% vs 18.2%),总 medal 率无提升。IdleSpec 在 execution-heavy 场景(代码运行延迟远超推理时间)尤为有效,因为 idle time budget 充裕。

延迟-准确率权衡 #

Figure 3: Latency-Accuracy trade-off on Pareto frontier

Paper Figure 3: Pareto 图(vLLM, NVIDIA A6000)。IdleSpec(绿色星形)位于左上角 Pareto 前沿——准确率最高且延迟接近 1.00×。Sequential Revision 和 Planning 的准确率提升伴随 1.25–1.33× 延迟。Sleep-Time Compute 延迟 ~1× 但准确率低于 Vanilla。

IdleSpec 在 GAIA L2(Qwen3.5-4B)上生成 5284 idle-time tokens/step,但这些 tokens 与工具执行并行生成——关键路径延迟不增加。Test-time tokens 从 7126(Vanilla)降至 5966,draft reference 减少了后续推理的探索负担。

消融实验 #

Table 6: Ablation studies — drafting strategy, aggregation, selection

Paper Table 6: (a) 策略消融 — dual drafting 比 single-mode 高 3.5–4.2 avg;(b) 聚合方式 — Reference 最优;(c) 选择策略 — Thompson sampling 最优。

三组消融的关键结论:

兼容性验证(Table 4): IdleSpec 可叠加在 test-time scaling 方法上——Sequential Revision 27.9→32.2,Planning 32.2→35.3,说明 idle-time 计算是正交的 scaling 维度。

§6 论证链 #

步骤论点证据强度
1LLM Agent 工具调用产生大量 idle time(81%–92.6%),且 per-call 分布高度不均(长尾)Figure 2(a)(b): 3 benchmarks 实测强(实测数据,3 benchmarks 一致)
2Idle time 中 Planning 是唯一一致有效的策略;Summarization/Reflection 因提前 commit 不完整解释而不稳定Figure 2(c): 受控策略对比强(GAIA 全难度级别对比)
3Observation uncertainty 要求同时准备 progressive(exploitation)和 recovery(exploration)两类 draftTable 6(a): dual vs single-mode 消融强(GAIA L1–L3 逐级验证)
4Draft 应作为 reference 而非 mandatory constraint,让模型保留综合改进能力Table 6(b): 3 种聚合方式对比强(FRAMES 上 Δ=8.0 vs mandatory)
5Thompson sampling 比 random 和 direct forecast 更适合策略选择Table 6(c): 3 种选择策略对比中强(仅 FRAMES + Qwen3.5-4B 一组验证)
6组合三个组件后 IdleSpec 在 3 benchmarks × 3 models 上一致提升,延迟开销 ~0Table 1, Table 2, Figure 3强(跨 benchmark、跨 model 一致性)

§7 实现 cross-reference #

[实现未公开]

论文使用已有 agent 框架作为基座:OAgents 用于 GAIA/FRAMES,OpenHands 用于 MLE-Bench。IdleSpec 作为推理层 wrapper 叠加在这些框架之上。

关键实现参数:

核心技术壁垒: 将 idle-time 策略选择建模为 bandit 问题,用 Beta-Bernoulli Thompson sampling 在 progressive/recovery 间动态分配计算。这是区别于 Sleep-Time Compute(单模式、忽略 uncertainty)和 Speculative Agent Execution(单模式、假设成功)的根本差异。实现上只需维护两个计数器 $(\alpha, \beta)$,极度轻量。

关键实现细节:

  1. Idle-aware termination — 工具返回时立即终止 drafting(而非固定 budget),使 IdleSpec 自适应不同长度的 idle window。Figure 2(b) 的长尾分布说明固定 budget 策略注定浪费或不足。
  2. Reference-based aggregation — draft 作为提示而非约束,保留模型在 observation 到达后的自主决策能力。这是避免 hallucination 传播的关键——小模型(Qwen3.5-4B)上 Sleep-Time Compute 因强制使用 idle-time 产出而降性能 3.8%,IdleSpec 反升 6.8%。