Repository navigation
Description
Description
create_hpo_experiment() silently drops step from floating-point search-space ranges when algorithm="grid".
For example, passing {"min": 0.1, "max": 0.5, "step": 0.1} produces a successful preview, but the serialized feasibleSpace contains only min, max, and distribution—no step.
Katib v0.19.0's grid validator converts double parameters into discrete combinations and requires a step. As a result, the preview succeeds, but Katib cannot validate the grid search space to generate trials.
I reproduced the missing field offline through the real MCP tool. No Kubernetes cluster is required.
Steps to Reproduce
- Call
create_hpo_experiment()withalgorithm="grid"and a floating-point range that includesstep. - Inspect
config.spec.parameters[0].feasibleSpacein the preview. - Observe that
stepis missing. - Submit the experiment to Katib; its grid validation cannot build the discrete combinations without the step.
Expected Behavior
For a floating-point grid parameter, preserve the supplied positive finite step in feasibleSpace.step. If grid search requires a step and none is provided, return a clear validation error before previewing or submitting the experiment.
Actual Behavior
The preview succeeds but serializes the parameter without feasibleSpace.step. Katib's grid validation then fails because the double parameter has no step.
MCP Server Version
main @ ce1dbcf
Python Version
3.12
Kubernetes Version
No response
MCP Client
Custom / Other
References
- Flat HPO parameter builder:
mcp-server/kubeflow_mcp/optimizer/api/optimization.py
Lines 87 to 130 in ce1dbcf
def _build_parameter(name: str, spec: dict[str, Any]) -> models.V1beta1ParameterSpec: """Convert one search-space entry into a Katib parameter spec. Uses the SDK's ``Search`` helpers so feasible-space encoding (distribution names, string coercion of numbers) stays identical to the SDK's own output. Raises: TypeError: The entry is not an object. ValueError: The entry is an object but malformed. Either message is surfaced to the caller as a validation error. """ if not isinstance(spec, dict): raise TypeError(f"search_space['{name}'] must be an object, got {type(spec).__name__}") if "choices" in spec: choices = spec["choices"] if not isinstance(choices, list) or not choices: raise ValueError(f"search_space['{name}'].choices must be a non-empty list") param = Search.choice(choices) else: missing = {"min", "max"} - spec.keys() if missing: raise ValueError( f"search_space['{name}'] needs 'min' and 'max' (or 'choices'); " f"missing {sorted(missing)}" ) distribution = spec.get("type", "uniform") if distribution == "uniform": _check_range(name, spec, distribution) param = Search.uniform(spec["min"], spec["max"]) elif distribution == "loguniform": _check_range(name, spec, distribution) param = Search.loguniform(spec["min"], spec["max"]) elif distribution == "int": param = _build_int_parameter(name, spec) else: raise ValueError( f"search_space['{name}'].type must be 'uniform', 'loguniform' or 'int', " f"got '{distribution}'" ) param.name = name return param - Katib v0.19.0 grid validation: https://github.com/kubeflow/katib/blob/v0.19.0/pkg/suggestion/v1beta1/optuna/service.py
- Katib v0.19.0 grid conversion requires a step for double parameters: https://github.com/kubeflow/katib/blob/v0.19.0/pkg/suggestion/v1beta1/internal/search_space.py
- Example Katib floating-point grid: https://github.com/kubeflow/katib/blob/v0.19.0/examples/v1beta1/hp-tuning/grid.yaml
- Related but distinct: fix(optimizer): validate HPO trial bounds in spec preview and reject booleans #615 validates trial-count bounds; bug(pipelines): _validate_params accepts non-finite floats (NaN/Infinity) as valid JSON #647 rejects non-finite floats.
Activity
ADITYA-CODE-SOURCE commentedon Dec 2, 2026
/assign