SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2105.03418 · ICLR · 2021

Deep Learning Hamiltonian Monte Carlo

Sam Foreman, Xiao-Yong Jin, James Osborn

arXiv · PDF · Open in the Atlas

Code that ran

9 of 14 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; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 6 failures of our instrument; 5 no recorded run), measured 2026-11-22; 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/2105.03418.json · badge: /api/ran/2105.03418.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
saforem2/l2hmc-qcd canonical (classifier label)
classifier basis: census
9 ran · 5 no recorded run
FunctionStatusWhere it lives
dict_to_list_of_overrides Ran
ran; our contract draft was wrong, not the code
saforem2/l2hmc-qcd/src/l2hmc/configs.py
code served (permissive licence) · get_code("71e54e8b9add4ad1")
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 list, ndim 1, 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
import torch.nn as nn

torch.manual_seed(0)

# The function dict_to_list_of_overrides takes a dict and flattens it,
# then converts key-value pairs to override strings.
# It calls flatten_dict which recursively flattens nested dicts.

# Create a nested dictionary to test the function
test_dict = {
    'model': {
        'layers': 3,
        'hidden_dim': 64
    },
    'training': {
        'lr': 0.001,
        'epochs': 100
    },
    'simple_param': 42
}

ARGS = {
    'd': test_dict
}
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 list, ndim 1, dtype family float — a list 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
dict_to_str Ran
ran; our contract draft was wrong, not the code
saforem2/l2hmc-qcd/src/l2hmc/common.py
code served (permissive licence) · get_code("2d5f8e2abbc109f7")
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)

# Test case 1: dict with grab=False (simple string representation)
d1 = {
    'a': 1,
    'b': 'hello',
    'c': 3.14,
}

# Test case 2: dict with grab=True (uses grab_tensor to extract values)
d2 = {
    'tensor_val': torch.randn(2, 4),
    'numpy_val': np.array([[1, 2, 3], [4, 5, 6]]),
    'scalar_int': 42,
    'scalar_float': 2.71,
    'scalar_bool': True,
    'none_val': None,
    'list_of_tensors': [torch.randn(2, 4), torch.randn(2, 4)],
    'list_of_arrays': [np.array([1, 2]), np.array([3, 4])],
}

ARGS = {
    'd': d2,
    'grab': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow, 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
flatten_dict Ran
ran; our contract draft was wrong, not the code
saforem2/l2hmc-qcd/src/l2hmc/configs.py
code served (permissive licence) · get_code("3e2181383d727aba")
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)

# The function flatten_dict takes a nested dict and flattens it
# It uses:
# - d: a dict (can be nested)
# - sep: a string separator (default '/')
# - pre: a string prefix (default '')
# The function recursively flattens nested dicts and joins keys with sep

# Create a nested dictionary to test the function
nested_dict = {
    'a': {
        'b': 1,
        'c': 2
    },
    'd': {
        'e': {
            'f': 3
        }
    },
    'g': 4
}

