Sari la conținut
aiqbenchInformații despre AI & calcul cuantic
ȘtiriAnalizeBenchmark-uriSkill-uriÎntreabă AIÎnvațăDespre
...Se încarcă sesiunea
ȘtiriAnalizeBenchmark-uriSkill-uriÎntreabă AIÎnvațăDespre

Română · beta. Traducerea a fost făcută automat și este încă în curs de revizuire. Citește pagina în engleză

  1. Joburile viitorului
  2. ›
  3. AI Inference & Efficiency Engineer
  4. ›
  5. Lecția 6 din 8

Lecțiile acestui traseu sunt publicate deocamdată doar în engleză, așa că lecția de mai jos apare în engleză. Restul — module, quiz și materiale — funcționează la fel.

Measuring Latency and Cost Honestly

Avansat¶ Citire · 4 min⚑ Misiune · 35 min◆ Test · 5 întrebări✓ Verificată la 23 nov. 2026

Vei putea să:

You can define time-to-first-token, inter-token latency, tokens per second and goodput, explain why averages and single-request benchmarks mislead, compute cost per million tokens from an hourly machine price and a measured throughput, and list the ways a vendor benchmark can be technically true and still irrelevant to your production load.

Define the metric before you run the benchmark

Inference benchmarks are easy to make look good and hard to make honest. The reason is that "fast" hides four different quantities, and a system can be excellent at one while being unusable on another. Before any run, write down which of these you are reporting:

  • Time to first token (TTFT) — from request arrival to the first streamed token. Dominated by queueing and prefill; it is what a user experiences as "is it thinking?".
  • Inter-token latency (ITL), or its inverse, per-user tokens per second — how fast the answer streams once started. Dominated by the decode step time at the current batch size.
  • End-to-end latency — TTFT plus ITL × output length. The only thing that matters for non-streaming API calls.
  • Throughput — total tokens per second across all users, which is what sets cost. Report input and output tokens separately; they cost different amounts of work.

A fifth, goodput, is throughput counted only for requests that met a latency target. It is the honest number for capacity planning, because a server that produces 10,000 tokens/s while every user waits 20 seconds for the first one is not serving anyone.

Why averages lie

Gil Tene's talk "How NOT to Measure Latency" is required viewing. Three of his points matter most here. First, the mean of a latency distribution describes nobody; users experience the tail, and a session of twenty requests sees at least one response at or beyond the p95 about two times in three (1 − 0.95²⁰ ≈ 64%). Second, coordinated omission: if your load generator waits for each response before sending the next request, a slow period causes it to send fewer requests, and the slow period is under-sampled in your data. The fix is an open-loop generator that fires requests on a schedule regardless of responses (a Poisson arrival process at a chosen rate), and a closed-loop generator only when your real clients genuinely behave that way. Third, percentiles must come from the full set of recorded samples, not from averaging percentiles across intervals, which is meaningless.

For LLM serving, add a fourth: the distribution of prompt and output lengths shapes everything. A benchmark with 128-token prompts and 128-token outputs says nothing about your 3,000-token RAG prompts and 50-token answers. Databricks' "LLM Inference Performance Engineering: Best Practices" shows the same hardware producing very different numbers as input/output shapes and concurrency change, and gives the practitioner's checklist for stating them.

Turning tokens per second into money

Cost per token is a derived number and the derivation should be shown. A numbered procedure:

  1. Measure sustained aggregate throughput at the concurrency and latency target you actually accept — say 2,400 output tokens/s at 32 concurrent users with p99 TTFT under 1.5 s.
  2. Convert to tokens per hour: 2,400 × 3,600 = 8.64 million output tokens per hour.
  3. Divide the machine's hourly price by that. If the machine costs 4.00 per hour in your currency, the cost is 4.00 ÷ 8.64 ≈ 0.46 per million output tokens at full utilisation.
  4. Correct for real utilisation. Traffic has peaks and valleys; if the server averages 40% of peak over a day, the effective cost is 0.46 ÷ 0.4 ≈ 1.16 per million. Autoscaling narrows the gap but adds cold-start latency.
  5. Add input tokens with their own throughput measurement, and overheads: idle replicas for failover, the engineer-hours of running it, and egress.

Compare that number to an API price only after step 4. Most "self-hosting is 10× cheaper" claims stop at step 3.

Vendor benchmarks: true but irrelevant

