SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.00198 · 2023

Filter Pruning for Efficient CNNs via Knowledge-driven Differential Filter Sampler

arXiv · PDF · Open in the Atlas

Code that ran

7 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 2 failures of our instrument; 4 no recorded run), measured 2026-11-23; 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/2307.00198.json · badge: /api/ran/2307.00198.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
osilly/kdfs canonical (classifier label)
classifier basis: census
7 ran · 4 no recorded run
FunctionStatusWhere it lives
DenseNet_40_pruned_cifar10 Ran
ran on a synthesized input
osilly/kdfs/model/pruned_model/DenseNet_pruned.py
code served (permissive licence) · get_code("84f236df2836cfb9")
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 DenseNet_pruned. 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)

# For DenseNet_40_pruned_cifar10, we need to provide masks
# depth=40, so we need (depth - 2) = 38 masks
# nDenseBlocks = (40 - 4) // 3 = 12 (since bottleneck=False)
# masks structure: [0:12] for dense1, [12] for trans1, [13:25] for dense2, [25] for trans2, [26:38] for dense3

# Create masks as binary tensors indicating which filters are preserved
# Each mask should have some preserved filters (sum > 0)
growthRate = 12

# Create 38 masks total
# For each dense block layer, we need a mask that determines preserved filter count
masks = []
for i in range(38):
    # Create a mask with random preserved filters (at least 1 to avoid empty conv layers)
    # Use small random size for masks to keep model small
    mask_size = 12  # Same as growthRate for simplicity
    mask = torch.randint(0, 2, (mask_size,)).float()
    # Ensure at least one filter is preserved
    if mask.sum() == 0:
        mask[0] = 1
    masks.append(mask)

ARGS = {
    'masks': masks
}
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 DenseNet_pruned — a DenseNet_pruned output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DenseNet_pruned 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
VGG_16_bn_pruned_cifar10 Ran
ran on a synthesized input
osilly/kdfs/model/pruned_model/vgg_bn_pruned.py
code served (permissive licence) · get_code("f104c2256fda2a71")
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 VGG_pruned. 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)

# Build masks for the pruned VGG model
# The defaultcfg is [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 512]
# We need masks for each convolutional layer (non-'M' entries in cfg[:-1])
# cfg[:-1] has 17 elements, 13 of which are conv layers (not 'M')

# Create masks for 13 conv layers
masks = []

# Layer 1: 64 filters
masks.append(torch.ones(64, dtype=torch.float32))

# Layer 2: 64 filters
masks.append(torch.ones(64, dtype=torch.float32))

# Layer 3: 128 filters
masks.append(torch.ones(128, dtype=torch.float32))

# Layer 4: 128 filters
masks.append(torch.ones(128, dtype=torch.float32))

# Layer 5: 256 filters
masks.append(torch.ones(256, dtype=torch.float32))

# Layer 6: 256 filters
masks.append(torch.ones(256, dtype=torch.float32))

# Layer 7: 256 filters
masks.append(torch.ones(256, dtype=torch.float32))

# Layer 8: 512 filters
masks.append(torch.ones(512, dtype=torch.float32))

# Layer 9: 512 filters
masks.append(torch.ones(512, dtype=torch.float32))

# Layer 10: 512 filters
masks.append(torch.ones(512, dtype=torch.float32))

# Layer 11: 512 filters
masks.append(torch.ones(512, dtype=torch.float32))

# Layer 12: 512 filters
masks.append(torch.ones(512, dtype=torch.float32))

# Layer 13: 512 filters (final conv layer before classifier)
masks.append(torch.ones(512, dtype=torch.float32))

ARGS = {
    'masks': masks
}
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 VGG_pruned — a VGG_pruned output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a VGG_pruned 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
conv3x3 Ran
ran; our contract draft was wrong, not the code
osilly/kdfs/model/pruned_model/resnet_pruned_cifar.py
pointer only (licence: MIT); the stored copy get_code serves, from amerch/CIFAR100-Training, is pointer only (licence: NONE) · get_code("583f9780bdd00a45")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from amerch/CIFAR100-Training, and GitHub detected no licence in that repository 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.

