ML for NLU · Term Paper
An exploration of how differently autoregressive and diffusion architecture deal textual data. Specifically, LLaMA-3-8B-Base and LLaDA-8B-Base were used in the experiment.
Full Paper
Autoregressive and Diffusion Language Models: How Each Architecture Encodes and Accesses Linguistic Knowledge
Two paradigms generate text differently and that difference is measurable:
| Autoregressive (LLaMA-3-8B) | Masked Diffusion (LLaDA-8B) | |
|---|---|---|
| Generation | Left-to-right, one token at a time | Iterative denoising, full sequence |
| Attention | Causal (past only) | Bidirectional (full context) |
| Reversal drop (causal facts) | 90% | 20% |
| Infilling perplexity ↓ | 49.8 (left-only) / 35.6 (SPM) | 20.1 |
| Infilling BERTScore F1 ↑ | 0.842 / 0.849 | 0.904 |
Claim: Neither is "better." The training objective biases each model toward different linguistic tasks. AR is dominant for scale and fluency; diffusion has structural advantages on tasks requiring bidirectional conditioning.
A sequence's joint probability is factored left-to-right:
Implemented with causal masked attention — the upper-triangular mask blocks any view of future tokens:
The model commits to each token without seeing what comes after. Errors compound (exposure bias) and reverse-direction facts are never reinforced.
Forward (corruption) — gradually mask tokens. For original token at step :
where is the one-hot for [MASK] and controls how much of the original survives (, fully visible; , fully masked).
Reverse (denoising) — a bidirectional transformer recovers the original distribution:
At every denoising step, every position attends to every other non-masked position. Right context is a constraint, not a hint.
Setup. Berglund et al. (2023) showed that AR models trained on "A is B" fail at "B is A" — the reversal curse. Their analysis was limited to identity relations and flagged causal/spatial/logical relations as open questions. This paper extends the test to causal relations.
Why causal? The form "A causes B" (forward) and "B is caused by A" (reverse) maps directly onto the AR training signal: only the forward direction gets gradient updates.
| Direction | LLaMA-3 (fine-tuned, fictional) | LLaDA (zero-shot, real) |
|---|---|---|
| Forward (cause → effect) | 100% (10/10) | 70% (7/10) |
| Reverse (effect → cause) | 10% (1/10) | 50% (5/10) |
| Reversal drop | 90% | 20% |
Reading the result. LLaMA-3 learned the forward form perfectly but cannot retrieve it in reverse — its left-to-right gradient never reinforced that direction. LLaDA's bidirectional masking exposes both directions during training, and the reversal drop drops by ~70 percentage points. The two evaluations are not a controlled comparison (different data, different fine-tuning state) — they are complementary evidence for the directional asymmetry hypothesis.
Task. Given left context + right context, predict the missing middle span. AR models cannot do this natively because causal attention blocks the right side. The standard workaround is Fill-in-the-Middle (FIM) with the Suffix-Prefix-Middle (SPM) prompt format (Bavarian et al., 2022): rearrange the input so the suffix appears first, giving the model a "preview" of the right context as background.
LLaDA does it natively: at every denoising step, all non-masked tokens (including the right context) participate in attention.
[left] [MASK]×n [right] fed to the denoiser.| Model | Conditioning | BERTScore F1 ↑ | Perplexity ↓ |
|---|---|---|---|
| — | Original sentence | — | 26.7 |
| LLaMA-3-8B-Base | Left context only | 0.842 | 49.8 |
| LLaMA-3-8B-Base | SPM (right context first) | 0.849 | 35.6 |
| LLaDA-8B-Base | Full masked sequence | 0.904 | 20.1 |
The pattern. SPM helps LLaMA-3 — perplexity drops 14.2 points — but a 15.5-point gap to LLaDA remains. SPM exposes right context as input tokens; LLaDA conditions on right context at every denoising step. Information availability ≠ structural integration. LLaDA even beats the original sentence on perplexity (20.1 < 26.7), suggesting the denoiser converges on highly fluent reconstructions.
"The scientist carefully placed the sample under ___ to examine its cellular structure."Original: "the high-powered electron microscope"
| Condition | Output |
|---|---|
| LLaMA-3 left-only | "the microscope. He was looking for the" |
| LLaMA-3 SPM | "the microscope and adjusted the focus until" |
| LLaDA | "a high-powered microscope" |
LLaMA-3 SPM uses the right context as topical priming; LLaDA integrates it as a structural constraint on the span.
Each training objective creates measurable, predictable strengths:
The interesting research question isn't "which architecture is better?" but "which architectural inductive bias matches which linguistic phenomenon?"
Source code: github.com/Bormey-Sky/Autoregressive-and-Diffusion-Language-Models