Distributed LLM Systems
Scheduling, parallel execution, KV/state management and runtime correctness.
Feihong Guo · 郭飞鸿
I build and optimize inference systems, from distributed runtimes to GPU and NPU execution.
PROFILE
For ThermoPulse, I worked on Qwen3-8B medical adaptation through continued pretraining and supervised fine-tuning, alongside a GRPO reward-design study for structured reports. In inference engineering, I focus on runtime correctness and kernel performance, and use controlled experiments to measure their impact on the end-to-end service.
Scheduling, parallel execution, KV/state management and runtime correctness.
CUDA, Triton and TileLang; fusion, tiling and data movement.
NVIDIA GPUs, Ascend NPUs and Kunpeng CPUs.
Controlled benchmarks, profiling and SLO-qualified capacity.
BAIDU AI CLOUD · RUNTIME ENGINEERING
SGLang runtime work on B300 and GB300: tracing request routing, asynchronous execution and memory ownership, then carrying validated fixes upstream.
Kimi-K3 produced long token-0 runs when I deepened the asynchronous PP Decode queue. I traced the failure to receive buffers being reused before the forward stream read them. After fixing tensor lifetime, affected requests fell from 51/192 and 98/192 to 0/192 at depths 2 and 3. PR #47614 merged on 2 November 2026.
1. Turn an apparent speedup into a correctness test. Deeper asynchronous PP queues appeared faster, but many Kimi-K3 requests emitted long runs of token 0. On PP2 × TP4, depth 1 produced no affected requests in the tested run. Raising the depth to 2 or 3 made the fault reproducible. Synchronizing after each launch also suppressed it, which directed the investigation to queued work and tensor lifetime.
2. Measure where the data changed. On the downstream stage, I checked the same proxy tensors just after receive on the communication stream and just before use on the forward stream. Two depth-2 runs had 76/7,498 and 378/7,498 checksum mismatches. Keeping the previous tensor reference alive until the next receive had allocated its buffers gave 0/7,499 mismatches with a similar observed queue depth. Checksum and reference-lifetime controls
3. Extend storage lifetime at the shared launch boundary. CPU scheduling could drop the old reference while a forward-stream read was still queued. The next receive could reuse the same storage and overwrite that microbatch's activations. In _pp_launch_batch, I used record_stream(self.forward_stream) on each non-CPU proxy tensor before run_batch. This tells the allocator to retain storage until forward-stream use completes. Existing stream dependencies still determine execution order.
| Configuration | Async depth | Before | After |
|---|---|---|---|
| PP2 × TP4 | 2 | 51/192 | 0/192 |
| PP2 × TP4 | 3 | 98/192 | 0/192 |
| PP2 × TP4 + DCP4 | 2 | 59/192 | 0/192 |
| PP4 × TP2 | 3 | 6/192 | 0/192 |
| PP4 × TP2 | 4 | 19/192 | 0/192 |
The table reports single-node B300 correctness tests using fake transfer. The PR records the tested patch variants and separate communication-overlap follow-ups. The corrupted-output runs served as failure reproductions.
Repeated DeepSeek-V4-Pro Prefill runs on 8×B300 showed intermittent throughput drops. I traced the trigger to generation-health requests changing shared DPC user-routing state before scheduler admission. After isolating health dispatch, all four patched health-ON runs reached 94.56–94.70k input tok/s. PR #35721 shipped in v0.5.22.
1. Separate scheduling from GPU execution. Identical long-Prefill runs intermittently dropped throughput. I first tested DP Attention, chunk sizing and PrefillDelayer because LOW runs showed rank progress gaps and sustained mixed/delay activity. A Delayer admission-order backport still produced both GOOD and LOW, so I investigated whether a rank received less work or took longer to execute it. Backport counterexample
2. Check whether observation perturbs the run. A continuous alternating 4 OFF / 4 ON DeviceTimer test gave healthy-state means of 94,563 and 94,569 input tok/s. The sample was too small to settle LOW entry probability. Moving from 5 s to 250 ms metrics sampling separated observed chunk completions, and a benchmark start marker made the fast window cover the onset. DeviceTimer A/B
3. Trace the request across the control plane. Client POST, tokenizer, DataParallelController and scheduler admission traces exposed a hidden ordering: a generation-health request could advance shared user round-robin or touch load-budget state before a busy scheduler skipped it. The patch isolated health dispatch and preserved explicit-rank and P/D routing. The initial symptom report was filed on 18 August and the patch opened on 20 August. Health trigger evidence
4. Isolate the cause with a 2×2. On 26 August I held the image, workload, DP Attention, PrefillDelayer and external GET /health polling fixed. Each round started a fresh server and varied only the patch and generation-health request creation. Four-arm experiment
| Configuration | Result | Input tok/s |
|---|---|---|
| Original + generation health ON | 2/8 LOW | 68,403 / 82,883 LOW |
| Original + generation health OFF | 4/4 GOOD | 94,783–94,847 |
| Patched + generation health ON | 4/4 GOOD | 94,558–94,699 |
| Patched + generation health OFF | 4/4 GOOD | 94,850–94,934 |
What the follow-up revealed. In the severe LOW run, the active-window median of summed scheduler running requests was 48 vs 72–80 in the healthy controls. This is request inventory, measured separately from kernel batch dimensions. A milder LOW still had a median of 80. Rank dispatch traces and the four-arm result establish the causal link. Delayer timeouts persisted in healthy patched runs. Revised mechanism
Full public investigation · #35241During DSpark SPS/compact verification testing on B300/TP8, I reported timing-sensitive CUDA Graph failures and separated cross-rank planning, capture ordering and a GPU planner race. Ragged inputs exposed a general shared-memory correctness bug, not a speculative decoding algorithm error. My technical review of PR #32467 validated the final no-init variant: 13,111/30,000 out-of-bounds plans → 0/30,000.
1. Follow the failure across replay and startup. On 13 July I filed #31023 for a TP8 compact target-verify replay failure, then opened diagnostic #31455 to bisect synchronization and observe graph metadata. In August I filed #33356 for an independent startup-capture reproducer on v0.5.16. The surfacing rank, shape and kernel varied, so I traced the inputs to those kernels back to their producer.
2. Separate TP agreement, capture ordering and invalid plans. After #31195, all 120/120 TP8 trials agreed on verify budget, lengths and graph key. A separate four-arm startup experiment compared planner patch #32467 and capture-ordering patch #33795. Full capture succeeded in 0/7 without either, 1/6 with capture ordering alone, and 3/3 with the planner patch alone or both. Each successful planner-patch run captured all 35 shapes. Startup matrix
3. Observe the bad index at the producer and test the proposed fix. A single-GPU reproducer called the real GPU-input planner and checked max(valid ragged_id) < sum(extend_lens). Redundant initialization of shared warp scratch could overwrite another warp's reduction, misclassifying ragged input as uniform. One bad plan reached index 383 for only 360 valid rows. I tested DarkSharpness’s no-init suggestion in the same session, with isolated JIT caches and 30,000 calls per variant. Under the existing 32-warp launch, each warp writes its slot before the existing post-reduction barrier.
| Variant | Out-of-bounds plans |
|---|---|
| A · original initialization | 13,111 / 30,000 |
| B · initialization + added barrier | 0 / 30,000 |
| C · remove redundant initialization | 0 / 30,000 |
4. Check sustained replay and ragged coverage separately. The disclosed v0.5.16 backport stack completed 18,560/18,560 decode-only requests across C64–C1024 with Graph replay observed. Natural traffic in that sweep produced uniform verify lengths. A separate forced-budget probe observed 39/43 genuinely ragged scheduling blocks, with no GPU fault or budget violation in that window. The higher-concurrency follow-up up to C2560 measured admission pressure at a fixed MRR of 1024. Runtime and coverage details
I reported and reproduced the failures, contributed the controlled experiments and submitted the formal review. EanWang211123 authored the merged no-init fix in #32467. I tracked separate follow-ups for Breakable CUDA Graph ordering (#34286) and P/D draft-input handoff coverage (#34410).
Reported Issue #38645, localized the logical-to-physical KV index mismatch in DCP retraction backup/restore, and implemented and validated draft fix #38790. Unpatched DCP8 failed at its first retraction; my patched B300 run completed 2,048/2,048 requests with eight retractions. Maintainer kpham-sgl integrated the fix through a shared DCP layout helper, added compatibility and runtime checks, and merged #39487; I closed my superseded draft.
My implementation and six CPU tests covered rank ownership, local-row mapping, and restoration into newly allocated KV locations; four KDA/Mamba GPU regressions checked the separate recurrent-state path. The maintainer reused a shared layout helper, handled already-resolved physical indices and partial-page prefixes, and added B200 forced-retraction and logprob checks. My B300 evidence validates the documented local patch stack.
My validated draft · #38790 · Maintainer integration · merged #39487I reproduced degenerate Kimi-K3 outputs in graph-captured DCP a2a on two-node GB300. Disabling NCCL Graph Registration reduced degenerate outputs from 12/12 to 0/12 in the local probe. Upstream #43216, authored by zhihengy, introduced a broader default guard that covers this configuration.
Local diagnosis and alternatives. In the original TP8/DCP8 2×2 probe, only registration ON with temporary exchange buffers produced degenerate outputs. The startup guard in #45371 also completed 640/640 requests in a separate local C128 run. Persistent buffers (#45824) passed an early smoke test, but the no-guard configuration later produced 0/10 valid answers under load in a separate TP8/attention-DP2/DCP4 deployment. I withdrew the apparent speedups and closed that proposal unmerged.
Upstream resolution. #43216 was merged on 22 October 2026. When a deployment spans multiple TP, EP or DP ranks and any CUDA Graph phase is enabled, it defaults NCCL_GRAPH_REGISTER to 0, preserving explicit overrides. The original graph-enabled GB300 DCP a2a configuration meets those conditions, so I closed the narrower #45371 unmerged and marked Issue #45367 completed.
Closure is based on source-level coverage of the original configuration and the earlier local experiments. A matched GB300 end-to-end rerun on current main remains outstanding, and the precise NCCL replay-time mechanism remains unconfirmed.
#35721 DP health routing
#47614 PP stream lifetime
#43786 FP8 fusion
#48404 EPLB validation
#39487 DCP KV recovery
My diagnosis, draft fix, and validation; maintainer integration.
Selected upstream records · contribution and evidence index
The framework may change; the research method should not. I treat public issues, PRs, regressions, and RFCs as a reproducible evidence trail that distinguishes symptom, causal mechanism, repair, and validation.
PR states checked 8 November 2026. Full contribution index
BAIDU AI CLOUD · PERFORMANCE ENGINEERING
Workload-specific Prefill, Decode and end-to-end benchmarks. I connect parallelism, memory budgets and runtime traces to throughput and latency.
Benchmarked long-context Prefill and Decode on B300 and GB300, using throughput and latency to guide parallelism and deployment choices.
| Model | Benchmark focus |
|---|---|
| DeepSeek-V4-Pro | Prefill and Decode tuning, comparing batching, cache capacity, and speculative decoding. |
| DeepSeek-V4.1-Flash | Prefill and expert balancing under synthetic and real-token loads. RFC #44697 |
| Kimi K3 | Prefill: compared tensor/expert parallelism with pipeline parallelism. Decode: evaluated DCP and pipeline trade-offs in throughput, per-token latency, and runtime correctness. |
Related K3 runtime investigations · PR #47614 · Issue #45367
Extended an InferFlux-based capacity model for long-context inference and used workload, compute/bandwidth limits, cache memory, parallel layout, and efficiency priors to narrow the test space. For Kimi K3, examined DCP and the capacity/rollback boundaries of KV and SSM state pools.
The output is a capacity estimate, not a guaranteed throughput number. Gaps between prediction and measurement help prioritize memory, communication, batching, or runtime investigation.
Compared TP8/DP8 and TP8/CP8 for DeepSeek-V4-Pro, and TP8/EP8/MegaMoE and PP8 for Kimi K3. A separate GB300 CP8 V4-Pro Prefill configuration measured median TTFT of 0.666 s at 60k and 1.516 s at 128k input, with one output token.
Select hardware and parallel layout against the target workload and SLO. Compare throughput, TTFT/TPOT and resource use at the qualifying operating point.
Separated logical expert popularity, physical placement, replica dispatch, padding and kernel time. Earlier V4-Pro B300 work motivated a follow-up on real-token V4.1-Flash 64K/C32 Prefill workloads.
In the reported V4.1-Flash comparison, frozen placement lowered rank-count CV from 0.149 to 0.047 and average MegaMoE duration from 7.512 to 7.180 ms. Input throughput rose 0.95%, compared with 1.01% for the synthetic balanced-routing diagnostic.
The uniform-routing arm changes logical expert selection and serves as a performance diagnostic. The RFC records its measurement boundaries. Separately, #48404 rejects incompatible recorder modes at startup after an online rebalance crash was reproduced.
My SGLang profiling RFC · #44697 · My DeepSeek EPLB discussion · #29Used a MegaMoE microbenchmark as a component reference for the serving trace. A 32K-chunk microbenchmark measured about 5.6 ms. In a separate V4.1-Flash real-input Prefill trace, mean main MegaMoE kernel times were 6.9–7.5 ms across ranks. Used nsys to follow execution and communication, and ncu to examine selected kernels.
Merged #43786 fuses inverse RoPE into CUDA UE8M0 FP8 activation quantization, preserving BF16 rounding and packed scales. Upstream B200 kernel tests passed 7/7, including numerical equivalence and CUDA Graph replay with updated inputs.
The microbenchmark and serving trace have different execution boundaries. The trace includes internal waits, so the gap guides attribution. The historical B300 fusion backport measured +1.61% Prefill throughput. Full-model performance of the final upstream implementation remains unmeasured.
Maintained SGLang container images and CI/CD workflows for multi-node experiments. Automated dependency setup, service lifecycle and benchmark collection, and recorded topology, cache budgets and validation settings for repeatable regressions.
HUAWEI ASCEND & KUNPENG
Ascend 910B/910C inference, kernel integration and Kunpeng CPU tuning, with results measured on complete workloads.
Worked with xLLM and vLLM-Ascend on Ascend 910B: model support, MTP, ACL Graph, cache capacity, and benchmark configuration. Qwen3.5-9B throughput moved 2,301 → 30,451 tok/s at C960 in a combined configuration comparison.
A separate Gemma 4 E2B deployment comparison measured 1,159.53 → 1,274.00 tok/s with Full ACL Graph. The two benchmarks have different baselines.
Used Ascend C, Triton, and TileLang to connect tiling and fusion to the Da Vinci data path: aligned transfers, on-chip buffers, compute, and synchronisation. Specialised paths need shape and layout checks, precision validation, and a fallback before serving integration.
Kernel timing and system throughput are measured separately. A faster local operator needs a reachable engine path and an end-to-end comparison.
On Kunpeng 920, tuned SVE/NEON, NUMA affinity, MPI/OpenMP and FFT plan reuse. The 256³ FFTW workload moved from 80.97 to 555.00 GFLOP/s.
CPU workloads are independent measurements, rather than evidence of an NPU or LLM serving speedup.
ASCEND 910C · CROSS-PLATFORM PROJECT
Using the OpenBMB MiniCPM-o model, this project connects DSpark draft training on NVIDIA B300 with llama.cpp-omni deployment and runtime optimization on Huawei Ascend 910C.
Technical article · From Encoder to Omni-Flow: multimodal serving ↗
Paired 120 s full-duplex test; 4/4 accuracy checks passed. Standalone speculative speedups were measured separately; the final duplex path ran without speculation.
Trained a 5-layer DSpark draft on 8×B300 (DP8) with DeepSpec; fixed-set mean acceptance length increased from 3.49 to 3.86.
Converted to mixed-precision GGUF, integrated with llama.cpp-omni / ggml-CANN on Ascend 910C, and checked KV position and streaming-state alignment.
Integrated TileLang AOT and QK-norm + RoPE fusion, used ACL Graph and prefix KV reuse, and improved Flow/Vocoder overlap.
APPLIED AI · THERMOPULSE
An applied-AI prototype connecting thermal measurements and visual findings with Qwen3-8B medical adaptation (CPT and SFT), with GRPO reward design for evidence-grounded reports.
Training evidence covers CPT/SFT. GRPO and stage-wise held-out evaluations are planned; no reference-project performance numbers are attributed to ThermoPulse.
Recorded: CPT/SFT training and loss metrics. GRPO rewards and held-out case evaluation remain a proposed study, not claimed performance gains.
MEASUREMENT → REPRESENTATION → EXECUTION → REPORT
A 640×480 LWIR camera with an FPGA-oriented acquisition and control path provides calibrated thermal images for YOLOv11 region and anatomical-landmark localization.
ResNet18 encodes 512-D local features, while a lightweight Transformer models patch relations into 64-D features; the fused 576-D representation supports a classification prototype.
Explored fused CUDA WarpAffine preprocessing, GPU-side NMS and FP16 TensorRT deployment for the ResNet visual branch, with the Transformer branch in PyTorch.
Continued pretraining on approximately 114 GB of Chinese and Western medical text, followed by supervised fine-tuning with approximately 18k ChatML instruction–response records. Used BF16, PyTorch SDPA and DeepSpeed ZeRO-2 on four H200 GPUs.
System output: Regional thermal findings and visual analysis are organized into structured medical reports and remote-service interfaces for human review.
CPT models domain language; SFT learns the response format; GRPO reward design targets evidence-grounded report generation. Training loss, reward and downstream quality are evaluated separately.
Combine the report instruction, regional temperatures and dual-stream visual findings into a structured text prompt for Qwen3-8B.
The proposed rollout samples multiple reports per case prompt, allowing group-wise comparison of generation quality.
The proposed reward checks evidence consistency, clinically significant omissions and report format before group-relative policy updates. Unlike the reference project’s multiple-choice rewards, report quality cannot be reduced to exact-match accuracy.
About 114 GB of medical text; 26,656 training steps over 204.8 h on four GPUs, with final training loss 1.186. Training loss is not a clinical-accuracy metric.
About 18k ChatML records from the CPT checkpoint; 2,048-token packing, BF16 and ZeRO-2. The available records show validation loss improving from 1.260 to 1.144.
Proposed evaluation uses held-out cases to check evidence-grounded findings, unsupported conclusions, required report fields and human-review outcomes; GRPO gains need separate experimental verification.
Proposed comparisons use fixed held-out data and consistent prompts and decoding settings. Training loss alone is not task accuracy.
Token-level NLL on held-out medical text; distinct from recorded training loss.
Held-out MCQ likelihood or answer accuracy, with one consistent scoring protocol.
Generate responses with fixed decoding and score extracted final answers.
Check field coverage, unsupported claims, evidence alignment and human review.
Current evidence: CPT training loss and SFT validation loss are recorded. Independent PPL, MCQ, generative and report-quality comparisons are evaluation targets, not published ThermoPulse gains.
The reference project uses SGLang to serve a teacher model for SFT data distillation, while GRPO runs on TRL + colocated vLLM. These are implementation references, not claimed as ThermoPulse's deployed training stack.
These open sources are methodological references, not verified provenance for ThermoPulse training data. Some tutorial results use the earlier teacher experiment; consult the updated REPORT.md for the reference project's results, and original logs for ThermoPulse.
Performance → capacity → economics
My completed work establishes NVIDIA serving-performance and capacity baselines. Cross-accelerator comparisons and full TCO analysis are team follow-up work.
Sweep concurrency and configuration on the target request mix. Compare TTFT, TPOT, request throughput, memory pressure, failures, and output correctness. Select an operating point that meets the specified latency, quality, and stability criteria.
Input tok/s, output tok/s, aggregate input+output tok/s and requests/s are different metrics. State ISL/OSL, cache-hit rules, and whether reused tokens count as newly computed work.
Convert Prefill and Decode rates to per-instance requests/s under the same workload and SLO. Size both stages for peak demand, with headroom and redundancy for the deployment.
Validate the resulting P/D ratio with real KV transfers, queueing and end-to-end TTFT/TPOT. Stage-isolated rates are sizing inputs.
Use one accounting period for compute rental or hardware depreciation, power, networking, software, and operations. Divide by the correctly delivered token volume under the chosen service criteria. Treat input and output separately when the accounting requires it.
Use actual service days, busy/idle utilisation, headroom, uptime and retries rather than extrapolating peak TPS to 24×30. Keep compute cost, billable-token pricing and ROI separate.
A useful framework for relating Prefill/Decode, batching, memory bandwidth, and parallel execution to measured server behaviour.
Connects latency-constrained benchmark points to deployment capacity and a cost model. These references guide the method; my results remain tied to my own workloads.
From performance evidence to hardware economics: NVIDIA serving baselines (my completed work) → controlled comparison with Kunlunxin and other accelerators (team follow-up) → deployment sizing and TCO with real utilization, power, prices and traffic. Compare like-for-like models, traffic mixes, SLOs and correctness criteria; cache-token accounting and operating windows must also be explicit before claiming a unit-cost advantage.
TCO series / 案例复盘: (一)一套算力到底值不值得用?↗ · (二)DeepSeek 线上吞吐、卡时收入与投资回收↗
Inference engineering practice
A faster kernel or a higher benchmark TPS is only one piece of evidence. I keep workload, code revision, resource limits and correctness checks comparable before accepting a change as a service-level improvement.
How much correct, reliable serving capacity can this configuration deliver within its latency and resource budget?
Pin model and framework versions, topology, request distribution, cache policy, precision, and resource limits. Confirm the intended backend and communication path.
Separate P/D tests from end-to-end service tests. Use nsys for critical paths, CPU/GPU gaps, communication overlap, synchronisation, and graph coverage; use ncu for selected kernels.
Test one causal hypothesis at a time. Check output quality, failure behaviour, memory boundaries, repeatability, and throughput/latency together. Carry the regression upstream.
Size from sustained, SLO-qualified service throughput—not SLO-free peaks or microbench numbers—then estimate GPU allocation and cost scenarios. Label measured results, estimates and open assumptions.
CURATED LEARNING RESOURCES
A reading shelf for LLM systems, runtimes and GPU programming. My blog connects these ideas to engineering investigations.
Architecture, quantitative reasoning and code-first tutorials.
Trace a request through scheduling, caching and execution.
Understand memory movement, collective communication and fused kernels.
MORE LEARNING MAPS
Additional verified forks and public references. These are reading suggestions, not a claim that every link is starred.
Read public Stars directly from GitHub on demand. No token needed. The learning filter is keyword-based; search covers loaded repositories.