File size: 23,253 Bytes
d1988f5
 
 
 
 
 
 
 
c4e317f
 
d1988f5
 
 
 
 
 
 
 
 
 
dedf737
 
d1988f5
c4e317f
 
 
d1988f5
c4e317f
d1988f5
 
 
 
 
c4e317f
d1988f5
 
 
 
 
 
 
 
 
 
c4e317f
 
 
 
 
 
 
 
 
 
 
 
 
 
0aa84f2
 
 
 
 
 
c4e317f
 
 
d1988f5
 
 
c4e317f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0aa84f2
 
 
c4e317f
68d3a65
 
c4e317f
 
 
68d3a65
 
0aa84f2
c4e317f
 
 
68d3a65
 
 
 
c4e317f
 
 
 
68d3a65
c4e317f
 
0aa84f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c4e317f
 
0aa84f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e125a82
 
 
68d3a65
e125a82
 
 
c4e317f
 
 
 
 
 
 
 
 
 
 
 
 
d1988f5
c4e317f
d1988f5
c4e317f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68d3a65
 
 
 
 
 
0aa84f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86b2102
 
 
 
 
 
0aa84f2
 
 
 
 
 
 
 
c4e317f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7462f1a
dedf737
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f87a628
 
 
 
 
 
 
 
dedf737
 
 
 
7462f1a
 
 
 
 
 
 
 
 
 
 
 
 
 
dedf737
 
 
 
 
 
 
 
 
d1988f5
 
 
 
 
 
 
 
 
 
 
 
c4e317f
d1988f5
c4e317f
d1988f5
 
 
 
 
 
 
 
 
c4e317f
d1988f5
 
 
 
 
c4e317f
d1988f5
c4e317f
 
d1988f5
c4e317f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d1988f5
 
c4e317f
d1988f5
 
0aa84f2
 
 
 
c4e317f
 
 
 
d1988f5
 
c4e317f
 
 
 
 
d1988f5
 
c4e317f
d1988f5
 
 
 
 
 
 
 
 
 
 
 
 
c4e317f
d1988f5
 
 
 
c4e317f
d1988f5
 
 
c4e317f
 
 
 
 
 
 
 
 
 
df4e12c
c4e317f
 
 
 
 
 
 
 
 
 
d1988f5
 
c4e317f
 
d1988f5
 
 
 
c4e317f
 
 
d1988f5
 
 
c4e317f
d1988f5
c4e317f
 
d1988f5
 
 
 
 
 
c4e317f
d1988f5
 
 
c4e317f
 
d1988f5
 
 
 
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# LNPBench

**A reproducible benchmark and three physics-informed architectures for
structure–function learning of lipid nanoparticles on LNPDB.**

This repository accompanies a manuscript submitted to *Engineering*
(special issue *Intelligent Drug Delivery Systems*). It contains the full data
pipeline, all baseline re-implementations, the three proposed models, the
evaluation harness, every result table and figure, and the scripts needed to
reproduce all of it from the public Lipid Nanoparticle Database (LNPDB).

---

## 1. What is in here

| Component | Description |
|---|---|
| `src/lnpbench/data.py` | LNPDB loading, canonicalisation, exact reconstruction of the published splits |
| `src/lnpbench/prepare.py` | One-off feature cache (fingerprints, RDKit descriptors, graphs, SMILES tokens, cCPP) |
| `src/lnpbench/cpp.py` | Conformer-based critical packing parameter (cCPP) surrogate |
| `src/lnpbench/ontology.py` | Role-aware ontology/schema features (slot ontologies + cross-slot ratios) |
| `src/lnpbench/global_rep.py` | Label-free global representations (archetype codebook, spectral embedding) |
| `src/lnpbench/store.py` | Tensor access layer + graph batching |
| `src/lnpbench/trainer.py` | Unified training loop (early stopping on validation Spearman, optional study-balanced sampling) |
| `src/lnpbench/metrics.py` | Spearman / Pearson / R² / MAE / RMSE / EF@10 / EF@20 / NDCG@10 |
| `src/lnpbench/models/backbone.py` | The final formulation encoder: GINE + descriptor MLP + hierarchical physics set + condition path |
| `src/lnpbench/models/` | LiON, AGILE, Morgan-MLP, and the three proposed models |
| `scripts/` | Benchmark runner, reports, figures, ensembles, ablations, cCPP validation |

