Repository navigation
Serve LoRA on all Qwen3.5 linear-attention projections - #99
Merged
micahtyong merged 4 commits intoNov 17, 2026
Merged
Conversation
Signed-off-by: Yusheng Su <[email protected]> (cherry picked from commit 2fdb655)
…gl-project#37466) (cherry picked from commit 98bb145)
Adapters exported from Megatron-Bridge list in_proj_qkv, in_proj_z, in_proj_b and in_proj_a in target_modules, and canonical adapters list in_proj_q, in_proj_k, in_proj_v and in_proj_z. Map these names to the fused runtime modules so the adapter passes the --lora-target-modules subset check. Shard in_proj_ba on the attention TP group like in_proj_qkvz, since both are built on that group. Accept out_proj as a --lora-target-modules choice too. Ported from sgl-project#48158; the sglang-miles branch has the same mapping. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Spindle trains LoRA on the Qwen3.5 linear-attention (GatedDeltaNet) layers. Its trainer uses one fused
in_projadapter over q, k, v, z, b and a, and exports a standard PEFT adapter with four modules:in_proj_qkv,in_proj_z,in_proj_bandin_proj_a, each with the samelora_A. This branch could serve only q, k, v and z, throughin_proj_qkvz. A sampler started within_proj_borin_proj_ain--lora-target-modulesfailed at startup withget_hidden_dim not implemented for in_proj_b.This PR brings over the GDN LoRA support from upstream:
in_proj_bais a LoRA target for Qwen3.5. It has a hidden size, a stacked count of 2, and shards on the attention TP group likein_proj_qkvz._normalize_in_proj_bastacks splitin_proj_bandin_proj_aweights into it._normalize_in_proj_qkvzalso reads the two-wayin_proj_qkv+in_proj_zsplit that Megatron-Bridge exports.target_modulesnamedin_proj_q,in_proj_k,in_proj_v,in_proj_qkvorin_proj_zmap toin_proj_qkvz, andin_proj_borin_proj_amap toin_proj_ba. Without this, an adapter that lists the split names fails the check against--lora-target-modules.in_proj_qkvz,in_proj_baandout_projare accepted--lora-target-moduleschoices.The first two commits are cherry-picks of the sglang-miles commits from sgl-project#30499 and sgl-project#37466. The third ports the target-name mapping, the attention-TP entry and a CPU unit test from sgl-project#48158. Models without GDN layers are unchanged. The fused in_proj GEMM is already off when LoRA is enabled, so LoRA runs through the separate
in_proj_qkvzandin_proj_balayers.Testing
On
803bccb:test/registered/unit/lorain thelmsysorg/sglang:v0.5.23image with this branch'spython/copied in, on CPU: 186 passed, 16 skipped. The newtest_qwen3_5_gdn_lora.pypasses. Three tests intest_lora_spec_verify_batch_info.pyfail on CPU, and they fail the same way on the base commitc4182b2.sglang serveargument parsing accepts--lora-target-modules in_proj_qkvz,in_proj_baandout_proj. Onc4182b2it rejectsout_proj.803bccb: Qwen3.5-4B LoRA, rank 32, 1 H100 trainer and 1 H100 sampler, stock Tinker SDK. On both Spindle trainer images, the sampler loggedloaded weights for target modules [..., 'in_proj_ba', 'in_proj_qkvz', ..., 'out_proj', ...]for each published adapter and never restarted. After 10 training steps, trainer and sampler logprobs differed by 0.017 on average on held-out data, the same as before the gates were trained. The exportedin_proj_bandin_proj_aadapters had non-zerolora_Bin all 24 linear-attention layers.a344370after803bccbonly tightens the new unit test.Not covered here:
--lora-backend triton_v2, which keeps a per-stream workspace.in_proj_banow has an adapter and runs on the alternate stream during CUDA graph capture, so check that backend before relying on it. Spindle usescsgmv.