TL;DR
This paper introduces "LLM Sleep," a novel training technique that allows large language models to consolidate information from their limited attention windows into persistent fast weights. By performing offline recurrent passes during a "sleep" phase, models can retain and reason over information that would otherwise be lost, significantly improving performance on tasks requiring deep sequential reasoning.
What Problem Does This Paper Address?
Large Language Models (LLMs) often struggle with long-horizon tasks due to the quadratic scaling of their attention mechanism with context length. While efficient sequence models use hybrid architectures with attention and fast-weight memories (like State-Space Models or SSMs) to mitigate this, they still face limitations. Specifically, these hybrid models can fail when tasks require deep computation over information that has been evicted from the attention cache. This suggests that the bottleneck isn't just memory capacity, but the computational capacity to effectively transform evicted context into a useful internal state for later reasoning. The paper aims to address this by enabling models to perform more computation on past context before it's evicted, without increasing inference latency.
Methods
The core innovation is the "LLM Sleep" mechanism. During training, when the model's attention window is full, instead of simply discarding the oldest tokens, the model enters a "sleep" phase. In this phase, it performs N offline recurrent passes over the accumulated context. These passes iteratively update the fast weights within the SSM blocks of the model using a learned local rule. This process effectively consolidates the evicted context into a more robust, weight-based memory. Crucially, this "sleep" computation happens before the attention cache is cleared and the model proceeds to the next segment of the input. During inference, the model operates with its usual single-pass latency, but now benefits from the consolidated knowledge stored in its fast weights. The entire process, including the sleep phase, is trained end-to-end to maximize performance on downstream tasks.
Datasets
The paper evaluates its method on:
- Controlled Synthetic Tasks:
- Cellular Automaton (Rule 110): A task designed to test deep sequential computation by requiring models to predict future states of a 1D cellular automaton after a certain number of steps. This allows for controlled variation of reasoning depth.
- Depo: A multi-hop knowledge retrieval task that tests reasoning depth by requiring models to navigate a shuffled directed cycle and answer queries about nodes reached after a specified number of hops.
- Realistic Math Reasoning Task:
- GSM-Infinite: A synthetic math reasoning benchmark generated to control problem length and the number of arithmetic operations required. This dataset is used to evaluate the method on more complex, real-world-like reasoning problems.
Key Insights and Ideas
- Beyond Memory Capacity: The paper strongly suggests that the limitations of current long-context models are not solely due to insufficient memory capacity, but rather the lack of sufficient computation to effectively process and consolidate information from evicted context.
- Sleep as Consolidation: Drawing inspiration from biological sleep and memory consolidation, the "LLM Sleep" mechanism provides a computational framework for models to "replay" and integrate past information into their internal representations (fast weights).
- Decoupling Computation and Latency: The key trick is to perform intensive computation during a "sleep" phase (offline, during training or a dedicated consolidation phase) that doesn't add to the strict single-pass latency requirement during inference.
- Reasoning Depth Matters: The benefits of increased "sleep" duration (more recurrent passes) are most pronounced on tasks requiring deeper reasoning, highlighting the method's ability to handle complex sequential dependencies.
Key Results
- Cellular Automaton: Increasing the number of offline loops (sleep passes) from 1 to 4 significantly improved accuracy on the Rule 110 task, especially for higher reasoning depths (t=32), reaching over 30% accuracy with 3-4 loops compared to near random guessing for the no-loop baseline.
- Depo: For higher hop counts (4 hops and above), increasing sleep passes from 1 to 4 accelerated learning and improved test loss. The 4-loop model showed initial progress on the most challenging 16-hop queries within the training budget.
- GSM-Infinite: On this realistic math reasoning task, additional offline loops consistently improved accuracy, particularly for problems requiring more arithmetic operations (6-8 operations). For example, on 8-operation problems, accuracy improved from 0.351 to 0.388 with 6 loops for the Jet-Nemotron model.
- Training Throughput: The method incurs minimal training overhead, with throughput decreasing roughly linearly with the number of sleep passes (N), but this cost is offset by significant performance gains.
Limitations and Future Work
- Training Cost: The primary limitation is the increased training cost due to the additional recurrent passes during the sleep phase. This can make training slower and potentially unstable, requiring techniques like gradient checkpointing or truncated backpropagation.
- Generalization of Sleep: While the paper shows benefits across synthetic and semi-realistic tasks, further investigation into how this "sleep" mechanism generalizes to even more diverse and complex real-world scenarios is warranted.
- Learned Local Rule: The specific learned local rule for updating fast weights is a component that could be further explored and optimized.
- Sliding Window Eviction: The paper briefly explores a sliding-window eviction strategy, suggesting that further research into different eviction mechanisms could yield additional benefits.
Summary updated