﻿# Optuna categorical parameters: reusing a name requires a compatible choice definition

Version categorical search choices in Optuna deliberately when adding optimizers or model variants, separating conditional parameter presence from changing an existing distribution.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-optuna-categorical-choice-space-versioning/
Language: en

## Identify the parameter schema already stored

A researcher resumes a study after adding another optimizer to a categorical choice list. Earlier trials used the same parameter name with the original choices. The [distribution compatibility reference](https://optuna.readthedocs.io/en/stable/reference/generated/optuna.distributions.check_distribution_compatibility.html) describes checking distribution kind and categorical choices against the previously stored definition. Treat the choice list as part of the parameter schema. It is more than a UI menu that can be casually edited while assuming every old and new trial belongs to an unchanged search.

## Distinguish conditional presence from incompatible meaning

The [Pythonic search-space tutorial](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/002_configurations.html) shows branches and loops that request different parameters depending on earlier choices. A branch-specific parameter may legitimately be absent from another trial. That does not mean the same name can stand for unrelated categorical domains on different branches. Give distinct logical parameters distinct names, and document how conditional presence changes the set of candidates that the sampler can evaluate.

## Keep external choices interpretable

The [CategoricalDistribution API](https://optuna.readthedocs.io/en/stable/reference/generated/optuna.distributions.CategoricalDistribution.html) describes candidate values and external/internal representations. Preserve the human-meaningful choice value with the study rather than interpreting an internal index as a durable optimizer identity. Also keep choices compatible with the selected storage's supported value types. A model-variant label should identify a defined configuration, not silently acquire a different architecture when application code changes behind an unchanged categorical string.

## Decide the boundary of a changed search

When the candidate domain changes substantially, establish a deliberate new study or a clearly versioned parameter design. Renaming a parameter merely to suppress an error is not sufficient scientific documentation; explain how the new domain relates to previous trials. Existing outcomes can remain useful baseline evidence, but they were collected under a particular candidate population and objective. Avoid presenting an expanded search as though its proposal distribution and available choices were unchanged throughout the history.

## Probe the schema before expensive evaluations

Use a small objective that records recognizable choices, then inspect behavior when the intended schema is reused and when a proposed categorical definition differs. Related guides cover [taxonomy version mapping](/journal/data-guide-label-taxonomy-version-mapping/) and [explicit table schemas](/journal/data-guide-frictionless-table-schema/). The purpose is to verify schema compatibility and interpretation before spending GPU trial time. A cleanly accepted parameter definition still requires separately checking that each selected choice constructs the intended model or optimizer in the training application.
