SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2023.emnlp-main.892 · EMNLP · 2023

Z-FOLD: A Frustratingly Easy Post-Training Quantization Scheme for LLMs

Yongkweon Jeon, Chungman Lee, Kyungphil Park, Ho-Young Kim

Open in the Atlas

Code that ran

6 of 16 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 4 have no contract verdict; 2 failures of our instrument; 10 no recorded run), measured 2026-11-24; 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/2023.emnlp-main.892.json · badge: /api/ran/2023.emnlp-main.892.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
SamsungLabs/Z-Fold canonical (classifier label)
classifier basis: census
6 ran · 10 no recorded run
FunctionStatusWhere it lives
c4_set_input_ids Ran
ran on a synthesized input
SamsungLabs/Z-Fold/datautils.py
code served (permissive licence) · get_code("d13f2b6279e1c693")
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 4, 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 torch
import random

torch.manual_seed(0)
random.seed(0)

class MockTokenizer:
    def __call__(self, text, return_tensors=None):
        class TokenizerOutput:
            def __init__(self):
                self.input_ids = torch.randint(0, 1000, (1, 50))
        return TokenizerOutput()

tokenizer = MockTokenizer()

inputs = [
    {'text': 'This is a sample text for testing the c4 set input ids function with enough tokens.'},
    {'text': 'Another example text with sufficient length to pass the seqlen requirement.'},
    {'text': 'Yet another piece of text that should work fine for the random sampling.'},
]

seed = 42
seqlen = 10
nsamples = 3
mode = 'train'

ARGS = {
    'tokenizer': tokenizer,
    'inputs': inputs,
    'seed': seed,
    'seqlen': seqlen,
    'nsamples': nsamples,
    'mode': mode,
}
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 4, dtype family int — 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
find_layers Ran
ran; our contract draft was wrong, not the code
SamsungLabs/Z-Fold/zfold.py
code served (permissive licence) · get_code("602607980dfc128c")
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 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
from torch import nn

torch.manual_seed(0)

# Build a small neural network module with Conv2d and Linear layers
module = nn.Sequential(
    nn.Conv2d(3, 16, kernel_size=3),
    nn.ReLU(),
    nn.Linear(16, 4)
)

# Alternative more complex module to test recursive traversal
class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv2d(3, 8, kernel_size=3)
        self.fc = nn.Linear(8, 4)
    
    def forward(self, x):
        return self.fc(self.conv(x))

test_module = SimpleNet()

