arXiv:2605.03344cs.IRcs.AI2026-05被引 2

用思维轨迹替代文档,让RAG在推理任务中表现大幅提升

RAG over Thinking Traces Can Improve Reasoning Tasks

论文配图:RAG over Thinking Traces Can Improve Reasoning Tasks
图 1 · 摘自论文原文
  • 用问题求解过程中的思维轨迹作为检索语料
  • 在AIME等基准上相对提升最高达56.3%
  • 适合做数学、代码等强推理任务的研究与应用

检索增强生成(RAG)在知识密集型任务中表现优异,但普遍认为对数学和代码生成等推理密集型任务帮助有限。本文挑战这一观点,指出问题不在于RAG本身,而在于语料选择。我们提出检索思维轨迹——即求解过程中生成的中间思考路径——作为新的检索源。实验表明,思维轨迹本身已是强大语料,进一步引入T3方法将其转化为结构化、可检索的表示形式,显著提升可用性。以这些轨迹为语料库,简单“检索-生成”流程在多个强模型和基准(如AIME 2025–2026、LiveCodeBench、GPQA-Diamond)上持续提升推理性能,超越非RAG基线及标准网络语料检索。例如,在AIME 2025–2026上,基于Gemini-2-thinking生成的轨迹使Gemini-2.5-Flash、GPT-OSS-120B、GPT-5分别获得+56.3%、+8.6%、+7.6%的相对提升,即使这些是更先进的模型。结果表明,思维轨迹是推理任务的有效检索语料,结构化处理可进一步释放潜力。代码已开源。

原文摘要 · Abstract (English)

Retrieval-augmented generation (RAG) has proven effective for knowledge-intensive tasks, but is widely believed to offer limited benefit for reasoning-intensive problems such as math and code generation. We challenge this assumption by showing that the limitation lies not in RAG itself, but in the choice of corpus. Instead of retrieving documents, we propose retrieving thinking traces, i.e., intermediate thinking trajectories generated during problem solving attempts. We show that thinking traces are already a strong retrieval source, and further introduce T3, an offline method that transforms them into structured, retrieval-friendly representations, to improve usability. Using these traces as a corpus, a simple retrieve-then-generate pipeline consistently improves reasoning performance across strong models and benchmarks such as AIME 2025--2026, LiveCodeBench, and GPQA-Diamond, outperforming both non-RAG baselines and retrieval over standard web corpora. For instance, on AIME 2025-2026, RAG with traces generated by Gemini-2-thinking achieves relative gains of +56.3%, +8.6%, and +7.6% for Gemini-2.5-Flash, GPT-OSS-120B, and GPT-5, respectively, even though these are more recent models. Overall, our results suggest that thinking traces are an effective retrieval corpus for reasoning tasks, and transforming them into structured, compact, or diagnostic representations unlocks even stronger gains. Code available at https://github.com/Narabzad/t3.

RAG思维轨迹推理增强代码生成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。