SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2510.03267 · ICLR · 2025

PT$^2$-LLM: Post-Training Ternarization for Large Language Models

Yulun Zhang, Ruobing Xie, Haotong Qin, Xingwu Sun, Xianglong Yan, Chengzhu Bao, Zhiteng Li, Tianao Zhang, Kaicheng Yang

arXiv · PDF · Open in the Atlas

Code that ran

13 of 24 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, 1 violated it and 0 have no contract verdict; 10 failures of our instrument; 11 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/2510.03267.json · badge: /api/ran/2510.03267.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
XIANGLONGYAN/PT2-LLM canonical (classifier label)
classifier basis: census
13 ran · 11 no recorded run
FunctionStatusWhere it lives
add_common_args Ran
ran; our contract draft was wrong, not the code
XIANGLONGYAN/PT2-LLM/pt2_llm/eval_utils.py
code served (permissive licence) · get_code("86b2b0edb3228d3b")
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 ArgumentParser. 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 argparse

torch.manual_seed(0)

# Create a minimal ArgumentParser to test add_common_args
parser = argparse.ArgumentParser()

# The function add_common_args modifies the parser in-place and returns it
# We need to prepare arguments that would be parsed from command line

ARGS = {
    'parser': parser,
}
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 ArgumentParser — a ArgumentParser output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ArgumentParser 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
atq Ran
ran; our contract draft was wrong, not the code
XIANGLONGYAN/PT2-LLM/pt2_llm/quantizer.py
code served (permissive licence) · get_code("3012b28251a8b320")
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
import torch.nn as nn

torch.manual_seed(0)

# x: input tensor shape (batch_size, dim)
# The function uses x.mean(dim=1), x.shape, so it needs to be 2D
x = torch.randn(2, 4, dtype=torch.float32)

# S: covariance or similarity matrix used in the atq function
# From the code: T @ S, S @ one, x @ S * T, x @ S @ one
# S should be (dim, dim) to work with (batch, dim) @ (dim, dim)
S = torch.randn(4, 4, dtype=torch.float32)

# logger: optional logging parameter, can be None or a simple object
logger = None

ARGS = {
    "x": x,
    "S": S,
    "logger": logger,
}
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 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
cluster_based_perm Ran
ran; our contract draft was wrong, not the code
XIANGLONGYAN/PT2-LLM/pt2_llm/gptq.py
code served (permissive licence) · get_code("dab5f3ef2b72c0dc")
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 (3,) 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 numpy as np
import random

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

# Create a small weight matrix tensor
# Shape: (features, output_dim) - distinct dimensions for clarity
W = torch.randn(4, 3)

