SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.17946 · NeurIPS · 2024

SparseLLM: Towards Global Pruning of Pre-trained Language Models

Liang Zhao, Guangji Bai, Chen Ling, Kibaek Kim, Yijiang Li

arXiv · PDF · Open in the Atlas

Code that ran

3 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 2 failures of our instrument; 6 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2402.17946.json · badge: /api/ran/2402.17946.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
BaiTheBest/SparseLLM canonical (classifier label)
classifier basis: census
2 ran · 6 no recorded run
baithebest/sparsellm community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
SparseGPT_OPT Ran
ran on a synthesized input · constructed an object; no result was computed
baithebest/sparsellm/pruning_utils.py
code served (permissive licence) · get_code("b5fc92a2899d6d8a")
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 an instance of its own class, SparseGPT_OPT: the run constructed the object and did not call it, so no result was computed. 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 on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import transformers
import math

torch.manual_seed(0)

# Create a simple linear layer to use as the layer parameter
layer = nn.Linear(in_features=3, out_features=4)

# Create sample input and output tensors for add_batch
# Input: (batch_size, sequence_length, input_dim)
inp = torch.randn(2, 5, 3)
out = torch.randn(2, 5, 4)

ARGS = {
    "layer": layer
}
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 SparseGPT_OPT — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SparseGPT_OPT 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
BaiTheBest/SparseLLM/pruning_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.

quantize Ran
ran; our contract draft was wrong, not the code
BaiTheBest/SparseLLM/quant.py
code served (permissive licence) · get_code("50ceff9d34d96d60")
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)

# x: tensor to quantize
x = torch.randn(2, 4)

# scale: scaling factor (tensor or float)
scale = torch.tensor(0.1)

# zero: zero point offset
zero = torch.tensor(0, dtype=torch.long)

# maxq: maximum quantization level
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
get_llama Not yet run
unverified (harvested, no recorded run)
BaiTheBest/SparseLLM/model_utils.py
code served (permissive licence) · get_code("0ac474c6b7daab48")
How it ran

no invocation recorded.

get_opt Not yet run
unverified (harvested, no recorded run)
BaiTheBest/SparseLLM/model_utils.py
code served (permissive licence) · get_code("ca396f6562e13af3")
How it ran

no invocation recorded.

get_ptb Not yet run
unverified (harvested, no recorded run)
BaiTheBest/SparseLLM/datautils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Aaronhuang-778/MC-MoE, is pointer only (licence: NONE) · get_code("a7cbf4fc49c71e03")
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 Aaronhuang-778/MC-MoE, 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. No invocation recorded.

get_tokenizer Not yet run
unverified (harvested, no recorded run)
BaiTheBest/SparseLLM/datautils.py
code served (permissive licence) · get_code("729f957048af4a3f")
How it ran

no invocation recorded.

get_wikitext2 Not yet run
unverified (harvested, no recorded run)
BaiTheBest/SparseLLM/datautils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Aaronhuang-778/MC-MoE, is pointer only (licence: NONE) · get_code("011909315dfdbc2e")
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 Aaronhuang-778/MC-MoE, 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. No invocation recorded.

opt_sparsellm Not yet run
unverified (harvested, no recorded run)
BaiTheBest/SparseLLM/model_utils.py
code served (permissive licence) · get_code("dd6dc15886074ef8")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 4 the same month, 5 later) and 4 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
9 dated earlier, 1 the same month, 15 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
get_ptb 7 other papers
1 dated earlier, 1 the same month, 5 later
2310.00034 (2023-10)
PB-LLM: Partially Binarized Large Language Models
2402.04291 (2024-02)
BiLLM: Pushing the Limit of Post-Training Quantization for LLMs
2405.15756 (2024-05)
Wasserstein Distances, Neuronal Entanglement, and Sparsity
and 4 more not named here
get_tokenizer 6 other papers
1 dated earlier, 1 the same month, 4 later
2310.00034 (2023-10)
PB-LLM: Partially Binarized Large Language Models
2402.04291 (2024-02)
BiLLM: Pushing the Limit of Post-Training Quantization for LLMs
2409.18850 (2024-09)
Two Sparse Matrices are Better than One: Sparsifying Neural Networks with Double Sparse Factorization
and 3 more not named here
get_wikitext2 6 other papers
1 dated earlier, 1 the same month, 4 later
2310.00034 (2023-10)
PB-LLM: Partially Binarized Large Language Models
2402.04291 (2024-02)
BiLLM: Pushing the Limit of Post-Training Quantization for LLMs
2409.18850 (2024-09)
Two Sparse Matrices are Better than One: Sparsifying Neural Networks with Double Sparse Factorization
and 3 more not named here
quantize 6 other papers
2 dated earlier, 3 later, 1 same year, order not determinable
2307.15290 (2023-07)
ChatHome: Development and Evaluation of a Domain-Specific Language Model for Home Renovation
2310.00034 (2023-10)
PB-LLM: Partially Binarized Large Language Models
2024.findings-naacl.145 (2024 (year only))
Role Prompting Guided Domain Adaptation with General Capability Preserve for Large Language Models
and 3 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-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

The transformative impact of large language models (LLMs) like LLaMA and GPT on natural language processing is countered by their prohibitive computational demands. Pruning has emerged as a pivotal compression strategy, introducing sparsity to enhance both memory and computational efficiency. Yet, traditional global pruning is impractical for LLMs due to scalability issues, while local pruning, despite its efficiency, leads to suboptimal solutions. Addressing these challenges, we propose SparseLLM, a novel framework that redefines the global pruning process into manageable, coordinated subproblems, allowing for resource-efficient optimization with global optimality. SparseLLM's approach, which conceptualizes LLMs as a chain of modular functions and leverages auxiliary variables for problem decomposition, not only facilitates a pragmatic application on LLMs but also demonstrates significant performance improvements, particularly in high-sparsity regimes, surpassing current state-of-the-art methods. Our source code is publicly available at https://github.com/BaiTheBest/SparseLLM.

For agents

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

get_harvested_code_for_paper("2402.17946")
get_code_for_paper("2402.17946")
have("2402.17946")

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

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

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

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

Connect an agent — have() is free.