File size: 14,594 Bytes
b1d398e
ae39dd9
b4bf54d
f55dafa
 
 
 
 
 
 
 
 
ae39dd9
b1d398e
f55dafa
 
 
b8be3a9
 
c9045ea
f55dafa
 
ae39dd9
 
 
b4bf54d
 
f55dafa
 
ae39dd9
f55dafa
 
 
 
 
 
 
 
 
 
 
 
b4bf54d
f55dafa
 
 
 
 
 
 
 
ae39dd9
b4bf54d
f55dafa
 
 
 
 
 
00f65f1
f55dafa
 
 
 
 
 
 
 
00f65f1
f55dafa
 
 
 
 
 
 
 
 
 
 
ae39dd9
f55dafa
 
 
ae39dd9
b4bf54d
f55dafa
b4bf54d
 
f55dafa
 
 
 
 
 
ae39dd9
 
 
 
f55dafa
ae39dd9
f55dafa
 
 
 
 
 
ae39dd9
 
 
 
 
 
b4bf54d
 
 
 
 
 
 
 
 
 
11921e5
00f65f1
 
b4bf54d
 
 
 
11921e5
 
 
b4bf54d
 
 
 
 
 
 
 
f55dafa
 
ae39dd9
 
b4bf54d
f55dafa
 
 
 
 
 
 
 
 
 
 
ae39dd9
 
 
f55dafa
ae39dd9
b4bf54d
f55dafa
 
 
ae39dd9
 
 
 
f55dafa
 
 
ae39dd9
 
b4bf54d
11921e5
00f65f1
f55dafa
 
 
ae39dd9
 
f55dafa
 
 
 
 
 
 
 
 
 
ae39dd9
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
---
license: mit
pretty_name: samplingdb reference sets and train splits
tags:
- sampling
- mcmc
- benchmark
- bayesian-inference
- molecular-dynamics
- statistical-physics
size_categories:
- 100K<n<1M
viewer: false
---

# samplingdb reference sets

<img class="dark:hidden" src="https://huggingface.co/datasets/h2o64/samplingdb/resolve/main/banner_light.png" alt="The samplingdb catalog, one tile per target" />
<img class="hidden dark:block" src="https://huggingface.co/datasets/h2o64/samplingdb/resolve/main/banner_dark.png" alt="The samplingdb catalog, one tile per target" />

Reference samples for the targets of [samplingdb](https://github.com/h2o64/samplingdb), a PyTorch
library of unnormalised densities for benchmarking samplers. A sampler's output is scored against
these sets. Each one comes from a long Markov chain run on the target's own density (MCMC, or
replica-exchange molecular dynamics for the peptides), or from an exact sampler where the posterior
allows one, and passed the convergence and independence checks below before it was published here.
The repo also holds every target's default train split, the cheap and biased set a sampler may
learn from, so that every user reads the same one.

You do not need to download anything by hand. samplingdb fetches a set the first time it is used,
checks its sha256, and keeps it in its cache.

## Quick start

```sh
pip install git+https://github.com/h2o64/samplingdb
```

```python
from samplingdb import build

target = build('lj55')
reference = target.test_samples(n=10000)   # downloads the set once (66 MB), then reads the cache
train = target.train_samples()             # the published train split, downloaded once
metrics = target.compute_metrics(samples)  # samples: your sampler's output, same shape
```

To fetch sets ahead of time, for example before a job on machines with no internet access:

```python
import samplingdb

samplingdb.download_references(['lj55', 'ace-a-nme-T300'])   # by catalog name
samplingdb.download_references()                   # every published set, 6.3 GB
```

The cache is `~/.cache/samplingdb`, or the directory `SAMPLINGDB_CACHE` names. It is laid out like
this repo, so a copy of the repo is a ready cache:

```sh
hf download h2o64/samplingdb --repo-type dataset --revision v5 --local-dir "$SAMPLINGDB_CACHE"
```

Without samplingdb, every file is a plain NumPy array:

```python
import numpy as np
from huggingface_hub import hf_hub_download

path = hf_hub_download('h2o64/samplingdb', 'pt/dw4_d9994289.npy', repo_type='dataset', revision='v5')
x = np.load(path)   # (n_samples, dim)
```

## Files

Each row of an array is one sample, flattened, in the coordinates the samplingdb target's
`log_prob` takes:

