vLLM vs SGLang vs TGI vs llama.cpp
These are not really competitors; they are answers to four different questions. The mistake is picking on model support alone, because the thing that actually determines throughput is your traffic shape.
Short answer
Start with vLLM. Benchmark SGLang against it if more than a few hundred requests share a long system prompt, because prefix reuse compounds and the gap is not marginal.
By Lattice editorial · Licence and cost facts verified · method
- vLLMThe default. Paged attention, widest ecosystem.
- SGLangPrefix sharing and structured output specialist.
- Text Generation InferenceHugging Face's tensor-parallel server.
- llama.cppCPU-first, GGUF-native, runs anywhere.
| Dimension | vLLM | SGLang | Text Generation Inference | llama.cpp |
|---|---|---|---|---|
| Best for | General GPU serving under bursty load | Heavy shared prefixes, constrained decoding | Multi-GPU tensor parallelism in an HF shop | Local, edge, or no-GPU deployments |
| Prefix caching | Automatic prefix caching | RadixAttention — strongest on long shared prefixes | Supported, less heavily optimised | KV cache reuse, not prefix-aware by default |
| Hardware floor | One CUDA GPU | One CUDA GPU | Multi-GPU, designed for it | None — CPU is the default path |
| Quantised formats | AWQ, GPTQ, FP8 | AWQ, GPTQ, FP8 | AWQ, GPTQ, FP8 | GGUF, any quant level |
| API compatibility | OpenAI-compatible server | OpenAI-compatible server | OpenAI-compatible server | OpenAI-compatible server + native CLI |
| Where it loses | Prefix-shared workloads, where SGLang wins | Small teams wanting the least moving parts | Single-GPU deployments — overkill | Maximum concurrent throughput |
Scroll the table sideways to see every tool.
What this table is not. These are editorial judgements, not benchmarks: Lattice has not run these tools head to head, and no cell uses GitHub stars or vendor benchmark claims as evidence. Licence and cost facts are re-checked on a schedule the build enforces — the receipt is public.
The recommendation
Which should you choose: vLLM, SGLang, Text Generation Inference or llama.cpp?
Start with vLLM. Benchmark SGLang against it if more than a few hundred requests share a long system prompt, because prefix reuse compounds and the gap is not marginal. Use llama.cpp when the constraint is hardware rather than throughput. Reach for TGI only when you specifically need multi-GPU tensor parallelism inside an existing Hugging Face setup.
Rules of thumb
- Bursty traffic is what makes continuous batching pay. Steady low-concurrency traffic is better served by a managed API.
- Never benchmark on single-stream latency — it measures the wrong thing and will point you at the wrong runtime.
- Two GPUs running two replicas behind a load balancer usually beats one GPU running a sharded model.
Quick answers
- When should you use vLLM, and when should you skip it?
- Use vLLM when: general GPU serving under bursty, high-concurrency traffic. Skip it when: traffic is steady and low-concurrency, so batches never fill.
- When should you use SGLang, and when should you skip it?
- Use SGLang when: a large share of requests share a long prefix, or you need constrained decoding. Skip it when: you want the fewest moving parts and vLLM already clears your bar.
- When should you use Text Generation Inference, and when should you skip it?
- Use Text Generation Inference when: multi-GPU tensor parallelism inside an existing Hugging Face stack. Skip it when: the model fits on one GPU, where this is overkill.
- When should you use llama.cpp, and when should you skip it?
- Use llama.cpp when: the constraint is hardware, not throughput — no GPU, or an edge box. Skip it when: you need maximum concurrent throughput on datacentre GPUs.