Running 70B Parameter Models on Consumer Hardware: VRAM Math and MoE Strategies

Running 70B Parameter Models on Consumer Hardware: VRAM Math and MoE Strategies

A developer buys a workstation with a single 24 GB graphics card and 64 GB of system RAM, downloads a 70-billion-parameter model that a forum thread called "fine on consumer hardware", and starts it. The loader reports that it is offloading part of the model to the CPU. The first answer arrives at roughly the speed of someone typing with two fingers. The developer concludes either that the card is defective or that the forum was lying. Neither is true. The machine is doing exactly what its memory system allows, and the arithmetic that predicts the result fits on a napkin.

This article gives you that arithmetic. It covers how many bytes the weights take at each precision, how the context cache grows, why generating text is limited by memory bandwidth rather than compute, how to split a model between GPU and CPU and what that costs, and why mixture-of-experts models change the calculation. All the formulas below are standard, and the numbers are computed from them rather than measured, so treat them as ceilings that real software approaches but does not reach.

1. Weights: the first number you must get right

A dense model stores one number per parameter. The memory needed for weights is the parameter count times the bytes per parameter, which is the bit width divided by eight. For a 70-billion-parameter model that gives the following sizes, in decimal gigabytes:

  • 16-bit floating point (FP16 or BF16): 70e9 × 2 bytes = roughly 140 GB.
  • 8-bit: roughly 70 GB.
  • 4-bit: roughly 35 GB, and in practice somewhat more, as explained next.
  • 2- to 3-bit schemes: roughly 18 to 26 GB, with a visible quality cost that depends on the method and the model.

The real files are larger than the idealised figure because quantisation formats store extra metadata. Block-wise schemes keep a scale (and sometimes a minimum) for each small group of weights, and popular "K-quant" mixes keep a few sensitive tensors, such as embeddings and the output layer, at higher precision. A file labelled as a 4-bit mix of this kind typically works out to roughly 4.5 to 5 effective bits per weight, so a 70B model lands somewhere around 40 to 43 GB. Check the actual file size on the download page; it is the most reliable number you will get.

What quantisation costs you

Quantisation trades precision for size. At 8 bits the quality loss is usually very small. At 4 bits it is small for most models and tasks, and noticeable on some, such as long multi-step reasoning, precise arithmetic and rare-language text. Below 4 bits the degradation grows quickly. The effect varies by model and by method, so the honest procedure is to run your own evaluation prompts at two adjacent quantisation levels before committing to the smaller one. Larger models tend to tolerate aggressive quantisation better than small ones, which is why a 4-bit 70B model often beats an 8-bit 13B model at the same memory budget, but "often" is not "always".

2. The KV cache: the number that grows while you use it

Weights are fixed. The key-value (KV) cache is not. Every token in the context stores a key vector and a value vector for each attention layer, so that later tokens do not recompute them. The size per token is:

kv_bytes_per_token = 2 × layers × kv_heads × head_dim × bytes_per_element

The factor 2 covers keys and values. For a Llama-3-70B-style architecture, the published configuration is 80 layers, 8 key-value heads (grouped-query attention) and a head dimension of 128. At FP16 that is 2 × 80 × 8 × 128 × 2 bytes = 327,680 bytes, or 320 KiB per token. Multiply by context length:

  • 8,192 tokens: about 2.5 GiB.
  • 32,768 tokens: about 10 GiB.
  • 131,072 tokens: about 40 GiB.

Two points follow. Grouped-query attention is why this is manageable at all: with one key-value head per query head (64 instead of 8 in this architecture) the cache would be eight times larger. And a long context can cost as much memory as the quantised weights, which is why "it fits" at a short context and "it crashes" at a long one are the same model on the same machine. Always read the layer count, KV-head count and head dimension from the model's configuration file rather than assuming a family-wide value, because they differ between models of the same nominal size.

Most runtimes let you store the cache at 8-bit instead of 16-bit, which roughly halves it at a small quality cost that usually matters less than quantising weights. Add compute buffers and runtime overhead on top: plan for about one to a few gigabytes beyond weights plus cache, more with large batch sizes.

Memory budget rule of thumb: total = weights file size + KV cache for your real context length + 1 to 3 GB of overhead. Leave headroom for the operating system and the display if the same GPU drives your monitor.

