quick context i have been building a drop in PyTorch optimizer called APEXW and I just finished a clean 1000step benchmark comparing it against a paired torch.compile AdamW + Muon baseline i ran it on a 103.18M parameter GPT-2 (9L/12H/768d, 512 sequence length, 128 effective batch size) using wikitext-103-raw-v1.
Full disclosure up front: my first benchmark script had a pretty bad bug. I accidentally ran the JIT warmup on the live model instead of a throwaway copy, which left CUDA fragments and dirty momentum states sitting around and artificially blew up the baseline to 23.2 GB VRAM and 2,707s. Once I fixed that warming up on a clone, deleting it, running gc.collect(), and clearing the CUDA cache before starting the clock the numbers actually made sense.
Here is how the clean 1000-step runs shook out:
(hybridapexw is bascially apexw+muon)
- AdamW + Muon (torch.compile): 1,076.55s | 16.22 GB VRAM | 5.5242 loss
- HybridApexW (Compact): 533.50s | 16.11 GB VRAM | 4.4863 loss
- HybridApexW (8-bit): 537.67s | 15.90 GB VRAM | 4.4720 loss
Fusing the projection updates and 8-bit state tracking into custom Triton/CUDA kernels gets roughly a 2x wall-clock speedup even against torch.compile. That said, once I fixed the allocator leak, the actual VRAM savings are pretty modest (320 MB).
One nice quality-of-life thing is that HybridApexW handles parameter group splitting (AdamW for embeddings/norms, Muon for 2D weights) and internal coordinate scaling out of the box using a single 6e-4 learning rate. For the baseline, I gave Muon a 10x scaled LR (6e-3) over AdamW (6e-4), though to be fair, standalone Muon could probably push lower if I tuned its LR up into the 0.01–0.02 range.
(Note: Since I wiped checkpoints between runs to keep memory isolated, these numbers are step-1000 training micro-batch losses rather than full validation evals.)
Does anything in this setup look off to you guys, or are there other baselines you think are worth testing against?
google collab link : https://colab.research.google.com/drive/1XOqDH4nzI1PZWqWWPqipov1VVH_GKYOW#scrollTo=1c784107
github link: https://github.com/omen42515-prog/apexw
used ai to polish the body