New Tool Radar

AI Concepts

How to Estimate a Quantized Model File Size from Bits per Weight

Estimate a quantized model file size with one formula: parameters times bits per weight divided by 8.

Schematic illustration of estimate a quantized model file size from bits per weight: step one count the parameters, step two find the bits per weight, step three apply the formula.

The rule of thumb for GGUF file size is simple: file size in gigabytes is approximately the parameter count in billions times the bits per weight, divided by 8. It works because each weight is stored in that many bits, and 8 bits make a byte. Use it before downloading, so you know whether the file fits your disk and memory.

Prerequisites

  • The model’s parameter count in billions.
  • The bits per weight for the quantization level, from the llama.cpp figures.
  • A calculator.

Steps

Step 1: Count the parameters

Read the parameter count from the model card: 7B means 7 billion parameters, 13B means 13 billion. Use the full count, not a rounded marketing number, where the card gives it.

Step 2: Find the bits per weight

Find the level’s real bits per weight: Q4_K_M is 4.89, Q5_K_M is 5.70, Q8_0 is 8.50, measured on Llama 3.1 8B. The name alone understates it, because the per-block scales take space.

Step 3: Apply the formula

Multiply parameters by bits per weight and divide by 8. Compare the result with the published file size; a small difference is normal, because metadata and the tokenizer add a little.

Worked example: Three models at Q4_K_M and Q8_0

The table below applies the formula to three fictional download choices, using 4.89 bits per weight for Q4_K_M and 8.50 for Q8_0.

Model Level Calculation Estimated size
7B model Q4_K_M 7 x 4.89 / 8 4.28 GB
13B model Q4_K_M 13 x 4.89 / 8 7.95 GB
1B model Q8_0 1 x 8.50 / 8 1.06 GB

The estimates are 4.28 GB, 7.95 GB and 1.06 GB, and each follows the same formula, so the reader can repeat it for any model and level.

Expected result. You can estimate any GGUF file size from its parameter count and level before downloading it. UNTESTED: this guide was not run against a live model or API. The worked example below is fictional practice material, and its result is the expected result, not a measured one.

Limits

  • The formula estimates the weights only; metadata, tokenizer and the file header add a small amount.
  • Bits per weight varies slightly by model, so treat the estimate as approximate, not exact.
  • This guide does not cover the memory the model needs while running, which includes the KV cache.

Sources

See all