SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.06984 · 2021

A Free Lunch From ANN: Towards Efficient, Accurate Spiking Neural Networks Calibration

arXiv · PDF · Open in the Atlas

Code that ran

11 of 13 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, 2 violated it and 5 have no contract verdict; 4 failures of our instrument; 2 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/2106.06984.json · badge: /api/ran/2106.06984.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
yhhhli/SNN_Calibration canonical (classifier label)
classifier basis: census
11 ran · 2 no recorded run
FunctionStatusWhere it lives
build_imagenet_data Ran
ran; our contract draft was wrong, not the code
yhhhli/SNN_Calibration/main_cal_imagenet.py
code served (permissive licence) · get_code("c31380755f356fae")
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 float; 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 os
import tempfile
import torch
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from PIL import Image
import numpy as np

# Create a temporary directory structure with minimal ImageNet-like data
temp_dir = tempfile.mkdtemp()
train_dir = os.path.join(temp_dir, 'train')
val_dir = os.path.join(temp_dir, 'val')

# Create class directories
for split_dir in [train_dir, val_dir]:
    for class_idx in range(2):
        class_dir = os.path.join(split_dir, f'class_{class_idx}')
        os.makedirs(class_dir, exist_ok=True)
        
        # Create minimal dummy images (32x32 RGB)
        for img_idx in range(2):
            img_array = np.random.randint(0, 256, (32, 32, 3), dtype=np.uint8)
            img = Image.fromarray(img_array, 'RGB')
            img_path = os.path.join(class_dir, f'img_{img_idx}.jpg')
            img.save(img_path)

torch.manual_seed(0)

ARGS = {
    'data_path': temp_dir,
    'input_size': 224,
    'batch_size': 2,
    'workers': 0,
    'dist_sample': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — 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 float — 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
conv3x3 Ran
ran; our contract draft was wrong, not the code
yhhhli/SNN_Calibration/models/CIFAR/models/resnet.py
pointer only (licence: MIT); the stored copy get_code serves, from yfguo91/ternary-spike, is pointer only (licence: NONE) · get_code("dacc6812ec177540")
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 yfguo91/ternary-spike, 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_bn Ran
ran; our contract draft was wrong, not the code
yhhhli/SNN_Calibration/models/ImageNet/models/mobilenet.py
code served (permissive licence) · get_code("2f7853ff01cbbc29")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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

torch.manual_seed(0)

inp = 3
oup = 8
stride = 2

ARGS = {
    'inp': inp,
    'oup': oup,
    'stride': stride
}
Setup block drafted by
a language model, Claude Sonnet 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 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_dw Ran
ran on a synthesized input
yhhhli/SNN_Calibration/models/ImageNet/models/mobilenet.py
code served (permissive licence) · get_code("67bde0c6505e6d67")
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)

ARGS = {
    "inp": 3,
    "oup": 16,
    "stride": 1,
    "simplified": False,
}
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
find_threshold_mse Ran
ran on a synthesized input
yhhhli/SNN_Calibration/models/spiking_layer.py
code served (permissive licence) · get_code("75e3a80e27467439")
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 Tensor, ndim 4, dtype family float, shape (1, 3, 1, 1) 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 small 4D tensor (batch, channels, height, width)
# batch=2, channels=3, height=4, width=5
tensor = torch.randn(2, 3, 4, 5)

# Make it positive and scale it for realistic activation values
tensor = torch.abs(tensor) * 10 + 1

ARGS = {
    'tensor': tensor,
    'T': 8,
    'channel_wise': True,
}
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 Tensor, ndim 4, dtype family float, shape (1, 3, 1, 1) — shape (1, 3, 1, 1) 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
floor_ste Ran
ran on a synthesized input
yhhhli/SNN_Calibration/models/calibration.py
code served (permissive licence) · get_code("7c22ced4eaf89920")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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)

# floor_ste expects a tensor x with .floor(), .detach() methods
# and supports arithmetic operations
x = torch.randn(2, 4, requires_grad=True)

