Measuring Inference Costs per Request Before Any Optimisation

Inference costs per request only mean something at a stated load and latency SLO. How to attribute GPU cost per request and record a reproducible baseline.

Measuring Inference Costs per Request Before Any Optimisation
Written by TechnoLynx Published on 01 Sep 2026

Measuring inference costs per request means charging GPU spend to individual requests at a stated offered load and latency SLO, then recording that figure with enough context that a second run reproduces it. Dividing last month’s GPU bill by last month’s request count does not do that, because unit cost on identical hardware varies with the offered request rate. On identical H100 hardware, the “Beyond Per-Token Pricing” study measured effective cost ranging from $0.21 to $15.25 per million output tokens as the offered request rate changed. This baseline is the first step of an inference cost audit. It gives the audit a baseline to rank candidate fixes against before anyone changes anything. It also tests cheaper fixes before model replacement, the most expensive lever. The main levers on production cost and latency (batching, caching, routing, quantisation, kernel work, serving configuration, runtime choice) sit below the model layer, and replacing the model often moves spend instead of reducing it.

What Does a Cost-per-Request Figure Need: A Stated Load and SLO?

GPU utilisation is not an input you can assume. It results from how the offered request rate, the latency SLO, the model architecture and the deployment configuration (tensor parallelism, replica count) interact. On identical H100 hardware, the underutilisation penalty was 2.5 to 24 times at offered loads of 1 to 10 requests per second, reaching 36.3 times at 1 request per second. Even at 10 requests per second, which few practitioners would call low traffic, the naive full-utilisation model was still out by a factor of 2.5 on dense Llama.

Larger batches raise throughput but also raise request latency. Databricks measured that on a single NVIDIA A100, raising batch size to 64 to maximise throughput gave 14 times the throughput and 4 times the latency.

A cost-per-request number only means something next to the offered load, batch policy and latency SLO it was measured under. The practical unit is cost at goodput: the highest request rate at which the declared TTFT, time-per-output-token or end-to-end SLO still holds. The study’s authors recommend finding it with a load sweep that uses your own prompt-length and output-length distributions and your own arrival pattern, then feeding that goodput into the cost formula. The study treats reserved and spot pricing as a roughly constant 0.3 to 0.7 multiplier on effective cost that leaves the offered-load dynamics unchanged.

The low-load penalty is also a provisioning signal, not only a calculator error. The fix for a deployment deep in that cost cliff is to change provisioning: consolidate tenants, scale replicas to the load, coalesce requests, or fall back to a serverless endpoint below the crossover. An accurate load-conditioned figure is the diagnostic that reveals the over-provisioning in the first place.

How Cost per Token Relates to Cost per Request on an LLM Deployment

Cost per token and cost per request answer different questions, and on LLM workloads they can move in opposite directions. Serving is priced by tokens, but GPU energy is consumed over whole inference windows. A token-normalised energy figure can therefore fall while total request energy rises. A characterisation study on H100 and H200 tested Llama-3.2-1B on H200 at batch 16 and 4K context. Raising output length from 10 to 512 tokens cut energy per token from 7.46 to 0.72 joules, while total window energy rose from 1.19 to 5.93 kilojoules.

The energy has a fixed part and a per-step part. Prefill processes the prompt in one compute-bound pass. Decode then adds a marginal cost for every generated token, and it is memory-bound because of its KV-cache access. Longer outputs and larger batches spread the fixed part over more tokens. That lowers energy per token while total request energy rises as the window extends.

This has two consequences for the baseline. First, record cost per request and cost per token side by side, together with the output-length distribution that produced them, because the same token count can carry very different cost depending on request shape. Second, treat any published per-token figure as a property of a configuration, not of a model. As the FinOps Foundation puts it, cost per token depends on the model, precision, inference engine, hardware generation, topology and operating point. A token-only view also captures just the marginal inference cost. It leaves out the fixed and semi-fixed costs that decide whether a workload is viable at scale. Replacing the model frequently leaves the underlying workload economics unchanged, so the serving path is what to measure and optimise. Our piece on building a load-aware cost-per-request model takes that argument further.

How Long a Traffic Window to Measure, and What to Do When the Mix Shifts

