Repository navigation
kimi: K3 and K3.1 through the native server on Metal - #2221
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/k31-config
branch
from
November 5, 2026 03:59
31256c8 to
4cc027d
Compare
ashhart
force-pushed
the
lead/k31-config
branch
from
November 5, 2026 07:00
4cc027d to
f8d17a7
Compare
ashhart
force-pushed
the
lead/k31-serving
branch
from
November 5, 2026 07:20
859c1d4 to
f436eca
Compare
ashhart
marked this pull request as ready for review
November 5, 2026 07:20
4 tasks done
ashhart
added a commit
that referenced
this pull request
Nov 5, 2026
ashhart
force-pushed
the
lead/k31-serving
branch
from
November 5, 2026 08:57
f436eca to
ef880b0
Compare
Register kimi_k3 and kimi_k31 on Metal, with a native text path: chat rendering, masked special tokens, reasoning and tool calls, and K3's efforts including medium. A request past K3.1's 2,047-token ceiling gets dsa_config.limit_message, and snapshot restore checks the ceiling before any copy. Admission prices every expert before opening anything and refuses by budget, so the complete 1.45 TB checkpoint does not run on one Mac through this path. The reply loop moves from chat.zig to chat_generation.zig, keeping main's clamp of the cached count. kimi_prompt.zig and kimi_values.zig adapt the model's own encoding_k3.py at revision 6d0a0202, named in THIRD_PARTY_NOTICES.md. Tested on a four-layer synthetic graph on Metal, and all 15 prompt goldens match the release encoder's token ids. No real weights, no model-forward reference and no full-model run. No lane or lane-host scheduling change.
ashhart
force-pushed
the
lead/k31-serving
branch
from
November 5, 2026 10:00
ef880b0 to
dadb396
Compare
jschmied
added a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 6, 2026
ashhart
pushed a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 6, 2026
ashhart
pushed a commit
to jschmied/TensorFold
that referenced
this pull request
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second step of #2192, on main now that #2208 has landed: K3 and K3.1 become reachable through the native HTTP server on Metal, on one machine.
What it adds
kimi_k3andkimi_k31are registered on Metal, with resident BF16 projections, stored MXFP4 experts, KDA and MLA slots, and shared verification scratch. The unchanged lane core handles scheduling, verification and sampling; no lane or scheduling code changes.medium. All 15 prompt goldens rendered by the release's own encoder agree on segments and joined text. Token ids against the realtiktoken.modelare still to run.dsa_config.limit_message, and snapshot restore checks the ceiling before any copy.Notice:
kimi_prompt.zigandkimi_values.zigadapt the model's ownencoding_k3.pyat revision6d0a0202, and the tokenizer integration followstokenization_kimi.py, named inTHIRD_PARTY_NOTICES.md. No other engine's source was read. The recipe states the licence's Model-as-a-Service condition.Tested on a four-layer synthetic graph, on Metal: drafted equals plain, concurrent equals solo at two streams, resumed equals fresh at five prompt cuts, and cancellation leaves the next output equal. The full test suite, kernel contract and server goldens pass (322/335 equal with zero unexpected differences).
Not run: real weights, a K3.1 reference, the complete model, long-context K3.1, quality, speed, or any Mac other than the test machine.