File size: 1,840 Bytes
da8c244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
license: apache-2.0
tags:
- fast-weights
- associative-memory
- meta-learning
- sequence-modeling
- gradio
---

# Fast-Weight Time Machine

Fast-Weight Time Machine tests temporary variable binding with an explicit,
sequence-local weight matrix. A controller receives key/value writes, produces a
write strength, and accumulates outer products in a fast memory. A later query key
reads the memory in one matrix-vector operation. The learned parameters stay fixed
between examples; only the fast matrix changes inside each sequence.

The historical anchor is Schmidhuber's 1992
[Learning to Control Fast-Weight Memories](https://doi.org/10.1162/NECO.1992.4.1.131),
which described feedforward controllers producing context-dependent weight changes
and included adaptive temporary-variable binding. This project is a modern
outer-product interpretation tested against a similarly sized GRU. It does not
claim to reproduce the original implementation or experiments exactly.

## Verified results

The models trained on 16,000 sequences containing four writes and 12 distractors.
Each held-out condition contained 4,000 new sequences.

| Condition | Fast weights, 2,508 params | GRU, 3,050 params |
| --- | ---: | ---: |
| 4 bindings, 12 distractors | 100.00% | 37.40% |
| 8 bindings, 12 distractors | 100.00% | 27.03% |
| 4 bindings, 64 distractors | 100.00% | 31.15% |
| 8 bindings, 64 distractors | 99.98% | 23.83% |

This task is intentionally aligned with the fast-weight architecture: an explicit
outer-product matrix can bind a key and value, while the GRU must compress all
bindings into one recurrent vector. The comparison demonstrates the inductive bias;
it is not a general claim that fast weights outperform GRUs on arbitrary sequences.

## Reproduce

```powershell
uv run python projects/fast-weight-time-machine/train.py
```