Nearest-neighbour baselines for fingerprint prediction from MS/MS spectra under different assumptions
Organizations: MIT
Abstract
It has recently been shown that nearest-neighbour retrieval provides a strong baseline for molecular fingerprint prediction from MS/MS spectra, with several variants matching or outperforming current deep learning models (Khoo and Barzilay, 2026; Liu et al., 2026; Gupta et al., 2026). Importantly, "nearest neighbour" encompasses a family of retrieval methods that differ in the information assumed to be available at inference. In this report, we systematically compare several nearest-neighbour variants and show how these differing assumptions affect performance. Our goal is to establish stricter baselines that enable more rigorous benchmarking and better measure progress in this area.
Figures & tables
| NPLIB1 | MassSpecGym | ||||
| Assumption | Similarity | Scaffold | Random | Scaffold | Random |
| (1) No chemical formula | Cosine | 0.208 | 0.519 | 0.235 | 0.740 |
| Modified cosine | 0.236 | 0.517 | 0.246 | 0.700 | |
| Neutral-loss cosine | 0.187 | 0.533 | 0.220 | 0.749 | |
| Cosine Similarity (DreaMS) | 0.263 | 0.691 | 0.299 | 0.895 | |
| Binned cosine | 0.178 | 0.592 | 0.231 | 0.850 | |
| NPLIB1 | MassSpecGym | ||||
| Assumption | Similarity | Scaffold | Random | Scaffold | Random |
| (1) No chemical formula | Cosine | 0.313 | 0.593 | 0.331 | 0.777 |
| Modified cosine | 0.346 | 0.598 | 0.347 | 0.745 | |
| Neutral-loss cosine | 0.290 | 0.602 | 0.311 | 0.781 | |
| Cosine Similarity (DreaMS) | 0.380 | 0.754 | 0.400 | 0.913 | |
| Binned cosine | 0.276 | 0.650 | 0.315 | 0.869 | |
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Split | Train | Val | Test | Coverage | Leakage | FP oracle |
|---|---|---|---|---|---|---|---|
| NPLIB1 | Scaffold | 12,909 | 2,688 | 2,689 | 38.2% | 1.6% | 0.523 |
| NPLIB1 | Random | 12,800 | 2,742 | 2,744 | 80.7% | 62.9% | 0.870 |
| MassSpecGym | Scaffold | 76,243 | 16,041 | 16,042 | 41.0% | 14.3% | 0.562 |
| MassSpecGym | Random | 75,828 | 16,248 | 16,250 | 97.1% | 95.3% | 0.977 |
| Fallback (+ sub-formula) | Sub-formula rule only | ||||||||
| Dataset | Split | ||||||||
| NPLIB1 | Scaffold | 4 | 1 | 0.05 | 10 | 4 | 1 | 0.05 | 10 |
| NPLIB1 | Random | 4 | 1 | 0.1 | 5 | 2 | 4 | 0.05 | 10 |
| MassSpecGym | Scaffold | 8 | 1 | 0.05 | 20 | 8 | 1 | 0.05 | 20 |
| MassSpecGym | Random | 4 | 2 | 0.05 | 10 | 4 | 4 | 0.01 | 5 |
k-Nearest Neighbors
k-Nearest Neighbors (k-NN) predicts or retrieves from nearby data points using local similarity for classification, regression, clustering, and uncertainty.
See all 32 papers