PhaseSweep
PhaseSweep runs hyperparameter sweeps in ordered phases: choose model depth, then tune learning rate with the winning depth fixed, then regularization. One YAML file holds your trainer configuration, objective, and search plan. Each trial receives a complete trainer input with inherited, fixed, and sampled values applied.
Requires Python 3.11+ and Linux or macOS. GPUs are optional; the starter uses a packaged toy trainer. The project is unstable: a release can change ledger and artifact formats, and data in an older format is refused.
Install and try it
Install from PyPI and check that the command runs:
pip install phasesweep
phasesweep --version
The demo runs four trials of the packaged toy trainer, which needs no GPU and takes a few seconds, and writes its results under runs/ in the new directory:
mkdir phasesweep-demo && cd phasesweep-demo
phasesweep init # writes starter.yaml without overwriting files
phasesweep validate starter.yaml # checks the config without launching work
phasesweep run starter.yaml # runs the four trials
phasesweep status starter.yaml --trials # lists every recorded trial and marks each winner
phasesweep show-winners starter.yaml # prints each phase's full winner record
The starter compares two depths, then two learning rates. status --trials then prints (the generation and attempt IDs and the durations vary):
phasesweep_starter
published generation 344606b50f8940bd8b81f4ae3e838bd4
depth: 2 of 2 trials, eval_loss (lower is better)
trial eval_loss model.n_layers state time
1 0.5 6 COMPLETE 0.5s
winner 0 0.3 8 COMPLETE 0.5s
winner trial 0 directory:
runs/phasesweep_starter/depth/trial_00000__generation_344606b50f8940bd8b81f4ae3e838bd4__attempt_d5a3153f2a1049998f24289fa2136e7d
learning_rate: 2 of 2 trials, eval_loss (lower is better)
trial eval_loss optimizer.lr state time
1 0.413822 0.0001 COMPLETE 0.5s
winner 0 0.3 0.0003 COMPLETE 0.5s
winner trial 0 directory:
runs/phasesweep_starter/learning_rate/trial_00000__generation_344606b50f8940bd8b81f4ae3e838bd4__attempt_e762c86f3ffa4f6a95bcfc07fc77388b
The depth winner's model.n_layers: 8 becomes a fixed input to every learning-rate trial: phases inherit parameter values, not weights. The complete starter YAML and phase composition guide explain the configuration and its tradeoffs.
Results live under runs/phasesweep_starter/ beside the config, including run.log. show-winners adds the generation directory and publication state to each winner record; finished phases appear as unpublished while later phases run. See inspection commands for the output.
Use your own trainer
phasesweep init --list lists the templates. Replace the command, configuration keys, and objective extractor in the closest template:
| Configure | Choices and details |
|---|---|
| Trainer input | Complete YAML, command-line flags, Hydra overrides, or nested JSON: input interfaces. |
| Objective | Python report_objective(...), the phasesweep report-objective command, JSON, logs, W&B, or MLflow: reporting and extractors. |
| Environment | execution.cwd, env, and execution.inherit_env: trainer contract. |
Before training, run --dry-run prints the trainer command, environment and working directory and each phase's trial count without launching anything. Configuration errors name the relevant keys; explain gives their types, defaults, interactions, and warnings:
phasesweep run starter.yaml --dry-run
phasesweep explain
phasesweep explain 'phases[].sampler'
W&B and MLflow require their optional extras, phasesweep[wandb] and phasesweep[mlflow]; follow the W&B setup or MLflow guide. For noisy measurements, see small-budget advice and repeats.
Scope and continuation
PhaseSweep drives Optuna's grid, random, TPE, and CMA-ES samplers on one host, with an Optuna journal for persistent trials. GPU trials can run in parallel on that host; distributed sweeps and early pruning are outside its scope.
On Apple silicon Macs, trials share the one MPS device and run one at a time. See GPU isolation.
With persistent storage, rerun the same config to resume interrupted work. Continuation and reruns covers aborted phases, trial budgets, and --from-phase NAME.
Connect an agent
With the optional MCP server, an agent can list the experiments in a catalog you write, launch and monitor a run where the catalog permits it, and read each phase's winner. Create and check a catalog beside the config:
pip install "phasesweep[mcp]"
phasesweep mcp init-catalog --from ./starter.yaml # writes catalog.yaml; every entry starts read-only
phasesweep mcp check --catalog catalog.yaml # validates it without launching anything
MCP setup covers permissions, client configuration, and verification. Tool responses omit config and storage paths, trainer commands, environment values, and raw logs; sampled winner values follow visible_params. phasesweep mcp call invokes one tool from a shell without a client.
Reference
- Configuration guide and per-key reference.
- Minimal configuration: one toy-trainer attempt from the checkout root.
- Runtime: outputs, locks, leases, supervision, fingerprints, and resume.
- MCP operator reference: catalog fields, tools, authorization, run state, and recovery.
- Toy experiment and MCP catalog: checkout-local examples with MCP state and outputs under
/tmp. - Tiny Decoder Enwik8: real-trainer integration.
- Durability invariants: ledger, publication, and recovery rules, with their tests.
- Development: contributor setup, quality gates, and declined requests.
License
MIT. See LICENSE.
Metadata
Release files for phasesweep 0.3.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| phasesweep-0.3.15.tar.gz | 2.9 MB | With provenance | Details for phasesweep-0.3.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| phasesweep-0.3.15-py3-none-any.whl | Python 3 | none | any | Details for phasesweep-0.3.15-py3-none-any.whl |
Total release size: 3.6 MB
Release files / phasesweep-0.3.15.tar.gz
| Download URL | phasesweep-0.3.15.tar.gz |
|---|---|
| Size | 2.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
345420dc8d7e7970e12eed93e5be0b8c2c80ae3eb754c18c8d853cd054713306
|
|
BLAKE2b-256 checksum How to use checksums |
17b0ec2440361505806564cf599400f11a3579c3e0bf9a05359007307f0ab6b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / phasesweep-0.3.15-py3-none-any.whl
| Download URL | phasesweep-0.3.15-py3-none-any.whl |
|---|---|
| Size | 640.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49095e5f2a5ddc9491ad55cb321efa39564f543c91655e849379c9d14fb4dc22
|
|
BLAKE2b-256 checksum How to use checksums |
45099d0d3511271cd5c05feb1728ddaea742a33bb1c1567d8bc470d76235a3de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for phasesweep 0.3.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for phasesweep-0.3.15.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.