LSTM Gate Equations › The Output Gate

Michael BrenndoerferUpdated May 11, 20252 min read
Language AI HandbookAll chapters
Part 11 of 67Recurrent Neural Networks
Chapter 78LSTM Gate Equations › The Output Gate
Reading section 7 of 17 · The Output Gate · 2 minSection 7 of 17 · 2 min

Book contents

Section 7 of 17 · 2 min read

LSTM Gate Equations › The Output GateOne section · Sections in this chapter7 / 17 ↓
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 cell state now contains the LSTM's updated memory, but not all of this memory is relevant for the current moment. Consider a language model that has stored information about the subject of a sentence ("The cat"), the ongoing action ("is chasing"), and various contextual details. When predicting the next word, only some of this stored information is immediately relevant. The output gate acts as a filter, selecting which parts of the internal memory to expose for the current output.

This separation between internal memory (cell state) and external output (hidden state) is a key architectural insight. The cell state can accumulate and preserve information over long time spans, while the hidden state provides a task-relevant summary at each step. The output gate bridges these two representations.

The Output Gate Equation

Following the same pattern as the other gates, the output gate examines the current context:

ot=σ(Woxt+Uoht−1+bo)\mathbf{o}_t = \sigma(\mathbf{W}_o \mathbf{x}_t + \mathbf{U}_o \mathbf{h}_{t-1} + \mathbf{b}_o)

where:

  • ot∈Rh\mathbf{o}_t \in \mathbb{R}^h: the output gate activation vector, controlling what to expose
  • Wo∈Rh×d\mathbf{W}_o \in \mathbb{R}^{h \times d}: weight matrix that learns which input features signal "this memory is now relevant"
  • Uo∈Rh×h\mathbf{U}_o \in \mathbb{R}^{h \times h}: weight matrix that learns which processing contexts warrant exposing certain memories
  • bo∈Rh\mathbf{b}_o \in \mathbb{R}^h: bias vector

The structure matches the other gates: linear combination followed by sigmoid. But the purpose is different. While the forget and input gates control what goes into memory, the output gate controls what comes out. This asymmetry allows the LSTM to store information that isn't immediately useful but may become relevant later.