Large Language Model Parameter Count vs. Model File Size: How to Convert Between Them

    This article explains how to convert between a model's parameter count and its on-disk size, and how to calculate parameter counts layer by layer. It covers the core formula (parameters × bytes per parameter), a precision-to-bytes reference table, worked examples for a 130B model, the extra storage overhead of mixed-precision training states, parameter formulas for convolutional and fully connected layers, and a breakdown of Embedding and Transformer block parameters, finishing with a step-by-step estimation workflow and a quick reference for 10B and 100B models. By the end, you will be able to size storage and GPU memory for both compact vision models and hundred-billion-parameter language models without order-of-magnitude mistakes.

    1. Why the Parameter Count–to–Size Relationship Matters

    Engineers working on large model development and deployment run into the same questions repeatedly: you have a model file that takes up 300GB — how many parameters does it actually represent? Tens of billions, hundreds of billions, or trillions? Going the other way, if you need to train or serve a 100B-parameter model, how much storage and GPU memory should you provision?

    Both questions come down to the same thing: converting between parameter count and storage footprint. Knowing how to do this conversion helps with capacity planning, and it also lets you quickly gauge the scale of a model when reading papers, evaluating open-weight releases, or designing an inference service.

    2. The Core Conversion Formula

    Here is the conclusion first:

    Model file size ≈ parameter count × bytes per parameter

    How many bytes each parameter occupies depends on the numeric precision (that is, the data type):

    Precision Bytes per parameter Notes
    FP32 (single-precision float) 4 bytes Default training precision; wide range, high accuracy
    FP16 / BF16 (half precision) 2 bytes Common for inference; halves memory usage
    INT8 (8-bit integer) 1 byte Typical precision after quantization
    INT4 (4-bit integer) 0.5 bytes Extreme compression scenarios

    Take a 130B-parameter model. The weight storage alone works out to roughly:

    • FP16: 130B × 2 bytes ≈ 260 GB
    • FP32: 130B × 4 bytes ≈ 520 GB
    • INT8: 130B × 1 byte ≈ 130 GB

    Keep in mind that this is the size of the weights only. In real deployments you also have to account for:

    1. Save precision: some weights are served in FP16 but stored with an additional FP32 master copy;
    2. Training state files: including optimizer states (such as momentum and second-moment estimates) and gradient buffers, the total size can multiply several times over;
    3. Additional data: vocabularies, configuration files, tokenizers, and so on take up a small amount of space;
    4. Mixed-precision strategies: master weight copies, gradients, and optimizer states may each be saved at different precisions.

    Under a typical mixed-precision training setup, a single parameter often corresponds to an FP16 weight (2 bytes) + an FP32 master copy (4 bytes) + two FP32 optimizer states (8 bytes), for a total of about 16 bytes per parameter. In other words, training a 130B model means this portion alone can reach the 2TB range — which is the fundamental reason large model training demands so much storage and GPU memory.

    3. Small-Model Era: Counting Parameters in a Classic Convolutional Network

    Once you understand the conversion, the next key question is: how do you calculate the parameter count itself? Start with the structurally simple convolutional network.

    3.1 Convolutional Layer Parameters

    The general formula for a convolutional layer is:

    1. parameters = (K_w × K_h × C_in + 1) × C_out

    where K_w and K_h are the width and height of the kernel, C_in is the number of input channels, C_out is the number of output channels (i.e., the number of kernels), and +1 accounts for the bias term of each kernel.

    For the first convolutional layer of a classic network: 3 input channels, an 11×11 kernel, and 96 kernels:

    1. parameters = (11² × 3 + 1) × 96 = 34944

    As you can see, the parameter count of a convolutional layer is driven mainly by kernel size and channel count, and is independent of the spatial resolution of the input image — exactly the advantage that comes from the parameter sharing of convolutional structures.

    3.2 Fully Connected Layer Parameters

    Fully connected layers come in two cases.

    (1) Connected to a convolutional feature map:

    1. parameters = (O² × N + 1) × F

    where O is the side length of the feature map, N is the number of feature map channels, and F is the number of neurons in the fully connected layer. For the first fully connected layer of a given network, with a 6×6 feature map, 256 channels, and 4096 outputs:

    1. parameters = (6² × 256 + 1) × 4096 = 37752832

    (2) Connected to the previous fully connected layer:

    1. parameters = (F_prev + 1) × F

    The final layer, mapping from 4096 dimensions to 1000 classes:

    1. parameters = (4096 + 1) × 1000 = 4097000

    The comparison shows that fully connected layers carry far more parameters than convolutional layers. This observation still holds in the Transformer era: the linear transformation layers built around matrix multiplication remain the dominant source of parameters.

    4. Large-Model Era: Counting Parameters in a Transformer

    Large models are generally built on the Transformer architecture, and their parameter count comes mainly from two parts: the Embedding layers and the stacked Transformer blocks.

    4.1 Embedding Layer Parameters

    Take the embeddings of a BERT-style model, which typically consist of three embedding tables and one LayerNorm:

    • Token embedding: Embedding(vocab_size, hidden_size)
    • Segment embedding: Embedding(2, hidden_size)
    • Position embedding: Embedding(seq_length, hidden_size)

    With a vocabulary size of 30522, a sequence length of 512, and a hidden size of 1024:

    1. parameters = (30522 + 2 + 512) × 1024 + 1024 × 2 = 31782912

    That is about 32 million parameters. Note that when the vocabulary is very large (hundreds of thousands of entries), the Embedding layers take up a significantly larger share of the total — which is why some models use vocabulary pruning or embedding factorization.

    4.2 Transformer Block Parameters

    The core of a Transformer is self-attention plus the feed-forward network (FFN). With hidden_size = 1024 and a sequence length also of 1024:

    (1) Attention

    In self-attention, Q, K, and V all come from the same input; in cross-attention, Q comes from a different source than K and V. Either way, the input passes through three separate linear transformation matrices (corresponding to W_Q, W_K, W_V), after which the concatenated output goes through one output projection matrix. When input and output dimensions are the same, each linear layer is Linear(1024, 1024), with a parameter count of:

    1. per linear layer = 1024 × 1024 + 1024 = 1049600
    2. attention total ≈ 4 × 1049600 ≈ 4198400

    (2) FFN

    The feed-forward network usually consists of two linear layers, with the intermediate dimension typically 4× the hidden size:

    1. first linear layer = 1024 × 4096 + 4096 ≈ 4202496
    2. second linear layer = 4096 × 1024 + 1024 ≈ 4195328
    3. FFN total ≈ 8397824

    (3) LayerNorm and other components

    Each Transformer block also contains several LayerNorms, each holding only on the order of 2 × hidden_size parameters, which is negligible in comparison.

    Overall, a Transformer block has roughly 12 × hidden_size² parameters (slightly more with biases). For the configuration above, a single block is about 12.6 million parameters; stack 24 layers and the Transformer blocks alone come to about 300 million parameters. Add the Embedding layers and you have an estimate of the total parameter count.

    5. The Complete Conversion Workflow and Practical Advice

    Putting the pieces together, here is a complete estimation workflow:

    1. Calculate the parameter count: accumulate layer by layer according to the architecture. Use the kernel-size formula for convolutional layers, (in + 1) × out for linear layers, and 12 × hidden_size² as a quick estimate for a Transformer block;
    2. Determine the save precision: confirm whether the weights are FP32, FP16, or quantized to INT8/INT4;
    3. Apply the conversion formula: parameter count × bytes per parameter = weight file size;
    4. Add training overhead: if training is involved, add gradients (usually the same precision as the weights) and optimizer states (usually more than 2× the size of the weights);
    5. Leave headroom: for actual storage planning, reserve 20%–50% on top of the theoretical value to accommodate checkpoints, logs, and temporary files.

    A handy quick reference:

    • 10B-parameter model: about 20GB in FP16, about 10GB in INT8;
    • 100B-parameter model: about 200GB in FP16, about 400GB in FP32;
    • Training state estimate: about 4× the weights under mixed precision (weight copy + gradients + two optimizer states).

    6. Summary

    Converting between parameter count and model size is not complicated — the core is the single formula “parameter count × bytes per parameter.” The real difficulty lies in calculating the parameter count accurately and in understanding the extra storage amplification that training introduces. Once you know how to count parameters for convolutional layers, fully connected layers, Embedding layers, and Transformer blocks, you can quickly plan storage and GPU memory for anything from a few-hundred-MB vision model to a several-hundred-GB language model, and avoid order-of-magnitude errors in resource estimation.