3. Why generation speed is set by memory bandwidth

Text generation has two phases with different bottlenecks. Prefill processes your prompt in parallel: many tokens at once, large matrix multiplications, limited mainly by compute. Decode produces one token at a time, and for each token the processor must read essentially every weight in the model once (the cache is read too). With so little arithmetic per byte read, decode is limited by how fast bytes can be streamed from memory:

decode_tokens_per_second ≤ memory_bandwidth / bytes_read_per_token

For a dense model, bytes read per token is about the size of the weights. This single inequality explains most real-world observations. Some public bandwidth figures, with the caveat that you should check your exact part:

  • High-end consumer GPUs with GDDR6X: on the order of 900 to 1,000 GB/s (the 24 GB cards of the last two generations are in this range).
  • Dual-channel DDR5 desktop memory: roughly 80 to 100 GB/s theoretical, depending on speed.
  • Apple silicon unified memory: from roughly 100 GB/s on base chips to several hundred GB/s on the Max tier and up to around 800 GB/s on the largest Ultra parts.

Divide a 40 GB model by those figures and you get ceilings of about 25 tokens per second on a 1 TB/s GPU, about 2 tokens per second from desktop DDR5, and somewhere in between for unified memory. Real throughput is below the ceiling because of kernel efficiency, cache reads and scheduling, but the ordering never changes. This is also why a bigger quantisation can be faster than expected relative to its quality: fewer bits per weight means fewer bytes to stream.

Prefill is a different problem

Because prefill is compute-bound, long prompts hit CPU offload far harder than decode does. A GPU does matrix multiplication orders of magnitude faster than a desktop CPU, so layers left on the CPU dominate the time to first token on a long prompt. If your workload is "paste a large file, ask a short question", prefill speed matters more than decode speed, and you should weigh hardware accordingly.

4. A worked example: 70B at 4 bits on a 24 GB GPU plus system RAM

Take a 4-bit 70B file of about 42 GB, 80 layers, a context target of 8,192 tokens with an 8-bit cache (about 1.25 GiB), a 24 GB GPU and 64 GB of DDR5.

  1. Budget the GPU. Reserve about 2 to 3 GB for the cache, compute buffers and the desktop. That leaves roughly 20 to 21 GB for layers.
  2. Per-layer size. 42 GB / 80 layers = about 0.52 GB per layer (the embeddings and output layer make the split slightly uneven, but this is close).
  3. Layers on GPU. 20 GB / 0.52 = about 38 layers on the GPU, 42 on the CPU.
  4. Bytes per token. About 20 GB read from VRAM and 22 GB from system RAM.
  5. Time per token. 20 GB / 1,000 GB/s = 0.02 s; 22 GB / 90 GB/s = 0.24 s. Total about 0.26 s, so a ceiling near 4 tokens per second.

The shape of that result is the important part. The GPU contributes under 10 percent of the time; the CPU-resident half contributes over 90 percent. Adding a second identical GPU would not double speed; it would move all 42 GB onto cards (with some room to spare at this context length), and the ceiling would jump to roughly 25 tokens per second or more, a several-fold improvement from a "twice the VRAM" change. The reverse also holds: if the model is partly offloaded, a small increase in the number of GPU layers helps less than you expect until you cross the threshold where nothing is left on the CPU.

5. Hardware options compared

The table compares common ways to run a 4-bit 70B model. It is qualitative: it describes where each option is limited, not how many tokens per second you will measure.

Setup Fits 4-bit 70B? Decode limited by Prefill speed class Main trade-off
One 24 GB GPU + system RAM Only with CPU offload System RAM bandwidth for offloaded layers Good for GPU layers, poor for CPU layers Cheapest entry; slow generation
Two 24 GB GPUs Yes, with limited context headroom GPU memory bandwidth (and interconnect for some splits) Good Power, cooling, case and PCIe lanes; multi-GPU software setup
Unified-memory workstation (64 GB or more) Yes Unified memory bandwidth, which varies widely by chip tier Moderate; below discrete high-end GPUs Quiet, simple, large capacity; slower per token than multi-GPU on lower tiers
CPU only, dual-channel DDR5 Yes, with enough RAM Desktop DDR5 bandwidth Slow No special hardware; usable for batch or overnight jobs
Single 48 GB workstation GPU Yes, but tight at long context GPU memory bandwidth Good Highest simplicity; high price per card

