Matching Model Size, Format and Context to Your Machine

Someone picks up a new AI box with a large pool of memory, or finally installs a second GPU, and the fun part starts: which model should run on it? The usual approach is trial and error, downloading one model after another and reading forum posts that each recommend something different. People often ask whether there are benchmark or comparison sites that settle it.
There are useful leaderboards, but none of them know your machine or your tasks. Community recipes help too, such as published launch settings that get a specific new model running fast on a specific box, but a recipe tuned for one model does not tell you whether that model is right for you.
This article gives a repeatable method instead. You will estimate what fits in memory, understand how quantization, context and model architecture change that estimate, predict roughly how fast it will run, and then choose between the candidates with a short test on your own prompts.
Frequently asked questions
What decides whether a model fits?
Weights at your chosen precision, plus the KV cache for your context and number of users, plus some overhead for the engine and activations. If the sum is below your usable GPU or unified memory, it fits at full speed.
How much memory do the weights need?
Roughly parameters times bytes per parameter. At 16-bit precision that is about two bytes per parameter, at 8-bit about one, at 4-bit about half a byte, plus a small extra for quantization scales. A 30B model at 4-bit needs on the order of 16 to 18 GB for weights alone.
What is quantization?
It stores weights with fewer bits, trading a little accuracy for much less memory and often faster generation. Moderate 4-bit to 6-bit quantizations are a common sweet spot; very low bit levels save more memory but can noticeably hurt quality.
How do mixture-of-experts models change the choice?
All experts must be stored, so memory needs follow total parameters. But only the active experts are computed per token, so speed follows active parameters. That makes large sparse models attractive on machines with lots of memory but modest bandwidth.
Are public leaderboards useful?
Yes, as a filter. They show which models are strong in general and help narrow the list. They cannot tell you how a model handles your language, your domain or your output format, so they should not be the final word.
Which matters more on unified-memory systems: size or speed?
Usually speed becomes the constraint first. These systems can hold very large models, but memory bandwidth is lower than on high-end discrete GPUs, so dense large models generate slowly. Sparse models with few active parameters tend to suit them best.
Should I pick the largest model that fits?
Not automatically. The largest model may leave no room for context, run too slowly for interactive use, or offer little gain on your tasks. A slightly smaller model with headroom is often the better daily driver.
How often should I revisit my choice?
Whenever a notable new model family appears, or your workload changes. Open model releases are frequent, and a model that was the best fit a few months ago may have been overtaken.
Start with your workload, not the model list
Before browsing models, write down what you will use the machine for. A chat assistant, a coding agent, document summarisation, creative writing and structured extraction all favour different models and settings. So do language: a model that excels in English may be mediocre in your users' language.
Also note how you will use it. One person chatting needs fast single-stream speed. An agent that fires many calls needs concurrency and fast prompt processing. A nightly batch job can tolerate slow generation as long as quality is high.
Collect ten real prompts
Pick ten prompts from your actual work, each with a short note on what a good answer must include. You will use them at the end to compare finalists, and they are far more informative than generic benchmarks.
Decide the context you really need
Many people set very long contexts by default and then wonder why nothing fits. If your prompts rarely exceed a few thousand tokens, say so in your plan; it frees a lot of memory.
Work out your usable memory
On a discrete GPU, usable memory is the card's VRAM minus a little for the driver and display if the card also drives a monitor. On multiple GPUs, it is roughly the sum, minus overhead for splitting the model. On unified-memory systems, the operating system and your other applications draw from the same pool, so plan for less than the headline figure.
Leave headroom. Engines need memory for activations and buffers, and long prompts can spike usage. Aim to fill no more than about 85 to 90 percent of usable memory with weights and cache combined.
System RAM as an overflow
Tools based on llama.cpp can place some layers in system RAM. That lets oversized models run, but every layer outside fast memory slows generation. Treat overflow as a way to try a model, not as a long-term plan.

Estimate weights, cache and overhead
A rough estimate is enough to filter candidates before downloading tens of gigabytes. The script below adds weights at a chosen bit width, a KV cache estimate from the model's configuration and a fixed overhead. Plug in values from each model's configuration file.
The example values are illustrative only. For exact cache sizes on a particular architecture, see the KV cache article, which explains how layers and key-value heads affect it.
Read the configuration file
Model repositories include a configuration with the number of layers, attention heads, key-value heads and hidden size. Those numbers, not the marketing name, tell you how large the cache will be.
Quantized cache halves the cache term
If your engine supports 8-bit KV cache, set the bytes per element to one in the estimate. That often makes the difference between a 16K and a 32K context on the same card.
def fits(params_b, bits, layers, kv_heads, head_dim, ctx, users=1,
kv_bytes=2, overhead_gb=2.0, usable_gb=24.0):
weights_gb = params_b * 1e9 * bits / 8 / 1e9 * 1.05 # +5% for scales
kv_gb = layers * kv_heads * head_dim * 2 * kv_bytes * ctx * users / 1e9
total = weights_gb + kv_gb + overhead_gb
return round(weights_gb, 1), round(kv_gb, 1), round(total, 1), total <= usable_gb * 0.9
# illustrative: 32B dense model, 4-bit, 64 layers, 8 KV heads, head size 128
for ctx in (8_000, 16_000, 32_000):
print(ctx, fits(32, 4, 64, 8, 128, ctx))Predict speed from bandwidth
Once a model fits, generation speed for one user is roughly limited by memory bandwidth divided by the bytes read per token. For a dense model, that is about the size of the weights. For a mixture-of-experts model, it is the size of the active parameters plus shared layers.
This simple ratio explains why a dense 70B model can feel sluggish on a large unified-memory system while a sparse model with far more total parameters but few active ones runs briskly. The article on active parameters explains the naming that tells you which is which.
Treat the estimate as a ceiling
Real speeds are lower than the theoretical bandwidth limit because of overheads, attention computation and imperfect kernels. Still, the ratio between two candidates on the same machine is usually predicted well.
Prompt speed follows compute
If your workload sends long prompts, also consider compute. Prefill runs on tensor cores and benefits from newer GPUs and multi-GPU splits far more than generation does.

