[https://nvbugs/6240561][fix] Fix AutoDeploy DeepSeek-R1 accuracy drop - #14793
Conversation
e749a8c to
4cfca57
Compare
📝 WalkthroughWalkthroughThis PR updates MLA latent down-projections in DeepSeek to use ChangesDeepSeek MLA Simple-Shard and IR Support
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…tions (q_a/kv_a) via YAML hint Restores the DSR1 GSM8K accuracy that dropped around 92c5030 ("Switch ... to sharding-IR canonical models"): 90.0 -> 95.0 (>= legacy 94.92). - Before 92c5030: the legacy heuristic sharder simple-sharded MLA q_a/kv_a, so their misaligned per-rank FP8 scale hit the kernel BF16 dequant fallback -- the latent projections effectively ran in BF16. - After 92c5030 (sharding-IR): the canonical model hints q_a/kv_a tp_mode="none" (replicate), so they ran in true FP8. This side effect of the new sharding is the ~5-point regression. - Fix (no model edit): add a tp_mode="simple_shard" mode (colwise + all_gather) and a YAML-driven tp_mode_overrides (fnmatch weight-name -> tp_mode) to apply_sharding_hints. deepseek-r1.yaml maps q_a/kv_a to simple_shard; the model keeps tp_mode="none" so other models/linears are unaffected. Also adds per-row FP8 scale expansion (fixes kv_a N=576 -> 5-row scale < world_size IndexError) and backend-aware all_gather. - Gotcha: only manifests with deepgemm ON; forcing those linears to BF16 via the finegrained kernel gate needed deepgemm-off, which dropped the baseline and confounded the bisection. MLA latent down-projection (q_a_proj N=1536, kv_a_proj N=576), FP8 weights: tp_mode="none" (replicate): full weight on every rank --> 128-aligned --> true FP8 tp_mode="simple_shard": colwise split --> per-rank 192/72 rows (not 128-mult) --> BF16 fallback --> all_gather Signed-off-by: Taylor Yeonbok Lee <249374542+taylor-yb-lee@users.noreply.github.com>
galagam
left a comment
There was a problem hiding this comment.
LGTM, but I would rather @greg-kwasniewski1 also takes a look
4cfca57 to
7713e3b
Compare
7713e3b to
1a6260a
Compare
1a6260a to
f8651ed
Compare
…ment for non-128-multiple N - BF16-fallback dequant expanded block scales by ceil(N/scale_n); for N not a multiple of 128 (MLA kv_a N=576 -> 116) the 128-block scales land on the wrong rows -> ~40% weight error. - Use the canonical 128 when the scale grid is coarse (scale_n == ceil(N/128)); keep ceil only for per-row scales (scale_n == N) produced by TP sharding. - DSR1-0528 GSM8K 90.0 -> 95.489 with kv_a left replicated; no sharding, no model change, perf-neutral. - Reverts the prior simple_shard workaround (sharding_ir.py + deepseek-r1.yaml) now that the root kernel-dequant bug is fixed generally. Scale row -> weight row mapping (kv_a N=576, 5 scale rows): before block_n=ceil(576/5)=116: s0->[0:116] s1->[116:232] s2->[232:348] ... (mis-aligned) after block_n=128 : s0->[0:128] s1->[128:256] ... s4->[512:576] (correct) Signed-off-by: Taylor Yeonbok Lee <249374542+taylor-yb-lee@users.noreply.github.com>
f8651ed to
6b86e2d
Compare
|
/bot run --disable-fail-fast --extra-stage "DGX_B200-4_GPUs-AutoDeploy-1,DGX_H100-4_GPUs-AutoDeploy-1,DGX_B200-8_GPUs-AutoDeploy-Post-Merge-1" |
|
PR_Github #51265 [ run ] triggered by Bot. Commit: |
|
PR_Github #51265 [ run ] completed with state |
|
/bot run --disable-fail-fast --extra-stage "DGX_B200-4_GPUs-AutoDeploy-1,DGX_H100-4_GPUs-AutoDeploy-1,DGX_B200-8_GPUs-AutoDeploy-Post-Merge-1" |
|
PR_Github #51408 [ run ] triggered by Bot. Commit: |
|
PR_Github #51408 [ run ] completed with state
|
|
/bot run --disable-fail-fast --extra-stage "DGX_B200-4_GPUs-AutoDeploy-1,DGX_H100-4_GPUs-AutoDeploy-1,DGX_B200-8_GPUs-AutoDeploy-Post-Merge-1" |
|
PR_Github #51439 [ run ] triggered by Bot. Commit: |
|
PR_Github #51439 [ run ] completed with state |
Fixed accuracy drop in DeepSeek-R1-0528 AutoDeploy GSM8K 90.0 → 95.489 after PR #13478
kv_aleft replicated, multi_stream + deepgemm on).Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.