Skip to content

Molecular Prior Networks: matching state of the art at 16 shots

THE ARGUMENT

At 16 support molecules the Molecular Prior Network ties the strongest few-shot method ADKF-IFT on FS-Mol regression (Kendall tau 0.298 for both), but it falls behind once more labels are available, and only part of its advantage is explained by molecular similarity.

On this page

A team has 14 compounds with measured potency against a new kinase target and another 400 sitting unmeasured in the queue; the decision on the table is whether to pay for another round of lab assays or trust a model to rank the queue. The default answer is no: with a dozen labels you either fit a small model per target or go back to the bench. This paper argues that the default is out of date. It trains one model on 4938 existing affinity datasets so that, for a brand-new target, ranking the unmeasured compounds takes a single forward pass and no task-specific training at all [1].

What it does: feed measured and unmeasured molecules in together, get a ranking out

The Molecular Prior Network (MPN) is a transformer — a neural network that lets a set of inputs attend to each other and then produce one output per input. It takes two groups of molecules: a support set (the handful that have been assayed and carry a number) and a query set (the ones still waiting to be ranked). In one forward pass — data flows from input to output without any parameters being updated — the model emits predicted values for every query molecule, with no fitting on the task at hand [1].

Each molecule is written as a fixed-length string of zeros and ones, a fingerprint (a standard way of encoding molecular structure as a fixed-length binary vector). The paper uses Morgan fingerprints of radius 2 and length 2048. Unlike TabPFN, which tokenizes every individual feature, here one molecule is one token and the feature ordering is held fixed across datasets, so the model can learn what individual fingerprint bits mean in a way that transfers across targets [1].

Attention is asymmetric: queries can look at the support set, but not the other way round, so evidence only flows from labelled to unlabelled molecules. Support hidden states do not produce output directly, yet they are repeatedly read and updated at every layer, letting the network build a task-specific representation conditioned on the labels. Labels enter the computation only through the attention values, and the original label embeddings are re-injected at every layer, which the authors report improves performance. No positional encoding is used, so predictions are invariant to the ordering of the support set.

Training uses thousands of real affinity datasets, not synthetic tables

The TabPFN line of work generates thousands of synthetic tabular datasets and trains the model to solve small-data prediction problems over and over. This paper swaps the synthetic corpus for real protein-ligand measurements: 4938 training tasks, each corresponding to a single protein target, with molecular fingerprints as inputs and measured activity as the target (on the logarithmic pIC50 scale) [1].

At each training step a dataset is sampled and randomly split into support and query sets, with the support size drawn uniformly from {16, 32, 64, 128, 256} and capped at 80% of the dataset so that at least 20% stays as query. The loss is mean squared error over the query predictions. To keep a few large datasets from eating the training budget, any dataset with more than 500 molecules is randomly subsampled to 500. Model selection uses mean absolute error on 40 validation tasks; final metrics are averaged over 111 test tasks and 10 random splits per task [1].

The evaluation setup is the part that matters most: none of those 111 test tasks appear during training. The model is not learning a structure-activity relationship for a particular target, it is learning how to propagate a handful of labelled molecules onto the rest.

The actual numbers on the FS-Mol regression tasks

Evaluation uses the regression variant of the FS-Mol benchmark, scored by Kendall tau — a rank correlation that only cares whether the ordering is right, where 1 means perfect agreement with the true order and 0 is roughly chance [1]. Table 1, reproduced from the paper, gives the values.

ModelN_s=163264128256
Random forest0.1380.1980.2550.3100.354
GP-ST0.1630.2140.2620.3150.358
TabPFN0.1460.1900.2280.2760.322
TabICL (2048 bits)0.1560.2000.2500.3090.358
kernel MPN0.2330.2820.3260.3690.379
MPN (4 layers)0.2990.3260.3520.3820.395
MPN (16 layers)0.2980.3350.3680.3980.411
ADKF-IFT0.2980.3490.3910.4340.456

Two caveats before reading. First, the N_s = 256 column covers only the 43 of 111 tasks with enough samples to build a 256-molecule support set, so it is not directly comparable to the other columns. Second, the tie happens only at 16 shots: 0.299 for the 4-layer MPN and 0.298 for the 16-layer one, against 0.298 for ADKF-IFT. At 32 shots ADKF-IFT is already ahead (0.349 versus 0.335), and by 256 the gap is 0.456 versus 0.411. The paper's own phrasing is that the model matches the state of the art for the smallest support sets [1] — matches, not beats.

