Chapter 4
Associative Memory & RNNs
Pattern association, auto- vs hetero-associative memory, feedforward vs recurrent associative networks, RNNs (LSTM, GRU), the Hopfield network and BAM.
From: Chapter 4_Associative Memory.pptx, Chapter 4_RNNs.pptx
Pattern association (slide 4)
- Association: a link between things. In AI, the system learns that one pattern is related to another.
- Pattern: something that repeats or has a consistent structure we can detect and predict.
- Pattern association: identifying, learning and linking relationships between patterns (words, symbols, images, sounds), based on co-occurrence, similarity, or contextual relevance.
Associative memory (slides 7–11)
A memory system that retrieves information by its association with other information. It is content-addressable: it maps a set of input patterns to a set of output patterns.
| Auto-associative | Hetero-associative | |
|---|---|---|
| Maps | A pattern to itself | An input to a different output pattern |
| Retrieves | The stored pattern that most closely resembles the input | A pattern different in content, and possibly in type and format |
| Purpose | Pattern completion, noise correction | Associating different types of patterns |
| Example net | Hopfield network | BAM (Bidirectional Associative Memory) |
| Everyday example | Blurry cat → clear cat; partly hidden face → full face | Cat picture → “meow”; word → definition; letter → alphabet position |
Architectures (slide 12)
| Feedforward | Recurrent (iterative) | |
|---|---|---|
| Flow | One direction, input → output. No loops, no feedback | Feedback loops; updates repeatedly until it stabilises |
| Auto-associative | Feedforward autoassociative: reconstructs/cleans noisy input | Recurrent autoassociative: Hopfield |
| Hetero-associative | Feedforward heteroassociative: e.g. Hebbian network | Recurrent heteroassociative: BAM |
Exercise answers (slide 14)
- Messy handwritten “5” corrected to “5” → auto-associative.
- English sentence → Malay translation → hetero-associative.
- “artific…” → “artificial” (completion) → auto-associative.
- Email → spam / not spam → hetero-associative.
- Corrupted audio → clean original audio → auto-associative.
- Symptoms → disease label → hetero-associative.
Recurrent Neural Networks (RNN slides 2–8)
- Built for sequential data (each item depends on others, e.g. time series).
- Feedback loops let it remember past information. The output of one step feeds into the next along with the current input.
- Defining feature: the hidden state (memory state) keeps essential information from earlier inputs.
- Weights: U = input → hidden, W = hidden → hidden, V = hidden → output.
- Unfolding expands the recurrence over time steps, one layer per step. It enables backpropagation through time (BPTT).
- Weakness: good at short-term memory, but forgets long-term dependencies (vanishing gradient). Analogy: summarising a book page by page and forgetting early pages.
- Applications: next-word prediction, speech-to-text, stock prices, power consumption, cardiac arrest and readmission prediction, game moves and player behaviour.
| Type | Key idea |
|---|---|
| LSTM | Memory mechanism to beat the vanishing gradient. Three gates: input (add new info), forget (discard old info), output (what to output now). Handles long-term dependencies |
| GRU | Simplifies LSTM by merging input and forget gates into one update gate. Computationally efficient, often as good as LSTM, faster to train |
Hopfield network (RNN slides 9–13)
- Hopfield, 1982. A simple assembly of perceptrons that can overcome the XOR problem.
- Recurrent, fully interconnected: every unit connects to every other unit (no self-loops). Signals go back and forth in a closed loop until they settle in stable states.
- Auto-associative: stores individual patterns, not input–output pairs. Single layer.
- Recall: compute net input, apply the output function to get X′, feed X′ back to get X″, and repeat until the output stops changing.
- With an incomplete or distorted input, it settles on the most similar stored pattern: pattern completion. Analogy: typing “Goog” → “Google”.
Bidirectional Associative Memory (RNN slides 14–20)
- Developed by Kosko (1988). Hetero-associative, two layers connected by directional weighted paths.
- Stores associations by summing bipolar correlation matrices (an n×m outer product per pair).
- Signals go back and forth between the two layers until all neurons reach equilibrium.
W = Σₘ Xₘ · Yₘᵀ
Step 1, storage: sum of outer products of each bipolar pair
Yₘ = sign(Wᵀ · Xₘ)
Step 2, testing: recall Y from X (and X = sign(W · Y) the other way)
Y(p) = sign[Wᵀ X(p)] then X(p+1) = sign[W Y(p)]
Step 3, retrieval: repeat until X and Y stop changing
| Hopfield | BAM | |
|---|---|---|
| Type | Auto-associative | Hetero-associative |
| Connections | Fully connected, no self-loops | Input layer ↔ output layer |
| Layers | Single layer | Two layers |
| Function | Pattern with itself: completion, error correction | Two-way mapping between two sets of patterns |
| Applications | Pattern recognition, content-addressable memory, error correction in communication | Translation/mapping (letters → numbers), associative reasoning, bi-directional ML tasks |