Skip to content
Articles
TechnicalInfrastructureOptimization

VRAM, Precision, and Quantization: Fitting AI on a GPU

A detailed guide to FP32, BF16, FP16, FP8, INT4, weight storage, activation peaks, mixed precision, offloading, and out-of-memory failures.

Published Jul 18, 2026Updated Jul 23, 202617 min readDifficulty: Advanced5/5
In this article
Chart comparing the bit width and storage intuition of FP32, BF16, FP16, FP8, and INT4
Lower precision can reduce weight storage and bandwidth, but a production VRAM budget also includes activations, caches, workspaces, model components, and allocator overhead.

The Short Answer

Precision determines how numeric values are encoded. Fewer bits usually reduce weight storage and memory bandwidth, but they also reduce representable detail or range. Quantization adds a mapping between a compact stored number and an approximate real value.

The production question

Do not ask only “Does the checkpoint fit?” Ask whether the complete pipeline fits at the target resolution, frame count, batch size, attention implementation, and concurrency level with enough headroom to avoid fragmentation and transient peaks.

What Actually Occupies VRAM

  • Model weights: denoiser, text encoder, VAE, adapters, and auxiliary models.
  • Activations: intermediate values whose shapes depend on the current input.
  • Attention state: queries, keys, values, score blocks, and optimized kernel workspaces.
  • Latents and decoded frames: larger with resolution, frame count, and batch size.
  • Runtime memory: CUDA context, compiled kernels, allocator pools, and graph caches.
  • Temporary copies: loading, casting, dequantization, and transfer buffers.
VRAM peak ≈ weights + peak activations + workspaces + caches + runtime overhead
weight bytes ≈ parameter count × bytes per stored parameter
A planning approximation for inference memory.

FP32, BF16, FP16, FP8, And INT4

FormatBitsUseful intuitionCaution
FP3232Wide range and precision baselineHigh storage and bandwidth
BF1616FP32-like exponent rangeOnly 7 fraction bits
FP1616More fraction bits than BF16Narrower exponent range
FP88Compact floating-point weightsFormat and scale handling matter
INT44Very compact quantized valuesRequires scale and grouping choices

NVIDIA’s TensorRT data-format documentation specifies FP16, BF16, FP8, FP4, INT8, and INT4 among supported inference types. Hardware support and fast kernels vary by GPU generation and operation.

Measured Wan2.2 Files On Sage3

Sage3 holds matched Wan2.2 14B high-noise and low-noise checkpoints in FP16 and scaled FP8 forms. The FP16 files are 28.58 GB each. The FP8 files are 14.29 GB each, almost exactly half.

Bar chart comparing measured Wan2.2 FP16 and FP8 checkpoint file sizes
Measured local files. High-noise FP16: 28,577,914,792 bytes; high-noise FP8: 14,294,742,832 bytes. The matching low-noise pair has the same relationship.

This is a storage comparison, not an end-to-end quality or speed benchmark. The FP8 checkpoint may still use higher-precision accumulation, scales, and activations. Runtime kernels decide whether compact storage also becomes faster execution.

What Quantization Adds

Integer and low-bit formats usually represent a group of real values using compact codes plus one or more scales. A simple symmetric quantizer can be written as:

s = max(|w|) / qmax
q = clamp(round(w / s), -qmax, qmax)
ŵ = s × q
Simplified symmetric quantization and reconstruction.

The reconstructed value ŵ approximates w. Group size controls how many weights share one scale. Smaller groups adapt better to local ranges but require more scale metadata. Outlier handling, calibration data, per-channel scales, and quantization-aware training can all affect error.

FP8 is floating point rather than integer, but practical FP8 inference still depends on format choice and scaling. E4M3 offers more fraction precision and less range than E5M2. The suffix in a checkpoint filename is part of the runtime contract, not decoration.

Why Weights Can Fit While The Run Fails

Weight memory is largely fixed for one loaded model. Activation memory grows with the workload. Video is especially demanding because latent frames and temporal attention expand with duration and resolution.

activation elements ∝ batch × channels × latentFrames × latentHeight × latentWidth
activation bytes = elements × bytesPerElement
A simplified activation shape for a video latent.

Attention may create additional temporary tensors. Memory-efficient attention kernels avoid materializing the full score matrix, but they still need supported shapes, dtypes, and head dimensions. A fallback kernel can change a previously safe workflow into an out-of-memory failure.

PyTorch automatic mixed precision handles this selectively. Linear layers and convolutions can run at lower precision while reductions or numerically sensitive operations remain in FP32. Mixed precision is an operation policy, not one global cast.

Offloading, Tiling, And Scheduling

  • CPU offload: move inactive components or blocks out of VRAM, trading transfer latency for capacity.
  • Model unload: release one model before loading another, reducing warm-cache speed.
  • VAE tiling: decode smaller spatial regions, with possible seam or overhead concerns.
  • Temporal chunking: process frame groups where the model supports it, with continuity tradeoffs.
  • Quantized weights: reduce storage and bandwidth when supported kernels preserve acceptable quality.
  • Queue scheduling: avoid placing two individually safe jobs on the same GPU at the same time.

An Out-Of-Memory Checklist

  1. Record free and reserved VRAM before the run.
  2. Confirm which model components are already resident.
  3. Reduce batch size to one.
  4. Reduce frame count before changing several variables at once.
  5. Reduce pixel area while keeping model-required multiples.
  6. Check whether an optimized attention kernel was disabled or unsupported.
  7. Unload stale models and clear only safe caches.
  8. Test a supported lower-precision checkpoint.
  9. Leave operational headroom instead of targeting the exact advertised VRAM total.

Frequently Asked Questions

Does FP8 always use half the VRAM of FP16?

Weights stored with one byte instead of two bytes are roughly half the size, but total VRAM also includes scales, activations, workspaces, caches, allocator overhead, and components that may remain in higher precision.

Is BF16 more accurate than FP16?

Neither is universally more accurate. BF16 has the wide exponent range of FP32 but fewer fraction bits. FP16 has more fraction precision but a narrower range. The better choice depends on the values and operations.

Why can a model file fit on disk but fail to load on the GPU?

Loading may require temporary copies, dequantization buffers, multiple model components, CUDA context memory, and room for activations. File size is a lower-bound clue, not a complete VRAM budget.

Sources

Primary precision documentation plus the official model repository behind the measured checkpoint family.

Keep reading

Related articles

All guides
Diagram showing image frames stacking into an increasingly large space-time video payload
TechnicalVideo Models

Why AI Video Is So Much Heavier Than AI Images

Understand why AI video needs more GPU memory and compute than image generation, with tensor math, frame-resolution scaling, temporal attention, and practical cost controls.

14 min readDifficulty 3/5
Diagram tracing an AI generation job from browser to API, queue, GPU worker, storage, and progress channel
TechnicalInfrastructure

From Click to Clip: Inside an AI Generation Job

Follow an AI generation request through validation, durable job state, Redis-backed queues, ComfyUI execution, WebSocket progress, output storage, and failure recovery.

15 min readDifficulty 2/5
VRAM, Precision, and Quantization: Fitting AI on a GPU | Movey