ML Model Optimization • Model Pruning (Structured vs Unstructured)Easy⏱️ ~3 min

Structured vs Unstructured Pruning: Core Differences

Definition
Model pruning removes weights or neurons from a trained neural network to reduce size and computation. The key insight: 80-90% of neural network weights contribute minimally to predictions and can be removed with negligible accuracy loss.

Unstructured Pruning

Removes individual weights anywhere in the network, creating sparse weight matrices. A 90% pruned layer keeps only 10% of its original weights. The remaining weights are scattered unpredictably. Advantage: maximum flexibility means maximum compression. A 95% sparse network can match dense accuracy. Disadvantage: sparse matrices don"t run faster on standard hardware. A GPU still processes full matrix multiplications; zeros just produce zero outputs.

Structured Pruning

Removes entire neurons, channels, or layers rather than individual weights. Pruning a filter in a convolutional layer removes that filter entirely plus corresponding connections. The result is a smaller dense network, not a sparse one. Advantage: direct speedup on any hardware since matrix dimensions actually shrink. A network with 50% of channels pruned runs approximately 2x faster. Disadvantage: less flexible, harder to maintain accuracy at high compression ratios.

The Practical Gap

Unstructured pruning achieves 10-20x compression on paper but often no speedup without specialized sparse hardware. Structured pruning typically achieves 2-4x compression but delivers real speedups on GPUs and CPUs. Choose based on deployment target, not just compression ratio.

💡 Key Takeaways
✓80-90% of neural network weights can be removed with minimal accuracy loss
✓Unstructured pruning removes individual weights, creating sparse matrices that compress well but don"t speed up standard hardware
✓Structured pruning removes entire neurons/channels, creating smaller dense networks with real speedups
✓Unstructured: 10-20x compression, no speedup without sparse hardware; Structured: 2-4x compression, real speedups
✓Choose pruning type based on deployment hardware, not just compression ratio
📌 Interview Tips
1Explain the structured vs unstructured distinction clearly - interviewers test whether you understand why sparse matrices don"t speed up GPUs
2Mention specific compression ratios (90-95% for unstructured, 50-75% for structured) to show practical experience
3Discuss the hardware dependency: structured for standard GPUs/CPUs, unstructured only with sparse accelerators
← Back to Model Pruning (Structured vs Unstructured) Overview