Dive into Deep Learning · §12.2
Sequence-to-Sequence Learning and the Fixed-State Bottleneck
encoder–decoder abstraction · chrF & BLEU scoring · string reversal · effective bit capacity
Motivation
Architectural Abstraction
Information bottleneck invariant: Everything the decoder knows about the source sequence must pass through the state \mathbf{c}.
Probabilistic Formulation
P(y_{1:T'} \mid x_{1:T}) = \prod_{t'=1}^{T'} P(y_{t'} \mid y_{<t'}, \mathbf{c})
<eos>.Historical Context
Translation Metrics
F_\beta = \frac{(1 + \beta^2)\, P R}{\beta^2 P + R}, \qquad \beta = 2
p & r) and weights recall 4\times over precision.Translation Metrics
\text{BLEU} = \exp\!\left(\min\!\left(0, 1 - \frac{\text{len}_{\text{label}}}{\text{len}_{\text{pred}}}\right)\right) \prod_{n=1}^{k} p_n^{w_n}
Metric Failure Modes
Comparing chrF and sentence-level BLEU (k = 4) on a 6-word reference 'we will visit our grandparents tomorrow':
copy chrF 1.00 BLEU 1.00
near miss chrF 0.91 BLEU 0.00
paraphrase chrF 0.67 BLEU 0.00
'visits' at word 3): In a 6-word sentence, there are only three word 4-grams (1..4, 2..5, 3..6) and every single one contains word 3—so p_4 = 0 collapses BLEU to 0.00, while chrF gracefully scores 0.91.'are going to see'): Scores 0.00 on BLEU and 0.67 on chrF—lower than the ungrammatical near miss.Pair character-level chrF (or corpus sacreBLEU) with learned semantic evaluators such as COMET or LLM judges.
The Bottleneck Experiment
Model Architecture
\mathbf{s}_{t'} = g(y_{t'-1}, \mathbf{c}, \mathbf{s}_{t'-1}), \qquad \mathbf{s}_0 = \mathbf{c}
Bit-Counting Analysis
float32 vector holds 2{,}048 raw bits, whereas T \in \{8, 16, 64\} letters require only 32, 64, 256 bits (0.5 to 4.0 bits/float).Reversal Benchmark Results
Per-letter teacher-forced accuracy on 1{,}000 fresh strings after 1{,}000 AdamW steps (batch size 128, two seeds per entry; random guessing = 1/16 \approx 0.06):
width T = 8 T = 16 T = 32 T = 64
64 0.99/0.99 0.74/0.74 0.41/0.42 0.27/0.26
256 1.00/1.00 0.99/0.99 0.80/0.80 0.51/0.51
Interpreting the Bottleneck
Three quantitative findings stand out from the reversal capacity table:
Architectural Crossroads
Check Your Understanding
Test your understanding with these three questions:
Answers:
min(k, len_pred) stops at n=3; if k=4 is enforced without clipping to len_pred, p_4 = 0; even when clipped, any 4+ word candidate with a mismatch on word 3 of 6 has zero matching 4-grams and p_4 = 0).Key Takeaways
| Component / Concept | Mathematical Form | Key Property / Limitation |
|---|---|---|
| Encoder | \mathbf{c} = f_{\text{enc}}(x_1, \ldots, x_T) \in \mathbb{R}^d | Compresses variable-length source into fixed-size vector \mathbf{c} |
| Autoregressive Decoder | \prod_{t'=1}^{T'} P(y_{t'} \mid y_{<t'}, \mathbf{c}) | Assumes \mathbf{c} retains all source information needed by target |
| chrF Metric | F_2 = \frac{5PR}{4P + R} on character 1\ldots 6-grams | Robust to inflections & tokenization; rewards partial stem overlap |
| BLEU Metric | \exp(\min(0, 1 - \ell_{\text{ref}}/\ell_{\text{cand}})) \prod_{n=1}^k p_n^{w_n} | Geometric product collapses to 0 on sentence level if any p_n = 0 |
| Fixed-Vector Bottleneck | 4T bits of random string in d floats | Trained GRU packs < 1\text{ bit/float} (0.99 \to 0.26 from T=8 \to 64 at d=64) |
| Architectural Remedies | Cross-attention (O(T) cache) vs. Matrix state (O(1)) | Attention stores all tokens; §12.3–12.8 build fast, high-capacity states |