Skip to content

Synthetic Function Examples

This tutorial walks you through running complete active learning experiments on two synthetic benchmarks: the 2D Branin function and the 6-dimensional Hartmann function. Before starting, make sure you have completed Installation.

It is structured as three stages — each one runnable on its own:

  1. Single-fidelity — get a working run and understand the terminal output.
  2. Multi-fidelity — add fidelity levels and observe how the algorithm trades off cost vs. quality.
  3. Aim logging — persist metrics and figures to a local Aim dashboard.

All four tutorial configs use ConsoleLogger by default, so every stage gives you visible output immediately.

The benchmarks

Branin is a 2-dimensional function commonly used in optimization research. Its small input space makes it quick to run and easy to visualize — the oracle logs a 2D contour plot after each round when Aim logging is enabled.

Hartmann is a 6-dimensional function with a more complex landscape, commonly used to evaluate multi-fidelity methods at higher dimensionality. Because there is no 2D representation, no landscape figure is logged.

Both use the same algorithmic stack: a Gaussian process surrogate, max-value entropy acquisition, uniform sampling, and cost-aware selection.

Config Fidelity costs Total budget Round budget
branin_single_fidelity.yaml — 300 30
branin_multi_fidelity.yaml 0.01 / 0.1 / 1.0 300 30
hartmann_single_fidelity.yaml — 100 10
hartmann_multi_fidelity.yaml 0.125 / 0.25 / 1.0 100 10

Tip

All configs are fully self-contained YAML files — open them before running to see the complete experiment specification.

1. Single-Fidelity Setting

Start with the simplest runnable version of Branin — a short pilot with a reduced budget:

uv run activelearning config/branin_single_fidelity.yaml \
  budget.available_budget=30.0

You should see output like this in your terminal:

[Step 1] round=1 | num_new_samples=30 | round_cost=30.0000 | total_cost=30.0000 | budget_remaining=0.0000
Done. Rounds: 1 | Total cost: 30.0000

Cold start

The first round always runs with a random acquisition (the surrogate isn't fitted yet). From round 2 onwards, the acquisition function guides the search.

Each line represents one active learning round. The fields are:

Field Meaning
round Active learning round index
num_new_samples Candidates queried in that round
round_cost Budget consumed in that round
total_cost Cumulative budget consumed across all rounds so far
budget_remaining Total budget still available

Once you've confirmed the run completes successfully, drop the budget override to run the full experiment:

uv run activelearning config/branin_single_fidelity.yaml

The same workflow applies directly to Hartmann. With a round budget of 10.0, a budget cap of 20.0 gives two rounds — enough to verify the output:

uv run activelearning config/hartmann_single_fidelity.yaml \
  budget.available_budget=20.0

Drop the override for the full run:

uv run activelearning config/hartmann_single_fidelity.yaml

2. Multi-Fidelity Setting

Switch to the Branin multi-fidelity config:

uv run activelearning config/branin_multi_fidelity.yaml \
  budget.available_budget=30.0

The terminal output looks the same, but the numbers will differ:

[Step 1] round=1 | num_new_samples=3000 | round_cost=30.0000 | total_cost=30.0000 | budget_remaining=0.0000
Done. Rounds: 1 | Total cost: 30.0000

What changed with multi-fidelity?

With fidelity costs of 0.01, 0.1, and 1.0, the selector can now pack many cheap low-fidelity queries into a single round budget. Notice that num_new_samples can be much larger when cheap queries dominate. The acquisition function learns to escalate to higher fidelities as evidence accumulates.

For Hartmann, the same applies with fidelity costs 0.125 / 0.25 / 1.0:

uv run activelearning config/hartmann_multi_fidelity.yaml \
  budget.available_budget=20.0

Full run:

uv run activelearning config/hartmann_multi_fidelity.yaml

3. Add Aim Logging

So far, results only exist in the terminal. Aim is an open-source experiment tracker that persists runs locally and lets you explore metrics, configs, and figures in an interactive UI.

Once the terminal workflow is clear, install the optional Aim dependency:

uv sync --extra aim

The repository ships config/aim_logging.yaml — a logger overlay that replaces the console-only logger with a MultiLogger (console + Aim). Compose it with any base config by passing both files to the CLI:

uv run activelearning config/branin_single_fidelity.yaml config/aim_logging.yaml
uv run activelearning config/branin_multi_fidelity.yaml config/aim_logging.yaml
uv run activelearning config/hartmann_single_fidelity.yaml config/aim_logging.yaml
uv run activelearning config/hartmann_multi_fidelity.yaml config/aim_logging.yaml

All runs still print to the console and are now also persisted in Aim. Branin runs additionally log a 2D contour of the landscape after each oracle query; Hartmann runs do not.

The figure below illustrates a typical visualization logged to Aim during a Branin run. Captured after the 10th active learning round, it displays the objective landscape overlaid with the known minima and the candidates queried at each fidelity level.

Branin landscape logged to Aim after round 10

4. Open Aim and inspect

Aim stores its data in the .aim/ directory at the repository root (already git-ignored).

Launch the Aim UI:

uv run aim up

Open the URL shown in the terminal. All runs appear under the project activelearning_tutorials.

The most useful views to start with:

  • Config tab — the full resolved config that was used for the run
  • Metrics — scalar time series for round_cost, total_cost, and budget_remaining
  • Images — 2D contour of the Branin landscape logged after each oracle query (Branin runs only)

Comparing runs

Because all runs log to the same activelearning_tutorials project, you can compare all four side by side — overlaying total_cost curves to see how multi-fidelity covers more of the space per unit budget, and how Branin and Hartmann differ in their convergence behaviour.

5. What comes next

This tutorial covers running and monitoring experiments from the checked-in configs. Natural follow-ups include:

  • adapting the configs to your own oracle — see the Extension Guide,
  • reading Multi-Fidelity Setting for a deeper treatment of how fidelity costs and confidences propagate through the loop,
  • or replacing the random sampler with a generative model — see the GFlowNet Sampler tutorial to learn how to configure and evaluate a GFlowNet that learns to sample proportionally to the reward.