Views
No views yet
v2-2.71bpw.| Component | Treatment |
|---|---|
| Routed experts (low band) | 1.5625 bpw ternary codebook (IQ1_S-style semantics, native MLX kernels), Hessian-weighted encoding |
| Routed experts (protected band) | 14,000 of 82,432 expert-instances promoted to native MXFP4 (4.25 bpw) — selected by blended Hessian×activation-mass score with depth-aware, clamp-aware waterfilling |
| Attention / dense / shared experts | 6-bit, group size 64 |
| Vision tower (MoonViT-3d) | bf16, unquantized — multimodal path preserved |
| Post-quant training | Layer-wise DWQ against the mxfp4-QAT teacher (fp32 master weights, bias-corrected Adam, monotone rollback; all 8 depth blocks converged, val-KL −12…−37% per block) |
model.safetensors.index.json covers 7,675 tensors.| Build | Size | bpw | wikitext PPL | Korean PPL | KL(teacher‖build) | top-1 flip |
|---|---|---|---|---|---|---|
| teacher (mxfp4-QAT) | 1,561 GB | ≈4.25 | 1.578 | 3.114 | — | — |
| v2 (2.71 bpw, retired) | 948.5 GB | 2.71 | 2.879 | 3.341 | 0.349 nats | 17.70% |
| v3 (this build) | 737.1 GB | 2.096 | 2.078 | 3.311 | 0.2253 nats | 13.77% |
[!NOTE] The 2.71 bpw (v2) build is retired and no longer distributed. Its numbers stay in the table below purely as the historical baseline this build is measured against — thev2-2.71bpwbranch has been removed. v3 (this build) is smaller and better on every metric measured, so there is no configuration in which v2 was the right choice.
llama-perplexity (unsloth's kimi-k3-fullsize-vision branch, CPU) on the same wikitext raw text, -c 2048 --chunks 24, gives PPL 1.7064 ± 0.0128. This number is not directly comparable to the table above: llama-perplexity inserts BOS per chunk and handles window boundaries differently from our teacher-logit harness (same text, different protocol — the two harnesses disagree systematically, and we could not run either build through the other's harness). Within a single harness the ordering is measured only for our builds (v3 strictly better than v2 everywhere). The KL-vs-teacher and flip numbers above remain the strongest like-for-like quality evidence for this build; a same-harness GGUF comparison would require logits export from llama.cpp and is left open. (Korean H2H was skipped by design.)1# 1. Both boxes: deps + this repo's runtime (the *.py files and chat_ui.html here)
2pip install "mlx>=0.31" "mlx-lm>=0.31" numpy huggingface_hub
3huggingface-cli download avlp12/Kimi-K3-Alis-MLX-Dynamic-2.10bpw --local-dir k3-2.10bpw
4
5# 2. Box 1: split the 96 shards into two expert-parallel halves (~369 GB each),
6# then move the rank-1 half to box 2 (fast local link recommended)
7python3 slice_rank_half.py --src k3-2.10bpw --rank 0 --out r0
8python3 slice_rank_half.py --src k3-2.10bpw --rank 1 --out r1 # then scp/rsync r1 to box 2
9
10# 3. Launch (from box 1; starts rank 1 on box 2 over ssh, serves web chat on :8010)
11BOX1_IP=10.0.0.1 BOX2_IP=10.0.0.2 BOX2_SSH=user@10.0.0.2 \
12BUILD_R0=$PWD/r0 BUILD_R1='~/r1' bash launch_serve.shhttp://<box1>:8010 — markdown-rendered chat with a thinking-channel panel, session KV
reuse (delta prefill), and a stop button. /api/chat accepts
{messages, session, max_tokens, temperature, thinking_effort} as SSE.k3_cbq.py, row-parallel decode variant),
KDA projection packing + fused glue kernels (k3_fuse.py), fused MoE router (top-16-of-896
in one dispatch), SiTU-at-store expert kernels, expert-parallel harness with lazy-graph
collectives (k3_ep.py), and two-rank synchronized sampling (no per-token broadcast;
32-round tripwire). Env switches: K3_KDA_FUSE/K3_KDA_GLUE/K3_MOE_ROUTE/K3_SHARED_FUSE/ K3_CBQ_NO_V4/K3_CBQ_NO_SITU/K3_SYNC_SAMPLE (all default-on), K3_MLA_ABSORB=1 (required).curl -s http://<box1>:8010/ returns the chat HTML, then
POST a short /api/chat request with "temperature":0 and confirm tokens stream;
(4) expect ≈7 min load per boot; ≈8.8 tok/s decode with the default K3_ATTN_TP=1 K3_DENSE_TP=1 (up to ≈10.5 tok/s on code with opt-in speculative decoding, see below) (7.0 with TP off, see below); if rank 1 dies, kill both
k3_serve.py processes with SIGTERM (never kill -9 — wired-memory leak risk) and relaunch.
Do not raise MLX_MAX_OPS_PER_BUFFER/MLX_MAX_MB_PER_BUFFER — measured regression.
The port in the hostfile must be free on BOTH boxes (TIME_WAIT collisions look like hangs).K3_MLA_ABSORB=1 recommended).K3_ATTN_TP=1 +12% — each step transcript- or teacher-anchored). TP quality is certified two ways: single-box head-shard numerical parity (rel_max ≈5e-3 on both KDA and MLA layers = bf16 rounding scale; the partial sums are accumulated in fp32 before the all_sum), and byte-identical greedy transcripts vs the non-TP configuration (3 prompts × 96 tokens, reasoning traces included). On top of attention TP, the shared (always-active) experts are also sharded (−4.9 GB weight reads per token per rank, gate/up column-split + down row-split); their partial sums ride the existing per-layer expert all_sum as a concatenated payload, so shared-expert TP adds zero extra collectives. Certified by a 4-window teacher-anchored KL check — 0.2303/0.3626/0.1112/0.1170 nats vs the non-TP baseline 0.2313/0.3637/0.1130/0.1169, i.e. within noise — plus single-box numerical parity on the sliced-then-packed fused path (rel_max ≈1e-3). At 8.8 tok/s this build is now ahead of the 211 GB larger v2 build (5.7 tok/s) outright, and decode holds 8.8 tok/s even at 2k-token context depth.K3_ATTN_TP=1 shards the replicated q/k/v/gate/o attention projections across the two ranks (−16.6 GB weight reads per token per rank) at the cost of one extra per-layer partial-sum all_sum. The long-prompt stall reported here earlier is fixed: the trigger was the size of a single forward graph containing per-layer TP collectives (T ≳ 1.5k wedges the scheduler on both jaccl and ring backends; chunking only the all_sum payloads does not help), so under TP the server now chunks prefill into 256-token forwards automatically (K3_PREFILL_CHUNK, override if you must) — verified end to end with a 2k-token prompt. The chunking cost was then erased by a new prefill kernel: v7, an MMA fused-codebook GEMM (simdgroup_matrix tiles with the ternary-codebook dequant fused into the threadgroup loader — no dequant round-trip to device memory, tile runs aligned to expert boundaries, tile height auto-selected by routed-run length). Measured on the expert GEMMs: 2.1× vs the prior token-parallel kernel at 512-token chunks, 3.6× unchunked, 2.65× vs dequant-then-GEMM expert-major. End to end at 2k tokens: prefill 24.8 s (80 tok/s) under full TP — faster than the old non-TP path (33.6 s) — with decode 8.8 tok/s held at that depth. Short chat-turn prompts keep the token-parallel kernel (tiny per-expert runs starve MMA tiles below ~3k routed rows) and are byte-identical. The v7 configuration passes the same 4-window teacher-anchored KL gate (0.2307/0.3634/0.1125/0.1167 vs baseline 0.2313/0.3637/0.1130/0.1169).v2-2.71bpw branch remains marginally faster if footprint is no object.K3_SPEC=2 K3_SPEC_K=5 and the drafter in dspark-drafter-r4/; acceptance is
sampler-equality, so outputs follow the target's own distribution. Full round economics and
lessons: alis-dwq repo, K3 Addendum 11.vision.safetensors) injected and run through all 93 quantized layers across both boxes. Beyond finite activations (rms 0.60), the model generated HTML/CSS reproducing the input image (<div class="gradient"> + background: linear-…) — the same image-to-code behavior the v2 build demonstrated. Vision tower is bf16 passthrough, identical treatment to v2.