What QSAR is and how it turns descriptors into predictions
QSAR is a statistical model that maps numbers computed from a structure to a measured property. Here is how it works, what it needs and where it stops.
QSAR, quantitative structure-activity relationship modelling, fits a function that maps numbers computed from a molecule's structure to a measured property, then uses that function to predict the property for molecules nobody has measured. It is a form of supervised learning with a chemical flavour. The prediction is only as trustworthy as the training data, the way the structure is encoded and the way the model was validated.
The three parts of every QSAR model
A QSAR model has three parts, and each one can fail on its own.
- A set of molecules with a measured endpoint, for example aqueous solubility, a pIC50 against a kinase, or a yes or no from a toxicity assay.
- A numerical representation of each molecule, either a handful of named descriptors or a long fingerprint. The guide on molecular descriptors versus fingerprints covers the choice.
- A learning algorithm that finds the relation between the two, from ordinary least squares to random forests and neural networks.
Most disappointments trace back to the first part. If half the values come from one assay and half from another, or if the same compound appears three times under three spellings, the model will faithfully learn the noise.
A worked example with the ESOL solubility set
The ESOL data set, published by Delaney in 2004 and distributed with MoleculeNet as delaney-processed.csv, holds measured log solubility in mol/L for roughly one thousand organic compounds. Delaney's own model was a linear equation in four quantities: a calculated logP, molecular weight, the number of rotatable bonds and the proportion of heavy atoms that are aromatic. Higher logP and a higher aromatic proportion push solubility down, which matches what a bench chemist expects of greasy, flat molecules.
You can rebuild a model of that kind in a few lines with RDKit and scikit-learn.
import pandas as pd
from rdkit import Chem
from rdkit.Chem import Descriptors, rdMolDescriptors
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_score
df = pd.read_csv("delaney-processed.csv")
def features(smiles):
mol = Chem.MolFromSmiles(smiles)
heavy = mol.GetNumHeavyAtoms()
aromatic = sum(atom.GetIsAromatic() for atom in mol.GetAtoms())
return [
Descriptors.MolLogP(mol),
Descriptors.MolWt(mol),
rdMolDescriptors.CalcNumRotatableBonds(mol),
aromatic / heavy,
]
X = [features(s) for s in df["smiles"]]
y = df["measured log solubility in mols per litre"]
scores = cross_val_score(LinearRegression(), X, y, cv=5, scoring="r2")
print(scores.mean())
The printed value is a cross-validated R², the honest estimate, because each fold is scored on compounds the model did not see during fitting. Fitting and scoring on the same compounds would give a higher and misleading number. The coefficients of the fitted model are also readable, which is the main strength of a small descriptor model: you can see why it predicts what it does.
Where QSAR came from
Hansch and Fujita fitted equations relating biological activity to substituent constants and lipophilicity in the 1960s. The idea was that a few physical properties of a substituent explain a potency trend across a series. Modern QSAR keeps that logic but allows thousands of inputs and nonlinear learners, which makes validation much more important. With enough inputs and a flexible learner, a model can fit any set of numbers, including random ones.
What a QSAR model can and cannot tell you
A model can rank a virtual library, flag likely poorly soluble molecules before synthesis, or prioritise compounds for an assay. It cannot explain a mechanism by itself, and it cannot be trusted outside the chemistry it learned from. The OECD guidance on validating QSAR models asks for a defined endpoint, an unambiguous algorithm, a defined applicability domain, appropriate measures of fit and predictivity, and a mechanistic interpretation where possible. Those principles are a good checklist for any model, regulatory or not.
A few honest limits follow.
- The model predicts the property as the training assay measured it. A solubility model trained on kinetic data does not predict thermodynamic solubility.
- Experimental error sets a ceiling. If repeat measurements of the same compound differ by half a log unit, no model can be much better than that.
- Similar inputs give similar outputs by construction, so the model struggles with activity cliffs.
A sensible workflow
Start by cleaning structures, because a salt, a tautomer or a stereoisomer written differently can duplicate a compound. The guide on canonical SMILES explains why. Then choose a split that matches how the model will be used, as described in train and test splits in chemistry. Fit a simple baseline first, such as a ridge regression or a random forest. Evaluate with metrics that match the decision, as in evaluating a QSAR model. Only then try something more elaborate.
If you work with solubility, the descriptor logic connects to the physics. The guide on logP versus logD explains why the lipophilicity input matters and when it must account for ionisation. QSAR training and prediction on your own table is available in Advanced Modeling, which is useful for a quick baseline before you decide whether a larger model is worth the effort.
Key points
- QSAR maps structure-derived numbers to a measured endpoint and predicts it for new molecules.
- Data quality, representation and validation each decide whether the model is useful.
- A small descriptor model on ESOL is a good first exercise because it is both accurate enough to learn from and readable.
- Always report cross-validated or held-out performance, never the fit on the training set.
- A prediction outside the training chemistry is an extrapolation and should be labelled as one.
Questions people ask
- What does QSAR stand for?
- QSAR stands for quantitative structure-activity relationship. When the predicted quantity is a physical property such as solubility instead of a biological activity, the same approach is often called QSPR, quantitative structure-property relationship.
- Is QSAR the same as machine learning?
- QSAR is the task, and machine learning is one family of tools for it. A QSAR model can be a two-term linear regression or a graph neural network. What makes it QSAR is the pairing of structure-derived inputs with a measured endpoint.
- How much data do I need to build a QSAR model?
- There is no fixed number. A linear model on a handful of descriptors can be informative with a few dozen congeneric compounds, while a fingerprint model across diverse chemistry needs hundreds or thousands of measurements. What matters more is that the data cover the chemistry you want to predict and come from one comparable assay.
- Can a QSAR model predict a completely new scaffold?
- Only weakly. A model learns from the regions of chemical space it has seen, so predictions for a scaffold far from the training set are extrapolations and should be flagged, not trusted.
Further reading
- Delaney, ESOL, estimating aqueous solubility directly from molecular structure (2004)
- Tropsha, Best practices for QSAR model development, validation and exploitation (2010)
- RDKit documentation, getting started in Python
In practice: Advanced Modeling trains and applies QSAR models; the AI Foundry runs or fine-tunes ChemBERTa, MoLFormer-XL and Chemprop on a CSV, as a preview. Validation is the user's responsibility, and these guides show how.