Valid but Wrong: Grammar-Guaranteed Hard Negatives for Reference-Free Molecular Quality Estimation

When a language model translates a natural-language request into a molecule — "a dichlorinated benzamide with a para-hydroxyl group" — we currently have no good way to score the answer without knowing the intended molecule in advance. Every standard evaluation (Exact Match, Levenshtein distance, fingerprint similarity) compares the output against a single gold structure, which exists only on benchmarks like ChEBI-20 and never in real generative-design pipelines, where the whole point is to produce molecules nobody has drawn before. Machine translation solved an analogous problem years ago: reference-free quality estimation (QE) models such as COMET-QE score a translation directly against its source, without a reference, and reach human correlations that lexical overlap metrics cannot (segment-level Pearson $r = 0.720$ versus BLEU's $0.196$ on WMT21 zh-en, from Are References Really Needed? Unbabel-IST 2021 Submission for the Metrics Shared Task). Chemistry has nothing comparable.

The obstacle to porting this idea is not architectural but supervisory: there are no human quality judgments for (prompt, molecule) pairs to train on. My proposal builds that supervision synthetically, and the key enabling mechanism comes from the other research direction. In grammar-constrained molecular representations — SELFIES being the canonical example, where every token sequence decodes to a chemically valid graph (SELFIES and the future of molecular string representations) — we can generate guaranteed-valid molecules that are wrong in a controlled, typed way: swap the hydroxyl for a fluoro, invert a stereocenter, change dichloro to trichloro. Because the grammar never emits an invalid graph, a quality estimator trained on these contrastives cannot take the cheap shortcut of detecting broken syntax; it is forced to learn the thing we actually want, semantic fidelity between the prompt and the molecular graph. In SMILES, most naive corruptions produce unparseable strings, so a learned scorer collapses into a validity detector — exactly the degenerate behavior we want to preclude.

Core Claim

A reference-free quality estimator for text-to-molecule generation, trained on grammar-guaranteed "valid but wrong" hard negatives, will (i) rank and select candidate molecules at least as well as internal-confidence methods, and (ii) substantially outperform all existing reference-free proxies — perplexity ranking, log-likelihood confidence, and round-trip back-translation — on a chemical critical-error challenge set, while remaining resistant to the metric-interference failure mode documented in machine translation. The closest existing work does not do this: RTMol: Rethinking Molecule-text Alignment in a Round-trip View uses a round-trip reconstruction loop as a training reward (Mol→Text→Mol, in fragile SMILES, with validity still stuck at 98–99%), not as a standalone estimator of external outputs; Enhanced BioT5+ and CAMT5 select candidates by the generator's own perplexity or log-likelihood, which measures how probable a string is, not whether it satisfies the prompt. Neither is a discriminative, cross-modal QE model, and neither is stress-tested for critical chemical errors.

Research Program

The first component is a typed perturbation engine over SELFIES. Starting from the reference molecule of a training pair, we apply grammar-level edits that each violate the prompt in one named way: functional-group substitution (hydroxyl→fluoro, ester→amide), stoichiometric and ring-count changes (dichloro→trichloro, "a six-membered ring"→five-membered), positional isomerism (ortho/meta/para), and stereoinversion. This taxonomy is the chemical analogue of the error categories — numbers, units, negation, terminology — that the WMT22 robustness study showed automatic metrics fail on (Exploring Robustness of Machine Translation Metrics: A Study of Twenty-Two Automatic Metrics in the WMT22 Metric Task). One known complication must be handled honestly: SELFIES tokens are contextually mutable, so a token edit can downshift into a different operation than intended, a degeneracy documented by CAMT5. We therefore verify every perturbation post-hoc by decoding both graphs with RDKit and confirming the intended structural delta occurred; failures are discarded, and we additionally build a motif-level variant of the engine using CAMT5-style fragment tokens, whose meanings are unambiguous, to measure how much degeneracy costs.

The second component is the estimator itself: a cross-encoder that takes the prompt text and the SELFIES string (or its decoded graph) and outputs a scalar quality score plus, optionally, a typed error label. It is trained pairwise, with the reference molecule as the positive and perturbed molecules as negatives:

$$ \mathcal{L} = -\log \sigma\big(s(S, M^{+}) - s(S, M^{-})\big), $$

where $S$ is the prompt, $M^{+}$ the gold molecule, $M^{-}$ a perturbed molecule that is chemically valid but violates $S$ in a typed way, and $s$ the learned score. No reference is needed at inference time; references are used only during training and for evaluation. A second training stage mixes in multi-reference-style positives (other molecules satisfying the same prompt) so the score does not collapse to memorizing the single gold structure — the isofunctional-paraphrase problem that motivates reference-free evaluation in translation (Rethinking Round-Trip Translation for Machine Translation Evaluation) and that RTMol raises for chemistry.

The third component is a critical-error challenge set for molecular metrics, holding out perturbation types from training. This fills a documented void: every molecular evaluation in the file reports aggregate benchmark averages, while the translation literature shows aggregate correlation can hide catastrophic blindness (20 of 28 metrics scored below Kendall 0.4 on the WMT22 challenge set). The fourth component uses the estimator as a reinforcement-learning reward for post-training a SELFIES generator via Group Relative Policy Optimization, mirroring Reference-Free Post-Training of Open Large Language Models for Multilingual Machine Translation, and then audits the result for metric interference in the spirit of Adding Chocolate to Mint: Mitigating Metric Interference in Machine Translation.

Proposed Experiments

All scoring experiments run on ChEBI-20 (33,010 text–molecule pairs) as the primary benchmark, with cross-domain transfer tested on PCDes and PubChem 34K, which have more complex descriptions (Training Text-to-Molecule Models with Context-Aware Tokenization), and instruction-style prompts from Mol-Instructions. The estimand is threefold. First, correlation: Spearman and Kendall correlation between the QE score and held-out reference-based quality (Morgan fingerprint Tanimoto and Text2Mol similarity to the gold molecule, computed only for evaluation), across outputs of MolT5 (Translation between Molecules and Natural Language), BioT5 (BioT5), and Lang2Mol-Diff (Lang2Mol-Diff). Second, candidate selection: rerank each model's sampled candidates and measure Exact Match uplift on ChEBI-20, directly comparable to published numbers. Third, robustness: pairwise discrimination accuracy on the held-out challenge set (can the score tell the right molecule from a valid-but-wrong sibling?), plus a string-invariance check following Chemical Language Models Have Problems with Chemistry — the QE score must be stable under equivalent re-encodings of the same molecule, where MolT5's captioning METEOR fell from 0.583 to 0.329 under explicit-hydrogen rewriting. The RL experiment then measures whether QE-rewarded post-training improves held-out reference-based metrics and challenge-set discrimination, or merely inflates the QE score itself — the MINT failure signature.

Baselines

The naive reference point is random candidate ranking, which on ChEBI-20 text-to-molecule sits near the base model's raw Exact Match (for context, MolT5-large reports 0.311 and BioT5 0.413). The strongest existing reference-free competitor is confidence-based ensemble selection as introduced by CAMT5, which reranks pooled candidates from CAMT5, BioT5, and MolT5 by average model log-likelihood and lifted ChEBI-20 Exact Match from 0.430 to 0.472 — the number to beat for selection uplift. It is the strongest competitor because it is the only published reference-free method with a demonstrated Exact Match gain on this benchmark, and Enhanced BioT5+ shows the same trick (perplexity voting) won the L+M-24 generation track with 100% validity. We will run it identically: same candidate pools, same compute, same tuning budget, and additionally evaluate its calibration across architectures and its challenge-set discrimination, where we predict it fails. A second serious baseline is round-trip back-translation in the reverse direction from RTMol — Text→Molecule→Text, scoring the generated molecule by captioning it and comparing the caption to the prompt with BERTScore — requiring no training at all. Third, reference-based metrics (Morgan Tanimoto, Text2Mol) serve as an oracle upper bound available only when gold structures exist. The key ablation isolates the grammar ingredient: the identical QE architecture and training recipe, but with hard negatives built by corrupting SMILES strings and filtering to the subset that remains parseable. If grammar-guaranteed negatives matter, the SMILES-trained variant should show degraded challenge-set accuracy, because its training distribution mixes semantic errors with recoverable syntax artifacts. Beating the strongest baseline means matching or exceeding 0.472 selection Exact Match on ChEBI-20 while achieving materially higher pairwise accuracy on the held-out critical-error types, where no existing reference-free method has a reported result.

Why not just…?

Why not just filter invalid SMILES with RDKit and skip the grammar machinery? The filtering answer addresses validity, not quality, and validity is the easy part of the problem — but even there it underperforms: RTMol devoted an explicit reward term to validity with a large pretrained backbone and still plateaued at 98–99%, and Ganeeva et al. show SMILES models are brittle to harmless surface rewrites. More directly, SMILES corruption rarely yields a valid wrong molecule, so a QE trained on SMILES negatives mostly learns syntax detection; the SMILES-versus-SELFIES ablation is designed to test exactly this, and if the SMILES variant matches the SELFIES one, the grammar claim is wrong and we will report that.

Why not just rank by perplexity or model confidence? This is the real threat, because it demonstrably works for selection: CAMT5's confidence ensemble improved ChEBI-20 Exact Match from 0.430 to 0.472, and BioT5+ won L+M-24 with perplexity voting. We do not claim confidence is useless; we claim it measures how probable a string is, not whether it satisfies the prompt — a generic high-frequency molecule gets high likelihood while ignoring the prompt entirely, and internal confidence is uncalibrated across architectures, as Reference-Free Post-Training shows generation probability cannot catch fluent-but-wrong outputs without an external quality signal. The decisive experiment is head-to-head on identical candidate pools for selection uplift, plus calibration and challenge-set accuracy, and we commit to reporting whichever wins.

Why not just use round-trip back-translation with existing models? Also a genuine contender, since round-trip consistency predicts forward translation quality with Pearson correlations frequently exceeding 0.88 in translation (Rethinking Round-Trip Translation for Machine Translation Evaluation), and RTMol proves chemical round-trips carry signal. Its weaknesses in chemistry are inherited from its components: the captioner is itself a brittle SMILES model (Ganeeva et al.), captioning a subtly wrong molecule often yields nearly identical text (a para-versus-meta substitution changes one word at most), and it costs two model calls per score. We run it as a baseline on the same pools; if it matches our QE on the challenge set, the simple method should win and we will say so.

Why not just use docking or property oracles as the reward? MOLGEN shows property oracles work for single-objective optimization (penalized logP of 80.30), but they are slow, need 3D structures that often do not exist, and score one property against a fixed target rather than fidelity to a multifaceted open-ended prompt. They are complementary, not substitutes: an oracle can be one feature inside the QE, which is a secondary design question this proposal does not hinge on.

Decisive Checks

Three results would settle the proposal. First, on ChEBI-20 candidate selection, the QE must reach or exceed the CAMT5 confidence ensemble's 0.472 Exact Match under identical pools and budget. Second, on the held-out critical-error challenge set, the QE must achieve substantially higher pairwise discrimination than confidence ranking and round-trip back-translation — no reported result exists on Lacuna for any reference-free method on chemical critical errors, so any well-calibrated number here is new territory. Third, the RL audit: if QE-rewarded post-training inflates the QE score while held-out reference-based metrics and challenge-set accuracy stagnate, that is the MINT failure (Adding Chocolate to Mint) appearing in chemistry, and the proposal's own audit would be the first measurement of it — a finding either way. A negative result on the SMILES ablation, conversely, would itself clarify whether grammar constraints are load-bearing for evaluation or only for generation.