- Mon 25 August 2025
- Neuron
Benchmarking vLLM on Neuron with LLMPerf
A speed benchmark of an inference server measures throughput and latency. Server-level throughput is the number of output tokens the server produces per second, and it determines how many instances a given load needs. Request-level latency is the time to first token (TTFT) and the time per output token, and it determines whether a service meets its latency targets. Both depend on the number of concurrent requests, the prompts, the sampling parameters and the length of the run. This post describes how to measure them for a vLLM server on Trainium or Inferentia with the LLMPerf client. It also covers three LLMPerf definitions that differ from the usual ones.
Setup
The server is vLLM with the Neuron backend, serving the OpenAI-compatible API. The client is LLMPerf, which sends streaming chat completion requests at a fixed concurrency and records the timing of every streamed chunk. Client and server run on the same instance and talk over the loopback interface, so network latency between hosts does not enter the measurements.
The Neuron vLLM user guide for Neuron SDK 2.25 starts the server with the NxD Inference backend:
VLLM_NEURON_FRAMEWORK='neuronx-distributed-inference' python -m vllm.entrypoints.openai.api_server \
--model="meta-llama/Llama-3.1-8B-Instruct" \
--max-num-seqs=4 \
--max-model-len=2048 \
--tensor-parallel-size=8 \
--port=8000 \
--device "neuron"--max-num-seqs is the largest batch the server runs at
once, and a Neuron model is compiled for that batch size. A client
concurrency above it only adds queueing time to TTFT.
--max-model-len has to cover the longest prompt plus the
largest number of output tokens the client requests.
Metrics in LLMPerf
LLMPerf records these values for every request:
ttft_s: the time from sending the request to receiving the first streamed chunk with content. On a server that is not overloaded, this is mostly the prefill of the prompt.end_to_end_latency_s: the time from sending the request to the end of the stream.inter_token_latency_s: the time per output token.number_input_tokensandnumber_output_tokens: the prompt length and the number of generated tokens. A request can stop before itsmax_tokenslimit, so the output count can be lower than requested.request_output_throughput_token_per_s: output tokens divided by the end-to-end latency of that request.
At the end of a run, LLMPerf reports
mean_output_throughput_token_per_s, the sum of output
tokens over all completed requests divided by the wall-clock time of the
run. This is the server-level throughput. The per-request throughput
times the concurrency approximates it only while the client keeps every
slot busy.
Inter-token latency includes TTFT
The OpenAI client in LLMPerf appends the TTFT to the list of gaps between chunks, and the benchmark then divides the sum of that list by the number of output tokens. The result is close to end-to-end latency divided by output tokens:
LLMPerf: ITL = (TTFT + time between first and last token) / output_tokens
Excluded: ITL = (end_to_end_latency - TTFT) / (output_tokens - 1)
With long prompts or a queue at the server, TTFT is large, and the first definition reports a higher per-token latency than the decode steps actually take. The Neuron LLM inference benchmarking guide treats TTFT and time per output token as separate metrics and supplies a patch for LLMPerf that excludes TTFT from the second one. A report that gives ITL should say which definition it uses.
Token counts use a Llama 2 tokenizer
LLMPerf builds prompts and counts output tokens with the
hf-internal-testing/llama-tokenizer, a Llama 2 tokenizer.
For any other model, including Llama 3, these counts differ from the
number of tokens the model processed. The throughput and per-token
latency that LLMPerf computes from them are off by the same ratio. The
same Neuron patch adds an option to use the tokenizer of the model under
test.
Concurrency
Before a fix merged in December
2024, LLMPerf waited for a full group of
num_concurrent_requests requests to finish before sending
the next requests. The server ran at the target concurrency only at the
start of each group, and the measured throughput was lower than the
server could sustain. Results from older versions of LLMPerf understate
throughput at a given concurrency.
Client invocation
export OPENAI_API_BASE='http://localhost:8000/v1'
export OPENAI_API_KEY='EMPTY'
python token_benchmark_ray.py \
--model meta-llama/Llama-3.1-8B-Instruct \
--llm-api openai \
--mean-input-tokens 550 \
--stddev-input-tokens 150 \
--mean-output-tokens 800 \
--stddev-output-tokens 200 \
--num-concurrent-requests 4 \
--max-num-completed-requests 1000 \
--timeout 21600 \
--additional-sampling-params '{"temperature": 0.5, "top_p": 0.9}' \
--results-dir results/LLMPerf draws the input and output lengths of each request from
normal distributions with the given means and standard deviations. The
output length becomes the max_tokens of the request. The
run ends when --max-num-completed-requests requests have
finished or the --timeout in seconds expires, whichever
comes first.
--additional-sampling-params sets the sampling
parameters on every request. Without it, the server uses its own
defaults, which may differ from the parameters that production clients
send. Temperature and top-p affect when a model emits its
end-of-sequence token, so they also affect output lengths and
throughput.
Prompts
LLMPerf’s default prompt is a block of Shakespeare sonnet lines, padded to the sampled input length, with an instruction to stream random lines from it for the requested number of tokens without emitting an end-of-sequence token. Without speculative decoding, the cost of a decode step depends on the batch size and the sequence lengths, and the content of the prompt has little effect. The synthetic prompt works for this case.
With speculative decoding, the speedup depends on how many draft tokens the target model accepts per step. Leviathan et al. (2023) report acceptance rates that vary by task and by model pair, so the synthetic prompt gives an unrepresentative speedup. A benchmark of speculative decoding uses prompts from real tasks, grouped by task type. The following public datasets cover the common task types:
| Task type | Datasets |
|---|---|
| Coding | HumanEval, MBXP |
| Reasoning | GSM8K, BIG-bench arithmetic |
| Summarization | DialogSum, WikiLingua |
| Question answering | SQuAD v2, QuAC |
| Conversation | MultiWOZ 2.2, DSTC11 track 5 |
| Mixed | ShareGPT |
The metrics are averaged over the datasets in each task type, and then over task types, so each type carries equal weight regardless of how many datasets it has. Using these datasets requires changing LLMPerf’s prompt source, which is the sonnet file.
Dataset prompts usually come without the chat template the model was
trained with. vLLM’s /v1/chat/completions endpoint, which
LLMPerf calls, applies the model’s template on the server. A prompt that
already contains the template would then receive it twice. The template
has to be applied in exactly one place, either the client or the
server.
Run length
A run of 1,000 requests at low concurrency takes minutes, which is enough to compare configurations. A run of an hour or more shows whether throughput and latency stay constant under sustained load and whether server memory grows over time. Running the chosen configuration for that long checks it before it serves traffic.
From measurements to capacity
LLMPerf reports p25 through p99 for every per-request metric. A sweep over concurrency, compared with a latency target such as a p99 TTFT of 1 s and a p99 ITL of 50 ms, finds the highest concurrency that meets the target. The server-level output throughput at that concurrency is the capacity of one instance. The instance’s hourly price divided by that throughput gives the cost per output token. A stricter latency target lowers the usable concurrency, which raises the cost per token.
References
If you found this useful, please cite this post using
Senthilkumar Gopal. (Aug 2025). Benchmarking vLLM on Neuron with LLMPerf. sengopal.me. https://sengopal.me/posts/benchmarking-vllm-on-neuron-with-llmperf
or
@article{gopal2025benchmarkingvllm,
title = {Benchmarking vLLM on Neuron with LLMPerf},
author = {Senthilkumar Gopal},
journal = {sengopal.me},
year = {2025},
month = {Aug},
url = {https://sengopal.me/posts/benchmarking-vllm-on-neuron-with-llmperf}
}