Bring the mental model from Efficiency: Quantization, Distillation, LoRA & Sparse MoE; this page will reuse it instead of restarting from zero.
Efficiency
Pruning: Removing Unnecessary Weights
Reduce parameter count by zeroing or removing weights. Unstructured sparsity needs sparse kernels for speed; structured pruning removes whole channels/heads to shrink dense tensor shapes.

Concept Structure
Pruning: Removing Unnecessary Weights
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learning map
Pruning: Removing Unnecessary WeightsConceptual Bridge
What should feel connected as you move through this page.
Reduce parameter count by zeroing or removing weights. Unstructured sparsity needs sparse kernels for speed; structured pruning removes whole channels/heads to shrink dense tensor shapes.
The next edge should feel earned: use the demo prediction here before following Quantization: Compressing Models to Integers.
01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
Deep nets are often heavily overparameterized. Pruning asks: can we remove weights (or whole structures like neurons/heads) while keeping most of the performance?
Two big distinctions matter:
- Unstructured pruning: set individual weights to zero. This can give huge sparsity numbers, but you only get speedups if your hardware/software stack has sparse kernels.
- Structured pruning: remove whole channels/heads/blocks. This often gives smaller compression, but because it changes dense tensor shapes, it is more likely to translate into wall-clock speedups on standard kernels.
The surprising part is that naive rules (like "prune small weights") often work decently, even though they are not theoretically optimal.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Magnitude pruning (a common baseline)
Let be a weight matrix and let be a threshold. Define a mask:
Structured pruning (remove units)
If is the set of columns/heads you keep, structured pruning changes the layer shape:
This changes the model shape, which is why it can translate into ordinary dense-kernel speedups more directly.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import numpy as np
rng = np.random.default_rng(0)
W = rng.normal(size=(256, 256)).astype(np.float32)
sparsity = 0.7 # prune 70% of weights by magnitude
th = np.quantile(np.abs(W), sparsity)
M = (np.abs(W) > th).astype(np.float32)
W_pruned = W * M
print("target sparsity:", sparsity)
print("actual sparsity:", round(float((M == 0).mean()), 3))
print("L2 norm ratio ||W_pruned||/||W||:", round(float(np.linalg.norm(W_pruned) / np.linalg.norm(W)), 3))
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
The demo below asks you to predict which pruning pattern actually turns into a speedup before revealing the mask and deployment metrics. The key invariant is that unstructured zeros reduce storage and sometimes sparse-kernel work, but structured pruning changes the dense matrix shape and therefore can map to ordinary GPU speedups more directly.
Live Concept Demo
Explore Pruning: Removing Unnecessary Weights
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Commit to what Pruning: Removing Unnecessary Weights should make visible before reading the result.
After The First Pass
Turn the concept into an inspected object.
Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.
Mechanism Storyboard
See the idea move before the page explains it
Reduce parameter count by zeroing or removing weights. Unstructured sparsity needs sparse kernels for speed; structured pruning removes whole channels/heads to shrink dense tensor shapes.

Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Pruning: Removing Unnecessary Weights should make visible.
Visual Inquiry
Make the image answer a mathematical question
Reduce parameter count by zeroing or removing weights. Unstructured sparsity needs sparse kernels for speed; structured pruning removes whole channels/heads to shrink dense tensor shapes.
Which visible object should carry the first intuition?
Pick the cue that should make Pruning: Removing Unnecessary Weights easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
Grounds magnitude-threshold connection pruning, retraining, sparse storage, and sparse-kernel batch-1 speed/energy benchmarks in the Deep Compression pipeline.
Open sourceGrounds structured/filter pruning as removing whole filters and feature maps, avoiding irregular sparse connectivity, and mapping to standard dense BLAS operations.
Open sourceClaim Review
Reduce parameter count by zeroing or removing weights. Unstructured sparsity needs sparse kernels for speed; structured pruning removes whole channels/heads to shrink dense tensor shapes.
Claims without a substantive review badge still need exact source-support review.
han-2015-deep-compression, li-2016-pruning-filters
Use equation, code, and demo objects to check whether the source support is operational.
Han et al. prune small-weight connections below a threshold, retrain remaining sparse connections, store them as CSR/CSC, and benchmark sparse matrix-vector kernels. Li et al. show filter pruning removes whole filters/feature maps, avoids sparse connectivity, and works with dense BLAS. The page math/code/demo instantiate this contrast.
Sources: Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman Coding, Pruning Filters for Efficient ConvNetsThis checks the pruning-mask and deployment-distinction lesson, not exact compression ratios, full retraining schedules, measured speedups, modern pruning methods, sparse-kernel performance on current hardware, or accuracy preservation guarantees.A bounded review summary is present; still check caveats and exact source scope.Oracle PASS: Han supports thresholded unstructured connection pruning, masks, CSR/CSC sparse storage, and sparse-kernel benchmarking; Li supports filter/feature-map removal that avoids irregular sparsity and maps to smaller dense BLAS operations. Scope excludes exact ratios, schedules, modern hardware, universal speedups, and accuracy guarantees.
Reviewer: codex+oracle; reviewed 2026-05-07Source support candidates
paper 2015Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman CodingGrounds magnitude-threshold connection pruning, retraining, sparse storage, and sparse-kernel batch-1 speed/energy benchmarks in the Deep Compression pipeline.
paper 2016Pruning Filters for Efficient ConvNetsGrounds structured/filter pruning as removing whole filters and feature maps, avoiding irregular sparse connectivity, and mapping to standard dense BLAS operations.
Practice Loop
Try the idea before it explains itself
Reduce parameter count by zeroing or removing weights. Unstructured sparsity needs sparse kernels for speed; structured pruning removes whole channels/heads to shrink dense tensor shapes.
Before touching the demo, predict one visible change that should happen in Pruning: Removing Unnecessary Weights.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
Research Room
Attach the question to an exact object
Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.Open the draft below to save one note and next action in this browser.
Pruning: Removing Unnecessary Weights
What is the smallest example that makes Pruning: Removing Unnecessary Weights click without losing the math?
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays locally in this browser for concept:efficiency/pruning.
- Source ids to inspect: han-2015-deep-compression, li-2016-pruning-filters
- Definition, prerequisite, and contrast concept links
- The equation or code witness that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Pruning: Removing Unnecessary Weights Object key: concept:efficiency/pruning Context: Efficiency Anchor id: concept/concept-notebook/efficiency/pruning Open question: What is the smallest example that makes Pruning: Removing Unnecessary Weights click without losing the math? Evidence to inspect: - Source ids to inspect: han-2015-deep-compression, li-2016-pruning-filters - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.
concept/concept-notebook/efficiency/pruning
concept:efficiency/pruning