# Integrating TorchTPU into TorchTitan and Optimizing Models for TPU

DevFeed: [Integrating TorchTPU into TorchTitan and Optimizing Models for TPU](<https://devfeed.tech/articles/integrating-torchtpu-into-torchtitan-and-optimizing-models-for-tpu-91265.md>)

Original publisher: [Read original article](<https://developers.googleblog.com/integrating-torchtpu-into-torchtitan-and-optimizing-models-for-tpu/>)

Author: Aleksey Vlasenko; Rob Torres; Will Constable

Published: 2026-10-21T02:36:15.506968Z

Content type: article

Language: en

Sources: [Google Developers Blog](<https://devfeed.tech/sources/google-developers-blog.md>)

Topics: [LLM optimization](<https://devfeed.tech/topics/llm-optimization.md>), [LLM Techniques](<https://devfeed.tech/topics/llm-techniques.md>), [hugging face](<https://devfeed.tech/topics/hugging-face.md>), [grpo](<https://devfeed.tech/topics/grpo.md>), [vllm](<https://devfeed.tech/topics/vllm.md>)

Tags: [architectures](<https://devfeed.tech/tags/architectures.md>), [backend](<https://devfeed.tech/tags/backend.md>), [can](<https://devfeed.tech/tags/can.md>), [cloud](<https://devfeed.tech/tags/cloud.md>), [code](<https://devfeed.tech/tags/code.md>), [custom](<https://devfeed.tech/tags/custom.md>), [developers](<https://devfeed.tech/tags/developers.md>), [device](<https://devfeed.tech/tags/device.md>), [efficiently](<https://devfeed.tech/tags/efficiently.md>), [fork](<https://devfeed.tech/tags/fork.md>), [google](<https://devfeed.tech/tags/google.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [graph](<https://devfeed.tech/tags/graph.md>), [hugging-face](<https://devfeed.tech/tags/hugging-face.md>), [jax](<https://devfeed.tech/tags/jax.md>), [kernels](<https://devfeed.tech/tags/kernels.md>), [large](<https://devfeed.tech/tags/large.md>), [models](<https://devfeed.tech/tags/models.md>), [torchtpu](<https://devfeed.tech/tags/torchtpu.md>), [tpu](<https://devfeed.tech/tags/tpu.md>)

## AI overview

TorchTPU adds a native `torch.device("tpu")` backend to PyTorch, while TorchTitan TPU supplies distributed training recipes and compiler-aware optimizations. SimpleFSDP expresses sharding as graph operations that XLA can schedule and overlap; Graph Trainer captures full steps and offers layer scanning or graph splitting for large models. TPU-specific Pallas kernels target attention, loss and MoE computations. In the reported case studies, these methods brought FLUX.1 to about 99% of JAX MaxDiffusion throughput and Qwen3 235B to roughly 32% MFU on 256 chips. Qwen3's 8,192-chip result was a weak-scaling experiment with a fixed per-chip batch, not a recommended training configuration. The Transformers backend offers a less optimized first run for supported Hugging Face models, while model-specific recipes and profiling enable further tuning.

## Source excerpt

TorchTPU integrates a native torch.device("tpu") backend directly into PyTorch, allowing developers to train large-scale models on Google Cloud TPUs without rewriting code in JAX. The TorchTitan TPU fork enhances this with production-grade scaling primitives like SimpleFSDP, Graph Trainer, and custom Pallas kernels that achieve high Model Flops Utilization (MFU) across dense and MoE architectures. Developers can leverage these battle-tested optimization playbooks, recipes, and the Hugging Face modeling backend to efficiently scale their own workloads on TPU infrastructure.