Can LLMs Beat Classical Hyperparameter Optimization Algorithms? A Study on autoresearch

Fabio Ferreira, Lucca Wobbe, Arjun Krishnakumar, Frank Hutter, Arber ZelaarXiv 2026

TL;DR

While Large Language Models (LLMs) are increasingly used as autonomous agents for machine learning research, this paper demonstrates that pure LLMs actually underperform classical hyperparameter optimization (HPO) algorithms like CMA-ES and TPE in a fixed search space. To get the best of both worlds, the authors introduce Centaur, a hybrid approach that injects classical optimization state directly into an LLM, outperforming all pure classical and LLM methods—even when powered by a tiny 0.8B parameter model.

What Problem Does This Paper Address?

With the rise of open-ended agentic frameworks like Andrej Karpathy's autoresearch, LLMs are being tasked with iteratively editing training code to optimize model performance. However, it remains unclear whether LLMs possess a genuine advantage over classical, mathematically rigorous HPO algorithms (such as Bayesian Optimization or Evolution Strategies), or if they are simply brute-forcing solutions through massive compute.

This paper systematically benchmarks classical vs. LLM-based HPO methods under identical compute budgets to answer two questions: how do classical methods perform on these modern agentic tasks, and can LLM-based HPO actually outperform them? The authors tackle core challenges faced by LLMs in optimization, such as their tendency to cause out-of-memory (OOM) failures and their struggle to track optimization history across multiple iterations.

Methods

The authors benchmark 9 different HPO methods categorized into three groups:

  1. Classical Methods: Tree-structured Parzen Estimators (TPE), Covariance Matrix Adaptation Evolution Strategy (CMA-ES), and Sequential Model-Based Algorithm Configuration (SMAC), alongside a Random Search baseline.
  2. Pure LLM Agents: Methods like LLAMBO and the "Karpathy Agent" operating either within a fixed 14-hyperparameter search space or via unconstrained direct code editing.
  3. Hybrid (Centaur): The paper's core novelty. Centaur combines CMA-ES with an LLM by explicitly sharing the optimizer's internal state—specifically the mean vector ($\mu$), step-size ($\sigma$), and covariance matrix ($C$)—with the LLM on 30% of the optimization trials. The LLM can then use its domain knowledge to override or refine the classical proposal, while CMA-ES continues to update its state based on all trial outcomes.
Centaur Algorithm Pseudocode

Datasets

The benchmark evaluates the HPO methods on nanochat, a small decoder-only transformer (~50M parameters) trained on the FineWeb dataset. The objective is to minimize validation bits-per-byte (val_bpb) within a strict 24-hour GPU wall-time budget on an NVIDIA H200 GPU. The search space consists of 14 hyperparameters automatically extracted from the training script via Abstract Syntax Tree (AST) parsing to eliminate human bias.

Key Insights and Ideas

  • State-Tracking is an LLM Bottleneck: Pure LLMs struggle to track optimization history across multiple trials, leading to high out-of-memory (OOM) rates (up to 61%) that match or exceed random search. Classical methods excel here because their mathematical state inherently maps out safe vs. unsafe regions.
  • Domain Knowledge vs. Pure Math: Classical algorithms lack domain knowledge; for instance, CMA-ES might suggest an odd, non-power-of-two batch size like 61. An LLM can instantly recognize that a batch size of 64 is more hardware-friendly and efficient for GPU tensor cores.
  • The Hybrid Sweet Spot: Centaur works exceptionally well because it lets CMA-ES handle the heavy lifting of mapping the optimization landscape, while the LLM acts as an occasional, highly informed perturbation that injects transformer-specific intuition (e.g., switching attention patterns or adjusting learning rates).
  • Scale Doesn't Solve Everything: Simply scaling up a pure LLM from 0.8B to frontier models like Claude 4.6 or Gemini 3.1 Pro narrows the gap to classical methods but does not completely close it. However, scaling does significantly boost the hybrid Centaur approach.

Key Results

  • In a fixed search space, classical methods like TPE (mean best val_bpb of 0.9768) and CMA-ES (0.9785) consistently outperform pure LLM agents like LLAMBO (0.9862).
  • Centaur achieved the best overall performance in the benchmark. Powered by Qwen3.5-27B, it achieved a val_bpb of 0.9763. When scaled up to Claude Opus 4.6, Centaur extended its lead to a benchmark-best 0.9739.
  • Remarkably, a tiny 0.8B parameter LLM integrated into Centaur (0.9766) was sufficient to outperform all pure classical and pure LLM methods, demonstrating that explicit state-sharing dramatically reduces the required model capacity for effective HPO.
Figure 1: Best val_bpb (mean ± std, 3 seeds) against cumulative training time. All methods receive the same 24-hour GPU budget; LLM inference overhead is excluded. All LLM-based methods use Qwen3.5-27B. Linestyle and markers encode method category: dashed with circles = classical, solid with stars = pure LLM, dash-dot with diamonds = hybrid (Centaur). Marker positions are offset per line for visual clarity. Bands shown for top 5 methods (see Figure 14 for all).

Limitations and Future Work

  • Single-Task Evaluation: The study focuses on a single benchmark task (nanochat on FineWeb). More diverse benchmarks are needed to guarantee the generalizability of these findings across different architectures and domains.
  • No External Tools: The LLM agents in this study operated without external tools or knowledge retrieval. Equipping them with capabilities like paper search, documentation lookup, or automated code analysis tools could significantly boost pure LLM performance.
  • Fixed Search Space for Hybrids: While Centaur excels, it is currently constrained to a fixed hyperparameter search space. A promising future direction is pairing CMA-ES with a code-editing LLM agent to allow the search space itself to co-evolve with the optimization trajectory.

Summary updated

BibTeX
@misc{ferreira2026can,
  author = {Fabio Ferreira and Lucca Wobbe and Arjun Krishnakumar and Frank Hutter and Arber Zela},
  title = {{Can LLMs Beat Classical Hyperparameter Optimization Algorithms? A Study on autoresearch}},
  year = {2026},
  eprint = {2603.24647},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.24647},
}
Figure