SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.09259 · 2023

QUIK: Towards End-to-End 4-Bit Inference on Generative Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

9 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; 2 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 6 failures of our instrument; 4 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/2310.09259.json · badge: /api/ran/2310.09259.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
ist-daslab/quik canonical (classifier label)
classifier basis: census
9 ran · 4 no recorded run
FunctionStatusWhere it lives
asymmetric_quantize Ran
ran; our contract draft was wrong, not the code
ist-daslab/quik/experiments/quant_sim.py
code served (permissive licence) · get_code("aa2f6205ec9bf13c")
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)

# Create small test tensors
x = torch.randn(2, 4)
scale = torch.tensor(0.1)
zero = torch.tensor(0.0)
maxq = torch.tensor(255)

ARGS = {
    "x": x,
    "scale": scale,
    "zero": zero,
    "maxq": maxq,
}
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
get_c4 Ran
ran on a synthesized input
ist-daslab/quik/experiments/datautils.py
code served (permissive licence) · get_code("980b7a8e42ae4a52")
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. 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 random

torch.manual_seed(0)

# Create a minimal mock tokenizer that has the methods and attributes used
class MockTokenizer:
    def __call__(self, text, return_tensors=None):
        # Returns a simple object with input_ids attribute
        # Simulating tokenization with variable length sequences
        class TokenizerOutput:
            def __init__(self):
                # Return a tensor of shape (1, seq_len) with random token ids
                self.input_ids = torch.randint(0, 1000, (1, 256))
        return TokenizerOutput()

# Mock the transformers.AutoTokenizer.from_pretrained
import sys
from unittest.mock import MagicMock

transformers_mock = MagicMock()
transformers_mock.AutoTokenizer.from_pretrained = MagicMock(return_value=MockTokenizer())
sys.modules['transformers'] = transformers_mock