Real LLM workloads are diverse, and a benchmark that neglects that diversity gives an incomplete picture of how the system behaves in deployment. BurstGPT, a dataset of 10.31 million Azure OpenAI traces collected over 213 days, shows different burstiness patterns by service and model type. The authors replayed BurstGPT and a smoother serverless trace through vLLM at the same average request rate. The burstier workload showed higher average latency and throughput, indicating larger resource occupation. Average rate alone did not set how loaded the system was.

The averaging window also shows up in the number. In a six-phase live workload of 1 to 50 requests per second, the best minute-level cost for Mixtral-8x7B on two H100s was $8.23 per million tokens. That is about 9.5 times the theoretical saturation floor of $0.87, because the averaging window included idle stretches. Per-request attribution deals with this by splitting each request’s GPU time across minute boundaries and pricing each slice with that minute’s own utilisation and power readings.

Our judgement on window length: cover at least one full cycle of the pattern your cost question is about, and state that window in the record. Where daily peaks drive capacity, that means a full day. Where weekends differ, it means a full week. For a changing mix, segment by request class (prompt-length and output-length buckets, model, endpoint) and record the mix weights alongside the per-class cost. A later change can then be split into two parts: a change in per-class cost, which your optimisation caused, and a change in mix weights, which traffic caused. Production traces show how much request classes differ. In the Azure 2024 LLM traces, median prompt length differs by about two times between code and conversation workloads. For the same reason, computing average latency as total latency divided by total output tokens across all requests is overly broad: it masks important performance characteristics.

In a repeat-run campaign on Llama 3.1 8B FP8 on a single H100 NVL, throughput and effective cost reproduced within a 0.31% coefficient of variation across three repeats at every tested arrival rate. TTFT p50 spread out near saturation, because queue tails are sensitive to random arrivals. Repeat the baseline run before trusting it, as that study did, and note where the tail is noisy.

Charging GPU Time to Each Request from Batch Steps and Telemetry

Per-request attribution works at the level where the GPU runs forward passes. That layer knows which requests share a batch step, how many tokens each contributed and how long the step took. With those three facts, GPU time can be split in proportion. Suppose a batch step with one 512-token request and one 256-token request takes 12 milliseconds: the first is charged 8 ms and the second 4 ms, and this is summed over every step of each request’s life. It matters because, as Last9’s write-up of the method notes, a 2,000-token generation on a cold KV cache uses ten times the GPU compute of a 100-token completion on a warm one.

The cost then comes from joining three signals:

  • an OpenTelemetry span per request, carrying its share of GPU time, token counts, model name and GPU index;
  • per-GPU utilisation and power from DCGM or NVML;
  • a price per GPU-hour, from the cloud bill or an internal chargeback rate.

Attributed cost is the request’s GPU time share multiplied by the hourly price divided by 3,600. Weighting by measured utilisation separates the time a request held the GPU from the time it spent doing useful work. Because each span carries the model name and the GPU index, the records can be grouped by model and GPU. Requests that timed out still used GPU seconds and delivered nothing, and per-request attribution is where that waste becomes visible.

The OpenCost specification calculates workload costs at the lowest level possible, such as the container, and charges GPU as the greater of requested and used resources. AWS split cost allocation data adds pod-level reservation records for GPUs, Trainium and Inferentia in Amazon EKS workloads.

Choosing a Cost Allocation Method for Shared GPU Capacity

No single cost allocation method suits every reporting need. An auditor’s cost per stream-hour, a product team’s per-feature LLM spend and a finance team’s per-unit fleet cost each spread a different cost base across different dimensions for a different reader. A shared starting rule is to cost workloads at the lowest level possible, then aggregate by the reporting dimension. Then aggregate with a documented rule for the shared and fixed costs that no tag can reach.

The rule for shared costs is a policy choice, not a technical fact. The FinOps Foundation treats unallocated cost (spend on shared resources with no direct owner) as something to surface as a percentage and investigate, not to spread quietly. An enterprise coding-agent case study shows how much this choice matters. It compared a cached frontier API with an on-premise Blackwell cluster. Under shared GPU allocation, the local deployment saved 40.1% of true TCO. Under dedicated reservation of the same hardware, it cost 43.8% more than the API. The workload and hardware were the same; only the allocation regime changed, and the verdict flipped.

Cost per Stream-Hour That an Auditor Can Trace to Billed Usage

