Skip to content
Future SliceFUTURE SLICE / Deep Reads
Back to articles

How Much Memory Does a 7B Model Need? Start with the Weights

Deciding that a GPU can run a model just because its description says “7B, 4-bit” can overlook other memory needs. You can estimate weight size by hand, but weights are only part of the inference system. Keeping theoretical size separate from peak runtime usage makes hardware decisions clearer.

Editorial note · AI-assisted

AI-assisted original explainer; sources are listed at the end. Worked examples and exercises were not run unless marked as tested. Diagrams are AI-generated. The cover is an editorial photo.

AI-assisted editorial · Translated from Chinese

A close photograph of a circuit board and its chips.
Photograph

Start with a simplified estimate of weight size:

Weight size in bytes ≈ number of parameters × bits per parameter ÷ 8.

Taking 7B to mean approximately seven billion parameters gives these theoretical figures:

Weight precisionTheoretical weight size, in decimal GB
16-bitAbout 14GB
8-bitAbout 7GB
4-bitAbout 3.5GB

These are arithmetic estimates, not measured VRAM usage for a particular model. A real implementation also includes quantization metadata, unquantized layers, working buffers, activations, and the KV cache. Conversion between GB and GiB also produces differences in the numbers.

Hugging Face's documentation describes loading lower-precision weights with bitsandbytes, along with relevant compute types and implementation requirements. The actual benefit depends on the model and how it runs. Read the documentation

If you are choosing hardware, first fix three conditions: the model and quantization version, the longest input, and the number of requests handled concurrently. Then measure peak memory, time to first token, and generation speed under those conditions. Parameter count alone misses how you actually intend to use the model.

VISUAL NOTE
Translucent file slices pass through an inspection gate to a compute chip and separate memory modules, illustrating a local inference path.
AI-generated concept illustrationLook at the whole memory budget

Try it

List the models you plan to run and calculate the theoretical weight size of each. Add four columns to your test sheet: input length, concurrency, peak memory, and speed. Leave entries blank for models you have not run; do not record theoretical estimates as measurements.

If you only process one article a day, comparing the total cost of a remote API with local hardware should also include equipment purchases, idle time, electricity, and maintenance.

EXPLAINED IN SLICES

Look at the whole memory budget

  1. Weights

    What is actually loaded

  2. KV cache

    Context and concurrent requests

  3. Runtime

    Buffers and other allocations

Editorial diagramThese are categories, not measured proportions. Active parameter count describes computation; it does not by itself specify the memory you need.

Which local model fits?

Available memory and task needs matter more than parameter counts alone.

Which model earns its place in this task?

Public rankings offer clues; your tasks and acceptance criteria determine the choice.

Share this articleXSubscribe with RSSThe Weekly Slice
Was this useful?
Loading likes…

Original references

参考文档huggingface.coReference 1