SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2209.08183 · 2022

Optimal Scaling for Locally Balanced Proposals in Discrete Spaces

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 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; 1 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 3 failures of our instrument; 2 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/2209.08183.json · badge: /api/ran/2209.08183.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
ha0ransun/lbp_scale canonical (classifier label)
classifier basis not recorded on the link
8 ran · 2 no recorded run
FunctionStatusWhere it lives
conv3x3 Ran
ran; our contract draft was wrong, not the code
ha0ransun/lbp_scale/lbp/model/dnn.py
pointer only (licence: MIT); the stored copy get_code serves, from patrickpynadath1/automatic_cyclical_sampling, is pointer only (licence: NONE) · get_code("a01b6bf3d5c907c2")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from patrickpynadath1/automatic_cyclical_sampling, 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.

conv_transpose_3x3 Ran
ran; our contract draft was wrong, not the code
ha0ransun/lbp_scale/lbp/model/dnn.py
pointer only (licence: MIT); the stored copy get_code serves, from patrickpynadath1/automatic_cyclical_sampling, is pointer only (licence: NONE) · get_code("abe28c18ca27abc1")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from patrickpynadath1/automatic_cyclical_sampling, 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.

get_binary_data_loader Ran
ran on a synthesized input
ha0ransun/lbp_scale/lbp/data_util/data_loader.py
code served (permissive licence) · get_code("d14e95b9443ebb30")
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 DataLoader. 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 torch.utils.data import Dataset, DataLoader

torch.manual_seed(0)

# Create a small tensor dataset
x = torch.randn(2, 4)

# Create a simple args object with the required attributes
class Args:
    def __init__(self):
        self.dynamic_binarization = False
        self.batch_size = 2

args = Args()

# Define the phase
phase = 'train'

# Build ARGS mapping
ARGS = {
    'x': x,
    'args': args,
    'phase': phase
}
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 DataLoader — a DataLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataLoader 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_rate_stats Ran
ran on a synthesized input
ha0ransun/lbp_scale/lbp/common/rate_stats.py
code served (permissive licence) · get_code("443e30fa4cee1ada")
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 AlltimeRateStats. 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

# Define ARGS for get_rate_stats function
# The function takes a single parameter: rs_type (a string)

ARGS = {
    'rs_type': 'all'
}
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 AlltimeRateStats — a AlltimeRateStats output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AlltimeRateStats 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
identity Ran
ran, honoured the contract we drafted
ha0ransun/lbp_scale/lbp/data_util/data_loader.py
pointer only (licence: MIT); the stored copy get_code serves, from dholzmueller/universal_double_descent, is pointer only (licence: NONE) · get_code("9910e2fc297f8665")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from dholzmueller/universal_double_descent, 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.

load_omniglot Ran
ran on a synthesized input
ha0ransun/lbp_scale/lbp/data_util/raw_dataset.py
code served (permissive licence) · get_code("fe47fc8dbdb874c4")
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 numpy as np
import os
import tempfile
from scipy.io import savemat

# Create a temporary directory with fake omniglot data
temp_dir = tempfile.mkdtemp()
omniglot_dir = os.path.join(temp_dir, 'OMNIGLOT')
os.makedirs(omniglot_dir, exist_ok=True)

# Create fake chardata.mat with appropriate structure
# The function reshapes data from shape (-1, 28, 28) to (-1, 784)
# We need to create data that when transposed and reshaped will work
fake_train_data = np.random.rand(28 * 28, 100).astype('float32')  # 100 samples
fake_test_data = np.random.rand(28 * 28, 50).astype('float32')    # 50 test samples

savemat(os.path.join(omniglot_dir, 'chardata.mat'), {
    'data': fake_train_data,
    'testdata': fake_test_data
})

# Create a simple args object
class Args:
    def __init__(self):
        self.data_dir = temp_dir
        self.input_size = None
        self.input_type = None
        self.dynamic_binarization = None

