LLM-guided ML optimization — point it at a training script, it reads the curves and designs better models
Project description
neuropt
An LLM reads your training curves and designs your next experiment.
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
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.
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:
- How it works — what the LLM sees, training curve analysis
- CLI reference —
neuropt run,inspect,results - Python API —
ArchSearch,from_model, search space types - Model Introspection —
from_model()auto-detection, activations, dropout, pooling - Fine-Tuning — pretrained models, freeze strategies, L2-SP
- Examples — CNN search, ResNet tuning
- Benchmarks — vs Optuna, random search
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neuropt-0.6.0.tar.gz.
File metadata
- Download URL: neuropt-0.6.0.tar.gz
- Upload date:
- Size: 32.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da2552cc3c11ffad8226d7367891c6e7cdb477969cf81d03714a03bd8520d4c3
|
|
| MD5 |
c32e75723ca8ce67a969d3e6ced7e4a0
|
|
| BLAKE2b-256 |
67ceadb1f754d2a558b50bb6cc49843e2a5efee0a6bb0272eb0ce2a9ffed989e
|
File details
Details for the file neuropt-0.6.0-py3-none-any.whl.
File metadata
- Download URL: neuropt-0.6.0-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7791d2ae7180563b240ee8553178bd27875c63a4067ee2472a5f3aef92a01a2f
|
|
| MD5 |
737ced478c5ce21bc4f14ea9096e85c3
|
|
| BLAKE2b-256 |
03ad913ffe9de8031262bc54adca57f9ad56e66b6447d65cfd98fcceae9558e1
|