The request-serving path
Inference applies learned parameters without updating them. For a loaded decoder-only language model, the prompt is the supplied sequence; tokens are its vocabulary units. Autoregressive generation selects a continuation token, then conditions the next prediction on that selection. Vocabulary readout and autoregressive generation explains the underlying prediction mechanism.
Input preparation turns application messages into the model’s expected sequence. A chat template serializes roles, contents, and control tokens. Using the wrong template or duplicating special tokens changes what the model receives, even when the application’s message objects look correct.
An execution engine runs the model; a server accepts requests and coordinates their execution. In the TensorRT-LLM deployment example, a compiled engine supplies model execution while Triton supplies hosting and batching. One HTTP request therefore encloses many model operations rather than one indivisible GPU call.
Model weights are shared learned parameters. Request state depends on the current sequence. Prefill processes the supplied prompt; decode continues it incrementally. Waiting before execution, delivering output, and finishing the request add boundaries around those phases, so execution time and client-visible latency need separate measurements.
Latency and throughput boundaries
| Measurement | Boundary and interpretation |
|---|---|
| Time to first token: TTFT | At the client, request start to first nonempty content receipt; headers and empty events do not count. |
| Inter-token latency: ITL | Intervals between successive token events at a specified observation point. Engine events and client arrivals differ. |
| Average continuation time: TPOT | Elapsed time after the first output token, divided by the number of subsequent tokens. |
| Completion latency | Request start to the declared completion event. State whether that event is last content or terminal protocol completion. |
| Request throughput | Completed requests divided by observation duration; specify which finish outcomes count. |
| Token throughput | Processed input tokens or generated output tokens per observation second. Report these as separate quantities. |
One request, several boundaries
Example timingsFirst content, last content, and terminal completion differ.
Read the diagram as text
- Dispatch to terminal completion. 0 to 120 ms; duration 120 ms.
- Server waiting. 5 to 15 ms; duration 10 ms. Parent: Dispatch to terminal completion.
- Prompt processing. 15 to 40 ms; duration 25 ms. Parent: Dispatch to terminal completion.
- Subsequent generation. 40 to 105 ms; duration 65 ms. Parent: Dispatch to terminal completion.
- Incremental delivery. 40 to 115 ms; duration 75 ms. Parent: Dispatch to terminal completion.
- Client TTFT. Measurement interval, not additional work. 0 to 45 ms; duration 45 ms. Parent: Dispatch to terminal completion.
- Last content to terminal event. 115 to 120 ms; duration 5 ms. Parent: Dispatch to terminal completion.
Metric names are not interchangeable contracts. AIPerf labels its per-request continuation average ITL. GenAI-Perf instead normalizes successive response intervals by the later response’s token count. Neither convention recovers every internal token-emission interval from bundled responses.
A p99 latency is the 99th percentile of a specified population of observations, not an average. Request-latency percentiles and response-interval percentiles use different observation units. Record the population, duration, tokenizer, and load alongside the number.
A service-level objective, or SLO, states a target and its required attainment. Serving objectives can constrain both response onset and continuation pace. Task metrics, latency and usage accounting covers their broader design. Meeting a latency objective does not establish answer correctness.
Workload shape and service objectives
A workload has a joint distribution of input and output lengths: how often each combination occurs. Independent averages hide whether long prompts also produce long answers. Those requests can combine expensive prompt processing with prolonged memory residency, reducing the room available for other requests.
| Workload shape | Serving consequence |
|---|---|
| Long input, short output | Prompt processing can dominate; first-token performance deserves particular attention. |
| Short input, long output | Many dependent continuation steps make output pace and sustained state access important. |
| Repeated compatible prefix | Prefix reuse can remove repeated prompt work, but each new continuation still requires generation. |
Arrival rate counts incoming requests per second. Active concurrency counts requests occupying execution resources; total outstanding requests also includes waiting work. Burstiness means arrivals cluster unevenly over time. A burst can increase outstanding work without changing the long-run average arrival rate.
Measure input length after conversation serialization, including role markers and generation prompts. Complete-request token counts explains why document counts alone are insufficient. Changing formatting can change both total input length and the prefix available for reuse.
Input truncation removes tokens before execution and can discard needed evidence. An output limit instead caps newly generated tokens. A remote service may reject oversized inputs rather than truncate them; the tokenizer setting does not establish the server’s policy.
A supported context window describes admissible sequence length, not reliable use of every position. Controlled long-context studies found position-dependent retrieval performance in several evaluated models. Test relevant-information position and distractors separately instead of treating nominal context capacity as a quality guarantee.
A capacity objective must identify the workload class, arrival pattern, latency percentiles, completion target, and acceptable rejection rate. Throughput comparisons become decision-relevant only after excluding configurations that violate those requirements. A single fast request cannot establish performance under the intended load.
Prefill and iterative decoding
Prompt tokens are already known, so prefill can process many positions together. Causal visibility still restricts each position to itself and earlier positions. Parallel computation does not grant access to future context; Visibility and attention masks explains that distinction.
The final prompt position supplies scores for the first output selection. Processing that selected token supplies the next selection; selection alone does not create its cached representations.
Selection precedes new cached state
ExampleOnly processed positions have KV representations.
Create prompt representations and scores.
Read the diagram as text
- Fixed weights.
- Prompt positions 1…N.
- Prompt KV.
- Scores at N.
- Token y1.
- KV at N+1.
- Scores at N+1.
- Token y2.
- Fixed weights → Prompt KV: parameters.
- Fixed weights → Scores at N: parameters.
- Prompt positions 1…N → Prompt KV: processing yields.
- Prompt positions 1…N → Scores at N: processing yields.
- Scores at N → Token y1: select.
- Token y1 → KV at N+1: processing yields.
- Token y1 → Scores at N+1: processing yields.
- Prompt KV → Scores at N+1: retained context.
- Fixed weights → Scores at N+1: parameters.
- Scores at N+1 → Token y2: select.
- Process prompt. Create prompt representations and scores. Active: Fixed weights, Prompt positions 1…N, Prompt KV, Scores at N. New: Fixed weights, Prompt positions 1…N, Prompt KV, Scores at N.
- Select y1. No y1 KV yet. Active: Fixed weights, Prompt positions 1…N, Prompt KV, Scores at N, Token y1. New: Token y1.
- Process y1; select y2. Retain prompt KV. y2 remains unprocessed. Active: Fixed weights, Prompt positions 1…N, Prompt KV, Scores at N, Token y1, KV at N+1, Scores at N+1, Token y2. New: KV at N+1, Scores at N+1, Token y2.
The key-value cache, or KV cache, retains attention keys and values from processed positions. Keeping these representations avoids repeating their computation. It does not eliminate the new computation or retained-state access needed when the next selected token enters the model.
Ordinary continuation remains dependent across selections: choosing a different token changes the prefix and therefore subsequent prediction distributions. Processing a known prompt in parallel and batching independent requests exploit different opportunities; neither removes this within-sequence dependency.
Token selection and stopping
Logits are unnormalized vocabulary scores. Greedy decoding chooses a highest-scoring token; sampling draws from a probability distribution derived from scores. A vocabulary projection produces those scores, but the resulting vector is not itself a token or an estimate of answer correctness.
Suppose three candidates have probabilities 0.60, 0.25, and 0.15 at temperature one. At temperature two, probabilities become proportional to their square roots, approximately 0.47, 0.30, and 0.23 after normalization. The ranking remains unchanged, but lower-ranked candidates become more likely.
| Rule | Eligible candidates | Probabilities after filtering |
|---|---|---|
| Top-k, k = 2 | The two highest-probability candidates | 0.60/0.85 and 0.25/0.85 |
| Top-p, p = 0.80 | The smallest leading set reaching 0.80: the same two candidates | 0.60/0.85 and 0.25/0.85 |
Top-k fixes candidate count; nucleus sampling, or top-p, fixes a cumulative-probability threshold. They happen to retain the same set above but need not do so elsewhere. These controls alter selection without retraining the model or validating the selected answer.
| Stopping boundary | Meaning |
|---|---|
| End-of-sequence: EOS | A designated token can end generation when the runtime honors it. |
| Stop string | A matching text sequence can end output; the returned text may exclude generated stopping content. |
| Output-token limit | A generation cap stops further output; it does not ensure a complete answer. |
| Context limit | Supported sequence length constrains prompt plus continuation independently of allocated cache capacity. |
A fixed random seed controls only part of reproducibility. Scheduling, numerical execution, hardware, and runtime versions can also matter. For example, vLLM distinguishes seeded randomness from deterministic scheduling or supported batch-invariant execution, and bounds its reproducibility guidance to the same hardware and version.
Constrained decoding masks tokens that would violate a represented structure before selection. It narrows the generation path rather than merely parsing arbitrary text afterward. Constraints during generation covers this mechanism; structural conformity does not establish factual correctness.
Applications must inspect completion status before accepting a generated record. Refusal, output exhaustion, and partial streaming responses require separate handling. A schema-conforming completed result can still contain mistakes; a partial prefix is weaker evidence still.
Streaming delivery and cancellation
Generation decoding selects tokens; tokenizer decoding reconstructs text from their IDs. Incremental reconstruction can buffer output before delivery. Decoding and text preservation explains the representation boundary. A delivered text fragment can contain several tokens or only part of their eventual printable text.
| Event | What it establishes |
|---|---|
| Token ID selected | Generation has advanced; printable text need not yet be available. |
| Text fragment queued | A downstream consumer can retrieve text; client receipt is a later boundary. |
| Client receives a chunk | Content has arrived, but chunk timing cannot reveal every internal token interval. |
Abort and cleanup are separate
ExampleTerminal status can precede ownership release.
Execution may write blocks.
Read the diagram as text
- Request R.
- R’s block group.
- Running.
- Abort handled.
- Cleanup pending.
- Writer finished.
- R’s ownership released.
- Request R → Running: status.
- Request R → Abort handled: terminal status.
- Request R → R’s block group: associated state.
- R’s block group → Cleanup pending: release blocked.
- R’s block group → Writer finished: safe-release condition.
- R’s block group → R’s ownership released: ownership.
- Active. Execution may write blocks. Active: Request R, R’s block group, Running. New: Request R, R’s block group, Running.
- Abort handled. No further scheduling; cleanup waits. Active: Request R, R’s block group, Abort handled, Cleanup pending. New: Abort handled, Cleanup pending.
- Writer finishes. Deferred release becomes safe. Active: Request R, R’s block group, Abort handled, Writer finished. New: Writer finished.
- Release. R relinquishes its references. Active: Request R, R’s block group, Abort handled, R’s ownership released. New: R’s ownership released.
Stop-string handling can intentionally delay text. The inspected vLLM detokenizer withholds a suffix while checking whether it completes a stop string. Generated token IDs and returned text can therefore account for different content, even without network delay.
Backpressure means downstream slowdown constrains upstream production. A slow consumer can instead merely accumulate queued output. Buffering alone establishes neither bounded queues nor producer throttling; those behaviors require evidence from the deployed delivery path.
Cancellation must reach request scheduling. Queued work can be removed; active work must stop receiving further scheduling. Cleanup may wait for an in-flight operation that can still write cache blocks. A disconnected client, terminal request status, and released ownership are therefore distinct observations.
KV state and the resident memory budget
Attention keys provide matching features; values provide the information combined using those matches. The KV cache stores these numerical representations, not conversation text or durable records. Queries, keys, values and information mixing explains their roles. Shared weights describe learned transformations; cached representations depend on processed context.
High-bandwidth memory, or HBM, is accelerator-local memory on hardware that provides it. Capacity measures stored bytes; bandwidth measures transferred bytes per second. Enough capacity to hold a model does not imply enough bandwidth to execute it quickly.
For 32 layers, cached head dimensions totaling 4096 per layer, 4096 retained positions, and two-byte values, one sequence needs 2 × 32 × 4096 × 4096 × 2 = 2,147,483,648 bytes, or 2 GiB. Doubling retained positions doubles these tensor bytes. Cached dimensions need not equal model width in other architectures.
Weights occupy only one allocation. Serving also needs temporary activations, execution workspaces, runtime and communication buffers, and room for transient peaks. Framework-reserved memory and live tensors overlap in accounting; adding them blindly double-counts consumption.
| Allocation | Budget |
|---|---|
| Weights | 14 GiB |
| Other allocations and headroom | 4 GiB |
| Remaining for KV storage | 6 GiB: at most three such unshared tensor sets before additional cache overhead |
This storage ceiling is not validated concurrency. Representative forward-pass profiling and runtime allocation measurements must establish the actual cache budget; graph storage and transient peaks can reduce it further.
Retained history and allocated slots also differ. A static cache reserves capacity; a dynamic cache grows. Windowed layers can retain less history than the total sequence length. Neither allocating more slots nor changing reservation strategy extends the model’s supported positional range.
Quantization uses lower-precision numerical representations. Weight precision and KV precision affect different allocations. Storage dtype, arithmetic dtype, and device placement are separate choices; reducing weight bytes does not halve all serving memory or latency. Quantization covers numerical methods and quality tradeoffs. Supported kernels and workload-specific validation determine whether a smaller representation helps.
Cache blocks and compatible prefix reuse
Reserving contiguous maximum-length caches wastes space for short sequences and can fragment available memory. PagedAttention maps logical token positions to fixed-size physical KV blocks allocated as needed. Partial blocks can still waste space. This is tensor-storage organization, not automatic disk spill or ordinary CPU paging.
Prefix caching reuses compatible prompt computation across requests; it does not return a cached answer. Matching meaning is insufficient. New continuation tokens still require generation, so long outputs can limit the fraction of latency saved. An HTTP interface alone neither promises nor prevents server-side reuse.
One allocation, multiple owners
ExampleOne request’s completion cannot release another’s state.
One shared allocation; separate suffixes.
Read the diagram as text
- Request A.
- Request B.
- Physical prefix block P.
- A’s private suffix.
- B’s private suffix.
- Held by A and B.
- Held by B.
- Unreferenced; reusable.
- Request A → Held by A and B: owns.
- Request B → Held by A and B: owns.
- Held by A and B → Physical prefix block P: references.
- Request B → Held by B: owns.
- Held by B → Physical prefix block P: references.
- Request A → A’s private suffix: private state.
- Request B → B’s private suffix: private state.
- Physical prefix block P → Unreferenced; reusable: release state.
- Both active. One shared allocation; separate suffixes. Active: Request A, Request B, Physical prefix block P, A’s private suffix, B’s private suffix, Held by A and B. New: Request A, Request B, Physical prefix block P, A’s private suffix, B’s private suffix, Held by A and B.
- A cleaned up. B still protects P. Active: Request A, Request B, Physical prefix block P, B’s private suffix, Held by B. New: Held by B.
- B cleaned up. P becomes overwrite-eligible. Active: Request A, Request B, Physical prefix block P, Unreferenced; reusable. New: Unreferenced; reusable.
Within a compatible engine and model configuration, reuse identity must preserve preceding context and relevant execution inputs. vLLM’s documented block identity includes the parent hash, exact block tokens, and identifiers such as adapters or multimodal content hashes. Thus an identical suffix does not imply identical state. Cache salts restrict matching but are not independently an authorization mechanism.
Shared blocks require shared ownership accounting. Finishing one request cannot make a block available for overwrite while another request still references it. Once references reach zero, cached contents may remain reusable until eviction. Releasing ownership is different from erasing data.
Dynamic allocation follows growth; static allocation reserves a maximum shape that can support compilation but wastes space on shorter sequences. Offloading moves cache state through host memory, trading accelerator capacity for transfers. Cache quantization reduces precision and storage, yet can add latency when short contexts already fit.
Retaining more cached context also requires fast writes and retrieval. A large storage tier can leave accelerators waiting if it cannot deliver useful state promptly. Capacity beyond the workload’s useful reuse horizon has diminishing benefit.
Compute, memory movement, and execution overhead
A capacity limit prevents required state from fitting. A bandwidth limit delays moving operands. A compute limit delays arithmetic. Arithmetic intensity is operations performed per transferred byte at a specified memory level. Processing more positions together can increase operand reuse, changing which limit matters.
The roofline model expresses the corresponding throughput envelope. Actual execution can fall below it through insufficient parallelism or other inefficiencies. Find the limiting resource connects this model to traces and counters rather than treating peak specifications as predicted request performance.
Prefill often offers more parallel arithmetic; small-batch decode often depends strongly on memory bandwidth. Neither is universal. Batch size, architecture, retained context, and implementation change the balance. Longer histories add retained-state traffic even when the weights remain unchanged.
A kernel is an operation executed on the device; a launch is its host-side submission. CPU preparation and dispatch can leave gaps between GPU operations. Compute, operand movement, and host overhead need distinct evidence before choosing an optimization.
Optimizations target different costs. FlashAttention reduces attention data movement through IO-aware tiling while retaining the exact attention algorithm. Exactness here does not promise bit-identical floating-point results across implementations.
CUDA graph replay reduces repeated host setup and launch overhead by preparing a dependency graph for repeated execution. It does not remove GPU computation. Configuring graph support is insufficient evidence that the measured request actually followed that execution path.
Whole-pipeline profiling can overturn a GPU-focused diagnosis. In the Orpheus serving example, token prediction and audio decoding ran on the GPU, yet CPU coordination limited simultaneous streams in some workloads. Device placement alone does not identify the limiting resource.
Batching independent requests
A batch is work executed together, not every outstanding request. Continuous batching changes membership between generation iterations, allowing completed sequences to leave while others continue. New requests still need their own prompt processing.
| Policy | Membership and waiting |
|---|---|
| Fixed batch | A fixed group finishes before replacement; shorter sequences cannot independently admit new members. |
| Dynamic batch formation | Dispatch waits briefly for a suitable batch or a formation timeout. Triton’s ordinary dynamic batcher targets stateless calls. |
| Continuous batching | Membership can change between autoregressive iterations, without waiting for the longest sequence to finish. |
Replacement without waiting for B
ExampleBatch membership can change between iterations.
C waits.
Read the diagram as text
- Request A.
- Request B.
- Request C.
- A running.
- A finished.
- B running.
- C waiting.
- C admitted.
- Request A → A running: status.
- Request A → A finished: status.
- Request B → B running: status.
- Request C → C waiting: status.
- Request C → C admitted: status.
- A and B execute. C waits. Active: Request A, Request B, Request C, A running, B running, C waiting. New: Request A, Request B, Request C, A running, B running, C waiting.
- A finishes. B remains active. Active: Request A, Request B, Request C, A finished, B running, C waiting. New: A finished.
- C admitted. Available budgets permit prompt work. Active: Request A, Request B, Request C, A finished, B running, C admitted. New: C admitted.
Shared execution can reuse weights across useful work. Padding fills unused positions; packing organizes useful positions without that filler. Consequently, sequence count alone does not describe the computation or memory traffic of a batch.
A sequence limit bounds participating requests; a token budget bounds positions scheduled in an iteration. A prompt can contribute many positions while an ordinary decode step contributes one per continuing sequence. Changing that mixture changes execution shape and the demand on cache memory.
Aggregate tokens per second can increase while each request progresses more slowly. Batch formation adds initial waiting, and shared execution can lengthen continuation intervals. Sweep batch settings against both user-visible latency and total throughput instead of assuming that higher utilization benefits every request.
Scheduling prompt work and continuing streams
A long prefill can delay a continuing stream when both compete for execution. Chunked prefill divides prompt processing across scheduling opportunities. The benefit is shorter interruptions; the cost can include later prompt completion and repeated state access or scheduling work.
One documented policy schedules decode first and uses remaining token budget for prefill chunks. Smaller budgets can favor continuation latency; larger budgets can favor prompt completion and throughput. These are workload-dependent tendencies, not an ordering that dominates every alternative.
Uninterrupted prompt work
Example timingsThe active stream waits through the entire prefill.
Read the diagram as text
- Shared execution window. 0 to 10 ms; duration 10 ms.
- B: decode step. 0 to 1 ms; duration 1 ms. Parent: Shared execution window.
- New prompt: full prefill. 1 to 9 ms; duration 8 ms. Parent: Shared execution window.
- B: next decode step. 9 to 10 ms; duration 1 ms. Parent: Shared execution window.
Prompt work split into chunks
Example timingsEarlier continuation trades against later prompt completion.
Read the diagram as text
- Shared execution window. 0 to 10 ms; duration 10 ms.
- B: decode step. 0 to 1 ms; duration 1 ms. Parent: Shared execution window.
- New prompt: first chunk. 1 to 5 ms; duration 4 ms. Parent: Shared execution window.
- B: next decode step. 5 to 6 ms; duration 1 ms. Parent: Shared execution window.
- New prompt: remaining chunk. 6 to 10 ms; duration 4 ms. Parent: Shared execution window.
Priority lets some waiting requests bypass others. Starvation occurs when a request keeps losing scheduling opportunities. Continuous batching and priority support do not establish a fairness bound; a service needs an explicit policy for sustained competing traffic.
Unknown output lengths make admission provisional: cache demand grows during generation. Preemption temporarily removes running work from execution; the inspected scheduler can return it to waiting and later recompute discarded state.
Separating prefill and decode across workers changes placement and communication as well as scheduling. Distributed Training and Inference covers that architecture; within-instance scheduling still needs explicit resource and latency priorities.
Queueing and sustainable capacity
Goodput here means completed requests meeting the declared per-request latency criteria per benchmark second. It differs from raw completions and excludes errors or rejections. Timely completions can still be wrong answers.
Raw throughput can hide overload
ExampleCompliant completions can decline while raw throughput stays flat.
Fixed workload and configuration
128 input and 64 output tokens; warm execution. Compliance: TTFT ≤1,000 ms and TPOT ≤50 ms.
Scroll sideways if the figure extends beyond the screen.
- 1. All completions
- 2. SLO-compliant completions
Read coordinates and regions as data
X: 0–13 requests/s; Y: 0–10 requests/s, increasing up. Equal scale on both axes.
(4, 4); (8, 8); (10, 9); (12, 9)
(4, 4); (8, 8); (10, 8.4); (12, 6.5)
The following constructed comparison fixes hardware, warm execution, 128 input tokens, and 64 output tokens. Each trial starts empty and observes 60 seconds. Compliance requires TTFT at most 1,000 ms and TPOT at most 50 ms. No cancellation or execution errors occur.
| Offered req/s | Completed / compliant | Rejected / unfinished | Waiting at end | p99 TTFT / TPOT, ms |
|---|---|---|---|---|
| 4 | 240 / 240 | 0 / 0 | 0 | 300 / 20 |
| 8 | 480 / 480 | 0 / 0 | 0 | 800 / 40 |
| 10 | 540 / 504 | 0 / 60 | 56 | 2,400 / 80 |
| 12 | 540 / 390 | 60 / 120 | 116 | 5,000 / 120 |
Bounded queues and admission limits make overload explicit. Resource-aware limits matter because requests have unequal costs. Rejection prevents unlimited waiting; degradation reduces work but must expose reduced completeness. Output caps bound generation while potentially truncating useful answers.
Serving experiments and diagnosis
- Execution identity — Record model and tokenizer revisions, runtime version, hardware, precision, sampling, stopping, seeds, and scheduling conditions. Compare configurations within an explicit reproducibility boundary.
- Workload and observation — Record joint input/output lengths, concurrency or request rate, warmup, duration, repetitions, and metric boundaries. Keep throughput units explicit.
- Cache conditions — Record retained working set and access pattern. Sequential replay and sampling across an expanding user pool stress cache tiers differently; neither automatically represents production.
A closed-loop test waits for replies before issuing replacement work, often maintaining fixed concurrency. An open-loop test schedules arrivals independently. As responses slow, a closed-loop client reduces its own offered rate; an open-loop test can expose growing outstanding work and explicit overload.
Coordinated omission hides delay when stalled issuance removes work or starts its latency clock too late. Record scheduled arrival separately from actual send and completion. MLPerf LoadGen preserves scheduled timestamps so client issuance delay remains visible instead of disappearing from the measured residence time.
Worker startup can include moving weights from storage through host memory into accelerator memory. Separate this from steady execution. Warmup is another condition: initialization and compilation effects should not be silently mixed with warmed measurements.
A warm worker can still receive a cold prefix. Compare cold-prefix and reused-prefix workloads with unchanged request shapes, documented cache reset or isolation, and observed hits. Merely repeating requests does not establish which retained state the server used.
| Symptom | Competing causes | Discriminating evidence and bounded change |
|---|---|---|
| Long first-content latency | Prompt length, batching, or scheduling delay | Compare matched lengths under load; change the implicated waiting or execution policy. |
| Slow continuation | Resource limits or interference from prompt work | Locate stalls relative to prefill; test a scheduling change with unchanged request shapes. |
| Cache allocation failure | Insufficient budget after non-KV allocations and peaks | Profile representative shapes and graph storage before reducing admitted state or changing memory allocation. |
| Generated output appears late | Detokenization or stop-string buffering | Compare generated IDs with released text before changing model execution. |
| Unexpectedly low measured throughput | Server limit or saturated load generator | Check achieved sends and client capacity; remote timing also contains network effects. |
Inspect execution and memory traces when aggregate profiles leave the cause ambiguous. Redundant launches and idle gaps can explain poor utilization without changing model arithmetic. The useful observation connects a specific interval or allocation to a proposed intervention.
A kernel speedup needs correct execution timing, appropriate input sizes, controlled cache conditions, and an explicit numerical tolerance. Establish correctness and meaningful timing covers those requirements; a faster isolated operation is not yet a serving improvement.
Accept a serving change against matched workload results: latency distributions, completed throughput, errors, rejections, unfinished work, and memory behavior. Evaluate answer quality separately through Controlled offline comparisons. AI Cost and Performance Engineering extends the decision to cost attribution and utilization.
Open questions
Bounded streaming under slow consumers remains deployment-specific. Uncontrolled buffering wastes memory and computation; throttling can instead disrupt execution sharing. Progress requires traces showing delivery-queue bounds, producer response, and disconnect-to-abort behavior under deliberately slow consumption.
Portable KV reuse needs a compatibility contract beyond matching text. Model revisions, positional settings, adapters, and tensor representations can change state meaning. Progress would include explicit compatibility checks and equivalence tests that reject incompatible persisted caches before reuse.
Fair scheduling remains difficult when output lengths are unknown and priority traffic persists. Protecting existing streams can delay new prompts indefinitely. Progress requires a stated waiting or service-share bound, tested under sustained mixed traffic without hiding rejected requests.
Cache retention needs evaluation against changing reuse patterns. Additional capacity can improve hits while slow retrieval erases the benefit. Progress requires controlled cold and reused-prefix trials, measured hits, and joint latency, memory, and completion accounting across a changing working set.























































































































































