Skip to content
Neural Daily

ResearchNews

OPAL: an agent rewrites the optimizer mid-training

Xingjian Bai and colleagues built an optimizer where a coding agent watches training and rewrites the update rule on the fly. Without a tuned recipe, it matches or beats off-the-shelf ones.

By: Mikola Máté Patrik · · 2 min read

Reactive Optimizers preview: static versus agent-rewritten optimizer code and a LightningDiT training loss chart
Image: Xingjian Bai · Press kit · Official project page social image (og:image) · Source

What changed?

A neural network's optimization recipe is usually fixed before training starts and runs unchanged to the end. The Reactive Optimizers project (Xingjian Bai et al.) flips that: an agent, Claude Code by default, periodically reads training reports and can rewrite the optimizer program that turns gradients into updates, plus an analysis program that measures whatever it needs.

Results

  • LightningDiT-XL/1 on ImageNet: FID-50K of 1.83 versus 2.18 for the official recipe (with guidance).
  • Goldfish model on Amharic: 81.11 bits per sentence versus 83.48 for the official recipe. Started from the best swept static recipe (80.89), it ended ahead again at 80.73.
  • On modded-nanogpt variants trained on Chinese, Thai and Kyrgyz data, or with a quarter of the batch size, it matched or beat five selected leaderboard recipes.

The authors say the agent came up with complex schedules, loss-spike guards and layer-specific updates on its own. On the LightningDiT run, about 100 decisions cost $6.42 at Claude Opus 5.5 list price, on top of roughly 74 H100-hours of training. When training does not wait for the agent, wall-clock time grows only 1.01x to 1.14x.

Try it

OPAL ships as a PyTorch wrapper (GitHub): wrap your existing optimizer in one line and set a cost cap; until the agent changes something, the run is bit-for-bit identical to the plain one. Sharded training and optimizer compilation are not supported yet. It is most useful where no recipe exists: a new architecture, a new language or dataset, and a single GPU-day budget.

    Produced with the help of AI, reviewed by an editor. How we make our articles

    Reviewed and edited by the Neural Daily desk. About

    Related articles