Principle:Kubeflow Pipelines Recursive Sub Pipelines
| Sources | KFP Control Flow |
|---|---|
| Domains | ML_Pipelines, Control_Flow, Recursion |
| Last Updated | 2026-02-13 |
Overview
A control flow pattern that enables a sub-pipeline to invoke itself recursively, creating iterative loops within a pipeline DAG.
Description
Recursive sub-pipelines allow defining a graph component that can call itself, creating loops that repeat until a termination condition is met. This pattern is used for iterative refinement workflows — train-evaluate-check cycles where work continues until quality metrics are met. The termination condition uses dsl.Condition to gate the recursive call; when the condition is no longer met, recursion stops. Caching must be carefully managed (set max_cache_staleness to P0D) to prevent infinite loops.
Usage
Use when a pipeline needs to repeat a block of steps until a convergence or quality criterion is met — for example, iterative model training until error drops below a threshold.
Theoretical Basis
Recursive graph composition. A graph component is a sub-DAG that can reference itself, creating a dynamic loop. Termination is controlled by a conditional gate. This models iterative algorithms in a DAG-based execution framework.