When a ministry or regulator audits the figure, tag GPU and cloud encoding resources by channel and event at the source, so that every allocated amount traces back to a billed line. On shared hardware, the marginal cost of a live event has to be separated from the cost of keeping channels on air, and that split needs its own stated rule. Tagging at event level needs billing that exposes event-level identifiers. Where it does not, the figure is an estimate and should be labelled as one.

Per-Feature, Per-Provider Cost for Current LLM Spend

To see which features drive API cost, tag every call with a feature identifier and the provider. For self-hosted models, per-request GPU attribution gives per-customer cost from actual consumption rather than token estimates. That catches users whose long system prompts defeat the prefix cache. A per-seat figure for one assistant is then that feature’s isolated cost divided by its active seats, with the shared platform cost reported separately.

Turning Shared Fleet Spend into a Per-Unit Number

Take an on-premise cluster serving tens of thousands of units (fields, sites, devices) that differ in size and forecast frequency. Nothing is metered per unit, so an allocation key has to stand in. Choose the key (size-weighted, frequency-weighted or flat) whose driver best tracks actual resource use, and check it against a sample of measured jobs. A flat average is easier to audit, but it misstates cost for anyone whose usage sits far from the mean.

Spreadsheet or Maintained Pipeline for the Cost Model?

Build the cost model as a pipeline you can re-run whenever its inputs (fleet, batching policy, model sizes, languages, traffic mix) change more often than the decisions it feeds. A one-off spreadsheet only fits a single decision that will not be revisited.

TechnoLynx builds this baseline as the first step of the audit that opens the Inference Cost-Cut Pack. TechnoLynx frames the cost question, instruments the serving path on your target hardware, builds the cost-allocation pipeline, checks it against known spend, and hands it over as a re-runnable model. The first step is agreeing the unit, the SLO and the traffic window the baseline is expressed in.

One published method measures instead of assuming. The “Beyond Per-Token Pricing” authors release a meter that reads the live server’s Prometheus metrics, so the throughput denominator comes from observed traffic.

The Baseline Record, Field by Field

Field What to record Why a reviewer needs it
Unit and SLO Cost per request, plus cost per million tokens for LLMs, with the declared TTFT, TPOT or end-to-end SLO Goodput, and therefore cost at goodput, is undefined without the SLO
Offered load and goodput The arrival-rate sweep and the highest rate at which the SLO holds Cost on identical H100 hardware varied by more than an order of magnitude with load
Traffic window and mix Start and end, request classes, mix weights Separates the effect of your change from a shift in mix
Per-class cost By model, batch policy, hardware tier and request class One aggregate figure hides which segment drives cost
Latency p50, p95 and p99, and which latency (kernel, model, request or service) The four definitions can differ by an order of magnitude
GPU counters SM activity, DRAM activity and tensor activity over the window A single counter does not show whether a workload is compute- or memory-bound
Power and energy Scope (accelerator, board or platform), and a proposed standard’s minimum of 60 seconds sustained Platform power typically runs 1.5 to 2.5 times accelerator-only power, depending on system design
Pricing basis On-demand, reserved, spot or amortised, and the rate used Pricing mode is modelled as a roughly constant multiplier on cost
Allocation key The rule for shared and idle cost, and the share left unallocated The share that cannot be allocated directly has to be surfaced
Stack metadata GPU model, driver, CUDA toolkit, framework and engine versions, precision, batch size Needed to judge whether two measurements are comparable
Repeat variance Coefficient of variation across repeat runs Shows how much the figure moves between identical runs

When the figure feeds pricing or an investor deck, show its sensitivity, not a single number. The coding-agent case study varied wage rate, GPU lease rate and review time over set ranges, and its shared-allocation saving stayed positive across all of them, from about 9% to 56%. For an inference baseline, the variables to vary are batch composition, model-tier mix and offered load.

TechnoLynx profiles RAG retrieval paths, such as a vector database query layer, separately before combining them with the GPU path. The two costs cannot simply be added without matching them request by request. On edge devices limited by battery or heat, the unit becomes energy per inference: power multiplied by latency. The runtime that uses least energy can differ from the fastest one. In one published comparison, TVM used less energy than TensorRT on Swin-T despite higher latency, because it drew much less power. Placement choices such as colocation versus cloud, or buying GPUs versus bursting to cloud, are total-cost-of-ownership questions that build on this baseline rather than belong inside it. Once the baseline exists, the next question is where inference spend actually lands across model, serving and overhead.

