Introduction
Improving Large Language Models (LLMs) typically necessitates massive annotated datasets or computationally intensive fine-tuning. However, many state-of-the-art models are only accessible via APIs, making parameter updates impossible for most users. The Memory-of-Thought (MoT) framework addresses this by enabling LLMs to self-improve their reasoning capabilities without fine-tuning or human labels.
MoT draws inspiration from human metacognition, where we solve problems by recalling mental templates from past experiences. By "pre-thinking" on unlabeled data to create an external memory and then "recalling" relevant logic during inference, MoT bridges the gap between static prompting and dynamic learning.
Methodology: Pre-thinking and Recalling
The MoT framework operates in two distinct stages: Pre-thinking and Recall/Inference.
1. Pre-thinking (Building the Memory)
The LLM processes an unlabeled dataset by generating multiple reasoning paths (Chain-of-Thought) for each question. To ensure memory quality, the framework employs:
- Majority Voting: Identifying the most consistent answer across multiple attempts.
- High-Confidence Filtering: Using answer entropy to discard uncertain thoughts. Only high-confidence question-rationale-answer triplets are stored in the external "Memory of Thoughts."
2. Recalling (Using the Memory)
During testing, the model retrieves relevant logic from its memory to guide its reasoning:
- Two-Stage Retrieval: A standard semantic retriever (SBERT) first identifies a pool of candidates. Then, the LLM itself performs a second retrieval step to select the most logically helpful example from those candidates.
- Inference: The selected memories serve as in-context examples, allowing the LLM to solve new problems using its own previously validated logic.
Evaluation and Key Insights
MoT was evaluated across ten datasets spanning arithmetic, natural language inference (NLI), commonsense, and factual reasoning.
Key Results
- Performance Gains: MoT outperformed Few-Shot-CoT by an average of 3.7 points and Zero-Shot-CoT by 9.1 points across all tasks.
- Arithmetic Proficiency: On the DROP dataset, MoT achieved a score of 65.7, a significant improvement over the 24.7 Zero-Shot baseline.
- Efficiency: The framework remains robust even with limited memory sizes (e.g., 10% of the original pool), highlighting the importance of quality over quantity.
Insights
- LLMs as Librarians: LLMs are more effective at retrieving logically similar examples than standard semantic search engines. While SBERT looks for word similarity, the LLM-retrieval stage identifies similar logical structures.
- The Rationale Matters: Removing the reasoning steps (rationales) from the memory significantly degrades performance, confirming that the stored thought process is the primary driver of improvement.
- Orthogonality: MoT is compatible with other prompting techniques like "Plan-and-Solve," providing additive benefits.
Limitations and Future Work
Despite its success, MoT faces challenges such as "confident hallucinations" entering the memory and potential bias amplification from self-generated thoughts. Future work could explore more sophisticated memory integration strategies or dynamic, "on-the-fly" memory updates during the inference phase where the model learns from every new test question it solves.
Summary updated