RNN Architecture › Visualizing the Hidden State

Michael BrenndoerferMay 7, 20252 min read
Language AI HandbookAll chapters
Part 11 of 67Recurrent Neural Networks
Chapter 74RNN Architecture › Visualizing the Hidden State
Reading section 14 of 19 · Visualizing the Hidden State · 2 minSection 14 of 19 · 2 min

Book contents

Section 14 of 19 · 2 min read

RNN Architecture › Visualizing the Hidden StateOne section · Sections in this chapter14 / 19 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

The hidden state is the computational heart of the RNN. Let us visualize how it evolves as the network processes a sequence, to build intuition about what information it captures.

Out[17]:
Visualization
Heatmap of RNN hidden state activations across 20 dimensions and 15 sequence positions showing varied color patterns.
Hidden state activations across the first 20 dimensions for the sequence 'the quick brown', showing how the RNN's internal representation evolves at each character position. Warmer colors (red) indicate positive activations; cooler colors (blue) indicate negative activations. The pattern shifts at word boundaries and changes character-by-character, illustrating how the hidden state continuously integrates new input with prior context.

The heatmap reveals that the hidden state is not static. It shifts at every character, integrating the new input with the running context. Word boundaries (spaces) tend to produce noticeable shifts. This reflects the transition from word-internal character patterns to inter-word context. Some hidden dimensions appear to function as detectors for specific character categories, showing consistent activation patterns across all vowels, or shifting predictably at word boundaries. This continuous updating is the mechanism by which the RNN accumulates context.

The color pattern also reveals something important about the range of activations. Most values stay well within (−1,1)(-1, 1). This reflects the effect of tanh⁡\tanh saturation. Units near +1+1 or −1-1 are in the saturated regime where the gradient of tanh⁡\tanh is close to zero. This saturation is part of the vanishing gradient story: units that are consistently saturated contribute very little gradient signal back through time.