Databricks cuts Qwen 27B fine-tuning time 6x on AI Runtime
A Databricks blog details systematic performance work that cut supervised fine-tuning of Qwen 3.8 27B on AI Runtime from 7 hours 44 minutes to 1 hour 17 minutes on a fixed dataset, roughly a 6x speedup. The authors note that 98% GPU utilization only shows the GPU was busy, not how efficiently it was used, so they used torch traces to find where time was actually spent. Optimizations included enabling the flash-linear-attention and causal-conv1d fused kernels and reworking batch packing, which alone gave a 1.6x improvement from 2 hours 5 minutes to 1 hour 17 minutes. Example code is published in the AI Runtime cookbook.
The write-up argues that high GPU utilization can hide real training bottlenecks, and that kernel fusion and data packing can still deliver large throughput gains when utilization already looks saturated.
Training or finetuning a multi-billion parameter foundation model requires significant compute, often spanning hundreds to thousands of hours of GPU training. But tuning training performance for an LLM is challenging, and high level metrics, such as GPU utilization may not be showing your actual utilization. In this blog post, we show how to cut through the layers of abstraction, and speed up fine-tuning of the latest Qwen 3.8 27B model on AI Runtime by 6x. Through systematic performance optimization, even with GPU utilization already at 98%, we go from 7 hours 44 minutes to 1 hour 17 minutes fine tuning a fixed dataset.
We will provide a deep dive into the techniques behind these improvements, from how to measure what matters, implementation details, and design trade-offs involved in each optimization.
If you want to get started right away, jump directly to the example code on AI Runtime and give it a try!
Model setup
We start with a standard training loop for Qwen 3.8 27B using the transformers library and the SFT training dataset HuggingFaceH4/ultrachat_200k.
- We apply FSDP2, the latest model sharding technique from torch. This is required to fit the model weights and optimizer state onto the GPUs. A pure distributed data parallel approach would fail to fit the model weights, at this size, on a single GPU.
- We also enable activation checkpointing, a technique which trades memory space for compute in the backwards pass to allow for a larger batch size per GPU.
- The dataloader is packing 2D batches with a maximum tokens per batch of 8192, padding to the maximum size of the batches example.
#Databricks#AI Runtime#Qwen 3.8 27B#transformers#Flash Linear Attention#causal-conv1d#PyTorch FSDP2#HuggingFaceH4/ultrachat_200k