Thought-Retriever: Don't Just Retrieve Raw Data, Retrieve Thoughts for Memory-Augmented Agentic Systems
Organizations: University of Illinois Urbana-Champaign · Carnegie Mellon University
Abstract
Large language models (LLMs) have transformed AI research thanks to their powerful internal capabilities and knowledge. However, existing LLMs still fail to effectively incorporate the massive external knowledge when interacting with the world. Although retrieval-augmented LLMs are proposed to mitigate the issue, they are still fundamentally constrained by the context length of LLMs, as they can only retrieve top-K raw data chunks from the external knowledge base which often consists of millions of data chunks. Here we propose Thought-Retriever, a novel model-agnostic algorithm that helps LLMs generate output conditioned on arbitrarily long external data, without being constrained by the context length or number of retrieved data chunks. Our key insight is to let an LLM fully leverage its intermediate responses generated when solving past user queries (thoughts), filtering meaningless and redundant thoughts, organizing them in thought memory, and retrieving the relevant thoughts when addressing new queries. This effectively equips LLM-based agents with a self-evolving long-term memory that grows more capable through continuous interaction. Besides algorithmic innovation, we further meticulously prepare a novel benchmark, AcademicEval, which requires an LLM to faithfully leverage ultra-long context to answer queries based on real-world academic papers. Extensive experiments on AcademicEval and two other public datasets validate that Thought-Retriever remarkably outperforms state-of-the-art baselines, achieving an average increase of at least 7.6% in F1 score and 16% in win rate across various tasks. More importantly, we further demonstrate two exciting findings: (1) Thought-Retriever can indeed help LLM self-evolve after solving more user queries; (2) Thought-Retriever learns to leverage deeper thoughts to answer more abstract user queries.
Figures & tables
| Dataset | Task Type | Avg. len | Cases |
| AcademicEval | |||
| Abstract-single | Single Sum | 8,295 | 100 |
| Abstract-multi | Multi Sum | 33,637 | 30 |
| Related-multi | Multi Related | 22,107 | 30 |
| Public Datasets | |||
| Gov Report | Single QA | 8,910 | 100 |
| Type | AcademicEval | Public | ||||||||
| Dataset | Abstract-single | Abstract-multi | Related-multi | Gov Report | WCEP | |||||
| Method | F1 | Win Rate | F1 | Win Rate | F1 | Win Rate | F1 | Win Rate | F1 | Win Rate |
| BM25 | 0.212 | 7% | 0.232 | 7% | 0.203 | 40% | 0.211 | 30% | 0.178 | 31% |
| TF-IDF | 0.202 | 4% | 0.225 | 4% | 0.207 | 40% | 0.195 | 35% | 0.223 | 34% |
| Contriever | 0.242 | 13% | 0.232 | 15% | 0.201 | 35% | 0.223 | 40% | 0.211 | 40% |
| DPR | 0.206 | 4% | 0.226 | 4% | 0.196 | 30% | 0.188 | 20% | 0.201 | 33% |
| Setting | Retriever-origin | Response-direct | Retriever-other | Thought-Retriever |
| F1 | 0.25 | 0.19 | 0.22 | 0.24 |
Appendix figures & tables23 assets
Supplementary material from the paper’s appendix.
Appendix
| Attribute | Description | |
| Abstract-Single | ‘title’ | The title of the academic paper. |
| ‘abstract’ as label | The abstract of the academic paper. | |
| ‘main_content’ | The content of the paper excluding the abstract and the conclusion. | |
| Abstract-Multi | ‘title 1’ | The title of the first academic paper. |
| ‘abstract 1’ | The abstract of the first academic paper. | |
| ‘main_content 1’ | The content of the first paper excluding the abstract and the conclusion. |
| Query | What has driven significant progress in various NLP tasks in recent years? |
| Response | According to the text, significant progress in various NLP tasks in recent years has been driven in part by benchmarks such as GLUE, whose leaderboards rank models by how well they perform on these diverse tasks. |
| Prompt template | Input: Given query:{query}, given response:{response}. Based on the provided query and its corresponding response, perform the following step: succinctly summarize both the question and answer into a coherent knowledge point, forming a fluent passage. |
| Thought candidate | Here is a summarized knowledge point: In recent years, significant progress has been made in various Natural Language Processing (NLP) tasks. A key driver of this progress is the development of benchmarks, such as GLUE, which provide a standardized way to evaluate and compare the performance of different models on a range of diverse NLP tasks. These benchmarks, which often take the form of leaderboards, rank models based on their performance, fostering competition and innovation in the field. As a result, researchers and developers have been motivated to improve their models, leading to significant advancements in NLP capabilities. |
| Abstraction | Rank (expert LLM) | Query |
| High | 6 (Most Abstract) | "What are the broader future implications of user-centric utility in NLP model evaluation?" |
| High | 5 | “Please craft an abstract summarizing the key points from the provided text.” |
| Medium | 4 | "What are some of the limitations of this study?" |
| Medium | 3 | “What are the key methods introduced in this paper?” |
| Low | 2 | "Please explain the term Minerva to me." |
| Low | 1 (Least Abstract) | "How many benchmarks are used to test the model’s long context understanding ability in this paper?" |
| Type | Abstract-single | Abstract-multi | ||||||
| LLM | Qwen-7b | Llama-3-70b | Qwen-7b | Llama-3-70b | ||||
| Method | F1 | Win Rate | F1 | Win Rate | F1 | Win Rate | F1 | Win Rate |
| BM25 | 0.196 | 3% | 0.22 | 13% | 0.232 | 7% | 0.233 | 14% |
| TF-IDF | 0.192 | 3% | 0.21 | 17% | 0.220 | 3% | 0.224 | 12% |
| Contriever | 0.231 | 10% | 0.238 | 18% | 0.229 | 4% | 0.228 | 19% |
| DPR | 0.209 | 4% | 0.215 | 18% | 0.222 | 3% | 0.222 | 11% |
| QA Accuracy | Reasoning Accuracy | |
| BM25 | 10% | 30% |
| TF-IDF | 13% | 33% |
| Contriever | 20% | 50% |
| DPR | 17% | 20% |
| Dragon | 13% | 27% |
| Full Context (left) | 7% | 20% |
| Method | F1 |
| Contriever | 0.242 |
| Thought-Retriever using Contriever | 0.290 |
| NV-Embed | 0.268 |
| Thought-Retriever using NV-Embed | 0.326 |
| Dataset | Model | F1 | Win Rate |
| Abstract-single | RECOMP | 0.237 | 7% |
| Abstract-single | Thought-Retriever | 0.290 | 50% |
| Abstract-multi | RECOMP | 0.202 | 8% |
| Abstract-multi | Thought-Retriever | 0.275 | 50% |
| Task Description: |
| You will be shown a query and several intermediate thoughts generated by a large language model (LLM). Please evaluate each thought independently based on its usefulness, relevance, and correctness. Your rating should reflect how well the thought contributes to answering the query. |
| Scoring Criteria (per thought): |
| Score 2 (High Quality) : Relevant, helpful, logically coherent, and factually correct. Score 1 (Medium Quality) : Somewhat relevant/helpful; may have minor issues or vague content. Score 0 (Low Quality) : Irrelevant, incorrect, incoherent, or hallucinated content. |
| Instructions: • Evaluate each thought individually , without comparing it to others. • Focus on content quality, not writing style or fluency. • You only need to assign a score (0, 1, or 2); no explanation required. |
| Example: |
| Query: What are the key challenges in training large-scale language models? |
| MemWalker | Thought-Retriever (Ours) | ||||||
| Type | Dataset | F1 | Win Rate | Time | F1 | Win Rate | Time |
| Academic Eval | Abs-single | 0.268 | 40% | 25.0s | 0.290 | 50% | 1.85s |
| Abs-multi | 0.255 | 35% | 85.0s | 0.275 | 50% | 3.20s | |
| Rel-multi | 0.212 | 44% | 65.0s | 0.216 | 50% | 2.40s | |
| Public | Gov Report | 0.229 | 45% | 30.0s | 0.232 | 50% | 3.50s |
| WCEP | 0.228 | 39% | 28.0s | 0.238 | 50% | 3.10s | |
| Method | Abstract-single | Abstract-multi | Related-multi | Gov Report | WCEP | |||||
| F1 | Win Rate | F1 | Win Rate | F1 | Win Rate | F1 | Win Rate | F1 | Win Rate | |
| SOTA Baseline (Qwen3) | 0.245 | 28% | 0.240 | 20% | 0.211 | 35% | 0.229 | 42% | 0.235 | 44% |
| Oracle (Gold Chunks) | 0.278 | 46% | 0.255 | 42% | 0.214 | 49% | 0.255 | 62% | 0.245 | 55% |
| Thought-Retriever | 0.290 | 50% | 0.275 | 50% | 0.216 | 50% | 0.232 | 50% | 0.238 | 50% |
| HRALM (Baselines) | Thought-Retriever (Ours) | ||||||
| Type | Dataset | Prec. | Recall | F1 | Prec. | Recall | F1 |
| AcademicEval | Abs-single | 0.82 | 0.65 | 0.72 | 0.80 | 0.88 | 0.84 |
| Abs-multi | 0.74 | 0.58 | 0.65 | 0.78 | 0.84 | 0.81 | |
| Rel-multi | 0.65 | 0.52 | 0.58 | 0.76 | 0.82 | 0.79 | |
| Public | Gov Report | 0.78 | 0.60 | 0.68 | 0.75 | 0.82 | 0.78 |
| WCEP | 0.71 | 0.62 | 0.66 | 0.77 | 0.83 | 0.80 | |
| Method | Memory Status | F1 Score on Held-out Test Set | |
| (at start of testing) | Abstract-multi | Related-multi | |
| Baseline (Cold Start) | Empty | 0.235 | 0.198 |
| Ours (Evolved) | Pre-filled (from Evolution Set) | 0.250 | 0.210 |
| Relative Improvement | +6.4% | +6.1% | |
| Type | Inference Time (Seconds) | ||||
| Dataset | Abstract-single | Abstract-multi | Related-multi | Gov Report | WCEP |
| Method | Time (s) | Time (s) | Time (s) | Time (s) | Time (s) |
| BM25 | 0.42 | 0.45 | 0.48 | 0.75 | 0.62 |
| TF-IDF | 0.40 | 0.43 | 0.46 | 0.72 | 0.60 |
| Contriever | 0.65 | 0.72 | 0.68 | 1.10 | 0.95 |
| DPR | 0.62 | 0.70 | 0.66 | 1.05 | 0.92 |
Memory-Augmented Language Model Agents
Memory-augmented language model agents use persistent facts, interaction histories, and skills to support personalization and long-horizon tasks.
See all 443 papers