SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.17836 · NeurIPS · 2024

Language Models as Zero-shot Lossless Gradient Compressors: Towards General Neural Parameter Prior Models

Mario Fritz, Hui-Po Wang

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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 0 have no contract verdict; 5 failures of our instrument; 0 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/2409.17836.json · badge: /api/ran/2409.17836.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
hui-po-wang/LM-GC canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
hui-po-wang/lm-gc canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
bits_to_bytes Ran
ran; our contract draft was wrong, not the code
hui-po-wang/LM-GC/utils/deepmind_utils.py
code served (permissive licence) · get_code("63e2ee5b6dd1c819")
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 torch
import numpy as np

# The function bits_to_bytes takes a string of bits and converts it to bytes
# It requires a valid bitstream string

ARGS = {
    "bits": "11010110101"  # A simple bitstream string with 11 bits
}
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, 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
bytes_to_bits Ran
ran; our contract draft was wrong, not the code
hui-po-wang/LM-GC/utils/deepmind_utils.py
code served (permissive licence) · get_code("1100deb3c14e1b2b")
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 torch
import numpy as np

# Set seed for reproducibility
torch.manual_seed(0)

# The function takes:
# 1. data: bytes - the input bytes to convert to bitstream
# 2. num_padded_bits: int - number of bits to skip from the beginning (default 0)

# Create sample bytes data
sample_data = b'\x0f\xff'  # Two bytes: 0x0f (00001111) and 0xff (11111111)

# Create ARGS dict with all parameters
ARGS = {
    'data': sample_data,
    'num_padded_bits': 0
}
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 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
compress Ran
ran; our contract draft was wrong, not the code
hui-po-wang/LM-GC/compressors/png.py
code served (permissive licence) · get_code("a97701702e1a2e67")
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 bytes. 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 io
import math
from PIL import Image

# Create test data: a sequence of bytes
# We need a length that can be factored into close squares
# For example, 256 bytes can be factored as 16x16 (perfect square)
test_data = bytes(range(256))

ARGS = {
    "data": test_data,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bytes — a bytes output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a bytes 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
decompress Ran
ran; our contract draft was wrong, not the code
hui-po-wang/LM-GC/compressors/png.py
code served (permissive licence) · get_code("b9d52dfa29c79c4b")
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 bytes. 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 io
from PIL import Image
import numpy as np

# Create a simple valid PNG image in memory
# Create a small 2x2 grayscale image
img_array = np.array([[100, 150], [200, 250]], dtype=np.uint8)
img = Image.fromarray(img_array, mode='L')

# Compress it to PNG bytes
png_bytes_io = io.BytesIO()
img.save(png_bytes_io, format='PNG')
compressed_data = png_bytes_io.getvalue()

ARGS = {
    'data': compressed_data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bytes — a bytes output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a bytes 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
right_shift_bytes_by_one Ran
ran; our contract draft was wrong, not the code
hui-po-wang/LM-GC/utils/deepmind_utils.py
code served (permissive licence) · get_code("0f261d001735e36f")
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 torch
import numpy as np

# Construct arguments for right_shift_bytes_by_one
# The function takes:
# - data: bytes

# Create sample bytes data
sample_data = bytes([0xFF, 0xAA, 0x55, 0x00, 0x80, 0x7F])

ARGS = {
    "data": sample_data,
}
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, 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
test Ran
ran, honoured the contract we drafted
hui-po-wang/lm-gc/train_and_collect_grad.py
code served (permissive licence) · get_code("2341b0a9750434aa")
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) 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal args object with device attribute
class Args:
    def __init__(self):
        self.device = torch.device('cpu')

args = Args()

# Create a minimal neural network that takes inputs and produces outputs
class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(4, 3)  # 4 input features, 3 output classes
    
    def forward(self, x):
        return self.fc(x)

net = SimpleNet()

# Create a loss function (CrossEntropyLoss for classification)
crit = nn.CrossEntropyLoss()

# Create a minimal test loader with 2 batches of (inputs, targets)
# Each batch has 2 samples, 4 features per sample
# Targets are class indices (0, 1, or 2)
test_loader = [
    (torch.randn(2, 4), torch.tensor([0, 1])),
    (torch.randn(2, 4), torch.tensor([2, 0]))
]

ARGS = {
    'args': args,
    'net': net,
    'crit': crit,
    'test_loader': test_loader
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 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
train Ran
ran, honoured the contract we drafted
hui-po-wang/lm-gc/train_and_collect_grad.py
code served (permissive licence) · get_code("a14e485102e0eff2")
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) 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 torch
import torch.nn as nn
import torch.optim as optim
import os
import tempfile

torch.manual_seed(0)

# Create a minimal neural network
class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.fc(x)

# Create a minimal args object
class Args:
    def __init__(self):
        self.device = torch.device('cpu')
        self.batch_step = 0
        self.grad_interval = 1
        self.grad_dir = tempfile.mkdtemp()

args = Args()

# Create network, optimizer, and criterion
net = SimpleNet()
opt = optim.SGD(net.parameters(), lr=0.01)
crit = nn.CrossEntropyLoss()

# Create a minimal train loader with 2 batches
# Each batch has 2 samples with 4 features and 3 classes
train_loader = [
    (torch.randn(2, 4), torch.randint(0, 3, (2,))),
    (torch.randn(2, 4), torch.randint(0, 3, (2,)))
]

ARGS = {
    'args': args,
    'net': net,
    'opt': opt,
    'crit': crit,
    'train_loader': train_loader
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch, yaml — 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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 0 later) and 2 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
bits_to_bytes 1 other paper
1 dated earlier
2309.10668 (2023-09)
Language Modeling Is Compression
bytes_to_bits 1 other paper
1 dated earlier
2309.10668 (2023-09)
Language Modeling Is Compression
compress 1 other paper
1 dated earlier
2309.10668 (2023-09)
Language Modeling Is Compression
decompress 1 other paper
1 dated earlier
2309.10668 (2023-09)
Language Modeling Is Compression
right_shift_bytes_by_one 1 other paper
1 dated earlier
2309.10668 (2023-09)
Language Modeling Is Compression

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

Despite the widespread use of statistical prior models in various fields, such models for neural network gradients have long been overlooked. The inherent challenge stems from their high-dimensional structures and complex interdependencies, which complicate effective modeling. In this work, we demonstrate the potential of large language models (LLMs) to act as gradient priors in a zero-shot setting. We examine the property by considering lossless gradient compression -a critical application in distributed learning -that depends heavily on precise probability modeling. To achieve this, we introduce LM-GC, a novel method that integrates LLMs with arithmetic coding. Our technique converts plain gradients into text-like formats, enhancing token efficiency by up to 38 times compared to their plain representations. We ensure that this data conversion maintains a close alignment with the structure of plain gradients and the symbols commonly recognized by LLMs. Our experiments indicate that LM-GC surpasses existing state-of-theart lossless compression methods, improving compression rates by 10% up to 17.2% across various datasets and architectures. Additionally, our approach shows promising compatibility with lossy compression techniques such as quantization and sparsification. These findings highlight the significant potential of LLMs as a model for effectively handling gradients. Code is available at https://github. com/hui-po-wang/LM-GC.

For agents

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

get_harvested_code_for_paper("2409.17836")
get_code_for_paper("2409.17836")
have("2409.17836")

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

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

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

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

Connect an agent — have() is free.