Kimi K3 runs on 8GB CPU, No GPU

Kimi K3 runs on 8GB CPU, No GPU​

Mehul Gupta - Medium

This is exactly why the Kimi K3 in C repository has attracted so much attention. Instead of requiring GPU clusters, it demonstrates that Kimi K3, a 2.78 trillion parameter Mixture-of-Experts (MoE) model, can perform inference on a single CPU with as little as 8GB of RAM.

What is Kimi K3 in C?​

Kimi K3 in C is an inference engine built specifically for running the Kimi K3 language model using only CPU resources.
Unlike traditional AI frameworks that depend on multiple libraries and GPU acceleration, this project focuses on simplicity and portability.

The engine itself is written in standard C99 and is designed to compile with common compilers while relying only on standard libraries and OpenMP for parallel execution.
The repository includes everything needed to execute inference, including a tokenizer, model loader, streaming engine, cache management, validation tools, benchmarking utilities, and a command-line interface. Rather than acting as another wrapper around an existing deep learning framework, it implements the core inference pipeline from scratch.


View: https://medium.com/data-science-in-your-pocket/kimi-k3-runs-on-8gb-cpu-no-gpu-d69f75eaace1
 
Instead of asking how to load the entire model into RAM, they asked whether the entire model actually needs to be present in memory at every moment during inference.

That simple question completely changes the problem.
The core ideas include:

Keeping only essential components resident in memory.
Streaming large portions of the model directly from storage.
Loading experts only when required.
Using intelligent caching so recently used experts do not need to be fetched repeatedly.
 
What's the difference between this and using distilled models?
 
The lead is a bit burried here, it is 100% impraticable, just an experiment proof of concept, it is not running with token per second metric, but how many second it take to make a single token

Generating each token can take several seconds, and performance depends heavily on available RAM and storage speed. Machines with larger memory budgets and fast NVMe SSDs naturally perform much better.

On the github page, benchmark give result in s/token:

8 tokens in 261.5 s, 32.69 s/token average



Nothing special with running a model on CPU alone and this:
For years, the AI community has largely believed that trillion-parameter models inevitably require enormous GPU clusters and vast amounts of memory.

Is ridiculous, no, no one ever thought that if you want to run them at 0.05 token per second... same goes for playing 3d video game on cpu alone if you do not mind 0.1 fps cpu are turing complete of course everything binary machine code could be made to be run on them, and even when they are using 124 core of epyc cpu it is extremelly slow in token/second with giant latency over it (considering CPU silicon is so much costlier than GPU silicon not sure what the goal here, everything gpu can do they should obviously be the one doing it.... maybe cheaper system memory, but gpu having fancy memory is purely a choice you could put cheap memory on gpu instead).

What's the difference between this and using distilled models?
This will give you the full model (evrey modern LLM use MoE they are still the full model), distilled are much smaller model in weight count.
 
Last edited:
Instead of asking how to load the entire model into RAM, they asked whether the entire model actually needs to be present in memory at every moment during inference.

That simple question completely changes the problem.
Does this mean I can have my commododized RAM prices again? Pleeeeeeease?
 
The lead is a bit burried here, it is 100% impraticable, just an experiment proof of concept, it is not running with token per second metric, but how many second it take to make a single token

Generating each token can take several seconds, and performance depends heavily on available RAM and storage speed. Machines with larger memory budgets and fast NVMe SSDs naturally perform much better.
Yep and this is something that you see with other models as well. Any mixture of experts type model and can have only the active part loaded in to RAM... but you will pay a performance penalty as you swap it in and out. It is the same thing you see with system RAM vs VRAM: You can totally let your stuff leak in to system RAM and it totally works, but the more of that you do, the more it has to cross the PCIe bus, the slower it is.
 
The lead is a bit burried here, it is 100% impraticable, just an experiment proof of concept, it is not running with token per second metric, but how many second it take to make a single token

Generating each token can take several seconds, and performance depends heavily on available RAM and storage speed. Machines with larger memory budgets and fast NVMe SSDs naturally perform much better.

On the github page, benchmark give result in s/token:

8 tokens in 261.5 s, 32.69 s/token average



Nothing special with running a model on CPU alone and this:
For years, the AI community has largely believed that trillion-parameter models inevitably require enormous GPU clusters and vast amounts of memory.

Is ridiculous, no, no one ever thought that if you want to run them at 0.05 token per second... same goes for playing 3d video game on cpu alone if you do not mind 0.1 fps cpu are turing complete of course everything binary machine code could be made to be run on them, and even when they are using 124 core of epyc cpu it is extremelly slow in token/second with giant latency over it (considering CPU silicon is so much costlier than GPU silicon not sure what the goal here, everything gpu can do they should obviously be the one doing it.... maybe cheaper system memory, but gpu having fancy memory is purely a choice you could put cheap memory on gpu instead).


This will give you the full model (evrey modern LLM use MoE they are still the full model), distilled are much smaller model in weight count.
Thanks for the analysis!

Would it still be cheap if you're using lower bandwidth memory? You still have Micron, Samsung, SK Hynix as the sole memory providers. They will only produce so much memory.
For data centers, lower bandwidth = fewer token/s = fewer customers supported.

I do think you have a point, though, if we had some GPUs that had memory, which Intel, Global Foundries and possibly others could develop memory for, you could take some of the pressure off.
But they're fabs may already be focused on things that they're better at.
 
Last edited:
The lead is a bit burried here, it is 100% impraticable, just an experiment proof of concept, it is not running with token per second metric, but how many second it take to make a single token

Generating each token can take several seconds, and performance depends heavily on available RAM and storage speed. Machines with larger memory budgets and fast NVMe SSDs naturally perform much better.