Using leaderboards and community recipes well
Leaderboards are good at one thing: telling you which recent models are broadly competitive at a given size. Use them to build a short list of three or four candidates that fit your memory and speed estimates.
Community launch recipes are good at another: getting a specific model running efficiently on specific hardware, with the right engine version, quantization and flags. When a new model arrives, someone has often published settings that reach good speeds on a popular box within days. Use those to avoid configuration pain, not to choose the model.
Beware single-number claims
Claims that a small model matches a much larger one usually rest on one benchmark. Your ten prompts will tell you whether that holds for your work.
- Filter leaderboard results to models you can fit at a sensible quantization.
- Prefer models with active maintenance and an open licence that suits your use.
- Check that your engine supports the architecture before downloading.
- Look for recipes from people with the same hardware, and note their engine version.
Run a short bake-off
With two to four finalists, run your ten prompts through each with identical settings. Score each answer against your notes, ideally without looking at which model wrote it. Record speed and any formatting failures.
Include one or two hosted models in the bake-off as reference points. They tell you whether a local model is close to what a larger model would do, and whether paying for a commercial API would make a meaningful difference on your tasks.
Score with a simple scale, such as zero for unusable, one for acceptable with edits and two for ready to use. Add a column for speed and another for formatting failures. A spreadsheet with ten prompts and three or four models fits on one screen and makes the decision almost obvious. If two models tie, prefer the one that leaves more memory headroom or runs faster, because day-to-day comfort matters more than a small edge on one prompt.
About the hosted reference
The hosted entry uses free-ai, an independent open-weight model of about 35B parameters, served keyless at https://api.apifreenvidia.com/v1. This site is not affiliated with NVIDIA, and the model is not an NVIDIA model. Requests are limited to one per second per IP, so the sequential loop above suits it well.
from openai import OpenAI
CANDIDATES = {
"local-a": ("http://localhost:8000/v1", "model-a"),
"local-b": ("http://localhost:8001/v1", "model-b"),
"hosted-ref": ("https://api.apifreenvidia.com/v1", "free-ai"),
}
prompts = [line.strip() for line in open("prompts.txt", encoding="utf-8") if line.strip()]
for name, (url, model) in CANDIDATES.items():
client = OpenAI(base_url=url, api_key="none")
with open(f"answers-{name}.txt", "w", encoding="utf-8") as out:
for p in prompts:
r = client.chat.completions.create(
model=model, messages=[{"role": "user", "content": p}],
temperature=0.2, max_tokens=800,
)
out.write(f"### {p}\n{r.choices[0].message.content}\n\n")
Special considerations for unified-memory boxes
Large unified-memory systems change the usual trade-off. Capacity is plentiful, so models that would need several discrete GPUs fit on one device. Bandwidth is more limited, so dense large models generate slowly. Sparse mixture-of-experts models with modest active parameters tend to be the sweet spot.
These systems also run a different CPU architecture on some platforms, which can affect which engine builds and containers are available. Check that your chosen engine provides images for your platform before settling on a model that only one engine supports.
Mixing roles across machines
Some owners keep a fast discrete GPU for instant chat and a unified-memory box for a larger, slower model used for planning or agent work. Matching each model to the machine whose strengths suit it is often better than finding one model for everything. The comparison of fast GPUs and big-memory boxes looks at that split.
Living with your choice
Once you pick a model, keep the prompt set and the scoring notes. When a new model appears, you can run the same bake-off in an hour and know whether it is worth switching. That habit beats chasing every announcement.
Record the exact model file, quantization, engine version and launch flags that work. Performance and even output quality can change between engine versions, and a written record makes regressions easy to spot.
When no local model is good enough
Sometimes the bake-off shows that none of the models you can run handle your hardest tasks well. That is useful knowledge: route those tasks to a stronger hosted model and keep the local one for everything else.

Send a prompt from the chat box on the home page: no key, no account and no card, just a quick look at how free-ai answers.