ARGS = {
    'args': Args(),
    'n_validation': 1345
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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
mlp_ebm Ran
ran; our contract draft was wrong, not the code
ha0ransun/lbp_scale/lbp/model/dnn.py
pointer only (licence: MIT); the stored copy get_code serves, from patrickpynadath1/automatic_cyclical_sampling, is pointer only (licence: NONE) · get_code("646a9f9fd82940a8")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from patrickpynadath1/automatic_cyclical_sampling, 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.

process_categorical_data Ran
ran on a synthesized input
ha0ransun/lbp_scale/lbp/data_util/data_loader.py
code served (permissive licence) · get_code("16f406586bb9e7d2")
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 3, dtype family float, shape (2, 4, 256) 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)

# Construct valid arguments for process_categorical_data
# The function expects 'data' to be a tensor with values in range [0, 1)
# It multiplies by 256 and converts to long, then applies one_hot with 256 classes

data = torch.rand(2, 4)  # batch_size=2, dim=4, values in [0, 1)

ARGS = {
    "data": data
}
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 3, dtype family float, shape (2, 4, 256) — shape (2, 4, 256) 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
load_dynamic_mnist Not yet run
unverified (harvested, no recorded run)
ha0ransun/lbp_scale/lbp/data_util/raw_dataset.py
code served (permissive licence) · get_code("10ec5dcad59f3e85")
How it ran

no invocation recorded.

load_static_mnist Not yet run
unverified (harvested, no recorded run)
ha0ransun/lbp_scale/lbp/data_util/raw_dataset.py
code served (permissive licence) · get_code("41c71b384e5548f7")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 4 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 4 later) and 6 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
identity 69 other papers
30 dated earlier, 1 the same month, 38 later · 5 only as an assembly brick
1706.07296 (2017-06)
A Minimal Developmental Model Can Increase Evolvability in Soft Robots
1802.09419 (2018-02)
Stochastic Hyperparameter Optimization through Hypernetworks
1804.06055 (2018-04)
Co-occurrence Feature Learning from Skeleton Data for Action Recognition and Detection with Hierarchical Aggregation
and 66 more not named here
conv_transpose_3x3 3 other papers
3 later
2307.04333 (2023-07)
Enhancing Adversarial Robustness via Score-Based Optimization
2310.12920 (2023-10)
Generative Marginalization Models
2402.17699 (2024-02)
Gradient-based Discrete Sampling with Automatic Cyclical Scheduling
conv3x3 2 other papers
2 later
2307.04333 (2023-07)
Enhancing Adversarial Robustness via Score-Based Optimization
2402.17699 (2024-02)
Gradient-based Discrete Sampling with Automatic Cyclical Scheduling
mlp_ebm 2 other papers
1 dated earlier, 1 later
2202.01361 (2022-02)
Generative Flow Networks for Discrete Probabilistic Modeling
2402.17699 (2024-02)
Gradient-based Discrete Sampling with Automatic Cyclical Scheduling

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

Optimal scaling has been well studied for Metropolis-Hastings (M-H) algorithms in continuous spaces, but a similar understanding has been lacking in discrete spaces. Recently, a family of locally balanced proposals (LBP) for discrete spaces has been proved to be asymptotically optimal, but the question of optimal scaling has remained open. In this paper, we establish, for the first time, that the efficiency of M-H in discrete spaces can also be characterized by an asymptotic acceptance rate that is independent of the target distribution. Moreover, we verify, both theoretically and empirically, that the optimal acceptance rates for LBP and random walk Metropolis (RWM) are $0.574$ and $0.234$ respectively. These results also help establish that LBP is asymptotically $O(N^\frac{2}{3})$ more efficient than RWM with respect to model dimension $N$. Knowledge of the optimal acceptance rate allows one to automatically tune the neighborhood size of a proposal distribution in a discrete space, directly analogous to step-size control in continuous spaces. We demonstrate empirically that such adaptive M-H sampling can robustly improve sampling in a variety of target distributions in discrete spaces, including training deep energy based models.

For agents

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

get_harvested_code_for_paper("2209.08183")
get_code_for_paper("2209.08183")
have("2209.08183")

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

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

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

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

Connect an agent — have() is free.