MLPerf Inference, run by MLCommons, is the most rigorous public benchmark: fixed models, fixed datasets, accuracy constraints, audited submissions, and separate "server" (latency-constrained) and "offline" (max throughput) scenarios. Read the rules before the results and you learn what a careful benchmark must specify. Even so, its numbers come from vendors' best-tuned configurations on the benchmark's shapes. Ways a published figure can be accurate and still useless to you:

  • Measured at a batch size or sequence shape you will never see.
  • Offline scenario quoted as if it were a latency-bound one.
  • Different precision (FP8) than you are willing to run.
  • Warm KV cache from repeated identical prompts (prefix caching inflates throughput enormously on synthetic loads).
  • Short runs that never hit thermal or memory-fragmentation steady state.

Your own benchmark should state model, precision, server version, hardware, prompt and output length distributions, concurrency, arrival process, warm-up, duration, and the percentiles reported — every time, in the results table.

What is still unsettled

Reasoning models that generate long hidden chains of thought make "output tokens" an ambiguous quantity for pricing, and goodput definitions for agentic, multi-call workloads are not standardised. Energy per token is the metric many organisations will soon be asked to report and few currently measure.

What to remember

  • Name the metric: TTFT, inter-token latency, end-to-end latency, throughput (input and output separately), goodput.
  • Report percentiles from full samples, use open-loop load to avoid coordinated omission, and match the workload's length distribution.
  • Cost per million tokens = hourly price ÷ (sustained tokens/s × 3,600), then divided by real utilisation; stopping before utilisation flatters self-hosting.
  • A vendor number is only comparable when model, precision, shapes, concurrency, scenario and caching state are the same as yours.

Materiale selectate

1.7h

Munca de profunzime se întâmplă aici — lecția este briefingul tău.

  • How NOT to Measure Latency (Gil Tene, Strange Loop)Video· 45 min
  • LLM Inference Performance Engineering: Best Practices (Databricks)Tutorial· 30 min
  • MLPerf Inference: Datacenter benchmark suite (MLCommons)Documentație· 25 min

În direct pe aiqbench

Subiectul acestei lecții în restul site-ului, astăzi.

În știri, ultimele 30 de zile

  • GPU decoder keeps pace with a superconducting qubit clock on a continuous stream, with NVIDIA NVQLink interconnectAlice & Bob · 1 dec.
  • DeepSeek Opens Source Production-Level Ascend Inference Code36Kr · 1 dec.
  • NVIDIA and Cerebras Partner to Accelerate AI Agent Inference with Two-Stage Compute Architecture36Kr · 1 dec.
Mai multe știri pe acest subiect →

Mergi mai departe

  • Care model merită?Preț, viteză și hardware alături de capabilitate.
  • Întreabă AI despre această lecțieDeschide Întreabă AI cu o întrebare despre această lecție, cu răspuns din arhiva de știri, cu surse.
  • Skill-uri de agent pentru această muncăSkill-uri gata făcute pentru agenți AI de programare, verificate și evaluate.

Testează-ți cunoștințele

5 întrebări în 100 de secunde, pe o pagină separată. Citește mai întâi tot ce este mai sus.

Testează-ți cunoștințele →

Misiunea modulului

30–40 min

Design a benchmark plan for a hypothetical customer-support assistant: 600-token prompts, 150-token answers, 20 concurrent users at peak. Write it as a one-page document covering the exact metrics you will report (with definitions), the load pattern (open-loop versus closed-loop, and why), the warm-up and run duration, what percentiles you will quote and why p99 rather than mean, how you will turn tokens/s into cost per million tokens, and the three mistakes from Gil Tene's talk you are explicitly guarding against.

Se încarcă lucrarea ta…

← Lecția anterioară5. Accelerators: GPU, TPU, CPU and Edge — What the Memory Hierarchy DecidesLecția următoare →7. Caching, Routing and the Small-vs-Large Model Decision
aiqbench
Informații despre AI & calcul cuantic© aiqbench. Toate drepturile rezervate.

Fluxuri:RSS·JSON Feed

LimbăEnglish·Românăbeta
ȘtiriAI & tehnologieCuanticAnalize
ExploreazăBenchmark-uriÎnvață
CompanieDespreÎncredereInformații legaleTermeni și condițiiPolitica de confidențialitateNotificări privind drepturile de autorȘtergerea datelorRaportează conținut

Perspectiva aiqbench, analizele, rezumatul zilnic și răspunsurile din Întreabă sunt scrise de modele AI din sursele afișate, fără revizuire editorială înainte de publicare. Pot conține erori — verifică sursa. Cum este folosit modelul →

  • Știri
  • Analize
  • Întreabă
  • Topuri
  • Cont