ARGS = {
    'module': test_module,
    'layers': [nn.Conv2d, nn.Linear],
    '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 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
get_bloom Ran
ran on a synthesized input
SamsungLabs/Z-Fold/bloom.py
code served (permissive licence) · get_code("f18f0494e2be2164")
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
from unittest.mock import Mock, MagicMock
from transformers import BloomForCausalLM

torch.manual_seed(0)

# Create a minimal mock for BloomForCausalLM that satisfies the function's usage
mock_model = Mock(spec=BloomForCausalLM)
mock_model.seqlen = None
mock_model.eval = Mock(return_value=None)

# Mock the from_pretrained method to return our mock model
with torch.no_grad():
    original_from_pretrained = BloomForCausalLM.from_pretrained
    BloomForCausalLM.from_pretrained = Mock(return_value=mock_model)

# The function takes a model identifier string
ARGS = {
    "model": "bigscience/bloom-560m"
}
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
init_quantization_scale Ran
ran on a synthesized input
SamsungLabs/Z-Fold/zfold.py
code served (permissive licence) · get_code("ffb8648e07fb63de")
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 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
from torch import nn, Tensor

torch.manual_seed(0)

# Create a small tensor for quantization
# Shape: (batch=2, features=4) - 2D tensor with batch dimension
x = torch.randn(2, 4)

# Parameters for init_quantization_scale
n_bits = 8
symmetric = True
channel_wise = True
scale_method = 'mse'
signed = True

ARGS = {
    'x': x,
    'n_bits': n_bits,
    'symmetric': symmetric,
    'channel_wise': channel_wise,
    'scale_method': scale_method,
    'signed': signed
}
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 tuple, ndim 3, 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
quantize Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SamsungLabs/Z-Fold/quant.py
code served (permissive licence) · get_code("41c57e55d21c4d96")
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 x (batch_size=2, features=4)
x = torch.randn(2, 4)

# Create scalar scale parameter
scale = torch.tensor(0.1)

# Create scalar zero parameter
zero = torch.tensor(0.0)

# Create integer maxq parameter (positive value for normal quantization)
maxq = 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
wiki_ptb_set_input_ids Ran
ran on a synthesized input
SamsungLabs/Z-Fold/datautils.py
code served (permissive licence) · get_code("2d648c2a0651463a")
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 4, 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 torch
import random

torch.manual_seed(0)

# Create a mock inputs object with input_ids attribute
class MockInputs:
    def __init__(self):
        # Shape: (batch_size=2, sequence_length=10)
        # We need seqlen=4, so sequence_length must be > seqlen + 1
        self.input_ids = torch.randint(0, 100, (2, 10))

inputs = MockInputs()
seed = 42
seqlen = 4
nsamples = 3

ARGS = {
    "inputs": inputs,
    "seed": seed,
    "seqlen": seqlen,
    "nsamples": nsamples
}
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 4, dtype family int — 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
bloom_nearest Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/bloom.py
code served (permissive licence) · get_code("0be0cc95c7e2c075")
How it ran

no invocation recorded.

bloom_sequential Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/bloom.py
code served (permissive licence) · get_code("4c7dbc08f69a7498")
How it ran

no invocation recorded.

find_qkv_params Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/zfold.py
code served (permissive licence) · get_code("b37370202097713f")
How it ran

no invocation recorded.

get_llama Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/llama.py
code served (permissive licence) · get_code("6897a8caeb3dedd0")
How it ran

no invocation recorded.

get_opt Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/opt.py
code served (permissive licence) · get_code("6353af0994dc9501")
How it ran

no invocation recorded.

get_wikitext2 Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/datautils.py
code served (permissive licence) · get_code("f011af2b47206903")
How it ran

no invocation recorded.

llama_nearest Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/llama.py
code served (permissive licence) · get_code("8a87900f3f52fdff")
How it ran

no invocation recorded.

llama_sequential Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/llama.py
code served (permissive licence) · get_code("5a78f54227d63c12")
How it ran

no invocation recorded.

opt_nearest Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/opt.py
code served (permissive licence) · get_code("d91da6595b0c5b1a")
How it ran

no invocation recorded.

opt_sequential Not yet run
unverified (harvested, no recorded run)
SamsungLabs/Z-Fold/opt.py
code served (permissive licence) · get_code("b9f991171a7e5789")
How it ran

no invocation recorded.

Also present in other papers' code

Of 16 samples lifted from this paper's linked repositories, 16 carry a function identity and 0 do not. Of the 16 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 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
find_layers 27 other papers
1 dated earlier, 19 later, 6 same year, order not determinable, 1 undated
2203.13474 (2022-03)
CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
2307.15290 (2023-07)
ChatHome: Development and Evaluation of a Domain-Specific Language Model for Home Renovation
and 24 more not named here
quantize 9 other papers
1 dated earlier, 5 later, 2 same year, order not determinable, 1 undated · 1 only as an assembly brick
2210.17323 (2022-10)
GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers
2312.05215 (2023-12)
DeltaZip: Efficient Serving of Multiple Full-Model-Tuned LLMs
2312.05821 (2023-12)
ASVD: Activation-aware Singular Value Decomposition for Compressing Large Language Models
and 6 more not named here

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-24.

Repositories linked to this paper

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

Abstract

Efficient inference has become crucial for hyper-scale AI models, including large language models, as their parameter count continues to increase for enhanced performance. This necessity holds true regardless of the computing environment, whether it be mobile devices or cloud servers. Quantization emerges as a solution to alleviate the computational burden during inference. By representing models with a reduced bit-width, quantization minimizes the frequency of DRAM access while fully exploiting the parallelism of operations through a dense matrix format. Consequently, quantized models achieve low end-to-end latency and optimize resource utilization by addressing both memory and computing bottlenecks. In this paper, we propose a straightforward posttraining quantization scheme, called Z-FOLD, that fully utilizes the feature of the Transformer structure widely employed in large language models. The code will be available at https: //github.com/SamsungLabs/Z-Fold.

For agents

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

get_harvested_code_for_paper("2023.emnlp-main.892")
get_code_for_paper("2023.emnlp-main.892")
have("2023.emnlp-main.892")

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

curl https://syntology.ai/api/ran/2023.emnlp-main.892.json

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

[![Syntology run record](https://syntology.ai/api/ran/2023.emnlp-main.892.svg)](https://syntology.ai/paper/2023.emnlp-main.892)

Connect an agent — have() is free.