LLM Weight Packing Calculator: Minimum Packed Bytes – Free

This LLM weight packing calculator returns the smallest buffer that can hold a set of model weights when every weight is stored as a fixed-width bit field with no gaps.

How to use the LLM weight packing Calculator tool

  1. Enter how many weights the tensor or model has in the Number of values field.
  2. Enter the width of one packed weight in bits in the Bits per value field.
  3. Select Calculate. The Example button packs 1048576 weights at 4 bits, which gives 524,288 bytes.
  4. Read the minimum size in bytes and MiB, then repeat for each tensor that uses a different width.
  5. Select Copy to copy the figures into your size budget.

LLM weight packing and the minimum packed size

A language model is a collection of weight matrices: attention projections, feed-forward layers, embeddings. After quantization each weight is a small integer, and a bit-packed layout stores those integers one after another using exactly the chosen number of bits. The minimum size of that layout is ceil(weights x bits / 8) bytes, and this is the number the tool reports.

It is a floor, not a file size. Fixed-width fields cannot be stored in less space without entropy coding, and practical formats add alignment and quantization parameters on top. The arithmetic runs in the page from the two numbers you enter, so no model file is needed.

Worked example: one 4096 x 4096 projection matrix

A square projection in a model with a hidden size of 4096 has 16,777,216 weights. The lines below show its minimum packed size at four widths. Going from 16 bits to 4 bits saves 24 MiB for this single matrix, and a model has several such matrices in every layer.

16777216 weights at 16 bits  ->  33,554,432 bytes (32 MiB)
16777216 weights at 5 bits   ->  10,485,760 bytes (10 MiB)
16777216 weights at 4 bits   ->  8,388,608 bytes (8 MiB)
16777216 weights at 3 bits   ->  6,291,456 bytes (6 MiB)

Packing a whole model tensor by tensor

Quantized models rarely use one width everywhere. A common pattern gives most matrices 4 bits, keeps a few sensitive ones at 5 or 6, and leaves embeddings at 8 or 16. Because the calculator takes a single width per run, handle such a model in passes.

If you only know the total, a single run still gives a useful bound. A model with 7,241,732,096 weights needs at least 3,620,866,048 bytes at 4 bits and 4,526,082,560 bytes at 5 bits.

  • Sort the tensors by bit width and add up the weight count for each width.
  • Run the calculator once per width and note the bytes.
  • Add the results. The sum is the minimum packed payload of the model.
  • Divide total bits by total weights if you want the average bits per weight.

Odd widths: 3, 5 and 6 bits per weight

Widths that do not fill a byte evenly are where bit packing pays off. Without packing, a 5-bit weight would sit in an 8-bit slot and waste three bits in every byte. Packed, 2,048 five-bit weights take 1,280 bytes instead of 2,048. The price is decoding work: a weight can straddle two bytes, so the reader has to shift and mask instead of indexing an array.

Frequently asked questions

How many bytes do 4-bit LLM weights take?

Half a byte each, so the minimum is the weight count divided by two, rounded up. The built-in example of 1,048,576 weights packs into 524,288 bytes, which is 0.5 MiB.

Why is this a minimum and not the actual file size?

The figure counts weight bits only. Real model files also store a scale for each group of weights, tensor names and shapes, and padding that aligns each tensor to a convenient boundary. Those additions depend on the format.

Can I enter a total like 7 billion in short form?

No. Number of values must be written out in digits, for example 7000000000. Suffixes, commas and exponent notation cause the error Count must be a positive whole number of up to 24 digits.

Does it support widths below 2 bits?

Yes, the smallest width is 1 bit, which fits binarized weights. Fractional averages such as 1.58 bits cannot be entered, because the field requires a whole number and the calculation assumes every weight uses the same fixed-width slot.

How is this different from the Quantized model size Calculator?

Both pages use the same arithmetic and print the same five lines. This guide is about the packed layout of individual weight tensors. The model size guide covers whole-model estimates and the overhead that sits on top of the packed weights.

Related tools