esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

Serving Engines (vLLM, SGLang, TensorRT-LLM, llama.cpp)

Four engines that run AI models for users, what each one is built for, and how to choose between them, for your AI interview.

In short

A serving engine is the program that loads an AI model and answers requests from users. vLLM and SGLang suit a team's shared GPU server, TensorRT-LLM builds TensorRT engines for NVIDIA GPUs, and llama.cpp runs a model on one person's own machine.

11 min readIntermediateCommon · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

A serving engine is the program that runs an AI model for many people at once. You will hear four names: vLLM, SGLang, TensorRT-LLM and llama.cpp. For a team's shared server on GPUs, I would start with vLLM, which batches many requests and manages memory well, and test SGLang beside it. TensorRT-LLM is tuned for NVIDIA hardware and builds engines for it. llama.cpp is the simple choice for one person's own machine. I pick by hardware, traffic and the team's capacity to run it, then test under a realistic crowd of requests.

What is a serving engine, in plain words?

A serving engine is the program that loads an AI model and answers many people with it at once. It takes each request, groups requests so the GPU stays busy, looks after the memory each chat uses, and sends the answer back a few words at a time.

Think of a hospital bed manager. The doctors are the model. The bed manager decides who goes into which bed, when, and how many patients share a ward. The engine plays that part for requests and GPU memory.

Key words

Serving engine
The software that runs a model for users, takes their requests and returns answers.
GPU
The graphics chip that does most of the heavy maths when a model writes.
Batching
Running several requests through the model together, in one pass.
KV cache
The memory that keeps the model's notes on earlier words, so it does not redo them.

You will hear four names in interviews: vLLM, SGLang, TensorRT-LLM and llama.cpp. They all serve models, but each one is built for a different kind of job.

What are the four engines, and who is each for?

  • vLLM

    An open-source engine for serving many users from GPU servers. It can run an OpenAI-compatible API server, a front door that apps call in the same format as OpenAI's own service.

  • SGLang

    Built to run programs that make several model calls efficiently. Its runtime uses RadixAttention, a way to reuse the KV cache.

  • TensorRT-LLM

    NVIDIA's library. It builds TensorRT engines for NVIDIA GPUs. It is specifically customised for NVIDIA platforms, so it is built for that hardware.

  • llama.cpp

    Runs a model on one person's own machine. Per Hugging Face's llama.cpp guide, you can install it on macOS and Linux, or with WinGet on Windows, then download and run a GGUF model file, a packed model format it reads.

They overlap, so the useful part of your answer is the reason to pick each one.

  • “vLLM is a fast and easy-to-use library for LLM inference and serving.”

    vLLM project

  • “NVIDIA TensorRT-LLM provides users with an easy-to-use Python API to define Large Language Models (LLMs) and build NVIDIA TensorRT engines that contain state-of-the-art optimizations to perform inference efficiently on NVIDIA GPUs.”

    NVIDIA TensorRT-LLM docs

Why do engines batch requests and manage memory?

The PagedAttention paper behind vLLM makes the same point: serving at high throughput, meaning many answers per second, needs enough requests batched together. vLLM lists continuous batching, which adds new requests as others finish, among its main features.

The memory is the harder part. Each chat keeps its own KV cache, and that cache grows and shrinks as the chat goes on. If the engine manages it badly, memory is wasted on gaps and duplicate copies, so fewer chats fit on the GPU.

What a serving engine does

Many users at once

chats, claims and returns all day

Serving engine

Batches requests

runs many requests in one pass

Manages KV cache memory

keeps each chat's memory tidy

Model on GPU

weights stay loaded

Answers stream back

tokens sent as they are made

  1. 1Requests from many users reach the engine together.
  2. 2The engine groups them into batches and hands each group to the GPU.
  3. 3Each answer streams back as its tokens are made.
Requests from many users reach the engine together. It groups them into batches, manages their memory and runs the model on the GPU. Each answer streams back as its tokens are made.

A mid-size bank runs a support assistant. At 10 am, 300 chats are open at once. The numbers are made up, but the shape is real.

  1. 1

    Waste: memory lost to gaps and copies

    The paper says this memory can be wasted by fragmentation (gaps between pieces) and redundant duplication, which limits the batch size.

  2. 2

    Paged memory: small pages as chats grow

    vLLM hands out memory in small pages as each chat grows, inspired by how an operating system pages memory. Waste drops, so more chats share the same GPU.

  3. 3

    Keep adding requests as chats arrive

    The engine keeps adding requests to the running batch as they come in, so the GPU stays busy and answers keep flowing.

