theLLMs

Last checked: 2026-05-30

Scope: Global. Engine versions and capabilities checked on 2026-05-30; each tool evolves rapidly.

AI draft model: gemma4:26b

AI review model: deepseek-r1:32b

Hero image for Hosting LLMs at scale: vLLM, TGI, SGLang and TensorRT-LLM compared

Hosting LLMs at scale: vLLM, TGI, SGLang and TensorRT-LLM compared

If you are serving an LLM to more than a handful of concurrent users, you need a production inference engine. The runtime you choose determines your throughput, latency, memory efficiency, and hardware cost.

There are four serious options in mid-2026: vLLM, SGLang, TensorRT-LLM, and TGI (Text Generation Inference). Each takes a different approach to batching, memory management, and hardware optimisation. Choosing the wrong one means either paying for GPUs you do not fully use or fighting the engine’s configuration limits.

This article is a deep-dive comparison for operators choosing a serving stack. If you are still deciding between Ollama, llama.cpp, and the production engines, start with the broader runtime comparison first.

TL;DR

For most teams deploying a production LLM service in mid-2026, vLLM is the default choice: it supports over 200 model architectures, has the largest community, and balances throughput with ease of setup. Switch to SGLang if your workload is DeepSeek-heavy or benefits from aggressive prefix caching. Choose TensorRT-LLM only if you are on NVIDIA H100/B200 and have the engineering capacity to manage its compilation pipeline. TGI is in maintenance mode and should not be used for new projects.

EngineBest forKey strengthKey trade-off
vLLMGeneral production serving with diverse modelsWidest model support (200+ architectures), mature ecosystemConfiguration learning curve for peak throughput
SGLangDeepSeek models, structured outputs, cachingRadixAttention, best-in-class prefix caching, fastest JSON decodingSmaller community, fewer model architectures
TensorRT-LLMMaximum throughput on NVIDIA hardwareHighest raw performance on H100/B200/BlackwellNVIDIA lock-in, requires model compilation, complex setup
TGIExisting Hugging Face deploymentsEcosystem integration, built-in safety featuresMaintenance mode — not recommended for new projects

How production engines differ from prototyping runtimes

Ollama and llama.cpp load a model and serve one request at a time. Production engines do the opposite: they maximise the number of tokens served per second under concurrent load.

The key architectural differences are:

  • Continuous batching: Accept new requests while existing ones are still generating. Without it, a single slow request blocks the queue. All four engines support this, but their scheduling strategies differ significantly.
  • Memory management: Production engines handle the KV-cache — the intermediate state that grows with each token generated — as a shared, dynamically allocated resource. How they manage this cache is the biggest performance differentiator.
  • Parallelism: When one GPU is not enough, production engines split the model across devices using tensor parallelism (splitting individual layers), pipeline parallelism (splitting layer groups), or expert parallelism (for MoE models).

The runtime you choose determines your throughput, latency, and hardware cost. The decision is the single largest operational choice you will make for a production LLM service.

vLLM: the general-purpose production engine

vLLM started as a research project at UC Berkeley (Sky Computing Lab) and has grown into the most widely adopted open-source inference engine, with contributions from over 2,000 contributors across academia and industry.

Architecture

vLLM’s defining innovation is PagedAttention — a memory management technique that treats the KV-cache like virtual memory pages. Instead of allocating a contiguous block of memory for each request’s KV-cache (which leads to fragmentation and wasted GPU memory), it allocates fixed-size blocks on demand and maps them through a page table.

Think of it as virtual memory for the GPU: the model fetches the blocks it needs, in any order, and the page table handles the mapping. The result is near-zero memory waste from fragmentation and the ability to pack more concurrent requests into the same GPU memory.

Batching strategy

vLLM uses continuous batching with chunked prefill. When a new request arrives, it can begin prefill (processing the input tokens) even while other requests are decoding (generating output tokens). It mixes prefill and decode steps in the same batch, which improves GPU utilisation.

Key features for production

  • Prefix caching: vLLM caches KV-cache entries for common prompt prefixes. If many requests start with the same system prompt, the engine reuses the cached computation.
  • Speculative decoding: Supports n-gram, suffix, and EAGLE-based draft models. This is the technique where a smaller draft model proposes tokens and the target model verifies them in parallel — often 2-3x throughput improvement for latency-sensitive workloads.
  • Disaggregated prefill/decode: You can run prefill (compute-heavy, short-lived) on one set of GPUs and decode (memory-bandwidth-bound, long-lived) on another. This allows independent scaling and better GPU utilisation.
  • Structured outputs: Uses xgrammar or guidance for JSON and grammar-constrained generation.
  • Tool calling and reasoning parsers: Native support for OpenAI-style function calling and multi-step reasoning patterns.
  • Quantization: FP8, MXFP8, MXFP4, NVFP4, INT8, INT4, GPTQ, AWQ, GGUF, and more.
  • Parallelism: Tensor, pipeline, data, expert, and context parallelism for distributed inference.

Model support

vLLM supports over 200 model architectures including all major decoder-only LLMs (Llama, Qwen, Gemma), mixture-of-expert models (Mixtral, DeepSeek-V3, Qwen-MoE), hybrid attention/state-space models (Mamba, Qwen3.5), multimodal models (LLaVA, Qwen-VL, Pixtral), and embedding/retrieval models.

No other engine comes close to this breadth.

When to use it

  • You serve diverse model types and need broad architecture support.
  • You want the most mature ecosystem with the largest community.
  • You need features like speculative decoding, disaggregated prefill, or multimodal support.
  • You are willing to spend a day or two tuning scheduling and memory parameters.

When to consider alternatives

  • DeepSeek MLA architectures run faster on SGLang (which has dedicated MLA kernels).
  • If you are on pure NVIDIA hardware and need every last drop of performance, TensorRT-LLM may edge ahead.
  • If your main workload is structured JSON output under heavy caching, SGLang’s RadixAttention may give better results.

SGLang: the caching and structured output specialist

SGLang comes from the LMSYS organisation at UC Berkeley — the same group behind the Chatbot Arena. It has gained significant traction since mid-2025, particularly for serving DeepSeek models and applications that benefit from aggressive prefix caching.

Architecture

SGLang’s core innovation is RadixAttention — a prefix-caching system that treats the KV-cache as a radix tree. Instead of caching only full-prompt prefixes (as vLLM does), SGLang caches any overlapping prefix substring.

The practical effect: if two requests share a common prefix — a system prompt, a few conversation turns, or a shared template — SGLang reuses every overlapping chunk of KV-cache, not just the complete prefix. In chat applications with repeated system prompts, partial context reuse, or multi-turn conversations, this can reduce prefill computation by 50-80%.

Batching strategy

SGLang uses a zero-overhead batch scheduler introduced in v0.4. The scheduler batches requests without stalling or wasting GPU cycles on padding. It also includes a cache-aware load balancer for multi-GPU deployments that routes requests to the GPU most likely to have their prefix already cached.

Key features for production

  • Compressed finite-state machine for JSON decoding: SGLang compresses JSON schemas into a finite-state machine, reducing the per-token validation overhead. Benchmarks show up to 3x faster structured output generation compared to grammar-based approaches.
  • DeepSeek MLA optimisation: SGLang has dedicated kernels for DeepSeek’s Multi-head Latent Attention architecture, achieving up to 7x speed improvement over generic implementations.
  • SGLang-Jax backend: Runs natively on Google TPUs in addition to NVIDIA GPUs.
  • Diffusion support: Can serve image and video generation models (experimental in mid-2026).
  • Structured outputs: Native support for JSON mode and constrained decoding.
  • Expert parallelism: First-class support for MoE-style expert parallelism.

Model support

SGLang supports fewer model architectures than vLLM, but it has been explicitly optimised for the most popular ones: Llama, Qwen, DeepSeek (exceptional MLA support), Mistral, Gemma, and common multimodal models.

When to use it

  • Your primary workload is DeepSeek models (V3, R1, V3.2).
  • You serve a chat application with high prefix-reuse ratios (shared system prompts, multi-turn conversations).
  • You need the fastest structured output generation.
  • You want to deploy across both NVIDIA GPUs and Google TPUs.

When to consider alternatives

  • You need support for niche or less common model architectures.
  • You prefer a larger ecosystem with more community tooling and integration examples.
  • You need multimodal support beyond the common vision-language models.

TensorRT-LLM: NVIDIA’s maximum-performance engine

TensorRT-LLM is NVIDIA’s production inference engine. It compiles models into optimised CUDA kernels tailored to specific GPU architectures (H100, B200, Blackwell). The trade-off is clear: you get the highest possible throughput on NVIDIA hardware, but you are locked into NVIDIA GPUs and a more complex build pipeline.

Architecture

Unlike vLLM and SGLang (which load PyTorch models and optimise at runtime), TensorRT-LLM requires a model compilation step. You convert a model into a TensorRT engine — a hardware-specific binary optimised for your exact GPU model, batch size, precision, and sequence length.

The compilation process can take 30 minutes to several hours for large models, but the result is a set of fused CUDA kernels that squeeze every cycle out of the hardware.

Batching strategy

TensorRT-LLM uses inflight batching (NVIDIA’s term for continuous batching) with CUDA graph optimisation. CUDA graphs capture entire sequences of GPU operations and replay them without CPU intervention, reducing launch overhead. TensorRT-LLM can tune the batch size of these graphs dynamically for different phases of inference.

Key features for production

  • DWDP (Distributed Weight Data Parallelism): NVIDIA’s technique for running large models across NVL72 systems, where weight data is distributed across devices with minimal communication overhead.
  • Sparse attention: Support for sparse attention patterns that reduce computation for long-context models.
  • Inference-time compute: Techniques that allocate additional computation at inference time to improve output quality (analogous to “thinking” or “chain-of-thought” at the engine level).
  • Expert parallelism: Highly optimised MoE parallelism for models like DeepSeek-V3, with NVLink-aware communication.
  • In-flight batching with CUDA graph support: Dynamically sized CUDA graphs that adapt to changing batch compositions.
  • 2026 updates: DeepSeek-V3.2 on Blackwell, sparse attention kernel, joint optimisation for agent applications.

Model support

Fewer architectures than vLLM or SGLang, but covers all major ones: Llama, Qwen, DeepSeek, Mistral, Gemma, Nemotron, and common multimodal models. Each new architecture requires explicit kernel support, so there is a lag after new model releases.

When to use it

  • You are running on NVIDIA H100, B200, or Blackwell GPUs.
  • Maximum throughput is your primary goal and you can invest in the setup complexity.
  • You are deploying at a scale where GPU utilisation is a direct cost driver.
  • Your team has the expertise to manage the compilation pipeline.

When to consider alternatives

  • You use non-NVIDIA hardware (AMD, Intel, Apple Silicon, TPUs that are not Google-made).
  • You need to frequently swap models or experiment with new architectures.
  • Your team cannot afford the setup and maintenance overhead of the compilation pipeline.

TGI: the maintenance-mode legacy option

TGI (Text Generation Inference) was Hugging Face’s production inference server. As of early 2026, it is in maintenance mode — Hugging Face itself directs users to vLLM or SGLang for new deployments.

This is not an indictment of TGI’s quality. It served reliably at Hugging Face for years, powering Hugging Chat, the Inference API, and Inference Endpoints. But the team decided to redirect their efforts toward the upstream engines that now use the transformers model architecture standardisation that TGI helped establish.

What TGI still offers

  • Continuous batching and Paged Attention (adopted from vLLM’s approach).
  • Speculative decoding with ~2x latency improvement.
  • Guidance/JSON structured output support.
  • Watermarking for AI-generated content detection.
  • Distributed tracing with OpenTelemetry and Prometheus metrics.
  • Messages API compatible with OpenAI’s Chat Completion API.
  • Broad hardware support: NVIDIA, AMD, Intel, Gaudi, Google TPU, AWS Inferentia.

When (if ever) to use it

TGI is reasonable if you already have a production deployment running on it and the migration cost is higher than the maintenance risk. It is not the engine to start a new project on.

Decision framework

By workload type

WorkloadBest engineWhy
General-purpose chat with diverse modelsvLLMWidest model support, mature tooling
DeepSeek V3/R1 at scaleSGLangDedicated MLA kernels, RadixAttention for caching
JSON/structured output heavy APISGLang3x faster JSON decoding with compressed FSM
Maximum throughput on H100/B200TensorRT-LLMHardware-optimised compiled kernels
Multi-turn conversation (high prefix reuse)SGLangRadixAttention caches at substring granularity
Mixed model zoo (swap models frequently)vLLMNo compilation step, broadest architecture support
Running on TPUsSGLangSGLang-Jax backend
Existing TGI/HF deploymentvLLM (migrate) or keep TGIMaintenance risk vs migration cost

By team capability

TeamBest engineWhy
Small team, small model zoovLLMBest documentation, largest community, easiest debugging
ML-infra team, NVIDIA-onlyTensorRT-LLMCan afford compilation pipeline for maximum perf
Research team, frequent model swapsvLLMFastest iteration cycle, no compilation
Scale-up, cost-optimisedTest vLLM vs SGLang on your workloadRun your actual workload on both before committing

By hardware

HardwareEngines
NVIDIA H100/B200/BlackwellAll four, but TensorRT-LLM gives highest throughput
AMD MI300XvLLM, SGLang
Google TPUSGLang (Jax backend)
Apple SiliconNone — use llama.cpp or Ollama locally
Intel GaudiTGI (maintenance mode only)

Migration paths

From Ollama or llama.cpp to production

If you started with Ollama and need production throughput, the most common path is:

  1. Dockerise your model with vLLM’s OpenAI-compatible server.
  2. Keep Ollama for local development and quick experiments.
  3. Route production traffic to vLLM behind a load balancer.

From TGI to vLLM or SGLang

TGI’s OpenAI-compatible API means migration is often a URL swap:

  1. Deploy vLLM or SGLang with the same model.
  2. Point your application at the new endpoint.
  3. Verify that structured output behavior matches.
  4. Decommission TGI after a monitoring period.

Between vLLM and SGLang

Both expose OpenAI-compatible APIs, so swapping is straightforward at the endpoint level. Some features differ:

  • vLLM’s enable_prefix_caching vs SGLang’s RadixAttention: SGLang caches more aggressively at the substring level.
  • JSON mode should be tested if you rely on structured outputs — the validation behaviour differs slightly between engines.

Common mistakes

  1. Choosing based on a single benchmark. In-house benchmarks are valuable. Published numbers are usually run on ideal hardware with ideal workloads. Test with your actual prompt distribution, request rate, and latency requirements.

  2. Skipping prefix caching configuration. Many operators leave prefix caching disabled in vLLM or do not configure RadixAttention in SGLang. For chat workloads with shared system prompts, this can mean 2-3x more prefill computation than necessary.

  3. Over-allocating GPU memory. Setting gpu_memory_utilization to 0.95 in vLLM sounds efficient, but it leaves no headroom for memory spikes during batch composition changes. Start at 0.85 and tune up.

  4. Assuming TensorRT-LLM is always fastest. On the same hardware, a well-tuned vLLM or SGLang deployment is often within 10-20% of TensorRT-LLM’s throughput, and it took far less setup time. The compilation pipeline makes TensorRT-LLM a real commitment.

  5. Staying on TGI because it works. TGI works. That is true. But it will not get security patches, performance improvements, or new model support. The maintenance risk compounds over time. Plan the migration while you have the time, not when you are forced.

Methodology

  • Data checked: 2026-05-30
  • Sources consulted: Official documentation and repositories for vLLM, SGLang, TGI, and TensorRT-LLM; LMSYS blog and benchmarks; NVIDIA technical blogs and GPU technology conference proceedings; community deployment reports
  • Assumptions: Engine versions and capabilities change rapidly. Performance comparisons depend heavily on model, hardware, and workload characteristics. The guidance above reflects mid-2026 patterns and typical use cases, not exhaustive benchmarking.
  • Limitations: This article does not run benchmark comparisons on specific hardware configurations. It does not cover Kubernetes deployment patterns, autoscaling strategies, or multi-region serving in depth. Specific engine versions and features may have changed since publication. Hardware-specific optimisations (AMD ROCm, Intel Gaudi) are mentioned only where relevant.
  • Jurisdiction: Global. Engine availability and hardware access do not vary significantly by jurisdiction, though export controls on certain GPU hardware may affect deployment options in some regions.

Source list

Trust Stack

  • Last checked: 2026-05-30
  • Corrections: Contact us to report errors

Change log

  • 2026-05-30: First published. Covers vLLM, SGLang, TensorRT-LLM, and TGI (maintenance-mode) with performance comparison, decision framework, migration paths, and common mistakes.