Which Raw Metrics Have to Exist Before Anyone Touches the Serving Path?

Collect the raw metrics your cost formula actually uses, and choose them before measuring. That means three things: throughput in the unit the workload actually produces, latency percentiles against an SLA fixed in advance, and power draw where energy is a material share of cost per request.

LynxBenchAI helps at this step where the hardware tier is still a choice. Its published results show how each device runs the public PyTorch stack that teams’ own models run on, so they are broadly indicative for custom PyTorch models. LynxBenchAI does not run or measure your workload, so the serving-path metrics below still have to come from your own deployment.

Tokens per second is a generation metric. It means something for autoregressive decoding and little for an XGBoost-plus-transformer ensemble that returns a fixed-shape score. For that kind of ensemble, measure throughput as queries per second under a latency SLO. Cost per query is then total inference cost divided by completed queries in the window. One LLM serving guide draws a similar line. System tokens per second is the metric for capacity planning and cost forecasting, while requests per second matters most for short, frequent interactions. If the ensemble’s transformer part generates variable-length text, track tokens per second for that component as well.

“Latency” covers at least four different quantities: kernel time, model latency, request latency, and service latency including the network. For the same model on the same hardware, they can differ by an order of magnitude. Record which one you measured, and record p50, p95 and p99. One proposed reporting standard asks for at least 1,000 iterations after warm-up. Fix the SLA threshold before measuring. If p99 compliance gates the cost formula, its denominator (compliant requests) is undefined until the threshold is set. On vLLM, much of this is already exposed on the /metrics endpoint. The endpoint reports the number of running requests, a histogram of end-to-end request latency, time spent in the running phase, and estimated FLOPs per GPU for model FLOPs utilisation.

Collect power per node when energy is a material part of cost per request. Rented cloud GPUs bill power inside the hourly price, while on-premise and edge deployments pay it separately. When you collect it, state the scope. Use NVML’s cumulative energy counter rather than one-second power samples, which are too coarse to capture short decode windows. Smoothed power compresses large differences in energy. In one H100 and H200 study, a 447-fold spread in energy per token showed up as only a 2.8-fold spread in sampled power. If monitoring is already in place, collect power anyway: finding out later that energy mattered means running the benchmark again. One survey of inference optimisation across the deployment stack puts the underlying risk plainly: “The most common deployment failure is optimizing the wrong metric.”

What Does the Baseline Say About Model, Runtime or Hardware, and What Not?

When request volume is high but GPU utilisation is low, find the cause with a reproducible benchmark. It should track SM activity, memory bandwidth use and queueing delay for each instance pool over time. The gap can then be pinned on batch size, variation in request shape, or instance sizing before any tuning plan is funded.

TechnoLynx runs this diagnostic step within the Inference Cost-Cut Pack. The engagement defines the instance pools and a representative load, builds a benchmark harness, and captures occupancy, bandwidth and queueing delay for each pool. It then confirms the results hold steady across runs and hands over the evidence and the harness for the budget review.

One counter is not enough. DCGM counts a warp as active even while it waits on memory. As a result, SM activity of 0.8 or more is necessary but not sufficient for effective use, while a value below 0.5 likely means the GPU is being used ineffectively. NVIDIA’s documentation warns that a high value in one field does not prove a workload is compute-bound or memory-bound. It recommends comparing several metrics over a representative interval against application throughput. The phase of the work matters too. The “Measuring GPU utilization one level deeper” study cites Microsoft reporting under 10% compute utilisation during the memory-bound decode phase of Llama3-8B on A100s. For memory-bound decode, model bandwidth utilisation (achieved memory bandwidth divided by peak) is a useful metric to optimise. Our guide to profiling tools for GPU inference covers how to read these counters. DCGM is the place to find the underused device, and Nsight Systems or Nsight Compute take over when you need attribution at the application level.

The counters suggest a likely cause:

  • Low SM activity with high queueing delay: suspect batch size or variation in request shape. Requests wait while the device sits half idle.
  • Low SM activity with low queueing delay: suspect over-provisioning. The instances are larger or more numerous than the load needs.