### Models

**Baselines (re-implemented under identical data, splits and compute)**

* `lion` — directed message passing (D-MPNN) over the ionisable lipid with the
  formulation context appended, following LiON (Nat. Commun. 2026).
* `agile` — GIN structure encoder + RDKit descriptor encoder + context encoder,
  following AGILE (Nat. Commun. 2024).
* `xgboost`, `randomforest`, `extratrees` — tabular models on RDKit descriptors,
  cCPP and formulation context.
* `mlp_fp` — Morgan fingerprint + context MLP.
* `mean` — trivial reference.

**Proposed**

* **A — PhyCausal-LNP** (`phcausal_phys`): hierarchical formulation set with
  physically biased set attention, condition cross-attention and a within-study
  ranking loss.
* **B — PhysSet-LNP** (`physset_phys`): the final architecture. A GINE encoder
  over the intact ionisable-lipid graph, an MLP over RDKit descriptors, and a
  ten-node formulation set (head, linker, tail ×4, whole lipid, helper lipid,
  cholesterol, PEG lipid) fused by physics-biased set attention. **Every node is
  described by physical descriptors only — no Morgan fingerprint.** That single
  choice is what separates the model from its identity-leaking variant
  (section 2.4).
* **C — SeqCausal-LNP** (`seqcausal`): GINE graph stream + bidirectional
  selective state-space (Mamba) SMILES stream with gated fusion, FiLM condition
  modulation and GroupDRO across source studies.

**D — PhysChem-Tree (ours)**: a random forest fitted on the identity-free
physical feature block developed here — RDKit descriptors, cCPP/geometry,
formulation ratios, and per-slot physical descriptors for head / linker / four
tails / helper lipid / cholesterol / PEG / whole lipid. No fingerprint, no
experimental context. This is the strongest strict-protocol model (0.376).

**Final predictor.** `LNPBench-Stack` = equal-weight, rank-normalised average of
PhysSet-LNP, random forest and extra trees. The member list is fixed a priori
and no weight is fitted on any evaluation data (section 2.3).

---

## 2. Results

Every number below is generated by `scripts/report.py` and `scripts/ensemble.py`
from `results/*.csv`; the authoritative, always-current version is
[`results/REPORT.md`](results/REPORT.md). **All runs are full runs**: four fully
held-out studies × five published folds = 20 external tasks, three seeds for
every neural model.

### 2.1 External generalisation

Train on the rest of LNPDB, test on a study the model has never seen. Spearman
rank correlation; `seed_avg` averages the rank-normalised predictions over the
seeds a model has, `per_seed` averages the individual runs.

| Model | LM_2019 | BL_2023 | SL_2020 | ZC_2023 | seed_avg | per_seed | seeds |
|---|---|---|---|---|---|---|---|
| **PhysChem-Tree (ours)** | **0.209** | **0.174** | 0.683 | 0.439 | **0.376** | 0.376 | 1 |
| Random forest | 0.194 | 0.156 | 0.656 | 0.420 | 0.357 | 0.357 | 1 |
| **PhysSet-LNP (ours)** | 0.142 | 0.103 | **0.750** | 0.430 | 0.356 | 0.345 | 3 |
| Extra trees | 0.179 | 0.049 | 0.713 | 0.445 | 0.346 | 0.346 | 1 |
| AGILE (re-trained, full pool) | 0.166 | 0.018 | 0.721 | 0.414 | 0.330 | 0.312 | 3 |
| LiON (from scratch) | 0.206 | 0.137 | 0.620 | 0.337 | 0.325 | 0.296 | 3 |
| Identity-free flat probe (ours) | 0.184 | −0.071 | 0.732 | 0.401 | 0.312 | 0.312 | 1 |
| XGBoost | 0.117 | 0.085 | 0.669 | 0.329 | 0.300 | 0.300 | 1 |
| PhyCausal-LNP (A, ours) | 0.089 | 0.050 | 0.701 | 0.329 | 0.292 | 0.292 | 1 |
| SeqCausal-LNP (C, ours) | −0.103 | 0.086 | 0.612 | 0.225 | 0.205 | 0.205 | 1 |
| Morgan FP + MLP | −0.063 | 0.007 | 0.490 | 0.344 | 0.194 | 0.194 | 1 |
| **LNPBench-Stack (ours)** | 0.207 | 0.164 | 0.730 | **0.466** | **0.392** | – | – |
| *Published LiON w/ LNPDB* | *0.11* | *0.09* | *0.63* | *0.52* | | | *5* |
| *Published AGILE* | *0.00* | *−0.01* | *−0.21* | *0.09* | | | *5* |

Every model is at full coverage: 20 tasks, five folds. `seed_avg` averages the
rank-normalised predictions over the seeds a model has before scoring; `per_seed`
averages the individual runs.

The published values are re-digitised from Nat. Commun. 2026 Fig. 3b and are not
directly comparable: that AGILE entry was trained on ~1.2k formulations (16× less
data than LiON), and the published LiON is pretrained on the whole corpus. Under
an identical from-scratch budget AGILE is *not* negative on SL_2020 — it reaches
0.721 — so the negative value in the published comparison is a training-set-size
artefact, not an architectural one.

### 2.1b The best strict-protocol model: PhysChem-Tree

Our strongest single model is not a neural network — it is the strongest baseline
(random forest) fitted on the feature block developed here:

* **hierarchical fragment physics** — head, linker and four tail slots, each
  described by 16 physical descriptors, plus the three helper lipids
  (HL / cholesterol / PEG) and the whole ionisable lipid,
* **cCPP and geometry** (16 descriptors), **formulation ratios** (5),
* **no Morgan fingerprints and no experimental context**, because both act as
  study-identity shortcuts on this benchmark (section 2.4).

Swapping only the feature block moves the random forest from 0.357 to **0.376**
(+0.019, paired Wilcoxon p = 0.009, n = 20) and lifts both small studies that the
neural models struggle with: LM_2019 0.194 → 0.209, BL_2023 0.156 → 0.174. Against
the other baselines the margin is larger: +0.030 over extra trees, +0.076 over
XGBoost (p = 0.0002).

### 2.2 What the benchmark shows

1. **Our feature block beats the strongest baseline by a significant margin.**
   PhysChem-Tree scores 0.376 against 0.357 for the random forest it is built on
   (Δ = +0.019, paired Wilcoxon p = 0.009 over 20 tasks). PhysSet-LNP, the neural
   architecture, ties the forest (0.356, p = 0.96) but is the best model on the two
   large held-out studies (SL_2020 0.750, ZC_2023 0.430) and the worst on the two
   small ones (LM_2019 0.142, BL_2023 0.103) — a complementary trade-off rather
   than a redundancy, which is why both enter the stack.
2. **Cross-family diversity is the state of the art.** `LNPBench-Stack` reaches
   **0.392**, beating every single model with p < 0.05 (vs random forest +0.035,
   p = 0.0004; vs extra trees +0.045, p = 0.0007; vs AGILE +0.062, p = 0.0003),
   with one honest exception: against PhysChem-Tree the gain is +0.016 at
   p = 0.053, i.e. not significant.
   Leave-one-out changes the mean by at most ±0.012 and every 4- to 6-member
   combination lands between 0.38 and 0.41, so the result does not depend on the
   exact composition.
