SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.05740 · ICLR · 2022

QDrop: Randomly Dropping Quantization for Extremely Low-bit Post-Training Quantization

Yuhang Li, Ruihao Gong, Fengwei Yu, Xiuying Wei, Xianglong Liu

arXiv · PDF · Open in the Atlas

Code that ran

14 of 19 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; 0 honoured the contract we drafted, 1 violated it and 5 have no contract verdict; 8 failures of our instrument; 5 no recorded run); 2 of them were also run on the host, not in the jail, by the peer-agreement lane that set their level, 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/2203.05740.json · badge: /api/ran/2203.05740.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
wimh966/QDrop canonical (classifier label)
classifier basis: classifier_2025
9 ran · 2 no recorded run
modeltc/mqbench extension (classifier label)
classifier basis: classifier_2025
5 ran · 3 no recorded run
FunctionStatusWhere it lives
layer_has_weights Ran
ran, violated the contract we drafted
modeltc/mqbench/mqbench/advanced_ptq.py
code served (permissive licence) · get_code("734e5f593576355a")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-05T00:24:11Z). 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)

# Build a small modules dict with some Conv2d and Linear layers
modules = {
    'layer1': nn.Conv2d(3, 16, kernel_size=3),
    'layer2': nn.Linear(10, 5),
    'layer3': nn.ReLU(),  # Not in _WEIGHTS_MODULE_TYPE
    'layer4': nn.Conv2d(16, 32, kernel_size=3),
}

# Test case 1: nodes that include weighted layers
nodes_with_weights = ['layer1', 'layer3']

# Test case 2: nodes that don't include weighted layers
nodes_without_weights = ['layer3']

# Use the first test case for ARGS
ARGS = {
    'nodes': nodes_with_weights,
    'modules': modules,
}
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 bool, 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
round_ste Ran
ran; our contract draft was wrong, not the code
modeltc/mqbench/mqbench/fake_quantize/qdrop_quantizer.py
code served (permissive licence) · get_code("675da8641c602b03")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) 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. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-05T00:12:31Z). 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 takes a single parameter: x, which is a torch.Tensor
# It performs rounding with straight-through estimator
# We need a tensor with some values that will be rounded

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 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
DataSaverHook Ran
ran on a synthesized input · constructed an object; no result was computed
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("aad5f7fa5a104f83")
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, DataSaverHook: 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

torch.manual_seed(0)

class StopForwardException(Exception):
    """
    Used to throw and catch an exception to stop traversing the graph
    """
    pass

class DataSaverHook:
    """
    Forward hook that stores the input and output of a layer/block
    """

    def __init__(self, store_input=False, store_output=False, stop_forward=False):
        self.store_input = store_input
        self.store_output = store_output
        self.stop_forward = stop_forward
        self.input_store = None
        self.output_store = None

    def __call__(self, module, input_batch, output_batch):
        if self.store_input:
            self.input_store = input_batch
        if self.store_output:
            self.output_store = output_batch
        if self.stop_forward:
            raise StopForwardException


# Create a simple test module to use with the hook
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

module = SimpleModule()
input_batch = torch.randn(2, 4)
output_batch = torch.randn(2, 3)

