ERNIE 4.5 21B-A3B (文心) VRAM Requirements, KV Cache & Best GPUs

ERNIE 4.5 21B-A3B (文心) (21B total, 3B active, Sparse MoE + GQA) uses 11.96 GiB for 4-bit weights (Q4_K_M), requiring 12.96 GiB at 8K context and 14.27 GiB at 32K. · Hugging Face: baidu/ERNIE-4.5-21B-A3B-PT ↗ · GGUF: unsloth/ERNIE-4.5-21B-A3B-PT-GGUF ↗

Interactive Sizing Workbench

Full Compatibility Report →
16 GB · 288 GB/s
Fits with Safe Headroom
Config-derived formula HF config.json ↗
Memory Allocation Breakdown (GiB) 12.96 GiB (13.92 GB) / 16 GiB (81%)
Model Weights: 11.96 GiB KV Cache & State: 0.44 GiB Runtime & Activation Buffers: 0.56 GiB System RAM Offload: 0 GiB
Required GPU Memory
12.96 GiB
13.92 GB (decimal)
Usable Hardware Memory
15.2 GiB
16 GB (physical)
Safe Headroom
+2.24 GiB
81% utilization
Est. Decode Throughput
~65.5 tok/s
3B active params
Est. Prefill Throughput
~3813 tok/s
4K Prompt TTFT: ~1074 ms
Est. Cost / 1M Tokens
$0.52
Sparse MoE + GQA · Apache-2.0

Recommended Hardware for Current Configuration

Best Single GPU
RTX 4060 Ti 16GB (16GB)
~$430
Best Value / Used GPU
RTX 3090 (24GB)
~$750
Apple Unified Memory
Ryzen AI Max+ 395 128GB
~$1,999
Cloud From
Vast.ai · $0.12 / hr
1x RTX 4060 Ti 16GB

Production Launch Commands

llama.cpp (GGUF)
llama-server -hf unsloth/ERNIE-4.5-21B-A3B-PT-GGUF:Q4_K_M \
  --ctx-size 8192 -ngl 999 --flash-attn
vLLM
vllm serve baidu/ERNIE-4.5-21B-A3B-PT \
  --max-model-len 8192 --gpu-memory-utilization 0.92
Live Token Speed Simulator (TTFT ~1074ms · ~65.5 tok/s)
[ERNIE 4.5 21B-A3B (文心) · 12.96 GiB] allocated on target GPU. Prefill completed in TTFT window; streaming autoregressive tokens at memory-bandwidth-bound rate...

Cloud GPU Comparison & Rent-vs-Buy TCO

Verified public rates across RunPod, Vast.ai, Vultr, and DigitalOcean.

Verified: 2026-11-04
Purchase break-even
~18.5 months
Est. local power: $3.51 / mo
Provider Recommended Instance Total VRAM Hourly Rate Monthly at Selected Hours Billing Mode Deploy
RunPod 1x RTX 3090 (Community Cloud) 24 GB $0.22 / hr $26.75 / mo Per-second Deploy GPU ↗
Vast.ai 1x RTX 4060 Ti 16GB (Verified Host) 16 GB $0.12 / hr $14.84 / mo Spot / On-demand Deploy GPU ↗
Vultr ($300 Free Credit*) 1x L40S 48GB (Dedicated Instance · $300 Credit*) 48 GB $1.67 / hr $203.19 / mo Hourly Deploy GPU ↗
Vultr Cloud GPU 1x L40S 48GB (Dedicated Instance) 48 GB $1.67 / hr $203.19 / mo Hourly Deploy GPU ↗
DigitalOcean 1x RTX 6000 Ada (Dedicated Instance) 48 GB $1.57 / hr $190.91 / mo Per-second Deploy GPU ↗

Rates reflect public listings on the verification date and fluctuate with regional inventory.

Fine-Tuning VRAM Requirements (QLoRA / LoRA / Full) — ERNIE 4.5 21B-A3B (文心)

QLoRA (4b) Fits with Safe Headroom
14.19 GiB
Model Weights: 11.96 GiB · Gradients + Optimizer: 1.2 GiB · Act: 1.03 GiB
Recommended GPU: RTX 4060 Ti 16GB (16GB)
LoRA (16b) Exceeds Available GPU Memory
42.28 GiB
Model Weights: 39.12 GiB · Gradients + Optimizer: 1.8 GiB · Act: 1.36 GiB
Recommended GPU: A40 48GB (48GB)
Full BF16 Exceeds Available GPU Memory
162.79 GiB
Model Weights: 39.12 GiB · Gradients + Optimizer: 121.27 GiB · Act: 2.4 GiB
Recommended GPU: Instinct MI300X 192GB (192GB)

Engineering Sizing Notes & Optimization Playbook

Quick Hardware Verdict

RTX 4060 Ti 16GB (16GB physical, 15.2 GiB usable) runs 4-bit (Q4_K_M) ERNIE 4.5 21B-A3B (文心) at 8K context using 12.96 GiB with 2.24 GiB of safe headroom (~65.5 tok/s single-stream decode).

