LLM VRAM and Throughput Calculator
Find which local LLMs fit your GPU, Mac or CPU—or which hardware fits a model. Compare KV memory, prefill, decode, runtime support and measured speed references.
This LLM VRAM calculator helps engineers, students and local AI users answer “how much VRAM do I need for an LLM?” Choose hardware to compare models and quantizations, or choose a model to compare hardware. Detailed results always describe the selected model, hardware and precision.
Choose a model and a workload
Reference rows include sources, check dates and configuration notes. Models pin a Hugging Face revision and record safetensors parameter counts. Laptop and desktop GPUs have separate bandwidth entries. Custom rows and manual architecture inputs cover missing equipment.
Enter prompt length, expected output and concurrent sequences. The compact comparison shows device memory, fit, decode and prefill together. “Yes” means both memory budgets and the model context limit pass; “Dev”, “RAM” and “Ctx” identify the failed constraint. Use the row-number input to inspect verbose runtime support, host memory, compute assumptions and citations.
Read memory, compatibility and evidence separately
A model can fit while its format or kernels are unsupported. Choose the actual files and runtime: llama.cpp, vLLM, MLX LM or ExLlamaV2. Definite format/platform incompatibilities remain unsupported even when other settings need verification.
The nearest measured result includes its source, date, build and workload. Additional tables compare calculated and measured speeds for the same Llama 2 Q4_0 pp512 and tg128 workloads. Generation timing averages the modeled steps from empty context, rather than comparing a long-context endpoint with a short benchmark. Ratios expose model disagreement; they do not establish a universal accuracy bound.
Use device-specific speed assumptions
Manual compute belongs to the explicitly selected compute-profile device. Changing hardware does not transfer that profile. Other candidates need a supplied effective compute rate with precision, runtime, backend and source notes. Until then, prefill shows a dash and decode shows a bandwidth ceiling with “≤”. That ceiling is conditional on the entered effective-bandwidth assumption.
Weights use the parameters actually retained by the selected export/runtime. MoE execution uses active parameters while storage includes inactive experts. For Qwen3.5, ordinary text work excludes vision and MTP tensors; the retention control documents whether those unused tensors still occupy memory. The KV cache calculator distinguishes full, grouped-query, latent, sliding and hybrid attention. Fixed recurrent state has separate read and write traffic.
Plan unified memory and offload correctly
Apple and CPU memory use an editable usable share. CPU layer offload assigns the last whole transformer layers to the GPU and keeps other layers’ weights, KV/state and attention work on the CPU. Host RAM demand and DDR timing include that cache. The context capacity and decode curve obey both memory budgets. Enter extra host buffers separately.
Prefill and decode have separate rooflines. Speculative decoding uses a measured net factor, with extra memory entered separately. Energy per token uses average system power. Workspace, utilization and power defaults are planning assumptions. Training, image/video execution, disk swapping and multi-GPU communication are outside this tool; benchmark the exact runtime and workload before purchasing hardware.
How it is calculated
Stored and executed parameters
The pinned model table separates checkpoint total, text execution pool, and active parameters per token. Stored weight bytes equal retained parameters times effective bytes/weight. FP16/FP32 use 2/4 bytes; GGML Q4_0 and Q8_0 blocks use 18/32 and 34/32 bytes/value. Generic 4/8-bit options include the editable metadata allowance. Mixed unquantized tensors and alignment can make an actual file larger.
For Qwen3.5-4B revision 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a, the two safetensors headers sum to 4,205,751,296 text, 333,514,240 vision, and 120,599,552 MTP parameters. Together they give the Hub total 4,659,865,088. Ordinary text execution uses only the text pool. The retained-weight control follows an explicitly documented runtime baseline or an exact-file override: MLX LM filters vision/MTP; the vLLM multimodal baseline retains vision but its main-model loader skips MTP; llama.cpp text export excludes the separate vision projector and can retain MTP unless exported without it. Verify the actual export and runtime build.
Layer-aware cache and placement
Ordinary attention stores H_KV × (d_key + d_value) values per layer and retained token. Full attention retains the whole context; optimized sliding attention retains min(context, window). Optimized MLA replaces that coefficient by latent rank plus positional width: DeepSeek V2 Lite uses 512 + 64 values/layer; expanded K/V use 16 × (192 + 128). Hybrid recurrent layers receive no context-scaled KV allocation. Their fixed state remains separate from KV precision.
The Qwen3.5 row has eight full-attention and 24 recurrent layers, ordered RRR F repeatedly. Nominal fixed state is 24 × [32 × 128 × 128 × 4 + 8192 × 4 × 2] bytes: FP32 recurrent matrices and BF16 convolution history. Its allocation is runtime dependent.
CPU offload rounds the requested GPU percentage down to whole transformer layers. The last layers execute on the GPU, matching llama.cpp's layer-device cache allocation; preceding layers execute on the host. Full/sliding cache counts, fixed recurrent state and attention computation follow those layer devices. Standard rows supply explicit F/S/R order. State is distributed equally among the identical recurrent layers. Manual hybrid order is explicit; a custom row can describe another order.
Weight and linear-work shares default to the layer fraction. Unequal stored layer weights can use a separately entered measured GPU weight share; linear work still assumes equal work per transformer layer. Device memory is (device weights + device KV/state + device workspace + device runtime reserve + draft allowance) × planning margin. Host memory is (host weights + host KV/state + extra host buffers) × the same margin. Apple/CPU budgets apply the usable-memory share. Bisection finds the largest context satisfying both budgets and the model limit.
Decode traffic and work
Read weight traffic is b_weight × min(text execution pool, batch × active parameters), a conservative MoE expert-union bound. For each device, decode traffic adds its KV history read, new KV write, recurrent-state read and recurrent-state write. Recurrent allocation is one copy; per-step state traffic is two copies. Inactive vision/MTP tensors are never read as ordinary text work, even if retained in memory.
Active linear work is approximately 2 × active parameters × batch. Attention work is 2 × query heads × (d_key + d_value) × batch × retained attention positions on that device. GPU time is max(device traffic / effective bandwidth, device work / effective compute). CPU-layer time adds max(host traffic / sustained DDR bandwidth, host work / effective CPU compute), including host attention. These serial times form the decode step. There is no PCIe weight streaming in this model.
Prefill, compute provenance and energy
Prefill sums triangular causal pairs in full layers and window-capped pairs in sliding layers, separately on CPU/GPU. Prompt weight traffic uses the text execution pool, not unused auxiliary weights. Minimum modeled writes include KV updates and final recurrent state; activation traffic, padding and prefill chunking can add cost.
Manual compute is scoped to a named device. Hardware candidates never inherit another device's rate. Effective-compute row values are zero when not supplied; enter a source and precision/runtime/backend notes with any supplied rate. Without a compute assumption, prefill is unavailable and decode is marked with ≤ as the conditional bandwidth-model ceiling. This is not a statistical confidence interval or a hardware speed guarantee.
A measured net speculative factor adjusts decode only, already including draft/MTP/verification work. Additional resident draft memory is explicit. Average system power divided by aggregate decode rate gives joules/token. Derived speed/time/energy cards are suppressed when the workload is infeasible.
Compatibility and matched evidence
Format × platform restrictions are evaluated before architecture or placement caveats. The documented vLLM matrix rejects AWQ/GPTQ on AMD GPUs and GGUF on x86 CPU; a caveat never turns a definite unsupported result into a conditional one.
The matched-workload tables actually calculate Llama 2 Q4_0 pp512 and tg128. Prompt processing uses 512 input tokens. Generation averages modeled step times over contexts 0 through 127 from empty context; the displayed rate is the reciprocal mean time. KV storage is FP16, batch is one, and speculation is disabled. The comparison exposes discrepancies with the dated original runs; no utilization or formula is fitted to force agreement.
Assumptions
- Reference snapshot checked 26 October 2026. Config revisions, checkpoint totals, sources and check dates are on each row. Qwen3.5 component counts were summed from the pinned safetensors headers without downloading tensor payloads.
- Inference uses identical lengths per sequence, no shared prefixes, and memory-efficient attention. Workspace and runtime reserves are supplied independently of tensor storage.
- Default device workspace 1 GiB, device runtime reserve 0.75 GiB, margin 10%, bandwidth utilization 60%, usable unified/CPU share 75% and system power 300 W are planning scenarios. Additional host buffers default to zero and must be supplied when needed.
- The manual compute scenario is 100 numerical TFLOP/s with 35% utilization, scoped initially to RTX 4090 desktop. It is an assumption, not a vendor rating or benchmark. Unknown hardware-row compute values are deliberately unset. THz denotes the identical numerical scale of 10^12 operations/s; multiply and add count separately.
- CPU layer offload assumes the last whole transformer layers on GPU, normal KV offload enabled, and no overlapping CPU/GPU layer execution. Linear-work and default stored-weight fractions assume equal-sized layers. Use a measured weight fraction when actual tensor placement differs; nonuniform layer compute remains approximate.
- Qwen3.5 fixed-state dtype and convolution-history length follow the stated Transformers layout. Other runtime state packing, paged-cache padding and export choices can change memory. Vision/MTP retention is independent of whether their computation executes.
- GiB is binary; bandwidth is decimal GB/s. CPU DDR5-5600, two 64-bit channels, gives a theoretical 89.6 GB/s for the stated 64 GiB scenario. The offload DDR input asks for measured sustained bandwidth instead.
- The metric/US switch preserves information counts, time and energy semantics. This is static sizing, so no animation is needed.
Where it applies
This is a text-inference planning model for one selected device, optionally with serial CPU layer offload. Both device and host memory, plus model context, must be feasible before speed is shown as available. Fit is independent of runtime support and measured-data coverage. Detailed calculations retain analytical rates for diagnosis; visible rates and curves obey the shared feasibility predicate.
The compact fit codes are Yes (device, host and context all fit), Dev (device memory), RAM (host memory) and Ctx (model context). A dash in prefill means no device-specific compute assumption is supplied or the workload does not fit. A ≤ decode value is only a bandwidth-model ceiling at the chosen utilization. Unknown compute cannot rank real prefill performance across hardware. Enter effective rates for the actual precision, backend and runtime, or use the scoped manual profile.
Speed remains approximate: kernel launches, dequantization, router work, recurrent arithmetic, activation movement, CPU/GPU transfers, output projection placement and scheduling are simplified. Attention and cache/state placement follow the layer order, but unequal parameter/work distributions across layers need more detailed profiling. Context capacity holds temporary workspace fixed. Add CPU buffers to the host allowance and verify peak prefill memory.
MLA, sliding-cache eviction and hybrid-state packing depend on runtime support. Choose conservative cache allocation or exact-file retention overrides when applicable. The vLLM compatibility rules follow its checked hardware matrix; future versions can differ. Runtime baselines describe the cited loader/export paths, not every frontend or conversion option.
Matched benchmark comparisons reset the workload to pp512 or tg128 instead of silently comparing different contexts. Their analytical rates need not match measurements. Current-workload ratios against a nearby reference remain explicitly labelled as potentially different workloads. No measurements or compute profiles are invented, and no llmfit community dataset is redistributed.
Excluded: training, optimizer states, image/video execution, a predictive speculative-acceptance model, disk swapping, multi-GPU communication and PCIe weight streaming. Measure memory, sustained DDR bandwidth, kernel throughput and average system power for the actual deployment.
References
- Hugging Face, Unlocking Longer Generation with Key-Value Cache Quantization (2024), Llama-2 7B worked example and residual-cache discussion. https://huggingface.co/blog/kv-cache-quantization
- Hugging Face Accelerate, Model memory estimator: weight-loading estimates and inference caveat. https://huggingface.co/docs/accelerate/main/usage_guides/model_size_estimator
- NVIDIA, Mastering LLM Techniques: Inference Optimization (2023), prefill/decode bottlenecks and 4096-token Llama-2 example. https://developer.nvidia.com/blog/mastering-llm-techniques-inference-optimization/
- Kwon et al., Efficient Memory Management for Large Language Model Serving with PagedAttention (SOSP 2023), p. 4, OPT-13B KV-cache example. DOI:10.1145/3600006.3613165; open manuscript https://arxiv.org/abs/2309.06180
- MLCommons storage_results_v3.0, NVIDIA KV cache benchmark implementation guide (2026), section 4.2: per-token MHA/GQA memory table. Table uses MB/GB labels for binary-sized cache counts. https://github.com/mlcommons/storage_results_v3.0/blob/main/NVIDIA/code-1312df84/kv_cache_benchmark/docs/MLperf_v3_KV_cache_proposal.md
- Meta Llama 3.1 8B model card and Hugging Face model metadata (8.03B rounded parameter count). https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct ; https://huggingface.co/api/models/meta-llama/Llama-3.1-8B-Instruct
- Hugging Face model reference rows: pinned config.json and revision-specific safetensors metadata URLs are on every model row; checked 2026-10-26. https://huggingface.co/Qwen/Qwen3-30B-A3B ; https://huggingface.co/deepseek-ai/DeepSeek-V2-Lite
- Vendor hardware sources and derivations are on each row: PNY RTX 4090 desktop, Dell Precision 7680 laptop, Sapphire RX 7900 XTX, Apple Studio 2023 / mini 2024, AMD Ryzen 9950X. Checked 2026-10-26.
- Selected original llama.cpp Apple results: https://github.com/ggml-org/llama.cpp/discussions/4167 ; CUDA: https://github.com/ggml-org/llama.cpp/discussions/15013#discussioncomment-14016393 ; Vulkan: https://github.com/ggml-org/llama.cpp/discussions/10879#discussioncomment-18386832 ; ROCm: https://github.com/ggml-org/llama.cpp/discussions/15021#discussioncomment-18388777 . Report dates and build commits are on each row.
- Runtime documentation (checked 2026-10-26): https://github.com/ggml-org/llama.cpp ; https://docs.vllm.ai/en/latest/features/quantization/ ; https://github.com/ml-explore/mlx-lm ; https://github.com/turboderp-org/exllamav2
- llama.cpp cache allocation follows model.dev_layer: https://github.com/ggml-org/llama.cpp/blob/master/src/llama-kv-cache.cpp ; checked 2026-10-26.
- Qwen3.5 pinned component tensor index: https://huggingface.co/Qwen/Qwen3.5-4B/blob/851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a/model.safetensors.index.json . Counts are sums of shapes in its two safetensors headers.
- Qwen3.5 recurrent-state updates: https://github.com/huggingface/transformers/blob/main/src/transformers/models/qwen3_5/modeling_qwen3_5.py . Runtime retention: https://github.com/ggml-org/llama.cpp/blob/master/conversion/qwen.py ; https://github.com/vllm-project/vllm/blob/main/vllm/model_executor/models/qwen3_5.py ; https://github.com/ml-explore/mlx-lm/blob/main/mlx_lm/models/qwen3_5.py . Checked 2026-10-26.
- vLLM format × hardware restrictions: https://docs.vllm.ai/en/latest/features/quantization/#supported-hardware ; checked 2026-10-26.
- GGML quantization block storage: https://github.com/ggml-org/llama.cpp/blob/master/ggml/src/ggml-common.h . Cache strategies: https://huggingface.co/docs/transformers/main/en/kv_cache
Inputs
| Input | Symbol | Unit | Default |
|---|---|---|---|
| Planning direction The comparison table below changes direction. The detailed results always describe the selected model + hardware + precision. | plan_mode | My hardware → models and quantizations | |
| Use model reference row Switch off for manual architecture inputs. Or choose a custom row in the model selector. | use_model | true | |
| Selected model | model_pick | Llama 3.1 8B | |
| Use hardware reference row | use_hardware | true | |
| Selected hardware configuration | hardware_pick | RTX 4090 desktop 24 GiB | |
| Custom hardware backend family | platform_custom | NVIDIA CUDA | |
| Total stored parameters (billions) All stored parameters, including inactive experts. Use the exact safetensors count / 1e9. | P_b | 8.03 | |
| Transformer layers | L_n | 32 | |
| Query attention heads | H_q | 32 | |
| KV heads Use num_key_value_heads from the model configuration. MHA: equal to query heads; GQA/MQA: fewer. | H_kv | 8 | |
| Head dimension Usually hidden_size / num_attention_heads. The tool assumes equal key and value widths. | D_h | 128 | |
| Model context limit Use the supported limit of the exact model and runtime. The memory-only capacity is also capped by this limit. | S_limit | 131072 | |
| Weight precision | w_type | GGUF Q4_0 — 18/32 bytes per block value | |
| Quantized weight metadata allowance (%) Percentage added to ideal packed weights for scales, zero points and unquantized tensors. Tune to the actual resident weight size; 10% is an assumption, not a quantization standard. | q_extra | 10 | |
| Effective bytes per cached value FP16/BF16 2; Q8_0 1.0625; Q4_0 0.5625 bytes/value, including block scales. Other formats: enter effective storage. Confirm cache kernel support. Recurrent state remains at its own precision. | b_kv | byte | 2 |
| Concurrent sequences (batch) Every sequence is assumed to have the same prompt and output lengths. No shared prefix cache. | B_n | 1 | |
| Prompt length per sequence | S_prompt | 4096 | |
| Output tokens per sequence Memory is sized at prompt + output length. Decode speed is the endpoint estimate at that full context. | N_out | 512 | |
| Installed device memory Discrete VRAM, Apple unified memory or CPU RAM. Usable share is applied separately for unified/CPU memory. | M_gpu | GiB | 24 |
| Device activations and kernel workspace Temporary allocations on the selected device. Offload host buffers are entered separately; CPU-layer KV/state are counted automatically. | M_work | GiB | 1 |
| Runtime and allocator reserve Driver context, persistent buffers and allocator reserve. Set from your runtime; avoid counting memory already subtracted from available memory twice. | M_run | GiB | 0.75 |
| Planning margin on subtotal (%) Required memory = (weights + cache + workspace + runtime) × (1 + margin/100). This planning allowance is not measured memory usage. | margin | 10 | |
| Custom hardware physical memory bandwidth Decimal GB/s; use the exact laptop/desktop variant. CPU mode uses system DRAM bandwidth. | BW_peak | GB/s | 1000 |
| Selected-device compute assumption Other hardware candidates need their own effective-compute row. Without one, prefill is unavailable and decode is a bandwidth ceiling. | compute_mode | Manual scenario for selected device only | |
| Manual compute profile belongs to The manual compute numbers apply only to this device, not whichever hardware you later select. Other devices need their own effective compute row or an explicitly selected manual profile. | compute_device | RTX 4090 desktop 24 GiB | |
| Kernel compute-rate ceiling Dense TFLOP/s numerically (THz = 10^12 operations/s), for the selected device only. Default 100 is a scenario, not a hardware specification; it is never copied to other candidate devices. | C_peak | THz | 100 |
| Bandwidth utilization (%) Fraction of rated bandwidth available to model traffic. Calibrate to a measured decode run. This is an assumption, not a confidence bound. | eta_bw | 60 | |
| Compute utilization (%) Effective dense FLOPs divided by rated FLOPs. Depends on kernels, shape and precision; calibrate to measured prefill. | eta_c | 35 | |
| Usable share of unified / CPU memory (%) Applies to Apple/CPU RAM only; discrete VRAM uses 100%. An author-selected 75% budget leaves OS and other apps outside the workload. Use the actual runtime allocation limit; this is not an Apple specification. Also applies to Apple/CPU candidates in either planning direction. | usable_share | 75 | |
| Custom model is mixture of experts | custom_moe | false | |
| Active parameters per token (billions) Compute and single-token weight traffic use active parameters. Memory always uses total parameters, including inactive experts. | P_active | 3.3 | |
| Custom attention layout | attn_custom | Full MHA / GQA / MQA | |
| Full attention layers in hybrid model | L_cache | 8 | |
| Sliding-window tokens | window_custom | 4096 | |
| MLA latent + positional values per layer DeepSeek V2 Lite compressed cache: kv_lora_rank 512 + qk_rope_head_dim 64. No factor of two here. | latent_custom | 576 | |
| Fixed recurrent state per sequence Does not grow with context. Include convolution and recurrent state at their actual runtime precision. | state_custom | MiB | 49.5 |
| KV allocation policy Choose expanded if your runtime retains full sliding caches or materializes MLA K/V. Hybrid recurrent layers never receive a full KV cache. | cache_layout | Optimized: window eviction / compressed MLA | |
| Actual model file format | file_format | GGUF | |
| Inference runtime | runtime_pick | llama.cpp | |
| AMD llama.cpp backend Selects the matching AMD measured reference. | gpu_backend | HIP / ROCm | |
| Weight placement | placement | Fully resident on selected device | |
| Transformer layers on GPU (%) Rounds down to whole layers. As in llama.cpp, the last layers and their KV/state execute on the GPU; the others use CPU RAM/DDR. Weight and linear-work shares assume equal-sized layers unless you enter a measured weight share. | gpu_fraction | 50 | |
| Host RAM budget for offloaded weights | ram_budget | GiB | 32 |
| Measured effective host DDR bandwidth Enter measured sustained bandwidth. Offloaded layer traffic is divided by this rate and added to GPU time. | ddr_bw | GB/s | 40 |
| Effective host compute rate Effective CPU operations/s after utilization (numerical TFLOP/s). Includes CPU-layer attention and recurrent work as well as linear operations. | cpu_compute | THz | 0.5 |
| Net speculative decode speed factor 1 disables speculation. Supply a measured net factor including draft/MTP execution and verification. Base text work excludes vision/MTP; add retained draft/MTP memory separately. | spec_factor | 1 | |
| Extra speculative draft memory Draft weights, draft KV and verification workspace. Add when the net speculative speed factor differs from 1. | draft_memory | GiB | 0 |
| Average inference system power Author-selected scenario, not the GPU TDP or a measurement. Enter measured whole-system power for useful energy/token results. | power_draw | W | 300 |
| MLA value head dimension | V_custom | 128 | |
| Select nearest measured hardware reference automatically | auto_measure | true | |
| Measured reference (or your own run) | measure_pick | CUDA RTX 4090 Q4_0 | |
| Manual hybrid full-attention order Use a custom model row with explicit F/S/R order for another layout. | hybrid_order | Evenly spaced, ending in full attention | |
| Enter measured GPU weight share separately | weight_override | false | |
| Stored weights on GPU (%) Use actual runtime tensor placement when layers have unequal weights. Cache and attention still follow whole layers. | gpu_weight_share | 50 | |
| Additional host workspace and runtime memory Add CPU activations, staging buffers and runtime reserve from a peak-memory measurement. Host weights plus KV/recurrent state are already counted. | host_extra | GiB | 0 |
| Inspect comparison row number Row numbers match the compact comparison. Larger numbers are capped at the last row when you change planning direction. Verbose support messages, host memory, compute assumptions and citations appear in the detail card. | detail_row | 1 | |
| Auxiliary weight retention Ordinary text execution excludes vision and MTP. Memory follows the actual export/runtime: MLX LM drops both; vLLM normally keeps vision but skips main-model MTP; llama.cpp text export can keep MTP, with vision in a separate projector. Override for your exact file. | retention | Runtime baseline (see retention note) |
Results
With the default inputs above, the calc gives:
| Result | Value |
|---|---|
| 1 · Fits in memory? | Fits memory budget |
| 2 · Runtime supports the format? | Documented format / hardware; verify model build |
| 3 · A matching measured speed exists? | No measurement for this model; nearest model only |
| Required device memory with margin | 7.17 GiB |
| Remaining usable device memory | 16.83 GiB |
| All model weights, including inactive experts | 4.21 GiB |
| Peak KV cache plus recurrent state | 0.563 GiB |
| Context capacity at fixed workspace | 129,936 |
| Decode / sequence (≤ means bandwidth ceiling) | 118 |
| Decode / batch, tokens/s (≤ means ceiling) | 118 |
| Estimated inter-token latency | 8.5 ms |
| Estimated prefill time (prompt processing) | 2.01 s |
| Prefill / batch (— means unavailable) | 2040 |
| Usable device / unified-memory budget | 24 GiB |
| Required host weights, KV/state and extra buffers | 0 GiB |
| System energy per decoded token (entered power) | 2.54 J |
| Prefill + conservative endpoint decode time | 6.34 s |
| Nearest / chosen measured device | RTX 4090 desktop |
| Measurement report date | 2025-08-06 |
| Measurement runtime commit | 224145325 |
| Measured workload and backend | lhl; CUDA 12.9; driver575.64.03; Llama 2 7B; 3.56 GiB; pp512/tg128; ngl99; FA off. |
| Original measured result link | https://github.com/ggml-org/llama.cpp/discussions/15013#discussioncomment-14016393 |
| Reference measured decode · tg128 | 186.21 Hz |
| Reference measured prefill · pp512 | 11,992.7 Hz |
| Current decode estimate ÷ reference measured (workloads may differ) | 0.634 |
| Current prefill estimate ÷ reference measured (workloads may differ) | 0.17 |
| Runtime tensor-retention assumption | llama.cpp text GGUF keeps MTP unless exported without it; vision uses a separate projector. Use text-only override for a no-MTP export. |
Checked against sources
Each case below was calculated by this calc and agrees with the value from its source (within the tolerance where one is shown).
Hugging Face: Llama-2 7B cache at 10,000 tokens
Source: Hugging Face KV quantization article, worked example: cache approximately 5 GB at 10,000 tokens. This is rounded: exact tensor dimensions give 5.24288 decimal GB (4.8828125 GiB). Tolerance ±0.25 GB respects that rounding; no formula is adjusted. https://huggingface.co/blog/kv-cache-quantization
Inputs: KV heads = 32; Prompt length per sequence = 10,000; Output tokens per sequence = 0; Use model reference row = no; Use hardware reference row = no; Weight precision = FP16 / BF16 — 2 bytes/parameter; the others as above.
| Result | Source | This calc |
|---|---|---|
| Peak batch KV and recurrent state | 5 × 10⁹ ± 250,000,000 byte | 5.243 × 10⁹ byte |
NVIDIA: Llama-2 7B cache at 4096 tokens
Source: NVIDIA inference optimization post, KV cache example: 1 × 4096 × 2 × 32 × 4096 × 2 bytes, described as ~2 GB. The exact allocation is 2 GiB; this check uses binary units explicitly. https://developer.nvidia.com/blog/mastering-llm-techniques-inference-optimization/
Inputs: KV heads = 32; Output tokens per sequence = 0; Use model reference row = no; Use hardware reference row = no; Weight precision = FP16 / BF16 — 2 bytes/parameter; the others as above.
| Result | Source | This calc |
|---|---|---|
| Peak KV cache plus recurrent state | 2 GiB | 2 GiB |
PagedAttention paper: OPT-13B cache per token
Source: Kwon et al., PagedAttention, attached PDF p. 4: OPT-13B, hidden width 5120, 40 layers, FP16, 800 KB/token and about 1.6 GB per 2048-token request. The paper uses KB for KiB; 800 KiB/token corresponds to 1.5625 GiB, which rounds to 1.6. DOI:10.1145/3600006.3613165
Inputs: Total stored parameters (billions) = 13; Transformer layers = 40; Query attention heads = 40; KV heads = 40; Prompt length per sequence = 2,048; Output tokens per sequence = 0; Use model reference row = no; Use hardware reference row = no; Weight precision = FP16 / BF16 — 2 bytes/parameter; the others as above.
| Result | Source | This calc |
|---|---|---|
| KV bytes per retained token, excluding recurrent state | 800 KiB | 800 KiB |
| Peak KV cache plus recurrent state | 1.6 ± 0.05 GiB | 1.563 GiB |
MLCommons table: Llama 3.1 8B GQA cache
Source: MLCommons NVIDIA KV cache benchmark, section 4.2, llama3.1-8b row: 131,072 bytes/token and 1,024 MB at 8K. Counts indicate binary MiB, so this check uses 1 GiB at 8192 tokens. https://github.com/mlcommons/storage_results_v3.0/blob/main/NVIDIA/code-1312df84/kv_cache_benchmark/docs/MLperf_v3_KV_cache_proposal.md
Inputs: Prompt length per sequence = 8,192; Output tokens per sequence = 0; Use model reference row = no; Use hardware reference row = no; Weight precision = FP16 / BF16 — 2 bytes/parameter; the others as above.
| Result | Source | This calc |
|---|---|---|
| Variable KV bytes per full retained token | 131,072 byte | 131,072 byte |
| Peak KV cache plus recurrent state | 1 GiB | 1 GiB |
Hugging Face estimator: BERT-base-cased FP16 weights
Source: Hugging Face Accelerate estimator, bert-base-cased FP16 total size 206.59 MB (binary MiB). Uses 108,310,272 parameters of BertModel with its pooler (constructed via AutoModel); this validates weight storage only, not decoder architecture or inference memory. The page's inconsistent FP32 totals (418.18/413.18 MB) are not used. https://huggingface.co/docs/accelerate/main/usage_guides/model_size_estimator Estimator construction: https://github.com/huggingface/accelerate/blob/main/src/accelerate/commands/estimate.py
Inputs: Total stored parameters (billions) = 0.1083; Weight precision = FP16 / BF16 — 2 bytes/parameter; Use model reference row = no; Use hardware reference row = no; the others as above.
| Result | Source | This calc |
|---|---|---|
| Weight storage for estimator comparison | 206.6 MiB | 206.6 MiB |
Apple M2 Ultra Q4_0 — reported-rate transcription
Source: Original run https://github.com/ggml-org/llama.cpp/discussions/4167, reported 2023-11-22, build 8e672ef. Copies pp512 and tg128 exactly to verify the reference-row transfer; this is not validation of the analytical speed model.
Inputs: Select nearest measured hardware reference automatically = no; Measured reference (or your own run) = Apple M2 Ultra Q4_0; the others as above.
| Result | Source | This calc |
|---|---|---|
| Reference measured decode · tg128 | 94.27 Hz | 94.27 Hz |
| Reference measured prefill · pp512 | 1,238 Hz | 1,238 Hz |
CUDA RTX 4090 Q4_0 — reported-rate transcription
Source: Original run https://github.com/ggml-org/llama.cpp/discussions/15013#discussioncomment-14016393, reported 2025-08-06, build 224145325. Copies pp512 and tg128 exactly to verify the reference-row transfer; this is not validation of the analytical speed model.
Inputs: Select nearest measured hardware reference automatically = no; the others as above.
| Result | Source | This calc |
|---|---|---|
| Reference measured decode · tg128 | 186.2 Hz | 186.2 Hz |
| Reference measured prefill · pp512 | 11,993 Hz | 11,993 Hz |
Vulkan RX 7900 XTX Q4_0 — reported-rate transcription
Source: Original run https://github.com/ggml-org/llama.cpp/discussions/10879#discussioncomment-18386832, reported 2026-09-10, build 304665f. Copies pp512 and tg128 exactly to verify the reference-row transfer; this is not validation of the analytical speed model.
Inputs: Select nearest measured hardware reference automatically = no; Measured reference (or your own run) = Vulkan RX 7900 XTX Q4_0; the others as above.
| Result | Source | This calc |
|---|---|---|
| Reference measured decode · tg128 | 182.6 Hz | 182.6 Hz |
| Reference measured prefill · pp512 | 3,727 Hz | 3,727 Hz |
ROCm RX 7900 XTX Q4_0 — reported-rate transcription
Source: Original run https://github.com/ggml-org/llama.cpp/discussions/15021#discussioncomment-18388777, reported 2026-09-10, build 304665f. Copies pp512 and tg128 exactly to verify the reference-row transfer; this is not validation of the analytical speed model.
Inputs: Select nearest measured hardware reference automatically = no; Measured reference (or your own run) = ROCm RX 7900 XTX Q4_0; the others as above.
| Result | Source | This calc |
|---|---|---|
| Reference measured decode · tg128 | 155.7 Hz | 155.7 Hz |
| Reference measured prefill · pp512 | 4,146 Hz | 4,146 Hz |
llama-bench: Llama 2 7B Q4_0 weight size
Source: Original CUDA llama-bench row reports Q4_0 tensor size 3.56 GiB for Llama 2 7B. Block packing gives about 3.53 GiB; the published mixed-tensor quantization and alignment make the real file slightly larger. ±0.05 GiB tests a storage approximation, not peak VRAM or speed, and no packing coefficient is calibrated to this value. https://github.com/ggml-org/llama.cpp/discussions/15013#discussioncomment-14016393
Inputs: Selected model = Llama 2 7B; Prompt length per sequence = 512; Output tokens per sequence = 128; the others as above.
| Result | Source | This calc |
|---|---|---|
| All model weights, including inactive experts | 3.56 ± 0.05 GiB | 3.53 GiB |
Reviewer worked case: all CPU layers include host KV and DDR traffic
Source: Independent reviewer worked example supplied in the task: default Llama 3.1 Q4_0, batch 1, 100000 prompt tokens, all layers on CPU, 8 GiB host budget and 40 GB/s sustained DDR. Host weights plus KV need 18.06 GiB including margin; DDR limits decode to about 2.27 tokens/s. This is an independently supplied calculation, not a speed measurement. Layer-device allocation method: https://github.com/ggml-org/llama.cpp/blob/master/src/llama-kv-cache.cpp
Inputs: Weight placement = CPU layer offload (weights split with RAM); Transformer layers on GPU (%) = 0; Prompt length per sequence = 100,000; Output tokens per sequence = 0; Host RAM budget for offloaded weights = 8 GiB; the others as above.
| Result | Source | This calc |
|---|---|---|
| Required host weights, KV/state and extra buffers | 18.06 GiB | 18.055 GiB |
| Estimated decode rate per sequence | 2.27 ± 0.01 Hz | 2.27 Hz |
| Device KV and recurrent-state allocation | 0 ± 0.001 byte | 0 byte |
| Feasibility indicator | 0 | 0 |
vLLM hardware matrix: AWQ is unsupported on AMD GPU
Source: vLLM Supported Hardware matrix, AWQ row / AMD GPU column is unsupported. Encoded compatibility level 0 means definite unsupported; placement cannot override it. Checked 2026-10-26. https://docs.vllm.ai/en/latest/features/quantization/#supported-hardware
Inputs: Selected hardware configuration = RX 7900 XTX desktop 24 GiB; Inference runtime = vLLM; Actual model file format = AWQ; Weight precision = 4-bit — 0.5 bytes + metadata; Weight placement = CPU layer offload (weights split with RAM); the others as above.
| Result | Source | This calc |
|---|---|---|
| Compatibility: 0 unsupported, 1 verify, 2 documented | 0 | 0 |
vLLM hardware matrix: GPTQ is unsupported on AMD GPU
Source: vLLM Supported Hardware matrix, GPTQ row / AMD GPU column is unsupported. Encoded compatibility level 0 means definite unsupported. Checked 2026-10-26. https://docs.vllm.ai/en/latest/features/quantization/#supported-hardware
Inputs: Selected hardware configuration = RX 7900 XTX desktop 24 GiB; Inference runtime = vLLM; Actual model file format = GPTQ; Weight precision = 4-bit — 0.5 bytes + metadata; the others as above.
| Result | Source | This calc |
|---|---|---|
| Compatibility: 0 unsupported, 1 verify, 2 documented | 0 | 0 |
Pinned Qwen3.5 headers: ordinary text execution excludes vision/MTP
Source: Qwen/Qwen3.5-4B revision 851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a: safetensors header shapes sum to 4205751296 text, 333514240 vision and 120599552 MTP parameters. Source is the checkpoint tensor metadata, not a VRAM formula or fitted benchmark. https://huggingface.co/Qwen/Qwen3.5-4B/blob/851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a/model.safetensors.index.json
Inputs: Selected model = Qwen3.5 4B hybrid; Auxiliary weight retention = Entire checkpoint; Prompt length per sequence = 512; Output tokens per sequence = 0; the others as above.
| Result | Source | This calc |
|---|---|---|
| Total stored parameters (all experts) | 4.66 × 10⁹ | 4.66 × 10⁹ |
| Text parameters eligible for execution | 4.206 × 10⁹ | 4.206 × 10⁹ |
| Active parameters per token | 4.206 × 10⁹ | 4.206 × 10⁹ |
Calculated throughput against CUDA tg128 at matched workload
Source: Original lhl RTX 4090 CUDA run, 2025-08-06, build 224145325: Llama 2 Q4_0 tg128 = 186.21 tokens/s. The calculation averages all 128 modeled step times from empty context, with batch 1 and FP16 KV. A 25% modeling tolerance is an approximate comparison criterion, not measurement uncertainty or a universal accuracy bound. The independent 60% bandwidth and manual compute assumptions are not fitted to this result. https://github.com/ggml-org/llama.cpp/discussions/15013#discussioncomment-14016393
Inputs: the default inputs above.
| Result | Source | This calc |
|---|---|---|
| Calculated CUDA Llama 2 tg128 at its benchmark workload | 186.2 ± 46.553 Hz | 158.2 Hz |







Responses