vllm bench serve: How to Benchmark an Inference Server

vllm bench serve: How to Benchmark an Inference Server

Published on

2

views

Use vllm bench serve to measure inference server throughput and latency, design a realistic workload, and interpret results without misleading comparisons.

The fastest way to understand vllm bench serve is to treat it as a load generator for an already running inference server. It sends requests, measures responses, and reports serving metrics such as throughput and latency. It does not prove that the model made good decisions. For a routing or classification system, you need a separate quality check alongside the performance run.

Start with a server and a small workload

Before benchmarking, start a vLLM server with the model you intend to evaluate and confirm that its API responds. Then run the benchmark from a terminal that can reach that server. The benchmark client and server can run on the same machine, but their shared CPU and network resources may affect the results. For a serious comparison, document where each process runs.

A useful first command is `vllm bench serve --help`. Use it to inspect the options supported by your installed version; flags and defaults can change. In particular, check the backend, endpoint, model, dataset, prompt count, request rate, and output-length options before copying a command from an old tutorial.

For a common local setup, an illustrative invocation is `vllm bench serve --backend openai --base-url http://localhost:8000 --endpoint /v1/completions --model YOUR_MODEL --dataset-name random --num-prompts 100`. Replace `YOUR_MODEL` with the model identifier your server exposes. Verify the supported flags and the endpoint against your installation: a chat endpoint, for example, expects a different request shape from a completions endpoint.

Start with a small run and inspect errors before scaling up. A completed command is not automatically a valid benchmark: a wrong model identifier, incompatible endpoint, or rejected request can leave you measuring failures rather than inference. Save the command, server configuration, and raw output together so another engineer can reproduce the setup.

Illustration for vllm bench serve

Read latency and throughput together

The numbers produced by vllm bench serve answer different questions. Request throughput describes completed requests over time; output-token throughput describes generated tokens over time. Neither tells you by itself whether an individual user got an acceptable response.

Time to first token, often abbreviated TTFT, measures how long it takes before generation begins delivering output. For an interactive assistant, that can be an important part of perceived responsiveness. For a decision API that needs the entire label before acting, end-to-end latency is usually closer to the product requirement. A fast first token does not help much if the final structured response arrives too late.

Inter-token latency describes the spacing between generated tokens when the benchmark and endpoint support measuring it. It matters for streaming text, but can be less informative for a one-label classifier. Look at the exact metric definitions in the version you run, including whether reported latencies cover only successful requests and how percentiles are calculated.

Percentiles matter because an average hides slow requests. If your service has a latency objective, compare it with the corresponding tail percentile under the intended load, not just with the mean from an idle server. Also record completed and failed request counts. A high throughput figure accompanied by errors is not evidence that the deployment can sustain that load reliably.

Shape the workload around the decision

Random prompts are useful for checking that the harness works and for controlled length experiments. They are not a substitute for actual traffic. A realistic benchmark should reflect the input lengths, output limits, arrival pattern, and concurrency your application expects. For a router, a short user message followed by a small structured label is a different workload from a long document summary.

Consider an illustrative support-routing input: “I was charged twice; where do I report it?” The expected product output might be a label such as `billing`, plus an optional confidence value. That example defines what the system must return; it is not a benchmark result. Include ambiguous requests and malformed inputs in a separate evaluation set, with expected behavior defined before looking at model outputs.

Keep input and output lengths explicit. Longer prompts increase the amount of input processing; longer responses add generation work. A model that appears fast with tiny random inputs may miss its deadline on the documents your service actually receives. Check the benchmark's dataset options and whether its length settings describe requested, sampled, or realized token counts.

Visual context for vllm bench serve

Control load before comparing systems

A vllm bench serve run at one request rate is one point on a curve, not the capacity of the server. Repeat the experiment at increasing arrival rates or concurrency levels supported by your version. Watch where queueing drives tail latency beyond your service objective or errors begin to rise. A bursty production workload may need its own test; a steady arrival rate alone will not describe it.

Run a warm-up before the measured trials and state what it included. Then repeat each configuration and retain individual results rather than reporting only the best run. Record the model and revision, vLLM version, hardware, precision or quantization, server arguments, prompt distribution, output limit, client placement, and any competing traffic. Those details can change the conclusion as much as the model name.

When comparing a generative endpoint with a non-autoregressive decision model, define the boundary carefully. Is latency measured at the client, including network transfer and parsing? Does each system receive the same information and return a usable decision? An output-token-per-second comparison is not meaningful for a system that produces a class score rather than generated tokens. Compare completed, valid decisions per second and end-to-end latency under equivalent quality and load requirements instead.

Add the quality gate

For decision workloads, I would join each performance result to an evaluation of correctness and failure handling. Measure whether the returned label matches a reviewed reference, whether the response parses, and what happens when the system cannot decide. If confidence is available, assess calibration against outcomes; a confident number is not itself proof of reliability.

Keep quality evaluation separate from the load test if the benchmark does not calculate it. Capture outputs on a representative dataset, score them with a reproducible script, and report invalid responses and timeouts alongside classification errors. Check that logging or output capture does not distort the performance measurement.

The practical next step is simple: get one clean baseline, save the configuration, and change one workload or server setting at a time. Show me the decision, the latency distribution, and the failures—not just the highest throughput number.

Last updated:

Share:

Leave a comment

Related Articles