Deep Reinforcement Learning (RL) agents are often designed to react to their immediate environment. However, new research demonstrates that they can also evolve internal "biological clocks." By training agents equipped with recurrent memory in a periodic day-night cycle, researchers found that these agents spontaneously develop endogenous, entrainable rhythms. This allows them to anticipate environmental changes and adapt to simulated "jet lag" without any additional training.
The Challenge of Anticipation
Biological organisms have spent billions of years internalizing the Earth's 24-hour rotation. This "circadian rhythm" isn't merely a reaction to light; it is an internal clock that allows animals to anticipate dawn, prepare for sleep, and coordinate complex behaviors ahead of time.
In artificial intelligence, most agents are purely reactive or rely on short-term memory to solve immediate tasks. The authors of this paper posed a fundamental question: if we place an RL agent in a world with a reliable periodic signal, will it simply react to the signal, or will it "internalize" the rhythm? Understanding how artificial agents develop these internal dynamics is a critical step toward building autonomous systems that can anticipate environmental regularities rather than just responding to them.
Methods: Foraging in a Periodic World
To test this, the researchers designed a foraging task in a 5x5 grid world using the Artificial Primate Environment Simulator (APES).
- The Task: The agent (represented as a rabbit) must collect food in a designated "food zone" during the day to earn a reward (+1). At night, it must return to a "home" hole to avoid a heavy penalty (-2.5 per step).
- The Cycle: A single "day" lasts 40 time steps, split evenly into 20 steps of light and 20 steps of darkness. Crucially, the agent needs at least 4 steps to travel from the food zone to its home. This means it cannot simply wait for the dark signal to appear; it must anticipate the sunset to maximize its rewards.
- The Architecture: The agent is powered by a Dueling Q-Network equipped with a Long Short-Term Memory (LSTM) layer. The LSTM provides the recurrent "latent space" necessary for an internal rhythm to potentially emerge.
- Analysis Tools: Moving beyond standard reward curves, the authors used tools from dynamical systems theory. They employed clamping tests (holding the daylight signal constant to test for endogeneity), bifurcation analysis (tracking qualitative changes in neural dynamics), and Phase Response Curves (measuring how the internal clock shifts in response to light/dark pulses).
Key Insights and Discoveries
Spontaneous Internalization The agents didn't just learn a simple reactive rule like "if light=0, go home." Instead, they developed a stable periodic orbit in their neural activity. Even when the "sun" was forced to stay up or down indefinitely during testing, the agent's internal state continued to oscillate with a roughly 40-step period.
The "Aha!" Moment Rhythmic behavior did not emerge gradually. Around training episode 55, the system underwent a supercritical Neimark-Sacker bifurcation. In dynamical systems terms, this is a mathematical transition where a stable point in the neural dynamics suddenly "explodes" into a stable circular orbit (an attractor).
Zero-Shot "Jet Lag" Recovery When the researchers shifted the day-night cycle—simulating travel across time zones—the agents adapted within about three cycles. Remarkably, this adaptation happened without any further weight updates. The internal dynamical "attractor" simply resynchronized itself to the new external signal.
Key Results
- Endogeneity: In constant light or dark conditions, the LSTM activations maintained a clear 40-step oscillation. This proves the rhythm is generated internally rather than being a mere reflection of the environment.
- Anticipation: Trained agents consistently began their trek home at the 17th or 18th step of the day, perfectly timing their arrival for the onset of night at step 21.
- Entrainability: Agents successfully resynchronized to 10-step phase shifts (25% of the day cycle) within 3-5 days.
- Robustness: The emergence of these rhythms was robust across different optimizers (SGD, RMSprop), architectures (GRU, vanilla RNN), and hyperparameters.
Limitations and Future Work
While groundbreaking, the study operates within a highly simplified 5x5 grid. Real-world periodicity is often noisier and influenced by multiple overlapping cycles. Additionally, a hallmark of biological circadian rhythms is that they maintain their period across different temperatures—a feature not tested here via an analogous "computational temperature" compensation.
Future work could explore if agents can learn to adapt to varying day lengths, mimicking seasonal changes. Furthermore, the authors suggest exploring how these internal rhythms might facilitate coordination in complex multi-agent reinforcement learning scenarios.
Summary updated