AI Tools

LLM VRAM Calculator

Estimate static and dynamic GPU memory requirements for running Large Language Models locally.

1

Configuration Inputs

4,096 tokens
2

VRAM Budget & Allocation

Total VRAM Allocation COMPATIBLE
17.52 GB of 24.00 GB
Token Speed (Generation)
~57 t/s
Latency
~17.5 ms/token
Weights 0.00 GB
KV Cache 0.00 GB
Activations 0.00 GB
Overhead 0.00 GB

Inference Simulation

Loading model configuration... Input sequence length: --
Click play to simulate token generation...

Understanding Large Language Model VRAM Calculations

Running Large Language Models (LLMs) locally requires a solid understanding of Video RAM (VRAM) budgets. An Out-Of-Memory (OOM) error occurs if a model's operational requirements exceed the physical capacity of your GPU's memory. This calculator breaks down the four distinct components that consume VRAM: model weights, the key-value (KV) cache, activation tensors, and CUDA framework overhead.

1. Model Weights (Static Memory)

This is the baseline memory required simply to load the model onto the GPU. It is determined solely by the number of parameters and the quantization level (bit precision) of those weights:

  • FP16 / BF16 (16-bit): Standard precision. Consumes 2 bytes per parameter (e.g., an 8 Billion parameter model requires 16 GB of memory).
  • INT8 (8-bit): Consumes 1 byte per parameter (e.g., 8 GB for an 8B model).
  • INT4 / Q4 (4-bit): Consumes approximately 0.5 to 0.6 bytes per parameter (e.g., ~4.8 GB for an 8B model using Q4_K_M GGUF format).

2. Key-Value Cache (Dynamic Memory)

The KV Cache stores the key and value vectors of previous tokens in the context window during decoding. It grows linearly with Batch Size and Context Length. Modern architectures handle this differently:

  • Grouped Query Attention (GQA): Memory-efficient. Groups multiple query heads to share a single key-value head, compressing the KV cache size by up to 8x.
  • Hybrid Architecture (e.g. Qwen 3.5 9B): Models may use a mix of Linear Attention (which has a fixed-size state) and standard Attention, drastically reducing KV Cache size.
  • State-Space Models (SSM / Mamba): These models do not use a standard KV cache that grows with context length. They use a fixed recurrent state memory footprint, allowing for near-infinite context windows without OOM errors.

3. Activations, Overhead, & Mixture of Experts (MoE)

Activations are intermediate tensors generated during the forward pass. Overhead is the base allocation claimed by CUDA/PyTorch.

For Mixture of Experts (MoE) models like Mixtral or Gemma MoE, the Total Parameters dictate the massive VRAM needed to store the model weights, but only the Active Parameters are used during computation. This results in incredibly fast generation speeds (Tokens/Sec) relative to the model's total size!