SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.10800 · NeurIPS · 2021

Lossy Compression for Lossless Prediction

Chris Maddison, Yann Dubois, Benjamin Bloem-Reddy, Karen Ullrich

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; 2 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 1 failure 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/2106.10800.json · badge: /api/ran/2106.10800.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
YannDubs/lossyless canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
FunctionStatusWhere it lives
batch_flatten Ran
ran on a synthesized input
YannDubs/lossyless/lossyless/helpers.py
code served (permissive licence) · get_code("ca462457e364bdc8")
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)

# batch_flatten takes a tensor x and reshapes it to (-1, last_dim)
# It returns the reshaped tensor and the original shape
# We need to provide a multi-dimensional tensor

x = torch.randn(2, 3, 4)  # batch_size=2, height=3, width=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
dict_mean Ran
ran on a synthesized input
YannDubs/lossyless/lossyless/helpers.py
code served (permissive licence) · get_code("8a9a3c914c967c7d")
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 numpy as np

torch.manual_seed(0)

# dict_mean takes a list of dictionaries and averages them
# The function iterates over keys in dicts[0] and sums values across all dicts, then divides by length
# Values should be numeric (support sum and division operations)

# Create a list of dictionaries with numeric values
dicts = [
    {
        "loss": 0.5,
        "accuracy": 0.85,
        "f1_score": 0.78,
    },
    {
        "loss": 0.3,
        "accuracy": 0.90,
        "f1_score": 0.82,
    },
    {
        "loss": 0.4,
        "accuracy": 0.88,
        "f1_score": 0.80,
    },
]

ARGS = {
    "dicts": dicts,
}
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 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_Normalization Ran
ran on a synthesized input
YannDubs/lossyless/lossyless/architectures.py
code served (permissive licence) · get_code("54f70d49860ba87c")
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 type. 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 torch.nn as nn

torch.manual_seed(0)

