Concept notebookChecking saved investigationReading browser-local route memory before showing a continuation.

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.

published · difficulty 3/5 · 16 min read

01

01

Intuition

Build the mental picture first so the rest of the page has something to attach to.

PredictName the object in plain language, then predict what should change.Leave with one reusable mental picture before notation appears.

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.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

02

02

Math

Translate the story into symbols, assumptions, and a derivation you can inspect.

InspectTrack the same object through the notation and check each symbol.Leave with the invariant the equations preserve.

Magnitude pruning (a common baseline)

Let WWW be a weight matrix and let θ\thetaθ be a threshold. Define a mask:

Mij=1[Wij>θ],Wpruned=WM.M_{ij}=\mathbf 1[|W_{ij}|>\theta],\qquad W_{\text{pruned}}=W\odot M.Mij=1[Wij>θ],Wpruned=WM.

Structured pruning (remove units)

If SSS is the set of columns/heads you keep, structured pruning changes the layer shape:

Wpruned=W[:,S].W_{\text{pruned}} = W[:,\,S].Wpruned=W[:,S].

This changes the model shape, which is why it can translate into ordinary dense-kernel speedups more directly.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

03

03

Code

Keep the implementation aligned with the notation so the algorithm is legible.

TraceMatch variables to symbols before reading the implementation.Leave with a runnable witness for the math.
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))
Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

04

04

Interactive Demo

Use direct manipulation to connect the explanation to a moving system.

ManipulateChange one control and predict the visible response before reveal.Leave with the observed invariant or a repaired model.

Live Concept Demo

Explore Pruning: Removing Unnecessary Weights

The stage is code-native and interactive. Use it to test the explanation against the mechanism.

difficulty 3/5undergraduatecode-aligned
Demo inquiry checkpoint

Manipulate one control and predict the visible change.

01Choose lensTrace a quantity
02ObserveDemo state pending
03GroundName the equation, invariant, or control that explains it.
04CarryNext: Quantization: Compressing Models to Integers

Choose what to inspect in Pruning: Removing Unnecessary Weights. This shared fallback is an observation guide, not evidence of learning.

Loading interactive demo...

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.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

4/4 sections ready

Concept: Pruning: Removing Unnecessary Weights

What is the smallest example that makes Pruning: Removing Unnecessary Weights click without losing the math?

BeforeEfficiency: Quantization, Distillation, LoRA & Sparse MoENow4/4 sections readyTryManipulate one control and predict the visible change.NextQuantization: Compressing Models to Integers
Object contextEfficiency
ConceptLearner lens

Pruning: Removing Unnecessary Weights

What is the smallest example that makes Pruning: Removing Unnecessary Weights click without losing the math?

Mode questionCan I say the mechanism back in one sentence before I reveal anything?

Start with the prediction checkpoint, then compare the reveal to the mental model.

Take this move

Study modes

Keep the object fixed; change the lens.

Route back through the notebook

Carry the same object through intuition, math, code, and demo.

4/4 sections ready
Carry inEfficiency: Quantization, Distillation, LoRA & Sparse MoE

Bring the mental model from Efficiency: Quantization, Distillation, LoRA & Sparse MoE; this page will reuse it instead of restarting from zero.

Work herePruning: 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.

Carry outQuantization: Compressing Models to Integers

The next edge should feel earned: use the demo prediction here before following Quantization: Compressing Models to Integers.

After The First Pass

Turn the concept into an inspected object.

The lower panels are one second act: keep the object fixed, inspect it visually, check source boundaries, practice transfer, then attach the research question.
ConceptPruning: Removing Unnecessary WeightsEfficiency

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.

Demo notes open01 / Intuition
Editorial efficiency illustration of a dense weight grid being pruned into a smaller sparse structure.
Prediction lens

Start with the picture, metaphor, or geometric mechanism.

Commit first

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.

4/4 stages readyDemo notes connected
Prediction

Which visible object should carry the first intuition?

Commit first

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.

Object - ConceptPruning: Removing Unnecessary WeightsQuestion

What is the smallest example that makes Pruning: Removing Unnecessary Weights click without losing the math?

concept:efficiency/pruning
Boundary

sources: han-2015-deep-compression, li-2016-pruning-filters

Check

Open the closest source note before trusting the local explanation.

Evidence

2 selected-object sources shown first; 2 references total.

Next move

Audit the claim boundary, then ask from the same selected object.

selected object source · paper · 2015Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffman CodingHan, Mao, and Dally
Located CF editorial boundary

Grounds magnitude-threshold connection pruning, retraining, sparse storage, and sparse-kernel batch-1 speed/energy benchmarks in the Deep Compression pipeline.

Used here as

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...

Caveat

This checks the pruning-mask and deployment-distinction lesson, not exact compression ratios, full retraining schedules, measured speedups, modern pruning methods, sparse-kernel performan...

Open source
selected object source · paper · 2016Pruning Filters for Efficient ConvNetsHao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf
Located CF editorial boundary

Grounds structured/filter pruning as removing whole filters and feature maps, avoiding irregular sparse connectivity, and mapping to standard dense BLAS operations.

Used here as

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...

Caveat

This checks the pruning-mask and deployment-distinction lesson, not exact compression ratios, full retraining schedules, measured speedups, modern pruning methods, sparse-kernel performan...

Open source

Claim 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.

Object - ConceptPruning: Removing Unnecessary WeightsQuestion

What is the smallest example that makes Pruning: Removing Unnecessary Weights click without losing the math?

concept:efficiency/pruning
Boundary

sources: han-2015-deep-compression, li-2016-pruning-filters

Check

Treat every claim as provisional until source support and a local witness agree.

Evidence

