SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.11695 · ICLR · 2024

A Simple and Effective Pruning Approach for Large Language Models

J Zico Kolter, Zhuang Liu, Mingjie Sun, Anna Bair

arXiv · PDF · Open in the Atlas

Code that ran

9 of 22 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 3 failures of our instrument; 13 no recorded run), measured 2026-11-24; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2306.11695.json · badge: /api/ran/2306.11695.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
locuslab/wanda canonical (classifier label)
classifier basis: classifier_2025
2 ran · 4 no recorded run
ruchikachavhan/concept-prune community
Papers with Code archive
4 ran · 0 no recorded run
crystaleye42/eval-safety community
Papers with Code archive
1 ran · 5 no recorded run
baithebest/adagp community
Papers with Code archive
1 ran · 0 no recorded run
copy not recorded community
not in the paper's declared repositories
1 ran · 0 no recorded run
qiaoxiao7282/seft community
Papers with Code archive
0 ran · 4 no recorded run
FunctionStatusWhere it lives
BaseNeuronReceiver Ran
ran on a synthesized input · constructed an object; no result was computed
ruchikachavhan/concept-prune/neuron_receivers/wanda_receiver.py
pointer only (licence: NONE) · get_code("f0bf77723cb645ec")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ruchikachavhan/concept-prune when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ColumnNormCalculator Ran
ran on a synthesized input · constructed an object; no result was computed
ruchikachavhan/concept-prune/neuron_receivers/wanda_receiver.py
pointer only (licence: NONE) · get_code("5a2c0dc15b39cddf")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ruchikachavhan/concept-prune when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

SparseGPT_LlaMA Ran
ran on a synthesized input · constructed an object; no result was computed
baithebest/adagp/pruning_utils.py
code served (permissive licence) · get_code("e36ff7e861167680")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SparseGPT_LlaMA: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import transformers
import math

torch.manual_seed(0)

# Create a small linear layer to use as the layer parameter
layer = nn.Linear(in_features=4, out_features=3, bias=False)

# Initialize with CPU device
layer = layer.to('cpu')

# Create the SparseGPT_LlaMA instance
sparsegpt_instance = type('SparseGPT_LlaMA', (), {})()

# Now we need to set up the arguments for __init__
# The __init__ only takes 'layer' as parameter

ARGS = {
    'layer': layer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SparseGPT_LlaMA — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SparseGPT_LlaMA output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
TimeLayerColumnNorm Ran
ran on a synthesized input · constructed an object; no result was computed
ruchikachavhan/concept-prune/neuron_receivers/wanda_receiver.py
pointer only (licence: NONE) · get_code("fbd6d90f750b7edc")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ruchikachavhan/concept-prune when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Wanda Ran
ran on a synthesized input · constructed an object; no result was computed
ruchikachavhan/concept-prune/neuron_receivers/wanda_receiver.py
pointer only (licence: NONE) · get_code("ac7406fce0dca1ac")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ruchikachavhan/concept-prune when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

check_sparsity Ran
ran, honoured the contract we drafted
locuslab/wanda/lib/prune.py
code served (permissive licence) · get_code("3b7b64b9aea9a039")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal config class with use_cache attribute
class MinimalConfig:
    def __init__(self):
        self.use_cache = False

# Create a minimal model that satisfies the function's requirements
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.config = MinimalConfig()
        self.model = nn.Module()
        
        # Create layers attribute with some simple layers
        layers = nn.ModuleList()
        
        # Layer 0: with some zero weights
        layer0 = nn.Module()
        layer0.linear1 = nn.Linear(4, 3)
        layer0.linear1.weight.data[0, :] = 0  # Make first row sparse
        layers.append(layer0)
        
        # Layer 1: with different sparsity
        layer1 = nn.Module()
        layer1.linear1 = nn.Linear(3, 2)
        layer1.linear1.weight.data[0, 0] = 0  # Make some weights sparse
        layers.append(layer1)
        
        self.model.layers = layers

# Instantiate the model
model = MinimalModel()

# Define ARGS dictionary with all parameters
ARGS = {
    'model': model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_layers Ran
ran; our contract draft was wrong, not the code
locuslab/wanda/lib/prune.py
code served (permissive licence) · get_code("56ac52f94f2cc872")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a simple module hierarchy with various layer types
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.relu = nn.ReLU()
        self.linear2 = nn.Linear(3, 2)
        self.submodule = nn.Sequential(
            nn.Linear(2, 5),
            nn.ReLU(),
            nn.Linear(5, 1)
        )
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.relu(x)
        x = self.linear2(x)
        x = self.submodule(x)
        return x

module = SimpleModel()

ARGS = {
    'module': module,
    'layers': [nn.Linear],
    'name': ''
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
return_given_alpha Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
crystaleye42/eval-safety/lib/prune.py
code served (permissive licence) · get_code("d79ce728b3ab7682")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Analyzing the function:
# - alpha: used in multiplication with sum_before, should be a scalar or tensor
# - sort_res: indexed as sort_res[0], which is then used with torch.gather
#   sort_res[0] should be a tensor of shape (batch, features)
# - W_metric: compared with <= operator, should be a tensor
# - tmp_metric: compared with <= operator, shape should match (batch, features)
# - sum_before: multiplied by alpha, should be a 1D tensor of shape (batch,)

# The function:
# 1. Computes thres_cumsum = sum_before * alpha
# 2. Creates sort_mask by comparing tmp_metric <= thres_cumsum.reshape((-1, 1))
# 3. Uses torch.gather on sort_res[0] with indices from sort_mask.sum(dim=1, keepdims=True) - 1
# 4. Compares W_metric <= thres
# 5. Computes sparsity as ratio of True values

# Setting up small tensors with distinct dimensions:
batch_size = 2
feature_size = 4

# alpha: scalar or small tensor
alpha = torch.tensor(0.5)

# sum_before: shape (batch_size,)
sum_before = torch.tensor([10.0, 20.0])

# sort_res: list with first element being (batch_size, feature_size) tensor
sort_res = [torch.randn(batch_size, feature_size)]

# tmp_metric: (batch_size, feature_size) - values to compare
tmp_metric = torch.randn(batch_size, feature_size)

# W_metric: (batch_size, feature_size) - values to compare with threshold
W_metric = torch.randn(batch_size, feature_size)

ARGS = {
    "alpha": alpha,
    "sort_res": sort_res,
    "W_metric": W_metric,
    "tmp_metric": tmp_metric,
    "sum_before": sum_before,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sc Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from mail-research/cad-attribution4diffusion
pointer only; the stored copy get_code serves, from mail-research/cad-attribution4diffusion, is pointer only (licence: GPL-3.0) · get_code("02fe1aebf8355cab")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_c4 Not yet run
unverified (harvested, no recorded run)
crystaleye42/eval-safety/lib/prune.py
code served (permissive licence) · get_code("9660cb0c932e836e")
How it ran

no invocation recorded.

get_c4 Not yet run
unverified (harvested, no recorded run)
qiaoxiao7282/seft/lib/prune_all.py
pointer only (licence: NONE) · get_code("112fa6e5a362cc14")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, qiaoxiao7282/seft when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_c4 Not yet run
unverified (harvested, no recorded run)
locuslab/wanda/lib/prune.py
code served (permissive licence) · get_code("5a7a61a0235b3907")
How it ran

no invocation recorded.

get_loaders Not yet run
unverified (harvested, no recorded run)
crystaleye42/eval-safety/lib/prune.py
code served (permissive licence) · get_code("142350989c8691e6")
How it ran

no invocation recorded.

get_loaders Not yet run
unverified (harvested, no recorded run)
qiaoxiao7282/seft/lib/prune_all.py
pointer only (licence: NONE) · get_code("a0fc985586f0984c")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, qiaoxiao7282/seft when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_loaders Not yet run
unverified (harvested, no recorded run)
locuslab/wanda/lib/prune.py
code served (permissive licence) · get_code("d2a4a72ebbf33444")
How it ran

no invocation recorded.

get_wikitext2 Not yet run
unverified (harvested, no recorded run)
crystaleye42/eval-safety/lib/prune.py
code served (permissive licence) · get_code("1afe3719e760f32e")
How it ran

no invocation recorded.

prepare_calibration_input Not yet run
unverified (harvested, no recorded run)
locuslab/wanda/lib/prune.py
code served (permissive licence) · get_code("33272894b6721cfb")
How it ran

no invocation recorded.

prepare_calibration_input Not yet run
unverified (harvested, no recorded run)
crystaleye42/eval-safety/lib/prune.py
code served (permissive licence) · get_code("9aed9bf93575f59e")
How it ran

no invocation recorded.

prepare_calibration_input Not yet run
unverified (harvested, no recorded run)
qiaoxiao7282/seft/lib/prune_all.py
pointer only (licence: NONE) · get_code("09d5f6f2798113c6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, qiaoxiao7282/seft when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

prune_wanda Not yet run
unverified (harvested, no recorded run)
crystaleye42/eval-safety/lib/prune.py
code served (permissive licence) · get_code("f4e32af5cd3a92c5")
How it ran

no invocation recorded.

prune_wanda Not yet run
unverified (harvested, no recorded run)
qiaoxiao7282/seft/lib/prune_all.py
pointer only (licence: NONE) · get_code("3754399ccd7d5c49")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, qiaoxiao7282/seft when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

prune_wanda Not yet run
unverified (harvested, no recorded run)
locuslab/wanda/lib/prune.py
code served (permissive licence) · get_code("20569259cb1e7307")
How it ran

no invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 20 distinct functions with an identity, 10 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 10 later) and 10 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
find_layers
brick of this paper's assembly: helper
21 other papers
21 later · 5 only as an assembly brick
2310.05175 (2023-10)
Outlier Weighed Layerwise Sparsity (OWL ): A Missing Secret Sauce for Pruning LLMs to High Sparsity
2310.08915 (2023-10)
Dynamic Sparse No Training: Training-Free Fine-tuning for Sparse LLMs
2311.04902 (2023-11)
Beyond Size: How Gradients Shape Pruning Decisions in Large Language Models
and 18 more not named here
get_wikitext2
brick of this paper's assembly: helper
15 other papers
15 later · 1 only as an assembly brick
2310.01382 (2023-10)
Compressing LLMs: The Truth is Rarely Pure and Never Simple
2310.05175 (2023-10)
Outlier Weighed Layerwise Sparsity (OWL ): A Missing Secret Sauce for Pruning LLMs to High Sparsity
2310.08915 (2023-10)
Dynamic Sparse No Training: Training-Free Fine-tuning for Sparse LLMs
and 12 more not named here
get_c4
brick of this paper's assembly: helper
10 other papers
10 later · 1 only as an assembly brick
2310.05175 (2023-10)
Outlier Weighed Layerwise Sparsity (OWL ): A Missing Secret Sauce for Pruning LLMs to High Sparsity
2310.08915 (2023-10)
Dynamic Sparse No Training: Training-Free Fine-tuning for Sparse LLMs
2312.11983 (2023-12)
Fluctuation-based Adaptive Structured Pruning for Large Language Models
and 7 more not named here
get_loaders
brick of this paper's assembly: data_transform, sampler
9 other papers
9 later
2310.01382 (2023-10)
Compressing LLMs: The Truth is Rarely Pure and Never Simple
2310.05175 (2023-10)
Outlier Weighed Layerwise Sparsity (OWL ): A Missing Secret Sauce for Pruning LLMs to High Sparsity
2311.04902 (2023-11)
Beyond Size: How Gradients Shape Pruning Decisions in Large Language Models
and 6 more not named here
prepare_calibration_input
brick of this paper's assembly: helper
4 other papers
4 later · 1 only as an assembly brick
2310.05175 (2023-10)
Outlier Weighed Layerwise Sparsity (OWL ): A Missing Secret Sauce for Pruning LLMs to High Sparsity
2401.02938 (2024-01)
Fast and Effective Weight Update for Pruned Large Language Models
2406.02924 (2024-06)
Pruner-Zero: Evolving Symbolic Pruning Metric from scratch for Large Language Models
and 1 more not named here
sc
brick of this paper's assembly: helper
4 other papers
4 later · 1 only as an assembly brick
2310.10012 (2023-10)
Ring-A-Bell! How Reliable are Concept Removal Methods for Diffusion Models?
2312.08207 (2023-12)
Black-box Membership Inference Attacks against Fine-tuned Diffusion Models
2412.02542 (2024-12)
Unveiling Concept Attribution in Diffusion Models
and 1 more not named here
get_c4
brick of this paper's assembly: helper
3 other papers
3 later
2401.02938 (2024-01)
Fast and Effective Weight Update for Pruned Large Language Models
2406.15524 (2024-06)
Rethinking Pruning Large Language Models: Benefits and Pitfalls of Reconstruction Error Minimization
2505.23807 (2025-05)
DLP: Dynamic Layerwise Pruning in Large Language Models
check_sparsity 2 other papers
2 later
2310.08915 (2023-10)
Dynamic Sparse No Training: Training-Free Fine-tuning for Sparse LLMs
2401.02938 (2024-01)
Fast and Effective Weight Update for Pruned Large Language Models
return_given_alpha
brick of this paper's assembly: helper, update_rule
2 other papers
2 later · 1 only as an assembly brick
2025.findings-acl.394 (2025 (year only))
Hierarchical Safety Realignment: Lightweight Restoration of Safety in Pruned Large Vision-Language Models
2505.23807 (2025-05)
DLP: Dynamic Layerwise Pruning in Large Language Models
BaseNeuronReceiver
brick of this paper's assembly: helper
1 other paper
1 later
2310.10012 (2023-10)
Ring-A-Bell! How Reliable are Concept Removal Methods for Diffusion Models?

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

As their size increases, Large Languages Models (LLMs) are natural candidates for network pruning methods: approaches that drop a subset of network weights while striving to preserve performance. Existing methods, however, require either retraining, which is rarely affordable for billion-scale LLMs, or solving a weight reconstruction problem reliant on second-order information, which may also be computationally expensive. In this paper, we introduce a novel, straightforward yet effective pruning method, termed Wanda (Pruning by Weights and activations), designed to induce sparsity in pretrained LLMs. Motivated by the recent observation of emergent large magnitude features in LLMs, our approach prunes weights with the smallest magnitudes multiplied by the corresponding input activations, on a per-output basis. Notably, Wanda requires no retraining or weight update, and the pruned LLM can be used as is. We conduct a thorough evaluation of our method Wanda on LLaMA and LLaMA-2 across various language benchmarks. Wanda significantly outperforms the established baseline of magnitude pruning and performs competitively against recent method involving intensive weight update. Code is available at https://github.com/locuslab/wanda.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2306.11695")
get_code_for_paper("2306.11695")
have("2306.11695")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2306.11695.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2306.11695.svg)](https://syntology.ai/paper/2306.11695)

Connect an agent — have() is free.