Reducing LLM Inference Costs: Combining Expert Pruning and Speculative Decoding
This article explores how to reduce Large Language Model (LLM) inference costs by combining Mixture-of-Experts (MoE) pruning and speculative decoding. It details the principles, trade-offs, and prerequisites for both techniques, providing a practical guide on implementation steps, cost impacts, and real-world applicability for optimizing GPU resource utilization.
1. The Bottom Line
Expert pruning primarily reduces VRAM usage, while speculative decoding primarily shortens single-response latency. When combined, these techniques allow large models to run on lower-specification GPUs while maintaining acceptable response speeds. However, both technologies have prerequisites; blindly copying vendor benchmarks is a recipe for failure.
2. Where Do Costs Come From?
Among publicly available weighted large models, parameter scales have reached the trillion level. More parameters require more VRAM and compute power. Running your own data center requires purchasing high-end GPUs, while cloud environments charge by the hour. For enterprises running long-term inference services, GPU costs typically constitute the majority of AI infrastructure expenses.
Recently, a Korean AI inference optimization company disclosed a case study: they optimized a 2.8-trillion-parameter ultra-large model to run on a lower-tier GPU. According to the company’s public materials, GPU procurement costs were reduced by up to 20%, and cloud rental fees were reduced by up to 22%. These figures are self-reported by the vendor and currently lack third-party reproduction. Readers should treat them as directional references rather than directly applying them as their own expectations.
This case illustrates an engineering approach: first adapt your existing model to cheaper compute power, and then consider adding more hardware.
3. Expert Pruning: Reducing VRAM Usage
Principle
Mixture-of-Experts (MoE) models consist of numerous expert modules, only a portion of which are activated for each token. In practice, the contribution of different experts varies significantly. Some experts are only called upon for specific tasks or languages; removing them has minimal impact on the model’s primary capabilities.
Pruning involves analyzing the activation frequency and contribution of each expert and removing low-contribution modules. According to vendor materials, when the number of modules is reduced by about 30% to 37%, the model still retains about 99% of its original score on high-level scientific reasoning benchmarks. This result must be re-verified on your own evaluation sets.
Key Trade-offs
Pruning requires balancing three factors:
- Compression rate: The more you remove, the more VRAM you save, but the higher the risk of capability loss.
- Context length: The freed VRAM can be reallocated to the KV cache. According to vendor materials, a 30% reduction can support roughly 512,000 tokens of context, while a 37% reduction can support about 1 million tokens. The actual limit also depends on batch size, precision, and deployment configuration, not just the model itself.
- Long-tail tasks: Certain business functions rely on specific experts. Before pruning, you must conduct activation analysis using real traffic to confirm which experts cannot be deleted.
Pruning also alters the routing distribution. When the input distribution received by the router shifts, the load and output of the remaining experts may change. This typically requires a calibration step, and sometimes a small amount of continued training, to recover long-tail capabilities.
4. Speculative Decoding: Reducing Response Time
The VRAM saved by pruning can be used to deploy a smaller draft model that collaborates with the main model.
The basic workflow is as follows:
- The draft model quickly generates the next k candidate tokens.
- The main model performs a single forward pass to verify these k candidates.
- Verified tokens are adopted directly. From the first unverified position onward, the main model regenerates the tokens.
While autoregressive generation itself is serial, verifying multiple tokens can be done in parallel. Therefore, each round can yield multiple tokens.
This technology has three prerequisites:
- The draft model must use the same tokenizer and vocabulary as the main model; otherwise, token-by-token alignment is impossible.
- The acceleration effect depends on the acceptance rate α. If the acceptance rate is 0.8 and the draft length k is 4, an average of about 3.4 tokens can be produced per round. The calculation is
(1−α^(k+1))/(1−α), which includes one supplementary token from the main model. - When the batch size is large, the extra computation during the verification phase increases, and throughput may decrease rather than improve. Therefore, this technique yields the most obvious benefits in low-concurrency, low-latency scenarios.
Regarding output distribution, if strict validation methods like rejection sampling are used, the final distribution is equivalent to the main model. If approximate implementations using fixed draft lengths, tree-based verification, or other variants are used, deviations may occur and must be confirmed through business evaluations.
5. Understanding Cost Impacts
| Aspect | Source of Benefit | Vendor Claim | Impact on Cost |
|---|---|---|---|
| Hardware Procurement | Model runs on lower-tier GPUs | Up to ~20% reduction | Direct reduction |
| Cloud Rental | Reduced GPU quantity or specs required | Up to ~22% reduction | Direct reduction |
| Per-Request Latency | Fewer serial generation steps | P99 latency drops on same hardware; magnitude depends on acceptance rate | Indirect impact; fewer replicas needed once latency targets are met |
| Throughput | Increased verification overhead at large batch sizes | Not necessarily improved | Depends on load; requires testing |
6. Implementation Steps
- Collect production traffic data. Data should cover at least one week, including peak and off-peak periods. Count the activation frequency of each expert and group them by language and task type.
- Build evaluation sets. Construct four categories: general capability, multilingual, long-tail business, and long-context. It is recommended to have a few hundred samples per category. The tolerance threshold for the core set can initially be set at no less than 99% of the original version, while the long-tail set can be relaxed to around 95%. Adjust these values based on business risk.
- Compress incrementally. Increase the compression rate by about 5 percentage points each round, remove low-contribution experts, perform calibration, and re-evaluate.
- Define VRAM usage. The freed VRAM can be used to expand the KV cache, increase concurrency, or deploy the draft model. Without a clear purpose, the benefits are hard to realize.
- Set rollback conditions. If any core evaluation set drops below the tolerance threshold, or if online error rates or user complaint rates worsen by more than about 1 percentage point compared to the baseline, immediately roll back to the previous version.
After launch, track at least the following metrics: expert activation rate distribution, speculative decoding acceptance rate α, KV cache hit rate, P99 first-token latency, and cost per 1,000 tokens. The inference service must also integrate with request scheduling, batching, container platforms, logging services, and monitoring alerts. Only when these metrics are connected to cloud logging and monitoring capabilities can the cost advantages be translated into end-to-end service cost savings.
7. FAQs
Can pruning and speculative decoding be stacked? Which should be done first?
Yes, they can be stacked. It is recommended to perform pruning first, as the VRAM it frees up provides the deployment space for the draft model. After pruning, you must re-test the acceptance rate because the main model’s output distribution has changed.
How much VRAM is needed to enable long context?
It depends on the model structure, precision, batch size, and KV cache implementation—there is no universal number. You should test the maximum available context length under your target configuration.
What if capabilities degrade after compression?
First, roll back to the previous version, then compare your evaluation sets to identify the degraded categories. If long-tail tasks are degraded, you typically need to retain the corresponding experts or add calibration data before re-compressing.
8. Applicability Conditions
This approach is suitable for teams using an MoE architecture, possessing reproducible evaluation sets, and able to accept gray-release iterations. If your model does not use an MoE architecture, expert pruning is not applicable, and you can initially consider only speculative decoding. If your team does not yet have online traffic data, you should establish data collection first before deciding whether to prune.
