Inferensys

Glossary

Iteration Time

Iteration time is the latency of a single forward pass of a neural network, which during autoregressive decoding corresponds to the time taken to generate one token per sequence in the active batch.
Performance engineer optimizing AI latency on laptop, latency charts visible, technical optimization session.
CONTINUOUS BATCHING

What is Iteration Time?

A core performance metric in autoregressive inference, iteration time measures the latency of a single forward pass through a model.

Iteration time is the latency of a single forward pass of a neural network model. In the context of autoregressive decoding for large language models (LLMs), this corresponds to the time required to generate one new output token for every sequence currently active in the batch. It is the fundamental unit of work in the token-by-token generation loop and is a primary determinant of both throughput and per-token latency for interactive applications.

This metric is heavily influenced by the active batch size and the model's memory bandwidth consumption. During the decoding phase, iteration time is often memory-bound, as each step involves reading the entire model's key-value (KV) cache and weights to produce the next token. Optimization techniques like continuous batching aim to maximize GPU utilization by keeping iteration time consistent and high, ensuring the processor is never idle waiting for new requests to batch.

INFERENCE OPTIMIZATION

Key Characteristics of Iteration Time

Iteration time is the latency of a single forward pass of the model, which in the decoding phase corresponds to the time taken to generate one token for each sequence in the active batch. Its characteristics define the fundamental cadence of autoregressive generation.

01

Primary Determinant of Token Generation Rate

Iteration time is the inverse of token generation throughput for a fixed batch size. If the iteration time is 50 milliseconds, the system generates 20 tokens per second per sequence in the batch. This relationship is linear: halving the iteration time doubles the token output rate, making it the most direct metric for evaluating decoding speed.

  • Throughput Formula: Tokens/sec/sequence = 1000 ms / Iteration Time (ms)
  • Batch Impact: Total system throughput = (Batch Size * 1000) / Iteration Time (ms)
02

Memory-Bound in the Decoding Phase

During autoregressive decoding, iteration time is dominated by memory bandwidth, not compute. Each step performs a small matrix-vector multiplication to generate the next token, but must load the entire key-value (KV) cache from high-bandwidth memory (HBM). The time is largely spent waiting for data.

  • Bottleneck: Speed of reading the KV cache and model weights.
  • Implication: Optimizations like KV cache quantization or improved memory access patterns have a greater impact on iteration time than increasing FLOPs.
03

Directly Proportional to Sequence Length

Iteration time increases linearly with the total context length of all sequences in the batch due to the size of the KV cache. Processing a batch with 10 sequences of length 1000 requires accessing 10x more cached data than a batch with 10 sequences of length 100.

  • Cache Size: KV cache memory ~= 2 * batch_size * num_layers * num_heads * d_head * seq_len
  • Performance Impact: Longer sequences increase memory traffic per iteration, slowing down each step. Techniques like paged attention help mitigate this by organizing memory more efficiently.
04

Governed by the Slowest Operation in the Pipeline

The iteration time for a batch is set by the critical path—the slowest sequence or operation in that forward pass. If one sequence requires a specialized kernel or hits a memory bottleneck, it stalls the entire batch. This is a key challenge for variable-length batching.

  • Synchronization Point: GPU execution is synchronous within a batch; all sequences must finish the forward pass before the next iteration begins.
  • Optimization Target: Minimizing variance in per-sequence processing time through efficient kernels and memory layouts is essential for low, predictable iteration time.
05

Independent of Prefill Latency

Iteration time is a property of the decoding loop, separate from the initial prefill phase. Prefill is a single, compute-intensive parallel processing of the prompt. Decoding is many sequential, memory-bound steps. They are optimized differently.

  • Prefill Phase: High FLOP utilization, processes the entire prompt at once.
  • Decoding Phase: Characterized by iteration time; generates tokens auto-regressively.
  • System Design: High-performance servers often use separate hardware queues or scheduling policies for prefill vs. decode requests.
06

Key Input for Latency Calculations

For any request, the total time-to-first-token (TTFT) and time-per-output-token (TPOT) can be derived from iteration time and scheduling behavior.

  • TTFT: = Prefill Latency + Queueing Delay.
  • TPOT: ≈ Iteration Time (when batch composition is stable).
  • Total Latency: = TTFT + (Output Token Count - 1) * TPOT.

Engineers use iteration time to model and guarantee service-level objectives (SLOs) for interactive applications like chatbots, where TPOT directly impacts user perception.

CONTINUOUS BATCHING

How Iteration Time Works in Inference

Iteration time is a core latency metric for autoregressive language model inference, directly measuring the speed of the token-by-token generation loop.

Iteration time is the latency of a single forward pass of a model during the decoding phase, corresponding to the time taken to generate one new token for each active sequence in the batch. This metric is the fundamental unit of progress in autoregressive generation, where each iteration consumes the previous output token to produce the next. It is primarily constrained by memory bandwidth as the model reads its parameters and the cached key-value (KV) states for every generated token.

Optimizing iteration time is critical for reducing per-token latency and improving the responsiveness of interactive applications like chatbots. Techniques like continuous batching, which maximizes GPU utilization by dynamically managing the active batch, and KV cache optimization, which reduces memory traffic, directly target this bottleneck. In a well-tuned system, iteration time remains stable even as batch composition changes, ensuring predictable performance.

SYSTEM COMPONENTS

Factors Affecting Iteration Time

A comparison of primary system components and their impact on the latency of a single model forward pass (iteration time).

Component / FactorHigh ImpactMedium ImpactLow Impact

Model Size (Parameters)

Sequence Length (Context)

Hardware (GPU/TPU Type)

Numerical Precision (e.g., FP16 vs. INT8)

Batch Size

Memory Bandwidth (HBM)

Kernel Launch Overhead

Host-to-Device Data Transfer

Software Framework & Kernel Optimization

Network Latency (for Distributed Inference)

System Software (Driver Version)

ITERATION TIME

Frequently Asked Questions

Iteration time is a core latency metric in autoregressive model inference, directly impacting user experience and system throughput. These questions address its definition, measurement, and optimization.

Iteration time is the latency of a single forward pass of a neural network during inference, which, in the decoding phase of an autoregressive model, corresponds to the time taken to generate one new token for each sequence in the currently active batch.

This metric is distinct from end-to-end latency (the total time for a full request) and throughput (tokens generated per second). It is a fundamental determinant of the perceived responsiveness of interactive applications like chatbots. Iteration time is primarily governed by the time to compute the model's attention mechanism and feed-forward layers, and to read/write the key-value (KV) cache from high-bandwidth memory.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.