Inference engineering · first results
Kimi-K3 optimization: DSpark works and slicing passes its first gate
The first optimization window produced a working drafter, a rejected worker upgrade, and a corrected slicing path. The archived DSpark drafter loads and computes on CPU and GB300. FlashInfer 0.7.6 + B12x 1.5.1 passes whole-expert parity after I port the SiTU patch, but it is slower than the patched worker. Eight-way slicing now preserves the dequantized weights exactly and, after fixing the direct-micro SiTU activation, the partition canary reaches 0.999977–0.999980 cosine against the whole expert.
input_global_scale=None was equivalent to scale 1. Both were wrong. Fable 5.2’s source review led to the decisive test: the direct micro kernel was silently running SiLU. The corrected results below replace that explanation.In plain English
We started with a simple question: can we make the existing 4-bit Kimi-K3 pod faster without changing the model or breaking the server? The first answer is that the drafter is real, the newer worker is not automatically better, and slicing is more subtle than copying one-eighth of each record.
The key result is that slicing now works in the canary. The hard part was not the FP4 bytes; it was discovering that the small-slice dispatch path used a different kernel whose activation had not been patched. Once the exact K3 SiTU formula was added there, the eight-way sum matched the whole expert to about 0.99998 cosine.
1. DSpark moved from archive to computation
The pinned RadixArk artifact is a five-layer BF16 drafter with 2,249,289,601 parameters, block size seven, and a confidence/Markov head. It is not a generic seven-token speculative decoder. It expects target hidden states from layers 7, 23, 51, 67, and 83.
CPU smoke passed with no GPU visible: the forward output is [1, 7, 7168], the Markov output is [1, 7, 163840], and the confidence output is [1, 7]. The same pinned artifact then passed on the GB300 with CUDA. The loader lesson was concrete: AutoModel follows model_type=qwen3 and rejects DSparkConfig, so the smoke loads the pinned classes directly.
This is still not target integration. I have not measured acceptance, and I have not connected the drafter to the vLLM server. The next DSpark work is a target-hidden-state contract and a matched acceptance test, not a routing trace.
2. The newer worker passes parity and loses time
I built an isolated FlashInfer 0.7.6 / B12x 1.5.1 environment. The first import failed on CUTLASS 4.5.2; the candidate needed CUTLASS 4.8.0 and several small dependencies. After that, the real bank run exposed another important fact: 0.7.6 does not include K3 SiTU in this wrapper. The old SiTU patch had to be ported.
With that patch, whole-expert parity passes. The candidate’s minimum cosine is 0.995648 and its k=4 sum cosine is 0.999923. But its graph p50 is slower at every tested shape: +15.6% at k=1, +12.4% at k=2, +14.4% at k=4, +10.5% at k=8, and +4.6% at k=16.
That is a clean negative result. The patched 0.7.0.post1 worker remains the speed control. The candidate is useful for its true-extent and guard behavior, but it does not earn a promotion.
3. Slicing: two layout bugs, then an exact weight result
The first slice builder treated the whole record as if every byte divided by eight. It does not: the 24-byte global-scale block is duplicated per slice. A real slice record is 2,322,456 bytes, not 2,322,435.
The second bug was more interesting. Gate/up scales can be sliced by rows because their scale-column count stays unchanged. Down-projection scales cannot: their swizzle depends on the number of scale columns. The correct path is exact inverse swizzle → slice the linear scales → forward swizzle at the sliced geometry. I replaced the ambiguous NumPy permutation with explicit builder-index loops and added roundtrip tests.
After that, every dequantized slice matches the corresponding whole-expert columns. The minimum weight cosine is 0.99999988, with zero maximum absolute difference in the tested records. That is the right kind of gate: it proves the layout before asking a kernel to explain a bad result.
4. The partition sum now passes
The first corrected-layout run still failed at 0.9893–0.9927 cosine. Fable 5.2’s review predicted that the small-I calls were taking the direct micro kernel, whose activation fell through to SiLU. The diagnostic confirmed it: situ and silu outputs were bit-identical, and the partition matched the SiLU reference at about 0.9965.
Adding the exact K3 formula—4·tanh(g/4)·sigmoid(g) × 25·tanh(u/25)—to the direct micro path fixed it. The identity-checked v3 banks now reach 0.999977–0.999980 cosine against the whole expert, with norm ratios 0.99990–1.00018 and bit-exact repeats. The corrected slice benchmark’s minimum per-slice cosine is 0.995241 and its k=4 sum cosine is 0.999997.
FP32 partials are not required for this canary. BF16 partials with a fixed-order FP32 sum are sufficient here; the earlier rounding hypothesis was ruled out by the magnitude of the error. RTX slice latency is about 308 µs at graph k=1, but that is not a Spark measurement and does not establish the full-pod win.
5. Determinism is still open
The whole-expert eager repeats show p50 relative differences around 0.8–1.9% in both workers. Fable’s source reading explains the shape: the MMA micro kernel performs timing-dependent BF16 atomic accumulation. The candidate reduces the tail, but does not make the whole path deterministic. Its capture guard also requires one wrapper per layer when the real scale=1 is used; reusing one wrapper across layers changes the folded-scale cache key.
The direct-micro slice path is bit-repeatable in this canary, but the whole-expert determinism gate remains open. Fixed-order reduction alone does not fix the MMA kernel.
What happens next
- Spark pilot: when the Sparks are free, run the matched whole-expert control, then the corrected direct-SiTU sliced path with backend and memory assertions.
- Full-pod measurement: compare C1/C8 decode, prompt reading, and cold-load behavior against the existing vLLM server.
- DSpark target integration: capture the five target hidden states, measure acceptance against the target, and keep the vLLM server’s prefill and concurrency behavior intact.
The first window did not produce a faster pod. It produced a verified drafter, a rejected worker upgrade, an exact slicing layout, and a corrected partition path that is ready for a Spark pilot.