conv_1x1_bn_pruned Ran
ran on a synthesized input
osilly/kdfs/model/pruned_model/MobileNetV2_pruned.py
code served (permissive licence) · get_code("6fbfaf2712087647")
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 Sequential. 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)

# The mask parameter is used in:
# 1. get_preserved_filter_num(mask) which calls mask.sum()
# So mask needs to be a tensor that supports .sum()
# The result determines the number of output channels in Conv2d and BatchNorm2d

# Create a mask tensor - a 1D binary mask indicating which filters to preserve
# Let's say we have 8 filters and preserve 5 of them
mask = torch.tensor([1, 1, 1, 1, 1, 0, 0, 0], dtype=torch.float32)

# inp: input channels (should be distinct from output)
inp = 4

# oup: output channels (this will be ignored since the function uses get_preserved_filter_num(mask) instead)
# But we still need to provide it as a parameter
oup = 8

ARGS = {
    'inp': inp,
    'oup': oup,
    'mask': mask
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
conv_3x3_bn Ran
ran; our contract draft was wrong, not the code
osilly/kdfs/model/pruned_model/MobileNetV2_pruned.py
pointer only (licence: MIT); the stored copy get_code serves, from zhoudaquan/rethinking_bottleneck_design, is pointer only (licence: NOASSERTION) · get_code("408e747e0425a594")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from zhoudaquan/rethinking_bottleneck_design, and GitHub could not classify the licence of that repository (NOASSERTION). 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_preserved_filter_num Ran
ran on a synthesized input
osilly/kdfs/model/pruned_model/DenseNet_pruned.py
code served (permissive licence) · get_code("50594ba3bb532d96")
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 int, ndim 0, dtype family int, 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

torch.manual_seed(0)

# The function get_preserved_filter_num takes a mask and calls .sum() on it
# This suggests mask should be a tensor (or array-like object with a sum method)
# The result is converted to int, so mask.sum() should return a scalar

mask = torch.tensor([1, 0, 1, 1], dtype=torch.float32)

ARGS = {
    "mask": mask
}
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 int, ndim 0, dtype family int, 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
resnet_56_pruned_cifar10 Ran
ran on a synthesized input
osilly/kdfs/model/pruned_model/resnet_pruned_cifar.py
code served (permissive licence) · get_code("3d92a8e884f6a314")
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 ResNet_pruned. 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)

# ResNet-56 has 56 layers total
# The architecture is: 1 initial conv + 3 groups of residual blocks
# num_layers = 56, so (56-2)//6 = 9 blocks per group
# Each residual block needs 2 masks (one for each conv layer)
# Total masks needed: (56-2) = 54 masks

# Create masks: one mask per convolution in the residual blocks
# Each mask should have shape matching the number of filters it controls
# For layer1: 16 filters, 9 blocks * 2 convs = 18 masks
# For layer2: 32 filters, 9 blocks * 2 convs = 18 masks
# For layer3: 64 filters, 9 blocks * 2 convs = 18 masks
# Total: 54 masks

masks = []

# Layer 1: 9 blocks, each with 2 convolutions
# First conv in each block: input 16, output depends on mask[0]
# Second conv in each block: input depends on mask[0], output depends on mask[1]
for i in range(9):
    # First conv mask: controls output filters (16 filters, keep ~12)
    mask1 = torch.ones(16, dtype=torch.uint8)
    mask1[14:] = 0  # prune last 4
    masks.append(mask1)
    
    # Second conv mask: controls output filters (16 filters, keep ~12)
    mask2 = torch.ones(16, dtype=torch.uint8)
    mask2[13:] = 0  # prune last 3
    masks.append(mask2)

# Layer 2: 9 blocks, each with 2 convolutions
# Blocks go from 16->32 filters
for i in range(9):
    # First conv mask: output 32 filters, keep ~24
    mask1 = torch.ones(32, dtype=torch.uint8)
    mask1[24:] = 0  # prune last 8
    masks.append(mask1)
    
    # Second conv mask: output 32 filters, keep ~24
    mask2 = torch.ones(32, dtype=torch.uint8)
    mask2[25:] = 0  # prune last 7
    masks.append(mask2)

