Learn how inference providers improve GPU tokens per second through caching, routing, and scheduling, with DeepInfra examples and practical benchmarking tips.
Inference providers maximize GPU tokens per second by reducing redundant computation, improving memory use, and scheduling work around workload demands. Caching, cache-aware routing, memory management, and scheduling work together, balancing latency and output quality tradeoffs. Aggregate throughput differs from individual user generation speed. This guide separates these metrics in a dedicated measurement section and distinguishes developer-side changes from infrastructure responsibilities. DeepInfra is used as the provider illustration, clearly separating documented public capabilities from general serving techniques explained here, without claiming implementation of every technique.
LLM inference optimization improves how serving software uses GPU compute and memory to process prompts and generate responses. It involves two distinct phases: prefill, which processes prompt tokens with substantial parallel computation, and autoregressive decode, which generates output tokens conditioned on prior context. The key-value (KV) cache stores attention keys and values for retained tokens, avoiding recomputation of earlier tokens’ keys and values. KV storage grows with sequence length, concurrency, model dimensions, and storage precision, and is a major serving concurrency constraint distinct from model weights.
DeepInfra publicly describes owning and operating GPU infrastructure and co-designing hardware, inference software, and APIs. This illustrates why inference optimization extends beyond model or GPU choice: hardware and software must work together around compute and memory demands. It does not imply every serving technique is implemented on every DeepInfra endpoint.
Raw GPU capacity alone does not explain efficient handling of retained context and simultaneous requests. KV cache storage grows with sequence length and concurrency, making memory capacity a dynamic constraint alongside model weights. Prefill and decode phases compete for execution resources, potentially delaying each other. Efficient serving balances aggregate throughput with first-token and per-token latency objectives.
A fast isolated request does not guarantee performance under concurrency, where queueing and competing work increase latency. Benchmarks must include waiting time to avoid understating experienced latency. DeepInfra offers token-priced inference and separately billed own-model deployments with uptime-based billing and automatic scaling, providing deployment and billing context for evaluating GPU efficiency, but performance must be evaluated against workload concurrency and latency requirements.
GPU inference bottlenecks include growing attention state, repeated prompt processing, competing execution phases, and request queues. DeepInfra documents automatic prompt caching on supported models to reduce repeated work. Other approaches below describe general infrastructure techniques rather than specific DeepInfra implementations.
Problem 1, KV-memory growth and fragmentation. KV cache memory grows with sequence length and concurrency, limiting serving capacity. PagedAttention divides KV state into fixed-size blocks allocated as sequences grow, reducing fragmentation and fitting more requests. Partially filled blocks and management overhead remain.
Problem 2, Repeated shared-prefix computation. Requests with identical prefixes can reuse computed KV state, avoiding repeated prefill work but not decoding. DeepInfra’s supported models cache matching prefixes automatically, reducing first-token latency and input cost. Stable prefixes must be identical across requests.
Problem 3, Prefill/decode interference. Sharing execution resources can cause long prefills to delay decoding and vice versa. Remedies include chunked prefill-splitting prompts into smaller units interleaved with decode-and disaggregated serving-separating prefill and decode into distinct resource pools for independent optimization.
Problem 4, Saturation-driven queueing. Under load, requests queue and prefill/decode compete, increasing latency. Caching reduces prompt computation but does not eliminate capacity limits or decoding time. Balancing load against capacity and measuring latency including waiting time are essential.
Start with observable bottlenecks. Use stable prefixes for prompt caching on supported DeepInfra models. Treat block allocation, scheduling, phase separation, and capacity management as infrastructure-level remedies, distinct from prompt caching capabilities.
“Tokens per second” can describe either a single user's generation rate or overall system output under load. Responsiveness and capacity must be evaluated separately. A provider may appear fast on isolated requests but slow under concurrency due to saturation and queueing.
Avoid coordinated omission by including queue waiting time in measurements. Align token-count conventions (e.g., first token types) when comparing providers.
DeepInfra documents tokens_per_second, time_to_first_token, and requests_per_second, plus prompt, completion, token counts, and estimated cost. Dedicated deployments add average TTFT, token times, and errors. Verify aggregation and timing semantics before comparing benchmarks.
Providers increase GPU throughput by reducing redundant computation, improving memory efficiency, and scheduling requests to keep resources productive. These techniques involve latency and quality tradeoffs and vary by workload. Public engine implementations like vLLM, SGLang, and TensorRT-LLM illustrate these mechanisms-not specific provider deployments.
DeepInfra co-designs hardware, software, and APIs, controlling layers where these optimizations apply. It documents automatic prompt caching on supported models-stable prefixes reuse KV state reducing first-token latency and input cost. DeepInfra also publicly describes TensorRT-LLM, NVIDIA Dynamo, KV-aware routing, disaggregated serving, speculative decoding, and lower-precision inference in its engineering posts. Availability and configuration remain model- and endpoint-specific.
DeepInfra documentation describes automatic prompt caching and API controls to limit and format outputs, offering developers practical ways to reduce repeated prefill work and unnecessary generation without changing providers. Model capabilities vary; verify support before relying on parameters.
Tip 1, Keep reusable content in a stable prefix. Place fixed system instructions and reusable context before variable user content. Identical prefixes enable prompt caching, reducing prefill work and first-token latency but not decoding.
Tip 2, Ask for only the answer length you need. Request concise answers or bounded lists to avoid generating unnecessary tokens, saving generation time.
Tip 3, Set appropriate token caps and stop sequences. Use maximum token limits and stop sequences to bound generation appropriately; verify support per model.
Tip 4, Use supported structured outputs. Where available, specify response formats like JSON schemas for correctness. Benchmark effects on speed as impacts vary.
Tip 5, Stream for earlier consumption and measure separately. Streaming delivers output sooner but does not speed GPU generation. Measure TTFT, inter-token latency, and final latency distinctly.
Tip 6, Tune concurrency against throughput and latency. Test simultaneous request levels, comparing aggregate throughput and latency distributions (p50, p99). More concurrency is not always better.
These are application-level controls; infrastructure decisions on KV allocation, scheduling, precision, and execution remain provider responsibilities.
Inference optimizations address diverse bottlenecks; benefits depend on workload conditions and are not universal guarantees.
1. Prefix reuse: less prefill work and lower input cost. DeepInfra’s automatic prompt caching reuses KV state for matching prefixes, reducing first-token latency and input cost but not decoding time. Stable prefixes are essential.
2. Paged KV allocation: more requests within memory budget. Allocating KV cache in fixed-size blocks reduces fragmentation, fitting more requests. Partial block utilization and management overhead limit efficiency.
3. Continuous batching: better GPU utilization. Interleaving active requests improves utilization but increasing batch sizes eventually saturates resources and can increase latency.
4. Disaggregation: independent prefill and decode scaling. Separate worker pools optimize each phase, trading off KV-transfer overhead and interconnect capacity.
5. Quantization and speculation: less memory traffic or fewer decoding iterations. Quantization reduces storage and compute demands; speculation reduces decoding steps. Quantization can affect output quality; speculative decoding gains depend on draft acceptance and verification overhead.
DeepInfra links prefix reuse to cached-input pricing benefits; other benefits are explained generally without specific savings claims.
DeepInfra owns and operates GPU infrastructure and co-designs hardware, inference software, and APIs, enabling optimization across the serving stack. This does not confirm which caching, routing, precision, or scheduling techniques run on any particular endpoint.
For supported models, automatic prompt caching reuses KV state for matching prefixes, reducing prefill work and time to first token. Developers should keep stable prefixes identical and place variable content afterward.
Cached-input pricing is distinct from uncached input, reflecting avoided input processing rather than output token discounts; pricing and cache policies vary by model.
API documentation includes parameters like max_tokens, stop sequences, response formats, and tool-calling, subject to model support. Verify capabilities per model.
Measurement fields include prompt, completion, total-token counts, estimated cost, tokens_per_second, time_to_first_token, and requests_per_second. Dedicated deployments add averages and errors. Verify timing and aggregation semantics before benchmarking.
Deployment options include token-priced inference and own-model deployments with uptime billing and automatic scaling, plus GPU rental and managed clusters. These provide varied consumption models without implying specific scheduling implementations.
API controls shape requests; KV allocation, cache placement, pool sizing, draft execution, precision, and scheduling are infrastructure-level. Public reference engines illustrate mechanisms but do not confirm DeepInfra internal implementations.
Begin by defining your workload’s latency and output quality needs, not by targeting peak isolated tokens-per-second. Measure throughput and latency distributions (median and p99) at representative input/output lengths and concurrency. Use stable, identical prompt prefixes to reduce repeated prefill work, and avoid unnecessary output tokens to reduce decode work.
Next, evaluate provider capabilities holistically across caching, memory management, scheduling, and precision as interacting tradeoffs. Validate output quality on your tasks, especially when changing quantization.
Review DeepInfra’s documented model support and pricing, then benchmark representative workloads at your expected prompt lengths and concurrency levels to guide optimization decisions.
LLM inference optimization reduces computation, memory movement, and scheduling overhead needed to serve model responses efficiently. It involves reusing prompt state to avoid redundant work, managing key-value (KV) cache memory to support concurrency, and scheduling requests to share GPU capacity effectively. Prefill processes prompt tokens with parallel computation; decode generates tokens sequentially and is often memory-bandwidth-bound. DeepInfra’s hardware-software control enables optimization but does not guarantee all endpoints implement every technique.
Providers optimize tokens per second to serve concurrent requests while meeting latency objectives. KV cache storage grows with sequence length and concurrency, making memory capacity a dynamic constraint. Increasing aggregate throughput is beneficial only if first-token and generation latency remain acceptable. DeepInfra distinguishes workload requirements to evaluate performance realistically; single-request speed does not establish capacity under load.
Teams should seek representative performance evidence, supported model capabilities, and deployment options matching their workloads. Benchmark realistic input/output lengths and concurrency, inspecting median and p99 latency for typical and slow-tail performance. DeepInfra offers token-priced inference and own-model deployments with uptime billing. Check automatic prompt caching support per model; assumptions of universal availability are unreliable.
On supported DeepInfra models, prompt caching automatically reuses computed KV state for matching prompt prefixes, avoiding repeated prefill computation but not decoding. To maximize reuse, keep system instructions and reusable context in a stable, identical prefix, placing variable user content afterward. Changing early tokens prevents reuse of affected downstream KV blocks. Confirm caching support per selected model.
No. Prompt-cache hits save shared-prefix prefill computation but not autoregressive decoding of new output tokens. DeepInfra’s automatic caching reduces first-token latency and input cost; decoding still occurs. Evaluate first-token and inter-token latency separately. Stable, reusable prefixes reduce repeated prompt processing but do not eliminate decoding.
Time to first token (TTFT) measures the elapsed time from request submission to first content token receipt, including network, queueing, prompt processing, and generation. Per-user tokens per second reflects generation speed after output begins, approximately the inverse of inter-token latency. Aggregate throughput counts all tokens generated across the system during benchmarking. Measuring all three under representative concurrency and clarifying token counting conventions is essential.
No. Streaming exposes generated output before response completion, enabling earlier consumption but not accelerating GPU generation. When using streaming with DeepInfra, confirm model and API support for requested behavior. Measure TTFT, inter-token latency, and final latency distinctly. Test concurrency effects on aggregate throughput and latency distributions; more simultaneous requests do not always improve performance.
Infrastructure-level controls-including KV allocation and eviction, routing to cached replicas, prefill/decode pool sizing, speculative execution, precision choices, and scheduling-require serving-stack changes beyond prompt design. DeepInfra’s hardware and software ownership facilitates these optimizations but does not confirm specific configurations per endpoint. Public reference implementations like vLLM, SGLang, and TensorRT-LLM illustrate these ideas. Developers can stabilize prefixes and tune concurrency but cannot directly control infrastructure mechanisms via prompts.
Related guide: LLM inference providers that own vs. rent compute.
Reviewed October 28, 2026. This guide summarizes publicly documented technical claims rather than independently reproduced comparative benchmarks. Infrastructure classifications are product-specific and may change. Confirm major claims against current provider documentation.