GPU Memory Requirement Calculator

Estimate model weights, gradients, optimiser states, activations, KV cache, framework overhead, distributed sharding, and GPU fit before launching costly machine learning workloads at scale.

Estimated result

GPU memory breakdown

Enter values to calculate.
Required per GPU0 GiB
Total workload memory0 GiB
Selected GPU capacity24 GiB
Estimated headroom0 GiB
VRAM utilisation 0%
Memory component Unsharded Per GPU Share
Total including reserve 0 GiB 0 GiB 100%

Fit and scaling details

Minimum approximate GPU count1
Maximum estimated micro-batch0
Memory shortfall0 GiB
Global batch validationNot checked
Trainable parameters0

Optimisation suggestions

    Precision and tuning comparison

    ScenarioWeight memoryEstimated change

    Step-by-step calculation

    Calculation details will appear here.
    Scenario

    Workload and model profile

    Use more than one for ensembles or replicas.
    Weights and optimisation

    Precision, gradients, and optimiser states

    Batch and activations

    Batch, sequence, and activation memory

    Accounts for saved intermediates and temporary tensors.
    Inference

    Attention, outputs, and KV cache

    Input tensors

    Data type, tensor shape, and prefetch memory

    MiB
    Separate dimensions with commas, spaces, or the letter x.
    Fine-tuning

    LoRA, QLoRA, adapters, and trainable layers

    Overrides the LoRA estimate when greater than zero.
    Quantisation

    Weight compression profile

    %
    Distributed strategy

    Parallelism, sharding, and offloading

    Overhead and safety

    Framework reserve, workspace, and fragmentation

    MiB
    MiB
    MiB
    %
    %
    %
    GiB
    MiB
    Hardware fit

    GPU capacity and output units

    GiB
    Custom formula

    Manual tensor and workspace additions

    GiB
    Results update automatically after each change.

    Formula used

    Weight memory = parameters × bytes per weight
    Gradient memory = trainable parameters × bytes per gradient
    Optimiser memory = trainable parameters × optimiser state bytes
    Activation memory ≈ batch × sequence × hidden size × layers × bytes × multiplier
    KV cache = 2 × layers × batch × total sequence × KV heads × head dimension × bytes
    Required VRAM = sharded components + activations + inputs + buffers + overhead + reserve

    This calculator separates persistent tensors from temporary tensors. It then applies precision, sharding, offloading, and safety settings. The result remains an engineering estimate, not a framework guarantee.

    How to use the calculator

    1. Select a model preset or enter parameters manually.
    2. Choose training, fine-tuning, or inference mode.
    3. Set precision, optimiser, batch, and sequence values.
    4. Add quantisation, sharding, and offloading choices.
    5. Select GPU capacity and review the fit result.
    6. Export the breakdown for planning or documentation.

    Start with measured values from your actual model configuration. Keep a safety margin for allocator fragmentation and temporary kernels. Validate final settings with a small real workload run.

    Example data

    ScenarioParametersMethodWeight precisionTypical focus
    BERT-base fine-tuning110 millionFull fine-tuningFP16Gradients and Adam states
    7B language model7 billionQLoRANF4Quantised weights and activations
    13B text generation13 billionInferenceINT8Weights and KV cache
    Vision model training86 millionFull trainingBF16Image activations and workspace

    Precision memory guide

    FormatApproximate bytesCommon use
    FP648Special numerical workloads
    FP32 or TF32 storage4Master weights and stable training
    FP16 or BF162Mixed-precision training
    INT81Compressed inference
    INT4 or NF40.5 plus metadataLarge-model inference and QLoRA

    Frequently asked questions

    Why can actual GPU memory exceed this estimate?

    Framework allocators reserve memory and create temporary tensors. Kernel selection can also change workspace requirements. Always test the final configuration on target hardware.

    Does parameter memory equal total training memory?

    No. Training also stores gradients, optimiser states, activations, and workspaces. Those components can exceed the model weights.

    How does LoRA reduce memory?

    LoRA trains small low-rank matrices while base weights remain frozen. This reduces gradient and optimiser memory. Activation memory may still remain significant.

    Why does sequence length matter so much?

    Longer sequences increase activations and KV cache sizes. Standard attention buffers may grow quadratically. Flash Attention can reduce that temporary memory.

    What does ZeRO Stage 3 change?

    It shards parameters, gradients, and optimiser states across data-parallel workers. Communication overhead and runtime peaks still matter.

    Should I include FP32 master weights?

    Many mixed-precision training setups keep FP32 master copies. Disable them only when your optimiser and framework avoid them.

    Is GPU capacity measured in GB or GiB?

    Manufacturers and tools may use different unit conventions. This calculator treats selected GPU capacity as GiB. Decimal output units remain available separately.

    How much safety margin is reasonable?

    Ten to twenty percent is a common planning range. Dynamic shapes and variable sequence lengths may need more.

    Can this calculate maximum batch size?

    It provides an approximate batch limit from scalable activation memory. Real limits depend on kernels, graph shape, and allocator behaviour.

    Related Calculators

    Model Training Time CalculatorModel Throughput CalculatorDataset Storage CalculatorModel File Size CalculatorFloating-Point Operations Calculator

    Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.