The other useful comparison is against general tabular foundation models. TabPFN reaches only 0.146 at 16 shots and TabICL with 2048-bit fingerprints reaches 0.156, both far below the MPN's 0.298. The paper's conclusion is that when a domain-specific pre-training corpus exists, it yields stronger priors than a generic one [1]. That is also why you cannot simply drop a tabular foundation model onto molecular activity: its prior comes from generic tables, not from chemistry.

How much of the performance is just molecules looking alike

The authors run an ablation that strips the transformer stack out entirely. A single linear projection maps fingerprints into d dimensions, the result is L2-normalized, cosine similarity between each query and each support molecule is divided by a learned temperature, and support labels are averaged with softmax weights [1]. Mathematically this is kernel regression with an exponential-cosine kernel (kernel regression: no fitting on the task, just a similarity-weighted average of neighbours), and the projection itself is learned end to end.

The result is the kernel MPN row: 0.233 / 0.282 / 0.326 / 0.369 / 0.379. It beats both the tuned random forest (0.138 at 16 shots) and the Gaussian process with a Tanimoto kernel, GP-ST (0.163), at every support size, which says that similarity weighting in a learned feature space is already a non-trivial baseline. But it sits consistently below the full MPN (0.298 at 16 shots, 0.411 at 256). The paper's reading is that the transformer's predictive performance is only partially explained by simple molecular similarity [1].

Cost: four days to pre-train, then no fitting per task

Training a 16-layer MPN takes roughly 4 days on a single NVIDIA A10G GPU [1]. The settings: Adam, learning rate 1e-5 for the attention models and 1e-4 for the kernel variant, batches of 10 tasks, gradient norm clipped at 100; 100 epochs for the kernel model and 400 for the attention models, keeping the checkpoint with the lowest validation MAE. Hidden dimension is 1024 and the label embedding dimension is a quarter of that.

Inference is where the economics change. The paper reports inference over thousands of molecules in seconds for the attention model and hundredths of a second for the kernel variant, because nothing is fitted on the new task. The authors add that both MPN and ADKF-IFT are roughly two times faster on a GPU, but that GPU memory becomes a bottleneck for ADKF-IFT beyond 1000 samples [1]. That sentence is all the paper says about the speedup, without naming the baseline, so do not put the factor of two straight into a procurement spreadsheet.

For a buyer, the cost structure is: four A10G-days once, then near-zero adaptation cost per new target. ADKF-IFT and similar methods are stronger at small support sizes but must be fitted per task, and memory gives out before the dataset does.

Where this method stops being the right choice

  • It ties only at 16 shots, it does not lead. From 32 shots upward ADKF-IFT is better (0.349 / 0.391 / 0.434 / 0.456 versus 0.335 / 0.368 / 0.398 / 0.411). If your project already has dozens or hundreds of measured points, the upside of switching is thin.
  • There is one benchmark. Every number comes from the FS-Mol regression variant, 111 test tasks, 10 random splits each. No independent second benchmark is reported.
  • There is no uncertainty estimate. The conclusion lists explicit modelling of predictive uncertainty as future work [1], which means it is not yet something you plug into active learning or Bayesian optimization as an acquisition function.
  • The input representation is fixed. Morgan fingerprints, radius 2, 2048 bits. Replacing them with a graph neural network encoder, or adding descriptors, is listed as future work with no experiments.
  • The training corpus is existing affinity data. If a client's new target sits far from those 4938 training tasks in chemical space, the paper offers no evidence either way. That is an extrapolation question, not an architecture question.
  • Attention cost grows linearly with support and query set sizes. The paper notes it deliberately avoids external context for exactly this reason [1].

The one-line version: this is a model that ties the best method in the near-zero-label regime while removing task-specific fitting. It is not a model that broadly beats few-shot methods, and it is not ready to make decisions unsupervised. Before you use it, know how many labels you actually have, check whether your test targets overlap the pre-training corpus, and decide whether you need a confidence interval.

References

  1. Molecular Prior Networks

Read next

All articles

Sign in to Padda

A code in your inbox. No password to remember.

Connecting to sign-in…