Improving Synthetic Megadocs
Oct 29, 2026, 26 min read
The goal for this project was to implement the synthetic megadocs algorithm for a slowrun-style pretraining setup, measure the data efficiency improvements, and test whether the gains carry over to continued pretraining. All experiments and this writeup were finished in 4 days, using 8xH100s.
When pretraining a 313M model from scratch on 25M real FineWeb tokens, my best megadoc method matches a tuned baseline trained on 2.38x the real data, compared to 2.03x for the paper’s best method. When continuing to pretrain the same model on 10M tokens of arXiv CS papers, it matches raw training on 2.92x the arXiv data when evaluated on held-out papers, and 5.78x on papers published after the training cutoff.
The rest of this report goes through the experiments I ran and explains the thought process behind my decisions. It assumes familiarity with Data-efficient pre-training by scaling synthetic megadocs.
Setup
I started by forking the official slowrun repository and working off of the tiny track. The setting is similar to the one in Data-efficient pre-training by scaling synthetic megadocs. Slowrun trains a ~313M autoregressive transformer on 100M FineWeb tokens, while the paper trains a 300M model on 200M DCLM tokens.
For the baseline, I used slowrun tiny-track record #10 (a473277). It reaches 3.332 val loss on 100M FineWeb tokens and includes SwiGLU, U-Net skip connections, per-head attention gating, RoPE tweaks, a weight-decay schedule and per-epoch document shuffling. The records after #10 add layer recurrence and multi-token prediction. Unlike the earlier records, which change the architecture and optimizer but keep one forward pass and one next-token loss per token, these change the compute per token or the training objective. I stopped at #10 to stay close to the paper’s setting.
I also scaled the dataset down to 25M tokens so that I could test more ideas and iterate quickly. Doing some napkin math, I worked out that generating 32 rephrases for the 100M token pool alone would take ~11 node hours.
Baselines
Figure 11 in the megadocs paper indicates that for many-epoch training, weight decay and epoch count affect performance significantly more than learning rate. Thus, I kept the LR from the record and swept over weight decay and epochs for the 25M, 50M, and 100M token pools. To speed up the epoch sweep, I used Warmup-Stable-Decay, training one long stable run and decaying off of the saved checkpoints.
Reported is the validation loss at 4096 tokens on FineWeb. The baseline is reasonably strong, since it was able to reproduce the record at 100M (3.336 at E30 vs the record’s 3.332), although it took more epochs (30 vs 16). This is because I dropped the record’s weight averaging (SWA/EMA), which averaged over memorized weights at 25M, and replaced its schedule with WSD and a flat weight decay.
The baseline could have been stronger with a finer weight decay sweep and a custom LR sweep for each epoch count. The upper end of the baseline curve may be slightly under-tuned, which would slightly overstate the larger multipliers below.
Data efficiency multipliers are computed by finding how many real tokens the baseline would need to match a given loss, using log-linear interpolation of the best-over-epochs baseline loss against the number of real tokens (3.865 / 3.551 / 3.326 at 25M / 50M / 100M).
Implementing Megadocs
Before iterating on the algorithm, I first had to implement it. I built a separate repository, megadocs, which handles the generation, filtering, and construction of megadocs.
A fair amount of thought went into designing the generation pipeline. It uses SGLang’s async engine as the backend, with a runner I wrote (with help from Claude) on top. The runner builds prompts from the tokenized documents lazily, so we don’t need to hold the full set in memory. A fixed number of requests are always in the queue, and a new one is submitted whenever one finishes. This pairs nicely with SGLang’s (or really any inference engine’s) continuous batching scheme.
With a little bit of tuning of engine parameters, we were able to process up to ~101K output tokens per second on the node, or ~12.7K TPS per GPU for Llama-3.1-8B-Instruct!
Everything apart from this is fairly standard and follows the paper’s details, like prompt construction and data filtering. For training, megadocs are shuffled, concatenated and cut into contiguous 4096-token windows, so a long megadoc spans several consecutive windows (no document masking, matching the record trainer).
Training Setting
Unless otherwise stated, every run uses 25M real tokens and draws 75% of each training batch from the synthetic stream and 25% from the real stream. I call this mixing ratio m (m=0.75 means 12 of every 16 sequences are synthetic). Since the synthetic stream also contains the real documents, real text makes up 28–37% of training tokens depending on the method.
One epoch is one pass over the real data, so at a fixed epoch count a synthetic run takes 1/(1−m) times as many steps as the baseline (4x at m=0.75). Synthetic runs use the record’s LR and WD 0.8 (the paper’s optimum is 0.4–0.8), with the same WSD epoch sweep as the baseline. I report validation loss at 4096 context on a held-out 10M-token FineWeb set.
Paper Replication
My goal was to improve on megadocs, so I started from its strongest variant. In the paper, latent thoughts give the largest data-efficiency gain, so I reproduced that first and used it as the starting point for my improvements.
| Run | Best | Multiplier | Paper Multiplier |
|---|---|---|---|
| Baseline 25M | 3.865 (E20) | 1x | 1x |
| Latent thoughts G=8 | 3.587 (E20) | 1.85x | — |
| Latent thoughts G=32 | 3.546 (E40) | 2.03x | 1.80x |
Here, G is the number of latent thoughts generated per document. Latent thoughts give large data-efficiency gains, larger than the paper reports. There are two likely causes:
-
Our baseline uses 25M real tokens while the paper uses 200M. In an extremely data-constrained setting, synthetic data provides a significant amount of regularization and signal. As we get more real data that matches the true distribution of the validation set, gains from synthetic data are probably diluted.
-
We also train on a different dataset (FineWeb vs DCLM) and measure the efficiency against our own tuned baseline. Using a fitted scaling law () instead of log-linear interpolation only lowers the multipliers slightly (~0.03–0.04x).
Because the paper found latent thoughts to be the strongest variant, and I also had great results, I assumed that iterating on latent thoughts alone was the right direction (wrong assumption!).
Latent Thought Experiments
Why do latent thoughts work?
Before trying to improve latent thoughts, I wanted to understand why they work as well as they do. The paper compares two kinds of rephrasing. In simple rephrasing, each rephrase is shuffled in as its own document, while in stitched rephrasing, a document’s rephrases are concatenated with the real document at the end. Fundamentally, latent thoughts seem to be doing something different from simple rephrasing. Simple rephrasing mostly acts as regularization, allowing the model to consume the same information in different semantic forms. Training on the thought tokens seems to teach the model why the next section comes next.
The paper briefly mentions epiplexity as an explanation for why we should stitch the real document after the rephrases, writing that “given a function which is computationally harder to invert than evaluate, learning the inverse can impart more generalizable structure to a learner … Since the rephrase is generated by a language model and is generally less detailed than the real doc, we suspect that the inverse task of generating the real doc from the rephrase is more valuable for pre-training.”
Structurally, latent thoughts are a finer-grained version of stitched rephrases, where the real document is at the end. Each thought is generated from the text around it and is less detailed than the real next chunk, so predicting that chunk from the thought is the same inverse task, done once per split point instead of once per document.
Latent thoughts are also more diverse by nature. Each thought covers a different section of the document, so each one carries different information, while every rephrase describes the same whole document. I only realized this after running the experiments below, and it makes some of them less well motivated.
Latent tree
In the original latent thoughts implementation, the prefix for every cut is the start of the document up to the cut, and the suffix runs from the cut to the end. This creates an information imbalance. An early cut may not have enough prefix to explain the suffix, and a late cut may not have enough suffix to be worth explaining.
To balance this, I split the document recursively like a binary tree. Each thought only sees one segment of the document, cut at that segment’s midpoint, so the prefix is the segment’s first half and the suffix is its second half. Positions below are fractions of the document.
Root | prefix | suffix |
L2 | prefix | suffix | prefix | suffix |
L3 | pre | suf | pre | suf | pre | suf | pre | suf |
0 1/8 1/4 3/8 1/2 5/8 3/4 7/8 1
For comparison, the original method cuts at 3/4 with prefix [0, 3/4] and suffix [3/4, 1], so the prefix is three times longer than the suffix. In the tree, every thought’s prefix and suffix are the same length. Three levels give 7 thoughts, so I compare against latent G=8.
Results
Besides FineWeb, I also report long-context evals, which truncate long documents to 4096 tokens and report the token-averaged loss. FineWeb is at each run’s best epoch (E20), and the long-context rows use the E25 checkpoints. Δ < 0 means the tree is better.
| Eval set | Tree G=7 | Latent G=8 | Δ vs G=8 |
|---|---|---|---|
| FineWeb | 3.595 | 3.587 | +0.008 |
| arXiv (cs) | 3.891 | 3.889 | +0.002 |
| GitHub (Python) | 2.754 | 2.802 | −0.048 |
| Wikipedia | 3.548 | 3.534 | +0.014 |
The tree-structured latent thoughts did not improve over standard latent thoughts on FineWeb. On the long-context evals, the tree wins on code, which could be attributed to code’s naturally hierarchical structure. The gap is smaller at E20 (2.774 vs 2.797).
Given the earlier discussion about epiplexity, the 3rd-level thoughts are likely teaching a very simple/short inversion, which may not be very helpful.
Rotate and copies
Scaling the number of thoughts from 8 to 32 helped, but putting all 32 into a single document makes the synthetic megadoc extremely long. Within this dense document, the real text proportion drops from 37% to 28.5%. Is there a way to keep the benefit of 32 thoughts while keeping each document at G=8? Short of changing the mixing ratio m, I tested:
- Rotate: each epoch, a document gets 8 of its 32 thoughts, so all 32 are shown over 4 epochs. The idea is that the model sees new thoughts every epoch instead of memorizing the same 8.
- Copies: each document appears 4 times per epoch, and each copy gets a different 8 of its thoughts. The idea is that all 32 thoughts are used every epoch without any single document getting too long.
Results
| Run | E15 | E20 | E25 | E30 |
|---|---|---|---|---|
| Dense G=32 | 3.607 | 3.580 | 3.564 | 3.557 |
| Rotate | 3.601 | 3.585 | 3.580 | — |
| Copies | 3.603 | 3.590 | 3.585 | — |
| Latent G=8 | 3.606 | 3.587 | 3.590 | 3.589 |
Neither variant improves performance meaningfully, especially given that they need 4x the generation compute of latent G=8.
The lack of improvement from rotate and copies might indicate the bottleneck isn’t the number of thoughts but how often the model sees the real data. We’re heavily data-constrained, so the model can overfit on the real documents early, which can hide the synthetic data / algorithmic gains. This fits the results, since dense G=32 has the lowest real-text share and does best, while copies shows each real document 4 times per epoch, which should make overfitting worse. Raising m later on (see Combining Rephrasing and Latent Thoughts) supports this.
One nice property of latent thoughts is that they naturally sweep over the difficulty of the inverse task. Early cuts have a short prefix and a long suffix to explain, which is difficult, and later cuts have the opposite. The latent tree removed this sweep and didn’t help on FineWeb, which suggests the sweep may be useful. The G=32 run has a very fine sweep, whereas the other three are much coarser.
Can we pick better thoughts?
Up to this point, every split got a single thought. Since we sample at temperature 1 to get diverse outputs, the quality of the thoughts varies a lot. Inspired by best-of-n sampling, I generated 4 candidate thoughts per split (G=8) and kept the best one. Each candidate was scored with Qwen3.5-0.8B-Base.
To score a thought , I compared the loss on the next split’s real text with and without the thought in context, where is the document before the split:
I then trained on the best (highest ), the worst (lowest ), or a random candidate (Latent G=8).
| Pick | E10 | E15 | E20 | E25 | E30 |
|---|---|---|---|---|---|
| Best of 4 | 3.637 | 3.606 | 3.591 | 3.581 | 3.590 |
| Worst of 4 | 3.637 | 3.607 | 3.590 | 3.593 | — |
| Latent G=8 | 3.636 | 3.606 | 3.587 | 3.590 | 3.589 |
The methods have near-identical validation losses for the first 20 epochs of training, though best-of-4 pulls away slightly at epoch 25.
When taking a closer look at what the best thoughts actually look like, they tend to closely mirror the next split. This can be measured as the share of the next split’s unique 4-grams that also appear in the thought:
where is the set of unique 4-grams. Leak is 25.6% for best, 14.7% for random, and 6.6% for worst, and correlates +0.71 with it, indicating is mostly rewarding thoughts that copy the answer.
In terms of the inverse task, a leaky thought makes the real text after it trivial to predict, thereby teaching the model less.
Subtracting the leak
To keep whatever useful signal has, I removed the part explained by leakage:
Here is the regression slope of on leak, fit within each split in the document. Across 1.12M scored candidates, the within-split correlation is +0.723 and .
| Pick | Leak | |
|---|---|---|
| Best by | 0.261 | +0.687 |
| Best by | 0.152 | +0.530 |
| Random | 0.150 | +0.197 |
Now the leak-adjusted pick leaks the same amount as random, but still carries more information about the next split.
| Pick | E20 | E25 | E30 |
|---|---|---|---|
| Best of 4 by | 3.589 | 3.590 | — |
Surprisingly, the leak-adjusted best-of-4 barely beats worst-of-4 and is only level with random (3.590 at E25). Overall, none of the selection rules separate from random by more than seed noise. One possible reason is the scorer, since was computed with Qwen3.5-0.8B-Base, a fully pretrained model. The thoughts that help it predict the next section might rely on the knowledge and priors it has, meaning they aren’t helpful for our randomly initialized model.
Taking a Step Back
None of my changes to latent thoughts beat the simplest option, which was packing all 32 thoughts into a single document.
Feeling a bit lost on latent thoughts, I ran the other megadoc type, stitched rephrases, under the same configuration.
| Rephrases (stitched) | E15 | E20 | E25 | E30 | E40 | Multiplier |
|---|---|---|---|---|---|---|
| G=8 | 3.598 | 3.583 | 3.580 | 3.581 | — | 1.88x |
| G=16 | 3.601 | 3.582 | 3.571 | 3.566 | — | 1.94x |
| G=32 | — | 3.583 | 3.568 | 3.562 | 3.556 | 1.98x |
Adding more rephrases gives solid data-efficiency gains. With 8 rephrases per document, stitched rephrasing already matches latent thoughts G=8. Increasing this to 16 and 32 keeps helping, but the returns shrink quickly. The jump from 16 to 32 rephrases is barely visible, while latent thoughts are still improving at the same point. Trained out to E40, rephrase G=32 only reaches 3.556, against 3.546 for dense latent G=32.
Once again, our multipliers are larger than the paper’s, likely because we have far less real data. As discussed earlier, rephrasing acts as a form of regularization, since each rephrase is another view of the same information, which is especially useful when real data is this scarce.
This also helps explain why rephrasing saturates. Each rephrase restates the same whole document, so each new one adds less than the last. Stitching also produces only one inverse task per document, reconstructing the real text from its rephrases, regardless of how many rephrases come before it.
In contrast, each latent thought is a new inverse task for a different part of the document. Thus every additional thought introduces unique information into the sample, which would explain why latent thoughts keep improving after rephrasing has leveled off.
Combining Rephrasing and Latent Thoughts
From a performance standpoint, the two methods look similar, but they differ greatly in mechanism. Rather than scaling either one further, I tried combining them. The new megadoc consists of rephrases stitched together, and the final document is the real one with latent thoughts inserted.
The combination also fits the epiplexity framing. The rephrases give several coarse passes over the whole document that the real text has to fill in with detail. Within the real document, latent thoughts repeat the coarse-to-fine inversion locally.
Results
| Run | E15 | E20 | E25 | E30 | E50 | Multiplier |
|---|---|---|---|---|---|---|
| Rephrase G=16 | 3.601 | 3.582 | 3.571 | 3.566 | — | 1.94x |
| Combined 8 rephrases + 8 thoughts | 3.588 | 3.565 | 3.551 | 3.548 | — | 2.02x |
| Combined 8 rephrases + 32 thoughts | 3.597 | 3.571 | 3.554 | 3.544 | — | 2.04x |
| Combined 8 + 32, m=0.875 | — | 3.555 | 3.539 | 3.523 | 3.495 | 2.38x |
The fair control for Combined 8+8 is rephrase G=16. Both use 16 generations per document, with similar amounts of generated text (292M vs 328M tokens) and nearly the same real-token share (30.9% vs 30.3%). Combined still wins by 0.018 at E30, even with slightly less synthetic text, indicating that mixing the two kinds of synthetic data gives something that more of either one alone doesn’t.
Scaling to 32 thoughts (8+32) roughly matches 8+8, pulling slightly ahead only at E30, where it matches dense latent G=32 trained to E40. The biggest gain came from changing the ratio between synthetic and real data. Raising m from 0.75 (12/16) to 0.875 (14/16) reaches 3.523 at E30 and 3.495 at E50, about 2.38x the data efficiency of the baseline! This gain costs extra compute, since we need twice the number of steps to see all of the real data once. I only ran m=0.875 on the combined megadoc, so this gain comes from the combination and the higher m together, and I can’t say how much of it is specific to the combined megadoc.
Ensembling
Lastly, I tried ensembling, where I averaged the predicted probabilities of several independently trained models. Every model sees the same 25M real tokens, so ensembling is another way to get more out of a fixed data budget, at the cost of compute. All members are single E20 runs.
| Members | Baseline 25M | Rephrase G=8, same rephrases | Rephrase G=8, different rephrases |
|---|---|---|---|
| 1 | 3.861 | 3.584 | 3.583 |
| 2 | 3.762 | 3.498 | 3.496 |
| 3 | 3.727 | 3.467 | 3.464 |
| 4 | 3.708 | 3.451 | 3.447 |
Ensembling clearly helps, as four rephrase models reach a validation loss of 3.447, about 2.8x the data efficiency of a single baseline model. The baseline benefits too (3.708 with four members, about 1.4x), but even a four-member baseline ensemble is still far behind a single synthetic model. (Each row averages over every subset of that size, so the single-member row is the mean of the four individual models and differs slightly from the 3.865 run above.)
An obvious way to increase diversity among members is to train each one on different rephrases. Since we already had 32 rephrases from previous experiments, I split them into 4 groups and trained one model on each group. However, this barely improves over the setting where members only vary by seed. Varying the type of synthetic data across members works better, slightly on FineWeb and much more on the non-FineWeb evals. The mixed members are about as strong individually as the seeds (3.587 vs 3.584 on average), so the gain comes from diversity rather than from stronger members.
| 4-member ensemble | FineWeb | arXiv | GitHub |
|---|---|---|---|
| Rephrase G=8, 4 seeds | 3.451 | 3.696 | 2.613 |
| Mixed: Rephrase G=8, Rephrase G=16, Latent G=8, Latent tree | 3.442 | 3.630 | 2.568 |
An N-member ensemble costs N times the training and inference compute, so I report these results separately from the single-model numbers.
Continued Pretraining
Setup
I built a CPT corpus from Common Pile’s arxiv_papers_filtered, keeping computer-science papers (primary category cs.*) with at least 2,000 characters. This gives 106,520 papers and about 2B tokens. I held out 500 papers from July 2024 or later for validation, and built nested training sets of 10M, 25M, 50M and 100M tokens. I use the 10M training set as the seed for synthetic data.
The median paper is ~15k tokens, but generator outputs top out around 2k tokens. So I cut each paper into ~2k-token chunks along paragraph boundaries and generate all synthetic data per chunk.
I track three evals:
- arXiv val: the held-out papers from the same corpus
- UE arXiv: UncheatableEval’s 2026-07 arXiv set, published after the base models’ training data
- FineWeb val: the pretraining validation set, to measure forgetting
Unless otherwise stated, synthetic arms use m=0.75 (12 of every 16 training windows are synthetic). The raw CPT baselines and all arms use no FineWeb replay, except in the final experiments, where replay is stated explicitly.
Data Construction
The paper’s prompts target web and Wikipedia-style text, which doesn’t fit research papers, since rewriting a paper as an encyclopedia article tends to discard most of its technical detail and equations. So I added prompt styles aimed at papers.
Rephrase styles
- Wiki (the paper’s prompt): rewrite the chunk as a Wikipedia-style article
- Faithful: rewrite the chunk closely, keeping all of its content and equations
- Lecture: turn the chunk into graduate-level lecture notes that keep the equations and add the missing steps and definitions
Latent thought styles
- Paper: thoughts written for research text, explaining what the next part of the paper does and why
- Intuition: thoughts focused on the intuition behind the next part
Layouts
- Whole paper: each chunk is rephrased G times, and these are joined into G full rephrased copies of the paper. The megadoc is those copies stitched together, followed by the original paper
- Chunk: each chunk is rephrased G times, and its rephrases are stitched directly before it. The megadoc is these chunk-level blocks stitched together
Either layout can also be combined with latent thoughts, which are inserted into the original text.
Qwen3.5-0.8B
I started with Qwen3.5-0.8B-Base, using AdamW, a cosine schedule, LR 3e-6 for raw CPT (1e-6, 3e-6 and 1e-5 all land within 0.001 on arXiv) and 1e-6 for synthetic arms, 4,096 context, and synthetic data from Llama-3.1-8B and Qwen3.5-9B. I tried rephrases and latent thoughts, five prompt styles, and 4 vs 12 epochs.
| Run | arXiv | UE | FineWeb |
|---|---|---|---|
| Base model | 1.635 | 1.939 | 2.953 |
| Raw CPT (10M) | 1.585 | 1.951 | 2.976 |
| Rephrase / latent | 1.587–1.592 | 1.952–1.960 | 2.975–2.983 |
| Combined chunk | 1.592 | 1.944 | 2.976 |
Rephrase / latent covers 13 runs, which span prompts and generators. Combined chunk is the best recipe from the 313M experiments below (Qwen lecture notes G=4 with Llama thoughts G=16).
I first generated all synthetic data with Llama-3.1-8B-Instruct. When none of it beat raw CPT, I suspected that the poor performance stemmed from a mismatch in distribution. To test this, I regenerated latent thoughts and faithful rephrases with Qwen3.5-9B, which should be much closer to the student’s own distribution.
This did not help. Qwen-generated data landed in the same place as Llama’s (1.590 vs 1.590 on arXiv for both latent thoughts and faithful rephrases), still behind raw CPT (1.585). Across all runs, no synthetic method beat raw CPT on the IID set, and UncheatableEval got worse than the base model on every run, including raw CPT.
Thus, the generator’s distribution isn’t the bottleneck. Qwen likely already knows this material (the held-out papers probably fall inside its pretraining window), so its arXiv gains come from adapting to the corpus’s formatting, and restated content has little left to teach it.
A Weaker Student
If the problem is that the student already knows the content, we can use a model that explicitly doesn’t. I reused the 313M model from the FineWeb experiments (the 100M, WD 0.8, E30 baseline, FineWeb val 3.336). It has never seen arXiv-style text, so its loss on our arXiv val is quite high at 3.77 (4.05 on UE).
The model keeps its pretraining optimizer (Muon + AdamW) at a reduced LR, with WSD branches at every epoch, and 4096 context. The LR sweep below uses raw CPT on the 10M set, with one 16-epoch schedule per LR rather than WSD branches, so its best values differ slightly from the baselines below.
| LR (× pretraining) | Best arXiv (epoch) | Best UE (epoch) | FineWeb at best arXiv |
|---|---|---|---|
| ×1 | 2.460 (E5) | 3.426 (E4) | 5.61 |
| ×0.3 | 2.341 (E2) | 3.183 (E2) | 4.09 |
| ×0.1 | 2.365 (E4) | 3.158 (E2) | 4.01 |
| ×0.03 | 2.432 (E5) | 3.173 (E5) | 3.63 |
I used ×0.1 everywhere after this. It’s only 0.024 behind ×0.3 on arXiv, but has the best UncheatableEval loss, forgets less, and overfits at a slower rate, which leaves room for longer synthetic runs.
Unlike Qwen, this student learns a lot, with arXiv val dropping by ~1.4 nats and UE by ~0.9. Raw CPT also overfits very quickly, peaking after just a few passes over the data. Forgetting is an issue, which I address with FineWeb replay in later experiments.
Baseline
| Real tokens | Best arXiv (epoch) | Best UE (epoch) |
|---|---|---|
| 10M | 2.354 (E3) | 3.144 (E3) |
| 25M | 2.087 (E3) | 2.908 (E3) |
| 50M | 1.912 (E4) | 2.702 (E3) |
| 100M | 1.747 (E5) | 2.528 (E5) |
CPT multipliers are computed against these numbers, the same way as in pretraining.
Each doubling of real data is worth about 0.17–0.27 on arXiv. Up to 50M, raw CPT peaks after about 3 epochs and then overfits. The 100M run is still improving at E5, so the 100M point is slightly under-trained and the reported data efficiency gains may be slightly overstated.
What works
Since all of the infrastructure was already set up, it was pretty simple to sweep over different prompts, numbers of generations, and generator models for rephrases and latent thoughts.
Even in a continued pretraining setting, we get some very nice gains from synthetic data! Similar to pretraining, latent thoughts are very effective, and LT G=16 beats every Llama rephrase variant. However, Qwen lecture rephrasing provides the best data efficiency gains, even with only 4 generations per chunk.
It is important to note that the number of synthetic tokens in each setting varies greatly with the generator and prompt type. Qwen lecture rephrase G=4 actually has more synthetic data than latent thoughts G=16.
(LT = latent thoughts, Lec = lecture rephrase, WR = Wikipedia rephrase, FR = faithful rephrase)
| Arm | Layout | Synthetic stream (windows) | Generated text | Best arXiv | Multiplier |
|---|---|---|---|---|---|
| LT G=8 (Llama) | — | 8,118 | ~23M | 2.222 | 1.57x |
| LT G=16 (Llama) | — | 13,770 | ~46M | 2.192 | 1.74x |
| Lec G=4 (Llama) | chunk | 9,058 | ~27M | 2.237 | 1.49x |
| WR G=8 (Llama) | whole | 16,524 | ~57M | 2.254 | 1.41x |
| FR G=8 (Llama) | whole | 19,476 | ~70M | 2.331 | 1.08x |
| Lec G=4 (Qwen) | chunk | 16,732 | ~58M | 2.182 | 1.80x |
| Lec G=8 (Qwen) | chunk | 31,018 | ~117M | 2.146 | 2.04x |
It’s clear that the volume of synthetic tokens isn’t the main driver behind the gains, as 23M tokens of latent thoughts outperform 70M tokens of faithful rephrases. There are some clear trends, such as Qwen lecture rephrases being the best, and chunked rephrases beating whole-paper ones for every prompt and generator:
| Rephrase arm (best arXiv) | Whole paper | Chunk |
|---|---|---|
| Wiki G=8 (Llama) | 2.254 | 2.209 |
| Faithful G=8 (Llama) | 2.331 | 2.246 |
| Lecture G=4 (Llama) | 2.284 | 2.237 |
| Lecture G=4 (Qwen) | 2.208 | 2.182 |
The same intuition behind latent thoughts also explains why the chunk layout works so well. The whole-paper layout is analogous to stitched rephrasing. There is only one inverse task per paper, reconstructing the real paper from its rephrases, and the rephrases and the real text are usually too far apart to share a context window. When we chunk the paper and place each chunk’s rephrases right before it, the last rephrase sits next to the passage it describes, so at least one context window usually contains the inverse task. As with latent thoughts, this turns one inverse task per paper into many (one for every chunk).
Compared to the other rephrasing methods, there’s a large discrepancy in performance between models trained on Qwen lecture rephrases and Llama ones. Given the same prompt, Llama condenses each chunk to about 0.65x its length, while Qwen expands it by 1.4x. Qwen follows the instruction to add missing steps and definitions, providing the student with richer information.
Combining rephrases and latent thoughts
In pretraining, combining rephrases and latent thoughts gave the best performing megadoc, so I tested whether this holds in continued pretraining.
It does. Adding 16 latent thoughts per chunk to Qwen’s lecture notes improves on lecture notes alone at both mixing ratios, going from 2.146 to 2.122 on arXiv at m=0.75 and from 2.133 to 2.093 at m=0.875.
As in pretraining, the obvious objection is that the combined arm simply has more synthetic text. To rule this out, I generated a matched control with 12 lecture notes per chunk (~175M generated tokens), compared to 8 lecture notes plus 16 thoughts (~163M). With everything else held fixed (chunk layout, m=0.875, FineWeb replay), the combined arm still wins:
| Replay | Arm | arXiv | UE | FineWeb |
|---|---|---|---|---|
| 12.5% | Lecture G=12 | 2.074 | 2.690 | 3.517 |
| 12.5% | Lecture G=8 + thoughts G=16 | 2.061 | 2.676 | 3.513 |
| 25% | Lecture G=12 | 2.065 | 2.695 | 3.435 |
| 25% | Lecture G=8 + thoughts G=16 | 2.048 | 2.666 | 3.431 |
On arXiv, combined wins by 0.013–0.017 with slightly fewer generated tokens, well beyond seed noise (see Reflection). On UE the gap is smaller and less certain at 12.5% replay. Spending part of the generation budget on thoughts beats spending all of it on more rephrases. Replay also largely fixes forgetting, bringing FineWeb val from ~4.0 without replay down to 3.43 with 25% replay (3.336 before CPT).
Final CPT results
| Arm (10M real tokens) | arXiv val | Multiplier | UE | Multiplier |
|---|---|---|---|---|
| Raw + 25% replay (no synthetic data) | 2.296 | 1.22x | 3.074 | 1.31x |
| Combined, m=0.875, no replay | 2.093 | 2.44x | 2.761 | 4.10x |
| Matched control: lecture G=12 + 25% replay | 2.065 | 2.72x | 2.695 | 5.15x |
| Combined + 12.5% replay | 2.061 | 2.77x | 2.676 | 5.54x |
| Combined + 25% replay | 2.048 | 2.92x | 2.666 | 5.78x |
The final recipe (Qwen lecture notes G=8 + Llama thoughts G=16 per chunk, chunk layout, m=0.875, 25% FineWeb replay) matches raw CPT on about 2.92x the arXiv data, and about 5.78x on UncheatableEval. Replay alone accounts for only 1.2–1.3x, so most of the gain comes from the synthetic data. The UE multipliers interpolate between the 50M and 100M baselines, and the 100M run was still improving, so they are likely somewhat overstated.
This fits the earlier picture. Each extra lecture note is another view of the same chunk, so the returns shrink. Thoughts add a different kind of signal, in the form of many small inverse tasks inside the real text rather than one more restatement before it. The two still overlap, though. Combined beats lecture notes alone by 0.02–0.04 and thoughts alone by 0.07–0.11, not by the sum of their individual gains.
Reflection
Overall, I’m really happy with the results and had a great time working on this problem! The megadocs authors are excellent researchers, and going in I worried there would be little left to gain. It was an amazing feeling to see some of my ideas work and carry over across settings. The combined megadoc was the best recipe in both pretraining and continued pretraining!
There are a few shortcomings I would address with more time. First, most results in this report are single seeds. Where I did run several seeds, the noise is small. In pretraining, the four 25M baseline seeds span 3.858–3.865 and the four rephrase G=8 seeds span 3.581–3.587 (std ≈ 0.003). In CPT it is even smaller, as three seeds each of raw CPT, lecture G=4 and the final combined recipe vary by about 0.001 on arXiv (UE is noisier, up to ~0.007). So the main results (combined vs rephrase G=16, the m=0.875 gain, combined vs the matched CPT control) are well outside the noise.
I also leaned on the epiplexity perspective to explain and motivate many of my experiments, and I’d like to confirm that the latent thought gains aren’t mostly a byproduct of diversity. The chunk vs whole CPT results make me more confident. The generated text is identical, and only moving the rephrases next to the real text they describe, which creates many local inverse tasks, improves performance for every prompt and generator.
Additionally, I believe best-of-n latent thoughts could work with more time. In continued pretraining, the student itself can score the candidates, which directly tests whether the pretrained scorer’s priors were the problem here.
Although I spent a lot of time iterating on latent thoughts without much success, I don’t regret it. The negative results pushed me to think harder about what actually drives the gains, which led directly to the combined megadoc and gave me better intuitions for later experiments, including the chunk layout in continued pretraining.
It was truly a privilege to work on this problem, thank you all!