SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1412.4869 · 2014

Expectation propagation as a way of life: A framework for Bayesian inference on partitioned data

arXiv · PDF · Open in the Atlas

Code that ran

6 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; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 1 failure of our instrument; 5 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/1412.4869.json · badge: /api/ran/1412.4869.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
gelman/ep-stan canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
rhayes777/PyAutoFit community (classifier label)
classifier basis not recorded on the link
5 ran · 5 no recorded run
FunctionStatusWhere it lives
assert_not_frozen Ran
ran on a synthesized input
rhayes777/PyAutoFit/autofit/mapper/model.py
code served (permissive licence) · get_code("aed27dacbf7ec877")
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 torch
import torch.nn as nn
from functools import wraps

torch.manual_seed(0)

def assert_not_frozen(func):
    """
    Decorator that asserts a function is not called when an object
    is frozen. For example, it should not be possible to set an
    attribute on a frozen model as that might invalidate the results
    in the cache.

    Parameters
    ----------
    func
        Some function

    Raises
    ------
    AssertionError
        If the function is called when the object is frozen
    """

    @wraps(func)
    def wrapper(self, *args, **kwargs):
        string_args = list(filter(lambda arg: isinstance(arg, str), args))
        if '_is_frozen' not in string_args and '_frozen_cache' not in string_args and hasattr(self, '_is_frozen') and self._is_frozen:
            raise AssertionError('Frozen models cannot be modified')
        return func(self, *args, **kwargs)
    return wrapper


class DummyModel(nn.Module):
    """Minimal model to test the decorator"""
    def __init__(self):
        super().__init__()
        self._is_frozen = False
        self._frozen_cache = {}
        self.linear = nn.Linear(4, 3)
    
    @assert_not_frozen
    def set_param(self, param_name, value):
        """Sample function that should respect frozen state"""
        setattr(self, param_name, value)


def sample_function(self, *args, **kwargs):
    """Sample function to be decorated"""
    return "success"


# Create a test object
test_obj = DummyModel()

# Create a decorated version of the sample function
decorated_func = assert_not_frozen(sample_function)

ARGS = {
    'func': sample_function
}
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 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
compact_prior Ran
ran on a synthesized input
rhayes777/PyAutoFit/autofit/model_figure/presentation.py
code served (permissive licence) · get_code("dc87871c39fce4b4")
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 torch.nn as nn


class UniformPrior:
    def __init__(self, lower_limit, upper_limit):
        self.lower_limit = lower_limit
        self.upper_limit = upper_limit


class GaussianPrior:
    def __init__(self, mean, sigma):
        self.mean = mean
        self.sigma = sigma


class LogUniformPrior:
    def __init__(self, lower_limit, upper_limit):
        self.lower_limit = lower_limit
        self.upper_limit = upper_limit


class LogGaussianPrior:
    def __init__(self, mean, sigma):
        self.mean = mean
        self.sigma = sigma


class TruncatedGaussianPrior:
    def __init__(self, mean, sigma, lower_limit, upper_limit):
        self.mean = mean
        self.sigma = sigma
        self.lower_limit = lower_limit
        self.upper_limit = upper_limit


ARGS = {
    'prior': UniformPrior(0, 100)
}
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 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
default_df0 Ran
ran; our contract draft was wrong, not the code
gelman/ep-stan/experiment/fit.py
pointer only (licence: NOASSERTION) · get_code("c9c8e82a770b978f")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, gelman/ep-stan (NOASSERTION). 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.

dereference Ran
ran on a synthesized input
rhayes777/PyAutoFit/autofit/mapper/model_object.py
code served (permissive licence) · get_code("0c104b7823e780b7")
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)

# Analyze the function:
# - reference: Optional[dict] - can be None or a dict with string keys and values
# - name: str - a string used to filter keys by prefix
# The function splits keys by '.' and filters for those starting with 'name'

# Create a sample reference dict with dotted keys
reference = {
    'model.layer1.weight': 0.5,
    'model.layer2.bias': 0.3,
    'optimizer.lr': 0.001,
    'model.layer1.bias': 0.2,
    'other.value': 1.0,
}

name = 'model'

ARGS = {
    'reference': reference,
    'name': name,
}
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
frozen_cache Ran
ran on a synthesized input
rhayes777/PyAutoFit/autofit/mapper/model.py
code served (permissive licence) · get_code("69d30aac76503bb9")
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 torch
import torch.nn as nn
from functools import wraps

torch.manual_seed(0)

def frozen_cache(func):
    """
    Decorator that caches results from function calls when
    a model is frozen.

    Value is cached by function name, instance and arguments.

    Parameters
    ----------
    func
        Some function attached to a freezable, hashable object
        that takes hashable arguments

    Returns
    -------
    Function with cache
    """

    @wraps(func)
    def cache(self, *args, **kwargs):
        if hasattr(self, '_is_frozen') and self._is_frozen:
            key = (func.__name__, self, *args) + tuple(kwargs.items())
            if key not in self._frozen_cache:
                self._frozen_cache[key] = func(self, *args, **kwargs)
            return self._frozen_cache[key]
        return func(self, *args, **kwargs)
    return cache