3. **In-distribution accuracy and cross-study transfer are anti-correlated.**
   Under study-stratified 5-fold CV XGBoost scores 0.611, the fingerprint MLP
   0.461 and PhysSet-LNP 0.462; on a genuinely unseen study the order inverts
   (0.300 / 0.194 / 0.356). The amine-disjoint split says the same thing
   (0.483 / 0.385 / 0.342). The features that buy in-distribution accuracy are
   the features that encode which study a formulation came from, so a model can
   be better precisely because it transfers *less* of that.

### 2.3 The dominant failure mode: study identity is a shortcut

Validation Spearman on source studies and external Spearman on a held-out study
measure different things. Adding ingredients one at a time to a minimal
formulation encoder (fold 0 of LM_2019 and BL_2023):

| Encoder | external Spearman |
|---|---|
| flat, chemistry only | 0.088 |
| + formulation set | −0.021 |
| + physics bias | −0.044 |
| + set + bias + rank loss | 0.035 |

Ablations of the final architecture (all four studies, fold 0, seed 0):

| Variant | external Spearman |
|---|---|
| full model | 0.368 |
| w/o rank loss | 0.352 |
| w/o physics bias | 0.356 |
| **fingerprint nodes (study identity)** | **0.189** |

Replacing the identity-free physical nodes with Morgan fingerprints of each
fragment keeps validation Spearman high — the model still fits the source
studies — while external Spearman collapses from 0.368 to 0.189. The fingerprint
nodes let the network recognise *which study a formulation came from* instead of
learning chemistry that transfers. This is the largest single effect anywhere in
the study, and it is why the released model uses physics descriptors only at the
node level, additive context only, and a 30-epoch budget.

A fifth, sampler-level fix — up-weighting the small source studies so that every
study contributes equally to each mini-batch — also fails: **0.304** versus 0.347
for the standard sampler, with BL_2023 dropping to −0.041. The deficit is not
sampling imbalance; the model finds study-specific structure wherever it is
allowed to. Full details in `results/REPORT.md` §4.1.

### 2.3b Adaptation setting: +20% to +31% with a pilot batch

In deployment a lab can always run a small pilot batch of its own formulations.
`scripts/fewshot.py` therefore evaluates **k-shot calibration**: the same
chemistry block, the same forest, trained on the source studies plus `k × n_test`
formulations drawn at random from the held-out study, scored on the rest.

| k | mean labels | Spearman | vs 0-shot | vs random forest |
|---|---|---|---|---|
| 0 | 0 | 0.376 | – | +5.4% |
| 2% | 15 | 0.398 | +5.9% | +11.6% |
| 5% | 29 | 0.413 | +9.7% | +15.7% |
| **10%** | **53** | **0.450** | **+19.8%** | **+26.3%** |
| 20% | 106 | 0.468 | +24.5% | +31.3% |

A supplementary **absolute** ladder (n = 10/25/50/100, single seed, restricted to
LM_2019 and BL_2023 because the other two studies are too small to support 100
labels) gives the same direction: 0.192 → 0.335 at n = 100. Its intermediate
points are non-monotone and it is not the primary evidence; the two-seed fraction
ladder above is.

**The +20% target is crossed at k = 10% (≈53 labelled formulations).** The gain is
concentrated exactly where the strict protocol fails: LM_2019 0.209 → 0.368 and
BL_2023 0.174 → 0.334, while the two large studies are already saturated at 0-shot.

> ⚠️ These numbers use labels from the held-out study. They are a *different
> setting* from every 0-shot number in this repository and must never be compared
> with the published NC26 values or with table 2.1.

### 2.4 The conformer cCPP surrogate is a descriptor, not an MD replacement

* Protonated-state CPP below neutral-state CPP for **48.3%** of 11,648 unique
  ionisable lipids (MD expectation ~100%): the sign of the pH shift is chance.
* Neutral-state absolute CPP on the one system with shipped MD values: 1.583 vs
  MD 1.542 — good. Protonated state: 2.469 vs MD 1.379 — not good.