Tip

Asked how an engine saves memory, name the cause first: the KV cache grows with every token, and waste in that memory limits how many chats fit. Then name the fix.

How do you pick one?

Three things decide it: your hardware, your traffic, and how much setup your team can carry. Put those first, then test.

  • Team server

    GPUs in your data centre

    vLLM, SGLang or TensorRT-LLM, shared by a team behind one address. Expect setup work. TensorRT-LLM is made for NVIDIA GPUs.

  • One person

    A laptop or a small box

    llama.cpp. Simple to run on one machine, so it suits one user or a small private tool.

Where each engine fits

Team GPU server

TensorRT-LLM

builds TensorRT engines for NVIDIA GPUs

vLLM or SGLang

serves many users from one model

One person's machine

llama.cpp

runs a model on one person's machine

A team's shared service

one address, many users

One person's own tool

runs on your own machine

  1. 1A team's GPU server gives many people one shared address.
  2. 2llama.cpp gives one person a tool on their own machine.
Two kinds of setup. A team's GPU server can run TensorRT-LLM, vLLM or SGLang, and one person's machine runs llama.cpp. Each arrow ends at the job it serves.

The trade-off is setup effort against how closely the engine is built for one kind of hardware. TensorRT-LLM is built most closely for NVIDIA hardware, and llama.cpp needs the least setup for one person.

  • NVIDIA GPUs, and time to set it up

    Consider TensorRT-LLM. Check the release notes for how it loads your model.

  • Many users, or many chained model calls

    Shortlist vLLM and SGLang, and test both with your own prompts.

  • One person, or a small private tool

    llama.cpp is the simple choice.

Tip

Engines and their versions change fast. Quote the version you tested, and never promise a speed number before you measure it on your own traffic.

How would you choose an engine for a bank's assistant?

A mid-size bank wants an internal assistant for 2,000 staff. It must run on NVIDIA GPU servers in its own data centre, and answers must come back quickly at the 9 am rush. These are made-up details, but the constraints are typical.

  1. 1

    Check the hardware

    The servers are NVIDIA, so TensorRT-LLM is an option. Check its release notes for how it loads your model, and whether the team can own that work.

  2. 2

    Check the traffic

    Staff use the assistant in bursts at 9 am, so batching matters. vLLM and SGLang are the first two to test.

  3. 3

    Test both on real traffic

    Replay last month's real peak with the same model, then compare answers, speed and memory use. Measure rather than guess.

  4. 4

    Pick and plan a way back

    Lock the engine to one version, keep the previous one ready to switch back to, and watch the first week closely.

A strong answer ends on the test plan, not on the engine name.

What does the interviewer want to hear?

A strong answer covers

  • Name the four engines and the job each one is for.
  • Explain batching and the KV cache in plain words.
  • Say why memory, not only compute, limits how many users fit.
  • Say TensorRT-LLM builds engines for NVIDIA GPUs, so it is tied to that hardware.
  • Say llama.cpp suits one machine or a small private tool.
  • Pick by hardware, traffic and team capacity, then test.

Common traps

  • Trap"The four engines are all the same, so pick any one."

    BetterThey overlap, but each one fits a different hardware and traffic pattern.

  • Trap"The fastest engine always wins."

    BetterSpeed depends on your model, hardware and traffic. Measure it on your own load.

  • Trap"Run the bank's assistant on a laptop."

    BetterOne laptop cannot serve a whole bank. Use GPU servers with a batching engine, and load-test first.

Can you spot the risky plan?

Spot the risky plan

A team plans to serve 1,200 claims adjusters from one model. Which line is the risky one?

Quick check

An engineer wants a private note-summary tool on her own laptop. Which engine suits this best?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q055What is the KV cache, and why does it speed up generation?12 min
  2. Q314Static vs continuous batching?12 min
  3. Q317The latency vs throughput trade-off?10 min
  4. Q319What is PagedAttention / vLLM?12 min
  5. Q321What is speculative decoding?11 min
  6. Q327GPU basics: why does memory bandwidth limit decoding?11 min

Learn it in depth

Last updated on 27 November 2026

Serving an AI model to your whole team?

I design and build AI products and agents, and the system behind them. Book a short call and tell me who will use it and what hardware you have.