mirror of
https://github.com/kvcache-ai/sglang.git
synced 2026-11-05 01:07:39 +00:00
[PR #99] [MERGED] Support April V4 LoRA on original FP8/MXFP4 weights #99
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/sglang#99
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/sglang/pull/99
Author: @yyj6666667
Created: 9/28/2026
Status: ✅ Merged
Merged: 9/30/2026
Merged by: @yyj6666667
Base:
main← Head:yyj/dsv4-flash-delivery📝 Commits (10+)
e7ca3bffeat(kt): serve static DeepSeek V4 MXFP4 LoRA adapters948776cfix(kt): retain CPU expert outputs on the CUDA consumer streamf2ee355test(attention): cover nonfinite invalid V4 compressed KV slots7c01294build: pin private V4 delivery candidate dependenciesfe968dbfix: avoid unused TileLang dependency in V4 Triton RoPE1d746a0fix(packaging): declare the V4 compressed indexer TileLang dependency70a62d7fix(packaging): pin the compatible TileLang TVM FFI pair228cc9dFormat the new static adapter validation and compressed KV testad9a88bLoad April V4 training adapters on the original quantized basef675949Align native adapter tests with lint conventions📊 Changes
11 files changed (+688 additions, -30 deletions)
View changed files
📝
python/pyproject.toml(+5 -4)📝
python/sglang/srt/configs/deepseek_v4.py(+2 -1)📝
python/sglang/srt/layers/deepseek_v4_rope.py(+0 -8)📝
python/sglang/srt/layers/moe/kt_ep_wrapper.py(+52 -4)➕
python/sglang/srt/lora/kt_dsv4.py(+218 -0)📝
python/sglang/srt/lora/lora_manager.py(+13 -0)📝
python/sglang/srt/models/deepseek_v4.py(+38 -0)📝
python/sglang/srt/server_args.py(+62 -12)📝
test/registered/attention/test_dsv4_flash_mla_sm120.py(+31 -1)➕
test/unit/test_dsv4_kt_static_lora.py(+78 -0)➕
test/unit/test_kt_dsv4_checkpoint.py(+189 -0)📄 Description
Serve April DeepSeek-V4-Flash training checkpoints on the original FP8 / MXFP4 base with
--lora-paths trained=<checkpoint>. Users no longer need a BF16 export or the training cache for this path. The loader verifies checkpoint hashes, base identity and tensor shapes, maps seven ordinary LoRA targets and reads fused CPU expert LoRA directly. The existing BF16 export path remains available.The direct path supports one static r8 / alpha16 / dropout0 adapter. It omits only
self_attn.compressor.kv_projandgate_projLoRA, without skip logs or checkpoint changes; other unsupported tensors fail validation. Requests must select the paired adapter. Base identity currently requires the original training model files. Normal serving without an adapter retains its existing weight-loading and forward paths.Earlier changes in this PR provide BF16 non-expert loading, clamp-aware MXFP4 SFT dispatch, CPU-output CUDA stream lifetime handling, and the V4 indexer dependencies (
tilelang==0.1.10,apache-tvm-ffi==0.1.11). The direct-checkpoint addition changes five runtime files and adds one unit-test file; it requires no native-kernel, KT, Transformers or LF changes.Validation:
pip check. Both full training locks also resolve in dry runs. Only the SGLang Python carrier changes; its native CUDA partition and the other 258 wheels are byte-identical to the previous candidate.The previous candidate passed ten training/resume/BF16-serving configurations and Kimi RAWINT4 serving. This update repeats the direct-loading inference matrix, not all training regressions. Forced AVX2 uses an AVX512-capable host; this is not AVX2-only hardware certification. Short training and small probes are functional checks, not general answer-quality acceptance.
Draft; do not merge or publish. Draft GPU CI and existing all-files lint limitations remain. Tested wheel source:
ad9a88bc7; the subsequent formatting commits through1d6f5c6eepreserve the runtime AST. The latest change fixes only PR-added wrapping/import grouping reported by CI; it does not reformat unrelated baseline files.Related: kvcache-ai/ktransformers#2216 (follow-up to #2185), kvcache-ai/transformers#8. This remains the only SGLang PR for the delivery; no LF PR is requested.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.