How to add a benchmark experiment¶
This guide shows you how to register a benchmark experiment in Algorithm Nexus.
A benchmark experiment is an ado custom experiment, distributed as a Python
package, that evaluates a target (an algorithm or model) and collects
measurements. Registering the python package in Algorithm Nexus
makes all the experiments it contains available to submissions.
The steps below register a graph-coloring experiment whose package is already on PyPI. After that walk-through, Alternatives covers GitHub URLs, packages that expose several experiments, and authoring a new package.
To register the problem this experiment relates to, see How to add a benchmark problem and instance.
Prerequisites¶
Work from a local checkout of your Algorithm Nexus fork with the CLI extra installed:
The following assumes a python package containing the experiment is published on PyPI (or GitHub; see Point the specifier at a GitHub URL).
1. Create the experiment folder¶
Create the experiment folder and write experiment_package.yaml. This file
names the Python package and the experiment identifiers it exposes.
Create experiments/rlx_coloring/experiment_package.yaml:
experiment_package:
- requirement_specifier: "rlx-coloring"
experiments:
- experimentIdentifier: rlx_coloring
experiment_package is a list of packages. requirement_specifier is a PyPI
package name (optionally with a version constraint) or a GitHub URL. The
experiments list is the set of experiments, each with an experimentIdentifier
and an optional experimentVersion, that submissions will reference.
The full field list is in Benchmark Experiments and Submissions.
You now have:
2. Validate¶
A successful run lists the experiment with status success. The registration is
ready to commit.
3. Open a pull request¶
git add experiments/rlx_coloring
git commit -s -m "feat(benchmark): Add rlx_coloring experiment"
git push origin add-rlx-coloring-experiment
Open a pull request from your fork to the Algorithm Nexus main branch.
To map this experiment to a benchmark instance, continue with How to bind an experiment to a benchmark instance. To apply this experiment to a target and instance, continue with How to add a benchmark submission.
Alternatives¶
Point the specifier at a GitHub URL¶
To register a package hosted on GitHub, set requirement_specifier to the
repository URL:
experiment_package:
- requirement_specifier: "https://github.com/<org>/<experiment-package-repo>"
experiments:
- experimentIdentifier: rlx_coloring
Then validate as in step 2.
Declare several experiment ids from one package¶
To expose more than one experiment from the same package, list each one:
experiment_package:
- requirement_specifier: "sorting-benchmarks>=1.0.0"
experiments:
- experimentIdentifier: bubble_sort
- experimentIdentifier: merge_sort
- experimentIdentifier: quick_sort
Each id in the list is available to submissions under this experiment folder.
Pin experiment versions or several package revisions¶
Each experiment can carry an experimentVersion (strict SemVer, optional). To
declare several versions of an experiment, add one package entry per
requirement_specifier, for example to pin two revisions of a repository:
experiment_package:
- requirement_specifier: "git+ssh://git@github.com/<org>/<repo>.git@21e38a9[ado]"
experiments:
- experimentIdentifier: rlx_coloring
experimentVersion: 1.2.3
- requirement_specifier: "git+ssh://git@github.com/<org>/<repo>.git@5489863[ado]"
experiments:
- experimentIdentifier: rlx_coloring
experimentVersion: 1.3.0
An experiment can be listed only once per requirement_specifier. Two versions of
the same experiment must come from two package entries with different
specifiers, as above.
Nexus assumes each requirement_specifier is static, meaning it always resolves
to the same package contents, and does not check it. Any specifier is accepted,
including a branch, tag, commit or version range, but it is up to you to make
sure it will not change: if a branch or tag moves, the installed package may no
longer provide the declared experimentVersion. For several versions of the
same experiment, pin each entry to an exact package version
(my-package==1.2.3) or, preferably, a commit hash (...repo.git@21e38a9).
Label an experiment's compute type¶
To label the compute type of an experiment, add a compute-type-<experiment>
key to the metadata block of experiment_package.yaml. The <experiment>
part must be one of the ids in the experiments list:
experiment_package:
- requirement_specifier: "rlx-coloring"
experiments:
- experimentIdentifier: rlx_coloring
metadata:
compute-type-rlx_coloring: Classical
See Compute type metadata for suggested values.
Author a new experiment package¶
To create the Python package itself, follow the ado custom experiment template, publish the package on PyPI or GitHub, then continue from step 1.
List registered experiments¶
To see which experiments Algorithm Nexus already registers: