Inference engines
What an engine does
You don't write your own database; you run one. An inference engine does the same for models. It brings continuous batching, KV cache memory, fast kernels and an HTTP API, so you don't build them. Well-known engines are vLLM, SGLang, TensorRT-LLM and llama.cpp. You still choose the model, the hardware and the settings.
vLLM and SGLang
vLLM and SGLang are open-source servers for GPUs. Both use continuous batching and paged KV memory. Both offer an OpenAI-compatible API, so apps built for OpenAI's API need little change. SGLang is built around RadixAttention, which keeps old prompts' KV cache in a radix tree and reuses shared starts. vLLM also has prefix caching. Prefix reuse helps most when many calls share the same start.
TensorRT-LLM
TensorRT-LLM, from NVIDIA, is tuned hard for NVIDIA GPUs. Its classic setup compiles a model into an engine for a chosen GPU. The aim is top speed. The cost is more setup: limits like the longest request are set at build time, so big changes mean a rebuild. It runs on NVIDIA GPUs only.
llama.cpp
llama.cpp runs models on CPUs, Apple laptops and small GPUs. It uses quantized models, often 4-bit, in its GGUF file format. A 7B model at 4 bits takes about 4 GB. It is built for local and edge use, not for serving thousands of users.
Comparing engines fairly
To compare engines, change only the engine. Keep these the same:
- the model and its precision
- the GPU
- the context limit
- the workload: prompt lengths, answer lengths and traffic
Report two numbers: latency at low load, and throughput at peak. Then pick the engine that fits your own workload.
Remember
- An engine does batching, KV memory, kernels and the API for you.
- vLLM and SGLang: open-source GPU servers; SGLang centers on prefix reuse.
- TensorRT-LLM: compiled for NVIDIA GPUs, more setup.
- llama.cpp: quantized models on laptops and CPUs.
- Fair tests change only the engine.