SShortSingh.
Back to feed

176 KB C Binary Runs 2.78-Trillion-Parameter AI Model on 8 GB RAM Without a GPU

0
·13 views

Developer Fareed Khan has built kimi-k3-in-c, a 176 KB pure C99 binary that runs Moonshot AI's Kimi K3 model — which has 2.78 trillion parameters and normally requires dozens of H100 GPUs — on a single CPU with just 8 GB of RAM. The project achieves this through four layered optimisations: 4-bit weight packing, on-demand expert loading from NVMe storage, dense-layer streaming with O_DIRECT, and an LRU cache for routed experts, collectively reducing memory requirements by 676 times. Crucially, the engine produces output byte-for-byte identical to the PyTorch reference, meaning no accuracy is sacrificed despite the extreme resource constraints. Performance is slow — around 33 seconds per token at the minimum memory preset — making it impractical for real-time use, and generating 200 tokens can take roughly two hours. Khan has described the project explicitly as a teaching artifact rather than a production inference server, demonstrating the structural sparsity properties of Mixture-of-Experts models.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer Builds Minimal 3-Node Raft Consensus Cluster to Explain Core Protocol

A developer published a tutorial on DEV Community demonstrating how to implement a minimal three-node Raft consensus cluster within a single process, without sockets, threads, or real-time dependencies. Nodes communicate through a simulated network, with a virtual clock managing delivery latency and election timeouts. The implementation covers the four core Raft mechanisms: leader election, log replication, commitment, and leader failover. Raft ensures distributed consensus by designating a strong leader per term, which coordinates client writes and replicates log entries to follower nodes. The article intentionally omits production concerns like persistent storage and membership changes to keep the core protocol visible and easier to understand.

0
ProgrammingDEV Community ·

Go's typed-nil trap silently crashed a rate limiter when Redis was absent

A developer building Grounded LLM, an open-source document assistant platform, discovered a subtle Go bug during CI smoke tests for the v0.4 enterprise-hardening release. The rate limiter was designed to fall back to an in-memory backend when Redis was unavailable, but instead crashed with a hard panic on the first incoming request. The root cause was Go's typed-nil interface behavior: a nil *redis.Client pointer boxed into a redis.Cmdable interface evaluated as non-nil, tricking the limiter into enabling Redis mode despite no live client existing. The fix involved two defensive layers — returning a true nil interface at the source and adding an explicit typed-nil guard inside the WithRedis constructor — along with a regression test to prevent recurrence. The bug was caught in CI before reaching production and is now merged into the v0.4.0 release.

0
ProgrammingDEV Community ·

Google Launches Agent Sandbox to Safely Run AI-Generated Code on Kubernetes

Google Cloud has released Agent Sandbox, a managed GKE feature that provides isolated, stateful Linux containers for executing untrusted, LLM-generated code. Each sandbox runs as a single-replica Kubernetes workload with a stable hostname, persistent storage, kernel-level isolation, and a default deny-all network policy. The system is built on Kubernetes custom resource definitions, including primitives for sandbox instances, reusable templates, and warm pools that allow pre-started sandboxes to be assigned in milliseconds. An open-source controller under the kubernetes-sigs/agent-sandbox project lets teams run the same setup on their own clusters without relying on Google's managed offering. The feature addresses a growing security concern for platform engineers as AI agents are increasingly tasked with running shell commands, installing packages, and interacting with live infrastructure.

0
ProgrammingDEV Community ·

Developer ports cron-parser from TypeScript to Go, uncovers silent date-handling bugs

A developer spent a weekend porting the popular cron-parser library from TypeScript to Go, running the original unmodified test suite against the new implementation. Using a differential testing harness, they discovered 41,088 divergences caused by subtle differences in how JavaScript's Luxon library and Go's time package handle date arithmetic and DST transitions. Key discrepancies included asymmetric month/year clamping versus overflow behavior and opposite DST gap resolution directions, the latter of which could silently shift results to the wrong calendar day. Four tests in the original suite were found to be passing vacuously — a spy asserting a method was never called trivially passes when the method does not exist in the ported code. The developer resolved all divergences and added instrumented logging to ensure the passing tests were genuinely meaningful rather than silent false positives.