SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2510.10020 · ICML · 2025

Calibrating Generative Models to Distributional Constraints

Brian Trippe, Nathaniel Diamant, Henry Smith

arXiv · PDF · Open in the Atlas

Code that ran

13 of 16 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; 3 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 10 failures of our instrument; 3 no recorded run), measured 2026-11-23; 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/2510.10020.json · badge: /api/ran/2510.10020.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
smithhenryd/cgm canonical (classifier label)
classifier basis: census
13 ran · 3 no recorded run
FunctionStatusWhere it lives
build_prompt Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/gemma/cgm_gemma.py
code served (permissive licence) · get_code("083602ed7c768390")
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 numpy as np

torch.manual_seed(0)

# The function takes a single parameter: profession (str)
# It simply formats it into a prompt string
# No complex objects needed

ARGS = {
    "profession": "doctor"
}
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 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
clean_df Ran
ran, honoured the contract we drafted
smithhenryd/cgm/esm3/cgm_esm3.py
code served (permissive licence) · get_code("c8765fe23686641b")
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 DataFrame. 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 pandas as pd
import tempfile
import os

# Create a temporary CSV file with valid data
temp_dir = tempfile.gettempdir()
csv_path = os.path.join(temp_dir, 'test_protein_structure.csv')

# Create sample data that matches the expected format
data = {
    '% Helix': [0.3, 0.5, 0.2, 0.7, 0.1],
    '% Strand': [0.4, 0.2, 0.5, 0.1, 0.3]
}
df = pd.DataFrame(data)
df.to_csv(csv_path, index=False)

