Skip to content

Docs migration from XPK to CTK(2/5) - #5176

Draft
KevinYenky wants to merge 6 commits into
AI-Hypercomputer:mainfrom
KevinYenky:docs/ctk-migration-core-guides
Draft

Docs migration from XPK to CTK(2/5)#5176
KevinYenky wants to merge 6 commits into
AI-Hypercomputer:mainfrom
KevinYenky:docs/ctk-migration-core-guides

Conversation

@KevinYenky

@KevinYenky KevinYenky commented Sep 9, 2026

Copy link
Copy Markdown

Description

This PR is the second part of decomposing XPK to Cluster Toolkit document migration. It focuses on updating our post-training tutorial documentation to use Cluster Toolkit (CTK) instead of the deprecated XPK launcher.

Specifically, this PR updates the following post-training guides:

  • Supervised Fine-Tuning (SFT): Replaces xpk commands with gcluster job submit.
  • LoRA: Updates submission commands and environment variables for LoRA fine-tuning workflows.
  • Knowledge Distillation: Replaces xpk workload create-pathways with the multi-host gcluster equivalent, ensuring all student/teacher model overrides and tokenizer paths are properly documented.

Why this is being made:
CTK is replacing XPK as the primary submission mechanism for Google Kubernetes Engine (GKE) workloads. Breaking down the massive PR #5175 into smaller, logical chunks (starting with these core guides) makes the migration significantly easier to review and test.

Tests

tested by scripts that run the gcluster command provided in the documents, results stored in gcs bucket.

Checklist

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents.

@google-cla

google-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the post-training documentation (covering knowledge distillation, LoRA, and SFT) from using the XPK launcher to using the Cluster Toolkit (gcluster) for submitting and managing multi-host TPU workloads on GKE. Feedback was provided regarding the updated gcluster job submit command for multi-host distillation, which is missing critical parameters such as tokenizer paths and student model overrides required for successful execution.

Comment thread docs/tutorials/posttraining/knowledge_distillation.md Outdated
@KevinYenky KevinYenky changed the title Docs migration from XPK to CTK(1/5) Docs migration from XPK to CTK(2/5) Sep 9, 2026
@KevinYenky KevinYenky mentioned this pull request Sep 10, 2026
4 tasks
# Note: Kubernetes requires workload names to be valid DNS labels (lowercase, no underscores or periods).
export RUN_NAME=<RUN_NAME>
# Note: Workload names cannot exceed 28 characters (or 22 characters when using Pathways due to Kubernetes 63-byte coordinator label limits) and must be valid DNS labels (lowercase alphanumeric and hyphens).
export RUN_NAME="sft-$(date +%m%d%H%M%S)"

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.

I used this date postfix in my test, but we can remove it here and stay consistent to the previous.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

reverted it to the previous name.


# 1. Connect to the cluster (required for kubectl commands later):
# gcloud container clusters get-credentials ${GKE_CLUSTER?} --location ${ZONE?} --project ${PROJECT_ID?}
# gcloud container clusters get-credentials ${GKE_CLUSTER?} --zone ${ZONE?} --project ${PROJECT_ID?}

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.

May I know is it relevant to CTK migration?
I checked that both location and zone works but location is preferred ref: doc

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sure. Changed it to the recommended --location

--command "python3 -m maxtext.trainers.post_train.sft.train_sft run_name=${RUN_NAME?} base_output_directory=${BASE_OUTPUT_DIRECTORY?} model_name=${MODEL?} load_parameters_path=${MAXTEXT_CKPT_PATH?} hf_access_token=${HF_TOKEN?} per_device_batch_size=1 steps=${STEPS?} profiler=xplane hf_path=${DATASET_NAME?} train_split=${TRAIN_SPLIT?} train_data_columns=${TRAIN_DATA_COLUMNS?}"
gcluster job submit \
--image=${DOCKER_IMAGE?} \
--command "python3 -m maxtext.trainers.post_train.sft.train_sft run_name=${RUN_NAME?} base_output_directory=${BASE_OUTPUT_DIRECTORY?} model_name=${MODEL?} load_parameters_path=${MAXTEXT_CKPT_PATH?} hf_access_token=${HF_TOKEN?} per_device_batch_size=1 steps=${STEPS?} profiler=xplane hf_path=${DATASET_NAME?} train_split=${TRAIN_SPLIT?} train_data_columns=${TRAIN_DATA_COLUMNS?}" \

@lydhr lydhr Sep 10, 2026

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.

inconsistent on using --command= or

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done. Thanks

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.

2 participants