LLM Parameter Count vs. Model Size: A Conversion Guide for Deployment Planning

    This guide explains how to convert between LLM parameter counts and model file size, how parameters are distributed across embedding, attention, and feed-forward layers, and how the resulting numbers drive memory, bandwidth, and storage decisions. It includes the precision-to-bytes formula, worked examples at the hundred-million and hundred-billion scale, and common mistakes to avoid when estimating model size.

    1. It Usually Starts with a Capacity Question

    During large model deployment planning, a common scenario comes up: all you have is the size of a model file (say, 300GB), yet you are expected to answer “how many parameters does that correspond to,” “is that tens of billions, hundreds of billions, or trillions,” and “does it require high-speed interconnect bandwidth.” These three questions look unrelated, but they all point to the same thing: the conversion between parameter count and storage size, and the resource requirements derived from that result.

    One caveat matters up front: model size alone does not uniquely determine parameter count, because size is also affected by numerical precision, optimizer states, and shard redundancy. The right approach is to establish the conversion formula first, then account for parameters module by module, and finally return to resource planning.

    2. The Basic Conversion: From Parameters to Bytes

    Bytes per parameter are determined by numerical precision. Common values:

    • FP32: 4 bytes per parameter
    • FP16 / BF16: 2 bytes per parameter
    • INT8: 1 byte per parameter
    • INT4: 0.5 bytes per parameter

    The core formulas are:

    1. Model size (bytes) ≈ parameter count × bytes per parameter
    2. Parameter count ≈ model size (bytes) / bytes per parameter

    Take 300GB as an example (using 1GB = 1024^3 bytes, so 300GB ≈ 3.22×10^11 bytes):

    • FP16/BF16: about 150 billion parameters, i.e. the hundred-billion range
    • INT8: about 300 billion parameters
    • INT4: about 600 billion parameters
    • FP32: about 75 billion parameters, i.e. the ten-billion range

    The conclusion is straightforward: for the same 300GB, precision alone swings the answer between “tens of billions” and “close to a trillion.” So before answering any question about magnitude, confirm the precision first.

    3. Which Modules Actually Make Up the Parameter Count

    3.1 Embedding Layers

    In a typical setup, the embedding layer contains word embeddings, type embeddings, position embeddings, and a normalization layer. Let the vocabulary size be V, the hidden dimension H, and the maximum sequence length L:

    1. Parameter count ≈ (V + number of types + L) × H + 2H

    With V on the order of 30,000 and H = 1024, the embedding layer holds roughly 30 million parameters. Note that word embeddings often share weights with the output layer; if they are shared, do not count them twice. If they are not shared, the output projection adds another V×H parameters, which is substantial with a large vocabulary.

    3.2 Attention Sublayer

    The input goes through three separate linear transformations to produce Q, K, and V, and the concatenated output goes through one more linear transformation. Each attention layer therefore contains four H×H weight matrices (H×H+H each if biases are included):

    1. Parameter count ≈ 4 × (H² + H)

    With multi-head attention, the number of heads does not change the total parameter count; it only splits the same matrices. With grouped-query or key-value sharing, the projection dimensions for K and V shrink, and the parameter count drops noticeably.

    3.3 Feed-Forward Sublayer

    The feed-forward layer first projects up to an intermediate dimension of 4H (a common choice), then back down to H:

    1. Parameter count ≈ 2 × (H × 4H + 4H + H) ≈ 8H²

    A single Transformer layer is therefore on the order of 12H², and the total can be approximated as:

    1. Total parameter count ≈ number of layers × 12H² + embedding parameters

    This approximation is very useful: it shows that parameter count is driven mainly by “number of layers × hidden dimension squared,” while sequence length affects compute only and never enters the parameter formula.

    4. Worked Examples at Two Different Scales

    4.1 Small Models: Convolution vs. Fully Connected

    A convolutional layer has (kernel width × kernel height × input channels + 1) × output channels parameters. For an 11×11 kernel with 3 input channels and 96 output channels, that is about 35,000 parameters.

    Fully connected layers come in two forms: over a convolutional feature map, (number of spatial positions × channels + 1) × output dimension; over another fully connected layer, (input dimension + 1) × output dimension. For example, flattening 6×6×256 and projecting to 4096 dimensions gives about 37.75 million parameters; 4096 to 1000 classes gives about 4.1 million. Fully connected layers are the simplest in structure, yet they are the easiest place for parameters to pile up.

    4.2 Large Models: Tens of Billions and Hundreds of Billions

    With H = 1024 and 24 layers, each layer is about 12 million parameters, for roughly 290 million in total, plus about 320 million with the embedding layer. That is a “hundred-million-scale” small model.

    With H = 12288 and 96 layers, a single layer is about 1.8 billion parameters and the total is about 175 billion, which lands in the hundred-billion range. Stored in BF16, that is about 350GB. Seen the other way around, 300GB of BF16 weights corresponds to a hundred-billion-scale model, consistent with the estimate in Section 2.

    5. From Size to Resource Planning

    • GPU memory: inference memory ≈ weights + KV cache + activations and framework overhead. The KV cache grows linearly with batch size and sequence length, and in long-context scenarios it can exceed the weights themselves.
    • Bandwidth: single-machine multi-GPU tensor parallelism depends on high-bandwidth inter-GPU interconnect; cross-node pipeline or data parallelism is less sensitive to bandwidth. Hundred-billion-scale models usually must be sharded across GPUs, at which point high-speed interconnect is close to a hard requirement.
    • Storage and loading: loading hundred-billion-scale weights takes noticeable time. Sharded saving, on-demand streaming loads, and object storage with image pre-warming help shorten cold starts.
    • Precision strategy: when memory is tight, quantize weights to INT8/INT4; the KV cache can be quantized too. Keep BF16 for precision-sensitive tasks, and track throughput and latency changes with monitoring and alerts.

    6. Common Mistakes

    1. Asserting parameter count from size alone while ignoring the precision assumption.
    2. Counting sequence length into parameter count, confusing “parameters” with “compute.”
    3. Ignoring weight sharing and double-counting the embedding and output layers.
    4. Looking only at weights while ignoring the KV cache and optimizer states (during training, optimizer states can be several times the size of the weights).

    Master the chain “precision → bytes → parameter count → module-level accounting → resource derivation,” and you can produce a credible magnitude estimate and a deployment plan as soon as you are handed a model file of any size.