SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2010.10436 · 2020

VarGrad: A Low-Variance Gradient Estimator for Variational Inference

arXiv · PDF · Open in the Atlas

Code that ran

15 of 19 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 15 have no contract verdict; 0 failures of our instrument; 4 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/2010.10436.json · badge: /api/ran/2010.10436.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
aboustati/vargrad canonical (classifier label)
classifier basis: census
15 ran · 4 no recorded run
FunctionStatusWhere it lives
change_learning_rate Ran
ran on a synthesized input
aboustati/vargrad/experiments/vargrad_experiments/discrete_vae/config.py
code served (permissive licence) · get_code("fe9915d4c3e50a53")
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
from copy import deepcopy

# Construct a simple config dict
config_dict = {
    'learning_rate': 0.001,
    'batch_size': 32,
    'epochs': 10,
    'model_type': 'transformer',
    'hidden_dim': 128
}

new_learning_rate = 0.0001

ARGS = {
    'config_dict': config_dict,
    'new_learning_rate': new_learning_rate
}
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
change_path Ran
ran on a synthesized input
aboustati/vargrad/experiments/vargrad_experiments/discrete_vae/config.py
code served (permissive licence) · get_code("5bf6ae65c27a84b7")
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
from copy import deepcopy

# Analyze the function:
# - change_path takes config_dict and new_path
# - config_dict is a dict that gets deepcopied
# - The function accesses config_dict['image_path'] and sets it to new_path
# - new_path should be a string (based on the key name and typical usage)

# Construct a minimal config_dict with required keys
config_dict = {
    'image_path': '/old/path/to/images',
    'batch_size': 32,
    'num_epochs': 10
}

new_path = '/new/path/to/images'

ARGS = {
    'config_dict': config_dict,
    'new_path': new_path
}
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
change_training_seed Ran
ran on a synthesized input
aboustati/vargrad/experiments/vargrad_experiments/discrete_vae/config.py
code served (permissive licence) · get_code("11564269193fd678")
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
from copy import deepcopy

# Construct a valid config_dict with train_seed and init_seed
config_dict = {
    'train_seed': 42,
    'init_seed': 126,
    'model_name': 'test_model',
    'learning_rate': 0.001,
    'batch_size': 32
}

# Define the new seed value
new_seed = 100

