Skip to content
mentoor

Topic 1 of 6 · 4 min read

Choosing an inference engine to serve

Goal: Pick an inference engine for a stated model, GPU fleet and traffic level and name its main trade-off.

Pick the inference engine from your traffic and hardware, not from a benchmark chart: the right engine is the simplest one that keeps your GPUs busy.

Check yourself · 1 of 3

A team of five wants to run a small GGUF model on a Mac mini for their own use. Which engine fits best?

Choose one answer

Why it matters

A model file does nothing alone. An inference engine loads the weights, manages GPU memory, schedules requests and exposes an API. The same model on the same GPU can serve several times more users on a good engine than on a naive script. A wrong choice shows up later as idle GPUs, a rebuild for every model update, or a server that cannot run the model you want.

The four common choices

  • vLLM. A general server for NVIDIA, AMD and other accelerators. It supports a very wide list of open models, quantized formats and an OpenAI-compatible API. It is the default starting point for many teams.
  • SGLang. Similar scope to vLLM with strong prefix reuse (RadixAttention), which helps agents and chat apps that repeat long prompts. Check that your model and GPU appear on its supported list.
  • TensorRT-LLM. NVIDIA's engine. It can reach the highest throughput on NVIDIA GPUs, but models are compiled into engines for a specific GPU type and configuration. That adds build steps and slows model changes.
  • llama-server (llama.cpp). One small binary for GGUF models. It runs on CPUs, Apple silicon and single GPUs. It is excellent for one user or a small team, and not built for hundreds of concurrent requests.

How to choose

  1. Write down the model, the GPU type and count, the peak number of concurrent users and the latency target.
  2. Check the engine's supported-model page for your exact model and quantization.
  3. Start with the engine that needs the least setup and test it with your own prompts.
  4. Move to a more specialised engine only when a measurement shows you are paying for GPUs you cannot fill.

Before and after

Weak: "We read that TensorRT-LLM is the fastest, so we use it." The team has 12 different fine-tunes that change monthly. Every change means a rebuild and a re-test.

Better: "We use vLLM first. It loads each fine-tune directly. We will revisit TensorRT-LLM if one stable model takes most of our traffic and GPU cost becomes the main problem."

What goes wrong

  • Trusting vendor benchmarks. Results depend on prompt length, output length, model and GPU. Test with your own request mix.
  • Using llama-server for a public API. It handles a few users well, then queues badly under real load.
  • Ignoring the support matrix. A new architecture or quantization format may exist in one engine months before another.
  • Ignoring operations. An engine your team cannot upgrade, debug or monitor is slower in practice than a simpler one.

Examples

Three situations, three engines

Situation Reasonable engine Main trade-off
40 internal users, one 70B model on 2 GPUs, models change often vLLM Good all-round throughput, less peak speed than a compiled engine
Agent product with a 6,000-token shared system prompt SGLang or vLLM with prefix caching Test both; gains depend on how much prompt is shared
A developer's laptop or a Mac mini for one team llama-server Simple and portable, weak under heavy concurrency

When a compiled engine pays off

A company serves one model, fixed for a year, on a rack of identical NVIDIA GPUs, at steady high load. A build step per release is acceptable, and a 20 percent throughput gain removes a whole server. That is the case TensorRT-LLM exists for. The same team with weekly model changes would lose the gain to rebuilds.

Key points

  • An inference engine handles memory, scheduling and the API; the same model serves very different numbers of users on different engines.
  • vLLM and SGLang are general servers for many models; TensorRT-LLM trades flexibility for peak NVIDIA throughput; llama-server suits one user or a small team.
  • Choose by your model, GPUs, concurrency and latency target, and test with your own prompts.
  • Start with the engine that needs the least setup and switch only when a measurement shows wasted GPU capacity.
  • Check the supported-model and quantization list before you commit to an engine.

Common mistakes

  • Picking an engine from a leaderboard without testing your own prompt and output lengths.
  • Running llama-server in front of many concurrent users because it was easy on a laptop.
  • Skipping the supported-model check and discovering at deploy time that the quantized format does not load.
  • Treating the engine choice as permanent; the API is OpenAI-compatible, so switching early is cheap.

Check yourself · 2 of 3

A company serves 12 fine-tuned models that change every month, on NVIDIA GPUs. What is the main drawback of TensorRT-LLM for them?

Choose one answer

Check yourself · 3 of 3

A benchmark chart shows engine X is 30 percent faster than engine Y. What should you do before choosing X?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic