SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.18556 · 2026

GSQ: Highly-Accurate Low-Precision Scalar Quantization for LLMs via Gumbel-Softmax Sampling

Dan Alistarh, Eldar Kurtić, Michael Helcig, Alireza Dadgarnia, Ista Soroush, Tabesh Ista, Maximilian Kleinegger

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 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, 2 violated it and 0 have no contract verdict; 7 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2604.18556.json · badge: /api/ran/2604.18556.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/GSQ canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
FunctionStatusWhere it lives
collect_base_model_entries Ran
ran; our contract draft was wrong, not the code
IST-DASLab/GSQ/save_model.py
code served (permissive licence) · get_code("66dfe561ed653037")
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
import os
import tempfile
from safetensors.torch import save_file

torch.manual_seed(0)

# Create a temporary directory with mock safetensors files
temp_dir = tempfile.mkdtemp()

# Create sample tensors and save them in safetensors format
# File 1: model with some layers
tensors_file1 = {
    'embedding.weight': torch.randn(4, 3),
    'layers.0.weight': torch.randn(3, 2),
    'layers.0.bias': torch.randn(2),
    'layers.1.weight': torch.randn(2, 4),
    'layers.1.bias': torch.randn(4),
}
save_file(tensors_file1, os.path.join(temp_dir, 'model-00001-of-00002.safetensors'))

# File 2: more layers
tensors_file2 = {
    'layers.2.weight': torch.randn(4, 3),
    'layers.2.bias': torch.randn(3),
    'layers.3.weight': torch.randn(3, 2),
    'output.weight': torch.randn(2, 5),
}
save_file(tensors_file2, os.path.join(temp_dir, 'model-00002-of-00002.safetensors'))

