SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1609.07061 · 2016

Quantized Neural Networks: Training Neural Networks with Low Precision Weights and Activations

arXiv · PDF · Open in the Atlas

Code that ran

6 of 12 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 6 have no contract verdict; 0 failures of our instrument; 6 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/1609.07061.json · badge: /api/ran/1609.07061.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
PIlotcnc/neural community (classifier label)
classifier basis not recorded on the link
5 ran · 5 no recorded run
neuralmagic/sparsify community (classifier label)
classifier basis not recorded on the link
1 ran · 1 no recorded run
FunctionStatusWhere it lives
add_deploy_opts Ran
ran on a synthesized input
neuralmagic/sparsify/src/sparsify/cli/opts.py
code served (permissive licence) · get_code("64dc20dca8882db2")
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 function. 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 click
from unittest.mock import Mock

# The add_deploy_opts function is a decorator that adds click options to a function.
# It doesn't actually call or use the decorated function's logic - it just wraps it.
# So we need to construct a dummy function to decorate and verify it works.

# Create a simple function to decorate
def dummy_function(deploy_hardware=None, deploy_engine='deepsparse', deploy_scenario=None):
    pass

# Apply the decorator
_DEPLOY_ENGINES = ['deepsparse', 'onnxruntime']

DEPLOY_HARDWARE = click.option('--deploy-hardware', default=None, type=str)
DEPLOY_ENGINE = click.option('--deploy-engine', default=_DEPLOY_ENGINES[0], type=click.Choice(_DEPLOY_ENGINES))
DEPLOY_SCENARIO = click.option('--deploy-scenario', default=None, type=str)

def add_deploy_opts(f):
    for fn in [DEPLOY_SCENARIO, DEPLOY_ENGINE, DEPLOY_HARDWARE]:
        f = fn(f)
    return f

# Since add_deploy_opts is a decorator factory that takes a function,
# the "parameters" are the click.option decorators applied in sequence.
# The function itself doesn't have traditional parameters to call.
# We construct the decorated function:

decorated_function = add_deploy_opts(dummy_function)

