Skip to content

Shard Kimi projections without padding checkpoint weights - #385

Merged
lukealonso merged 6 commits into
dev/infernal-invocationfrom
agent/ii-kimi-projection-sharding
Aug 17, 2026
Merged

lukealonso merged 6 commits into
dev/infernal-invocationfrom
agent/ii-kimi-projection-sharding

Conversation

@voipmonitor

Copy link
Copy Markdown

Status

Implemented. This pull request is stacked on #384 and requires local-inference-lab/b12x#215 for unaligned multi-row FP8 output storage.

Behavior

  • Preserves the official Kimi-K3 MXFP4 routed-expert shard width instead of padding each TP16 shard from 192 to 256 channels.
  • Tensor-parallel shards the merged MLA latent projection and restores logical row order after gather.
  • Gathers BF16, FP16, FP32, and FP8 projection payloads through B12X while removing transport-only alignment rows.
  • Supports opt-in KDA f_a sharding when the output width is divisible by the tensor-parallel size.
  • Declares checkpoint-omitted KDA alignment rows and initializes them to zero before online quantization.

Technical reason

Checkpoint padding increases routed-expert storage and can prevent the official MXFP4 checkpoint from fitting with the required KV cache. Projection sharding reduces replicated dense weight memory without changing logical tensor shapes or executed values.

Compatibility

KDA f_a sharding remains disabled unless requested. TP12 rejects that option because width 128 is not divisible by 12. The replicated path remains the default because TP16 decode measurements favor replication despite its 113.20 MiB per-GPU memory cost.

Validation

  • Kimi model, TP-projection, sequence-parallel, KDA, omitted-tail, and native-MoE-shard tests pass.
  • The official checkpoint keeps a 192-channel local routed-expert shard at TP16.
  • The merged latent projection saves approximately 0.634 GiB per GPU at TP16.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • dev/*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 10f9e7e0-9a15-4ea8-8c8c-4598f2c7f1ef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@voipmonitor
voipmonitor force-pushed the agent/ii-b12x-dcp-collectives branch from 9ba0e56 to 5376dd6 Compare August 16, 2026 04:32
@voipmonitor
voipmonitor force-pushed the agent/ii-kimi-projection-sharding branch from b4f0414 to b1f33f3 Compare August 16, 2026 04:32
@voipmonitor voipmonitor changed the title [II] Shard Kimi projections without padding checkpoint weights Shard Kimi projections without padding checkpoint weights Aug 16, 2026
@voipmonitor
voipmonitor force-pushed the agent/ii-kimi-projection-sharding branch from b1f33f3 to ebd7bbb Compare August 16, 2026 05:04
@voipmonitor
voipmonitor force-pushed the agent/ii-b12x-dcp-collectives branch from 545690b to eb4d734 Compare August 16, 2026 05:38
@voipmonitor
voipmonitor force-pushed the agent/ii-kimi-projection-sharding branch from ebd7bbb to 17b9f73 Compare August 16, 2026 05:39
@lukealonso
lukealonso force-pushed the agent/ii-b12x-dcp-collectives branch from eb4d734 to cca7670 Compare August 17, 2026 04:26
@voipmonitor
voipmonitor changed the base branch from agent/ii-b12x-dcp-collectives to dev/infernal-invocation August 17, 2026 04:55
@voipmonitor
voipmonitor changed the base branch from dev/infernal-invocation to agent/ii-b12x-dcp-collectives August 17, 2026 04:56
Skip generic minimum-width padding when Kimi-K3 MXFP4 routed experts use the B12X W4A16 backend. TP16 retains the checkpoint 192-channel local intermediate shard instead of expanding it to 256 channels; other quantization and MoE backends preserve the established padding policy.
Add an opt-in tensor-parallel layout for Kimi-K3 fused q_a and kv_a weights. Gather rank-local outputs once per layer and restore logical q_a/kv_a ordering before normalization, preserving the replicated projection result while reducing per-rank weight storage.
@voipmonitor
voipmonitor force-pushed the agent/ii-kimi-projection-sharding branch from 17b9f73 to 49186ad Compare August 17, 2026 05:00
@voipmonitor
voipmonitor changed the base branch from agent/ii-b12x-dcp-collectives to dev/infernal-invocation August 17, 2026 05:00
@lukealonso
lukealonso merged commit 2b05b74 into dev/infernal-invocation Aug 17, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants