Skip to content

Add ai-ml/gke-ray/tpu/get-started: Ray on TPU end-to-end example#2122

Merged
olivi-eh merged 9 commits into
GoogleCloudPlatform:mainfrom
inardini:inardini--get-started-ray-tpu
Jul 17, 2026
Merged

Add ai-ml/gke-ray/tpu/get-started: Ray on TPU end-to-end example#2122
olivi-eh merged 9 commits into
GoogleCloudPlatform:mainfrom
inardini:inardini--get-started-ray-tpu

Conversation

@inardini

Copy link
Copy Markdown
Contributor

Description

Adds a new end-to-end Ray-on-TPU get-started example under
ai-ml/gke-ray/tpu/get-started/, alongside the existing tpu/ samples. It walks
through the full LLM lifecycle on a single Cloud TPU v6e slice with Ray on GKE,
using Qwen3-4B-Instruct-2507 (small, text-only, Apache-2.0) and the
ultrafeedback_binarized preference dataset:

  1. cluster: Terraform for a GKE cluster with the Ray Operator add-on, a
    single-host v6e 2x4 slice (Spot), Workload Identity, a Cloud Storage bucket,
    and a Prometheus + Grafana monitoring stack.
  2. serve: Qwen3-4B behind an OpenAI-compatible API with Ray Serve and vLLM,
    including the Ray 2.56 high-throughput ingress (HAProxy).
  3. data: Ray Data to prepare a DPO dataset and run offline batch prediction
    across the slice.
  4. train: DPO fine-tune with Ray Train's JaxTrainer, Tunix, and qwix LoRA.

Proposed and accepted in #2119.

Notes for reviewers:

  • Dependencies are pinned to the exact versions validated on the pinned
    vllm-tpu nightly base (captured from a pip freeze of the built images). The
    serve and train images build via Cloud Build.
  • Validated end-to-end on a v6e 2x4 slice, including the high-throughput serve
    path (proxies healthy, HAProxy actors alive, endpoint serves).
  • The base image is a pinned nightly because it is the first to bundle Ray 2.56,
    vLLM, and ray.serve.llm on TPU. The serve and train READMEs document this and
    recommend mirroring it to your own registry for durability.

Tasks

  • The contributing guide has been read and followed.
  • The samples added / modified have been fully tested.
  • Workflow files have been added / modified, if applicable.
  • Region tags have been properly added, if new samples.
  • Editable variables have been used, where applicable.
  • All dependencies are set to up-to-date versions, as applicable.
  • Merge this pull-request for me once it is approved.

inardini added 9 commits July 13, 2026 20:25
End-to-end Ray-on-TPU get-started example on a single Cloud TPU v6e slice:

- cluster: GKE + Ray Operator add-on + v6e slice + GCS + monitoring (Terraform)
- serve:   Qwen3-4B behind an OpenAI-compatible API (Ray Serve + vLLM)
- data:    DPO dataset prep + batch prediction (Ray Data)
- train:   DPO fine-tune with LoRA (Ray Train + Tunix)

Adds a CI workflow that validates the Terraform and builds the serve and
train images.

Towards GoogleCloudPlatform#2119.
Replace the Step/Content table in the get-started README with a numbered
list and a short lead-in, so the end-to-end order reads more clearly.
Expand each step in the get-started README to say what it does and which
Ray library it uses, and reference each sample directory inline.
Replace the loose pip specs in the serve and train Dockerfiles with the exact
versions frozen from a build on the pinned vllm-tpu base, for reproducibility:

- serve: protobuf==5.29.6 (grpcio-status stays 1.70.0)
- train: protobuf==6.33.6, google-tunix==0.1.7, grain==0.2.18, qwix==0.1.8,
  wandb==0.28.0
The provider "helm" block uses the v3 `kubernetes = {}` attribute syntax, so
helm 2.x is incompatible, not just low.

- google:     >= 6.0.0  -> >= 7.0.0
- kubernetes: >= 2.30.0 -> >= 3.0.0
- helm:       >= 2.13.0 -> >= 3.0.0

terraform validate passes with the bumped floors.
topology and accelerator_type are already CLI args; add a matching
--num-workers (default 1) so the trainer scales to multi-host slices.
Default preserves the validated single-host 2x4 behavior.
Add the Ray 2.56 high-throughput env vars to the serve RayService (head and
worker) and install haproxy in the serve image, which they require. Document
them in the serve README. Verified on a v6e slice: proxies HEALTHY, HAProxy
actors ALIVE, endpoint serves.
Add a prerequisites lead-in to the cluster and train READMEs.
Add a Prerequisites section to the data README (which Ray head the jobs use;
batch prediction needs the train RayCluster for /data + TPU), and note the
trainer's --topology/--num-workers flags for multi-host slices.
@snippet-bot

snippet-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 7 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@ryanaoleary ryanaoleary left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Primarily reviewed the python scripts, YAML, and READMEs but LGTM!!

@alizaidis alizaidis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@olivi-eh olivi-eh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@olivi-eh
olivi-eh merged commit 59875df into GoogleCloudPlatform:main Jul 17, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants