Sleep-time Compute: Beyond Inference Scaling at Test-time
该论文提出了一种名为“sleep-time compute”的新方法,允许模型在测试时之前对上下文进行离线推理,从而显著减少测试时的计算需求。
更新于 2025-04-18。作者:Kevin Lin、Charlie Snell、Yu Wang、Charles Packer、Sarah Wooders、Ion Stoica、Joseph E. Gonzalez。
中文摘要
扩展测试时计算能力已成为使大型语言模型(LLMs)能够解决困难问题的一个关键因素,但这伴随着高延迟和推理成本。我们提出了睡眠时间计算,它允许模型在查询呈现之前对上下文进行“思考”:通过预测用户可能会提出什么查询并预先计算有用的量,我们可以显著减少测试时的计算需求。为了展示我们方法的有效性,我们创建了两个推理任务的修改版本——有状态的 GSM-Symbolic 和有状态的 AIME。我们发现,睡眠时间计算可以将达到相同准确性的测试时计算量减少约 5 倍,并且在有状态的 GSM-Symbolic 和有状态的 AIME 上,通过扩展睡眠时间计算,我们可以进一步提高准确度,最高可达 13% 和 18%。此外,我们引入了多查询 GSM-Symbolic,它通过在每个上下文中包含多个相关查询来扩展 GSM-Symbolic。通过使用多查询 GSM-Symbolic 在相同上下文的相关查询之间分摊睡眠时间计算,我们可以将每个查询的平均成本降低 2.5 倍。然后,我们进行了额外的分析,以了解睡眠时间计算何时最有效,发现用户查询的可预测性与睡眠时间计算的有效性高度相关。最后,我们对将睡眠时间计算应用于现实中的代理 SWE 任务进行了案例研究。
英文摘要
Scaling test-time compute has emerged as a key ingredient for enabling large language models (LLMs) to solve difficult problems, but comes with high latency and inference cost. We introduce sleep-time compute, which allows models to "think" offline about contexts before queries are presented: by anticipating what queries users might ask and pre-computing useful quantities, we can significantly reduce the compute requirements at test-time. To demonstrate the efficacy of our method, we create modified versions of two reasoning tasks - Stateful GSM-Symbolic and Stateful AIME. We find that sleep-time compute can reduce the amount of test-time compute needed to achieve the same accuracy by ~ 5x on Stateful GSM-Symbolic and Stateful AIME and that by scaling sleep-time compute we can further increase accuracy by up to 13% on Stateful GSM-Symbolic and 18% on Stateful AIME. Furthermore, we introduce Multi-Query GSM-Symbolic, which extends GSM-Symbolic by including multiple related queries per context. By amortizing sleep-time compute across related queries about the same context using Multi-Query GSM-Symbolic, we can decrease the average cost per query by 2.5x. We then conduct additional analysis to understand when sleep-time compute is most effective, finding the predictability of the user query to be well correlated with the efficacy of sleep-time compute. Finally, we conduct a case-study of applying sleep-time compute to a realistic agentic SWE task.
解读
一句话总结
该论文提出了一种名为“sleep-time compute”的新方法,允许模型在测试时之前对上下文进行离线推理,从而显著减少测试时的计算需求。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:当前测试时计算扩展虽然能够提升大型语言模型(LLM)在复杂任务上的性能,但伴随着高延迟和计算成本。
- 现有方案不足:现有的测试时计算扩展方法通常假设问题是无状态的,即查询和上下文在测试时同时提供给模型,导致重复计算和额外的延迟。
- 研究目标:通过在测试时之前对上下文进行离线推理,减少测试时的计算需求,并提高LLM在复杂任务上的性能。
问题2:论文的核心创新点是什么?
- 技术创新:提出“sleep-time compute”概念,即在模型空闲时对上下文进行推理,生成新的上下文表示。
- 方法改进:通过预计算有用的量,减少测试时的计算需求,并通过共享上下文推理结果来降低平均查询成本。
- 优势:与现有方法相比,可以在相同精度下减少测试时计算需求,并提高整体性能。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:在Stateful GSM-Symbolic和Stateful AIME数据集上进行实验,评估sleep-time compute的效果。
- 性能提升:sleep-time compute可以将达到相同精度所需的测试时计算量减少约5倍,并通过扩展sleep-time compute,可以将精度提高最多13%和18%。
- 对比结果:与基线方法相比,sleep-time compute在多个查询中共享上下文推理结果,可以将平均查询成本降低2.5倍。
问题4:这个研究的实际应用价值是什么?
- 应用场景:适用于需要持久上下文和复用上下文的LLM应用,如文档问答、编码代理和对话助手。
- 实施建议:在实际部署中,应根据上下文和查询的可预测性来优化sleep-time compute的参数。
- 局限与展望:sleep-time compute在查询难以预测或与上下文无关的情况下可能不太有效。未来的工作可以探索更复杂的场景和更有效的上下文表示学习。