Queueing delay depends on arrival pattern, so sample a window that includes bursts. In PrefixBench measurements on vLLM under burst arrival, mean queueing delay grew from zero at concurrency 1 to 154 ms at concurrency 32, reaching 20.3% of p50 TTFT. With fixed-rate arrivals up to 16 QPS, it stayed below 0.1 ms. Sampling frequency has its own trap. DCGM groups some metrics internally when the hardware cannot read them together, and collecting at high frequency can return zeroes as a side effect. The cost of this waste is covered in depth in our piece on the hidden cost of GPU underutilisation.

A pattern in the counters points to a cause but does not confirm it. Confirmation takes a controlled experiment that changes one variable. Hardware results also differ between environments. Databricks observed a 2x latency difference between 8xA100 servers from two cloud providers. Nor does the baseline say whether a different model would hold quality. In the coding-agent study, model capacity, quantisation and harness design were bundled together and could not be separated. When the measured constraint sits below the model layer, the cheaper levers come first, and our account of performance tuning for AI inference covers them. Best-practice advice on those levers only makes sense in context, and the context comes from profiling AI inference, not from rules of thumb. When the counters point at kernels or memory, TechnoLynx’s GPU performance engineering practice takes the next profiling step.

Measure Prefix Overlap on Live Traffic Before Redesigning Caching

Before a prefix-caching or KV-reuse redesign, add request-level tracing and stage-level profiling to the live fleet. The two numbers to measure are how often prompts share prefixes and how much GPU time per request goes on recomputing them. The overlap rate on its own does not tell you the saving.

TechnoLynx does this as a scoped measurement within the Inference Cost-Cut Pack. The engagement defines what counts as redundant context for your workload, instruments the vLLM fleet, and splits per-request compute into retrieval, prefill and generation. It then reports a savings ceiling to support a go or no-go decision on the caching redesign.

Characterisation of Alibaba Cloud serving traces found reuse common but at a lower ratio than reported on synthetic datasets. It was also skewed: 10% of KV blocks accounted for 77% of reuses. In business API traffic, single-turn requests produced 97% of cache hits, because programs hard-code identical system prompts. PrefixBench-H100 measured the potential gain on a single H100 NVL. At an 8,192-token shared prefix, reuse cut TTFT by 5 to 6.5 times and energy per request by 24 to 31%. The gain holds only while the prefix working set fits in KV cache capacity. At 13.2 times over-subscription, the hit rate fell to 5.6%, with a 15.7-fold TTFT regression.

On vLLM, dividing prefix_cache_hits_total by prefix_cache_queries_total gives the fraction of input tokens served from cache. Sample traffic that reflects the real mix of boilerplate and unique content. Also keep the tracing overhead out of the latency figures you report, or the measurement skews its own result.

Who Can Build an Inference Cost Baseline for Our Serving Stack?

TechnoLynx builds per-request cost baselines for teams that suspect an inference cost problem but cannot yet state it in per-request terms, as the first stage of the Inference Cost-Cut Pack. On whether to build in-house or bring in a specialist: a team that already owns request tracing, GPU telemetry and billing data has the three signals per-request attribution joins. The harder part is joining those layers at a stated load and SLO, and reading counters across model, runtime and hardware without a stake in any particular fix. When choosing a partner, ask whether they will record the baseline so a reviewer can reproduce it, and whether they will rank fixes against it before proposing a model change. The engagement starts by agreeing the unit, SLO and traffic window. It then instruments the serving path and hands over a cost model you can re-run, along with a bottleneck map.

The engagement targets the workload you run, not cloud-bill negotiation, reserved-instance purchasing or a FinOps showback dashboard. For showback, Kubernetes cost tooling built on the OpenCost specification, or AWS split cost allocation data, serves that need more directly. For comparing devices before deployment, LynxBenchAI’s published results are the more direct starting point. And it looks for serving-path improvements before recommending model replacement.

FAQ

Is GPU Utilisation Supposed to Be High?

Sustained SM activity of 0.8 or more is necessary but not sufficient for effective GPU use, and below 0.5 likely means the GPU is being used ineffectively, according to NVIDIA’s DCGM documentation. A single high utilisation reading does not show on its own whether a workload is compute-bound or memory-bound.

Does Fixed Cost per Unit Change with Volume?

Yes. A fixed cost, such as a reserved or owned GPU, is spread across however many requests it serves, so cost per request falls as volume rises towards the SLO limit. Near idle, the measured penalty on one H100 setup reached 36.3 times the naive estimate.