Unfolding RNNs: Backpropagation Explained
Unfolding RNNs: Backpropagation Explained
What It Means
When we train neural networks that handle sequential data (like sentences, audio, or time series),
the same network is used repeatedly over time steps.
But — to understand how gradients flow and how backpropagation works, we “unfold” or “unroll”
this network through time.
So, Unfolding means representing a Recurrent Neural Network (RNN) as a regular feed-
forward network stretched across multiple time steps.
Intuition
Imagine you have an RNN that processes one input at each time step:
x1 → [RNN cell] → h1 → y1
↓
x2 → [RNN cell] → h2 → y2
↓
x3 → [RNN cell] → h3 → y3
Each [RNN cell] has the same weights (W_h, W_x, W_y), but acts on different inputs ( x_t )
and hidden states ( h_{t-1} ).
• It helps visualize long-term dependencies (how early inputs influence later outputs).
Mathematical View
During training, the gradient of the total loss w.r.t. weights is computed by summing over
time: [
\frac{\partial L}{\partial \theta} = \sum_{t=1}^{T} \frac{\partial L_t}{\partial \theta}
]
Since the same weights are reused at every time step, unfolding makes it possible to compute these
gradients correctly.
Visualization Summary
Unfolded RNN:
1. What is an RNN?
A Recurrent Neural Network (RNN) is a type of neural network that’s designed to process sequential
data — data where order matters (like text, speech, time series, or video frames).
Unlike traditional feedforward networks that treat each input independently, RNNs remember
past information using a hidden state that’s carried from one time step to the next.
3. Mathematical Representation
Let’s write the core RNN equations:
Where:
• ( W_x, W_h, W_y ): Weight matrices (shared across all time steps)
4. Structure of RNN
Here’s the flow:
┌──────────────┐
x₁ ─────▶│ RNN Cell │──▶ y₁
└──────┬───────┘
│ (hidden state)
▼
┌──────────────┐
x₂ ─────▶│ RNN Cell │──▶ y₂
└──────┬───────┘
│
▼
┌──────────────┐
x₃ ─────▶│ RNN Cell │──▶ y₃
└──────────────┘
Every cell receives info from the previous cell — that’s how “recurrent” behavior is achieved.
6. Activation Function
Most RNNs use tanh or ReLU for hidden states:
[
h_t = \tanh(W_h h_{t-1} + W_x x_t + b_h)
]
Reason:
tanh squashes values between -1 and 1 → prevents exploding outputs, but still allows gradients to
flow.
7. Advantages of RNNs
Handles sequential or temporal data naturally.
Shares weights → fewer parameters.
Maintains internal “memory” → context-aware predictions.
Good for NLP, speech, and time-series problems.
8. Limitations
Hard to train on long sequences (gradients vanish or explode).
Can forget early information when sequences are long.
Slow to train (depends on sequence length).
Can’t handle dependencies too far apart effectively.
1. Introduction
A Bidirectional Recurrent Neural Network (BiRNN) is an advanced version of the standard RNN that
processes data in both directions — forward and backward.
This means it looks at past (previous time steps) and future (upcoming time steps) information when
making predictions.
This dual processing helps the network gain context from the entire sequence, which is especially
useful in applications like speech recognition, language translation, and text analysis, where the
meaning of a word often depends on both its previous and next words.
2. Motivation
A traditional (unidirectional) RNN processes the sequence in one direction only, usually from left to
right:
At each step, it only knows the past context but not the future.
However, in many real-world tasks (like understanding a sentence), the context after a word also
matters.
For example, to understand the word “bank,” knowing the next word — “river” or “account” — changes
the meaning.
So, Bidirectional RNNs solve this by processing the sequence in both directions.
3. Architecture
A BiRNN consists of two RNNs:
[
\overrightarrow{h_t} = f(W_x^{(f)} x_t + W_h^{(f)} \overrightarrow{h_{t-1}} + b^{(f)})
]
[
\overleftarrow{h_t} = f(W_x^{(b)} x_t + W_h^{(b)} \overleftarrow{h_{t+1}} + b^{(b)})
]
Then the final hidden state for time ( t ) is obtained by combining both directions: [
h_t = [\overrightarrow{h_t}; \overleftarrow{h_t}]
]
[
y_t = g(W_y h_t + b_y)
]
This means that the prediction at time ( t ) depends on both past and future inputs.
5. Diagram Representation
Forward RNN: x1 → x2 → x3 → x4
Backward RNN: x1 ← x2 ← x3 ← x4
6. Advantages
• Captures context from both past and future.
• More powerful than a standard RNN for understanding the full sequence.
7. Disadvantages
• More computation and memory usage (two RNNs instead of one).
• Not suitable for real-time prediction, since it needs future data (you can’t know future
steps while streaming live input).
8. Applications
Application Example
Speech Recognition Phoneme classification where full sentence context improves accuracy
Text Classification Sentiment analysis using both previous and following words
Encoder-decoder models where context from the whole sentence is
Machine Translation
crucial
Named Entity
Identifying names, dates, or locations in text sequences
Recognition
Encoder–Decoder Sequence-to-Sequence
Architectures
1. Introduction
Traditional RNNs struggle when input and output sequences have different lengths — for example:
• Speech-to-text
• Text summarization
1. Encoder: Reads the entire input sequence and compresses it into a fixed-length
context vector (representation of the whole sequence).
2. Decoder: Takes this context vector and generates the output sequence one element at
a time.
3. Architecture Flow
Step-by-Step Process:
1. Input sequence:
( x_1, x_2, x_3, ..., x_T )
2. Encoder:
Processes each input sequentially to produce hidden states:
[
h_t = f(W_x x_t + W_h h_{t-1})
]
The final hidden state ( h_T ) acts as the context vector (C), representing the entire input
sequence.
3. Decoder:
Takes the context vector ( C ) as input and predicts output
sequence: [
s_t = f(W_y y_{t-1} + W_s s_{t-1} + W_c C)
]
[
y_t = g(W_o s_t)
]
where:
4. Diagram Representation
Encoder: x1 → x2 → x3 → ... → xT
↓
Context Vector (C)
↓
Decoder: y1 → y2 → y3 → ... → yT'
• The encoder compresses the input sequence into a single vector.
5. Mathematical View
Encoder Phase:
[
h_t = f(W_h h_{t-1} + W_x x_t + b_h)
]
Final context:
[
C = h_T
]
Decoder Phase:
[
s_t = f(W_s s_{t-1} + W_y y_{t-1} + W_c C)
]
[
y_t = g(W_o s_t + b_o)
]
The decoder predicts one token at a time using its previous output as the next input (known as
teacher forcing during training).
To solve it, attention mechanisms were later introduced (covered in advanced architectures like
LSTM with Attention and Transformers).
7. Advantages
• Handles variable-length input and output sequences.
8. Disadvantages
• The context vector may lose information for long sequences.
9. Applications
Application Example
Machine
Translation English → French translation
Text Summarization
Converting long text into short summary
Image (encoded by CNN) → Caption (decoded by RNN)
Image Captioning
Speech Recognition
Audio (input sequence) → Text (output sequence)
Chatbots Input message → Response generation
1. Introduction
A Deep Recurrent Neural Network (Deep RNN) is an extension of a basic RNN where multiple
recurrent layers are stacked on top of each other.
This deeper architecture allows the model to learn hierarchical temporal features — lower layers
capture short-term patterns, while higher layers capture long-term dependencies or more abstract
representations.
In simple terms:
• A shallow RNN → one layer of recurrence
2. Why Go Deeper?
A standard RNN can capture only limited temporal relationships due to its single hidden layer.
However, many real-world sequences (like speech or language) contain patterns at multiple time
scales — short-term (words) and long-term (sentences or context).
Stacking multiple RNN layers increases representational power, helping the network:
3. Architecture Overview
In a Deep RNN, each layer’s hidden state output becomes the input for the next layer.
At time step ( t ):
[
h_t^{(1)} = f(W_x^{(1)} x_t + W_h^{(1)} h_{t-1}^{(1)} + b^{(1)})
]
[
h_t^{(2)} = f(W_x^{(2)} h_t^{(1)} + W_h^{(2)} h_{t-1}^{(2)} + b^{(2)})
]
[
h_t^{(3)} = f(W_x^{(3)} h_t^{(2)} + W_h^{(3)} h_{t-1}^{(3)} + b^{(3)})
]
[
y_t = g(W_y h_t^{(3)} + b_y)
]
4. Diagram Representation
Layer 3: h1(3) → h2(3) → h3(3)
↑ ↑ ↑
Layer 2: h1(2) → h2(2) → h3(2)
↑ ↑ ↑
Layer 1: h1(1) → h2(1) → h3(1)
↑ ↑ ↑
Input: x1 x2 x3
Here:
• Layers (vertically)
This increases model power but also leads to training challenges like:
• Vanishing/exploding gradients
• Slow convergence
To counter these issues, LSTM and GRU layers are often used instead of vanilla RNN cells.
6. Advantages
Advantage Explanation
Better temporal
Learns dependencies at multiple time scales
understanding
Higher representational
Each layer extracts more complex features
power
Works better for complex tasks like translation and speech
Improved performance
recognition
Reusable features Lower layers can capture general temporal structures
7. Disadvantages
Disadvantage Explanation
More parameters and deeper gradient
Harder to train
flow
Prone to vanishing/exploding
Especially with many layers
gradients
Higher computation cost Needs more memory and training time
Requires large datasets To avoid overfitting
8. Applications
Field Example
Multiple recurrent layers extract phonetic → word → sentence-level
Speech Recognition
patterns
Language Modeling Deeper models capture sentence-level semantics
Time-Series
Handles complex multivariate time dependencies
Forecasting
Video Processing Frame-level + motion-level temporal understanding
9. Key Takeaways
• Deep RNNs = multiple RNN layers stacked vertically.
• Each layer refines the temporal representation from the previous one.
1. Introduction
A Recursive Neural Network (RecNN) is a type of neural network that works on hierarchical
structures such as trees, rather than flat sequences.
While an RNN processes data sequentially (left to right or time step by time step), a RecNN
processes data recursively, combining information from smaller parts into larger structures.
3. Architecture Concept
A Recursive Neural Network builds a tree where each parent node is computed as a function of its
child nodes.
If two child nodes have representations ( h_1 ) and ( h_2 ), then their parent node representation
( p ) is computed as:
[
p = f(W [h_1; h_2] + b)
]
where:
This process continues recursively up the tree until a single vector representation of the entire
structure (the root) is formed.
[Sentence]
/ \
[NP: The movie] [VP: was great]
/ \ / \
The movie was great
Each word is converted into a word embedding (vector).
The RecNN then recursively combines these embeddings bottom-up to form phrase vectors and
finally a sentence vector.
5. Mathematical Formulation
For a node ( j ) with two child nodes ( l ) and ( r ):
[
h_j = f(W [h_l; h_r] + b)
]
where:
• ( f ): activation function
If the tree has more than two children, the same function can be applied recursively across all
children.
6. Training
Training is done through a modified version of Backpropagation called Backpropagation
Through Structure (BPTS), where gradients are propagated through the tree structure rather
than through time (as in RNNs).
The model learns by minimizing a loss function (e.g., classification error, semantic distance) using
gradient descent.
7. Advantages
Advantage Explanation
Captures hierarchical
Works on tree-structured inputs rather than flat sequences
structure
Better sentence representation Understands nested dependencies in language
Reduces complexity, since the same function is used across the
Shared parameters
tree
Strong in semantic tasks Captures compositional meaning (e.g., sentiment of entire phrase)
8. Disadvantages
Disadvantage Explanation
Needs structured input Requires a tree structure (like parse trees) before training
Computationally Traversing and backpropagating through trees is
heavy complex
Hard to parallelize Tree structures vary in depth and branching factor
Data preprocessing Requires syntactic parsing, which can introduce errors
9. Applications
Domain Example
NLP Sentiment analysis using phrase trees
Semantic Parsing Understanding sentence meaning hierarchically
Computer Vision Scene understanding based on part hierarchies
Expression Parsing and evaluating mathematical or logical
Evaluation expressions
1. Introduction
Recurrent Neural Networks (RNNs) are built to handle sequential data and remember past
information.
However, in practice, they often fail to learn relationships between inputs that are far apart in
time.
This problem is known as the Long-Term Dependency Problem — it’s the reason why models
like LSTM and GRU were created.
• In a sentence like:
“The color of the car is red,”
understanding “is red” depends on remembering “color” that appeared much earlier.
So, a model must retain information over several time steps — that’s a long-term dependency.
However, standard RNNs can only retain short-term memory due to how gradients behave during
training.
During this process, gradients are multiplied repeatedly by the same weight matrix at each time
step.
This means information from earlier steps either disappears or explodes as it travels backward
through time.
When the activation function (like tanh or sigmoid) squashes values between −1 and 1, the gradient
becomes smaller with each time step.
Mathematically,
[
\frac{\partial L}{\partial W} \approx \prod_{t=1}^{T} \frac{\partial h_t}{\partial h_{t-1}}
]
Effect:
If the gradient terms > 1, the multiplication across many steps causes values to blow up
exponentially.
Effect:
• Training diverges.
Solution:
Gradient clipping (limit the gradient magnitude) is often used to fix this.
6. Impact on Learning
Because of these issues, standard RNNs:
• Fail on tasks requiring long memory (like paragraph-level understanding, long time series).
This is why models like LSTM, GRU, and attention-based networks were developed — to maintain
stable gradients and store information for longer periods.
7. Illustration
Time Steps → t1 → t2 → t3 → ... → tT
↓ ↓ ↓ ↓
(gradient decays →→→) → early inputs lose influence
In long sequences, gradients fade out before reaching earlier time steps — so the RNN can’t connect
distant relationships.
9. Key Takeaways
• The core issue is vanishing or exploding gradients during backpropagation through time.
• LSTM, GRU, and attention models were specifically designed to overcome this limitation.
• Managing gradient flow and memory representation is the main challenge for
sequence models.
1. Introduction
An Echo State Network (ESN) is a special kind of Recurrent Neural Network (RNN) that belongs to
a family called Reservoir Computing models.
This approach makes ESNs faster to train and more stable while still being able to model complex
temporal dynamics.
2. Architecture Overview
An Echo State Network has three main components:
1. Input Layer:
Projects input signals into the reservoir.
3. Output Layer:
Reads from the reservoir state and produces the final output. Only
this layer’s weights are learned.
3. Mathematical Model
At each time step ( t ):
1.
Reservoir State Update:
[
h_t = f(W_{in} x_t + W h_{t-1} + b)
]
4. Training
• The reservoir weights ( W ) and input weights ( W_{in} ) are initialized randomly
and remain fixed.
• The only parameter learned is ( W_{out} ), which is trained using linear regression
(or ridge regression).
• Less prone to gradient problems, since backpropagation through time is not used.
5. Echo State Property
The ESN’s reservoir must satisfy a critical condition called the Echo State Property (ESP): The
influence of a previous input on the current state must fade away gradually over time.
In simpler terms, the reservoir should not explode or retain infinite memory — it should “echo” past
information with decreasing strength.
Mathematically, this is ensured if the spectral radius (largest absolute eigenvalue) of the reservoir weight
matrix ( W ) is less than 1:
[
\rho(W) < 1
]
6. Advantages
Advantage Explanation
Only output weights are trained (no backpropagation through time)
Fast training
7. Disadvantages
Disadvantage Explanation
Reservoir tuning required Proper initialization (size, spectral radius) is critical
Random weights Performance depends on random initialization quality
Reservoir is fixed, cannot adjust internal dynamics during
Limited adaptability
training
Not ideal for highly nonlinear
Since only output weights adapt
dependencies
8. Applications
Domain Example
Time Series Forecasting
Predicting weather, traffic, or stock data
Phoneme recognition or sound pattern analysis
Speech Processing
Control Systems System identification and adaptive control
EEG/ECG Signal
Detecting brain or heart activity patterns
Analysis
• Proper control of the spectral radius ensures Echo State Property and stable dynamics.
Standard RNNs update the hidden state fully at every time step, which often causes rapid
forgetting of older information.
To counter this, researchers introduced leaky units and similar mechanisms that allow the network
to retain information over longer periods by controlling how fast the hidden state updates.
Instead of replacing the hidden state ( h_t ) entirely at each time step, a leaky unit uses a leak rate
(also called decay or time constant):
[
h_t = (1 - \alpha) h_{t-1} + \alpha f(Wx_t + Uh_{t-1} + b)
]
Where:
• If ( \alpha ) is small (like 0.1) → the neuron keeps memory longer, updating little each step
Effect:
The unit behaves like a slow-moving average, keeping past information alive.
4. Why We Need Leaky Units
Issue in Standard RNN Solution Provided
Quickly overwrites old info Slowly updates state
Vanishing gradients for long Maintains memory over longer
dependencies time
Poor performance on long sequences Handles multiple time scales
• Prosody in speech
b) Clockwork RNN
Different parts of the network update at different time intervals (like clocks ticking at different
speeds).
c) Skip/Residual Connections
Skip connections help gradients propagate across long time spans and layers.
LSTMs/GRUs introduce gates to control information flow and preserve long-term memory.
They can be seen as advanced, learnable leaky units.
6. Benefits
Benefit Explanation
Better long-term memory Helps model capture slow-changing patterns
Improved gradient flow Reduces vanishing gradient issues
Smooth updates avoid overfitting to recent
More stable learning
inputs
Handles complex
Useful for speech, sensor data, text
sequences
7. Limitations
Limitation Reason
More hyperparameters Requires tuning leak rate α
Harder to optimize than gated units LSTM/GRU often perform better
Not ideal for extremely long Better combined with other
dependencies models
8. Applications
Field Example
Time-Series Forecasting Weather, finance, climate
Prosody, phoneme
Speech Processing
sequence learning
Control Systems Robotic motion with memory states
Natural Language
Paragraph-level context
Processing
9. Key Takeaways
• Leaky units update hidden states slowly → preserve memory.
• Used as a bridge between simple RNNs and gated networks (LSTM, GRU).
1. Introduction
The Long Short-Term Memory (LSTM) network is a special type of Recurrent Neural Network
(RNN) designed to remember information for long periods and avoid the vanishing/exploding
gradient problem.
LSTM was introduced by Hochreiter and Schmidhuber (1997) to allow the model to store, use,
and forget information selectively through gates — making it capable of learning long-term
dependencies.
These gates help the network retain useful information over hundreds of time steps.
1. Forget Gate:
Controls what information to discard from the previous cell state
[
f_t = \sigma(W_f [h_{t-1}, x_t] + b_f)
]
2. Input Gate:
Decides what new information to add to the cell state
[
i_t = \sigma(W_i [h_{t-1}, x_t] + b_i)
]
[
\tilde{C}t = \tanh(W_C [h{t-1}, x_t] + b_C)
]
4. Output Gate:
Determines what to output
[
o_t = \sigma(W_o [h_{t-1}, x_t] + b_o)
]
[
h_t = o_t * \tanh(C_t)
]
Here:
• ( * ): element-wise multiplication
4. Output gate produces the next hidden state ( h_t ), which is also used for the next time step.
The cell state acts like a conveyor belt, flowing through time with minor linear interactions — this is
what preserves long-term memory.
This makes LSTM stable during backpropagation and effective even on long sequences.
7. Advantages of LSTM
Advantage Description
Long-term memory Maintains information over many time steps
Solves vanishing gradient problem
Stable gradient flow through gates
Learns what to remember or forget automatically
Selective memory
8. Disadvantages of LSTM
Disadvantage Explanation
Computationally expensive
More gates → more parameters
Training time Slower than simple RNNs or GRUs
Complex architecture Harder to interpret
Needs regularization for small datasets
Overfitting risk
• Similar performance
• Easier to implement
b) Peephole LSTM
Adds direct connections from the cell state to gates, allowing gates to “peek” at the memory state.
10. Applications
Domain Use Case
Machine translation, text generation, sentiment
NLP
analysis
Speech
Sequence modeling for audio frames
Recognition
Time Series Stock, weather, energy forecasting
Video Analysis Action recognition, frame prediction
Anomaly Detection Detecting unusual temporal patterns
1. Introduction
Training recurrent neural networks (RNNs) over long sequences is extremely challenging because of
gradient instability — either vanishing or exploding gradients during Backpropagation
Through Time (BPTT).
Even with architectures like LSTM or GRU that mitigate these issues, optimization still requires special
care to ensure stability, convergence, and proper long-term learning.
This section focuses on techniques and strategies that improve optimization for long-term dependencies.
2. Main Challenge
The Gradient Problem
When an RNN is unrolled over many time steps, the gradient of the loss function with respect to
parameters is a product of many Jacobians:
This repeated multiplication can cause:
3. Optimization Strategies
1. Gradient Clipping
Prevents exploding gradients by capping the gradient magnitude before parameter updates.
• Dropout in RNNs (variational dropout): applies same dropout mask across time steps.
• Zoneout: randomly preserves some hidden activations from the previous time step instead
of dropping them.
Instead of backpropagating through the entire sequence, the network is trained over shorter sub-
sequences.
For example:
This reduces computational cost and mitigates vanishing gradient effects, while still learning temporal
patterns.
6. Layer Normalization
Stabilizes hidden activations by normalizing neuron outputs across features, leading to smoother gradient
flow.
Used extensively in deep and stacked RNNs to maintain consistent scales through layers and time.
Connecting layers or time steps directly (skipping intermediate ones) allows gradients to bypass vanishing
paths, similar to ResNet principles.
For example:
[
h_t^{(l)} = h_t^{(l)} + h_t^{(l-1)}
]
This helps deep RNNs propagate long-term dependencies effectively.
8. Adaptive Optimizers
Use modern optimization algorithms like:
• RMSProp
• Nadam
These adjust learning rates dynamically based on gradient history, improving stability during long-
sequence training.
4. Empirical Tricks
Technique Purpose
Gradient clipping Prevents exploding gradients
Learning rate
Smooths convergence
scheduling
Batch normalization Stabilizes intermediate activations
Prevents overfitting and improves
Noise injection
generalization
Sequence shuffling Reduces temporal bias during training
6. Key Observations
• Optimization issues are not just architectural but also training-level problems.
7. Applications
• Speech recognition → stable training over thousands of audio frames.
8. Key Takeaways
Concept Description
Gradient Instability
Main obstacle in training long-sequence models
Core Fix Gradient clipping, gated architectures
Supported via additive memory (LSTM) or slow update (leaky units)
Long-Term Memory
Training Optimization
Requires adaptive learning rates and careful regularization
9. Summary Table
Technique Purpose Effect
Gradient Clipping Limit gradient magnitude Prevent explosion
Reduce vanishing
Proper Initialization Stabilize training
gradients
LSTM / GRU Structural fix Enable long-term memory
Practical backpropagation
TBPTT Reduces cost
Layer Normalization
Smoother activations Better convergence
Adaptive Optimizers
Auto-tune learning rates Faster, stable training
Explicit Memory
1. Introduction
Traditional RNNs (including LSTM and GRU) store information implicitly inside hidden states and cell
states.
However, their memory capacity is limited — once the sequence is long or the required dependency is
far away, the model starts to forget.
To overcome this, researchers introduced Explicit Memory Mechanisms, where the network has a
separate memory component that it can read from and write to — similar to how a computer
uses RAM.
This idea enables neural networks to:
3. Architecture Overview
An Explicit Memory Network has the following components:
1. Controller – a neural network (like an RNN or LSTM) that decides what to write/read.
4. Output Unit – produces predictions using controller outputs and read memory content.
Conceptual Diagram
┌──────────────────────────────┐
Input ───▶ │ Controller (LSTM) │
└──────────────────────────────┘
│
┌────────────────┴────────────────┐
▼ ▼
[ Write Head ] [ Read Head ]
│ │
▼ ▼
┌──────────────────────────────────────────┐
│ External Memory Matrix (M) │
└──────────────────────────────────────────┘
│
▼
[ Output ]
4. Mathematical Representation
Let the memory matrix at time ( t ) be ( M_t \in \mathbb{R}^{N \times D} ):
Write Operation:
[
M_t = M_{t-1} + w_t^{write} \otimes c_t
]
where:
Read Operation:
[
r_t = M_t^T w_t^{read}
]
where:
Both read and write weights are generated differentiably using attention-like mechanisms, enabling
the entire system to be trained via gradient descent.
• Memory is a set of facts; the model learns which ones to attend to (using attention).
• Advanced version of NTM with dynamic memory allocation, temporal links, and better
memory management.
d) Transformer Models
• Though not strictly "external memory," Transformers use self-attention, which acts as an
implicit memory retrieval mechanism across the entire sequence.
6. Advantages
Advantage Description
Long-term storage Keeps information for unlimited time steps
Learnable read/write Model learns how to store and retrieve relevant info
High reasoning
Can solve algorithmic and question-answering tasks
power
We can visualize what the model stores and
Interpretability
accesses
7. Disadvantages
Disadvantage Explanation
Managing external memory increases computational
High complexity
cost
Difficult training Hard to stabilize read/write attention
Requires large data Needs diverse examples to learn storage behavior
Memory
Risk of overwriting or underusing memory slots
management
8. Applications
Domain Example
Question Answering Reading comprehension (bAbI dataset)
Reasoning Multi-hop reasoning (Memory Networks, DNC)
Algorithmic Tasks Copying, sorting, associative recall
Reinforcement
Navigation and planning with long-term memory
Learning
Sequence modeling with implicit self-attention
Transformers
memory
9. Comparison Summary
Memory
Model Description
Type
RNN Implicit Limited by hidden state
LSTM/
Semi-implicit Memory cell with gates
GRU
NTM /
Explicit External read/write memory
DNC
Implicit Self-attention acts as memory
Transformer
global lookup
• It bridges the gap between traditional RNNs and symbolic reasoning systems.