ARGS = {
    'csv_path': csv_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
clone_network Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/cgm/utils.py
code served (permissive licence) · get_code("bceb224d9f5dca7a")
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 SimpleNet. 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
import copy

torch.manual_seed(0)

# Create a simple neural network module for testing
class SimpleNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

# Instantiate the network
net = SimpleNet()

# Define ARGS dictionary with all parameters
ARGS = {
    "net": net,
    "disable_gradients": True
}
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 SimpleNet — a SimpleNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleNet 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
compute_bivariate_quantiles Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/esm3/cgm_esm3.py
code served (permissive licence) · get_code("53c523697aec2dae")
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 pandas as pd
import torch
import numpy as np

torch.manual_seed(0)

# Create a small DataFrame with alpha_helix and beta_strand columns
# These columns contain probability-like values in [0, 1]
df = pd.DataFrame({
    'alpha_helix': [0.1, 0.3, 0.5, 0.7, 0.9, 0.2, 0.4, 0.6],
    'beta_strand': [0.2, 0.4, 0.6, 0.8, 0.1, 0.5, 0.7, 0.3]
})

N_quantiles = 3

ARGS = {
    'df': df,
    'N_quantiles': N_quantiles
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, torch — 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
diffusion Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/genie2/genie_score_network.py
code served (permissive licence) · get_code("9e8aacf09f0436f0")
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 1, dtype family float, shape (2,) 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 a time tensor t with values in [0, 1] range
t = torch.tensor([0.5, 0.75], dtype=torch.float32)

# Create sqrt_betas tensor with 1001 entries (for t_discrete clipped to [1, 1000])
sqrt_betas = torch.randn(1001, dtype=torch.float32)

# Create a noise_scale parameter
noise_scale = 1.0

ARGS = {
    "t": t,
    "sqrt_betas": sqrt_betas,
    "noise_scale": noise_scale,
}
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 1, dtype family float, shape (2,) — shape (2,) 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
dot_product_kernel Ran
ran, honoured the contract we drafted
smithhenryd/cgm/cgm/kernels.py
code served (permissive licence) · get_code("3e80da7d4a2d667c")
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 two small tensors with distinct dimensions
# x: batch_size=2, features=4
# y: batch_size=3, features=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 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
energy_distance_kernel Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/cgm/kernels.py
code served (permissive licence) · get_code("3f31d3435a5bdae8")
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

torch.manual_seed(0)

ARGS = {
    "p": 2.0,
    "beta": 1.0,
}
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
fit_pca Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/cgm/cgm_distribution.py
code served (permissive licence) · get_code("9c54db2784a3a05b")
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 PCATransform. 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)

# Create a small sample matrix [m, d] where m=2 samples, d=4 features
y = torch.randn(2, 4)

# Define arguments for fit_pca
ARGS = {
    "y": y,
    "n_components": 2,
    "whiten": False,
}
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 PCATransform — a PCATransform output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PCATransform 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
make_warmup_cosine_scheduler Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/cgm/lr_schedules.py
code served (permissive licence) · get_code("9bb8e09b1bfb72a0")
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 LambdaLR. 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 torch import optim
import math

torch.manual_seed(0)

# Create a simple model for the optimizer
model = nn.Linear(4, 3)

# Create an optimizer
optimizer = optim.SGD(model.parameters(), lr=0.1)

# Define arguments for make_warmup_cosine_scheduler
ARGS = {
    "optimizer": optimizer,
    "total_epochs": 100,
    "warmup_epochs": 10,
    "min_lr_ratio": 0.01
}
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 LambdaLR — a LambdaLR output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LambdaLR 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
module_device Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/cgm/utils.py
code served (permissive licence) · get_code("c951752cae37ba30")
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 device. 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

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

m = SimpleModel()

ARGS = {
    "m": m
}
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 device — a device output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a device 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
rbf_mixture_kernel Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/cgm/kernels.py
code served (permissive licence) · get_code("47f2c36e4e658821")
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

torch.manual_seed(0)

ARGS = {
    "sigmas": (0.08, 0.16, 0.32, 0.64)
}
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
up_to_eos_mask Ran
ran; our contract draft was wrong, not the code
smithhenryd/cgm/gemma/cgm_gemma.py
code served (permissive licence) · get_code("1e0dbc5011ce31a6")
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, 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 torch

torch.manual_seed(0)

# Construct arguments for up_to_eos_mask
# tokens: [B, L] tensor of token IDs
# eos_id: the ID of the EOS token
# prompt_lens: Optional[torch.Tensor] of shape [B]

B, L = 2, 4
tokens = torch.randint(0, 10, (B, L))
eos_id = 5
prompt_lens = torch.tensor([0, 1])

ARGS = {
    "tokens": tokens,
    "eos_id": eos_id,
    "prompt_lens": prompt_lens
}
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, 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
warmup_cosine_multiplier Ran
ran, honoured the contract we drafted
smithhenryd/cgm/cgm/lr_schedules.py
code served (permissive licence) · get_code("f61246a331d0104c")
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 math

# warmup_cosine_multiplier takes 4 scalar arguments
# epoch: current epoch number (int)
# total_epochs: total number of epochs (int)
# warmup_epochs: number of warmup epochs (int)
# min_lr_ratio: minimum learning rate ratio (float)

ARGS = {
    "epoch": 5,
    "total_epochs": 100,
    "warmup_epochs": 10,
    "min_lr_ratio": 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type 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
combine_samples Not yet run
unverified (harvested, no recorded run)
smithhenryd/cgm/gemma/cgm_gemma.py
code served (permissive licence) · get_code("67176465cf507433")
How it ran

no invocation recorded.

default_logger Not yet run
unverified (harvested, no recorded run)
smithhenryd/cgm/cgm/utils.py
code served (permissive licence) · get_code("c978a6b9da7552f8")
How it ran

no invocation recorded.

h_bi Not yet run
unverified (harvested, no recorded run)
smithhenryd/cgm/esm3/cgm_esm3.py
code served (permissive licence) · get_code("74dff8236e373e41")
How it ran

no invocation recorded.

Also present in other papers' code

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

Generative models frequently suffer miscalibration, wherein statistics of the sampling distribution-such as the fraction of generations in a given class-deviate from desired values. We frame calibration as a constrained optimization problem and seek the closest model in Kullback-Leibler divergence satisfying a calibration constraint. To address the intractability of imposing these constraints exactly, we introduce two surrogate objectives for fine-tuning: (1) the relax loss, which replaces the constraint with a miscalibration penalty, and (2) the reward loss, which converts calibration into a reward fine-tuning problem. We demonstrate that these approaches substantially reduce calibration error across hundreds of simultaneous constraints and models with up to nine billion parameters, spanning applications in protein design, image generation, and language modeling. Code is available at https: //github.com/smithhenryd/cgm.

For agents

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

get_harvested_code_for_paper("2510.10020")
get_code_for_paper("2510.10020")
have("2510.10020")

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

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

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

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

Connect an agent — have() is free.