<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ttft on lo0 — Tech Blog</title><link>https://blog.lo0.es/en/tags/ttft/</link><description>Recent content in Ttft on lo0 — Tech Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sat, 29 Aug 2026 09:00:00 +0200</lastBuildDate><atom:link href="https://blog.lo0.es/en/tags/ttft/index.xml" rel="self" type="application/rss+xml"/><item><title>MLPerf Inference: how to read it, what LoadGen enforces and what comparability it offers</title><link>https://blog.lo0.es/en/posts/mlperf-inference-reading-loadgen-comparability/</link><pubDate>Sat, 29 Aug 2026 09:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/mlperf-inference-reading-loadgen-comparability/</guid><description>&lt;blockquote>
&lt;p>Notation: amounts in &lt;strong>euros (N €)&lt;/strong>, decimals with a point. The dollar sign is not used
(on this site it is a formula delimiter).&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>MLPerf Inference is maintained by MLCommons on a six-monthly cadence. It imposes three things no home-made benchmark has: a &lt;strong>mandatory load generator&lt;/strong> (LoadGen, compiled from a tagged revision and unmodified), model-equivalence rules that bound what can be optimised, and an &lt;strong>audit process&lt;/strong> that reviews up to two submissions per round. The four scenarios (SingleStream, MultiStream, Server, Offline) have a minimum duration of 600 s and different metrics: Server reports the sustained Poisson rate and is the only one with a latency constraint. For the LLM benchmarks that constraint is not a request latency but two simultaneous SLOs at the 99th percentile: TTFT and TPOT, with per-model figures ranging from 2000 ms / 200 ms on Llama 2 70B to 450 ms / 40 ms on its Interactive variant. Quality is required relative to the reference model (99 % or 99.9 %) and the &lt;strong>generation length&lt;/strong> is audited as well (Llama 2 70B: more than 90 % of 294.45 tokens per sample). Three reading rules sum up the real comparability: results are only compared within the same version, division, category and scenario; per-accelerator is not an official MLCommons metric, it is derived; and neither cost nor energy enters the primary metric, to the point that round v5.1 had 2 power submissions against 27 participating organisations.&lt;/p>
&lt;hr>
&lt;h2 id="what-it-is-and-how-it-is-organised">What it is and how it is organised&lt;/h2>
&lt;p>MLPerf Inference is maintained by the &lt;strong>MLCommons Association&lt;/strong> through the MLPerf Inference Working Group, whose participation is limited to MLCommons members and affiliates (&lt;a href="https://mlcommons.org/working-groups/benchmarks/inference/">MLPerf Inference Working Group&lt;/a>). The declared cadence for publishing results is roughly six months.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Round&lt;/th>
&lt;th>Results published&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>v4.0&lt;/td>
&lt;td>27 March 2024&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>v4.1&lt;/td>
&lt;td>28 August 2024&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>v5.0&lt;/td>
&lt;td>2 April 2025&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>v5.1&lt;/td>
&lt;td>9 September 2025&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>v6.0&lt;/td>
&lt;td>1 April 2026&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>v6.1&lt;/td>
&lt;td>in preparation as of this data sheet&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The suite splits into two system categories: &lt;strong>Datacenter&lt;/strong> and &lt;strong>Edge&lt;/strong>, the latter defined in the rules as everything that is not datacenter (&lt;a href="https://github.com/mlcommons/inference_policies/blob/master/inference_rules.adoc">inference_rules.adoc&lt;/a>). A Datacenter system has two requirements that do not apply in Edge:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Mandatory ECC&lt;/strong> on DRAM and HBM, active during all performance and accuracy runs. There is no requirement on SRAM.&lt;/li>
&lt;li>&lt;strong>Mandatory networking&lt;/strong> since round v3.0, with a minimum bandwidth computed from the achieved throughput. For Llama 3.1 405B the minimum ingress is &lt;code>throughput × 20000 × dtype_size&lt;/code> bytes/s; for Llama 2 70B the minimum egress is &lt;code>throughput × 1024 × dtype_size&lt;/code>.&lt;/li>
&lt;/ul>
&lt;p>Edge additionally allows &lt;strong>inferred results&lt;/strong>: a MultiStream derived from SingleStream counts as 8 times the p99 latency; an Offline derived from MultiStream, 8000 divided by the mean latency in milliseconds.&lt;/p>
&lt;h2 id="the-four-scenarios">The four scenarios&lt;/h2>
&lt;p>This is the normative table, transcribed from the rules:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Scenario&lt;/th>
&lt;th>Query generation&lt;/th>
&lt;th>Duration&lt;/th>
&lt;th>Samples/query&lt;/th>
&lt;th>Latency constraint&lt;/th>
&lt;th>Tail latency&lt;/th>
&lt;th>Reported metric&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>SingleStream&lt;/td>
&lt;td>The next query is issued when the SUT completes the previous one&lt;/td>
&lt;td>600 s&lt;/td>
&lt;td>1&lt;/td>
&lt;td>None&lt;/td>
&lt;td>90 %&lt;/td>
&lt;td>p90 latency with early stopping&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Server / Interactive&lt;/td>
&lt;td>LoadGen issues queries following a &lt;strong>Poisson distribution&lt;/strong>&lt;/td>
&lt;td>600 s&lt;/td>
&lt;td>1&lt;/td>
&lt;td>Benchmark-specific&lt;/td>
&lt;td>99 %&lt;/td>
&lt;td>Maximum Poisson parameter supported&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Offline&lt;/td>
&lt;td>All samples are delivered at the start in &lt;strong>a single query&lt;/strong>&lt;/td>
&lt;td>1 query, 600 s&lt;/td>
&lt;td>At least 24,576&lt;/td>
&lt;td>None&lt;/td>
&lt;td>N/A&lt;/td>
&lt;td>Measured throughput&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>MultiStream&lt;/td>
&lt;td>The next query is issued when the SUT completes the previous one&lt;/td>
&lt;td>600 s&lt;/td>
&lt;td>&lt;strong>8&lt;/strong>&lt;/td>
&lt;td>None&lt;/td>
&lt;td>99 %&lt;/td>
&lt;td>p99 query latency with early stopping&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Four operational clarifications that change how each number is interpreted:&lt;/p>
&lt;ul>
&lt;li>In &lt;strong>Server&lt;/strong>, LoadGen does not measure a latency: it runs a binary search over the target rate. For a given value it generates queries at that QPS with Poisson arrivals; if the run fails the latency gate, it lowers the value and repeats. The final published metric is, per the official FAQ, &lt;strong>scheduled samples per second&lt;/strong>, not completed samples nor the target entered by the user.&lt;/li>
&lt;li>In &lt;strong>MultiStream&lt;/strong>, the latency of a query is the &lt;strong>maximum&lt;/strong> of the latencies of its samples, and the 8 samples of each query are contiguous in the order in which they were loaded. The value &lt;code>multi_stream_samples_per_query = 8&lt;/code> is fixed in the official configuration.&lt;/li>
&lt;li>In &lt;strong>Offline&lt;/strong> there is no latency constraint at all. The rules themselves forbid techniques that only work in fixed-length experiments &lt;em>except in the Offline scenario&lt;/em>, which is a normative acknowledgement that an Offline result says nothing about behaviour under an SLO.&lt;/li>
&lt;li>The percentiles in the table are the &lt;strong>lower theoretical bound&lt;/strong> for runs with very many queries. With early stopping, the percentile actually computed is somewhat above the nominal one, as a penalty for processing few queries.&lt;/li>
&lt;/ul>
&lt;p>The mandatory scenarios depend on the benchmark. In Datacenter, the summarisation, question answering, text generation and VLM tasks require &lt;code>(Server | Interactive), Offline&lt;/code>, that is, the submitter chooses between Server and Interactive. Reasoning and recommendation require &lt;code>Server, Offline&lt;/code>. Medical segmentation, node classification, speech-to-text and RAG require only &lt;code>Offline&lt;/code>.&lt;/p>
&lt;h2 id="loadgen-what-it-measures-and-what-it-does-not">LoadGen: what it measures and what it does not&lt;/h2>
&lt;p>LoadGen is the module that generates the load and computes the metrics. Its use is mandatory for all submissions, and it must be compiled from a tagged and approved revision of the repository, unaltered; the README is explicit that local modifications of the C++ library are not accepted.&lt;/p>
&lt;p>Its four declared responsibilities are generating the queries according to the scenario, tracking the latency of each query, validating the accuracy of the results and computing the final metrics. Latency is defined as the time from when LoadGen was scheduled to pass a query to the system under test until it receives the response.&lt;/p>
&lt;p>Equally important is what it declares &lt;strong>out of scope&lt;/strong>: LoadGen does not know the model, does not know the data formats, cannot score accuracy and does not know the scenario constraints of the MLPerf rules. The consequence is written in its own README: being model-agnostic, it cannot enforce the MLPerf requirements, for example the target percentiles and latencies. Those limits are injected from &lt;code>mlperf.conf&lt;/code> and &lt;code>user.conf&lt;/code>. The justification for making it mandatory appears in the founding ISCA 2020 paper: it establishes a clear boundary between the components that belong to the submitter and those that belong to MLPerf, and it measures the performance of the complete system instead of that of a single piece.&lt;/p>
&lt;h3 id="duration-query-count-and-early-stopping">Duration, query count and early stopping&lt;/h3>
&lt;p>The minimum duration is 600,000 ms in all four scenarios. The minimum number of queries comes from a confidence interval table that the rules publish:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Tail percentile&lt;/th>
&lt;th>Confidence&lt;/th>
&lt;th>Margin of error&lt;/th>
&lt;th>Inferences&lt;/th>
&lt;th>Rounded&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>90 %&lt;/td>
&lt;td>99 %&lt;/td>
&lt;td>0.50 %&lt;/td>
&lt;td>23,886&lt;/td>
&lt;td>24,576&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>95 %&lt;/td>
&lt;td>99 %&lt;/td>
&lt;td>0.25 %&lt;/td>
&lt;td>50,425&lt;/td>
&lt;td>57,344&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>97 %&lt;/td>
&lt;td>99 %&lt;/td>
&lt;td>0.15 %&lt;/td>
&lt;td>85,811&lt;/td>
&lt;td>90,112&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>99 %&lt;/td>
&lt;td>99 %&lt;/td>
&lt;td>0.05 %&lt;/td>
&lt;td>262,742&lt;/td>
&lt;td>270,336&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The submission checker applies &lt;code>Server: 270336&lt;/code>, &lt;code>SingleStream: 1024&lt;/code> and &lt;code>MultiStream: 662&lt;/code>. For Offline, the minimum is set per benchmark: 24,576 on Llama 2 70B, 15,000 on Mixtral 8x7B, 13,368 on Llama 3.1 8B, 8,313 on Llama 3.1 405B, 4,388 on DeepSeek-R1, 1,633 on Whisper and 43 on 3D UNet.&lt;/p>
&lt;p>The &lt;strong>early stopping&lt;/strong> mechanism allows runs to be shortened while keeping the statistical guarantee. With tolerance &lt;code>d = 0&lt;/code> and confidence &lt;code>c = 0.99&lt;/code>, the algorithm resolves by binary search the smallest number of queries below the latency threshold that satisfies the criterion, given the number of queries observed above it.&lt;/p>
&lt;p>LoadGen&amp;rsquo;s &lt;strong>modes&lt;/strong> are &lt;code>SubmissionRun&lt;/code> (accuracy followed by performance), &lt;code>AccuracyOnly&lt;/code>, &lt;code>PerformanceOnly&lt;/code> and &lt;code>FindPeakPerformance&lt;/code>. The last, applicable only to Server, takes &lt;code>target_qps&lt;/code> as a lower bound if it passes, estimates the upper bound at double and doubles it until failure, and then does a binary search. In performance mode LoadGen selects queries uniformly at random with replacement from a set of size QSL; in accuracy mode it uses a copy of the validation dataset, each sample exactly once. One accuracy run must be executed for every performance result submitted, and the same code in both modes.&lt;/p>
&lt;p>The &lt;strong>seeds&lt;/strong> are announced four weeks before the deadline and the mandatory generator is Mersenne Twister 19937. They change every round: in v5.1, &lt;code>qsl_rng_seed = 1780908523862526354&lt;/code>; in v5.0 it was &lt;code>6023615788873153749&lt;/code>.&lt;/p>
&lt;h3 id="the-compliance-tests">The compliance tests&lt;/h3>
&lt;p>They are activated by placing an &lt;code>audit.config&lt;/code> file in the working directory, whose parameters &lt;strong>override&lt;/strong> those of &lt;code>mlperf.conf&lt;/code> and &lt;code>user.conf&lt;/code>. Their logs are mandatory in the submission package. The declared purpose is to detect anomalies, not to diagnose their cause.&lt;/p>
&lt;p>For the LLM benchmarks the required test is &lt;strong>TEST06&lt;/strong>, specifically against the end-of-sequence token &lt;em>exploit&lt;/em>. It runs 100 samples and demands three conditions: that the first token reported separately matches the first token of the model&amp;rsquo;s output, that the output ends with zero or a single EOS token, and that the number of tokens reported matches the real length of the generated sequence.&lt;/p>
&lt;h2 id="divisions-categories-and-what-can-be-touched">Divisions, categories and what can be touched&lt;/h2>
&lt;h3 id="the-three-divisions">The three divisions&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Closed&lt;/strong>: requires preprocessing, postprocessing and model equivalent to the reference implementation. It allows calibration for quantisation and &lt;strong>does not allow retraining&lt;/strong>. It is the only one that can use the MLPerf name unqualified.&lt;/li>
&lt;li>&lt;strong>Open&lt;/strong>: allows arbitrary preprocessing, postprocessing and model, including retraining. The accuracy, latency and scenario constraints &lt;strong>do not apply&lt;/strong>: instead, the accuracy obtained and the latency constraints under which the performance was obtained must be reported. The model may have any origin, be quantised in any way and be sparsified in any way. It must use the same validation dataset as the corresponding Closed and use all of it.&lt;/li>
&lt;li>&lt;strong>Network&lt;/strong>: inherits all the Closed requirements, applies only to Datacenter, and separates the LoadGen node from the system under test through a &lt;em>fabric&lt;/em>. The submitter&amp;rsquo;s dispatch library cannot preprocess, postprocess, &lt;strong>batch&lt;/strong>, pad or &lt;strong>cache&lt;/strong>. Bus interconnects are forbidden by name (PCIe, CXL, CCIX, HyperTransport, NVLink, QPI, UPI, ICI) and only Ethernet, IEEE 802.11, InfiniBand and 3GPP are admitted, with a requirement to work chassis to chassis at more than ten metres.&lt;/li>
&lt;/ul>
&lt;h3 id="the-availability-categories">The availability categories&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Category&lt;/th>
&lt;th>Hardware&lt;/th>
&lt;th>Software&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Available in cloud&lt;/td>
&lt;td>Available for cloud rental&lt;/td>
&lt;td>Available&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Available on premise&lt;/td>
&lt;td>Available for purchase&lt;/td>
&lt;td>Available&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Preview&lt;/td>
&lt;td>Must be available for the next submission, or the one after 140 days, whichever is longer&lt;/td>
&lt;td>Available except what is needed for substantially new hardware&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>RDI&lt;/td>
&lt;td>Does not meet the above&lt;/td>
&lt;td>Does not meet the above&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Available demands four cumulative conditions: price available, having been rented or shipped to at least one third party, public evidence of availability and reasonable availability to additional third parties on the submission date. A Preview result obliges a resubmission as Available with equal or better performance, tolerating up to &lt;strong>2 % degradation&lt;/strong> from noise; if there is no resubmission, the Preview result is &lt;strong>marked invalid&lt;/strong>. RDI components cannot be submitted as Available until the cycle after the next one, or 221 days, whichever is longer.&lt;/p>
&lt;h3 id="what-closed-allows-and-forbids">What Closed allows and forbids&lt;/h3>
&lt;p>MLPerf delivers the weights in fp16 or fp32. The central rule is that the submitter may perform purely mathematical and reproducible quantisation, using only the calibration data and the tensors of the delivered model, to any numerical format that reaches the required quality, and that the method must be described publicly at a level that allows it to be reproduced. The test against back doors is elegant: the description of the quantisation method must be &lt;em>much smaller&lt;/em> than the non-zero weights it produces.&lt;/p>
&lt;p>&lt;strong>Allowed&lt;/strong>, among other things: any framework or runtime, arbitrary data layout, varying the matrix multiplication algorithm, mathematically equivalent transformations, polynomial approximations of transcendentals, processing queries out of order within what the scenario admits, replacing dense operations with mathematically equivalent sparse operations, hand-picking different precisions per operation, fusing and unfusing, dynamic batching, and mixtures of experts combining weights with different quantisation.&lt;/p>
&lt;p>&lt;strong>Forbidden&lt;/strong>: replacing or supplementing weights wholesale, discarding non-zero weights, including pruning, caching queries or responses, coalescing identical queries, modifying weights during the timed portion, quantisation algorithms of size comparable to the weights they produce, hardcoding the total number of queries, using knowledge of the LoadGen implementation to predict peaks or troughs in the Server scenario, changing the number of search beams, and incorporating statistics from the performance or accuracy sets.&lt;/p>
&lt;p>Two clarifications that matter to anyone serving LLMs in production: the &lt;strong>KV cache&lt;/strong> is allowed just as in the reference model provided it is not applied &lt;strong>across queries&lt;/strong>; PagedAttention is admitted if the block is reused only within the batch; continuous or dynamic batching is allowed; and KV cache entries are treated as activations for quantisation purposes, and cannot be pruned. &lt;strong>Speculative decoding&lt;/strong> is only admitted in the benchmark and scenario combinations explicitly listed, with the reference head at the same precision, and implementations that artificially manipulate the acceptance rate are forbidden.&lt;/p>
&lt;h2 id="the-slos-almost-nobody-cites-ttft-and-tpot">The SLOs almost nobody cites: TTFT and TPOT&lt;/h2>
&lt;p>This is the point where an MLPerf table is most often misread. In the LLM benchmarks of the Server scenario, the constraint is not a request latency: the rules set &lt;code>target_latency = 0&lt;/code> and activate &lt;code>use_token_latencies = 1&lt;/code>, so that the gate is formed by &lt;strong>two simultaneous metrics&lt;/strong>, both evaluated at the &lt;strong>99th percentile&lt;/strong>:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>TTFT&lt;/strong> (&lt;em>time to first token&lt;/em>): latency of the first token.&lt;/li>
&lt;li>&lt;strong>TPOT&lt;/strong> (&lt;em>time per output token&lt;/em>): mean interval between all generated tokens.&lt;/li>
&lt;/ul>
&lt;p>The figures are in &lt;code>mlperf.conf&lt;/code> and change per round and per benchmark:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Benchmark (Server scenario)&lt;/th>
&lt;th>TTFT&lt;/th>
&lt;th>TPOT&lt;/th>
&lt;th>Round&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>llama2-70b&lt;/code>&lt;/td>
&lt;td>2000 ms&lt;/td>
&lt;td>200 ms&lt;/td>
&lt;td>v5.0, v5.1, v6.x&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>llama2-70b-interactive&lt;/code>&lt;/td>
&lt;td>&lt;strong>450 ms&lt;/strong>&lt;/td>
&lt;td>&lt;strong>40 ms&lt;/strong>&lt;/td>
&lt;td>v5.1, v6.x&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>mixtral-8x7b&lt;/code>&lt;/td>
&lt;td>2000 ms&lt;/td>
&lt;td>200 ms&lt;/td>
&lt;td>v5.0, v5.1, v6.x&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>llama3_1-405b&lt;/code>&lt;/td>
&lt;td>6000 ms&lt;/td>
&lt;td>175 ms&lt;/td>
&lt;td>v5.0, v5.1, v6.x&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>llama3_1-405b-interactive&lt;/code>&lt;/td>
&lt;td>4500 ms&lt;/td>
&lt;td>80 ms&lt;/td>
&lt;td>v6.x&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>llama3_1-8b&lt;/code>&lt;/td>
&lt;td>2000 ms&lt;/td>
&lt;td>100 ms&lt;/td>
&lt;td>v5.1, v6.x&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>llama3_1-8b-interactive&lt;/code>&lt;/td>
&lt;td>500 ms&lt;/td>
&lt;td>30 ms&lt;/td>
&lt;td>v6.x&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>deepseek-r1&lt;/code>&lt;/td>
&lt;td>2000 ms&lt;/td>
&lt;td>80 ms&lt;/td>
&lt;td>v5.1, v6.x&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>deepseek-r1-interactive&lt;/code>&lt;/td>
&lt;td>1500 ms&lt;/td>
&lt;td>15 ms&lt;/td>
&lt;td>v6.x&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>gpt-oss-120b&lt;/code>&lt;/td>
&lt;td>3000 ms&lt;/td>
&lt;td>80 ms&lt;/td>
&lt;td>v6.x&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>A TPOT of 40 ms is equivalent to 25 tokens per second per user, which is the order of magnitude of a conversational interface; one of 200 ms is equivalent to 5 tokens per second, which is a batch use case dressed up as a service. Two results for the same model under the Server and Interactive labels are not the same measurement. Two documented discrepancies between primary sources remain: the &lt;code>llama2-70b-interactive&lt;/code> variant does not appear in the &lt;code>mlperf.conf&lt;/code> tagged as v5.0 despite having been announced in that round, and in the v6.x cycle the TPOT of &lt;code>gpt-oss-120b-interactive&lt;/code> appears as 15 ms in &lt;code>mlperf.conf&lt;/code> and as 20 ms in the text of the rules.&lt;/p>
&lt;p>For contrast, the constraints of the non-LLM benchmarks in the Server scenario are conventional request latencies: ResNet-50 15 ms, RetinaNet 100 ms, BERT 130 ms, DLRMv2 60 ms, DLRMv3 80 ms, RNN-T 1000 ms, GPT-J and Stable Diffusion XL 20,000 ms.&lt;/p>
&lt;h2 id="quality-the-99--and-the-token-count">Quality: the 99 % and the token count&lt;/h2>
&lt;p>The quality targets are expressed relative to the reference model, never in absolute terms, and each benchmark demands one variant, the other or both. In the current Datacenter suite, 3D UNet, Llama 3.1 8B and Whisper ask for 99 % and 99.9 % of FP32, which generates two distinct results; Llama 2 70B asks only for 99.9 %; Llama 3.1 405B, Mixtral, DeepSeek-R1, GPT-OSS-120B, Qwen3-VL, RGAT and WAN-2.2 ask only for 99 %; and E2E-RAG is the exception at 97 %. In the checker this materialises as separate benchmarks (&lt;code>bert-99&lt;/code> and &lt;code>bert-99.9&lt;/code>), each with its computed numerical threshold.&lt;/p>
&lt;p>On top of that metric there is a second LLM-specific constraint that is cited very rarely: the generation length is audited as well.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Benchmark&lt;/th>
&lt;th>Length constraint&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Llama 2 70B&lt;/td>
&lt;td>tokens per sample &amp;gt; 90 % of 294.45&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Llama 3.1 405B&lt;/td>
&lt;td>tokens per sample between 90 % and 110 % of 684.68&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Mixtral 8x7B&lt;/td>
&lt;td>tokens per sample between 90 % and 110 % of 144.84&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Llama 3.1 8B&lt;/td>
&lt;td>total generated length &amp;gt; 90 % of 8,167,644&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The FAQ settles the obvious shortcut: reducing the maximum output length below the reference is not allowed, and truncating tokens to improve performance or reach the accuracy target &lt;strong>is not permitted&lt;/strong>. The inference parameters are fixed in Closed (&lt;code>max_new_tokens = 1024&lt;/code> on Llama 2 70B, &lt;code>20000&lt;/code> on Llama 3.1 405B and DeepSeek-R1), as is the decoding algorithm: greedy search in the Llama family, Mixtral and DeepSeek-R1; sampling with &lt;code>temperature = 1.0&lt;/code> and &lt;code>top_p = 1.0&lt;/code> in GPT-OSS-120B and Qwen3-VL. Accuracy is reported to &lt;strong>five significant figures&lt;/strong> with round-half-to-even.&lt;/p>
&lt;h2 id="the-current-datacenter-suite">The current Datacenter suite&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Area&lt;/th>
&lt;th>Task&lt;/th>
&lt;th>Model&lt;/th>
&lt;th>Dataset&lt;/th>
&lt;th>QSL&lt;/th>
&lt;th>Required quality&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Vision&lt;/td>
&lt;td>Medical segmentation&lt;/td>
&lt;td>3D UNet&lt;/td>
&lt;td>KiTS 2019&lt;/td>
&lt;td>42&lt;/td>
&lt;td>99 % and 99.9 % of FP32 (DICE 0.86330)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Language&lt;/td>
&lt;td>Summarisation&lt;/td>
&lt;td>Llama 3.1 8B&lt;/td>
&lt;td>CNN DailyMail v3.0.0&lt;/td>
&lt;td>13,368&lt;/td>
&lt;td>99 % and 99.9 % of FP32&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Language&lt;/td>
&lt;td>Question answering&lt;/td>
&lt;td>Llama 2 70B&lt;/td>
&lt;td>OpenOrca&lt;/td>
&lt;td>24,576&lt;/td>
&lt;td>99.9 % of FP32&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Language&lt;/td>
&lt;td>Text generation&lt;/td>
&lt;td>Llama 3.1 405B&lt;/td>
&lt;td>LongBench, Ruler, GovReport&lt;/td>
&lt;td>8,313&lt;/td>
&lt;td>99 % of FP16&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Language&lt;/td>
&lt;td>QA, maths and code&lt;/td>
&lt;td>Mixtral 8x7B&lt;/td>
&lt;td>OpenOrca, GSM8K, MBXP&lt;/td>
&lt;td>15,000&lt;/td>
&lt;td>99 % of FP16&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Language&lt;/td>
&lt;td>Reasoning&lt;/td>
&lt;td>DeepSeek-R1&lt;/td>
&lt;td>&lt;code>mlperf_deepseek_r1&lt;/code>&lt;/td>
&lt;td>4,388&lt;/td>
&lt;td>99 % of FP16 (exact match 81.9132 %)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Language&lt;/td>
&lt;td>QA, maths and code&lt;/td>
&lt;td>GPT-OSS-120B&lt;/td>
&lt;td>AIME25, GPQA Diamond, LiveCodeBench v6&lt;/td>
&lt;td>6,396&lt;/td>
&lt;td>99 % of 83.13 %&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Vision&lt;/td>
&lt;td>Vision-language model&lt;/td>
&lt;td>Qwen3-VL-235B-A22B&lt;/td>
&lt;td>Shopify product catalogue&lt;/td>
&lt;td>48,289&lt;/td>
&lt;td>99 % of BF16 (hierarchical F1 0.7824)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Commerce&lt;/td>
&lt;td>Recommendation&lt;/td>
&lt;td>DLRMv3&lt;/td>
&lt;td>Synthetic Streaming 100B&lt;/td>
&lt;td>34,996&lt;/td>
&lt;td>99.9 % of FP32&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Generative&lt;/td>
&lt;td>Text to video&lt;/td>
&lt;td>WAN-2.2-T2V-A14B&lt;/td>
&lt;td>VBench prompts&lt;/td>
&lt;td>248&lt;/td>
&lt;td>99 % of BF16 (VBench 69.7752)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Graphs&lt;/td>
&lt;td>Node classification&lt;/td>
&lt;td>RGAT&lt;/td>
&lt;td>IGBH&lt;/td>
&lt;td>788,379&lt;/td>
&lt;td>99 % of FP32 (72.86 %)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Audio&lt;/td>
&lt;td>Speech to text&lt;/td>
&lt;td>Whisper&lt;/td>
&lt;td>LibriSpeech&lt;/td>
&lt;td>1,633&lt;/td>
&lt;td>99 % and 99.9 % of FP32 (WER 2.0671 %)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Language&lt;/td>
&lt;td>End-to-end RAG&lt;/td>
&lt;td>E2E-RAG&lt;/td>
&lt;td>FRAMES&lt;/td>
&lt;td>824&lt;/td>
&lt;td>97 % of FP32&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The &lt;strong>E2E-RAG&lt;/strong> benchmark deserves attention from anyone designing a RAG platform, because it fixes the whole pipeline: a FAISS HNSW index with mandatory parameters &lt;code>M = 32&lt;/code>, &lt;code>efConstruction = 200&lt;/code> and &lt;code>efSearch = 100&lt;/code>; e5-base-v2 embeddings; ColBERTv2 reranking; generation and query rewriting with GPT-OSS-120B; evaluation with Llama 3.1 8B as judge; and a maximum of 5 retrieval iterations, mandatory for all submitters. Model loading is not timed; building the vector database is.&lt;/p>
&lt;p>The definition of &lt;em>sample&lt;/em> changes per model and is a frequent source of confusion: in the LLMs it is a sequence, in DLRMv3 it is a request with a user history and &lt;strong>2048 candidates&lt;/strong>, in WAN-2.2 it is a pair of positive and negative prompts, and in PointPainting it is five images and a lidar point cloud.&lt;/p>
&lt;h2 id="how-to-read-a-results-row">How to read a results row&lt;/h2>
&lt;p>The columns of the official table in the Closed division are &lt;em>Submitter, Software, System, Benchmark Results, Processor/Count, Details, Accelerator/Count&lt;/em> and &lt;em>Code&lt;/em>. The Open division adds &lt;em>Model Used&lt;/em> and &lt;em>Notes&lt;/em>. Rows with power measurement add &lt;em>System Power&lt;/em> in Server and Offline, or &lt;em>Energy Per Stream&lt;/em> in the stream scenarios. Any citation must use the identifier in the format &lt;code>major-version.minor-version.entry.benchmark&lt;/code>, of the style &lt;code>5.1-0053&lt;/code>, and carry a footnote with suite, version, division, benchmark, scenario, date and source.&lt;/p>
&lt;h3 id="per-accelerator-is-not-an-official-metric">Per-accelerator is not an official metric&lt;/h3>
&lt;p>&lt;strong>There is no per-accelerator column.&lt;/strong> It is a derived metric, and the MLCommons messaging guidelines are blunt: any comparison based on a different or derived metric, such as power, cost, model size or accuracy, must make the basis of comparison clear in the text and in a footnote, and secondary and derived metrics cannot be presented as official or verified MLPerf metrics. NVIDIA itself states this with the standard formula in its round blogs: per-GPU performance is not a primary MLPerf Inference metric and is computed by dividing the reported throughput by the number of reported accelerators. The same applies to combining results from several benchmarks: MLCommons allows it but &lt;strong>does not endorse it&lt;/strong>, and the composite cannot be presented as an official result.&lt;/p>
&lt;h3 id="the-comparison-rules">The comparison rules&lt;/h3>
&lt;ul>
&lt;li>MLPerf results can only be compared &lt;strong>with compatible MLPerf results&lt;/strong>: same benchmark, same scenario and compatible versions per the normative compatibility table.&lt;/li>
&lt;li>MLPerf results cannot be compared with non-MLPerf results.&lt;/li>
&lt;li>When comparing, any difference in version, division, category, verification status, scenario or number of chips must be clearly identified. When comparing Open with Closed, it must be identified in what sense the Open result would not qualify as Closed.&lt;/li>
&lt;li>Submitters cannot publish results of a version before its official date; non-submitters must wait &lt;strong>two weeks&lt;/strong> from that date.&lt;/li>
&lt;li>The sanctions regime goes as far as barring an infringer from submitting results in the future and marking their results as non-compliant permanently in the database, with a deadline of &lt;strong>three working days&lt;/strong> to withdraw the infringing content.&lt;/li>
&lt;/ul>
&lt;h3 id="how-much-audit-sits-behind-a-row">How much audit sits behind a row&lt;/h3>
&lt;p>In each round up to two submissions are audited: one chosen at random from all of them and zero or one chosen by the review committee. And there is a constraint that conditions the reading of the whole table: only Available submissions in the Closed division are auditable. Preview, RDI and Open fall outside the process. There is an exemption from the random audit if the system is equivalent to another already audited and neither the aggregate performance nor the per-accelerator performance differ by more than 10 % from those of the previous audit. The deadlines are 28 days to select an auditor, 30 for the report after signing the confidentiality agreements and around 90 days for the complete process, with &lt;strong>two days&lt;/strong> of hardware access for the auditor. The rules close with three sentences that define the standard of proof: results that cannot be replicated are not valid results, benchmark detection is not allowed and input-based optimisation is not allowed either.&lt;/p>
&lt;h2 id="the-recent-rounds-in-figures">The recent rounds, in figures&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Round&lt;/th>
&lt;th>Organisations&lt;/th>
&lt;th>Performance results&lt;/th>
&lt;th>Power results&lt;/th>
&lt;th>New benchmarks&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>v4.0&lt;/td>
&lt;td>23&lt;/td>
&lt;td>more than 8,500&lt;/td>
&lt;td>900&lt;/td>
&lt;td>2&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>v4.1&lt;/td>
&lt;td>22&lt;/td>
&lt;td>964&lt;/td>
&lt;td>31&lt;/td>
&lt;td>1&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>v5.0&lt;/td>
&lt;td>23&lt;/td>
&lt;td>17,457&lt;/td>
&lt;td>n/a&lt;/td>
&lt;td>4&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>v5.1&lt;/td>
&lt;td>27&lt;/td>
&lt;td>n/a&lt;/td>
&lt;td>2&lt;/td>
&lt;td>3&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>v6.0&lt;/td>
&lt;td>24&lt;/td>
&lt;td>n/a&lt;/td>
&lt;td>n/a&lt;/td>
&lt;td>5 of 11 Datacenter tests&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>These counts do not form a time series: the counting criteria differ between press releases and none documents the criterion, to the point that v4.0 and v4.1 differ by a factor close to nine.&lt;/p>
&lt;p>The published performance jumps are comparable within each announcement. Between v4.0 and v5.0, twelve months apart, the number of Llama 2 70B submissions multiplied by 2.5, the &lt;strong>median&lt;/strong> score doubled and the best score was &lt;strong>3.3 times faster&lt;/strong>. Between v5.0 and v5.1, in six months, the best systems improved &lt;strong>by up to 50 %&lt;/strong> in some scenarios. Round v6.0 changed axis and its press release talks about scale rather than speed: 30 % more multi-node submissions, 10 % of the systems with more than ten nodes against 2 % in the previous round, and a system larger than 72 nodes and 288 accelerators, quadrupling the previous maximum node count.&lt;/p>
&lt;p>Hardware that debuted in each round: MI300X, TPU v6e, Xeon Granite Rapids and B200 in v4.1; MI325X, Xeon 6980P, GB200 and Jetson AGX Thor in v5.0; MI355X, Intel Arc Pro B60, GB300 and RTX Pro 6000 Blackwell Server Edition in v5.1.&lt;/p>
&lt;h2 id="what-mlperf-inference-does-not-measure">What MLPerf Inference does not measure&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Cost.&lt;/strong> There is no cost or TCO metric, and cost is explicitly classified as a derived metric that cannot be presented as official.&lt;/li>
&lt;li>&lt;strong>Energy, except as an optional extension.&lt;/strong> MLPerf Power is regulated in a separate document, requires measuring at the wall with the power group&amp;rsquo;s workflow and PTDaemon, and forbids any other method. Its real adoption is marginal: 2 power submissions in v5.1 against 27 participating organisations. In addition, MLCommons bounds what that figure means: the measured power is only valid for the benchmark it accompanies, and any other reference to power, such as a TDP setting or a power supply rating, is neither measured nor validated by MLCommons. The messaging rule forbids submitters from publishing per-watt normalised comparisons using any proxy other than the measured power.&lt;/li>
&lt;li>Configurations not optimised by the vendor. The bias is acknowledged in the audit rule itself, which contemplates submissions whose performance is not consistent with the known characteristics of the hardware, or where the committee lacks visibility into how it was achieved, or where hardware and software are not reasonably available to the public.&lt;/li>
&lt;li>&lt;strong>Barrier to entry.&lt;/strong> Only MLCommons members and &lt;em>test partners&lt;/em> can submit results for review. Anyone measuring with the same code without submitting must label every figure as &lt;strong>unverified&lt;/strong> with the corresponding legend.&lt;/li>
&lt;/ul>
&lt;h2 id="usage-flow-for-an-on-premise-platform">Usage flow for an on-premise platform&lt;/h2>
&lt;p>MLPerf Inference is useful in a purchasing decision if it is used for what it is, a test bench with written rules, and not as a ranking.&lt;/p>
&lt;ol>
&lt;li>Filter by division and category before looking at any number: keep Closed and Available. A Preview or RDI result describes hardware that cannot yet be bought, and neither of the two is auditable.&lt;/li>
&lt;li>Choose the scenario that matches the load pattern: Server or Interactive if there are users waiting, Offline if the work is batch. An Offline result does not authorise promising a latency.&lt;/li>
&lt;li>Read the SLO before the throughput: in any LLM benchmark, the number of queries per second only means something alongside its TTFT/TPOT pair. The same machine publishes very different figures under Server and under Interactive.&lt;/li>
&lt;li>Check the quality variant: 99 % and 99.9 % are different results for the same model, and the second usually costs performance.&lt;/li>
&lt;li>Translate to your own configuration carefully: dividing by the number of accelerators is a derived metric, not an official one, and it has to be declared as such.&lt;/li>
&lt;li>Close the gap MLPerf leaves open with your own measurement: cost, energy and behaviour under real traffic. That is exactly the function of the reproducible harness and of the track B bench tools, and the reason no platform decision stands on a public table alone.&lt;/li>
&lt;/ol>
&lt;h2 id="cross-links-from-the-benchmarking-track">Cross-links from the benchmarking track&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/llm-inference-benchmarking-frameworks-metrics-state-of-the-art/">B1/B2 — LLM inference benchmarking: frameworks, metrics and state of the art&lt;/a>: the TTFT, TPOT and goodput metrics outside the MLPerf corset, and which tool measures each one.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/llm-benchmark-tool-catalogue-practical-deep-dive/">B2 — LLM benchmark tool catalogue&lt;/a>: the tools with which you reproduce at home what MLPerf standardises.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/guidellm-validating-slo-under-load-sizing-knee/">B3 — GuideLLM and SLO validation under load&lt;/a>: the practical equivalent of LoadGen&amp;rsquo;s binary search in the Server scenario.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/measurement-bias-reproducibility-llm-benchmarks/">B6 — Measurement bias and reproducibility&lt;/a>: why LoadGen exists, told from the side of what happens when there is none.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/llm-serving-engines-pareto-frontier-comparison/">B8 — Serving engines compared on the Pareto frontier&lt;/a>: the comparison MLPerf does not make, with engines instead of systems.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/mlperf-power-energy-efficiency-benchmark/">C4 — MLPerf Power&lt;/a>: the energy extension of this same machinery, with its certified measurement at the wall.&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/reproducible-harness-cost-performance-energy-experiment/">The reproducible harness: cost, performance and energy in a single auditable experiment&lt;/a> — how to build at home the auditable equivalent of a submission, measuring on top of that what MLPerf leaves out.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/slo-to-number-of-gpus-sizing-justifying-inference-hardware/">Sizing and justifying the GPU investment&lt;/a> — the step from a throughput figure under an SLO to the number of accelerators and the return.&lt;/li>
&lt;/ul>
&lt;h2 id="sources">Sources&lt;/h2>
&lt;ul>
&lt;li>MLCommons, &lt;em>MLPerf Inference Working Group&lt;/em> — &lt;a href="https://mlcommons.org/working-groups/benchmarks/inference/">https://mlcommons.org/working-groups/benchmarks/inference/&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>MLPerf Inference Rules (inference_rules.adoc)&lt;/em> — &lt;a href="https://github.com/mlcommons/inference_policies/blob/master/inference_rules.adoc">https://github.com/mlcommons/inference_policies/blob/master/inference_rules.adoc&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>MLPerf Inference Power Measurement (power_measurement.adoc)&lt;/em> — &lt;a href="https://github.com/mlcommons/inference_policies/blob/master/power_measurement.adoc">https://github.com/mlcommons/inference_policies/blob/master/power_measurement.adoc&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>MLPerf Submission Rules (submission_rules.adoc)&lt;/em> — &lt;a href="https://github.com/mlcommons/policies/blob/master/submission_rules.adoc">https://github.com/mlcommons/policies/blob/master/submission_rules.adoc&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>MLPerf Results Messaging Guidelines&lt;/em> — &lt;a href="https://github.com/mlcommons/policies/blob/master/MLPerf_Results_Messaging_Guidelines.adoc">https://github.com/mlcommons/policies/blob/master/MLPerf_Results_Messaging_Guidelines.adoc&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>LoadGen README&lt;/em> — &lt;a href="https://github.com/mlcommons/inference/blob/master/loadgen/README.md">https://github.com/mlcommons/inference/blob/master/loadgen/README.md&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>loadgen/test_settings.h&lt;/em> — &lt;a href="https://github.com/mlcommons/inference/blob/master/loadgen/test_settings.h">https://github.com/mlcommons/inference/blob/master/loadgen/test_settings.h&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>loadgen/mlperf.conf (master)&lt;/em> — &lt;a href="https://github.com/mlcommons/inference/blob/master/loadgen/mlperf.conf">https://github.com/mlcommons/inference/blob/master/loadgen/mlperf.conf&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>loadgen/mlperf.conf (tag v5.1)&lt;/em> — &lt;a href="https://github.com/mlcommons/inference/blob/v5.1/loadgen/mlperf.conf">https://github.com/mlcommons/inference/blob/v5.1/loadgen/mlperf.conf&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>loadgen/mlperf.conf (tag v5.0)&lt;/em> — &lt;a href="https://github.com/mlcommons/inference/blob/v5.0/loadgen/mlperf.conf">https://github.com/mlcommons/inference/blob/v5.0/loadgen/mlperf.conf&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>tools/submission/submission_checker.py (tag v5.0)&lt;/em> — &lt;a href="https://github.com/mlcommons/inference/blob/v5.0/tools/submission/submission_checker.py">https://github.com/mlcommons/inference/blob/v5.0/tools/submission/submission_checker.py&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>compliance/nvidia TEST06 README (tag v5.1)&lt;/em> — &lt;a href="https://github.com/mlcommons/inference/blob/v5.1/compliance/nvidia/TEST06/README.md">https://github.com/mlcommons/inference/blob/v5.1/compliance/nvidia/TEST06/README.md&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>Benchmark results: Inference Datacenter&lt;/em> — &lt;a href="https://mlcommons.org/benchmarks/inference-datacenter/">https://mlcommons.org/benchmarks/inference-datacenter/&lt;/a>&lt;/li>
&lt;li>Reddi et al., &lt;em>MLPerf Inference Benchmark&lt;/em>, ISCA 2020 — &lt;a href="https://arxiv.org/abs/1911.02549">https://arxiv.org/abs/1911.02549&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>MLPerf Inference v5.0 Benchmark Results&lt;/em> (abril 2025) — &lt;a href="https://www.businesswire.com/news/home/20250402313932/en/MLCommons-Releases-New-MLPerf-Inference-v5.0-Benchmark-Results">https://www.businesswire.com/news/home/20250402313932/en/MLCommons-Releases-New-MLPerf-Inference-v5.0-Benchmark-Results&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>MLPerf Inference v5.1 Benchmark Results&lt;/em> (septiembre 2025) — &lt;a href="https://www.globenewswire.com/news-release/2025/09/09/3147136/0/en/MLCommons-Releases-New-MLPerf-Inference-v5-1-Benchmark-Results.html">https://www.globenewswire.com/news-release/2025/09/09/3147136/0/en/MLCommons-Releases-New-MLPerf-Inference-v5-1-Benchmark-Results.html&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>MLPerf Inference v6.0 Benchmark Results&lt;/em> (abril 2026) — &lt;a href="https://www.globenewswire.com/news-release/2026/04/01/3266801/0/en/MLCommons-Releases-New-MLPerf-Inference-v6-0-Benchmark-Results.html">https://www.globenewswire.com/news-release/2026/04/01/3266801/0/en/MLCommons-Releases-New-MLPerf-Inference-v6-0-Benchmark-Results.html&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>MLPerf Inference v4.1 Benchmark Results&lt;/em> (agosto 2024) — &lt;a href="https://www.businesswire.com/news/home/20240828886616/en/New-MLPerf-Inference-v4.1-Benchmark-Results-Highlight-Rapid-Hardware-and-Software-Innovations-in-Generative-AI-Systems">https://www.businesswire.com/news/home/20240828886616/en/New-MLPerf-Inference-v4.1-Benchmark-Results-Highlight-Rapid-Hardware-and-Software-Innovations-in-Generative-AI-Systems&lt;/a>&lt;/li>
&lt;li>NVIDIA Developer Blog, &lt;em>NVIDIA Blackwell delivers massive performance leaps in MLPerf Inference v5.0&lt;/em> — &lt;a href="https://developer.nvidia.com/blog/nvidia-blackwell-delivers-massive-performance-leaps-in-mlperf-inference-v5-0/">https://developer.nvidia.com/blog/nvidia-blackwell-delivers-massive-performance-leaps-in-mlperf-inference-v5-0/&lt;/a>&lt;/li>
&lt;li>NVIDIA Developer Blog, &lt;em>NVIDIA Blackwell Ultra sets new inference records in MLPerf debut&lt;/em> — &lt;a href="https://developer.nvidia.com/blog/nvidia-blackwell-ultra-sets-new-inference-records-in-mlperf-debut/">https://developer.nvidia.com/blog/nvidia-blackwell-ultra-sets-new-inference-records-in-mlperf-debut/&lt;/a>&lt;/li>
&lt;li>MLCommons, &lt;em>MLPerf Automotive&lt;/em> (octubre 2025) — &lt;a href="https://arxiv.org/html/2510.27065v1">https://arxiv.org/html/2510.27065v1&lt;/a>&lt;/li>
&lt;li>Tschand et al., &lt;em>MLPerf Power: Benchmarking the Energy Efficiency of Machine Learning Systems from Microwatts to Megawatts&lt;/em> — &lt;a href="https://arxiv.org/abs/2410.12032">https://arxiv.org/abs/2410.12032&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>GenAI-Perf in depth: LLM inference profiling with real data</title><link>https://blog.lo0.es/en/posts/genai-perf-llm-inference-profiling-in-depth/</link><pubDate>Mon, 15 Jun 2026 03:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/genai-perf-llm-inference-profiling-in-depth/</guid><description>&lt;blockquote>
&lt;p>Notation: amounts in &lt;strong>euros (N EUR)&lt;/strong>, decimals with a point. The dollar symbol is not used
(on this site it is a formula delimiter).&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>GenAI-Perf (the &lt;code>genai-perf&lt;/code> package, part of NVIDIA&amp;rsquo;s Triton ecosystem) is the reference LLM
inference profiler for OpenAI-compatible endpoints. Installable with &lt;code>pip install genai-perf&lt;/code>.
A single &lt;code>genai-perf profile&lt;/code> command produces a console table with TTFT, ITL, request latency
(avg/min/max/P75/P90/P99), output sequence length, output token throughput and request
throughput, plus &lt;code>profile_export_genai_perf.json&lt;/code> and &lt;code>.csv&lt;/code> artefacts. The &lt;code>analyze&lt;/code>
subcommand automatically sweeps concurrencies from 1 to 256 (powers of 2) and generates a
summary &lt;code>analyze_export_genai_perf.csv&lt;/code>. GenAI-Perf was declared &lt;strong>retired in April 2026&lt;/strong>
(replaced by AIPerf); it remains the reference benchmark for historical runs and documented
comparisons, and the NVIDIA tool with the most public documentation for LLMs before 2026.&lt;/p>
&lt;hr>
&lt;h2 id="what-genai-perf-is-and-where-it-fits">What GenAI-Perf is and where it fits&lt;/h2>
&lt;p>GenAI-Perf is a command-line tool for measuring the throughput and latency of generative AI
models served through an inference server. It is part of the
&lt;code>triton-inference-server/perf_analyzer&lt;/code> GitHub repository and is distributed as a pip package
(&lt;code>genai-perf&lt;/code>) and inside the Triton SDK container
(&lt;code>nvcr.io/nvidia/tritonserver:YY.MM-py3-sdk&lt;/code>).&lt;/p>
&lt;p>&lt;strong>Position in the NVIDIA ecosystem:&lt;/strong>&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1rem auto;">
&lt;svg viewBox="0 0 780 200" role="img" aria-label="NVIDIA ecosystem: Triton Inference Server and TensorRT-LLM as engines, NIM as a microservice, GenAI-Perf as an endpoint profiler, AIPerf as the successor" xmlns="http://www.w3.org/2000/svg">
&lt;style>.bx{fill:none;stroke:currentColor;stroke-width:1.3}.tl{font:600 12px sans-serif;fill:currentColor}.ts{font:11px sans-serif;fill:currentColor}.ar{fill:none;stroke:currentColor;stroke-width:1.3;marker-end:url(#am)}&lt;/style>
&lt;defs>&lt;marker id="am" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>&lt;/marker>&lt;/defs>
&lt;rect class="bx" x="20" y="60" width="140" height="44" rx="6"/>&lt;text x="90" y="79" text-anchor="middle" class="tl">Inference engine&lt;/text>&lt;text x="90" y="95" text-anchor="middle" class="ts">Triton + TRT-LLM / vLLM&lt;/text>
&lt;path class="ar" d="M160,82 L200,82"/>
&lt;rect class="bx" x="200" y="60" width="120" height="44" rx="6"/>&lt;text x="260" y="79" text-anchor="middle" class="tl">Endpoint&lt;/text>&lt;text x="260" y="95" text-anchor="middle" class="ts">OpenAI-compatible&lt;/text>
&lt;path class="ar" d="M320,82 L360,82"/>
&lt;rect class="bx" x="360" y="60" width="140" height="44" rx="6"/>&lt;text x="430" y="79" text-anchor="middle" class="tl">GenAI-Perf&lt;/text>&lt;text x="430" y="95" text-anchor="middle" class="ts">profiler (until Apr 2026)&lt;/text>
&lt;path class="ar" d="M500,82 L540,82"/>
&lt;rect class="bx" x="540" y="60" width="140" height="44" rx="6"/>&lt;text x="610" y="79" text-anchor="middle" class="tl">AIPerf&lt;/text>&lt;text x="610" y="95" text-anchor="middle" class="ts">successor (Apr 2026+)&lt;/text>
&lt;text x="20" y="155" class="ts">GenAI-Perf works against any endpoint compatible with the OpenAI API (vLLM, NIM, Triton, SGLang, TGI…).&lt;/text>
&lt;text x="20" y="172" class="ts">AIPerf is the official successor from April 2026 (GitHub: ai-dynamo/aiperf).&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>&lt;strong>Relationship with perf_analyzer:&lt;/strong> GenAI-Perf internally uses Triton&amp;rsquo;s &lt;code>perf_analyzer&lt;/code>
binary to generate load and measure latencies. perf_analyzer is the low-level load generator;
GenAI-Perf is the high-level layer that adds prompt synthesis, OpenAI payload construction and
the LLM-specific metrics (TTFT, ITL, sequence lengths).&lt;/p>
&lt;p>&lt;strong>Installation:&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Option 1: pip (requires CUDA 12, Ubuntu 24.04, Python 3.10+)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">pip install genai-perf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Option 2: Triton SDK container (recommended for reproducibility)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">export&lt;/span> &lt;span class="nv">RELEASE&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;25.01&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">docker run -it --net&lt;span class="o">=&lt;/span>host --gpus&lt;span class="o">=&lt;/span>all &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> nvcr.io/nvidia/tritonserver:25.01-py3-sdk
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Inside the container:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">genai-perf --help
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="metrics-genai-perf-produces">Metrics GenAI-Perf produces&lt;/h2>
&lt;p>The metrics cover the full cycle of a streaming generation request. All of them are reported
with avg, min, max, P75, P90 and P99 except the throughput ones (avg only).&lt;/p>
&lt;h3 id="metrics-glossary">Metrics glossary&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Metric&lt;/th>
&lt;th>Symbol&lt;/th>
&lt;th>Exact definition (GenAI-Perf)&lt;/th>
&lt;th>Unit&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Time to First Token&lt;/strong>&lt;/td>
&lt;td>TTFT&lt;/td>
&lt;td>Time from sending the request to receiving the first token (includes queueing, prefill and network)&lt;/td>
&lt;td>ms&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Inter-Token Latency&lt;/strong>&lt;/td>
&lt;td>ITL (= TPOT)&lt;/td>
&lt;td>\(\frac{e2e\_latency - TTFT}{output\_tokens - 1}\) — decode phase only, excludes the first token&lt;/td>
&lt;td>ms/token&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Request Latency&lt;/strong>&lt;/td>
&lt;td>e2e_latency&lt;/td>
&lt;td>\(e2e = TTFT + Generation\_time\) — from the first request to the last response&lt;/td>
&lt;td>ms&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Output Token Throughput&lt;/strong>&lt;/td>
&lt;td>OTT&lt;/td>
&lt;td>\(\frac{total\_output\_tokens}{T_y - T_x}\) where \(T_x\) = first request, \(T_y\) = last token received&lt;/td>
&lt;td>tok/s&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Request Throughput&lt;/strong>&lt;/td>
&lt;td>RPS&lt;/td>
&lt;td>\(\frac{total\_completed\_requests}{T_y - T_x}\)&lt;/td>
&lt;td>req/s&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Input Sequence Length&lt;/strong>&lt;/td>
&lt;td>ISL&lt;/td>
&lt;td>Mean length in tokens of the input prompt&lt;/td>
&lt;td>tokens&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Output Sequence Length&lt;/strong>&lt;/td>
&lt;td>OSL&lt;/td>
&lt;td>Mean length in tokens of the generated response&lt;/td>
&lt;td>tokens&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>&lt;strong>Methodological note on ITL versus LLMPerf:&lt;/strong> GenAI-Perf excludes TTFT from the ITL
calculation (pure decode only). LLMPerf includes TTFT in its ITL mean. The numbers are not
directly comparable.&lt;/p>
&lt;p>&lt;strong>Methodological note on TPS versus LLMPerf:&lt;/strong> GenAI-Perf measures throughput between the
first request and the last token received (\(T_y - T_x\)). LLMPerf uses the total duration of
the benchmark including prompt generation and response storage; in a concurrency-1 scenario,
that difference can amount to up to 33% in the reported throughput figure.&lt;/p>
&lt;h3 id="console-output-table-real-example-trt-llm-backend">Console output table (real example, TRT-LLM backend)&lt;/h3>
&lt;p>The table GenAI-Perf prints for a profile with ISL=200, OSL=100, concurrency=1:&lt;/p>
&lt;pre tabindex="0">&lt;code> NVIDIA GenAI-Perf | LLM Metrics
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓
┃ Statistic ┃ avg ┃ min ┃ max ┃ p99 ┃ p90 ┃ p75 ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━┩
│ Time to first token (ms) │ 13.68 │ 11.07 │ 21.50 │ 18.81 │ 14.29 │ 13.97 │
│ Inter token latency (ms) │ 1.86 │ 1.28 │ 2.11 │ 2.11 │ 2.01 │ 1.95 │
│ Request latency (ms) │ 203.70 │ 180.33 │ 228.30 │ 225.45 │ 216.48 │ 211.72 │
│ Output sequence length │ 103.46 │ 95.00 │ 134.00 │ 122.96 │ 108.00 │ 104.75 │
│ Input sequence length │ 200.00 │ 200.00 │ 200.00 │ 200.00 │ 200.00 │ 200.00 │
│ Output token throughput (per sec) │ 504.02 │ N/A │ N/A │ N/A │ N/A │ N/A │
│ Request throughput (per sec) │ 4.87 │ N/A │ N/A │ N/A │ N/A │ N/A │
└───────────────────────────────────┴────────┴────────┴────────┴────────┴────────┴────────┘
&lt;/code>&lt;/pre>&lt;p>&lt;em>(Source: docs.nvidia.com/deeplearning/triton-inference-server — LLM tutorial)&lt;/em>&lt;/p>
&lt;hr>
&lt;h2 id="invocation-against-openai-compatible-endpoints">Invocation against OpenAI-compatible endpoints&lt;/h2>
&lt;h3 id="profile-mode-one-load-point">&lt;code>profile&lt;/code> mode: one load point&lt;/h3>
&lt;p>The &lt;code>profile&lt;/code> subcommand measures a fixed operating point (concurrency or request-rate,
synthetic ISL/OSL).&lt;/p>
&lt;p>&lt;strong>Example 1: vLLM endpoint (chat, streaming)&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 1. Bring up the vLLM server&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">docker run -it --net&lt;span class="o">=&lt;/span>host --rm --gpus&lt;span class="o">=&lt;/span>all &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> vllm/vllm-openai:latest &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --model meta-llama/Llama-3.1-70B-Instruct &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --dtype float16
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># 2. Profile with GenAI-Perf&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">genai-perf profile &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -m meta-llama/Llama-3.1-70B-Instruct &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --endpoint-type chat &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --streaming &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --concurrency &lt;span class="m">16&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --synthetic-input-tokens-mean &lt;span class="m">1024&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --synthetic-input-tokens-stddev &lt;span class="m">128&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-mean &lt;span class="m">256&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-stddev &lt;span class="m">0&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-mean-deterministic &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --request-count &lt;span class="m">200&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --warmup-request-count &lt;span class="m">20&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --tokenizer meta-llama/Llama-3.1-70B-Instruct
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Example 2: completions endpoint (no streaming)&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">genai-perf profile &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -m meta-llama/Llama-3.1-70B-Instruct &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --endpoint-type completions &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --concurrency &lt;span class="m">32&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --synthetic-input-tokens-mean &lt;span class="m">512&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --synthetic-input-tokens-stddev &lt;span class="m">64&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-mean &lt;span class="m">128&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --request-count &lt;span class="m">200&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --warmup-request-count &lt;span class="m">20&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Example 3: NVIDIA NIM (TRT-LLM backend endpoint, via Triton)&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">genai-perf profile &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -m meta/llama-3.1-70b-instruct &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --backend tensorrtllm &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --streaming &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --concurrency &lt;span class="m">8&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --synthetic-input-tokens-mean &lt;span class="m">2048&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --synthetic-input-tokens-stddev &lt;span class="m">0&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-mean &lt;span class="m">512&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-mean-deterministic &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --request-count &lt;span class="m">100&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --warmup-request-count &lt;span class="m">10&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --generate-plots
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Example 4: request-rate instead of concurrency (Poisson)&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">genai-perf profile &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -m meta-llama/Llama-3.1-70B-Instruct &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --endpoint-type chat &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --streaming &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --request-rate 5.0 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --synthetic-input-tokens-mean &lt;span class="m">1024&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-mean &lt;span class="m">256&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --request-count &lt;span class="m">300&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --warmup-request-count &lt;span class="m">30&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="main-flags-and-what-they-do">Main flags and what they do&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Flag&lt;/th>
&lt;th>Typical values&lt;/th>
&lt;th>Function&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>--endpoint-type&lt;/code>&lt;/td>
&lt;td>&lt;code>chat&lt;/code>, &lt;code>completions&lt;/code>, &lt;code>embeddings&lt;/code>&lt;/td>
&lt;td>Type of OpenAI-compatible endpoint&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--streaming&lt;/code>&lt;/td>
&lt;td>(boolean)&lt;/td>
&lt;td>Enables SSE streaming; required to measure real TTFT and ITL&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--concurrency&lt;/code>&lt;/td>
&lt;td>1, 8, 16, 32, 64&lt;/td>
&lt;td>Number of concurrent requests maintained; GenAI-Perf guarantees N active at all times&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--request-rate&lt;/code>&lt;/td>
&lt;td>1.0, 5.0, 10.0&lt;/td>
&lt;td>Constant arrival rate (req/s); does not guarantee N active&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--synthetic-input-tokens-mean&lt;/code>&lt;/td>
&lt;td>128–8192&lt;/td>
&lt;td>Mean of synthetic ISL tokens&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--synthetic-input-tokens-stddev&lt;/code>&lt;/td>
&lt;td>0–512&lt;/td>
&lt;td>Standard deviation of the ISL (0 = fixed)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--output-tokens-mean&lt;/code>&lt;/td>
&lt;td>64–2048&lt;/td>
&lt;td>Mean of target OSL tokens&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--output-tokens-mean-deterministic&lt;/code>&lt;/td>
&lt;td>(boolean)&lt;/td>
&lt;td>Sets the minimum output tokens = target mean (more precise with TRT-LLM)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--request-count&lt;/code>&lt;/td>
&lt;td>100–2000&lt;/td>
&lt;td>Number of requests to benchmark&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--warmup-request-count&lt;/code>&lt;/td>
&lt;td>10–50&lt;/td>
&lt;td>Warm-up requests discarded from the metrics&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--generate-plots&lt;/code>&lt;/td>
&lt;td>(boolean)&lt;/td>
&lt;td>Generates PNG plots of TTFT vs ISL, ITL vs token position, etc.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--tokenizer&lt;/code>&lt;/td>
&lt;td>HF model id&lt;/td>
&lt;td>Tokenizer for counting tokens; mandatory when ISL/OSL matter&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--backend&lt;/code>&lt;/td>
&lt;td>&lt;code>tensorrtllm&lt;/code>, &lt;code>vllm&lt;/code>&lt;/td>
&lt;td>Triton backend (for serving directly via Triton without an OpenAI endpoint)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--extra-inputs&lt;/code>&lt;/td>
&lt;td>&lt;code>ignore_eos:true&lt;/code>&lt;/td>
&lt;td>Extra request parameters; &lt;code>ignore_eos:true&lt;/code> guarantees a consistent OSL&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>&lt;strong>Note on &lt;code>--concurrency&lt;/code> versus &lt;code>--request-rate&lt;/code>:&lt;/strong> NVIDIA recommends using &lt;code>--concurrency&lt;/code>.
With &lt;code>--request-rate&lt;/code>, if the rate exceeds the engine&amp;rsquo;s throughput, the queue grows without
bound and the metrics stop being stable. With &lt;code>--concurrency&lt;/code>, there are always exactly N
active requests, which gives a clean latency-throughput curve.&lt;/p>
&lt;h3 id="output-artefacts">Output artefacts&lt;/h3>
&lt;p>GenAI-Perf dumps all results into an &lt;code>artifacts/&lt;/code> directory:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Artefact&lt;/th>
&lt;th>Format&lt;/th>
&lt;th>Content&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>profile_export_genai_perf.json&lt;/code>&lt;/td>
&lt;td>JSON&lt;/td>
&lt;td>Full metrics (avg, min, max, P75, P90, P99) + CLI arguments used&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>profile_export_genai_perf.csv&lt;/code>&lt;/td>
&lt;td>CSV&lt;/td>
&lt;td>Exported console tables, ready to import into Excel/pandas&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>profile_export.json&lt;/code>&lt;/td>
&lt;td>JSON&lt;/td>
&lt;td>Raw perf_analyzer data (per-request traces)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>inputs.json&lt;/code>&lt;/td>
&lt;td>JSON&lt;/td>
&lt;td>Synthetic payloads sent (for reproducibility)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>PNG plots&lt;/td>
&lt;td>PNG&lt;/td>
&lt;td>TTFT analysis, Request latency, TTFT vs ISL, ITL vs position, ISL vs OSL (with &lt;code>--generate-plots&lt;/code>)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;hr>
&lt;h2 id="the-analyze-subcommand-automatic-concurrency-sweep">The &lt;code>analyze&lt;/code> subcommand: automatic concurrency sweep&lt;/h2>
&lt;p>The &lt;code>analyze&lt;/code> subcommand sweeps multiple values of a parameter in a single command and
generates a summary CSV.&lt;/p>
&lt;h3 id="concurrency-sweep-the-most-used">Concurrency sweep (the most used)&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Sweeps concurrencies 1, 2, 4, 8, 16, 32, 64, 128, 256&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">genai-perf analyze &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -m meta-llama/Llama-3.1-70B-Instruct &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --endpoint-type chat &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --streaming &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --sweep-type concurrency &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --sweep-range 1:256 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --synthetic-input-tokens-mean &lt;span class="m">1024&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-mean &lt;span class="m">256&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --request-count &lt;span class="m">200&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --warmup-request-count &lt;span class="m">20&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="request-rate-sweep">Request-rate sweep&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Sweeps 2, 4, 6, 8, 10, 12 req/s&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">genai-perf analyze &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -m meta-llama/Llama-3.1-70B-Instruct &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --endpoint-type chat &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --streaming &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --sweep-type request_rate &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --sweep-list 2,4,6,8,10,12 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --synthetic-input-tokens-mean &lt;span class="m">1024&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-mean &lt;span class="m">256&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --request-count &lt;span class="m">200&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --warmup-request-count &lt;span class="m">20&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="isl-sweep-to-study-the-effect-of-prefill">ISL sweep (to study the effect of prefill)&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">genai-perf analyze &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> -m meta-llama/Llama-3.1-70B-Instruct &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --endpoint-type chat &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --streaming &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --sweep-type input_sequence_length &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --sweep-list 256,512,1024,2048,4096 &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --concurrency &lt;span class="m">16&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --output-tokens-mean &lt;span class="m">256&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --request-count &lt;span class="m">200&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> --warmup-request-count &lt;span class="m">20&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="artefact-structure-of-analyze">Artefact structure of &lt;code>analyze&lt;/code>&lt;/h3>
&lt;p>For a sweep with &lt;code>--sweep-type concurrency --sweep-range 1:32&lt;/code>:&lt;/p>
&lt;pre tabindex="0">&lt;code>artifacts/
llama70b-openai-chat-concurrency1/
inputs.json
profile_export.json
profile_export_genai_perf.json
profile_export_genai_perf.csv
llama70b-openai-chat-concurrency2/
...
llama70b-openai-chat-concurrency4/
...
[...]
analyze_export_genai_perf.csv ← summary of every scenario
checkpoint.json ← allows interrupted sweeps to be resumed
&lt;/code>&lt;/pre>&lt;h3 id="summary-csv-format">Summary CSV format&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-csv" data-lang="csv">Config Name,Concurrency,ISL,p99 TTFT (ms),p99 ITL (ms),p99 Request Latency (ms),Avg. OTT (tok/s),RPS
llama70b_run_0,1,1024,45.2,6.8,1823.4,128.3,0.55
llama70b_run_1,4,1024,48.1,7.1,1901.2,510.7,2.18
llama70b_run_2,8,1024,61.3,7.9,2142.5,989.2,4.12
llama70b_run_3,16,1024,98.7,9.4,2891.3,1741.6,6.88
llama70b_run_4,32,1024,284.1,14.2,4320.8,2134.2,7.14
llama70b_run_5,64,1024,892.4,28.7,8741.2,2251.8,7.23
&lt;/code>&lt;/pre>&lt;p>The summary CSV also includes a second table with GPU metrics (P99 power, energy, utilisation,
memory) when they are captured via Triton&amp;rsquo;s telemetry URLs
(&lt;code>--server-metrics-urls http://localhost:8002/metrics&lt;/code>).&lt;/p>
&lt;hr>
&lt;h2 id="comparison-table-genai-perf-versus-guidellm-versus-llmperf-versus-vllm-bench">Comparison table: GenAI-Perf versus GuideLLM versus LLMPerf versus vLLM bench&lt;/h2>
&lt;p>The choice of tool changes the number. They are not comparable with each other without
adjustment.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Dimension&lt;/th>
&lt;th>&lt;strong>GenAI-Perf&lt;/strong>&lt;/th>
&lt;th>&lt;strong>GuideLLM&lt;/strong>&lt;/th>
&lt;th>&lt;strong>LLMPerf&lt;/strong>&lt;/th>
&lt;th>&lt;strong>vLLM bench serve&lt;/strong>&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Origin / maintainer&lt;/strong>&lt;/td>
&lt;td>NVIDIA / Triton team (retired Apr 2026)&lt;/td>
&lt;td>Red Hat / vLLM project&lt;/td>
&lt;td>Anyscale / Ray&lt;/td>
&lt;td>vLLM project&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Class&lt;/strong>&lt;/td>
&lt;td>multi-process load generator&lt;/td>
&lt;td>multi-process load generator&lt;/td>
&lt;td>multi-process load generator&lt;/td>
&lt;td>single-process micro-bench&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Supported endpoints&lt;/strong>&lt;/td>
&lt;td>OpenAI-compatible + KServe + native Triton&lt;/td>
&lt;td>OpenAI-compatible&lt;/td>
&lt;td>OpenAI-compatible&lt;/td>
&lt;td>native vLLM&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Main load mode&lt;/strong>&lt;/td>
&lt;td>fixed concurrency N (recommended) or constant request-rate&lt;/td>
&lt;td>synchronous, concurrent, poisson, throughput, &lt;strong>automatic sweep&lt;/strong>&lt;/td>
&lt;td>batches of N concurrent (with a draining period at the end)&lt;/td>
&lt;td>request-rate, concurrency&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Draining period&lt;/strong>&lt;/td>
&lt;td>NO — guarantees N active at all times&lt;/td>
&lt;td>NO (poisson)&lt;/td>
&lt;td>YES — at the end of each batch the system empties, concurrency drops to 0&lt;/td>
&lt;td>N/A&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Automatic sweep&lt;/strong>&lt;/td>
&lt;td>&lt;code>analyze&lt;/code> (concurrency, request-rate, ISL, OSL)&lt;/td>
&lt;td>&lt;code>--rate-type sweep&lt;/code> (idle to saturation, 10 rounds)&lt;/td>
&lt;td>manual (several runs)&lt;/td>
&lt;td>&lt;code>vllm bench sweep serve&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>LLM metrics&lt;/strong>&lt;/td>
&lt;td>TTFT, ITL, e2e latency, OTT, RPS, ISL/OSL&lt;/td>
&lt;td>TTFT, ITL/TPOT, throughput, goodput under SLO&lt;/td>
&lt;td>TTFT, ITL (includes TTFT in the mean), TPS (total benchmark duration)&lt;/td>
&lt;td>TTFT, TPOT, throughput&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>ITL difference&lt;/strong>&lt;/td>
&lt;td>excludes TTFT: \((e2e - TTFT) / (N_{tok}-1)\)&lt;/td>
&lt;td>excludes TTFT (same as GenAI-Perf)&lt;/td>
&lt;td>includes TTFT in the mean&lt;/td>
&lt;td>excludes TTFT&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>TPS difference&lt;/strong>&lt;/td>
&lt;td>\(total\_tokens / (T_y - T_x)\)&lt;/td>
&lt;td>throughput + goodput under SLO&lt;/td>
&lt;td>\(total\_tokens / (T_{end} - T_{start})\) — up to 33% lower&lt;/td>
&lt;td>\(total\_tokens / (T_y - T_x)\)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Goodput / SLO&lt;/strong>&lt;/td>
&lt;td>NO&lt;/td>
&lt;td>YES (the key differentiator)&lt;/td>
&lt;td>NO&lt;/td>
&lt;td>NO&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Exports&lt;/strong>&lt;/td>
&lt;td>JSON + CSV + PNG + checkpoint&lt;/td>
&lt;td>JSON + YAML + CSV + interactive HTML&lt;/td>
&lt;td>JSON&lt;/td>
&lt;td>console / JSON&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Built-in warm-up&lt;/strong>&lt;/td>
&lt;td>YES (&lt;code>--warmup-request-count&lt;/code>)&lt;/td>
&lt;td>YES (warm-up requests)&lt;/td>
&lt;td>NOT native&lt;/td>
&lt;td>YES&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Real datasets&lt;/strong>&lt;/td>
&lt;td>OpenOrca, CNN DailyMail, JSONL file, moon_cake&lt;/td>
&lt;td>file with a traffic distribution&lt;/td>
&lt;td>JSONL file&lt;/td>
&lt;td>sharegpt, random&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>GPU telemetry&lt;/strong>&lt;/td>
&lt;td>YES (via Triton&amp;rsquo;s server-metrics-urls → summary CSV)&lt;/td>
&lt;td>NOT native (integrate DCGM separately)&lt;/td>
&lt;td>NO&lt;/td>
&lt;td>NO&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>When to choose it&lt;/strong>&lt;/td>
&lt;td>fine profiling of one operating point, comparing configs with the same harness, integration with NIM/Triton&lt;/td>
&lt;td>SLO-driven sweep, finding the knee, sizing replicas&lt;/td>
&lt;td>quick endpoint validation in the Ray ecosystem&lt;/td>
&lt;td>iterating on vLLM flags&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>&lt;strong>Fair-comparison rule:&lt;/strong> never cross numbers from different tools for the same conclusion. If
vLLM and TRT-LLM are being compared, use GenAI-Perf against both, with the same ISL/OSL, the
same concurrency and the same &lt;code>--warmup-request-count&lt;/code>. The tool is the constant; the engine is
the variable.&lt;/p>
&lt;hr>
&lt;h2 id="profiling-on-4h100-sxm-80-gb-a-full-sweep-example">Profiling on 4×H100 SXM 80 GB: a full sweep example&lt;/h2>
&lt;p>Generic reference hardware: 4×H100 SXM 80 GB NVLink, model Llama-3.1-70B-Instruct FP16,
ISL=1024 tokens, OSL=256 tokens, vLLM endpoint.&lt;/p>
&lt;h3 id="illustrative-result-of-a-concurrency-sweep-164">Illustrative result of a concurrency sweep (1→64)&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Concurrency&lt;/th>
&lt;th>TTFT P50 (ms)&lt;/th>
&lt;th>TTFT P99 (ms)&lt;/th>
&lt;th>ITL P50 (ms)&lt;/th>
&lt;th>ITL P99 (ms)&lt;/th>
&lt;th>OTT (tok/s)&lt;/th>
&lt;th>RPS&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>1&lt;/td>
&lt;td>38&lt;/td>
&lt;td>45&lt;/td>
&lt;td>6.4&lt;/td>
&lt;td>7.1&lt;/td>
&lt;td>130&lt;/td>
&lt;td>0.51&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>4&lt;/td>
&lt;td>40&lt;/td>
&lt;td>51&lt;/td>
&lt;td>6.8&lt;/td>
&lt;td>8.2&lt;/td>
&lt;td>510&lt;/td>
&lt;td>2.00&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>8&lt;/td>
&lt;td>46&lt;/td>
&lt;td>62&lt;/td>
&lt;td>7.3&lt;/td>
&lt;td>9.4&lt;/td>
&lt;td>980&lt;/td>
&lt;td>3.83&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>16&lt;/td>
&lt;td>68&lt;/td>
&lt;td>98&lt;/td>
&lt;td>8.9&lt;/td>
&lt;td>12.1&lt;/td>
&lt;td>1,720&lt;/td>
&lt;td>6.72&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>32&lt;/td>
&lt;td>145&lt;/td>
&lt;td>284&lt;/td>
&lt;td>13.7&lt;/td>
&lt;td>21.4&lt;/td>
&lt;td>2,130&lt;/td>
&lt;td>8.32&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>48&lt;/td>
&lt;td>380&lt;/td>
&lt;td>740&lt;/td>
&lt;td>22.3&lt;/td>
&lt;td>38.6&lt;/td>
&lt;td>2,280&lt;/td>
&lt;td>8.90&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>64&lt;/td>
&lt;td>890&lt;/td>
&lt;td>1,820&lt;/td>
&lt;td>41.2&lt;/td>
&lt;td>78.3&lt;/td>
&lt;td>2,340&lt;/td>
&lt;td>9.14&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>How to read it: throughput saturates around concurrency 48–64, while TTFT P99 already exceeds
500 ms from concurrency 32 onwards. The &lt;strong>knee&lt;/strong> (the last point with TTFT P99 &amp;lt; 500 ms) is at
concurrency 16 with 1,720 useful tok/s. Anyone reporting &amp;ldquo;2,340 tok/s&amp;rdquo; (concurrency 64) is
describing the maximum throughput, at a point where the system meets no interactive chat SLO
at all.&lt;/p>
&lt;h3 id="formulas-for-the-key-metrics">Formulas for the key metrics&lt;/h3>
$$
\text{ITL} = \frac{e2e\_latency - TTFT}{N_{output\_tokens} - 1}
$$
$$
\text{OTT} = \frac{\sum output\_tokens}{T_y - T_x}
$$
$$
\text{RPS} = \frac{N_{requests}}{T_y - T_x}
$$
&lt;p>where \(T_x\) is the timestamp of the first request sent and \(T_y\) the timestamp of the last
token received from the last request.&lt;/p>
&lt;hr>
&lt;h2 id="synthetic-islosl-profiling-what-to-configure-for-each-use-case">Synthetic ISL/OSL profiling: what to configure for each use case&lt;/h2>
&lt;p>The ISL/OSL parameters determine which engine of the system is stressed: a long ISL stresses
prefill (KV-cache, TTFT); a long OSL stresses decode (ITL, memory bandwidth).&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Use case&lt;/th>
&lt;th>Typical ISL&lt;/th>
&lt;th>Typical OSL&lt;/th>
&lt;th>&lt;code>--synthetic-input-tokens-mean&lt;/code>&lt;/th>
&lt;th>&lt;code>--output-tokens-mean&lt;/code>&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Short interactive chat&lt;/td>
&lt;td>~300 tok&lt;/td>
&lt;td>~100 tok&lt;/td>
&lt;td>300&lt;/td>
&lt;td>100&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Code copilot&lt;/td>
&lt;td>~800 tok&lt;/td>
&lt;td>~200 tok&lt;/td>
&lt;td>800&lt;/td>
&lt;td>200&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Document summarisation&lt;/td>
&lt;td>~2000 tok&lt;/td>
&lt;td>~256 tok&lt;/td>
&lt;td>2000&lt;/td>
&lt;td>256&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>RAG with long context&lt;/td>
&lt;td>~4096 tok&lt;/td>
&lt;td>~512 tok&lt;/td>
&lt;td>4096&lt;/td>
&lt;td>512&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Batch without latency&lt;/td>
&lt;td>~512 tok&lt;/td>
&lt;td>~1024 tok&lt;/td>
&lt;td>512&lt;/td>
&lt;td>1024&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The &lt;code>--extra-inputs ignore_eos:true&lt;/code> option disables the engine&amp;rsquo;s EOS token, forcing exactly
the requested tokens to be generated. Essential for measuring a consistent OSL on TRT-LLM;
optional on vLLM.&lt;/p>
&lt;hr>
&lt;h2 id="honest-methodology-how-not-to-measure-badly">Honest methodology: how not to measure badly&lt;/h2>
&lt;h3 id="1-warm-up-is-mandatory">1. Warm-up is mandatory&lt;/h3>
&lt;p>Without warm-up, the first requests include the KV-cache loading latency, the engine&amp;rsquo;s
autotuning and the initialisations. GenAI-Perf applies a sliding window to detect stability
(max/min ratio within a margin over the last 3 measurements), but the explicit
&lt;code>--warmup-request-count&lt;/code> discards the first N requests from the metrics. Recommended minimum
value: 10 requests (or 5% of the total if the total is large).&lt;/p>
&lt;h3 id="2-the-concurrency-knee-extend-the-sweep-until-you-see-it">2. The concurrency knee: extend the sweep until you see it&lt;/h3>
&lt;p>Throughput saturates once the engine&amp;rsquo;s effective max batch size is reached. If the sweep stops
before saturation is reached, the &amp;ldquo;maximum capacity&amp;rdquo; reported is the last concurrency tested,
not the real knee. The rule: the sweep must reach a point where TTFT P99 has doubled relative
to the low-load value (or where OTT stops growing by more than 5% between steps). Only then is
the knee visible.&lt;/p>
&lt;p>For a sweep with &lt;code>--sweep-range 1:256&lt;/code>, GenAI-Perf sweeps 1, 2, 4, 8, 16, 32, 64, 128, 256
(powers of 2). On most 70B models over 4×H100, saturation occurs between concurrency 32 and
64; the range 1:128 covers the knee with room to spare.&lt;/p>
&lt;h3 id="3-concurrency-versus-request-rate-choosing-correctly">3. Concurrency versus request-rate: choosing correctly&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Mode&lt;/th>
&lt;th>Behaviour&lt;/th>
&lt;th>When to use&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;code>--concurrency N&lt;/code>&lt;/td>
&lt;td>Always N active requests; when one finishes, the next is sent&lt;/td>
&lt;td>Clean latency-throughput curve; comparison between configs&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;code>--request-rate R&lt;/code>&lt;/td>
&lt;td>1 request is sent every 1/R seconds; the queue can grow without bound&lt;/td>
&lt;td>Simulating traffic with arrivals at a constant rate&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>NVIDIA recommends &lt;code>--concurrency&lt;/code> for benchmarking. With &lt;code>--request-rate&lt;/code>, if R exceeds the
engine&amp;rsquo;s maximum throughput, the queue grows indefinitely and the metrics become unstable.&lt;/p>
&lt;h3 id="4-single-process-versus-multi-process-bias">4. Single-process versus multi-process bias&lt;/h3>
&lt;p>GenAI-Perf is multi-process: it maintains N concurrent requests using perf_analyzer&amp;rsquo;s internal
manager. There is no risk of client saturation. This sets it apart from &lt;code>vllm bench serve&lt;/code>
(single-process), which can saturate on the client at high concurrency and give inflated
throughput metrics.&lt;/p>
&lt;h3 id="5-ignore_eos-and-an-inconsistent-osl">5. &lt;code>ignore_eos&lt;/code> and an inconsistent OSL&lt;/h3>
&lt;p>Without &lt;code>--extra-inputs ignore_eos:true&lt;/code>, the engine may generate fewer tokens than requested
(if the model produces an EOS earlier). This makes the real OSL vary between requests and the
ITL become inconsistent between runs. For reproducible benchmarks with a controlled OSL: always
enable &lt;code>ignore_eos:true&lt;/code>.&lt;/p>
&lt;h3 id="6-the-correct-tokenizer">6. The correct tokenizer&lt;/h3>
&lt;p>The &lt;code>--tokenizer&lt;/code> flag must point to the model being served. If it is omitted, GenAI-Perf uses
a default tokenizer that can give different ISL/OSL in the real model&amp;rsquo;s tokens, making the
throughput numbers in tok/s not comparable between models with different vocabularies.&lt;/p>
&lt;h3 id="7-one-run--a-data-point-three-or-more--a-number">7. One run = a data point; three or more = a number&lt;/h3>
&lt;p>Variance between runs under identical conditions can be 5–10% on tail latency metrics (P99). A
single profile is not a defensible number; the mean of three runs with the same config is.&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1rem auto;">
&lt;svg viewBox="0 0 780 170" role="img" aria-label="Flow of a reproducible benchmark with GenAI-Perf: deploy engine, warm up, concurrency sweep beyond the knee, collect JSON, compare" xmlns="http://www.w3.org/2000/svg">
&lt;style>.bx{fill:none;stroke:currentColor;stroke-width:1.3}.tl{font:600 12px sans-serif;fill:currentColor}.ts{font:11px sans-serif;fill:currentColor}.ar{fill:none;stroke:currentColor;stroke-width:1.3;marker-end:url(#bm)}&lt;/style>
&lt;defs>&lt;marker id="bm" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>&lt;/marker>&lt;/defs>
&lt;rect class="bx" x="20" y="50" width="120" height="44" rx="6"/>&lt;text x="80" y="69" text-anchor="middle" class="tl">1 · Engine&lt;/text>&lt;text x="80" y="85" text-anchor="middle" class="ts">pinned config&lt;/text>
&lt;path class="ar" d="M140,72 L163,72"/>
&lt;rect class="bx" x="163" y="50" width="120" height="44" rx="6"/>&lt;text x="223" y="69" text-anchor="middle" class="tl">2 · Warm-up&lt;/text>&lt;text x="223" y="85" text-anchor="middle" class="ts">≥10 requests&lt;/text>
&lt;path class="ar" d="M283,72 L306,72"/>
&lt;rect class="bx" x="306" y="50" width="130" height="44" rx="6"/>&lt;text x="371" y="69" text-anchor="middle" class="tl">3 · Sweep&lt;/text>&lt;text x="371" y="85" text-anchor="middle" class="ts">1:256, past the knee&lt;/text>
&lt;path class="ar" d="M436,72 L459,72"/>
&lt;rect class="bx" x="459" y="50" width="130" height="44" rx="6"/>&lt;text x="524" y="69" text-anchor="middle" class="tl">4 · Artefacts&lt;/text>&lt;text x="524" y="85" text-anchor="middle" class="ts">versioned JSON + CSV&lt;/text>
&lt;path class="ar" d="M589,72 L612,72"/>
&lt;rect class="bx" x="612" y="50" width="130" height="44" rx="6"/>&lt;text x="677" y="69" text-anchor="middle" class="tl">5 · Compare&lt;/text>&lt;text x="677" y="85" text-anchor="middle" class="ts">P99 at the knee&lt;/text>
&lt;text x="20" y="128" class="ts">Pin: genai-perf version, engine version, model, precision, ISL/OSL, hardware, tokenizer.&lt;/text>
&lt;text x="20" y="145" class="ts">Without that metadata in the JSON, the number is neither reproducible nor comparable.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;hr>
&lt;h2 id="connection-with-the-cost-and-energy-track">Connection with the cost and energy track&lt;/h2>
&lt;p>GenAI-Perf can capture GPU metrics in the same summary CSV if
&lt;code>--server-metrics-urls http://localhost:8002/metrics&lt;/code> is passed (Triton&amp;rsquo;s metrics endpoint,
which exposes power and utilisation via DCGM). The &lt;code>analyze&lt;/code> summary CSV then includes a second
table with P99 power (W), energy (MJ), utilisation (%) and memory (GB) per GPU and per
scenario.&lt;/p>
&lt;p>With that data, a single sweep yields the three axes of the scorecard:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Axis&lt;/th>
&lt;th>Source&lt;/th>
&lt;th>Metric&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Performance&lt;/td>
&lt;td>GenAI-Perf&lt;/td>
&lt;td>OTT (tok/s), TTFT P99, ITL P99&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Energy&lt;/td>
&lt;td>DCGM via server-metrics-urls&lt;/td>
&lt;td>Power (W) → \(J/token = W / OTT\)&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Cost&lt;/td>
&lt;td>node price&lt;/td>
&lt;td>EUR/hour → \(EUR/token = EUR_{hour} / (OTT \times 3600)\)&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The formula for cost per million tokens:&lt;/p>
$$
CPM = \frac{EUR_{hour}}{OTT \times 3{.}6 \times 10^3}
$$
&lt;p>where \(OTT\) is the output token throughput in tok/s and \(CPM\) is the cost per million
tokens in EUR.&lt;/p>
&lt;p>It connects with &lt;a href="https://blog.lo0.es/en/posts/gpu-observability-llm-inference-twelve-dcgm-vllm-metrics/">GPU observability with DCGM&lt;/a> for
the power capture, and with &lt;a href="https://blog.lo0.es/en/posts/anatomy-llm-request-production-tour-six-stages/">anatomy of an LLM request&lt;/a>
for the breakdown of phases (prefill versus decode) that TTFT and ITL quantify.&lt;/p>
&lt;hr>
&lt;h2 id="status-2026-genai-perf--aiperf">Status 2026: GenAI-Perf → AIPerf&lt;/h2>
&lt;p>NVIDIA announced in April 2026 that GenAI-Perf moves to passive maintenance mode (no new
features) and that the active successor is &lt;strong>AIPerf&lt;/strong> (&lt;code>github.com/ai-dynamo/aiperf&lt;/code>). AIPerf
adds automatic detection of the saturation point (&lt;code>estimatedCapacity&lt;/code>) and is integrated into
the NVIDIA Dynamo pipeline.&lt;/p>
&lt;p>For new benchmarks in production: migrate to AIPerf. To reproduce historical runs documented
with GenAI-Perf, or to use NVIDIA&amp;rsquo;s NIM benchmarking artefacts (which use GenAI-Perf): stay on
GenAI-Perf 25.x.&lt;/p>
&lt;p>The article &lt;a href="https://blog.lo0.es/en/posts/llm-benchmark-tool-catalogue-practical-deep-dive/">LLM benchmark tools, one by one&lt;/a>
covers the full comparison including AIPerf. The article
&lt;a href="https://blog.lo0.es/en/posts/guidellm-validating-slo-under-load-sizing-knee/">GuideLLM: SLO validation under load&lt;/a> details
the SLO-driven sweep that GenAI-Perf does not do natively. For the general methodology context:
&lt;a href="https://blog.lo0.es/en/posts/llm-inference-benchmarking-frameworks-metrics-state-of-the-art/">LLM benchmarking frameworks, state of the art&lt;/a>.&lt;/p>
&lt;hr>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/measurement-bias-reproducibility-llm-benchmarks/">Measurement bias and reproducibility&lt;/a> — the configuration traps that invalidate a GenAI-Perf sweep even when the commands are correct: insufficient warm-up, synthetic versus real dataset, shared environment.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/llm-serving-engines-pareto-frontier-comparison/">LLM serving engines compared (vLLM/SGLang/TRT-LLM/Dynamo)&lt;/a> — where the numbers measured with GenAI-Perf land: the goodput-latency Pareto frontier across the four main engines.&lt;/li>
&lt;/ul>
&lt;h2 id="sources">Sources&lt;/h2>
&lt;ul>
&lt;li>NVIDIA · GenAI-Perf — README oficial — &lt;a href="https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/perf_analyzer/genai-perf/README.html">https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/perf_analyzer/genai-perf/README.html&lt;/a>&lt;/li>
&lt;li>NVIDIA · Tutorial LLM con GenAI-Perf (comandos y tablas de salida reales) — &lt;a href="https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/perf_analyzer/genai-perf/docs/tutorial.html">https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/perf_analyzer/genai-perf/docs/tutorial.html&lt;/a>&lt;/li>
&lt;li>NVIDIA · GenAI-Perf Analyze subcommand (sweep, CSV resumen, checkpoint) — &lt;a href="https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/perf_analyzer/genai-perf/docs/analyze.html">https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/perf_analyzer/genai-perf/docs/analyze.html&lt;/a>&lt;/li>
&lt;li>NVIDIA · NIM LLM Benchmarking — Métricas (definiciones TTFT, ITL, TPS, RPS, fórmulas exactas) — &lt;a href="https://docs.nvidia.com/nim/benchmarking/llm/latest/metrics.html">https://docs.nvidia.com/nim/benchmarking/llm/latest/metrics.html&lt;/a>&lt;/li>
&lt;li>NVIDIA · NIM LLM Benchmarking — Parámetros y buenas prácticas (ISL/OSL, concurrencia vs request-rate, ignore_eos) — &lt;a href="https://docs.nvidia.com/nim/benchmarking/llm/latest/parameters.html">https://docs.nvidia.com/nim/benchmarking/llm/latest/parameters.html&lt;/a>&lt;/li>
&lt;li>NVIDIA Technical Blog · Measuring Generative AI Model Performance Using NVIDIA GenAI-Perf and an OpenAI-Compatible API — &lt;a href="https://developer.nvidia.com/blog/measuring-generative-ai-model-performance-using-nvidia-genai-perf-and-an-openai-compatible-api/">https://developer.nvidia.com/blog/measuring-generative-ai-model-performance-using-nvidia-genai-perf-and-an-openai-compatible-api/&lt;/a>&lt;/li>
&lt;li>GitHub · triton-inference-server/perf_analyzer (genai-perf) — &lt;a href="https://github.com/triton-inference-server/perf_analyzer/blob/main/genai-perf/README.md">https://github.com/triton-inference-server/perf_analyzer/blob/main/genai-perf/README.md&lt;/a>&lt;/li>
&lt;li>GitHub · ray-project/llmperf (métricas y diferencias metodológicas) — &lt;a href="https://github.com/ray-project/llmperf">https://github.com/ray-project/llmperf&lt;/a>&lt;/li>
&lt;li>PyPI · nvidia-genai-perf-eval — &lt;a href="https://pypi.org/project/nvidia-genai-perf-eval/">https://pypi.org/project/nvidia-genai-perf-eval/&lt;/a>&lt;/li>
&lt;li>Macnica · Benchmarking LLM Applications Part 1: What is GenAI-Perf? — &lt;a href="https://www.macnica.co.jp/en/business/semiconductor/articles/nvidia/145977/">https://www.macnica.co.jp/en/business/semiconductor/articles/nvidia/145977/&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>LLM inference benchmarking: frameworks, metrics and the state of the art (tool by tool)</title><link>https://blog.lo0.es/en/posts/llm-inference-benchmarking-frameworks-metrics-state-of-the-art/</link><pubDate>Sat, 13 Jun 2026 02:30:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/llm-inference-benchmarking-frameworks-metrics-state-of-the-art/</guid><description>&lt;blockquote>
&lt;p>Notation: amounts in &lt;strong>euros (N €)&lt;/strong>, decimals with a point. Performance is not very
sensitive to the country, but its associated cost (cost per token) is expressed in € and
links back to the &lt;a href="https://blog.lo0.es/en/posts/cost-performance-energy-three-axes-llm-inference/">opening article&lt;/a>.&lt;/p>
&lt;/blockquote>
&lt;h2 id="what-this-introduction-covers">What this introduction covers&lt;/h2>
&lt;p>Third article in the data series, a deep dive into the performance axis. Measuring the
performance of an inference engine looks trivial (&amp;ldquo;how many tokens per second?&amp;rdquo;) and it is
exactly where people fool themselves most: two tools can report results that differ by a
factor of 7 for the same system. This article inventories the metrics that matter and &lt;strong>how
they are defined&lt;/strong>, why the architecture of the tool biases the figure, how the saturation
point is found with a concurrency &lt;em>sweep&lt;/em>, and the profile of each framework. No
recommendations: the choice of engine is settled in the Pareto article (B8); here there are
only the facts and the methodology, because &lt;strong>a benchmark without a published methodology is
not comparable&lt;/strong>.&lt;/p>
&lt;hr>
&lt;h2 id="the-performance-metrics">The performance metrics&lt;/h2>
&lt;p>There is no single performance metric, there are five, and mixing them is the first source
of error:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Metric&lt;/th>
&lt;th>Definition&lt;/th>
&lt;th>Unit&lt;/th>
&lt;th>Dominant phase&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>TTFT&lt;/strong> (Time To First Token)&lt;/td>
&lt;td>time from sending the prompt to the first token&lt;/td>
&lt;td>ms&lt;/td>
&lt;td>prefill&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>TPOT / ITL&lt;/strong> (Time Per Output Token / Inter-Token Latency)&lt;/td>
&lt;td>average time between output tokens once generation has started&lt;/td>
&lt;td>ms/token&lt;/td>
&lt;td>decode&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Request throughput&lt;/strong>&lt;/td>
&lt;td>complete request-response cycles per second at the concurrency tested&lt;/td>
&lt;td>req/s&lt;/td>
&lt;td>both&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Token throughput&lt;/strong>&lt;/td>
&lt;td>total tokens (input + output) per second across all concurrent requests&lt;/td>
&lt;td>tok/s&lt;/td>
&lt;td>both&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Goodput&lt;/strong>&lt;/td>
&lt;td>share of requests that &lt;strong>meet the defined SLO&lt;/strong>&lt;/td>
&lt;td>useful tok/s&lt;/td>
&lt;td>both&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>P50 / P95 / P99&lt;/strong>&lt;/td>
&lt;td>latency percentiles (not the mean)&lt;/td>
&lt;td>ms&lt;/td>
&lt;td>—&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Precise definitions, because every tool computes them its own way (&lt;a href="https://docs.anyscale.com/llm/serving/benchmarking/metrics">Anyscale · latency and
throughput metrics&lt;/a>): TTFT is
what a user waits before seeing the first character, dominated by prefill compute; ITL is
the average time between successive output tokens and sets the perceived &amp;ldquo;typing speed&amp;rdquo; of
the answer; request throughput is complete cycles per second; token throughput is
total tokens (input plus output) per second across all concurrent requests.&lt;/p>
&lt;h3 id="the-latency-decomposition">The latency decomposition&lt;/h3>
&lt;p>The total latency of a request with \(N\) output tokens decomposes as:&lt;/p>
$$\text{latency} \approx \text{TTFT} + (N-1)\times \text{TPOT}$$
&lt;p>That is why TTFT and TPOT are reported separately: a single mean latency hides very
different profiles. A system with high TTFT and low TPOT (expensive prefill, fast decode) and
another one the other way round can have the same mean latency for one particular length, yet
behave in opposite ways when the response size changes. For an interactive chat experience
TTFT and TPOT rule; for a batch of long summaries, token throughput does. Measuring the mean
hides both realities.&lt;/p>
&lt;h3 id="goodput-the-honest-metric">Goodput: the honest metric&lt;/h3>
&lt;p>Raw throughput (TPS, RPS) says how much work the system does; &lt;strong>goodput&lt;/strong> says how much
of that work meets your quality-of-service standards (SLO)
(&lt;a href="https://docs.anyscale.com/llm/serving/benchmarking/metrics">Anyscale&lt;/a>). An engine can boast
10,000 aggregate tok/s, but if half the requests violate the P99 TTFT SLO, its goodput is
5,000. The figure you defend in a proposal is the &lt;strong>goodput&lt;/strong>, not the catalogue throughput:
it is the only one that translates into satisfied users and an honest cost per token.&lt;/p>
&lt;hr>
&lt;h2 id="how-each-metric-is-instrumented-and-where-the-error-creeps-in">How each metric is instrumented (and where the error creeps in)&lt;/h2>
&lt;p>Before comparing numbers it helps to know where each clock starts and stops, because two
tools can call different things &amp;ldquo;TTFT&amp;rdquo;:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Client-side versus server-side TTFT.&lt;/strong> The TTFT measured by the client includes network
latency and gateway queueing; the one measured by the server does not. For an engine
comparison the server-side figure is the one that matters; for user experience, the
client-side one. Mixing the two invalidates the comparison.&lt;/li>
&lt;li>&lt;strong>Streaming is required.&lt;/strong> TTFT and ITL can only be measured if the response arrives as a
&lt;em>stream&lt;/em> (token by token). If the tool measures complete responses, there is no real TTFT:
there is total latency in disguise.&lt;/li>
&lt;li>&lt;strong>Token counting.&lt;/strong> Throughput in tok/s depends on which tokenizer counts the tokens.
If the tool uses a tokenizer different from the model&amp;rsquo;s, the token count (and therefore the
tok/s and the cost per token) is biased. You have to count with the tokenizer of the model
being served.&lt;/li>
&lt;li>&lt;strong>Warm-up and prefix cache.&lt;/strong> The first requests of a benchmark benefit from a warm prefix
cache and give artificially low TTFT; the warm-up has to be discarded or the result
inflates reality.&lt;/li>
&lt;/ul>
&lt;p>These four instrumentation decisions explain a good share of the discrepancies between tools.
A performance figure that does not say where the clock is measured and with which tokenizer
is not comparable, however precise it may look.&lt;/p>
&lt;hr>
&lt;h2 id="the-architecture-of-the-tool-biases-the-figure">The architecture of the tool biases the figure&lt;/h2>
&lt;p>Here is the trap that invalidates half the published benchmarks. Tools split into two classes
by the architecture of the client that generates the load, and that architecture
determines whether the measurement is reliable at high concurrency:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Single-process micro-bench&lt;/strong> (vLLM bench, SGLang bench, genai-perf): a Python client with
asyncio in a single process. Useful for quick experiments on one engine, but the
single-process architecture introduces a bottleneck on the client side that &lt;strong>biases the
data at high concurrency&lt;/strong> (&lt;a href="https://kchandan.medium.com/llm-inference-benchmarking-genai-perf-and-vllm-5dd06b57428e">genAI-perf and vLLM&lt;/a>):
the client cannot generate enough load and you measure the limit of the client, not the
limit of the engine.&lt;/li>
&lt;li>&lt;strong>Multi-process load&lt;/strong> (GuideLLM, AIPerf): they spread load generation across several
processes, avoiding that limit. This is the class that has emerged for measuring at real
scale.&lt;/li>
&lt;/ul>
&lt;p>The size of the bias is enormous: at 1,000 QPS, a single-process benchmark processed
75,574 tokens against the 545,733 tokens of a distributed architecture, a
discrepancy of 7.2× in measurement capacity for the same system ([search]). Anyone
comparing two engines with tools from different classes is not comparing the engines: they
are comparing the benchmark clients.&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1rem auto;">
&lt;svg viewBox="0 0 780 210" role="img" aria-label="Two classes of benchmark tool: a single-process client that saturates at high concurrency versus a multi-process load generator that measures the engine" xmlns="http://www.w3.org/2000/svg">
&lt;style>.bx{fill:none;stroke:currentColor;stroke-width:1.3}.dsh{fill:none;stroke:currentColor;stroke-width:1.3;stroke-dasharray:5 3}.tl{font:600 12px sans-serif;fill:currentColor}.ts{font:11px sans-serif;fill:currentColor}.ar{fill:none;stroke:currentColor;stroke-width:1.3;marker-end:url(#bm)}&lt;/style>
&lt;defs>&lt;marker id="bm" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="currentColor"/>&lt;/marker>&lt;/defs>
&lt;text x="20" y="26" class="tl">Single-process (vLLM bench, SGLang bench, genai-perf)&lt;/text>
&lt;rect class="bx" x="20" y="36" width="150" height="40" rx="6"/>
&lt;text x="32" y="62" class="ts">1 asyncio client&lt;/text>
&lt;path class="ar" d="M170,58 L215,58"/>
&lt;rect class="dsh" x="215" y="36" width="120" height="40" rx="6"/>
&lt;text x="227" y="56" class="ts">client bottleneck&lt;/text>
&lt;text x="227" y="71" class="ts">bias at high conc.&lt;/text>
&lt;path class="ar" d="M335,58 L380,58"/>
&lt;rect class="bx" x="380" y="36" width="110" height="40" rx="6"/>
&lt;text x="392" y="62" class="ts">engine (vLLM…)&lt;/text>
&lt;text x="510" y="52" class="ts">you measure the client,&lt;/text>
&lt;text x="510" y="68" class="ts">not the engine&lt;/text>
&lt;text x="20" y="118" class="tl">Multi-process (GuideLLM, AIPerf)&lt;/text>
&lt;rect class="bx" x="20" y="128" width="150" height="46" rx="6"/>
&lt;text x="32" y="148" class="ts">N load processes&lt;/text>
&lt;text x="32" y="164" class="ts">(real load)&lt;/text>
&lt;path class="ar" d="M170,151 L380,151"/>
&lt;rect class="bx" x="380" y="131" width="110" height="40" rx="6"/>
&lt;text x="392" y="155" class="ts">engine (vLLM…)&lt;/text>
&lt;text x="510" y="145" class="ts">you measure the engine;&lt;/text>
&lt;text x="510" y="161" class="ts">7.2× more capacity&lt;/text>
&lt;/svg>
&lt;/div>
&lt;hr>
&lt;h2 id="frameworks-one-by-one">Frameworks, one by one&lt;/h2>
&lt;h3 id="vllm-bench-and-sglang-bench--engine-micro-bench">vLLM bench and SGLang bench — engine micro-bench&lt;/h3>
&lt;p>What they measure: TTFT, TPOT and throughput of the engine itself (vLLM or SGLang). Class:
single-process micro-bench. Use: quick experiments to tune one engine and see the effect of
its optimisations (see &lt;a href="https://blog.lo0.es/en/posts/optimising-decode-vllm-squeezing-every-token-small-hardware/">decode&lt;/a> and
&lt;a href="https://blog.lo0.es/en/posts/optimising-prefill-vllm-knobs-ttft-will-not-forgive/">prefill&lt;/a>). Limit: they saturate on the client at
high concurrency; they are no good for measuring real capacity at scale.&lt;/p>
&lt;h3 id="aiperf--the-nvidia-one-formerly-genai-perf-multi-process">AIPerf — the NVIDIA one (formerly genai-perf), multi-process&lt;/h3>
&lt;p>What it measures: TTFT, ITL, throughput and latency against &lt;strong>vLLM, NIM, TGI and any
compatible endpoint&lt;/strong>. Class: multi-process load. State-of-the-art datum: NVIDIA &lt;strong>retired
genai-perf and replaced it with AIPerf on 15 April 2026&lt;/strong>. During the &lt;em>sweep&lt;/em>, AIPerf
detects GPU saturation and identifies the previous iteration, returning it as
&lt;code>estimatedCapacity&lt;/code>; if it detects no saturation, &lt;code>estimatedCapacity&lt;/code> is the last iteration
tested, which is why the sweep has to extend beyond the knee
(&lt;a href="https://lucaberton.com/blog/nvidia-aiperf-llm-inference-benchmarking-guide/">AIPerf&lt;/a>).&lt;/p>
&lt;h3 id="guidellm--from-the-vllm-project-slo-oriented">GuideLLM — from the vLLM project, SLO-oriented&lt;/h3>
&lt;p>What it measures: full distributions of TTFT, ITL and end-to-end behaviour, for
SLO-driven evaluation. Class: multi-process load. Differentiator: it generates realistic,
configurable traffic patterns in synchronous, concurrent and rate-based modes, including
reproducible sweeps to identify safe operating ranges
(&lt;a href="https://developers.redhat.com/articles/2025/06/20/guidellm-evaluate-llm-deployments-real-world-inference">Red Hat · GuideLLM&lt;/a>,
&lt;a href="https://github.com/vllm-project/guidellm">GuideLLM · GitHub&lt;/a>). It is the tool for answering
&amp;ldquo;how hard can I load this engine without breaking the SLO?&amp;rdquo;.&lt;/p>
&lt;h3 id="llmperf--the-anyscaleray-classic">LLMPerf — the Anyscale/Ray classic&lt;/h3>
&lt;p>What it measures: throughput and latency at the inference level. Use: endpoint validation,
historically very widespread. Class: load generator. Limit: less focused on distributions and
sweeps than GuideLLM/AIPerf.&lt;/p>
&lt;h3 id="mlperf-inference--the-industry-standard">MLPerf Inference — the industry standard&lt;/h3>
&lt;p>What it measures: performance under standardised scenarios with strict rules, for
comparability across vendors. Maintainer: &lt;strong>MLCommons&lt;/strong>. It is the gold standard of
cross-vendor comparability; it is expanded on below.&lt;/p>
&lt;h3 id="comparison-table">Comparison table&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Tool&lt;/th>
&lt;th>Class&lt;/th>
&lt;th>What it measures&lt;/th>
&lt;th>Maintainer&lt;/th>
&lt;th>When to use it&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>vLLM bench&lt;/strong>&lt;/td>
&lt;td>single-process micro&lt;/td>
&lt;td>TTFT, TPOT, throughput of vLLM&lt;/td>
&lt;td>vLLM (OSS)&lt;/td>
&lt;td>tune vLLM, quick experiments&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>SGLang bench&lt;/strong>&lt;/td>
&lt;td>single-process micro&lt;/td>
&lt;td>metrics of the SGLang engine&lt;/td>
&lt;td>SGLang (OSS)&lt;/td>
&lt;td>tune SGLang&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>AIPerf&lt;/strong> (formerly genai-perf)&lt;/td>
&lt;td>multi-process load&lt;/td>
&lt;td>TTFT, ITL, throughput; estimatedCapacity&lt;/td>
&lt;td>NVIDIA (OSS)&lt;/td>
&lt;td>real capacity, multi-endpoint&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>GuideLLM&lt;/strong>&lt;/td>
&lt;td>multi-process load&lt;/td>
&lt;td>distributions, SLO, sweeps&lt;/td>
&lt;td>vLLM (OSS)&lt;/td>
&lt;td>validate SLO, find the knee&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>LLMPerf&lt;/strong>&lt;/td>
&lt;td>load&lt;/td>
&lt;td>throughput and latency&lt;/td>
&lt;td>Anyscale/Ray (OSS)&lt;/td>
&lt;td>endpoint validation&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>MLPerf Inference&lt;/strong>&lt;/td>
&lt;td>standard suite&lt;/td>
&lt;td>server/offline/interactive scenarios&lt;/td>
&lt;td>MLCommons&lt;/td>
&lt;td>cross-vendor comparability&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;hr>
&lt;h2 id="the-concurrency-sweep-finding-the-knee">The concurrency sweep: finding the knee&lt;/h2>
&lt;p>The most useful measurement for sizing is not a number, it is a curve: how latency and
throughput change as concurrency rises. Raising concurrency keeps the GPU busier and raises
RPS, but past a certain point it sends TTFT, ITL and end-to-end latency through the roof
([search]). The goal of the &lt;em>sweep&lt;/em> is to find the &lt;strong>knee&lt;/strong>: the maximum concurrency where
throughput still rises without latency breaking the SLO.&lt;/p>
&lt;div class="diagram" style="max-width:780px;margin:1rem auto;">
&lt;svg viewBox="0 0 780 260" role="img" aria-label="Concurrency sweep curve: throughput rises and saturates while latency spikes beyond the knee, which marks the safe capacity under SLO" xmlns="http://www.w3.org/2000/svg">
&lt;style>.ax{fill:none;stroke:currentColor;stroke-width:1}.cv{fill:none;stroke:currentColor;stroke-width:1.6}.dsh{fill:none;stroke:currentColor;stroke-width:1;stroke-dasharray:4 3}.tl{font:600 12px sans-serif;fill:currentColor}.ts{font:11px sans-serif;fill:currentColor}&lt;/style>
&lt;line class="ax" x1="60" y1="40" x2="60" y2="200"/>
&lt;line class="ax" x1="60" y1="200" x2="720" y2="200"/>
&lt;text x="20" y="120" class="ts" transform="rotate(-90 20 120)">metric&lt;/text>
&lt;text x="360" y="228" class="ts">concurrency →&lt;/text>
&lt;path class="cv" d="M60,190 C200,150 300,120 400,112 C520,104 620,100 700,98"/>
&lt;text x="600" y="92" class="ts">throughput (saturates)&lt;/text>
&lt;path class="cv" d="M60,180 C260,176 360,170 430,150 C520,120 600,70 700,46"/>
&lt;text x="600" y="40" class="ts">latency (spikes)&lt;/text>
&lt;line class="dsh" x1="430" y1="40" x2="430" y2="200"/>
&lt;text x="392" y="56" class="tl">knee&lt;/text>
&lt;text x="362" y="216" class="ts">safe capacity under SLO&lt;/text>
&lt;text x="60" y="250" class="ts">Before the knee, raising concurrency gives more throughput for free. After it, latency breaks the SLO with barely any gain.&lt;/text>
&lt;/svg>
&lt;/div>
&lt;p>That is why AIPerf extends the sweep beyond the knee: only by seeing where latency takes
off can it return the safe capacity (&lt;code>estimatedCapacity&lt;/code>). This curve is the raw material of
&lt;a href="https://blog.lo0.es/en/posts/capacity-planning-on-premise-llm-inference/">capacity planning&lt;/a>: the knee
yields the replica count and the cost per token at the target load.&lt;/p>
&lt;hr>
&lt;h3 id="worked-example-reading-a-sweep">Worked example: reading a sweep&lt;/h3>
&lt;p>An illustrative sweep on an example node (a 70B on 8×H100, SLO of P99 TTFT &amp;lt; 500 ms), to
see how the knee is read:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Concurrency&lt;/th>
&lt;th>RPS&lt;/th>
&lt;th>TTFT P50 (ms)&lt;/th>
&lt;th>TTFT P99 (ms)&lt;/th>
&lt;th>Token tput (tok/s)&lt;/th>
&lt;th>Goodput&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>1&lt;/td>
&lt;td>2&lt;/td>
&lt;td>80&lt;/td>
&lt;td>110&lt;/td>
&lt;td>350&lt;/td>
&lt;td>100 %&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>8&lt;/td>
&lt;td>14&lt;/td>
&lt;td>110&lt;/td>
&lt;td>240&lt;/td>
&lt;td>2,100&lt;/td>
&lt;td>100 %&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>16&lt;/td>
&lt;td>22&lt;/td>
&lt;td>180&lt;/td>
&lt;td>460&lt;/td>
&lt;td>3,400&lt;/td>
&lt;td>98 %&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>24&lt;/td>
&lt;td>26&lt;/td>
&lt;td>320&lt;/td>
&lt;td>980&lt;/td>
&lt;td>3,900&lt;/td>
&lt;td>62 %&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>32&lt;/td>
&lt;td>27&lt;/td>
&lt;td>540&lt;/td>
&lt;td>1,800&lt;/td>
&lt;td>4,000&lt;/td>
&lt;td>20 %&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Reading: up to concurrency ~16 throughput grows and P99 stays under the SLO (goodput
~100 %). Between 16 and 24 sits the &lt;strong>knee&lt;/strong>: throughput barely rises any more (3,400 →
3,900 tok/s) but P99 takes off (460 → 980 ms) and goodput collapses (98 % → 62 %). At
concurrency 32 raw throughput is at its maximum (4,000 tok/s) but goodput is 20 %: the
system &amp;ldquo;performs well&amp;rdquo; while serving mostly requests that violate the SLO. The defensible
safe capacity is the one at concurrency ~16, not the one at maximum throughput. This is the
number that goes into &lt;a href="https://blog.lo0.es/en/posts/capacity-planning-on-premise-llm-inference/">capacity planning&lt;/a>
and into cost per token: at 3,400 useful tok/s, not 4,000 raw tok/s.&lt;/p>
&lt;hr>
&lt;h2 id="mlperf-inference-the-comparability-standard">MLPerf Inference: the comparability standard&lt;/h2>
&lt;p>To compare across vendors and engines with identical rules there is MLPerf Inference
(MLCommons). The datacenter category focuses on two scenarios plus an optional one
(&lt;a href="https://mlcommons.org/benchmarks/inference-datacenter/">MLCommons · datacenter&lt;/a>):&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Scenario&lt;/th>
&lt;th>What it simulates&lt;/th>
&lt;th>Metric&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Offline&lt;/strong>&lt;/td>
&lt;td>raw throughput processing the whole dataset in batch&lt;/td>
&lt;td>maximum throughput&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Server&lt;/strong>&lt;/td>
&lt;td>interactive environment: requests one at a time following Poisson at a mean RPS&lt;/td>
&lt;td>RPS under TTFT and TPOT limits&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Interactive&lt;/strong> (optional)&lt;/td>
&lt;td>like server but with &lt;strong>stricter latency limits&lt;/strong>&lt;/td>
&lt;td>RPS under a hard SLO&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The Server scenario is the realistic one for online inference: the load generator sends
requests following a Poisson distribution and demands that specific TTFT and TPOT bounds
be met. &lt;strong>MLPerf Inference v5.0&lt;/strong> (April 2025) introduced a large-scale 405B benchmark
and a low-latency interactive 70B one, offering language benchmarks at every scale (7B to
405B), architectural diversity (including MoE) and scenarios
(&lt;a href="https://mlcommons.org/2025/04/llm-inference-v5/">MLCommons · v5.0&lt;/a>); &lt;strong>v5.1&lt;/strong> (September
2025) widened the results with record participation
(&lt;a href="https://mlcommons.org/2025/09/mlperf-inference-v5-1-results/">MLCommons · v5.1&lt;/a>).&lt;/p>
&lt;p>The value of MLPerf is comparability: everyone measures the same thing under the same
rules. Its limit is that those rules may not match your workload (your length distribution,
your specific SLO), so it serves to compare hardware and engines against each other, not
necessarily to size your case. For that, your own sweep.&lt;/p>
&lt;hr>
&lt;h2 id="measurement-bias-and-reproducibility">Measurement bias and reproducibility&lt;/h2>
&lt;p>That two benchmarks give very different results for the same system is no accident:
systematic measurement bias in production benchmarks is characterised in the literature
(&lt;a href="https://arxiv.org/html/2605.24217">arXiv 2605.24217&lt;/a>), and there is work dedicated to the
meta-metrics and good practices of system-level performance benchmarking
(&lt;a href="https://arxiv.org/pdf/2508.10251">arXiv 2508.10251&lt;/a>). The most common sources of bias:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Source of bias&lt;/th>
&lt;th>Effect&lt;/th>
&lt;th>Mitigation&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Single-process client&lt;/td>
&lt;td>underestimates throughput at high concurrency&lt;/td>
&lt;td>use multi-process load&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Unrealistic length distribution&lt;/td>
&lt;td>results that do not apply to your traffic&lt;/td>
&lt;td>use realistic traces&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Measuring the mean instead of percentiles&lt;/td>
&lt;td>hides the latency tail&lt;/td>
&lt;td>report P95/P99&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Uncontrolled warm-up&lt;/td>
&lt;td>the prefix cache inflates the first results&lt;/td>
&lt;td>discard the warm-up&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Not pinning engine/model version&lt;/td>
&lt;td>irreproducible&lt;/td>
&lt;td>pin everything and publish it&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The methodological conclusion of this article: &lt;strong>a benchmark without a published methodology
is not comparable&lt;/strong>. For a performance figure to support a proposal it has to come with the
tool, its version, the model and precision, the load distribution and the SLO. Synthesis
article S4 builds a reproducible harness that pins all of that.&lt;/p>
&lt;hr>
&lt;h2 id="checklist-for-a-reproducible-benchmark">Checklist for a reproducible benchmark&lt;/h2>
&lt;p>For a performance figure to be defensible before a committee, it has to come with everything
that allows it to be reproduced. The minimum published alongside the result:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>What to pin&lt;/th>
&lt;th>Why&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Tool + version&lt;/td>
&lt;td>each one measures differently; the version changes behaviour&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Model + precision (FP16/FP8/INT4)&lt;/td>
&lt;td>precision changes throughput and quality&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Hardware (GPU, count, interconnect)&lt;/td>
&lt;td>an 8×H100 NVLink is not an 8×H100 PCIe&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Engine + version + flags&lt;/td>
&lt;td>vLLM/SGLang/TRT-LLM and their configuration&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Length distribution (in/out)&lt;/td>
&lt;td>real traffic is not fixed length&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Concurrency levels of the sweep&lt;/td>
&lt;td>you have to go past the knee&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>SLO (which percentile, which threshold)&lt;/td>
&lt;td>it defines the goodput&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Warm-up handling&lt;/td>
&lt;td>discard it or it biases the result&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Tokenizer used for counting&lt;/td>
&lt;td>it affects tok/s and cost per token&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The practical rule: if you cannot hand over this table alongside the figure, the figure is
not a datum, it is an anecdote. The reproducible harness of article S4 automates the recording
of all these parameters so that anyone, including whoever challenges the proposal, can
reproduce the exact number.&lt;/p>
&lt;hr>
&lt;h2 id="performance--quality">Performance ≠ quality&lt;/h2>
&lt;p>One warning that avoids the most expensive mistake: these tools measure &lt;strong>speed and
throughput, not accuracy&lt;/strong>. An engine can be blisteringly fast while serving a model that
answers badly. Quality is measured with another family of tools
(&lt;strong>lm-evaluation-harness&lt;/strong>, &lt;strong>HELM&lt;/strong>, task &lt;em>leaderboards&lt;/em>) which is another axis of the
scorecard (article B7). Confusing &amp;ldquo;fast&amp;rdquo; with &amp;ldquo;good&amp;rdquo; is how you build a platform that serves
bad answers very quickly. On the final Pareto frontier, performance and quality are two
distinct axes that must be looked at together, never one instead of the other.&lt;/p>
&lt;p>The other family of tools, for reference (expanded in B7):&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Tool&lt;/th>
&lt;th>What it measures&lt;/th>
&lt;th>Common trap&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>lm-evaluation-harness&lt;/strong>&lt;/td>
&lt;td>accuracy on hundreds of standardised tasks&lt;/td>
&lt;td>contamination of the test dataset&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>HELM&lt;/strong>&lt;/td>
&lt;td>holistic evaluation (accuracy, robustness, bias, efficiency)&lt;/td>
&lt;td>heavy to run&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>LiveBench / dynamic leaderboards&lt;/strong>&lt;/td>
&lt;td>tasks that rotate to avoid contamination&lt;/td>
&lt;td>comparability over time&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The data point: contamination, the model having seen the test during training, inflates
quality metrics just as warm-up inflates performance ones. That is why dynamic leaderboards
rotate their questions. Quality and performance share that lesson: the measurement method
biases the result as much as the system being measured.&lt;/p>
&lt;hr>
&lt;h2 id="the-latency-versus-throughput-trade-off">The latency versus throughput trade-off&lt;/h2>
&lt;p>A property the sweep reveals and which is worth keeping in mind: &lt;strong>latency and throughput
pull in opposite directions&lt;/strong>. Batching groups requests to amortise the cost of moving the
weights out of VRAM, which raises throughput, but each request waits for the batch to form,
which raises individual latency. There are two operating regimes, and the benchmark
serves to place you in the right one:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Regime&lt;/th>
&lt;th>Optimises&lt;/th>
&lt;th>Configuration&lt;/th>
&lt;th>Case&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Latency&lt;/strong>&lt;/td>
&lt;td>low TTFT/TPOT&lt;/td>
&lt;td>small batch, low concurrency&lt;/td>
&lt;td>interactive chat, copilots&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Throughput&lt;/strong>&lt;/td>
&lt;td>maximum tok/s&lt;/td>
&lt;td>large batch, high concurrency&lt;/td>
&lt;td>overnight batch, ingestion&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>There is no single &amp;ldquo;best&amp;rdquo; point: there is the best point for your SLO. A benchmark that
reports only maximum throughput is describing the throughput regime and ignoring whether that
point meets the latency your case needs. That is why &lt;strong>goodput&lt;/strong>, throughput under the SLO,
is the metric that reconciles the two regimes: it measures how much throughput you get
without stepping outside acceptable latency. The sweep traverses the curve between both
regimes; your SLO marks where on that curve your system sits.&lt;/p>
&lt;hr>
&lt;h2 id="the-connection-with-cost-and-energy">The connection with cost and energy&lt;/h2>
&lt;p>Performance is not an isolated axis: by the identity of the &lt;a href="https://blog.lo0.es/en/posts/cost-performance-energy-three-axes-llm-inference/">opening article&lt;/a>,
throughput is the denominator of cost per token and of energy per token. A sweep that finds a
knee at 4,000 tok/s rather than 2,800 is not just &amp;ldquo;faster&amp;rdquo;: it lowers the CPM from ~1.09 to
~0.76 €/1M tok and the energy per token in the same proportion, on the same iron. That is
why performance benchmarking is the tool that, indirectly, moves cost the most: every goodput
improvement translates into euros and into watts per token. The number that connects the
three axes is &lt;strong>goodput&lt;/strong>, the throughput that meets the SLO, not catalogue throughput.&lt;/p>
&lt;hr>
&lt;h2 id="state-of-the-art-2026">State of the art 2026&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>genai-perf → AIPerf migration&lt;/strong> (15 Apr 2026): NVIDIA consolidates its benchmarking into
a multi-process tool with saturation detection.&lt;/li>
&lt;li>&lt;strong>GuideLLM&lt;/strong> as the OSS standard for SLO-driven evaluation with reproducible sweeps.&lt;/li>
&lt;li>&lt;strong>MLPerf Inference v5.0/v5.1&lt;/strong> extends to 405B, interactive 70B and MoE, with record
participation: cross-vendor comparability is maturing.&lt;/li>
&lt;li>&lt;strong>Measurement bias characterised&lt;/strong>: the community accepts that the measurement method
matters as much as the system measured; the emphasis on reproducibility and meta-metrics is
growing.&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="limits-and-traps-data-driven">Limits and traps (data-driven)&lt;/h2>
&lt;ol>
&lt;li>&lt;strong>Comparing tools from different classes.&lt;/strong> A single-process micro-bench and a
multi-process load generator are not comparable; the difference can be 7×. Pin the class.&lt;/li>
&lt;li>&lt;strong>Catalogue throughput instead of goodput.&lt;/strong> The honest number is the one that meets the
SLO.&lt;/li>
&lt;li>&lt;strong>Means instead of percentiles.&lt;/strong> The mean hides the tail; report P95/P99.&lt;/li>
&lt;li>&lt;strong>Not extending the sweep beyond the knee.&lt;/strong> Without seeing where latency takes off you do
not know the safe capacity.&lt;/li>
&lt;li>&lt;strong>Confusing performance with quality.&lt;/strong> They are distinct axes; fast is not good.&lt;/li>
&lt;li>&lt;strong>Not pinning versions.&lt;/strong> Engine, model, precision and load left unpinned = irreproducible
= not defensible.&lt;/li>
&lt;/ol>
&lt;p>The next article in the track (B2) goes into the tool catalogue in depth; this one pins the
metrics and the methodology. With performance measured reproducibly, the scorecard can cross
it with cost (in €) and energy for the final decision.&lt;/p>
&lt;h2 id="closing">Closing&lt;/h2>
&lt;p>Performance benchmarking looks like the most &amp;ldquo;objective&amp;rdquo; of the three axes (they are tokens
per second, after all) and it is exactly where the most manipulation happens, almost always
without bad intent: a single-process tool here, a mean instead of a P99 there, a catalogue
throughput instead of the goodput. The difference between a marketing number and a defensible
datum lies not in the engine measured but in the &lt;strong>methodology&lt;/strong>: the class of tool, where
the clock is measured, with which tokenizer, how far the sweep goes and which SLO defines the
goodput. For a sovereign architecture proposal, performance only counts if it is delivered
with that reproducibility record, and, crossed with cost in euros and energy per token, it
becomes the column of the Pareto frontier that decides which engine and which configuration
hold up the platform. The number you defend is not the highest one: it is the &lt;strong>reproducible
goodput&lt;/strong>.&lt;/p>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/llm-serving-engines-pareto-frontier-comparison/">LLM serving engines compared (vLLM/SGLang/TRT-LLM/Dynamo)&lt;/a> — choosing the engine after measuring goodput: from the methodology of this article to the Pareto frontier.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/mlperf-inference-reading-loadgen-comparability/">MLPerf Inference: how to read it and what comparability it offers&lt;/a> — the industry standard: the four scenarios, the TTFT/TPOT SLOs of the Server scenario and the rules for comparing results.&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/measurement-bias-reproducibility-llm-benchmarks/">Measurement bias and reproducibility&lt;/a> — sources of systematic bias in performance benchmarks and how to control them to obtain defensible data.&lt;/li>
&lt;/ul>
&lt;h2 id="sources">Sources&lt;/h2>
&lt;ul>
&lt;li>Anyscale · métricas de latencia y throughput de LLM — &lt;a href="https://docs.anyscale.com/llm/serving/benchmarking/metrics">https://docs.anyscale.com/llm/serving/benchmarking/metrics&lt;/a>&lt;/li>
&lt;li>Red Hat · GuideLLM: evaluar despliegues LLM para inferencia real — &lt;a href="https://developers.redhat.com/articles/2025/06/20/guidellm-evaluate-llm-deployments-real-world-inference">https://developers.redhat.com/articles/2025/06/20/guidellm-evaluate-llm-deployments-real-world-inference&lt;/a>&lt;/li>
&lt;li>GuideLLM · GitHub (proyecto vLLM) — &lt;a href="https://github.com/vllm-project/guidellm">https://github.com/vllm-project/guidellm&lt;/a>&lt;/li>
&lt;li>NVIDIA AIPerf · guía de benchmarking (ex genai-perf) — &lt;a href="https://lucaberton.com/blog/nvidia-aiperf-llm-inference-benchmarking-guide/">https://lucaberton.com/blog/nvidia-aiperf-llm-inference-benchmarking-guide/&lt;/a>&lt;/li>
&lt;li>MLCommons · MLPerf Inference datacenter (escenarios) — &lt;a href="https://mlcommons.org/benchmarks/inference-datacenter/">https://mlcommons.org/benchmarks/inference-datacenter/&lt;/a>&lt;/li>
&lt;li>MLCommons · MLPerf Inference v5.0 (405B + 70B interactivo) — &lt;a href="https://mlcommons.org/2025/04/llm-inference-v5/">https://mlcommons.org/2025/04/llm-inference-v5/&lt;/a>&lt;/li>
&lt;li>MLCommons · MLPerf Inference v5.1 — &lt;a href="https://mlcommons.org/2025/09/mlperf-inference-v5-1-results/">https://mlcommons.org/2025/09/mlperf-inference-v5-1-results/&lt;/a>&lt;/li>
&lt;li>arXiv 2605.24217 · sesgo sistemático de medición en benchmarks de inferencia LLM — &lt;a href="https://arxiv.org/html/2605.24217">https://arxiv.org/html/2605.24217&lt;/a>&lt;/li>
&lt;li>arXiv 2508.10251 · meta-métricas y buenas prácticas de benchmarking de rendimiento — &lt;a href="https://arxiv.org/pdf/2508.10251">https://arxiv.org/pdf/2508.10251&lt;/a>&lt;/li>
&lt;li>Medium · LLM Inference Benchmarking (genAI-perf y vLLM) — &lt;a href="https://kchandan.medium.com/llm-inference-benchmarking-genai-perf-and-vllm-5dd06b57428e">https://kchandan.medium.com/llm-inference-benchmarking-genai-perf-and-vllm-5dd06b57428e&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Prefix cache: hit rate engineering to go from 15% to 75%</title><link>https://blog.lo0.es/en/posts/prefix-cache-hit-rate-engineering/</link><pubDate>Fri, 05 Jun 2026 04:00:00 +0000</pubDate><guid>https://blog.lo0.es/en/posts/prefix-cache-hit-rate-engineering/</guid><description>&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>vLLM&amp;rsquo;s prefix cache stores the KV cache blocks of shared prefixes and reuses them in later requests. A hit avoids recomputing that prefix: TTFT drops to the cost of the variable suffix only. In enterprise workloads with fixed system prompts (RAG, domain chatbots, assistants with long instructions) the hit rate should be &amp;gt;70%. In practice it is 10-20% for entirely avoidable reasons. This article identifies them, fixes them, and gives the OTel queries to confirm the result.&lt;/p>
&lt;hr>
&lt;h2 id="the-analogy">The analogy&lt;/h2>
&lt;p>A simultaneous conference interpreter who has to translate the speeches of twenty speakers. All of them open with the same two-page protocol preamble: the conference declaration, the rules of conduct, the day&amp;rsquo;s programme. An interpreter with no memory rereads the two pages for each speaker before starting on their specific speech. An interpreter with good notes reads them once, files them, and when the second speaker starts goes straight to the speech.&lt;/p>
&lt;p>The prefix cache is that file. The prefix hash is the reference that lets you skip to the new part. But if the preamble changes by even one word, because someone drops in the day&amp;rsquo;s date, the interpreter has to reread everything from the beginning.&lt;/p>
&lt;hr>
&lt;h2 id="how-the-prefix-cache-hash-works">How the prefix cache hash works&lt;/h2>
&lt;p>vLLM splits the KV cache into blocks of 16 tokens. Each block has a hash computed over its exact content. When a new request arrives, vLLM checks whether any initial block of the prompt is already in cache by comparing hashes.&lt;/p>
&lt;p>The hash is computed over &lt;strong>the byte-by-byte content of the tokens&lt;/strong>. Any difference, a space, a different character, one extra token, produces a completely different hash. There is no partial matching inside a block.&lt;/p>
&lt;p>Direct consequence: if your system prompt has 512 tokens and token number 3 changes between requests (because you interpolate a date, an ID, a version number), &lt;strong>no block hits&lt;/strong> even though 99% of the text is identical.&lt;/p>
&lt;pre tabindex="0">&lt;code>Block 0 (tokens 0-15): hash = a3f7... ← in cache?
Block 1 (tokens 16-31): hash = 9d2c... ← in cache?
...
Block 31 (tokens 496-511): hash = 7e1a... ← in cache?
&lt;/code>&lt;/pre>&lt;p>If block 0 does not hit (because its content changed), blocks 1-31 are not even checked although they are identical. The prefix cache is sequential.&lt;/p>
&lt;hr>
&lt;h2 id="audit-why-your-real-hit-rate-is-low">Audit: why your real hit rate is low&lt;/h2>
&lt;p>Before changing anything, you need to know &lt;em>what&lt;/em> is breaking the hash. The most direct method: pull the last 1000 production prompts and work out what fraction of the prefix varies.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># audit_prefix_cache.py&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">import&lt;/span> &lt;span class="nn">langfuse&lt;/span>&lt;span class="o">,&lt;/span> &lt;span class="nn">hashlib&lt;/span>&lt;span class="o">,&lt;/span> &lt;span class="nn">collections&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">transformers&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">AutoTokenizer&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">client&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">langfuse&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">Langfuse&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">tokenizer&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">AutoTokenizer&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">from_pretrained&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;Qwen/Qwen2.5-14B-Instruct&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">traces&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">client&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">fetch_traces&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">limit&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">1000&lt;/span>&lt;span class="p">)&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">data&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">prompts&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="n">t&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">input&lt;/span> &lt;span class="k">for&lt;/span> &lt;span class="n">t&lt;/span> &lt;span class="ow">in&lt;/span> &lt;span class="n">traces&lt;/span> &lt;span class="k">if&lt;/span> &lt;span class="n">t&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">input&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Tokenise and extract the first 512 tokens (the typical system prompt)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">prefixes&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="p">[]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> &lt;span class="n">prompt&lt;/span> &lt;span class="ow">in&lt;/span> &lt;span class="n">prompts&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">tokens&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tokenizer&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">encode&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">prompt&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">add_special_tokens&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="kc">False&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">prefix_tokens&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="nb">tuple&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">tokens&lt;/span>&lt;span class="p">[:&lt;/span>&lt;span class="mi">512&lt;/span>&lt;span class="p">])&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">prefixes&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">append&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">prefix_tokens&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># How many unique prefixes are there?&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">unique&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="nb">len&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nb">set&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">prefixes&lt;/span>&lt;span class="p">))&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">total&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="nb">len&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">prefixes&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">print&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;Unique prefixes: &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">unique&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">/&lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">total&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2"> (&lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">unique&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">total&lt;/span>&lt;span class="o">*&lt;/span>&lt;span class="mi">100&lt;/span>&lt;span class="si">:&lt;/span>&lt;span class="s2">.1f&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">%)&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">print&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;Theoretical hit rate if they were all equal: &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="mi">1&lt;/span> &lt;span class="o">-&lt;/span> &lt;span class="n">unique&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">total&lt;/span>&lt;span class="p">)&lt;/span>&lt;span class="o">*&lt;/span>&lt;span class="mi">100&lt;/span>&lt;span class="si">:&lt;/span>&lt;span class="s2">.1f&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">%&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Find which token differs between the most common prefix and the rest&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">collections&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">Counter&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">most_common_prefix&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">Counter&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">prefixes&lt;/span>&lt;span class="p">)&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">most_common&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="mi">1&lt;/span>&lt;span class="p">)[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">][&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">divergence_positions&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="p">[]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">for&lt;/span> &lt;span class="n">prefix&lt;/span> &lt;span class="ow">in&lt;/span> &lt;span class="n">prefixes&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">if&lt;/span> &lt;span class="n">prefix&lt;/span> &lt;span class="o">==&lt;/span> &lt;span class="n">most_common_prefix&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">continue&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">for&lt;/span> &lt;span class="n">i&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="p">(&lt;/span>&lt;span class="n">a&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">b&lt;/span>&lt;span class="p">)&lt;/span> &lt;span class="ow">in&lt;/span> &lt;span class="nb">enumerate&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="nb">zip&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">most_common_prefix&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">prefix&lt;/span>&lt;span class="p">)):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">if&lt;/span> &lt;span class="n">a&lt;/span> &lt;span class="o">!=&lt;/span> &lt;span class="n">b&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">divergence_positions&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">append&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">i&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">break&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">if&lt;/span> &lt;span class="n">divergence_positions&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">pos&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">Counter&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">divergence_positions&lt;/span>&lt;span class="p">)&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">most_common&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="mi">1&lt;/span>&lt;span class="p">)[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">][&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">token_text&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">tokenizer&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">decode&lt;/span>&lt;span class="p">([&lt;/span>&lt;span class="n">most_common_prefix&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="n">pos&lt;/span>&lt;span class="p">]])&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nb">print&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="se">\n&lt;/span>&lt;span class="s2">Most frequent divergence at position &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">pos&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">: &amp;#39;&lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">token_text&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">&amp;#39;&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nb">print&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;→ The token at that position varies between requests&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The most common culprits, in order of frequency:&lt;/p>
&lt;p>&lt;strong>1. Timestamps and dates:&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ❌ Breaks the hash on every request&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">system&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;Current date: &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">datetime&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">now&lt;/span>&lt;span class="p">()&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">strftime&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s1">&amp;#39;%Y-%m-&lt;/span>&lt;span class="si">%d&lt;/span>&lt;span class="s1"> %H:%M&amp;#39;&lt;/span>&lt;span class="p">)&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">. You are an assistant...&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ✅ Take the date out of the system prompt&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">system&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;You are an assistant specialising in cloud infrastructure.&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Pass the date as part of the user message if it is needed&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>2. Session and user IDs:&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ❌&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">system&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;User ID: &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">user_id&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">. Preferences: &lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">user_prefs&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">. You are an assistant...&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ✅ Separate the static from the contextual&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">system&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;You are a specialised assistant.&amp;#34;&lt;/span> &lt;span class="c1"># always the same&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Add the user context as the first message of the history&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>3. Interpolated prompt versions:&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ❌&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">system&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;[v&lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">PROMPT_VERSION&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">] You are an assistant...&amp;#34;&lt;/span> &lt;span class="c1"># changes with every deploy&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ✅ Do not version in the text, version in the prompt name in Langfuse&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">system&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;You are an assistant...&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>4. Dynamic few-shots:&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ❌ Examples retrieved at random from a pool&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">examples&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">random&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">sample&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">example_pool&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">k&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="mi">3&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">system&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;Examples:&lt;/span>&lt;span class="se">\n&lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">format_examples&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">examples&lt;/span>&lt;span class="p">)&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="se">\n\n&lt;/span>&lt;span class="s2">You are an assistant...&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ✅ Fixed few-shots always in the same order&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">FIXED_EXAMPLES&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="p">[&lt;/span>&lt;span class="n">example_pool&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">0&lt;/span>&lt;span class="p">],&lt;/span> &lt;span class="n">example_pool&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">1&lt;/span>&lt;span class="p">],&lt;/span> &lt;span class="n">example_pool&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="mi">2&lt;/span>&lt;span class="p">]]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">system&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;Examples:&lt;/span>&lt;span class="se">\n&lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">format_examples&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">FIXED_EXAMPLES&lt;/span>&lt;span class="p">)&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="se">\n\n&lt;/span>&lt;span class="s2">You are an assistant...&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="template-engineering-the-structure-that-maximises-hits">Template engineering: the structure that maximises hits&lt;/h2>
&lt;p>The principle is simple: &lt;strong>everything static goes first, everything dynamic goes after&lt;/strong>. The prefix cache is sequential. Once a block fails to hit, the rest are not looked up either.&lt;/p>
&lt;pre tabindex="0">&lt;code>OPTIMAL STRUCTURE for maximising prefix cache:
┌──────────────────────────────────────────────┐
│ STATIC BLOCK (tokens 0-511) │ ← hit rate ~100%
│ Invariant system prompt │
│ Fixed instructions │
│ Few-shots always in the same order │
├──────────────────────────────────────────────┤
│ SEMI-STATIC BLOCK (tokens 512-1023) │ ← hit rate ~60-80%
│ RAG documents for this session │
│ Conversation history so far │
├──────────────────────────────────────────────┤
│ DYNAMIC BLOCK (tokens 1024+) │ ← hit rate ~0% (expected)
│ Current user message │
│ Context specific to this request │
└──────────────────────────────────────────────┘
&lt;/code>&lt;/pre>&lt;p>For RAG specifically: if the retrieved documents are the same across a set of similar queries (very frequent in RAG over fixed corporate documents), ordering them &lt;strong>always in the same order&lt;/strong> (by ID, by a fixed score, not by a variable score) multiplies the hit rate of the semi-static block.&lt;/p>
&lt;hr>
&lt;h2 id="prefix-aware-routing-the-next-level">Prefix-aware routing: the next level&lt;/h2>
&lt;p>With a single vLLM instance, the prefix cache works automatically. The problem shows up with multiple replicas: the load balancer distributes requests round-robin, and the prefix cached on replica A is no use at all when the request lands on replica B.&lt;/p>
&lt;p>The solution is &lt;strong>prefix-aware routing&lt;/strong>: send requests with the same prefix to the same node.&lt;/p>
&lt;p>&lt;strong>With Ray Serve (native integration):&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ray_serve_prefix_router.py&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">ray&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">serve&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">from&lt;/span> &lt;span class="nn">ray.serve.llm&lt;/span> &lt;span class="kn">import&lt;/span> &lt;span class="n">LLMConfig&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">build_llm_deployment&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nd">@serve.deployment&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">class&lt;/span> &lt;span class="nc">PrefixAwareRouter&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">def&lt;/span> &lt;span class="fm">__init__&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="bp">self&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">replicas&lt;/span>&lt;span class="p">):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="bp">self&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">replicas&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">replicas&lt;/span> &lt;span class="c1"># list of vLLM handles&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">async&lt;/span> &lt;span class="k">def&lt;/span> &lt;span class="fm">__call__&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="bp">self&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">request&lt;/span>&lt;span class="p">):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">body&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="k">await&lt;/span> &lt;span class="n">request&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">json&lt;/span>&lt;span class="p">()&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">messages&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">body&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">get&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s2">&amp;#34;messages&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="p">[])&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="c1"># Compute the hash of the system prompt (static prefix)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">system_content&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="s2">&amp;#34;&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">for&lt;/span> &lt;span class="n">msg&lt;/span> &lt;span class="ow">in&lt;/span> &lt;span class="n">messages&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">if&lt;/span> &lt;span class="n">msg&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;role&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span> &lt;span class="o">==&lt;/span> &lt;span class="s2">&amp;#34;system&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">system_content&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">msg&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;content&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">break&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">prefix_hash&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="nb">hash&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">system_content&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="c1"># Deterministic routing: same hash → same node&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">replica_idx&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">prefix_hash&lt;/span> &lt;span class="o">%&lt;/span> &lt;span class="nb">len&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="bp">self&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">replicas&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">return&lt;/span> &lt;span class="k">await&lt;/span> &lt;span class="bp">self&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">replicas&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="n">replica_idx&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">remote&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">request&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>With an L7 gateway (Nginx/Traefik):&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-nginx" data-lang="nginx">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># nginx.conf — routing by X-Prefix-Hash header
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1">&lt;/span>&lt;span class="k">upstream&lt;/span> &lt;span class="s">vllm_backends&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="kn">hash&lt;/span> &lt;span class="nv">$http_x_prefix_hash&lt;/span> &lt;span class="s">consistent&lt;/span>&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="kn">server&lt;/span> &lt;span class="n">vllm-0&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">8000&lt;/span>&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="kn">server&lt;/span> &lt;span class="n">vllm-1&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">8000&lt;/span>&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="kn">server&lt;/span> &lt;span class="n">vllm-2&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">8000&lt;/span>&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="kn">server&lt;/span> &lt;span class="n">vllm-3&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">8000&lt;/span>&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The client computes the hash of the static prefix and includes it as a header:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-python" data-lang="python">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">import&lt;/span> &lt;span class="nn">hashlib&lt;/span>&lt;span class="o">,&lt;/span> &lt;span class="nn">requests&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">def&lt;/span> &lt;span class="nf">llm_request&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">messages&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">base_url&lt;/span>&lt;span class="p">):&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">system_msg&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="nb">next&lt;/span>&lt;span class="p">((&lt;/span>&lt;span class="n">m&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;content&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span> &lt;span class="k">for&lt;/span> &lt;span class="n">m&lt;/span> &lt;span class="ow">in&lt;/span> &lt;span class="n">messages&lt;/span> &lt;span class="k">if&lt;/span> &lt;span class="n">m&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s2">&amp;#34;role&amp;#34;&lt;/span>&lt;span class="p">]&lt;/span> &lt;span class="o">==&lt;/span> &lt;span class="s2">&amp;#34;system&amp;#34;&lt;/span>&lt;span class="p">),&lt;/span> &lt;span class="s2">&amp;#34;&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">prefix_hash&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="n">hashlib&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">sha256&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="n">system_msg&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">encode&lt;/span>&lt;span class="p">())&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">hexdigest&lt;/span>&lt;span class="p">()[:&lt;/span>&lt;span class="mi">16&lt;/span>&lt;span class="p">]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="k">return&lt;/span> &lt;span class="n">requests&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="n">post&lt;/span>&lt;span class="p">(&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="sa">f&lt;/span>&lt;span class="s2">&amp;#34;&lt;/span>&lt;span class="si">{&lt;/span>&lt;span class="n">base_url&lt;/span>&lt;span class="si">}&lt;/span>&lt;span class="s2">/v1/chat/completions&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">json&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">{&lt;/span>&lt;span class="s2">&amp;#34;messages&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="n">messages&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="s2">&amp;#34;model&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="s2">&amp;#34;my-model&amp;#34;&lt;/span>&lt;span class="p">},&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="n">headers&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="p">{&lt;/span>&lt;span class="s2">&amp;#34;X-Prefix-Hash&amp;#34;&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="n">prefix_hash&lt;/span>&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;hr>
&lt;h2 id="measuring-the-impact-with-otel">Measuring the impact with OTel&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-promql" data-lang="promql">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Current hit rate (0.0 to 1.0) — target &amp;gt; 0.70 with enterprise workloads&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nv">vllm&lt;/span>&lt;span class="err">:&lt;/span>&lt;span class="nv">gpu_prefix_cache_hit_rate&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="c1"># TTFT by percentile — should fall when the hit rate rises&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="kr">histogram_quantile&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="mf">0.50&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kr">rate&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">vllm&lt;/span>&lt;span class="err">:&lt;/span>&lt;span class="nv">time_to_first_token_seconds_bucket&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s">5m&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="o">))&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="kr">histogram_quantile&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="mf">0.95&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kr">rate&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">vllm&lt;/span>&lt;span class="err">:&lt;/span>&lt;span class="nv">time_to_first_token_seconds_bucket&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s">5m&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="o">))&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The inverse correlation between hit rate and TTFT is the proof that the cache is working. If the hit rate goes from 15% to 70% and the p50 TTFT does not change, there is a configuration problem: the cache may be disabled, or the routing may not be sending requests to the right node.&lt;/p>
&lt;p>&lt;strong>Correlation query in Grafana&lt;/strong> (two-axis panel):&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-promql" data-lang="promql">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Left Y axis: hit rate&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nv">vllm&lt;/span>&lt;span class="err">:&lt;/span>&lt;span class="nv">gpu_prefix_cache_hit_rate&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="c1"># Right Y axis: TTFT p50 (inverted)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="kr">histogram_quantile&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="mf">0.50&lt;/span>&lt;span class="p">,&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kr">rate&lt;/span>&lt;span class="o">(&lt;/span>&lt;span class="nv">vllm&lt;/span>&lt;span class="err">:&lt;/span>&lt;span class="nv">time_to_first_token_seconds_bucket&lt;/span>&lt;span class="p">[&lt;/span>&lt;span class="s">5m&lt;/span>&lt;span class="p">]&lt;/span>&lt;span class="o">))&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The inverse slope should be visible: when the hit rate drops (a spike of requests with new prompts), TTFT rises. When the hit rate stabilises (users repeating the same flow), TTFT falls.&lt;/p>
&lt;hr>
&lt;h2 id="the-impact-in-numbers">The impact in numbers&lt;/h2>
&lt;p>For a system with 100 req/min, a 512-token system prompt and a before/after hit rate:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align:left">Metric&lt;/th>
&lt;th style="text-align:right">Hit rate 15%&lt;/th>
&lt;th style="text-align:right">Hit rate 75%&lt;/th>
&lt;th style="text-align:right">Difference&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align:left">Prefill tokens per minute&lt;/td>
&lt;td style="text-align:right">5,100&lt;/td>
&lt;td style="text-align:right">12,800 — 50% cached → 6,400 effective&lt;/td>
&lt;td style="text-align:right">−37% load&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">TTFT p50 (512 prompt + 100 suffix)&lt;/td>
&lt;td style="text-align:right">~820 ms&lt;/td>
&lt;td style="text-align:right">~180 ms (suffix only)&lt;/td>
&lt;td style="text-align:right">−78%&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align:left">Prefill capacity freed&lt;/td>
&lt;td style="text-align:right">—&lt;/td>
&lt;td style="text-align:right">+1,200 tok/min&lt;/td>
&lt;td style="text-align:right">available for more requests&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>The 75% hit rate in this example is equivalent to being able to serve 37% more requests on the same hardware, because the prefill work of 3 out of every 4 requests is already done.&lt;/p>
&lt;hr>
&lt;h2 id="when-the-prefix-cache-does-not-help">When the prefix cache does not help&lt;/h2>
&lt;p>The prefix cache is ineffective in workloads where every request has a completely unique prompt: translating a different document every time, code analysis with always-different context, creative generation with no system prompt. In these cases the hit rate structurally cannot exceed 5-10% and the template engineering effort does not pay off.&lt;/p>
&lt;p>The signal: if your p99 input length is greater than the p50, you have high prompt variance and the prefix cache contributes little. If the p50 and the p99 are similar (consistent prompts), the prefix cache is the cheapest lever available.&lt;/p>
&lt;hr>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/vllm-attention-backend-flashattention-flashinfer-prefill-decode-asymmetry/">FlashInfer&amp;rsquo;s cascade attention: the &lt;em>compute&lt;/em> side of the shared prefix that the prefix cache solves in &lt;em>memory&lt;/em> — attending the common prefix once instead of R times&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/optimising-prefill-vllm-knobs-ttft-will-not-forgive/">&lt;code>--enable-prefix-caching&lt;/code> and the interaction with chunked prefill: only the first chunk benefits from the cache, which affects the optimal budget for &lt;code>max-num-batched-tokens&lt;/code>&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">the block structure the prefix cache operates on: why the 16-token granularity matters for template design&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/vllm-batch-sizing-two-hour-grid-search/">the grid search that determines the optimal &lt;code>max-num-seqs&lt;/code>, which interacts with the number of blocks available for the cache&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/llm-inference-router-l7-switchboard/">the L7 gateway where prefix-aware routing via header is implemented&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/instrumenting-vllm-otel-measuring-optimisations/">how to configure &lt;code>gpu_prefix_cache_hit_rate&lt;/code> on the Grafana dashboard and the alert for when it falls below the target threshold&lt;/a>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/prefix-routing-what-litellm-does-not-do/">Prefix routing: what LiteLLM does not do&lt;/a> — the real state of KV-aware routers in September 2026, and how much they genuinely improve.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h3 id="in-this-same-series">In this same series&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/vllm-batch-sizing-two-hour-grid-search/">the first optimisation in the series: the grid search of max-num-seqs × max-num-batched-tokens&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/fp8-end-to-end-enable-measure-quality-decide/">FP8 in weights and KV cache: doubling the VRAM available for cache and measuring the quality degradation before going to production&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://blog.lo0.es/en/posts/one-big-replica-or-many-small-ones-platform-decision/">TP=4×1 vs TP=2×2: the per-session routing that complements the prefix-aware routing in this article&lt;/a>&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://docs.vllm.ai/en/stable/design/prefix_caching/">vLLM Automatic Prefix Caching — official documentation&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.ray.io/en/latest/serve/llm/user-guides/prefix-aware-routing.html">Prefix-aware routing — Ray Serve&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://llm-d.ai/blog/kvcache-wins-you-can-see">KV-Cache Wins You Can See — llm-d blog&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://www.digitalocean.com/blog/reduce-llm-inference-costs-prefix-caching">The Inference Tax: Prefix-Aware Routing — DigitalOcean&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://github.com/vllm-project/vllm/issues/24394">vLLM issue #24394: Improve Prefix Cache Hit Rate&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Capacity planning for on-premise LLM inference: how to size GPUs from an SLO</title><link>https://blog.lo0.es/en/posts/capacity-planning-on-premise-llm-inference/</link><pubDate>Mon, 01 Jun 2026 15:00:00 +0200</pubDate><guid>https://blog.lo0.es/en/posts/capacity-planning-on-premise-llm-inference/</guid><description>&lt;blockquote>
&lt;p>This post complements the ones on &lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">KV cache&lt;/a> (the piece that dominates the VRAM budget), &lt;a href="https://blog.lo0.es/en/posts/continuous-batching-orca-vllm-chunked-prefill-goodput/">Continuous batching&lt;/a> (what defines the effective utilisation of the compute) and &lt;a href="https://blog.lo0.es/en/posts/anatomy-on-premise-llm-inference-stack-seven-layers/">Seven layers of the stack&lt;/a> (the pieces the sizing takes for granted). Before reading this one, make sure your team has written down the SLOs it is going to chase; without that input the calculation is not defensible.&lt;/p>
&lt;/blockquote>
&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>LLM inference capacity planning does not answer &amp;ldquo;how many tokens per second does a GPU give&amp;rdquo; — that question has no universal answer, because throughput depends on concurrency, the prefill/decode split, context length, the inference engine and quantisation. The right question has three inputs (&lt;strong>SLO&lt;/strong>: TTFT P95, TPOT P95, sustained RPS), a hardware reference (GPU model, VRAM, HBM bandwidth, effective FLOPs) and a model (parameters, GQA/MHA/MoE architecture, weight format). The calculation resolves into two coupled budgets that cross each other. &lt;strong>VRAM budget&lt;/strong>: from the GPU&amp;rsquo;s total you subtract model weights and activations, what remains is the &lt;strong>KV cache budget&lt;/strong>, and from there you derive the &lt;strong>maximum concurrency&lt;/strong> possible at the average context you expect. &lt;strong>Time budget&lt;/strong>: the engine (vLLM, SGLang, TensorRT-LLM) has a tokens/s ceiling in decode given by HBM bandwidth and another in prefill given by useful FLOPs; from there you derive the &lt;strong>expected TPOT&lt;/strong> and, dividing prefill_tokens by prefill throughput, the &lt;strong>expected TTFT&lt;/strong>. Both budgets must meet the SLO &lt;strong>simultaneously&lt;/strong>: whichever is tighter dictates the sizing. On the Llama 70B BF16 example with tensor parallel 4 on 4×H100 SXM, a single replica saturates at ~28 concurrent requests and delivers ~3,200 tokens/s of aggregate decode with a median TPOT of 35 ms; for 200 sustained RPS at a profile of 800 prompt tokens + 250 of output, you need between 4 and 5 replicas with a 25 % cushion over the observed peak. Quantisation (FP8 → INT4) divides VRAM cost and decode time by between 1.5 and 4×, but it degrades quality measurably — it is not assumed free, it is validated with evals. The five habitual traps: confusing the mean with P95, ignoring the prefill/decode split of the real workload, sizing without head-room for retraining or rollback, forgetting that a GPU at 100 % SM util means nothing if the HBM is saturated, and not documenting the assumptions behind the calculation (a sizing with no written assumptions is a throwaway calculation).&lt;/p>
&lt;h2 id="you-are-here-deploy-with-one-foot-in-observe">You are here: DEPLOY (with one foot in OBSERVE)&lt;/h2>
&lt;div class="diagram" style="max-width:780px;margin:1rem auto;">
&lt;svg viewBox="0 0 780 90" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="you are here: Deploy with one foot in Observe">
&lt;style>.box{stroke:#444;stroke-width:1.4;rx:6}.active{fill:#ffb347;stroke-width:3}.semiactive{fill:#ffe1b3;stroke-width:2}.idle{fill:#f4f4f4}.lbl{font:600 12px sans-serif;fill:#222}.arr{stroke:#666;stroke-width:1.4;fill:none;marker-end:url(#cpm)}.cyc{stroke:#888;stroke-width:1.2;fill:none;stroke-dasharray:4 2;marker-end:url(#cpm)}&lt;/style>
&lt;defs>&lt;marker id="cpm" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto">&lt;path d="M0,0 L10,5 L0,10 z" fill="#666"/>&lt;/marker>&lt;/defs>
&lt;text x="390" y="20" text-anchor="middle" class="lbl">You are here: capacity planning · closes DEPLOY and opens the conversation with OBSERVE&lt;/text>
&lt;rect x="30" y="35" width="110" height="35" class="box idle"/>&lt;text x="85" y="58" text-anchor="middle" class="lbl">1 · Data&lt;/text>
&lt;rect x="155" y="35" width="110" height="35" class="box idle"/>&lt;text x="210" y="58" text-anchor="middle" class="lbl">2 · Tune&lt;/text>
&lt;rect x="280" y="35" width="110" height="35" class="box idle"/>&lt;text x="335" y="58" text-anchor="middle" class="lbl">3 · Eval&lt;/text>
&lt;rect x="405" y="35" width="110" height="35" class="box active"/>&lt;text x="460" y="58" text-anchor="middle" class="lbl">4 · Deploy&lt;/text>
&lt;rect x="530" y="35" width="110" height="35" class="box semiactive"/>&lt;text x="585" y="58" text-anchor="middle" class="lbl">5 · Observe&lt;/text>
&lt;rect x="655" y="35" width="110" height="35" class="box idle"/>&lt;text x="710" y="58" text-anchor="middle" class="lbl">6 · Retrain&lt;/text>
&lt;path class="arr" d="M140,52 L155,52"/>&lt;path class="arr" d="M265,52 L280,52"/>&lt;path class="arr" d="M390,52 L405,52"/>&lt;path class="arr" d="M515,52 L530,52"/>&lt;path class="arr" d="M640,52 L655,52"/>
&lt;path class="cyc" d="M710,72 L710,82 L85,82 L85,72"/>
&lt;/svg>
&lt;/div>
&lt;p>Capacity planning is a piece with dual residency. It lives in &lt;strong>DEPLOY&lt;/strong> because without a valid sizing you do not buy hardware or configure the inference engine. But its &lt;strong>input is real observations&lt;/strong>: the distribution of prompt and output lengths, the prefill/decode mix of the workload, the real P95s already being seen in pre-production. Without that data the calculation is a napkin sketch, defensible only until the first customer arrives who does not fit the assumed average.&lt;/p>
&lt;h2 id="the-analogy-the-hotel-with-variable-sized-rooms">The analogy: the hotel with variable-sized rooms&lt;/h2>
&lt;p>Imagine a hotel where the rooms have no fixed size: each guest pays for the square metres they need, and the building&amp;rsquo;s floor plan reorganises itself dynamically to accommodate whoever arrives. Management wants to maximise occupancy, but it has two real constraints and one quality metric.&lt;/p>
&lt;p>&lt;strong>Constraint 1 — physical space.&lt;/strong> The floor has 1,000 m² in total. If a family comes in needing 200 m², that family occupies that surface and it cannot be handed to the next guest. The largest room limits how many simultaneous guests fit.&lt;/p>
&lt;p>&lt;strong>Constraint 2 — service staff.&lt;/strong> There are 10 receptionists. Each can handle the check-in of one guest every two minutes. When 60 guests arrive within an hour, the last ones wait in a queue; the time from walking into reception to receiving their key depends on how many are ahead of them.&lt;/p>
&lt;p>&lt;strong>Quality metric — a promise about time.&lt;/strong> The brochure says &amp;ldquo;check-in in under 15 minutes&amp;rdquo;. If too many guests arrive at once, that promise breaks even if there is physical space free.&lt;/p>
&lt;p>The physical space is the GPU&amp;rsquo;s VRAM. Each room is a request with its KV cache (larger the longer the conversation). The receptionists are the compute units (Streaming Multiprocessors + Tensor Cores). The check-in is the prefill phase; the nights the guest spends afterwards are the decode steps. The 15-minute promise is the TTFT P95 SLO.&lt;/p>
&lt;p>The hotel&amp;rsquo;s capacity planning is exactly this: given the expected guest profile (how many arrive per hour, how much space they ask for on average, how many minutes of waiting they tolerate), work out how many floors and how many receptionists are needed. It is not done by estimating &amp;ldquo;rooms per hour&amp;rdquo; in the abstract; it is done by crossing the two budgets with the promise about time. The analogy holds up the calculation all the way to the end.&lt;/p>
&lt;h2 id="the-three-slo-inputs">The three SLO inputs&lt;/h2>
&lt;p>Before putting a single number on the sheet, you have to write down the three dimensions of the SLO. Without this, the calculation is aesthetics, not engineering.&lt;/p>
&lt;p>&lt;strong>TTFT P95 (Time-To-First-Token).&lt;/strong> The time from the client sending the request until it receives the first token. It is dominated by the prefill phase (processing the whole prompt in one go) plus the scheduler queue. For conversational chat, a reasonable target sits between 0.5 and 2 seconds P95. For coding assistants with large prompts (5–10 K tokens of context), between 2 and 4 s P95. Below 500 ms you enter UX territory for voice-style conversations, but that demands serious architectural compromises.&lt;/p>
&lt;p>&lt;strong>TPOT P95 (Time-Per-Output-Token).&lt;/strong> The time between consecutive tokens during decode. It dominates the &amp;ldquo;perceived fluency&amp;rdquo; of streaming. Above 80 ms/token the human reader perceives pauses; below 30 ms/token the output flows faster than it can be read. The usual industry target: 40–60 ms P95.&lt;/p>
&lt;p>&lt;strong>Sustained RPS meeting the SLO.&lt;/strong> The throughput the system must support &lt;strong>without violating&lt;/strong> TTFT or TPOT. This is DistServe&amp;rsquo;s key metric, called &lt;strong>goodput&lt;/strong> (see &lt;a href="https://blog.lo0.es/en/posts/continuous-batching-orca-vllm-chunked-prefill-goodput/">Continuous batching&lt;/a>). &amp;ldquo;200 RPS peak&amp;rdquo; is not the same as &amp;ldquo;200 RPS with TTFT P95 ≤ 1.5 s&amp;rdquo;. Without the SLO condition, the RPS number means nothing.&lt;/p>
&lt;p>These three dimensions come with a &lt;strong>workload profile&lt;/strong>: the distribution of prompt and output lengths. Medians are not enough; you need P50, P95, P99. A badly measured profile is the main reason sizings fail.&lt;/p>
&lt;h2 id="the-central-formula-two-budgets-that-cross">The central formula: two budgets that cross&lt;/h2>
&lt;p>The calculation resolves into two independent sums that are then crossed. The smaller of the two rules.&lt;/p>
&lt;h3 id="vram-budget">VRAM budget&lt;/h3>
&lt;p>For a GPU with total VRAM $V$, the space available for KV cache is:&lt;/p>
$$V_{\text{kv}} = V - V_{\text{model}} - V_{\text{activations}} - V_{\text{overhead}}$$
&lt;p>where:&lt;/p>
&lt;ul>
&lt;li>$V_{\text{model}}$ is the size of the weights: for a model of $P$ parameters in a format of $b$ bytes/parameter, $V_{\text{model}} = P \cdot b$. Llama 70B BF16 = $70 \times 10^9 \times 2 = 140$ GB. Under tensor parallel TP=4, each GPU carries $140 / 4 = 35$ GB.&lt;/li>
&lt;li>$V_{\text{activations}}$ are the intermediate buffers of the forward pass. For vLLM with a reasonable batch, between 2 and 6 GB per GPU depending on batch size and maximum length.&lt;/li>
&lt;li>$V_{\text{overhead}}$ is the CUDA context, NCCL buffers, the PagedAttention pool, reserved paged blocks. 2–4 GB typical.&lt;/li>
&lt;/ul>
&lt;p>The KV cache budget per GPU is what is left over. For an H100 SXM 80 GB with Llama 70B TP=4 BF16:&lt;/p>
$$V_{\text{kv}} = 80 - 35 - 4 - 3 = 38 \text{ GB per GPU} = 152 \text{ GB aggregated over TP=4}$$
&lt;p>The KV cache cost per token for a model with $L$ layers, $H_{\text{kv}}$ KV heads (GQA), per-head dimension $d_h$, in a format of $b$ bytes:&lt;/p>
$$\text{kv per token} = 2 \cdot L \cdot H_{\text{kv}} \cdot d_h \cdot b$$
&lt;p>The factor of 2 is because both K and V are stored. For Llama 70B (L=80, $H_{\text{kv}}$=8 with GQA, $d_h$=128, BF16 = 2 bytes):&lt;/p>
$$\text{kv per token} = 2 \cdot 80 \cdot 8 \cdot 128 \cdot 2 = 327,680 \text{ bytes} = 320 \text{ KB/token}$$
&lt;p>And the maximum concurrency at average context $C$:&lt;/p>
$$N_{\text{max}} = \frac{V_{\text{kv}}}{C \cdot \text{kv per token}}$$
&lt;p>With an aggregated $V_{\text{kv}}$ of 152 GB and an average context of 1,500 tokens (800 prompt + 700 generated at the worst moment of the conversation):&lt;/p>
$$N_{\text{max}} = \frac{152 \times 10^9}{1,500 \cdot 320 \times 10^3} \approx 316 \text{ concurrent requests}$$
&lt;p>This is the &lt;strong>physical ceiling&lt;/strong> of concurrency for that replica. It is not what you are going to use; it is what you &lt;strong>cannot exceed&lt;/strong> without OOM. The operational number sits well below it (head-room for spikes).&lt;/p>
&lt;h3 id="time-budget">Time budget&lt;/h3>
&lt;p>Two sub-calculations come in here: decode (memory-bound) and prefill (compute-bound).&lt;/p>
&lt;p>&lt;strong>Decode TPOT.&lt;/strong> For every token generated, the model weights (the ones relevant to that request) have to be walked through and the accumulated KV cache has to be read. The bottleneck is HBM bandwidth. For a GPU with bandwidth $B$ GB/s and a model of $V_{\text{model per gpu}}$ GB of weights:&lt;/p>
$$\text{tpot}_{\text{theoretical}} \approx \frac{V_{\text{model per gpu}}}{B}$$
&lt;p>For an H100 SXM with HBM3 at 3.35 TB/s and Llama 70B TP=4 BF16 (35 GB/GPU):&lt;/p>
$$\text{tpot}_{\text{theoretical}} \approx \frac{35}{3,350} \approx 10.4 \text{ ms/token}$$
&lt;p>This is the &lt;strong>best theoretical case&lt;/strong> with batch=1 and 100 % HBM efficiency. In practice vLLM on H100 with Llama 70B TP=4 reaches 12–18 ms/token at low batch and 30–45 ms/token at high batch (at concurrency 32, tokens compete for the shared HBM). The defensible operational number: &lt;strong>35 ms/token&lt;/strong> at concurrency 24–32.&lt;/p>
&lt;p>&lt;strong>Prefill throughput.&lt;/strong> Prefill processes N prompt tokens in a single forward pass. It is compute-bound: the bottleneck is FLOPs. For an H100 SXM with 989 sustained BF16 TFLOPs and Llama 70B (each forward pass costs roughly $2 \cdot P \cdot N$ FLOPs per sequence of length N):&lt;/p>
$$\text{prefill tps} = \frac{4 \cdot \text{TFLOPs} \cdot \eta}{2 \cdot P} = \frac{4 \cdot 989 \times 10^{12} \cdot 0.5}{2 \cdot 70 \times 10^9} \approx 14,000 \text{ tokens/s}$$
&lt;p>(the factor of 4 is the GPUs in TP, $\eta$ is real efficiency between 0.4 and 0.6 on H100). An 800-token prompt takes this long in prefill:&lt;/p>
$$\text{prefill time} = \frac{800}{14,000} \approx 57 \text{ ms}$$
&lt;p>Adding a typical queue of 100–300 ms at high concurrency, &lt;strong>TTFT P95 ≈ 350–500 ms&lt;/strong> for that profile. Well below the 1.5 s target; there is margin.&lt;/p>
&lt;h3 id="the-crossing">The crossing&lt;/h3>
&lt;p>The real operational concurrency $N_{\text{op}}$ is the minimum of &lt;strong>the VRAM ceiling&lt;/strong>, the concurrency at which &lt;strong>TPOT starts to degrade&lt;/strong> past the SLO, and the concurrency at which &lt;strong>TTFT starts to degrade&lt;/strong> past the SLO (prefill queue). For the example:&lt;/p>
&lt;ul>
&lt;li>VRAM ceiling: 316.&lt;/li>
&lt;li>TPOT degrades to 80 ms (SLO) at around concurrency ~80–100 (measured empirically with a benchmark, not a closed formula).&lt;/li>
&lt;li>TTFT degrades to 1.5 s at around concurrency ~40–60 because of the prefill queue.&lt;/li>
&lt;/ul>
&lt;p>The replica&amp;rsquo;s operational concurrency is ~50. Applying 25 % head-room for spikes and rebalancing, &lt;strong>target concurrency per replica ≈ 35–40&lt;/strong>.&lt;/p>
&lt;h2 id="step-by-step-worksheet-llama-70b-bf16-on-4h100-sxm">Step-by-step worksheet: Llama 70B BF16 on 4×H100 SXM&lt;/h2>
&lt;p>The exercise&amp;rsquo;s input:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>SLO&lt;/strong>: TTFT P95 ≤ 1.5 s; TPOT P95 ≤ 60 ms; &lt;strong>200 sustained RPS&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Workload&lt;/strong>: prompt P50=600, P95=1,200, P99=2,500; output P50=180, P95=500, P99=900. Average prompt 800, output 250.&lt;/li>
&lt;li>&lt;strong>Generic hardware&lt;/strong>: 4×H100 SXM 80 GB with NVLink, vLLM v1 engine, tensor parallel 4, BF16.&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Step 1 — VRAM per GPU.&lt;/strong> Weights 35 GB, activations 4 GB, overhead 3 GB → KV budget 38 GB/GPU = 152 GB aggregated. KV/token for Llama 70B GQA = 320 KB. Ceiling of live tokens in cache: $152 \times 10^9 / 320 \times 10^3 \approx 475,000$ tokens. At the operational average context (800 prompt + 200 already generated = 1,000 live tokens per request), concurrency ceiling $\approx 475$.&lt;/p>
&lt;p>&lt;strong>Step 2 — average duration of a request.&lt;/strong> Prefill 800 tokens / 14,000 tps = 57 ms. Decode 250 tokens × 35 ms/token = 8,750 ms. Total $\approx 8.8$ s per request.&lt;/p>
&lt;p>&lt;strong>Step 3 — replica throughput.&lt;/strong> If the replica sustains operational concurrency 40 and each request lasts 8.8 s, the replica delivers roughly $40 / 8.8 \approx 4.5$ requests/s in steady state.&lt;/p>
&lt;p>&lt;strong>Step 4 — number of replicas.&lt;/strong> For a 200 RPS target: $200 / 4.5 \approx 45$ replicas. That is 45 × 4 = 180 GPUs. Too much: this sizing does not work because the cost per request is high.&lt;/p>
&lt;p>&lt;strong>Step 5 — review the levers.&lt;/strong> Before buying more hardware, there are three levers to explore, in this order:&lt;/p>
&lt;ol>
&lt;li>&lt;strong>Quantisation.&lt;/strong> Dropping to FP8 reduces weights to 17.5 GB/GPU (leaving more VRAM for KV cache → more concurrency), roughly doubles decode tokens/s (HBM saturated by half), and degrades MMLU quality typically by 0.5–1.5 points on models like Llama 70B. Rewriting the calculation in FP8: TPOT drops to ~18 ms, total time per request to 4.7 s, RPS per replica rises to ~8.5, &lt;strong>replicas needed ≈ 24, equivalent to 96 GPUs&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Speculative decoding.&lt;/strong> With a small drafter and 60–70 % acceptance, effective TPOT falls 30–40 %. RPS per replica rises to ~12, &lt;strong>replicas ≈ 17 = 68 GPUs&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Disaggregated serving.&lt;/strong> Separating prefill workers and decode workers lets each be scaled to the real mix of the workload (see &lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">Disaggregated serving&lt;/a>). It usually shaves off another 20–40 % under asymmetric workloads.&lt;/li>
&lt;/ol>
&lt;p>&lt;strong>Step 6 — recommended sizing.&lt;/strong> For the example, with FP8 + speculative decoding and 25 % head-room: &lt;strong>20 vLLM replicas at TP=4 over 80 H100 SXM&lt;/strong>. If the team does not want to depend on aggressive quantisation (pure BF16 for maximum fidelity), the calculation rises to &lt;strong>30 replicas = 120 GPUs&lt;/strong> and forces a renegotiation of the SLO or the budget.&lt;/p>
&lt;p>&lt;strong>Step 7 — write down the assumptions.&lt;/strong> This is the part no valid sizing skips. In the team&amp;rsquo;s repo, next to the calculation:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="c"># sizing/llama70b-prod.yaml&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">fecha&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="ld">2026-06-01&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">slo&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">ttft_p95_ms&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">1500&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">tpot_p95_ms&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">60&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">rps_target&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">200&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">workload&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">prompt_tokens_p50&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">600&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">prompt_tokens_p95&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">1200&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">output_tokens_p50&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">180&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">output_tokens_p95&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">500&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">asunto&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">chat productivo con RAG ligero&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">modelo&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">arquitectura&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">llama-70b-instruct&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">formato_pesos&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">fp8&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">motor&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">vllm-v1&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">hardware&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">gpu&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">H100-SXM-80GB&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">topologia&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">TP=4 con NVLink intra-nodo&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">red_inter_replica&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">25&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">GbE&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">optimizaciones&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">paged_attention&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">chunked_prefill&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">speculative_decoding (drafter llama-1.1b, aceptación esperada 65%)&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">asunciones_criticas&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">utilizacion_hbm_eficiente&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0.55&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">head_room_pico_sobre_p95&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0.25&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="nt">aceptacion_speculative_min&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0.55&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">plan_validacion&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">benchmark vllm bench serve antes de procurement&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">canary 10% durante 7 días post-deploy&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Without this YAML, the calculation is not reproducible a month later.&lt;/p>
&lt;h2 id="moe-case-mixtral-822b-141-b-total-39-b-active">MoE case: Mixtral 8×22B (~141 B total, 39 B active)&lt;/h2>
&lt;p>MoEs change the calculation along one key dimension: the total weights are large but the active weights per token are small. For Mixtral 8×22B with top-2 routing:&lt;/p>
&lt;ul>
&lt;li>Weight VRAM: $141 \times 2 = 282$ GB BF16. With TP=4 → 70 GB/GPU. It does not fit in an H100 80 GB alongside KV cache + activations. You need TP=8 (~35 GB/GPU) or FP8 with TP=4 (~35 GB/GPU).&lt;/li>
&lt;li>Decode TPOT: dominated by the weights read per token, which are $\sim 39 / 8 \cdot 2 \approx 9.75$ GB/GPU with TP=4 (one top-2 expert per token, divided across 4 GPUs). On an H100 with HBM at 3.35 TB/s, &lt;strong>theoretical TPOT ≈ 3 ms/token&lt;/strong>. In practice, 10–20 ms at reasonable concurrency.&lt;/li>
&lt;li>Prefill: similar to the dense model of the active weights, ~39 B FLOPs/token.&lt;/li>
&lt;/ul>
&lt;p>MoE sizing usually delivers more RPS per GPU than an equivalent dense model: the low cost per token compensates for the extra VRAM. See &lt;a href="https://blog.lo0.es/en/posts/moe-inference-fundamentals-expert-parallel-deepseek-economics/">MoE inference&lt;/a> for the detail of routing and why a high batch is decisive so that each expert sees enough tokens.&lt;/p>
&lt;h2 id="sensitivity-table-context-and-quantisation">Sensitivity table: context and quantisation&lt;/h2>
&lt;p>For Llama 70B on 4×H100 SXM (TP=4), operational concurrency per replica with an SLO of TTFT 1.5 s / TPOT 60 ms:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Average context&lt;/th>
&lt;th>BF16&lt;/th>
&lt;th>FP8&lt;/th>
&lt;th>INT4 (AWQ)&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>500 tokens&lt;/td>
&lt;td>55&lt;/td>
&lt;td>110&lt;/td>
&lt;td>180&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>1,000 tokens&lt;/td>
&lt;td>40&lt;/td>
&lt;td>80&lt;/td>
&lt;td>130&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>2,000 tokens&lt;/td>
&lt;td>24&lt;/td>
&lt;td>50&lt;/td>
&lt;td>85&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>4,000 tokens&lt;/td>
&lt;td>12&lt;/td>
&lt;td>26&lt;/td>
&lt;td>48&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>8,000 tokens&lt;/td>
&lt;td>6&lt;/td>
&lt;td>13&lt;/td>
&lt;td>25&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Approximate numbers from public vLLM benchmarks as of June 2026, with ±20 % variation depending on engine version and the headroom adopted. To validate on your own hardware: &lt;code>vllm bench serve&lt;/code> with your profile of real prompts.&lt;/p>
&lt;h2 id="the-five-habitual-traps">The five habitual traps&lt;/h2>
&lt;p>&lt;strong>Trap 1 — confusing the mean with P95.&lt;/strong> Average throughput over an hour may be 50 RPS while the 5-minute peak reaches 180 RPS. Sizing against the mean guarantees breaking the SLO at every peak. Rule: size against the hourly P95, with 20–30 % head-room over P95.&lt;/p>
&lt;p>&lt;strong>Trap 2 — not measuring the real prefill/decode split.&lt;/strong> A &amp;ldquo;RAG with short answers&amp;rdquo; workload spends 70–80 % of GPU time in prefill; a &amp;ldquo;writing assistant generating essays&amp;rdquo; spends 80 % in decode. The useful optimisations (chunked prefill vs speculative decoding) change radically. Without measuring it, you buy badly balanced hardware.&lt;/p>
&lt;p>&lt;strong>Trap 3 — sizing with no head-room for retraining or rollback.&lt;/strong> The production cluster is not just the inference engine: there is a re-embedding batch when the embeddings model changes, continuous canary evals (see &lt;a href="https://blog.lo0.es/en/posts/canary-blue-green-shadow-llm-models/">Canary, blue-green and shadow&lt;/a>), light fine-tuning, hot stand-by for rollback. Reserve 15–25 % of capacity for those non-negotiable workloads.&lt;/p>
&lt;p>&lt;strong>Trap 4 — &amp;ldquo;GPU at 100 % SM utilization&amp;rdquo; as a target.&lt;/strong> SM occupancy of 95 % with saturated HBM produces the same throughput as SM at 60 % with saturated HBM. The bottleneck in decode is the HBM. Optimising for &amp;ldquo;GPU usage 100 %&amp;rdquo; without looking at HBM utilisation and arithmetic intensity makes you spend more on GPU without gaining throughput. See &lt;a href="https://blog.lo0.es/en/posts/gpu-observability-llm-inference-twelve-dcgm-vllm-metrics/">GPU observability for LLM inference&lt;/a> for which metrics to actually watch.&lt;/p>
&lt;p>&lt;strong>Trap 5 — not documenting the assumptions.&lt;/strong> A sizing with no reproducible YAML (workload, model, engine, head-room, critical assumptions) leaves the team with no way of knowing what changed when the cluster stops meeting the SLO six months later. Documenting is cheap; losing a quarter to debugging is not.&lt;/p>
&lt;h2 id="applied-to-typical-on-premise-hardware">Applied to typical on-premise hardware&lt;/h2>
&lt;p>For a generic cluster of &lt;strong>4×H100 SXM 80 GB with intra-node NVLink and 25 GbE between nodes&lt;/strong>, the recurring configurations in May 2026 are:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Model&lt;/th>
&lt;th>Format&lt;/th>
&lt;th>TP&lt;/th>
&lt;th>Replicas that fit&lt;/th>
&lt;th>Typical RPS per node (ctx 1K)&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Llama 8B&lt;/td>
&lt;td>BF16&lt;/td>
&lt;td>1&lt;/td>
&lt;td>4 (one per GPU)&lt;/td>
&lt;td>240–320&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Llama 8B&lt;/td>
&lt;td>FP8&lt;/td>
&lt;td>1&lt;/td>
&lt;td>4&lt;/td>
&lt;td>450–600&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Llama 70B&lt;/td>
&lt;td>BF16&lt;/td>
&lt;td>4&lt;/td>
&lt;td>1&lt;/td>
&lt;td>30–45&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Llama 70B&lt;/td>
&lt;td>FP8&lt;/td>
&lt;td>4&lt;/td>
&lt;td>1&lt;/td>
&lt;td>60–90&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Llama 70B&lt;/td>
&lt;td>INT4 AWQ&lt;/td>
&lt;td>2&lt;/td>
&lt;td>2&lt;/td>
&lt;td>90–130&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Mixtral 8×22B&lt;/td>
&lt;td>FP8&lt;/td>
&lt;td>4&lt;/td>
&lt;td>1&lt;/td>
&lt;td>90–140&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Qwen 72B&lt;/td>
&lt;td>BF16&lt;/td>
&lt;td>4&lt;/td>
&lt;td>1&lt;/td>
&lt;td>28–42&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>These numbers are &lt;strong>orders of magnitude to start the conversation&lt;/strong>, not commitments. The definitive sizing is validated with &lt;code>vllm bench serve&lt;/code> or &lt;code>genai-perf&lt;/code> (NVIDIA) using the customer&amp;rsquo;s real prompt/output profile. The prefill/decode asymmetry of each case&amp;rsquo;s workload can move these numbers 30–50 % up or down.&lt;/p>
&lt;p>For clusters of 8×H100 SXM (typical of DGX servers or equivalent replicas), the options open up to TP=8 for 405B-class models or multi-replica TP=2 for 70B models with greater density. The metric that decides is always the same: tokens meeting SLO per kW and per euro of amortised hardware.&lt;/p>
&lt;h2 id="how-the-sizing-is-validated-before-buying">How the sizing is validated before buying&lt;/h2>
&lt;p>The spreadsheet sizing is the first half. The second is the validation benchmark.&lt;/p>
&lt;p>&lt;strong>Stage 1 — back-of-the-envelope sizing.&lt;/strong> This post&amp;rsquo;s formulas applied to the SLO and the expected workload. Output: an approximate number of replicas and a topology.&lt;/p>
&lt;p>&lt;strong>Stage 2 — synthetic micro-benchmark.&lt;/strong> On a borrowed GPU or one rented by the day, bring up the engine with the chosen model and run &lt;code>vllm bench serve&lt;/code> with prompts of representative lengths. Validate TPOT, prefill TPS and the concurrency ceiling. Calibrate the HBM efficiency factor ($\eta$) used in the formulas.&lt;/p>
&lt;p>&lt;strong>Stage 3 — load test with realistic traffic.&lt;/strong> Generate traffic following the real distribution of the customer&amp;rsquo;s workload (not Poisson, not constant: the real trace). Measure P50/P95/P99 of TTFT, TPOT, throughput. Confirm the head-room.&lt;/p>
&lt;p>&lt;strong>Stage 4 — canary in production.&lt;/strong> With the cluster sized, route 5–10 % of real traffic for 7–14 days before closing the procurement of additional hardware. See &lt;a href="https://blog.lo0.es/en/posts/canary-blue-green-shadow-llm-models/">Canary, blue-green and shadow&lt;/a> for the mechanics.&lt;/p>
&lt;p>Jumping from Stage 1 to full procurement is the most frequent cause of a cluster that is 40 % oversized and 60 % undersized at the same time, in different regions of the workload. Four weeks of validation done well save four months of refactoring.&lt;/p>
&lt;h2 id="what-we-have-not-covered-upcoming-articles">What we have not covered (upcoming articles)&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>The observability metrics&lt;/strong> that close the sizing loop in production, see &lt;a href="https://blog.lo0.es/en/posts/gpu-observability-llm-inference-twelve-dcgm-vllm-metrics/">GPU observability for LLM inference&lt;/a>.&lt;/li>
&lt;li>Autoscaling that adjusts replicas to the real traffic curve, see &lt;a href="https://blog.lo0.es/en/posts/llm-inference-autoscaling-kubernetes-hpa-keda/">Autoscaling LLM on Kubernetes&lt;/a>.&lt;/li>
&lt;li>&lt;strong>Detailed cost accounting&lt;/strong> per tenant (showback / chargeback) over the sized hardware.&lt;/li>
&lt;li>&lt;strong>Sizing for continuous fine-tuning&lt;/strong> (PEFT and light training) that shares a cluster with inference.&lt;/li>
&lt;/ul>
&lt;h2 id="see-also">See also&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/finops-multi-tenancy-gpu-cluster-who-pays/">FinOps and multi-tenancy of the GPU cluster: who pays for what&lt;/a> — translating the sizing into €/token and attributing cost per team.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/kv-cache-working-memory-llm-inference/">KV cache: the working memory that holds up LLM inference&lt;/a> — the component that dominates the VRAM budget.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/continuous-batching-orca-vllm-chunked-prefill-goodput/">Continuous batching&lt;/a> — what defines the effective utilisation of the compute and the goodput metric.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/disaggregated-serving-prefill-decode-specialised-pods/">Disaggregated prefill/decode serving&lt;/a> — an advanced lever for asymmetric workloads.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/moe-inference-fundamentals-expert-parallel-deepseek-economics/">MoE inference&lt;/a> — how the sums change with MoE models.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/quantization-llm-inference-fp8-int4-gguf/">Quantisation for inference&lt;/a> — what each format costs and what it saves.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/anatomy-on-premise-llm-inference-stack-seven-layers/">Seven layers of the on-premise LLM inference stack&lt;/a> — the pieces the sizing takes for granted.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/mixed-nvidia-intel-environments-llm-inference/">Mixed NVIDIA + Intel environments for LLM inference&lt;/a> — the sizing closes better once heterogeneity is accepted: embeddings and reranker on Intel Xeon AMX free up H100s for the large LLM, without buying more GPU.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/numa-hugepages-cpu-isolation-gpu-waits-kernel/">NUMA, hugepages and CPU isolation&lt;/a> and &lt;a href="https://blog.lo0.es/en/posts/cpu-memory-topology-manager-rke2/">RKE2 resource managers&lt;/a> — why the sizing comes to be reasoned per NUMA node rather than per node: you have to discount the reserved housekeeping cores and check that the pod fits on a single NUMA &amp;ldquo;table&amp;rdquo;.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/full-tco-on-premise-gpu-cluster-capex-gpu-hour-break-even/">TCO of the on-premise GPU cluster: amortisation, energy and infrastructure&lt;/a> — the €/GPU-hour that closes the sizing&amp;rsquo;s economic model: once you know how many GPUs you need, here is the real cost of owning them.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/slo-to-number-of-gpus-sizing-justifying-inference-hardware/">Sizing and justifying the investment in GPU&lt;/a> — the full roadmap for turning this sizing into an investment proposal defensible before management: ROI, break-even and sensitivity analysis.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;a href="https://blog.lo0.es/en/posts/sizing-agents-decode-bottleneck/">Sizing for agents&lt;/a> — the same method with the inputs changed, when the caller is an agent and not a person.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h2 id="references">References&lt;/h2>
&lt;ul>
&lt;li>Kwon et al. — &lt;em>vLLM: Easy, Fast, and Cheap LLM Serving with PagedAttention&lt;/em> (SOSP 2023).&lt;/li>
&lt;li>Zhong et al. — &lt;em>DistServe: Disaggregating Prefill and Decoding for Goodput-optimized LLM Serving&lt;/em> (OSDI 2024).&lt;/li>
&lt;li>Agrawal et al. — &lt;em>Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve&lt;/em> (OSDI 2024).&lt;/li>
&lt;li>NVIDIA — &lt;em>H100 Tensor Core GPU Architecture Whitepaper&lt;/em> (HBM3 memory, bandwidth, sustained FLOPs).&lt;/li>
&lt;li>vLLM project — &lt;code>vllm bench serve&lt;/code> reference (benchmarking CLI included in the repo).&lt;/li>
&lt;li>NVIDIA — &lt;code>genai-perf&lt;/code> (official tool for benchmarking LLM services).&lt;/li>
&lt;/ul></description></item></channel></rss>