Inferensys

Glossary

Tokens Per Second (TPS)

Tokens Per Second (TPS) is a throughput metric for autoregressive language models that measures the total number of output tokens generated across all concurrent requests in one second.
ML engineer running AI model benchmarks, performance charts on multiple screens, late night home office setup.
INFERENCE PERFORMANCE METRIC

What is Tokens Per Second (TPS)?

Tokens Per Second (TPS) is the definitive throughput metric for autoregressive language models, measuring the total number of output tokens generated across all concurrent requests in a one-second interval.

Tokens Per Second (TPS) quantifies the raw generative capacity of a language model inference system. It is calculated by dividing the total number of output tokens produced by the aggregate time taken to generate them. This metric is distinct from Queries Per Second (QPS), as TPS accounts for variable output lengths, making it essential for comparing systems where requests generate different amounts of text. High TPS indicates efficient hardware utilization and optimized software kernels, directly correlating to lower operational costs per token.

In performance analysis, TPS must be evaluated alongside latency metrics like Time to First Token (TTFT) and Time per Output Token (TPOT). A system can achieve high TPS under heavy continuous batching loads but may suffer increased latency for individual requests. Engineers use TPS to size infrastructure, model the throughput-latency curve, and establish Service Level Objectives (SLOs). It is a core measurement in benchmarks like MLPerf Inference for comparing the efficiency of different hardware accelerators and inference engines.

INFERENCE PERFORMANCE METRIC

Key Characteristics of TPS

Tokens Per Second (TPS) is the primary throughput metric for autoregressive language models, measuring the total output tokens generated across all concurrent requests in one second. It is a composite metric directly influenced by system architecture, model efficiency, and request patterns.

01

Definition and Core Formula

Tokens Per Second (TPS) is calculated as the total number of output tokens generated divided by the total wall-clock time measured in seconds. The formula is:

TPS = (Total Output Tokens) / (Measurement Window in Seconds)

  • Total Output Tokens: Sum of all tokens generated for all completed requests during the measurement period.
  • Measurement Window: A sustained period of steady-state inference, excluding cold-start phases.
  • This differs from Time per Output Token (TPOT), which is a latency metric (seconds/token). High TPS requires optimizing both low TPOT and efficient concurrent processing.
02

Relationship to Latency and Concurrency

TPS is intrinsically linked to latency metrics and the level of request concurrency. Under ideal conditions, the relationship can be approximated by Little's Law: TPS ≈ Concurrency / TPOT.

  • High Concurrency, Fixed TPOT: Increasing the number of concurrent requests typically increases TPS until a system bottleneck (e.g., memory bandwidth) is reached.
  • Latency-Tradeoff: As concurrency increases to boost TPS, Tail Latency (P99) often degrades due to resource contention and queueing delays.
  • Saturation Point: The maximum achievable TPS occurs at the system's saturation point, beyond which latency increases exponentially without TPS gains. Performance profiling involves tracing the Throughput-Latency Curve to identify this optimal operating point.
03

Primary System Bottlenecks

Achieving high TPS requires eliminating sequential bottlenecks in the inference pipeline. The major constraints are:

  • Memory Bandwidth (Memory-Bound): The dominant bottleneck for autoregressive decoding. Each generated token requires loading the model's Key-Value (KV) Cache and weights from GPU memory. Techniques like KV Cache Management and quantization aim to reduce this pressure.
  • Compute Capacity (Compute-Bound): For very large models or complex operations, the limit becomes the processor's FLOPs. This is analyzed using models like the Roofline Model.
  • Scheduling Overhead: Inefficient Continuous Batching can lead to GPU idle time, directly capping TPS. Optimal batching dynamically groups requests to maximize GPU Utilization.
  • I/O and Pre/Post-Processing: Tokenization, detokenization, and network serialization can become bottlenecks at very high TPS, shifting the limit from the GPU to the CPU or network.
04

Optimization Techniques

