LLM Parameter Count to Model Size: A Practical Estimation Guide

    Learn how to convert large language model parameter counts into estimated weight sizes across FP32, FP16, BF16, INT8, and INT4 formats. This guide explains GB versus GiB, file and quantization overhead, training checkpoint contents, and inference KV caches to help distinguish storage requirements from runtime memory needs.

    LLM Parameter Count to Model Size: A Practical Estimation Guide

    In large language model engineering, “parameter count” and “model size” are often used interchangeably, but they describe different things. Parameter count is the number of learnable weight elements in a model. Model size generally refers to the bytes occupied by weight files, checkpoints, or runtime data on disk, in system memory, or in GPU memory.

    Reliable capacity estimates require treating parameter count, numerical precision, storage units, and file contents as separate factors.

    1. Understand Three Basic Concepts

    Parameter count

    Parameter counts are commonly expressed in billions. A 130-billion-parameter model, for example, contains approximately (1.3 \times 10^{11}) weight elements.

    Parameter count describes the underlying scale of a model’s representational capacity and is an important starting point for estimating computation and memory requirements.

    Numerical precision

    The storage required per parameter depends on the format used to save it:

    • FP32: 4 bytes per parameter.
    • FP16 or BF16: typically 2 bytes per parameter.
    • INT8: 1 byte per parameter.
    • INT4: theoretically 0.5 bytes per parameter.

    Actual quantized files may also contain scale factors, zero points, group indices, and alignment padding. An INT4 file therefore does not necessarily occupy exactly one-quarter of the size of FP16 weights.

    Storage units

    Capacity estimates commonly use either decimal GB or binary GiB:

    [
    1\ \text{GB} = 10^9\ \text{bytes}
    ]

    [
    1\ \text{GiB} = 2^{30}\ \text{bytes}
    ]

    For a 130-billion-parameter model, FP16 weights occupy approximately 260 GB, or 242 GiB.

    Use a consistent unit when planning disk capacity, requesting system memory, or evaluating GPU memory. Otherwise, unit differences can lead to misleading estimates.

    2. The Basic Weight-Size Formula

    For a simplified estimate that includes only model weights and excludes metadata, alignment, indices, and additional quantization data:

    [
    \text{Weight size in bytes} \approx
    \text{Parameter count} \times \text{Bytes per parameter}
    ]

    Where:

    [
    \text{Bytes per parameter} =
    \frac{\text{Bits per parameter}}{8}
    ]

    For a 130-billion-parameter model, the theoretical weight sizes are:

    Weight format Bytes per parameter Theoretical weight size
    FP32 4 520 GB
    FP16 or BF16 2 260 GB
    INT8 1 130 GB
    INT4 0.5 65 GB

    The INT4 estimate excludes quantization scale factors and packing overhead.

    These figures represent theoretical weight-only baselines, not complete file-size or runtime-memory estimates. Model files may also include configuration data, vocabulary files, tensor indices, shard metadata, alignment padding, and version information.

    Very large models are often saved across multiple shards. Shard boundaries and alignment policies can introduce additional overhead.

    3. Why Training Checkpoints Are Larger Than Inference Weights

    Inference generally loads model weights along with runtime buffers. The weight component can therefore be estimated using parameter count multiplied by bytes per parameter, although total runtime memory requires additional accounting.

    Training is more complex. In addition to model weights, a training checkpoint may contain:

    • Gradients.
    • Optimizer states.
    • Master weight copies.
    • Checkpoint metadata.

    In a typical mixed-precision training setup, the model may maintain low-precision weights, FP32 master weights, first-moment estimates, second-moment estimates, and gradients.

    Exactly which items are saved depends on the training framework, parallelism strategy, and checkpoint configuration. Inference weight size alone is therefore insufficient for estimating training checkpoint size.

    As a rough illustration, saving low-precision weights, master weights, two moment estimates, and gradients can require well over 10 bytes per parameter. For a 130-billion-parameter model, such a checkpoint can reach terabyte scale. In practice, calculate the size of each saved component from the framework’s checkpoint configuration.

    Training GPU memory also includes activations, temporary buffers, communication buffers, and overhead associated with parallel sharding. Activation memory depends on batch size, sequence length, layer count, and attention structure. Activations are generally not all written to disk, but they can significantly affect per-GPU and per-node memory requirements.

    Model file size and training GPU memory requirements are different quantities.

    4. Account for the KV Cache During Inference

    Weights are only part of inference GPU memory usage. Autoregressive generation typically caches historical key and value states, known as the KV cache.

    KV cache size depends on:

    • Number of layers.
    • Attention head dimensions.
    • Sequence length.
    • Batch size.
    • Cache precision.

    With long contexts or high concurrency, the KV cache can become a substantial part of total GPU memory usage.

    For example, INT8 weights of approximately 130 GB do not imply that a single GPU with slightly more than 130 GB of memory can necessarily run the model efficiently. Capacity must also be reserved for the KV cache, runtime buffers, and memory fragmentation.

    5. Estimate Weight Size with Simple Pseudocode

    The following framework-independent example converts a parameter count into theoretical weight sizes at different precisions:

    1. function weight_bytes(parameter_count, bytes_per_parameter):
    2. return parameter_count * bytes_per_parameter
    3. function to_gb(byte_count):
    4. return byte_count / 1e9
    5. function to_gib(byte_count):
    6. return byte_count / (1024 * 1024 * 1024)
    7. parameter_count = 130_000_000_000
    8. for precision, bytes_per_parameter in [
    9. ("FP32", 4),
    10. ("FP16/BF16", 2),
    11. ("INT8", 1),
    12. ("INT4 theoretical", 0.5)
    13. ]:
    14. byte_count = weight_bytes(parameter_count, bytes_per_parameter)
    15. print precision, to_gb(byte_count), "GB", to_gib(byte_count), "GiB"

    This example calculates only the theoretical weight-only baseline. Engineering estimates should also account for file-format overhead, additional quantization data, shard indices, and checkpoint versioning.

    For training checkpoints, include optimizer states and gradients where applicable, or inspect the training configuration to identify exactly which components are saved.

    6. A Practical Capacity-Planning Workflow

    Use the following sequence when estimating capacity:

    1. Define the workload. Determine whether the model will be used only for inference or also for training, fine-tuning, or continued pretraining.
    2. Identify the saved weight precision. Confirm whether weights use FP32, FP16, BF16, INT8, or INT4.
    3. Calculate the weight-only baseline. Multiply parameter count by bytes per parameter.
    4. Add file-level overhead. Include metadata, sharding, alignment, quantization factors, and indices.
    5. For training, account for saved training state. Include gradients, optimizer states, and the chosen checkpoint strategy.
    6. For inference, account for runtime memory. Include the KV cache, runtime buffers, and headroom for concurrency.
    7. Separate disk, system memory, and GPU memory requirements. Do not treat them as a single capacity metric.
    8. Plan storage quotas beyond a single weight copy. For object storage, include checkpoint versions, temporary shards, and checksum files rather than estimating capacity from only one set of weights.

    7. Common Estimation Mistakes

    Treating parameter count as file size

    Parameter count is a count of elements, not bytes. It must be multiplied by the storage required per parameter.

    Ignoring the difference between GB and GiB

    Decimal GB and binary GiB differ noticeably at terabyte scale. Keep the unit consistent throughout capacity planning.

    Treating theoretical quantized size as actual file size

    Low-bit formats such as INT4 commonly include scale factors, packing overhead, and alignment padding. Actual files can exceed the theoretical estimate.

    Estimating training checkpoints from inference weights

    Training checkpoints may contain optimizer states and gradients, making them substantially larger than inference weight files.

    Planning storage without planning GPU memory

    Weights fitting on disk does not mean they can be loaded onto a single GPU. Parallel sharding, KV caches, and runtime buffers must also be considered.

    8. Summary

    The core calculation is straightforward:

    [
    \text{Theoretical weight size} =
    \text{Parameter count} \times \text{Bytes per parameter}
    ]

    Then adjust the estimate for saved precision, file format, quantization metadata, training checkpoint contents, and runtime caches.

    For a 130-billion-parameter model, the theoretical weight-only sizes are approximately:

    • FP16 or BF16: 260 GB.
    • FP32: 520 GB.
    • INT8: 130 GB.
    • INT4: 65 GB before additional quantization overhead.

    These values are useful starting points, not complete capacity requirements. Estimates suitable for engineering decisions must distinguish training from inference, disk storage from GPU memory, and theoretical weight sizes from actual file and runtime overhead.