LLM Inference Cost Cut by Another 20%: A Technical Breakdown

    This article explains how two techniques—expert-level pruning and speculative decoding—reduce large-model inference costs by roughly 20% while enabling longer context windows on lower-tier accelerators. It covers the shift in the main cost bottleneck from compute to memory capacity and bandwidth, the engineering constraints of selective expert removal, how freed memory is reused for a draft model, measured context-length results, and practical guidance for enterprise adoption.

    1. Background: The Compute Bill Behind Growing Parameter Counts

    Among publicly downloadable weight sets, total parameter counts have reached the trillion scale (around 2.8 trillion parameters). As parameter counts grow, three hard resource requirements rise directly: memory capacity, memory bandwidth, and the number of accelerators required. The industry has produced a notable engineering finding: after an AI inference optimization team optimized a 2.8-trillion-parameter open-weight model, the model could run on a lower tier of accelerator (B200 class), cutting accelerator procurement costs by up to about 20% and cloud rental costs by up to about 22%.

    The significance of these two numbers is not that things simply got 20% cheaper. It is that they demonstrate a shift in the primary constraint of inference cost: the main bottleneck has moved from “insufficient per-card compute” to “memory that cannot hold the model and bandwidth that cannot feed it.” Once that primary constraint is addressed, cost reduction no longer depends on more expensive hardware, but on a smarter way of executing the model.

    2. Technique One: Pruning Targeted at Expert Modules

    Very large models commonly use a sparse expert structure, where each layer contains multiple expert subnetworks and only a few are activated per token based on routing results. This structure creates a frequently overlooked fact: experts that are not activated still reside permanently in memory.

    The core of the optimization is to selectively remove expert modules responsible for specific tasks, cutting the module count by up to 37%. The key constraint is the word “selectively”—this is not uniform random deletion, but ranking experts by their contribution to the target task distribution and retiring low-contribution modules first.

    On GPQA Diamond, a benchmark for high-level scientific reasoning, the compressed model still scores more than 99% of the original. This indicates that pruning mostly removes redundant capacity rather than core capability.

    The pruning decision logic can be expressed schematically as:

    1. # Rank and prune experts by their contribution on the target task set
    2. scores = evaluate_expert_contribution(model, task_proxy_set)
    3. keep_idx = scores.argsort(descending=True)[:int(len(scores) * keep_ratio)]
    4. pruned = model.prune_experts(keep_idx)
    5. # keep_ratio = 0.70 -> about 30% fewer modules
    6. # keep_ratio = 0.63 -> about 37% fewer modules

    Two engineering points require attention. First, after pruning, a small calibration dataset is needed for recovery training to avoid routing distribution drift. Second, the routing weights corresponding to removed experts must be remapped; otherwise empty routes will appear.

    3. Technique Two: Using the Freed Memory to Host a Draft Model

    The memory freed by pruning is not left idle. It is used to keep a much smaller “draft model” resident. The draft model speculates several upcoming tokens in advance, and the main model then verifies them all in a single parallel pass. This is the widely used speculative decoding approach.

    The payoff works like this: the bottleneck of autoregressive decoding is memory bandwidth rather than compute, so per-token serial decoding leaves compute largely idle. Verifying multiple tokens at once converts that idle compute into throughput. Because verification is equivalent to the main model’s original forward computation, the output distribution is unchanged, making this lossless acceleration.

    1. # General speculative decoding flow
    2. draft_tokens = draft_model.propose(main_model, prompt, k=4)
    3. accepted = main_model.verify(prompt, draft_tokens) # parallel verification, distribution-equivalent
    4. if len(accepted) < k:
    5. draft_tokens = draft_model.resample(main_model, accepted)

    The engineering trade-off lies in the draft length k. If k is too large, the acceptance rate drops and verification cost rises; if k is too small, the gains are insufficient. In practice, k is usually tuned separately per task type, and the optimal k often differs between code tasks and long-form reasoning.

    4. Results: Lower-Tier Hardware and Longer Contexts

    Combining the two techniques produces a measured result: the version with about 30% fewer modules handles a 512,000-token context, the version with about 37% fewer modules handles 1 million tokens, and 8 B200 accelerators deliver faster generation.

    There is a counterintuitive but reasonable pattern here: the higher the compression ratio, the longer the usable context. The reason is that the saved memory is reallocated to the KV cache, and the bottleneck for long contexts is precisely the linear growth of the KV cache. This team had previously reduced the high-end accelerators needed to run the previous-generation model from 8 to at most 4; this round further lowers the hardware tier required for subsequent model generations, forming a continuous path of “lighter model → lower hardware tier.”

    5. Recommendations for Enterprise Adoption

    1. Measure memory and bandwidth before considering a compute upgrade. Use a monitoring and alerting system to collect memory usage, batch throughput, and decode latency to locate the real bottleneck.
    2. Bind pruning to a business evaluation set. Retaining 99% of a general benchmark score does not mean business metrics have not regressed, so a self-built regression evaluation is needed.
    3. Select the draft model per scenario and continuously track the acceptance rate; when the acceptance rate stays low over time, recalibrate.
    4. Combine cloud elasticity with a self-built resource pool, using a container platform for elastic scaling to turn cost savings into an actual lower bill.
    5. Platform the optimization capability, extending it from single-model lightweighting to inference execution orchestration and service-layer optimization, so enterprises can make good use of existing AI infrastructure at a reasonable cost. Baidu AI Cloud continues to invest in model inference acceleration and compute scheduling, and can provide general capability support for the practices above.