Manuscript Offprint

arXiv:2610.33826

Reactive Optimizers

Xingjian Bai, Jia-Hao Liang, Jayden Teoh, Vincent Sitzmann

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

We study a reactive optimizer that uses a pretrained language-model agent to inspect training dynamics and rewrite executable optimizer code during a single training run. The agent can change update rules and schedules for individual parameter groups, without optimizer-specific meta-training or memory transferred from other runs. We evaluate this approach, OPAL, on language modeling and image generation when a recipe has not been tuned for the target setting. Across the evaluated settings, it matches or improves on selected fixed recipes. Analysis of its decisions shows changes to learning-rate schedules, optimizer structure, numerical precision, and momentum. Controlled experiments also show adaptation to repeated data corruption and reduced overfitting. We report these behaviors together with the agent's computational cost and implementation requirements.

This document is a static version of our blog post. We recommend the original interactive version at https://xingjianbai.com/reactive-optimizers/. We release the code at https://github.com/xingjian-bai/opal.

Introduction

Today, the recipe used to optimize a deep neural network is typically completely determined before training even begins. A great deal of human ingenuity has gone into priors regarding how training should progress: adaptive step sizes (Kingma and Ba, 2015), preconditioning (Gupta et al., 2018; Vyas et al., 2024), orthogonalized updates (Jordan, 2024; Liu et al., 2025), schedules tied to the training step (Loshchilov and Hutter, 2017; Hägele et al., 2024), and learning rates scaled with model size (Yang et al., 2022). Automated discovery (Lu et al., 2024; Prime Intellect, 2026a; Chen et al., 2023; Metz et al., 2022) searches across many runs for better optimizers. Whether hand-crafted or automatically discovered, the optimizer then runs unchanged through the end of training, adapting, if at all, according to rules written in advance. This scope leaves the following questions unanswered: How should an optimizer respond to an unexpected loss spike or stall? What if one module's gradients start to oscillate while the others keep improving smoothly? And when a new type of architecture trains poorly with Adam or Muon, is the architecture worse, or has it not yet met an optimizer suited to it?

In this work, we attempt to expand the scope of conventional optimizers and make them reactive to the training itself, leading to an ever-adapting optimizer inside a single training run. This reactive optimizer reasons on the spot and writes the weight update rule for each parameter group. Directly writing optimization code, it has the freedom to implement complicated schedules, respond to training accidents, and customize the optimizer for the single training episode in which it exists. Building on earlier attempts to adapt optimizers during training (Metz et al., 2022; Daniel et al., 2016; Jaderberg et al., 2017) and to let a model direct its own fine-tuning (Zweiger et al., 2025), the reactive optimizer is entirely zero-shot, with nothing learned or retained from repeated runs, and puts the optimizer's entire algorithm up for rewriting.

We start with a practical situation, with tasks from image generation and language modeling, in which a reactive optimizer can do much better than static ones. We then turn to the emergent properties of the reactive optimizer, including sophisticated scheduling, suppressing loss spikes, and escaping overfitting. Lastly, we ask what all this costs and how practical it is at scale. We expect the reactive optimizer to grow only stronger with each generation of agents, to be most useful exactly where no recipe exists yet (for a new architecture or a new dataset), and to be one step toward solving the puzzles of deep learning optimization.

References (39)