SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2308.06689 · ICCV · 2023

Estimator Meets Equilibrium Perspective: A Rectified Straight Through Estimator for Binary Neural Networks Training

Xiao-Ming Wu, Wei-Shi Zheng, Dian Zheng, Zuhao Liu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 5 failures of our instrument; 2 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/2308.06689.json · badge: /api/ran/2308.06689.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
dravenalg/reste canonical (classifier label)
classifier basis: census
5 ran · 2 no recorded run
DravenALG/ReSTE community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
Binary_ReSTE Ran
ran on a synthesized input · constructed an object; no result was computed
DravenALG/ReSTE/model/binary_module/binarized_modules.py
code served (permissive licence) · get_code("09e796c558171dac")
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, Binary_ReSTE: 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 math

torch.manual_seed(0)

# The function Binary_ReSTE.forward takes (ctx, input, t, o)
# The function Binary_ReSTE.backward uses:
# - ctx.saved_tensors to retrieve (input, t, o)
# - torch operations on tensors
# - grad_output for gradient computation

# Create small test tensors
input_tensor = torch.randn(2, 4, requires_grad=True)
t_tensor = torch.tensor(0.5, requires_grad=False)
o_tensor = torch.tensor(0.5, requires_grad=False)

ARGS = {
    'input': input_tensor,
    't': t_tensor,
    'o': o_tensor
}
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 Binary_ReSTE — 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 Binary_ReSTE 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
accuracy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
dravenalg/reste/utils/tools.py
code served (permissive licence) · get_code("116d1448f8e9a8bd")
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 list, 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 torch

torch.manual_seed(0)

# Construct valid arguments for the accuracy function
# The function expects:
# - output: a tensor of logits/scores with shape (batch_size, num_classes)
# - target: a tensor of class indices with shape (batch_size,)
# - topk: a tuple of k values to compute accuracy for

batch_size = 2
num_classes = 4

# Create dummy output logits: (batch_size=2, num_classes=4)
output = torch.randn(batch_size, num_classes)

# Create dummy target indices: (batch_size=2,) with values in [0, num_classes)
target = torch.tensor([0, 2])

# topk parameter specifying which k values to compute accuracy for
topk = (1, 2)

ARGS = {
    "output": output,
    "target": target,
    "topk": topk
}
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 list, ndim 1, dtype family float — a list 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
add_module_fromdict Ran
ran; our contract draft was wrong, not the code
dravenalg/reste/utils/tools.py
code served (permissive licence) · get_code("157ec370c18f8930")
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 OrderedDict. 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
from collections import OrderedDict

torch.manual_seed(0)

# Create a simple state dict with tensor values
statedict = OrderedDict([
    ('layer1.weight', torch.randn(4, 3)),
    ('layer1.bias', torch.randn(4)),
    ('layer2.weight', torch.randn(5, 4)),
    ('layer2.bias', torch.randn(5)),
])

ARGS = {
    'statedict': statedict
}
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 OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict 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
approximate_function Ran
ran, honoured the contract we drafted
DravenALG/ReSTE/model/binary_module/binarized_modules.py
code served (permissive licence) · get_code("09cf7bf4ad177244")
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 math

torch_import_attempted = False
try:
    import torch
    torch_import_attempted = True
except:
    pass

# The function approximate_function takes two parameters:
# x: a numeric value (int, float, or could be a scalar)
# o: a numeric value used as divisor in exponentiation

# Looking at the function body:
# - x is compared with 0
# - x is passed to math.pow with exponent 1/o
# - o is used in division (1/o)
# Both x and o should be numeric types

# Create simple numeric arguments
x_value = 2.5
o_value = 3.0

ARGS = {
    "x": x_value,
    "o": o_value,
}
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
delete_module_fromdict Ran
ran; our contract draft was wrong, not the code
dravenalg/reste/utils/tools.py
code served (permissive licence) · get_code("19fd0375add14cbc")
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 OrderedDict. 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
from collections import OrderedDict

torch.manual_seed(0)

# The function iterates over statedict.items() and removes the first 7 characters
# from each key (name = k[7:]). It expects a dictionary with string keys and tensor values.
# This is typically a PyTorch state_dict where keys are prefixed with "module." when
# the model was wrapped in nn.DataParallel.

statedict = OrderedDict()
statedict["module.layer1.weight"] = torch.randn(4, 3)
statedict["module.layer1.bias"] = torch.randn(4)
statedict["module.layer2.weight"] = torch.randn(5, 4)
statedict["module.layer2.bias"] = torch.randn(5)

