Agent-in-a-loop: Codex hill-climbs to a 232x GPU kernel speedup
A hobbyist GPU programmer describes placing 12th of 183 in a GPU Mode auto-research contest by wrapping OpenAI’s Codex agent in a tight optimization loop. The task was a batched compact-Householder QR factorization matching torch.geqrf, benchmarked on square FP32 matrices from 512x512 up to 4096, and ranked by geometric-mean runtime across shapes and conditioning cases. Over 14 days the author fired off more than 1,500 leaderboard submissions—so many that everyone’s shared Modal credits briefly ran dry.
The contest was well-suited to ‘loop engineering’ because GPU Mode’s popcorn CLI lets an agent test, benchmark, and submit directly, and the checker returned per-shape timing feedback. That tight loop is exactly what an agent needs to hill-climb. The author’s edge wasn’t raw domain expertise—the competitor one rung up was an NVIDIA principal engineer—but enough foundational knowledge (Triton, CUDA basics, recent reading on GPU kernels) to prompt the models well, turning unknown unknowns into questions worth asking. Conversations with Claude and GPT-5.5 converged on a blocked Householder algorithm with a trailing WY update to expose more of the sequential problem as GEMM-shaped matrix multiplication.
The piece frames a broader point about AI-assisted research: a naive agent loop alone gets you a respectable speedup over baseline, but breaking out of local maxima required deliberately injecting idea diversity rather than letting the agent grind on one line of attack. The author also notes the problem’s relevance beyond the contest—matrix decompositions underpin preconditioned LLM optimizers like Shampoo and Muon, which orthogonalize weight updates instead of flattening them.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.