OpenMetal AI Deployment Guides · Inference · The Explainer

How AI models work, and what it takes to run one on your own hardware

Before you can decide which server runs a given AI model, it helps to know the handful of ideas that govern the whole question: what a model actually is, why it takes the space it does, and what makes it fast or slow. This guide explains all of it in plain terms, with no background assumed.

This is about inference, the act of using a finished model to produce output, as opposed to training, the one-time process of building it. (Training writes the textbook; inference looks things up in it.) And specifically, it is about inference you run on your own hardware, rather than renting it from a public API where fit, precision, and memory are the provider’s concern and you pay per token.

Self-hosting means open-weight models, ones whose weights are publicly available to download and run: Llama, Qwen, Mixtral, DeepSeek, Gemma, Phi, FLUX, Whisper, and more. Every model discussed across these guides is open-weight and self-hostable on your own box. Licenses vary, though: most permit commercial use (many under permissive Apache or MIT terms), while a few are research or non-commercial only, so confirm the license for your use. The models reference lists the owner and license for every model.

Why this matters: when you own the box, your data never leaves your infrastructure, your cost is a predictable monthly figure with no per-token meter, and sizing the box correctly is the one thing standing between you and a working deployment. These guides teach how: this one explains the ideas, and the fit guide applies them to each box.

Scope: this set is about inference, running finished models. To change a model on your own data (fine-tuning), see the separate training guides.

Capacity, or “does it fit?”
GPU memory · total size · storage
Speed, or “is it fast?”
memory bandwidth · active size · throughput

Part 1 · The building blocks

Seven ideas, each building on the last

These are generic, true of any model on any hardware. Read them in order; each sets up the next. The first five explain what a model is and which number matters on which machine. The last two explain how serving actually behaves once a model fits.

01

Weights are the model

Under the hood a model is a huge collection of numbers arranged in grids. Each single number is a weight. When people say a model “is 70B,” they mean it holds 70 billion weights and literally nothing else. There is no hidden rulebook and no code full of “if the user asks X, say Y.” The entire behavior of the model lives in the specific values of those 70 billion numbers.

a picture · the mixing board

Imagine an impossibly large studio mixing board, not a few dozen knobs but 70 billion of them. Each knob is one weight, and its exact position is one number. Set the knobs one way and the board “knows” how to write Python; nudge thousands of them and it drifts toward writing poetry. The model is not a machine next to the knobs. The model is the particular positions of all 70 billion knobs, frozen in place.

Those positions are what training produced. You start with all the knobs random (the model babbles nonsense), show it an enormous amount of text, and every time it guesses the next word wrong an automatic process nudges the knobs toward a better guess. Do that trillions of times and the knobs settle into positions that produce fluent, useful output. Then you freeze them. That frozen configuration is the finished model, and downloading a model means downloading that list of final positions.

Using the model means feeding your text in, passing it through all those weighted connections (multiply, add, repeat, billions of times), and reading out the most likely next token. A token is roughly a word or word-piece, the unit models read and write in. The model then appends that token and runs the whole pass again for the next one, a word at a time. This process of using the trained model is inference, and two questions fall straight out of it: how much space do all those numbers take, and how fast can you move them through the processor. Those are the only two that decide your hardware.

02

Precision: how much space each weight takes

A weight is a number, and a number can be written with more or less exactness. That choice controls how much space the model takes. A weight might really be 0.1836274. You can store all of it, or round it to 0.184, or roughly to 0.2. Each rounding is smaller to store but slightly less exact. Precision is how much detail you keep per weight, and deliberately keeping less is called quantization. It is the main lever for making a large model fit a smaller box.

a picture · photo quality

Precision is like photo quality. FP16 is the full-detail file straight off the camera. FP8 is a high-quality compressed version, half the size, with a loss you genuinely cannot see. INT4 is a heavily compressed version, much smaller again, with mild fuzziness if you look closely. It is the same photo throughout; you are trading file size against fidelity. A quantized model is the compressed version of the same weights.

This works because most weights do not need their last few digits. The model’s behavior comes from billions of numbers working together, and small rounding errors tend to cancel out across the crowd. So you can shrink every weight and the model barely notices, right up until you shrink too far.

LabelBytes / weightQualityA 70B model takes
FP162Full precision, no visible loss~140 GB
FP81Half the size, loss you cannot see~70 GB
INT40.5Much smaller, mild loss under scrutiny~35 GB

FP means “floating point” (a decimal-style value); INT means “integer.” The number is the bit count: FP16 uses 16 bits (2 bytes) per weight, FP8 uses 8 bits (1 byte), INT4 uses 4 bits (half a byte). Fewer bits means coarser rounding and a smaller file. The same idea appears in CPU tools under the label Q4 (4-bit) or Q8 (8-bit).

