Skip to main content
Back

Tsinghua's DDP Shrinks DeepSeek-R1 by 60% Without Destroying Accuracy

DDP replaces stochastic mask sampling with a deterministic surrogate, cutting LLM inference costs while keeping accuracy loss under 1% at 20% sparsity

Pro

Paper, Full Access
  • DDP is a new structured pruning method that replaces stochastic mask sampling with a deterministic annealed surrogate, eliminating train-test mismatch in LLM compression.
  • It optimizes only mask logits (0.35M parameters) with weights frozen, running in ~40 minutes for 7B models on 4 H20 GPUs using 30M tokens.
  • Qwen3-32B loses only ~1% accuracy at 20% sparsity; DeepSeekMoE-16B beats prior methods by +6.6 accuracy points at 60% sparsity.
  • End-to-end vLLM speedups reach 2.20x on RTX 5090 at 50% sparsity for LLaMA-7B; Qwen3-30B-A3B hits 1.51x on B200 at 60% sparsity.
  • DDP outperforms LoRA recovery baselines using 4x fewer training tokens, showing that better sparse structure matters more than post-pruning adaptation.
  • Code is publicly available; paper accepted at ICML 2026.

Deploying large language models at scale is expensive. Even after training, serving a 30B-parameter model requires significant GPU memory and compute, and that cost multiplies across every request. Structured pruning -- the idea of permanently removing entire attention heads or MLP channels from a model -- is one of the most hardware-friendly ways to shrink that bill. But getting it right without destroying model quality has been a persistent challenge. A new paper from Tsinghua University and Ant Group, accepted at ICML 2026, proposes a cleaner approach called Deterministic Differentiable Pruning (DDP) that fixes a fundamental flaw in how prior methods optimize their pruning decisions.

The pruning problem nobody talks about

Structured pruning works by learning a set of "masks" -- gating variables that decide which components of a model to keep or remove. The natural way to formulate this is as an optimization problem with an l0 constraint (l0 is the count of non-zero values, so constraining it means constraining how many components survive). The problem is that the l0 norm is discrete and non-differentiable, which breaks gradient-based optimization.

The standard fix, used by methods like ShearedLLaMA and Compresso, is the hard-concrete relaxation: inject random noise into the mask values during training so that the expected number of active components becomes differentiable. Think of it as replacing a hard on/off switch with a noisy dimmer. This works, but it creates two problems:

  • Train-test mismatch. During training, masks are random. At deployment, they must be deterministic binary values. Snapping a noisy continuous value to 0 or 1 introduces a gap between what the model was optimized for and what it actually runs.
  • Limited expressiveness. The hard-concrete mapping forces mask values into a near-binary [0,1] range. This shrinks the search space and prevents the optimizer from discovering that some components should be rescaled, not just kept or pruned.

On top of these issues, most prior mask-learning methods also update the model weights simultaneously -- either with full fine-tuning or LoRA adapters. That makes them expensive. For a 685B-parameter model like DeepSeek-R1, the mask variables number only in the tens of millions, a tiny fraction of total parameters. Optimizing only the masks, with weights frozen, is a much cheaper and more targeted problem.

The DDP fix: ditch the noise

DDP's core insight is that you don't need randomness to make the l0 objective differentiable. Instead, it uses a deterministic annealed surrogate: a smooth sigmoid-like function that starts soft and gradually sharpens toward a true step function over the course of training. At the end of training, the surrogate closely approximates the exact l0 count, so the sparsity constraint is enforced precisely.

DDP architecture diagram showing mask formulation for dense and MoE models with optimization pipeline

The method decouples two things that prior work conflated. The forward mask -- what actually gates components during the forward pass -- is computed as ReLU(z), where z is a learned real-valued logit. This allows mask values to range from 0 to infinity, not just 0 to 1. A component with a mask value of 1.3 stays in the model and gets slightly amplified; a component with 0 gets pruned. The retention score used for the sparsity regularizer is computed separately via the annealed sigmoid, which is what gets constrained to hit the target sparsity budget.

Three components work together in the final training objective:

  1. Cross-entropy loss on the masked model's predictions, keeping language modeling quality high.
  2. Sparsity loss via an augmented Lagrangian that enforces the target keep-ratio exactly, updating Lagrange multipliers alongside mask logits.
  3. Binarization loss that penalizes intermediate (ambiguous) retention scores, pushing each component to commit to kept or pruned early in training. This is what makes convergence fast.

Knowledge distillation from the unpruned model is also included at negligible cost: since weights are frozen, the dense model is a free teacher that requires no extra optimizer memory -- just a second forward pass.

How it works, step by step

The algorithm is straightforward to follow:

  1. Initialize all mask logits z = 1 (fully dense start) and Lagrange multipliers at 0.
  2. At each training step, compute forward masks m = ReLU(z) and retention scores s = sigmoid_annealed(z).
  3. Run the masked student model and the frozen dense teacher; compute cross-entropy, KL distillation, sparsity, and binarization losses.
  4. Update mask logits via gradient descent; update Lagrange multipliers via gradient ascent to enforce the sparsity budget.
  5. Anneal the sharpness parameter mu toward 0, making the surrogate progressively closer to a true l0 count.
  6. After training, prune all components where z <= 0 and fold nonzero mask values into the model weights.

