Skip to content
View AkiYangDev's full-sized avatar

Block or report AkiYangDev

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Content in all repositories owned by your account will be closed.
Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
AkiYangDev/README.md

Hi, I'm Aki! LLM inference systems, Ascend operators and measured performance.

English · 简体中文

EPLB   ·   DeepSeek-V4.1   ·   🐋 mini-DeepInfer   ·   📚 Engineering notes

👋 I'm Aki

Community fan art of DeepSeek's whale girl

DeepSeek inference & Ascend NPU engineering

SGLang DeepSeek Ascend 910C Ascend 950

I work on DeepSeek inference on Ascend 910C and Ascend 950, with contributions to SGLang and sgl-kernel-npu. My work follows the serving path from MoE routing and expert placement through weight migration, graph replay, and performance measurement.


Expert parallel load balancing on Ascend

In an expert-parallel MoE, one overloaded rank can hold up the rest. Dynamic EPLB uses recent routing counts to decide where expert replicas should live. The change only pays off if it reduces the work on slow ranks enough to cover the cost of planning, moving weights, and switching the routing table.

EPLB study guide · GPU and NPU implementations · How the storage PR evolved

Merged in SGLang

  • Bring dynamic EPLB to Ascend. Added the initial NPU support in #47574.
  • Keep draft forwards out of target statistics. I reported the rolling-window issue in #48603 and supplied the original fix in #47922. Ch-wan’s merged #48751 incorporates the core fix.
  • Move expert storage in place. #49701 uses writable byte views to move complete physical blocks, preserving NZ padding and the allocations used by captured graphs. It reuses the TP/HCCL group where compatible, isolates draft warmup and capture from target statistics, and covers FP4 NZ format 50 on Ascend 950PR.

Async migration, update cadence, and replica selection

  • Async HCCL migration · Open. #50784 stages one layer at a time over a dedicated HCCL P2P group while inference continues using the current layout. Once every rank is ready, the forward stream writes the staged weights and routing rows in place. The PR includes Ascend 910C migration and correctness checks. In an EP16 fixed-layout test, the worst forward step fell from 11.48 to 3.79 ms while step P95 rose from 0.61 to 2.71 ms.
  • Dynamic rebalance interval · Open. #53290 uses a rolling window of routing counts to recommend how many target forwards should elapse between rebalance checks. recommend reports a candidate. auto tries it on comparable batches and accounts for check and migration costs. On colocated workers, a P95 regression in prefill, decode, or mixed batches can veto the trial. PD endpoints tune independently. Supported DeepSeek-V4-Flash PD configurations on Ascend 910C get role-specific window defaults. The window capacity stays fixed while serving. CPU and Gloo checks are complete, with end-to-end Ascend performance still unmeasured for the change.
  • Per-batch replica selection with LPLB · Draft. #50517 uses the current batch’s demand to route tokens across existing expert replicas while preserving logical top-k choices. Preallocated solver buffers are refreshed in place after an EPLB update so captured graphs can keep using them. In the earlier matched long-decode P/D test, throughput fell 6.33% and mean TPOT rose from 19.07 to 20.87 ms.

Choosing prefill and decode sampling windows and update intervals

Dynamic EPLB serving benchmark

NZ and packed storage becomes writable expert-byte rows for the migration updater, retaining padding and the original model allocation.

Measured EPLB OFF → ON: output throughput 2,648.89 → 3,627.05 token/s (+36.93%) and mean E2E 50.49 → 36.39 s in the documented DeepSeek-V4-Flash W8A8 PD copying workload. Mean TPOT increased from 8.85 to 10.52 ms/token.

🔬 Experiment setup, acceptance counters & latency

The paired run at 08865d168 used Ascend 910C: 16 physical cards / 32 chips across P+D, TP16/EP16/attention-DP16 per endpoint, DSpark gamma 5 / verify 6, 16,384 input and 1,024 output tokens, concurrency 128, prefix/index caches disabled, and matched actual KV limits.

Throughput counts received generated tokens in the common [60, 360) s window. Latencies use successful requests started inside that window.

Metric EPLB OFF EPLB ON
Output throughput, token/s 2,648.89 3,627.05
Mean TTFT, s 41.43 25.63
Mean TPOT, ms/token 8.85 10.52
Mean E2E, s 50.49 36.39
Acceptance length, tokens/verify 5.988304 5.988304
Measured strict draft acceptance 100% 100%
Correct / proposed draft tokens, latency cohort 658,350 / 658,350 908,010 / 908,010
Full-run successful / failed requests 3,072 / 0 3,072 / 0

All 3,072 paired generated texts match. EPLB ON feeds a larger observed decode batch, alongside the higher per-request TPOT. For the separate comparison of old ND and physical-byte migration costs, see the storage migration write-up.