KV Cache & Runtime Tuning

ERNIE 4.5 21B-A3B (文心) uses Sparse MoE + GQA (21B total, 3B active per token). Moving from 8K to 32K context expands FP16 KV cache from 0.44 GiB to 1.75 GiB; enabling 8-bit KV cache (llama.cpp -ctk q8_0 -ctv q8_0 or vLLM --kv-cache-dtype fp8) saves 0.87 GiB at 32K (reducing total VRAM to 13.4 GiB).

VRAM Scaling Across Context Windows (4K to 128K, 4-bit Weights)

ERNIE 4.5 21B-A3B (文心) VRAM scaling from 4K to 128K context (4K: 12.73 GiB, 8K: 12.96 GiB, 32K: 14.27 GiB, 128K: 19.52 GiB) 4K 12.73 GiB (KV 0.22 GiB) 8K 12.96 GiB (KV 0.44 GiB) 32K 14.27 GiB (KV 1.75 GiB) 128K 19.52 GiB (KV 7 GiB) RTX 4060 Ti 16GB (16GB)
Model weights remain constant while attention KV cache grows with context length and batch size.

ERNIE 4.5 21B-A3B (文心) × 49 GPUs (4-bit Q4_K_M)

Target Hardware Total VRAM Memory Bandwidth 4-bit @ 8K 4-bit @ 32K Decode Speed Compatibility Full Compatibility Report
NVIDIA RTX 3060 12GB 12 GB (11.4 GiB) 360 GB/s 12.96 GiB 14.27 GiB ~65.1 tok/s Exceeds Available GPU Memory Full Compatibility Report →
NVIDIA RTX 4060 Ti 16GB 16 GB (15.2 GiB) 288 GB/s 12.96 GiB 14.27 GiB ~65.5 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 4070 Ti Super 16 GB (15.2 GiB) 672 GB/s 12.96 GiB 14.27 GiB ~128.3 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 4080 Super 16 GB (15.2 GiB) 736 GB/s 12.96 GiB 14.27 GiB ~136.8 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 5070 12GB 12 GB (11.4 GiB) 672 GB/s 12.96 GiB 14.27 GiB ~92.1 tok/s Exceeds Available GPU Memory Full Compatibility Report →
NVIDIA RTX 5070 Ti 16 GB (15.2 GiB) 896 GB/s 12.96 GiB 14.27 GiB ~156.3 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 5080 16 GB (15.2 GiB) 960 GB/s 12.96 GiB 14.27 GiB ~163.5 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 3090 24 GB (22.8 GiB) 936 GB/s 12.96 GiB 14.27 GiB ~160.8 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 4090 24 GB (22.8 GiB) 1008 GB/s 12.96 GiB 14.27 GiB ~168.6 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 4090 D 24 GB (22.8 GiB) 1008 GB/s 12.96 GiB 14.27 GiB ~168.6 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 5090 32 GB (30.4 GiB) 1792 GB/s 12.96 GiB 14.27 GiB ~232.6 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 5090 D 32 GB (30.4 GiB) 1792 GB/s 12.96 GiB 14.27 GiB ~232.6 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX A6000 48 GB (45.6 GiB) 768 GB/s 12.96 GiB 14.27 GiB ~140.9 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX 6000 Ada 48 GB (45.6 GiB) 960 GB/s 12.96 GiB 14.27 GiB ~163.5 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA RTX PRO 6000 Blackwell 96 GB (91.2 GiB) 1792 GB/s 12.96 GiB 14.27 GiB ~232.6 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA DGX Spark (GB10 128GB) 128 GB (99.8 GiB) 273 GB/s 12.96 GiB 14.27 GiB ~67.8 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA L4 24GB 24 GB (22.8 GiB) 300 GB/s 12.96 GiB 14.27 GiB ~67.9 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA A40 48GB 48 GB (45.6 GiB) 696 GB/s 12.96 GiB 14.27 GiB ~131.5 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA L20 48GB 48 GB (45.6 GiB) 864 GB/s 12.96 GiB 14.27 GiB ~152.6 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA L40S 48GB 48 GB (45.6 GiB) 864 GB/s 12.96 GiB 14.27 GiB ~152.6 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA A800 80GB SXM 80 GB (76 GiB) 2039 GB/s 12.96 GiB 14.27 GiB ~247.3 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA A100 80GB SXM 80 GB (76 GiB) 2039 GB/s 12.96 GiB 14.27 GiB ~247.3 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA H800 80GB SXM 80 GB (76 GiB) 3350 GB/s 12.96 GiB 14.27 GiB ~301 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA H100 80GB SXM 80 GB (76 GiB) 3350 GB/s 12.96 GiB 14.27 GiB ~301 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA H20 96GB HBM3 96 GB (91.2 GiB) 4000 GB/s 12.96 GiB 14.27 GiB ~318.5 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA H20 141GB HBM3e 141 GB (133.9 GiB) 4800 GB/s 12.96 GiB 14.27 GiB ~335.2 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA H200 141GB SXM 141 GB (133.9 GiB) 4800 GB/s 12.96 GiB 14.27 GiB ~335.2 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA B200 180GB 180 GB (171 GiB) 8000 GB/s 12.96 GiB 14.27 GiB ~374.5 tok/s Fits with Safe Headroom Full Compatibility Report →
NVIDIA B300 288GB Blackwell Ultra 288 GB (273.6 GiB) 8000 GB/s 12.96 GiB 14.27 GiB ~374.5 tok/s Fits with Safe Headroom Full Compatibility Report →
Huawei Ascend 910B 64GB (昇腾) 64 GB (60.8 GiB) 1200 GB/s 12.96 GiB 14.27 GiB ~187.5 tok/s Fits with Safe Headroom Full Compatibility Report →
Huawei Ascend 910C 128GB (昇腾) 128 GB (121.6 GiB) 2400 GB/s 12.96 GiB 14.27 GiB ~265.5 tok/s Fits with Safe Headroom Full Compatibility Report →
Huawei Atlas 300I Duo 96GB (310P) 96 GB (91.2 GiB) 408 GB/s 12.96 GiB 14.27 GiB ~87.6 tok/s Fits with Safe Headroom Full Compatibility Report →
Cambricon MLU590 80GB (寒武纪思元) 80 GB (76 GiB) 2048 GB/s 12.96 GiB 14.27 GiB ~247.8 tok/s Fits with Safe Headroom Full Compatibility Report →
Hygon DCU K100-AI 64GB (海光深算) 64 GB (60.8 GiB) 1638 GB/s 12.96 GiB 14.27 GiB ~222.4 tok/s Fits with Safe Headroom Full Compatibility Report →
MetaX MetaX C500 64GB (沐曦曦云) 64 GB (60.8 GiB) 1800 GB/s 12.96 GiB 14.27 GiB ~233.1 tok/s Fits with Safe Headroom Full Compatibility Report →
Kunlunxin Kunlunxin P800 64GB (昆仑芯) 64 GB (60.8 GiB) 1600 GB/s 12.96 GiB 14.27 GiB ~219.8 tok/s Fits with Safe Headroom Full Compatibility Report →
Moore Threads MTT S4000 48GB (摩尔线程) 48 GB (45.6 GiB) 768 GB/s 12.96 GiB 14.27 GiB ~140.9 tok/s Fits with Safe Headroom Full Compatibility Report →
AMD Radeon RX 7900 XTX 24GB 24 GB (22.8 GiB) 960 GB/s 12.96 GiB 14.27 GiB ~163.5 tok/s Fits with Safe Headroom Full Compatibility Report →
AMD Radeon AI PRO R9700 32GB 32 GB (30.4 GiB) 640 GB/s 12.96 GiB 14.27 GiB ~123.8 tok/s Fits with Safe Headroom Full Compatibility Report →
AMD Ryzen AI Max+ 395 128GB 128 GB (99.8 GiB) 256 GB/s 12.96 GiB 14.27 GiB ~64.1 tok/s Fits with Safe Headroom Full Compatibility Report →
AMD Instinct MI300X 192GB 192 GB (182.4 GiB) 5300 GB/s 12.96 GiB 14.27 GiB ~343.7 tok/s Fits with Safe Headroom Full Compatibility Report →
AMD Instinct MI325X 256GB 256 GB (243.2 GiB) 6000 GB/s 12.96 GiB 14.27 GiB ~353.8 tok/s Fits with Safe Headroom Full Compatibility Report →
AMD Instinct MI355X 288GB 288 GB (273.6 GiB) 8000 GB/s 12.96 GiB 14.27 GiB ~374.5 tok/s Fits with Safe Headroom Full Compatibility Report →
Intel Arc Pro B60 24GB 24 GB (22.8 GiB) 456 GB/s 12.96 GiB 14.27 GiB ~95.7 tok/s Fits with Safe Headroom Full Compatibility Report →
Intel Gaudi 3 128GB HBM2e 128 GB (121.6 GiB) 3700 GB/s 12.96 GiB 14.27 GiB ~310.9 tok/s Fits with Safe Headroom Full Compatibility Report →
Apple Mac mini M4 Pro 64GB 64 GB (49.9 GiB) 273 GB/s 12.96 GiB 14.27 GiB ~67.8 tok/s Fits with Safe Headroom Full Compatibility Report →
Apple MacBook Pro M4 Max 128GB 128 GB (99.8 GiB) 546 GB/s 12.96 GiB 14.27 GiB ~117.9 tok/s Fits with Safe Headroom Full Compatibility Report →
Apple Mac Studio M4 Ultra 256GB 256 GB (199.7 GiB) 819 GB/s 12.96 GiB 14.27 GiB ~156.6 tok/s Fits with Safe Headroom Full Compatibility Report →
Apple Mac Studio M3 Ultra 512GB 512 GB (399.4 GiB) 819 GB/s 12.96 GiB 14.27 GiB ~156.6 tok/s Fits with Safe Headroom Full Compatibility Report →