MolBasis
duplicatesdata-cleaninginchikeydatasetleakage5 min read

Duplicates and conflicting measurements in property datasets

Duplicates and conflicting measurements inflate every metric. Here is how to find them with InChIKeys, how to merge or drop them, and what to report.

Updated November 28, 2026

Duplicates and conflicting measurements are the most common defect in a property dataset, and the one that most inflates a reported figure. Two rows for the same molecule split across train and test let the model see the answer in advance. Two rows with different values for the same molecule put noise into the target that no descriptor can explain. Finding them takes a canonical identifier, a grouping step and a written rule. Here is the method, with a worked example and the numbers to report.

How duplicates get in

Datasets are built by merging sources, and sources name molecules differently. The same compound arrives as a trade name, a systematic name and a registry number, each with its own SMILES. One SMILES is written with explicit hydrogens, another aromatic, another as a Kekulé structure. One row is the free base, another the hydrochloride. One row has a defined stereocentre, another has none. Tautomers are drawn two ways. A string comparison sees ten molecules where chemistry sees one.

Conflicts arrive the same way. A melting point from a supplier catalogue reads 121 to 123 °C, a handbook says 122 °C, and a paper that measured a different polymorph says 115 °C. A solubility measured at pH 7.4 sits next to an intrinsic solubility of the same acid. A value in g/L is copied into a column of mol/L. The Bradley melting-point guide shows these patterns in a real set.

Finding them with a canonical key

Use a key that ignores how the molecule was drawn. The InChIKey is the usual choice. Its first block of fourteen characters encodes the skeleton and connectivity without stereochemistry, charge or isotopes, so two rows that differ only in a drawn stereocentre or a counter-ion share it. Before computing the key, strip salts to the largest fragment and neutralise charges with a defined rule. Then group rows by the first block.

from rdkit import Chem
from rdkit.Chem.MolStandardize import rdMolStandardize
import pandas as pd

df = pd.read_csv("dataset.csv")  # columns smiles, y
chooser = rdMolStandardize.LargestFragmentChooser()
uncharger = rdMolStandardize.Uncharger()

def key14(smiles):
    mol = Chem.MolFromSmiles(smiles)
    if mol is None:
        return None
    mol = uncharger.uncharge(chooser.choose(mol))
    return Chem.MolToInchiKey(mol)[:14]

df["key"] = df["smiles"].map(key14)
groups = df.groupby("key")["y"].agg(["count", "median", "min", "max"])
groups["spread"] = groups["max"] - groups["min"]

The grouped table shows how many rows each molecule has and how far apart its values sit. That table is the thing to inspect before any model is fitted. The MolBasis record uses the same InChIKey first block to group molecules in its leave-one-out procedure, which is how it keeps one molecule on one side of every fold. The guide on grouped cross-validation explains why that matters.

A worked example

A compound has three log S values, −2.10, −2.25 and −3.40. The mean is (−2.10 − 2.25 − 3.40) / 3 = −2.58. The median is −2.25. The spread is 1.30 log units. A spread that large is not measurement noise. One value was probably taken at a different temperature, at a different pH, or with a units error. Averaging it in moves the target by a third of a log unit toward a value that may be wrong. The better rule is to flag the group, go back to the sources, and either drop the outlying value with a reason or drop the compound.

Now apply a threshold. Keep groups whose spread is at most 0.5 log units for solubility, or at most 5 °C for melting point, and take the median. Flag the rest for review. Choose the threshold before looking at the model's performance, write it down, and report how many compounds it removed. A threshold chosen after seeing results is a form of feature selection on the target.

How duplicates inflate a metric

A random split places two rows of one molecule on opposite sides with probability close to one half. The model then predicts a test value it has already memorised. For a flexible model this is a direct leak. For a two-coefficient equation the leak is smaller, because two coefficients cannot memorise a point, but the duplicated molecule still counts twice in the metric and the search over descriptors and exponents still sees it twice. The guide on random splits and leakage quantifies the effect. A scaffold split removes it, since all rows of one molecule share a scaffold and move together. Sheridan's time-split work makes the related point that the molecules a project measures next are rarely independent of the ones it already has.

What to report

State the identifier used, the salt and charge rule, the number of rows before and after, the number of molecules with more than one row, the aggregation rule and the threshold, and the number of compounds dropped as conflicts. Five numbers and three sentences. A reader who has them can reproduce the training set. A reader who does not cannot tell a clean set from a leaky one. The guide on reporting a QSPR result honestly includes these items in its checklist.

Key points

  • Duplicates arrive through naming, salts, stereo, tautomers and drawing conventions. Compare molecules by the InChIKey first block after stripping salts.
  • Conflicts arrive through temperature, pH, polymorph and units. Group by key and look at the spread before fitting.
  • Take the median of groups within a stated spread, flag the rest, and choose the threshold before seeing results.
  • Duplicates across a random split leak the answer and count twice in the metric. A scaffold split keeps all rows of a molecule together.
  • Report the identifier, the rule, the threshold and the counts removed.

Questions people ask

How do I find duplicate molecules in a property dataset?
Strip salts to the largest fragment, neutralise charges with a fixed rule, compute the InChIKey and group rows by its first fourteen characters. That block encodes skeleton and connectivity without stereochemistry or charge, so rows that differ only in drawing, counter-ion or a drawn stereocentre fall together.
Should I average conflicting measurements of the same compound?
Only when they agree within a stated spread, such as half a log unit for solubility or five degrees for melting point. Take the median of those. Flag groups with a wider spread, go back to the sources, and drop the outlying value with a reason or drop the compound.
How do duplicates inflate model metrics?
A random split puts two rows of one molecule on opposite sides about half the time. The model then predicts a value it has already seen, and the molecule counts twice in the metric. A scaffold split keeps all rows of a molecule together because they share a scaffold.
What should I report about duplicate handling?
The identifier used, the salt and charge rule, the number of rows before and after, the number of molecules with more than one row, the aggregation rule with its threshold, and the number of compounds dropped as conflicts. With those a reader can rebuild the training set.

Further reading

In practice: The datalake page lists the datasets named in the research record, their coverage as reported and what is known about their licences. No dataset is redistributed by this site.

See the kernels themselves

Every kernel is shown with its held-out result, the number of molecules it rests on and what it cannot be trusted for.