DeepSeek-V4.1 on Ascend 950

  • Merged SGLang backend. #47660 adds low-ratio KV compression, two-level indexing, mixed-quantization sparse attention, graph replay, and DSpark. I contributed the migrated operator API integration and metadata validation. Related upstream alignment is tracked in draft #49005.
  • Merged NPU operators. I worked with ClownBin on seven CANNBot-DSL compute and metadata APIs in sgl-kernel-npu #964, covering dispatch contracts, PyTorch references and tests, and a K-tail storage fix. #1012 aligned the wrappers, registry, tests, and docs on explicit _dsl names.

128K hot-cache serving on eight Ascend A5 devices

Two follow-up runs of DeepSeek-V4.1-Flash reached 29,553.51 output tok/s across the full runs on November 28, up 3.70% from the earlier 28,500.16 tok/s on the same workload. Each run used 6,144 requests at concurrency 768, with 131,072 input tokens, 1,024 output tokens, and 99.90% on-device prefix hits. All 12,288 requests succeeded. Mean TTFT was 3.42 s, TPOT 21.50 ms/token, and E2E latency 25.42 s.

The earlier write-up covers prefill admission, MegaMoE, expert placement, device-side sequence lengths, and expert work reuse on the uncached tail page. 128K decode tuning report up to 28,500.16 tok/s

Per-run throughput and DSpark counters
  • Full-run throughput: 29,033.89 and 30,092.06 tok/s. The combined value uses total generated tokens divided by the two runs’ total elapsed time.
  • Combined steady-state throughput: 30,398.04 tok/s. Mean acceptance length in the two formal runs was 4.0373 tokens per verification. The colocated runs used DSpark with gamma 4 and verification width 5.
  • Measured strict draft acceptance: 76.26% (593,055 accepted / 777,688 proposed, 194,422 verifies) in a separate 768-request diagnostic. Strict acceptance counters were unavailable for the formal throughput runs.

Other upstream contributions

  • Merged · A3 prefill/decode handoff. SGLang #47934 fixes C4 state transfer between different prefill and decode ring sizes using row-sized registration and peer-local addressing.
  • Open · Allocator compilation. sgl-kernel-npu #1077 keys the Ascend Triton allocator by the number of loop blocks, allowing inputs with the same kernel geometry to share a compiled kernel.
Selected open patches · state transfer, memory, precision & timing (9 PRs)
Area Engineering change PR
PD state Preserve empty components across PP stages; use request-local C4 rows on AMD #47937 / #47938
Gateway lifecycle Cancel pending prefill on early decode failure #49792
Decode memory Bound DeepSeek-V4 SWA storage by request slots #47740
Numerical precision Preserve Softplus accuracy in GDN gating and decode kernel #933
Sparse attention Exclude padded lanes from non-power-of-two TopK reduction kernel #935
Quantization Preserve AWQ fallback dtype; correct GPTQ zero-point offsets #47639 / #47637
Benchmark timing Record non-streaming PD decode handoff time #47772
📦 More open SGLang patches (12 PRs)
📦 More open NPU operator patches (8 PRs)

Projects & engineering notes

  • mini-DeepInfer is a runnable teaching inference engine covering scheduling, batching, KV-slot reclamation, and speculative decoding, with CPU examples and Qwen3.5 generation on Ascend 910C. Repository
  • LLM Inference Notes is my Chinese-language technical blog. It follows the code from routing and tensor storage to whole-service measurements, with source references and worked examples. Blog

A cheerful chibi DeepSeek whale girl
Inference, kernels, and a well-reproduced bug. Let's talk 🐋
DeepSeek whale girl · Community fan art

Popular repositories Loading

  1. mini-deepinfer mini-deepinfer Public

    Learn DeepInfer through a small, runnable inference engine. Follow the code on CPU, then run real Qwen3.5 models on Ascend 910C.

    Python 30 1

  2. llm-inference-notes llm-inference-notes Public

    LLM inference engineering: SGLang internals, Ascend deployment, distributed inference, and performance analysis.

    Python 3

  3. AkiYangDev AkiYangDev Public

    Aki Yang | Backend engineering, SGLang, Ascend NPU, and LLM inference.

  4. sglang sglang Public

    Forked from sgl-project/sglang

    SGLang is a high-performance serving framework for large language models and multimodal models.

    Python

  5. sgl-kernel-npu sgl-kernel-npu Public

    Forked from sgl-project/sgl-kernel-npu

    SGLang kernel library for NPU

    C++

  6. ops-transformer ops-transformer Public

    CANN ops-transformer source mirror pinned for CANN 9.2.0 / DSv4.1 kernel builds. Upstream: gitcode.com/cann/ops-transformer

    C++