| Folder | Targets | Coordinates |
| --- | --- | --- |
| `pt/` | DW-4, LJ-13, LJ-55 | particle positions; samplingdb removes the centre of mass when it reads them |
| `pt/` | binary Kob-Andersen glass | particle positions in the periodic box, species in canonical order |
| `swapmc/` | ternary Kob-Andersen glass | particle positions in the periodic box, species in canonical order |
| `md/` | peptides | atom positions in nanometres, in the atom order of the released PDB |
| `stan/` | Bayesian posteriors | the unconstrained parameters, in samplingdb's order |
| `exact/` | the Brownian motion posterior | the unconstrained parameters, in samplingdb's order |
| `train/` | every target | the coordinates of the target's own folder above, or its `log_prob`'s |

A file is named `<folder>/<target name>_<spec_id>.npy`, and a train split
`train/<target name>_<spec_id>_<recipe>.npy`. The `spec_id` is a hash of the constants
that define the density, so a set can never be read against a different density than the one it
was drawn from. Next to every array, `<same name>_manifest.json` records the target, its `spec_id`,
the full generation protocol with its diagnostics, and the array's sha256.

| File | `build` name | Samples | dim | dtype | Size | Independence |
| --- | --- | --- | --- | --- | --- | --- |
| `pt/dw4_d9994289.npy` | `dw4` | 102400 | 8 | float32 | 3.3 MB | 91% effective |
| `pt/lj13_bd3bc3a0.npy` | `lj13` | 102400 | 39 | float32 | 16.0 MB | 98% effective |
| `pt/lj55_01c56181.npy` | `lj55` | 100352 | 165 | float32 | 66.2 MB | 100% effective |
| `pt/ka-binary-N64-T0.2_e60ecba4.npy` | `ka-binary-N64-T0.2` | 30720 | 128 | float32 | 15.7 MB | 91% effective |
| `stan/seeds_f9a50f20.npy` | `seeds` | 100000 | 26 | float64 | 20.8 MB | bulk ESS 96% of the draws |
| `exact/brownian_45794097.npy` | `brownian` | 100000 | 32 | float64 | 25.6 MB | exact independent draws |
| `stan/lgcp_cea6d9a6.npy` | `lgcp` | 100000 | 1600 | float64 | 1280.0 MB | bulk ESS 90% of the draws |
| `stan/lgcp-whitened_30e98363.npy` | `lgcp-whitened` | 100000 | 1600 | float64 | 1280.0 MB | bulk ESS 98% of the draws |
| `stan/breast-cancer_543f5f94.npy` | `breast-cancer` | 100000 | 31 | float64 | 24.8 MB | bulk ESS 102% of the draws |
| `stan/german-credit_3cfdf175.npy` | `german-credit` | 100000 | 25 | float64 | 20.0 MB | bulk ESS 110% of the draws |
| `stan/ionosphere_d00109c3.npy` | `ionosphere` | 100000 | 35 | float64 | 28.0 MB | bulk ESS 96% of the draws |
| `stan/sonar_52aa10ef.npy` | `sonar` | 100000 | 61 | float64 | 48.8 MB | bulk ESS 108% of the draws |
| `md/aaa-T310_e0bfbee3.npy` | `aaa-T310` | 100000 | 99 | float32 | 39.6 MB | 92% effective |
| `md/aaaaaa-T310_08d2d916.npy` | `aaaaaa-T310` | 100005 | 189 | float32 | 75.6 MB | 98% effective |
| `md/ace-a-nme-T300_54968005.npy` | `ace-a-nme-T300` | 100000 | 66 | float32 | 26.4 MB | 96% effective |
| `md/ace-aaa-nme-T300_cda31701.npy` | `ace-aaa-nme-T300` | 100000 | 126 | float32 | 50.4 MB | 94% effective |
| `swapmc/ka-ternary-N44-T0.32_d50e8a3f.npy` | `ka-ternary-N44-T0.32` | 131072 | 88 | float32 | 46.1 MB | 93% effective |
| `swapmc/ka-ternary-N44-T1.0_c0f9b3b8.npy` | `ka-ternary-N44-T1.0` | 163840 | 88 | float32 | 57.7 MB | 92% effective |
| `train/funnel_556b9f8f_uniform-neck.npy` | `funnel` | 100000 | 10 | float64 | 8.0 MB | train split, recipe uniform-neck |
| `train/manywell_30beb4d2_uniform-sides.npy` | `manywell` | 100000 | 32 | float64 | 25.6 MB | train split, recipe uniform-sides |
| `train/gmm40_a1f669cb_skewed-modes.npy` | `gmm40` | 100000 | 2 | float64 | 1.6 MB | train split, recipe skewed-modes |
| `train/mos_3d819321_skewed-modes.npy` | `mos` | 100000 | 2 | float64 | 1.6 MB | train split, recipe skewed-modes |
| `train/twomodes_0eddf6c9_skewed-modes.npy` | `twomodes` | 100000 | 2 | float64 | 1.6 MB | train split, recipe skewed-modes |
| `train/brackettwomodes_334746c8_skewed-modes.npy` | `brackettwomodes` | 100000 | 2 | float64 | 1.6 MB | train split, recipe skewed-modes |
| `train/manymodes-k3_edf2fcb2_skewed-modes.npy` | `manymodes-k3` | 100000 | 2 | float64 | 1.6 MB | train split, recipe skewed-modes |
| `train/eightgaussians_ae0110e3_skewed-modes.npy` | `eightgaussians` | 100000 | 2 | float64 | 1.6 MB | train split, recipe skewed-modes |
| `train/rings_5deb01ff_skewed-modes.npy` | `rings` | 100000 | 2 | float64 | 1.6 MB | train split, recipe skewed-modes |
| `train/checkerboard_9547623f_skewed-modes.npy` | `checkerboard` | 100000 | 2 | float64 | 1.6 MB | train split, recipe skewed-modes |
| `train/dw4_d9994289_hot-mala.npy` | `dw4` | 100000 | 8 | float32 | 3.2 MB | train split, recipe hot-mala |
| `train/lj13_bd3bc3a0_split-mala.npy` | `lj13` | 100000 | 39 | float32 | 15.6 MB | train split, recipe split-mala |
| `train/lj55_01c56181_split-mala.npy` | `lj55` | 100000 | 165 | float32 | 66.0 MB | train split, recipe split-mala |
| `train/seeds_f9a50f20_tempered-mala.npy` | `seeds` | 100000 | 26 | float64 | 20.8 MB | train split, recipe tempered-mala |
| `train/brownian_45794097_tempered-mala.npy` | `brownian` | 100000 | 32 | float64 | 25.6 MB | train split, recipe tempered-mala |
| `train/lgcp_cea6d9a6_tempered-mala.npy` | `lgcp` | 100000 | 1600 | float64 | 1280.0 MB | train split, recipe tempered-mala |
| `train/lgcp-whitened_30e98363_tempered-mala.npy` | `lgcp-whitened` | 100000 | 1600 | float64 | 1280.0 MB | train split, recipe tempered-mala |
| `train/ka-ternary-N44-T1.0_c0f9b3b8_hot-basin-mc.npy` | `ka-ternary-N44-T1.0` | 100000 | 88 | float32 | 35.2 MB | train split, recipe hot-basin-mc |
| `train/ka-ternary-N44-T0.32_d50e8a3f_hot-basin-mc.npy` | `ka-ternary-N44-T0.32` | 100000 | 88 | float32 | 35.2 MB | train split, recipe hot-basin-mc |
| `train/ka-binary-N64-T0.2_e60ecba4_hot-basin-mc.npy` | `ka-binary-N64-T0.2` | 100000 | 128 | float32 | 51.2 MB | train split, recipe hot-basin-mc |
| `train/ionosphere_d00109c3_tempered-mala.npy` | `ionosphere` | 100000 | 35 | float64 | 28.0 MB | train split, recipe tempered-mala |
| `train/sonar_52aa10ef_tempered-mala.npy` | `sonar` | 100000 | 61 | float64 | 48.8 MB | train split, recipe tempered-mala |
| `train/german-credit_3cfdf175_tempered-mala.npy` | `german-credit` | 100000 | 25 | float64 | 20.0 MB | train split, recipe tempered-mala |
| `train/breast-cancer_543f5f94_tempered-mala.npy` | `breast-cancer` | 100000 | 31 | float64 | 24.8 MB | train split, recipe tempered-mala |
| `train/ace-a-nme-T300_54968005_basin-md.npy` | `ace-a-nme-T300` | 100000 | 66 | float32 | 26.4 MB | train split, recipe basin-md |
| `train/ace-aaa-nme-T300_cda31701_basin-md.npy` | `ace-aaa-nme-T300` | 100000 | 126 | float32 | 50.4 MB | train split, recipe basin-md |
| `train/aaa-T310_e0bfbee3_basin-md.npy` | `aaa-T310` | 100000 | 99 | float32 | 39.6 MB | train split, recipe basin-md |
| `train/aaaaaa-T310_08d2d916_basin-md.npy` | `aaaaaa-T310` | 100000 | 189 | float32 | 75.6 MB | train split, recipe basin-md |

