Manuscript Offprint

arXiv:2610.41745

Do LLMs Know When They Are Wrong About Molecules? In-Context Property Prediction with Self-Reported Uncertainty

Matthias Busch, Marius Tacke, Tamadur Albaraghtheh, Sviatlana V. Lamaka, Mikhail L. Zheludkevich, Roland C. Aydin, Christian Feiler, Christian J. Cyron

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Large language models (LLMs) are used in many domains, but molecular property prediction with them is still little explored. In this work we evaluate the capability of 7 frontier LLMs to predict molecular properties together with a self-reported uncertainty from in-context examples, and compare them with classical baselines trained on the same molecules. We use 4 datasets and screen each for contamination of the training data of the LLMs: three are clean, and the fourth, ESOL, is memorised by most of the models and serves as a comparison. On the clean datasets every LLM improves with the context, at 30 examples the most accurate one beats every baseline. The requested reasoning effort changes accuracy little. The self-reported uncertainty ranks the prediction errors weakly, with Spearman rank correlations of up to 0.46, about the level reached by the uncertainties of the baselines. Combining uncertainty and prediction, on lipophilicity the most certain half of the best LLM is the most accurate at small context sizes; on BACE and antiviral, and on lipophilicity at large context sizes, the best LLMs are on par with the best baseline. On the contaminated ESOL dataset the LLMs show no improvement with the context size, as expected for a memorised dataset, and their stated uncertainty is smaller on the molecules whose value they recall.

Keywords: large language models · in-context learning · uncertainty quantification · active learning · selective prediction · data contamination · molecular property prediction

*Corresponding authors: matthias.busch@tuhh.de, christian.cyron@hereon.de

1 Introduction

Large language models (LLMs) predict molecular properties in context from a Simplified Molecular Input Line Entry System (SMILES) string, and in several studies they reach the accuracy of baseline models trained on the same small datasets [6, 19, 26, 39, 46]. Outside chemistry, Vacareanu et al. [57] found that LLMs given in-context examples solve synthetic regression tasks about as well as random forests and gradient boosting, and Requeima et al. [50] elicited numerical predictive distributions from them. An in-context regressor needs no training, reads a molecule in the notation chemists use, and can be asked in the same prompt how uncertain its prediction is.

Uncertainty matters specifically in two scenarios. The first is active learning, where an uncertainty selects the samples to label. Ideally, the samples with the highest prediction error should be taken, but without label, the prediction error is unknown. The second is selective prediction [14], the use of predictions without measuring them: the most certain predictions are kept, and the error of the kept fraction measures accuracy and ranking together. For both purposes, the uncertainty must rank the actual prediction errors well; whether the magnitude of the stated uncertainty also matches the observed errors, its calibration [32], is a separate property that this study does not assess. For classical molecular models ranking and calibration have been compared for ensembles, sampling and evidential methods [24, 51], and stated confidences of language models have been found over-confident on text and on chemistry questions [41, 60]. An uncertainty benchmark needs data the models cannot recall, because a recalled value is predicted with almost no error and nothing requires the stated uncertainty to register that it was recalled rather than predicted [7, 8].

In-context regression has a basis outside chemistry: transformers trained on function classes recover linear and tree-like functions from the examples in their prompt [2, 13], and pre-trained LLMs forecast time series [18] and classify tabular rows [20] from text alone, with an accuracy that grows with the number of examples [1]. In chemistry, LLMs have served as few-shot predictors of molecular properties [19, 26, 39], as generators of rules that feed a classical model [61], and as surrogates for Bayesian optimisation over molecules and catalysts [42, 47]; fine-tuned LLM regressors, however, trail dedicated models on materials data [27], and LLM surrogates help Bayesian optimisation mainly after adaptation to the domain [30]. These studies compare accuracy, mostly at one training-set size; the learning curve over the number of examples and the overlap of the test molecules with the pre-training data are rarely reported.

Work on the uncertainty of LLMs has concentrated on classification and question answering [15]: models can be taught to state their confidence in words [37], the stated confidence is informative [55] but often too high [60, 62], prompting alone yields a weaker uncertainty than a short fine-tuning on graded answers [29], and the disagreement between repeated samples is an alternative to self-report [31, 40]. For numerical prediction the uncertainty has so far been read from token likelihoods or sampled outputs [18, 47, 50], and the one molecular study we are aware of uses sampling on classification tasks [9]. The uncertainties of classical molecular models, in contrast, have been benchmarked across methods [36], with the recommendation to judge them together with the accuracy of the model [21, 56], and they are used for selective prediction [28] and for choosing the next experiment [23, 49]. A like-for-like comparison of the self-reported σ\sigma of an in-context regressor with classical uncertainties on the same molecules, judged by these two uses over the number of examples and on data the models have not seen, has not been made; it is the comparison of this study.

We evaluate 7 frontier language models on 4 molecular regression datasets: lipophilicity, BACE-1 inhibition, inhibition of the SARS-CoV-2 main protease from a challenge of 2025, and ESOL. The test molecules of the first three occur in none of seven open pre-training corpora, and a zero-shot screen finds only insignificant retrieval of their values by any panel model, whereas ESOL is retrieved by most and serves as the control. Each model predicts 150 test molecules per dataset with a stated standard deviation from nested contexts of 30 to 1,000 training molecules, in three calls per molecule and, at the small context sizes, in three independent context draws; eight classical methods are trained on exactly the same molecules, and six of the models are also run along a ladder of reasoning efforts. We analyze how accurate the models are over context sizes and reasoning levels, which uncertainty ranks the prediction errors best, as needed for active learning, how accurate the most certain predictions are, as needed for selective prediction, and, with the contaminated ESOL dataset as the comparison, how a memorised dataset behaves on the same measures.

References (60)