LNPBench / README.md
eduzrh's picture
LNPBench: code, caches, results and figures
681b79a verified
|
Raw History Blame Contribute Delete
12.6 kB
---
license: mit
task_categories:
- graph-ml
- tabular-regression
language:
- en
tags:
- lipid-nanoparticle
- LNP
- mRNA-delivery
- drug-delivery
- molecular-property-prediction
- benchmark
pretty_name: LNPBench - physics-informed LNP structure-function benchmark
---
# LNPBench
Reproducible benchmark and physics-informed models for **lipid nanoparticle
(LNP) structure-function prediction** on the public
[LNPDB](https://lnpdb.molcube.com) database (Nature Communications 2026).
## Contents
| Path | Description |
|---|---|
| `code/` | Full source tree (`src/lnpbench`, `scripts/`) |
| `cache/` | Derived feature cache (fingerprints, descriptors, cCPP, tasks) |
| `results/` | Result tables, statistical tests, per-sample predictions (`results/predictions/`, `results/predictions_final/`) |
| `figures/` | Publication figures (PNG + PDF) |
| `manuscript/` | Chinese manuscript draft (`PAPER_zh.md`) and its todo list |
## Headline: the unified-budget k-shot ladder
Every method below receives **the same pilot batch** (k% of the target
study, same draw, same seeds) and is evaluated on the unlabelled remainder
(`results/unified_ladder.csv`, 20 external tasks, 2 pilot seeds):
| k (labels) | strongest same-budget baseline | **ours** | our arm | improvement |
|---|---|---|---|---|
| 0 (0) | 0.362 (CatBoost) | **0.403** | family4 ensemble | +11.4% |
| 10% (53) | 0.434 (CatBoost) | **0.466** | refit + family ensemble | +7.3% |
| 20% (106) | 0.450 (XGBoost) | **0.476** | refit + family ensemble | +5.7% |
| 30% (159) | 0.490 (XGBoost) | **0.522** | XGB refit + ensemble | +6.5% |
| 50% (265) | 0.573 (XGBoost) | **0.593** | adapted-tree ensemble | +3.4% |
| 80% (424) | 0.594 (XGBoost) | 0.593 | adapted XGB + fingerprint | -0.3% |
**0.55+ is reached at k=50% (0.593).** Our protocol dominates every
same-budget baseline up to k=50% and ties the strongest one at k=80%. Two
label-efficiency facts stand out: our k=10% (0.466) beats every baseline at
k=20% (0.450) - **twice the label efficiency** - and our 0-shot ensemble
beats every 0-shot baseline by +11.4%.
Against our own 0-shot, the ladder gains **+47%** (0.403 -> 0.593); against
the strongest 0-shot baseline, **+64%**.
## The single method: a two-stage representation-calibration protocol
* **Stage 0 (0-shot).** An identity-free 398-dimensional chemistry block
(217 RDKit descriptors + 16 cCPP + 5 molar ratios + 96 fragment descriptors
+ 48 helper-lipid descriptors + 16 ionisable-lipid physicochemical
properties). The **family4 ensemble** - one rank-averaged member per model
family (identity-free tree, physics-informed neural, neural baseline,
discrete-relation kernel) - reaches **0.403** Spearman at zero target
labels, verified with a leave-one-study-out selection protocol (the same
four members are chosen no matter which study is held out).
* **Stage 1 (pilot calibration, LNPAdapt).** The pilot labels are added to
the training pool and the tree read-outs are **refit**; for small k the
refit forest is rank-averaged with the fixed family ensemble (0.466 at
k=10%), for large k the *adapted trees themselves* are ensembled
(XGBoost + XGBoost-on-fingerprint + random-forest-on-fingerprint:
**0.593 at k=50%**).
The pilot matters through *refitting*, not through calibration: isotonic or
residual corrections of a fixed prediction add at most +0.016, while a refit
re-learns the target study's chemistry->activity mapping in feature space.
## The central empirical finding
**Study identity is a shortcut - and it cuts both ways.** Replacing the
identity-free physical node features of PhysSet-LNP with Morgan fingerprints
raises validation Spearman but collapses external Spearman from 0.368 to
0.189: the model learns to recognise which study a formulation came from
instead of chemistry that transfers. Appending the fingerprint to the
398-d block likewise *lowers* the tree read-out (0.376 -> 0.374 RF, 0.372 ->
0.335 ET, the latter significant at p = 0.012).
But once the target study has labels, the same fingerprint becomes the best
adaptation signal: refitting on the block + fingerprint beats refitting on
the identity-free block at every k >= 10% (k=50%: 0.584 vs 0.577 RF; XGBoost
0.588 vs 0.577). **The pilot labels convert study identity from a shortcut
into signal** - the same information that destroys zero-shot transfer is
exactly what a locally-calibrated model needs.
Cross-validation on the same data reaches 0.61 Spearman versus 0.30-0.36
externally: within-database CV overstates generalisation by 2-3x.
## The 0-shot benchmark table
| Model | LM_2019 | BL_2023 | SL_2020 | ZC_2023 | seed_avg | seeds |
|---|---|---|---|---|---|---|
| **PhysChem-Tree (ours)** | 0.209 | 0.174 | 0.683 | 0.439 | **0.376** | 1 |
| Random forest | 0.194 | 0.156 | 0.656 | 0.420 | 0.357 | 1 |
| PhysSet-LNP (ours) | 0.142 | 0.103 | 0.750 | 0.430 | 0.356 | 3 |
| CatBoost (strongest boosted baseline) | -- | -- | -- | -- | 0.362 | 1 |
| Extra trees | 0.179 | 0.049 | 0.713 | 0.445 | 0.346 | 1 |
| AGILE (re-trained, full pool) | 0.166 | 0.018 | 0.721 | 0.414 | 0.330 | 3 |
| LiON (from scratch) | 0.206 | 0.137 | 0.620 | 0.337 | 0.325 | 3 |
| Identity-free flat probe (ours) | 0.184 | -0.071 | 0.732 | 0.401 | 0.312 | 1 |
| XGBoost | 0.117 | 0.085 | 0.669 | 0.329 | 0.300 | 1 |
| PhyCausal-LNP (ours) | 0.089 | 0.050 | 0.701 | 0.329 | 0.292 | 1 |
| SeqCausal-LNP (ours) | -0.103 | 0.086 | 0.612 | 0.225 | 0.205 | 1 |
| Morgan FP + MLP | -0.063 | 0.007 | 0.490 | 0.344 | 0.194 | 1 |
| LNPBench-Stack (published 4-member) | 0.207 | 0.164 | 0.730 | 0.466 | 0.392 | -- |
| **Family4 ensemble (ours)** | 0.232 | 0.164 | 0.758 | 0.458 | **0.403** | -- |
## Ensembles: one member per family (honest selection)
Rank-averaging one representative per model family gives **0.403** at zero
target labels. Priced with leave-one-study-out selection (each family's
representative chosen on the other three studies only), the same four
members are selected every time and the honest estimate is **0.403**
(`results/stack_family.csv`, `results/stack_loso.csv`). Unconstrained greedy
selection is *worse* (0.385), so the family constraint acts as a regulariser.
## Discrete latent relations (RelMode-LNP): interpretable kernel
LaRIN's discrete latent-variable design was re-implemented twice at the
formulation level (VQ codebook; CoDiffGRN's D3PM diffusion posterior) and once
at the **node-pair** level (the intermolecular contact as the discrete
variable: pair encoder -> cosine assignment to K=16 prototypes -> EMA codebook
-> residual latent-relation odds marginalised into the attention logits).
Formulation-level modes do not beat their nested controls; the pair-level
variant `relmode_nr_w` is the only one that does not lose (0.360 vs 0.349,
p = 0.22) and is kept as an interpretable kernel.
The codebook recovers the formulation grammar without labels: IL-internal
fragments use modes {0,6,7,13}, IL-HL {2,6,8,10}, IL-Chol {1,6,10},
IL-PEG {6,7,8,10}, helper-helper {3,5}; the same assignment appears in two
different held-out studies. Within-mode chemistry is flat (cCPP 0.175-0.180),
i.e. the relation bias carries information already present in the
identity-free features - which is why it does not raise the mean by itself.
## What did not work (reported in full)
Three feature-side ideas, one decoder family, three reviewer suggestions and
several adaptation variants were implemented and run at full scale. **None
improves the state of the art**, and the report says so:
| Feature block added to PhysChem-Tree | mean | delta |
|---|---|---|
| role-aware ontology / schema (223-d) | 0.368 | -0.008 (p = 0.28) |
| ontology, revised taxonomy (226-d) | 0.364 | -0.013 (p = 0.15) |
| global archetype codebook (75-d, label-free) | 0.314 | -0.063 (p < 0.0001) |
| ontology + codebook | 0.293 | -0.083 |
* The ontology *redistributes* rather than adds: best model on LM_2019 (+0.031)
and worst on SL_2020 (-0.031).
* A codebook fitted on the union of the studies encodes the *composition* of the
database, and in LNPDB the composition of the database is the study.
* The descriptor space has no exploitable manifold: the kNN graph spectrum is
degenerate (leading singular values 0.9957, 0.9945, 0.9939 ... within 1e-3).
* Schema-LNP (typed adjacency + ontology node attributes) scores 0.354 versus
0.360 for PhysSet-LNP at the same budget.
* A study-identifiability audit saturates: *every* block, including the
reference (0.950), predicts the study of origin at >= 0.93 balanced accuracy,
because the 40 study sources screened chemically disjoint lipid libraries.
* **Discrete formulation-mode decoders** (LaRIN-style VQ codebook and
CoDiffGRN-style diffusion posterior, eight configurations): none beats the
tuned PhysSet-LNP (best screen row -0.007, all p >= 0.12; the confirmed
variant scores 0.3362 vs 0.3597, p = 0.23).
* **Reviewer suggestion 1 - coarse cross-study context** (keep only the 47 of
109 context dimensions shared across studies): -0.013, p = 0.84.
* **Reviewer suggestion 2 - pure within-study ranking loss**: -0.055 / -0.067;
absolute regression is not wasting capacity, the ranking loss is.
* **Reviewer suggestion 3 - stronger tree family at 0-shot**: CatBoost 0.362,
LightGBM 0.325, strongly regularised XGBoost 0.339 - all below the random
forest 0.376 already in the benchmark. (With a pilot batch the picture
reverses: boosted refits are the strongest same-budget competitors, which
is why the unified ladder uses them as baselines.)
* **Hybrid read-out** (neural head sees the 398-d chemistry block): -0.037.
* **External supervision** (pretraining on LNP Atlas absolute properties):
no gain over training from scratch.
* **Representative (k-means medoid) pilot selection** does not beat random
selection at any k (e.g. 0.437 vs 0.448 at k=10%).
* **3-seed averaging of the refit forest, isotonic on top of the refit, and
replacing (rather than adding to) the ensemble's tree slot** - none beats
the plain refit + ensemble combination (`results/fewshot_family_refit.csv`).
* **Stacking weights / self-training / disagreement pilot selection** - none
beats the plain refit + ensemble at k=10%.
## Benchmark protocols
1. **External generalisation** - four studies held out entirely
(`LM_2019`, `BL_2023`, `SL_2020`, `ZC_2023`), five published 80/20 folds on
the remaining database.
2. **Amine-disjoint 70/15/15** - the split used by the LNPDB evaluation.
3. **Study-stratified 5-fold CV** over all 18,858 formulations.
4. **Unified-budget k-shot** - every method receives the same pilot batch
(k% of the target study, same draw, same seeds); evaluated on the
unlabelled remainder.
Primary metric: Spearman rank correlation between predicted and measured
delivery efficiency.
## Models
* Baselines: LiON (D-MPNN), AGILE (GIN + descriptors), XGBoost / RF /
ExtraTrees / CatBoost / LightGBM, Morgan-fingerprint MLP, mean predictor.
* Proposed: **PhysSet-LNP** (GINE over the intact lipid + descriptor MLP +
ten-node formulation set with physics-biased attention, identity-free nodes),
**PhyCausal-LNP** (same set encoder with condition cross-attention and a
within-study ranking loss), **SeqCausal-LNP** (GINE + Bi-Mamba + GroupDRO),
**RelMode-LNP** (pair-level discrete latent-relation codebook, interpretable
kernel).
## Reproduction
```bash
git clone https://github.com/evancollins1/LNPDB.git data/LNPDB
pip install -r code/requirements.txt && pip install -e code
python -m lnpbench.prepare --stage all --workers 32
python scripts/run_benchmark.py --models physset_phys --protocols external \
--seeds 0 1 2 --device cuda --epochs 30 --batch-size 256 --save-preds
python scripts/ensemble.py --pred-dirs results/predictions --out results/ensemble.csv
python scripts/stack_family.py # family-rule ensemble + LOSO honesty
python scripts/fewshot_ens_refit.py # Stage 1 (small k)
python scripts/fewshot_kscale.py # k-ladder, RF arms
python scripts/fewshot_kscale_xgb.py # k-ladder, XGBoost arms
python scripts/fewshot_baselines.py # same-budget baselines
python scripts/fewshot_final.py # adapted-tree ensemble + saved predictions
python scripts/unified_ladder.py # the definitive unified table
python scripts/report.py --results results && python scripts/report_r2.py
```
Every table and figure can be rebuilt from `results/predictions/`,
`results/predictions_final/` and `results/*.csv` without retraining.
## License
Code: MIT. Derived features follow the LNPDB terms of use; raw LNPDB data are
not redistributed here - download them from https://lnpdb.molcube.com.