Skip to main content
Back

Karpathy's autoresearch Now Runs Overnight on a MacBook Without a GPU

An MLX rewrite drops the CUDA dependency from Karpathy's autonomous research loop, letting a Mac quietly hunt for better training recipes overnight.

Pro

Repo, Full Access
  • MLX port of Karpathy's autoresearch runs autonomous training loops natively on Apple Silicon Macs.
  • No PyTorch or CUDA required, uses MLX and unified memory on M-series chips.
  • Same contract as upstream: one mutable train.py, fixed 5-minute budget, val_bpb metric, git keep-or-revert.
  • Public results show baseline dropping from 2.667 to 1.807902 val_bpb, mostly by shrinking the model.
  • Overnight runs on M4 Max hit 1.294 val_bpb; Mac Mini found a different winning recipe using Muon.
  • Available now on GitHub under MIT license, install with uv sync.

Andrej Karpathy's autoresearch project turned heads by handing a coding agent the keys to a training script and letting it iterate on its own. The catch: it was built for NVIDIA GPUs. A community port called autoresearch-mlx rewrites the whole thing on top of Apple's MLX framework, so the same overnight research loop now runs natively on a MacBook or Mac Mini with no PyTorch or CUDA dependency.

The repo has already picked up around 1,600 stars and 336 forks, riding the wave of interest in the original project, which collected 21,000+ GitHub stars and 8.6 million views on Karpathy's announcement within days of release.

The loop, in one paragraph

AutoResearch is an autonomous ML experimentation loop for anyone who missed the original. A coding agent (Claude Code, Codex, or any equivalent) is pointed at a minimal LLM training setup and given a Markdown instruction file. The agent then runs an indefinite loop: read the training code, propose a change, run a 5-minute training job, measure whether the result improved, commit the change if it did, roll it back if it didn't, repeat. The metric being optimized is val_bpb (validation bits-per-byte, a token-length-normalized measure of language model loss), and git is the safety net.

The MLX port keeps that contract exactly. One mutable train.py, one fixed prepare.py for data and evaluation, one program.md that spells out the protocol in English, and a results.tsv ledger of every attempt.

What actually changed for Apple Silicon

This is a full rewrite rather than a shim. The training code uses MLX arrays and optimizers directly, taking advantage of unified memory on M-series chips. A few practical differences worth knowing:

  • MLX instead of PyTorch/CUDA, with native Apple Silicon training and no external accelerator required.
  • AdamW-only public path. A Muon optimizer variant was explored on a working branch but is not exposed as the default.
  • Smaller eval token budget so iteration stays fast on a laptop, while keeping the same evaluate_bpb interface as upstream.
  • Roughly 6-7 minutes per experiment, meaning 5 minutes of training plus compile and eval overhead.
  • MFU reporting is a placeholder because there is no clean Apple Silicon equivalent to the H100 FLOPs reference used upstream.

Setup is short. Install uv, sync dependencies, run prepare.py once, then train.py for a single experiment. After that you point Claude Code or another coding agent at program.md and walk away.

curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
uv run prepare.py
uv run train.py

Does it actually find anything?

The public results.tsv shows a baseline walk from a default val_bpb of 2.667 down to 1.807902, with the biggest single win coming from cutting model depth from 8 layers to 4. That result is the point of the exercise: under a fixed 5-minute wall clock, a smaller model that fits more optimizer steps into the budget beats a larger one that trains slower. The Apple Silicon constraint sharpens the effect.

Longer overnight runs pushed much further. On an M4 Max, the loop reached 1.294 and 1.330 val_bpb with recipes favoring AdamW-only, low matrix learning rate, a 3x MLP, and no logit cap. A Mac Mini run landed at 1.353 with a genuinely different winning stack: Muon optimizer, sharper attention, smaller MLP, lower scalar learning rate. Some of those Mac Mini findings did not transfer cleanly back to the Max baseline, which is exactly the kind of hardware-specific behavior an autonomous loop is good at surfacing.

Why this matters beyond the novelty

Karpathy's original release resonated because the pattern extends well past nanochat-style pretraining. Shopify CEO Tobi Lütke reported that after letting autoresearch run overnight, it ran 37 experiments and delivered a 19% performance gain on an internal model. The MLX port extends that same trick to anyone with a reasonably specced Mac.

The important caveat is the same as upstream. The pattern requires a clean, well-defined evaluation function. Autoresearch works because val_bpb is a single number that definitively orders experiments. If your business problem has a fuzzy or expensive-to-compute evaluation function, the loop becomes harder to run at speed. Critics have also noted the underlying idea is not brand new, with some pointing out that Karpathy had done little more than rediscover part of a process known as AutoML that researchers at Google, Microsoft, and other AI labs have already been using for years. What differs here is that the search is driven by a general coding agent reading English instructions, rather than a hand-built hyperparameter sweep.

When to reach for it

Autoresearch-mlx is a good fit if you want to:

  1. Explore small language model training recipes without renting a GPU, using the unified memory on your Mac.
  2. Study the autoresearch pattern itself by reading a compact, self-contained implementation before adapting it to your own domain.
  3. Run hardware-specific ablations, since the M4 Max vs Mac Mini results already show the winning recipe depends on the machine.
  4. Prototype an autonomous experimentation loop for a problem you own that has a single, cheap, unambiguous metric.

It is not the right tool for production model training, fuzzy evaluation targets, or anything where you need reproducibility across hardware. Treat it as a laboratory for the pattern, keep an eye on results.tsv, and let the agent do the boring part.