ARGS = {
    "store_input": True,
    "store_output": True,
    "stop_forward": 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 DataSaverHook — 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 DataSaverHook 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
LSQPlusFakeQuantize Ran
ran on a synthesized input · constructed an object; no result was computed
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("cae087e14b082ad7")
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, LSQPlusFakeQuantize: 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

torch.manual_seed(0)

class ObserverBase(nn.Module):
    def __init__(self, bit=8, symmetric=False, ch_axis=-1):
        super(ObserverBase, self).__init__()
        self.bit = bit
        self.symmetric = symmetric
        self.ch_axis = ch_axis
        self.eps = torch.tensor(1e-08, dtype=torch.float32)
        if self.symmetric:
            self.quant_min = -2 ** (self.bit - 1)
            self.quant_max = 2 ** (self.bit - 1) - 1
        else:
            self.quant_min = 0
            self.quant_max = 2 ** self.bit - 1
        self.register_buffer('min_val', torch.tensor(float('inf')))
        self.register_buffer('max_val', torch.tensor(float('-inf')))

    def set_bit(self, bit):
        self.bit = bit
        if self.symmetric:
            self.quant_min = -2 ** (self.bit - 1)
            self.quant_max = 2 ** (self.bit - 1) - 1
        else:
            self.quant_min = 0
            self.quant_max = 2 ** self.bit - 1

    def set_name(self, name):
        self.name = name

    @torch.jit.export
    def calculate_qparams(self, min_val, max_val):
        quant_min, quant_max = (self.quant_min, self.quant_max)
        min_val_neg = torch.min(min_val, torch.zeros_like(min_val))
        max_val_pos = torch.max(max_val, torch.zeros_like(max_val))
        device = min_val_neg.device
        scale = torch.ones(min_val_neg.size(), dtype=torch.float32, device=device)
        zero_point = torch.zeros(min_val_neg.size(), dtype=torch.int, device=device)
        if self.symmetric:
            max_val_pos = torch.max(-min_val_neg, max_val_pos)
            scale = max_val_pos / (float(quant_max - quant_min) / 2)
            scale = torch.max(scale, self.eps)
        else:
            scale = (max_val_pos - min_val_neg) / float(quant_max - quant_min)
            scale = torch.max(scale, self.eps)
            zero_point = quant_min - torch.round(min_val_neg / scale)
            zero_point = torch.clamp(zero_point, quant_min, quant_max)
        return (scale, zero_point)


class QuantizeBase(nn.Module):
    def __init__(self, observer=ObserverBase, bit=8, symmetric=False, ch_axis=-1):
        super().__init__()
        self.observer = observer(bit=bit, symmetric=symmetric, ch_axis=ch_axis)
        self.bit = bit
        self.symmetric = symmetric
        self.ch_axis = ch_axis
        self.observer_enabled = 0
        self.fake_quant_enabled = 0
        self.quant_min = self.observer.quant_min
        self.quant_max = self.observer.quant_max
        self.drop_prob = 1.0
        self.register_buffer('scale', torch.tensor([1.0]))
        self.register_buffer('zero_point', torch.tensor([0], dtype=torch.int))

    def set_bit(self, bit):
        self.observer.set_bit(bit)
        self.bit = bit
        self.quant_min = self.observer.quant_min
        self.quant_max = self.observer.quant_max

    def set_name(self, name):
        self.name = name

    @torch.jit.export
    def calculate_qparams(self):
        return self.observer.calculate_qparams(torch.tensor([-1.0]), torch.tensor([1.0]))

    @torch.jit.export
    def disable_observer(self):
        self.observer_enabled = 0

    @torch.jit.export
    def enable_observer(self):
        self.observer_enabled = 1

    @torch.jit.export
    def disable_fake_quant(self):
        self.fake_quant_enabled = 0

    @torch.jit.export
    def enable_fake_quant(self):
        self.fake_quant_enabled = 1

    @torch.jit.export
    def extra_repr(self):
        return 'fake_quant_enabled={}, observer_enabled={}, symmetric={}, bit={}, ch_axis={}, quant_min={}, quant_max={}'.format(
            self.fake_quant_enabled, self.observer_enabled, self.symmetric, self.bit, self.ch_axis, self.quant_min, self.quant_max)


ARGS = {
    'observer': ObserverBase,
    'bit': 8,
    'symmetric': False,
    'ch_axis': -1
}
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 LSQPlusFakeQuantize — 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 LSQPlusFakeQuantize 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
LinearTempDecay Ran
ran on a synthesized input · constructed an object; no result was computed
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("4aded0dd4cff11f4")
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, LinearTempDecay: 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 numpy as np

torch.manual_seed(0)

ARGS = {
    "t_max": 20000,
    "warm_up": 0.2,
    "start_b": 20,
    "end_b": 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LinearTempDecay — 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 LinearTempDecay 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
LossFunction Ran
ran on a synthesized input · constructed an object; no result was computed
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("665e30ed4645891a")
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, LossFunction: 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

torch.manual_seed(0)

# Create a minimal QuantizedModule with the necessary structure
class MinimalQuantizedModule(nn.Module):
    def __init__(self):
        super().__init__()
        # Add a Linear layer with weight_fake_quant attribute
        self.linear = nn.Linear(4, 3)
        # Create a fake quantization module with rectified_sigmoid method
        self.linear.weight_fake_quant = FakeQuant()
        
        # Add a Conv2d layer with weight_fake_quant attribute
        self.conv = nn.Conv2d(2, 3, kernel_size=2)
        self.conv.weight_fake_quant = FakeQuant()

class FakeQuant:
    def rectified_sigmoid(self):
        # Return a tensor of rounding values between 0 and 1
        return torch.rand(12)

# Instantiate the module
module = MinimalQuantizedModule()

# Create sample tensors for pred and tgt
pred = torch.randn(2, 4)
tgt = torch.randn(2, 4)

# Define all required arguments for LossFunction
ARGS = {
    'module': module,
    'weight': 1.0,
    'iters': 20000,
    'b_range': (20, 2),
    'warm_up': 0.2,
    'p': 2.0
}
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 LossFunction — 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 LossFunction 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
QuantizedModule Ran
ran on a synthesized input · constructed an object; no result was computed
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("f762b59f2c5ed75b")
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, QuantizedModule: 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

torch.manual_seed(0)

# QuantizedModule.__init__ takes only self, so no additional parameters needed
ARGS = {}
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 QuantizedModule — 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 QuantizedModule 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
_fake_quantize_learnable_per_tensor_affine_training Ran
ran; our contract draft was wrong, not the code
modeltc/mqbench/mqbench/fake_quantize/qdrop_quantizer.py
code served (permissive licence) · get_code("7d7aa73f165ae52e")
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 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)

# Create small tensors for the function parameters
x = torch.randn(2, 4, requires_grad=True)  # Input tensor to quantize
scale = torch.tensor(0.1, requires_grad=True)  # Scale factor for quantization
zero_point = torch.tensor(0, dtype=torch.int32)  # Zero point offset
quant_min = torch.tensor(-128, dtype=torch.int32)  # Minimum quantization value
quant_max = torch.tensor(127, dtype=torch.int32)  # Maximum quantization value

ARGS = {
    "x": x,
    "scale": scale,
    "zero_point": zero_point,
    "quant_min": quant_min,
    "quant_max": quant_max,
}
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 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
fake_quantize_learnableplus_per_channel_affine_training Ran
ran; our contract draft was wrong, not the code
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("7daaddceec308813")
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 (2, 4, 3, 5) 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)

# Construct arguments for fake_quantize_learnableplus_per_channel_affine_training
x = torch.randn(2, 4, 3, 5)  # batch_size=2, channels=4, spatial dims=3x5

ch_axis = 1  # Channel axis is dimension 1

# scale: should be a learnable parameter with shape matching the number of channels
scale = torch.ones(4, requires_grad=True)

# zero_point: should be a learnable parameter with shape matching the number of channels
zero_point = torch.zeros(4, requires_grad=True)

# quant_min and quant_max: typical for 8-bit quantization
quant_min = 0
quant_max = 255

# grad_factor: a scaling factor for gradient computation (typically between 0 and 1)
grad_factor = 0.1

ARGS = {
    'x': x,
    'scale': scale,
    'zero_point': zero_point,
    'ch_axis': ch_axis,
    'quant_min': quant_min,
    'quant_max': quant_max,
    'grad_factor': grad_factor,
}
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 (2, 4, 3, 5) — shape (2, 4, 3, 5) 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
fake_quantize_learnableplus_per_tensor_affine_training Ran
ran; our contract draft was wrong, not the code
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("128adf85beb85df4")
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)

# Construct arguments for fake_quantize_learnableplus_per_tensor_affine_training
x = torch.randn(2, 4)
scale = torch.tensor(0.1, requires_grad=True)
zero_point = torch.tensor(0.5, requires_grad=True)
quant_min = -128
quant_max = 127
grad_factor = 0.1

ARGS = {
    'x': x,
    'scale': scale,
    'zero_point': zero_point,
    'quant_min': quant_min,
    'quant_max': quant_max,
    'grad_factor': grad_factor,
}
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
lp_loss Ran
ran; our contract draft was wrong, not the code
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("8003cb7a5176e497")
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
# pred: predictions from model, shape (batch_size, features)
# tgt: targets, same shape as pred
batch_size = 2
feature_dim = 4

pred = torch.randn(batch_size, feature_dim)
tgt = torch.randn(batch_size, feature_dim)

# p is the norm parameter (default 2.0 for L2 norm)
p = 2.0

ARGS = {
    "pred": pred,
    "tgt": tgt,
    "p": p,
}
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
node2modules Ran
ran; our contract draft was wrong, not the code
modeltc/mqbench/mqbench/advanced_ptq.py
code served (permissive licence) · get_code("ac274433bb73e20c")
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
from torch.fx import GraphModule, Node

torch.manual_seed(0)

# Create a simple module to use in name2modules
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Create mock Node objects with target attributes
class MockNode:
    def __init__(self, target):
        self.target = target
    
    def __repr__(self):
        return f"MockNode({self.target})"
    
    def __hash__(self):
        return hash(self.target)
    
    def __eq__(self, other):
        if isinstance(other, MockNode):
            return self.target == other.target
        return False

# Build the arguments
name2modules = {
    "module_a": SimpleModule(),
    "module_b": SimpleModule(),
    "module_c": SimpleModule(),
}

nodes = [
    MockNode("module_a"),
    MockNode("module_b"),
    MockNode("unknown_module"),
    MockNode("module_c"),
]

ARGS = {
    "name2modules": name2modules,
    "nodes": nodes,
}
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
qnode2fpnode Ran
ran; our contract draft was wrong, not the code
modeltc/mqbench/mqbench/advanced_ptq.py
code served (permissive licence) · get_code("2df773973fe13be2")
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 node-like class that has a 'target' attribute
class MockNode:
    def __init__(self, target):
        self.target = target

# Create mock quantized modules (list of nodes with target attributes)
quant_modules = [
    MockNode(target="layer1"),
    MockNode(target="layer2"),
    MockNode(target="layer3"),
]

# Create mock fp32 modules (list of nodes with target attributes)
fp32_modules = [
    MockNode(target="layer1"),
    MockNode(target="layer2"),
    MockNode(target="layer3"),
]

ARGS = {
    "quant_modules": quant_modules,
    "fp32_modules": fp32_modules,
}
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
save_inp_oup_data Ran
ran; our contract draft was wrong, not the code
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("01e81fd5942011ad")
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. 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

torch.manual_seed(0)

# Build a minimal model that accepts a tensor input
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 8)
        self.linear2 = nn.Linear(8, 3)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

# Create model instance
model = SimpleModel()

# Create a target module to hook (use the first linear layer)
module = model.linear1

# Create calibration data: shape (8, 4) - 8 samples of dimension 4
cali_data = torch.randn(8, 4)

