█

AI/TLDR

Buy me a coffee
Buy me a coffee

Kubeflow Trainer

Kubernetes-native distributed training and LLM fine-tuning across PyTorch, JAX, and more

IN SHORT

What is Kubeflow Trainer?

Kubeflow Trainer is a Kubernetes-native platform for distributed AI training and large language model (LLM) fine-tuning. It runs multi-node, multi-GPU jobs across many frameworks, including PyTorch, MLX, HuggingFace, DeepSpeed, JAX, and XGBoost, and exposes them through two Kubernetes APIs: TrainJob and Runtimes. It sits in the GPU & Compute Clouds category of the Models & Inference tools.

Overview

Kubeflow Trainer is a Kubernetes-native platform for distributed AI training and large language model (LLM) fine-tuning. It runs multi-node, multi-GPU jobs across many frameworks, including PyTorch, MLX, HuggingFace, DeepSpeed, JAX, and XGBoost, and exposes them through two Kubernetes APIs: TrainJob and Runtimes.

It is built for teams that already run on Kubernetes and need to scale training beyond a single machine. It brings MPI to Kubernetes to coordinate high-throughput communication between GPU nodes, and integrates with ecosystem projects like Kueue for topology-aware scheduling and JobSet and LeaderWorkerSet for workload orchestration.

As a compute-orchestration tool, it sits between your training code and the cluster. AI practitioners define jobs in Python with the Kubeflow SDK, while the operator handles pod creation, scheduling, and a distributed data cache that streams large datasets toward GPU nodes.

What it does

  • Distributed training and LLM fine-tuning across PyTorch, MLX, HuggingFace, DeepSpeed, JAX, and XGBoost
  • Two Kubernetes APIs, TrainJob and Runtimes, for defining and reusing training setups
  • MPI on Kubernetes for multi-node, multi-GPU jobs on HPC clusters
  • Integrates with Kueue for topology-aware scheduling and with JobSet and LeaderWorkerSet for orchestration
  • Distributed data cache that streams large datasets to GPU nodes with zero-copy transfer
  • Python SDK (TrainerClient, CustomTrainer) to launch and manage jobs without writing Kubernetes manifests

Getting started

Kubeflow Trainer has two parts: a control plane you install on a Kubernetes cluster, and a Python SDK you use to submit jobs. You need Kubernetes and kubectl 1.31 or newer.

Install the control plane

Apply the Trainer manifests to your cluster with kubectl. Set VERSION to a released tag.

bashbash
export VERSION=v2.2.0
kubectl apply --server-side -k "https://github.com/kubeflow/trainer.git/manifests/overlays/manager?ref=${VERSION}"

Verify the pods are running

Check that the JobSet and Trainer controller managers are up in the kubeflow-system namespace.

bashbash
kubectl get pods -n kubeflow-system

Install the Python SDK

Install the Kubeflow SDK to talk to the Trainer APIs from Python.

bashbash
pip install -U kubeflow

Submit a TrainJob

List the available runtimes, then launch a CustomTrainer job with TrainerClient. Replace train_pytorch with your own training function.

pythonpython
from kubeflow.trainer import TrainerClient, CustomTrainer

for r in TrainerClient().list_runtimes():
    print(f"Runtime: {r.name}")

job_id = TrainerClient().train(
    trainer=CustomTrainer(
        func=train_pytorch,
        num_nodes=4,
        resources_per_node={
            "cpu": 3,
            "memory": "16Gi",
            "gpu": 1,
        },
    )
)

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Fine-tune an LLM across several GPU nodes on a shared Kubernetes cluster
  • Run distributed PyTorch or JAX training jobs without writing raw Kubernetes manifests
  • Schedule multi-node MPI training on HPC hardware with queueing through Kueue
  • Migrate existing Kubeflow Training Operator V1 workloads to the newer TrainJob API

How Kubeflow Trainer compares

Kubeflow Trainer alongside other open-source gpu & compute clouds tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Ray★ 44.4kA distributed computing framework that scales Python and ML workloads for training, tuning, data processing, and serving.
Prefect★ 24.3kA Python-native workflow orchestration tool for scheduling, running, and monitoring data and ML pipelines.
Dagster★ 16.5kA data and ML pipeline orchestrator with a declarative asset model, built-in lineage, and observability.
Kubeflow★ 16kA Kubernetes toolkit that brings together pipelines, notebooks, and training operators for running ML workflows at scale.
Kedro★ 11.1kPython framework for production-ready data engineering and data science pipelines, hosted by the LF AI & Data Foundation: a project template, a Data Catalog of connectors, and a dependency-resolving pipeline abstraction.
SkyPilot★ 10.9kA framework that runs AI jobs across clouds and Kubernetes, automatically finding and provisioning the cheapest available GPUs.
Metaflow★ 10.4kA Python framework from Netflix for building and running data science and ML workflows that scale from laptop to cloud.
Kubeflow Trainer★ 2.3kKubernetes-native distributed training and LLM fine-tuning across PyTorch, JAX, and more