arjan suri ← writing

gpu-setup: free way to run Karpathy’s Autoresearch

I ran Karpathy's Autoresearch 24/7 for free. Here's my setup: deploy.sh, status.sh and teardown.sh talk to the Akash API, which leases a GPU provider that boots a container with PyTorch, clones autoresearch, downloads data and starts sshd.

What is Autoresearch?

Autoresearch is a small open‑source project from Andrej Karpathy that turns a single‑GPU ML training setup into an autonomous “experiment loop” an AI agent can run for you. Instead of promising a general AI scientist, it focuses on one narrow job: automatically tweaking a compact language‑model training script, running short experiments, and keeping only the changes that improve a fixed evaluation metric.

The repo is intentionally tiny (around 600–630 lines of Python) and built on a stripped‑down version of Karpathy’s nanochat LLM trainer. A human writes the research “program” in a Markdown file, and an external LLM agent (Claude, Codex, etc.) uses that spec to decide how to edit the training code and what to try next.

Why should I care?

Better neural network architectures give you more capable models without more hardware, so systematically exploring architectures is one of the highest‑ROI things you can do in ML.

Autoresearch is Karpathy’s way of turning that exploration into a closed loop: an agent is allowed to rewrite a compact training script, run 5‑minute experiments on a fixed dataset, and keep only the changes that improve a simple metric like validation bits‑per‑byte.

If this pattern scales, it means a single GPU can quietly grind through hundreds of architecture and training tweaks while you sleep, making “AI that improves AI” a practical tool instead of a thought experiment.

I think Manthan Gupta did a great job of explaining this. If you want more, read his article here.

How it Works

At a high level, Autoresearch turns “AI research” into a bounded optimization problem.

The agent is not browsing papers, forming original theories, or deciding what science should matter. Its job is much narrower, and revolves around this scientific loop:

  1. Edit the training code
  2. Run an experiment for a fixed amount of time
  3. Measure the result using a fixed metric
  4. Keep the change if it improves the score
  5. Revert it if it does not
  6. Repeat

Repository Structure

autoresearch/
  ├── .gitignore
  ├── .python-version
  ├── README.md           # project overview + quick start
  ├── analysis.ipynb      # notebook for analyzing experiment results
  ├── prepare.py          # fixed: data download, tokenizer, dataloader, eval (DO NOT MODIFY)
  ├── train.py            # the one file the agent edits: model, optimizer, training loop
  ├── program.md          # instructions for the AI agent ("the skill")
  ├── progress.png        # teaser image for README
  ├── pyproject.toml      # dependencies (torch, numpy, tiktoken, etc.)
  └── uv.lock             # lockfile for uv

Autoresearch really lives in three files: program.md, prepare.py, and train.py.

Flowchart of the Autoresearch loop: verify baseline, modify training code, commit, run the training job; if it crashes, analyze logs and either fix and restart or document the failure; otherwise read the metric, analyze, update results, and accept the change if performance improved or revert it if not, then proceed to the next step.
the autoresearch experiment loop

Quickstart | The Easiest Way to Run Autoresearch

Karpathy's original repository outlines the requirements to run autoresearch.

Requirements: A single NVIDIA GPU (tested on H100), Python 3.10+, uv.

Some providers you can use include:

I set up a quick script in my fork of the original Karpathy repository in case you need help deploying the Akash GPU.

gpu-setup | requirements

You need four things before starting:

  1. An Akash Console account: sign up at console.akash.network. New accounts get free credits.
  2. An Akash API key: grab one from the Console dashboard. It starts with ac.sk.
  3. jq, a command line JSON tool. Install it:
    Mac: brew install jq
    Linux: sudo apt-get install -y jq
  4. sshpass, which lets you SSH with a password in one command:
    Mac: brew install hudochenkov/sshpass/sshpass
    Linux: sudo apt-get install -y sshpass

gpu-setup | steps to run

1. Clone this repository

git clone https://github.com/arjanssuri/autoresearch_gpu_setup.git
cd autoresearch_gpu_setup

2. Add your API key. Create a file called .env in the repo root:

echo "AKASH_API_KEY=ac.sk.production.your-key-here" > .env

3. Deploy

cd gpu-setup
./deploy.sh

4. Wait for setup. The container needs ~5 minutes after deploy to finish installing everything. You can check if it's ready:

./status.sh

Look for "ready": 1. That means it's good to go.

5. SSH in. The deploy script prints your exact SSH command. It looks like this:

sshpass -p 'autoresearch' ssh -p <PORT> root@<HOST>

6. Run Autoresearch

cd /workspace/autoresearch
uv run train.py

That runs one 5-minute training experiment. To start the full autonomous loop where the AI runs experiments on its own:

# install claude code
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt-get install -y nodejs
npm install -g @anthropic-ai/claude-code

# set your anthropic key
export ANTHROPIC_API_KEY=your-anthropic-key

# start the loop
claude "Read program.md and let's kick off a new experiment"

7. Teardown when done

cd gpu-setup
./teardown.sh

What you get

Cost

The deploy script picks the cheapest GPU bid automatically. With $100 in credits you can run for several hours. The $5 escrow deposit gets returned (minus usage) when you tear down.

Customizing

Edit deploy.yaml if you want to change the GPU model, memory, storage, or base Docker image.

gpu-setup | How It Works

.env (API key)
    │
    ▼
deploy.sh ──► Akash API ──► GPU Provider ──► Container
    │              │              │              │
    │         POST /v1/deployments          boots PyTorch image
    │              │                            │
    │         GET /v1/bids                  installs deps
    │         (picks cheapest)              clones autoresearch
    │              │                        downloads data
    │         POST /v1/leases               starts sshd
    │              │                            │
    │         saves .deployment              ready for SSH
    ▼
status.sh ──► GET /v1/deployments/{dseq} ──► shows ready/host/port

teardown.sh ──► DELETE /v1/deployments/{dseq} ──► closes, returns deposit
gpu-setup: full lifecycle management of GPU containers on Akash. deploy.sh creates a deployment, collects bids and picks the cheapest H100 or A100, then creates a lease; status.sh polls readiness; teardown.sh closes the deployment and returns the deposit. deploy.yaml specifies the PyTorch image, 1 GPU, 8 CPU, 64GB RAM, 30GB disk and exposes port 22.
gpu-setup: full lifecycle management of GPU containers on Akash

And you're set up!

Conclusion

Autoresearch is the interesting idea; gpu-setup is the part that makes it practical to use. With a single script and an Akash API key, you can go from reading about the repo to actually running it on an H100 in a few minutes. If you have been curious about agentic research but blocked by infrastructure and CUDA issues, this flow removes most of that friction so you can focus on writing a good program.md and letting the loop run.

Credits, Inspiration, and Good Reads