ARGS = {
    'base_model_dir': temp_dir,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
safetensors, 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
discover_layers Ran
ran; our contract draft was wrong, not the code
IST-DASLab/GSQ/convert_to_humming.py
code served (permissive licence) · get_code("93b88e4e45825ae2")
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 json
import tempfile
from pathlib import Path
from safetensors.numpy import save_file
import numpy as np

# Create a temporary directory with safetensors files
tmpdir = tempfile.mkdtemp()
in_dir = Path(tmpdir)

# Create sample weight data
weights_data = {
    'model.layers.0.mlp.gate_proj.weight_packed': np.random.randn(4, 3).astype(np.float32),
    'model.layers.0.mlp.gate_proj.weight_scale': np.random.randn(4).astype(np.float32),
    'model.layers.0.mlp.gate_proj.weight_shape': np.array([4, 3], dtype=np.int64),
    'model.layers.1.attention.q_proj.weight_packed': np.random.randn(8, 5).astype(np.float32),
    'model.layers.1.attention.q_proj.weight_scale': np.random.randn(8).astype(np.float32),
    'model.layers.1.attention.q_proj.weight_shape': np.array([8, 5], dtype=np.int64),
    'model.layers.0.mlp.up_proj.weight_packed': np.random.randn(6, 2).astype(np.float32),
    'model.layers.0.mlp.up_proj.weight_scale': np.random.randn(6).astype(np.float32),
    'model.layers.0.mlp.up_proj.weight_shape': np.array([6, 2], dtype=np.int64),
}

# Save as single safetensors file
single_file = in_dir / 'model.safetensors'
save_file(weights_data, str(single_file))

ARGS = {
    'in_dir': in_dir,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, safetensors — 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
find_latest_run Ran
ran; our contract draft was wrong, not the code
IST-DASLab/GSQ/eval_model.py
code served (permissive licence) · get_code("d047a654dcc09c44")
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 os
import tempfile
import json

# Create a temporary directory structure with test runs
temp_dir = tempfile.mkdtemp()

# Create first run with progress.json
run1_dir = os.path.join(temp_dir, 'run_001')
os.makedirs(run1_dir, exist_ok=True)
prog1_path = os.path.join(run1_dir, 'progress.json')
with open(prog1_path, 'w') as f:
    json.dump({'step': 100}, f)

# Create second run with progress.json (more recent)
run2_dir = os.path.join(temp_dir, 'run_002')
os.makedirs(run2_dir, exist_ok=True)
prog2_path = os.path.join(run2_dir, 'progress.json')
with open(prog2_path, 'w') as f:
    json.dump({'step': 200}, f)

# Create a directory without progress.json (should be ignored)
run3_dir = os.path.join(temp_dir, 'run_003')
os.makedirs(run3_dir, exist_ok=True)

ARGS = {
    'checkpoint_dir': temp_dir
}
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
load_layer_tensors Ran
ran; our contract draft was wrong, not the code
IST-DASLab/GSQ/convert_to_humming.py
code served (permissive licence) · get_code("ad0d7c3339fff0a2")
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 tempfile
import os
from safetensors.torch import save_file

torch.manual_seed(0)

# Create temporary directory and shard files
tmpdir = tempfile.mkdtemp()

# Create first shard with weight_packed and weight_scale
shard1_path = os.path.join(tmpdir, "shard1.safetensors")
shard1_data = {
    "layer.weight_packed": torch.randn(2, 4),
    "layer.weight_scale": torch.randn(4, 3),
}
save_file(shard1_data, shard1_path)

# Create second shard with weight_shape
shard2_path = os.path.join(tmpdir, "shard2.safetensors")
shard2_data = {
    "layer.weight_shape": torch.randn(5, 6),
}
save_file(shard2_data, shard2_path)

# Construct shard_map
# Maps suffix -> (key, shard_file_path)
shard_map = {
    "weight_packed": ("layer.weight_packed", shard1_path),
    "weight_scale": ("layer.weight_scale", shard1_path),
    "weight_shape": ("layer.weight_shape", shard2_path),
}

ARGS = {
    "shard_map": shard_map,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
safetensors, torch — 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
load_quant_config Ran
ran; our contract draft was wrong, not the code
IST-DASLab/GSQ/convert_to_humming.py
code served (permissive licence) · get_code("999727d7b12f4232")
How it ran

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

import json
import tempfile
from pathlib import Path

# Create a temporary directory with the required config.json structure
temp_dir = tempfile.mkdtemp()
in_dir = Path(temp_dir)

# Create a valid config.json matching what load_quant_config expects
config = {
    "model_type": "llama",
    "hidden_size": 768,
    "quantization_config": {
        "quant_method": "compressed-tensors",
        "format": "pack-quantized",
        "config_groups": {
            "group_0": {
                "weights": {
                    "num_bits": 8,
                    "type": "int8",
                    "strategy": "channel"
                }
            }
        }
    }
}

config_file = in_dir / "config.json"
config_file.write_text(json.dumps(config))

ARGS = {
    "in_dir": in_dir
}
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 tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_wandb_run_id Ran
ran; our contract draft was wrong, not the code
IST-DASLab/GSQ/eval_model.py
code served (permissive licence) · get_code("a07ac9c4ea13f152")
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 os
import json
import tempfile
import shutil

# Create a temporary directory structure with a progress.json file
temp_dir = tempfile.mkdtemp()
run_id = "test_run_123"
run_dir = os.path.join(temp_dir, run_id)
os.makedirs(run_dir, exist_ok=True)

# Create a progress.json file with a wandb_run_id
progress_data = {
    "wandb_run_id": "wandb_run_abc_xyz",
    "step": 100,
    "loss": 0.5
}
progress_file = os.path.join(run_dir, "progress.json")
with open(progress_file, 'w') as f:
    json.dump(progress_data, f)

ARGS = {
    "checkpoint_dir": temp_dir,
    "run_id": run_id
}
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
resolve_model_path Ran
ran; our contract draft was wrong, not the code
IST-DASLab/GSQ/save_model.py
code served (permissive licence) · get_code("726199d718f25c3b")
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.

from pathlib import Path
import tempfile
import os

# Create a temporary directory and file to simulate a local path
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "model.pt")
with open(temp_file, 'w') as f:
    f.write("dummy model")

# Test with an existing file path
model_name = temp_file

ARGS = {
    "model_name": model_name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
huggingface_hub — 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
wait_for_health Ran
ran, violated the contract we drafted
IST-DASLab/GSQ/serve_vllm.py
code served (permissive licence) · get_code("fc84bc83a47b18fc")
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 bool, 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 sys
import time
import urllib.error
import urllib.request

# Mock server setup - we'll create a simple test that demonstrates the function
# can be called with valid arguments, but won't actually run a server

ARGS = {
    'port': 8000,
    'timeout_sec': 5,
    'poll_interval': 1
}
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 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
wait_for_ray Ran
ran, violated the contract we drafted
IST-DASLab/GSQ/serve_vllm.py
code served (permissive licence) · get_code("725b6c43bc9fd418")
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 bool, 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 sys
import time

# This function doesn't use any complex objects like models, tensors, or dataloaders
# It only needs simple integer parameters

ARGS = {
    'num_nodes': 2,
    'timeout_sec': 10,
    'poll_interval': 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
ray — 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
load_config Not yet run
unverified (harvested, no recorded run)
IST-DASLab/GSQ/src/config.py
code served (permissive licence) · get_code("e545273558348386")
How it ran

no invocation recorded.

run_completions_test Not yet run
unverified (harvested, no recorded run)
IST-DASLab/GSQ/serve_vllm.py
code served (permissive licence) · get_code("d80eb921294964e0")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 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 11 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-23.

Repositories linked to this paper

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

Abstract

Quantization has become a standard tool for efficient LLM deployment, especially for local inference, where models are now routinely served at 2-3 bits per parameter. The state of the art is currently split into simple scalar quantization techniques, such as GPTQ or AWQ, which are widely deployed but plateau in accuracy at 3-4 bits per parameter (bpp), and "second-generation" vector-or trellis-quantized methods, such as QTIP, GPTVQ and AQLM, which push the accuracy frontier but are notoriously hard to implement and to scale. In this paper, we ask whether this gap is fundamental, or whether a carefully optimized scalar quantizer can recover most of it. We answer in the affirmative, by introducing GSQ (Gumbel-Softmax Quantization), a post-training scalar quantization method which jointly learns the per-coordinate grid assignments and the per-group scales using a Gumbel-Softmax relaxation of the discrete grid. GSQ matches the cardinality of the relaxation to the small number of levels available in the target bit-width regime (e.g., 3-8 levels for ternary and 3 bpp, respectively), making optimization tractable. Practically, on the standard Llama-3.1-8B/70B-Instruct models, GSQ closes most of the gap between scalar quantization and the QTIP frontier at 2 and 3 bits, while using a symmetric scalar grid with group-wise quantization, and thus remains compatible with existing scalar inference kernels. We further show that the same discreteassignment optimization can be applied to practical GGUF K-Quant checkpoints: starting from publicly released GGUF models, GSQ improves accuracy while projecting the result back into the same deployment format. Finally, GSQ scales to trillion-scale Mixture-of-Experts models such as Kimi-K2.5, where vectorquantized methods are difficult to apply. The source code is publicly available at https://github.com/IST-DASLab/GSQ.

For agents

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

get_harvested_code_for_paper("2604.18556")
get_code_for_paper("2604.18556")
have("2604.18556")

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

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

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

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

Connect an agent — have() is free.