Course contentsShow
← Machine Learning and Deep Learning
Lesson 1010 of 3,53823. Recurrent Neural NetworksFree lesson

Bidirectional RNNs

Processing sequences in both forward and backward directions to capture context from past and future.

Bidirectional RNNs

What you'll learn: How to process sequences in both directions simultaneously to capture complete context from both past and future time steps.

The Limitation of Standard RNNs

In all the RNN architectures you've learned so far (many-to-one, one-to-many, many-to-many), information flows in one direction: from earlier time steps to later ones. The hidden state at time t only knows about the past—what came before it in the sequence. But what if understanding the future context is equally important?

Reading Forward and Backward

A Bidirectional RNN processes the input sequence in both directions:

  • One RNN reads the sequence forward (left to right)
  • Another RNN reads the same sequence backward (right to left)

At each time step, you have two hidden states: one from the forward pass and one from the backward pass. These are typically concatenated to form a single representation that captures both past and future context.

Real-World Analogy

Think about understanding a sentence. When you read "The animal didn't cross the street because it was too tired," you need words that come after "it" to understand what "it" refers to. A unidirectional RNN processing left-to-right wouldn't know "tired" is coming. A bidirectional RNN sees the whole context.

When Bidirectional RNNs Excel

Bidirectional RNNs are powerful for tasks where you have access to the entire sequence during prediction:

  • Sentiment analysis: The full sentence determines sentiment
  • Named entity recognition: Surrounding words help identify entities
  • Machine translation: Understanding complete source sentences before translating

They're not suitable for real-time prediction where future inputs aren't available yet.

Key Takeaway: Bidirectional RNNs process sequences in both forward and backward directions, capturing richer context by combining past and future information into each time step's representation.