# Define arguments dict
ARGS = {
    "model": model,
    "module": module,
    "cali_data": cali_data,
    "store_inp": True,
    "store_oup": True,
    "bs": 2,
    "keep_gpu": 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 list — a list 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
LSQFakeQuantize Not yet run
unverified (harvested, no recorded run)
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("a1873dbf3ee330ef")
How it ran

no invocation recorded.

QDropFakeQuantize Not yet run
unverified (harvested, no recorded run)
modeltc/mqbench/mqbench/fake_quantize/qdrop_quantizer.py
code served (permissive licence) · get_code("21646d4b40b8c655")
How it ran

no invocation recorded.

QuantizeBase Not yet run
unverified (harvested, no recorded run)
modeltc/mqbench/mqbench/fake_quantize/qdrop_quantizer.py
code served (permissive licence) · get_code("7c23cc16e1d8d7b3")
How it ran

no invocation recorded.

_fake_quantize_learnable_per_channel_affine_training Not yet run
unverified (harvested, no recorded run)
modeltc/mqbench/mqbench/fake_quantize/qdrop_quantizer.py
code served (permissive licence) · get_code("ff3b513126ce71ed")
How it ran

no invocation recorded.

reconstruction Not yet run
unverified (harvested, no recorded run)
wimh966/QDrop/qdrop/solver/recon.py
code served (permissive licence) · get_code("e62a3ec748b29b66")
How it ran

no invocation recorded.

Also present in other papers' code

Of 19 samples lifted from this paper's linked repositories, 19 carry a function identity and 0 do not. Of the 19 distinct functions with an identity, 5 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 5 later) and 14 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
round_ste
brick of this paper's assembly: helper
27 other papers
27 later · 13 only as an assembly brick
2204.12322 (2022-04)
RAPQ: Rescuing Accuracy for Power-of-Two Low-bit Post-training Quantization
2302.04304 (2023-02)
Q-Diffusion: Quantizing Diffusion Models
and 24 more not named here
lp_loss
brick of this paper's assembly: metric
2 other papers
2 later
2405.03144 (2024-05)
PTQ4SAM: Post-Training Quantization for Segment Anything
Zhang_AHCPTQ_Accurate_and_Hardware-Compatible_Post-Training_Quantization_for_Segment_Anything_Model_ICCV_2025_paper (2025 (year only))
AHCPTQ: Accurate and Hardware-Compatible Post-Training Quantization for Segment Anything Model
DataSaverHook
brick of this paper's assembly: helper
1 other paper
1 later
2405.16005 (2024-05)
PTQ4DiT: Post-training Quantization for Diffusion Transformers
layer_has_weights 1 other paper
1 later
2303.11906 (2023-03)
Solving Oscillation Problem in Post-Training Quantization Through a Theoretical Perspective
node2modules 1 other paper
1 later
2303.11906 (2023-03)
Solving Oscillation Problem in Post-Training Quantization Through a Theoretical Perspective

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

Recently, post-training quantization (PTQ) has driven much attention to produce efficient neural networks without long-time retraining. Despite its low cost, current PTQ works tend to fail under the extremely low-bit setting. In this study, we pioneeringly confirm that properly incorporating activation quantization into the PTQ reconstruction benefits the final accuracy. To deeply understand the inherent reason, a theoretical framework is established, indicating that the flatness of the optimized low-bit model on calibration and test data is crucial. Based on the conclusion, a simple yet effective approach dubbed as QDROP is proposed, which randomly drops the quantization of activations during PTQ. Extensive experiments on various tasks including computer vision (image classification, object detection) and natural language processing (text classification and question answering) prove its superiority. With QDROP, the limit of PTQ is pushed to the 2-bit activation for the first time and the accuracy boost can be up to 51.49%. Without bells and whistles, QDROP establishes a new state of the art for PTQ. Our code is available at https://github.com/wimh966/QDrop and has been integrated into MQBench (https://github.com/ModelTC/MQBench).

For agents

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

get_harvested_code_for_paper("2203.05740")
get_code_for_paper("2203.05740")
have("2203.05740")

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

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

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

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

Connect an agent — have() is free.