Repository navigation
[trainer throughput] Compile FLA linear-attention kernels once on Miles LoRA trainers - #373
Open
Micah Yong (micahtyong) wants to merge 1 commit into
Open
Micah Yong (micahtyong) wants to merge 1 commit into
Micah Yong (micahtyong) wants to merge 1 commit into
Conversation
Qwen3.5 and Qwen3.6 LoRA trainers on Miles run FLA's Triton short-conv and gated-norm kernels. These take an NB argument derived from the token count, which the kernels never read but Triton compiles and FLA autotunes on. Every new packed micro-batch length compiled and retuned them, at 2.7-6 s per kernel. Both Miles actors now pin NB to 1 once the model is built, with the helper the Megatron backend already uses (#333). The helper moves to spindle.backends.fla_kernels and also covers the gated-norm kernels. Models that don't load fla skip the pin and its import cost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Micah Yong (micahtyong)
requested a review
from Kailash Ranganathan (kailash109)
as a code owner
November 18, 2026 03:36
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the Miles LoRA trainers, FLA's Triton kernels for the short convolution, gated RMS norm and (on
miles-v0.1.x) l2norm take anNBargument derived from the token count. The kernels never read it, but Triton compiles and FLA autotunes per value, so a step with new packed lengths paused 2.6–10 s per kernel. This pinsNBto 1 on both Miles actors once the model is built, as #333 did for the Megatron backend. The helper moves tobackends/fla_kernels.pyso both backends share it, and now also covers the gated-norm kernels. Trainers that don't load FLA skip it. Losses are bit-identical.Testing
Fresh
qwen35-4b-lora-32ktrainer on 4×B200 with a cold Triton cache, stock Tinker SDK, 20 steps of 8 rows with lengths from 1K–30K tokens. Times are trainerforward_backwardper step, on main 730c853 plus this PR. The v0.1.1 columns run the same recipe onmiles-v0.1.1-52a7a99, the actorqwen36-35b-a3b-lora-32kuses.v0.2.0 before · after · v0.1.1 before · after
Every loss matched the unpatched run on all 40 steps on both images. With a warm kernel cache, main still had 7 steps over 5 s and this PR had none. First-step time ranges 46–196 s on both sides depending on compile caches. Not run:
qwen36-35b-a3bat its 8-GPU layout, multi-node, contexts above 32K.