Independence is the effective sample size as a fraction of the rows: measured on the stored chains
for the tempered runs and the glass, and Stan's smallest bulk ESS for the posteriors, which exceeds
100% where successive NUTS draws are anticorrelated. The exact draws are independent by
construction. A train split is biased on purpose, so its row says which recipe made it.

The rows are interleaved across chains, so the first `n` rows of a file span every chain of the run
that produced it, and `test_samples(n=...)` can read a prefix.

## How the sets were made

Every set was generated by a script in the `gen/` folder of the samplingdb repository, which
documents each protocol and its acceptance checks in `docs/reference-sets.md`.

| Folder | Sampler | Checked before writing |
| --- | --- | --- |
| `pt/` | non-reversible parallel tempering with HMC moves | every chain makes 10 round trips and every pair of adjacent levels accepts at least 5% of its swaps; the set is at least 90% independent; the binary glass, merged from shards, also shows no drift from its start, and its chains started from deep configurations and from a melt agree within 4 standard errors |
| `md/` | replica-exchange molecular dynamics with solute tempering, BAOAB at 1 fs | every replica makes a round trip and every pair of adjacent levels accepts at least 5% of its swaps; each shard's energy agrees between the two halves of its run within 5 standard errors; the merged set is at least 90% independent on the pair distances and backbone torsions. The integrator is unadjusted: at 1 fs it puts Ace-A-Nme's mean energy about 0.1 kT above the zero-timestep limit |
| `swapmc/` | swap Monte Carlo on the GPU, 16 384 chains started from equilibrated configurations and stored at a fixed spacing | the merged set is at least 90% independent on the energy and the pair distances, with no drift from its start, and the specific heat agrees between the two halves of the run |
| `stan/` | Stan's NUTS, on models written in samplingdb's own coordinates | Stan's log density equals samplingdb's to 1e-9; R-hat below 1.01, bulk ESS above 90% of the draws, no divergences |
| `exact/` | rejection sampling of the two log scales from their priors against the bounded marginal likelihood, then the locations from their exact Gaussian conditional | the factorised density equals samplingdb's up to a constant, to 1e-8 across 1000 random points; every proposal stays below the bound |
| `train/` | the target's own `generate_train_samples` at seed 0, 100 000 samples, on a GPU (`gen/train/generate.py`) | samplingdb's tests: every mode of the test split visited in the wrong proportions, and the test energies covered at both ends |

