Nsa trtllm mla sparse fp8 support with Deepseek v3.2 NVFP4#18389
Nsa trtllm mla sparse fp8 support with Deepseek v3.2 NVFP4#18389Fridge003 merged 26 commits intosgl-project:mainfrom
Conversation
Summary of ChangesHello @rainj-me, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the model serving capabilities by integrating the Deepseek v3.2 NVFP4 model with a TensorRT-LLM sparse FP8 attention backend. The changes streamline the attention mechanism's performance and memory efficiency by introducing dedicated FP8 quantization and RoPE application logic, and by optimizing KV cache storage for this specific configuration. This allows for more efficient inference with Deepseek v3.2 NVFP4 models. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for Deepseek v3.2 NVFP4 with the trtllm mla sparse fp8 attention backend. The changes involve updating the NSA backend to support this new configuration and ensuring cos_sin_cache is correctly passed to the trtllm kernels. The refactoring in nsa_backend.py to handle the trtllm backend at the beginning of forward_extend and forward_decode is a good improvement. I have a few suggestions to improve code clarity and fix a potential bug in deepseek_v2.py.
Let's bake it a little bit and do it in different PR. |
|
/tag-run-ci-label |
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
|
/rerun-failed-ci |
1 similar comment
|
/rerun-failed-ci |
Motivation
#17655
Modifications
Accuracy Tests
GSM8K
GPQA
python3 -m sglang.test.run_eval --port 30000 --eval-name gpqa --num-examples 198 --max-tokens 128000 --repeat 8 --top-p 0.95 --temperature 1.0 --thinking-mode deepseek-v3 ChatCompletionSampler initialized with self.system_message=None self.temperature=1.0 self.max_tokens=128000 self.reasoning_effort=None self.extra_body={'chat_template_kwargs': {'thinking': True}} ChatCompletionSampler initialized with self.system_message=None self.temperature=1.0 self.max_tokens=128000 self.reasoning_effort=None self.extra_body={'chat_template_kwargs': {'thinking': True}} ChatCompletionSampler initialized with self.system_message=None self.temperature=1.0 self.max_tokens=128000 self.reasoning_effort=None self.extra_body={'chat_template_kwargs': {'thinking': True}} ChatCompletionSampler initialized with self.system_message=None self.temperature=1.0 self.max_tokens=128000 self.reasoning_effort=None self.extra_body={'chat_template_kwargs': {'thinking': True}} ChatCompletionSampler initialized with self.system_message=None self.temperature=1.0 self.max_tokens=128000 self.reasoning_effort=None self.extra_body={'chat_template_kwargs': {'thinking': True}} ChatCompletionSampler initialized with self.system_message=None self.temperature=1.0 self.max_tokens=128000 self.reasoning_effort=None self.extra_body={'chat_template_kwargs': {'thinking': True}} ChatCompletionSampler initialized with self.system_message=None self.temperature=1.0 self.max_tokens=128000 self.reasoning_effort=None self.extra_body={'chat_template_kwargs': {'thinking': True}} ChatCompletionSampler initialized with self.system_message=None self.temperature=1.0 self.max_tokens=128000 self.reasoning_effort=None self.extra_body={'chat_template_kwargs': {'thinking': True}} 100%|███████████████████████████████████████████| 198/198 [07:11<00:00, 2.18s/it] 100%|███████████████████████████████████████████| 198/198 [07:43<00:00, 2.34s/it] 100%|███████████████████████████████████████████| 198/198 [07:53<00:00, 2.39s/it] 100%|███████████████████████████████████████████| 198/198 [08:25<00:00, 2.55s/it] 100%|███████████████████████████████████████████| 198/198 [08:46<00:00, 2.66s/it] 100%|███████████████████████████████████████████| 198/198 [08:47<00:00, 2.66s/it] 100%|███████████████████████████████████████████| 198/198 [08:52<00:00, 2.69s/it] 100%|███████████████████████████████████████████| 198/198 [15:52<00:00, 4.81s/it] ==================== Repeat: 8, mean: 0.818 | 40/198 [15:52<1:10:59, 26.96s/it] Scores: ['0.798', '0.823', '0.803', '0.818', '0.823', '0.813', '0.838', '0.828'] ==================== [METRIC] gpqa_mean_score=0.8181818181818181 labels={"model": "/data02/models/DeepSeek-V3.2-NVFP4", "eval": "gpqa", "repeat": 8} Writing report to /tmp/gpqa__data02_models_DeepSeek-V3.2-NVFP4.html {'chars': np.float64(20040.570707070707), 'chars:std': np.float64(19597.30393311847), 'score:std': np.float64(0.37713443843625194), 'scores': ['0.798', '0.823', '0.803', '0.818', '0.823', '0.813', '0.838', '0.828'], 'mean_score': np.float64(0.8181818181818181)} Writing results to /tmp/gpqa__data02_models_DeepSeek-V3.2-NVFP4.json cat /tmp/gpqa__data02_models_DeepSeek-V3.2-NVFP4.json { "chars": 20040.570707070707, "chars:std": 19597.30393311847, "score:std": 0.37713443843625194, "scores": [ "0.798", "0.823", "0.803", "0.818", "0.823", "0.813", "0.838", "0.828" ], "mean_score": 0.8181818181818181AIME25
nsa trtllm sparse attn backend, fp8 kv cache and MTP
nsa flashmla_auto/flashmla_kv attn backend, fp8 kv cache and MTP
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci