aaimake

Documentation

Experiments

Compare builds, hyperparameter optimize with grid/random/bayesian/optuna, Hyperband pruning, Pareto multi-objective, and MLflow export.

aimake treats hyperparameter search as repeated incremental builds over a search space. Each trial injects parameters as environment variables, reuses cached upstream artifacts, and records metrics for compare / Pareto / MLflow.

Related: CLI reference, Artifact registry, Dashboard.

Compare builds

aimake compare                    # previous vs latest
aimake compare 3 5                # build #3 vs #5
aimake compare latest previous
ArgumentDescription
baselineBuild id, latest, or previous (default previous)
candidateBuild id, latest, or previous (default latest)

The CLI prints metric deltas (accuracy, cost, latency, …) from stored build history. The dashboard Experiments page exposes the same compare flow via the API.

Hyperparameter optimization

Config

optimization:
  trials: 5
  strategy: grid          # grid | random | bayesian | optuna | hyperband
  parameter_artifact: evaluation
  seed: 42
  search_space:
    temperature:
      type: float
      low: 0.8
      high: 1.2
      step: 0.2
    top_k:
      type: int
      low: 3
      high: 10
    prompt_variant:
      type: categorical
      choices: [v1, v2, v3]
  objective:
    metric: accuracy
    direction: maximize
    artifact: evaluation
FieldDescription
trialsMax trials (CLI --trials can override)
strategygrid, random, bayesian, optuna, or hyperband
parameter_artifactArtifact whose rebuild receives trial params
search_spaceNamed params (float / int / categorical)
objectiveMetric + direction (+ optional multi-metric — see Pareto)
seedOptional RNG seed for reproducibility

Search space types

typeFields
floatlow, high, optional step
intlow, high, optional step
categoricalchoices: [...]

CLI

aimake optimize
aimake optimize --dry-run
aimake optimize -n 20 --name tuning-v2
aimake experiments list
aimake experiments list --limit 50
aimake experiments show 1
Command / optionDescription
optimizeRun the search defined in yaml
--trials, -nOverride trial count
--dry-runShow planned trials without building
--nameExperiment display name
experiments listRecent optimization runs
experiments show <id>Per-trial params, metrics, objective

Trial parameters in your code

Parameters are injected as AIMAKE_PARAM_<NAME> (uppercased):

import os

temperature = float(os.environ.get("AIMAKE_PARAM_TEMPERATURE", "1.0"))
top_k = int(os.environ.get("AIMAKE_PARAM_TOP_K", "5"))
variant = os.environ.get("AIMAKE_PARAM_PROMPT_VARIANT", "v1")

Upstream artifacts that do not depend on those params stay SKIP / RESTORE — only the swept subgraph rebuilds.

Strategies

StrategyExtraNotes
gridFull cartesian product (respects trials cap)
randomUniform samples from the space
bayesianBuilt-in Bayesian optimization
optunapip install aimake[optuna]TPE / Optuna sampler
hyperbandoften with Optuna pruningMulti-fidelity / Hyperband-style
optimization:
  strategy: optuna
  trials: 20
  # ...

Early stopping

optimization:
  strategy: optuna
  trials: 40
  early_stopping:
    enabled: true
    patience: 5
    min_trials: 10
    min_delta: 0.001
  objective:
    metric: accuracy
    direction: maximize
    artifact: evaluation
  search_space:
    # ...

Stops when the objective does not improve by min_delta for patience trials after min_trials.

Pareto / multi-objective

Optimize several metrics at once (e.g. maximize quality, minimize cost):

optimization:
  strategy: optuna
  trials: 30
  search_space:
    temperature:
      type: float
      low: 0.5
      high: 1.5
  objective:
    metrics: [accuracy, cost_usd]
    directions: [maximize, minimize]
    artifact: evaluation
FieldDescription
objective.metricsList of metric names
objective.directionsParallel list of maximize / minimize
objective.artifactArtifact that emits those metrics

Single-objective form (metric + direction) remains supported. Results surface as Pareto-aware trial summaries in the CLI and experiment history.

Hyperband & multi-fidelity pruning

optimization:
  strategy: optuna
  trials: 24
  pruning:
    enabled: true
    strategy: hyperband       # or successive_halving
    min_fidelity: 1
    max_fidelity: 3
    reduction_factor: 3
    fidelity_param: epochs
    fidelity_values: [1, 5, 10]
  search_space:
    learning_rate:
      type: float
      low: 1.0e-5
      high: 1.0e-3
  objective:
    metric: accuracy
    direction: maximize
    artifact: evaluation
FieldDescription
pruning.strategyhyperband or successive_halving
min_fidelity / max_fidelityFidelity rung bounds
reduction_factorBracket reduction (≥ 2)
fidelity_paramLogical name for the fidelity knob
fidelity_valuesOne value per fidelity level

Training scripts should read:

Env varMeaning
AIMAKE_FIDELITYCurrent fidelity index
AIMAKE_FIDELITY_VALUEMapped value (e.g. epoch count)
AIMAKE_MAX_FIDELITYMax fidelity index

Low-fidelity trials can be pruned early so GPU budget goes to promising configs.

MLflow export

optimization:
  strategy: optuna
  trials: 15
  mlflow:
    enabled: true
    tracking_uri: http://localhost:5000
    experiment_name: my-rag-tuning
  search_space:
    # ...
  objective:
    metric: accuracy
    direction: maximize
    artifact: evaluation
pip install aimake[mlflow]
aimake optimize --name sweep-mlflow
FieldDescription
mlflow.enabledTurn on export
mlflow.tracking_uriMLflow tracking server
mlflow.experiment_nameExperiment name in MLflow

Trial params and metrics are logged so you can use the MLflow UI alongside aimake experiments show. For pipeline-level lineage (not just optimization), see Trust — lineage.

End-to-end workflow

# 1. Preview the sweep
aimake optimize --dry-run

# 2. Run
aimake optimize -n 12 --name temp-sweep

# 3. Inspect
aimake experiments list
aimake experiments show 1
aimake compare previous latest

# 4. Promote the winner (optional)
aimake registry tag evaluation v7 best
aimake registry promote evaluation v7 --stage production