Abstract
Neural "replay" during sleep is a hallmark of biological intelligence, yet its emergence in artificial systems often requires specialized memory buffers or explicit generative training. This paper demonstrates that offline reactivation can emerge naturally in recurrent neural networks (RNNs) as a functional byproduct of learning to track environmental states in noisy conditions. By optimizing for denoising dynamics during active state estimation, RNNs spontaneously generate "dreams" that mirror waking experiences when sensory inputs are removed. This work provides a mathematical and empirical foundation for understanding replay as an emergent property of robust perception.
Introduction
In both biological brains and artificial intelligence, the phenomenon of "replay"—the reactivation of neural patterns associated with past experiences during periods of rest—is critical for memory consolidation and learning. In modern Reinforcement Learning (RL), this is typically achieved through external mechanisms like experience replay buffers or separate generative models (e.g., VAEs or GANs) designed to hallucinate past data to mitigate catastrophic forgetting.
However, biological systems exhibit a more integrated approach: replay occurs autonomously within the same circuits used for active perception and behavior. For instance, hippocampal place cells replay spatial trajectories during sleep without a clear architectural separation between the "perceiver" and the "generator." This paper investigates the mathematical conditions under which standard RNNs, optimized for simple state-tracking tasks, naturally exhibit this spontaneous offline reactivation.
Theoretical Framework: Denoising as a Driver for Reactivation
The authors propose that the necessity of compensating for internal noise during active tasks forces a network to learn specific internal dynamics that later enable replay. They approach this through a mathematical analysis of a continuous-time RNN trained to estimate environmental states (such as location) based on change-based inputs (such as velocity).
The Denoising Vector Field
When a network must track a state in the presence of internal noise, its optimal update rule naturally decomposes into two distinct components:
- Signal Integration: A component that tracks the external signal (e.g., integrating velocity to update position).
- Denoising Dynamics: A component that corrects for internal noise by pushing the network's hidden state back toward the manifold of valid representations.
During "sleep" or quiescence, the external sensory inputs are removed. In this state, the network is driven solely by its internal noise. The learned denoising dynamics act as an attractor, while the noise provides the energy to explore the state space. Mathematically, this results in Langevin sampling, where the network's state wanders through the manifold of previously learned experiences, effectively "dreaming" of waking states.
Experimental Methodology
To validate this theory, the authors trained noisy continuous-time RNNs and Gated Recurrent Units (GRUs) on two canonical neuroscience-inspired tasks:
- Spatial Position Estimation: A path integration task where the network must maintain an estimate of 2D location based on velocity inputs, simulating the function of place cells.
- Head Direction Estimation: A 1D angular velocity integration task simulating head direction cells, where the network maps inputs to a circular bearing.
"Sleep" was simulated by setting external inputs to zero and allowing internal stochastic noise to drive the hidden state dynamics. The resulting activity was then compared to the activity recorded during the "waking" (active) phase.
Key Results
Emergent Manifolds and Distribution Matching
The experiments revealed that the networks naturally developed low-dimensional manifolds corresponding to the task geometry—smooth 2D spatial maps for navigation and 1D ring attractors for head direction. Crucially, the quiescent activity diffused along these exact same manifolds.
Quantitative analysis using KL divergence confirmed that the probability distribution of neural states during sleep closely matched the distribution during active behavior. If the training data was biased (e.g., the simulated agent spent more time in the center of an environment), the offline reactivation reflected that same bias, demonstrating that the network's "dreams" are a faithful reflection of its statistical experience.
The Role of Noise
Noise was found to be a prerequisite for this behavior. Networks trained without internal noise successfully learned the integration tasks but failed to explore the state manifold during quiescence. Without the pressure to learn denoising dynamics, these networks exhibited erratic or highly constrained activity when external inputs were removed, failing to produce meaningful replay.
Discussion and Limitations
This research suggests that replay is not necessarily a specialized module but an emergent feature of doing noisy path integration well. It implies that any system optimized for robust state estimation in a noisy environment may inherently possess the machinery for generative replay.
However, some limitations remain. While the theory explains why the distribution of states matches between waking and sleep, it does not fully account for the sequential structure of replay (the specific forward or reverse ordering of trajectories). While some sequentiality was observed empirically, the current mathematical framework focuses primarily on the steady-state distribution. Additionally, the theory relies on change-based inputs (like velocity), and further work is needed to determine if these findings extend to systems driven by absolute sensory inputs, such as the visual cortex or prefrontal decision-making circuits.
Conclusion
By framing offline reactivation as a consequence of denoising, this paper bridges the gap between functional state estimation and generative memory. It provides a parsimonious explanation for why biological circuits replay experiences and offers a potential blueprint for more integrated, autonomous memory systems in artificial intelligence.
Summary updated