SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2411.17337 · 2024

sbi reloaded: a toolkit for simulation-based inference workflows

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/2411.17337.json · badge: /api/ran/2411.17337.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
sbi-dev/sbi canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_rbf_mmd Ran
ran; our contract draft was wrong, not the code
sbi-dev/sbi/sbi/diagnostics/misspecification.py
code served (permissive licence) · get_code("fc0e53b9b168ce47")
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 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
import numpy as np

torch.manual_seed(0)

# Create small tensors for x and y
# x: shape (2, 4) - 2 samples, 4 dimensions
# y: shape (2, 4) - 2 samples, 4 dimensions
x = torch.randn(2, 4)
y = torch.randn(2, 4)

# bandwidth parameter
bandwidth = 1.0

# mode parameter
mode = 'biased'

ARGS = {
    'x': x,
    'y': y,
    'bandwidth': bandwidth,
    'mode': mode
}
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 Tensor, 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
eval_lc2st Ran
ran; our contract draft was wrong, not the code
sbi-dev/sbi/sbi/diagnostics/lc2st.py
code served (permissive licence) · get_code("042c1c4d2e2f3e1c")
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 float, 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
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.base import BaseEstimator

torch.manual_seed(0)

# Create sample tensors
sample_size = 2
dim_theta = 4
dim_x = 3

theta_p = torch.randn(sample_size, dim_theta)
x_o = torch.randn(1, dim_x)

# Train a simple classifier
# The function expects a classifier with predict_proba method
# It concatenates theta_p (sample_size, dim_theta) with x_o repeated (sample_size, dim_x)
# So the joint input will be (sample_size, dim_theta + dim_x)
X_train = np.random.randn(10, dim_theta + dim_x)
y_train = np.random.randint(0, 2, 10)

clf = LogisticRegression(random_state=0, max_iter=1000)
clf.fit(X_train, y_train)