# Map all parameters to their values
ARGS = {
    'config_dict': config_dict,
    'new_seed': new_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 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
conditional_sample Ran
ran on a synthesized input
aboustati/vargrad/vargrad/distributions/binary_concrete.py
code served (permissive licence) · get_code("eaea1bbb60313d70")
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 ArrayImpl, ndim 2, dtype family float, shape (2, 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 jax.numpy as jnp
from jax import random
import numpy as np

# Set up PRNG key for JAX
key = random.PRNGKey(0)

# Create small test arrays
# p: Bernoulli probabilities - shape (2, 4)
p = jnp.array([
    [0.3, 0.5, 0.7, 0.2],
    [0.6, 0.4, 0.8, 0.1]
], dtype=jnp.float32)

# y: Conditioning parameters - same shape as p
y = jnp.array([
    [1.0, 0.0, 1.0, 0.0],
    [0.0, 1.0, 1.0, 0.0]
], dtype=jnp.float32)

# temperature: scalar temperature parameter
temperature = 0.5

ARGS = {
    "p": p,
    "y": y,
    "temperature": temperature,
    "key": key
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
conditional_sample Ran
ran on a synthesized input
aboustati/vargrad/vargrad/distributions/binary_relaxed.py
code served (permissive licence) · get_code("4fc51fcaff50f27e")
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 ArrayImpl, ndim 2, dtype family float, shape (2, 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 jax.numpy as jnp
from jax import random
import numpy as np

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

# Create a PRNG key for JAX
key = random.PRNGKey(0)

# Create small test arrays with distinct shapes
# p: Binary relaxed params (Bernoulli probabilities), shape (2, 4)
p = jnp.array([[0.3, 0.7, 0.5, 0.2],
                [0.6, 0.4, 0.8, 0.1]], dtype=jnp.float32)

# y: Conditioning parameters, same shape as p, shape (2, 4)
y = jnp.array([[1.0, 0.0, 1.0, 0.0],
                [0.0, 1.0, 1.0, 0.0]], dtype=jnp.float32)

ARGS = {
    "p": p,
    "y": y,
    "key": key,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
fori_loop Ran
ran on a synthesized input
aboustati/vargrad/vargrad/discrete_vae/utilities.py
code served (permissive licence) · get_code("9a3faf80f939fb16")
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 torch.nn as nn

torch.manual_seed(0)

def body_fun(i, val):
    """
    A simple body function that accumulates values.
    Takes an iteration index i and a value, returns updated value.
    """
    return val + i

lower = 0
upper = 5
init_val = torch.tensor(0.0)

ARGS = {
    "lower": lower,
    "upper": upper,
    "body_fun": body_fun,
    "init_val": init_val,
}
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 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
generate_negative_elbo Ran
ran on a synthesized input
aboustati/vargrad/vargrad/discrete_vae/two_layer_objectives.py
code served (permissive licence) · get_code("9f917c4035c94cea")
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 jax
import jax.numpy as jnp
from jax import random
from scipy import stats as scipy_stats

# Create stand-in bernoulli distribution object with required methods
class BernoulliStandIn:
    def logpmf(self, x, p):
        """Log probability mass function for Bernoulli"""
        return scipy_stats.bernoulli.logpmf(x, p)
    
    def sample(self, p, key, num_samples=1):
        """Sample from Bernoulli distribution"""
        if isinstance(p, (int, float)):
            shape = (num_samples,)
        else:
            shape = (num_samples,) + p.shape
        return random.bernoulli(key, p, shape=shape)

bernoulli = BernoulliStandIn()

# Define minimal encoder/decoder functions
def encoder1_fn(params, batch):
    """First encoder layer: outputs Bernoulli parameters"""
    # batch shape: (batch_size, input_dim)
    # output shape: (batch_size, 200)
    return jnp.ones((batch.shape[0], 200)) * 0.5

def encoder2_fn(params, samples):
    """Second encoder layer"""
    # samples shape: (num_samples, batch_size, 200)
    # output shape: (num_samples, batch_size, 10)
    return jnp.ones((samples.shape[0], samples.shape[1], 10)) * 0.5

def decoder1_fn(params, samples):
    """First decoder layer"""
    # samples shape: (num_samples, batch_size, 10)
    # output shape: (num_samples, batch_size, 4)
    return jnp.ones((samples.shape[0], samples.shape[1], 4)) * 0.5

def decoder2_fn(params, samples):
    """Second decoder layer"""
    # samples shape: (num_samples, batch_size, 200)
    # output shape: (num_samples, batch_size, 200)
    return jnp.ones((samples.shape[0], samples.shape[1], 200)) * 0.5

# Create minimal parameter dicts
encoder_params1 = {"w": jnp.ones((4, 200))}
encoder_params2 = {"w": jnp.ones((200, 10))}
decoder_params1 = {"w": jnp.ones((10, 4))}
decoder_params2 = {"w": jnp.ones((10, 200))}

# Create batch data
batch = jnp.ones((2, 4))  # batch_size=2, input_dim=4

# Create PRNG key
prng_key = random.PRNGKey(0)

# Define ARGS dictionary with all parameters for generate_negative_elbo
ARGS = {
    "encoder": (encoder1_fn, encoder2_fn),
    "decoder": (decoder1_fn, decoder2_fn),
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, scipy — 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
generate_negative_elbo Ran
ran on a synthesized input
aboustati/vargrad/vargrad/discrete_vae/objectives.py
code served (permissive licence) · get_code("f2ff37104e831e78")
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 jax
import jax.numpy as jnp
from jax import random
from scipy.stats import bernoulli as scipy_bernoulli
import numpy as np

# Create mock encoder and decoder functions
def encoder_fn(encoder_params, batch):
    """
    Encoder that takes params and batch, returns posterior parameters (probabilities for Bernoulli).
    Returns shape (batch_size, latent_dim)
    """
    batch_size = batch.shape[0]
    latent_dim = 4
    # Simple mock: return fixed probabilities for each sample
    return jnp.ones((batch_size, latent_dim)) * 0.5

def decoder_fn(decoder_params, sample):
    """
    Decoder that takes params and sample, returns reconstruction probabilities.
    sample shape: (batch_size, latent_dim) or just (latent_dim,)
    Returns shape matching batch or (original_batch_size, data_dim)
    """
    if sample.ndim == 1:
        # Single sample
        return jnp.ones(3) * 0.6
    else:
        # Multiple samples
        batch_size = sample.shape[0]
        return jnp.ones((batch_size, 3)) * 0.6

# Mock bernoulli distribution object with logpmf and sample methods
class MockBernoulli:
    @staticmethod
    def logpmf(x, p):
        """Log probability mass function for Bernoulli"""
        # Clamp p to avoid log(0)
        p = jnp.clip(p, 1e-7, 1 - 1e-7)
        return x * jnp.log(p) + (1 - x) * jnp.log(1 - p)
    
    @staticmethod
    def sample(p, key, num_samples):
        """Sample from Bernoulli distribution"""
        # p shape: (batch_size, latent_dim)
        # Returns shape: (num_samples, batch_size, latent_dim)
        batch_size = p.shape[0]
        latent_dim = p.shape[1]
        samples = random.bernoulli(key, p, shape=(num_samples, batch_size, latent_dim))
        return samples.astype(jnp.float32)

bernoulli = MockBernoulli()

# Mock encoder and decoder params
encoder_params = [jnp.array([0.1, 0.2, 0.3, 0.4])]
decoder_params = [jnp.array([0.5, 0.6, 0.7])]

# Create batch of data (binary values)
batch = jnp.array([
    [1.0, 0.0, 1.0],
    [0.0, 1.0, 0.0]
])

# Create PRNG key
prng_key = random.PRNGKey(0)

ARGS = {
    "encoder": encoder_fn,
    "decoder": decoder_fn,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy, scipy — 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
generate_score_function_objective Ran
ran on a synthesized input
aboustati/vargrad/vargrad/discrete_vae/two_layer_objectives.py
code served (permissive licence) · get_code("2493e2fccccb1611")
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 jax
import jax.numpy as jnp
from jax import random
from scipy.stats import bernoulli

# Create simple encoder/decoder functions that satisfy the interface
def encoder1_fn(params, batch):
    """First encoder layer: takes batch, returns bernoulli parameters"""
    # params is not used, just return fixed output shape
    batch_size = batch.shape[0]
    return 0.5 * jnp.ones((batch_size, 200))

def encoder2_fn(params, samples):
    """Second encoder layer: takes samples, returns bernoulli parameters"""
    samples_shape = samples.shape
    # Return shape (num_samples, batch_size, latent_dim)
    return 0.5 * jnp.ones(samples_shape)

def decoder1_fn(params, samples):
    """First decoder layer: reconstructs input"""
    # samples shape is (num_samples, batch_size, 200)
    # Return shape (batch_size, 4) to match input
    batch_size = samples.shape[1]
    return 0.3 * jnp.ones((batch_size, 4))

def decoder2_fn(params, samples):
    """Second decoder layer: outputs prior params"""
    # samples shape is (num_samples, batch_size, 200)
    return 0.5 * jnp.ones(samples.shape)

# Create encoder and decoder tuples
encoder = (encoder1_fn, encoder2_fn)
decoder = (decoder1_fn, decoder2_fn)

# Create dummy parameters (just scalars or small arrays)
encoder_params = (jnp.array(0.1), jnp.array(0.1))
decoder_params = (jnp.array(0.1), jnp.array(0.1))

# Create a small batch of binary data
batch = jnp.array([
    [0, 1, 0, 1],
    [1, 0, 1, 0]
], dtype=jnp.float32)

# Create PRNG key
prng_key = random.PRNGKey(0)

# Assemble ARGS
ARGS = {
    "encoder": encoder,
    "decoder": decoder,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, scipy — 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
generate_variance_loss_objective Ran
ran on a synthesized input
aboustati/vargrad/vargrad/discrete_vae/two_layer_objectives.py
code served (permissive licence) · get_code("27e122b570e527f9")
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 jax
import jax.numpy as jnp
from jax import random
import numpy as np

# Define a simple Bernoulli distribution stand-in for scipy.stats.bernoulli
class BernoulliDist:
    @staticmethod
    def logpmf(x, p):
        """Log probability mass function for Bernoulli"""
        # Clamp p to avoid log(0)
        p = jnp.clip(p, 1e-7, 1 - 1e-7)
        return x * jnp.log(p) + (1 - x) * jnp.log(1 - p)
    
    @staticmethod
    def sample(p, key, num_samples=1):
        """Sample from Bernoulli distribution"""
        return random.bernoulli(key, p, shape=(num_samples,) + p.shape)

bernoulli = BernoulliDist()

# Create encoder functions
def encoder1_call(params, batch):
    """First encoder layer: outputs parameters for first layer Bernoulli"""
    # params shape: (4, 200)
    # batch shape: (2, 4)
    # output shape: (2, 200)
    return jnp.dot(batch, params)  # Simple linear transformation

def encoder2_call(params, samples):
    """Second encoder layer: outputs parameters for second layer Bernoulli"""
    # params shape: (200, 3)
    # samples shape: (num_samples, 2, 200)
    # output shape: (num_samples, 2, 3)
    batch_size = samples.shape[1]
    output_list = []
    for i in range(samples.shape[0]):
        output_list.append(jnp.dot(samples[i], params))
    return jnp.stack(output_list)

def decoder1_call(params, samples):
    """First decoder layer: reconstructs input from samples"""
    # params shape: (3, 4)
    # samples shape: (num_samples, 2, 3)
    # output shape: (num_samples, 2, 4)
    batch_size = samples.shape[1]
    output_list = []
    for i in range(samples.shape[0]):
        output_list.append(jnp.dot(samples[i], params))
    return jnp.stack(output_list)

def decoder2_call(params, samples):
    """Second decoder layer: outputs prior parameters"""
    # params shape: (200, 3)
    # samples shape: (num_samples, 2, 200)
    # output shape: (num_samples, 2, 3)
    batch_size = samples.shape[1]
    output_list = []
    for i in range(samples.shape[0]):
        output_list.append(jnp.dot(samples[i], params))
    return jnp.stack(output_list)

# Create encoder and decoder tuples
encoder1 = encoder1_call
encoder2 = encoder2_call
decoder1 = decoder1_call
decoder2 = decoder2_call

encoder = (encoder1, encoder2)
decoder = (decoder1, decoder2)

# Create parameters
encoder_params1 = jnp.ones((4, 200))  # Maps from batch (4,) to (200,)
encoder_params2 = jnp.ones((200, 3))  # Maps from (200,) to (3,)
encoder_params = (encoder_params1, encoder_params2)

decoder_params1 = jnp.ones((3, 4))   # Maps from (3,) to (4,) for reconstruction
decoder_params2 = jnp.ones((200, 3)) # Maps from (200,) to (3,) for prior
decoder_params = (decoder_params1, decoder_params2)

# Create batch
batch = jnp.ones((2, 4))  # batch size 2, feature dim 4

# Create PRNG key
prng_key = random.PRNGKey(0)

ARGS = {
    "encoder": encoder,
    "decoder": decoder,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — 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
logpdf Ran
ran on a synthesized input
aboustati/vargrad/vargrad/distributions/binary_concrete.py
code served (permissive licence) · get_code("624810d1981de662")
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 ArrayImpl, ndim 2, dtype family float, shape (2, 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 jax.numpy as jnp
import numpy as np

# Create small test arrays
x = jnp.array([[0.3, 0.7, 0.2, 0.9],
               [0.5, 0.4, 0.6, 0.1]], dtype=jnp.float32)

p = jnp.array([[0.4, 0.6, 0.3, 0.8],
               [0.5, 0.5, 0.7, 0.2]], dtype=jnp.float32)

temperature = 0.5

ARGS = {
    "x": x,
    "p": p,
    "temperature": temperature
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
logpmf Ran
ran on a synthesized input
aboustati/vargrad/vargrad/distributions/bernoulli.py
code served (permissive licence) · get_code("b62664bcd7b69aeb")
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 ArrayImpl, ndim 2, dtype family float, shape (2, 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 jax.numpy as jnp

# The function logpmf takes two parameters: x and p
# Both should be jax.numpy arrays with the same shape
# x represents outcomes (typically binary: 0 or 1)
# p represents Bernoulli probabilities (values between 0 and 1)

# Create small jax arrays with matching shapes
x = jnp.array([[1.0, 0.0, 1.0, 0.0],
                [0.0, 1.0, 0.0, 1.0]])

p = jnp.array([[0.7, 0.3, 0.9, 0.2],
                [0.4, 0.6, 0.5, 0.8]])

ARGS = {
    'x': x,
    'p': p
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
sample Ran
ran on a synthesized input
aboustati/vargrad/vargrad/distributions/bernoulli.py
code served (permissive licence) · get_code("ea712673f75d17f9")
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 ArrayImpl, ndim 3, dtype family float, shape (3, 2, 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 jax
import jax.numpy as jnp
from jax import random

# Set random seed for reproducibility
key = random.PRNGKey(0)

# Create Bernoulli probabilities as a jax.numpy array
# Using a small array with shape (2, 4) for distinct dimensions
p = jnp.array([[0.3, 0.5, 0.7, 0.9],
               [0.2, 0.4, 0.6, 0.8]])

# Number of samples to generate
num_samples = 3

ARGS = {
    "p": p,
    "key": key,
    "num_samples": num_samples
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 3, dtype family float, shape (3, 2, 4) — shape (3, 2, 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
sample Ran
ran on a synthesized input
aboustati/vargrad/vargrad/distributions/binary_concrete.py
code served (permissive licence) · get_code("829c661dd26bef5b")
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 ArrayImpl, ndim 2, dtype family float, shape (2, 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 jax.numpy as jnp
from jax import random
import numpy as np

# Set up PRNG key for JAX
key = random.PRNGKey(0)

# Create small test arguments
p = jnp.array([0.3, 0.5, 0.7, 0.2])  # Bernoulli probabilities, shape (4,)
temperature = 0.5  # Temperature parameter (scalar)
num_samples = 2  # Number of samples to generate

ARGS = {
    "p": p,
    "temperature": temperature,
    "key": key,
    "num_samples": num_samples
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
sample Ran
ran on a synthesized input
aboustati/vargrad/vargrad/distributions/binary_relaxed.py
code served (permissive licence) · get_code("369211dfef704bde")
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 ArrayImpl, ndim 2, dtype family float, shape (2, 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 jax
import jax.numpy as jnp
from jax import random

# Create a PRNG key for JAX
key = random.PRNGKey(0)

# Create a small probability array (shape: 4,)
p = jnp.array([0.2, 0.5, 0.7, 0.3])

# Number of samples
num_samples = 2

ARGS = {
    "p": p,
    "key": key,
    "num_samples": num_samples
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
generate_score_function_objective Not yet run
unverified (harvested, no recorded run)
aboustati/vargrad/vargrad/discrete_vae/objectives.py
code served (permissive licence) · get_code("dde442b8095695aa")
How it ran

no invocation recorded.

generate_variance_loss_objective Not yet run
unverified (harvested, no recorded run)
aboustati/vargrad/vargrad/discrete_vae/objectives.py
code served (permissive licence) · get_code("da1b7d08884188b5")
How it ran

no invocation recorded.

mnist Not yet run
unverified (harvested, no recorded run)
aboustati/vargrad/vargrad/datasets.py
code served (permissive licence) · get_code("b08eaa978b0e8144")
How it ran

no invocation recorded.

omniglot Not yet run
unverified (harvested, no recorded run)
aboustati/vargrad/vargrad/datasets.py
code served (permissive licence) · get_code("7c4b2e4da8105181")
How it ran

no invocation recorded.

Also present in other papers' code

Of 19 samples lifted from this paper's linked repositories, 19 carry a function identity and 0 do not. Of the 19 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 19 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-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

We analyse the properties of an unbiased gradient estimator of the ELBO for variational inference, based on the score function method with leave-one-out control variates. We show that this gradient estimator can be obtained using a new loss, defined as the variance of the log-ratio between the exact posterior and the variational approximation, which we call the $\textit{log-variance loss}$. Under certain conditions, the gradient of the log-variance loss equals the gradient of the (negative) ELBO. We show theoretically that this gradient estimator, which we call $\textit{VarGrad}$ due to its connection to the log-variance loss, exhibits lower variance than the score function method in certain settings, and that the leave-one-out control variate coefficients are close to the optimal ones. We empirically demonstrate that VarGrad offers a favourable variance versus computation trade-off compared to other state-of-the-art estimators on a discrete VAE.

For agents

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

get_harvested_code_for_paper("2010.10436")
get_code_for_paper("2010.10436")
have("2010.10436")

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

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

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

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

Connect an agent — have() is free.