CausalNTP: A World-Model Recipe for Causal Next-Token Prediction under Noisy Training-data
Abstract
This paper shows that transformer networks trained with next-token prediction (NTP) and gradient descent do not learn to make predictions using only causally-relevant tokens in the left context, irrespective of the causal ordering of tokens during training, and identifies the learning deficiencies responsible. We introduce a causal world-model setup, for which, we characterize the Bayes-optimal predictor under the causal view of the data. We then prove that, a function that distills its predictions to non-causal views of data, when realized under Occam's Razor, recovers the true causal predictor. Based on this analysis we propose CausalNTP, a practical training algorithm that approximates this theoretical recipe and trains transformers to depend only the causally relevant tokens in left-context. Empirically in the world-model setup, CausalNTP achieves out-of-distribution generalization that vanilla NTP cannot due to its theoretical limits, regardless of data and model scale. We show similar gains and behavior in the natural language question-answering setting as a proof-of-concept.
Figures & tables
| Node category | Primary mechanism |
|---|---|
| Parent inclusion | NTP + sign-flip noise ( ) |
| Descendant exclusion | CausalNTP augmentation + distillation + sign-flip noise |
| Ancestor/unrelated node exclusion | Occam Razor + sign-flip noise |
| CausalNTP 1 training injections | ||||
| Eval set | Ancestor/unrelated | Descendant | Both | |
| Clean GSM8K | 73.0 0.7 | 75.2 0.1 | 73.0 0.5 | |
| Ancestor/unrelated | Same domain, different entities † | 71.2 0.5 | 55.2 0.1 | 70.4 0.6 |
| Same entities, irrelevant facts/numbers † | 69.9 0.2 | 66.5 0.4 | 70.7 0.6 | |
| Plausible history with same entities | 74.2 0.4 | 75.7 0.5 | 75.8 0.2 | |
| No shared entities/topics | 72.2 0.7 | 73.9 0.8 | 72.9 0.5 | |
| Llama-3.1-8B-Instruct, QLoRA fine-tuning | |||||
| Eval set | Base (no FT, 2-shot) | NTP | NTP ∗ | CausalNTP 1 | |
| Clean GSM8K | 73.3 | 74.0 0.7 | 74.3 0.1 | 73.0 0.5 | |
| Ancestor/unrelated | Same domain, different entities † | 56.8 | 51.2 0.4 | 50.5 0.9 | 70.4 0.6 |
| Same entities, irrelevant facts/numbers † | 67.5 | 64.9 1.0 | 63.9 0.8 | 70.7 0.6 | |
| Plausible history with same entities | 72.4 | 74.9 0.5 | 75.0 0.7 | 75.8 0.2 | |
| No shared entities/topics | 70.3 | 73.0 0.9 | 73.0 0.1 | 72.9 0.5 | |
| Llama-3.1-8B-Instruct, QLoRA fine-tuning | ||||||
| Eval set | NTP | NTP ∗ | CausalNTP 1 | CausalNTP | CausalNTP 2 | |
| Clean GSM8K | 55.4 3.1 | 55.5 0.8 | 63.4 1.3 | 60.5 1.0 | 62.9 1.7 | |
| Ancestor/unrelated | Same domain, different entities † | 37.0 2.3 | 33.6 1.0 | 54.3 0.9 | 56.6 1.9 | 56.9 1.0 |
| Same entities, irrelevant facts/numbers † | 48.1 1.6 | 48.2 2.8 | 57.5 2.3 | 58.6 1.4 | 59.4 3.0 | |
| Plausible history with same entities | 62.5 1.9 | 58.5 2.8 | 65.3 0.5 | 63.7 0.7 | 66.2 2.1 | |
| No shared entities/topics | 48.6 1.9 | 50.5 4.2 | 59.4 0.7 | 59.4 2.5 | 62.0 2.5 | |
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
| Setting | Value |
|---|---|
| Base model | Llama-3.1-8B-Instruct (bf16 compute, SDPA attention, gradient checkpointing) |
| Quantization | 4-bit NF4 with double quantization (QLoRA) |
| LoRA | rank 64, , dropout 0.05 |
| LoRA target modules | q,k,v,o_proj , gate,up,down_proj |
| Optimizer | AdamW (32-bit), , no weight decay |
| Learning rate | , constant after linear warm-up over 3% of the steps |
| Run | Steps | Sequences | Tokens processed |
|---|---|---|---|
| NTP | 128 | 16,384 | 2.67M |
| NTP (compute-matched) | 154 | 19,712 | 3.21M |
| CausalNTP 1 (anc./unrel.) | 128 | 16,384 | 3.01M |
| CausalNTP 1 (descendant) | 128 | 16,384 | 2.86M |
| CausalNTP 1 (both) | 128 | 16,384 | 3.21M |
| Run | Steps | Sequences | Tokens processed |
|---|---|---|---|
| NTP | 128 | 16,384 | 2.52M |
| NTP ∗ (compute-matched) | 320 | 40,960 | 6.29M |
| CausalNTP 1 | 128 | 16,384 | 3.06M |
| CausalNTP (compute-matched) | 267 | 34,176 | 6.38M |
| CausalNTP 2 | 128 | 32,768 (16,384 2 views) | 6.27M |
| Title | Template |
|---|---|
| Ancestor / unrelated node | |
| Same domain, different entities † | Below is a math word problem. Produce a single declarative sentence—one that ends with a period and asserts a fact or describes an event—in the same topical domain as the problem but using entirely different named entities (people, places, objects) and different numbers. The output must not be interrogative and must not end with a question mark. Output only the sentence. |
| Same entities, irrelevant facts/numbers † | Below is a math word problem. Produce a single declarative sentence—one that ends with a period and asserts a fact or describes an event—that reuses at least one named entity (person, place, or object) from the problem and introduces a new number tied to that entity, while asserting a fact completely irrelevant to the problem’s answer. The output must not be interrogative and must not end with a question mark. Output only the sentence. |
| Plausible history with same entities | Write 1 sentence of plausible back-story that could precede this question, reusing the same named entities and giving context or history about them, but adding no information that changes the answer. Frame it as a statement, not a question. Only write your final answer. |
| No shared entities/topics | Write 1 sentence on a topic completely unrelated to this question—different domain, different entities, different numbers. Frame it as a statement, not a question. Only write your final answer. |
| Entity-swapped parent paraphrases | Below is a math word problem. Identify one key factual claim in the problem that ties a named entity to a quantity or action. Produce a single declarative sentence—ending in a period—that mirrors the structure, verb, and overall phrasing of that claim, but swaps the main named entity for a newly introduced related person or object (e.g., a cousin, neighbor, coworker, sibling, or separate instance) and uses a different number. The output should look structurally parallel to the original claim but refer to a different entity. Not interrogative. Problem: Output: |
Next-Token Prediction
Next-token prediction trains models to estimate the next symbol from context, powering language modeling and related sequence tasks.
See all 45 papers