Ultra-Fast LLM Inference: Principles, Costs, and Selection Guide

    This article explains why LLM decoding is limited by memory bandwidth and how continuous batching changes that limit. It compares the main speed-up techniques, including quantization, speculative decoding, KV Cache management, and kernel fusion, along with their trade-offs. It also shows how cache hit rate affects the real cost of ultra-fast modes, how to measure end-to-end performance, and how to decide whether a fast mode is worth paying for.

    1. The Decoding Bottleneck and Its Effect on Speed

    LLM inference has two phases. Prefill processes all input tokens at once. Its matrix operations are large, so GPU compute utilization is high. Decoding generates tokens one at a time. For each token, the model weights must be read from GPU memory into the compute units, yet the multiply-add operations performed per read are few.

    With a single request or a small batch, decoding speed is mainly limited by memory bandwidth. A rough estimate gives a theoretical lower bound on the time per step: the weight size in bytes divided by memory bandwidth. For example, with weights of about 14 GB and memory bandwidth of about 1 TB/s, reading the weights takes at least about 14 ms per step, which corresponds to roughly 70 tokens per second. This is only a theoretical upper bound. Real latency also includes KV Cache reads, kernel launch overhead, and scheduling overhead.

    Continuous batching changes this relationship. Multiple requests share a single weight read, so throughput rises as batch size grows, until compute capacity or memory capacity becomes the new bottleneck. The statement “tokens generated per second is proportional to bytes read per second” therefore holds only approximately for single-request or small-batch cases. To judge the speed ceiling of a service, consider batch size, KV Cache occupancy, and compute capacity together.

    2. Acceleration Methods, Trade-offs, and Speed Evaluation

    Ultra-fast modes usually combine several techniques. The table below lists the main directions, along with their benefits and costs.

    Technique Target Main Benefit Cost and Limits
    Low-bit quantization (INT8, INT4, FP8) Weight size Fewer bytes read per step and lower memory usage Accuracy may drop. Requires hardware and kernel support, and the actual gain depends on the implementation.
    Speculative Decoding Number of decoding steps A draft model or draft head proposes multiple tokens at once, and the main model verifies them in parallel The gain depends on the acceptance rate. Drafting adds overhead. In standard implementations, the verification step keeps the output distribution identical to the original model. Check the service documentation to confirm whether a given service does this.
    KV Cache management Memory reads, writes, and capacity for attention Supports longer context and more concurrent requests Memory fragmentation. Prefix reuse depends on the scheduling policy.
    Continuous batching Scheduling utilization Higher overall throughput Wait time for an individual request may increase.
    Operator fusion and custom kernels Scheduling and memory access Fewer kernel launches and fewer intermediate reads and writes High maintenance cost. Usually tied to specific hardware.

    These techniques affect one another. For example, a larger batch raises throughput but uses more KV Cache memory, which can shrink the usable context length. In speculative decoding, a higher-quality draft yields a higher acceptance rate and a larger gain. If the draft quality is poor, the extra computation can cancel out the benefit.

    Single-prompt speed tests give limited insight. Network jitter, queuing, and rate limiting all distort the results. A more reliable approach is to compare end-to-end time on a real task workflow. Use the same inputs, the same planning steps, and the same coding task, run the full workflow in each mode, and record the following metrics:

    • Time to first token (TTFT) and time per output token (TPOT)
    • Total end-to-end time, including the mean, P50, and P99 values
    • Timeout rate: the share of total requests that exceed the set threshold
    • Error rate: including 5xx errors and rate-limit rejections
    • Task pass rate and retry count

    Average speed alone can hide tail problems. Some aggressive scheduling and timeout policies reduce the safety margin. During peak hours, queuing time grows, and P99 latency and timeout rate are usually the first to degrade. Measure during both peak and off-peak hours instead of relying on a single average.

    3. Cost Calculation: Cache Hit Rate Determines the Actual Bill

    Ultra-fast modes usually cost more per token than standard modes. The actual bill, however, also depends on how often cached content is reused. Two terms need to be clear:

    • Cache hit rate = number of reusable prefix tokens found in the cache ÷ total input tokens
    • Cache miss rate = 1 − cache hit rate. Missed tokens are billed at the full input price.

    Billing rules vary by provider. Examples include whether cached tokens receive a discount, the minimum cacheable length, and the cache lifetime. Refer to the official billing documentation for the exact rules.

    In multi-turn conversations, each turn usually submits the full history together with the new question. If the prefix matches the previous turn exactly, it can be reused. If the system prompt, tool definitions, or message order changes, the prefix is invalidated, and the uncached tokens are billed again. Long sessions, such as code debugging and agent tool calls, usually have long prefixes, so they depend most heavily on caching.

    The calculation steps are as follows:

    1. Export the input tokens, output tokens, and cache-hit tokens for each request from logs or billing records.
    2. Calculate the hit rate and miss rate for each session.
    3. Group the results by task type, including single-turn Q&A, code generation, multi-turn debugging, and agent tool calls.
    4. Use the unit price for each type to calculate the average cost per task.
    5. Compare with standard mode and convert the price premium into extra cost per task.

    The following example uses assumed values, not measured data. Suppose a multi-turn debugging session accumulates 300,000 input tokens. At an 80% hit rate, about 60,000 tokens are uncached. At a 40% hit rate, about 180,000 tokens are uncached. The uncached tokens triple, so the input cost rises to about three times the original. If the ultra-fast unit price is k times the standard price, the total cost is multiplied by k again. The price premium and the drop in hit rate compound, and the calculation must include both.

    A common way to reduce the miss rate is to place the system prompt and tool definitions at the very beginning of the messages and keep them unchanged. Dynamic content, such as timestamps and random IDs, should go after the stable prefix so it does not break the cache.

    4. Scenario Selection and Routing Strategy

    Whether an ultra-fast mode is worth its cost depends on five factors:

    • Latency sensitivity: whether a one-second reduction in latency produces a measurable business benefit
    • Request frequency and concurrency: whether the workload consists of frequent short requests or infrequent long tasks
    • Session prefix stability: whether the workload involves multi-turn long context and whether the prefix can be reused
    • Token volume per task: input and output size determine the absolute amount of the premium
    • Share of human waiting time: if time spent reading output and reviewing results far exceeds model generation time, the practical benefit of a speed-up is limited

    When latency sensitivity and prefix stability are both high, the premium is usually justified. Examples include real-time market monitoring and trading signal processing, live incident diagnosis, streaming content moderation, and interactive real-time assistants.

    Routine coding assistance needs to be measured first. In programming tasks, the time people spend reading and reviewing code often dominates. A machine that is twice as fast does not make the overall output twice as fast.