ARGS = {
    'd': nested_dict,
    'sep': '/',
    'pre': ''
}
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
generate_SU2 Ran
ran, violated the contract we drafted
saforem2/l2hmc-qcd/src/l2hmc/group/generators.py
code served (permissive licence) · get_code("75233715ea36a25d")
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 ndarray, ndim 2, dtype family float, shape (2, 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 numpy as np

ARGS = {
    "eps": 0.1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (2, 2) — shape (2, 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
grab_tensor Ran
ran, honoured the contract we drafted
saforem2/l2hmc-qcd/src/l2hmc/common.py
code served (permissive licence) · get_code("462e070a822710c7")
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 ndarray, 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
import numpy as np

torch.manual_seed(0)

# Test case 1: None input
case_none = None

# Test case 2: scalar inputs
case_int = 42
case_float = 3.14
case_bool = True
case_np_float = np.float32(2.71)

# Test case 3: numpy array
case_numpy = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])

# Test case 4: torch tensor
case_torch = torch.randn(2, 4)

# Test case 5: list of torch tensors
case_list_torch = [torch.randn(2, 4), torch.randn(2, 4)]

# Test case 6: list of numpy arrays
case_list_numpy = [np.array([1, 2, 3, 4]), np.array([5, 6, 7, 8])]

# Test case 7: object with callable numpy() method (simulating TensorFlow-like tensor)
class FakeTFTensor:
    def __init__(self, data):
        self._data = data
    
    def numpy(self):
        return self._data

case_tf_like = FakeTFTensor(np.array([[1, 2, 3, 4], [5, 6, 7, 8]]))

# Build ARGS dict with one representative test case
ARGS = {
    "x": case_torch
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, 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
mixed_loss Ran
ran, honoured the contract we drafted
saforem2/l2hmc-qcd/src/l2hmc/loss/loss.py
code served (permissive licence) · get_code("323f9441636d582a")
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

torch.manual_seed(0)

ARGS = {
    "loss": 0.5,
    "weight": 2.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 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
print_dict Ran
ran; our contract draft was wrong, not the code
saforem2/l2hmc-qcd/src/l2hmc/common.py
code served (permissive licence) · get_code("6f2c837026338169")
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
import logging

torch.manual_seed(0)
logging.basicConfig(level=logging.INFO)

# Construct test data for the dict parameter
test_dict = {
    'tensor_key': torch.randn(2, 4),
    'numpy_key': np.random.randn(2, 3),
    'scalar_key': 42,
    'float_key': 3.14,
    'bool_key': True,
    'none_key': None,
    'list_of_tensors': [torch.randn(2, 4), torch.randn(2, 4)],
}

ARGS = {
    'd': test_dict,
    'grab': True,
    'ret': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow, 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
run Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
saforem2/l2hmc-qcd/src/l2hmc/__main__.py
code served (permissive licence) · get_code("e875dff8a5c6114d")
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
from omegaconf import DictConfig, OmegaConf
from typing import Optional
import os
import tempfile
from pathlib import Path

torch.manual_seed(0)

# Create a minimal mock Experiment class
class MockTrainer:
    def __init__(self):
        self._is_orchestrator = True

class MockExperiment:
    def __init__(self, cfg, keep=None, skip=None):
        self.config = cfg
        self.trainer = MockTrainer()
        self._outdir = tempfile.gettempdir()
    
    def train(self):
        return None
    
    def evaluate(self, job_type='eval', nchains=2):
        return None
    
    def visualize_model(self):
        return None

# Patch the imports to return our mock
import sys
from unittest.mock import MagicMock

mock_l2hmc = MagicMock()
mock_l2hmc.experiment.pytorch.experiment.Experiment = MockExperiment
sys.modules['l2hmc'] = mock_l2hmc
sys.modules['l2hmc.experiment'] = mock_l2hmc.experiment
sys.modules['l2hmc.experiment.pytorch'] = mock_l2hmc.experiment.pytorch
sys.modules['l2hmc.experiment.pytorch.experiment'] = mock_l2hmc.experiment.pytorch.experiment
sys.modules['l2hmc.utils'] = mock_l2hmc.utils
sys.modules['l2hmc.utils.plot_helpers'] = mock_l2hmc.utils.plot_helpers
sys.modules['l2hmc.configs'] = mock_l2hmc.configs
sys.modules['ezpz'] = MagicMock()
sys.modules['opinionated'] = MagicMock()
sys.modules['opinionated'].STYLES = {'opinionated_min': 'default'}

# Mock the setup functions
sys.modules['ezpz'].setup_torch = MagicMock(return_value=None)
sys.modules['l2hmc.utils.plot_helpers'].set_plot_style = MagicMock()
sys.modules['l2hmc.utils.plot_helpers'].measure_improvement = MagicMock(return_value=0.95)
sys.modules['l2hmc.configs'].get_config = MagicMock(return_value={})

# Create a valid DictConfig with all necessary fields
cfg_dict = {
    'framework': 'pytorch',
    'seed': 42,
    'backend': 'DDP',
    'port': '2345',
    'precision': None,
    'steps': {
        'nera': 2,
        'nepoch': 2,
        'test': 0,
    },
    'dynamics': {
        'xshape': (8, 4),
    },
    'init_wandb': False,
}

cfg = OmegaConf.create(cfg_dict)

ARGS = {
    'cfg': cfg,
    'overrides': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
ezpz, l2hmc, matplotlib, omegaconf, opinionated, rich, torch, wandb — 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
setup_tensorflow Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
saforem2/l2hmc-qcd/src/l2hmc/utils/dist.py
code served (permissive licence) · get_code("e48c024f590b573a")
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 MagicMock. 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 os
from unittest.mock import MagicMock, patch

# Mock horovod to avoid runtime errors in non-distributed environment
class MockHorovod:
    def __init__(self):
        self._initialized = False
    
    def init(self):
        self._initialized = True
    
    def is_initialized(self):
        return self._initialized
    
    def rank(self):
        return 0
    
    def size(self):
        return 1
    
    def local_rank(self):
        return 0

mock_hvd = MockHorovod()

# Patch horovod before importing tensorflow
import sys
sys.modules['horovod'] = MagicMock()
sys.modules['horovod.tensorflow'] = MagicMock(
    init=mock_hvd.init,
    is_initialized=mock_hvd.is_initialized,
    rank=mock_hvd.rank,
    size=mock_hvd.size,
    local_rank=mock_hvd.local_rank
)

ARGS = {
    'precision': 'float32',
    'ngpus': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
horovod, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MagicMock — a MagicMock output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MagicMock output the recorded ndim 1 and dtype family None 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_experiment Not yet run
unverified (harvested, no recorded run)
saforem2/l2hmc-qcd/src/l2hmc/__main__.py
code served (permissive licence) · get_code("947a11bbb362aef4")
How it ran

no invocation recorded.

generate_SU3 Not yet run
unverified (harvested, no recorded run)
saforem2/l2hmc-qcd/src/l2hmc/group/generators.py
code served (permissive licence) · get_code("865d0ea11b9ea000")
How it ran

no invocation recorded.

generate_SU3_array Not yet run
unverified (harvested, no recorded run)
saforem2/l2hmc-qcd/src/l2hmc/group/generators.py
code served (permissive licence) · get_code("eb36853a373fd9c5")
How it ran

no invocation recorded.

get_experiment Not yet run
unverified (harvested, no recorded run)
saforem2/l2hmc-qcd/src/l2hmc/__main__.py
code served (permissive licence) · get_code("68790b67a0f21442")
How it ran

no invocation recorded.

get_jobdir Not yet run
unverified (harvested, no recorded run)
saforem2/l2hmc-qcd/src/l2hmc/configs.py
code served (permissive licence) · get_code("25a191e0ba1ad778")
How it ran

no invocation recorded.

Also present in other papers' code

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

We generalize the Hamiltonian Monte Carlo algorithm with a stack of neural network layers, and evaluate its ability to sample from different topologies in a twodimensional lattice gauge theory. We demonstrate that our model is able to successfully mix between modes of different topologies, significantly reducing the computational cost required to generate independent gauge field configurations. Our implementation is available at https://github.com/saforem2/l2hmc-qcd.

For agents

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

get_harvested_code_for_paper("2105.03418")
get_code_for_paper("2105.03418")
have("2105.03418")

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

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

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

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

Connect an agent — have() is free.