HyperAIHyperAI

Command Palette

Search for a command to run...

Sprachmodelle brauchen Schlaf

Sangyun Lee Sean McLeish Tom Goldstein Giulia Fanti

Zusammenfassung

Transformer-basierte Large Language Models (LLMs) werden zunehmend für Langzeitaufgaben eingesetzt; ihr Aufmerksamkeitsmechanismus (Attention Mechanism) skaliert jedoch schlecht mit der Kontextlänge. Um dieses Problem zu bewältigen, untersuchen wir einen schlafähnlichen Konsolidierungsmechanismus, bei dem ein Modell den aktuellen Kontext in regelmäßigen Abständen in persistente „Fast Weights“ umwandelt, bevor es seinen Key-Value-Cache zurücksetzt. Während des „Schlafzustands“ führt das Modell N offline rekursive Durchläufe über den angesammelten Kontext durch und aktualisiert die Fast Weights in seinen State-Space-Model (SSM)-Blöcken durch eine gelernte lokale Regel. Während der Inferenz wird die zusätzliche Rechenlast in die Schlafphase verlagert, wodurch die Latenz der Vorhersagen während der aktiven Phase erhalten bleibt. Wir testen unsere Methode auf kontrollierten synthetischen Aufgaben, darunter zelluläre Automaten und die Mehrweg-Graphenabfrage, sowie auf einer realistischen mathematischen Reasoning-Aufgabe, bei der sowohl ein regulärer Transformer als auch SSM-Aufmerksamkeits-Hybridmodelle versagen. Anschließend zeigen wir, dass eine Erhöhung der Schlafdauer N bei unseren Modellen die Leistung verbessert, wobei die größten Verbesserungen bei Beispielen zu verzeichnen sind, die tieferes Reasoning erfordern.

One-sentence Summary

To address poor attention scaling in transformer-based large language models, the authors propose a sleep-like consolidation mechanism that converts recent context into persistent fast weights within state-space model blocks through N offline recurrent passes, shifting computation to sleep periods to preserve the latency of wake-time prediction while achieving improved performance on cellular automata, multi-hop graph retrieval, and a realistic math reasoning task where regular transformers and SSM-attention hybrids fail.

Key Contributions

  • A sleep-like consolidation mechanism is introduced where a model periodically converts recent context into persistent fast weights before clearing its key-value cache. Offline recurrent passes update fast weights within state-space model blocks through a learned local rule, shifting computation to sleep periods without increasing inference latency.
  • The approach is evaluated on controlled synthetic tasks including cellular automata and multi-hop graph retrieval, as well as a realistic math reasoning task. Regular transformers and SSM-attention hybrid models fail on these tasks, while the method demonstrates performance improvements.
  • Increasing sleep duration N improves performance, with the largest gains observed on examples that require deeper reasoning. This indicates that additional sleep-time computation is most beneficial when reasoning depth increases.

Introduction

Large Language Models typically rely on attention mechanisms that scale poorly with context length, leading to the adoption of hybrid architectures combining attention with fixed size fast weight memories. Yet these prior models struggle with deep reasoning tasks even when memory capacity is sufficient because they lack the computation needed to transform evicted context into useful internal states. The authors leverage biological sleep as inspiration to introduce a consolidation phase where the model performs recurrent forward passes on accumulated context without external input. This process updates fast weights to preserve information for later inference, significantly improving reasoning performance on tasks requiring deep computation over evicted tokens.

Method

The proposed architecture addresses the memory scaling issues of standard transformers by interleaving attention layers with State Space Model (SSM) blocks. In this hybrid design, attention layers maintain a Key-Value (KV) cache that grows linearly with the sequence length, while SSM layers store information in a fixed-size fast-weight state. The model is constructed by stacking these blocks, where an attention block is denoted as Battn\mathcal{B}_{\ell}^{\text{attn}}Battn and an SSM block as Bssm\mathcal{B}_{\ell}^{\text{ssm}}Bssm. The SSM blocks utilize a gated Hebbian-like update rule to compress past information into their internal state St\mathbf{S}_tSt:

St=αtSt1+βtvtkt\mathbf{S}_t = \alpha_t \mathbf{S}_{t-1} + \beta_t \mathbf{v}_t \mathbf{k}_t^\topSt=αtSt1+βtvtkt

Here, αt\alpha_tαt and βt\beta_tβt serve as data-dependent forget and input gates, enabling the model to retain relevant history without expanding memory requirements.

To manage contexts that exceed the attention window, the system implements a consolidation mechanism known as "LLM Sleep." This process involves performing multiple offline recurrent passes over the context before discarding the attention cache.

As illustrated in the framework diagram, the model processes input tokens until it reaches the eviction boundary. At this point, the system executes NNN recurrent passes over the current context, indicated by the green dashed loop labeled ×N\times N×N. During these passes, the fast weights in the SSM blocks are iteratively refined to encode the accumulated information. Simultaneously, the KV cache in the attention blocks, represented by purple squares, is cleared. The refined fast weights, shown as green network icons, persist across the boundary to support subsequent predictions. This approach allows the model to perform deep reasoning on evicted context during the sleep phase while maintaining constant latency during the inference phase. Training is conducted by backpropagating through the entire computational graph, including the recurrent consolidation steps.

Experiment

This study evaluates attention-SSM hybrid models under hard context eviction constraints using synthetic reasoning tasks like Rule 110 and Depo, alongside the GSM-Infinite math benchmark. By varying the number of offline sleep loops during memory consolidation, the results demonstrate that additional recurrence significantly improves performance on deep sequential computation and multi-hop retrieval where standard single-pass models fail. These findings confirm that extending sleep-time computation allows models to encode evicted context into fast weights more effectively, a trend that persists across both controlled synthetic environments and realistic pretrained LLMs.


KI mit KI entwickeln

Von der Idee bis zum Launch – beschleunigen Sie Ihre KI-Entwicklung mit kostenlosem KI-Co-Coding, sofort einsatzbereiter Umgebung und bestem GPU-Preis.

KI-gestütztes kollaboratives Programmieren
Sofort einsatzbereite GPUs
Die besten Preise

HyperAI Newsletters

Abonnieren Sie unsere neuesten Updates
Wir werden die neuesten Updates der Woche in Ihren Posteingang liefern um neun Uhr jeden Montagmorgen
Unterstützt von MailChimp