# Now we can set up the arguments
ARGS = {
    'nsamples': 2,
    'seed': 42,
    'seqlen': 64,
    'model': 'gpt2',
    'synthetic_data': True,  # Use synthetic to avoid network calls
    'hf_token': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets, torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple 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
get_fp_features_num Ran
ran, honoured the contract we drafted
ist-daslab/quik/experiments/modelutils.py
code served (permissive licence) · get_code("6a7807d7d7ad0fb4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal Linear module
module = nn.Linear(in_features=8, out_features=4)

# Create a minimal model with config
class MinimalConfig:
    def __init__(self):
        self.hidden_size = 2

class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.config = MinimalConfig()
        self.linear = nn.Linear(8, 4)
    
    def forward(self, x):
        return self.linear(x)

model = MinimalModel()

# Create args object with required attributes
class Args:
    def __init__(self):
        self.fp_features_num = 2
        self.fp_features_frac = 0.5
        self.fp_relative = True

args = Args()

ARGS = {
    "module": module,
    "args": args,
    "model": model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_fp_features_num Ran
ran, honoured the contract we drafted
ist-daslab/quik/experiments/llama.py
code served (permissive licence) · get_code("f0ae4c8287c19664")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal Linear module
# The function accesses module.in_features
module = nn.Linear(in_features=10, out_features=5)

# Create a minimal args object with required attributes
class Args:
    def __init__(self):
        self.fp_features_num = 2
        self.fp_features_frac = 0.3

args = Args()

ARGS = {
    "module": module,
    "args": 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 int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_opt Ran
ran; our contract draft was wrong, not the code
ist-daslab/quik/experiments/modelutils.py
code served (permissive licence) · get_code("afa2292fc283853b")
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 Mock. 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 transformers
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Mock the from_pretrained to avoid actual model downloads
def mock_from_pretrained(model_name, torch_dtype=None):
    mock_model = Mock(spec=transformers.OPTForCausalLM)
    mock_config = Mock()
    mock_config.max_position_embeddings = 2048
    mock_model.config = mock_config
    return mock_model

# Patch the from_pretrained method
transformers.OPTForCausalLM.from_pretrained = mock_from_pretrained

ARGS = {
    'model': 'facebook/opt-125m'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Mock — a Mock output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Mock 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_ptb Ran
ran; our contract draft was wrong, not the code
ist-daslab/quik/experiments/datautils.py
code served (permissive licence) · get_code("614c29352fee019e")
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. 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 random

torch.manual_seed(0)

# Mock tokenizer that has __call__ method
class MockTokenizer:
    def __call__(self, text, return_tensors=None):
        # Return a simple object with input_ids attribute
        # We need input_ids to be a tensor with shape (1, seq_length)
        # Make it large enough to sample from with seqlen=8
        mock_result = type('obj', (object,), {
            'input_ids': torch.randint(0, 1000, (1, 100))
        })()
        return mock_result

# We need to mock the datasets.load_dataset and transformers.AutoTokenizer
# but since we can't modify those, we'll just provide arguments that would work
# if those were available. However, the function WILL try to call them.
# So we need to mock them at module level.

import datasets
import transformers

# Store original functions
_original_load_dataset = datasets.load_dataset
_original_from_pretrained = transformers.AutoTokenizer.from_pretrained

# Create mock datasets
def mock_load_dataset(dataset_name, config, split):
    if split == 'train':
        return {
            'sentence': [
                'This is a training sentence.',
                'Another training example here.',
                'More training data for the model.',
            ] * 10
        }
    elif split == 'validation':
        return {
            'sentence': [
                'This is a validation sentence.',
                'Another validation example here.',
                'More validation data.',
            ] * 5
        }

def mock_from_pretrained(model_name, use_fast=False, use_auth_token=None):
    return MockTokenizer()

# Monkey patch
datasets.load_dataset = mock_load_dataset
transformers.AutoTokenizer.from_pretrained = mock_from_pretrained

ARGS = {
    'nsamples': 4,
    'seed': 42,
    'seqlen': 8,
    'model': 'gpt2',
    'hf_token': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets, torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple 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
pack_to_i4 Ran
ran; our contract draft was wrong, not the code
ist-daslab/quik/experiments/qlinear.py
code served (permissive licence) · get_code("715c101a77c1534c")
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 int, shape (2, 2) 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 a small tensor with shape (2, 4) containing values in range [-8, 7]
# to fit in 4-bit signed integers
X = torch.tensor([
    [-3, 5, -1, 2],
    [4, -7, 1, 0]
], dtype=torch.float32)

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 int, shape (2, 2) — shape (2, 2) 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
symmetric_quantize Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ist-daslab/quik/experiments/quant_sim.py
code served (permissive licence) · get_code("417a0b6e6d05ce3b")
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)

# Create a small tensor for quantization
x = torch.randn(2, 4)

# Create a scale tensor (can be scalar or same shape as x)
scale = torch.tensor(0.1)

# Test with different bit widths
bits = 8

ARGS = {
    "x": x,
    "scale": scale,
    "bits": bits,
}
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
two_compl Ran
ran; our contract draft was wrong, not the code
ist-daslab/quik/experiments/qlinear.py
code served (permissive licence) · get_code("77a12785d85226d6")
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 1, dtype family int, shape (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
from torch import Tensor

torch.manual_seed(0)

# Construct test tensor with both positive and negative values
# to exercise the two_compl function logic
x = torch.tensor([-5, -1, 3, 7], dtype=torch.int32)

# bits parameter: number of bits for two's complement representation
bits = 4

ARGS = {
    "x": x,
    "bits": bits,
}
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 1, dtype family int, shape (4,) — shape (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
get_falcon Not yet run
unverified (harvested, no recorded run)
ist-daslab/quik/experiments/fake_quant/modelutils.py
code served (permissive licence) · get_code("586dfe618a4fadd4")
How it ran

no invocation recorded.

get_opt Not yet run
unverified (harvested, no recorded run)
ist-daslab/quik/experiments/fake_quant/modelutils.py
code served (permissive licence) · get_code("afe299403d03afcb")
How it ran

no invocation recorded.

get_wikitext2 Not yet run
unverified (harvested, no recorded run)
ist-daslab/quik/experiments/datautils.py
code served (permissive licence) · get_code("79092c10d8a25941")
How it ran

no invocation recorded.

llama_eval Not yet run
unverified (harvested, no recorded run)
ist-daslab/quik/experiments/llama.py
code served (permissive licence) · get_code("340f10d2f7201ee7")
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, 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 13 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

Large Language Models (LLMs) from the GPT family have become extremely popular, leading to a race towards reducing their inference costs to allow for efficient local computation. Yet, the vast majority of existing work focuses on weight-only quantization, which can reduce runtime costs in the memory-bound one-token-at-a-time generative setting, but does not address them in compute-bound scenarios, such as batched inference or prompt processing. In this paper, we address the general quantization problem, where both weights and activations should be quantized. We show, for the first time, that the majority of inference computations for large generative models such as LLaMA, OPT, and Falcon can be performed with both weights and activations being cast to 4 bits, in a way that leads to practical speedups, while at the same time maintaining good accuracy. We achieve this via a hybrid quantization strategy called QUIK, which compresses most of the weights and activations to 4-bit, while keeping some outlier weights and activations in higher-precision. The key feature of our scheme is that it is designed with computational efficiency in mind: we provide GPU kernels matching the QUIK format with highly-efficient layer-wise runtimes, which lead to practical end-to-end throughput improvements of up to 3.4x relative to FP16 execution. We provide detailed studies for models from the OPT, LLaMA-2 and Falcon families, as well as a first instance of accurate inference using quantization plus 2:4 sparsity. Code is available at: https://github.com/IST-DASLab/QUIK.

For agents

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

get_harvested_code_for_paper("2310.09259")
get_code_for_paper("2310.09259")
have("2310.09259")

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

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

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

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

Connect an agent — have() is free.