On the github page, benchmark give result in s/token:

8 tokens in 261.5 s, 32.69 s/token average



Nothing special with running a model on CPU alone and this:
For years, the AI community has largely believed that trillion-parameter models inevitably require enormous GPU clusters and vast amounts of memory.

Is ridiculous, no, no one ever thought that if you want to run them at 0.05 token per second... same goes for playing 3d video game on cpu alone if you do not mind 0.1 fps cpu are turing complete of course everything binary machine code could be made to be run on them, and even when they are using 124 core of epyc cpu it is extremelly slow in token/second with giant latency over it (considering CPU silicon is so much costlier than GPU silicon not sure what the goal here, everything gpu can do they should obviously be the one doing it.... maybe cheaper system memory, but gpu having fancy memory is purely a choice you could put cheap memory on gpu instead).


This will give you the full model (evrey modern LLM use MoE they are still the full model), distilled are much smaller model in weight count.

Also it requires storing terabytes locally on SSDs just to be that slow too (SSD speed, even fast SSD speed, is actually the bottleneck IIRC)
 
Last edited:
Also it requires storing terabytes locally on SSDs just to be that slow too (SSD speed, even fast SSD speed, is actually the bottleneck IIRC)
SSD speed is a huge bottleneck. These things are fucking massive and access needs to be extremely fast. Even if you had a perfect swap algorithm, it will still slow shit down a ton. I mean let's say you have the fastest nVME PCIe 5 drive you can get and it really does manage to push data to VRAM at 14GB/sec. Great, but then consider how big is your expert that you need to load? Let's say it isn't a huge, something like Nemotron 3 super, which has about 12 billion parameters activated at once and we'll say that you can cleanly load that in as needed. Ok... that's still about 1 second to load in if you've got an 8-bit quantization, 2 seconds if it is all BF16. So every time you have to load in a new 12B parameters, your tokes per second goes down to zero for a second or two as this loads in. Depending on how often you have to do that, it'll REALLY hit your throughput.

It would be one thing if it could be designed such that you were able to figure out just a subset of the model that was needed and ONLY that subset for a query, and load that, but that isn't how it works. It can bounce back and forth between what parts different things activate. If those are being swapped in and out, that is going to cost you a lot of performance.

That's the issue with these things and RAM: Because of how they do their calculations, they need assloads of RAM speed. So for high tokens/sec only GPU type RAM speeds will do. The 1.5TB/sec of RAM speed on the 5090 sounds silly until you try something like this and discover that it can be the limiting factor, not the GPU itself. Also, they use a TON of parameters, with a "parameter" meaning "a 16-bit floating point value, or compressed version thereof". Even if you quantize it down to 4-bit, that's still 1-byte per two parameters so you can see how it gobbles space when things like Kimi K3 are "2.8 trillion parameters."
 
I do think you have a point, though, if we had some GPUs that had memory, which Intel, Global Foundries and possibly others could develop memory for, you could take some of the pressure off.
But they're fabs may already be focused on things that they're better at.
there is something to it and they are working hard on this.

Cerebras system do not use expensive HBM, on-chip sram combined with standard cheap ddr4-5 I think

Rubin has a lot of non-HBM memory going on has well, those system are a mix of "cheap" lpddr5 / gddr7, while also having state of the art hbm4, and now have s-ram on compute-die memory compute mix, has well, they have like 6 hierarchy of memory from HDD to HBM4, using samsung and other non state of the art TSMC provider
 
If I has a dime for every wrong answer, I could open a datacenter and generate billions.
 
SSD speed is a huge bottleneck. These things are fucking massive and access needs to be extremely fast. Even if you had a perfect swap algorithm, it will still slow shit down a ton. I mean let's say you have the fastest nVME PCIe 5 drive you can get and it really does manage to push data to VRAM at 14GB/sec. Great, but then consider how big is your expert that you need to load? Let's say it isn't a huge, something like Nemotron 3 super, which has about 12 billion parameters activated at once and we'll say that you can cleanly load that in as needed. Ok... that's still about 1 second to load in if you've got an 8-bit quantization, 2 seconds if it is all BF16. So every time you have to load in a new 12B parameters, your tokes per second goes down to zero for a second or two as this loads in. Depending on how often you have to do that, it'll REALLY hit your throughput.

It would be one thing if it could be designed such that you were able to figure out just a subset of the model that was needed and ONLY that subset for a query, and load that, but that isn't how it works. It can bounce back and forth between what parts different things activate. If those are being swapped in and out, that is going to cost you a lot of performance.

That's the issue with these things and RAM: Because of how they do their calculations, they need assloads of RAM speed. So for high tokens/sec only GPU type RAM speeds will do. The 1.5TB/sec of RAM speed on the 5090 sounds silly until you try something like this and discover that it can be the limiting factor, not the GPU itself. Also, they use a TON of parameters, with a "parameter" meaning "a 16-bit floating point value, or compressed version thereof". Even if you quantize it down to 4-bit, that's still 1-byte per two parameters so you can see how it gobbles space when things like Kimi K3 are "2.8 trillion parameters."
I don't think this is for regular Joe Schmoe at home, more for small and medium sized businesses. A decent server backed by a decent ZFS installation for instance could meet these requirements if you knew what you were doing. I do agree this type of model wouldn't be great for bleeding edge, but a bunch of people who ask "What time is it?" or "When is the next meeting?" would be devoured by most systems that utilize this model backed by your standard COW storage system. In many ways it's almost built for it. That saves TONS of money to stratify local AI on prem vs cloud AI meant for bigger/complex workloads.
 
Last edited:
Back
Top