ARGS = {
    "x": x
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
is_absorbing Ran
ran, violated the contract we drafted
yhhhli/SNN_Calibration/models/fold_bn.py
pointer only (licence: MIT); the stored copy get_code serves, from yfguo91/ternary-spike, is pointer only (licence: NONE) · get_code("bc1bf5bb29e60206")
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 yfguo91/ternary-spike, 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.

is_bn Ran
ran, violated the contract we drafted
yhhhli/SNN_Calibration/models/fold_bn.py
pointer only (licence: MIT); the stored copy get_code serves, from yfguo91/ternary-spike, is pointer only (licence: NONE) · get_code("06ddc213753098ff")
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 yfguo91/ternary-spike, 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.

lp_loss Ran
ran on a synthesized input
yhhhli/SNN_Calibration/models/spiking_layer.py
code served (permissive licence) · get_code("54ab1b5bf761f953")
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 Tensor, 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

torch.manual_seed(0)

# Create small tensors for pred and tgt
# The function operates on tensors with shape that allows .sum(1), .sum((0,2,3))
# This suggests 4D tensors (batch, channels, height, width)
batch_size = 2
channels = 3
height = 4
width = 5

pred = torch.randn(batch_size, channels, height, width)
tgt = torch.randn(batch_size, channels, height, width)

ARGS = {
    'pred': pred,
    'tgt': tgt,
    'p': 2.0,
    'reduction': 'none'
}
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 Tensor, 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
quantile Ran
ran; our contract draft was wrong, not the code
yhhhli/SNN_Calibration/models/spiking_layer.py
pointer only (licence: MIT); the stored copy get_code serves, from bic-l/burst-ann2snn, is pointer only (licence: NONE) · get_code("33aa9d7aced035c3")
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 bic-l/burst-ann2snn, 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.

validate_model Ran
ran on a synthesized input
yhhhli/SNN_Calibration/main_cal_imagenet.py
code served (permissive licence) · get_code("a0c40c8deb933e86")
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 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 simple neural network model
class SimpleANN(nn.Module):
    def __init__(self):
        super(SimpleANN, self).__init__()
        self.fc1 = nn.Linear(4, 8)
        self.fc2 = nn.Linear(8, 10)
    
    def forward(self, x):
        x = torch.relu(self.fc1(x))
        x = self.fc2(x)
        return x

# Create model instance
ann = SimpleANN()

# Create a simple test loader with 2 batches of data
# Each batch has 2 samples with 4 input features and 10 output classes
test_loader = [
    (torch.randn(2, 4), torch.randint(0, 10, (2,))),
    (torch.randn(2, 4), torch.randint(0, 10, (2,)))
]

ARGS = {
    'test_loader': test_loader,
    'ann': ann
}
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 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
conv1x1 Not yet run
unverified (harvested, no recorded run)
yhhhli/SNN_Calibration/models/ImageNet/models/resnet.py
code served (permissive licence) · get_code("02a6946a4c9814db")
How it ran

no invocation recorded.

conv3x3 Not yet run
unverified (harvested, no recorded run)
yhhhli/SNN_Calibration/models/ImageNet/models/resnet.py
code served (permissive licence) · get_code("1ab65b82589cc9e7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 6 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 2 the same month, 6 later) and 7 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
312 dated earlier, 12 the same month, 356 later, 6 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_bn 16 other papers
4 dated earlier, 2 the same month, 10 later
1704.04861 (2017-04)
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications
1807.10221 (2018-07)
Unified Perceptual Parsing for Scene Understanding
1904.05049 (2019-04)
Drop an Octave: Reducing Spatial Redundancy in Convolutional Neural Networks with Octave Convolution
and 13 more not named here
is_absorbing 4 other papers
4 later
Liu_PD-Quant_Post-Training_Quantization_Based_on_Prediction_Difference_Metric_CVPR_2023_paper (2023 (year only))
PD-Quant: Post-Training Quantization Based on Prediction Difference Metric
2303.11906 (2023-03)
Solving Oscillation Problem in Post-Training Quantization Through a Theoretical Perspective
2308.07650 (2023-08)
EQ-Net: Elastic Quantization Neural Networks
and 1 more not named here
is_bn 4 other papers
4 later
Liu_PD-Quant_Post-Training_Quantization_Based_on_Prediction_Difference_Metric_CVPR_2023_paper (2023 (year only))
PD-Quant: Post-Training Quantization Based on Prediction Difference Metric
2303.11906 (2023-03)
Solving Oscillation Problem in Post-Training Quantization Through a Theoretical Perspective
2308.07650 (2023-08)
EQ-Net: Elastic Quantization Neural Networks
and 1 more not named here
build_imagenet_data 1 other paper
1 later
2606.25285 (2026-06)
EPTS: Elastic Post-Training Sparsity for Efficient Large Language Model Compression
quantile 1 other paper
1 later
2311.14265 (2023-11)
Adaptive Calibration: A Unified Conversion Framework of Spiking Neural Networks

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

Spiking Neural Network (SNN) has been recognized as one of the next generation of neural networks. Conventionally, SNN can be converted from a pre-trained ANN by only replacing the ReLU activation to spike activation while keeping the parameters intact. Perhaps surprisingly, in this work we show that a proper way to calibrate the parameters during the conversion of ANN to SNN can bring significant improvements. We introduce SNN Calibration, a cheap but extraordinarily effective method by leveraging the knowledge within a pre-trained Artificial Neural Network (ANN). Starting by analyzing the conversion error and its propagation through layers theoretically, we propose the calibration algorithm that can correct the error layer-by-layer. The calibration only takes a handful number of training data and several minutes to finish. Moreover, our calibration algorithm can produce SNN with state-of-the-art architecture on the large-scale ImageNet dataset, including MobileNet and RegNet. Extensive experiments demonstrate the effectiveness and efficiency of our algorithm. For example, our advanced pipeline can increase up to 69% top-1 accuracy when converting MobileNet on ImageNet compared to baselines. Codes are released at https://github.com/yhhhli/SNN_Calibration.

For agents

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

get_harvested_code_for_paper("2106.06984")
get_code_for_paper("2106.06984")
have("2106.06984")

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

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

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

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

Connect an agent — have() is free.