ARGS = {
    "theta_p": theta_p,
    "x_o": x_o,
    "clf": clf,
    "return_proba": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
get_default_diag_kwargs Ran
ran; our contract draft was wrong, not the code
sbi-dev/sbi/sbi/analysis/plotting_classes.py
code served (permissive licence) · get_code("db2fea809ee31e99")
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 matplotlib.pyplot as plt
from dataclasses import asdict, dataclass, field
from typing import Any, Dict, List, Optional

@dataclass(frozen=True)
class DiagOptions:
    """
    Base class for keyword arguments used in diagonal plots.

    This class serves as a common parent for specific diagonal plot
    configuration classes such as KDE, Histogram, and Scatter.
    """
    mpl_kwargs: Dict[str, Any] = field(default_factory=dict)

@dataclass(frozen=True)
class KdeDiagOptions(DiagOptions):
    bw_method: str = 'scott'
    bins: int = 50

@dataclass(frozen=True)
class HistDiagOptions(DiagOptions):
    bin_heuristic: str = 'Freedman-Diaconis'

    def __post_init__(self):
        mpl_kwargs_defaults = {'density': False, 'histtype': 'step'}
        updated = {**mpl_kwargs_defaults, **self.mpl_kwargs}
        object.__setattr__(self, 'mpl_kwargs', updated)

@dataclass(frozen=True)
class ScatterDiagOptions(DiagOptions):
    ...

@dataclass(frozen=True)
class BarDiagOptions(DiagOptions):
    """Options for discrete bar charts on diagonal."""
    width: float = 0.8

    def __post_init__(self):
        mpl_kwargs_defaults = {'alpha': 0.7, 'edgecolor': 'white'}
        updated = {**mpl_kwargs_defaults, **self.mpl_kwargs}
        object.__setattr__(self, 'mpl_kwargs', updated)

def _set_color(i: int) -> str:
    """
    Returns a distinct color from Matplotlib's default color cycle.

    Args:
        i: Index used to select a color, spaced by 2.

    Returns:
        str: A color string from the Matplotlib color cycle.
    """
    colors = plt.rcParams['axes.prop_cycle'].by_key()['color']
    new_color = colors[i * 2 % len(colors)]
    return new_color

def get_default_diag_kwargs(diag: Optional[str], i: int=0) -> Dict[str, Any]:
    """Get default diag kwargs."""
    if diag == 'kde':
        diag_options = KdeDiagOptions(mpl_kwargs=dict(color=_set_color(i)))
    elif diag == 'hist':
        diag_options = HistDiagOptions(mpl_kwargs=dict(color=_set_color(i)))
    elif diag == 'scatter':
        diag_options = ScatterDiagOptions(mpl_kwargs=dict(color=_set_color(i)))
    elif diag == 'bar':
        diag_options = BarDiagOptions(mpl_kwargs=dict(color=_set_color(i)))
    else:
        return {}
    return asdict(diag_options)

ARGS = {
    'diag': 'kde',
    'i': 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib — 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_default_offdiag_kwargs Ran
ran; our contract draft was wrong, not the code
sbi-dev/sbi/sbi/analysis/plotting_classes.py
code served (permissive licence) · get_code("9e075659a09f2c50")
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
from matplotlib import pyplot as plt

# Set seed for reproducibility
torch.manual_seed(0)
np.random.seed(0)

# The function get_default_offdiag_kwargs takes two parameters:
# 1. offdiag: Optional[str] - can be 'kde', 'kde2d', 'hist', 'hist2d', 'scatter', 'contour', 'contourf', 'plot', or None
# 2. i: int - defaults to 0, used as index for color selection

# Test with 'kde' offdiag type
ARGS = {
    'offdiag': 'kde',
    'i': 0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, 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_kde Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
sbi-dev/sbi/sbi/analysis/plot.py
code served (permissive licence) · get_code("f75a8e2562862bbf")
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 3, 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
import torch

torch.manual_seed(0)

# Create sample data for 2D KDE
np.random.seed(0)
samples_col = np.random.randn(100)
samples_row = np.random.randn(100)

# Create limit tensors
limits_col = torch.tensor([-3.0, 3.0])
limits_row = torch.tensor([-3.0, 3.0])

# Create offdiag_kwargs dictionary with required parameters
offdiag_kwargs = {
    'bw_method': 0.2,
    'bins': 16,
    'percentile': True,
    'levels': [0.1, 0.5, 0.9]
}

ARGS = {
    'samples_col': samples_col,
    'samples_row': samples_row,
    'limits_col': limits_col,
    'limits_row': limits_row,
    'offdiag_kwargs': offdiag_kwargs
}
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 tuple, ndim 3, 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
median_heuristic Ran
ran; our contract draft was wrong, not the code
sbi-dev/sbi/sbi/diagnostics/misspecification.py
code served (permissive licence) · get_code("982bf515ea600367")
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 float, 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
from torch import Tensor

torch.manual_seed(0)

# Create two small tensors with distinct dimensions
# x: batch size 2, dimension 4
# y: batch size 3, dimension 4
x = torch.randn(2, 4)
y = torch.randn(3, 4)

ARGS = {
    "x": x,
    "y": y,
}
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 float, 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
permute_data Ran
ran; our contract draft was wrong, not the code
sbi-dev/sbi/sbi/diagnostics/lc2st.py
code served (permissive licence) · get_code("4b99ed3c2e6b6613")
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 3, 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
from torch import Tensor

torch.manual_seed(0)

# Create small sample tensors
# theta_p: samples from P, shape (sample_size, dim)
# theta_q: samples from Q, shape (sample_size, dim)
sample_size = 2
dim = 4

theta_p = torch.randn(sample_size, dim)
theta_q = torch.randn(sample_size, dim)
seed = 1

ARGS = {
    "theta_p": theta_p,
    "theta_q": theta_q,
    "seed": seed,
}
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 tuple, ndim 3, 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
rbf_kernel Ran
ran; our contract draft was wrong, not the code
sbi-dev/sbi/sbi/diagnostics/misspecification.py
code served (permissive licence) · get_code("62ed8bd9e7daa553")
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, 3) 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)

# Create small tensors for x and y
# x: (2, 4) - 2 samples, 4 dimensions
# y: (3, 4) - 3 samples, 4 dimensions (distinct size to disambiguate)
x = torch.randn(2, 4)
y = torch.randn(3, 4)
bandwidth = 1.0

ARGS = {
    "x": x,
    "y": y,
    "bandwidth": bandwidth,
}
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, 3) — shape (2, 3) 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

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 0 the same month, 1 later) and 0 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
permute_data 3 other papers
2 dated earlier, 1 later
2305.15871 (2023-05)
Learning Robust Statistics for Simulation-based Inference under Model Misspecification
2404.07593 (2024-04)
Diffusion posterior sampling for simulation-based inference in tall data settings
2607.05252 (2026-07)
FUSE: FK-Steered Multi-Modal Flow Matching for Efficient Simulation-Based Posterior Estimation
compute_rbf_mmd 1 other paper
1 dated earlier
2305.15871 (2023-05)
Learning Robust Statistics for Simulation-based Inference under Model Misspecification
eval_lc2st 1 other paper
1 dated earlier
2305.15871 (2023-05)
Learning Robust Statistics for Simulation-based Inference under Model Misspecification
get_default_diag_kwargs 1 other paper
1 dated earlier
2305.15871 (2023-05)
Learning Robust Statistics for Simulation-based Inference under Model Misspecification
get_default_offdiag_kwargs 1 other paper
1 dated earlier
2305.15871 (2023-05)
Learning Robust Statistics for Simulation-based Inference under Model Misspecification
get_kde 1 other paper
1 dated earlier
2305.15871 (2023-05)
Learning Robust Statistics for Simulation-based Inference under Model Misspecification
median_heuristic 1 other paper
1 dated earlier
2305.15871 (2023-05)
Learning Robust Statistics for Simulation-based Inference under Model Misspecification
rbf_kernel 1 other paper
1 dated earlier
2305.15871 (2023-05)
Learning Robust Statistics for Simulation-based Inference under Model Misspecification

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

Scientists and engineers use simulators to model empirically observed phenomena. However, tuning the parameters of a simulator to ensure its outputs match observed data presents a significant challenge. Simulation-based inference (SBI) addresses this by enabling Bayesian inference for simulators, identifying parameters that match observed data and align with prior knowledge. Unlike traditional Bayesian inference, SBI only needs access to simulations from the model and does not require evaluations of the likelihood function. In addition, SBI algorithms do not require gradients through the simulator, allow for massive parallelization of simulations, and can perform inference for different observations without further simulations or training, thereby amortizing inference. Over the past years, we have developed, maintained, and extended sbi, a PyTorch-based package that implements Bayesian SBI algorithms based on neural networks. The sbi toolkit implements a wide range of inference methods, neural network architectures, sampling methods, and diagnostic tools. In addition, it provides well-tested default settings, but also offers flexibility to fully customize every step of the simulation-based inference workflow. Taken together, the sbi toolkit enables scientists and engineers to apply state-of-the-art SBI methods to black-box simulators, opening up new possibilities for aligning simulations with empirically observed data.

For agents

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

get_harvested_code_for_paper("2411.17337")
get_code_for_paper("2411.17337")
have("2411.17337")

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

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

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

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

Connect an agent — have() is free.