Parameter Reference#

Parameters of the tuner can be set in the tuning configuration file (e.g. config.json) or via command line options.

Attention

If a parameter is present in both the configuration file and as a command line option, the configuration file takes precedence.

We will distinguish between the main setup parameters and model-related, tuning-related, match-related and miscellaneous parameters.

Main tuning setup#

The most important part when setting up a tuning run is to specify the participating engines, their fixed parameters and the UCI parameters to tune for the first engine.

A minimal tuning configuration could look like this:

{
    "engines": [
        {
            "command": "engine1",
            "fixed_parameters": {
                "Threads": 2
            }
        },
        {
            "command": "engine2",
            "fixed_parameters": {
                "Threads": 4
            }
        }
    ],
    "parameter_ranges": {
        "CPuct": "Real(0.0, 10.0)",
        "MaxCollisionEvents": "Integer(1, 65536)"
    }
}

The participating engines are given as a list in "engines". Each engine needs to contain a field "command" which specifies how cutechess-cli runs the engine. In "fixed_parameters" you can set arbitrary amount of UCI parameters to fixed values. These will not be optimized by the tuner.

To tell the tuner about the UCI parameters it should optimize, we will use the "parameter_ranges" dictionary. In the example we optimize two parameters CPuct and MaxCollisionEvents. We tell the tuner that CPuct is a real-valued parameter in the range from 0 to 10. Since MaxCollisionEvents can only assume whole numbers, we specify it as an Integer parameter.

Possible parameter specifications are:

  • Real(lower, upper) or (lower, upper): A real-valued parameter in the range from lower to upper.

  • Real(lower, upper, prior=log-uniform): A real-valued parameter in the range from lower to upper. Will be sampled in log-space. Useful for parameters for which we want to weight different orders of magnitude equally.

  • Integer(lower, upper) or (lower, upper): An integer-valued parameter in the range from lower to upper.

  • (val1, val2, ...): A categorical parameter which can only assume the specified values. The values can be of mixed type (e.g. (42, 'foo', 'bar')).

Nested parameters can be specified as follows:

{
    "parameter_ranges": {
        "TimeManager=legacy(steepness)": "Real(5.0, 10.0)",
        "TimeManager=legacy(midpoint-move)": "Real(30.0, 80.0)"
    }
}

Here TimeManager is the UCI parameter, legacy its value, steepness and midpoint-move are (sub-)parameters for legacy. For example, the following UCI will be send to the engine:

setoption name TimeManager value legacy(steepness=7.5,midpoint-move=42.0)

The remaining parameters of the optimizer are optional and described below.

Miscellaneous parameters#

Parameter

CLI

Description

"confidence"

--confidence FLOAT

Confidence to use for the highest density intervals of the optimum. [default: 0.9]

-d --data-path PATH

Save the evaluated points to this file. When restarting the tuner, this file will be read to resume the optimization process. [default: data.npz]

"logfile"

-l --logfile PATH

Path to the log file. [default: log.txt]

"plot_every"

--plot-every INTEGER

Plot the current optimization landscape every n-th iteration. Set to 0 to turn it off. [default: 1]

"plot_path"

--plot-path PATH

Path to the directory to which the tuner will output plots. [default: plots]

"random_seed"

--random-seed INTEGER

Number to seed all internally used random generators. [default: 0]

"result_every"

--result-every INTEGER

Output the current optimum, its score estimate and confidence intervals every n-th iteration. Set to 0 to turn it off. [default: 1]

--resume / --no-resume

Let the optimizer resume, if it finds points it can use. [default: True]

--fast-resume / --no-fast-resume

If set, resume the tuning process with the model in the file specified by the --model-path. Note, that a full reinitialization will be performed, if the parameter ranges have been changed. [default: True]

--model-path PATH

The current optimizer will be saved for fast resuming to this file. [default: model.pkl]

-v --verbose

Turn on debug output. -vv turns on the debug flag for cutechess-cli.

Warning

If --no-resume is passed it will overwrite any data found at data-path.