Reducing Inference Costs for Giant MoE Models: Expert Pruning and Speculative Decoding

    This article explores cost-reduction strategies for serving large-scale Mixture-of-Experts (MoE) models, focusing on expert pruning to free GPU memory, using the saved resources for draft-model-based speculative decoding, and then downgrading GPU specifications. It details the technical workflow, evaluation requirements, and operational risks, drawing on a real-world case where a 2.8-trillion-parameter model achieved up to 22% reduction in cloud GPU rental costs while maintaining high reasoning accuracy.

    1. Problem Definition: The Cost Bottleneck of Giant MoE Inference

    When a model reaches 2.8 trillion total parameters, the first constraint for an inference system is usually not the compute of a single matrix multiplication, but the combined cost of GPU memory capacity, memory bandwidth, and multi-GPU interconnect. The Mixture-of-Experts (MoE) architecture uses sparse activation to let each token pass through only a small number of experts, thereby controlling per-token compute. However, the model weights still must reside entirely in memory or be frequently swapped in and out. The more expert modules there are, the more significant the memory footprint and communication overhead become.

    From a cost structure perspective, inference spending falls into two main categories: GPU procurement (CAPEX) in self-managed environments, and GPU rental fees (OPEX) in cloud environments. The former is influenced by memory capacity, inter-card interconnect specs, and node density; the latter by instance type, occupancy duration, and elastic scheduling. For giant models, using high-spec GPU clusters directly leads to rapidly rising procurement and rental costs. Simply switching to lower-spec GPUs risks insufficient memory or reduced bandwidth, which lowers throughput and increases latency. Therefore, cost reduction cannot rely on “buying cheaper cards” alone; it must jointly optimize model architecture, memory footprint, and inference execution strategies.

    Industry practice shows that one team, after optimizing inference for a publicly available model with 2.8 trillion parameters, switched to relatively lower-cost GPUs, reducing GPU procurement costs by up to about 20% and cloud GPU rental fees by up to about 22%. The core idea was not sacrificing core reasoning capability but rather using expert module pruning to free memory, then reinvesting that saved memory into a draft model and speculative decoding, ultimately achieving joint optimization of model lightweighting and execution efficiency. The same team had previously reduced the number of high-spec GPUs required for an earlier giant model from 8 to at most 4; this effort further lowered the GPU spec tier needed for the subsequent generation. This path offers a reference for teams that want to use existing AI infrastructure at a reasonable cost.

    2. Optimization Path One: Expert Module Pruning and Structured Sparsity

    An MoE model consists of multiple expert sub-networks. A routing network selects the Top-K experts for each token based on token representations. Different experts are not equally balanced in their roles across training data; some may be sensitive only to specific domains, languages, or task patterns. The basic assumption behind expert-level pruning is that, under the target business distribution, a certain proportion of experts contribute little to core inference. Removing these modules can reduce memory usage and routing overhead while preserving main capabilities.

    In engineering practice, expert pruning is usually not a one-time deletion but a phased process. The first step is to collect expert activation frequency and routing distribution, identifying experts that are persistently under-activated or highly redundant. The second step is to evaluate each expert’s impact on the loss function, task accuracy, and output distribution using a calibration dataset. The third step is to prune in order of importance, re-calibrating the router and remaining experts after each round to avoid routing collapse. The fourth step sets a performance rollback threshold—if core metrics degrade beyond the acceptable range, the pruning is rolled back. Granularity can be at the expert level, per-expert channel level, or inter-layer combinations, depending on model structure, memory bottleneck location, and long-tail capability requirements.

    The most notable data from the original practice: by selectively removing experts responsible for specific tasks, the team reduced the number of modules by up to 37%, while still achieving more than 99% of the original score on a high-level scientific reasoning benchmark. This shows that expert redundancy indeed exists within the target evaluation distribution, and structured pruning can preserve core reasoning performance. However, it is critical to note that 99% on benchmark scores does not mean all business capabilities remain unchanged. Pruning may affect low-frequency tasks, multilingual ability, code generation, or long-tail factual QA. Therefore, a multi-dimensional evaluation suite covering real business traffic is necessary, not just a single scientific reasoning benchmark.

    In addition, after expert pruning, routing load may become more concentrated. The remaining experts face higher compute demand. While per-card memory decreases, the GPUs hosting hot experts may see increased throughput pressure. Engineering teams should concurrently monitor expert load balance, batching efficiency, and inter-card communication volume. If necessary, adjust routing temperature, re-arrange expert parallelism, or apply request-level rate limiting to stabilize service.

    3. Optimization Path Two: Memory Reuse and Draft-Model Speculative Decoding

    Memory freed by pruning should not be used only to “use fewer cards”—it can be converted into inference acceleration resources. A typical approach is to use saved memory to run a smaller draft model. The draft model proposes several future tokens ahead of time; the main model then verifies those candidate tokens in a single forward pass via speculative decoding. If the draft model’s tokens are accepted by the main model, one main-model forward produces multiple tokens. If rejected, the main model corrects from the rejection point onward. This mechanism can reduce the average number of main-model calls per token without changing the output distribution of the main model.

    The benefit of speculative decoding hinges on the “acceptance rate.” The closer the draft model’s distribution is to the main model’s, and the more accurate its predictions for the current context, the longer the accepted sequence and the greater the speedup. If acceptance is too low, the overhead of draft generation and verification becomes an extra burden. Engineering attention is needed in several areas: the draft model should share the same tokenizer and context format as the main model; the draft model should not be too large, otherwise it will consume main-model memory and negate pruning gains; the candidate token count γ should be dynamically adjusted—larger γ for long contexts and high-certainty tasks, more conservative for open-ended generation; and the rejection-and-correction logic must guarantee that the output distribution matches the main model, avoiding quality changes from speculative decoding.

    The original practice notes that the memory savings were used to run a draft model that assists answer generation. The main model performs verification in one pass via speculative decoding, allowing faster answer generation even on 8 relatively low-cost GPUs. This demonstrates that pruning and speculative decoding can work in synergy: pruning reduces the memory footprint of the main model, the draft model uses remaining memory to improve decoding efficiency, and the final outcome maintains acceptable service capability on lower-grade GPUs. In deployment, monitor acceptance rate, average accepted length, P99 latency, and throughput. If acceptance remains low, check the distribution alignment between draft and main models and context truncation strategies.

    4. Optimization Path Three: GPU Specification Downgrade and Resource Planning

    GPU specification downgrade is the most direct cost-cutting measure but also the easiest to cause SLA risk. High-spec GPUs offer larger memory, higher bandwidth, and faster interconnect, suitable for full-weight residency and high-concurrency batching of giant models. Lower-cost GPUs make trade-offs in memory capacity, bandwidth, or interconnect. Before downgrading, three questions must be answered: Can model weights and KV cache fit into the target GPU memory? Does the throughput under target business concurrency meet peak demand? Does inter-card communication become a new bottleneck?

    From the original practice, after optimization GPU procurement costs dropped by up to about 20% and cloud rental fees by up to about 22%, with the required GPU spec tier gradually decreasing. This indicates the cost savings come from the combined effect of “model-side lightening” and “hardware-side downgrade,” not just buying cheaper cards. Engineering should establish a cost model: for self-managed, calculate per-card purchase price, node density, data-center power, and O&M amortization; for cloud, calculate instance unit price, occupancy duration, and utilization changes from elastic scaling. Cost reduction ratios should be measured against real utilization; otherwise, rental fees may appear lower but per-request costs could actually rise.

    After downgrading, resource planning should also consider batching strategies. If a lower-cost GPU has lower bandwidth, a large batch may increase per-step latency, while a small batch may waste compute. Dynamic batching, continuous batching, request priority queues, and KV cache paging can improve effective throughput. For long-context requests, KV cache occupancy can exceed weight occupancy and become the main memory consumer. Thus, KV cache quantization, paged allocation, and eviction policies should be evaluated together.

    5. Optimization Path Four: Long-Context Capability Expansion

    After expert modules are reduced, model weight memory usage decreases, and the freed memory can be used for longer contexts. In the original practice, a version with 30% fewer modules handled a 512K-token context, while a version with 37% fewer modules handled 1 million tokens. This result shows that memory freed by pruning can be converted into expanded context window capability. However, long context is not limited only by weight memory. Attention compute grows with context length, and KV cache capacity grows linearly with token count. The longer the context, the higher the complexity of draft-model proposals and main-model verification, cache management, and tail latency risk.

    Therefore, long-context optimization should be designed in tandem with pruning. Common techniques include: paged attention management to allocate KV cache in blocks and reduce fragmentation; KV cache quantization to lower cache footprint with acceptable precision loss; sliding-window attention or hybrid local-global attention to control long-distance compute; retrieval augmentation to feed only relevant segments of very long documents into the model; and request-level context compression via summarization or selective retention. It must be emphasized that expanding the context window does not automatically improve quality across all long-context tasks. After pruning, the model still needs dedicated evaluation for long-range dependency, cross-document reasoning, and detail recall.

    6. Evaluation Framework and Engineering Practice

    A cost-reduction solution must be accompanied by a complete evaluation framework; otherwise, it risks “cost down, experience down” hidden losses. Evaluation should be done in three layers. First, model capability: cover scientific reasoning, code, multilingual, long-context, and business-specific tasks. Set a rollback threshold of no less than 99% of the original model’s score. Second, service performance: throughput, time-to-first-token, P99 end-to-end latency, peak memory, GPU utilization, and error rate. Third, cost evaluation: per-request cost, per-token cost, and peak resource usage, whether purchasing or renting.

    For engineering rollout, use canary releases and A/B testing: first validate the pruned model and speculative decoding acceptance rate on small traffic, then gradually expand; keep the original weights and rollback switches; make pruning ratio, draft-model candidate length, batch size cap, and KV cache policy configurable. Below is a pseudo-code configuration example that does not depend on any specific tool:

    1. prune:
    2. target_expert_ratio: 0.37
    3. calibration_dataset: "mixed business samples"
    4. eval_metrics:
    5. - "core reasoning accuracy"
    6. - "long-context coherence"
    7. - "multilingual and code tasks"
    8. rollback_threshold: 0.99
    9. speculative_decode:
    10. draft_model: "small draft model"
    11. candidate_tokens: "dynamically adjusted"
    12. min_accept_rate: 0.55
    13. fallback_to_main: true
    14. serving:
    15. gpu_spec: "relatively low-cost specification"
    16. max_batch_size: "determined via load testing"
    17. kv_cache: "paged management + on-demand quantization"
    18. monitor:
    19. - "acceptance rate"
    20. - "P99 latency"
    21. - "peak memory"
    22. - "per-request cost"

    When deploying in the cloud—whether self-managed or on platforms such as Baidu AI Cloud—you can use common capabilities like container orchestration, monitoring and alerting, logging, and object storage to build an observable inference service. The focus is not on stacking tools but on incorporating pruning ratio, GPU spec, batching parameters, and speculative decoding acceptance rate into unified monitoring, enabling a closed loop of tuning across performance, cost, and quality.

    7. Risks and Boundaries

    The risk of expert pruning lies in irreversible capability loss and task drift. Keep original model weights, and calibrate pruned versions per business line instead of using a single calibration set for all scenarios. The risk of speculative decoding is extra overhead under low acceptance rates; set an acceptance-rate floor and automatic fallback. The risk of GPU spec downgrade is memory overflow or bandwidth bottlenecks during peak concurrency; load-test with production traffic patterns, not just offline throughput. The risk of long-context expansion lies in attention compute and cache management becoming new bottlenecks; pair with context compression and retrieval augmentation to avoid “wider window but lower effective information density.”

    In summary, cost reduction for giant model inference should follow this order: first reduce model load (expert pruning), then accelerate execution (draft-model speculative decoding), then downgrade hardware (GPU spec and resource planning), and finally control risk with multi-dimensional evaluation and canary mechanisms. The core value of this path is transforming model lightweighting from a single-point technique into a systematic engineering effort that optimizes inference execution and service delivery—enabling enterprises to run large models at a more reasonable cost on existing AI infrastructure.