SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1506.02626 · 2015

Learning both Weights and Connections for Efficient Neural Networks

Song Han, William Dally, Jeff Pool, John Tran

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 2 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/1506.02626.json · badge: /api/ran/1506.02626.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
ciodar/deep-compression community
Papers with Code archive
4 ran · 1 no recorded run
JoseVillagranE/Learning-Both-Weights-and-Connections-for-Efficient-NNs community
Papers with Code archive
2 ran · 0 no recorded run
tomshalini/pruning_lenet300-100 community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
FineGrainedPruner Ran
ran on a synthesized input · constructed an object; no result was computed
JoseVillagranE/Learning-Both-Weights-and-Connections-for-Efficient-NNs/pruning.py
pointer only (licence: NONE) · get_code("cdf35d1cd84c892d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, JoseVillagranE/Learning-Both-Weights-and-Connections-for-Efficient-NNs 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.

LinearWithAdjustableDropout Ran
ran on a synthesized input · constructed an object; no result was computed
ciodar/deep-compression/trainer/callbacks/pruning.py
code served (permissive licence) · get_code("6564e1ebcafd6d0f")
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, LinearWithAdjustableDropout: the run constructed the object and did not call it, so no result was computed. 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
import math

torch.manual_seed(0)

class LinearWithAdjustableDropout(nn.Linear):

    def __init__(self, in_features, out_features, dropout_rate=0.5):
        super().__init__(in_features, out_features)
        self.dropout_rate = dropout_rate

    def forward(self, input):
        import torch.nn.functional as F
        out = F.dropout(input, self.dropout_rate, self.training)
        out = super().forward(input)
        return out

    def adjust_dropout_rate(self, name='weight'):
        c_ir, c_i0 = self.get_pruned(name)
        self.dropout_rate = self.dropout_rate * math.sqrt(c_ir / c_i0)
    
    def get_pruned(self, name: str):
        attr = f'{name}_mask'
        if not hasattr(self, attr):
            return (0, 1)
        mask = getattr(self, attr)
        return ((mask == 0).sum().item(), mask.numel())

# Create an instance with distinct dimensions
module = LinearWithAdjustableDropout(in_features=4, out_features=3, dropout_rate=0.5)

# Add a weight mask to test the pruning logic
weight_mask = torch.ones_like(module.weight)
weight_mask[0:1, 0:1] = 0  # Prune one element
module.weight_mask = weight_mask

ARGS = {
    'in_features': 4,
    'out_features': 3,
    'dropout_rate': 0.5
}
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 LinearWithAdjustableDropout — 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 LinearWithAdjustableDropout 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
ThresholdPruning Ran
ran on a synthesized input · constructed an object; no result was computed
ciodar/deep-compression/trainer/callbacks/pruning.py
code served (permissive licence) · get_code("f6511a3e3fdf9486")
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, ThresholdPruning: the run constructed the object and did not call it, so no result was computed. 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
from torch.nn.utils.prune import BasePruningMethod

torch.manual_seed(0)

class ThresholdPruning(BasePruningMethod):
    PRUNING_TYPE = 'unstructured'

    def __init__(self, amount):
        self.s = amount

    def compute_mask(self, tensor, default_mask):
        threshold = torch.std(tensor).item() * self.s
        return torch.abs(tensor) > threshold

ARGS = {
    'amount': 0.5
}
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 ThresholdPruning — 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 ThresholdPruning 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
fine_grained_prune Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
JoseVillagranE/Learning-Both-Weights-and-Connections-for-Efficient-NNs/pruning.py
pointer only (licence: NONE) · get_code("57df211eb79a4f38")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, JoseVillagranE/Learning-Both-Weights-and-Connections-for-Efficient-NNs 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.

get_pruned Ran
ran, honoured the contract we drafted
ciodar/deep-compression/trainer/callbacks/pruning.py
code served (permissive licence) · get_code("34f00aaf868661c9")
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, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 nn.Module with a pruning mask
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
        # Add a pruning mask attribute
        self.weight_mask = torch.tensor([1, 0, 1, 0], dtype=torch.float32)

module = SimpleModule()
name = "weight"

ARGS = {
    "module": module,
    "name": name
}
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, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
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
prune_weights Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tomshalini/pruning_lenet300-100/prune_model.py
pointer only (licence: NONE) · get_code("9def416438747df0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, tomshalini/pruning_lenet300-100 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.

sparsity_stats Ran
ran, honoured the contract we drafted
ciodar/deep-compression/trainer/callbacks/pruning.py
code served (permissive licence) · get_code("fe8133bc905d6833")
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, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 logging

# Set seed for reproducibility
torch.manual_seed(0)

# Set up logging to see the output
logging.basicConfig(level=logging.INFO)

# Create a simple model with pruning masks
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
        
        # Add pruning masks for the weights
        # For linear1: 4x3 weight matrix
        self.linear1.weight_mask = torch.ones(3, 4)
        self.linear1.weight_mask[0, 0] = 0  # One pruned weight
        self.linear1.weight_mask[1, 1] = 0  # Another pruned weight
        
        # For linear2: 3x2 weight matrix
        self.linear2.weight_mask = torch.ones(2, 3)
        self.linear2.weight_mask[0, 0] = 0  # One pruned weight

model = SimpleModel()

ARGS = {
    'model': model,
    'name': 'weight'
}
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, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
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
IterativePruning Not yet run
unverified (harvested, no recorded run)
ciodar/deep-compression/trainer/callbacks/pruning.py
code served (permissive licence) · get_code("377845318c40391f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 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.

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

Repositories linked to this paper

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

Abstract

Neural networks are both computationally intensive and memory intensive, making them difficult to deploy on embedded systems. Also, conventional networks fix the architecture before training starts; as a result, training cannot improve the architecture. To address these limitations, we describe a method to reduce the storage and computation required by neural networks by an order of magnitude without affecting their accuracy by learning only the important connections. Our method prunes redundant connections using a three-step method. First, we train the network to learn which connections are important. Next, we prune the unimportant connections. Finally, we retrain the network to fine tune the weights of the remaining connections. On the ImageNet dataset, our method reduced the number of parameters of AlexNet by a factor of 9×, from 61 million to 6.7 million, without incurring accuracy loss. Similar experiments with VGG-16 found that the total number of parameters can be reduced by 13×, from 138 million to 10.3 million, again with no loss of accuracy.

For agents

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

get_harvested_code_for_paper("1506.02626")
get_code_for_paper("1506.02626")
have("1506.02626")

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

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

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

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

Connect an agent — have() is free.