Index
MaxText
`` (getting-started)= Welcome to MaxText! This guide will help you get started with running your first MaxText workloads. Whether you are working on a single host or scaling up to a multihost environment using Cloud TPUs or NVIDIA GPUs, this page provides the starting point for your journey. Follow the steps below to install MaxText, train your first model, and run inference. 1. To store logs and checkpoints, create a Cloud Storage bucket in your project. To run MaxText, the TPU or GPU VMs must have read/write permissions for the bucket. These permissions are granted by service account roles, such as the 2. MaxText reads a yaml file for configuration. We also recommend reviewing the configurable options in 3. Checkpoint Conversion: In order to run MaxText on HuggingFace checkpoints, you must convert them to the MaxText/Orbax format first. For detailed instructions, see the Checkpoint Conversion Guide. This procedure describes how to run MaxText on a single GPU or TPU host. Before running MaxText, you must install it on your VM. - For detailed installation instructions, see the Installation Guide. To get started with training your first model, refer to the Pre-training Tutorial. To fine-tune your model or apply post-training techniques (such as SFT or RL), refer to the Post-training Tutorial. This guide covers various post-training workflows. To run inference (decoding) using MaxText models, refer to the Inference Tutorial. This guide covers offline and online inference, as well as integration with vLLM. Google Kubernetes Engine (GKE) is the recommended way to run MaxText on multiple hosts. It provides a managed environment for deploying and scaling containerized applications, including those that require TPUs or GPUs. See Running MaxText with Cluster Toolkit or Running Maxtext with XPK for details. You can run MaxText interactively using Jupyter notebooks, Google Colab, or Visual Studio Code. Refer to the Notebook Guide for instructions on setting up your notebook environment on TPUs. After you get workloads running, there are optimizations you can apply to improve performance. For more information, see Optimization Tips. --- Explore our how-to guides for optimizing, debugging, and managing your MaxText workloads. ::::{grid} 1 2 2 2 :::{grid-item-card} ⚡ Optimization Techniques for maximizing performance, including sharding strategies, Pallas kernels, and benchmarking. :::{grid-item-card} 💾 Data Pipelines Configure input pipelines using Grain (recommended for determinism), HuggingFace, or TFDS. :::{grid-item-card} 🔄 Checkpointing Manage GCS checkpoints, handle preemption with emergency checkpointing, and configure multi-tier storage. :::{grid-item-card} 🔍 Monitoring & Debugging Tools for observability: goodput monitoring, hung job debugging, and Vertex AI TensorBoard integration. :::{grid-item-card} 🐍 Python Notebooks Interactive development guides for running MaxText on Google Colab or local JupyterLab environments. :::{grid-item-card} 🌱 Model Bringup A step-by-step guide for the community to help expand MaxText's model library. :::{grid-item-card} 🎗️ LoRA Model Bringup Learn how to integrate Low-Rank Adaptation (LoRA) support for a new model architecture. :::{grid-item-card} 🎓 Distillation How online distillation works in MaxText: loss anatomy, α / β / temperature schedule tuning, layer indices, monitoring metrics, and troubleshooting. :::{grid-item-card} 📊 Evaluation Run benchmark evaluation (lm-eval, evalchemy, custom datasets) against MaxText checkpoints using the vLLM-native eval framework. Deep dive into MaxText architecture, models, and core concepts.{raw} html{grid} 1 2 2 2
---
file: index.html
---<div class="doc-body">
<section class="latest-news">
---
start-after:
end-before:
---</section>
</div>
---
maxdepth: 2
hidden:
---
getting_started
install_maxtext
tutorials
run_maxtext
guides
reference
development
release_notes---Development
---
hidden:
---
development/update_dependencies.md
development/contribute_docs.md
development/hlo_diff_testing.md---STORAGE ADMINGetting Started
Getting Started
Prerequisites
role.configs/base.yml. This file includes a decoder-only model of ~1B parameters. The configurable options can be overwritten from the command line. For instance, you can change the steps or log_period by either modifying configs/base.yml or by passing in steps and log_period as additional arguments to the train.py call. Set base_output_directory to a folder in the bucket you just created.maxtext[tpu]Running MaxText on a Single Host
1. Installation
- For TPU VMs, install for pre-training, or maxtext[tpu-post-train] for post-training.maxtext[cuda12]
- For GPU VMs, ensure you install .2. Running Pre-training
3. Running Post-training
4. Running Inference
Running MaxText on Multiple Hosts
Running MaxText in Notebooks
Next steps: preflight optimizations
Guides
How-to guides
:gutter: 2
:link: guides/optimization
:link-type: doc
:::
:link: guides/data_input_pipeline
:link-type: doc
:::
:link: guides/checkpointing_solutions
:link-type: doc
:::
:link: guides/monitoring_and_debugging
:link-type: doc
:::
:link: guides/run_python_notebook
:link-type: doc
:::
:link: guides/model_bringup
:link-type: doc
:::
:link: guides/lora_model_bringup
:link-type: doc
:::
:link: guides/distillation
:link-type: doc
:::
:link: guides/eval_framework
:link-type: doc
:::
::::
---
hidden:
maxdepth: 1
---
guides/optimization.md
guides/data_input_pipeline.md
guides/checkpointing_solutions.md
guides/monitoring_and_debugging.md
guides/run_python_notebook.md
guides/model_bringup.md
guides/lora_model_bringup.md
guides/distillation.md
guides/eval_framework.md---Reference
Reference documentation
---
gutter: 2
---
``{grid-item-card} 📊 Performance Metrics
:link: reference/performance_metrics
:link-type: doc
Understanding Model Flops Utilization (MFU), calculation methods, and why it matters for performance optimization.
:link: reference/models
:link-type: doc
Supported models and architectures, including Llama, Qwen, and Mixtral. Details on tiering and new additions.
:link: reference/architecture
:link-type: doc
High-level overview of MaxText design, JAX/XLA choices, and how components interact.
:link: reference/core_concepts
:link-type: doc
Key concepts including checkpointing strategies, quantization, tiling, and Mixture of Experts (MoE) configuration.
📚 API Reference
Find comprehensive API documentation for MaxText modules, classes, and functions in the API Reference page.
`` MaxText is available in PyPI and can be installed through pip. Please see our MaxText Installation Guide for setup instructions. #### Changes - Upgraded JAX to version 0.10.0 for pre-training and 0.10.1 for post-training. #### Deprecations - Deleted legacy DPO implementation in favor of the integrated DPO trainer. #### Changes - Upgraded JAX to version 0.9.2, improving support for both pre-training and post-training. #### Deprecations - Legacy #### Changes - Use the new #### Changes - New #### Deprecations - Many MaxText modules have changed locations. Core commands like train, decode, sft, etc. will still work as expected temporarily. Please update your commands to the latest file locations Our first MaxText PyPI package is here! MaxText is a high performance, highly scalable, open-source LLM library and reference implementation written in pure Python/JAX and targeting Google Cloud TPUs and GPUs for training. We are excited to make it easier than ever to get started. Users can now install MaxText through pip, both for local development and through stable PyPI builds. Please see our MaxText Installation Guide for more setup details. Going forward, this page will document notable changes as we release new versions of MaxText. --- Choose your environment and orchestration method to run MaxText. ::::{grid} 1 2 2 2 :::{grid-item-card} 💻 Localhost / Single VM Get started quickly on a single machine. Clone the repo, install dependencies, and run your first training job on a single TPU or GPU VM. :::{grid-item-card} 🎮 Single-host GPU Run MaxText on single-host NVIDIA GPUs (e.g., A3 High/Mega). Includes Docker setup, NVIDIA Container Toolkit installation, and 1B/7B model training examples. :::{grid-item-card} 🚀 At scale with Cluster Toolkit (GKE) Deploy to Google Kubernetes Engine (GKE) using Cluster Toolkit's :::{grid-item-card} 🏗️ At scale with XPK (GKE) Deploy to Google Kubernetes Engine (GKE) using XPK. Orchestrate large-scale training jobs on TPU or GPU clusters with simple CLI commands. :::{grid-item-card} 🌐 Multi-host via Pathways Run large-scale JAX jobs on TPUs using Pathways. Supports batch and headless (interactive) workloads on GKE. :::{grid-item-card} 🔌 Decoupled Mode Run tests and local development without Google Cloud dependencies (no :::{grid-item-card} ♻️ Elastic training (demo) Demonstrate fault-tolerant training with Pathways on GKE: lose a TPU slice mid-run and recover in-process from the last checkpoint, no job restart.{toctree}``
---
hidden:
maxdepth: 1
---
reference/performance_metrics
reference/models
reference/architecture
reference/core_concepts
reference/api.rst---eval_intervalRelease Notes
MaxText release notes
PyPI Package
Releases
v0.2.3
- New vLLM-Powered Evaluation Framework: Introduced an eval framework for running lm-eval, evalchemy, and custom benchmarking against MaxText checkpoints. See the evaluation guide for details.
- Added support for pre-training new models:
- Qwen3.5: Qwen3.5 35B & 397B is now supported.
- Qwen3-Omni: Support for multimodal SFT (PR #3863).
- Direct Preference Optimization (DPO/ORPO) Support: Full support for DPO and ORPO alignment pipelines. See the DPO tutorial for details.
- Reinforcement Learning (RL) Recipe: Added a pre-configured RL recipe for Qwen3-30b-a3b.
- Iterative Quality Monitoring (RL): Added intermediate evaluation hooks to automatically run quality benchmarks during RL training (every steps), optimized with a new eval_batch_size configuration knob.dataset_processor_path
- Developer Extensibility: Added CLI knob for custom dataset integration, and refactored shared post-training hooks to simplify custom SFT, DPO, and RL workflow development.[tpu-post-train]
- Generalized Learn-to-Init (LTI) for Distillation: Enhanced post-training distillation capabilities with generalized LTI support.
- Added support for recording elastic goodput events during training to track efficiency (PR #3901).
- Installation Updates: Updated the installation command to require UV_TORCH_BACKEND=cpu(see Installation Guide).TunixMaxTextAdapter
- Zero1 AOT Compilation: Added zero1 support to Ahead-Of-Time (AOT) compilation in train compile, improving compilation capabilities for zero1 config.
- MoE Performance Optimization: Integrated ragged gather reduce into Mixture of Experts (MoE) layers to optimize memory and performance by replacing ragged scatter and supporting backward pass.
- Added E2E scripts to run checkpoint conversion, pre-training and post-training (SFT, RL) with Gemma3-4B model.
- Bug Fixes and Usability Enhancements:
- Attention Masking Fix in RL: Fixed an issue in where queries at non-pad positions could attend to pad-position keys during training, which was corrupting log-probabilities and affecting GRPO training reward trajectories (PR #4016).train_distill
- JAX/NNX Gradient Mutation Fix: Refactored post-training loops (, train_sft, train_rl) to use jax.value_and_grad with explicit NNX state split/merge instead of nesting nnx.value_and_grad inside nnx.jit (PR #3652).open-r1/OpenR1-Math-220k
- Qwen3-MoE Checkpoint Conversion: Fixed checkpoint conversion issues for Qwen3-MoE models (PR #3868).
- Duplicate Configuration Failures Fix: Allowed identical config overrides and handled configuration exceptions cleanly (PR #3933).
- Documentation Improvements: Updated Getting started guide, including new guides for the evaluation framework and the DPO tutorial.
- Removed stack trace collection feature.v0.2.2
- Introduced simplified APIs for accessing MaxText models.
- Included maxtext_with_gepa.ipynb, a new notebook demonstrating AIME prompt optimization using the GEPA framework within MaxText.
- Added support for Kimi-K2 models and the MuonClip optimizer. Users can explore this with the kimi-k2-1t config (see user guide for details).
- Kimi-K2-Thinking, Kimi-K2.5 (text), and Kimi-K2.6 (text) are now supported. See Run_Kimi.md for details.
- DeepSeek-V3.2 is now supported, including DeepSeek Sparse Attention for handling long contexts. Use the deepseek3.2-671b config to try it out (refer to the user guide for more information).
- Support has been added for Gemma 4 multi-modal models (26B MoE and 31B dense). These can be used with the gemma4-26b and gemma4-31b configs. See Run_Gemma4.md for further details.
- Support has been added for Gemma 4 inference using MaxText on vLLM plugin.
- Enhanced RL capabilities with support for the dataset and nvidia/OpenMathReasoning.MaxText.*
- Added more evaluation modes for RL like majority voting and pass@1 estimation.
- Sync weights to vllm prior to pre RL evaluation.
- More robust usage of math-verify in RL.
- MaxText's Supervised Fine-Tuning (SFT) now supports non-instruct models.
- Added support for tensor parallelism using the Fused MoE kernel for MaxText on vLLM inference.
- Added support for MaxText to vllm converters for Qwen3 and Gemma4 family of models.
- validate_converter.py now runs on multislice environment to test larger models with utilities to compare maxtext and vllm weights. shims have been removed. Please refer to src/MaxText/README.md for details on the new command locations and how to migrate.expert_shard_attention_option
- Sequence parallelism has been deprecated, please use context parallelism instead.
- The flag is deprecated, use custom_mesh_and_rule=ep-as-cp for the same functionality.maxtext[runner]v0.2.1
installation option to build Docker images without cloning the repository. This can be used for scheduling jobs through XPK. See the MaxText installation instructions for more info.tpu-post-train
- Config can now be inferred for most MaxText commands. If you choose not to provide a config, MaxText will now select an appropriate one.
- Configs in MaxText PyPI will now be picked up without storing them locally.
- New features from DeepSeek-AI are now supported: Conditional Memory via Scalable Lookup (Engram) and Manifold-Constrained Hyper-Connections (mHC). Try them out with our deepseek-custom starter config.
- MaxText now supports customizing your own mesh and logical rules. Two examples guiding how to use your own mesh and rules for sharding are provided in the custom_mesh_and_rule directory.v0.2.0
target in PyPI. Please also use this installation option for running vllm_decode. See the MaxText installation instructions for more info.num_vocab_tiling
- Qwen3-Next is now supported.
- New MaxText structure! MaxText has been restructured according to RESTRUCTURE.md. Please feel free to share your thoughts and feedback.
- Muon optimizer is now supported.
- DeepSeek V3.1 is now supported. Use existing configs for DeepSeek V3 671B and load in V3.1 checkpoint to use model.
- New RL and SFT Notebook tutorials are available.
- The ReadTheDocs documentation site has been reorganized.
- Multi-host support for GSPO and GRPO is now available via new RL tutorials.
- A new guide, What is Post Training in MaxText?, is now available.
- Ironwood TPU co-designed AI stack announced. Read the blog post on its co-design with MaxText.
- Optimized models tiering documentation has been refreshed.
- Added Versioning. Check out our first set of release notes!
- Post-Training (SFT, RL) via Tunix is now available.
- Vocabulary tiling (PR) is now supported in MaxText! Adjust config to unlock more efficient memory usage.tools/setup/setup_post_training_requirements.sh
- The GPT-OSS family of models (20B, 120B) is now supported.
- install_maxtext_github_deps installation script replaced with install_maxtext_tpu_github_deps
- for post training dependency installation is deprecated in favor of pip installationgclusterv0.1.0
Run Maxtext
Run MaxText
:gutter: 2
:link: run_maxtext/run_maxtext_localhost
:link-type: doc
:::
:link: run_maxtext/run_maxtext_single_host_gpu
:link-type: doc
:::
:link: run_maxtext/run_maxtext_via_cluster_toolkit
:link-type: doc CLI. Package and run multi-host JAX workloads with on-the-fly container builds.gcloud
:::
:link: run_maxtext/run_maxtext_via_xpk
:link-type: doc
:::
:link: run_maxtext/run_maxtext_via_pathways
:link-type: doc
:::
:link: run_maxtext/decoupled_mode
:link-type: doc, GCS, or Vertex AI required).
:::
:link: run_maxtext/run_maxtext_elastic_training
:link-type: doc
:::
::::
---
hidden:
maxdepth: 1
---
run_maxtext/run_maxtext_localhost.md
run_maxtext/run_maxtext_single_host_gpu.md
run_maxtext/run_maxtext_via_cluster_toolkit.md
run_maxtext/run_maxtext_via_xpk.md
run_maxtext/run_maxtext_via_pathways.md
run_maxtext/decoupled_mode.md
run_maxtext/run_maxtext_elastic_training.md
---