FFN Neuron Pruning Benchmarks: LS Refit & CUDA Graphs

A standardized audit of 28 public FFN neuron pruning methods across six LLMs (arXiv:2612.05711) proves that least-squares refitting of kept neurons halves zero-shot spread from 15.1 to 7.8 and boosts magnitude selection by up to 24.6 points. Crucially, FFN width pruning reduces batch-1 decode latency only when CUDA graphs are enabled.
FFN Neuron Pruning Benchmarks: LS Refit & CUDA Graphs: A standardized audit of 28 public FFN neuron pruning methods across six LLMs (arXiv:2612.05711) proves that least-squares refitting of kept neurons halves zero-shot spread from 15.1 to 7.8 and boosts magnitude selection by up to 24.6 points. Crucially, FFN width pruning reduces batch-1 decode latency only when CUDA graphs are enabled. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- Least-Squares Refit Halves Method Spread: Refitting kept down-projection weights cuts mean zero-shot accuracy spread from 15.1 to 7.8 and lifts Magnitude pruning by +6.5 to +24.6 points.
- Exposes Broken Zero-Calibration Selectors: Without least-squares compensation, DepGraph, Mag-sp, and Model Folding trail random neuron selection in 21–24 of 24 model-budget pairs.
- CUDA Graphs Are Mandatory for Batch-1 Speedup: Under eager PyTorch execution, pruning 30%–47% of FFN width stalls or slows batch-1 decode (10.37 -> 10.65 ms/tok) until CUDA graphs remove launch overhead.
- MMLU Degrades Faster Than Zero-Shot QA: Even top methods like CFSP (59.3% ZS vs 66.9% dense) drop MMLU from 45.7% to 39.1%, warning teams against relying solely on perplexity.
import { createAgent } from '@smoke-monkey/harness';// Verify FFN-pruned model accuracy & CUDA-graph batch-1 decode latency via vLLMconst agent = createAgent({agentId: 'ffn-pruning-benchmarker',provider: 'openai-compatible',baseUrl: 'http://127.0.0.1:8000/v1',model: 'pruned/llama-2-7b-cfsp-30pct',workspacePath: process.cwd(),permissions: {read_file: 'allow',write_file: 'ask',run_command: 'ask',},});async function main() {const result = await agent.run('Compare batch-1 eager decode latency vs --enforce-eager disabled (CUDA Graphs on) for the 30% FFN-pruned checkpoint.');console.log('Pruning Benchmark:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
LLM Inference Optimization: Prune, Exit Early, Answer Faster
Mastering LLM Inference Optimization From Theory to Cost Effective Deployment: Mark Moyou
What Did the 28-Method FFN Neuron Pruning Benchmark Uncover?
Structured FFN Neuron Pruning shrinks dense LLM memory and FLOPs by removing, compensating, folding, or factorizing intermediate MLP channels. A standardized 28-method benchmark across six LLMs (arXiv:2612.05711) reveals that closed-form least-squares (LS) refitting of kept neurons matters far more than exotic importance scores—halving zero-shot spread from 15.1 to 7.8.
Prior pruning papers confounded neuron selectors with differing LoRA recovery budgets, calibration sets, and target ratios. When evaluated under equal FFN width without LS refitting, calibration-free selectors such as DepGraph (35.3% ZS, 11.6k PPL) and Mag-sp (36.2% ZS, 55k PPL) collapse below random neuron deletion. Applying a single ridge-regularized least-squares refit $W_d' = W_d H H_S^\top (H_S H_S^\top + \lambda I)^{-1}$ lifts Magnitude selection by 6.5 to 24.6 points above refitted random.
| Method (Llama-2-7B, ~30% Pruned) | Operation | % FFN Removed | WikiText-2 PPL ↓ | Zero-Shot (%) ↑ | MMLU 5-Shot (%) ↑ | Peak VRAM (GB) | Eager Decode (ms/tok) |
|---|---|---|---|---|---|---|---|
| Dense Baseline | None | 0.0% | 5.47 | 66.9% | 45.7% | 13.7 GB | 10.37 ms |
| DepGraph (No Calib) | Removal (R) | 30.8% | 11,600 | 35.3% | 23.9% | 9.5 GB | 10.08 ms |
| Wanda-sp | Removal (R) | 31.2% | 13.90 | 56.2% | 27.3% | 10.0 GB | 10.84 ms |
| LLM-Pruner (+LoRA) | Removal + LoRA | 31.2% | 14.99 | 58.8% | 25.7% | 9.7 GB | 10.25 ms |
| CFSP (+LoRA) | Removal + LoRA | 46.6% | 9.25 | 59.3% | 39.1% | 9.7 GB | 10.65 ms |
Why CUDA Graphs Are Mandatory for Batch-1 Decode Latency Gains
Notice in the eager-mode benchmark table above that removing 46.6% of FFN neurons with CFSP shrinks peak VRAM from 13.7 GB to 9.7 GB and cuts 512-token prefill from 19.8 ms to 16.7 ms, yet batch-1 eager decode actually ticks slower (10.65 ms vs 10.37 ms). At batch size 1, GPU kernel launch overhead dominates narrower GEMM matrices; capturing the decode step inside CUDA graphs (default in vLLM/SGLang unless --enforce-eager is set) is required to convert pruned width into wall-clock latency savings.
# 1. Serve a pruned Llama checkpoint WITH CUDA Graphs enabled (omit --enforce-eager)
vllm serve ./checkpoints/llama-2-7b-cfsp-ls-refit \
--max-model-len 4096 \
--gpu-memory-utilization 0.85 \
--port 8000
# 2. Apply closed-form Ridge Least-Squares compensation to kept down-projection activations
python3 -c '
import torch
# W_d: [d_model, d_ff], H: full calibration activations [d_ff, N], H_S: kept subset [d_kept, N]
def ls_refit(W_d, H, H_S, lam=1e-4):
lhs = W_d @ H @ H_S.T
rhs = H_S @ H_S.T + lam * torch.eye(H_S.shape[0], device=H_S.device)
return torch.linalg.solve(rhs.T, lhs.T).T
print("Ridge LS refit helper ready for post-pruning calibration.")
'Do Not Evaluate Pruned Checkpoints Only on Perplexity or Zero-Shot QA
Even after LS refit and LoRA recovery, 5-shot MMLU drops much steeper than zero-shot accuracy across all 28 audited methods. Always gate pruned models on domain-specific MMLU and tool-calling evals.
Frequently Asked Questions
Q:Why does FFN width pruning fail to speed up eager batch-1 decoding?
At batch size 1, CPU-to-GPU kernel launch latency dominates narrower FFN matrix multiplications; CUDA graphs must be enabled to eliminate launch overhead and realize real decode speedups.
Q:How much does least-squares refitting improve FFN neuron pruning?
Across 28 audited methods, refitting kept down-projection neurons via ridge-regularized least squares halves the mean zero-shot accuracy spread (15.1 to 7.8) and boosts Magnitude pruning by 6.5 to 24.6 points.
Q:Can you rely on WikiText-2 perplexity to validate a pruned LLM?
No. The benchmark shows MMLU 5-shot reasoning degrades significantly faster than perplexity or zero-shot accuracy—for instance, Wanda-sp keeps 56.2% zero-shot accuracy while MMLU falls from 45.7% to 27.3%.
Q:Which pruned configuration achieved the strongest structured retention on Llama-2-7B?
CFSP with LoRA recovery removed 46.6% of FFN parameters while preserving 9.25 WikiText-2 PPL, 59.3% zero-shot accuracy, 39.1% MMLU, and reducing peak memory from 13.7 GB to 9.7 GB.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.