ARGS = {
    "statedict": statedict
}
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 OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict 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
load Ran
ran; our contract draft was wrong, not the code
dravenalg/reste/dataset/load_data.py
code served (permissive licence) · get_code("e0bd0b127c31b7df")
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 torch
import os
from unittest.mock import Mock, MagicMock
from torch.utils.data import DataLoader

torch.manual_seed(0)

# Create a minimal mock dataset for CIFAR10
class MockCIFAR10:
    def __init__(self, root, train=True, download=False, transform=None):
        self.root = root
        self.train = train
        self.transform = transform
        self.data = [torch.randn(3, 32, 32) for _ in range(4)]
        self.targets = [0, 1, 0, 1]
    
    def __len__(self):
        return len(self.data)
    
    def __getitem__(self, idx):
        img = self.data[idx]
        if self.transform:
            img = self.transform(img)
        return img, self.targets[idx]

# Create a minimal mock dataset for ImageFolder
class MockImageFolder:
    def __init__(self, root, transform=None):
        self.root = root
        self.transform = transform
        self.data = [torch.randn(3, 256, 256) for _ in range(4)]
        self.targets = [0, 1, 0, 1]
    
    def __len__(self):
        return len(self.data)
    
    def __getitem__(self, idx):
        img = self.data[idx]
        if self.transform:
            img = self.transform(img)
        return img, self.targets[idx]

# Patch the datasets module to use our mock classes
import torchvision.datasets as datasets
datasets.CIFAR10 = MockCIFAR10
datasets.ImageFolder = MockImageFolder

# Create temporary directories for the data_path
temp_data_path = "/tmp/mock_dataset"
os.makedirs(temp_data_path, exist_ok=True)
os.makedirs(os.path.join(temp_data_path, 'train'), exist_ok=True)
os.makedirs(os.path.join(temp_data_path, 'val'), exist_ok=True)

ARGS = {
    'type': 'both',
    'dataset': 'cifar10',
    'data_path': temp_data_path,
    'batch_size': 2,
    'batch_size_test': 2,
    'num_workers': 0,
    'device_id': 0,
    'use_dali': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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
resnet18 Ran
ran; our contract draft was wrong, not the code
dravenalg/reste/model/models_imagenet/resnet18.py
code served (permissive licence) · get_code("7386d10841a4a333")
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. 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 = {
    'pretrained': 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 ResNet — a ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ResNet 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
resnet18_1w1a Not yet run
unverified (harvested, no recorded run)
dravenalg/reste/model/models_imagenet/resnet18.py
code served (permissive licence) · get_code("e3761947f732d1fe")
How it ran

no invocation recorded.

resnet34_1w1a Not yet run
unverified (harvested, no recorded run)
dravenalg/reste/model/models_imagenet/resnet34.py
code served (permissive licence) · get_code("7ee85694bd6b7162")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 2 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
resnet18 89 other papers
65 dated earlier, 2 the same month, 21 later, 1 same year, order not determinable
1705.09759 (2017-05)
CASENet: Deep Category-Aware Semantic Edge Detection
1801.07698 (2018-01)
ArcFace: Additive Angular Margin Loss for Deep Face Recognition
1803.00839 (2018-03)
Pose-Robust Face Recognition via Deep Residual Equivariant Mapping
and 86 more not named here
approximate_function
brick of this paper's assembly: helper
1 other paper
1 later
2506.04624 (2025-06)
Static Word Embeddings for Sentence Semantic Representation

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

Binarization of neural networks is a dominant paradigm in neural networks compression. The pioneering work BinaryConnect uses Straight Through Estimator (STE) to mimic the gradients of the sign function, but it also causes the crucial inconsistency problem. Most of the previous methods design different estimators instead of STE to mitigate it. However, they ignore the fact that when reducing the estimating error, the gradient stability will decrease concomitantly. These highly divergent gradients will harm the model training and increase the risk of gradient vanishing and gradient exploding. To fully take the gradient stability into consideration, we present a new perspective to the BNNs training, regarding it as the equilibrium between the estimating error and the gradient stability. In this view, we firstly design two indicators to quantitatively demonstrate the equilibrium phenomenon. In addition, in order to balance the estimating error and the gradient stability well, we revise the original straight through estimator and propose a power function based estimator, Rectified Straight Through Estimator (ReSTE for short). Comparing to other estimators, ReSTE is rational and capable of flexibly balancing the estimating error with the gradient stability. Extensive experiments on CIFAR-10 and ImageNet datasets show that ReSTE has excellent performance and surpasses the stateof-the-art methods without any auxiliary modules or losses.

For agents

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

get_harvested_code_for_paper("2308.06689")
get_code_for_paper("2308.06689")
have("2308.06689")

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

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

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

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

Connect an agent — have() is free.