Reinforcement Learning with Long Short-Term Memory

Bram BakkerNeurIPS 2001

This paper, published in 2001 by Bram Bakker, represents a foundational step in deep reinforcement learning. It introduces RL-LSTM, a system that combines Reinforcement Learning (RL) with Long Short-Term Memory (LSTM) networks to solve tasks where an agent must remember information over long periods to succeed.

TL;DR

The paper demonstrates that LSTM networks can empower reinforcement learning agents to solve "non-Markovian" tasks—problems where the current observation isn't enough to decide the best action. By using LSTM's unique ability to maintain stable gradients over time, the RL-LSTM agent successfully bridges long time lags that cause standard recurrent networks and history-window approaches to fail.

What Problem Does This Paper Address?

Most standard RL algorithms assume the environment is Markovian, meaning the current state contains all the information needed to make an optimal decision. However, real-world tasks are often Partially Observable (POMDPs). For example, a robot navigating a building might see two identical-looking hallways; to know which way to turn, it must remember a sign it saw three minutes ago.

This creates a "long-term dependency" problem. Traditional Recurrent Neural Networks (RNNs) struggle here because of the vanishing gradient problem: as you try to backpropagate an error signal through many time steps, the signal shrinks until it effectively disappears. This makes it impossible for the agent to learn the connection between a distant past event and a current reward.

Methods

The author proposes RL-LSTM, which swaps out standard neurons for LSTM "memory cells" to handle these long-term dependencies.

RL-LSTM Architecture
  • LSTM Architecture: Unlike standard RNNs, LSTMs use "Constant Error Carrousels" (CECs) and multiplicative gates (input, output, and forget gates). This structure allows the network to trap error signals inside the cells, maintaining them for indefinite periods without the signal vanishing or exploding.
  • Advantage($\lambda$) Learning: Instead of standard Q-learning, the author uses Advantage Learning. This method is designed to be more robust in continuous-time tasks or environments where the values of different actions are very similar, making it easier for the function approximator (the LSTM) to distinguish the optimal move.
  • Directed Exploration: To prevent the agent from getting stuck, the paper uses a second neural network to predict the absolute "Temporal Difference" (TD) error. If the error is high, it means the agent is "uncertain" about the state, and the system increases exploration (using Boltzmann selection) in those specific areas.
  • Model-Free Approach: The system is model-free, meaning it doesn't try to map out the entire environment. It simply learns to map its internal memory and current observations directly to the "Advantages" of specific actions.

Datasets and Tasks

The paper evaluates the agent on three simulated benchmarks designed to test memory:

  1. Long-term dependency T-maze: An agent starts at the beginning of a long corridor ($N$ steps long). At the start, it sees a "road sign" (011 or 110). It must travel the length of the corridor and then choose North or South at a T-junction based on that initial sign.
  2. Noisy T-maze: The same as above, but the observations in the corridor are filled with random noise, testing if the agent can ignore distractions while holding onto the important "sign" information.
  3. Multi-mode Pole Balancing: A variation of the classic cart-pole task where the agent cannot see velocities (hidden state). Additionally, the "modes" are swapped (left push becomes right push) at the start of each episode, and the agent is only told which mode it is in for the first second. It must remember this mode indefinitely to keep the pole balanced.

Key Insights and Ideas

  • The Power of the CEC: The "aha moment" is that the LSTM's ability to maintain a constant error flow is exactly what RL needs to solve the credit assignment problem over long time horizons.
  • Selective Memory: Because the approach is model-free, the LSTM only learns to resolve hidden states that are useful for getting rewards. It doesn't waste "memory capacity" trying to predict irrelevant features of the environment.
  • Exploration is Key: In the T-maze, the agent initially doesn't know the sign at the start is important. Directed exploration ensures the agent spends enough time at the T-junction to eventually "realize" that its success correlates with the observation it had $N$ steps ago.

Key Results

T-maze Performance Comparison
  • T-maze Performance: As shown in the performance graphs, RL-LSTM achieved perfect performance on corridors up to 50 steps long and maintained high success at 70 steps. In contrast, standard Elman RNNs and "memory bit" systems failed as soon as the corridor exceeded 10–20 steps.
  • Robustness to Noise: In the noisy T-maze, RL-LSTM was virtually unaffected by the random data in the corridor, whereas simpler memory systems were completely derailed.
  • Pole Balancing: RL-LSTM was the only system tested that could learn to balance the pole while remembering the "hidden mode" of operation. Standard RNNs (Elman-BPTT) never reached a satisfactory solution.

Limitations and Future Work

  • Success Rate in Complex Tasks: In the multi-mode pole balancing task, RL-LSTM only reached "optimal" performance in 2 out of 10 runs. While this was better than the competition (which had 0 successes), it suggests that the interaction between RL and LSTM can be unstable and sensitive to initial conditions.
  • Computational Cost: LSTMs are more computationally expensive than standard RNNs or window-based approaches, though the author argues this is a necessary trade-off for the memory capacity gained.
  • Scaling: The tasks, while difficult for the time, are low-dimensional. The author notes that further work is needed to see how this scales to high-dimensional sensory inputs (like vision).

Summary updated

BibTeX
@inproceedings{bakker2001reinforcement,
  author = {Bram Bakker},
  title = {{Reinforcement Learning with Long Short-Term Memory}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2001},
}
Figure