Self-Hosting LLMs in 2026: GPU Sizing, VRAM Math & KV-Cache Guide
An advanced engineering guide to sizing GPU servers for open-weight LLMs: exact VRAM formulas, KV-cache scaling for long contexts, FP16 vs Q4/Q8 quantization, and API break-even rules.
Deploying an open-weight language model in production comes down to one hard hardware constraint before throughput or latency even enter the picture: does the model plus its runtime context fit inside GPU VRAM? If it misses by even 1 GB, the inference engine either refuses to boot or spills layers onto system RAM over PCIe and collapses to single-digit tokens per second.
This guide covers the exact sizing arithmetic used for production deployments in 2026—from weight memory and quantization trade-offs to KV-cache math under concurrent long-context requests, multi-GPU interconnects, and the financial break-even against token APIs.
1. Core VRAM Math: Weights + Activation Overhead
Before counting context windows or batch sizes, calculate the baseline footprint of the model weights themselves:
Base VRAM (GB) ≈ Parameters (B) × Bytes per Weight × 1.20
The 1.20 multiplier accounts for CUDA/cuBLAS kernels, PyTorch or vLLM workspace buffers, activation memory during the prefill phase, and minor fragmentation.
Bytes per Weight by Precision
| Precision / Format | Bits per Weight | Bytes per Weight | Typical Use Case |
|---|---|---|---|
| FP32 | 32-bit | 4.0 bytes | Training / reference debugging only |
| FP16 / BF16 | 16-bit | 2.0 bytes | Full-precision inference, fine-tuning, LoRA bases |
| FP8 / INT8 (W8A8 / Q8_0) | 8-bit | 1.0 byte | Near-lossless production inference on Hopper/Ada/L40S |
| 4-bit (AWQ / GPTQ / Q4_K_M) | 4-bit | ~0.55 bytes | High-efficiency serving; best $/token ratio |
Note on 4-bit overhead: Pure 4-bit weights are 0.5 bytes/param, but group-wise quantization scales and zero-points (e.g., group_size=128 in AWQ/GPTQ or GGUF Q4_K_M super-blocks) add roughly 8–12%, putting effective weight size closer to 0.55 bytes per parameter.
Baseline Footprint by Model Class (Weights + 20% Overhead)
| Model Size | FP16 / BF16 | 8-bit (FP8 / Q8) | 4-bit (AWQ / Q4_K_M) | Minimum Single-Card Target (4-bit) |
|---|---|---|---|---|
| 8B (Llama 3 8B class) | ~19.2 GB | ~9.6 GB | ~5.3 GB | 8–16 GB VRAM |
| 14B | ~33.6 GB | ~16.8 GB | ~9.2 GB | 16 GB VRAM |
| 32–34B | ~81.6 GB | ~40.8 GB | ~22.4 GB | 24–48 GB VRAM |
| 70B (Llama 3.3 70B class) | ~168 GB | ~84 GB | ~46.2 GB | 48–80 GB VRAM (or 2× 24 GB) |
To see which live servers clear these thresholds right now, check our GPU-for-LLM compatibility matrix or compare GPU hosting plans.
2. KV-Cache Sizing for Long Context & Concurrency
The 1.20 rule of thumb breaks down as soon as you serve long context windows (32K–128K tokens) or high concurrency. During autoregressive decoding, the attention mechanism caches Key (K) and Value (V) tensors for every token across every layer so previous tokens do not have to be recomputed.
The Exact KV-Cache Formula
For each token in a sequence, the KV-cache memory in bytes is:
KV bytes per token = 2 (K and V) × Layers × KV_Heads × Head_Dim × Bytes_per_KV_Element
Multiply by total concurrent tokens in flight (Batch_Size × Context_Length):
Total KV-Cache (GB) = (Batch_Size × Context_Length × KV bytes per token) / 10⁹
Modern open-weight models use Grouped-Query Attention (GQA) specifically to shrink KV_Heads (for example, 8 KV heads instead of 64 query heads), reducing KV-cache size by 4× to 8× compared to older Multi-Head Attention architectures.
Worked KV-Cache Examples (FP16 KV Cache = 2 bytes/element)
-
8B GQA Model (
32 layers,8 KV heads,head_dim = 128):- Per token:
2 × 32 × 8 × 128 × 2 = 131,072 bytes(~128 KB/token) - 1 request at 32K context:
32,768 × 128 KB ≈ 4.2 GB - 16 concurrent requests at 16K context (
262,144total tokens):~33.6 GB— more than the 4-bit weights themselves!
- Per token:
-
70B GQA Model (
80 layers,8 KV heads,head_dim = 128):- Per token:
2 × 80 × 8 × 128 × 2 = 327,680 bytes(~320 KB/token) - 1 request at 128K context:
131,072 × 320 KB ≈ 41.9 GB - 8 concurrent requests at 32K context (
262,144total tokens):~83.9 GB
- Per token:
Practical Ways to Cut KV-Cache Bloat
- Enable FP8 KV-cache quantization (
--kv-cache-dtype fp8in vLLM): cuts KV memory in half (1 byte/element instead of 2) with negligible perplexity impact on Ada/Hopper GPUs. - Turn on Prefix Caching (APC): essential for RAG, system prompts, and agentic tool definitions where 2,000+ prefix tokens repeat across requests.
- Cap
max_model_lenexplicitly: never leavemax_model_lenat 128K if your application only sends 8K prompts—vLLM pre-allocates KV blocks based on available headroom, and reserving unused context limits concurrency.
3. FP16 vs Q8 vs Q4 Quantization: Engineering Trade-Offs
Choosing a quantization format is a balance between VRAM capacity, memory bandwidth, and output fidelity:
- Memory bandwidth often bottlenecks single-user latency more than FLOPS. Token generation (decode) is memory-bandwidth bound: every generated token streams the entire model weight matrix from VRAM to the GPU cores. A 70B 4-bit model (~38.5 GB) reads 4× fewer bytes per token than FP16 (~140 GB), meaning 4-bit is frequently 2.5–3.5× faster per stream on the same card.
- Where 4-bit (AWQ / GPTQ / Q4_K_M) excels: customer support chat, classification, summarization, RAG synthesis, and structured JSON extraction. Quality degradation on 70B-class models is typically under 1–2% on standard benchmarks.
- Where Q8 / FP8 or FP16 is worth paying for: multi-step mathematical reasoning, complex code refactoring, strict tool-calling schemas with small (8B–14B) models, and sensitive evaluation pipelines. Note that quantizing a small 7B–8B model to 4-bit loses proportionally more capability than quantizing a 70B model to 4-bit—a 4-bit 32B or 70B model consistently outperforms an FP16 8B model at similar or lower latency.
4. Single-GPU vs Multi-GPU Topology
When a workload exceeds 24 GB or 48 GB VRAM, you face a topology choice:
- One large-VRAM GPU (e.g., 48 GB L40S/A6000 or 80 GB A100/H100): simplest deployment, zero cross-card communication overhead, ideal for maximum single-stream decode speed.
- Multiple smaller GPUs (e.g., 2× 24 GB RTX 4090 or 4× 24 GB) with Tensor Parallelism (
-tp 2/-tp 4): unlocks 48–96 GB combined VRAM at a lower monthly rental rate on consumer/prosumer bare metal. - Watch the interconnect: Tensor Parallelism performs an
all-reducesynchronization step across GPUs twice per transformer layer. Over NVLink, scaling is near-linear. Over PCIe Gen4 x16 without NVLink,tp=2usually works well, whiletp=4ortp=8can introduce noticeable synchronization latency—especially if two GPUs sit across separate NUMA sockets.
Compare per-card and multi-GPU VRAM pricing directly on our AI Value Ranking and filter by exact VRAM floor on GPU Hosting.
5. API vs Self-Hosted Break-Even Rules
Before provisioning dedicated GPU hardware, run the workload through a clean TCO filter:
Monthly API Spend = (Monthly Input Tokens × Input $/1M) + (Monthly Output Tokens × Output $/1M)
Monthly Self-Hosted Cost = GPU Server Rent + Engineering Ops Overhead + Redundancy
Use current per-token rates from the live LLM API pricing table and apply these four rules:
- Below $100/month in API spend: stay on serverless APIs. Even an entry GPU server costs more in rent plus maintenance than your token bill.
- Spiky or daytime-only traffic (under 15% average utilization): APIs win because you never pay for idle VRAM overnight.
- Steady 24/7 traffic where API spend ≥ 2× qualifying GPU rent: self-hosting clears both hardware rent and ops overhead—and every additional request up to GPU saturation drives marginal token cost toward zero.
- Hard compliance, PII, or air-gapped latency requirements: self-hosting wins on architecture regardless of token volume.
Summary Sizing Checklist
- Pick your target model class and precision (
params × bytes × 1.20). - Add explicit KV-cache memory for your realistic
concurrency × context_length. - Select the smallest GPU tier that leaves 15–20% VRAM headroom for KV-cache spikes—verify live options on /ai/gpu-for-llm and /gpu-hosting.
- Compare the monthly server price against your projected token bill on /ai/llm-pricing and /ai before committing.
Related Guides
Dedicated Server Pricing Buyer's Guide (2026): Bare-Metal Costs & TCO
Complete 2026 breakdown of dedicated server pricing: budget vs enterprise bare-metal tiers, CPU/RAM/NVMe $/GB benchmarks, bandwidth & hidden fees, and unmanaged vs managed TCO.
Complete Guide to VPS Hosting
Everything you need to know about Virtual Private Servers, from basics to advanced configurations. Learn when to use VPS, how to choose specs, and best practices.
Website Performance Optimization: Complete 2026 Guide
Learn how to optimize website performance for speed and Core Web Vitals. Covers caching, CDN, image optimization, database tuning, and server configuration.