# Test case 1: norm_layer as string 'batch' with dim=2
ARGS = {
    "norm_layer": "batchnorm",
    "dim": 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 type — a type output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a type 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_marginalDist Ran
ran on a synthesized input
YannDubs/lossyless/lossyless/distributions.py
code served (permissive licence) · get_code("ed851002ec8aabc9")
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 MarginalUnitGaussian. 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 torch.nn as nn
from torch.distributions import Categorical, Independent, MixtureSameFamily, Normal

torch.manual_seed(0)

class MarginalUnitGaussian(nn.Module):
    """Mean 0 covariance 1 Gaussian."""

    def __init__(self, out_dim):
        super().__init__()
        self.out_dim = out_dim
        self.register_buffer('loc', torch.as_tensor([0.0] * self.out_dim))
        self.register_buffer('scale', torch.as_tensor([1.0] * self.out_dim))

    def forward(self):
        return Independent(Normal(self.loc, self.scale), 1)

def get_marginalDist(family, cond_dist, **kwargs):
    """Return an approximate marginal distribution.

    Notes
    -----
    - Marginal ditsributions are Modules that TAKE NO ARGUMENTS and return the correct distribution
    as they are modules, they ensure that parameters are on the correct device.
    """
    if family == 'unitgaussian':
        marginal = MarginalUnitGaussian(cond_dist.out_dim, **kwargs)
    else:
        raise ValueError(f'Unkown family={family}.')
    return marginal


class MockCondDist(nn.Module):
    """Mock conditional distribution with out_dim attribute."""
    def __init__(self, out_dim):
        super().__init__()
        self.out_dim = out_dim


cond_dist = MockCondDist(out_dim=4)

ARGS = {
    'family': 'unitgaussian',
    'cond_dist': cond_dist,
}
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 MarginalUnitGaussian — a MarginalUnitGaussian output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MarginalUnitGaussian 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_scale_table Ran
ran, honoured the contract we drafted
YannDubs/lossyless/lossyless/rates.py
code served (permissive licence) · get_code("052ae753efea2e31")
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 float, shape (64,) 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 math
import torch

torch.manual_seed(0)

ARGS = {
    "min": 0.11,
    "max": 256,
    "levels": 64
}
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 float, shape (64,) — shape (64,) 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
is_plot Ran
ran on a synthesized input
YannDubs/lossyless/lossyless/callbacks.py
code served (permissive licence) · get_code("a0b0ecede0ebcf72")
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 torch

class MockTrainer:
    def __init__(self, current_epoch, max_epochs):
        self.current_epoch = current_epoch
        self.max_epochs = max_epochs

ARGS = {
    "trainer": MockTrainer(current_epoch=4, max_epochs=10),
    "plot_interval": 5
}
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 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
read_bytes Ran
ran; our contract draft was wrong, not the code
YannDubs/lossyless/hub/compressor.py
code served (permissive licence) · get_code("bd13dca3e1023087")
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 struct
import io

# Create a BytesIO object to act as a file descriptor
# We'll write some test data that can be read back
test_data = struct.pack('>5s', b'hello')
fd = io.BytesIO(test_data)

ARGS = {
    'fd': fd,
    'n': 5,
    'fmt': '>{:d}s'
}
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 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
read_uints Ran
ran, honoured the contract we drafted
YannDubs/lossyless/hub/compressor.py
code served (permissive licence) · get_code("ae94682e8b678a9e")
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 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 struct
import io

# Create a BytesIO object to simulate a file descriptor
# We'll write some unsigned integers to it
data = struct.pack('>4I', 10, 20, 30, 40)  # 4 unsigned ints in big-endian format
fd = io.BytesIO(data)

ARGS = {
    'fd': fd,
    'n': 4,
    'fmt': '>{:d}I'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 int — 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
to_numpy Ran
ran on a synthesized input
YannDubs/lossyless/lossyless/helpers.py
code served (permissive licence) · get_code("297b95954cb4a65e")
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 ndarray, ndim 1, dtype family int, shape (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 numpy as np
import torch
from torch.nn.utils.rnn import PackedSequence

torch.manual_seed(0)

# Test case 1: numpy array (should return as-is)
numpy_array = np.array([1, 2, 3, 4])

# Test case 2: list (should convert to numpy)
list_input = [1, 2, 3, 4]

# Test case 3: tuple (should convert to numpy)
tuple_input = (1, 2, 3, 4)

# Test case 4: torch tensor (should convert to numpy)
torch_tensor = torch.randn(2, 4)

# Test case 5: torch tensor with requires_grad
torch_tensor_grad = torch.randn(2, 4, requires_grad=True)

# Test case 6: PackedSequence
data = torch.randn(10, 4)
batch_sizes = torch.tensor([3, 3, 2, 2])
packed_sequence = PackedSequence(data, batch_sizes)

# Use the first test case (numpy array) as the primary argument
ARGS = {
    'X': numpy_array
}
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 ndarray, ndim 1, dtype family int, shape (4,) — shape (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_distortion_estimator Not yet run
unverified (harvested, no recorded run)
YannDubs/lossyless/lossyless/distortions.py
code served (permissive licence) · get_code("e984324a4075fe28")
How it ran

no invocation recorded.

get_featurizer_predictor Not yet run
unverified (harvested, no recorded run)
YannDubs/lossyless/lossyless/predictors.py
code served (permissive licence) · get_code("d5392321fab0a866")
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, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 8 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
read_bytes 2 other papers
2 later · 1 only as an assembly brick
2109.15047 (2021-09)
Deep Contextual Video Compression
2302.05071 (2023-02)
EVC: Towards Real-Time Neural Image Compression with Mask Decay
read_uints 2 other papers
2 later · 1 only as an assembly brick
2109.15047 (2021-09)
Deep Contextual Video Compression
2302.05071 (2023-02)
EVC: Towards Real-Time Neural Image Compression with Mask Decay
get_scale_table 1 other paper
1 later
2506.15201 (2025-06)
Privacy-Shielded Image Compression: Defending Against Exploitation from Vision-Language Pretrained Models

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

Most data is automatically collected and only ever "seen" by algorithms. Yet, data compressors preserve perceptual fidelity rather than just the information needed by algorithms performing downstream tasks. In this paper, we characterize the bit-rate required to ensure high performance on all predictive tasks that are invariant under a set of transformations, such as data augmentations. Based on our theory, we design unsupervised objectives for training neural compressors. Using these objectives, we train a generic image compressor that achieves substantial rate savings (more than 1000× on ImageNet) compared to JPEG on 8 datasets, without decreasing downstream classification performance.

For agents

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

get_harvested_code_for_paper("2106.10800")
get_code_for_paper("2106.10800")
have("2106.10800")

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

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

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

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

Connect an agent — have() is free.