Skip to main content

gpu-fit

Try it in your browser → · no install, nothing leaves your browser

Will this LLM fit on this GPU, at this context length, for this many users, and how fast?

gpu-fit answers that before you rent the GPU. It reads the model's config and weight sizes from Hugging Face and works out vLLM's memory budget: weights, runtime overhead, KV cache, how many requests fit at full context, and the longest single request. Then it prints the vllm serve command.

$ gpu-fit Qwen/Qwen3-32B --context 32k --concurrency 4

  GPU          smallest setup    requests at full ctx     KV tokens
  L4           8× L4                             10.6       347,888
  L40S         4× L40S                           11.6       380,656
  A100-80      2× A100-80                         9.9       323,484
  H100         2× H100                            9.8       320,885
  H200         1× H200                            7.9       259,428
  ...
$ gpu-fit deepseek-ai/DeepSeek-V3 --gpu H200 --tp 8 --context 128k

  vLLM budget per GPU             126.4 GiB
    weights                        80.1 GiB
    runtime overhead                2.0 GiB
    left for KV cache              44.2 GiB
  KV cache capacity              675,671 tokens
  Requests at full context       5.2
  Longest single request         163,840 tokens

✓ Fits. Suggested command:
  vllm serve deepseek-ai/DeepSeek-V3 --max-model-len 131072 --tensor-parallel-size 8 --max-num-seqs 5

Install

pip install gpu-fit        # no dependencies, Python 3.10+

Why another VRAM calculator?

Most calculators multiply parameters by bytes and add a guess. Modern models break that:

Architecture What changes gpu-fit
Grouped-query attention KV per token depends on KV heads, not attention heads ✓
Hybrid (linear attention + full attention, e.g. Qwen3-Next family) Only full-attention layers grow with context; the rest hold fixed state per request ✓
MLA (DeepSeek) Compact latent KV, but copied to every tensor-parallel GPU ✓
Sliding window (Gemma, Mistral) Window layers stop growing past the window ✓
FP8 / AWQ / GPTQ checkpoints Exact weight size from the safetensors metadata ✓
Tensor parallel beyond KV heads KV heads get replicated, not split ✓
Hybrid --max-num-seqs limit vLLM refuses to start above the state-slot count ✓ warns first
FP8 KV cache Doubles capacity: --kv-cache-dtype fp8 ✓

Options

gpu-fit MODEL [--gpu L40S | --gpu-mem-gib 48] [--tp 2] [--context 128k]
              [--concurrency 8] [--max-num-seqs 32] [--kv-cache-dtype fp8] [--util 0.9]
              [--overhead-gib 2.0] [--bandwidth-gbs 864] [--json]
  • MODEL: a Hugging Face id, or a local folder with config.json and *.safetensors. Gated models need HF_TOKEN in the environment.
  • Leave out --gpu to compare every GPU in the catalog with the smallest tensor-parallel size that works.
  • --json for scripts and CI.

How the maths works

vLLM takes gpu_memory_utilization × GPU memory, loads the weights, profiles a forward pass (activations, CUDA graphs), and gives the rest to the KV cache. gpu-fit mirrors that:

KV pool   = memory × utilization − weights / tp − overhead
KV/token  = 2 × full-attention layers × KV heads per GPU × head dim × dtype bytes
requests  = KV pool / (context × KV/token + sliding-window KV + recurrent state)

Speed estimates

gpu-fit also estimates decode speed (tokens per second): for one user, and per user at your concurrency. Generating a token is memory-bound, so the estimate divides the GPU's memory bandwidth by what each step reads: the weights (for mixture-of-experts models, only the experts in use) plus every active request's KV cache, with a fixed per-layer cost that matters for small MoE models. Prompt processing is not included. It's a planning estimate: real numbers from your hardware are welcome (see CONTRIBUTING.md).

Accuracy, measured

Predicted vs what vLLM 0.31 actually allocated on an AWS g6e.xlarge (1× L40S 48 GB), 32K context, --max-num-seqs 32. Raw data and method: bench/.

Model Type KV tokens (vLLM) KV tokens (gpu-fit) Error
Qwen/Qwen3-8B dense 175,696 174,639 −0.6%
Qwen/Qwen3-14B dense 75,888 76,882 +1.3%
Qwen/Qwen3.8-27B-FP8 hybrid + vision 137,216 134,122 −2.3%
Qwen/Qwen3.6-35B-A3B-FP8 hybrid MoE + vision 179,361 159,023 −11.3% (cautious)
  • Weights and KV per token come straight from the config, so they're exact.
  • Runtime overhead (activations, CUDA graphs) is calibrated from these runs: about 1.25 GiB for text models and 2 GiB when vLLM also profiles a vision encoder, plus a little more for each --max-num-seqs slot. Override it with --overhead-gib.
  • Hybrid models have a hard limit on --max-num-seqs. Each request needs one recurrent-state slot. Ask for more slots than fit and vLLM refuses to start; gpu-fit tells you the limit first (it predicted 156 where vLLM reported 164).
  • Treat the output as a planning estimate and confirm on the real GPU before you commit money.

Help make it exact: share what vLLM printed on your hardware (see CONTRIBUTING.md). Every measurement improves the defaults for everyone.

Roadmap

  • Memory model calibrated on real hardware (L40S)
  • Hybrid --max-num-seqs limit warning
  • Browser calculator
  • Decode speed estimate, MoE-aware
  • Speed calibrated against measured vLLM throughput
  • More GPUs measured (L4, H100) and models (Llama, Gemma, Mistral) from community results
  • Prompt-processing (prefill) time and time-to-first-token
  • Cost per million tokens for cloud GPUs
  • SGLang and TensorRT-LLM memory models
  • LoRA adapters and speculative decoding

License

MIT

Metadata

Release files for gpu-fit 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gpu-fit 0.3.0
File Size Uploaded Provenance Actions
gpu_fit-0.3.0.tar.gz 17.9 kB With provenance Details for gpu_fit-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gpu-fit 0.3.0
File Interpreter ABI Platform Actions
gpu_fit-0.3.0-py3-none-any.whl Python 3 none any Details for gpu_fit-0.3.0-py3-none-any.whl

Total release size: 33.3 kB

Release files / gpu_fit-0.3.0.tar.gz

Download URL gpu_fit-0.3.0.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
70184393d3abd2b72a0534e01b3c87d693a44691ea59d6d8a21e7e611ce6c700
BLAKE2b-256 checksum
How to use checksums
db61c677279b1a121899be6562bda011b57415b0abf1c0de3b0e94007c98ee9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / gpu_fit-0.3.0-py3-none-any.whl

Download URL gpu_fit-0.3.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e051f8cab7cc94b3259d3f06e1824628e38f3d0e00495200a8cad9b9c74014e9
BLAKE2b-256 checksum
How to use checksums
16b4357b8cea480cb1ed1d572cf1952f70ff9a7bf45014338f047cb10c37fd37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for gpu-fit 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gpu_fit-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page