# ARGS maps the conceptual parameters of the decoration process
ARGS = {
    'f': dummy_function,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
click — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
convert_example_to_features Ran
ran on a synthesized input
PIlotcnc/neural/integrations/transformers/run_distill_qa.py
code served (permissive licence) · get_code("fb67524ca6f08994")
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 3, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import collections
import numpy as np
import torch

torch.manual_seed(0)

class SimpleTokenizer:
    def tokenize(self, text):
        # Simple whitespace tokenizer
        tokens = text.split()
        return tokens
    
    def convert_tokens_to_ids(self, tokens):
        # Simple mapping: each unique token gets an id
        token_to_id = {
            '[CLS]': 101,
            '[SEP]': 102,
            'what': 2054,
            'is': 2003,
            'python': 3916,
            'a': 1037,
            'programming': 5420,
            'language': 3517,
            'used': 2572,
            'for': 2005,
            'scientific': 4436,
            'computing': 4750,
        }
        ids = []
        for token in tokens:
            if token in token_to_id:
                ids.append(token_to_id[token])
            else:
                ids.append(100)  # UNK token
        return ids

example = {
    'question': 'what is python',
    'context': ['Python', 'is', 'a', 'programming', 'language', 'used', 'for', 'scientific', 'computing']
}

tokenizer = SimpleTokenizer()

ARGS = {
    'example': example,
    'tokenizer': tokenizer,
    'max_seq_length': 128,
    'doc_stride': 32,
    'max_query_length': 64,
}
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 tuple, ndim 3, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
detect_framework Ran
ran on a synthesized input
PIlotcnc/neural/src/sparseml/base.py
code served (permissive licence) · get_code("e73fc1a24af5a318")
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 Framework. 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 enum import Enum

torch.manual_seed(0)

class Framework(Enum):
    """
    Framework types known of/supported within the sparseml/deepsparse ecosystem
    """
    unknown = 'unknown'
    deepsparse = 'deepsparse'
    onnx = 'onnx'
    keras = 'keras'
    pytorch = 'pytorch'
    tensorflow_v1 = 'tensorflow_v1'

# Test case 1: Framework enum instance
framework_enum = Framework.pytorch

# Test case 2: String representation of framework
framework_string = "pytorch"

# Test case 3: A simple PyTorch model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 2)
    
    def forward(self, x):
        return self.linear(x)

pytorch_model = SimpleModel()

# Test case 4: A tensor
tensor_item = torch.randn(2, 4)

# Test case 5: A dict-like object that could represent model config
model_config = {"layers": 2, "hidden_dim": 4}

# Test case 6: A string that doesn't match framework names
random_string = "some_random_item"

# Test case 7: None
none_item = None

# Test case 8: An integer
int_item = 42

ARGS = {
    "item": Framework.pytorch
}
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 Framework — a Framework output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Framework 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
drop_layers Ran
ran on a synthesized input
PIlotcnc/neural/integrations/transformers/run_distill_qa.py
code served (permissive licence) · get_code("b05e6b10690ba830")
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 BertWrapper. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import copy

torch.manual_seed(0)

# Build a minimal BERT-like model structure that the function expects
class BertLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def forward(self, x):
        return self.linear(x)

class BertEncoder(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer = nn.ModuleList([BertLayer() for _ in range(12)])
    
    def forward(self, x):
        return x

class BertModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.encoder = BertEncoder()
    
    def forward(self, x):
        return x

class BertWrapper(nn.Module):
    def __init__(self):
        super().__init__()
        self.bert = BertModel()
    
    def forward(self, x):
        return x

# Create the model
model = BertWrapper()

# Test with layers_to_keep = 3 (a valid key in layer_drop_matching)
layers_to_keep = 3

ARGS = {
    "model": model,
    "layers_to_keep": layers_to_keep
}
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 BertWrapper — a BertWrapper output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a BertWrapper 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
get_kr_layer Ran
ran on a synthesized input
PIlotcnc/neural/utils/pytorch2keras.py
code served (permissive licence) · get_code("37057a7078af9a5d")
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 SimpleLayer. 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

class SimpleLayer(nn.Module):
    def __init__(self, name):
        super().__init__()
        self.name = name
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

class SimpleKRModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layers = nn.ModuleList([
            SimpleLayer("layer_1"),
            SimpleLayer("layer_2"),
            SimpleLayer("target_layer"),
            SimpleLayer("layer_4"),
        ])
    
    def forward(self, x):
        for layer in self.layers:
            x = layer(x)
        return x

torch.manual_seed(0)
kr_model = SimpleKRModel()
kr_layer_name = "target_layer"

ARGS = {
    "kr_model": kr_model,
    "kr_layer_name": kr_layer_name,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SimpleLayer — a SimpleLayer output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleLayer 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
get_pytorch_name Ran
ran on a synthesized input
PIlotcnc/neural/utils/pytorch2keras.py
code served (permissive licence) · get_code("0988e1f7835f94f8")
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 str. 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 re

torch_name = "dense_1/kernel:0"
layer_mapping = {
    r"dense_(\d+)/kernel:0": "layer.{0}.weight",
    r"dense_(\d+)/bias:0": "layer.{0}.bias",
    r"conv2d_(\d+)/kernel:0": "conv.{0}.weight",
}

ARGS = {
    "kr_name": torch_name,
    "layer_mapping": layer_mapping,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
add_data_opts Not yet run
unverified (harvested, no recorded run)
neuralmagic/sparsify/src/sparsify/cli/opts.py
code served (permissive licence) · get_code("c55723df4fa1140d")
How it ran

no invocation recorded.

execute_in_sparseml_framework Not yet run
unverified (harvested, no recorded run)
PIlotcnc/neural/src/sparseml/base.py
code served (permissive licence) · get_code("8c8865bf5862de8e")
How it ran

no invocation recorded.

get_version Not yet run
unverified (harvested, no recorded run)
PIlotcnc/neural/src/sparseml/base.py
code served (permissive licence) · get_code("416986508915b636")
How it ran

no invocation recorded.

load_and_normalize_cifar10 Not yet run
unverified (harvested, no recorded run)
PIlotcnc/neural/integrations/keras/prune_resnet20.py
code served (permissive licence) · get_code("6fe673c869d15b78")
How it ran

no invocation recorded.

postprocess_qa_predictions Not yet run
unverified (harvested, no recorded run)
PIlotcnc/neural/integrations/transformers/utils_qa.py
code served (permissive licence) · get_code("181ade20c4851e11")
How it ran

no invocation recorded.

postprocess_qa_predictions_with_beam_search Not yet run
unverified (harvested, no recorded run)
PIlotcnc/neural/integrations/transformers/utils_qa.py
code served (permissive licence) · get_code("b33c979ffa9d04b2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 12 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

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

Abstract

We introduce a method to train Quantized Neural Networks (QNNs) --- neural networks with extremely low precision (e.g., 1-bit) weights and activations, at run-time. At train-time the quantized weights and activations are used for computing the parameter gradients. During the forward pass, QNNs drastically reduce memory size and accesses, and replace most arithmetic operations with bit-wise operations. As a result, power consumption is expected to be drastically reduced. We trained QNNs over the MNIST, CIFAR-10, SVHN and ImageNet datasets. The resulting QNNs achieve prediction accuracy comparable to their 32-bit counterparts. For example, our quantized version of AlexNet with 1-bit weights and 2-bit activations achieves $51\%$ top-1 accuracy. Moreover, we quantize the parameter gradients to 6-bits as well which enables gradients computation using only bit-wise operation. Quantized recurrent neural networks were tested over the Penn Treebank dataset, and achieved comparable accuracy as their 32-bit counterparts using only 4-bits. Last but not least, we programmed a binary matrix multiplication GPU kernel with which it is possible to run our MNIST QNN 7 times faster than with an unoptimized GPU kernel, without suffering any loss in classification accuracy. The QNN code is available online.

For agents

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

get_harvested_code_for_paper("1609.07061")
get_code_for_paper("1609.07061")
have("1609.07061")

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

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

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

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

Connect an agent — have() is free.