LLM Inference Engines — vLLM vs TensorRT-LLM vs llama.cpp vs SGLang
As of 2026-11-24
What is LLM Inference Engines?
The inference engine, not the model, is the single biggest lever on LLM serving cost — the same Llama-3-70B can cost 3-10× more on a naive generate loop than on a tuned vLLM or TensorRT-LLM deployment.
An LLM inference engine is the runtime layer that turns a trained model's weights into served tokens: it schedules incoming requests, manages GPU memory, batches prompts together, and decodes outputs token by token. The engine choice is arguably the single biggest lever on serving cost in the entire generative AI stack — the same seventy-billion-parameter open-weight model can cost about ten times more to run, or worse, on a naive, unoptimised serving loop than on a properly tuned production engine, before anyone has touched model size or prompt design.
The Four Engines That Matter
vLLM, born out of UC Berkeley research, is the open-source reference implementation most teams reach for first. Its signature technique, PagedAttention, manages the key-value cache the way an operating system manages virtual memory, which lets it pack far more concurrent requests onto the same GPU than earlier serving stacks. Combined with continuous batching — folding new requests into a running batch instead of waiting for the whole batch to finish — vLLM covers a huge range of open-weight model families and is genuinely easy to operate, which is why it has become the default choice for teams self-hosting Llama, Mistral, Qwen or similar models on NVIDIA or AMD hardware.
Why it matters
- vLLM is the open-source default for broad model coverage and Python ergonomics; TensorRT-LLM is often put at 1.5-2× its throughput on H100/H200 (estimate, to measure) and locks you to NVIDIA, but since release 1.3.0 it no longer needs a per-model engine build.
- llama.cpp is the edge/laptop engine (LLaMA 7B Q4_0: about 14 tok/s on a base M1, roughly 55-120 on Max chips), not a data-centre choice; SGLang's RadixAttention has been measured up to 5× faster than vLLM without prefix caching on agentic workloads with heavy prefix reuse.
- The decision maps directly to workload: TensorRT-LLM for latency-sensitive single-user chat, vLLM for high-throughput batch RAG, SGLang for multi-turn custom agents on a self-hosted model (BYOM on SAP AI Core) with shared system prompts.
Key points
- Four dominant engines — vLLM (open-source default), TensorRT-LLM (max throughput on NVIDIA), llama.cpp (CPU/edge), SGLang (prefix reuse for agents).
- vLLM combines PagedAttention + continuous batching — 8.5-24x the throughput of Hugging Face Transformers in vLLM's launch benchmark (June 2023, LLaMA 7B and 13B).
- TensorRT-LLM (FP8/INT8 optimised kernels) — often put at 1.5-2x vLLM on H100 (estimate); since 1.3.0 (20 Nov 2026) PyTorch is the only backend and no engine build is needed; NVIDIA-only.
- SGLang's RadixAttention shares KV-cache across requests with common prefixes — measured up to 5x vLLM without prefix caching on agentic + few-shot workloads (LMSYS, Jan 2024).
- Engine choice is the single biggest cost lever — a naive serving loop can multiply the GPU bill several times over, and the wrong production engine can leave much of the throughput on the table, before any model tuning matters.
- Q4 quantisation on a 70B model: weights from about 140 GB (70 billion × 2 bytes) to roughly 40 GB (order of magnitude); the accuracy loss depends on model and task — measure it on your own SAP extraction set.
- OpenAI-compatible API (/v1/chat/completions): vLLM and TensorRT-LLM both implement it — swap model or engine without touching the SAP integration layer.
- Production monitoring metrics: tokens/s per GPU, TTFT P50/P99, KV-cache hit rate, KV-cache usage (all exposed via Prometheus by vLLM); overall GPU memory utilisation comes from NVIDIA DCGM Exporter.
- llama.cpp: LLaMA 7B (Q4_0) at about 14 tokens/s on a base M1 and roughly 55-120 tokens/s on Max chips (llama.cpp benchmark thread) — a laptop/edge engine, not a datacenter one.
- SAP deployment pattern: Docker container on SAP AI Core + OpenAI-compatible endpoint = BTP/Datasphere/Joule integration unchanged when the model is swapped.
Terms used on this page
- Inference engine
- The runtime that loads model weights into GPU/CPU memory, schedules incoming requests, manages the KV-cache, and decodes output tokens; distinct from the model itself.
- vLLM
- Open-source LLM inference engine from UC Berkeley (2023) built around PagedAttention and continuous batching; the de-facto reference for self-hosting open-weight models — and one of the serving backends SAP's own sample repository documents for the Bring-Your-Own-Model path on SAP AI Core.
- TensorRT-LLM
- NVIDIA's inference engine, with CUDA-optimised kernels and FP8/INT8 quantisation; built for maximum throughput on NVIDIA hardware, and one of the backends NVIDIA NIM microservices use depending on the model profile. Since 1.3.0 it runs on PyTorch only, with no engine build.
- RadixAttention
- SGLang's technique of organising KV-cache as a prefix tree so multiple requests sharing system prompt / few-shot exemplars reuse the cached compute.
- llama.cpp
- A C/C++ inference engine for quantised models (GGUF format) that runs on ordinary CPUs, Apple Silicon or a single consumer GPU; the natural choice for edge, laptop or air-gapped deployment, not for data-centre-scale serving.
- Continuous batching
- A scheduling technique that folds newly arrived requests into an already-running batch rather than waiting for the whole batch to finish, keeping GPU utilisation high under variable, real-world traffic.
- OpenAI-compatible API
- The /v1/chat/completions request/response contract that vLLM, TensorRT-LLM and most serving engines implement, letting a model or engine be swapped behind an SAP integration layer without touching the calling code.
- GGUF
- The container format of the GGML project — the format llama.cpp uses for quantised model weights, with one quantisation type per file (variants from Q2_K through Q8_0 are published as separate files) (see “Quantization Strategies — INT8, INT4, AWQ, GPTQ, GGUF”).
Sources
- Kwon et al. — Efficient Memory Management for Large Language Model Serving with PagedAttention (vLLM paper, SOSP 2023)
- NVIDIA TensorRT-LLM documentation
- ggerganov/llama.cpp GitHub repository
- Zheng et al. — SGLang: Efficient Execution of Structured Language Model Programs
- https://help.sap.com/docs/SAP_AUTONOMOUS_SUITE
- SAP News Center — How SAP and NVIDIA Advance Enterprise AI Transformation (NIM inference optimisation, SAP-ABAP-1, 2026-03-17)
- GitHub SAP-samples — btp-generative-ai-hub-use-cases: bring-your-own OSS LLM on SAP AI Core (Ollama, LocalAI, llama.cpp, vLLM, custom HF Transformers server)
- GitHub SGLang — sgl-project/sglang (RadixAttention engine)
- SAP Help Portal — Choose a Resource Plan for training/inference in SAP AI Core
- OpenAI — Chat Completions API reference (the compatibility contract vLLM/TensorRT-LLM implement)
- NVIDIA Newsroom — SAP and NVIDIA to Accelerate Generative AI Adoption Across Enterprise Applications
- GitHub NVIDIA — TensorRT-LLM
- llama.cpp — performance of llama.cpp on Apple Silicon M-series (benchmark discussion)
- NVIDIA TensorRT-LLM documentation — PyTorch backend
- Red Hat — Red Hat launches the llm-d community (with Google, IBM Research, NVIDIA, CoreWeave), 20 May 2025
- NVIDIA — TensorRT-LLM 1.3.0 release notes (20 November 2026): TensorRT backend removed
- LMSYS — Fast and Expressive LLM Inference with RadixAttention and SGLang (17 January 2024)
- vLLM — Easy, Fast, and Cheap LLM Serving with PagedAttention (launch benchmark, 20 June 2023)
- Google Cloud — llm-d 1.0: an open-source stack for distributed inference
- AWS — Push-based KV transfer to improve TTFT and TPOT for disaggregated inference in vLLM
Full card with the Consultant plan — €19.90/month. What the full card adds: the full decision framework · the SAP vs Snowflake / Databricks / Fabric comparison · the common pitfalls and their fix · the cheat sheet · the architecture schemas · the code blocks · the facts worth quoting.
Open missions
50 live roles and contracts in SAP AI & Joule right now — see the SAP AI & Joule missions · freelance SAP contracts.