One consequence: if you are shopping rather than reusing, memory capacity and memory bandwidth matter far more than headline compute figures for this workload, and the two are not interchangeable. A large pool of slow memory lets the model load and run slowly. A small pool of fast memory refuses to load it at all.

6. Mixture-of-experts: big on disk, small per token

A mixture-of-experts (MoE) model replaces each feed-forward block with many parallel "experts" and a router that picks a few of them for each token. Publicly documented examples include Mixtral 8x7B, which has roughly 47 billion parameters in total but activates roughly 13 billion for any given token. The consequence for memory is asymmetric:

  • Capacity: all experts must be resident somewhere, because the router can pick any of them for the next token. Memory need scales with total parameters.
  • Bandwidth: only the chosen experts (plus attention and shared layers) are read per token. Decode cost scales with active parameters.

So an MoE model needs the RAM of a large model but streams like a much smaller one. That makes it a good match for machines with lots of cheap, slowish RAM and a modest GPU: put the attention layers, the router and shared tensors on the GPU, which are small and read every token, and leave the bulk of the expert weights in system RAM, where only a few are touched per token. Recent builds of llama.cpp expose this kind of placement through tensor-override options (and, in some versions, a dedicated flag for keeping expert tensors on the CPU); the exact option names change between releases, so read the help output of the version you have rather than copying a flag from an old post.

MoE has its own caveats. Expert selection can differ across tokens in a batch, so batched serving reads more distinct experts and loses some of the advantage. Quantisation interacts with routing in model-specific ways. And "active parameters" understates the work done during prefill, where many tokens collectively touch most experts. For single-user interactive decode, though, MoE is often the best capability per gigabyte of bandwidth available to a workstation.

7. Putting it together: an estimator and a launch command

The script below computes the memory budget from a model's configuration and a file size, and prints how many layers fit on a GPU. Every input is something you can read from the model card, its configuration file or the file listing.

#!/usr/bin/env python3
"""Rough memory planner for a dense, quantised LLM. Estimates only: measure on your machine."""
import argparse

GIB = 1024 ** 3


def kv_bytes_per_token(layers: int, kv_heads: int, head_dim: int, bytes_per_el: float) -> float:
    # keys + values for every layer
    return 2 * layers * kv_heads * head_dim * bytes_per_el


def main() -> None:
    p = argparse.ArgumentParser()
    p.add_argument("--file-gb", type=float, required=True, help="size of the quantised weights file (GB)")
    p.add_argument("--layers", type=int, required=True)
    p.add_argument("--kv-heads", type=int, required=True)
    p.add_argument("--head-dim", type=int, required=True)
    p.add_argument("--ctx", type=int, default=8192)
    p.add_argument("--cache-bytes", type=float, default=2.0, help="2.0 = fp16 cache, 1.0 = 8-bit cache")
    p.add_argument("--vram-gb", type=float, required=True)
    p.add_argument("--overhead-gb", type=float, default=2.5, help="buffers, desktop, runtime")
    p.add_argument("--gpu-bw", type=float, default=1000.0, help="GPU memory bandwidth, GB/s")
    p.add_argument("--ram-bw", type=float, default=90.0, help="system RAM bandwidth, GB/s")
    a = p.parse_args()

    cache_gb = kv_bytes_per_token(a.layers, a.kv_heads, a.head_dim, a.cache_bytes) * a.ctx / 1e9
    per_layer_gb = a.file_gb / a.layers
    free_for_layers = max(0.0, a.vram_gb - a.overhead_gb - cache_gb)
    gpu_layers = min(a.layers, int(free_for_layers / per_layer_gb))
    gpu_gb = gpu_layers * per_layer_gb
    cpu_gb = a.file_gb - gpu_gb

    seconds_per_token = gpu_gb / a.gpu_bw + cpu_gb / a.ram_bw
    print(f"KV cache at {a.ctx} tokens: {cache_gb:.2f} GB")
    print(f"Layers on GPU: {gpu_layers}/{a.layers}  ({gpu_gb:.1f} GB on GPU, {cpu_gb:.1f} GB on CPU)")
    print(f"Decode ceiling: about {1 / seconds_per_token:.1f} tokens/s (real speed will be lower)")


if __name__ == "__main__":
    main()