## Versions

samplingdb pins one tag of this repo and the sha256 of every file it reads, so every samplingdb
version keeps reading the exact bytes it was tested against. A density change gets a new
`spec_id`, and therefore a new file. A set regenerated for the same density keeps its file name and
changes its bytes under a new tag; samplingdb refuses a cached copy from another tag.

| Tag | Contents |
| --- | --- |
| `v1` | 17 sets |
| `v2` | the Brownian posterior from an exact sampler, under `exact/` in place of `stan/`; both ternary glass sets regenerated on the GPU; the three particle sets, unchanged, under new names, since the particle count joined their `spec_id`; the binary Kob-Andersen glass at T = 0.2, published for the first time; every set under the MIT License, in place of CC BY 4.0 |
| `v3` | the default train split of every target, under `train/`; the reference sets of `v2`, unchanged |
| `v4` | the train splits of the particle systems and the glasses, with most chains far hotter than the target; everything else as in `v3` |
| `v5` | the train splits of LJ-13 and LJ-55, with nine chains in ten at one temperature above the target's and one in ten from 0.8 to 1 times it; everything else as in `v4` |

## License and attribution

The samples are released under the MIT License, like samplingdb. They are draws from densities
that others defined, so please also credit the sources of the densities you use:

- DW-4, LJ-13 and LJ-55: the potentials of Köhler et al. 2020, as implemented in bgflow.
- The logistic regressions: the Ionosphere, Sonar, Statlog (German Credit) and Breast Cancer
  Wisconsin (Diagnostic) datasets of the UCI Machine Learning Repository, under CC BY 4.0. Seeds:
  the data of Crowder 1978. Brownian: the model of inference_gym. LGCP: the Finnish pines data of
  Møller et al. 1998.
- The peptides: the systems of the Sequential Boltzmann Generators data (Tan et al. 2025), with the
  Amber ff99SB-ILDN and ff14SB force fields and OBC implicit solvent, evaluated with OpenMM.
- The ternary glass: the swap-friendly Kob-Andersen mixture of Jung et al. 2023, after Kob and
  Andersen 1995.
- The binary glass: the two-dimensional 80:20 Kob-Andersen mixture of Cheng et al. 2026, after Kob
  and Andersen 1995.