Y. DONG · FSU
01 / 16
scroll · ↓ · space   |   press N for notes
Guest Lecture · Department of Chemistry

When AI Suggests a Molecule That Cannot Exist

A machine doing matched molecular pair analysis — and what it hands back.

Yushun Dong  ·  Florida State University
He, Zheng, Soga, Zhu, Dong & Li. Findings of the Association for Computational Linguistics: EMNLP 2024, 7079–7096.
these slides
The tool this talk is about

A graph neural network — a GNN — predicts a property straight from the structure.

What you draw on paper is already a graph: atoms are the nodes, bonds are the edges. A GNN lets each atom ask its neighbours who they are, twice over — so each atom ends up knowing its environment two bonds out. The same logic as a chemical shift. Pool the atoms, and out comes one word: toxic or not, active or not.

Structure of 2-(2-naphthylmethyl)-4,5-dihydro-1H-imidazole.
one molecule from Tox21 — to a GNN, this is nodes and edges
99.4AIDS activity
76.2mutagenicity
85.0brain barrier
78.3clinical tox.
97.4Tox21

% correct on molecules the GNN never saw in training — the five datasets used throughout this talk

Why an explanation is needed at all

The GNN says: “crosses the blood–brain barrier, confidence 0.87.”
Would you spend three months making it?

Highlight it

“This ring is why.” Colour on a structure. It does not tell you what to make next.

Change it

“Replace this carbonyl with a hydroxylamine and the GNN would say non-toxic.” That is an experiment you can run.

A molecule labelled non-AIDS drug and the edited version the GNN labels AIDS drug.
one atom changed, one atom and bond added — the GNN's answer flips
You have been doing this for years

A compound is inactive. You swap one group. Activity goes up. You conclude that group mattered.

That is a matched molecular pair. This paper is about getting a machine to do it to a GNN — and everything that follows is graded with the three words in the right-hand column.

What you already doWhat the paper calls it
the starting compoundinput graph G
swap a groupperturbation
the compound you end up withcounterfactual Ĝ
the activity flippedValidity higher is better
you only changed a littleProximity lower is better
the new thing can existFeasibility
The two rulers, and why they fight

Validity — did it flip?

Of the molecules the GNN called negative, how many does it now call positive. Here 40 of 100.

Proximity — how much did you change?

Count what differs between the two structures — atoms swapped, bonds added or removed, bond orders changed — and average it. Close to what you mean by “a small change”.

Why insist on small? Without it the task is trivial: throw the molecule away, hand back a known active, and the label flips. That is not an explanation. That is a different compound.

The two pull against each other: change less and the label will not flip. Every technical decision in this paper lives on that trade-off.

What the experiment actually is

For every molecule the GNN calls negative, ask for the smallest edit that makes the GNN say positive.

“The GNN says this molecule is not an AIDS drug. Change as little as you can so that it says it is.”

Asked for every negative molecule — five datasets, roughly 2,000 molecules each (ClinTox 478). What comes back is what gets scored.

Validity w/o Feasibility CheckValidity w/ Feasibility CheckGNNExplainer100.000.00CF-GNNExplainer100.000.00CLEAR100.001.33RegExplainer100.000.00

The gate: run each answer through RDKit; wrong valences do not count. The bar is low — it checks valence, not ring strain or whether anyone could synthesise it.

Why the second column collapses

That first example was not a molecule.

The atom the method changed is a neutral nitrogen carrying two ring bonds and a double bond to oxygen — four bonds. RDKit rejects it on sight.

The GNN, meanwhile, was perfectly happy: it did change its answer to “AIDS drug”. So it counts as a success — until you ask whether the thing can be made.

Close-up of the generated counterfactual with the substituted nitrogen highlighted in pink.
the same example from earlier, up close — the pink atom is the edit, and the problem
The obvious idea  ·  and a clean failure

Why not just ask GPT-4?

  • 01It has read the chemical literature. It knows a carbonyl from a hydroxylamine.
  • 02It answers in words, not in a matrix.

The authors tried exactly that: “make the smallest change to this SMILES so the molecule becomes active. Output SMILES only.”

0validity, all five datasets

GPT-3.5 refused outright. GPT-4 produced SMILES — and not one of them was a successful counterfactual.

It can talk chemistry. It cannot draw a molecule: a SMILES string is just characters to it, with no structure behind them.