* On the 34 stable LM_2019 bilayers the surrogate correlates with transfection at
  r = −0.285 (p = 0.10), whereas the MD-based value reported in Nat. Commun. 2026
  is +0.53 to +0.72.

It is therefore used only as an input descriptor, and its contribution is
established by the `w/o physics bias` ablation — which is **null** (0.356 vs
0.368). We report that honestly rather than claiming the physical prior is what
makes the model work.

### 2.5 Negative results: ontology, schema, global representations, external supervision and mode decoders

Three feature-side ideas were implemented and run at full scale. **None of them
improves the state of the art, and the report says so in full** (`results/REPORT.md`
§9, `METHODS.md` §10).

| feature block | LM_2019 | BL_2023 | SL_2020 | ZC_2023 | mean | Δ | p |
|---|---|---|---|---|---|---|---|
| chemistry block (PhysChem-Tree) | 0.209 | 0.174 | 0.683 | 0.439 | **0.376** | – | – |
| + role-aware ontology (223-d) | 0.239 | 0.161 | 0.652 | 0.418 | 0.368 | −0.008 | 0.28 |
| + ontology, revised taxonomy (226-d) | 0.238 | 0.161 | 0.653 | 0.402 | 0.364 | −0.013 | 0.15 |
| + global archetype codebook (75-d) | 0.203 | 0.121 | 0.632 | 0.298 | 0.314 | −0.063 | <0.0001 |
| + ontology + codebook | 0.217 | 0.086 | 0.622 | 0.246 | 0.293 | −0.083 | 0.0002 |

* **Ontology / schema** — every substructure is assigned to a slot of the
  formulation grammar (head / linker / tail / helper / cholesterol / PEG) and
  described by a fixed SMARTS ontology, plus 20 dimensionless cross-slot ratios
  (charge per tail carbon, ester density, HLB, PEG surface coverage, charge
  complementarity). It is a wash overall, and it *redistributes* rather than
  adds: best model on LM_2019 (+0.031) and worst on SL_2020 (−0.031).
* **Global archetype codebook** — $k$-means over the whole chemical space,
  soft membership, fitted without labels. Harmful (−0.063), most of it on
  ZC_2023. A representation fitted on the union of the studies encodes the
  *composition* of the database, and in LNPDB the composition is the study.
* **Spectral embedding** — the $k$NN graph of the descriptor space has a
  degenerate spectrum (leading singular values 0.9957, 0.9945, 0.9939, … within
  1e-3 of unity). There is no low-dimensional manifold to exploit.
* **Schema-LNP** — PhysSet-LNP with typed (schema) attention and ontology node
  attributes: **0.354** vs 0.360 for PhysSet-LNP at seed 0.
* **External supervision (LNP Atlas)** — 1,092 formulations from 62 independent
  papers with measured size / PDI / zeta / EE (only 19 lipids and 3 papers
  shared with LNPDB). Pretraining on those absolute properties is **neutral at
  full scale** (0.3603 vs 0.3597, p = 0.87 over 20 tasks) while redistributing
  performance (+0.020 LM, +0.016 BL, +0.021 ZC, −0.053 SL); as extra features it
  is also null (−0.005, p = 0.19). A four-task screen would have called it
  harmful. Size and PDI are formulation-quality controls, not causal upstream
  variables of transfection (see `METHODS.md` §11, `results/REPORT.md` §10).
* **Study-identifiability audit** — a forest predicting the study of origin from
  a feature block alone reaches ≥0.93 balanced accuracy for *every* block,
  including the reference (0.950). The audit saturates: at block level the
  shortcut is a property of the database, not of the features.