Run it for the example above and you get a ceiling in the neighbourhood of four tokens per second, matching the hand calculation. Then launch the runtime with settings that reflect the plan:

# llama.cpp server: flags shown are long-standing, but verify with --help for your build
llama-server \
  -m ./model-70b-q4.gguf \
  --n-gpu-layers 38 \
  --ctx-size 8192 \
  --flash-attn \
  --cache-type-k q8_0 --cache-type-v q8_0 \
  --threads 8 \
  --port 8080

Set the thread count near the number of physical cores, not hardware threads; hyper-threading rarely helps a bandwidth-bound loop and can hurt. Watch the loader output: it reports how many layers it placed on the GPU and how much memory each buffer took. If those numbers disagree with your estimate, trust the loader and find out why.

Other levers worth knowing

  • Speculative decoding: a small draft model proposes several tokens and the large model verifies them in one pass. It helps when the draft is accurate and the large model is bandwidth-bound; it costs extra memory for the draft.
  • Prompt caching: reusing the cache for a shared prefix removes repeated prefill, which matters most with offload.
  • Smaller context: halving the context window halves the cache. Many tasks do not need the maximum.
  • A smaller or better model: a recent mid-size model often matches an older 70B model on your task. Evaluate before you buy hardware.

8. Failure modes, and when not to run it locally

Know the ways this fails before you build on it:

  • Out-of-memory at long context. The model loads, the first short prompt works, and a long document crashes it because the cache grew. Budget for the longest context you will actually use.
  • Silent swapping. If the operating system pages model memory to disk, speed drops by one to two orders of magnitude without an error. Check that the weights stay resident and that nothing else is competing for RAM.
  • Thermal and power throttling. Sustained decode keeps the memory system saturated. Laptops and compact cases reduce clocks under that load, so a benchmark that lasts thirty seconds overstates a thirty-minute job.
  • Quality surprises from heavy quantisation. The model "works" and subtly degrades on your task. Keep a small fixed evaluation set and rerun it after every change of quantisation or runtime version.
  • Multi-GPU split overhead. Splitting across cards adds communication cost, and unequal cards leave the slower one setting the pace. Layer-wise splits tolerate slow interconnects better than tensor-wise splits.

And there are cases where running locally is the wrong answer. If you need many concurrent users, a hosted or datacentre-class deployment with batching will beat a workstation per dollar. If your workload is a few requests a day, an API call costs less than the hardware and your time. If you need the strongest available model, local open-weight models trail the best hosted ones on many tasks. Local makes sense for privacy-sensitive data, offline work, predictable cost at steady volume, and experimentation where you control every parameter.

9. Checklist, common mistakes and what to do on Monday

Before buying or downloading anything:

  1. Write down the context length you need, not the maximum the model supports.
  2. Read layers, KV heads and head dimension from the model configuration and compute the cache.
  3. Take the quantised file size from the download page and add cache plus 1 to 3 GB.
  4. Divide the weight bytes read per token by the memory bandwidth of the device that holds them. Do it for each tier if you split.
  5. Decide whether your task is decode-heavy (chat) or prefill-heavy (large documents), since it changes what to optimise.
  6. Compare against a smaller or MoE model on your own prompts before committing to 70B.

The most common mistakes are: trusting the parameter count alone and ignoring the cache; comparing GPUs by compute instead of memory bandwidth; assuming offloading "a little" costs a little, when the slowest tier sets the pace; benchmarking with a tiny prompt and a short run; and forgetting that the runtime, quantisation format and version all change the results, so numbers from an old post may not hold.

Short FAQ

Can I run 70B on 16 GB of VRAM? Only with most layers on the CPU, so expect low single-digit tokens per second at best, and a long wait on large prompts. A smaller model will serve you better for interactive use.

Is a Mac with lots of unified memory better than a PC with one GPU? For capacity, yes: the model fits in one memory pool. For raw speed, a multi-GPU PC usually wins at equal model size. The right answer depends on whether you are limited by fit or by speed.

Does a faster CPU help? For decode with offload, memory channels and memory speed help more than core count. For prefill on the CPU, cores and vector instructions matter.

What should I do first? Run the estimator with your real numbers, pick the model and context that fit, measure tokens per second and time to first token on three of your own prompts, and only then decide whether the hardware is enough.