class FreezableModel(nn.Module):
    """A simple freezable model for testing the decorator."""
    
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
        self._is_frozen = False
        self._frozen_cache = {}
    
    def __hash__(self):
        return id(self)
    
    def __eq__(self, other):
        return self is other
    
    @frozen_cache
    def compute(self, x, y=10):
        """A simple function decorated with frozen_cache."""
        return x + y


def sample_decorated_function(self, x, y=5):
    """Sample function to be decorated."""
    return x * y + 1


model = FreezableModel()
decorated_func = frozen_cache(sample_decorated_function)

ARGS = {
    'func': sample_decorated_function
}
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 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
prior_summaries Ran
ran on a synthesized input
rhayes777/PyAutoFit/autofit/model_figure/presentation.py
code served (permissive licence) · get_code("97889234fe89f111")
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 torch.nn as nn
from typing import Dict

# Define minimal Prior classes that the function expects
class UniformPrior:
    def __init__(self, lower_limit, upper_limit):
        self.id = 1
        self.lower_limit = lower_limit
        self.upper_limit = upper_limit

class GaussianPrior:
    def __init__(self, mean, sigma):
        self.id = 2
        self.mean = mean
        self.sigma = sigma

class LogUniformPrior:
    def __init__(self, lower_limit, upper_limit):
        self.id = 3
        self.lower_limit = lower_limit
        self.upper_limit = upper_limit

class LogGaussianPrior:
    def __init__(self, mean, sigma):
        self.id = 4
        self.mean = mean
        self.sigma = sigma

class TruncatedGaussianPrior:
    def __init__(self, mean, sigma, lower_limit, upper_limit):
        self.id = 5
        self.mean = mean
        self.sigma = sigma
        self.lower_limit = lower_limit
        self.upper_limit = upper_limit

# Create a minimal model with priors attribute
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
        # Add priors as a tuple attribute
        self.priors = (
            UniformPrior(0.0, 100.0),
            GaussianPrior(0.5, 0.1),
            LogUniformPrior(1e-6, 1e6),
            TruncatedGaussianPrior(0.0, 1.0, -2.0, 2.0),
        )
    
    def forward(self, x):
        return self.linear(x)

torch.manual_seed(0)
model = MinimalModel()

ARGS = {
    'model': model,
}
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 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
build_layout Not yet run
unverified (harvested, no recorded run)
rhayes777/PyAutoFit/autofit/model_figure/layout.py
code served (permissive licence) · get_code("3cb89fcdabab0696")
How it ran

no invocation recorded.

build_presentation Not yet run
unverified (harvested, no recorded run)
rhayes777/PyAutoFit/autofit/model_figure/presentation.py
code served (permissive licence) · get_code("39c6b1847ba0f7db")
How it ran

no invocation recorded.

draw Not yet run
unverified (harvested, no recorded run)
rhayes777/PyAutoFit/autofit/model_figure/render.py
code served (permissive licence) · get_code("f843adaaba33480c")
How it ran

no invocation recorded.

measure_text Not yet run
unverified (harvested, no recorded run)
rhayes777/PyAutoFit/autofit/model_figure/layout.py
code served (permissive licence) · get_code("2723580bd526508e")
How it ran

no invocation recorded.

save Not yet run
unverified (harvested, no recorded run)
rhayes777/PyAutoFit/autofit/model_figure/render.py
code served (permissive licence) · get_code("36db77121167fda6")
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, 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 11 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-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

A common divide-and-conquer approach for Bayesian computation with big data is to partition the data, perform local inference for each piece separately, and combine the results to obtain a global posterior approximation. While being conceptually and computationally appealing, this method involves the problematic need to also split the prior for the local inferences; these weakened priors may not provide enough regularization for each separate computation, thus eliminating one of the key advantages of Bayesian methods. To resolve this dilemma while still retaining the generalizability of the underlying local inference method, we apply the idea of expectation propagation (EP) as a framework for distributed Bayesian inference. The central idea is to iteratively update approximations to the local likelihoods given the state of the other approximations and the prior. The present paper has two roles: we review the steps that are needed to keep EP algorithms numerically stable, and we suggest a general approach, inspired by EP, for approaching data partitioning problems in a way that achieves the computational benefits of parallelism while allowing each local update to make use of relevant information from the other sites. In addition, we demonstrate how the method can be applied in a hierarchical context to make use of partitioning of both data and parameters. The paper describes a general algorithmic framework, rather than a specific algorithm, and presents an example implementation for it.

For agents

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

get_harvested_code_for_paper("1412.4869")
get_code_for_paper("1412.4869")
have("1412.4869")

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

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

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

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

Connect an agent — have() is free.