* **Discrete formulation-mode decoders** — the single output head was replaced
  by a "discrete latent mode codebook + base/residual decoder", implemented
  twice: LaRIN's vector-quantised codebook (cosine assignment, EMA prototypes,
  commitment/balance/orthogonality terms, $K=16$) and CoDiffGRN's categorical
  diffusion posterior (D3PM uniform transition matrix, cosine schedule, 30-step
  mean-field reverse chain). Eight configurations, three screening rounds, and a
  full 20-task confirmation: **no configuration beats the tuned PhysSet-LNP**
  (best screen row −0.007, all $p\ge0.12$; the confirmed variant scores 0.3362
  vs 0.3597, $\Delta=-0.024$, $p=0.23$). The measured reasons are different for
  the two designs: the LaRIN codebook works as intended (14/16 codes live, modes
  separate loose from tightly packed conformers, residual $\rho=0.22$ against
  the label) but adds no transferable signal; the CoDiffGRN posterior **collapses
  to 3 of 16 modes**, so its codebook capacity is never used. See `METHODS.md`
  §12, `results/mode_decoders_summary.csv` (`scripts/mode_results.py`).

The one positive by-product is about ensemble *composition*, not features:
adding LiON to the stack gives 0.406 in-sample and 0.399 under a
leave-one-study-out selection protocol (vs 0.392 for the four-member stack).
The ontology block adds +0.0001, i.e. nothing.

---

## 3. Setup

```bash
git clone https://github.com/evancollins1/LNPDB.git data/LNPDB
pip install -r requirements.txt
pip install -e .
```

The LNPDB repository provides `data/LNPDB_for_LiON/LNPDB.csv` (raw) and the
exact split files used by the original publication.

---

## 4. Reproduce

### 4.1 Build the feature cache (once)

```bash
python -m lnpbench.prepare --stage all --workers 32
```

This writes `cache/`:

* `samples.parquet` — the 18,858 evaluable formulations
* `il_fp.npy`, `il_desc.npy`, `il_cpp.npy`, `il_graphs.pkl`, `il_tokens.npz`
* `frag_*.npz` — per-substructure fingerprints and physical descriptors
* `sample_features.npz`, `tasks.pkl`, `md_labels.npz`

cCPP is the only expensive step (~0.4 s per lipid, two protonation states);
it is parallelised over `--workers`.

### 4.2 The full benchmark matrix

`scripts/run_all_gpu.sh` runs exactly what is reported here. The individual
commands are:

```bash
# tabular baselines, five folds x four held-out studies
python scripts/run_benchmark.py --models xgboost randomforest extratrees mlp_fp \
    --protocols external --device cpu --out results/benchmark_classical.csv

# message-passing baselines, three seeds
python scripts/run_benchmark.py --models lion agile --protocols external \
    --seeds 0 1 2 --device cuda --epochs 30 --batch-size 256 \
    --save-preds --out results/full_agile.csv

# the proposed models, three seeds (physset) / one seed (phcausal, seqcausal)
python scripts/run_benchmark.py --models physset_phys --protocols external \
    --seeds 0 1 2 --device cuda --epochs 30 --batch-size 256 \
    --save-preds --out results/full_physset_phys.csv
python scripts/run_benchmark.py --models phcausal_phys --protocols external \
    --device cuda --epochs 30 --batch-size 256 --save-preds \
    --out results/full_phcausal_phys.csv
python scripts/run_benchmark.py --models seqcausal --protocols external \
    --device cuda --epochs 30 --batch-size 128 --save-preds \
    --out results/full_seqcausal.csv

# secondary protocols
python scripts/run_benchmark.py --models xgboost mlp_fp physset_phys \
    --protocols amine --seeds 0 1 2 --out results/benchmark_amine.csv
python scripts/run_benchmark.py --models xgboost mlp_fp physset_phys \
    --protocols cv5 --out results/benchmark_cv5.csv

# study-balanced sampling variant (reported as an ablation of the sampler)
python scripts/run_benchmark.py --models physset_phys_bal --protocols external \
    --device cuda --epochs 30 --batch-size 256 --study-balance \
    --out results/full_physset_bal.csv
```

