Skip to content

Add recipe for training Maxtext Qwen3.5-35B-A3B with v6e-256 #recipebot - #373

Open
Ardiegon wants to merge 2 commits into
AI-Hypercomputer:mainfrom
Ardiegon:oskarb/qwen35-v6e-256-training-recipes
Open

Ardiegon wants to merge 2 commits into
AI-Hypercomputer:mainfrom
Ardiegon:oskarb/qwen35-v6e-256-training-recipes

Conversation

@Ardiegon

Copy link
Copy Markdown

Adding recipe for training Maxtext Qwen3.5-35B-A3B with v6e-256, both for kubernetes and xpk.

- UBench Run ID: maxtext_training_with_xpk-llama3_1_8b-2026-10-13_122827-0adb8e8a-dfb7-4c16-ac25-79fba638966b

This PR should be merged after successfully merging those two PRs:

@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 introduces recipes for pretraining the Qwen3.5-35B-A3B model using MaxText on Trillium GKE clusters (v6e-256) via both Kubernetes JobSet and XPK. The feedback highlights a few critical improvements: first, the ttlSecondsAfterFinished field in the JobSet manifest requires v0.14.0, which conflicts with the v0.13.0 version specified in the prerequisites; second, the signal trap in the manifest should use the captured $PID instead of $! to avoid volatility; and finally, the python command in the XPK recipe should be prepended with exec to ensure proper SIGTERM propagation for graceful shutdown.

annotations:
alpha.jobset.sigs.k8s.io/exclusive-topology: cloud.google.com/gke-nodepool # 1:1 job replica to node pool assignment
spec:
ttlSecondsAfterFinished: 43200

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The ttlSecondsAfterFinished field was introduced in JobSet v0.14.0. Since the prerequisites in the README specify JobSet v0.13.0, applying this manifest will fail with a validation error on clusters running v0.13.0. Consider commenting this field out or upgrading the JobSet version in the README to v0.14.0 or later.

  # ttlSecondsAfterFinished: 43200

- -c
- |
echo XPK Start: $(date);
_sigterm() (kill -SIGTERM $! 2>/dev/null;);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using $! inside the trap function is volatile because $! always refers to the most recently started background process in the shell, which can change if other background commands are executed. Since the background process PID is explicitly captured in $PID on line 55, it is much safer and more robust to use $PID in the signal handler. Additionally, using standard curly braces {} instead of subshell parentheses () is preferred for standard function definitions.

                  _sigterm() { kill -SIGTERM "$PID" 2>/dev/null; }

export LIBTPU_INIT_ARGS='${XLA_FLAGS}' && \
export JAX_PLATFORMS='tpu,cpu' && \
export ENABLE_PJRT_COMPATIBILITY='true' && \
python3 -u -m maxtext.trainers.pre_train.train src/maxtext/configs/base.yml ${MAXTEXT_ARGS}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The python training process is run in the foreground of the container's entrypoint shell without exec. When GKE/Kueue sends a SIGTERM (e.g., during preemption or eviction), the shell (PID 1) receives the signal but does not propagate it to the foreground python process, causing the training job to be abruptly killed without triggering MaxText's graceful shutdown and checkpointing handlers. Prepending exec ensures that the python process replaces the shell as PID 1 and receives termination signals directly.

Suggested change
python3 -u -m maxtext.trainers.pre_train.train src/maxtext/configs/base.yml ${MAXTEXT_ARGS}"
exec python3 -u -m maxtext.trainers.pre_train.train src/maxtext/configs/base.yml ${MAXTEXT_ARGS}"

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