Skip navigation
Compute grows fast but pretraining corpora don’t, so data-constrained optimization matters!
0:00 / 0:29

Compute grows fast but pretraining corpora don’t, so data-constrained optimization matters!

Xingyu Dang

@xingyudang1.6K followers

Visit on X
428 likesDownloadOriginal post

38,000 views

Compute grows fast but pretraining corpora don’t, so data-constrained optimization matters! We propose Training-Time Testing (T³): each step takes a trial step on half the batch, tests it on the other half, and updates with the meta-gradient. It achieves SOTA on SlowRun!

20 Comments

Comments from the original post on X (Twitter)

  • Xingyu Dang's profile picture

    @xingyudang

    Please check out our blog post at

    28 likes

  • Xingyu Dang's profile picture

    @xingyudang

    On SlowRun, adding T³ to the previous record scripts with nothing else changed lowers val loss by 0.011 (1-hour) and 0.012 (15-min) across multi seeds. We further added a few tweaks pushing the 1-hour track result to 3.183

    12 likes

  • Xingyu Dang's profile picture

    @xingyudang

    Added to the tuned data-constrained recipes of Kim et al. with no hyperparameters changed, T³ also lowers validation loss by 0.012–0.015 nats/token at 300M, 600M and 1.4B over 8 seeds.

    15 likes

  • Xingyu Dang's profile picture

    @xingyudang

    It’s cheap and simple: a first-order step with three extra lines. Shift the weights along A’s gradient, take Q’s gradient there, shift back. No other optimizer or hyperparameter changes, and a step takes only 6 to 9% longer.

    14 likes

  • Xingyu Dang's profile picture

    @xingyudang

    The gain comes from testing on tokens the trial step didn't see. Testing on the same tokens hurts, random or uphill trial steps don't help, and half batch with 2× steps is worse. SAM is also generally worse than the baseline, with steps 1.94× slower.

    10 likes

  • Xingyu Dang's profile picture

    @xingyudang

    cc folks who might be interested @konwookim @kothasuhas @tatsu_hashimoto @percyliang @industriaalist @akshayvegesna @ShmuelBerman @Muennighoff @andrewgwils @jxbz @dlwh @_arohan_

    12 likes

  • Dimitris Papailiopoulos's profile picture

    @DimitrisPapail

    I think pretraining corpora are and will keep growing faster than compute

    6 likes

  • Xingyu Dang's profile picture

    @xingyudang

    Ha, fair, code is clearly exploding. But we still don't really know how to make good use of massive synthetic data in pretraining, and even for code, people still train for multiple epochs.

    1 like

  • Xingyu Dang's profile picture

    @xingyudang

    Nexus ( also takes trial steps on mini-batches and accumulates the first-order meta-gradient. It reaches the same loss with better downstream performance in 1-pass training.

    5 likes

  • Jack Ziyang Cai's profile picture

    @jackcai1206

    This is super interesting!

    4 likes

  • Xingyu Dang's profile picture

    @xingyudang

    Thanks! Data-constrained optimization is so much fun!

  • Maciej Pióro 𐙼's profile picture

    @maciejpioro

    Isn't this the same as ?

    3 likes

  • Adam Klein's profile picture

    @AdamKleinML

    Interesting that it only improves performance when tokens repeat. This makes me think it's acting more like a regularizer than anything. Maybe optimizing the weights to be robust under noisy mini-batches pushes towards wide minima

    3 likes

  • cider's profile picture

    @jeffreycider

    very cool! what do you think about hypergradient methods? i.e. for architecture f, optimizer g, parameters \theta, optimizer hyperparameters \phi parameterize step t+1's fwd pass as f(\theta_t + g(\nabla L(\theta_t), \phi_t)). backprop through hyperparameters \phi_t using the next minibatch t+1 i think (?) it looks like your method but staggered across optimizer iterations. wondering if your method's success critically depends on the two batch halves being eval'd on the same parameterization

    2 likes

  • Xingyu Dang's profile picture

    @xingyudang

    Thanks! Online meta-gradients on hyperparameters sound cool, and it'd be exciting to see that work at pretraining scale. On your question: in our closest ablation, a trial step along the previous step's direction loses the gain (+0.002, within noise).

    2 likes

  • Daniel Lenton's profile picture

    @DanielLenton1

    Does it still help when you fine-tune on a small dataset for a few epochs?

    1 like

  • Xingyu Dang's profile picture

    @xingyudang

    Could be helpful. I haven’t tried it yet

    1 like

  • eatnow's profile picture

    @eatnow240008

    This sounds a lot like Reptile, how is it different?

    1 like

  • Shivam Gupta's profile picture

    @ShivamGuptaim

    The same-token ablation is the useful sting here: testing the move against itself makes things worse. Curious whether splitting A and Q by source rather than randomly changes the result. That would expose when “generalizes across the batch” is mostly “fits the dominant source”.

  • R_Hu's profile picture

    @ry4nhu

    It seems that normalization here is the key? any intuition behind why normalizing gradient as the perturbation in particular here works?