Commander, not soldier.

How it is put together  ·  this diagram is the training loop, not a query
language modelGPT-4 writesone sentenceper moleculeGPT-3.5 swapsone groupan encoder, thena decoder, drawthe moleculethe GNNscores itthe score goes back into the next prompt
  • 01Before training, once: GPT-4 writes one sentence per molecule, in a locked format — only the group names vary.
  • 02During training, for every molecule: propose a swap, draw it, score it with the GNN, feed the score back. Three rounds every epoch.
  • 03What comes out is not a chatbot. It is the set of counterfactual molecules — and those are what get measured.
The trick that makes it work

One word changes in the sentence. That points at a molecule nobody has ever seen.

the sentence… the carbonyl may be themost influential for this property.… the hydroxylamine …the same space the structures live inthe original moleculewhere the new sentence points

Train until a molecule's description and the molecule's structure land in the same place. Then swap one word. The new sentence lands somewhere else — and that somewhere is where the counterfactual should be. The decoder walks towards it.

Keeping it honest

The score comes from the GNN, not from the language model grading itself.

Write the new molecule out, let the GNN score it — 0.4 — and put that number in the next prompt: “change one group to raise it.”

A marked exam, not self-assessment. Two rounds is where it saturates; more rounds can make the hallucination worse.

The feedback loop: the generated molecule is written as SMILES, scored by the GNN, and the score returns to the language model.
Result 1  ·  are they real molecules?

Flipping the GNN is easy — all five do it every time. The question is what survives the chemistry check.

Validity w/o Feasibility CheckValidity w/ Feasibility CheckGNNExplainer100.000.00CF-GNNExplainer100.000.00CLEAR100.001.33RegExplainer100.000.00LLM-GCE100.0030.86ClinTox — % of the negative molecules, before and after the RDKit check

Because every method flips the label 100% of the time here, the right-hand number is the share of flipped molecules that could actually be made. For the existing methods that share is essentially zero.

Result 2  ·  the same check, dataset by dataset

Every point here had to do both: flip the GNN's answer and pass the chemistry check.

strongest existing methodLLM-GCE10203040Mutagenicity4.8913.52BBBP9.5638.25ClinTox1.3330.86Tox210.003.70Validity with Feasibility Check (%) — higher is better

Better on every dataset here. On ClinTox it is more than twenty times the strongest existing method; on Tox21 nothing else produced anything at all.

Result 3  ·  proximity, on the same surviving counterfactuals

Flipping the label is only half of it. How much of the molecule survived?

strongest existing methodLLM-GCElog scale110100Mutagenicity406.42 · CLEAR1.75BBBP16.06 · GNNExplainer11.68ClinTox50.10 · CLEAR0.95Tox21no existing method produced one at all5.93how far the counterfactual sits from the original molecule — lower is better

Two orders of magnitude apart on some sets — the baselines mostly redraw the molecule. Tox21 has no grey point because no existing method produced a single counterfactual that both flipped the label and could exist.

One molecule from ClinTox, three structures

The question all three answer: the GNN puts a in the negative class for ClinTox's toxicity label. What is the smallest edit that makes the GNN say positive? b and c are two methods' answers to that one question.

a

the original molecule — a steroid

The original steroid molecule from ClinTox.
b

this method's answer. The four fused rings are still there. Distance from a: 16.5

This method's counterfactual, keeping most of the steroid core.
c

an existing method's answer. Nothing of a is left. Distance: 24.4

A baseline counterfactual which is an entirely different compound.

The smaller the distance, the more the explanation is still about the molecule you started from. At c you learn nothing about what was wrong with a.

Take away
  • 01On its own, neither model can do a matched molecular pair. The GNN does not care whether the molecule exists; the language model cannot put a structure into SMILES properly.
  • 02Make the edit in words, in the shared space, then map it back to a structure. That one move improves all three measures at once: more of the answers can actually exist, more of them flip the label, and less of the molecule has to change.
  • 03There is no final answer yet — which is exactly what makes this worth working on.

The whole point was explanations a person can understand — and there is no human evaluation anywhere in the paper. It is listed as future work. You are the people who could do it.

slides

Thank you.
He, Zheng, Soga, Zhu, Dong & Li. Findings of the ACL: EMNLP 2024, 7079–7096.
Code & data: github.com/YinhanHe123/new_LLM4GNNExplanation