1 structured claim check on this concept.

Next move

Run the prediction or practice transfer before asking for a grounded review.

1 CF editorial source-scope review recorded

Publisher-side editorial review is not independent replication. Claims without it still need exact source-support review. 2 references and 3 local witnesses are available for inspection.

Pruning can be taught as applying a sparsity mask, often with a magnitude threshold: unstructured zeros can compress storage but do not automatically speed dense kernels, while structured filter/channel removal changes tensor shape and can map to dense-kernel acceleration.
Used here as

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 who...

Local witness
Equation 1
Mij=1[Wij>θ],Wpruned=WM.M_{ij}=\mathbf 1[|W_{ij}|>\theta],\qquad W_{\text{pruned}}=W\odot M.
Equation 2
Wpruned=W[:,S].W_{\text{pruned}} = W[:,\,S].
Code witness 1import numpy as np rng = np.random.default_rng(0) W = rng.normal(size=(256, 256)).astype(np.f...
Caveat

This 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 hardwa...

Review stateCF editorial source-scope reviewClaim metadata: source checkedPublisher-side editorial review only; not independent replication. 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-07

Practice notebook

Use the idea, then test it somewhere new

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.

AttemptNo learning claim inferred
Object - ConceptPruning: Removing Unnecessary WeightsQuestion

What is the smallest example that makes Pruning: Removing Unnecessary Weights click without losing the math?

concept:efficiency/pruning
Boundary

sources: han-2015-deep-compression, li-2016-pruning-filters

Check

Use one state from Pruning: Removing Unnecessary Weights to explain what changes, why it changes, and which assumption the explanation needs.

Evidence

No learner move yet; no learning state is inferred.

Next move

Write first, use only the help you need, then try a new case without it.

Explain

Use one state from Pruning: Removing Unnecessary Weights to explain what changes, why it changes, and which assumption the explanation needs.

Hint 1

Reveal when your model needs a nudge.

Hint 2

Reveal when your model needs a nudge.

Hint 3

Reveal when your model needs a nudge.

Grounded object roomClose
Selected object routeAsk from this object; carry one invariant back.sources: han-2015-deep-compression, li-2016-pruning-filters
  1. ObjectConceptPruning: Removing Unnecessary Weights
  2. PredictBefore revealPruning: Removing Unnecessary Weights prediction
  3. WitnessCompare codePruning: Removing Unnecessary Weights code witness 1
  4. RoomAsk groundedChecking local snapshot
ConceptPruning: Removing Unnecessary WeightsEfficiency

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.
Next local actionNo local draft saved yet

Open the draft below to save one note and next action in this browser.

conceptEfficiency

Pruning: Removing Unnecessary Weights

Anchored question

What is the smallest example that makes Pruning: Removing Unnecessary Weights click without losing the math?

Source boundaryInspect source ids: han-2015-deep-compression, li-2016-pruning-filtersStable content-object key attached
Role lenses for this object

These are fixed, deterministic perspectives derived from the selected object. They do not represent people, community contributions, or independent review.

Learner evidence requestAsk what would make "Pruning: Removing Unnecessary Weights" feel predictable rather than familiar.
Assumption

Source ids han-2015-deep-compression, li-2016-pruning-filters must support the exact object, not just the surrounding topic.

Source-checking summary

Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion.

Proposed experiment

Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo.

Next action

The learner can state the mechanism in their own words

Evidence4 checks
PredictionChecking carried observation
ActionReady for one action
AILearner handoff ready
Open source object
01PredictionChecking browser-local route memory
02EvidenceChecking for a carried observation
03BoundaryInspect source ids: han-2015-deep-compression, li-2016-pruning-filters
04Next moveSave one next action
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
Local action draft

This draft stays locally in this browser for concept:efficiency/pruning.

No local draft saved.
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
Object-attached AI handoff

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 Deterministic role lenses for this object: - Boundary: fixed perspectives, not people, community contributions, or independent review - Source-checking summary: Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Teach/transfer move: Turn the mechanism into one sentence that predicts a neighboring concept. - Assumptions: - Source ids han-2015-deep-compression, li-2016-pruning-filters must support the exact object, not just the surrounding topic. - The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. - The concept explanation is local atlas prose until checked against its math, code, and source support. - Prerequisite gaps should become a repair route, not a reason to leave the object vague. - Role-lens requests: - Learner: ask for "Ask what would make "Pruning: Removing Unnecessary Weights" feel predictable rather than familiar." | assumption: Source ids han-2015-deep-compression, li-2016-pruning-filters must support the exact object, not just the surrounding topic. | next action: The learner can state the mechanism in their own words - Researcher: ask for "Source ids to inspect: han-2015-deep-compression, li-2016-pruning-filters" | assumption: The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. | next action: The learner can name the prerequisite that would repair confusion - Experimenter: ask for "Choose one variable or condition to perturb before asking for an explanation." | assumption: The concept explanation is local atlas prose until checked against its math, code, and source support. | next action: The learner can predict how the mechanism changes under one perturbation - Professor: ask for "Find the smallest transferable rule a learner could reuse without the AI." | assumption: Prerequisite gaps should become a repair route, not a reason to leave the object vague. | next action: Teach or transfer: Turn the mechanism into one sentence that predicts a neighboring concept. 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. Current deterministic role lens for this object: - Role lens: Learner - Evidence request: Ask what would make "Pruning: Removing Unnecessary Weights" feel predictable rather than familiar. - Assumption to keep visible: Source ids han-2015-deep-compression, li-2016-pruning-filters must support the exact object, not just the surrounding topic. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Next action: The learner can state the mechanism in their own words

concept/concept-notebook/efficiency/pruning concept:efficiency/pruning