Skip to content

Model card: MolMini

Overview

MolMini converts a raster image of a 2D chemical structure diagram into a canonical SMILES string. It is an encoder-decoder trained from scratch: a convolutional stem and 2D-RoPE transformer encoder over the image, and a causal transformer decoder that cross-attends to the encoder and emits atom-level SMILES tokens.

preset parameters input encoder decoder
tiny 3.6 M 256 px conv stem + 3 blocks, d=192 3 blocks, d=192
small 12.1 M 320 px conv stem + 4 blocks, d=288 5 blocks, d=288
base 23.8 M 384 px conv stem + 4 blocks, d=384 6 blocks, d=384

Input: single-channel grayscale, any size (resized internally). Output: a SMILES string, canonicalized through RDKit; unparseable output is reported as such rather than silently repaired.

Intended use

Reading single-molecule structure diagrams into machine-readable form — literature and patent digitization, lab notebook capture, dataset construction. It is designed to run on a laptop with no accelerator beyond Apple MPS.

Out of scope

  • Markush structures and R groups. Not in the training corpus, not rendered.
  • Reaction schemes and multi-molecule pages. One molecule per image is assumed; there is no page segmentation step.
  • Molecules outside the declared scope (see below). Predictions outside it are unconstrained, and the reported accuracy does not transfer.
  • Anything safety-critical without human review. A wrong SMILES is a different molecule, and the model gives no reliable signal that it is wrong: a confident score accompanies incorrect predictions as readily as correct ones.

Declared scope

constraint value
heavy atoms 4 to 48
elements B, Br, C, Cl, F, I, N, O, P, S, Se, Si
formal charges allowed
multi-fragment (salts, .) excluded
SMILES length cap 160 atom-level tokens

Training data

ChEMBL 37 (CC BY-SA 3.0), curated to the scope above: 2,628,559 molecules kept of 2,897,819 read. Depictions are generated on the fly by RDKit with randomized layout engine, rotation, bond width, font, atom palette, condensed abbreviations and drawing style, then corrupted with blur, downscaling, JPEG artifacts, perspective warp, paper texture, speckle and stroke morphology.

The augmentation distribution is effectively part of the specification: a depiction convention or degradation mode absent from it is out of distribution at inference regardless of how long the model trained.

Leakage control. All 5,088 DECIMER hand-drawn evaluation molecules were subtracted from the training corpus by canonical SMILES before splitting; 210 were present and removed. Train/val/test splits are disjoint by canonical SMILES and asserted at build time.

Evaluation

Frozen image sets, fixed seed, three difficulty tiers (clean, varied, degraded) plus the DECIMER hand-drawn set as an out-of-distribution test. Scoring is validated by an oracle that must reach exactly 1.000, and calibrated against a nearest-neighbour memorization floor that scores 0.000.

Metrics: canonical exact match (headline), stereo-blind exact match, molecular formula match, Morgan Tanimoto, and normalized token edit distance. Results in reports/.

Known failure modes

  • Hand-drawn input. RDKit's comic mode approximates wobbly strokes but not human line breaks, inconsistent bond lengths or misplaced labels.
  • Stereochemistry. Wedge/hash reading is the single largest error category for OCSR models generally; for reference, 32% of MolScribe's failures on the same frozen set are stereo-only.
  • Large molecules. Accuracy declines monotonically with heavy-atom count.
  • Degraded images. The corruption tier costs substantially more than style variation alone.

Compute and environment

Trained on a single NVIDIA A100 / RTX 6000 Ada. Inference targets a 16 GB Apple M3 and needs only PyTorch and RDKit. Measured inference cost is reported in reports/latency_*.json alongside the machine it was measured on — latency figures from different hosts are not comparable.

Reproduction

docs/REPRODUCE.md carries every command. docs/DECISIONS.md records the rationale for each design choice with the measurement behind it, including the encoder-collapse failure that cost a training run and the guards added against it.