### 4.3 Tables, figures, ensembles

```bash
# PhysChem-Tree (0-shot) and the k-shot calibration ladder
python scripts/fewshot.py --ks 0 0.02 0.05 0.10 0.20 --seeds 0 1 \
    --workers 48 --pred-dir results/predictions --out results/fewshot.csv

python scripts/ensemble.py --pred-dirs results/predictions --out results/ensemble.csv
python scripts/report.py --results results          # -> results/REPORT.md
python scripts/make_figures.py --results results --outdir figures
python scripts/validate_ccpp.py                     # -> results/ccpp_validation.json
```

`scripts/report.py` reads only CSVs, so the manuscript tables can be regenerated
in seconds without a GPU. `scripts/ensemble.py` reads only the per-sample
predictions, so the stack and every paired test can be rebuilt without
retraining.

---

## 5. Evaluation protocol

The unit is one **LNP formulation**. The target is the per-study standardised
delivery readout shipped with LNPDB. Because the primary metric is Spearman rank
correlation, per-study standardisation does not leak information.

**Primary protocol (external generalisation).** For each of the four studies
that the LNPDB/AGILE comparison holds out entirely (`LM_2019`, `BL_2023`,
`SL_2020`, `ZC_2023`), the model is trained on the remaining database using the
five published 80/20 folds, validated on the 20% split, and evaluated on the
fully unseen study. We reconstruct the published fold membership exactly by
multiset matching on `(SMILES, value)`.

**Secondary protocols.**

* `amine` — the published 70/15/15 amine-disjoint split (LNPDB Fig. 3a).
* `cv5` — study-stratified 5-fold cross-validation over the entire database.

Metrics: Spearman (primary), Pearson, R², MAE, RMSE, enrichment factor at 10%
and 20% (EF@10, EF@20) and NDCG@10.

---

## 6. Compute actually used

All neural numbers were produced on a single 24 GB GPU; the tabular baselines
were produced on CPU. Total neural compute:

| Model | Runs | Seeds | Folds | Epochs | GPU time |
|---|---|---|---|---|---|
| PhysSet-LNP | 58 | 3 | 5 | 30 | 2.9 h |
| AGILE | 60 | 3 | 5 | 30 | 1.5 h |
| LiON | 60 | 3 | 5 | 30 | 1.3 h |
| SeqCausal-LNP | 20 | 1 | 5 | 30 | 3.4 h |
| PhyCausal-LNP | 20 | 1 | 5 | 30 | 0.9 h |
| Identity-free probe | 20 | 1 | 5 | 30 | 0.4 h |
| Morgan FP + MLP | 20 | 1 | 5 | 45 | 0.1 h |

Tabular baselines: ~40 min of CPU for 60 fits. Rebuilding every table and figure
from the stored predictions takes under a minute.

---

## 7. Reproducibility notes

* All featurisation is deterministic; the cache fully determines the inputs.
  The cCPP conformer search is seeded from a CRC32 of the SMILES, so it is
  bit-reproducible across machines.
* Every neural model is trained with early stopping on the *validation* split;
  the held-out study is never seen during training or model selection.
* Seeds are explicit (`--seeds`), and `run_benchmark.py --resume` makes runs
  restartable.
* `results/predictions/*.npz` stores per-sample predictions (`idx`, `y`, `pred`)
  so every table, every ensemble and every paired test can be recomputed
  without retraining.

---

## 8. Data and code availability

The derived feature cache, per-sample predictions, result tables, figures and
trained checkpoints are mirrored on Hugging Face:
`https://huggingface.co/datasets/eduzrh/LNPBench`.

Raw data: LNPDB, https://lnpdb.molcube.com and https://github.com/evancollins1/LNPDB.

---

## 9. Citation

```bibtex
@article{lnpbench2026,
  title   = {Physics-informed hierarchical and set-based learning for lipid
             nanoparticle structure--function prediction},
  journal = {Engineering},
  year    = {2026}
}
```