Transformer-based large language models are increasingly used for long-horizon tasks; however, their attention mechanism scales poorly with context length. To handle this, we study a sleep-like consolidation mechanism in which a model periodically converts recent context into persistent fast weights before clearing its key-value cache. During sleep, the model performs $N$ offline recurrent passes over the accumulated context and updates the fast weights in its state-space model (SSM) blocks through a learned local rule. During inference, this shifts extra computation to sleep while preserving the latency of wake-time prediction. We test our method on controlled synthetic tasks, including cellular automata and multi-hop graph retrieval, as well as a realistic math reasoning task, on which a regular transformer as well as SSM-attention hybrid models fail. We then show that increasing sleep duration $N$ for our models improves performance, with the largest gains on examples that require deeper reasoning.
翻译:基于Transformer的大语言模型越来越多地用于长程任务,但其注意力机制随上下文长度扩展性较差。为解决此问题,我们研究了一种类似睡眠的巩固机制:模型周期性地将近期上下文转换为持久快速权重,随后清空其键值缓存。在睡眠阶段,模型对累积上下文执行$N$次离线递归传递,并通过习得的局部规则更新其状态空间模型(SSM)块中的快速权重。在推理阶段,该方法将额外计算转移至睡眠阶段,同时保持清醒时预测的延迟不变。我们在包括元胞自动机、多跳图检索等受控合成任务以及一个实际数学推理任务上测试了该方法——而常规Transformer及SSM-注意力混合模型在这些任务上均失败。进一步研究表明,增加模型睡眠时长$N$可提升性能,其中需要更深层推理的样本获益最大。