Maximizing TPS is the goal of Inference Optimization. Key techniques include:

  • Continuous Batching: Dynamically groups requests of varying lengths to minimize padding and keep GPU compute units saturated, dramatically improving TPS over static batching.
  • KV Cache Optimization: Methods like paged attention manage the cache efficiently to support more concurrent sequences, directly increasing TPS.
  • Model Quantization: Reducing weight precision (e.g., to FP16, INT8) via Post-Training Quantization decreases memory bandwidth consumption and increases compute efficiency, boosting TPS.
  • Speculative Decoding: Uses a small draft model to propose multiple tokens which are then verified in parallel by the large target model, effectively reducing the average TPOT and increasing TPS.
  • Operator/Kernel Fusion: Combines multiple low-level operations into a single optimized GPU kernel, reducing launch overhead and increasing computational density.
05

Measurement and Benchmarking

Accurate TPS measurement requires controlled, reproducible conditions to establish a valid Performance Baseline.

  • Steady-State Measurement: TPS should be measured after the Cold Start Latency period, when caches are warm and performance is stable.
  • Defined Workload: Use either a Synthetic Workload (e.g., fixed prompt/output length distribution) or a representative Real-World Workload. The workload defines the Average Tokens Per Request.
  • Industry Benchmarks: MLPerf Inference provides standardized benchmarks for comparing TPS across different systems and software stacks under fair conditions.
  • Load Testing: Gradually increasing concurrent request load while measuring TPS and latency reveals the system's Throughput-Latency Curve and saturation point.
06

TPS vs. Other Throughput Metrics

TPS is specific to token-generating models. It must be distinguished from related throughput metrics:

  • Queries Per Second (QPS): Measures complete requests per second. QPS = TPS / (Average Output Tokens per Request). QPS is useful for cost-per-request analysis but obscures the computational cost of long generations.
  • Inferences Per Second (IPS): A general metric for non-LLM models (e.g., classification). For LLMs, one 'inference' can generate many tokens, making IPS less precise than TPS.
  • Context: TPS measures output generation speed. The processing of input prompts (affecting Time to First Token) is a separate cost. High TPS systems must also optimize prompt processing to maintain low TTFT under concurrency.
MEASUREMENT AND OPTIMIZATION

How is TPS Measured and Influenced?

Tokens Per Second (TPS) is a critical throughput metric for language models, but its measurement is nuanced and its value is highly dependent on system configuration and workload characteristics.

TPS is measured by dividing the total number of output tokens generated across all concurrent requests by the total wall-clock time of the measurement window. This aggregate metric is distinct from the inverse of Time per Output Token (TPOT), which measures per-request latency. Accurate TPS benchmarking requires a steady-state performance period, excluding cold start latency, and must account for variable output lengths using a synthetic workload or real-world workload trace. The resulting throughput-latency curve reveals the saturation point where maximum TPS is achieved before latency degrades exponentially.

TPS is primarily influenced by compute-bound matrix multiplications in the transformer's attention and feed-forward layers. Optimization focuses on maximizing hardware utilization of GPU/TPU resources through techniques like continuous batching and KV cache management to reduce memory overhead. Model quantization and operator fusion decrease computational intensity, directly boosting TPS. The metric is also constrained by memory bandwidth for loading weights and resource contention from concurrent requests. Ultimately, TPS represents a trade-off against tail latency (P99), as maximizing throughput often increases latency variance.

TOKENS PER SECOND (TPS)

Frequently Asked Questions

Tokens Per Second is a critical throughput metric for language models. This FAQ addresses common technical questions about its measurement, optimization, and relationship to other performance indicators.

Tokens Per Second is a throughput metric that measures the total number of output tokens a language model inference system can generate across all concurrent requests in one second. It is calculated by dividing the total number of tokens generated during a benchmark run by the total elapsed time of that run. For accurate measurement, systems are typically brought to steady-state performance under a sustained load that represents a real-world workload. Key factors influencing TPS include batch size, model architecture, hardware acceleration, and the efficiency of the inference server (e.g., vLLM, TensorRT-LLM). It is distinct from Time per Output Token (TPOT), which measures incremental latency, and Queries Per Second (QPS), which counts complete requests regardless of output length.

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.