Guides / QSAR and machine learning

activity-cliffssimilaritysar

Activity cliffs, where similar molecules differ in potency

An activity cliff is a pair of very similar compounds with a large potency gap. Learn how to detect cliffs and why they limit QSAR models.

Updated 4 min read

An activity cliff is a pair of structurally similar compounds with a large difference in potency against the same target. They matter because nearly every similarity-based method, from nearest-neighbour search to a QSAR model, assumes that similar molecules behave alike. At a cliff that assumption fails, and the model's error can be as large as the potency gap itself.

Defining a cliff in numbers

A cliff needs two thresholds, one for similarity and one for potency. Studies by Stumpfe and Bajorath often define similarity through matched molecular pairs, two compounds that differ at a single site, and use a potency difference of at least two log units, a factor of 100. Others use a fingerprint similarity cut-off, such as a Tanimoto coefficient of 0.85 on ECFP4 as discussed in Morgan fingerprints and the Tanimoto coefficient. Neither choice is canonical, and the number of cliffs found in a data set depends strongly on both.

The structure-activity landscape index (SALI) of Guha and Van Drie folds the two into one number per pair: the absolute potency difference divided by one minus the similarity. A pair with high similarity and a big gap scores very high, and it is easy to rank pairs by it.

Maggiora's 2006 paper set out the problem for the field. He pointed out that QSAR assumes a smooth landscape, and that cliffs are the places where the landscape is rough, and that these roughnesses are where models perform worst.

Why a single change can matter

The potency of a ligand depends on interactions with a particular binding site. A small change can add or remove a hydrogen bond, push a group into a clash, force a different ring conformation, change the protonation state, or shift the molecule between two binding modes. Binding free energy is a sum of large terms of opposite sign, and a small structural change can tip the balance by several kilojoules per mole, which is already a ten-fold change in affinity.

Cliffs also arise for reasons that have nothing to do with the target. A compound might be racemic in one report and a single enantiomer in another, or measured under different assay conditions. Potencies from papers are not always comparable, which is why the checklist in reading potency values from abstracts is worth following before you call a pair a cliff.

Finding cliffs in your own data

import itertools
import pandas as pd
from rdkit import Chem, DataStructs
from rdkit.Chem import rdFingerprintGenerator

gen = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048)
fps = [gen.GetFingerprint(Chem.MolFromSmiles(s)) for s in df["smiles"]]
pic50 = df["pic50"].to_numpy()

rows = []
for i, j in itertools.combinations(range(len(fps)), 2):
    sim = DataStructs.TanimotoSimilarity(fps[i], fps[j])
    delta = abs(pic50[i] - pic50[j])
    if sim >= 0.85 and delta >= 2.0:
        rows.append({"i": i, "j": j, "similarity": sim, "delta_pic50": delta})

cliffs = pd.DataFrame(rows)
print(len(cliffs))

Pairwise comparison grows with the square of the number of compounds, which is fine for thousands and slow for hundreds of thousands. Use BulkTanimotoSimilarity or a neighbour search to speed it up. Then inspect each pair by eye. The two structures drawn side by side usually tell you at once whether the difference is real chemistry or a data problem.

What cliffs do to models

A model that smooths over similar inputs predicts the two partners at about the same value, so the error is half the potency gap on each partner at best. Several results from the literature report that machine learning models do worse on compounds involved in cliffs than on the rest, and that deep models are not exempt. Treat that as a general tendency and check it on your own data instead of assuming a size.

You can measure the effect directly. Take the held-out predictions of your model, select the compounds that belong to a cliff pair, and compute the error on them separately from the error on the rest. A good model report states both numbers. If a model must rank close analogues, which is the typical use in lead optimisation, a score computed only on cliff pairs says more than a global R².

Working with cliffs instead of against them

Cliffs are also information. A pair with a large gap is a small experiment that isolates one structural change, which medicinal chemists use to learn what the target cares about. Docking or short simulations can sometimes explain a cliff by showing a changed contact, although docking scores are not affinities and should not be used as proof.

For modelling, three practices help. Keep the pair together in a split so that one partner does not leak the answer for the other, as discussed in train and test splits in chemistry. Flag predictions for compounds whose nearest training neighbours have very different activities, which is a local roughness measure related to the applicability domain. And report uncertainty wide enough that a user does not mistake a smooth prediction for a promise.

Key points

Questions people ask

What is an activity cliff?
An activity cliff is a pair of structurally similar compounds that act on the same target and differ greatly in potency. A commonly used criterion pairs a high structural similarity with a potency difference of two log units, which is a factor of 100.
Why are activity cliffs a problem for machine learning?
Most models assume that similar inputs give similar outputs. A cliff breaks that assumption, so models tend to predict the two partners as nearly equal and make a large error on at least one.
Are activity cliffs real or experimental noise?
Both happen. Some cliffs reflect true changes such as a lost hydrogen bond or a clash, and others come from comparing data measured in different assays or from errors in the record. Check the source of both values before interpreting a cliff.
How do you find activity cliffs in a dataset?
Compute pairwise similarity, for example Tanimoto on ECFP4 or matched molecular pairs, and list pairs above a similarity cut-off whose potency differs by a large factor. The structure-activity landscape index combines the two into a single number per pair.

Further reading

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.

← All guides