Skip to main content

neuropt

PyPI CI License: MIT Python Open In Colab

Three robot researchers designing neural network architectures

An LLM reads your training curves and designs your next experiment.


Get started with neuropt →

Point it at a training script, let it run overnight. The LLM sees full per-epoch train/val curves, spots overfitting, and proposes what to try next — like a research assistant who never sleeps and actually reads the loss plots.

vs Optuna and random search

Benchmark: neuropt vs Optuna vs Random

Same 15-eval budget on two tasks: CNN architecture search (14 params) and XGBoost tuning (9 params, 7-class Covertype). These results use Claude Haiku 4.5 (the smallest and cheapest of their 4.5 models). We expect even stronger results with Sonnet or Opus. Optuna's TPE was configured with n_startup_trials=3 for a fair comparison (default is 10, which would make it purely random for most of the budget).

In a separate 200-eval run on the CNN task, neuropt again beat the others within 15 evals and kept improving — reaching 0.337 val loss by eval 200 (vs 0.454 for Optuna's best at 15). Local Qwen backend (experimental) also beat Optuna at 15 evals (0.440 vs 0.454) despite a 40% JSON parse failure rate.

2-param search: neuropt vs Optuna vs Random

Quick start

pip install "neuropt[llm]"
export ANTHROPIC_API_KEY="sk-ant-..."

Option 1 — define what to search over:

# train.py
search_space = {
    "lr": (1e-4, 1e-1),                    # auto-detects log-scale
    "hidden_dim": (32, 512),                # auto-detects integer
    "activation": ["relu", "gelu", "silu"], # categorical
}

def train_fn(config):
    model = build_my_model(config["hidden_dim"], config["activation"])
    # ... train, return per-epoch losses for smarter LLM decisions ...
    return {"score": val_loss, "train_losses": [...], "val_losses": [...]}

Option 2 — just give it a model, we figure out the rest:

# train.py
model = torchvision.models.resnet18(num_classes=10)  # neuropt introspects this

def train_fn(config):
    m = config["model"].to("cuda")  # deep copy with modifications applied
    # ... train ...
    return {"score": val_loss, "train_losses": [...], "val_losses": [...]}

Then run:

neuropt run train.py

Runs until Ctrl+C. Crash-safe, resumable. Works in notebooks too:

from neuropt import ArchSearch

search = ArchSearch(train_fn=train_fn, search_space=search_space, backend="claude")
search.run(max_evals=50)

Documentation

See the full documentation for:

Installation

pip install neuropt                  # core
pip install "neuropt[llm]"           # + Claude API (recommended)
pip install "neuropt[llm-openai]"    # + OpenAI API
pip install "neuropt[all]"           # everything

License

MIT

Metadata

Release files for neuropt 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neuropt 0.6.2
File Size Uploaded
neuropt-0.6.2.tar.gz 33.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for neuropt 0.6.2
File Interpreter ABI Platform
neuropt-0.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 64.2 kB

Release files / neuropt-0.6.2.tar.gz

Download URL neuropt-0.6.2.tar.gz
Size 33.3 kB
Tags Source
SHA-256 checksum
How to use checksums
19944d43820e1d0bd2a5d2106ea71cbece21160b54af3c3e2f836dea89aee95c
BLAKE2b-256 checksum
How to use checksums
cc435f3c6a1630da94e98241dadeb754976071349e3a175176d216954e0c0e19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.6

Release files / neuropt-0.6.2-py3-none-any.whl

Download URL neuropt-0.6.2-py3-none-any.whl
Size 30.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9439dc2244367782a01ad840a1357e863a4a1d6e73acaf531d10a2f0df6d009
BLAKE2b-256 checksum
How to use checksums
e4556c590c279d078058bf23618b4e8bdfe982ad744d9c8e2d6d6a4692707207
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.6

Release history Release notifications | RSS feed

This release

0.6.2 This release

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page