LSTM Gate Equations › The Candidate Cell State
Language AI HandbookAll chapters LSTM Gate Equations › The Candidate Cell StateOne section · Sections in this chapter5 / 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 input gate decides how much to write, but something must decide what to write. This is the role of the candidate cell state: it proposes the actual content that might be added to memory. Think of it as drafting a memo that may or may not be filed, depending on the input gate's judgment.
The candidate needs to be expressive. It should be able to propose increases to certain memory dimensions, decreases to others, and leave some unchanged. This flexibility is necessary because the cell state encodes information through both the magnitude and sign of its values. A sentiment analysis model, for instance, might use positive cell state values to encode positive sentiment and negative values for negative sentiment. The candidate must be able to push the cell state in either direction.
The Candidate Formula
Like the gates, the candidate examines the current input and previous hidden state:
where:
- : the candidate cell state vector, proposing potential updates
- : weight matrix that learns what content to extract from the input
- : weight matrix that learns how recent processing should shape the update
- : bias vector
Why tanh Instead of Sigmoid?
Notice the functional difference: the candidate uses instead of sigmoid. The hyperbolic tangent function is defined as:
where is the input value. This function outputs values in the range , centered around zero. The centering is key: unlike sigmoid, which only produces positive values between 0 and 1, can output negative values. This allows the candidate to propose both positive and negative updates to the cell state.
Consider what would happen if the candidate used sigmoid instead. The cell state could only ever increase (since you'd only be adding positive values). Information could accumulate but never be actively reversed. With , the candidate can propose "increase this dimension" (positive values) or "decrease this dimension" (negative values), giving the network the full expressiveness it needs.
The candidate cell state uses because it needs to propose values that can add to or subtract from the existing cell state. Sigmoid would only allow positive additions, severely limiting the network's representational power.