# Layer 3: 9 blocks, each with 2 convolutions
# Blocks go from 32->64 filters
for i in range(9):
    # First conv mask: output 64 filters, keep ~48
    mask1 = torch.ones(64, dtype=torch.uint8)
    mask1[48:] = 0  # prune last 16
    masks.append(mask1)
    
    # Second conv mask: output 64 filters, keep ~48
    mask2 = torch.ones(64, dtype=torch.uint8)
    mask2[49:] = 0  # prune last 15
    masks.append(mask2)

assert len(masks) == 54, f"Expected 54 masks, got {len(masks)}"

ARGS = {
    "masks": masks
}
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 ResNet_pruned — a ResNet_pruned output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet_pruned 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
DenseNet_40_sparse_cifar10 Not yet run
unverified (harvested, no recorded run)
osilly/kdfs/model/student/DenseNet_sparse.py
code served (permissive licence) · get_code("e8b3a3ed4ba961f5")
How it ran

no invocation recorded.

GoogLeNet_pruned_cifar10 Not yet run
unverified (harvested, no recorded run)
osilly/kdfs/model/pruned_model/GoogLeNet_pruned.py
code served (permissive licence) · get_code("7a4a5e3606d5a965")
How it ran

no invocation recorded.

ResNet_18_pruned_imagenet Not yet run
unverified (harvested, no recorded run)
osilly/kdfs/model/pruned_model/ResNet_pruned.py
code served (permissive licence) · get_code("c1428f3d0526821b")
How it ran

no invocation recorded.

ResNet_34_pruned_imagenet Not yet run
unverified (harvested, no recorded run)
osilly/kdfs/model/pruned_model/ResNet_pruned.py
code served (permissive licence) · get_code("be1a0658f837c0ac")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 2 later) and 9 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
conv3x3 686 other papers
489 dated earlier, 8 the same month, 182 later, 7 same year, order not determinable · 31 only as an assembly brick
1406.2661 (2014-06)
Generative Adversarial Networks
1409.0575 (2014-09)
ImageNet Large Scale Visual Recognition Challenge
1412.6572 (2014-12)
Explaining and Harnessing Adversarial Examples
and 683 more not named here
conv_3x3_bn 12 other papers
6 dated earlier, 4 later, 2 same year, order not determinable
1801.04381 (2018-01)
MobileNetV2: Inverted Residuals and Linear Bottlenecks
1904.07399 (2019-04)
Adaptive Wing Loss for Robust Face Alignment via Heatmap Regression
1911.08114 (2019-11)
Neural Network Pruning with Residual-Connections and Limited-Data
and 9 more not named here

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

Repositories linked to this paper

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

Abstract

Filter pruning simultaneously accelerates the computation and reduces the memory overhead of CNNs, which can be effectively applied to edge devices and cloud services. In this paper, we propose a novel Knowledge-driven Differential Filter Sampler~(KDFS) with Masked Filter Modeling~(MFM) framework for filter pruning, which globally prunes the redundant filters based on the prior knowledge of a pre-trained model in a differential and non-alternative optimization. Specifically, we design a differential sampler with learnable sampling parameters to build a binary mask vector for each layer, determining whether the corresponding filters are redundant. To learn the mask, we introduce masked filter modeling to construct PCA-like knowledge by aligning the intermediate features from the pre-trained teacher model and the outputs of the student decoder taking sampling features as the input. The mask and sampler are directly optimized by the Gumbel-Softmax Straight-Through Gradient Estimator in an end-to-end manner in combination with global pruning constraint, MFM reconstruction error, and dark knowledge. Extensive experiments demonstrate the proposed KDFS's effectiveness in compressing the base models on various datasets. For instance, the pruned ResNet-50 on ImageNet achieves $55.36\%$ computation reduction, and $42.86\%$ parameter reduction, while only dropping $0.35\%$ Top-1 accuracy, significantly outperforming the state-of-the-art methods. The code is available at \url{https://github.com/Osilly/KDFS}.

For agents

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

get_harvested_code_for_paper("2307.00198")
get_code_for_paper("2307.00198")
have("2307.00198")

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

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

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

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

Connect an agent — have() is free.