# Define ARGS dict with all parameters
ARGS = {
    "W": W,
    "num_groups": 2,
    "pca_dim_ratio": 0.05
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, 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 (3,) — shape (3,) 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
cluster_based_perm Ran
ran; our contract draft was wrong, not the code
XIANGLONGYAN/PT2-LLM/pt2_llm/gptq_ssr.py
code served (permissive licence) · get_code("290494739e1414f0")
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 (3,) 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 numpy as np
import random
from collections import Counter
from sklearn.cluster import KMeans

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

# Create a small weight matrix W
# Shape: (4, 3) - 4 features, 3 output channels
W = torch.randn(4, 3)

# num_groups: number of clusters
num_groups = 2

# pca_dim_ratio: ratio for PCA dimension (not used in function but parameter exists)
pca_dim_ratio = 0.05

ARGS = {
    "W": W,
    "num_groups": num_groups,
    "pca_dim_ratio": pca_dim_ratio,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, 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 (3,) — shape (3,) 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
count_ternary_patterns Ran
ran; our contract draft was wrong, not the code
XIANGLONGYAN/PT2-LLM/pt2_llm/gptq.py
code served (permissive licence) · get_code("d861ac5b9a252b36")
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 Counter. 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 collections import Counter

torch.manual_seed(0)

# Construct a small tensor with ternary values (-1, 0, 1)
T = torch.tensor([[-1, 0, 1, -1],
                   [0, 1, -1, 0]], dtype=torch.int32)

pattern_size = 3

ARGS = {
    "T": T,
    "pattern_size": pattern_size
}
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 Counter — a Counter output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Counter 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_layers Ran
ran; our contract draft was wrong, not the code
XIANGLONGYAN/PT2-LLM/pt2_llm/model_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from squeezeailab/kvquant, is pointer only (licence: NONE) · get_code("a9e7f2cdf016b88b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from squeezeailab/kvquant, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

llama_eval Ran
ran, honoured the contract we drafted
XIANGLONGYAN/PT2-LLM/pt2_llm/eval_ppl.py
code served (permissive licence) · get_code("7823347a3a40550c")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. 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, 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 minimal LLaMA-like model structure
class RotaryEmb(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return x

class LlamaLayer(nn.Module):
    def __init__(self, hidden_size):
        super().__init__()
        self.self_attn = nn.Linear(hidden_size, hidden_size)
        self.mlp = nn.Linear(hidden_size, hidden_size)
    
    def forward(self, hidden_states, attention_mask=None, position_embeddings=None):
        hidden_states = self.self_attn(hidden_states)
        hidden_states = self.mlp(hidden_states)
        return (hidden_states,)

class LlamaModel(nn.Module):
    def __init__(self, hidden_size, num_layers):
        super().__init__()
        self.embed_tokens = nn.Embedding(1000, hidden_size)
        self.layers = nn.ModuleList([LlamaLayer(hidden_size) for _ in range(num_layers)])
        self.norm = nn.LayerNorm(hidden_size)
        self.rotary_emb = RotaryEmb()
    
    def forward(self, input_ids):
        hidden_states = self.embed_tokens(input_ids)
        for layer in self.layers:
            hidden_states = layer(hidden_states, attention_mask=None, position_embeddings=None)[0]
        return hidden_states

class LlamaForCausalLM(nn.Module):
    def __init__(self, hidden_size=4, num_layers=2, vocab_size=1000):
        super().__init__()
        self.model = LlamaModel(hidden_size, num_layers)
        self.lm_head = nn.Linear(hidden_size, vocab_size)
        self.seqlen = 2048
        self.config = type('Config', (), {
            'use_cache': False,
            'hidden_size': hidden_size,
        })()
    
    def forward(self, input_ids):
        hidden_states = self.model(input_ids)
        logits = self.lm_head(hidden_states)
        return logits

class TestEncoding:
    def __init__(self, input_ids):
        self.input_ids = input_ids

# Create test data
hidden_size = 4
num_layers = 2
vocab_size = 1000
seqlen = 2048
nsamples = 2
total_tokens = nsamples * seqlen

# Create model
model = LlamaForCausalLM(hidden_size=hidden_size, num_layers=num_layers, vocab_size=vocab_size)

# Create test encoding - token IDs tensor
input_ids = torch.randint(0, vocab_size, (1, total_tokens))
testenc = TestEncoding(input_ids)

# Create device
dev = 'cpu'

# Create dataset name
dataset = 'test_dataset'

# Create ARGS dict
ARGS = {
    'model': model,
    'testenc': testenc,
    'dev': dev,
    'dataset': dataset,
    'log_wandb': False,
    'ppl_seqlen': 2048
}
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 float, 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
qwen_eval Ran
ran, honoured the contract we drafted
XIANGLONGYAN/PT2-LLM/pt2_llm/eval_ppl.py
code served (permissive licence) · get_code("7cb1e73581e2b09c")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. 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, 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 minimal Qwen-like model structure
class MinimalConfig:
    def __init__(self):
        self.hidden_size = 4
        self.vocab_size = 128
        self.use_cache = True
        self.num_hidden_layers = 2

class MinimalAttention(nn.Module):
    def __init__(self, hidden_size):
        super().__init__()
        self.attention_type = "self"
        self.linear = nn.Linear(hidden_size, hidden_size)
    
    def forward(self, hidden_states, attention_mask=None, position_embeddings=None):
        return self.linear(hidden_states)

class MinimalLayer(nn.Module):
    def __init__(self, hidden_size):
        super().__init__()
        self.attention_type = "self"
        self.self_attn = MinimalAttention(hidden_size)
        self.mlp = nn.Linear(hidden_size, hidden_size)
    
    def forward(self, hidden_states, attention_mask=None, position_embeddings=None):
        attn_out = self.self_attn(hidden_states, attention_mask=attention_mask, position_embeddings=position_embeddings)
        mlp_out = self.mlp(attn_out)
        return mlp_out,

class MinimalModel(nn.Module):
    def __init__(self, config):
        super().__init__()
        self.config = config
        self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size)
        self.layers = nn.ModuleList([
            MinimalLayer(config.hidden_size) 
            for _ in range(config.num_hidden_layers)
        ])
        self.norm = nn.LayerNorm(config.hidden_size)
    
    def forward(self, input_ids, attention_mask=None):
        hidden_states = self.embed_tokens(input_ids)
        for layer in self.layers:
            hidden_states = layer(hidden_states, attention_mask=attention_mask)[0]
        return hidden_states

class MinimalQwenModel(nn.Module):
    def __init__(self, config):
        super().__init__()
        self.config = config
        self.seqlen = 2048
        self.model = MinimalModel(config)
        self.lm_head = nn.Linear(config.hidden_size, config.vocab_size)
    
    def forward(self, input_ids, attention_mask=None):
        hidden_states = self.model(input_ids, attention_mask=attention_mask)
        logits = self.lm_head(hidden_states)
        return logits

# Create config and model
config = MinimalConfig()
model = MinimalQwenModel(config)

# Create small test encoding (token ids)
# Shape: (1, 4096) to have at least 2 samples of seqlen=2048
testenc_input_ids = torch.randint(0, config.vocab_size, (1, 4096), dtype=torch.long)

class MinimalTestEnc:
    def __init__(self, input_ids):
        self.input_ids = input_ids

testenc = MinimalTestEnc(testenc_input_ids)

# Device (CPU only)
dev = 'cpu'

# Dataset name
dataset = 'test_dataset'

# Build ARGS dictionary
ARGS = {
    'model': model,
    'testenc': testenc,
    'dev': dev,
    'dataset': dataset,
    'log_wandb': False,
    'ppl_seqlen': 2048
}
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 float, 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
setup_logger Ran
ran; our contract draft was wrong, not the code
XIANGLONGYAN/PT2-LLM/quantize.py
code served (permissive licence) · get_code("b50e1058ea310be4")
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 RootLogger. 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 logging
import tempfile
import os

# Create a temporary file for logging
temp_dir = tempfile.gettempdir()
log_file = os.path.join(temp_dir, "test_logger.log")

ARGS = {
    "log_file": log_file
}
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 RootLogger — a RootLogger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RootLogger 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
ternary_init Ran
ran; our contract draft was wrong, not the code
XIANGLONGYAN/PT2-LLM/pt2_llm/quantizer.py
code served (permissive licence) · get_code("9ef9b159a0d540b7")
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 numpy as np

torch.manual_seed(0)

# Create a small tensor for testing
# Shape: (batch_size=2, feature_dim=4)
x = torch.randn(2, 4)

ARGS = {
    'x': x
}
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 — 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
ternary_init_only Ran
ran; our contract draft was wrong, not the code
XIANGLONGYAN/PT2-LLM/pt2_llm/quantizer.py
code served (permissive licence) · get_code("a63bf3bef780168d")
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
import numpy as np

torch.manual_seed(0)

# Create a small tensor with shape (batch_size=2, dim=4)
# The function expects x to have at least 2 dimensions
# It computes mean across dim=1, so we need multiple columns
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 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
ternary_pattern_to_id Ran
ran, violated the contract we drafted
XIANGLONGYAN/PT2-LLM/pt2_llm/gptq.py
code served (permissive licence) · get_code("9516b5796ab3b949")
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 numpy as np

# Analyze the function:
# - ternary_pattern_to_id takes a single parameter: pattern
# - pattern is iterated over: for x in pattern
# - each element x is used in arithmetic: x + 1
# - the result is a number (pattern_id)
# pattern should be a sequence (list, tuple, or array-like) of numeric values

# Create a simple pattern as a list of integers
# The function treats each element as a value to convert to base-3 representation
pattern = [0, 1, -1, 2]  # Simple ternary pattern with values in range [-1, 2]

ARGS = {
    "pattern": pattern
}
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 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
topk_similar_columns Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
XIANGLONGYAN/PT2-LLM/pt2_llm/gptq_ssr.py
code served (permissive licence) · get_code("55b80284fff862b9")
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 (3,) 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

torch.manual_seed(0)

# Create a small weight matrix W_left with shape (n_features, n_cols)
# Using distinct dimensions: 4 rows (features), 3 columns (to select from)
W_left = torch.randn(4, 3)

ARGS = {
    "W_left": W_left,
    "blocksize": 2
}
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 (3,) — shape (3,) 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
cleanup_memory Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/pt2_llm/model_utils.py
code served (permissive licence) · get_code("a8119d4e31042017")
How it ran

no invocation recorded.

cluster_based_perm_balanced Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/pt2_llm/gptq_ssr.py
code served (permissive licence) · get_code("00150b858dfafe07")
How it ran

no invocation recorded.

eval_ppl Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/run_ppl_eval.py
code served (permissive licence) · get_code("f044b684b951e585")
How it ran

no invocation recorded.

get_model Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/quantize.py
code served (permissive licence) · get_code("75fa5d245db56957")
How it ran

no invocation recorded.

get_ppl_eval_loaders Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/run_ppl_eval.py
code served (permissive licence) · get_code("88e150118e4e25e0")
How it ran

no invocation recorded.

get_ppl_eval_loaders_original Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/run_ppl_eval.py
code served (permissive licence) · get_code("9e96f484accf8fe8")
How it ran

no invocation recorded.

get_ptb Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/pt2_llm/data.py
code served (permissive licence) · get_code("1b0736b420b42de6")
How it ran

no invocation recorded.

get_tokenizer Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/pt2_llm/data.py
code served (permissive licence) · get_code("9b51f71e770bd399")
How it ran

no invocation recorded.

get_wikitext2 Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/pt2_llm/data.py
code served (permissive licence) · get_code("bc9148e3beb23d8f")
How it ran

no invocation recorded.

load_quant Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/pt2_llm/eval_utils.py
code served (permissive licence) · get_code("9fa0c8cd09b878ff")
How it ran

no invocation recorded.

opt_eval Not yet run
unverified (harvested, no recorded run)
XIANGLONGYAN/PT2-LLM/pt2_llm/eval_ppl.py
code served (permissive licence) · get_code("576d385291767a99")
How it ran

no invocation recorded.

Also present in other papers' code

Of 24 samples lifted from this paper's linked repositories, 24 carry a function identity and 0 do not. Of the 24 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 23 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
24 dated earlier, 1 later, 1 same year, order not determinable, 1 undated
2203.13474 (2022-03)
CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis
2023.emnlp-main.892 (2023 (year only))
Z-FOLD: A Frustratingly Easy Post-Training Quantization Scheme for LLMs
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
and 24 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-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

Large Language Models (LLMs) have shown impressive capabilities across diverse tasks, but their large memory and compute demands hinder deployment. Ternarization has gained attention as a promising compression technique, delivering substantial size reduction and high computational efficiency. However, its potential in the post-training quantization (PTQ) setting remains underexplored, due to the challenge of training-free parameter optimization and the quantization difficulty posed by outliers and dispersed weights. To address these issues, we propose PT 2 -LLM, a post-training ternarization framework tailored for LLMs. At its core is an Asymmetric Ternary Quantizer equipped with a two-stage refinement pipeline: (1) Iterative Ternary Fitting (ITF), which alternates between optimal ternary grid construction and flexible rounding to minimize quantization error, and (2) Activation-aware Grid Alignment (AGA), which further refines the ternary grid to better match full-precision outputs. In addition, we propose a plug-and-play Structural Similarity-based Reordering (SSR) strategy that leverages inter-column structural similarity to ease quantization and mitigate outlier effects, further enhancing overall performance. Extensive experiments demonstrate that PT 2 -LLM delivers competitive performance against state-of-the-art (SOTA) 2-bit PTQ methods with lower memory cost, while also accelerating both prefill and decoding to achieve end-to-end speedup. The code and models will be available at https://github.com/XIANGLONGYAN/PT2-LLM.

For agents

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

get_harvested_code_for_paper("2510.03267")
get_code_for_paper("2510.03267")
have("2510.03267")

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

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

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

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

Connect an agent — have() is free.