LLM Parameter Count, Model File Size, and Memory Conversion: A Capacity Planning Guide for Deployment
How large is a large language model, really? This guide untangles three often-confused metrics—parameter count, model file size, and runtime GPU memory—and shows how to convert between them. You will learn how to estimate weight storage across precision formats (FP32, FP16/BF16, INT8, 4-bit quantization), distinguish GB from GiB, reverse-engineer parameter counts from file sizes, count parameters layer by layer (convolutions, fully connected layers, attention, and feed-forward networks), and estimate inference KV cache and training memory. The article concludes with a practical capacity planning workflow and a discussion of when high-speed interconnects are actually required.
1. First, Distinguish: Parameter Count, Model File Size, and Runtime Memory
When people ask “how big is a large model,” at least three different measures may be involved.
Parameter count is the number of parameter elements in the model, usually described in billions. It reflects how many weights and biases the network contains, but says nothing about the precision used to store them.
Model file size is the actual storage footprint on disk. Beyond the weights, it may include configuration files, quantization metadata, and training state; the serialization format can also introduce overhead.
Runtime memory is the device memory consumed during inference or training. It includes the weights plus intermediate activations, caches, temporary computation buffers, and—during training—gradients and optimizer states.
Therefore, “the model file is 300GB” does not tell you how many parameters it has, nor does it alone determine how many compute cards you need or whether high-speed interconnects are mandatory. The correct order of analysis: first confirm the file contents and storage precision, then estimate runtime memory, and finally decide on the parallelization strategy and communication requirements.
2. The Basic Conversion: Parameter Count × Bytes per Parameter
For a pure weight file where all parameters use the same storage format:
[
S_{\text{weights}}=P\times b
]
where:
- (P): number of parameters;
- (b): bytes per parameter;
- (S_{\text{weights}}): theoretical storage in bytes for the weights.
Theoretical footprints for common formats:
| Storage format | Theoretical bytes per parameter | Notes |
|---|---|---|
| FP32 | 4 bytes | 32-bit floating point |
| FP16 | 2 bytes | 16-bit floating point |
| BF16 | 2 bytes | Also 16-bit, but with a different numeric range than FP16 |
| INT8 | 1 byte | 8-bit integer, typically used for quantized weights |
| 4-bit quantization | 0.5 bytes | Tightly packed; excludes quantization metadata |
Note that this describes storage, not compute precision. A model may store weights in one format while computing or accumulating in another, higher-precision format.
2.1 Storage Example: A 100B+ Parameter Model
Take 130 billion parameters, i.e., (130\times10^9):
| Storage format | Theoretical weight size, decimal GB |
|---|---|
| FP32 | 520 GB |
| FP16 or BF16 | 260 GB |
| INT8 | 130 GB |
| 4-bit quantization | 65 GB |
These are ideal estimates for pure weights—not the actual download size, and not the GPU memory required for deployment.
For example, quantized files usually also store scale factors, zero points, or other auxiliary data, and some layers may be kept at higher precision. A 4-bit quantized file is therefore not necessarily exactly one-quarter the size of the 16-bit original.
2.2 Don’t Mix GB and GiB
Capacity estimates must use consistent units:
[
1\text{ GB}=10^9\text{ bytes}
]
[
1\text{ GiB}=2^{30}\text{ bytes}
]
260 GB is roughly 242.1 GiB. If your file browser and hardware specs use different units, the numbers may look very different—but that doesn’t mean parameters are missing.
Engineering documentation should explicitly state “decimal GB” or “binary GiB” to keep procurement, deployment, and monitoring consistent.
3. Reverse Conversion: How Many Parameters Does a 300GB File Contain?
If you know the file contains only weights in a single precision, you can invert the formula:
[
P=\frac{S_{\text{weights}}}{b}
]
For a 300GB decimal capacity:
| Storage format | Theoretical parameter count |
|---|---|
| FP32 | 75 billion |
| FP16 or BF16 | 150 billion |
| INT8 | 300 billion |
| 4-bit quantization | 600 billion |
The same 300GB could correspond to tens of billions or hundreds of billions of parameters—the storage format is what matters.
However, the table above does not apply to every file. When examining a real model directory, check first:
- Does it contain only inference weights, or also training checkpoints?
- Are there multiple versions, backups, or duplicated weights?
- Are different precisions mixed?
- Does it contain quantization metadata?
- Is the size the whole directory or a single weight file?
- Are shared weights written out multiple times in the saved file?
If a large portion of the 300GB is optimizer state, you cannot treat the entire capacity as weights when running the reverse calculation.
4. Where Parameter Counts Come From: Counting Basic Layers
Parameter counts are determined by the network architecture. Understanding how basic layers are counted helps you validate whether a model’s description is plausible—and avoids conflating input size with parameter count.
4.1 Convolutional Layers
For a standard 2D convolution with bias:
[
P=(KwK_hC{\text{in}}+1)C_{\text{out}}
]
where the kernel width and height are (Kw) and (K_h), the input channel count is (C{\text{in}}), and the output channel count is (C_{\text{out}}). The “1” accounts for one bias per output channel.
For example, with 3 input channels, an 11×11 kernel, and 96 output channels:
[
P=(11\times11\times3+1)\times96=34,944
]
Without bias, drop the corresponding term.
For grouped convolution with (g) groups, the weight parameter count becomes:
[
P{\text{weight}}=K_wK_h\frac{C{\text{in}}}{g}C_{\text{out}}
]
This means you cannot judge parameter count from kernel size and output channels alone—you also need the grouping configuration.
4.2 Fully Connected Layers
For input dimension (D{\text{in}}), output dimension (D{\text{out}}), with bias:
[
P=(D{\text{in}}+1)D{\text{out}}
]
Flattening a 6×6×256 feature map into a 4096-dimension output:
[
P=(6\times6\times256+1)\times4096
=37,752,832
]
Connecting a 4096-dimension input to a 1000-dimension output:
[
P=(4096+1)\times1000=4,097,000
]
This also explains why, in traditional networks, large fully connected layers can account for a significant share of the total parameters.
5. How to Estimate Parameter Counts for Attention-Based Models?
For large language models, the main parameter contributions come from embedding layers, attention projections, feed-forward networks, and the output layer.
Throughout this section:
- (V): vocabulary size;
- (d): hidden dimension;
- (L): number of layers;
- (m): feed-forward intermediate dimension.
5.1 Embedding Layers and Positional Representations
The token embedding table has:
[
P_{\text{token}}=Vd
]
With learnable positional embeddings and a maximum position count of (T_{\max}), add:
[
P{\text{position}}=T{\max}d
]
Some architectures also include type embeddings. With (C) types, that contributes (Cd) parameters.
For a vocabulary of 30,522, hidden dimension 1024, 512 learnable positions, 2 types, plus a normalization layer with scale and shift parameters:
[
P=(30522+512+2)\times1024+2\times1024
=31,782,912
]
Note that not all models use learnable position tables or type embeddings. For architectures without a large learnable position table (e.g., certain positional encoding schemes), this formula should not be applied mechanically.
5.2 The Attention Module
Queries, keys, and values are typically obtained by projecting the input through different linear projections:
[
Q=XW_Q,\quad K=XW_K,\quad V=XW_V
]
“Self-attention” means all three come from the same input—not that the projected (Q), (K), and (V) values are identical.
For standard multi-head attention, if the query, key, value, and output projections are all (d\times d) matrices, the weight parameter count is:
[
P_{\text{attention}}=4d^2
]
With biases on all four projections:
[
P_{\text{attention}}=4d^2+4d
]
For (d=1024), the count with biases is 4,198,400.
With a fixed total hidden dimension, changing only the number of attention heads usually does not change the total parameters of these projection matrices. However, reducing the number of key/value heads changes both projection sizes and cache sizes, so the standard multi-head attention formula no longer applies directly.
5.3 Feed-Forward Networks
A standard two-layer feed-forward network first expands from (d) to (m), then maps back to (d). Ignoring biases:
[
P_{\text{FFN}}=2dm
]
If (m=4d), then:
[
P_{\text{FFN}}=8d^2
]
For the common three-matrix gated feed-forward structure, ignoring biases:
[
P_{\text{gated}}=3dm
]
So you cannot assume every feed-forward network follows the same expansion ratio and matrix count.
5.4 Normalization Layers, the Output Layer, and Shared Weights
Normalization layer parameters generally scale with the hidden dimension and are usually small compared to the large projection matrices, but should still be included in precise counts.
If the output layer maps the hidden vector to the full vocabulary, its weight size is also typically (Vd). If the input embedding and output layer share the same weights, count them only once; if not, count them separately.
The correct metric is the total number of independent parameter elements—not the sum of module reference counts.
5.5 Overall Approximation
For an architecture with standard attention and a two-layer feed-forward network, ignoring biases and normalization parameters:
[
P\approx P{\text{embedding}}+L(4d^2+2dm)+P{\text{output}}
]
When (m=4d):
[
P\approx P{\text{embedding}}+12Ld^2+P{\text{output}}
]
This formula is good for quick estimates but is not universal. Gated feed-forward networks, shared weights, sparse mixture-of-experts architectures, and alternative attention forms all require adjustments based on the actual configuration.
6. Why Sequence Length Doesn’t Necessarily Change Parameter Count
For a fixed architecture, increasing input sequence length usually does not increase the parameter count of attention projections and feed-forward networks, because the same weights are reused across positions.
But sequence length significantly affects compute and runtime memory:
- Intermediate activations grow with sequence length;
- Standard attention computation involves pairwise interactions between positions;
- In autoregressive inference, the KV cache grows with the number of processed positions.
If a model uses learnable positional embeddings and you enlarge the position table, the parameter count does increase—but that results from a structural change, not from longer inputs automatically generating more parameters.
Therefore, “the parameter count is unchanged” does not mean “long-context inference costs stay the same.”
7. Inference Memory: Beyond Weights, Count the Cache
Inference memory can be broken down as:
[
M{\text{infer}}
\approx
M{\text{weights}}
+M{\text{KV}}
+M{\text{activation}}
+M{\text{workspace}}
+M{\text{overhead}}
]
This includes weights, KV cache, intermediate activations, computation workspace, and framework management/allocation overhead.
For a typical decoder-style model, the KV cache can be approximated as:
[
M{\text{KV}}
\approx
2LBTn{\text{kv}}d{\text{head}}b{\text{kv}}
]
where:
- (B): batch size;
- (T): cache length actually used per sequence;
- (n_{\text{kv}}): number of key/value heads;
- (d_{\text{head}}): per-head dimension;
- (b_{\text{kv}}): bytes per cached element;
- The factor 2 accounts for both keys and values.
Real implementations may add paging, alignment, and allocation overhead. For requests of different lengths, a more accurate estimate requires summing the cache length of each request.
This means that even if the weights are quantized to 8-bit or 4-bit, the cache may not use the same precision. Increasing concurrency or context length can still rapidly consume GPU memory.
8. Why Are Training Files Much Larger Than Inference Weights?
During training, beyond the weights you may need to store:
- Gradients;
- First- and second-order optimizer states;
- High-precision master weights;
- Forward activations;
- Temporary computation buffers.
For example, in one common mixed-precision training configuration, assume each parameter requires:
- 2 bytes of low-precision weights;
- 2 bytes of gradients;
- 4 bytes of high-precision master weights;
- Two optimizer states of 4 bytes each.
That totals roughly 16 bytes per parameter. 130 billion parameters would correspond to about 2,080 GB—before counting activations and temporary buffers.
This is only an estimate for one specific configuration, not a fixed multiplier for all training jobs. Different optimizers, gradient precision, state sharding, and memory offloading schemes change the result. Whether a training checkpoint saves all states also determines the on-disk file size.
9. Does a 300GB Model Require High-Speed Interconnects?
The answer: you cannot tell from file size alone.
9.1 First Determine Whether Cross-Device Execution Is Needed
If the weights and required runtime space fit on a single device, there is no cross-device model communication problem.
If they don’t fit, you may need to shard the model, offload some data, or adjust storage precision and request configuration. At that point, look not only at total device memory, but at the weights, cache, and temporary space each device bears after sharding.
9.2 Then Determine the Parallelization Strategy
Different parallel strategies have different communication characteristics:
- Data parallelism: Each device usually holds a full model replica and must synchronize gradients during training; it cannot by itself solve the problem of a model replica not fitting.
- Tensor parallelism: Splits intra-layer computation across devices, often exchanging or reducing intermediate results frequently—typically sensitive to bandwidth and latency.
- Pipeline parallelism: Partitions the model by layer, mainly transmitting activations at stage boundaries, but must deal with pipeline scheduling and utilization issues.
- Parameter and state sharding: Reduces resident state per device, but requires parameter gathering or state communication during computation.
9.3 Separate Load Traffic from Sustained Communication
Loading 300GB of weights from disk is a startup-phase data-read problem; exchanging activations or synchronizing gradients at runtime is a sustained communication problem. The two should not be conflated.
If each device loads an independent shard and then mostly computes locally, a large model file does not mean every inference transfers data of the same magnitude. Conversely, even a modestly sized model can become bottlenecked by frequent intra-layer communication.
So the necessity of high-speed interconnects depends on communication volume, synchronization frequency, parallel granularity, and your throughput and latency targets—not on an isolated “300GB” figure.
10. An Actionable Capacity Planning Process
For actual deployment, build your budget in this order:
Step 1: Confirm the parameter accounting. Obtain the total number of independent parameters and check whether the embedding and output layers share weights. For sparse mixture-of-experts models, distinguish total parameters from activated parameters per computation: inactive experts usually still need to be stored.
Step 2: Estimate weight volume. Compute per precision and sum:
[
S_{\text{weights}}=\sum_i P_i b_i
]
Quantization metadata must be added separately—you cannot rely on nominal bit width alone.
Step 3: Define the runtime workload. Specify training or inference, along with concurrency, input length, maximum generation length, and cache precision.
Step 4: Build a per-device budget. Estimate weight shards, cache, activations, and workspace separately—do not simply divide total weights by the device count.
Step 5: Evaluate communication and data paths. Analyze model loading, inter-device communication, and host-to-device transfers separately to find the real bottleneck.
Step 6: Validate with measurements. Under representative loads, measure resident memory after loading, peak usage at different concurrency levels, throughput, and latency. Memory headroom should be based on the actual implementation and measurements, not fixed ratios.
Conclusion
The core relationship between parameter count and model size is simple: pure weight volume is approximately the parameter count multiplied by the bytes of storage per parameter.
The hard part is defining the boundaries of the calculation. Disk files may contain training state; quantization may include extra metadata; inference requires cache and workspace; training also stores gradients and optimizer states; and cross-device execution introduces communication costs.
By decomposing the problem into “parameter structure → storage format → runtime workload → parallelization strategy,” you can turn a vague model-size figure into a verifiable storage, memory, and bandwidth plan.
