Working Memory Connections for LSTM

Federico Landi, Lorenzo Baraldi, Marcella Cornia, Rita Cucchiara

Introduction

Long Short-Term Memory (LSTM) networks have long been the standard for sequence modeling, primarily due to their ability to manage long-term dependencies through a system of gates. These gates—input, forget, and output—regulate the flow of information into and out of an internal cell state ($c_t$). However, a fundamental architectural limitation exists in the standard "vanilla" LSTM: the gates are technically "blind" to the internal memory they are tasked with managing. Decisions are made based solely on the current input ($x_t$) and the previous hidden state ($h_{t-1}$), without direct observation of the cell's content.

The Challenge of Internal State Access

In the early 2000s, researchers attempted to address this blindness by introducing "peephole connections," which allowed gates to inspect the cell state directly. Despite their theoretical promise, peepholes never became the industry standard. This paper identifies the root cause of their inconsistency: the "flooding" phenomenon.

In many tasks, the internal cell state can grow linearly over time. Because peepholes use direct linear connections, a large cell state magnitude eventually overpowers the other inputs to the gate. This forces the gate's sigmoid activation into a saturated regime (stuck at 0 or 1), where gradients can no longer flow effectively. This instability leads to poor performance on long sequences and high variance during training.

Methods: Working Memory Connections (WMC)

To resolve the stability issues of peepholes while retaining the benefits of state-aware gating, the authors propose Working Memory Connections (WMC). The core innovation is a "protection mechanism" that ensures the gates remain responsive regardless of the cell state's magnitude.

Comparison of Vanilla LSTM, Peephole, and Working Memory Connection (WMC) gates.

As illustrated in the comparison above, WMCs introduce two critical modifications to the gate architecture:

  1. Nonlinear Projection: Unlike peepholes, WMCs pass the cell state through a $tanh$ activation function before it reaches the gates. This "squashes" the potentially unbounded cell state into a fixed range of $[-1, 1]$. This prevents the cell state from saturating the gate, ensuring that the sigmoid activation stays in a responsive regime where learning can occur.
  2. Information Symmetry: The architecture is designed so that the output gate can see the current cell state ($c_t$) rather than just the previous one ($c_{t-1}$). This allows the network to be much more responsive; it can decide to "close the door" on an output immediately if the memory cell contains information that has become irrelevant to the current timestep.

These modifications are "plug-and-play," fitting into standard LSTM architectures without requiring task-specific assumptions or significant computational overhead.

Experimental Evaluation

The authors evaluated the WMC architecture across a diverse range of benchmarks to test its robustness and representational power.

Synthetic and Sequential Tasks

On the Adding Problem with a sequence length of $T=400$—a task designed to test extremely long-term dependencies—vanilla LSTMs and peephole LSTMs failed to converge. In contrast, WMC LSTMs solved the task efficiently by epoch 145. Similarly, on Sequential MNIST (sMNIST), where images are processed pixel-by-pixel, WMC LSTMs achieved a state-of-the-art accuracy of 98.63%, outperforming more complex variants like uRNNs.

Language Modeling and Image Captioning

In natural language processing, WMCs were tested on the Penn Treebank (PTB) dataset for character-level prediction. WMCs reduced the Bit Per Character (BPC) from 1.334 (vanilla) to 1.299, even when the vanilla baseline was given additional parameters to compensate for the architectural difference.

For image captioning on the Microsoft COCO dataset, WMCs provided a significant boost in caption quality. Using the "Show and Tell" architecture, the inclusion of WMCs improved the CIDEr metric by 2.0 points. The researchers also noted that WMCs exhibited much lower variance during training, suggesting the architecture is more robust to hyperparameter choices than its predecessors.

Conclusion

Working Memory Connections provide a simple yet powerful fix for the stability issues that have historically plagued state-aware gating in LSTMs. By introducing a nonlinear protection layer, WMCs allow gates to "glimpse" the past without being overwhelmed by it. While the benefits may be less pronounced in very deep stacked architectures where inter-layer interactions provide similar representational power, WMCs represent a significant advancement for single-layer and wide recurrent networks, particularly in tasks requiring precise control over long-term memory.

Summary updated

BibTeX
@article{landi2021working,
  author = {Federico Landi and Lorenzo Baraldi and Marcella Cornia and Rita Cucchiara},
  title = {{Working Memory Connections for LSTM}},
  journal = {Neural Networks},
  year = {2021},
  doi = {10.1016/j.neunet.2021.08.030},
}
Figure