A 2.78-trillion-parameter Kimi K3 running inference on a single CPU in 8.24 GB of RAM. Portable C99: no BLAS, no framework, no GPU.
C avx2c99cpu-inferencedeep-learningfrom-scratchinference-enginekimi-k3linear-attentionllmllm-inferencemachine-learningmemory-efficientmixture-of-expertsmoemxfp4quantizationsimdsystems-programmingtransformerzero-dependencies
release: v1.1.0
Fareed Khan1025d9e4990b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b3211bc..02df6b1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,8 +5,26 @@ versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).## [Unreleased]+## [1.1.0] - 2026-10-02++Chat, native Windows builds alongside Linux and macOS, an 8 GB class mode for the+complete model, NEON kernels for ARM, and a round of hardening on everything that parses+checkpoint files. Output is unchanged wherever it was already defined: every oracle gate+still matches the reference exactly.++One compatibility note: `--save-state` files move to version 2, with a checksum. A+version 1 file is refused with a clear message rather than read; regenerate it with+`--gen 0 --incremental --save-state`.+### Added+- **`--preset ultra` and `--ultra-low-memory`**: the complete 93 layer model inside an+ 8 GB class memory budget, by streaming exact embedding rows and bounded lm_head chunks+ and reusing one recurrent state slot. Same weights, same top-16 routing, same kernels.+ Verified with four full runs on a Jetson Orin Nano Super against the released+ checkpoint, identical ids and identical logits each time. Slow, by design.+- **NEON kernels on aarch64** for the bf16, MXFP4 and q8 matmuls, so Apple Silicon and+ ARM servers are no longer scalar only. Bit identical to the scalar path.- **`--chat`**: a terminal REPL implementing K3's official XTML chat format, messageenvelopes, the `thinking_effort` system preamble, and `reasoning_content` on priorassistant turns, rendered exactly as the checkpoint's own encoder does, with JSONL@@ -62,6 +80,9 @@ versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).### Changed+- **The MXFP4 expert matmul is about 1.6x faster**, decoding nibbles in register, plus+ another 1.56x from a flat-row AVX2 path when the group is a multiple of 16. Bit+ identical, checked against the kernel hashes before and after.- **Expert reads are split into 1 MiB chunks**, so a batch of reads no longer waits on itsslowest expert. Output is unchanged.- **Trunk layers are read in parallel chunks.** `load_run()` streamed each layer with@@ -78,6 +99,14 @@ versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).### Fixed+- **macOS could not read the embedding table or a packed trunk layer.** Darwin's pread+ refuses a single request of 2 GiB or more, and both exceed it; reads are now chunked.+ The download script also works on macOS and with current huggingface_hub releases.+- **CMake on Apple Silicon and on macOS.** The ARM64 build was handed x86 flags, and the+ macOS build silently came out single threaded because CMake could not find Homebrew's+ libomp. Both are fixed.+- **`k3_matmul_mxfp4` now enforces its documented preconditions.** An odd input width or a+ group above 64 aborts with a message instead of writing past the caller's buffer.- **`--preset auto` refused itself on large machines.** It planned to 98% of availablememory while admission allowed 95%, so from about 100 GB of RAM upward the recommendedpreset could never start, and the refusal printed a negative shortfall. One constant@@ -228,6 +257,7 @@ First public release.See [docs/ROADMAP.md](docs/ROADMAP.md).-[Unreleased]: https://github.com/FareedKhan-dev/kimi-k3-in-c/compare/v1.0.0...HEAD+[Unreleased]: https://github.com/FareedKhan-dev/kimi-k3-in-c/compare/v1.1.0...HEAD+[1.1.0]: https://github.com/FareedKhan-dev/kimi-k3-in-c/compare/v1.0.0...v1.1.0[1.0.0]: https://github.com/FareedKhan-dev/kimi-k3-in-c/compare/v0.1.0...v1.0.0[0.1.0]: https://github.com/FareedKhan-dev/kimi-k3-in-c/releases/tag/v0.1.0diff --git a/README.md b/README.mdindex f7488f2..04f8555 100644--- a/README.md+++ b/README.md@@ -10,8 +10,8 @@<a href="https://github.com/FareedKhan-dev/kimi-k3-in-c/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/FareedKhan-dev/kimi-k3-in-c/ci.yml?branch=main&style=flat-square&label=CI" alt="CI"></a><a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue?style=flat-square" alt="License"></a><a href="Makefile"><img src="https://img.shields.io/badge/C99-portable-lightgrey?style=flat-square" alt="C99"></a>-<a href="#requirements"><img src="https://img.shields.io/badge/platform-Linux%20x86--64-lightgrey?style=flat-square" alt="Platform"></a>-<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-1.0.0-brightgreen?style=flat-square" alt="Version"></a>+<a href="#requirements"><img src="https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey?style=flat-square" alt="Platform"></a>+<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-1.1.0-brightgreen?style=flat-square" alt="Version"></a></p><table>@@ -202,7 +202,7 @@ The gate is storage: **the checkpoint is 1.56 TB.** Everything else is ordinary.| | | ||---|---|---|| **OS** | Linux, x86-64 (reference); macOS/arm64 and Windows/x86-64 also build and pass every gate | uses `O_DIRECT`, `posix_memalign`, `getrusage` -- ported for Windows via MSYS2's MinGW-w64 (see `src/io/k3_portable_io.h`) |-| **CPU** | AVX2 + FMA | AVX-512 unnecessary. `make portable` targets generic AVX2 |+| **CPU** | AVX2 + FMA on x86-64, NEON on arm64 | AVX-512 unnecessary. `make portable` targets generic AVX2 on x86-64 || **RAM** | 8 GB and up | every preset works; more memory is faster, never different || **Storage** | ~1.7 TB free | 1.56 TB checkpoint + 109 GB packed trunk, ideally on fast local disk || **Toolchain** | GCC ≥ 9 or Clang ≥ 10 | GNU make, or CMake |diff --git a/pyproject.toml b/pyproject.tomlindex 505adc2..904fd14 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,6 +1,6 @@[project]name = "kimi-k3-in-c"-version = "1.0.0"+version = "1.1.0"description = "Python tooling for the Kimi K3 inference engine: fixture generation, reference-vs-C conformance, cache replay"requires-python = ">=3.12"# Pinned exact, not a range, so the next environment anyone builds from this filediff --git a/src/cli/k3_run.c b/src/cli/k3_run.cindex 8429153..31e98b4 100644--- a/src/cli/k3_run.c+++ b/src/cli/k3_run.c@@ -207,7 +207,7 @@ static int spec_draft(const int *seq, int T, int cap, int *out)}#ifndef K3_VERSION-#define K3_VERSION "1.0.0"+#define K3_VERSION "1.1.0"#endif/* The fraction of available memory a plan is allowed to occupy. The admission check and