Skip to main content
This tutorial shows how to add and use pipeline parameters with Kubeflow Pipelines. The example pipeline has two components:
  • train_model — simulates training and accepts hyperparameters.
  • evaluate_model — simulates model evaluation.
We start with a hardcoded pipeline, then convert it to accept runtime parameters so each pipeline run can use different hyperparameters.

Hardcoded pipeline (problem)

In this version the epochs and lr values are fixed inside the component, so every run uses the same hyperparameters.
Problem: the hyperparameters are hardcoded. To run experiments with different values you must change the source code each time. Pipeline parameters solve this by allowing values to be supplied at run-time.

How pipeline parameters work (overview)

  • Declare parameters as arguments to the @pipeline function and give them default values if desired.
  • Make the component accept the corresponding arguments.
  • Forward the pipeline parameters to the component when constructing the pipeline tasks.
Pipeline parameters are ideal for hyperparameters, dataset locations, or any run-specific configuration. Declaring defaults keeps runs reproducible while allowing overrides in the UI or via the API.
Below is the same pipeline updated to accept epochs and lr as pipeline parameters. When you upload the compiled pipeline, the UI will expose these fields so users can override them for each run.
Key points:
  1. ml_pipeline declares epochs and lr (defaults: 10 and 0.01).
  2. When creating a run in the Kubeflow Pipelines UI or via API, you can override these defaults.
  3. The pipeline forwards those values into train_model at runtime.

Compile the pipeline

Generate the pipeline package (YAML) with:
  • python pipeline.py
The compiler may emit a FutureWarning about a default base image used by the @component decorator. This is informational; see the warning callout below.
You may see a FutureWarning about the default base image changing in a future SDK release. To avoid surprises, specify an explicit base_image when using @component, or ensure your component is compatible with the newer Python version.
Example console output (trimmed):

Upload the compiled pipeline to Kubeflow

  • In the Kubeflow Pipelines UI, upload the generated parameters.yaml and create a new pipeline.
Screenshot of the Kubeflow Central Dashboard showing the "New Pipeline" creation form, with the pipeline name set to "parameters-pi" and a file "parameters.yaml" selected for upload. The app's left navigation bar (Home, Notebooks, Pipelines, etc.) is visible.

Start a run and supply parameter values

  • Click “Create run” (select an experiment if needed).
  • The run form exposes the pipeline parameters (epochs, lr). Enter values to override the defaults (for example: epochs = 20, lr = 0.02) and start the run.
A screenshot of the Kubeflow web UI showing a "Start Run" form for pipelines, with a left navigation bar and fields for experiment, service account, run type, pipeline root and run parameters. The page shows options like one-off vs recurring and input boxes for epochs and learning rate.

Verify the run and inspect inputs

  • After the run completes, open the Train Model step to inspect input parameters and logs.
  • The run inputs will show the parameter values you supplied:
  • The executor logs should include the component printout confirming the passed-in values:

Quick reference

Summary

  • Define pipeline parameters as inputs to the @pipeline function (with optional defaults).
  • Accept corresponding arguments in the component that needs them.
  • Pass the pipeline parameters into the component call inside the pipeline.
  • Users can override defaults in the Kubeflow UI or via the API for flexible experimentation without changing code.
Further reading and references:

Watch Video