weight memory ≈ (number of weights) × (bytes per weight)

Multiply it out and the stakes are clear: 70 billion weights at 2 bytes is about 140 GB, but only about 35 GB at INT4. The same model, a quarter of the footprint, purely from how precisely each weight is stored. That single fact decides half the fit calls you will see in the fit guide, where a table marking a model FP8 or INT4 only is naming the lowest precision you must drop to for that model to fit a given card. Any precision means the model is small enough that even full FP16 fits with room to spare.

03

The KV cache: the model’s memory of the conversation

There is a second thing taking up memory while a model runs, and it is the one that surprises people: the model’s running memory of the conversation so far, called the KV cache.

A model writes one token at a time, and to choose each new token it looks back at everything said so far. The naive approach would re-read the entire conversation from scratch for every new token, which gets slower with every word and quickly becomes unusable.

a picture · the meeting notepad

Think of someone taking minutes in a long meeting. Rather than re-read the whole transcript before writing each new line, they keep a running notepad of what has been said, glance at it, and add the next line. The KV cache is that notepad. As the model processes each word it jots down a compact summary (a Key and a Value, the “K” and “V”), and because those never change once written, it never re-reads the raw conversation.

why the tables care

The KV cache lives in the same memory as the weights, and unlike the weights it keeps growing: every new token adds a line to the notepad, and every extra simultaneous user needs their own notepad. So a GPU’s fixed memory is split two ways:

GPU memory = weights (fixed) + KV cache (grows with context and users)
A GPU's fixed memory is split between weights and KV cache. A small model leaves lots of room for KV cache; a large model leaves only a sliver.
A GPU’s memory is fixed. The weights take a set amount; whatever is left is the KV-cache notepad. A small model leaves room for long context and many users; a large one leaves only a sliver.

That is what the fit notes mean. Load a large model and the weights take most of the card, leaving only a sliver for the notepad:

  • “full context”: the weights are small, so there is plenty of room for a long notepad, meaning long conversations and many users.
  • “limited KV” or “tight KV”: the weights took most of the card, so little room is left, meaning shorter conversations and fewer concurrent users.
  • “image tokens eat KV”: a vision model turns each image into hundreds or thousands of tokens, so one picture fills pages of notepad and squeezes context hard.

“Context” is how long the prompt plus output is, measured in tokens. Longer context means a bigger notepad and more memory. This is why a model can fit yet still leave you only a small usable conversation window. All of these models are Transformers; the notepad exists because of a mechanism called attention, where each token looks back at every previous one.

04

Dense vs Mixture-of-Experts: two numbers hiding in “size”

So far “size” has been a single number: 70B means 70 billion weights, all used for every token. That is a dense model, and for it “how much to store” and “how much work per token” are the same number.

A Mixture-of-Experts (MoE) model breaks that, and it is the most important idea here, because it is why the same model can be a poor fit for a GPU and a great fit for a CPU. An MoE is split into many specialist sub-models called experts, with a small router that, for each token, picks just a couple of experts to do the work. The rest sit idle for that token.

a picture · the hospital of specialists

A dense model is one general doctor who personally handles every case; for every patient, the whole doctor shows up. An MoE is a large hospital of specialists. When a patient arrives, a receptionist (the router) sends them to just the two specialists they need, and everyone else stays in their offices. So two numbers now describe the same hospital: how many doctors you employ (you pay to house them all), versus how many actually see each patient (only two). A big hospital can give fast individual visits, as long as you can afford the building to house the entire staff.

Total size, every doctor on staff: how much you must store. All experts stay in memory, because the router might call any of them on the next token.

Active size, the doctors who see this patient: how much you must touch per token. Only the few the router fired. This is what costs time per word.

A dense model uses every weight for every token, so total equals active. A Mixture-of-Experts model stores all experts but a router fires only a few per token, so total is much larger than active.
A dense model fires every weight per token, so its total and active sizes are one number. An MoE stores every expert (total) but the router fires only a couple per token (active), so the two numbers pull apart.
ModelTypeTotal (store)Active / tokenReads like
Llama 3.1 405BDense405B405Ba 405B workload every token
DeepSeek-R1MoE671B~37Bstores like a 671B, runs like a ~37B
Mixtral 8x7BMoE46.7B~13Bstores like a 47B, runs like a ~13B

Look at the top two rows. DeepSeek-R1 is larger than Llama 3.1 405B on paper (671B vs 405B), yet does far less work per token (about 37B vs 405B) because it is MoE. The headline number and the per-token cost point in opposite directions. That is exactly why the two boxes disagree about which model is easy to run.

“8x7B” is MoE shorthand for “8 experts of about 7B each,” not 8 times 7. Shared layers make the real total 46.7B, and only about 2 of the 8 experts fire per token (about 13B active).

05

The key idea: which number binds, and why it flips

