SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2002.08158 · ICML · 2020

Variational Bayesian Quantization

Stephan Mandt, Robert Bamler, Yibo Yang

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 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; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-21; 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/2002.08158.json · badge: /api/ran/2002.08158.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
mandt-lab/vbq canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
mandt-lab/bayesian-ac marked official in Papers with Code
Papers with Code archive
4 ran · 0 no recorded run
FunctionStatusWhere it lives
ChannelwisePriorCDFQuantizer Ran
ran on a synthesized input · constructed an object; no result was computed
mandt-lab/bayesian-ac/img-compression/quantizer.py
code served (permissive licence) · get_code("a9bae2618b825de4")
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, ChannelwisePriorCDFQuantizer: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
import tensorflow as tf

# Set random seeds for reproducibility
np.random.seed(0)
tf.random.set_seed(0)

# Build a minimal prior_model that has an inverse_cdf method
class MinimalPriorModel:
    """Minimal prior model with inverse_cdf method."""
    def inverse_cdf(self, quantiles, **kwargs):
        """
        Map quantiles in [0, 1] to values using inverse normal CDF.
        quantiles: shape (M, K) where M is number of quantiles, K is num_channels
        Returns: shape (M, K) tensor
        """
        # Use scipy's normal inverse CDF and convert to TensorFlow
        from scipy.stats import norm
        result = norm.ppf(quantiles)
        return tf.constant(result, dtype='float32')

# Create arguments for ChannelwisePriorCDFQuantizer.__init__
ARGS = {
    'num_channels': 4,
    'max_bits_per_coord': 3,
    'float_type': 'float32',
    'int_type': 'int32'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ChannelwisePriorCDFQuantizer — 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 ChannelwisePriorCDFQuantizer 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
add_cli_args Ran
ran; our contract draft was wrong, not the code
mandt-lab/vbq/word-embeddings/bayesian-skip-gram/models/single-timestep.py
code served (permissive licence) · get_code("c367c2879a750564")
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 _ArgumentGroup. 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 argparse

# Create a minimal ArgumentParser to pass to add_cli_args
parser = argparse.ArgumentParser(description='Test parser for Bayesian word embedding model')

# The function only takes parser as an argument
ARGS = {
    'parser': parser
}
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 _ArgumentGroup — a _ArgumentGroup output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a _ArgumentGroup 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
batch_quantize_indep_dims Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mandt-lab/bayesian-ac/img-compression/quantizer.py
code served (permissive licence) · get_code("0072df20810f5343")
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 numpy as np

torch = None

B = 2
K = 4
M = 3

def dummy_fun(Z):
    """
    Compute coordinate-wise negative distortion.
    Takes input of shape (..., B, K) and returns same shape.
    """
    return -np.sum(Z ** 2, axis=-1, keepdims=True)

code_points_2d = np.random.randn(K, M).astype(np.float32)
code_lengths_2d = np.random.randint(1, 10, size=(K, M)).astype(np.float32)

lambs = [0.1, 0.5, 1.0]

ARGS = {
    "Z_shape": (B, K),
    "code_points": code_points_2d,
    "code_lengths": code_lengths_2d,
    "fun": dummy_fun,
    "lambs": lambs,
    "backend": np,
    "return_np": True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
curry_normal_logpdf Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mandt-lab/bayesian-ac/img-compression/quantizer.py
code served (permissive licence) · get_code("96b6cf8f92d89bfe")
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 function. 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 numpy as np
import torch

torch.manual_seed(0)

# Examine the function:
# - loc: K-vector (used in norm.logpdf and arithmetic operations)
# - scale: K-vector (used in norm.logpdf and arithmetic operations)
# - ignore_const: boolean flag
# - backend: module with log() method (np or torch)

# Create small K-vectors for loc and scale
loc = np.array([0.0, 1.0, -1.0, 0.5])
scale = np.array([1.0, 2.0, 0.5, 1.5])

# ignore_const can be True or False
ignore_const = False

# backend is either np or torch
backend = np

ARGS = {
    "loc": loc,
    "scale": scale,
    "ignore_const": ignore_const,
    "backend": backend,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
n_bit_binary_floats Ran
ran, honoured the contract we drafted
mandt-lab/bayesian-ac/img-compression/quantizer.py
code served (permissive licence) · get_code("28883132ac80d2fc")
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 list, 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

def n_bit_binary_floats(n):
    return [i * 2 ** (-n) + 2 ** (-n - 1) for i in range(2 ** n)]

ARGS = {
    "n": 3
}
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 list, ndim 1, dtype family float — a list 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 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 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 5 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-21.

Repositories linked to this paper

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

Abstract

We propose a novel algorithm for quantizing continuous latent representations in trained models. Our approach applies to deep probabilistic models, such as variational autoencoders (VAEs), and enables both data and model compression. Unlike current end-to-end neural compression methods that cater the model to a fixed quantization scheme, our algorithm separates model design and training from quantization. Consequently, our algorithm enables "plug-and-play" compression with variable rate-distortion trade-off, using a single trained model. Our algorithm can be seen as a novel extension of arithmetic coding to the continuous domain, and uses adaptive quantization accuracy based on estimates of posterior uncertainty. Our experimental results demonstrate the importance of taking into account posterior uncertainties, and show that image compression with the proposed algorithm outperforms JPEG over a wide range of bit rates using only a single standard VAE. Further experiments on Bayesian neural word embeddings demonstrate the versatility of the proposed method.

For agents

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

get_harvested_code_for_paper("2002.08158")
get_code_for_paper("2002.08158")
have("2002.08158")

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

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

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

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

Connect an agent — have() is free.