What this is about
Every graphics card has its own memory, called VRAM. A model has to sit in that memory to run fast. When the model is bigger than the card, you have three choices: buy a bigger card, pick a smaller model, or find a way to keep part of the model somewhere else.
This article is about the third choice. We tried it with a 35 billion parameter model on a card with 24 GB. It works. It costs speed. Here is the real price, and what you should expect if you try the same at home.
Why it matters
Most people do not own a card with 80 GB. A 24 GB card is already a big one for a home computer. If you can only run what fits in VRAM, you are stuck with small models.
If you can run a bigger model at a lower speed, you gain a choice. Maybe you need the bigger model's answers more than you need the fast reply. Or maybe your card is shared with other programs, and the full model would not fit beside them.
The special trick: experts
The model in our test, RegesCore-35B, is a mixture-of-experts model. It has 256 small "experts" in every layer. For each token, a router picks the top 8. The other 248 sit idle for that token.
Think of a hospital with 256 specialists. A patient only sees 8. The rest wait. Most of the model's weight is in the experts, but only a few are used at one moment. That is the opening. The experts that are idle do not need to be in VRAM at all.
Our full weight pack for this model is 21 GB. The card holds 24 GB. That fits, but only just. A long conversation needs room for its working memory. A second model or a desktop window needs room too.
What we did
We built a version of our engine that keeps the shared parts of the model in VRAM, 2.68 GB of them, and leaves the 18.3 GB of expert weights in ordinary computer memory, called host RAM. When the router picks 8 experts, the engine checks a small cache in VRAM. If an expert is there, it uses it. If not, it fetches it from host RAM.
Two results from the first version:
- The output was identical to the full engine on 20 of 20 test prompts. Moving the weights changed nothing about what the model said.
- It was slow: 39 tokens per second, against 107 for the full engine in the same stretch of work.
The first version spent nearly all its time waiting for fetches, not doing math. On the first test prompt, 1.74 seconds of a 1.75 second decode went to waiting.
What speeds it up
We got the speed up in two steps, both measured.
Pinning the memory. Normal computer memory can be moved around by the operating system. If you "pin" it, the card can copy from it directly. That took us from 48.57 to 67.12 tokens per second with the same cache and the same output. The cost: 18.3 GB of host RAM is locked and nothing else can use it while the engine runs.
Reading from host RAM during the math. For two of the three kinds of expert layers, the kernel can read a missing expert straight from the pinned memory while it computes, instead of copying first. That took us to 72.02 tokens per second. Output stayed identical.
The same engine with the full 21 GB pack in VRAM reached 111.89 in a comparable run. So the tier runs at about two-thirds of the full speed. A cache of 64 slots, 4.5 GB, covered about 77% of the requests the model made in our replay. The cache policy was not the bottleneck. How the fetching was done was.
What to expect at home
Based on that one test:
- You can run a model that is a bit bigger than your VRAM. Our shared parts took 2.68 GB of the card. The rest lived in RAM.
- Expect a real slowdown. Ours lost about a third of its speed even after tuning. A plain version without tuning lost more than half.
- You need a lot of ordinary RAM. The experts have to live somewhere. We locked 18.3 GB of a 64 GB machine.
- It only works well with mixture-of-experts models. A dense model uses all of its weights for every token, so there is nothing idle to move out.
- Check the output. Our test compared answers to the full engine on 20 prompts. If you change where weights live, test that the answers stayed the same.
What we have not shown
Our model did fit on the card in full. We built the tier to learn what it costs, not because we had to. We have not measured this design on a model whose experts truly do not fit in 24 GB, because tracing how such a model picks its experts is unfinished work. Our numbers say "this is the price on a model that fits". They do not say "this is the price on a model that does not".
Words you may not know
- VRAM: the memory on the graphics card itself. It is fast and limited.
- Host RAM: the ordinary memory of your computer.
- Mixture of experts (MoE): a model made of many small experts, where only a few work on each token.
- Router: the part that picks which experts handle a token.
- Pinned memory: host RAM that is locked in place so the card can copy from it directly.
- Cache: a small fast store of the things you used most recently.
- tok/s: tokens per second, the speed of the model's writing.
Try it
Our engine, which runs this tier and the full version, is on the mojo-baro project page. The code is on GitHub. The repository keeps its test protocols in a bench/ folder so you can rerun each number.
If you try a big model on a small card, tell us what you saw at gllm.forum.
Read next
Experts in Host RAM has the full engineering account, including the two rounds of fixes after the first slow version.

Commenti
Ancora nessun commento.
Accedi per commentare.