The whole process runs on 4 NVIDIA H20 GPUs and takes about 40 minutes for LLaMA-7B and 60 minutes for DeepSeekMoE-16B, using a 30M-token training budget -- roughly 60x less data than ShearedLLaMA's 50B tokens.

What the numbers say

The paper tests DDP across dense LLaMA models (7B, 13B), Qwen3 (4B through 32B), and MoE models (DeepSeekMoE-16B, Qwen3-30B-A3B). Benchmarks include WikiText-2 and C4 perplexity plus nine zero-shot tasks: ARC, OpenBookQA, WinoGrande, PIQA, HellaSwag, MathQA, RTE, and BoolQ.

Heatmap of learned attention head sparsity patterns across layers in LLaMA-7B at 20% sparsity

On dense models at 20% sparsity, DDP improves mean accuracy from 62.41 to 64.13 on LLaMA-7B and from 53.16 to 56.07 at 50% sparsity, while also reducing perplexity compared to the best prior methods. The gains compound at higher sparsity: on LLaMA-13B, DDP improves mean accuracy by more than 7 points at 50% sparsity over baselines.

MoE results are even more striking. On DeepSeekMoE-16B at 60% sparsity, DDP outperforms the strongest baseline by +6.6 mean-accuracy points (58.18 vs. 51.62) while substantially reducing perplexity (12.65 vs. 18.10). For flagship models, Qwen3-32B at 20% sparsity drops only from 72.12 to 71.09 average zero-shot accuracy -- a loss of about 1%.

A key comparison is DDP versus training-free pruning followed by LoRA recovery. LoRAP improves from 59.44 to 62.98 mean accuracy on LLaMA-2-7B with 120M recovery tokens, yet still trails DDP's 64.82 using only 30M mask-optimization tokens. The interpretation is clean: LoRA can adapt the surviving weights, but it cannot fix a bad pruning decision. DDP finds a better sparse structure in the first place.

The ablation study isolates each component's contribution. Starting from hard-concrete, switching to deterministic optimization with binarization loss yields consistent gains on both dense and MoE models, suggesting that sampling noise hinders stable mask optimization. Adding the expanded mask range (ReLU instead of clamped sigmoid) improves further, and distillation adds the final increment.

Real-world speedups

Structured pruning is only useful if it translates to actual inference acceleration. The authors measure end-to-end throughput with vLLM on 1,000 ShareGPT prompts. On an RTX 5090, pruning LLaMA-7B achieves 1.36x speedup at 20% sparsity and 2.20x at 50% sparsity. For MoE, Qwen3-30B-A3B on a B200 reaches 1.11x, 1.25x, and 1.51x speedup at 20%, 40%, and 60% sparsity respectively.

Training cost is also minimal. DDP updates only 0.35M mask parameters, compared to 20M for LoRA (rank 8), and achieves the lowest per-step wall-clock time at 2.1 seconds versus 2.4 seconds for LoRA on LLaMA-7B.

What it's good for -- and where it falls short

DDP is well-suited for teams that need to deploy large models on constrained hardware and want a principled, fast way to find a good sparse structure without retraining. It works especially well when:

  • You want 10-20% sparsity with near-zero quality loss on a flagship model like Qwen3-32B.
  • You're working with MoE architectures, where expert activation is already uneven and pruning rarely-used experts is a natural fit.
  • You need deployment-ready models quickly -- the whole process runs in under an hour for 7B-scale models.

The method is less suited for very aggressive compression. At 50% sparsity, Qwen3-4B drops from 65.38 to 47.63 average accuracy -- a substantial degradation. Larger models handle high sparsity better due to greater redundancy, but smaller models suffer. The authors also note that high-quality pretraining-like data is preferred for mask learning; instruction-style data can bias masks toward behaviors that do not transfer to pretraining-style evaluation.

The learned sparsity patterns are also interpretable and match intuitions from prior work. For dense models, sparsity tends to concentrate in later layers, and attention shows higher cross-layer variance than MLPs, suggesting greater redundancy in multi-head attention. For MoE models, rarely routed experts are pruned more aggressively, indicating a negative correlation between activation frequency and pruning ratio.

The real breakthrough

The deeper contribution here isn't just better benchmark numbers. It's the demonstration that mask-only optimization is a first-class compression strategy -- not a stepping stone to full fine-tuning. By keeping weights frozen and optimizing only the tiny set of mask logits, DDP sits in a practical sweet spot: cheaper than LoRA fine-tuning, far better than heuristic one-shot pruning, and deployable in under an hour. The deterministic formulation also gives the method a clean theoretical guarantee: under mild conditions, the staged annealing procedure provably recovers the exact target sparsity budget at convergence.

The code is publicly available, and the method has been validated on models up to Qwen3-32B and DeepSeek-R1-scale architectures, making it immediately applicable to the models most teams are actually running in production.