Command Palette
Search for a command to run...
언어 모델은 수면이 필요하다
언어 모델은 수면이 필요하다
Sangyun Lee Sean McLeish Tom Goldstein Giulia Fanti
초록
트랜스포머 기반 대규모 언어 모델(LLL)은 장기적(horizon) 작업에 점점 더 널리 활용되고 있지만, 그 주의 메커니즘(attention mechanism)은 문맥의 길이에 따라 확장성이 부족하다는 한계가 있습니다. 이를 해결하기 위해 본 연구에서는 최근의 문맥을 주기적으로 영구적인 빠른 가중치(fast weights)로 변환한 후 키-밸류 캐시를 초기화하는 수면과 유사한 통합(consolidation) 메커니즘을 고안했습니다. 수면 단계에서 모델은 축적된 문맥에 대해 N번의 오프라인 재귀적(recurrent) 처리를 수행하며, 학습된 지역 규칙(local rule)을 통해 상태 공간 모델(SSM) 블록 내의 빠른 가중치를 업데이트합니다. 추론 시점에는 추가적인 연산 작업을 수면 단계로 이동시키면서 깨어 있을 때의 예측 지연시간(latency)은 유지됩니다.본 연구는 세포 자동자(cellular automata)와 다중hop 그래프 탐색(multi-hop graph retrieval)을 포함한 통제된 합성 과제와, 일반적인 트랜스포머 및 SSM-주의(attention) 하이브리드 모델이 실패하는 현실적인 수학 추론 과제를 통해 방법을 검증했습니다. 그 결과, 수면 시간 N을 늘리면 모델의 성능이 향상되며, 특히 더 깊은 추론이 요구되는 사례에서 가장 큰 성능 개선을 보였다.
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 Bℓattn and an SSM block as Bℓssm. The SSM blocks utilize a gated Hebbian-like update rule to compress past information into their internal state St:
St=αtSt−1+βtvtkt⊤
Here, αt and β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 N recurrent passes over the current context, indicated by the green dashed loop labeled ×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.