arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.25645cs.DCcs.AI
收藏

在Google Cloud TPU上微调和服务Gemma 4 31B:与GPU基线的技术比较

Fine-Tuning and Serving Gemma 4 31B on Google Cloud TPU: A Technical Comparison with GPU Baselines

Google Cloud(谷歌云)

Jatin Kishnani, Mayank Goel, Amit Singh, Pulkit Agrawal, Sairanjan Mishra

AI总结:

本文首次端到端展示了在TPU硬件上微调和服务Google Gemma 4 31B模型,通过与GPU平台的实证比较,提供了代码级适配方案,并证明TPU在训练速度和成本上具有优势。

摘要:

我们首次端到端展示了在TPU硬件上微调和服务Google的Gemma 4 31B模型,提供了TPU与GPU平台在大语言模型适配上的实证比较。使用LoRA在Google TPU v5p-8上进行训练,在TPU v6e-8(Trillium)上进行推理,我们记录了将基于PyTorch、HuggingFace TRL和FSDP的GPU原生训练配方移植到JAX + Tunix/Qwix栈所需的全部代码级适配。这些适配涵盖网格配置、LoRA模块命名约定、分片注释修正、梯度检查点、数据管道重构以及自定义的Orbax到safetensors检查点合并过程。对于推理,我们详细描述了在v6e-8上服务Gemma 4所需的vLLM-TPU Docker设置,并刻画了由此产生的延迟和吞吐量特征。与相同超参数下的2xH100 GPU基线相比,TPU训练完成速度快1.61倍,成本低2.12倍。推理吞吐量在平台间差异在3%以内,而TPU的首令牌延迟低2倍(235 ms vs. 475 ms)。总体而言,对于代表性的训练加服务工作负载,TPU配置便宜1.82倍。我们的工作填补了开放工具生态系统中的关键空白,为从业者提供了可复现、生产就绪的Gemma 4在TPU基础设施上部署的配方。

英文摘要:

We present the first end-to-end demonstration of fine-tuning and serving Google's Gemma 4 31B model on TPU hardware, providing an empirical comparison of TPU and GPU platforms for large language model adaptation. Using LoRA on a Google TPU v5p-8 for training and TPU v6e-8 (Trillium) for inference, we document the full set of code-level adaptations required to port a GPU-native training recipe - built on PyTorch, HuggingFace TRL, and FSDP - to the JAX + Tunix/Qwix stack. These adaptations span mesh configuration, LoRA module naming conventions, sharding annotation corrections, gradient checkpoint, data pipeline restructuring, and a custom Orbax-to-safetensor checkpoint merging procedure. For inference, we detail the vLLM-TPU Docker setup necessary to serve Gemma 4 on v6e-8 and characterize the resulting latency and throughput profile. Compared with a similar-costing 2xH100 GPU baseline under identical hyperparameters, TPU training completes 1.61x faster at 2.12x lower cost. For inference, we cover the vLLM-TPU Docker setup required to serve Gemma 4 on v6e-8 and explain the observed latency and throughput characteristics across a QPS sweep spanning 512 to 16k input tokens. Across both workloads we compare performance and cost against a 2xH100 GPU baseline running identical hyperparameters. The TPU completes training 1.61x faster at 2.12x lower cost. For inference, TPU v6e-8 matches GPU at short context (<=2048 tokens) and decisively outperforms at long context: 66% higher throughput and 23.6x faster TTFT at 4096-token inputs (61 ms vs 1,443 ms at QPS=4). Our work removes a critical gap in the open tooling ecosystem and provides practitioners with a recipe for Gemma 4 Dense 31B deployment on the TPU infrastructure.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