The two machines in play are the GPU (a chip with thousands of parallel cores, built for this kind of math, but with limited on-board memory) and the CPU (the general-purpose processor in every computer, fewer cores, but paired with large, inexpensive system memory). Two resources decide everything: capacity (where do all the weights physically live?) and bandwidth (how fast can you stream the ones you need into the cores, per token?). Every hardware decision comes down to which of these runs out first, and the GPU and CPU run out of different ones.

GPU: capacity is scarce, so total size binds

A GPU card has a small, hard memory ceiling: its on-board memory (VRAM) tops out at, for example, 141 GB. Its bandwidth is enormous, so space runs out long before speed does. Everything must physically fit in that memory: the weights plus the KV cache. The binding question is “how big is the thing I have to store?” and that is total size.

CPU: bandwidth is scarce, so active size binds

A CPU box has abundant system memory (the XL v5 has 1 to 2 TB), so everything fits and the capacity question drops out. What is scarce instead is memory bandwidth, the speed of the pipe from memory to the cores. Since generation streams weights per token, the binding question becomes “how many bytes must I move per token?” and that is active size.

tokens/sec ≈ memory bandwidth ÷ ( active size × bytes per weight )
On a GPU, capacity is scarce so total model size binds. On a CPU, memory bandwidth is scarce so active size binds. The same MoE model is penalized on the GPU and rewarded on the CPU.
The whole argument in one picture. A GPU runs out of capacity first, so the total size must fit; a CPU has room to spare but a narrow pipe to the cores, so the active size per token is what bites. That is why MoE flips between the two.

Now watch MoE flip. On a GPU, an MoE must load every expert into memory (the router can call any of them next token), so it pays its full total size and is penalized. On a CPU, that same MoE only touches its active experts per token while the plentiful memory holds the rest, so it is rewarded. Same model, opposite outcome:

MachineScarce resourceBinding number
GPU (H200 / RP6000)Capacity (on-board memory)Total size
CPU (XL v5)Bandwidth (memory to cores)Active size

On a GPU the total size is what bites; on a CPU the active size is what bites. MoE is the architecture where those two numbers differ, which is why it is penalized on the GPU and rewarded on the CPU.

06

Reading vs writing: prefill and decode

Every request runs in two phases that behave very differently:

  • Prefill: the model reads your entire prompt. Because all the prompt’s tokens are known, it processes them in parallel, in one pass. This is fast, limited by raw compute, not memory.
  • Decode: the model writes the answer one token at a time, and each new token streams the relevant weights through the processor again. This is serial, limited by memory bandwidth, and it is the slow part. It is what “tokens per second” measures.
a picture · reading vs writing a page

You can take in a whole page of text almost at a glance, which is prefill. But you can only write one word at a time, which is decode. This is why a large prompt is comparatively cheap to ingest, while a long answer is what actually costs you time.

Two earlier points now connect. “Image tokens eat KV” means an image becomes thousands of prompt tokens, a big prefill cost and a big chunk of notepad. And the whole CPU speed story is really a decode story: the bandwidth limit bites while writing tokens, so a model that decodes too slowly is a background-job model no matter how quickly it read the prompt.

07

One user or fifty: latency vs throughput

“How fast is it” is two questions, and sizing a box depends on which you mean:

  • Latency: how quickly a single response streams back for one user. This is what a live chat feels like.
  • Throughput: how many tokens the box produces per second across all users at once. This decides how many people you can serve on one machine.

The lever connecting them is batching. Because decode spends most of its time waiting on memory, a GPU can generate for many requests at the same time almost as cheaply as for one, so serving 20 users can cost barely more per user than serving one, up to a point. That greatly improves throughput and the economics of the box, but each simultaneous user needs their own KV-cache notepad, so batching spends the very memory the weights are already competing for.

a picture · the bus and the taxi

A taxi carries one rider quickly (low latency, low throughput). A bus makes each rider wait a little longer but moves far more people per hour (slightly higher latency, much higher throughput). Batching is running the bus, and the bus only has so many seats, which is the KV-cache limit.

So “many users” is really a throughput-and-batching question, and it trades directly against context length for the same memory. “Can one person chat with a 70B model?” and “can I serve my whole team on this box?” are different questions, and the second is usually the one that sizes the hardware.

Reference

Glossary and models reference

Every term used across these guides, plus the full table of models with owner and license, lives on the AI Deployment Guides hub.

Ready to match models to hardware?

The fit guide places every model on the H200, RP6000, and XL v5 CPU. Or talk to an OpenMetal engineer about benchmarking your target models on real hardware.

Open the fit guide Talk to an engineer

These explanations describe how models behave in general. Exact throughput on any box depends on your model, precision, context length, and concurrency; OpenMetal can benchmark your target models on request. See also the use-case guide for real workloads mapped to models and boxes.