[LoRA] Preserve DeepSeek-V4 grouped wo_a semantics - #36579
Open
zhoutong-hai wants to merge 7 commits into
Open
Conversation
zhoutong-hai
requested review from
Fridge003,
Ying1123,
jybsuper,
lifuhuang and
yushengsu-thu
as code owners
August 26, 2026 23:37
This was referenced Aug 26, 2026
zhoutong-hai
force-pushed
the
codex/deepseek-v4-grouped-wo-a
branch
from
August 27, 2026 00:09
85a287a to
f5a9770
Compare
zhoutong-hai
requested review from
BBuf,
Edwardf0t1,
HaiShaw,
ch-wan,
ispobock and
merrymercy
as code owners
August 27, 2026 00:09
zhoutong-hai
marked this pull request as draft
August 27, 2026 00:11
zhoutong-hai
marked this pull request as ready for review
August 28, 2026 00:56
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.
Problem
DeepSeek-V4
wo_ais a grouped projection:Gindependent[R, D]matrices are stored in one flattened column-parallel weight. Each input group
must receive only the LoRA delta from its matching output group.
The generic column-parallel LoRA path instead treats the flattened weight as
one dense projection. That introduces cross-group terms and changes the model
operator. It also hides the base-layer attributes used by the native V4
forward.
CP decode attention TP introduces another layout transition: it slices the
replicated base weights for decode while loaded LoRA buffers remain in the
prefill layout. Silently unwrapping an active adapter there would be incorrect.
Fix
wo_alayer for the native BF16, FP8, and GGUF projection.for one LoRA A and one LoRA B dispatch.
a composite adapter/group index, so only the matching group diagonal is
materialized.
max_len; group count must notchange kernel tuning or chunk size.
eager-to-CUDA-graph capture transition so all metadata transforms are
captured safely.
closed if capture begins before initialization.
metadata for A and B.
under CP decode attention TP. Inactive wrappers are safely unwrapped and use
the existing base-weight slice/restore path.
This computes the required diagonal directly. It does not allocate a
G x Gintermediate and does not issue a separate A/B kernel pair per group.
The target registration and V4 dimensions are in #36578, which should merge
after this execution support. The matching trainer implementation is
radixark/miles#2771.
Validation
routing/permutation metadata, incompatible layouts, and the CP contract.
routing.
bit-for-bit on both ranks and both backends.
0.03125 for prefill and 0.015625 for decode.
tokens (64 MiB instead of 256 MiB).
iterations, were:
GPU qualification also caught two problems in the earlier prototype: repeated
metadata inflated csgmv's
max_lenfrom 128 to 512 and exceeded H200 sharedmemory, while a later implementation allocated grouped offsets during CUDA
capture. The submitted path preserves
max_lenand initializes the offsets ineager warmup.
CI States
Latest PR Test (Base): ❌ Run #33131282727
Latest PR Test (Extra): ❌ Run #33131282590
Latest PR Test (AMD ROCm 7.2): ❌ Run #33131282712