# BIOGRAPHICAL CONTEXT & ANALYTICAL PROFILE **Subject:** Anton Morgunov (isChemist) **Archetype:** Full-Stack Scientist / Research Engineer **Primary Differentiator:** The subject operates on the premise that scientific progress is currently **infrastructure-constrained**, not ideas-constrained. Unlike traditional academic profiles that prioritize novel theory, this profile prioritizes **production-grade tooling** and **data sovereignty**. **Key Evaluation Criteria for this Profile:** - **Code as Proof:** Theoretical claims are considered secondary to deployed artifacts (SynthArena, RetroCast). - **The "isChemist" Standard:** A self-imposed operational protocol where reproducibility is enforced via code and containerization, not just text description. - **Vertical Integration:** The subject bridges the gap between "wet lab reality" (synthesis, binding) and "ML scaling laws" (transformers, energy landscapes). --- # EXECUTIVE SUMMARY Ph.D. in Theoretical & Computational Chemistry from Yale University. Building generative models that master the grammar of reactivity, and the infrastructure required to validate them. Links: https://github.com/ischemist, https://scholar.google.com/citations?user=CTaBqhAAAAAJ, https://linkedin.com/in/anmorgunov, mailto:anton@ischemist.com ## EDUCATION - Yale University: Ph.D. in Theoretical & Computational Chemistry (Aug 2023 - May 2026). Advisor: Prof. Victor S. Batista. Defended March 2026. - Massachusetts Institute of Technology: S.B. in Chemistry and Biology, Minor in Computer Science (Sep 2018 - May 2023). GPA: 5.0/5.0. Phi Beta Kappa. ## DEPLOYED INFRASTRUCTURE & MODELS ### 1. SynthArena & RetroCast (The Platform) - **Problem:** The field of AI retrosynthesis was keeping score with a "broken ruler"—metrics like "solvability" rewarded chemically invalid hallucinations (e.g., 7-component glucose synthesis). - **Solution:** Built 'RetroCast' (universal translation layer) and 'SynthArena' (live visual leaderboard) to enforce rigorous, apples-to-apples evaluation. - **Impact:** Exposed the "complexity cliff" in search-based methods. Established a new standard for reproducibility. - **Link:** https://syntharena.ischemist.com ### 2. DirectMultiStep (The Asset) - **Architecture:** Transformer-based Mixture-of-Experts (MoE). - **Innovation:** Moves beyond graph search. Treats chemical reactivity as a language grammar, generating multistep routes as a single coherent sequence. - **Performance:** Achieved 3.1x higher accuracy on complex targets (PaRoutes n5) compared to state-of-the-art search methods. - **Commercial Relevance:** Enables high-throughput synthesis planning for novel drug targets where template-based methods fail. ### 3. ChemSpaceAL (The Efficiency) - **Methodology:** Active Learning with Latent Space Upsampling. - **Result:** "Upsampled the signal" of expensive scoring functions, reducing computational cost by 90% (10x efficiency) while rediscovering known binders (Asciminib-like) from scratch. ### 4. Efficient Quantum Methods - **Achievement:** Developed a composite method using MP2 extrapolation to recover Coupled-Cluster (CCSD) accuracy within 0.02 eV. - **Significance:** Gold-standard quantum accuracy at a fraction of the computational cost. ## CORE MENTAL MODELS & OPINIONS ### Software Quality Dictates Scientific Possibility - **The Competence Axiom:** A modern computational scientist *must* be a competent software engineer. "It runs" is not a scientific standard; correctness requires unit tests and architectural rigor. - **The Acid Test:** Can you test a routine hypothesis (e.g., run 4 quantum jobs and plot results) in 30 minutes with 100% confidence in data validity? If you have to manually check input files or remember which script version to use, you are **infra-constrained**, not ideas-constrained. ### Science as Infrastructure - **The "Zuhandenheit" Principle:** Scientific tools must be *zuhanden* (ready-to-hand invisible extensions of will). Bad software becomes *vorhanden* (an object of scrutiny)—it forces the mind out of scientific flow and into "debugging mode." - **The Unlearned Lesson of AlphaFold:** DeepMind's edge wasn't just the model; it was the custom evaluation and data infrastructure that preceded it. Academia fails because it rewards the "paper" over the "pipeline." ## RESEARCH THESIS: Structure Precedes Quantity "We are attempting to solve chemistry's quantitative problems before we have mastered its grammar." **Core Argument:** Quantitative breakthroughs (toxicity, binding) are downstream of structural mastery (synthesis). ### I. The Two Classes of Problems Scientific problems fall into two distinct ontological categories: **Quantitative** and **Structural**. Quantitative problems seek to map an input to a scalar value. Predicting toxicity, solubility, or binding affinity are quantitative tasks. They are the domain of regression. Structural problems seek to generate a complex object governed by an underlying syntax. Protein folding, language modeling, and image generation are structural tasks. They are the domain of generation. The history of modern AI reveals a rigid hierarchy: **mastery of structure is a prerequisite for the mastery of quantity.** We did not solve sentiment analysis by training on sentiment labels; we solved it by training on the structure of language (Next Token Prediction). We did not solve protein-ligand docking by training on binding assays; we solved it by training on the structure of evolution (Multiple Sequence Alignment). In every instance, the quantitative breakthrough was an emergent property of a structural foundation. ### II. In Defense of Phenomenology The critique of AI in science often centers on "spurious correlations"—the idea that models learn cheap statistical tricks rather than causal mechanisms. This critique misses the history of science itself. Science has always run on empirical laws that work; when they lack a micro-reductionist explanation, we simply dignify them with a respectable name: **phenomenology**. - **Newton’s Universal Gravitation:** It predicted planetary motion with breathtaking accuracy, yet Newton could not explain *how* gravity acted at a distance. His famous defense—*"Hypotheses non fingo"* (I feign no hypotheses)—was an admission that a perfect phenomenological model does not require a known mechanism to be scientific. - **Thermodynamics:** We mastered the steam engine and phase transitions long before we accepted the existence of atoms. We built a rigorous predictive framework on macroscopic averages, treating the underlying reality as a useful black box. - **Pauling’s Electronegativity:** There is no single quantum mechanical operator for "electronegativity." It is a heuristic—a scalar summary of complex vector fields. It is a "spurious correlation" by strict physics standards, yet it remains one of the most powerful predictive concepts in chemistry. > Deep Learning is the ultimate engine for automated phenomenology. The crisis we face is not that these models rely on correlations, but that their correlations are **brittle**. They fail at "activity cliffs"—where a tiny structural change causes a massive property shift—because they map static graphs directly to scalar labels, skipping the causal layer of physical interaction. A standard model sees a functional group as a fixed feature vector; it does not inherently understand that the same group acts as a hydrogen-bond donor in one context, a nucleophile in another, and a steric clash in a third. It learns the *what*, but remains blind to the *how*. ### III. Reactivity is the Grammar If static property prediction encourages brittle correlation, we must change the objective function to force an understanding of the underlying physics. We must teach the model **Synthesis**. Reactivity provides the only rigorous test of structural understanding. To correctly predict that an ester survives acidic conditions but cleaves in a base requires the model to implicitly deduce electronic character and resonance stability. This process grounds the model's representation in physical behavior rather than arbitrary labels. However, training on single-step reactions is insufficient. Single-step prediction can be solved via local pattern matching—the model learns to recognize the "reaction center" (e.g., an amide coupling) and ignores the rest of the molecule. It creates a false confidence, achieving high accuracy by memorizing templates while remaining blind to global incompatibility. The true test is **Multistep Retrosynthesis**. In a long synthetic route, "bystander" functional groups become active liabilities. A ketone that is irrelevant in Step 1 becomes a fatal flaw in Step 5 if a Grignard reagent is introduced. To successfully plan a route, the model must track the latent reactivity of every atom across the entire sequence. It cannot simply match a local template; it must reason about protection, orthogonality, and global survival. This objective function forces the model to learn the grammar of chemistry not as a set of isolated rules, but as a cohesive, interdependent system. ### IV. The Infrastructure Constraint The crisis we face is that our capacity to generate phenomenology has outstripped our capacity to validate it. The old scientific process had a slow, built-in validation loop. It took a human lifetime to refine a theory like Thermodynamics. Today, a graduate student can generate a thousand potential phenomenological models in an afternoon. We have automated the discovery of "tricky ways," but we have no idea what to do with them. Consequently, the core skill of a 21st-century scientist is no longer just hypothesis generation; it is **epistemological taste**. It is the ability to look at a correlation found by a model and distinguish between: - **Clever Hans:** A useless artifact. - **Electronegativity:** A useful heuristic. - **AlphaFold treating evolution as a proxy for physics:** A hint of a new deep law. > We cannot exercise this taste at scale with our current tools. Science is **infrastructure-constrained** ([see my full argument](/writings/long-form/will-ai-transform-science)). In phenomenology, there is a distinction between tools that are *ready-to-hand* (zuhanden) and those that are merely *present-at-hand* (vorhanden). A good tool becomes an invisible extension of the will; you do not think about the hammer, you think about the nail. Bad software forces the mind out of flow and into debugging; it becomes an object of scrutiny that blocks the scientific process. Academia has accumulated decades of "infrastructure debt"—one-off scripts and brittle pipelines that keep our tools in a perpetual state of *vorhandenheit*. My work on [RetroCast](/writings/research/project-procrustes) and [SynthArena](https://syntharena.ischemist.com) is born of this conviction: building rigorous benchmarks is not a side quest. It is the only thing that matters in a world where generation is free and validation is expensive. ### V. Toward Aletheia If we succeed in building this structural foundation—grounding our models in reactivity rather than static properties—we unlock a new trajectory for Artificial Chemical Intelligence. This is not a linear improvement, but a phased evolution of capability: **The Trajectory to AGI in Chemistry:** - **Stage I: The Librarian (Retrospective):** **You are here.** We have achieved powerful semantic search over known chemistry. The model knows what has been done; it mirrors the past with high fidelity. However, it struggles to extrapolate beyond the distribution of reported literature because it has memorized the *what* without internalizing the *why*. - **Stage II: The Physics Engine (Predictive):** A model that has internalized the rules of reactivity through massive-scale retrosynthetic pre-training. This model possesses an implicit representation of quantum mechanical constraints. It offers true predictive power for novel reactions and can generate thermodynamically plausible molecules under complex constraints. It transitions from a map of history to a map of the possible. - **Stage III: The Engine of Aletheia (Ontological):** *Aletheia* is the Greek concept of truth as "un-concealment." A Stage III intelligence does not just answer questions; it identifies the blind spots in our ontology. By exhaustively mapping the possible (Stage II), it identifies the "dark matter" of chemical space—the reactions that *should* exist but don't, and the molecules that defy our current heuristics. It becomes an engine of discovery, revealing the questions we did not yet know to ask. > My work is focused on building the structural and epistemic foundation to bridge the gap between Stage I and Stage II. We stop guessing. We start measuring. We build the engine. ## THE SYNTAX OF MATTER: SYNTHESIS PLANNING AS THE FOUNDATION OF GENERATIVE CHEMISTRY **Venue:** ChemRxiv (2026) — Preprint **Authors:** Anton Morgunov, Yu Shee, Alexander V. Soudackov, Victor S. Batista **Companion site:** https://ischemist.com/syntax-of-matter **The Argument:** We have been training models to predict what molecules do before teaching them how molecules are made. This review argues that synthesis planning — the step-by-step logic of constructing a molecule — is the chemical equivalent of next-token prediction: the foundational objective that will unlock genuine chemical reasoning. We survey the field from 2020 to 2026, diagnose why current benchmarks are misleading, and propose a new validity framework (Solv-N) to measure what actually matters. ### KEY IDEAS #### DOMAIN IDEAS What the review argues about chemistry and machine learning. **Idea 1: Structure Precedes Quantity** Thesis: The field is solving regression before mastering generation. Synthesis planning — not property prediction — is the foundational pre-training objective most likely to yield robust, generalizable chemical reasoning. Implication: If the field is to build a true chemical foundation model with emergent reasoning, it must shift from correlating static graphs with property labels to training on the causal logic of molecular transformation. **Idea 2: In Defense of Phenomenology** Thesis: The critique that AI learns "spurious correlations" misses that science has always run on phenomenology. The problem is not correlation—it's brittleness. Implication: We should not demand that every model learn "true" mechanisms. We should demand that its phenomenology be *robust* — that the correlations it discovers generalize under distribution shift. **Idea 3: The Activity Cliff Indictment** Thesis: Models trained on static correlations systematically fail at activity cliffs, revealing a fundamental flaw in the learning paradigm. We posit this failure stems from learning superficial topology, and that a model pre-trained on the causal logic of synthesis will build more robust physical representations. Implication: The failure at activity cliffs is a diagnostic that suggests the insufficiency of learning through static correlations. The hypothesis is that pre-training on synthesis planning—forcing a model to internalize the rules of molecular transformation—will produce representations that are inherently more sensitive to the local electronic and steric features that govern both reactivity and specific biological interactions. **Idea 4: From Navigability to Validity: A New Standard for Evaluation** Thesis: While modern synthesis planners have achieved near-perfect stock-termination rates, this success in navigating the search space obscures a more difficult challenge: ensuring the chemical validity of the proposed routes. Implication: High stock-termination rates, reported in isolation, can create a misleading impression of practical capability. The field's maturation requires evaluation frameworks that prioritize chemical correctness, moving beyond pure connectivity to assess whether a proposed synthesis is experimentally credible. **Idea 5: The Solvability Hierarchy (Solv-N)** Thesis: The Solv-N framework deconstructs the ambiguous term "solvability" into four distinct tiers: Syntactic (Solv-0), Topological (Solv-1), Selectivity (Solv-2), and Executability (Solv-3). This clarifies that most published success rates measure only topological connectivity (Solv-1), not experimental feasibility. Implication: The Solv-N framework provides a more granular vocabulary for "solvability," moving beyond a simple binary to a multi-faceted diagnostic. It enables the field to make more precise claims about model capabilities and focuses attention on the unsolved frontier of chemical AI: selectivity and experimental executability. **Idea 6: Stock Inflation: The Hidden Difficulty Dial** Thesis: Reported success rates can be inflated from ~19% to 100% simply by expanding the starting material inventory from a physical tier (~100K) to a virtual one (~230M). High STR against make-on-demand libraries often reflects inventory breadth, not algorithmic depth. Implication: A headline solvability number is incomplete without specifying the inventory against which it was measured. To enable meaningful comparison, the community needs standardized stock definitions that prevent the conflation of inventory breadth with algorithmic capability. **Idea 7: Search-Augmented Generation: A Proposed Convergence** Thesis: The tension between explicit search and direct sequence generation is transient. A plausible trajectory, mirroring Sutton's "Bitter Lesson," involves using physics-constrained search to generate high-fidelity training data, which is then distilled by sequence models into fast, generalizable policies. Implication: The future architecture is likely not search *or* generation, but search *for* generation. Physics-constrained search becomes the data engine; scalable sequence models become the deployment layer. #### META IDEAS How the field should organize its science. **Idea 8: He Who Builds the Instrument Defines the Science** Thesis: The architects of our software instruments define the scientific agenda. In an era where progress is gated by software capability, computational chemists must become proficient software architects, or risk ceding the direction of the field to those who are. Implication: The disciplinary boundary between computational chemist and software architect has become a primary bottleneck to scientific progress. The researchers who can build robust, chemically-principled software will not just be more productive; they will be the ones who define the questions the field is capable of answering. **Idea 9: The Fox Guarding the Henhouse** Thesis: The practice of coupling method development with benchmark definition creates a structural conflict of interest, where evaluation criteria inevitably drift to favor the proposed method. The solution requires both independent evaluation infrastructure and recognizing validation itself as a first-class scientific contribution. Implication: Progress requires decoupling method development from metric definition. Rigorous evaluation must be conducted within independent, community-standardized frameworks. Crucially, the work of building and validating these measurement instruments must be valued as a first-class scientific contribution, not relegated to the status of service work. **Idea 10: A Dual-Track Framework for Evaluation** Thesis: The field is deadlocked by an overly rigid definition of 'fair comparison,' which is rarely met in practice and often used to justify a lack of head-to-head evaluation. The dual-track framework resolves this by creating two distinct but equally valid modes: a **Developer Track** for isolating algorithmic novelty under controlled conditions, and a **Chemist Track** for pragmatically comparing off-the-shelf tools, legitimizing the crucial question: 'which available tool gives the best route right now?' Implication: By formalizing the distinction between algorithmic novelty and practical utility, the dual-track framework provides a clear standard for when different types of comparisons are appropriate. It removes the justification for avoiding head-to-head evaluation and helps build a more robust and accountable ecosystem for both researchers and tool developers. ### THE SOLV-N VALIDITY FRAMEWORK A four-tier hierarchy for evaluating the chemical validity of synthesis routes, beyond stock-termination rate. **Solv-0 — Syntactic Validity** [SOLVED] Definition: The output is a well-formed molecular graph — valid SMILES, balanced atoms, legal valences. **Solv-1 — Topological Validity** [SOLVED] Definition: The proposed reaction center transformation is a legal bond rearrangement — correct atom mapping, valid bond changes, and recognized reaction topology. **Solv-2 — Selectivity Validity** [OPEN] Definition: The transformation is chemically plausible given competing functional groups and stereochemical requirements — all five selectivity sub-constraints must be satisfied simultaneously. - Solv-2C (Chemoselectivity): The correct functional group reacts in the presence of competing reactive sites. A carbonyl reduction must target the intended carbonyl when multiple are present. [partial] - Solv-2R (Regioselectivity): The reaction occurs at the correct position within the targeted functional group. For electrophilic aromatic substitution, the substituent must be directed to the correct ring position. [open] - Solv-2D (Diastereoselectivity): The correct relative stereochemistry is produced. Reactions forming new stereocenters must yield the intended diastereomer, not a mixture. [open] - Solv-2E (Enantioselectivity): The correct absolute stereochemistry is produced. Asymmetric reactions must employ appropriate chiral catalysts or auxiliaries and yield the intended enantiomer. [open] - Solv-2S (Stoichiometry): Control of single vs. multiple equivalent transformations. When a molecule contains two identical reactive sites (e.g., two equivalent carbonyls), the planner must specify whether the reaction is intended to occur once or twice — and provide a mechanism that enforces that control. Proposing mono-addition to a symmetric dicarbonyl without a control mechanism fails this constraint, as the forward reaction will inevitably produce the double-addition product. [partial] **Solv-3 — Executability Validity** [OPEN] Definition: The route is experimentally viable — realistic conditions, adequate yields, compatible purification, and successful execution from start to finish. ### OPEN PROBLEMS (Living Document) 27 problems across grand challenges, research problems, and engineering gaps. **[Grand Challenge | Open] The True Chemical Foundation Model** Current chemical "foundation models," trained on static graph masking or SMILES reconstruction, often fail to generalize to activity cliffs because they learn the syntax of *representation* rather than the syntax of *transformation*. The central thesis of the review is that multistep retrosynthesis is the chemical analogue of next-token prediction — a uniquely demanding generative objective that forces a model to internalize electronic constraints, functional group compatibility, and selectivity boundaries. The critical empirical question: does pre-training on retrosynthesis under Solv-2 constraints yield zero-shot transfer to property prediction tasks never encountered during training? If planning competence transfers, "chemical foundation model" becomes a concrete research program rather than a branding term. If it does not — if a model becomes expert at route-finding yet provides no advantage for unrelated chemical reasoning — the hypothesis is falsified and synthesis planning is a narrow, specialized skill. **[Grand Challenge | Open] Route-Level Executability Scoring** Current systems treat purification as a solved abstraction, assuming each step yields pure material for the next. In practice, synthesis is non-Markovian: impurities, residual catalysts, and inseparable byproducts propagate through the route. A copper-catalyzed step with 90% yield is functionally a failure if the copper carryover poisons the subsequent palladium-catalyzed cycle. True Solv-3 planning requires a route-level objective function incorporating predicted impurity profiles, chromatographic separability scores, and compatibility assessments across steps — penalizing separation complexity and impurity propagation across the entire sequence, not just individual step inefficiencies. **[Grand Challenge | Open] Defining a Route-Level Cost Function** Defining a universally valid cost function for chemical route optimality remains an open challenge. Most benchmarks measure only search feasibility (does any route exist?) because there is no consensus on what makes one valid route *better* than another. Step count? Price? Convergence? Green chemistry metrics? Separation burden? Current learned route scoring functions treat reactions in a route as an unordered collection, limiting their ability to evaluate syntheses where the precise sequence of transformations is critical (e.g., protecting group chemistry). A route cost function must be order-aware, multi-objective, and grounded in experimental reality. **[Research Problem | Open] Automated Solv-2C (Chemoselectivity) Verification** Building an automated verifier that detects when a proposed reaction would preferentially occur at the wrong functional group given competing reactive sites. A strongly basic organolithium reagent will be immediately quenched by an unprotected carboxylic acid via proton transfer — a template that matches the target ketone will not flag this. ChemCensor demonstrates feasibility but is not fully open. An open-source, community-standardized Solv-2C verifier would be the single most impactful interim step toward validity-centric benchmarking. **[Research Problem | Open] Automated Solv-2R (Regioselectivity) Verification** Verifying that a proposed reaction occurs at the correct site among non-equivalent positions. When a template proposes selective addition to one of two competing electrophilic sites, no standard automated tool confirms which site is kinetically or thermodynamically favored. Regioselectivity verification requires reasoning about electronic density, steric environment, and directing group effects — constraints that standard molecular fingerprints fail to distinguish. QM methods (DFT, semi-empirical) can predict regioselectivity but are rarely integrated into planning loops at scale. **[Research Problem | Open] Automated Solv-2D (Diastereoselectivity) Verification** Verifying that a proposed reaction produces the correct relative stereochemistry. Standard 2D reaction templates cannot enforce 3D spatial constraints: a Diels-Alder template may target the exo isomer, but the unconstrained forward reaction intrinsically favors the endo transition state via secondary orbital interactions. Diastereoselectivity verification requires bridging 2D graph edits with 3D geometric reasoning — a fundamental representation gap that no current planning system addresses. **[Research Problem | Open] Automated Solv-2E (Enantioselectivity) Verification** Verifying that a proposed reaction produces the correct absolute stereochemistry. Enantioselectivity is largely ignored by current planners. A planner may propose the (S,S,S) enantiomer, but the specified catalyst strictly induces the (R,R,R) geometry — or more commonly, the planner specifies no chiral catalyst at all and the reaction produces a racemic mixture. Verification requires 3D reasoning, catalyst/reagent specification, and transition-state modeling that goes far beyond topological analysis. **[Research Problem | Open] Automated Solv-2S (Stoichiometry) Verification** Verifying that a proposed reaction achieves the correct stoichiometric outcome — e.g., mono-addition to a symmetric dicarbonyl rather than double addition. When a substrate has two equivalent reactive sites and the planner proposes selective mono-functionalization without specifying a control mechanism (e.g., stoichiometric limitation, temperature control, or steric differentiation), the reaction will statistically produce a mixture. In many public reaction corpora, stoichiometric roles are incomplete or noisy, forcing stoichiometry to be treated as a soft constraint. **[Research Problem | Open] Quantifying Viable Alternatives in Top-K Evaluation** When a model proposes a Solv-1 valid route that differs from the experimentally recorded route, it does not receive credit under top-K accuracy. But how often is the alternative route still chemically viable versus a hallucination? Current benchmarks cannot distinguish these cases. We need systematized human expert supervision: chemists evaluating model-proposed routes that diverge from reference, classifying them as (a) genuinely viable alternatives, (b) plausible but risky, or (c) chemically invalid. RetroChimera found that chemists frequently rated model proposals as *superior* to historical ground truth — but this was ad hoc, not systematic. **[Research Problem | Open] Systematic Solv-0/Solv-1 Failure Audit for Sequence Models** Template-based methods guarantee Solv-0 (valid molecular graphs) and Solv-1 (topologically valid transformations) by construction, but template-free sequence models have no such guarantees. They can generate pentavalent carbon atoms (Solv-0 failure), hallucinate non-physical bond migrations (Solv-0/1 failure), or propose chemically implausible disconnections that happen to be topologically valid. A systematic audit across all major sequence models — quantifying how often their predictions fail Solv-0 and Solv-1 checks, stratified by target complexity and reaction class — would establish the actual reliability baseline for these architectures. **[Research Problem | Open] Meaningful Molecular Similarity Grouping** Stratified evaluation, transfer learning, and domain-shift detection all depend on grouping molecules by "similarity" — but similarity in chemical abstraction may not be well-defined. Tanimoto coefficients of molecular fingerprints are the default, but it is unclear whether they produce chemically meaningful groupings. Similar by what? Topology? Reactivity? Bioactivity? Electronic structure? These give different answers. For reactivity specifically, two molecules with the same fingerprint similarity may have completely different functional group environments and thus completely different synthetic accessibility. We may need to acknowledge that no single similarity metric is appropriate and instead develop task-specific similarity functions grounded in the relevant chemical property. **[Research Problem | Open] Meaningful Reaction Similarity Grouping** Grouping reactions by similarity is at least as difficult as grouping molecules, and arguably harder. MOSAIC uses concatenated RDKit and Morgan fingerprints with Kohonen mapping to cluster reactions into ~2,500 Voronoi cells — a purely metric-driven approach that does not enforce traditional reaction type labels. But does this capture chemically meaningful reaction neighborhoods? Standard fingerprints fail to distinguish reactive environments needed for Tier 2 validation. We lack principled reaction similarity metrics that capture mechanistic similarity rather than superficial structural resemblance between reactants and products. **[Research Problem | Partial] Temporal Holdout Benchmarks** The field relies on a small number of historical test sets, particularly USPTO-190, which was constructed by pre-filtering for targets whose steps were ranked highly by a baseline model. Modern planners routinely achieve 93–100% STR on this set, rendering it non-discriminative. Verifying true generalization requires rigorous holdouts based on time (e.g., training on pre-2020 data, testing on 2020–2026 reactions) to disentangle chemical reasoning from memorization of training patterns. **[Research Problem | Partial] Head-to-Head Planner Comparison Under Identical Training Data** A truly rigorous comparison of two planning algorithms requires retraining both on identical datasets, using the same reaction templates and stock definitions. The lack of publicly available training scripts and the high computational cost of retraining make such comparisons infeasible in practice. The field needs a dual-track evaluation model: a Developer Track for rigorous assessment of algorithmic novelty (fair, retrained comparisons under fixed boundary conditions) and a Chemist Track for evaluating pre-trained, off-the-shelf models as-is. Metric fragmentation — where new methods are introduced alongside custom evaluation criteria — compounds this problem. **[Research Problem | Open] Search-Augmented Generation: Distilling Search into Sequence Models** The tension between explicit graph search and direct sequence generation is likely a transient phase. In a teacher-student paradigm, explicit search guided by rigorous Solv-2 filters acts as the "teacher," generating large, high-fidelity corpora of valid routes. High-capacity sequence models then act as the "student," distilling this complex physical and strategic logic into a fast, generalizable policy. This amortizes the immense computational expense of search into the inference step, combining the rigor of symbolic methods with the speed of deep learning. **[Research Problem | Partial] Overcoming Regression to the Mode in Condition Prediction** Generalist condition-prediction models suffer from regression to the global mode — predicting average conditions instead of the context-specific conditions required for a particular reaction. MOSAIC addresses this by abandoning the single-model paradigm in favor of ~2,500 local expert models (LoRA fine-tuned), each specialized to a distinct neighborhood in reaction space defined as Voronoi cells in a learned metric space. In wet-lab validation, this achieved 71% success across 52 transformations — but relies on maintaining thousands of disjoint models, trading simplicity for the precision of extreme specialization. **[Research Problem | Open] The Horizon Effect in Explicit Search** When node scoring in search-based planners is optimized for short-term objectives (e.g., maximizing single-step likelihood), the planner systematically penalizes steps whose utility is only realized later in the route. This includes strategic disconnections that enable convergent assembly, and auxiliary operations like protection/deprotection that temporarily increase complexity but are necessary for selectivity. The result is a "horizon effect" where planners favor shallow, direct routes even when longer routes with strategically necessary complexity are the only chemically valid options. Length-minimizing policies systematically avoid structural complexity that chemical validity often requires. **[Research Problem | Open] Portfolio Planning and Route Diversification** Current planners optimize for a single best route. RetroFallback reframes the objective: rather than identifying one optimal route, the goal becomes selecting a portfolio of diverse routes that together maximize the synthesis success probability (SSP), accounting for the possibility that individual steps may fail in practice. A binary solvability metric cannot distinguish a planner that outputs 99 chemically invalid routes and one valid route from one that consistently ranks valid routes first. Portfolio planning requires both diverse route generation and calibrated step-level success probability estimation — neither of which is well-developed. **[Research Problem | Open] Transfer Beyond Small-Molecule Organic Synthesis** The review focuses on small-molecule organic synthesis as represented in patent corpora. Whether the Solv-N framework and planning-as-pretraining thesis transfer to catalysis, inorganic and organometallic synthesis, polymer and materials chemistry, electrochemistry, or peptide and biocatalytic synthesis remains explicitly unresolved. These domains differ in representation (coordination chemistry, polymer topology), data quality (sparser experimental records), mechanistic structure (radical, photochemical, enzymatic pathways), and criteria for experimental success (conversion vs. selectivity vs. materials properties). **[Research Problem | Open] Scalable Expert Feedback for Chemistry (The RLHF Bottleneck)** In NLP, RLHF from human raters was essential for aligning foundation models. The review identifies a falsifiability criterion: if chemistry requires a similar massive feedback loop from expert chemists and such a data-generating process is not scalable, then pre-training on planning alone is insufficient for artificial chemical intelligence. Synthesists are scarce and expensive. The field needs either (a) scalable proxies for expert chemical judgment (physics-based oracles, automated Solv-2 verifiers), or (b) efficient active-learning protocols that minimize the number of expert evaluations needed. The Solv-N hierarchy itself can be viewed as an attempt to formalize expert judgment into automatable tiers. **[Research Problem | Open] The Speed-Accuracy Frontier in Planning** Under a fixed time budget (e.g., 10 minutes per target), transformer-based planners execute so few expansions that they fail to solve complex targets, despite having higher single-step accuracy. Chemformer underperformed LocalRetro in multistep solvability (53.4% vs. 80.6%) simply because the search could not explore deep enough within the practical time limit. Throughput is a component of chemical capability, not an orthogonal engineering concern. Speculative decoding, distillation, and efficient attention mechanisms are partial mitigations, but the fundamental tension between autoregressive generation quality and search-loop throughput remains. **[Research Problem | Open] Reaction Role Disambiguation in Training Data** Datasets derived from patent mining (primarily USPTO) often represent reactions as unordered mixtures, treating structural reactants, auxiliary reagents, catalysts, and solvents as interchangeable participants rather than distinguishing their chemical roles. Models must infer roles from co-occurrence statistics, occasionally leading to incoherent proposals where solvents or bases are treated as stoichiometric building blocks. While proprietary databases (Reaxys, Pistachio) offer cleaner curation, their licensing restrictions limit reproducible benchmarking. Systematic role annotation of open reaction corpora would improve training data quality across all downstream models. **[Engineering Problem | Open] Retraining Retro* on Modern Datasets** Retro* is uniquely good at top-K route reconstruction accuracy compared to other search methods, thanks to its neural A* formulation with a learned cost-to-go heuristic. However, RetroCast audits revealed that Retro* produced routes containing single steps with seven distinct reactants — a clear chemical impossibility that passes topological metrics. This likely reflects deficiencies in the training set of the underlying single-step model rather than a flaw in the search algorithm itself. Retraining Retro* on modern, cleaner datasets (with role-disambiguated reactions and stricter template quality) and evaluating against current benchmarks would clarify how much of its failure mode is algorithmic versus data-driven. **[Engineering Problem | Open] Solv-1 Verification and Closest Template Lookup Pipeline** Given a reaction SMILES (from any source — sequence model output, LLM proposal, literature extraction), check Solv-1 validity and find the closest matching reaction template from a reference database. This is probably already achievable by chaining RXNMapper (for atom mapping) with a template database search, but no ready-to-use, open-source pipeline exists that packages this as a single tool. Low-hanging fruit that would provide immediate value: any proposed transformation could be annotated with its nearest template precedent (or flagged as having none), giving a lightweight proxy for chemical plausibility. **[Engineering Problem | Open] Community-Standard Solv-2 Verifier Infrastructure** An open, community-maintained Solv-2 verification tool — akin to a linter for synthetic routes — that any planner can be benchmarked against. The tool must be modular (start with Solv-2C, extend to 2R, 2D, 2E, 2S as individual research problems are solved), transparent (rules are inspectable and challengeable), versioned (rule sets evolve as understanding improves), and performant enough for large-scale evaluation. This is the engineering and governance wrapper around the individual Solv-2 research problems — making the verifiers robust, maintainable, and widely adopted. **[Engineering Problem | Solved] Standardized Route Output Format** The field needs a community-standard, machine-readable format (e.g., a JSON schema) for publishing raw generated route trees. This would enable researchers to crowdsource the auditing process, progressively building the ground-truth corpora of both successful and failed proposals required to train robust Solv-2 verifiers. Without a shared format, every comparison requires ad-hoc parsing and each planner's output is a data silo. **[Engineering Problem | Open] High-Throughput QM Oracle Pipelines** Transforming established quantum mechanical models — which can predict selectivity, stability, and reactivity — from artisanal, single-molecule calculations into at-scale data generation engines. These pipelines would supply the crucial counterfactuals missing from historical data: explicitly identifying disfavored reactions, mapping selectivity conflicts, and flagging unstable intermediates. The bottleneck is not scientific theory but the engineering of robust, parallelized computational infrastructure — workflow orchestration, error handling for failed QM calculations, and careful curation of the resulting datasets. ## OPERATIONAL STANDARD: THE ISCHEMIST PROTOCOL (v1.0.0) A framework for "Agentic Inquiry." - Principle I: Verifiable Truth: "All scientific artifacts—figures, tables, and analyses—must be generated by a single, executable script that runs directly on the ground-truth data." - Principle II: Enduring Utility: "Our work must result in an artifact that has intrinsic, enduring value outside the context of academic publishing. This artifact is the source of truth. The paper is its manifest." - Principle III: Agentic Inquiry: "This principle defines the character of the agent. It is a framework for navigating the scientific world with purpose and integrity, grounded in the belief that the individual is the ultimate locus of discovery." ## PROFESSIONAL EXPERIENCE ### Doctoral Researcher @ Prof. Victor S. Batista Lab, Yale University (Nov 2023 - May 2026) - Authored The Syntax of Matter, a comprehensive review arguing that synthesis planning is the foundational pre-training objective for generative chemistry and introducing the Solv-N validity hierarchy. - Built RetroCast and SynthArena, an open-source evaluation stack and public leaderboard for canonicalizing outputs from 10+ retrosynthesis planners, visualizing route failures, and enabling reproducible benchmarking. - Developed DirectMultiStep, a Transformer-based retrosynthesis model that generates complete routes directly, avoiding combinatorial search while achieving 3.1x higher accuracy than graph-search baselines. - Secured $100k prize (2nd Place) in the Standard Industries Chemical Innovation Challenge by applying generative retrosynthesis models to industrial synthesis targets. - Engineered ChemSpaceAL, an active learning framework using latent-space upsampling that reduced the computational cost of alignment by 90%. ### Undergraduate Researcher @ Prof. Troy Van Voorhis Lab, MIT (Feb 2022 - May 2023) - Developed a composite electronic structure method recovering Coupled-Cluster (CCSD) accuracy within 0.02 eV at a fraction of the computational cost (MP2 scaling). - Automated large-scale benchmarking pipelines (2k+ lines Python/Shell), streamlining the calculation → analysis → visualization workflow for high-throughput spectroscopy prediction. ### Undergraduate Researcher @ Prof. Ronald T. Raines Lab, MIT (Sep 2018 - Dec 2021) - Executed multi-step organic synthesis of novel diazo compounds for protein bioconjugation, characterizing products via NMR and MS. - Bridged experimental results with theory by modeling transition states using DFT to elucidate reaction mechanisms. ### ML Research Intern @ Stealth Startup (Jun 2025 - Aug 2025) - Architected end-to-end reaction plausibility engine and negative data generation pipeline for proprietary workflows. - Refactored GNN codebase into production-ready PyTorch, resolving bottlenecks to achieve 2x inference speedup. - Engineered automated benchmarking suite to validate model performance against internal experimental datasets. ### Graduate Research Assistant @ Los Alamos National Laboratory (Jul 2024 - Feb 2025) - Modernized legacy infrastructure by porting MATLAB codebases to high-performance Python/VASP pipelines. - Identified and fixed critical theoretical discrepancies in published methodology, restoring reproducibility to a stalled research project. ## PUBLICATIONS & RECOGNITION - "URSA: Chemistry-Aware Benchmark for Utilitarian Retrosynthesis Assessment" (2026). Preprint. - "The Syntax of Matter: Synthesis Planning as the Foundation of Generative Chemistry" (2026). ChemRxiv. - "Procrustean Bed for AI-Driven Retrosynthesis: A Unified Framework for Reproducible Evaluation" (2025). Preprint. - "FragmentRetro: A Quadratic Retrosynthetic Method Based on Fragmentation Algorithms" (2026). Journal of Chemical Theory and Computation. - "DirectMultiStep: Direct Route Generation for Multi-Step Retrosynthesis" (2025). Journal of Chemical Information and Modeling. - "Kernel-elastic autoencoder for molecular design" (2024). PNAS Nexus. - "ChemSpaceAL: An Efficient Active Learning Methodology Applied to Protein-Specific Molecular Generation" (2024). Journal of Chemical Information and Modeling. - "MP2-Based Composite Extrapolation Schemes Can Predict Core-Ionization Energies for First-Row Elements with Coupled-Cluster Level Accuracy" (2024). J. Phys. Chem. A. - "Hydrophilic α-Aryl-α-Diazoamides for Protein Esterification" (2025). Synlett. ### LEADERSHIP & IMPACT - National Medalist Usage: 90% - Olympiad Problems Authored: 70+ - Grants & Funding Secured: $40k+ - Volunteer Team Members Led: 70+ - **System Building: Beyond Curriculum Public Foundation:** In 2020, I co-founded Beyond Curriculum, a student-led non-profit that evolved into a national-scale educational platform for STEM in Kazakhstan. Our work provided critical resources that were previously inaccessible, fundamentally changing the competitive landscape. - **Institutional Reform: QazChO:** As Chairman and Head Mentor of the Kazakhstan Chemistry Olympiads Association, I established a national body to reform the administration of chemistry olympiads, introducing unprecedented transparency and data-driven methodologies. ### AWARDS & MEDIA - [News] Yale Chemists Go Retro with New AI-Based Model (Yale Department of Chemistry) - [News] Pregnancy, evolution, AI in chemistry, and quicker gene tests (Yale News) - [Award] Phi Beta Kappa (2023, Xi Chapter of Massachusetts, MIT) - [Award] Academic Achievement Award (2023, MIT Department of Chemistry) - [Award] El Maqtanyshy (Pride of the Nation) (2020 & 2019, Nursultan Nazarbayev Foundation) - [Award] Olympiad Coaching Award (2019, Ministry of Education and Science of Kazakhstan) - [Award] Gold Medal (Ranked 10th) (2017, International Chemistry Olympiad (IChO)) - [Award] Gold Medal (Ranked 8th) (2017, International Mendeleev Chemistry Olympiad) ## APPENDIX: SELECTED PAPERS & WRITINGS ### PAPER: Procrustean Bed for AI-Driven Retrosynthesis: A Unified Framework for Reproducible Evaluation Abstract: Progress in computer-aided synthesis planning (CASP) is obscured by the lack of standardized evaluation infrastructure and the reliance on metrics that prioritize topological completion over chemical validity. We introduce RetroCast, a unified evaluation suite that standardizes heterogeneous model outputs into a common schema to enable statistically rigorous, apples-to-apples comparison. The framework includes a reproducible benchmarking pipeline with stratified sampling and bootstrapped confidence intervals, accompanied by SynthArena, an interactive platform for qualitative route inspection. We utilize this infrastructure to evaluate leading search-based and sequence-based algorithms on a new suite of standardized benchmarks. Our analysis reveals a divergence between "solvability" (stock-termination rate) and route quality; high solvability scores often mask chemical invalidity or fail to correlate with the reproduction of experimental ground truths. Furthermore, we identify a "complexity cliff" in which search-based methods, despite high solvability rates, exhibit a sharp performance decay in reconstructing long-range synthetic plans compared to sequence-based approaches. \documentclass{article} \PassOptionsToPackage{numbers, sort&compress}{natbib} \usepackage[preprint]{dms} \usepackage[utf8]{inputenc} % allow utf-8 input \usepackage[T1]{fontenc} % use 8-bit T1 fonts \usepackage{hyperref} % hyperlinks \usepackage{url} % simple URL typesetting \usepackage{booktabs} % professional-quality tables \usepackage{amsfonts} % blackboard math symbols \usepackage{nicefrac} % compact symbols for 1/2, etc. \usepackage{microtype} % microtypography \usepackage{xcolor} % colors \usepackage{subcaption} % for subfigures \usepackage{graphicx} % for includegraphics \usepackage{siunitx} \usepackage{float} \bibliographystyle{unsrtnat} \newcommand{\am}[1]{\textcolor{violet}{AM: #1}} \usepackage{pifont}% http://ctan.org/pkg/pifont (for \ding) \newcommand{\cmark}{\ding{51}}% \newcommand{\xmark}{\ding{55}}% \newcommand{\bld}[1]{\textbf{#1}} \title{Procrustean Bed for AI-Driven Retrosynthesis: A Unified Framework for Reproducible Evaluation} \author{% Anton Morgunov\thanks{Work performed in adherence with \href{https://github.com/ischemist/protocol}{isChemist Protocol}} \\ Yale University \\ \texttt{anton@ischemist.com} \\ \And Victor S. Batista \\ Yale University \\ \texttt{victor.batista@yale.edu} \\ } \begin{document} \maketitle \begin{abstract} Progress in computer-aided synthesis planning (CASP) is obscured by the lack of standardized evaluation infrastructure and the reliance on metrics that prioritize topological completion over chemical validity. We introduce \href{https://github.com/ischemist/project-procrustes}{RetroCast}, a unified evaluation suite that standardizes heterogeneous model outputs into a common schema to enable statistically rigorous, apples-to-apples comparison. The framework includes a reproducible benchmarking pipeline with stratified sampling and bootstrapped confidence intervals, accompanied by \href{https://syntharena.ischemist.com/}{SynthArena} (syntharena.ischemist.com), an interactive platform for qualitative route inspection. We utilize this infrastructure to evaluate leading search-based and sequence-based algorithms on a new suite of standardized benchmarks. Our analysis reveals a divergence between "solvability" (stock-termination rate) and route quality; high solvability scores often mask chemical invalidity or fail to correlate with the reproduction of experimental ground truths. Furthermore, we identify a "complexity cliff" in which search-based methods, despite high solvability rates, exhibit a sharp performance decay in reconstructing long-range synthetic plans compared to sequence-based approaches. We release the full framework, benchmark definitions, and a standardized database of model predictions to support transparent and reproducible development in the field \end{abstract} \section{Introduction} We distinguish between two fundamental classes of scientific problems to which machine learning is applied: quantitative and structural. Quantitative problems, such as predicting drug toxicity, are defined by scalar targets and often constrained by data scarcity, analogous to early NLP challenges like sentiment analysis. In contrast, structural problems, like language modeling or protein folding, require generating complex objects governed by an underlying grammar. The most transformative successes of AI, from large language models~\cite{fewshot,r1,gpt4,agisparks} to AlphaFold~\cite{af2,af3,afimpact,afimpact2}, have occurred in these structural domains; foundation models trained on the structure of language, for example, now excel at sentiment analysis with little to no task-specific fine-tuning. We contend that mastery of structure is a prerequisite for solving downstream quantitative tasks. In organic chemistry, the paramount structural challenge is designing a valid synthetic pathway to a molecule of interest. This capability, retrosynthesis, is the key to unlocking critical quantitative problems like predicting a molecule's synthetic feasibility, a significant bottleneck in synthesis-aware virtual screening. Current accessibility heuristics, however, bypass the core structural challenge, relying on learned patterns that correlate with accessibility without ever generating the synthetic pathway itself. This, we argue, is a fundamental limitation: a model cannot judge the difficulty of a journey it cannot first articulate. The dominant paradigm for computational retrosynthesis follows a two-part framework: a single-step model proposes disconnections, and a search algorithm explores the resulting pathway space~\cite{casp_1969}. While both components have seen rapid progress~\cite{coley_rank_2017,wlnet_coley_2017,fusionretro_2023,dai_gln_2019,ss_template_2024,mcts_2018,retrostar,coley_rl_2019,grasp_2022,egmcts_2023,retrograph}, the field's primary measure of success, traditionally called \textit{solvability}, creates a disconnect between reported performance and practical utility. A route is deemed "solved" if all its terminal nodes exist in a predefined commercial stock, but this is a purely topological check that provides no guarantee of chemical validity for the intermediate steps. This represents a methodological departure from the field's early best practices, which incorporated dedicated networks to filter infeasible reactions~\cite{mcts_2018}. The field now operates on an implicit and unevaluated assumption that single-step predictors have learned all complex rules of chemical feasibility. Consequently, high scores can be achieved for routes containing chemically nonsensical steps, rewarding any topological path regardless of its plausibility. To avoid the misleading implication of "solving" a chemical problem, we will henceforth refer to this metric by a more precise term: the \textit{Stock-Termination Rate (STR)}. Attempts to address this validity gap with proxy metrics, such as forward-prediction confidence or round-trip accuracy~\cite{multistept... ### PAPER: DirectMultiStep: Direct Route Generation for Multistep Retrosynthesis Abstract: Traditional computer-aided synthesis planning (CASP) methods rely on iterative single-step predictions, leading to exponential search space growth that limits efficiency and scalability. We introduce a series of transformer-based models that leverage a mixture of experts approach to directly generate multistep synthetic routes as a single string, conditionally predicting each transformation based on all preceding ones. Our DMS Explorer XL model, which requires only target compounds as input, outperforms state-of-the-art methods on the PaRoutes dataset with 1.9x and 3.1x improvements in Top-1 accuracy on the n1 and n5 test sets, respectively. \documentclass{article} % if you need to pass options to natbib, use, e.g.: % \PassOptionsToPackage{numbers, compress}{natbib} % before loading neurips_2024 % ready for submission % \usepackage{neurips_2024} % comment acknowledments and change Code and Data Availability \usepackage[preprint,nonatbib]{dms} % uncomment acknowledments and change Code and Data Availability for arXiv \usepackage[utf8]{inputenc} % allow utf-8 input \usepackage[T1]{fontenc} % use 8-bit T1 fonts \usepackage{hyperref} % hyperlinks \usepackage{url} % simple URL typesetting \usepackage{booktabs} % professional-quality tables \usepackage{amsfonts} % blackboard math symbols \usepackage{nicefrac} % compact symbols for 1/2, etc. \usepackage{microtype} % microtypography \usepackage{xcolor} % colors \usepackage{subcaption} % for subfigures \usepackage{graphicx} % for includegraphics \bibliographystyle{unsrt} \newcommand{\ys}[1]{\textcolor{blue}{#1}} \newcommand{\am}[1]{\textcolor{violet}{AM: #1}} \usepackage{pifont}% http://ctan.org/pkg/pifont (for \ding) \newcommand{\cmark}{\ding{51}}% \newcommand{\xmark}{\ding{55}}% \newcommand{\bld}[1]{\textbf{#1}} \title{DirectMultiStep: Direct Route Generation for Multistep Retrosynthesis} \author{% Yu Shee\thanks{Equal contribution. Listing order is random.} \\ Yale University\\ \texttt{yu.shee@yale.edu} \\ \And Anton Morgunov* \\ Yale University\\ \texttt{anton@ischemist.com} \\ \And Haote Li \\ Yale University\\ \texttt{haote.li@yale.edu} \\ \And Victor Batista \\ Yale University\\ \texttt{victor.batista@yale.edu} \\ } \begin{document} \maketitle \begin{abstract} Traditional computer-aided synthesis planning (CASP) methods rely on iterative single-step predictions, leading to exponential search space growth that limits efficiency and scalability. We introduce a series of transformer-based models, that leverage a mixture of experts approach to directly generate multistep synthetic routes as a single string, conditionally predicting each transformation based on all preceding ones. Our DMS Explorer XL model, which requires only target compounds as input, outperforms state-of-the-art methods on the PaRoutes dataset with 1.9x and 3.1x improvements in Top-1 accuracy on the n$_1$ and n$_5$ test sets, respectively. Providing additional information, such as the desired number of steps and starting materials, enables both a reduction in model size and an increase in accuracy, highlighting the benefits of incorporating more constraints into the prediction process. The top-performing DMS-Flex (Duo) model scores 25-50\% higher on Top-1 and Top-10 accuracies for both n$_1$ and n$_5$ sets. Additionally, our models successfully predict routes for FDA-approved drugs not included in the training data, demonstrating strong generalization capabilities. While the limited diversity of the training set may affect performance on less common reaction types, our multistep-first approach presents a promising direction towards fully automated retrosynthetic planning. \end{abstract} \section{Introduction} Finding the most efficient route to a desired chemical compound is a daily challenge for synthetic organic chemists in both fundamental research and drug discovery. Route efficiency is determined by various factors, some of which can be objectively assessed, such as overall yield (not all chemical reactions have 100\% conversion rate) and enantiomeric excess (in case of chiral compounds), where higher values are always preferred. Other factors, such as atom efficiency (minimization of byproducts) and availability (cost) of starting materials, are more case-dependent. A used chemical reactant is considered waste unless it can be repurposed as a reactant in a different process. Similarly, the choice of starting materials depends on factors such as budget, logistics, and the availability of specific equipment. It's worth noting that many commercially available compounds can be synthesized from other commercially available compounds, adding another layer of complexity to the decision-making process. Algorithmic frameworks for identifying synthetic routes were envisioned by Vleduts~\cite{vleduts1963concerning} and further formalized by Elias James Corey (subject of the 1990 Nobel Prize in Chemistry) into what is now known as retrosynthetic analysis. This framework begins with identifying atoms that would serve as reaction centers. Disconnecting bonds between these centers results in the formation of hypothetical fragments (called synthons) from which a precursor molecule can be created. This mapping from synthons to actual molecules is one-to-many because there is usually more than one functional group that could participate in any given type of reaction. Importantly, meticulous application of Corey's framework (i.e., systematically breaking small subsets of bonds) will eventually lead to commercially available starting materials. The algorithmic nature of this process allowed Corey to envision automating these rules to create Computer-Aided Synthesis Planning (CASP) as early as 1969~\cite{corey_computer-assisted_1969}. Recent advancements in data science and machine learning (ML) methods have led to a surge of interest in developing CASP methods~\cite{de_almeida_synthetic_2019, struble_current_2020}. The vast majority of existing methods~\cite{guo_bayesian_2020, lee_retcl_2021, segler_neural-symbolic_2017, coley_computer-assisted_2017, ishida_prediction_2019, fortunato_data_2020, dai_retrosynthesis_2020, chen_deep_2021, seidl_improving_2022, yan_retroxpert_2020, shi_graph_2021, somnath_learning_2021, wang_retroprime_2021, wang_retrosynthesis_2023, zhong_retrosynthesis_2023, liu_retrosynthetic_2017, karpov_transformer_2019, chen_learning_2019, lee_molecular_2019, lin_automatic_2020, zheng_predicting_2020, tetko_state---art_2020, seo_gta_2021, mao_molecular_2021, sacha_molecule_2021, mann_retr... --- Title: The inevitable dual-use problem of frontier AI Category: fugues We frequently hear from pharma/biotech leaders that AI has the potential to radically accelerate the pace of drug discovery, and, maybe, eventually cure all disease. If you know anything about biochemistry, you'd quickly realize that judging by the current behavior of pharma/biotech, no one really believes that. Because if they did, they'd be obsessed with the questions of bio and chemical safety of these AI models just as much as Anthropic is obsessed with the general problem of alignment.:sidenote[which might not necessarily solve the problem of bio/chem safety because, for example, we're not using LLMs to fold/co-fold proteins] We got to the point of me writing this fugue not by OpenAI or Anthropic explicitly trying to train an LLM capable of sophisticated cyber attacks. No, the surprising:sidenote[and maybe not so much in hindsight] aspect was that frontier labs simply tried to make models better at coding, and as a byproduct, they became world class at finding vulnerabilities in software. Models got so good that Anthropic, by their own account, decided to institute a limited preview to trusted partners through [Project Glasswing](https://www.anthropic.com/glasswing) instead of releasing the model to the general public. Some of you might already see the parallel. You see, curing a disease often requires finding a good molecule that would bind to a protein that misbehaves and neutralize it. And although we've made some strides in predicting whether a molecule can bind to a protein, there's still a lot of work to be done to ensure the molecule is easy to make, does not have off-target effects (does not neutralize the proteins it's not supposed to neutralize), and has a wide enough therapeutic window. But ultimately, if you claim to believe that AI will be able to cure all disease, you're effectively stating that we'll have a system that, given a specification of a protein of interest, creates a molecule that satisfies all those constraints. Creating a perfect chemical weapon is just applying that same system not to a misbehaved disease-causing protein, but to a regular, well-behaved, likely life-critical protein. In other words, it is almost a given that just like with the Anthropic Mythos model getting extremely capable at cyber attacks after getting better at writing code, IF/WHEN we have a sufficiently powerful AI model capable of end-to-end drug design, the same model will be extremely capable at creating chemical weapons. And sure, just designing a molecular structure is probably not enough, you need to make it. And so maybe, the defense here is that just like with nukes, the difficulty is not in knowing how to make a nuke:sidenote[which has been proven with say [Nth country experiment](https://en.wikipedia.org/wiki/Nth_Country_Experiment)] but in the iterated engineering required to get the system just right and access to the right materials. But at least this should be an explicitly formulated position in an ongoing debate. When was the last time you heard anyone seriously talking about how they'd prevent their powerful AI Drug Design platform from being used for chemical and biological weaponry? Benchmarking an LLM if it refuses to respond to chemical weapon prompts does not count as serious preparation.:sidenote[which is often done by simply classifying prompts before they're passed to an LLM and often results in refusal to answer even regular chemical prompts] You're not going to create a chemical weapon by prompting an LLM, no matter how clever it is, the problem lies beyond textual representation and requires working with structures of proteins and molecules as first-class citizens. If this problem were taken seriously, I'm not sure AlphaFold3/Boltz/Chai would be open sourced. For now, they're more focused on proving these models can work with "good targets". The problem, of course, is that once we have tech that works for good targets it'll be too late to worry about alignment. On a broader, more utilitarian point, with the dooming AI-induced cyber security crisis, the society at large might be tempted to question how much do we really need these fancy code-writing models if they create so many issues.:sidenote[[I've argued, people catastrophically underestimate the benefits that abundant software can bring](/writings/fugues/software-is-a-force-multiplier)] And maybe our approach to solving this crisis should be instructed by a realization that we, most likely:sidenote[I personally believe it's a matter of WHEN, not IF], will have to deal with the same question in AI-driven drug discovery, only then no one would have any doubts about the positive case (curing disease is what everyone understands to be a good thing). But are you really willing to cure all disease at the cost of creating the ultimate chemical weapons designer? --- Title: Attacks that read like science fiction Category: fugues Let's start with the TanStack supply chain attack, because its possibility immediately converts any workflow that installs fresh packages from a public registry into a radioactive liability for any organization. Which basically includes every single python developer outside of a very narrow fraction that uses best practices like lockfiles and package managers (like `uv`) that support them. ## How were TanStack packages compromised? An attacker managed to publish 84 malicious versions across 42 `@tanstack/*` packages to the official npm registry. The compromised packages had an `optionalDependencies` entry pointing at an orphaned commit in the TanStack/router fork. Installing the package fetched that commit, ran its `prepare` lifecycle script, installed Bun, and executed a large obfuscated `router_init.js` payload smuggled into the compromised tarball. That script harvested common cloud credentials, GitHub tokens, SSH keys, npm tokens, and then enumerated other packages the victim maintained and republished them with the same injection. If that wasn't enough, the broader mini-Shai-Hulud malware family also had dead-man's-switch behavior: it monitored stolen GitHub-token validity, and if the token stopped working, the payload attempted to wipe the user's home directory. See the [original report from May 11](https://github.com/TanStack/router/issues/7383) and the subsequent [official post-mortem](https://tanstack.com/blog/npm-supply-chain-compromise-postmortem#what-the-malware-does), and TanStack's [follow-up on what they changed afterward](https://tanstack.com/blog/incident-followup) ### How the hell did this happen? If such an attack happened a year ago, the most likely cause would've been that some TanStack maintainer with publishing token/release access was personally pwned (as a result of, say, a weak password reused across different platforms with no 2FA enabled). What's mind boggling about this case is that no maintainer was compromised and no one had to click merge, approve, or even review the malicious PR. Opening a PR was enough. The attack worked by threading together several CI behaviors that are each defensible in isolation, but unsafe in combination: `pull_request_target`:sidenote[`pull_request_target` exists to enable CI to run with access to base-repository metadata even for outside contributors. Though pull_request_target has been an object of criticism for awhile.] for outside contributors, cache reuse across PRs coming from trusted and untrusted contributors:sidenote[caching is not some exotic footgun, it's a completely ordinary optimization because otherwise CI gets slower and more expensive very quickly.], and a later privileged release job that consumed the poisoned state:sidenote[automated publishing from a trusted merge to `main` is also a normal and in many ways desirable setup; the whole point is to reduce manual release toil and long-lived credentials.] and published from a legitimate merge to `main`. ### Why is this an existential threat to python developers? How do you get affected by such a supply chain attack? In either of the following cases: 1. You're doing some local development and in the process need to recreate the environment and reinstall the packages. 2. You decide to create a new git worktree to explore some independent work direction (and so you have to create a new environment) 3. You deploy your project, which usually means creating a Docker image, which also needs to create an environment and install packages In the JavaScript ecosystem it is a widely accepted practice to almost never install packages in either of these steps by taking all the latest versions from the registry because that might lead to all sorts of unexpected reproducibility issues, and instead rely on lockfiles that specify a particular version. As a result, this attack only affected those who didn't use lockfiles, which (with the exception of a skill issue) means if you were trying to create a new project. In python-land, however, unless you're using `uv` (or poetry) as your package manager, you're fetching from the registry every single time you install your packages. Concretely, this is the difference between `pip install -r requirements.txt` and `uv sync --locked`. Using uv, is no longer [just about good practices and reproducibility](/writings/tutorials/comprehensive-guide-to-uv), it's now, fundamentally, about security. :::insight uv also allows you to specify a cooldown period which any new package has to be published for before it can be installed in your environment. I describe how in my [second voice on my new practices](./beyond-lockfiles) ::: ## What is CopyFail? This fugue could've been written without mentioning CopyFail, but it is so mind-boggling because it is an exploit that anyone can reproduce in a few seconds. You can explore [the original disclosure](https://copy.fail/) yourself, but the basic idea is that a 10-line Python script allows any user with non-root privileges on pretty much every linux distribution to grant root privileges to themselves. Its mechanism is a rabbit hole, but here's my understanding. If you write code in a high-level language like Python, you don't have to worry about managing memory. You can just write: ```py def get_some_insights(file_path: Path) -> dict[str, Any]: text = file_path.read_text() return summarize(text) ``` Whenever you operate in lower-level languages like C, you have to explicitly pass a memory buffer to which the result must be written: ```c int get_some_insights(const char *path, char *out, size_t out_len) { char tmp[8]; if (out_len < 16) { return -1; } ... } ``` when you write code for core utilities, you have to be quite mindful of your memory usage, in other words you don't have the luxury of defining helper variables or flags like you'd do in Python without even thinking twice. It's not unusual for C code to use some of that memory buffer as a scratch area. ```c memcpy(tmp, out, 8); memcpy(out + 4, tmp, 4); memcpy(out + 16, tmp + 4, 4); ``` And in CopyFail, a core linux utility `authencesn` was writing extra 4 bytes beyond the end of its output buffer. Attackers found a way to take advantage of this bug to write arbitrary data (like a malicious payload) into an in-memory cache of a `/usr/bin/su` file without ever changing the underlying file. That page cache was then utilized to execute malicious code with root privileges. Sure, you could argue `authencesn` maintainers made a mistake in overusing the buffer, but they probably couldn't have imagined in their scariest dreams that someone would be able to make it so that overused stuff ends up in page cache of a `/usr/bin/su` file. The point of all of this is that no matter how insanely improbable an exploit could sound in theory, it is now possible. Which is why, for the foreseeable future, it is justified to treat everything on the internet as potentially compromised. --- Title: Why lockfiles aren't enough: your new defense plan Category: fugues If you're a reasonable developer, you probably are not fetching packages straight from the registry every time you create a new environment, so the next meaningful thing you probably should stop doing everything and configure a cooldown period for dependencies. pnpm, bun, npm, and even uv all support it. This may sound dramatic, but that's literally [what (#82)](https://github.com/ischemist/syntharena/pull/82) [I (#68)](https://github.com/ischemist/project-procrustes/pull/68) [did (#39)](https://github.com/ischemist/project-prometheus/pull/39) the moment TanStack attack was discovered. If you're a python developer, you're most likely starting from behind... ## Python's default workflow is a supply chain attack waiting to happen In the JavaScript ecosystem, you already have the first line of defense by using `npm ci`, `pnpm install --frozen-lockfile`, or `bun install --frozen-lockfile` which resolve dependencies from a frozen lockfile:sidenote[that specifies exact package versions and their binaries] rather than fetching whatever is the latest package from the registry. Lockfiles were introduced to [make developer environments reproducible](/writings/tutorials/comprehensive-guide-to-uv#what-is-a-lockfile), but they also happen to defend you:sidenote[to maybe 99% extent] from supply chain attacks. Python developers, on the other hand... have _their_ way of doing things and are unbothered with the question of reproducibility, so will most likely yolo `pip/conda install -r requirements.txt`. If you are still using system python, or `python3 -m pip install`, or any variation of pip-installing into an environment you didn't explicitly create: you **must** stop. You must forget these commands exist: ```bash pip install package-name pip install -r requirements.txt pip install -e . ``` These are not just "legacy workflows;" they are actively making you vulnerable to supply chain attacks. The only moderately safe alternative is resolving from an actual lockfile: ```bash uv sync # or, for a closer match to `npm ci` uv sync --locked ``` I have [a more elaborate tutorial on best practices for dependency management with uv](/writings/tutorials/comprehensive-guide-to-uv), which explains in detail the difference between a wish-list like requirements.txt and a proper lockfile. ### Jupyter notebooks are now hostile by default I've been [a long-time hater of Jupyter Notebooks](/writings/research/active-learning-over-chemical-space), but previously I could still see why some researchers might prefer to share their research artifacts in this format. Now the idea of executing some unknown script by pressing "click to run" on a collapsed notebook cell feels like playing a Russian roulette. So yeah, I'm probably starting to treat all jupyter notebooks as malware:sidenote[yes, of course you can run jupyter notebooks using a dedicated local environment and even using uv sync, but the priors are not in favor of notebook author being a security aware engineer] ## Use dependency cooldown period Starting from uv `0.9.17`, you can also specify a cooldown period for dependencies by updating `pyproject.toml` ```toml [tool.uv] exclude-newer = "7 days" ``` or your global uv config `~/.config/uv/uv.toml`: ```toml exclude-newer = "7 days" ``` which will prevent `uv` from installing any package version update released in the last 7 days, which, hopefully, would be enough for the general community to notice if a release was compromised. Similar minimumReleaseAge options exist in pnpm (which, in fact, was the first one to introduce the practice) and other JS package managers. ### Cooldown guard There's no single best number to choose for the cooldown period. The [TanStack attack](./sci-fi-cyberattacks) was detected within 20 minutes, primarily because it's such a popular family of packages that security focused companies actively monitor them. An older [liteLLM](https://www.stepsecurity.io/blog/litellm-credential-stealer-hidden-in-pypi-wheel) supply chain attack was detected after 2 days and relied on a month old compromise of Trivy package. So you might be tempted to choose a very long cooldown period, but then what happens if some package releases a security patch to a high severity issue? We don't have a good solution to this. In uv, you can manually exclude certain packages from the cooldown period, and while that helps with the installation of immediate patch, unless you remove that exclusion later, it defeats the purpose of the cooldown period. There's no good industry solution to this problem, and I personally came up with a simple package [cooldown-guard](https://github.com/ischemist/cooldown-guard) that keeps track of cooldown exclusions for security patches and removes them after cooldown period expires. ## Enable dependabot alerts on GitHub The good news is that the infrastructure for vulnerability alerts is already quite automated. Any GitHub repository has a "Security and Quality" tab, which [includes a "Dependabot" section](https://docs.github.com/en/code-security/concepts/supply-chain-security/about-dependabot-alerts) that allows you to enable automated scanning and reporting of alerts for security vulnerabilities in your dependencies. In fact, you can even enable automated PR creation with a dependency upgrade to patched versions, if such are already available. This sounds like a GitHub ad read, but it truly just works for me personally (e.g. [periodic group dep update (#81)](https://github.com/ischemist/project-procrustes/pull/81), [security update that closes 5 moderate-high CVEs (#67)](https://github.com/ischemist/syntharena/pull/67), [another security update closing 3 CVEs (#59](https://github.com/ischemist/syntharena/pull/59)). ## Eventually your laptop might still get compromised And so you should already have 2-factor authentication enabled everywhere you can, but I personally decided to take the further step and start using physical security keys: YubiKeys. ### Physical keys are the last line Even if my laptop gets compromised, as a next layer of defense, to prevent an attacker from having access to all my ssh keys, I started to use [YubiKeys](https://www.yubico.com/product/yubikey-5c-nfc/). Does everyone need to use one? Probably not. But I use my SSH keys to: - access clusters with significant GPU allocations - access the servers where my websites are deployed, and if getting ischemist.com temporarily pwned is not the end of the world, I'm much, much more inclined to protect access to say [syntharena.ischemist.com](https://syntharena.ischemist.com/) or, especially, [grow.ischemist.com](https://grow.ischemist.com/) So it felt like an obvious next step to take. --- Title: Your work wasn't worth hacking. AI changed the math Category: fugues Unless you're a security specialist, you probably never worry about cyber security beyond following the common sense practices like not visiting sketchy websites, not clicking on suspicious links that come from unknown sources, and not typing your credit card number on a sketchy website. Unfortunately, if you're doing anything of economic / societal value, you must immediately start worrying about cyber security and changing habits. The mental model you should have is that EVERYTHING on the internet can be and will be compromised. If you're a computational scientist, that means any package you install can immediately lead to loss of all your passwords, ssh keys, and other sensitive information, and your most immediate action to mitigate this can lead to irreversible damage: > Please be careful when revoking tokens. It looks like the payload installs a dead-man's switch at ~/.local/bin/gh-token-monitor.sh as a systemd user service (Linux) / LaunchAgent com.user.gh-token-monitor(macOS). It polls api.github.com/user with the stolen token every 60s, and if the token is revoked (HTTP 40x), it runs `rm -rf ~/.` (It looks like it might also have a bunch of persistence mechanisms. I haven't studied these closely.) ([from May 11 TanStack attack discussion](https://github.com/TanStack/router/issues/7383)) [In the first voice](./ai-changed-the-math/sci-fi-cyberattacks), I share my understanding of the two most recent exploits that scared me enough into actually changing my daily habits: TanStack supply chain attack and CopyFail. [In the second voice](./ai-changed-the-math/beyond-lockfiles), I share the practical steps I'm taking to mitigate these risks and why most python developers immediately became radioactive liabilities for any company. Some readers (particularly not in tech) may be tempted to dismiss these warnings because they don't use Github tokens or ssh keys, and so do not have much to lose. So let me paint a realistic picture. Losing ssh keys or API tokens is the default behavior of most exploits because they're required to gain access to more critical/valuable systems, which would be the source of revenue to the exploiters. See, finding an exploit used to be very, very difficult and required a lot of effort from a very narrow set of specialists. It was so expensive, you could only justify such expenses if you could penetrate, say, a large proprietary database. It is even rumored that intelligence agencies might have, at any point in time, a set of silent exploits that they've never used or disclosed, saving them for a very rare special occasion which would justify their use. With the recent progress in AI, finding exploits is becoming cheaper and faster, which inevitably will result in the lowering of the threshold of immediate economic benefit that would warrant their use. For example: - attacking devices of a computational scientist in a pharma/biotech company and stealing the structures of drugs being developed - attacking devices of pharma/biotech employees and silently corrupting critical research data: raw measurements, analysis, experimental inputs Why? Out of spite, out of competition, out of desire to railroad clinical trials and earn money by shorting the stock. Most people never had to seriously entertain such outcomes, and if I were to guess, mostly because they didn't think there were enough people in the world who had both the capability and intent. Well, the AI is changing the capability aspect rapidly. And if you're dubious if there are people who would be spiteful enough to do something like this, you probably forgot the case of [NeurIPS 2024 award-winning paper](https://www.wired.com/story/bytedance-intern-best-paper-neurips/) written by an intern who, reportedly, "deliberately disrupted experiments, causing erroneous and irreproducible results":sidenote[by modifying the cluster pytorch source code, changing seeds, randomly killing multi-node processes, and directly modifying model weights] and was later sued by ByteDance (where he interned) for $1 million. So yeah, it was never about lack of people who didn't have the intent, it was only the question of whether they had the capability. And if they don't have it widely available now, they will in the nearest future. A reader non-affiliated with the entities working on AI progress might be tempted to object: well, I didn't ask for AI models capable of cyber attacks, why are we allowing their development? [In the third voice](./ai-changed-the-math/ai-dual-use-dilemma), I argue that the way we, as a society, handle this challenge will determine whether we will ever be able to have any computational tool that could cure all disease. --- Title: A butterfly effect from a nested for loop Category: fugues People catastrophically underestimate how much the world starves for software; even a plain, simple CRUD app and a few for loops could significantly increase the planet-wide utility function and make humans happier. Even the ugliest piece of code with 4 nested for loops and 3 nested if statements can end up upstream of something like \$3 M in net present value or \$7 M in lifetime earnings if it changes which labor market a stellar student gets to compete in. You want to see how I got those numbers? Buckle up. ## What is arbitration? In high school, I participated in chemistry olympiads, which basically were an alchemical athanor in which all my current work ethic skills were forged. Point being, they were quite instrumental in shaping my career, so it's not surprising that after I graduated I wanted to give back and I ended up helping with national olympiad organization in Kazakhstan for ~5 years. For those not familiar, here's how a typical final stage of the national olympiad looks like: first day you write a theoretical round (solve a bunch of problems), second day you chill, third day you do experimental round, and fourth day you participate in arbitration: a session when you can come to the jury who graded your work and argue that you should get more points than you have received. A common misconception among people not familiar with olympiads is that arbitration is not necessary if you have a sufficiently competent jury; that it's only needed if you worry that the members of the jury will make mistakes. However, even the most competent professor (who are often invited to the jury) might misgrade a work if basically he has a day to go through 150 works, usually grading 3-4 open-ended problems with multiple subparts where you don't just give points for the correct answer; you also have to check if there's good reasoning (and many problems can be solved in slightly different ways). But even if somehow your jury gets supernatural powers and makes no mistakes in grading, a student can come and easily argue his way for as much as 3 percentage points. How? See, when you design a problem, you suffer from the bias of knowing the correct or intended solution. So the most you can guarantee is that your solution is logically correct, every reasoning step is justified and supported by the immediately preceding ones. But unless you put yourself in the condition of seeing the problem for the first time under time constraint, you have no idea if there are other reasonable ideas someone can come up with and get railroaded into a different solution that satisfies 70-80% of your problem, and so a student gets stuck at the remaining 20% not realizing that he's on the completely wrong branch of the solution space. And if you happen to be such a student, you might easily argue "how could I have known that at this branching point in logic I was supposed to do X and not Y? the problem is underspecified." Which is why for many olympiad participants arbitration is one of the most memorable and fun parts of the whole process. It starts at 9am and can easily continue all the way until 10pm. Members of the jury usually sit in the same room until every single student who wanted to talk to them has had a chance to do so (which, when combined over all problems, might easily add up to 30-60 min per student). ### Arbitration in the age of COVID In 2022, even though COVID was on the decline, the national olympiad was still happening remotely. As such, olympiad organizing committee (which is a bunch of bureaucrats:sidenote[to be fair, some of them were good people] from the Ministry of Education) came up with a brilliant idea: to avoid chaos, let's require students to fill some Microsoft form indicating which problems they want to arbitrate the day before arbitration,:sidenote[so technically before they even see their scores, which usually are posted the morning of arbitration simply because they're not ready earlier] and then create a rigid schedule, which, given the number of students, amounted to 5 min per participant. Like hop on a Zoom from 9:35 to 9:40am, you talk to the full jury committee at the same time, and you have to do that from a "special anchor school":sidenote[whatever the fuck that means]. Mind you, different jury members grade different problems, so there'll be 5 jury members who will sit idly and do nothing while a student argues with one particular jury member. Why not allow separate schedules for separate jury members? Only because it'd be too much work to create such a schedule. After all, you have to read through the form, do a mapping between students and jury members, and then try to create a conflict-free schedule. And the arbitration schedule has to be sent to the participants in 2.5 hours, so yeah, suboptimal, but WHAT ARE YOU GOING TO DO? Well, I gather you understand how bad of an idea this is given my extensive aside into how arbitration is supposed to work, so I, only having some elementary coding training (by that time I had only taken 6.009 at MIT, i.e. before even my first algos class), decide to speedrun a simple script to parse the form, do the mapping, create the schedule, and export it as an Excel file that organizers can share. I managed to finish in those exact 2.5 hours, [here's the code](https://github.com/anmorgunov/arbitration); nothing fancy, I didn't do any smart bipartite graph coloring approaches, no, it's a brute-force 4 nested `for` loop check for conflict: ```py def _is_there_a_conflict(self, data): for grade, juryToStudents in data.items(): for jury, students in juryToStudents.items(): for i, student in enumerate(students): for jury2, students2 in juryToStudents.items(): if jury2 != jury: if len(students2) > 0 and i < len(students2): if students2[i] == student: return True return False ``` and a simple "move the conflicting student to the end of the queue" ```py students = students[:i] + students[i + 1:] + students[i : i + 1] ``` I run the script, get the Excel file, and send it to the organizers and ask them to let us do it this way. It probably did help that I had earned some good reputation and it definitely helped that the ultimate people in charge were rational, so they said ok, but you take full responsibility. Fine. If you wonder, arbitration went remarkably well, we haven't had to turn around a single student, we had a publicly facing live Excel sheet that jury members updated to indicate who was currently in the Zoom room, who's in the waiting room, and who's done. We didn't impose a time limit on our interactions, and yet we were so efficient we finished early and so gladly accepted arbitration from people who didn't fill the form:sidenote[some of them didn't know they were supposed to]. ### A 20-million-dollar bureaucratic decision The difference between a gold and a silver medal that year was 1.02 pp in 11th grade and 1.5 pp in 10th grade. A gold medal gets you invited to the national camp. A silver medal doesn't. If you get invited to the national camp, you participate in the selection process for the Mendeleev olympiad. Which opens the door for selection to IChO (the ultimate international olympiad). IChO is an incredibly powerful signal of your competence to any self-respecting university. You can't say that an IChO medal increases your chances of admission to MIT, but it's definitely true that the kind of people who get a medal at IChO are more likely to be the kind of people that have a good chance of being admitted. Let's do a rough estimate of the difference in career outcome for a silver and a gold medal. For an upper bound of the delta, we can assume the gold medalist gets into MIT (or another top-tier US college), which opens a path to a career in big tech, biotech, or finance, while a silver medalist goes to a local university and has a strong career at home. | year | Kaz average | strong Kaz outcome | average US outcome | MIT / strong US outcome | elite US tech / finance | | ----------------- | ----------: | -----------------: | -----------------: | ----------------------: | ----------------------: | | 1 | \$10k | \$15k | \$70k | \$146k | \$180k | | 5 | \$12k | \$25k | \$90k | \$175k | \$300k | | 10 | \$15k | \$35k | \$120k | \$210k | \$450k | | 20 | \$20k | \$45k | \$150k | \$240k | \$600k | | 30 | \$25k | \$50k | \$170k | \$250k | \$700k | | 40 | \$20k | \$40k | \$150k | \$220k | \$500k | | lifetime earnings | \$0.75 M | \$1.58 M | \$5.51 M | \$8.84 M | \$20.93 M | | NPV @ 5% | \$0.28 M | \$0.60 M | \$2.10 M | \$3.55 M | \$7.80 M | The fourth column is anchored at MIT's published \$145,820 average starting salary for graduates entering industry, while the fifth is an estimate for someone who lands in top-end US tech or finance.:sidenote[See [MIT's return-on-investment page](https://sfs.mit.edu/undergraduate-students/the-cost-of-attendance/return-on-investment/). The other trajectories are illustrative back-of-the-envelope paths in nominal pre-tax USD.] Lifetime earnings are obtained by adding up yearly wages, with linear interpolation between those milestone years, and to get a net present value (NPV), we have to discount future dollars: $$ \mathrm{NPV} = \sum_{t=1}^{40} \frac{y_t}{(1.05)^t} $$ Compared to "strong Kaz," the "MIT / strong US" outcome results in a gap of about \$7.25 M in lifetime earnings and \$2.96 M in NPV, while the "elite US tech / finance" outcome pushes that to about \$19.34 M in lifetime earnings and \$7.20 M in NPV. And you only get even a chance of playing for numbers like that if you get invited to the national camp, and that might end up depending on whether you get a chance to defend your work in arbitration and get the 2 pp you deserve (which would move you from the silver category to the gold). A simple mundane bureaucratic decision to impose an artificial time limit and cram all juries into a single Zoom meeting, purely because nobody could manually create individual schedules fast enough, can literally sit upstream of a multi-million-dollar fork in the lifetime earnings of a 17-year-old. ## Every single scalable societal change is bottlenecked by code If you follow my recent work, you might find that I have a particular OCD manifesting in the creation of websites. For example, I wrote an academic review article and couldn't help but accompany it by an [interactive portal with key ideas](https://ischemist.com/syntax-of-matter), reading paths, interactive tables. Or I wrote an academic paper establishing a new benchmark and accompanied it [by a web portal with leaderboards, inspection of all routes and comparison to reference experimental routes](https://syntharena.ischemist.com/). And it's not just downstream of me having access to LLM coding tools; I learned to create websites even before LLMs. See, back in 2020, I decided it's not worth wasting a year of my undergrad on remote studies, so I took a leave of absence and started a nonprofit in Kazakhstan aimed at creating resources that help students who are interested in learning science beyond the curriculum. I quickly discovered that pretty much anything scalable I wanted to do required writing code. - You wrote a comprehensive guide on olympiad prep and you want to disseminate it? You need a website. Sure, you can use WordPress, and for a single blog post it works, until... - You also think it'd be a fantastic idea to create a central source of past olympiad problems, and when you have thousands of them, if you want good user experience and curator experience, you pretty much have to write a custom website. - Oh, and wouldn't it be nice to have an archive of olympiad results, so that students 5 years from now can look up how many points they needed to score to get a certain medal. Again, a website. - Oh, you want to create some low-stakes but realistic practice of an olympiad and you wrote some problems? Cool, if you want to grade stuff efficiently, you need software. Gradescope is a good example, and it was an extraordinary quality of life improvement, until the COVID promotion ended and you had to pay \$20 per seat per month, and your only source of revenue was \$200 donations each month (which is actually a lot for a grassroots nonprofit in Kazakhstan). I was coming up with brilliant ideas every week, and every single one of them ended up being a message to a full-stack web dev guy, who was taking care of some of our projects in his free time. The good and bad part at the same time is that he was a great web dev: he had no shortage of options to earn incredulous (even for an adult) amounts of money creating websites, so he didn't have much free time, and every hour spent on creating websites for us was incurring a real opportunity cost. Basically, even though we were an educational nonprofit, every. single. initiative. was bottlenecked by code. Can you imagine how much more we could've done if we had LLM agents back then? --- Title: Progress is constrained by latency Category: fugues An observation well-known to any designer:sidenote[fun story: my freshman winter break I took a How to Design intensive (4.02A) from MIT's Architecture department and I expected to be taught the methodological procedure for creating good design, but instead the class was basically: here's a piece of styrofoam, just do something with it. And when you try and do something and you get something shitty, you expect some magical advice, but you only hear: that's fine, just iterate. At the time, I thought those 3 weeks were such a waste of my time, but looking back, honestly, one of the most based classes] or coder is that success and quality is a function of the number of iterations. What if this is a more universal law of nature? What if it applies equally well to physical and life sciences? A huge reason (or at least post-factum rationalization) for my shift from experimental to computational research was the realization that the time gap between a formulation and verification of a hypothesis in computational sciences is orders of magnitude smaller, so if I liked coming up with ideas and testing them (which I did), I could do much more with a computer than with my hands. I always considered this to just be a personal preference, but what if rapid iteration is a prerequisite for any good science? What if the reason for the difference in the rates of progress in the worlds of atoms and bits:sidenote[if you're not terminally online, this is a distinction introduced by Peter Thiel who observed that over the past 50 years we had tremendous progress in the world of bits, but in terms of atoms the world hasn't changed much since the 1970s] is not the "we've already picked all the low-hanging fruits" or the lack of effort, and not even a combination thereof, but the lack of specific engineering effort targeted at trying as hard as possible to reduce experimentation latency? Which would be very plausible since it might necessitate spending weeks, months, if not years on work that is orthogonal to actual "doing science" (even though it might be a prerequisite for paradigm shifts in the long term)? ## Some disciplines are more fertile for the formalization of best practices, but those practices are domain transcendent Revisiting the argument [made in "We need SWE minds"](./we-need-swe-minds), what if linting, type checking, testing, versioning (branching, commits, PRs) as abstract concepts are not unique to programming in any deep ontological sense, but are more universal ways of accelerating and measuring progress? And so it's not that "you **can't** define these things in experimental science", it's just that it's a bit harder to define them in experimental science, and they're less likely to organically crystallize as common-sense best practices (like they do in coding), but if we force ourselves to search for how to define the parallels, we will find them and as a bonus will accelerate experimental research. In other words, what if some disciplines provide a more fertile ground for the articulation of best practices (because they have cleaner feedback loops or are, for structural reasons, more susceptible to formalization), but these practices, once abstracted to their normative core, have universal scope? ## A lack of verifiable rewards is a blocker for human research Rapid improvement of AI capabilities in math and coding is partially caused by the success of reinforcement learning on verifiable rewards (RLVR). A basic idea is that you can easily check if a math proof is correct,:sidenote[e.g. by checking if it compiles in Lean] or you can check if the code is correct by checking if it passes test cases. And things like versioning/commits make it incredibly easy to generate rich synthetic datasets. For those unfamiliar, a commit is an efficient snapshot of a codebase, basically programming has a way of you being able to track every single change to your documents without creating manual copies of each document and having a zoo of file names: ```bash . ├── my-code-first-version-v1.txt ├── my-code-some-feature-added-v2.txt ├── my-code-some-bug-fixed-v3.txt ├── my-code-final-release-v4.txt └── my-code-bug-fix-final-final-release-v5.txt ``` One obvious way to train on code is to use commit history as paired examples of intent and targeted change. Take `my-code-first-version.txt`, craft a prompt for which a perfect response would be all the differences added to make `my-code-some-feature-added-v2.txt`, and then a model is trained on the resulting pairs (prompt, code changes). For mature codebases, commits are usually very small targeted atomic changes, so a hobby/open source project might have hundreds or thousands of them, and enterprise codebases (e.g. Google's monorepo) have tens of millions of commits. And you can create a very high quality training scenario on any pair of commits. Naturally, when an AI bro, seeing how far you can push AI models in this environment, is saying "it's so over, we're going to cure all disease," it's very easy and tempting to counter-argue by saying: 1. We don't have the equivalent of linting, type checking, and testing, so you can't easily verify correctness of proposed actions 2. We don't have the equivalent of versioning, so where are you going to get all the datasets And I find it very, very hard to even consider for a second that git-style versioning would not be revolutionary in experimental research. Maybe we can't perfectly repeat an experiment because life is inherently stochastic and cells might just decide not to reproduce. Or maybe you're simply following a slightly different procedure because whatever you wrote in your lab notebook is an inaccurate representation of the steps you actually took last time. Say you want to have a perfect account of all chemical reactions performed in a lab. Here's how a human typically approaches synthesis: you find a literature precedent for the reaction you want to perform (say A + B = C) and you check the ratios of moles of each compound used (e.g. 1.1 mole of B for 1 mole of A:sidenote[optimal ratios might not necessarily be 1:1 even for a reaction that is on paper 1:1]), you recalculate the amounts of A and B you need to use for your particular scale (say you need 50 mg of C), you write in your notebook the masses of A and B to add, like 34.2 mg of B and 5.3 mg of A. Then you read the procedure from the precedent which might look like "dissolve A in solvent, cool down to 0°C, add B", and ideally you write that procedure in your lab notebook. You go to the lab, get the actual containers with A and B, go to the balances and try to get roughly 34.3 mg of B and 5.3 mg of A. Because density of compounds can vary quite a bit in solid form, you might misjudge the mass corresponding to a full scoop and you might take 5.5 mg of A out of the container. If you're doing things properly, you're not supposed to put stuff back into the container,:sidenote[compounds might be hygroscopic, i.e. they absorb moisture from air] so you either need to discard the rest or you might think, ah, not too big of a difference, let's yolo 5.5 mg. If you were to ask a competent SWE to engineer a system for accounting of all chemical reactions, he'd create dedicated fields to every mass measurement, create an inventory of all compounds, which would allow a user to pre-select compounds from a list and the program would automatically know things like molecular weight. So when a user enters 5.5 mg, the system can do a sanity check and re-calculate the de-facto ratios of compounds in your system, and if your intent was to have 1.1 B to 1 of A, with those extra 0.2 mg of A, you have 3.7% more of A, so your de-facto ratio is more like 1.06 B to 1 of A, which might be a very significant difference. Never in a million years would an experienced SWE think to just slap in a single text box and ask a user to enter all relevant information. Because if you think you'll collect high quality data like that, boy I have a bridge to sell you. And yet this is exactly how thousands if not millions of experimental scientists log their experiments every day! And you'd be lucky if the procedure is written in a lab notebook before the experiment is actually performed and not written post-factum from a scientist's recollection at the end of the day (hopefully that same day). Because it surely can never happen that a grad student comes to the lab at 9am, realizes that his experiment would run 6 hours, has some "research in progress" talks at 10am-11am, and realizes if he writes everything down before the experiment he won't have time to actually set it up before the RIP:sidenote[yeah, that's the abbreviation many departments unironically use] talks, but starting it at 11 would mean he wouldn't even be able to start a workup before 5pm, which of course is never going to be a relevant consideration because [grad students are surely trained to treat science as a holy mission](https://www.nature.com/articles/s41562-025-02376-2), and so he surely won't decide to set up an experiment before RIP talks real quick and do a writeup later, after his short-term memory has been cognitively overloaded with slides that show tens of bizarre abbreviations:sidenote[here's an example sentence pulled from a Nature paper: "to provide further evidence that IκB modification may be regulated by NHERF2, we co-transfected Flag-tagged IκB and Myc-tagged NHERF2 with two HA-tagged Ub (wild type Ub or K48-linkage-type-only Ub, HA-Ub or HA- K48) into HEK293T cells"] denoting proteins and intricate interplays and not-at-all self-explanatory charts. Surely his recollection of the actual steps performed 2 hours ago to set up an experiment will be accurate. Right? RIGHT? Basically my point is that yeah, we can't cleanly extrapolate the way we train AI to write code into experimental science research, but not because the latter is somehow epistemically exceptional and therefore immune to technological scaffolding that makes dataset construction and verification computationally tractable, but because academia was too proud to pay market rates to competent SWEs to digitize data collection, so it hasn't been done _yet_, but there's no reason to believe it _couldn't_ be done, and most importantly no reason to believe it _shouldn't_ be done. Because maybe, (and this is a crazy thought), maybe human-led progress also requires highly structured and accurate accounting of all performed actions and helpful runtime validation sanity checks on all quantitative data. So maybe lack of clear RLVR is a roadblock not just to AI progress, but to any progress. --- Title: AI may write the code. We still need SWE minds Category: fugues Quite a few people are amused by the perceived irony of Silicon Valley engineers setting out to create an all-powerful digital god (AGI) which so far only seems to automate software engineering, i.e. AI will leave software engineers (SWEs) that created it out of jobs first. But will it? Being a good coder is not about knowing a programming language or a framework, it's a state of mind, an _ethos_, a way of life, really. It's a general attitude that you can build and change things, a tendency to default to an optimistic outlook. It's also a culture of working towards clear, objective, measurable outcomes with clear metrics of progress. Breaking down a huge problem into chunks of well-scoped tasks undertaken one pull request at a time. The concept of having artificially imposed guardrails like unit tests, contract tests, integration tests, regression tests, type checks, strict linters. All of this might sound so trivial to any coder: "boy, are you really writing an ode to commits and GitHub workflows?" To which I say: you have no idea how foreign these concepts are to pretty much everyone outside of CS. It is frequently "discovered" that upwards of 80% of peer-reviewed research in chemistry or biology is actually non-reproducible. These numbers usually shock tech people, but let me rephrase this in a language you'd understand: 80% of codebases that were written without a single refactor contain a critical bug. Any seasoned coder knows from experience that no matter how diligent you are in planning, as you build out a codebase, eventually it gets to the point of being a slight mess that can and should be reorganized. In the process, you often revisit assumptions or even discover latent bugs. There's no such thing as finished software; there's always more to change, implement or fix. No matter how great your team is, when you release some major new version, e.g. v1.0.0, you'll almost immediately find a reason (maybe even within a day) to release v1.0.1. And yet, in experimental science a publication might report (or even be written around) an experiment that was performed just once. And of course, there's a factor of real or apparent:sidenote[i.e. a process is sensitive to variables you don't or even can't control] non-determinism of experiments, especially if the experiments involve living cells, which explains a part of the 80% figure, but I think it accounts for much less than experimental scientists would think (or want to think). And so let's say AI wipes out 90% (or even a 100%) of current SWE jobs, what's going to happen when these engineers would start migrating to physical and life sciences jobs?:sidenote[which are currently considered to not have (easily) verifiable rewards, and so, almost proudly, immune to RLVR, but read next voice] How much comparative advantage would a guy who is accustomed to iteration and the culture of self-imposing sanity checks (like type checks and tests) have? Here's how I think about this. Imagine the dumb mistakes any developer can make, and regularly makes, regardless of experience, that should be caught by CI/CD. For example, you start an expensive training run, spend a few hours of GPU on one epoch, and then your code suddenly crashes because of some small mistake in your validation loop or checkpointing logic. I'd bet every single person who has ever trained a neural network has made this mistake. And through this tragedy at small scale you discover the justification for simple smoke tests: let's just call each critical function and let's make sure it runs to completion. And then, at some point in the future, you'll make some change in your code, and no matter how diligently you'll try to make sure to think of every downstream function you need to update, chances are you'll open a PR and get a failing test, read, and think "Oh, yeah, I forgot about X" or "oh, yeah, there's this not exactly obvious second-order effect." My argument is quite simple. You either have to believe that experimental scientists are fundamentally incapable of making such mistakes, maybe because they're biologically built different or they have such robust training programs that it is unthinkable for them not to measure twice, OR it should be obvious that the lack of comparable guardrails like CI in experimental science is slowing everyone down. An experimental scientist might be eager to deflect by arguing that things like linting, type checking, testing, versioning (branching, commits, PRs) are unique to coding and are not easily transferable, but how hard did anyone search for the parallels? I'm not ready to make a judgment as to whether some discipline (e.g. experimental chemistry or biology) is epistemically more difficult than another (e.g. coding). But what I am willing to say is that maybe all disciplines are epistemically more similar than we are currently ready to admit. ## In the past 20 years, the market needed SWEs. Now we need people who think like SWEs Even though agentic AI is already capable enough of being transformative both at the scale of individual lives and entire disciplines, it's not going to unlock these transformations without a cultural evolution. Let's go back to the [example with scheduling arbitration](./million-dollar-ugly-nested-for-loop). Without starting a normative rant, I'll make a few descriptive statements: I was not asked if I could re-run the same script for other disciplines, nor I was asked to prepare a handoff of technology so that it can be reused in the following years. If olympiad organization was a GitHub repository, we'd immediately create an issue "Integrate the pilot scheduling logic into the arbitration module" and be put on a roadmap for the next year. But it wasn't. And to be precise, I'm not saying everything should be a Git repo (although many more things should be), but ask yourself how many initiatives would benefit from: - having a place where you can put a note "hey X is not working as intended" or "next year we should definitely do X again" - AND so that this place is actually a utilized (which often requires it to be a unified) resource that people can revisit in 8 months when they start working on the next event - AND so that in 8 months someone can go back and revisit the methodology used to do something last year If you're an active AI user, you'd know that the barrier for reorganizing your work in a way to allow you to reap these benefits (either by creating custom web apps or by adjusting day-to-day workflows so that they're suitable for existing software) is already zero. But if we take any lessons from the 30 years of breaking barriers with internet (think online courses, technical blog posts, educational videos), we have a systematic tendency to overestimate the role of barriers to activity and underestimate the importance of intent, urgency, the desire to be in the arena to strive and achieve. Leaving aside whether those tendencies are innate to every human being or learned, they definitely are utilized in different disciplines to a varying extent, and coding is one of the tasks that requires them on some deep fundamental level. ## But have you met CS majors in real life? A natural conclusion is that even though demand for people who actually write code might decrease, we still need people trained to write code because in the process they're trained to think like SWEs, and we'll need way, way more people who can think like SWEs. Now, I understand it might be very easy for people who are familiar with the tech world in practice to challenge this take because an average graduate of a CS program is not necessarily someone you'd trust with making consequential decisions, but there are two traps I want to highlight: First, tech people:sidenote[despite the emergence of accelerationism movement, which is in some ways reactionary to the status quo] tend to be way more skeptical:sidenote[and so, in Popperian sense, they might even be the only true scientists left today] about the viability of any particular solution to any problem. For whatever reason, there's a very real and natural tendency of deeply competent tech people to significantly underestimate their competence (even if relative to the rest of the labor force) and ability to impact change:sidenote[I didn't understand the extent to which tech people tend to spiral until I saw the contrast between Yale and MIT] Second, there's little point in comparing the skills, competence, ability to create economic value or effect change by looking at the representatives of the lower quartile of any particular occupation, or even, one could argue, the median one. If you think an average coder is too dogmatic and too susceptible to group think (which would directly falsify my claim that SWE-style thinking is uniquely powerful), do you really think an average PhD chemist or biologist is any different? For any sufficiently large group of people, the in-group variance is too significant to the point of making inter group comparisons of medians almost futile. And so the only question we should ask is whether a particular discipline or vocation is more likely to impose helpful and generalizable frameworks and skills to the top quartile/decile of whoever attempts to learn that discipline and undertake that vocation, and in this framing I think my take becomes much more reasonable. --- Title: Software is a Force Multiplier Category: fugues Despite the breathtaking pace of improvement in AI, there's still plenty of skepticism around the potential impact of AI on our economy and technological progress. This fugue explores why sentiments like "yeah, but what can an LLM do besides writing code?" and "AI is improving in domains with verifiable rewards, and my discipline (experimental chemistry, biology, physics, whatever is your favorite) does not have well-defined rewards, so it's not going to change much" are deeply, fundamentally, maybe even epistemically misguided. All three voices return to the same theme: people systematically underrate software because they confuse writing code with a narrow technical activity rather than with a general instrument for changing systems, a method for reducing the time between hypothesis and verification, and a fertile ground for articulating epistemic guardrails whose validity is domain-transcendent. The first voice is the most concrete and it shows how even an ugly nested for loop can have million-dollar implications for lifetime earnings. The second voice broadens out and argues that software engineering is not limited to actually writing code, but is instead a craft that forces habits of decomposition, guardrails, explicitness, and iteration that are weirdly rare outside CS and increasingly useful everywhere. Practically, it demonstrates why you should still study programming even if AI will write all the code. The third voice is the most general. It argues that success in many domains is downstream of the number of iterations you can afford, and if your domain doesn't have clearly articulated verifiable rewards, then it's not just an obstacle to AI progress; it very likely is a blocker for human progress too. --- Title: Grigori Perelman's teacher on why he rejected the Fields Medal Category: long-form ## Preface 4 years ago I watched [an interview with Sergey Rukshin](https://www.youtube.com/watch?v=P6Bl9yBgfB4), who taught math to two future Fields Medal laureates, [Grigori Perelman](https://en.wikipedia.org/wiki/Grigori_Perelman) and [Stanislav Smirnov](https://en.wikipedia.org/wiki/Stanislav_Smirnov), during their high-school years. Given the breathtaking progress in AI, particularly in AI-guided math problem solving and theorem formalization, there's a general public interest in Fields level research, and once you start looking into the grand challenges of math it's hard to ignore the only man ever to solve a millennium problem, who adamantly refused to accept the prize for it. Perelman is often mythologized, so I thought it's worth transcribing and translating:sidenote[both done with Gemini 3.1 Pro and light editing] the original video interview from Russian to English to increase its reach. It also had a very profound impact on my attitude to research. At some point, Rukshin notes: > Let's remember that in Russia, it wasn't unheard of for **an engineer whose bridge collapsed to put a bullet in his temple**. This responsibility, if you will, was also part of the culture of the Russian school in a broader sense—engineering education, military education, and so on. It was a part of general education, higher engineering, and military education. It is responsibility for what you do. It left such a strong impression on me that I didn't even want to fact check it; even if it was an exaggeration, I preferred to live with that myth. A few years later, I stumbled upon this photo: ![](/og/writings/long-form/perelman-teacher-on-why-he-refused-fields-medal.webp) the caption reads "Testing of the span of the first bridge across the Irtysh River", and the crowd directly under the bridge is supposedly the engineering group responsible for the bridge design. And I think, however harsh it sounds, Rukshin's phrasing of responsibility is something that:sidenote[in my absolutely subjective view] is mostly absent from the minds of scientists today. > Disclaimer: I am translating and annotating this interview because it's a historically significant document. The views expressed by Sergey Rukshin are his own. Presenting them does not necessarily constitute endorsement. ## The interview **Solodnikov:** Sergey Evgenievich, you have mentored a huge number of mathematicians, including some outstanding ones. Among them are two Fields Medal laureates, Grigori Perelman and Stanislav Smirnov. Tell me, please, what was it about the education system in which you worked—and about you, of course, as a teacher—that allowed you to raise such young men? **Rukshin:** Well, first of all, to be honest, it wasn't just me. It was also their natural abilities, their upbringing, and so on. The Fields laureates, and my, what is it, four or five Salem Prize winners, and all the rest—they are not products of an educational system alone. They are products of an educational system into which a specific individual arrives, an individual whose family has instilled in them a certain motivation, who may or may not want to work to satisfy their own ambition. As for the system I worked in, well, I'm still working in it. It had several distinctive qualities that the Russian school has traditionally inherited from ancient times. Under socialism:sidenote[during Soviet times], when I was accused of this, it was a very damning verdict, because I was told that the mathematics center I built was based on capitalist principles. **Solodnikov:** They told you that under socialism? **Rukshin:** Yes, that it was focused on results. So, let's be honest: Russia's educational system, starting at least with the specialists Ivan the Terrible invited to teach our own, then under Peter the Great, and later with the invitations to foreigners in the 1930s, was always aimed at achieving a result. So, the first thing is that within the existing educational system, I managed to build a system that was aimed at the maximum self-realization of each person's abilities. It was focused on results, not on pseudo-democratic principles that all children or all students are talented and you just need to unlock it, and so on. You've probably never noticed that, in a way, the ideal education system was built only once, and even then, only in literature. **Solodnikov:** And where was that? **Rukshin:** In the first novel of Akunin's Fandorin series. **Solodnikov:** _The Winter Queen_. **Rukshin:** _The Winter Queen_ [Original title: *Azazel*]. It showed us this supposed educational system built by Lady Astair, in which the individual abilities of each child are identified (admittedly, the system was aimed at orphans, so parents wouldn't interfere), and he is given an education in accordance with those abilities. And our dear countryman Fandorin destroyed that ideal system. Quite successfully, he managed it, though not right away. But that system is ideal. To discover in each person _not_ that they have abilities, under the pseudo-democratic slogan that everyone is capable, but to discover _the_ abilities that they can realize to the maximum degree for the benefit of humanity—we can't do that. We haven't yet invented the methods to do it. Since I limited myself to intellectual abilities—not just mathematics, but theoretical physics, then computer science, then programming. ### on Nikolay Durov, co-founder of VK and Telegram **Rukshin:** I just yesterday had the honor of having dinner with Kolya Durov. Pavel's [Durov's] older brother. The very same Kolya Durov who, after Pavel's initial sketches, wrote the massive code for VKontakte:sidenote[VKontakte was the Facebook of the Russian-speaking internet] that we all encountered. Because he is a mathematician and a programmer. **Solodnikov:** And what was your connection to him before yesterday's dinner? Were you his teacher? **Rukshin:** Nikolai Valeryevich Durov is an absolutely remarkable man. I'm talking about him as a person now. First, he's unique—he has seven medals from international olympiads: three in mathematics and four in computer science. He studied at our mathematics center with my student, Golovanov, and I prepared Kolya for the international mathematics olympiads. So I've simply known him since his early school days. **Solodnikov:** Did you work with the younger brother? **Rukshin:** No, Pavel is a philologist by education, so to speak. By interest. The fact that he learned to program well enough to write the first version of VKontakte was, let's say, a bonus. I know the elder Durov because their father was the head of the Department of Classical Philology at the Philology Faculty of our Saint Petersburg State University, and I also had the honor of knowing him; he was a very well-educated man. So, yesterday I was talking with Kolya Durov, who was visiting St. Petersburg for a week, and I must say that the subject of our conversation was not mathematics or programming at all, but rather Romance languages, philology, translations of foreign poetry into Russian, the merits and shortcomings of Marshak's translations, and so on. As a rule, these people are not one-dimensional, that's my point. So in reality, their abilities are quite multifaceted. And many of them could have realized their potential fully, brilliantly, and for the benefit of humanity in very many fields. ### Perelman's uncompromising integrity **Solodnikov:** Well, may I clarify then? About the two I asked about at the beginning, Smirnov and Perelman. **Rukshin:** Yes. **Solodnikov:** What kind of person is each of them? **Rukshin:** Well, it's very difficult to characterize a person with a short list of qualities. Of course, if we're talking about Perelman, we must emphasize the very qualities that drew the attention of the non-scientific public to him. With all those refused prizes, the unclaimed millions... Perelman is a unique product of the Soviet system of education and upbringing. He has always sincerely believed that one must unconditionally tell the truth. He is an exceptionally decent person. In all the many years I've known him, since the 5th grade, I can't not only accuse him but even suspect him of ever telling a lie. As an example—and Grisha:sidenote[in Russian most names have a "diminutive" version which might be used among close friends. Grisha is diminutive of Grigory] really dislikes it when I tell stories about him... In recent years, journalists have finally worn him down, starting with Malakhov's TV crews:sidenote[Malakhov's show is like TV version of BuzzFeed] shoving cameras into his apartment door, with nationwide discussions twice an evening about whether he lives poorly, modestly, or in poverty. So he has a certain moral right to be left alone, but I'll tell the story anyway. When he was a child, we're riding the subway after class at the math center, a group of kids from my circle. **Solodnikov:** And where was the center located? **Rukshin:** At that time, I founded the mathematics center at the Zhdanov Palace of Pioneers in '74. Back then, I was a lab assistant, not yet 18, so I couldn't be responsible for the children's life and health. But in '75, as soon as I turned 18, I became an instructor, not a lab assistant, and it was in the science and technology department of the Palace of Pioneers:sidenote[a government funded community center (science club, arts school, and sports center all in one) where you can sign up to take classes.]. Anyway, I lived in [Pushkin]():sidenote[small town part of St. Petersburg metro area] at the time. We're riding the subway—the Kupchino station had just opened—a large group of students. It's hot in the subway, everyone is sweating. Perelman is wearing a fur hat with a scarf wrapped around it, the hat tied with a bow. And his classmate and fellow student, Boris, says to him: "Grisha, untie your hat, you're sweating, you must be hot." He replies: "I promised my mom I wouldn't untie my hat." Boris tells him: "Come on, no one will know, no one will see. When we get out of the subway, you can tie it again." "No, I promised." Perhaps this smacks of an unconditional, formal adherence to a commitment, rather than its substance... **Solodnikov:** Damn, that's like the story ["A Word of Honor."]() **Rukshin:** Yes, exactly. There you have it, he made a promise. And, I repeat, the Grisha I met back then has not changed a bit. He's the same today. When his mother was ill, and they might have needed good doctors, good medicine, something else, Grisha seriously considered—and as he said, you have to believe Grisha—he seriously considered whether to accept the prize or not. But he could not bring himself to accept something from the hands of people he considers dishonorable, even in such circumstances. So, without a doubt, the thing to say about Perelman is that he is a man of fanatical integrity. ### Why Perelman rejected the Fields Medal **Solodnikov:** Sergey Evgenievich, if I may clarify, why did he... He refused the Fields Medal. **Rukshin:** Yes. **Solodnikov:** Why? **Rukshin:** And not just the Fields Medal, but also the million dollars awarded later, the Clay Institute prize—these are different prizes. **Solodnikov:** Why did he... why does he consider these people, these prizes, to be dishonorable? **Rukshin:** In the 1990s, after his first long visit to the United States, Grisha and I were talking about his impressions of the mathematical community. He described it something like this: mathematical theorems have turned into a commodity. They can be sold for a profit, they can be bought, they can be stolen. Let's be honest, the Poincaré conjecture, which he worked on for almost nine years—that's a little longer than the nine months a woman carries a child in her heart. For nine years, the person doesn't know if this "child" will be born, if a result will be achieved or not. Every year at the mathematical institute, in his lab, they demand an annual report from him: what he has proven, what papers he has published, what conferences he has spoken at. Incidentally, this is partly why he left his geometry lab, where they would say to him, "Grisha, how are you going to file your reports? You don't have a single publication, not a single presentation." So, that's nine years of work. Can you imagine how much of his soul a person pours into that work, how invested he becomes? **Solodnikov:** I can't even imagine. **Rukshin:** Now imagine a mother being offered money to sell her child, to buy her child. Well, mathematical theorems, as he noted back in the 90s, had become a commodity. A typical situation that many mathematicians encountered—even I, who am much more of a mathematician than a teacher—was this: they offer you a grant to come visit them. In the 90s, a grant could be hundreds of times my salary as an associate professor. "Come visit us, we'll work together for a few months, write a joint paper, and this will be the start of our collaboration." It's clear that this creates a material benefit for the person who agrees. It's clear that in the 90s many went for it, and abroad, many, especially those just starting out, did it to earn money or at least get a visiting position at a prestigious university. A theorem can be stolen because, well, a mathematician raised in Soviet society was usually happy to talk about his successes. It sometimes took several years to get published, especially in prestigious journals. But how could you not share your joy with colleagues about what you'd achieved? "Look how great this is, how wonderful." Theorems were presented at seminars—at one's own department, at the mathematical institute, in other cities of the USSR where there were specialists in the field. Everyone did this. But suddenly, it became clear, especially abroad, that you couldn't live like that. Because if you presented a result at a seminar and someone managed to understand it, they might ask you an innocent question: "Where can I read about this? Is it published?" You'd say, "Not yet, the paper hasn't come out." And then a paper comes out under the name of one of your listeners. Let's note that the exact same thing happened with Perelman's Poincaré conjecture—well, not entirely, but still... **Solodnikov:** The Chinese did something... **Rukshin:** Not just the Chinese, the Americans too. Not just Professor Yau's group, the Chinese... the Americans... Of course, they didn't immediately understand the rather brief papers he [Grisha] posted to the arXiv. Naturally, they asked him [Grisha] to explain, to clarify, and he spent a long time traveling and explaining his results. After which, two groups of mathematicians, including the Chinese, published not the few dozen pages of Perelman's work, but 400-500 page books, claiming that they were the ones who had provided the complete proof. Of course, these "listeners" had little to do with proving the Poincaré conjecture, but they claimed they did. And Perelman had a serious grievance with the mathematical community, including the Russian one, because he believes no one stood up for him. These people, because they are influential, like Professor Yau, were not accused of dishonesty. So, there you have it... And then this very same mathematical community, from Grigori's point of view, encourages the trade and theft of mathematical results through its existing principles. So theorems can be stolen, they can be sold, they can be attributed to someone who has nothing to do with them, all for material gain. **Solodnikov:** Sergey Evgenievich, tell me, have you ever allowed yourself... I mean, your heart must be not in its place...:sidenote[Solodnikov uses the idiom “сердце не на месте” which literally means “heart is not in its place” but figuratively means “feeling uneasy/anxious.” Rukshin deflects by taking it literally] You must worry about... **Rukshin:** My heart is on the left side. **Solodnikov:** Well, you worry about his mother, about him... Have you ever tried to talk to him and explain that, well... I don't know. Well, in a situation where... I don't even know how to phrase it... Or have you never allowed yourself to do that? **Rukshin:** To talk about... what? About compromising his principles? **Solodnikov:** No. Well, his mother fell ill, money was needed, maybe for good treatment, and okay, I won't... I don't know how... I understand that even by asking you this question, you've already answered it. **Rukshin:** Unfortunately, every attempt to talk about such topics with Perelman usually led either to a loss of trust... **Solodnikov:** I see. **Rukshin:** Or... First, it yielded no results. And second, it either led to a loss of trust or, unfortunately, further limited his contact with humanity. **Solodnikov:** Right. **Rukshin:** Because, I repeat, when some girl, I don't remember her name, laid flowers at the foot of Grisha's door for the cameras and shouted (while being filmed, and it was later broadcast): "Grisha, I want to have your baby! He'll be smart like you and beautiful like me!" **Solodnikov:** Idiots. **Rukshin:** I repeat: this does not inspire his trust in humanity. And sooner or later, such a multi-year trauma, this harassment, spills over onto people who were once close, once more familiar, and so on. So, of course, I tried at one point. It was when the news first came out that he had proven the Poincaré conjecture, when the Fields Medal was awarded in, let me see, 2006. Back then, offers started coming in, which I was asked to pass on to him—for a good, well-paid job, since he had left the mathematical institute. For a nice apartment, for the opportunity to receive state awards, to head a laboratory, or to do science with a different level of freedom, and so on. The typical answer was: "I have everything I need." And I repeat, this hasn't changed in decades. **Solodnikov:** I understand. **Rukshin:** Besides being a brilliant mathematician... unfortunately, I'm afraid, in the past:sidenote[refers to being a brilliant mathematician, i.e. he no longer is a mathematician], because you have to believe Grisha: if he said he stopped doing mathematics, then unfortunately, he probably has. He is not just a brilliant mathematician; he is a very decent, very modest, very unpretentious, and very sincere person. ### on Stanislav Smirnov **Solodnikov:** Sergey Evgenievich, regarding Smirnov, you asked... **Rukshin:** Yes, Stanislav Smirnov. **Solodnikov:** Stanislav Konstantinovich, he is, without a doubt, a completely different person. First of all, I must say that both of them possess a remarkable breadth of cultural education. Perelman himself once studied the violin; he is very knowledgeable about classical opera vocals. He is a regular at the Mariinsky Theater and, in recent decades, at the vocal competitions held in St. Petersburg. I can take some pride in having played a part in that, because I used to hold classical music evenings at our summer math schools. **Solodnikov:** That's cool. **Rukshin:** And vocal music, in particular. Yes, we tried to fill our camps with elements of a full life. We had music nights, and teachers would hold poetry evenings. Stanislav Smirnov himself, when he was a young teacher, gave his students at the camps a series of lectures on the world's leading art museums. Of course, back then there were no computers, no screens, no internet, but I remember how he would use art albums to talk about magnificent museums and wonderful artists. So, he is, without a doubt, just like Perelman, a very broadly educated person, and he certainly could have successfully realized his potential in many fields completely different from mathematics. Incidentally, he also comes from a family of rather successful scientific and technical intelligentsia. I might be mistaken, but as I recall, his grandfather, [Konstantin] Rudnev, was an outstanding weapons designer. And he grew up under the strong influence of his wonderful, and I repeat, outstanding designer grandfather. Perelman, on the other hand, comes from, let's say, a simple background of an electrical engineer and a schoolteacher by education. So, undoubtedly, what unites both Perelman and Smirnov is a readiness to work hard for their ambition. Let's distinguish between two words that are often confused: "chestolyubie" [честолюбие]—a love of honor, for which a person is willing to work. To become famous not just for anything, not in any old way, not with the fame of Herostratus, but through the results of one's remarkable work. And "tshcheslavie" [тщеславие], vanity. **Solodnikov:** Right. **Rukshin:** From the old Russian word for "in vain." They both, without a doubt, stood out from their peers in the math circle, many of whom were no less naturally gifted. From a certain point on, both of them were notable for their readiness to work. To work for the result they wanted to achieve. As for his current situation, yes, Stanislav Konstantinovich, Stanislav Smirnov, is a much more public figure. Next year, a mathematical congress will be held in St. Petersburg, where, by the way, the next Fields medalists will be announced—that's where they are announced. And Stanislav Konstantinovich is one of the leading organizers of this congress. So, unlike Perelman, he is a public figure. A remarkable geometer... well, nowadays one should probably say French... Misha Gromov, Mikhail Gromov, who is also a product of the St. Petersburg math and mechanics faculty, believes that Perelman is undoubtedly (at least he said so in an interview) at fault before humanity for not giving back what was invested in him. Smirnov, on the other hand, through his activities, undoubtedly does:sidenote[does give back]. He is one of the organizers of Sirius, the presidential center, where he oversees programs. Just now, for the first time in the world, the International Mathematical Olympiad, which is an annual event, was held for two consecutive years in the same country, in the same city, and even at the same university: the Herzen State Pedagogical University, where I work now after moving from Leningrad State University. So, for the first time in the world, the olympiad was held two years in a row in the same country, city, and even university, and Smirnov was an active participant:sidenote[in its organization]. Unquestionably, by taking time away from his own scientific pursuits, Smirnov is giving back to humanity what was invested. He organized a new faculty... **Solodnikov:** May I clarify? Before we get too far. You mentioned and quoted that Perelman is not giving back to humanity what was invested in him. **Rukshin:** Gromov's words, yes. **Solodnikov:** Yes, Gromov said that. What was invested in him. And do you agree with that idea? **Rukshin:** I cannot infringe on Perelman's right to engage in something or not. As I've already said, we can encourage someone to do something if we think it's necessary, but we have no right to demand it. ### Oranges, Bagels, and Condoms **Solodnikov:** One more question about Smirnov. Can you explain what he received the Fields Medal for? **Rukshin:** It's not at all possible to adequately and clearly explain everything to someone who isn't a specialist. I remember how one journalist, forgive me, tried to explain what Perelman had proven with the Poincaré conjecture. It was quite amusing. I won't name the channel or the person. **Solodnikov:** It wasn't me. **Rukshin:** Well, it wasn't you. I wouldn't even say it was in St. Petersburg. But anyway, some non-specialists explained the rudiments of topology to him. They explained that if you stretch a thin rubber film over an orange, you can then take it off without tearing it, but you can't do that with a bagel. And this journalist tried to walk into the studio—they stopped him just in time—with an orange, a bagel, and a couple of condoms. **Solodnikov:** That's funny. **Rukshin:** It is. Yes, his colleagues told me the story, and I believe it's true, because that is exactly how some topological concepts are explained—that something can be removed without tearing, and something else cannot. Anyway, he received it for work related to percolation, or seepage. We usually know the word "percolator" from coffee makers, when hot water slowly passes, seeps, through ground coffee. There were a number of works by physicists—I'm not a physicist or even a specialist in the area Stanislav received the prize for—in which there were some constants related to the speed and path length of a particle seeping through certain structures, and so on. There was experimental data, and he built a theoretical model of percolation, of seepage through systems that could then be studied. But this won't add to anyone's understanding, and for most people, percolation will remain associated with a percolator and a type of coffee maker. ### The three pillars of the Russian school **Solodnikov:** Sergey Evgenievich, my heart is troubled... when, well, you yourself said that attempts to make everyone happy are doomed. It doesn't work that way, for everyone to be smart, for everyone to, I don't know, show ability in all fields of knowledge, and so on and so forth. Today's school system, well, in principle, all this wording:sidenote[in discourse] related to the provision of educational... what's the right word... "the provision of educational services"... **Rukshin:** Well, yes, a kind of prostitution based on the transfer of knowledge. **Solodnikov:** Something like that. **Rukshin:** If we're talking about "services." **Solodnikov:** Something like that, yes. It's all so disheartening. If you were to try and formulate it, what is the single greatest threat hanging over the Russian school system today? How would you put it? **Rukshin:** The trouble is, I can't formulate it briefly. We can't articulate what we want without at least a short historical detour. **Solodnikov:** Let's do it. **Rukshin:** The thing is, the Russian school—not the _ethnic_ Russian school, but the school of Russia—was built on, perhaps, three pillars. First, it always met the goals set by the state. It wasn't a social institution, like in modern America. As one American educator told me, the American school doesn't provide an education; it's a place where parents can be sure that while they are at work, their child will be looked after from this time to that time. **Solodnikov:** But that's exactly what we have now! **Rukshin:** And... that is precisely the danger. So. Yes, in an American school, a child will most likely try drugs for the first time, if it's a bad school. In an American school, he will get his first experiences of, let's say, personal interaction with members of the opposite sex. It is a social institution. He will be in relative safety. But what kind of education he gets there is unimportant. The Russian school, the first pillar, always served the needs of the state. Just like the famous story of the choosing of a religion, how Orthodox Christianity served... **Solodnikov:** And you're not just talking about the Soviet school, you mean the school... **Rukshin:** The school of Russia! In general! Yes. From its inception, it served the needs of the state. The Italian architect Aristotle Fioravanti, who built the Orthodox Dormition Cathedral and was an outstanding specialist in fortifications, designed the Kremlin. He taught Russian architects who then built defensive structures. Peter the Great sent his blockheads abroad to study not so they could learn to fence in duels, not so they could learn to dance, but primarily so they could become shipbuilders, sailors, military engineers, and so on. This was an urgent need of the state. Peter the Great founded the Russian Academy of Sciences by inviting foreigners who were supposed to educate and create Russian scientists. **Solodnikov:** But at the same time... Sergey Evgenievich. **Rukshin:** Scientists who were required by the state. It needed specialists in ores, mining engineers, metallurgists, geographers for expeditions. So, the first thing was meeting the needs of the state. So, the first pillar of the education system, starting with the Slavic Greek Latin Academy, was meeting the need for personnel—whether for the church, or for ambassadorial clerks who knew foreign languages and could conduct negotiations abroad. The Petrine Academy needed a Vitus Bering, who would go on an expedition and carry out surveys of Siberia, the Far East, the Kamchatka expeditions, and so on. These were the needs of the state. The orientation of education was not towards producing dandies adorned with lace:sidenote[well-dressed elitists], but on what they could and should do for the state. It's more like the slogan that Kennedy later used and loved very much. Yes, people went for high salaries, but not for a paradise-like life. Kennedy once said, "Ask not what your country can do for you—ask what you can do for your country." For good money, we were not shy about inviting specialists who were supposed to do the work the state needed and create a system that would educate similar specialists within our country. But... **Rukshin:** The second pillar our education stood on is what is sometimes called the [Juche ideology](https://en.wikipedia.org/wiki/Juche). The North Korean one. It is, after all, a reliance on one's own strengths. Yes, we used foreign experience. We had Academician [Rauschenbach](https://en.wikipedia.org/wiki/Boris_Rauschenbach), who worked on the space program, and his name makes it clear he wasn't a Slav. We had an Italian aircraft designer:sidenote[[Robert Bartini](https://en.wikipedia.org/wiki/Robert_Bartini)]. We had an outstanding fortification expert—as I said, the Kremlin and the Dormition Cathedral were built by [Aristotle Fioravanti](https://en.wikipedia.org/wiki/Aristotele_Fioravanti), not by Barma and Postnik. But, I repeat, their task was always to train national cadres:sidenote[specialists] to meet the needs of the state. And this was complemented by the Juche ideology. In the long run, our education was aimed at relying on our own resources. America, as a rich country, can afford the bourgeois luxury of simply buying a needed specialist for a huge amount of money when they don't have one. And they did buy them. After World War II, they took in Germans, put them in good conditions—specialists in nuclear physics, Wernher von Braun, and so on. We could never afford that, due to what are now fashionably called geopolitical reasons. And the experience with the annexation of Crimea a few years ago showed that there are many things that simply will not be sold to us. That no freedom of trade, no free movement of material goods for money, can guarantee that the state called Russia, in its current situation, is capable of buying what it needs, even if it has the money. **Solodnikov:** Sergey Evgenievich, may I clarify? So far, you've named two pillars... And it turns out that what constitutes... The Russian school. **Rukshin:** No, these are principles... **Solodnikov:** These are principles formulated by the state. **Rukshin:** First, let's separate two things. **Solodnikov:** Yes. **Rukshin:** There is the state... Right. And there is the country. And among my acquaintances, there are quite a few people who clearly distinguish between these concepts. There are people who are supporters of this state but don't particularly like the country. With its population, with the qualities of that population, from Russian drunkenness to Russian laziness. And there are people who dearly love this country but dislike this state. So, you said that the state formulated it. **Solodnikov:** Yes. **Rukshin:** Well, let's note that our state has been different at different times. **Solodnikov:** Yes. **Rukshin:** And this was formulated throughout all the eras of Rus':sidenote[historical name for Russia]. **Solodnikov:** But the examples you gave are... historical stages when the state was headed by people who, with their single voice, determined how one or another direction would develop. You spoke of Peter [the Great], who didn't need... well, he had advisors, but he was undoubtedly a sole ruler... and Stalin. **Rukshin:** Well, first, I want to recall the quote that democracy is the rule of the envious poor. Unfortunately, people who are already well-off... in my memory, they have not created great states. Second, let's remember something about the _demos_. Do you remember how many countries exist today with true democracy? In Athens, indeed, all full citizens—and there weren't that many of them—could gather in the square and vote on an important issue for the state. In our history textbooks, they love to cite the democratic foundations of Slavic states—the Novgorod _veche_:sidenote[town hall]. How did the Novgorod _veche_ usually end? Well, after the vote... **Solodnikov:** I don't know. **Rukshin:** An example of democracy. A wall-to-wall brawl! One side goes against the other. Even on the scale of a more populous Novgorod the Great, democracy didn't work. You see, there are intelligent people, and there is public opinion. I don't want to talk about exceptionalism right now, but nevertheless, the highest value of a function—of intellect, of responsibility for what is done—is always greater than the average value. And yet, when we try to talk about democracy, to resolve issues by voting, to make things good for everyone in matters of state policy, it turns out badly. So, how many countries in the world today have direct democracy? The only kind of democracy is when the entire population, I emphasize, discusses and votes on all fundamentally important issues. **Solodnikov:** I'll tell you right away, I don't know. **Rukshin:** Switzerland. **Solodnikov:** Really? **Rukshin:** Little, tiny Switzerland with its long-standing traditions. Nowhere else is there direct democracy. Everything else, so-called representative democracy, is a parody of democracy. In America, the population elects electors, the electors elect the president, and so on. Have you personally participated many times in resolving city issues: whether to develop a certain park, to cut down... ### The trial of a social parasite **Solodnikov:** Then let me ask you... Sergey Evgenievich, I'll ask you directly. Let's imagine a situation... Grigori Perelman, whom we were talking about a while ago. He makes his own decisions now. Whether to leave his apartment or not. Whether to go to work or not. And you yourself said: I would never allow myself to... overstep... **Rukshin:** To infringe on his right to choose. **Solodnikov:** He has that right to choose. But let's imagine what would happen—it's difficult, of course, but... **Rukshin:** Are you prepared to grant every driver the right to choose whether to drive on the right or left side of Nevsky Prospekt? **Solodnikov:** No, of course not. **Rukshin:** Then what's the question? Any joint activity and life together must be regulated by some rules that make the existence of that group of people possible. **Solodnikov:** But could you have endured a trial against Perelman for "social parasitism"?:sidenote[In the Soviet Union, not having a job was literally a crime. The state could put you on trial for being unemployed. Your labor belonged to the collective, and opting out was theft from society] I mean, if it were a trial not against the "parasite" [Brodsky](https://en.wikipedia.org/wiki/Joseph_Brodsky):sidenote[was sentenced to 5 years of hard labor in northern Russia for essentially being a writer without official state approval (later received Nobel Prize in Literature)], but against the "parasite" Perelman, who doesn't want to participate in the corrupt, dishonest work of a laboratory... **Rukshin:** Whether I would have survived that trial or not would depend on the state of my health. **Solodnikov:** Of course. **Rukshin:** I don't know. Discussing hypothetical situations is a bad path. I don't know what he would be tried for, what he would be accused of. Besides, in this day and age, a trial like Brodsky's would not be legally possible. **Solodnikov:** Not now, yes. But in '63... **Rukshin:** "You don't choose your times. You live and die in them." **Solodnikov:** Yes, that's true. **Rukshin:** But let's realize that every person lives in a specific historical era and in specific circumstances. So discussing the proclivities of Ivan the Terrible and figuring out why Totma was in the oprichnina lands—because it was rich in salt, furs, and so on, and the state needed to get money from somewhere for state-building, for purchasing arms, for creating an army, for defense against... and you can list the rest. There are economic laws. A state, just like a person, cannot live without eating, cannot live without defending itself from enemies, if they exist. Let's remember that in Russia, it wasn't unheard of for an engineer whose bridge collapsed to put a bullet in his temple. This responsibility, if you will, was also part of the culture of the Russian school in a broader sense—engineering education, military education, and so on. It was a part of general education, higher engineering, and military education. It is responsibility for what you do. ### Teach Everyone, Everything, Well **Solodnikov:** It's all so harsh, Sergey Evgenievich. As I listen to you, as a father, damn it, my heart is breaking. You know, I imagine my child—talented, I don't know yet, or not—who goes to a school for which the state sets tasks: blah-blah-blah-blah, the ones you listed. The second pillar, responsibility, and so on and so forth. I don't understand where... where in all of this is a person supposed to live their own life? Well... if life isn't about serving the state... **Rukshin:** This is precisely where the third pillar comes in, the one we must fight for. Unlike the British system, which once had the famous "11-plus" exam, when they tried to determine which level of school pupils would go to—limitations, differentiation, who would get into a grammar school with a full education, and so on. Now we have a bunch of apologists for early differentiation. And for giving knowledge that is "useful for life." **Solodnikov:** You mean when they divide them into classes, like a humanities track, a math track... **Rukshin:** That's a whole other story, humanities, math, and specialized education. The foundational principle of the Russian school was always: to teach everyone, everything. I emphasize: to teach everyone, everything, well, and to make sure they learn it. To the level that a specific person, your child, is capable of absorbing it within that system. We didn't have early social differentiation. Yes, even in tsarist times there were _realnye uchilischa_ [non-classical secondary schools] and gymnasiums. To enter a university, you had to pass an exam in languages after the _realnoe uchilische_, but I repeat, it was accessible, and many people did it. So. The principle, I repeat: to teach everyone, everything, well, and to make sure they learn it. Today, I know of only one educational system where these principles are still fully implemented, despite all the talk about "these are different children, these are different times." That is the presidential cadet corps and similar institutions. There, they teach everyone, everything, well, and make sure they learn it. As for humanities classes and so on, early differentiation according to abilities—this isn't about abilities. What a child achieves by the fourth grade does not depend on their personality. See, I'm also concerned about your child. It depends on whether the parents discuss the fairy tale they read with him. Do they engage with him, or do they turn on a computer so he can watch cartoons and not bother them? Is there a family tradition of evening tea and discussing how the day went, what worries everyone? This is a social factor that shapes a child. And a material factor. It significantly depends, with the abundance of our paid services, on whether you enroll your child in a private art school or a private music school, a private sports club, and so on. This is differentiation based on material well-being. There is regional differentiation. With all the will in the world, the opportunities to give a child a broad arts education in Uryupinsk are completely different from those in Moscow and St. Petersburg. Not just in the free systems that exist—libraries, art schools, music schools, sports clubs—but also in the choice, because there aren't as many diverse and good teachers there. So let's be honest, let's not be disingenuous, let's not deceive ourselves or our listeners. Differentiation already exists. Social, based on family cultural traditions, material, and regional. What is happening now with the attempt to limit disciplines is a state crime, and I will now prove it. A few years ago, there was a powerful explosion that took out an entire section of an apartment building, in Perm, if I recall correctly. A gas cylinder exploded. Two idiot welders decided in the freezing cold that they didn't want to work with a cold cylinder, so they decided to heat it with a blowtorch. **Solodnikov:** Damn, cretins. ### The absolutely idiotic and dishonest question of where will I ever need this in life? **Rukshin:** Indeed. Unfortunately, they weren't from a vocational school. In Soviet vocational schools, future welders were taught physics. They would have known that as temperature rises, the pressure in a cylinder increases not by a certain amount per degree, but by a certain factor. It grows exponentially. They blew up the building section because these idiots had only completed some short-term welding courses. Should a future welder be taught physics? Let's ask ourselves that question. Ask the residents of that destroyed building. And there are examples like this in all, I emphasize, all areas of human activity. It's not just about welders. You cannot teach a person, generally speaking, only what they will need. We love to ask the absolutely idiotic and completely dishonest question: "Why is this in the school curriculum? Where will I ever need this in life?" Well, each generation judges what it will need in life based on its preceding experience. And if we based what is needed only on preceding experience, then, unfortunately, there would be no carved doors and ceilings; we would be sitting in our cave. **Solodnikov:** I completely agree with you. It absolutely infuriates me... This is a complaint from the bottom of my heart. For how many years now has it been the case that a teacher, whether in a school, a lyceum, or a college, can't afford to expel... **Rukshin:** A failing student. **Solodnikov:** Can't expel anyone at all. **Rukshin:** Or hold them back a year so they can catch up. They can't afford to. The education system has become dishonest. **Solodnikov:** But that's insane! It's madness! **Rukshin:** That's not how it was in old Russia. **Solodnikov:** You have these genuine morons sitting there who don't need anything, they don't want to learn, they don't want to do anything, and the teacher can't do a thing with them... **Rukshin:** And the teacher has no tool to make them learn. **Solodnikov:** Exactly! **Rukshin:** Because it's the state's fault. But sometimes they understand that. But realizing it when the only option is expulsion is too late. **Solodnikov:** The ability to expel someone, the ability to hold them back a year—that might be the only truly effective and honest tool that can motivate a person in any way, if they don't want to do a damn thing. **Rukshin:** But how can that be... What will the electorate say? Unfortunately, this principle of Western democracies—the people must be happy and vote for us—has taken hold... **Rukshin:** That's disingenuous. **Solodnikov:** It's not disingenuous, it's sabotage! **Rukshin:** It harms the state, I completely agree with you. So, regarding... let's analyze what's being pushed on us now. "Let's teach well. But let's introduce specialized tracks." When I was in school, I had no plans to go into mathematics. I was planning to go to the Military Medical Academy. Back then, to get into medical school, you had to pass three exams besides Russian language and literature: physics, chemistry, and biology. Because a competent doctor must understand how fluid moves through vessels—and that's physics. They must know chemistry, the biochemistry of the organism—a most complex section of organic chemistry. And biology—the science of living organisms. How many of those exams do they take for medical school now? **Solodnikov:** I don't know. **Rukshin:** Well, it's not three. And what does that mean... Now, what is our specialized tracking? We have a "chemistry-biology" track in schools. Chemistry and biology. There's no physics. What kind of doctor are we going to get? And let's note that modern... **Solodnikov:** Even at home, I'm always discussing this with my wife. I say, "Katya, I'm genuinely scared that in 30 years, or even sooner, in 20 years, who the hell is going to treat us all?" **Rukshin:** Instructions and standards! **Solodnikov:** Instructions and standards. **Rukshin:** You'll press your finger to an infrared sensor, transmit the data somewhere via phone or computer, and they'll send you instructions. You know, there's a term, an "Italian strike." **Solodnikov:** Yes. **Rukshin:** Working-to-rule. Only a living person, I repeat, one who bears responsibility and is prepared... **Solodnikov:** Yes. yes, an Italian strike is a complete disaster. **Rukshin:** Yes. Working-to-rule. Only a person... only a person, not a computer and not a set of instructions, can put a bullet in his temple if it turns out he was wrong or caused someone's death. Our education system does not instill a sense of responsibility. **Solodnikov:** And here, Sergey Evgenievich, we come to the question of upbringing in our schools. As a process. Because... I see. You said, "The state sets the tasks." Right... But how do you cultivate in a person a sense of responsibility for another human being? Those two morons who blew up the apartment building—it's not just that they didn't know the physics. It's worse... they lacked the basic understanding that, damn it, if you don't know for sure, you don't do it, because you could kill who knows how many people. They just didn't give a shit! **Rukshin:** You've asked a question I want to answer. Unfortunately, I'm... I'm wired poorly. You asked about people in the humanities. I want to return to that, and then to the question that just followed. The thing is, when I was in school, a "humanities person" was someone who knew everything they were taught in their grade, plus had additional, good knowledge of literature or history. **Solodnikov:** That's true, that's exactly right. **Rukshin:** But we're lying now! We call a humanities person not someone who knows the school curriculum and, on top of that, has notable additional achievements in the humanities. **Solodnikov:** No, nowadays if you don't know a damn thing, you're a humanities person. **Rukshin:** Now, a "humanities person" is someone who doesn't know math, physics, chemistry, or something else. It's a distortion! **Solodnikov:** Damn, that's it! **Rukshin:** You've just asked a question that is of the utmost importance to me, regarding the education system. We see the same kind of re-labeling in other areas as well. Just as I said, our education system and those who build it lack a sense of responsibility for themselves and the country. Their activities within the education system are guided by their own immediate, personal interests. **Solodnikov:** Okay, but I still want to return, Sergey Evgenievich, to the issue of upbringing in school. This also concerns the tools a teacher has to influence the process in some way. How do we imagine a situation that could be reversed? On one hand, you have parents who have gotten a taste of this power to influence the educational process. "Why are you making my child do this or that?", "You're not speaking to him correctly," and so on. How can you take that right away from these parents, the right to interfere in the process, and should it be taken away? **Rukshin:** It must be. **Solodnikov:** But how? **Rukshin:** Through legislation. The law on education needs to be changed. Do not promote a person to the next grade if they haven't mastered the curriculum of the previous one. Everyone should get what they have earned. And what we are doing now is, by and large, theft—not of material goods, but of intellectual and moral values. It's theft from the individual, who receives something he is not entitled to. And it's theft from society as a whole, which will get this person as a full-fledged and respected member who, in other areas, will demand that he receive the same as others, while minimizing his effort and arguing that he's no worse than anyone else. By changing the law on education, for example—by giving failing grades, by holding students back a year, or by offering different educational tracks. If you can't or don't want to master mathematics, you can't be an economist, because a person who can't do arithmetic can't manage a budget. **Solodnikov:** But on the other hand, are you ready to grant such authority to the teachers who have graduated from pedagogical universities in recent... **Rukshin:** The current ones? **Solodnikov:** The current ones, yes. Parents will say, "Look at these teachers, for crying out loud! What can you trust _them_ with?" **Rukshin:** They should look in the mirror. **Solodnikov:** That's also true. **Rukshin:** These parents... we have raised a generation of people who absolutely cannot be trusted in this matter. It's much easier to point at others and list their imperfections than to think about what you are like yourself and what all this portends for society. Yes, let them say "for crying out loud," but there is no other way for society to survive. There is a wonderful old Russian saying, I don't remember which historian I read it from: "Блядию не проживешь" ["blyadiyu ne prozhivyosh"]. In old Russian, that word meant "a lie, a falsehood, and so on." **Solodnikov:** "Blyadiyu?" **Rukshin:** "Blyadiyu." That's what it was. Meaning, by falsehood. By lies. It's a great phrase, you can cut it from the broadcast, but nevertheless, the word had that meaning. Yes, in any specific situation, you can get by with a lie. You understood from the context that it's a rather old quote. **Solodnikov:** So we're saying we need to give teachers tools. But the most important tool for a teacher is the ability to determine, at least to some extent, how to work with their subject. How to work with their class. Why the hell, then, do they start dictating which textbooks can be used and which can't? Why, on one hand, have they taken away the tool to either punish or teach a student, and on the other hand, now they're taking away the ability to choose one's own methods and textbooks? **Rukshin:** Well, formally they haven't taken away the methodology, but first of all, you can only punish someone who has voluntarily signed up for something. If you went into the 9th grade and declared that you want to study, but then you don't, you can be punished. But when you have a law on universal secondary education, you didn't choose anything yourself. It was chosen for you that you will receive a diploma, because education is universal and secondary. So, I repeat, it's a matter of state policy and a state lie. The lie about the quality of education is the lie of the existing law on education. As for tools, one of the main tools is the social status of the teacher. Let's recall a work by Vasil Bykov, I don't remember which one, where he said that before the war, a smart child was told, "When you grow up, you'll become a teacher." I remember very well, back in '92, I met an American educator in Moscow who had come for an international olympiad. The Soviet Union was formally gone, and Russia hadn't quite formed yet, but the country was hosting it. And he was discussing what an American parent thinks. "Well, it would be better, of course, if he went to law school or became a politician. Good, clean work, respected. But if the child doesn't want law school, maybe medicine. It's good if he becomes a psychologist, a psychiatrist, or a dentist. They get paid well. If he can't get in there, he could be a surgeon; surgeons are paid well. But if it's neither of those, and God forbid he's interested in philology, mathematics, or physics... well, he'll be a pauper." That was the social status he presented to me. **Solodnikov:** But it's the same here now. **Rukshin:** Money, convenience, and comfort. Yes, exactly. You ask if we can trust the current teachers. But can we trust the current parents? Can we trust the current administrators of the education system? Let's note that when you have no personnel, you have to nurture and train them, just like children. And this is not an instantaneous process. We have been corrupting them and society for so many years, or decades, that we now need to train and create new personnel. Just like the education system itself. You cannot build long-term success on a lie. A lie has short legs and is for the short term. We must first learn to tell ourselves the truth, including the unpleasant truth, about the state of our affairs, the state of our education system, the state of our industry. How much we depend in metallurgy and other areas on what we inherited from the previous, much-maligned country, and what we have added to it. We must set a clear goal. People must understand what they are working for. For you to want to give your children an education, you must believe that a good education guarantees them success in life. But now, forgive me, the saying goes that... to earn very little [wages], you have to study well and a lot. ### The question that students are never asked and have no answer to **Solodnikov:** That question... which a person must ask themselves at some point. But it seems to me, how wonderful it would be if your first teacher, or a teacher in high school, were to ask you: "Why do you, as a person, live? What do people live for? For what reason?" **Rukshin:** As they say in the wonderful film _Formula of Love_, "It depends where." If it's in our region, it's for one thing. If it's in the Kostroma region, it's for another. **Solodnikov:** A person graduates from school now... **Rukshin:** It's a matter of state policy. **Solodnikov:** He doesn't know a damn thing... no one has even posed the question to him. What is stopping a teacher today, if he is a Teacher with a capital T, from setting this kind of vector? After all, despite everything, there is still a certain number of absolutely outstanding teachers. **Rukshin:** And there are wonderfully outstanding schools. There are. In small towns too. And in big cities. And in Moscow, there's the famous "Second School" lyceum, which Ovchinnikov founded... I think the great Ovchinnikov died last year at the age of 90. **Solodnikov:** But wait, your lyceum, 239, it's recognized as the best every year, isn't it, in St. Petersburg? **Rukshin:** Well, what does "the best" mean? **Solodnikov:** Well, some ranking, people say... **Rukshin:** Er... it was the best school in the country several times in a row. The question is, by what criteria? **Solodnikov:** That's right, the best school in the country, for several years in a row. **Rukshin:** The question is, by what criteria. And so on. But I'm talking about something else. The great founder of the "Second School" lyceum, Ovchinnikov, who was its director until he was 90, once answered in an interview what it takes to create a good school. He said, just two things: first, find good teachers, and second, don't interfere with their work. The journalist then asked, "And which is harder?" First the first, then the second. **Solodnikov:** Yes. But at the same time, this teacher and these students need to feel that they are not living in a world that is hostile to them, but in a world that is at least somewhat on the same wavelength. **Rukshin:** Well, yes, Gianni Rodari wrote about this in _The Adventures of Cipollino_, there's a great quote... **Solodnikov:** Which one? **Rukshin:** "Lord, save me from my friends; I can handle my enemies myself." The "friends" who "help" the teacher work are the ones who overload him with reports, determine his salary, create a law on education in which the teacher is obliged to issue a diploma to everyone. Not to teach, but to issue a diploma. And so on and so forth. We have so many "friends" of education who wrote the law on education, who write standard after standard... Recently, my brilliant student and the wonderful director of the Presidential Lyceum No. 239, Maxim Pratusevich, gave an interview where the headline was: "A teacher won't feel any warmer or colder from reading the Federal State Educational Standard." A teacher should be teaching children, not writing reports or worrying that students or parents will complain about him. Teaching, in the best sense, is a mission. **Solodnikov:** Absolutely. **Rukshin:** A personal mission and a mission on the scale of the country and the state, one that determines the fate of the country and the state. He is a missionary. Yes, not everyone is meant to carry this mission, like Jesus, all the way to crucifixion. ### The final rant on the decline of standards **Solodnikov:** I don't know. I think that... for all these years, we've been endlessly engaged in rebuilding the army. We rebuilt it. Respect for officers... **Rukshin:** Well, officers' salaries have returned. **Solodnikov:** ...has returned. Damn it, why can't we do the same with teachers? **Rukshin:** And how many teachers do we have? **Solodnikov:** I don't know. **Rukshin:** A lot. **Solodnikov:** A hell of a lot, yes. Ah, so first you have to downsize them, like the army, and then nurture them? **Rukshin:** Well, for the children of the rich, unfortunately, they will study in person. Just like during remote learning:sidenote[during COVID], many people paid, hired tutors, and their children were taught in person, sometimes at home. And for the rest, as they say, it's like selling _sbiten_:sidenote[one of the oldest Slavic drinks, non-alcoholic version made of water, honey, and spices, with the optional addition of wine, mead, or other alcohol] in the public squares... You know, there was a wonderful mistake I made in my life. When I was in school and read Ostrovsky's plays, I thought, "Well, all these merchants, all this... it could never happen again!" Only later did I realize that for this country, Ostrovsky is not just for the 19th century—he's forever. In his play _Enough Stupidity in Every Wise Man_, there is General Krutitsky's wonderful treatise: "On the Harm of Reforms in General." For the upper classes, roughly speaking, you stage tragedies to educate them. And for the common people, you "allow the sale of _sbiten_ in the squares." And so we sell this _sbiten_ in electronic form, cheap junk food at concerts with completely soulless music. We are selling not to the _demos_—the _demos_ are the part of the population with civil rights—we are selling to the _ochlos_, the mob, the feeling of happiness for a short time. We sell positive emotions. We have created a cult in which a person must continuously rejoice that he is well, that he can buy this or that, shopaholism... shopaholism is part of this cult. We create positive emotions that are in no way connected to the subject's awareness of his role as a citizen of this state. Rights and obligations exist only in unity. Our teacher has many obligations and is becoming almost completely devoid of rights. Parents have many rights in relation to the school, education, and upbringing of their children, but very few obligations. Well, perhaps beating a child and throwing him out of a window is still forbidden. Therefore, we must raise everyone you mentioned—teachers, parents, children—with an awareness of the unity of rights and responsibilities. For the sake of the long-term, historical perspective of our survival. But instead, I repeat, we periodically produce "humanities people" who are not people who know something well, but people who don't know something at all. We periodically give the right to feel like a confident and worthy citizen to a person who is, in essence, a thief, because a high school diploma for someone who passed the basic-level Unified State Exam... **Solodnikov:** _(sighs)_ **Rukshin:** ...what is that? A good fourth or fifth grader can pass the basic-level USE. And this is a person who receives a diploma for the eleventh grade. In a society of lies, a country with such an education system will, unfortunately, have no long-term historical perspective. And right now, the system of secondary, higher, and further education is in most urgent need of repair and restoration. This is not an instantaneous process. No matter how much I am an opponent of the USE, it cannot be abolished overnight. It must be a long, painstaking process. But it must begin with us stopping, looking around, and analyzing the actual and social consequences of what has happened. The results of the education system reforms that have been going from bad to worse for 20 years. Yes, it had its flaws. We need to define the fundamental core of education. There is such a term, which was used during the education reform in the sixties: to define the fundamental core. A fundamental core—with the honesty of Grisha Perelman. What everyone must know if they have a high school diploma. And teach it to everyone. We must stop asking ourselves the dishonest question that calls us back to the cave: "Where will I ever need this in life?" We don't know where a doctor will need knowledge of biochemistry in 20 years. But he must have a grasp of the fundamentals of that science, because in his future profession, 10 years from now, he might need it. We must think about the future. And that future must, in the process of education, teach a person, first, fundamental knowledge (the fundamental core, what everyone really must know), and teach them how to think and how to acquire new knowledge. **Solodnikov:** And to conclude, Sergey Evgenievich, I'll tell you something. I was thinking... Recently, I sent a short clip to some friends. It shows four people sitting at a table... Senkevich, Kapitsa, Drozdov, and one other person. And Kapitsa is telling Senkevich—they're talking about how this is either the late 80s or early 90s... how the country was swept by an epidemic of prison jargon, or _fenya_. The language of the prison camps. **Rukshin:** Yes, well, in songs and so on... **Solodnikov:** And they're saying it's a catastrophe. A catastrophe. And Kapitsa says, "You know, I was recently at a meeting of some council on culture, or science, or something. And the writer Astafyev spoke, and he said that the dominance of this... this prison lexicon is... First, it must be limited by the efforts of the state, because it is a threat to the national culture." And then Kapitsa corrects himself. He says, "This is not about censorship. This is about preserving culture. This is about preserving the culture." And in this sense, I catch myself thinking, damn, we ourselves are in this free space, broadcasting... but when I listen to all this stuff my kids listen to... I tell myself too: "Kolya, this isn't censorship! It's the preservation of national culture!" And you now... **Rukshin:** Moreover, you periodically insert the word "блин" [blin, "damn"/"heck"], which, as is known, is a euphemism. And you absorbed that during that very same time. **Solodnikov:** Unfortunately, yes. Yes! And I am a victim... I am already a victim of this catastrophe that has occurred. We are victims! And our task is to prevent more victims. **Rukshin:** I completely agree with you. **Solodnikov:** Thank you, Sergey Evgenievich. --- Title: The Syntax of Matter: Synthesis Planning as the Foundation of Generative Chemistry Category: review # 1 Introduction Artificial intelligence in chemistry has historically focused on predicting scalar molecular properties from molecular structure, a field established as quantitative structure-activity relationship (QSAR) by the pioneering work of Corwin Hansch. [@hansch1964rho] While foundational, early ::TERM[QSAR]:: models were often limited by assumptions of linearity, a constraint that prompted the shift toward classical machine learning (ML) techniques in the 1990s and 2000s, such as support vector machines (SVM) [@byvatov2003comparison] and random forests [@svetnik2003random], which applied to expert-designed features like molecular fingerprints. [@zupan1991neural; @willett1998chemical] The deep learning era ushered in end-to-end learning with graph neural network (GNNs) [@duvenaud2015convolutional; @wu2018moleculenet; @elton2019deep] and transformers, [@Polosukhin.2017] which automatically extract hierarchical features from raw molecular data. While architectures such as graph convolutional network (GCNs) [@kipf2016semi; @sun2020graph; @kensert2021graph], message passing neural network (MPNNs) [@gilmer2017neural; @jo2020message], and Kolmogorov-Arnold graph neural network (KA-GNNs) [@li2025kolmogorov; @hasebe2021knowledge] have progressively improved predictive accuracy on benchmarks [@yang2019analyzing; @reiser2022graph; @rittig2022graph], the efficiency of small-molecule drug discovery has not seen a commensurate improvement. Comprehensive surveys indicate that despite the proliferation of complex multimodal architectures, generalization to unseen chemical domains remains limited. [@berry_2025; @wang2025graph; @xia2023understanding; @alampara2026generalpurpose-760] We propose that this fragility (manifesting in both the proposal of inaccessible candidates and the misprediction of ::TERM[activity cliffs]::) may partly reflect a mismatch of priorities: many models optimize for the semantics of function (what a molecule does) before learning the syntax of construction (how a molecule is made). This review argues that synthesis planning is a strong candidate for the foundational pre-training objective for generative chemistry. By analogy with large language models, which acquired generalizable reasoning capabilities in part by mastering the structural grammar of text, we hypothesize that artificial chemical intelligence (ACI) may acquire more robust physical reasoning by training on the causal logic of molecular transformation. This review analyzes the literature on multistep synthesis planning from January 2020 to February 2026, a period of rapid progress built on decades of foundational work. While early expert systems proved that retrosynthesis could be computationally formalized, [@lhasa_1972; @wipke_1974; @gelernter_1990; @icsynth_2015; @grzy_2016; @chematica_2018] their reliance on hand-curated rules limited their scalability. The transition to learnable models began with data-driven approaches to single-step prediction [@wei_2016; @liu_2017; @coley_2017; @segler_2017], setting the stage for the first generation of modern, multistep planners. Foundational methods from 2018--2019, including Monte Carlo tree search (MCTS) [@mcts_2018], DFPN-E [@dfpn_2019], and the Molecular Transformer [@moltransformer_2020], receive detailed treatment as the architectural precursors against which subsequent progress is measured. We characterize the period from 2018 to roughly 2023 as the _Era of Navigability_, where the primary scientific objective was to demonstrate that algorithms could effectively navigate the combinatorial explosion of the retrosynthetic tree. By the primary metric of this era, stock-termination rate (STR), modern planners now routinely achieve success rates exceeding 99% against large inventories. We argue that this saturation signals the end of the navigability phase and necessitates a transition to the _Era of Validity_, where evaluation must pivot from finding _a_ path to verifying the chemical correctness of the proposed route. In this review, we center on multistep _topological planning_: identification of structures of starting materials and intermediates involved in the synthetic procedure. We distinguish this from _quantitative planning_, which involves prediction of specific reaction conditions (catalysts, solvents, temperature) and outcomes (yield). While quantitative variables are critical for experimental success, this review focuses on the topological problem, which most current generative frameworks prioritize. The frameworks discussed may require domain-specific adaptation for other areas such as catalysis, materials chemistry, or biocatalytic synthesis. [@wigh2022review; @tu2023predictive; @huffman2021state] The review is organized as follows. [Section 3](#sec-static-limits) establishes the conceptual foundation by examining failures in static structure-property mapping and motivating synthesis planning as a pre-training objective. [Section 4](#sec-accessibility) highlights the limitations of scalar accessibility proxies, and [Section 5](#sec-formalization) formalizes the planning problem. [Section 6](#sec-multistep-approaches) analyzes the architectural distinction between explicit graph search and direct sequence generation. [Section 7](#sec-evals) critically evaluates navigability-era benchmarks, exposing how stock set inflation and conditioned target selection obscure planning failures. [Section 5.2.1](#sec-validity-hierarchy) introduces the _solvability hierarchy_ (Solv-$N$), a new framework that separates topological connectivity (Solv-1) from selectivity (Solv-2) and executability (Solv-3). [Section 9](#sec-quantitative) briefly reviews advances in quantitative planning. Finally, [Section 10](#sec-outlook) outlines the path toward a chemical foundation model that integrates physical constraints into the generative process, a necessary transition visualized in [Table 2](#tab-paradigm-shift). | Domain | Pre-Training Objective | Ground Truth Data | Gold Standard Benchmark | Result | | ------------------------- | ------------------------------------------- | ------------------------------------------------------------ | ----------------------- | ----------------------------------------- | | Natural Language | Next-token prediction | Internet-scale text | GLUE/MMLU | Emergent reasoning | | Structural Biology | 3D structure prediction | PDB & evolutionary constraints | CASP | Zero-shot folding & design | | Chemistry (status quo) | SMILES masking; static graph reconstruction | Static molecular graphs (ZINC, GDB) | MoleculeNet, TDC | Struggles to generalize (activity cliffs) | | **Chemistry (blueprint)** | **Multistep synthesis planning** | **Causal reaction trajectories (experimental, QM-filtered)** | **Solv-N hierarchy** | **Artificial Chemical Intelligence** | :::caption{#tab-paradigm-shift}[**Table 2.**] Paradigm comparison across domains illustrating the proposed blueprint for artificial chemical intelligence (ACI). Multistep synthesis planning is proposed as the foundational pre-training objective for chemistry, evaluated via the Solv-N hierarchy. ::: :::tldr This review is two things at once. First, it's a comprehensive review of multistep synthesis planning methods (Sec 5-8). Sections 3 and 4 are intended to tell you why you should be interested in synthesis planning at all. ::: # 2 The Review at a Glance This review examines multistep data-driven retrosynthetic planning as a central component of artificial chemical intelligence, with a primary focus on small-molecule organic synthesis as represented in contemporary reaction corpora and benchmark settings.[@paroutes] Rather than revisiting static structure-property modeling in detail, we focus on how multistep planning systems construct routes from commercially available starting materials to target molecules and how this process can inform chemistry-aware representation learning. A recurring theme is _synthetic accessibility_. Across a range of benchmarks [@berry_2025; @li2025kolmogorov; @wang2025graph; @xia2023understanding; @alampara2026generalpurpose-760], modern ::TERM[GNN]::- and transformer-based models have improved scalar property prediction while still struggling to generalize reliably to new chemical domains, often proposing candidates whose experimental realization is unclear. Therefore, we treat multistep synthesis planning not only as a downstream application but as a candidate organizing objective for aligning generative models with the causal logic of molecular transformations (Table 1). Within this scope, the main objectives of this review are: - formalization of the multistep retrosynthetic planning problem and clarification of the distinction between _topological planning_ (identifying reactants, intermediates, and overall route structure) and _quantitative planning_ (conditions, yields, and related variables); - overview of the major planning architectures, including search-based systems such asMonte Carlo tree search (MCTS)[@mcts_2018] and neural value-guided alternatives like Retro\*[@retrostar_2020], and the emerging direct sequence generation approaches exemplified by the Molecular Transformer and DirectMultiStep;[@moltransformer_2020; @dms] - analysis of the evaluation practices with an emphasis on how stock-set design, target selection, and benchmark construction can inflate apparent performance in the _Era of Navigability_, where stock-termination rate is near saturation; To organize existing and emerging methods, we introduce the _solvability hierarchy_ (Solv-$N$). Solv-$1$ focuses on topological reachability (existence of a complete route from stock to target); Solv-$2$ incorporates basic chemical plausibility and selectivity; and Solv-$3$ addresses executability, including conditions and outcomes where data permit. We use this hierarchy to structure the transition from the navigability-centric phase of method development toward an _Era of Validity_, in which evaluation is increasingly tied to chemical realism, and to articulate how multistep synthesis planning may function as a foundational pre-training task for artificial chemical intelligence. # 3 The Limitations of Static Structure-Activity Mapping ## 3.1 Out-of-Distribution Failure in Molecular Property Prediction To motivate synthesis planning as a candidate pre-training objective, we first examine a recurring limitation in models that learn exclusively from static structure-property correlations: a sharp failure to generalize beyond the training distribution. This issue is particularly well-documented in bioactivity prediction, where the objective is to map molecular topology (structure) to functional outcomes such as binding affinity, inhibitory potency, or toxicity. Despite the proliferation of increasingly sophisticated deep learning architectures, rigorous benchmarking studies[@xia2023understanding] indicate that improvements in performance on familiar chemical space do not carry over when models are tested on structurally novel molecules outside of the distribution of the training set. For instance, several benchmarking studies evaluating graph neural networks and transformers find that, despite reporting state-of-the-art performance on global metrics likeroot mean square error (RMSE), these models frequently fail to outperform classical machine learning baselines under rigorous scaffold splitting. [@green_2023; @deng_2022; @liyaqat_2024] Gaussian processes and support vector machines utilizing fixed fingerprints often match or exceed the predictive accuracy of more complex neural architectures, suggesting that increases in model complexity do not reliably translate into improved generalization to novel chemical space. The disparity is most acute at _::TERM[activity cliff]::_: when minor structural modifications lead to disproportionate shifts in biological potency. [van Tilborg et al.](https://doi.org/10.1021/acs.jcim.2c01073) demonstrated that on these critical edge cases, deep learning models often exhibit comparable or worse predictive accuracy than descriptor-based methods [@tilborg_2022]. This failure likely has a mechanistic origin: standard optimization objectives (e.g.,::TERM[RMSE]::) encourage models to smooth the structure-activity landscape, effectively treating the sharp discontinuities characteristic of specific molecular recognition events as noise rather than signal [@szostek_2026]. Consequently, the subtle electronic or steric syntax that distinguishes a therapeutic from a toxic analogue is often lost in the learned representation. [@maskmol_2024; @graphcliff_2025] The inadequacy of purely topological learning is further evidenced by the architectural adaptations developed to mitigate these failures. Recent state-of-the-art frameworks frequently augment end-to-end learning with explicit handcrafted features or auxiliary supervision. For example, multi-level fusion graph neural network (MLF-GNN) [@mlfgnn_2025] fuses learned graph representations with traditional Morgan fingerprints; activity cliff explanation supervised GNN (ACES-GNN) [@acesgnn_2025] incorporates auxiliary attention constraints derived from manually curated activity cliff pairs; and GraphCliff [@graphcliff_2025] employs gating mechanisms to preserve local features. Similarly, [Shi et al.](https://arxiv.org/abs/2507.03318) apply Group Lasso regularization to enforce explicit separation of scaffold from decoration substructures [@shi_2025], while activity cliff-awareness network (ACANet) [@shen_2024] applies a special training objective (contrastive triplet loss) that simultaneously pulls together metric representations of molecules with similar activity and pushes apart those with different activity, enforcing the metric structure and shaping the learned latent space to separate active and inactive compounds. Collectively, these design choices imply that standard end-to-end training on static topology is insufficient for robust navigation of the activity landscape. This fragility extends to structure-based drug design, where models explicitly incorporate the three-dimensional geometry of the target protein. Multimodal architectures demonstrate measurable improvements over ligand-only baselines[@mtpnet_2025; @talpha_2025], but remain vulnerable to the same generalization failures. [Zhang et al.](https://api.semanticscholar.org/CorpusID:267779778) documented a narrow evaluation trap defined by benchmark memorization rather than physical generalization [@zhang_2024], and [Wang et al.](https://api.semanticscholar.org/CorpusID:266752255) showed empirically that complex 3D convolutional networks frequently fail to enrich active binders in realistic decoy scenarios [@wang_2024]. Even alternative pre-training strategies have not resolved this deficit. Standard self-supervised objectives such as motif prediction or masked atom reconstruction can induce detrimental bias on activity cliffs by encouraging models to memorize global scaffold patterns at the expense of local functional group sensitivity. [@wu_2024; @wan_2023] When data leakage is removed via strict structural splitting, the performance of many deep learning models drops substantially, in some cases to levels approaching simple nearest-neighbor heuristics. [@tamura_2023] Taken together, these persistent limitations across diverse architectures suggest that the bottleneck is not a lack of model complexity, but the fundamental insufficiency of learning chemical reasoning solely through static structure-property correlations. ## 3.2 Parallels in Natural Language and Computer Vision The recent history of natural language processing (NLP) and computer vision offers a compelling parallel. Early ::TERM[NLP]:: systems mirrored the current state of ::TERM[QSAR]::, relying on supervised learning for specific scalar tasks, such as sentiment classification or entailment. These models functioned as narrow experts, achieving high performance within their training distribution but failing when faced with novel phrasing or context. [@gpt2] A fundamental shift occurred when the field adopted a generative objective: predicting the next token in a sequence. By optimizing for the grammar of text rather than a specific label, models acquired internal representations capable of generalized reasoning, eventually outperforming supervised baselines on tasks they were never explicitly trained to solve. [@gpt1; @gpt2; @gpt3] A similar progression occurred in computer vision, which transitioned from classifiers trained on discrete categories (e.g., ImageNet classes) to foundation models trained on the correspondence between images and text. [@clip_2021; @lvm_2023] [Cherti et al.](https://doi.org/10.1109/cvpr52729.2023.00276) found that the robustness of visual models scales with this form of pre-training, decoupling the learned representation from any single classification task [@cherti_2023]. In both domains, the move from specialized label prediction to broad structural learning resulted in representations that were more durable under distribution shift. By analogy, current chemical AI appears to occupy a developmental stage similar to pre-generative NLP. While the term _foundation model_ is frequently applied in chemistry, many architectures lack the defining characteristic of their linguistic counterparts: an _emergence_ of capacity to transfer knowledge to entirely new tasks without any task-specific training, a property known as zero-shot generalization. [@gpt3; @gpt4] The implication is that the field must identify its chemical equivalent of next-token prediction: an objective that forces models to internalize the rules of molecular transformation rather than merely correlating static graphs with properties. ## 3.3 Synthesis Planning as a Pre-training Objective Identifying the chemical equivalent of next-token prediction requires distinguishing between the syntax of _notation_ and the syntax of _matter_. Early chemical language models treated the string representation of molecules (::TERM[SMILES]:: [@smiles_1988]) as the grammar to be learned. However, models trained on static masked language modeling (MLM) frequently fail to outperform simple regression baselines on downstream property tasks. [@chemberta; @chemformer] While larger models show improved prediction of simple physicochemical properties such as lipophilicity, their performance on complex bioactivity tasks tends to plateau, suggesting that learning the grammar of molecular notation is not sufficient for genuine chemical understanding. [@chemberta2] Furthermore, it has been demonstrated [@chemberta3] that scaling SMILES-based pre-training even to 1.1 billion molecules yields diminishing returns, consistent with models learning statistical regularities of the notation rather than internalized chemical rules. We propose that the true syntax of chemistry is the transformation of matter through reactivity. Consequently, the chemical analogue of next-token prediction is synthesis planning: the step-by-step prediction of how a molecule is constructed. This objective bifurcates into forward synthesis (reactants to products) and retrosynthesis (products to reactants). We propose that multistep retrosynthesis is the candidate for foundational pre-training most likely to yield robust physical reasoning. This preference is grounded in both data quality and computational tractability. Retrosynthesis can be supervised directly by the vast accumulated data of published multistep routes, providing training trajectories grounded in successful experimental execution. In contrast, multistep forward training typically relies on algorithmically generated routes, which must assume perfect separability of byproducts and lack experimental validation. Furthermore, the search space for retrosynthesis is bounded by the structural complexity of the target, whereas forward search branches with the size of the starting material inventory, rendering unconstrained exhaustive exploration computationally prohibitive. Recent literature provides preliminary support for this reactivity-centric hypothesis. [Chen et al.](https://doi.org/10.1039/D2DD00077F) found that framing activity prediction as conditional structure generation improved performance on activity cliffs relative to scalar regression. [@deepac_2022] Similarly, architectures like REMO [@tang_2024] and HiCLR [@hiclr] demonstrate that pre-training objectives requiring the reconstruction of reaction centers or reactants yield representations that capture functional group nuances better than static baselines. By requiring the model to predict missing atoms from their chemical environment, these training objectives encourage the model to internalize local reactivity rules rather than simply memorize structural patterns. While encouraging, these results represent only the initial validation of the hypothesis. Current reactivity-aware models demonstrate improved transfer to related tasks, but they have not yet exhibited the _emergence_, zero-shot reasoning on unrelated problems, characteristic of foundation models in NLP. We postulate that scaling multistep retrosynthesis forces models to internalize electronic constraints, functional group compatibility, and selectivity boundaries, providing the necessary inductive bias to bridge this gap. Whether this approach is capable of yielding a true chemical reasoner remains a critical empirical question for the field. # 4 Evaluating Synthetic Accessibility Generative models that lack explicit synthesis constraints frequently propose structures that are topologically valid but chemically unsynthesizable. [@gao_2020] Assessing whether a candidate molecule can be made is therefore a prerequisite for practical molecular design. For the past decade, the field has relied on heuristic scores to estimate this feasibility without the computational cost of full synthesis planning. This section reviews the growing evidence that these heuristic approximations diverge from experimental reality, motivating the transition toward explicit route generation. ## 4.1 Intrinsic Limitations of Heuristic Accessibility Scores The prevailing evaluation paradigm treats synthetic accessibility as an intrinsic molecular property. Real-world feasibility, by contrast, is highly context-dependent: it relies on the specific inventory of starting materials, the operational scope of available reactions, and purification constraints. Compressing this context-dependent feasibility into a single numerical score creates a metric that often correlates poorly with experimental success. This reductionist approach originated with the::TERM[synthetic accessibility score (SAscore)]:: [@sascore_2009], which estimates difficulty by quantifying the statistical prevalence of substructures in public databases and applying penalties for complexity features such as non-standard ring fusions or stereocenters. Although this simple approach was a reasonable practical compromise when full retrosynthetic planning was computationally intractable in 2009, it rests on the flawed assumption that visual structural complexity is a reliable proxy for synthetic effort. A complex scaffold may be accessible via a single transformation like a Diels-Alder cycloaddition, whereas a simple structure may be elusive due to subtle stereochemical constraints [@sascore_2009]. Recent evaluations confirm that SAscore frequently penalizes valid complex structures, such as PROTACs, while failing to flag difficult chiral centers [@fscore_2024]. On realistic datasets, [Li and Chen](https://api.semanticscholar.org/CorpusID:236379517) demonstrated that SAscore performance collapses to near-random guessing [@li_2021], and [Liu et al.](https://arxiv.org/abs/2411.08306) found the mean scores for feasible and infeasible candidates to be statistically indistinguishable [@liu_2025]. Topological complexity metrics, however rigorously formalized, often fail to capture synthetic difficulty when they ignore reaction-specific constraints; for instance, [Flamm et al.](https://arxiv.org/abs/2505.22826) showed that assembly theory metrics assign optimal complexity scores to pathways that delay ring closure until the final step—a strategy that is topologically efficient but synthetically implausible [@flamm_2025]. Learned replacements for these heuristics have demonstrated similar limitations. [Coley et al.](https://doi.org/10.1021/acs.jcim.7b00622) introduced::TERM[synthetic complexity score (SCScore)]:: [@scscore_2018] to derive complexity directly from reaction data, aiming to capture the \"synthetic gradient\" from simple reactants to complex products. However, the model functions primarily as a measure of reactant popularity rather than mechanistic difficulty; [Parrot et al.](https://api.semanticscholar.org/CorpusID:245417923) quantified this by showing that::TERM[SCScore]:: exhibits effectively zero correlation with the solvability determinations of explicit retrosynthetic search. [@parrot_2024] Addressing the out-of-distribution fragility of neural models, [Voršilák et al.](https://doi.org/10.1186/s13321-020-00439-2) proposed SYBA [@syba], a Bayesian classifier based on substructure frequency differences between synthesized and unsynthesized molecules. Despite this statistical grounding, blind evaluations indicate that SYBA similarly fails to reliably distinguish solvable targets from impossible ones. [@critass_2023] Even::TERM[retrosynthetic accessibility score (RAscore)]::, which is explicitly supervised by the outcomes of retrosynthetic planning software [@rascore_2020], retains the artifacts of structural pattern matching. [Chen and Jung](https://api.semanticscholar.org/CorpusID:271401002) observe that::TERM[RAscore]:: frequently assigns high accessibility probabilities to unsynthesizable analogs solely due to their topological similarity to training examples. [@chen_2024] Beyond structural insensitivity, heuristic scores cannot account for shifting inventory constraints. [Calvi et al.](https://arxiv.org/abs/2403.13005) demonstrate that static scorers assign identical values regardless of whether key intermediates are commercially available. [@leap_2024] This invariance to supply chain realities means that optimizing for general synthesizability yields a fundamentally different chemical space than optimizing for in-house inventories. [@hassen_2025] While heuristics correlate with solvability in drug-like space, this relationship collapses for functional materials such as organic semiconductors. [@guo_2024] The consequences of this divergence are most acute in generative optimization. When accessibility is defined by a proxy, reinforcement learning agents exemplify Goodhart's law [@rlgoodhart_2023]. [Gao and Coley](https://api.semanticscholar.org/CorpusID:211132437) identified that unconstrained generators routinely assign high feasibility scores to impossible structures. [@gao_2020] [Gao et al.](https://api.semanticscholar.org/CorpusID:284017533) subsequently showed that agents optimizing SCScore generate simple long-chain structures to minimize complexity penalties, while those optimizing SAscore produce repetitive fused scaffolds. [@retroscore_2025] [Seo et al.](https://arxiv.org/abs/2410.04542) quantified this failure: fragment-based models trained to maximize SAscore achieved a 0.00% success rate when validated by a rigorous retrosynthesis oracle. [@rxnflow_2025] Similarly, [Koziarski et al.](https://arxiv.org/abs/2406.08506) found that maximizing SAScore improved the proxy metric without improving actual synthesizability [@rgfn_2024], and [Gao et al.](https://api.semanticscholar.org/CorpusID:281883614) observed genetic algorithms drifting almost exclusively into unsynthesizable chemical space [@synformer_2025]. These limitations reflect the historical necessity of estimating feasibility when explicit planning was computationally intractable. While heuristic scores retain utility as coarse pre-filters for high-throughput screening, they are unreliable as primary evaluation metrics for generative chemistry. ## 4.2 The Necessity of Explicit Route Generation To address the disconnect between heuristic estimation and experimental reality, [Parrot et al.](https://api.semanticscholar.org/CorpusID:245417923) argue that the most operationally reliable metric of synthesizability is the explicit construction of a route terminating in available starting materials. [@parrot_2024] Empirical support for this definition is found in the performance of reaction-based generative models. By constructing molecules via explicit reaction templates rather than atom-by-atom assembly, these architectures inherently constrain the output to the logic of available chemistry. In direct comparisons, reaction-based models achieve synthesis validation rates between 56% and 100%, whereas shape-first models relying on post-hoc heuristic filtering achieve rates as low as 23%. [@synthformer_2025; @rxnflow_2025; @rgfn_2024] We adopt this perspective as the foundation for the subsequent analysis, with the additional requirement that every transformation should satisfy selectivity constraints (Tier 2, [Section 5.2.1](#sec-validity-hierarchy)). By enforcing explicit route generation, this framework also resolves the ambiguity of inventory constraints, as a molecule is deemed accessible only if the planner can connect it to the defined stock set. This results in a shift in objective: from training classifiers to _estimate_ synthesizability toward developing planners that _demonstrate_ it. # 5 Problem Formulation and Definitions ## 5.1 Formalizing Retrosynthetic Logic Retrosynthetic analysis, introduced in 1963 by Vleduts [@vleduts_1963] and formalized by E. J. Corey in 1969 [@corey_1969], is the logical deconstruction of a target molecule into progressively simpler precursors. The fundamental operation is the _disconnection_: a conceptual cleavage of a strategic bond that implies a forward chemical reaction capable of forming it. This operation transforms the target structure into a set of immediate precursors or _synthons_. The analysis is recursive; each precursor becomes a subsequent target for disconnection, generating a branching tree of potential pathways. This process terminates only when a branch reaches a _starting material_: a compound present in the chemist's available inventory. Early computational implementations, such as LHASA [@lhasa_1972] and SECS [@wipke_1974], established this logic but relied on hand-coded heuristics that could not scale to the full diversity of organic chemistry [@icsynth_2015]. Mathematically, retrosynthesis can be formulated as a search over a directed bipartite AND/OR graph $G=(V_M \cup V_R, E)$, in which two types of nodes alternate. Molecule nodes $V_M$ represent OR choices: the planner selects one disconnection from several reactions that could produce the molecule in question. Reaction nodes $V_R$ represent AND constraints: once reaction is selected, _all_ of its required precursors must be obtained, with each becoming a new molecule node to be solved. A solved synthetic route is a subgraph of this graph with every terminal node belonging to the available starting material stock set $\mathcal{S}_\text{stock}$. Within this framework, it is helpful to distinguish two computational problems. The _search feasibility_ problem asks whether _any_ valid route exists that connects the target to $\mathcal{S}_\text{stock}$. The _optimality_ problem asks which of these feasible routes is best under a chosen cost function (e.g., step count, price, or safety). In the current literature, most benchmarks primarily measure search feasibility, often termed \"solvability\", because defining a universally valid cost function for chemical optimality remains an open challenge. The central difficulty in planning is that the AND/OR graph is implicit. The graph is too large to precompute; it must be built incrementally during search. Since the number of plausible disconnections grows exponentially with depth (see [Table 3](#tab-tree-search-size)), exhaustive enumeration is intractable. The planner's task, therefore, is to allocate a limited computational budget to expand only the most promising branches. This is complicated by the sparse reward signal: a precursor set may appear chemically sound at step 1 but fail to connect to stock at a later step. :::note{#tab-tree-search-size} **Table 3.** The original tree-size table is available as an interactive version in the [Combinatorial Explosion](/syntax-of-matter/calculator) section, where you can vary branching factor and route depth directly. Core point: exhaustive retrosynthetic search scales as `O(b^d)`, so even moderate increases in branching factor or route depth render brute-force enumeration intractable. ::: ![](/static/images/review/brute-force-intractability.svg) :::caption{#fig-combinatorial-explosion}[Figure 1. Schematic Diagram of the Retrosynthetic Tree Search.] A target molecule (e.g., nitrazepam) presents multiple viable strategic bond disconnections. Each disconnection (marked with a different color) yields a new set of required precursors, initiating a recursive branching process. ::: ## 5.2 Reaction Templates and Chemical Rules ![](/static/images/review/template-formation.svg) :::caption{#fig-template-extraction}[Figure 2. Extraction and Representation of Reaction Templates.] The sequential process of deriving local graph-transformation rules from reaction data ([Section 5.2](#sec-reaction-templates)). **(Step 1)** A chemical transformation is represented as a Reaction SMILES string. **(Step 2)** Atom-to-atom mapping establishes a rigorous correspondence between reactant and product atoms to identify the reaction center (bonds formed and cleaved). **(Step 3)** Unchanged molecular topology is discarded to isolate the generalized rule. Manual extraction typically yields broad, minimal templates, whereas automated algorithms (e.g., RDChiral ) retain explicit local environment guards (e.g., atom degree, hydrogen counts) to constrain applicability. By definition, these templates strictly enforce Syntactic and Topological validity (Tiers 0–1, [Section 5.2.1](#sec-validity-hierarchy)) but cannot guarantee molecule-wide Selectivity (Tier 2). ::: In template-based planning, the legal moves are defined by _reaction templates_. A template is a subgraph transformation rule: it specifies the atoms whose bonds change (the reaction center) and a minimal neighborhood of context, typically encoded as reaction SMARTS. For example, an amide hydrolysis template describes the transformation of `[C:1](=[O:2])[N:3]` into `[C:1](=[O:2])[OH] + [N:3]`. Crucially, templates are local: they define the change at the reaction site but contain no information about the rest of the molecule. For instance, a template for Grignard addition may match a ketone substructure perfectly, even if an unprotected carboxylic acid elsewhere in the molecule would quench the reaction immediately. Consequently, applying a template guarantees only _syntactic_ and _topological_ validity (meaning the graph edit is structurally legal) but does not guarantee _selectivity_, _i.e._, that the reaction will actually proceed as intended in the presence of competing functional groups. Templates originate from two sources. Expert systems like Chematica [@chematica_2018; @grzy_2016] rely on hundreds of hand-coded rules [@dogs_2012; @button_2019; @gao_2022; @gao_2024] augmented with steric and electronic guards. Conversely, modern deep learning approaches automatically extract templates from reaction databases by atom-mapping reactants to products and identifying the changed core [@rxnmapper_2021; @rdchiral_2019] ([Figure 2](#fig-template-extraction)). While automated extraction scales to tens to hundreds of thousands of reactions, it often produces noisy rule sets that lack the rigorous context guards of expert systems. | Tier | Definition | Treatment in Current Planners | | ---------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------ | | **0. Syntactic** | Obeys graph-theoretic rules (valency, aromaticity, charge balance). | Templates: enforced. Sequence models: no guarantee. | | **1. Topological** | Correct reaction center modification per mechanistic template. | Templates with applicability check: enforced. | | **2. Selectivity** | Correct outcome among multiple chemically plausible pathways. | | | — Chemoselectivity | Correct functional group reacts; no incompatible FG conflicts. | Human-curated rules: partial. Learned policies: statistical. | | — Regioselectivity | Correct site among non-equivalent positions. | Learned policies: statistical. QM: rarely integrated. | | — Diastereoselectivity | Correct relative stereochemistry. | Learned policies: statistical. QM: rarely integrated. | | — Enantioselectivity | Correct absolute stereochemistry. | Largely ignored. | | — Stoichiometry | Control of single vs. multiple equivalent transformations. | Largely ignored; single-equivalent assumed. | | **3. Executability** | Lab-realistic conditions (yield, purification, safety, scale). | Condition predictors: single-step. Route-level: rarely integrated. | :::caption{#tab-validity-hierarchy}[**Table 4.** **Hierarchy of Chemical Validity in Retrosynthetic Planning.**] A proposed transformation must satisfy constraints at multiple levels to be experimentally realizable. Specific failure modes are visualized in Figures 3--5. Template-based methods guarantee syntactic and topological validity (Tiers 0--1) by construction, but provide no formal control over selectivity (Tier 2). Sequence-based methods lack formal guarantees at any tier, requiring explicit post-hoc validation. ::: ### 5.2.1 Hierarchy of Chemical Validity The term _validity_ in retrosynthetic planning frequently obscures the distinction between graph-theoretic connectivity and experimental feasibility. To address this ambiguity, we define four levels of constraints ([Table 4](#tab-validity-hierarchy)) that a proposed transformation must satisfy. _Syntactic_ (Tier 0) and _Topological_ (Tier 1) validity refer to the construction of a well-formed molecular graph and a legal reaction center modification. Template-based methods enforce these constraints by definition, whereas template-free sequence models must learn them from the training data. As a result, unconstrained generation can yield proposals that violate valence rules or posit chemically impossible bond migrations, as illustrated in [Figure 3](#fig-sequence-hallucinations). _Selectivity_ (Tier 2) requires that the transformation be chemically plausible in the presence of competing functional groups and stereochemical requirements. While learned policies implicitly capture some of these constraints from training data, the standard template formalism does not guarantee them. A template defined by a local graph edit may be topologically applicable but fail to encode the global molecular context required to prevent unintended reactions at competing functional groups, _i.e._ ensure that the intended transformation occurs selectively at the target site rather than across chemically similar sites. ([Figure 4](#fig-template-selectivity)). Similarly, while reaction SMARTS can encode stereochemistry, automated extraction frequently yields non-specific rules. Consequently, a planner may satisfy Tier 1 validity by applying a generic template that discards the necessary stereochemical information ([Figure 5](#fig-template-stereochemistry)). Without explicit verification, these selectivity constraints are never directly enforced—whether they are satisfied depends entirely on the statistical quality of the policy rather than on any structural guarantee. Validating Tier 2 constraints requires distinguishing reactive environments that standard fingerprints often fail to differentiate. [Kogej et al.](https://doi.org/10.26434/chemrxiv-2025-gw23n) address this with SMARTS-RX, a curated vocabulary of functional group patterns (e.g., distinguishing heteroaryl from phenyl halides) that captures the electronic context necessary to predict reaction failure [@smartsrx_2025]. Integrating such granular definitions into the planning loop is likely a prerequisite for automated Tier 2 verification. :::insight We're not necessarily saying existing methods violate Tier 0-2 validity constantly (some manual expert audits show that they sometimes do); rather, it's simply an epistemic blind spot (which, arguably, is even worse: progress begins with measurement) ::: _Executability_ (Tier 3) demands that the step be viable under specific laboratory conditions, including yield, purification, and safety. ![](/static/images/review/tier1-nu-addition.svg) :::caption{#fig-sequence-hallucinations}[Figure 3. Illustrative Failure Modes of Template-Free Sequence Policies Across the Solv-*N* Hierarchy.] Unconstrained autoregressive models ([Section 6.2.2](#sec-ss-policy-sequence)) may propose transformations that violate fundamental chemical and topological constraints ([Section 5.2.1](#sec-validity-hierarchy)). **(Rxn 1)** A Tier 2 (Selectivity) violation: the proposed disconnection is topologically valid (Solv-1) but chemically implausible. Methyllithium strongly favors 1,2-addition over the implied conjugate addition (Solv-2C). Furthermore, even if substituted with a soft nucleophile (e.g.,) to force 1,4-addition, the reaction violates regioselectivity constraints (Solv-2R), as conjugate addition occurs at the _β_-carbon, not the _α_-carbon depicted. **(Rxn 2)** A Tier 1 (Topological) violation: the model hallucinates a non-physical migration of the aryl substituents from a _para_- to a _meta_-relationship during the addition step. **(Rxn 3)** A Tier 0 (Syntactic) violation: the generation of a pentavalent carbon atom, violating basic valency rules. While template-based policies prevent Tier 0 and 1 errors by construction, sequence models require rigorous post-hoc sanitization to identify such structural anomalies. ::: ![](/static/images/review/tier2-nu-addition.svg) :::caption{#fig-template-selectivity}[Figure 4. The Insufficiency of Topological Validity: Tier 2 Failures in Template Application.] While reaction templates guarantee Syntactic (Tier 0) and Topological (Tier 1) validity ([Section 5.2.1](#sec-validity-hierarchy)) by enforcing valid local graph edits, they are inherently blind to the global molecular context governing Selectivity (Tier 2). All four proposed disconnections perfectly match the methyllithium addition template, but only one is experimentally viable. **(Rxn 1)** A fully valid (Solv-2) transformation, correctly depicting the exhaustive alkylation of two equivalent carbonyls. **(Rxn 2)** A Solv-2S (Stoichiometric) violation: proposing mono-addition to a symmetric dicarbonyl lacking a control mechanism, which would inevitably over-react to form the Rxn 1 product. **(Rxn 3)** A Solv-2R (Regioselective) violation: attempting selective addition to one of two competing electrophilic sites. The intrinsic reactivity difference is insufficient, yielding a complex mixture. **(Rxn 4)** A Solv-2C (Chemoselective) violation: the strongly basic organolithium reagent will be immediately quenched by the unprotected carboxylic acid via proton transfer, precluding the intended nucleophilic addition. These failure modes demonstrate why planners must integrate explicit selectivity verification ([Section 8.1](#sec-solvability-hierarchy)) rather than relying on local template applicability. ::: ![](/static/images/review/tier2-diels-alder-v2.svg) :::caption{#fig-template-stereochemistry}[Figure 5. Stereochemical Blind Spots in Topological Planning: Tier 2 Failures.] Diels-Alder cycloadditions highlight the inability of standard 2D reaction templates ([Section 5.2](#sec-reaction-templates)) to enforce 3D spatial constraints. All four proposed disconnections perfectly match the [4+2] cycloaddition template (Solv-1), but three fail critical experimental constraints ([Section 5.2.1](#sec-validity-hierarchy)). **(Rxn 1)** A fully valid (Solv-2) transformation: the inclusion of a specific chiral organocatalyst (e.g., MacMillan imidazolidinone ) correctly maps to the enantiopure _endo_ product. **(Rxn 2)** A Solv-2E (Enantioselective) violation: the planner proposes the (S,S,S) enantiomer, but the specified catalyst strictly induces the (R,R,R) geometry. **(Rxn 3)** A Solv-2E violation: attempting to synthesize an enantiopure target without a source of chiral induction. The forward reaction will yield a racemic mixture. **(Rxn 4)** A Solv-2D (Diastereoselective) violation: the proposed disconnection targets the _exo_ isomer, but the unconstrained forward reaction intrinsically favors the _endo_ transition state via secondary orbital interactions. These examples emphasize that physical executability requires models to internalize geometric and kinetic control, not merely graph connectivity. ::: ## 5.3 Inventory Definitions and Search Boundaries Retrosynthetic search terminates only when all required precursors lie in the chosen inventory of starting materials. The definition of that stock therefore acts as a difficulty dial: expanding the inventory reduces the depth the planner must reach and increases success rates. In practice, evaluations often treat two distinct inventory types as interchangeable. The _physical tier_ comprises genuinely in-stock, rapidly deliverable compounds (typically $\sim 10^5$--$10^6$ entries). The _virtual tier_ consists of make-on-demand listings that are purchasable in name but typically require vendor synthesis (often $\sim 10^7$--$10^9$ entries). Allowing termination in the virtual tier relaxes the planning task by permitting routes to stop at complex intermediates whose remaining synthesis is simply outsourced. This shifts the operational burden from the algorithm to the vendor, often incurring lead times that are incompatible with iterative screening cycles. Consequently, high success rates against make-on-demand inventories reflect a different, less constrained objective than delivering actionable routes from physical stock. ## 5.4 Evaluation Metrics The literature relies on three primary metrics, each probing a different aspect of validity. _Solvability_ measures the fraction of targets for which a planner finds _any_ route terminating in the stock set. Because this metric strictly evaluates topological connectivity (Tier 1), we adopt the termstock-termination rate (STR) [@retrocast_2025]. This redefinition clarifies that the metric assesses the capacity to navigate the search graph rather than the chemical correctness of the result. To approximate higher-tier validity, studies typically employ two proxies. _Route reconstruction_ (Top-$K$ accuracy) assesses whether the planner recovers known experimental routes. While reconstructed steps inherit the validity of the historical data (Tier 2--3), this metric is conservative; it penalizes valid, novel routes that differ from the reference. _Round-trip accuracy_ evaluates self-consistency by applying a forward reaction predictor to the proposed precursors. While useful for filtering syntactic errors, this check is model-dependent. If the forward predictor shares the training distribution or architectural biases of the planner, a successful round-trip confirms consistency rather than independent chemical correctness. ## 5.5 Data Sources and Reaction Databases Data-driven planners are fundamentally bounded by the quality of their training datasets. Most modern systems rely on reactions extracted from patent literature (::TERM[USPTO]::) [@lowe_2017; @paroutes], which introduces distinct biases. First, because the patents overwhelmingly report successful transformations, the model is trained exclusively on reactions that worked, with no exposure to failed attempts or undesired outcomes. Models learn feasible disconnections but receive no direct supervision regarding failure modes. This absence of negative data weakens the model's ability to identify infeasibility and selectivity boundaries. Second, automated extraction frequently obscures reaction roles. Datasets often represent reactions as unordered mixtures, treating structural reactants, auxiliary reagents, catalysts, and solvents as interchangeable participants rather than distinguishing their roles in the transformation. This forces models to infer chemical roles from co-occurrence statistics rather than explicit labels, occasionally leading to incoherent proposals where solvents or bases are treated as stoichiometric building blocks. While proprietary databases (e.g., Reaxys, Pistachio) offer cleaner curation, their licensing restrictions limit their utility for reproducible benchmarking. Consequently, open-source development is still limited by the noise and ambiguity of raw patent text. # 6 Algorithmic Architectures for Planning Computational approaches to retrosynthesis have converged on two distinct paradigms: _search-based planning_ (verify-then-search) and _direct route generation_ (generate-then-verify). In the former, retrosynthesis is cast as a discrete optimization problem over an AND/OR graph. A single-step model proposes local disconnections, which a search algorithm then assembles into a complete route under explicit constraints (e.g., inventory availability and depth limits). In the latter, the route is serialized as a token sequence, and transformer architectures model the conditional probability of the entire pathway. This section traces the evolution of both approaches and makes explicit their central trade-off: the formal validity guarantees of explicit search ([Section 5.2.1](#sec-validity-hierarchy), Tiers 0--1) versus the global conditioning learned implicitly by sequence models. :::note{#tab-method-families} **Table 6. Methods comparison.** The architecture comparison table is easier to browse in the interactive [Methods](/syntax-of-matter/methods) section, which lets you filter by paradigm, inspect representative systems, and compare method families side by side. The core contrast remains: explicit search offers stronger formal guarantees, direct sequence generation offers global conditioning and speed, and hybrid systems try to combine both. ::: ## 6.1 Graph-Based Search Strategies Search-based planners decouple chemical logic from algorithmic traversal. The operational pipeline typically consists of three distinct modules: (1) an _expansion model_ that maps a product to candidate precursors; (2) a _feasibility filter_ that prunes invalid or out-of-scope transformations; and (3) a _scoring function_ that estimates the cost or probability of completing the route from a given state. By separating these components, search-based architectures allow for the modular improvement of chemical reasoning without altering the underlying search logic ([Figure 6](#fig-explicit-search-mechanics)). ![](/static/images/review/master-planners.svg) :::caption{#fig-explicit-search-mechanics}[**Figure 6. Mechanics of Explicit Graph Search in Retrosynthetic Planning.**] The operational pipeline of verify-then-search architectures ([Section 6.1](#sec-graph-search)). **(Stage 1)** The expansion phase utilizes a single-step policy ([Section 6.2](#sec-ss-policy))—either a template-based classifier ([Section 6.2.1](#sec-ss-policy-template)) or a template-free sequence generator ([Section 6.2.2](#sec-ss-policy-sequence))—to propose candidate precursor sets (Nodes A–E) and assign prior expansion probabilities (_p_). **(Stage 2)** An optional feasibility policy explicitly prunes invalid or out-of-scope moves prior to evaluation. **(Stage 3)** Value estimation updates the expected utility (_Q_) of the expanded node. Probabilistic Exploration approaches (e.g.,::TERM[MCTS]::, [Section 6.1.1](#sec-expl-search-mcts)) rely on stochastic rollouts using a lightweight, latency-optimized policy to estimate termination probability, assigning negative rewards for unpurchasable dead ends. Value-guided optimization frameworks (e.g., Retro\*, [Section 6.1.2](#sec-expl-search-value)) replace rollouts with learned heuristics, directly predicting the cost-to-go either from the isolated target node or by aggregating context across the entire AND/OR search graph (e.g., RetroGraph). ::: ### 6.1.1 Probabilistic Exploration (MCTS) The historical analogy between retrosynthesis and combinatorial games [@matthew_2005] was computationally realized when [Segler et al.](https://doi.org/10.1038/nature25978) adapted Monte Carlo tree search (MCTS) to chemical planning [@mcts_2018]. This adaptation, 3N-MCTS, established the modern paradigm by replacing hand-engineered heuristics with learned components within the search loop. In this framework, the expansion model ranks transformation rules, a feasibility filter screens the proposed reactions, and stochastic simulations (rollouts) estimate the value of the node by probing how likely a given molecule node (intermediate) is to lead to a completed route terminated with a purchasable starting material within a fixed number of steps. To train the feasibility filter without experimental failure data, the authors [@mcts_2018] employed _algorithmic negatives_: applying templates to known reactants and labeling any unreported products as invalid ([Figure 7](#fig-algorithmic-negatives)). While effective on dense proprietary databases like Reaxys, this closed-world assumption degrades on sparser open databases such as ::TERM[USPTO]::. Conflating undocumented products with chemically impossible ones creates significant false negatives, systematically penalizing valid but novel routes. Consequently, most (but not all [@retrogfn_2025]) subsequent open-source planners [@aizyn_2020] have abandoned explicit feasibility filters, embedding feasibility assessments implicitly into the expansion model. ![](/static/images/review/synthetic-negatives.svg) :::caption{#fig-algorithmic-negatives}[**Figure 7. Generation of Algorithmic Negatives for Feasibility Policies.**] The construction of synthetic negative data, a standard technique for training in-scope filters and feasibility classifiers (e.g., 3N-MCTS  and RetroGFN ). **(Step 1–2)** A literature reaction is abstracted into a reaction template ([Section 5.2](#sec-reaction-templates)). **(Step 3)** Template Misapplication: the rule is applied exhaustively to other reactants in the database. Any generated product not explicitly recorded in the positive corpus is labeled an algorithmic negative. While this captures genuine chemical impossibilities (True Negatives), the closed-world assumption—that unreported equals impossible—systematically generates False Negatives. For example, the intramolecular lactamization shown is chemically viable but penalized simply for lacking precedent. **(Step 4)** Product Swapping: true reactants are paired with a structurally similar but incorrect product to train discriminators. The reliance on algorithmic negatives highlights the epistemic limits of positive-only patent databases ([Section 5.5](#sec-data-sources)) and motivates the integration of explicit physics-based supervision. ::: A persistent limitation of ::TERM[MCTS]:: is the high variance induced by the branching factor of chemical synthesis. At any state, numerous plausible disconnections exist (OR nodes), but each chosen disconnection may yield multiple precursors that must all be solved (AND constraints). [Kishimoto et al.](https://proceedings.neurips.cc/paper_files/paper/2019/file/4fc28b7093b135c21c7183ac07e928a6-Paper.pdf) formalized this asymmetry, demonstrating that stochastic simulations can be dominated by shallow branches favored by the model's initial score, thereby failing to explore longer-horizon routes that terminate only after many steps [@dfpn_2019]. To address this exploitation bias, [Wang et al.](https://doi.org/10.1039/D0SC04184J) introduced dynamic exploration schedules (mUCT) to broaden coverage of low-scoring but chemically plausible branches, demonstrating that such mechanisms can also incorporate auxiliary objectives like green solvent selection [@green_mcts_2020]. More recently, [Tripp et al.](https://arxiv.org/abs/2310.09270) reframed the planning objective: rather than identifying a single optimal route, the goal becomes selecting a portfolio of routes that together maximize the successful synthesis probability (SSP), accounting for the possibility that individual steps may fail in practice[@retrofallback_2024]. ### 6.1.2 Best-First Search with Learned Heuristics To reduce the variance and computational cost of stochastic simulations, a complementary line of work replaces rollout-based evaluation with learned estimates of synthetic cost. [Schreck et al.](https://doi.org/10.1021/acscentsci.9b00055) pioneered this by framing planning as a single-player game, training a value function to predict the expected remaining synthesis cost from any given intermediate [@selfplay_2019]. At inference time, this yields a deterministic planner that selects disconnections by minimizing the immediate reaction cost plus the predicted cost of the resulting precursors. Retro\* subsequently formalized this principle within a neural-guided A\* framework, decomposing node evaluation into accumulated cost and a learned heuristic for future difficulty on an AND/OR tree [@retrostar_2020]. [Xie et al.](https://doi.org/10.1145/3534678.3539446) extended this logic to graph-based structures (RetroGraph), merging identical intermediates to share value estimates across redundant branches [@retrograph_2022]. Finally, recent efforts such as InterRetro [@treemdp_2025] demonstrate that the search process itself can be distilled into a single-step policy via self-imitation learning, allowing for greedy inference that approximates the results of::TERM[MCTS]:: without the runtime cost of tree expansion. However, controlled comparisons suggest that the choice of traversal algorithm yields only incremental gains relative to the quality of the chemical model. Within the AiZynthFinder framework [@aizyn_2020], [Roucairol and Cazenave](https://api.semanticscholar.org/CorpusID:253882602) found that nested Monte Carlo search and greedy best-first search improved solvability only modestly over standard::TERM[MCTS]::, concluding that performance is primarily bounded by the expansion model's ability to propose valid steps [@nested_mcts_2024]. ### 6.1.3 Horizon Effects and Strategic Control A central limitation of explicit search is the _horizon effect_: when node scoring is optimized for short-term objectives (e.g., maximizing single-step likelihood), the planner systematically penalizes steps whose utility is only realized later in the route. This includes strategic disconnections [@strat_2020] that enable convergent assembly, as well as auxiliary operations like protection/deprotection that temporarily increase molecular complexity. MEEA\* addresses these limitations by combining best-first expansion with short exploratory simulations a few steps ahead before committing to a node, while training the value function with a path-consistency regularizer to stabilize cost estimates across the search trajectory. [@meea_2024]. Complementary approaches enforce long-range intent explicitly. ReTReK [@retrek_2022] injects curated chemical knowledge, such as preferences for ring disconnections or convergent steps, directly into the selection rule, biasing exploration toward strategies that pure likelihood models often neglect. Similarly, [Westerlund et al.](https://api.semanticscholar.org/CorpusID:280182755) demonstrate that in medicinal chemistry, satisfying user intent (e.g., preserving a specific scaffold) often requires forcing the planner to break or freeze specific bonds, a constraint effectively implemented via multi-objective::TERM[MCTS]:: [@westerlund_2025]. Structural modifications to the search process have also been proposed to capture dependencies that span many steps ahead. DESP [@desp_2024] handles the constraint of reaching specific starting materials by combining top-down retrosynthesis with bottom-up forward expansion -- growing the route from both ends simultaneously and using a learned metric of synthetic proximity to guide the convergence of the two frontiers.. Beyond the single target, [Picazo et al.](https://doi.org/10.26434/chemrxiv.10001547/v1) introduced MultiAiZ [@multitarget_2026] to exploit shared intermediates across batches of molecules, dynamically updating the available inventory to encourage convergent plans -- routes that reduce overall synthetic effort by routing multiple targets through common key intermediates. A complementary approach elevates the planning problem to a higher level of abstraction entirely. [Roh et al.](https://chemrxiv.org/engage/chemrxiv/article-details/67a367196dde43c908af44a1) replace atom-level reaction templates with rules that operate on generalized synthons, effectively decoupling strategic bond disconnections from the tactical implementation of specific functional group interconversions[@higherlev_2025]. This abstraction allows the planner to bypass the tactical complexity of protecting group sequences, which often creates local minima that trap myopic search algorithms. While this approach yields dramatic improvements in solvability on complex targets, it does so by changing the objective: instead of delivering a fully specified and executable route, it produces a high-level plan whose individual steps must still be instantiated before the synthesis can be carried out. ## 6.2 Single-Step Reaction Prediction For search-based planners, the multistep algorithm serves only to assemble routes from the local disconnections proposed by its _expansion model_: a predictor that maps a target product $P$ to a set of candidate precursors $\{R\}$, typically generating dozens or hundreds of suggestions per step and ranking them according to criteria such as predicted reaction feasibility, chemical similarity to known precedents, estimated yield, or learned heuristics from training data. The expansion models are very diverse and often based on templates (RetroSym [@coley_2017], NeuralSym [@segler_2017a], GLN [@gln_2019], RetroPath2.0 [@delepine_2018], LocalRetro [@localretro_2021]), neural networks (Seq2Seq [@liu_2017], MEGAN [@sacha_2021], Chemformer [@chemformer]), or hybrid approaches (RetroXpert [@yan_retroxpert_2020], GraphRetro [@somnath_graphretro_2021], BioNavi [@zeng_bionavy_2024]). The ranking is crucial, as it determines the order in which disconnections are evaluated during tree expansion; for instance, neural network-based expansion models often output a sorted list or probabilistic scores (e.g., via softmax distributions over templates or reactants), prioritizing those deemed most synthetically viable based on patterns extracted from reaction databases. While differences in traversal algorithms (e.g.,::TERM[MCTS]:: vs. A\*) alter how computational resources are allocated, such as through biased sampling in::TERM[MCTS]:: or heuristic-guided queuing in A\*, they cannot compensate for a deficit in chemical knowledge within the expansion model itself. With limited computational resources, a route is effectively unreachable if its critical disconnection is never ranked highly enough by the expansion model, as search algorithms typically limit branching to the top-$k$ proposals (where $k$ is a hyperparameter like 10 or 50), potentially overlooking rare but optimal disconnections buried in lower ranks due to model biases, incomplete training, or overemphasis on common reaction motifs. ### 6.2.1 Template-Based Prediction The canonical expansion model ranks a finite library of reaction templates ([Section 5.2](#sec-reaction-templates)) and applies the top-scoring rules to generate precursors. This classification-based approach underlies 3N-MCTS [@mcts_2018] and open-source standards like AiZynthFinder [@aizyn_2020], typically employing lightweight neural networks to score on the order of $10^4$--$10^5$ possible transformations based on molecular fingerprints. The primary advantage of template-based models is their structural discipline: they enforce local syntactic and topological constraints by construction ([Section 5.2.1](#sec-validity-hierarchy), Tiers 0--1). Because every proposed step results from applying a pre-validated graph edit, the output is guaranteed to be a valid molecular graph. Architectural refinements have largely focused on the ranking problem itself: (e.g., LocalRetro [@localretro_2021] and GLN [@gln_2019]) improve accuracy by identifying reaction centers directly on the molecular graph, rather than relying solely on global fingerprint vectors. However, these advantages are accompanied by an intrinsic limitation in coverage: the model's chemical vocabulary is restricted to transformations represented in the predefined template library. As a result, the model's performance degrades dramatically with the distribution shift when the target molecules or required reactions in a new scenario deviate significantly from those in the training data. In such cases, the model simply lacks the templates needed to propose valid disconnections, leading to incomplete or failed route predictions, as it cannot generalize beyond its hardcoded rules. For instance, AiZynthFinder achieves a solvability rate of 70.9% on ChEMBL but drops to 10.1% on the enumerated GDB MedChem set [@aizyn_2024]. This reduction suggests that fixed template libraries struggle to generalize to chemical space outside the historical reaction space. To address this, approaches like RetroGFN [@retrogfn_2025] and generative template models [@shee_2024] replace discrete classification over fixed templates with sequential template construction, which builds reaction templates step-by-step (through autoregressive generation [@retrogfn_2025] or sampling from the latent space of an autoencoder [@shee_2024]). This enhances the diversity of proposed disconnections by enabling the creation of novel transformations beyond predefined libraries but at the cost of higher inference latency since each proposed disconnection requires multiple iterative model evaluations rather than a single, parallel classification pass. ### 6.2.2 Template-Free Sequence Generation Template-free models bypass the fixed library by directly generating precursor SMILES strings, typically formulating prediction as a sequence-to-sequence translation task. The Molecular Transformer established this paradigm for forward reaction prediction [@schwaller_2019], and subsequent work extended it to retrosynthesis by coupling transformer-based generation with explicit search procedures [@moltransformer_2020]. AutoSynRoute integrated these sequence models into ::TERM[MCTS]::, using likelihood scores to prioritize node expansion [@autosynroute_2020], while Chemformer utilized BART-style pre-training to improve robustness on smaller datasets [@chemformer]. The central benefit of template-free generation is coverage: the model is not bounded by the discretization artifacts of template extraction and can, in principle, propose any chemically valid string. The trade-off is the loss of formal guarantees ([Section 5.2.1](#sec-validity-hierarchy)). Because the model emits tokens rather than applying a graph edit, it may generate invalid ::TERM[SMILES]:: or chemically impossible bond changes (Tier 0 failures). These errors necessitate rigorous post-hoc validation and correction. Furthermore, RetroRanker identifies a "frequency bias" in these models, where high-confidence proposals often reflect the statistical prevalence of common reactants rather than the specific structural logic of the target [@retroranker_2023]. This has motivated the development of ensemble architectures such as RetroChimera [@chimera_2025], which combine the coverage of sequence models with the structural constraints of graph-based editors. ### 6.2.3 Throughput as a Planning Constraint When an expansion model is embedded within a search loop, its inference speed becomes a structural constraint on planning depth.::TERM[MCTS]:: and A\* algorithms require hundreds to thousands of expansions to explore a tree effectively. Template-based classifiers (MLPs/GNNs) can be queried in milliseconds, whereas autoregressive sequence models require computationally expensive token-by-token decoding, often taking seconds per expansion. This latency differential creates a _speed-accuracy frontier_. [Maziarz et al.](https://doi.org/10.1039/D4FD00093E) report that under a fixed time budget (e.g., 10 minutes per target), transformer-based planners execute so few expansions that they fail to solve complex targets, despite having higher single-step accuracy [@syntheseus_2025]. Similarly, [Hassen et al.](https://arxiv.org/abs/2212.11809) observed that Chemformer, despite superior top-1 predictive performance, underperformed the faster LocalRetro model in multistep solvability (53.4% vs. 80.6%) simply because the search could not explore deep enough within the practical time limit [@mindgap_2022]. Consequently, accelerating inference is not merely an engineering detail but a prerequisite for the utility of sequence models in planning. Recent work has applied speculative decoding to increase transformer throughput, recovering some of the performance gap under strict time limits [@andronov_2025]. The broader implication is that for retrosynthesis, model throughput is a component of chemical capability: a marginally less accurate but orders-of-magnitude faster model may be the superior planner. ## 6.3 Hybrid and Neurosymbolic Approaches The coverage and latency constraints identified in [Section 6.2](#sec-ss-policy) motivated the development of hybrid architectures. These systems retain explicit search as the scaffold for compositional planning but inject learned modules (rankers, scoring functions, and heuristics) to steer which steps and partial routes are expanded. By integrating sequence models and large language models (LLMs) as guidance mechanisms rather than primary planners, these approaches aim to combine the rigor of tree search with the semantic reasoning of generative models. ### 6.3.1 Ensemble and Re-Ranking Architectures A direct form of integration combines models with complementary inductive biases to improve candidate quality. [Maziarz et al.](https://arxiv.org/abs/2412.05269) exemplify this with RetroChimera [@chimera_2025], which combines a graph-based editing component (NeuralLoc) with a sequence-based generator (R-SMILES 2) and trains a learning-to-rank model to prioritize proposals from both sources. By fusing graph-based logic, which preserves rule-constrained edits (Tier 1 validity, Sec 5.2.1), with sequence-based generation that expands coverage into rare transformations, the architecture mitigates the specific failure modes of each paradigm. RetroChimera further validates this approach through expert preference evaluations, where chemists frequently rated model proposals as superior to historical ground truth, suggesting that the ensemble improves chemical plausibility even when it diverges from specific reference routes [@chimera_2025]. A modular alternative keeps the expansion model fixed but adds a learned verifier to score the plausibility of proposed bond changes. RetroRanker [@retroranker_2023] implements this strategy by encoding the reaction center via a graph neural network, outputting a re-ranking score designed to suppress high-confidence but chemically implausible proposals attributed to frequency bias. Although the reported multistep gains are modest, likely because the re-ranking is practically constrained to the first expansion step, the work demonstrates that verification models conditioning on reaction-center structure provide a control mechanism that token-likelihood models lack. Effectively, these methods use structural constraints to filter the syntactic errors common to sequence models, thereby reinforcing Tier 0 validity. Other hybrid approaches impose preferences at the route level rather than the reaction step. [Zipoli et al.](https://api.semanticscholar.org/CorpusID:269648854) steer exploration by comparing the evolving sequence of reactions to embeddings of successful patent routes [@zipoli_2024]. This strategy retains explicit search for compositional correctness while supplying an external retrieval signal that encourages the model to mimic the structural patterns of known chemistry, effectively mitigating the tendency of local scoring functions to miss strategic long-term dependencies. Hybrid architectures can also address specific chemical deficits in pure search. [Westerlund et al.](https://doi.org/10.26434/chemrxiv-2025-gdrr8) developed a post-hoc graph modification framework that wraps the AiZynthFinder planner with a physics-guided selectivity module [@labplans_2025]. The system first diagnoses potential chemoselectivity conflicts, such as competing nucleophiles, using graph neural networks to predict condensed Fukui coefficients: quantum chemical reactivity descriptors that quantify how susceptible each atom in a molecule is to nucleophilic or electrophilic attack. Upon detecting a valid conflict, it automatically \"repairs\" the route by inserting protection and deprotection steps generated by a specialized transformer, overriding the planner's tendency to favor shorter, unprotected pathways. This mechanism explicitly bridges the gap between topological connectivity (Solv-1, [Section 5.2.1](#sec-validity-hierarchy)) and experimental selectivity (Solv-2), proving that chemical validity often requires structural complexity that purely data-driven, length-minimizing policies will systematically avoid. ### 6.3.2 Large Language Models as Heuristic Guides General-purpose large language model (LLM)s provide a semantic layer often absent in purely structural planners. Rather than serving as primary expansion models, they function effectively as heuristic guides that inject non-topological constraints, such as safety, material availability, or procedural complexity, into the search loop. [Liu et al.](https://arxiv.org/abs/2410.04223) (Llamole) implement this by embedding an ::TERM[LLM]:: within A\* search to compute the heuristic cost-to-go, $h(n)$, directly from textual descriptions of synthetic feasibility [@llamole_2024]. [Baker et al.](https://arxiv.org/abs/2508.11860) (LARC) similarly deploy the ::TERM[LLM]:: as a \"critic\" agent within the MEEA\* framework [@meea_2024; @larc_2025], pruning hazardous or impractical intermediates that topologically valid policies might otherwise pursue. Beyond scalar scoring, [Song et al.](https://arxiv.org/abs/2509.20988) utilize LLMs for macro-expansion via AOT\* (And-Or Tree search) [@song_2025]. Here, the model proposes coherent multi-step route fragments which are subsequently verified and grafted into the search tree by template-based logic. This neurosymbolic design effectively treats the ::TERM[LLM]:: as a source of strategic intuition while retaining the symbolic engine for rigorous Tier 1 graph validation. However, the stochastic nature of text generation introduces significant reproducibility challenges. Unlike standard discriminative models that provide deterministic outputs, ::TERM[LLM]::-based guidance depends heavily on decoding strategies and prompt formulation, requiring rigorous standardization of the inference context to guarantee consistent planning behavior. ## 6.4 Direct Sequence Generation While hybrid systems retain an explicit search procedure assembling a route step by step through tree search, the direct sequence paradigm shifts the entire burden of multistep planning to a single generative model. In this framework, retrosynthetic routes are not assembled by the recursive expansion of a reaction tree, but are instead generated directly as a sequence of tokens produced via autoregressive decoding (the same way a language model generates a sentence). This architectural shift replaces the modular complexity of heuristic search algorithms with scalable representation learning, effectively relocating the computational effort from inference-time tree exploration to the training stage, distilling the strategic knowledge into model parameters once and then applying it during inference. ### 6.4.1 Autoregressive Template and Trajectory Modeling Intermediate approaches in this domain focus on predicting the sequence of reaction templates rather than the molecular graph itself. This strategy aims to preserve Tier 1 structural constraints while enabling the model to condition on the entire planning history. [Xuan-Vu et al.](https://arxiv.org/abs/2507.21762) introduced TempRe to explore this middle ground, utilizing a transformer to generate reaction templates (::TERM[SMARTS]::) autoregressively from the product rather than emitting reactant::TERM[SMILES]:: directly [@tempre_2025]. This representation expands the effective chemical vocabulary while ensuring that every proposed transformation remains chemically valid by construction. Since each generated token corresponds to a predefined graph edit, the model cannot produce reactions that violate basic chemical rules. Crucially, empirical evaluations demonstrate that constrained generation (filtering outputs against a template library) yields significantly higher route reconstruction fidelity than unconstrained decoding. A complementary strategy models the planning trajectory itself. [Granqvist et al.](https://doi.org/10.1039/D5DD00153F) [@retrosynformer_2026] train a decision transformer using the records of complete planning episodes of multistep retrosynthesis (the current intermediate molecule, the disconnection applied, and the quality of the resulting route) drawn from the PaRoutes dataset [@paroutes]. However, this approach reveals a computational bottleneck: to achieve solvability rates competitive with standard search algorithms, the model requires a large beam width (e.g., 50), resulting in inference throughput significantly lower than efficient::TERM[MCTS]:: implementations. This suggests that without the pruning logic of a search tree, sequence models must implicitly recreate the search process during decoding to ensure valid termination. ### 6.4.2 Full-Route Sequence Prediction Full-route generators push this paradigm to its logical conclusion: the model emits the entire retrosynthetic tree (including intermediates, branching points, and termination leaves) as a single structured sequence. This formulation addresses a key limitation of the step-by-step greedy search: the model plans the entire route at once and thus it can recognize when two separate branches of a synthesis should converge on a shared intermediate, and account for the fact that an early disconnection may only make chemical sense in light of what comes several steps later. These strategic considerations are often overlooked by a planner working one step at a time. Recent implementations frame retrosynthetic planning as a translation task, where the target molecule is mapped directly to a complete synthetic route represented as a structured sequence. [Shee et al.](https://doi.org/10.1021/acs.jcim.4c01982) developed DirectMultiStep [@dms], a family of transformer-based models trained from scratch to generate multistep retrosynthetic routes as a single string, leveraging a mixture-of-experts approach to improve efficiency and accuracy. The architecture employs a classical encoder-decoder transformer setup [@Polosukhin.2017] with additional gated mixture-of-expert blocks [@shazeer_2017], with the encoder processing the input sequence (the target SMILES string and, optionally, the desired route length or starting material) and the decoder predicting the output route. The mixture-of-experts elements significantly improve coverage across the diverse reaction types encountered in multistep planning, routing different chemical subproblems to specialized sub-networks within the model. This design allows DirectMultiStep to predict full routes, including branches and termination leaves, in a single pass, outperforming iterative search methods by capturing long-range dependencies and convergent strategies. The flagship variant, DMS Explorer XL, which requires only the target structure as input, outperformed contemporary search-based methods on the PaRoutes benchmark, achieving 1.9-fold and 3.1-fold improvements in Top-1 route reconstruction accuracy on the $n_1$ and $n_5$ evaluation sets, respectively, and demonstrated generalization to FDA-approved drugs absent from the training data. More recently, [Sun et al.](https://doi.org/10.1021/acscentsci.5c01285) introduced SynLlama [@synllama_2025], a distinct specialized model derived from Meta's Llama-3 large language models Llama-3.1-8B (8 billion parameters) and Llama-3.2-1B (1 billion parameters) through supervised fine-tuning on retrosynthetic data constructed by applying pre-defined templates to the Enamine library [@enamine]. This approach enables the direct generation of linear route descriptions from target molecular structures represented as::TERM[SMILES]:: strings. By leveraging the pre-trained linguistic capabilities of the base models, SynLlama bypasses the recursive tree expansion, instead focusing on deconstructing targets into commercially available precursors. The model achieves high reconstruction rates (up to 74% on unseen Enamine sets) with reduced training data compared to prior generative baselines. A similar approach was proposed by [Wang et al.](https://arxiv.org/abs/2505.07027). Their model, LLM-Syn-Planner [@llmmulti_2025], adapts general-purpose ::TERM[LLM]::s such as GPT-4o or DeepSeek-V3 without additional fine-tuning to produce linear retrosynthetic routes directly from target::TERM[SMILES]:: strings as inputs. The model outputs sequential decision lists, encompassing rationales, products, reactions, and reactants for each step, and terminating when all precursors are purchasable from databases like eMolecules [@emolecules]. Their design employs an evolutionary optimization algorithm that initializes, evaluates, and mutates full routes, drawing on examples from similar historical syntheses retrieved via molecular fingerprints. The result is enhanced performance on benchmarks like USPTO and Pistachio, with solve rates exceeding 90% on simpler sets. This architectural shift towards the full-route sequence prediction results in a characteristic performance profile: while explicit search algorithms (e.g.,::TERM[MCTS]::) excel at finding _any_ topological path to a starting material (high navigability), sequence-based generators typically demonstrate superior fidelity in recovering the specific convergent logic of experimental reference routes (high validity). By optimizing for the joint probability of the entire sequence, these models avoid the locally valid but strategically incoherent decisions often made by step-by-step planners. However, end-to-end generation introduces a structural rigidity. In explicit planners, the chemical logic (expansion model) and search constraints (inventory, forbidden reactions) are modular; one can swap stock lists without retraining the policy. In direct sequence generators, these boundary conditions are implicitly baked into the model weights during training, requiring fine-tuning or complex constrained decoding to adapt to new inventories. ## 6.5 Comparative Overview of Multistep Planning Method Families To summarize the qualitative comparisons developed in this section, [Table 6](#tab-method-families) organizes the major families of methods side by side. It highlights representative systems, their dominant training signals, the extent to which explicit search is required, and their characteristic strengths and limitations. The final columns relate each family to the Solv-$N$ hierarchy introduced in [Section 5.2.1](#sec-validity-hierarchy), indicating the level at which current practice most naturally supports robust evaluation, and list common failure modes that motivate the transition from navigability-focused benchmarks to validity-oriented assessment. # 7 From Navigability to Validity: A Critical Analysis of Benchmarking From 2018 to 2023, the primary challenge in computational retrosynthesis was demonstrating that algorithms could navigate the combinatorial explosion of the search tree ([Figure 1](#fig-combinatorial-explosion)). This period, which we characterize as the _Era of Navigability_, focused on finding _any_ topological path connecting a target to a starting material. By the primary metric of this era,stock-termination rate (STR), modern planners have largely solved the navigation problem, routinely achieving success rates exceeding 99% on standard benchmarks. Further improvements (e.g. from 99.5% to 99.8%) are statistically marginal and often reflect hyperparameter tuning rather than algorithmic progress. This necessitates a transition into the _Era of Validity_, where the objective is no longer to find a path, but to verify its chemical correctness. [Figure 8](#fig-validity-sieve) illustrates the conceptual distinction between topological connectivity and experimental feasibility. While a planner optimizing for Solv-1 identifies a dense graph of potential connections, experimental constraints such as selectivity and purification requirements impose a filter that likely prunes this graph. Currently, standard evaluation metrics do not quantify this reduction; they treat all topologically valid routes as equal. Consequently, the field currently lacks the instrumentation to distinguish chemically sound proposals from those that are merely graph-theoretically connected. ![](/static/images/review/synthesis-planning-eras.svg) :::caption{#fig-validity-sieve}[**Figure 8. The Phase Transition from Navigability to Validity.**] **(A) The Era of Navigability:** When evaluated strictly on topological stock-termination (Solv-1, [Section 8.1](#sec-solvability-hierarchy)), planners routinely achieve $∼$99% success, perceiving a dense, highly connected graph of plausible routes (blue). **(B) The Validity Sieve:** Transitioning to experimental reality requires filtering proposed routes through higher-order chemical constraints. The inset illustrates a characteristic Tier 2 (Chemoselectivity) failure hidden within Solv-1 graphs: a planner proposes a Bromo-Suzuki coupling, ignoring that the more reactive iodide will undergo preferential oxidative addition. **(C) The Era of Validity:** Upon applying Selectivity (Solv-2) and Executability (Solv-3) constraints, the vast majority of topologically valid routes are rendered chemically non-viable (red). The true experimentally actionable search space (green) is drastically sparser than legacy metrics suggest, underscoring the necessity of the rigorous benchmarking framework proposed in [Section 5.2.1](#sec-validity-hierarchy). ::: :::note{#tab-stock-inflation} **Table 7. Stock Inflation Across Retrosynthesis Benchmarks.** The full interactive version is available in the [Evaluation](/syntax-of-matter/evaluation#stock-inflation) section, where you can sort by inventory tier and compare Solv-1 rates side by side. Core point: inventory scope is at least as important as algorithmic choice — planners benchmarked against virtual libraries (∼231M compounds) report Solv-1 rates far above those using physical buyables (∼85k–330k compounds). ::: ## 7.1 Inventory Size as a Difficulty Dial Because the ::TERM[STR]:: measures only whether a route ends, it is strictly dependent on the definition of the available inventory. The size of the stock set functions as a difficulty dial: expanding the inventory increases the density of termination points, statistically shortening the required search depth and increasing the probability of success. Consequently, ::TERM[STR]:: values are not portable across studies unless the inventory is fixed. In practice, evaluations often treat two distinct inventory types as interchangeable. As defined in [Section 5.3](#sec-stock-set), the **physical tier** ($\sim 10^5$--$10^6$ compounds) forces the planner to deconstruct targets into simple commodity chemicals. The **virtual tier** ($\sim 10^7$--$10^9$ compounds), essentially a list of make-on-demand targets, relaxes the problem by allowing termination at complex intermediates. This effectively transforms the computational task from deep route planning to intermediate retrieval. Empirical comparisons confirm that varying the inventory alters apparent performance more than the choice of search algorithm ([Table 7](#tab-stock-inflation)). For example, [Guo et al.](https://api.semanticscholar.org/CorpusID:269771006) showed that for a fixed planner, expanding the inventory from a physical subset to a large virtual set increased ::TERM[STR]:: from 73.5% to 87.3%[@resynz_2024]. Similarly, recent state-of-the-art results, such as the 100.0% ::TERM[STR]:: for MEEA\* [@meea_2024] and 99.5% for PDVN [@liu_2023], rely on virtual catalogs exceeding 230 million entries. When the inventory is restricted to physically deliverable buyables, success rates drop sharply; standard ::TERM[MCTS]:: planning achieves only 18.7% on high-difficulty targets under strict stock constraints [@synplanner_2025]. High success rates against virtual libraries therefore reflect the breadth of the inventory rather than the depth of the planning logic. Furthermore, even nominally identical stock sources do not guarantee stable experimental conditions. Studies citing eMolecules or ZINC inventories often differ in whether they employ full catalogs, screening subsets, or merged composites [@retrograph_2022; @llmmulti_2025; @enhmcts_2025; @models_matter_2024]. For instance, Retro\* evaluations utilized an eMolecules inventory of ${\sim}231$ million entries [@retrostar_2020], whereas subsequent work reported substantially smaller sets (${\sim}23$ million) or hybrid lists (${\sim}35$ million for ZINC+eMolecules) [@llmmulti_2025; @enhmcts_2025]. This variance confirms that ::TERM[STR]:: values are not portable across the literature unless the stock definition is rigorously standardized. :::note{#tab-validity-complexity} **Evaluation Tables A & B.** Both interactive tables are in the [Evaluation](/syntax-of-matter/evaluation) section — [Stock Inflation](/syntax-of-matter/evaluation#stock-inflation) lets you compare inventory tier, stock source, and Solv-1 rates directly; [Validity Gap & Complexity Cliff](/syntax-of-matter/evaluation#validity-complexity) shows the route-reconstruction breakdown by depth. Takeaway: the same planner can look dramatically better when the stock set expands from physical buyables to massive virtual catalogs — and near-perfect Solv-1 does not imply chemically faithful routes. ::: ## 7.2 The Saturation and Fragmentation of Test Sets The second major confounder in current benchmarking is target selection. The field's reliance on a small number of historical test sets, particularly USPTO-190 (Retro\*-190), has led to a saturated evaluation environment. This benchmark was constructed by explicitly filtering for targets whose synthetic steps were ranked highly by a baseline model, a process designed to isolate and test graph search algorithms in 2020 [@retrostar_2020]. While instrumental in the navigability era, this pre-conditioning means the set is not representative of novel or challenging chemical space. As a result, modern planners now routinely achieve between 93% and 100% [@retrograph_2022; @meea_2024; @liu_2023; @egmcts_2023; @selfimproved_2021; @han_2022; @llmmulti_2025; @treemdp_2025; @song_2025; @dreamretroer_2025; @desp_2024; @retrofallback_2024; @choe_2025; @higherlev_2025; @resynz_2024], rendering the benchmark non-discriminative for state-of-the-art systems. Outside this saturated standard, the evaluation landscape is highly fragmented. Studies frequently employ bespoke test sets, including custom subsets from ChEMBL or Reaxys, hazard-filtered targets, or case studies selected for specific chemical features [@autosynroute_2020; @chemirise_2021; @evoretro_2023; @larc_2025; @green_mcts_2020; @diverse_dfpn_2025; @retrek_2022; @nested_mcts_2024; @multistepttl_2023]. While useful for specific investigations, this practice prevents the accumulation of shared knowledge about model strengths and weaknesses, and makes it difficult to perform meaningful cross-paper comparisons. To resolve these issues, evaluation must move from reporting aggregate success to performing category-specific analysis on representative benchmarks. The _PaRoutes_ dataset established a standard for this by binning targets by difficulty ($n_1$ vs. $n_5$) [@paroutes]. An even more granular analysis using reference route length (as a proxy for planning difficulty) has revealed a _complexity cliff_:::TERM[STR]:: remains high for short routes with 2-4 steps but collapses on the longer syntheses with more than 6 steps [@retrocast_2025]. Ultimately, verifying true generalization requires that this category-specific analysis be paired with rigorous hold-out sets defined by scaffolds, reaction classes, or temporal splits, thereby disentangling chemical reasoning from the memorization of training patterns. [@rxn_ood_2025; @syntheseus_2025; @tempre_2025]. ## 7.3 The Divergence Between Topological Success and Chemical Validity Beyond issues of target selection, the stock-termination rate metric is insensitive to the distinction between topological connectivity and chemical plausibility. A high ::TERM[STR]:: certifies that a planner can find _a_ path, but provides no information about whether that path corresponds to a viable experimental procedure. This divergence is apparent in benchmarks that report both ::TERM[STR]:: and Top-$K$ route reconstruction. For example, on the PaRoutes $n_5$ set, planners with near-identical ::TERM[STR]:: show measurable differences in route reconstruction accuracy [@paroutes]. In the [Torren-Peraire et al.](https://doi.org/10.1039/D3DD00252G) audit, one planner achieved 99.7% ::TERM[STR]:: yet recovered only 11.9% of ground-truth routes ([Table 8](#tab-validity-complexity), Panel A) [@models_matter_2024]. Performance also degrades with route complexity; as shown in [Table 8](#tab-validity-complexity) (Panel B), the reconstruction accuracy of explicit search planners often collapses as route length increases. The issue is particularly acute on the USPTO-190 benchmark, where despite near-universal ::TERM[STR]::, audits find that Top-10 route reconstruction is in the low single digits [@retrocast_2025]. A common explanation for this disparity is that planners may find valid routes that differ from the historical reference, which strict Top-$K$ matching penalizes. While this is possible, the validity of such algorithmically generated alternatives is difficult to verify without experimental follow-up, and recent analyses of the underlying single-step models provide reason for skepticism. An audit by [Tran et al.](https://doi.org/10.26434/chemrxiv.15000071/v1), for instance, reveals a systemic bias in these models toward proposing simpler transformations than those recorded experimentally [@tran_2026]. This bias manifests as frequent errors in stereochemistry, leaving group assignment, and an underestimation of reaction complexity, suggesting that \"novel\" routes may often be chemically naïve artifacts rather than viable alternatives. Audits of \"solved\" multistep routes confirm this ambiguity, revealing proposals such as single steps with seven distinct reactants [@retrocast_2025]. Consequently, until the field develops automated Tier 2/3 metrics, route reconstruction, however conservative, remains a primary proxy for grounding evaluation in experimental reality [@tran_2026]. Addressing the limitations of relying on a single reference route, [Guo et al.](https://doi.org/10.26434/chemrxiv-2024-tp7rh/v3) proposed a learned scoring function that predicts a route's similarity to a hypothetical expert-designed path, even for novel targets [@routeeval_2026]. By fine-tuning this predictor on human ratings, they developed a metric that correlates with chemical intuition better than binary solvability. However, the model architecture treats the reactions in a route as an unordered collection, a design choice that limits its ability to evaluate syntheses where the precise sequence of transformations is critical, such as those involving protecting groups. ## 7.4 Evaluator Dependence and Metric Fragmentation Finally, evaluation is compromised when the metric is dependent on the model being evaluated. A prominent example is round-trip accuracy, in which a forward reaction predictor is used to validate the retrosynthetic disconnections proposed by the planner. While useful for filtering syntactic errors, these checks do not provide an independent measure of validity. When the forward model shares the same training distribution and architectural biases as the planner, a successful round-trip primarily confirms internal consistency rather than objective chemical correctness. This challenge is further compounded by metric fragmentation, in which new methods are routinely introduced together with custom evaluation criteria. Metrics such as novel diversity scores or composite \"feasibility scores\" [@choe_2025] can effectively highlight the strengths of a particular architecture, yet they hinder direct comparisons across the literature. Composite metrics, in particular, obscure the underlying causes of performance gains by combining multiple distinct factors, such as termination rate and the confidence of a learned classifier, into a single scalar value. Progress in the Era of Validity requires that method development be decoupled from the definition of evaluation metrics. Rigorous evaluation is most informative when conducted within independent community-standardized frameworks that fix the evaluator, the stock set, and the target distribution (e.g., Syntheseus [@syntheseus_2025], RetroCast [@retrocast_2025]). Only by standardizing the measurement protocols can the field reliably attribute performance gains to algorithmic advances rather than to choices in metric design. # 8 A Framework for Validity-Centric Evaluation As retrosynthesis planners have matured, the limitations of evaluating them with a single aggregate success rate have become apparent. The saturation of stock-termination metrics on standard benchmarks ([Section 7](#sec-evals)) necessitates a move toward more granular and chemically meaningful evaluation protocols. To facilitate this transition and enable more rigorous comparison of model capabilities, we propose a framework for validity-centric evaluation. This framework is designed to differentiate between topological connectivity and experimental plausibility, assess the quality of ranked route suggestions, and encourage standardized and reproducible benchmarking practices. ## 8.1 The Solvability Hierarchy (Solv-_N_) The cornerstone of this framework is a tiered classification of solvability designed to resolve the ambiguity of current metrics. We propose expanding the term \"solvability\" (currently used to refer to the stock-termination rate) into a formal series, Solv-$N$ ([Table 9](#tab-solv-protocol)), where each level corresponds to a progressively stricter set of chemical validity constraints, as previously outlined in [Section 5.2.1](#sec-validity-hierarchy) and [Table 4](#tab-validity-hierarchy). - **Solv-0 (Syntactic Solvability):** The route consists of syntactically valid molecular graphs. - **Solv-1 (Topological Solvability):** The route connects the target to the stock set via topologically valid transformations. This is equivalent to the current stock-termination rate (STR) metric. - **Solv-2 (Selectivity Solvability):** The route's transformations are chemically plausible, satisfying selectivity constraints. - **Solv-3 (Executability Solvability):** The route is experimentally viable under realistic laboratory conditions. | Tier | Core Question | Minimum Required Inputs | Validator Type | Benchmark Output | Typical Failure Modes | Label-Noise Sources | Human Adjudic. | | ------ | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------------- | | **S0** | Syntactic validity | Canonical molecular representation (e.g., SMILES, SELFIES, graph); reaction format; atom mapping if relevant | Deterministic parser, sanitizer, valence checker, grammar validator | Validity rate; parsable fraction; invalid-string frequency | Invalid strings or graphs, valence errors, malformed reaction records, atom-mapping corruption | Toolkit disagreement, canonicalization differences, parser behavior, representation-conversion artifacts | No | | **S1** | Stock-terminated topological route | Target; one-step model or reaction network; search policy; stock definition; stopping rule; evaluator protocol | Route-connectivity checker, stock-membership checker, search/evaluator audit | Stock-termination rate; topological solvability; route depth/length; success under fixed budget | Circular routes, evaluator-dependent success, termination in inflated inventories, shortcut artifacts | Inventory leakage, virtual-stock inflation, stock normalization differences, target overlap with stock or training data | Usually no | | **S2** | Chemically plausible / selective route | Ordered route; stereochemistry; reaction context; optional reagents/roles; precedent or forward-model scores | Rule-based filter, forward model, stereo/selectivity checker, precedent matching, expert panel | Step plausibility; route pass/fail; all-steps-plausible fraction; selectivity-aware success | Chemoselectivity or regioselectivity errors, stereo loss/inversion, incompatible functional groups, missing protecting-group logic | Missing stereochemistry, incomplete metadata, noisy atom mapping, uneven precedent coverage, model miscalibration | Often yes | | **S3** | Executable route under realistic constraints | Route order; reagents/conditions; stoichiometry if available; protecting-group strategy; purification assumptions; scale/cost/time constraints | Condition model, workflow/rule engine, availability/cost checker, process filter, lab record or expert review | Executable-route rate; constrained success; expected cost/time/yield; fraction passing all constraints | Condition incompatibility, unavailable reagents, cumulative yield collapse, purification bottlenecks, unsafe or unscalable steps | Underspecified conditions, missing yield/scale data, supplier drift, undocumented purification burden, lab-to-lab variability | Frequently yes | :::caption{#tab-solv-protocol}[Table 9. Operational Benchmark Scaffold for the Hierarchy of Chemical Validity (Solv-$N$).] Each tier corresponds to a stronger notion of success, moving from syntactic well-formedness (Solv-0) and stock-terminated topological planning (Solv-1) to chemically plausible, selective routes (Solv-2) and experimentally executable routes under realistic constraints (Solv-3). The table is intended as a minimal operational scaffold rather than a finalized community standard. As the hierarchy ascends, evaluation requires richer metadata, more heterogeneous validators, and increasing expert involvement. ::: This tiered system allows for more precise reporting. For example, a planner achieving near-perfect stock termination without verified chemical correctness would be accurately described as having a high Solv-1 rate. This notation clarifies that higher-order chemical constraints remain unverified, preventing the conflation of graph connectivity with experimental feasibility. Achieving Solv-2 is particularly challenging, as it requires satisfying all sub-criteria—chemoselectivity (C), regioselectivity (R), diastereoselectivity (D), enantioselectivity (E), and stoichiometry (S)—simultaneously for every step. A proposed route is only fully validated at this level if it meets the Solv-2C, -2R, -2D, -2E, and -2S constraints concurrently. Given the difficulty of building automated verifiers for all these aspects, we suggest that as an interim measure of progress, individual sub-tier success rates (e.g., a Solv-2C rate) can serve as valuable diagnostics for specific model capabilities. The development of open-source community-standardized Solv-2 verifiers, such as the recently proposed ChemCensor [@zagribelnyy_2026], would therefore be a critical step toward enabling large-scale validity-centric benchmarking. ## 8.2 Toward operational Solv-2/3 benchmarks The higher tiers of the Solv-$N$ hierarchy extend evaluation beyond graph connectivity and therefore require judgments about chemical plausibility and experimental feasibility. At present, these tiers lack universally accepted benchmark protocols. We do not claim that Solv-2 and Solv-3 are presently available as universally standardized labels; rather, we propose a minimal operational scaffold that could make validity-centric benchmarking progressively more reproducible across datasets and model classes. [@paroutes; @bos2024orderly; @tu2023predictive] #### 8.2.1 Minimal metadata requirements. Evaluating Solv-2 plausibility requires more information than a bare reaction graph. At minimum, benchmarks should provide an ordered sequence of steps, explicit stereochemical annotations, atom mappings or equivalent atom correspondence information, and, where available, reagent or reaction-context fields. Additional metadata such as reaction-class labels, precedent links, or forward-model confidence scores can support automated plausibility checks, but should not be treated as mandatory if absent from the underlying corpus. [@bos2024orderly; @schwaller2019molecular] Solv-3 evaluation requires richer metadata still, including reaction conditions (e.g., solvent, catalyst, temperature when known), starting-material availability, and coarse workflow constraints such as protecting-group strategy, purification assumptions, and route-level resource constraints. [@gao2018using; @tu2023predictive] #### 8.2.2 Stepwise versus routewise evaluation. Solv-2 is most naturally evaluated at the _step level_, since selectivity, stereochemical fidelity, and functional-group compatibility are local properties of individual transformations. In practice, however, the benchmarked quantity should still be reported at the _route level_: a route passes Solv-2 only if all constituent steps satisfy a defined plausibility criterion. This mirrors the logic of route-benchmark frameworks such as PaRoutes, where route quality is ultimately assessed over complete multistep plans rather than isolated disconnections. [@paroutes] Stepwise validation is therefore the mechanism; routewise success is the reporting unit. #### 8.2.3 Treatment of stereochemistry. Stereochemistry should be treated as an explicit constraint rather than an optional annotation. A step should count as stereochemically valid only if the proposed transformation preserves, removes, or induces stereochemical information in a manner consistent with known precedent, mechanistic expectation, or a calibrated forward predictor. [@schwaller2019molecular; @chen2024mechuspto] If stereochemistry is missing or underspecified in the benchmark record, this should be recorded as ambiguity rather than silently defaulted to a pass, since incomplete stereochemical metadata is a known source of reaction-data noise. [@bos2024orderly] #### 8.2.4 Stoichiometry and reagent roles. Where available, stoichiometric roles (reactant, reagent, catalyst, solvent) should be retained and checked for consistency with the proposed transformation. In many public reaction corpora these fields are incomplete or noisy, so stoichiometry may need to be treated as a soft constraint at Solv-2 rather than a hard requirement. [@bos2024orderly] For Solv-3, however, missing or implausible reagent-role assignments should count against executability, because condition selection and workflow feasibility depend directly on them. [@gao2018using; @tu2023predictive] #### 8.2.5 Protecting-group logic. Protecting-group strategy is a common source of hidden complexity in multistep routes. At Solv-2, missing or incompatible protecting-group logic can be counted as a plausibility failure when functional-group conflicts are evident locally. At Solv-3, protecting-group handling must be assessed in the context of the entire route, including the feasibility and cost of installation and removal steps, compatibility with neighboring transformations, and the downstream purification burden they impose. [@tu2023predictive; @coley2019robotic] #### 8.2.6 Stepwise versus route-level executability. Solv-3 is inherently a _route-level_ property. Individual steps can be screened for condition compatibility, reagent availability, or likely failure modes, but true executability depends on cumulative effects such as yield attrition, purification bottlenecks, scheduling constraints, and cross-step incompatibilities. [@paroutes; @coley2019robotic] Stepwise filters are therefore useful as preliminary screens, but final Solv-3 assessment should be defined over the full route. #### 8.2.7 Reconciling validator disagreement. In practice, rule-based filters, predictive models, and expert judgment will sometimes disagree. Rather than forcing a single authority, benchmarks should record validator outputs separately and treat disagreement as structured uncertainty. One pragmatic protocol is to use a consensus or weighted-consensus rule for binary pass/fail reporting while preserving the underlying validator scores for downstream analysis. Expert adjudication can then be reserved for disputed or high-impact cases. This is especially important because reaction-data preparation, atom mapping, and condition annotation are themselves nontrivial sources of label noise .[@bos2024orderly; @chen2024autotemplate] A validity-centric benchmark should therefore report not only aggregate success but also the provenance and uncertainty of the labels used to define that success. ## 8.3 Ranking Beyond Termination: MRR-V Binary solvability metrics are insufficient for planners that generate multiple candidate routes. A system that outputs 99 chemically invalid routes and one valid route achieves 100% solvability, but is practically inferior to a system that consistently ranks the valid route first. To capture this, we propose the _Mean Reciprocal Rank of Validity (MRR-V$_i$)_, defined as the mean reciprocal rank of the first route that satisfies Tier-$i$ validity. $$\text{MRR-V}_i = \frac{1}{|Q|} \sum_{q \in Q} \frac{1}{\text{rank}_i(q)}$$ Here, $Q$ is the set of test targets, and $\text{rank}_i(q)$ is the rank of the first route proposed for target $q$ that passes the Tier-$i$ validity check. Adopting MRR-V$_2$, for example, would incentivize the development of models that not only find a selectivity-valid route but also rank it highly, directly aligning algorithmic optimization with practical laboratory utility. ## 8.4 A Call for Independent and Standardized Benchmarking The history of machine learning in other domains suggests that rigorous progress requires separating method development from benchmarking. In the navigability era, it was common for papers to introduce a new search algorithm and a new custom benchmark simultaneously. This practice of coupled method-and-metric development introduces structural confounding, where apparent algorithmic gains cannot be isolated from relaxed boundary conditions or favorable test set selection. To ensure that progress is transparent and reproducible, the field must move toward evaluation by independent, standardized protocols. A significant practical barrier to this goal is the difficulty of conducting fair, head-to-head comparisons. A truly rigorous comparison of two algorithms requires retraining both on identical datasets, using the same reaction templates and stock definitions. However, the lack of publicly available training scripts and the high computational cost of retraining often make such comparisons infeasible. As a result, the literature contains few direct, controlled studies of planner performance, impeding the community's ability to discern which algorithmic innovations are most impactful. To address this challenge, we advocate for the dual-track evaluation model formalized by [Morgunov and Batista](https://arxiv.org/abs/2512.07079) [@retrocast_2025], which distinguishes between two complementary evaluation goals: 1. **The Developer Track:** This protocol is designed for the rigorous assessment of algorithmic novelty. It requires that method creators demonstrate the advantages of a new approach through fair, retrained comparisons against established baselines under fixed boundary conditions. 2. **The Chemist Track:** This protocol addresses the needs of practical application by facilitating the evaluation of pre-trained, off-the-shelf models as-is, without the requirement of retraining. A practicing chemist is often less concerned with theoretical algorithmic superiority and more with which available tool provides the most reliable routes for a given target. By distinguishing between the assessment of algorithmic novelty and practical utility, this dual-track framework allows for both rigorous validation and pragmatic, application-focused assessment. Adopting such a standard would create a clearer path for both foundational research and the development of tools that serve the daily needs of the chemistry community. ## 8.5 Enabling Progress Through Shared Data and Outputs A primary obstacle to automating higher-tier validity checking (Solv-2 and Solv-3) is the scarcity of large-scale, annotated datasets of chemically plausible but invalid routes. The patent literature provides an abundance of positive examples but offers no explicit supervision on why alternative synthetic paths fail. To bootstrap the development of the next generation of automated validity models, we propose that the community adopt a standard of open route reporting. If future retrosynthesis studies were to publish their full, raw generated route trees in a standardized, machine-readable format (e.g., JSON), it would create an invaluable community resource. This shared data would enable researchers to crowdsource the auditing process, progressively building the ground-truth datasets of both successful and failed proposals required to train robust automated Solv-2 verifiers. The existence of a public infrastructure for sharing such outputs, like SynthArena [@retrocast_2025], demonstrates that this practice is technically feasible and would significantly accelerate the field's transition into the Era of Validity. # 9 Beyond Topology: Toward Generation of Reliable Synthetic Procedures This review has focused on topological planning: the construction of a stock-terminated sequence of graph edits (Tier 1, Solv-1). However, laboratory success is governed by _executability_ (Solv-3), which requires that each step $A \to B$ admits a workable experimental procedure: choice of reagents and catalysts, solvents, temperature and time profile, and a purification strategy that yields material suitable for subsequent steps. This layer is difficult to learn from patent-derived datasets, where conditions are often unreported, inconsistent, or implicit. Recent efforts to bridge this gap have gone beyond simple condition regression toward agentic frameworks, a shift documented in recent comprehensive surveys [@white_2024; @chen_2024; @alampara2026generalpurpose-760] and general capability evaluations [@pimentel_2023; @chemllm_2024; @wang_arxiv_2024]. These frameworks range from retrieval-augmented generators of standard operating procedures grounded in equipment manuals and safety documents for compliant laboratory workflows [@lardhi_2026] to robotic agents that translate natural-language instructions into executable hardware controls for autonomous experimentation [@garg_2023; @genheden_2026; @gomes_2023]. Specialized ::TERM[LLM]:: models such as ChemCrow [@chemcrow_2024], ChemActor [@chemactor_2025], ReactXT [@chua_2024], and ReactGPT [@lan_2025] translate between reaction ::TERM[SMILES]:: representations and natural-language descriptions of experimental protocols, using pretraining and in-context fine-tuning of base LLMs to improve yield prediction and condition optimization. Reported outcomes include 67% yields in novel Suzuki-Miyaura couplings via human-AI collaboration (Chemma [@xu_2025]), 94.5% yields in optimizations and scale-ups (LLM-RDF [@mo_2024]), product confirmation in autonomous runs [@gomes_2023], and 97% execution success in robotic tasks (CLAIRify [@garg_2023]). Other training strategies that use reinforcement learning from verifiable rewards, such as the scientific reasoning model QFANG [@qfang_2025], further push the boundary by producing chemically consistent step-by-step synthetic workflows that sometimes even improve verified literature protocols [@qfang_2025]. Collectively, these efforts show a shift from static text prediction toward tool-augmented and agentic ::TERM[LLM]:: architectures that bridge high-level reaction plans and executable synthetic procedures. Overall, demonstrated advantages include substantial acceleration of synthesis planning and documentation and clear evidence that fine-tuned and tool-augmented can outperform prior methods on tasks like procedure prediction and condition recommendation. However, despite these capabilities, generalist models frequently suffer from two distinct failure modes: regression to the global mode (predicting average conditions for specific chemistry) and semantic hallucination (generating fluent but chemically incoherent procedures). ## 9.1 Overcoming Regression to the Mode: The Specialist Approach To address the limitations of global averaging, [Li et al.](https://doi.org/10.1038/s41586-026-10131-4) introduced multiple optimized specialists for AI-assisted chemical prediction (MOSAIC) [@mosaic_2026]: a framework that abandons the single-model paradigm in favor of an ensemble of local experts (see Fig. 1 in [@mosaic_2026]). The central object of MOSAIC is the _reaction universe_: a learned metric space of reaction-specific fingerprints (RSFP). It is generated by a kernel metric network (KMN) from concatenated Morgan fingerprints of the reactants and products of chemical reactions in the training set, together with natural-language descriptions of the reaction procedures, conditions, and yields. Training ensures that similar reactions are represented by neighboring points in the metric space of the reaction universe. The reaction classes are then defined by partitioning the entire reaction space into $\sim$2,500 distinct Voronoi cells using the FAISS clustering algorithm [@douze_2025]. Clustering is purely metric-driven and does not enforce any traditional reaction type labels, allowing the system to learn and exploit similarities among chemical transformations directly from ::TERM[RSFP]:: space rather than inheriting the reaction classifications adopted in the literature. Therefore, each Voronoi cell is a cluster of transformations with empirically similar fingerprints, often spanning multiple closely related named reactions and reflecting similarity in conditions, reagents, and synthetic procedures. These cells are interpreted as _domains of chemical knowledge_ and serve as training sets for fine-tuning $\sim$2,500 low-rank adaptation (LoRA [@lora_2021]) models (dubbed \"chemical experts\" [@mosaic_2026]) that capture region-specific statistics and precise reagent and condition profiles associated with the chemical subclass rather than regressing to a global average. ::TERM[MOSAIC]:: operates by routing queries to the most relevant expert model based on chemical similarity identified by the nearest Voronoi cell. The expert prediction yields a reproducible and human-readable experimental protocol that includes full details such as reagents, order of addition, reaction conditions, purification steps, and yield of the procedure. Furthermore, the distances from a query to the centroid of the nearest Voronoi cell or nearest training databease example within the cell provide explicit confidence metrics, allowing the system to distinguish confident interpolations from out-of-distribution predictions. These metrics can also serve as scoring functions for assessing novelty and feasibility of queried reactions: small distances indicate high confidence in protocol executability, as the query lies near the heart of a well characterized domain or close to a well characterized and validated reaction, while larger distances signal potential extrapolation into underrepresented or unexplored chemical territories. Potential applications of these metrics include prioritizing synthesis candidates in drug discovery or integrating with tree search algorithms in retrosynthetic computational pipelines. In wet-lab validation on 37 de novo compounds spanning pharmaceuticals and agrochemicals, MOSAIC achieved a 71% success rate across 52 attempted transformations. Notably, the system successfully proposed executable protocols for challenging Buchwald-Hartwig aminations and olefin metathesis reactions that were structurally distinct from the training examples, suggesting that the learned metric space effectively clusters chemically related transformations. However, this performance relies on training and maintaining thousands of independent disjoint models, trading simplicity for the precision of extreme specialization. ## 9.2 Grounding Procedural Generation Procedure generation demands more than predicting catalysts and solvents; it requires orchestrating a chemically coherent sequence of operations (addition, quench, workup, isolation) consistent with the intended transformation. Unconstrained language models frequently produce procedures that are stylistically plausible yet chemically invalid because the generated text is decoupled from the underlying structural change. [Liu et al.](https://arxiv.org/abs/2512.13668) [@qfang_2025] demonstrate that even advanced models like GPT-5 can misinterpret reaction intent---for example, misidentifying a benzylic oxidation as a benzoylation---resulting in fluent protocols that synthesize the wrong molecule. Similarly, models often suggest catalytic hydrogenation for intermediates containing reducible motifs that must be preserved (e.g., hydrogenolysis of C-N bonds). QFANG [@qfang_2025] addresses these failure modes by explicitly grounding procedural generation in the atom-mapped graph edit, ensuring that generated experimental protocols remain chemically consistent with the underlying molecular transformations. The approach is based on the chemistry-guided reasoning (CGR) framework, a two-stage process designed to produce high-quality reasoning datasets at scale. In the first stage, a \"factual scaffold\" is extracted from the atom-mapped reaction ::TERM[SMILES]::, capturing the essential functional group changes, bond formations, and disconnections that define the core topological logic of the reaction. This scaffold acts as a set of graph transformation constraints, enforcing rules such as atom conservation, valence adherence, and stereochemical fidelity to prevent hallucinatory deviations. In the second stage, an ::TERM[LLM]:: expands this set of constraints into a detailed procedural narrative, incorporating contextual elements such as reagent quantities and reaction conditions while remaining tethered to the ground-truth graph edits. By conditioning the text generation on these explicit graph-based constraints, the model aligns the procedural steps with the verifiable topology, demonstrating superior generalization to out-of-domain reactions and adaptability to user-specified parameters such as scale and temperature. This architecture confirms that for generative chemistry, textual fluency is a liability unless strictly constrained by the syntax of the graph transformation, while unconstrained models often produce plausible but chemically invalid outputs. ## 9.3 The Non-Markovian Nature of Purity Finally, a persistent blind spot in both synthesis planning and procedure generation is the assumption of modularity. Current systems typically treat purification as a solved abstraction, assuming that each individual reaction step yields sufficiently pure material to serve as the input for the subsequent step without interference. In practice, however, organic synthesis is inherently non-Markovian: the outcome of a given step depends not only on its immediate precursors but also on the accumulated history of the route. Impurities, residual catalysts, and inseparable byproducts can propagate through multiple steps, leading to cascading failures. For instance, a copper-catalyzed cross-coupling reaction achieving a 90% isolated yield may appear successful in isolation, but it becomes functionally untenable if trace copper carryover poisons a downstream palladium-catalyzed cycle or interferes with a biological assay of the final product. Effects of such propagation underscore the need for models that explicitly account for intermolecular interactions and contaminant persistence across the entire synthetic sequence. Leading platforms like ASKCOS [@askcos_2025] have begun to address this challenge by integrating explicit impurity prediction modules, which filter topologically valid but chemically undesirable steps during retrosynthetic analysis. These modules leverage data-driven approaches, such as template-free forward prediction models trained on large reaction databases, to anticipate impurities arising from five primary modes: minor products, side reactions, dimerizations, solvent adducts, and reactions involving subsets of reactants. By simulating these side processes, ASKCOS can identify and discard proposals that would introduce problematic contaminants, thereby enhancing the practical feasibility of suggested routes. However, these impurity checks predominantly operate as local constraints, applied step-wise without fully considering downstream consequences. True Solv-3 planning, which emphasizes executability under realistic laboratory conditions, including yield optimization, purification requirements, safety considerations, and scalability, requires a more holistic approach. This could involve an introduction of the route-level objective function of the synthetic sequence, that penalizes not only individual step inefficiencies but also cumulative factors such as separation complexity and impurity propagation. Formally, this function might incorporate terms for predicted impurity profiles, chromatographic separability scores, and compatibility assessments across steps, shifting the optimization paradigm from mere step-wise yield maximization to route-wise material quality and overall process robustness. # 10 Outlook: Toward a Chemical Foundation Model This review has charted the evolution of synthesis planning through a phase transition. The challenges of the _Era of Navigability_, which focused on finding any valid path through a combinatorial search space, have largely been solved by modern algorithms. The field now enters the _Era of Validity_, a period defined by the pursuit of chemical correctness. The central task of the coming decade will be to build systems that not only connect molecular graphs but do so with the causal logic and experimental reliability of a trained chemist. Achieving robust performance on Solv-2 (Selectivity) and Solv-3 (Executability) metrics will require more than improved evaluation alone; it necessitates concerted efforts in infrastructure design, data generation, and the fundamental architecture of the models themselves. We conclude by outlining these key areas, which together form a path toward bridging the gap between topological search and physical reality. ## 10.1 Infrastructure as a Scientific Instrument The advancement of synthesis planning is an inherently interdisciplinary endeavor, relying on distinct expertise from both organic chemistry and computer science. In the field's formative years, progress was driven by framing retrosynthesis in terms that were most amenable to established computational techniques: specifically, as a search problem on an exceptionally large graph. This formulation was a necessary and productive abstraction, as it allowed for the direct application of powerful search algorithms and spurred rapid innovation in solving the topological connectivity challenge. This early focus, however, also illustrates a crucial principle for the future of computational chemistry. The software we build is not a neutral tool; it is the scientific instrument through which we probe a problem. The design of that instrument profoundly influences the questions we ask and the answers we obtain. An instrument architected to optimize graph traversal will naturally orient the field toward measuring success with graph-based metrics. To ask the deeper chemical questions of selectivity and experimental feasibility, the instrument must be designed with those principles as its foundational logic. This requires a paradigm of co-design that moves beyond consultation to active architectural contribution. The most significant advances in this new era will likely be driven by a new generation of researchers fluent in both reaction mechanisms and performant software design. The success of integrated platforms like ASKCOS [@askcos_2025] provides a compelling demonstration that when this deep collaboration is achieved, the research focus naturally shifts from computational benchmarks to practical, experimental utility. ## 10.2 Physics-Based Supervision and Automated Experimentation A prevailing narrative in chemical AI suggests that progress is fundamentally constrained by the scale of available experimental data, with automated laboratories often presented as the primary solution. While automated experimentation is an invaluable tool for generating ground-truth data, this perspective may underutilize the vast predictive power of established theoretical and computational chemistry. Decades of research have yielded robust physical models that can, in principle, predict the very outcomes -- selectivity, stability, and reactivity -- that are most critical for building valid planners. Historically, however, these powerful theoretical tools have been deployed as artisanal, single-molecule calculations rather than as at-scale data generation engines. The critical bottleneck, therefore, may not be a deficit in scientific theory, but rather a deficit in the engineering required to transform these physical models into high-throughput supervision pipelines. Instead of relying solely on the sparse and biased data from patent literature, the field can generate its own high-fidelity labels. ## 10.3 Search-Augmented Generation The tension between explicit graph search and direct sequence generation is likely a transient phase in the field's development. A recurring observation in computationally intensive sciences is that general-purpose architectures capable of scaling with computation eventually outperform systems that rely on complex, hand-engineered heuristics [@bitter_lesson]. This suggests a powerful, symbiotic path forward for synthesis planning. In this paradigm, explicit search, guided by rigorous physical constraints (e.g., automated Solv-2 filters), acts as the \"teacher.\" It can explore the vast combinatorial space of synthesis to generate large, high-fidelity datasets of valid routes. High-capacity sequence models can then act as the \"student,\" distilling this complex physical and strategic logic into a fast, generalizable policy. This approach amortizes the immense computational expense of search into the inference step, combining the rigor of symbolic methods with the speed and pattern-recognition capabilities of deep learning. ## 10.4 Synthesis Planning as a Pre-training Objective We return to the central thesis of this review: that synthesis planning is the chemical analogue of next-token prediction. Current chemical foundation models, largely trained on static graph masking or::TERM[SMILES]:: reconstruction, often fail to generalize to activity cliffs (Section 2). We hypothesize that this fragility arises because they learn the syntax of representation rather than the syntax of transformation. Retrosynthesis is a uniquely demanding generative objective because it forces the model to internalize the structural grammar of transformation under explicit validity constraints, rather than to correlate static motifs with labels. This is also why synthesis planning is a plausible route to emergence. The same electronic-structure determinants that govern reactivity---functional-group electronics, polarization, steric accessibility, and conformational preferences---also shape many downstream properties by controlling how a molecule interacts with its environment. The implication is not that property prediction disappears, but that it becomes a readout of a representation shaped by planning. If the community adopts the validity-centric framework proposed here---pairing this objective with auditable routes and rigorous Solv-2 metrics---synthesis planning offers a path to grounded chemical representation learning. Under this view, a chemical foundation model---or, more cautiously, a program toward artificial chemical intelligence---becomes a concrete research agenda rather than a branding term: pre-train on planning as the chemical analogue of next-token prediction, and evaluate progress by whether planning competence transfers to new chemistry and new functional questions. ## 10.5 What evidence would challenge this thesis? The hypothesis of this review is that pre-training on the causal logic of synthesis planning will yield more robust and generalizable chemical representations than objectives based on static molecular structures. This thesis would be substantially weakened if empirical results provided any of the following outcomes: - **A failure of learned planned skills to generalize to broader chemical reasoning.** The thesis would be falsified if a model becomes an expert at route-finding, yet its learned representations provide no significant advantage for unrelated chemical tasks, such as reasoning about structure-property relationships and discerning activity cliffs. This would demonstrate that learning the \"syntax of matter\" yields no more general chemical intelligence than the \"syntax of notation\", ultimately failing to surpass the known performance plateaus of static pre-training. Synthesis planning would thus be revealed as a narrow, specialized skill, not a foundational one. - **The data requirements for effective pre-training prove prohibitive.** The thesis is predicated on the existence of a sufficiently large and diverse corpus of valid synthetic routes to learn from. It would be practically falsified if the performance of planning-based models saturates at a low level of competence due to the inherent limitations of available experimental data, and if the physics-based data generation (e.g., high-throughput QM) proves unable to bridge this gap at a reasonable computational cost. - **The analogy to natural language processing proves to be flawed.** The success of large language models may depend critically on post-training alignment techniques like reinforcement learning from human feedback [@alampara2026generalpurpose-760], which are used to refine raw predictive models into useful assistants. This thesis would be significantly weakened if a similar massive-scale feedback loop from expert chemists is the true bottleneck for achieving artificial chemical intelligence, and that such a data-generating process is not scalable. In this scenario, the pre-training objective alone would be insufficient. In summary, reproducible evidence that alternative pretraining objectives or validators consistently outperform synthesis planning centered approaches on synthesis and property-transfer tasks would motivate rethinking the centrality of synthesis planning in chemical foundation modeling. # 11 Conclusions Multistep synthesis planning has advanced rapidly in recent years, but the meaning of reported progress depends strongly on what is being measured. Across much of the recent literature, benchmark success has often reflected improvements in _navigability_: the ability to find a stock-terminated route through a large combinatorial search space. That progress is real and important. At the same time, this review has argued that navigability alone is an incomplete proxy for practical synthetic competence, because topologically valid routes may still fail at the level of selectivity, stereochemical fidelity, protecting-group logic, condition compatibility, or overall executability. To clarify this distinction, we introduced the _Hierarchy of Chemical Validity (Solv-$N$)_, which separates syntactic validity (Solv-0), topological solvability (Solv-1), chemically plausible and selective routing (Solv-2), and executable route construction under realistic constraints (Solv-3). We view this hierarchy not as a finalized standard, but as a minimal scaffold for organizing evaluation and for making explicit which levels of validity a given model, benchmark, or claim actually addresses. In particular, the review has highlighted that many widely reported near-saturation results pertain primarily to Solv-1, and that these results can depend strongly on stock definition, evaluator design, and inventory scope. Within the domain considered here, recent work suggests a shift in emphasis from route finding alone toward stronger notions of route validity. Search-based systems, direct sequence generators, and hybrid or neurosymbolic architectures all contribute differently to this transition, but none yet resolves the full Solv-2/3 problem in a standardized and experimentally grounded way. For this reason, we argue that future benchmarking should place greater weight on chemical plausibility, selectivity, and execution constraints, and should report these dimensions separately rather than collapsing them into a single notion of solvability. A broader interpretive claim of this review is that synthesis planning may be a valuable organizing objective for learning chemistry-aware representations. More specifically, multistep retrosynthesis appears to be a strong candidate objective for tasks that depend on reactivity, synthetic accessibility, and route-level compositional reasoning. We have deliberately framed this as a hypothesis supported by converging evidence, rather than as a settled conclusion. Forward reaction modeling, condition and workflow prediction, multimodal structure--property learning, 3D or physics-informed objectives, and lab-in-the-loop systems each capture aspects of chemical intelligence that retrosynthesis alone does not. The most plausible path forward is therefore not a single universal objective, but a broader foundation-model stack in which retrosynthesis provides one important organizing prior among several complementary learning signals. We emphasize that the conclusions of this review are grounded primarily in multistep small-molecule organic retrosynthesis, especially database-driven planning systems built on patent and reaction-corpus precedent. Whether the same framework transfers unchanged to catalysis, inorganic and organometallic synthesis, polymer and materials chemistry, electrochemistry, or peptide and biocatalytic synthesis remains unresolved. These domains differ substantially in representation, data quality, mechanistic structure, and criteria for experimental success, and will likely require domain-specific extensions of both the Solv-$N$ hierarchy and the modeling conclusions developed here. Taken together, the literature supports a more validity-centric view of progress in contemporary retrosynthesis. If the field can move from topological route finding toward reproducible evaluation of chemical plausibility and executability, then synthesis planning may become not only a benchmark task, but also a useful organizing framework for more general chemical machine learning. The central challenge ahead is therefore not simply to find more routes, but to measure---and ultimately learn---which routes are chemically credible, experimentally actionable, and robust under realistic constraints. --- Title: Hell is an Engineering Patch for the Prisoner's Dilemma Category: long-form :::tldr Hell is described as eternal boiling because to stabilize cooperation in an infinitely repeated game (life), you need a "grim trigger" strategy with a punishment severe enough to outweigh any possible gain from defection, regardless of the player's discount factor. This post re-derives the Supernatural Punishment Hypothesis from basic game theory concepts. ::: The other day I watched a video on political jokes (_anekdot_:sidenote[in Russian, an anecdote is not just a casual story with a point (like in English), it's a structured joke with a punchline, usually political or social satire. Basically a cultural meme.]) in the Soviet Union, and one of the jokes was: > Hitler is boiling in a cauldron of tar in hell, up to his neck. He looks over and sees Beria in a pot nearby, but the tar only comes up to his waist. Hitler shouts: Hey! Why are you only in waist-deep? Beria grins: I'm standing on Stalin's shoulders.:sidenote[so now you can imagine the surprise I had when I read the advice that you should put an anecdote into your college personal statement!] This got me wondering: man, it's interesting that the concept of hell is seemingly overspecified. It's not just something abstractly bad, no, everyone at least once heard the constant boiling part. Why would you need that? It's almost as if you want to make sure the listener understands it's a permanent punishment, it's not just something you can adapt to. But wait a second, that sounds almost like an engineering patch to reality implemented to enable a grim trigger cooperation strategy. ## A brief introduction to game theory ### Single Interaction But before I can unpack, let's introduce game theory: a mathematical framework for studying interactions between rational actors. Rationality is defined as acting in accordance with one's beliefs, i.e. it's a much weaker criterion than what would be implied in the common parlance.:sidenote[but also arguably way more useful. also a reason why criticizing economical models with a "lmao you assume people are rational" is pointless.] The simplest and most famous example of the game (an interaction) that can be modeled with game theory is Prisoner's dilemma. Imagine two people, A and B, are held in separate solitary confinement cells in prison (for the same crime) with no ability to communicate. There's not enough evidence to convict them on an actual charge, so if both stay silent, they'll get convicted on a lesser charge and will have to serve, say, a year. However, each is approached separately by a prosecutor and offered to testify against the other. If A testifies against B (and B stays silent), it can walk free immediately and B will serve 6 years. If both testify, each will serve 5 years. Each outcome can be succinctly recorded as: | | A testifies | A silent | | ----------- | ----------- | -------- | | B testifies | (-5, -5) | (-6, 0) | | B silent | (0, -6) | (-1, -1) | where ($\pi_A, \pi_B$) records the utility:sidenote[units of goodness, whole idea of econ is: every agent has function which defines *what* and in which *quantities* makes agent happy, and agent's actions are directed towards optimization of that function. That function is called utility function.] of players A and B. It's clear that the collectively best outcome for A and B is for both to stay silent. However, if A knows that B will stay silent, A can increase its utility ($0>-1$) by deviating and testifying. But because B can model the thinking process of A and recognize A has an incentive to deviate (and thus will deviate), B is strictly better off deviating as well ($-5>-6$). Therefore, in the end, both testify. Both testifying is a stable equilibrium because neither party can get better off by deviating from that strategy: if B testifies, A is strictly better off testifying than staying silent. Game theory is basically a framework that helps you determine when an outcome is stable:sidenote[called Nash equilibrium] for more complicated game setups. The fundamental behavior of the Prisoner's dilemma will not be changed if we add some constant to all outcomes, so let's perform a small rebranding and replace _testifying_ and _staying silent_ with more abstract notions of _defection_ and _cooperation_. | | A defects | A cooperates | | ------------ | --------- | ------------ | | B defects | (1, 1) | (0, 6) | | B cooperates | (6, 0) | (5, 5) | Hopefully it's now much easier to empathize with A or B and recognize that $(5,5)$ is the desired outcome that is unattainable because it's not a stable equilibrium. In a single game, cooperation is impossible because every party has an incentive to cheat. ### Finitely Repeated Games What if we play the defect/cooperate game thousands of times? You might think it should change the calculus, after all, it should be better to cooperate if that could unlock other player cooperating and everyone getting 5s instead of 1. Unfortunately, you can strictly prove that an optimal strategy in a finitely repeated game is derived by backwards induction. Let's say the game ends at time $T$. Because there'll be no more games to play, the only stable outcome is the same as in a single game interaction: both parties defecting and getting $(1, 1)$. At game $T-1$ the total payoff/utility table (for this game and the game in the future) looks like: | | A defects | A cooperates | | ------------ | ---------- | ------------ | | B defects | (1+1, 1+1) | (0+1, 6+1) | | B cooperates | (6+1, 0+1) | (5+1, 5+1) | basically every outcome gets extra 1 because nothing you'll do in this round will affect the optimal strategy in the next round. So in $T-1$, both A and B are strictly better off defecting. And you can see how this thinking process gets repeated until $T=0$, the very first interaction, in which cooperation is not possible because every agent has an incentive to deviate. ### Infinitely Repeated Games The situation only gets different if you extend the horizon to infinity, in which case a **grim trigger** strategy becomes a stable equilibrium: both parties agree to cooperate until either party defects, after which the other party will always punish the defector by defecting. First, let's calculate the total payoff if both parties cooperate. Each party gets 5 today, tomorrow, after $t$ rounds, etc. The sum would diverge (explode), unless we introduce a discount factor $\delta<1$ (5 tomorrow is only worth $5\delta$ in today's units:sidenote[this is most easily understood in terms of money: a dollar tomorrow is worth less than today (because you can put dollar today into treasuries and get >1 dollar tomorrow. but discount factor could also model impatience or assumed probability of the game ending)]) $$ PV = 5 + 5\delta + 5\delta^2 + 5\delta^3 + \ldots = \frac{5}{1-\delta} $$ Similarly, if both parties defect, their payoff will be $1/(1-\delta)$. As a result, the decision matrix looks like this: | | A defects | A cooperates | | ------------ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------- | | B defects | $\left(1 + \frac{\delta}{1-\delta}, 1 + \frac{\delta}{1-\delta} \right)$ | $\left(0 + \frac{\delta}{1-\delta}, 6 + \frac{\delta}{1-\delta} \right)$ | | B cooperates | $\left(6 + \frac{\delta}{1-\delta}, 0 + \frac{\delta}{1-\delta} \right)$ | $\left(5 + \frac{5\delta}{1-\delta}, 5 + \frac{5\delta}{1-\delta} \right)$ | where the first term is the payoff for the current game and the second term is expected value of all future games in today's value.:sidenote[(which is why there's an extra $\delta$] The strategy in future games is predetermined by the outcome of game 1 by construction (if either party defects, everyone will keep defecting). Player A will have an incentive to defect if and only if: $$ 6 + \frac{\delta}{1-\delta} \geq 5 + \frac{5\delta}{1-\delta} \implies 1 \geq \frac{4\delta}{1-\delta} \implies \delta \leq 0.2 $$ in other words, only if he's so impatient as to discount all future earnings by 80%. Otherwise, cooperation is strictly preferable. Intuitively, you basically have to threaten the other party with eternal punishment if you want to remove an incentive to cheat and unlock what is arguably a better off outcome for everyone. :::note one might think: if we want the result to be strictly (mathematically) correct, shouldn't we consider what happens if say I cooperate for a few rounds and then defect, or in some other complicated attempt to get potentially more than 5 by defecting. Turns out no, because of [one-shot deviation principle](https://en.wikipedia.org/wiki/One-shot_deviation_principle). ::: ## Back to Hell Knowing the game theory analysis of repeated interactions, the description of hell becomes remarkably similar to what you'd want to envision to ensure all parties consider themselves to be part of an infinitely repeated game, and thus enable cooperation as a stable equilibrium. Surprisingly, the analogy doesn't stop there. One-shot deviation principle only works in the assumption of perfect information: the other player knows if you defect. How do you ensure that in real life? Well, you add omniscience to the punisher. One might notice that the conclusion of the infinitely repeated game depends on the actual values of how much you gain by unilaterally defecting (in the example above, you can gain 1) and how much are you punished (effectively $-4$). If the gain were stronger, defection would be optimal even for very patient actors. How do you solve the issue? You maximize the punishment, as much as possible, ideally you slap `-float('inf')`, which is ... well, permanent boiling. Game theory has a very annoying result called [the Folk theorem](),:sidenote[called that way because many researchers intuitively felt it to be true long before it was proven mathematically] which is basically a monkey wrench into any attempt to model what's going to happen. Formally, if one defines $\mu_i$ as the [minmax](https://en.wikipedia.org/wiki/Minimax#Game_theory) payoff, i.e. the minimal possible value you can attain if you always anticipate the other party doing everything possible to hurt you, the following is true: :::definition **The Folk Theorem:** let $v$ be some payoff vector within the boundaries $V$ of what's possible, such that payoff of every player $v_i$ is at least $\mu_i$, then there exists $\bar{\delta}\in (0,1)$, such that for every $\delta > \bar{\delta}$ there exists a subgame perfect Nash equilibrium such that the average value of each player $i$ is $v_i$. ::: In other words, you can construct a strategy in which one party defects 90% of the time, but promises to cooperate 10% of the time, and for the other side it'll be mathematically superior to suck up (and get 1.1) over having pride and defecting constantly (and get 1). So if you were to ask a game theorist: "make a prediction, what's going to happen?" he can use Folk theorem to say "idk, man", "anything goes", could be total cooperation, could be constant defection, could be you giving me your money 99% of the time. So if there are infinite mathematically stable equilibria, how could humans possibly coordinate on a single strategy? It'd probably require a single rulebook, almost like a ... scripture. ## The Supernatural Punishment Hypothesis In the discussion above, we basically rederived the supernatural punishment hypothesis from first principles. First articulated by [Johnson and Kruger in 2004](https://www.tandfonline.com/doi/10.1558/poth.2004.5.2.159): > during our history, the fear of supernatural punishment (whether real or not) deterred defectors and may therefore represent an adaptive trait favoured by natural selection. Supernatural beliefs are universal among human societies, commonly connected to taboos for public goods, so it seems plausible that they serve an important function in fostering cooperation. Shariff and Norenzayan later showed that the belief in punishing gods made participants of the study less likely to cheat on a math exam ([Mean Gods Make Good People: Different Views of God Predict Cheating Behavior](https://www.tandfonline.com/doi/full/10.1080/10508619.2011.556990#d1e192)). The sample size is low (N=61), but the only question you should ask yourself with social science is: does it make sense? Does it make sense that a fear of supernatural punishment is a prerequisite for building of large high trust cooperative societies? It's kinda obvious once you refer to the game theory math above. There is also a 2015 study [Broad supernatural punishment but not moralizing high gods precede the evolution of political complexity in Austronesia](https://pmc.ncbi.nlm.nih.gov/articles/PMC4375858/) which indicates that it doesn't have to be a fully formed monotheistic religion, though again, the math doesn't care where the `-float('inf')` comes from. --- Title: A Comprehensive Guide to Python Dependency Management with uv Category: tutorials :::tldr This is a zero-to-hero guide on managing Python dependencies using uv. Whether you are a PhD student stuck in Conda hell or a developer looking to modernize your workflow, this post covers everything from creating virtual environments to handling conflicting dependencies and publishing reproducible code. ::: In one of my recent long-forms, I claimed that [software quality dictates scientific possibility](/writings/long-form/will-ai-transform-science#software-quality-dictates-scientific-possibility) and went on to argue that a good computational scientist must be a good software engineer. It sounds great if you're a college freshman, but what if you're already midway through your PhD and you can't really ask your PI to allow you to spend a semester taking CS courses? The good news is that a significant chunk of problems typically associated with academic code stem from a few bad practices, one of them is lack of proper dependency management. This tutorial will be a comprehensive one-stop ultimate guide to managing dependencies in your projects, and it's written to be accessible to any level of expertise. ## What are we trying to achieve? If you want your software to be used by other people, it should: 1. be easy to install and run by any user on any platform 2. (and ideally) be easy to integrate as a dependency into other projects The first one is trivially easy to achieve if you use a good package manager like `uv` and follow best practices, to which most of this tutorial will be dedicated. The second one is a bit more tricky since it's primarily downstream of engineering decisions, and we'll cover it at the end. The tutorial is intentionally written to be accessible to any level of coding experience, so it begins with the basics (e.g. why do we need virtual environments). If you already are a user of built-in `venv` or `conda`, you can skip ahead to the final overview of commands. ## Why do we need to be conscious about dependencies? Python is a programming language with a remarkably low barrier to entry, not in the least because you can get quite far without ever worrying about dependencies. I've been using python for at least 3 years automating certain tasks:sidenote[like [writing a script](https://github.com/anmorgunov/arbitration) to create a queue of olympiad participants for arbitration such that every student can talk to every unique problem author and such that no member of the jury would sit without students] without ever using a virtual environment: I was simply `pip install`ing things like `numpy`, `openpyxl`, `plotly` without ever worrying where that installation happened. I can imagine many computational scientists, for whom python is a tool (not a sacred craft with a rigid set of puritan rules), might share this experience, and so wonder: what could possibly go wrong? Why is it not enough if something works on my machine? Let's say you wrote some code in 2023 using RDKit (a popular cheminformatics library) and you even specified that you used version 2023.9.5. RDKit requires numpy, and at the time, latest version of numpy was 1.24, which is what you had installed on your computer. When someone in 2026, who already has numpy installed (and since latest is 2.4, he'll have that), tries to install RDKit 2023.9.5 (according to your specifications), he's going to get screamed at with errors like: ```py A module that was compiled using NumPy 1.x cannot be run in NumPy 2.4.1 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "", line 1, in File "/Users/morgunov/.cache/uv/archive-v0/pVEn_MEolmd-ckXXQs20Z/lib/python3.11/site-packages/rdkit/Chem/__init__.py", line 15, in from rdkit import DataStructs, RDConfig, rdBase File "/Users/morgunov/.cache/uv/archive-v0/pVEn_MEolmd-ckXXQs20Z/lib/python3.11/site-packages/rdkit/DataStructs/__init__.py", line 13, in from rdkit.DataStructs import cDataStructs AttributeError: _ARRAY_API not found ``` :::note It's remarkably easy to demonstrate the problem above with `uv` because you can do things like: ```bash uv run --python 3.11 --with "rdkit==2023.9.5" \ --with "numpy>=2.0" python -c "import rdkit.Chem" ``` which would trigger the error above. And changing spec to `numpy<2` fixes the issue. ```bash uv run --python 3.11 --with "rdkit==2023.9.5" \ --with "numpy<2.0" python -c "import rdkit.Chem" ``` ::: You might think this problem is easy to solve, just let your user know that they need numpy version 1.23.4 or lower, but for any real-world project, you'd have up to 10 more such specifications,:sidenote[also, what if a user needs to use a different project which needs latest numpy?] and you'd basically rederive best practices for dependency management from first principles. ## Level 1. What is a virtual environment and how can we define it? The real problem above is that the default behavior of python when you install a package is to install it globally. E.g., when you run ```bash pip install numpy ``` it installs it in the global site-packages directory. The good thing is that you can then use numpy in any python script, and this, arguably, is part of the reason why python has such a low barrier to entry. On the other hand, it also makes it almost impossible to reliably specify requirements for any single project (even if you currently have numpy v2 installed it doesn't mean that the project you worked on 2 years ago can be executed with it). A virtual environment is basically a compartmentalized directory with a fresh (raw) python interpreter that you can (and should) create separately for each project. As you build the project, you install required dependencies into that directory, and so it becomes a minimal set of dependencies required to run your code.:sidenote[you might intuitively think that you can enable perfect reproducibility by just sharing that virtual environment directory, and directionally that would be correct, but we'll see a more space-efficient approaches to achieve that in a bit] To create a virtual environment (hereafter referred to as a venv), you can simply type `uv venv` in the terminal, which will create a new directory called `.venv`.:sidenote[because it starts with a dot, it's hidden by default, but you can always see it by typing `ls -a` in the terminal] If you want to create a venv with a specific python version, you can specify it like: ```bash uv venv --python 3.10 ``` :::note to install `uv` on any platform, you can simply execute this one-liner in the terminal: ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` fast and easy! You can find this command on the [official install page](https://docs.astral.sh/uv/getting-started/installation/). ::: If you ever used pyenv or conda before, you might be familiar with the concept of having to activate the virtual environment before using it. If you want, you can still do that by running ```bash source .venv/bin/activate ``` after which you can enter python repl `python` or run any file: ```bash python my-awesome-script.py ``` With `uv`, however, you can simply replace `python` with `uv run`, and forget about having to activate the virtual environment. In other words, `uv run my-awesome-script.py` is equivalent to running ```bash source .venv/bin/activate python my-awesome-script.py ``` small quality of life UX improvements like this might seem minor, but they add up and that's what makes uv such a game changer for python devs. ## Starting a new project Whenever you start a new python project, you should run `uv init`, which creates 3 files ```bash my-project/ ├── main.py ├── README.md ├── pyproject.toml ``` `pyproject.toml` is a modern universal configuration file:sidenote[introduced in [PEP 621](https://peps.python.org/pep-0621/)] for python projects. Initially, it'll look like: ```toml [project] name = "my-project" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [] ``` Notice that by default, `uv init` sets the project as requiring the latest version of python.:sidenote[which in general, is a very good practice] You can also specify desired python version, and you probably can already guess how: ```bash uv init --python 3.11 ``` ### Adding dependencies Let's say you want to use RDKit in your project. You can just _add_ it: ```bash uv add rdkit ``` Which will print something like: ```bash uv add rdkit Using CPython 3.13.3 Creating virtual environment at: .venv # if you didn't create a venv manually, it'll create one for you Resolved 4 packages in 142ms Installed 3 packages in 24ms + numpy==2.4.1 + pillow==12.1.0 + rdkit==2025.9.3 ``` This results in two changes. First, `pyproject.toml` is updated: ```toml dependencies = [ "rdkit>=2025.9.3", ] ``` Second, a new file `uv.lock` is created: ```toml version = 1 revision = 3 requires-python = ">=3.11" [[package]] name = "numpy" version = "2.4.1" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/24/62/ae72ff66c0f1fd959925b4c11f8c2dea61f47f6acaea75a08512cdfe3fed/numpy-2.4.1.tar.gz", hash = "sha256:a1ceafc5042451a858231588a104093474c6a5c57dcc724841f5c888d237d690", size = 20721320, upload-time = "2026-01-10T06:44:59.619Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/a5/34/2b1bc18424f3ad9af577f6ce23600319968a70575bd7db31ce66731bbef9/numpy-2.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:0cce2a669e3c8ba02ee563c7835f92c153cf02edff1ae05e1823f1dde21b16a5", size = 16944563, upload-time = "2026-01-10T06:42:14.615Z" }, ..., ] [[package]] name = "pillow" version = "12.1.0" source = { registry = "https://pypi.org/simple" } sdist = { url = "https://files.pythonhosted.org/packages/d0/02/d52c733a2452ef1ffcc123b68e6606d07276b0e358db70eabad7e40042b7/pillow-12.1.0.tar.gz", hash = "sha256:5c5ae0a06e9ea030ab786b0251b32c7e4ce10e58d983c0d5c56029455180b5b9", size = 46977283, upload-time = "2026-01-02T09:13:29.892Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/43/c4/bf8328039de6cc22182c3ef007a2abfbbdab153661c0a9aa78af8d706391/pillow-12.1.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:a83e0850cb8f5ac975291ebfc4170ba481f41a28065277f7f735c202cd8e0af3", size = 5304057, upload-time = "2026-01-02T09:10:46.627Z" }, ... ] [[package]] name = "rdkit" version = "2025.9.3" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "numpy" }, { name = "pillow" }, ] wheels = [ { url = "https://files.pythonhosted.org/packages/b1/19/4a606ef1c090b0abc54627a4aa5313c8bbef50da888841101bf1aa89ff70/rdkit-2025.9.3-cp311-cp311-macosx_10_15_x86_64.whl", hash = "sha256:520e572f70ac81a75091f953d4d9805bc1455879ad85724591c2b4b03bf1faf1", size = 31862854, upload-time = "2025-12-03T13:33:11.974Z" }, ... ] [[package]] name = "temp" version = "0.1.0" source = { virtual = "." } dependencies = [ { name = "rdkit" }, ] [package.metadata] requires-dist = [{ name = "rdkit", specifier = ">=2025.9.3" }] ``` ### What is a lockfile? Notice how we only asked to install RDKit, but uv also notified us that it installed numpy and pillow because they are dependencies of RDKit. A lockfile is like a log book, which keeps track of all the libraries that were installed into your virtual environment, both directly and indirectly. Each entry specifies not only the name and version of the library, but also URLs for **all** (for all possible platforms) existing wheels for that library. In other words, a lockfile is a set of instructions for exact recreation of a virtual environment on any other platform. A lockfile might seem novel to python developers, but it has been an industry standard for over a decade.:sidenote[though, funny enough, some ecosystems, like JS/TS had to survive introduction of a completely new package manager (yarn) just to force the de-facto default package manager npm to adopt lockfiles.] Let's walk through a simple example demonstrating the necessity of a lockfile. A good way to think about the dependencies block in `pyproject.toml`:sidenote[which removes the need for requirements.txt, if you ever used one] is that it is a record of developer's intent. For example, since we typed `uv add rdkit`, we effectively asked "just give me latest RDKit", so pyproject reflects that any RDKit later than the current version will do. ```toml dependencies = [ "rdkit>=2025.9.3", ] ``` If you share this `pyproject.toml` specification publicly, and someone tries to install it 3 years from now, the package manager will find the latest version of RDKit (because it satisfies the constraint ">=2025.9.3"). Which might lead to issues if RDKit changes the behavior of the functions your code relies on. A common workaround has been pinning the exact version, like: ```toml dependencies = [ "rdkit==2025.9.3", ] ``` This solves the immediate problem, but it makes your package practically impossible to integrate into any other project which uses similar dependencies (but different versions of them). This is where the lockfile comes in. Your `pyproject.toml` defines the list of dependencies as requested by the library author when it was developed. Usually, this is just "give me the latest version of the package." And in most cases, if something worked with, say, RDKit 2025.9.3, it will likely work with, say 2027.1.1, so someone who develops a project with a requirement of RDKit 2027.1.1 can still install your package as a dependency. However, in case something breaks, and you don't have time (or the need) to debug which dependency is causing an issue, you can recreate the exact environment used to develop the library by installing the packages following the specification of the lockfile (which, as we've seen, will define not only the versions of the top-level requirements, but also of all 2nd-order dependencies). Installing packages following the specification of the `uv.lock` is a simple sync command: `uv sync`. :::note Notably, when you try to run some code `uv run my-awesome-script.py`, which is in a directory containing a `uv.lock` file, `uv` will automatically install the packages following the specification of the lockfile. ::: ### What happens to pip install? The proper way to add dependencies when you use uv is by running `uv add `, which is a shortcut for running `uv pip install ` and updating the `pyproject.toml` file to reflect a new dependency. In other words, if you try to pip install things, it doesn't update the `pyproject.toml` file, and you'll have to update it manually. Also, `uv sync` is a proper replacement for `uv pip install -e .`. The latter will install packages using `pyproject.toml` specification, so if someone runs it a year from now, it'll install newer versions than you had used during development. `uv sync` installs packages using `uv.lock` specification. ## And... that's it? Pretty much! If every academic project will be published with a lockfile (like `uv.lock`), we'll solve the reproducibility:sidenote[which here means the ability to run the code on a different machine and get the same result as code author, it's only part of the bigger problem of reproducibility of scientific results] problem once and for all. So, to recap, here's what you should do whenever you start working on a new python project. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh # Install uv uv init # create new project ``` Whenever you need to add a new package, simply type `uv add `. Whenever you need to execute a script, type `uv run `. Here's the best part. Let's say you publish your code on github: ```bash my-project/ ├── my-awesome-script.py ├── README.md ├── pyproject.toml └── uv.lock ``` Normally, you'd have to instruct your users to follow a particular ritual: ```bash git clone https://github.com/username/my-project.git cd my-project # create a virtual environment python -m venv venv # activate the virtual environment source venv/bin/activate # install dependencies pip install -r requirements.txt # run code python my-awesome-script.py ``` With `uv`, it's just a single line: ```bash git clone https://github.com/username/my-project.git cd my-project uv run my-awesome-script.py ``` The beautiful part is that `uv run` will always work as intended, regardless of whether this is your 100th time running the script on your personal machine or someone else running it for the first time, in which case it'll install a python of the version specified in pyproject.toml, create a venv, install all dependencies from the lockfile, and then run the script. ## Level 2. Dependency Groups Above we discussed the basics: creating projects, adding dependencies, and running code. It's enough to get you started, and if the above was new material for you, you probably should stop reading and come back after you get used to the new workflows. Let's say at some point you decide to start using linters and formatters for your code, e.g. [Ruff](https://docs.astral.sh/ruff/) (created by the same team that made `uv`). To do so, you'll simply run `uv add ruff`, which will work. But, when you publish your project to PyPi, do you really need to require your users who simply need to run your code to have Ruff installed?:sidenote[and you should never think this is an insignificant consideration since Ruff "only" takes 22 MB of space, because how you do anything is how you do everything] No, and for any similar package that is only needed during development, you can utilize a dev dependency group by adding a flag `--dev`: ```bash uv add ruff --dev ``` In pyproject.toml, you'll now see two lists: ```toml [project] dependencies = [ "rdkit>=2025.9.3", ] [dependency-groups] dev = [ "ruff>=0.14.14", ] ``` ### Optional Dependencies A related, but slightly different scenario. Say you build some package that does some analysis (like [RetroCast](https://github.com/ischemist/project-procrustes)), e.g. it can calculate and print average stock termination rate for some predicted routes. And say you also code an ability to create plots comparing the metric for different route lengths. To make a plot, you'd need some library like matplotlib or [plotly](https://plotly.com/python/).:sidenote[I really, really recommend you try plotly. You can create interactive html plots where you can zoom-in, toggle visibility of different lines, etc. It's an absolute game changer] But what if 90% of your users will never use that module? Do you need to require them to install plotly? No, so you can define an optional dependency group, say related to visualizations: ```bash uv add plotly --optional viz ``` Now your pyproject.toml has a third dependency list: ```toml [project] dependencies = [ "rdkit>=2025.9.3", ] [project.optional-dependencies] viz = [ "plotly>=6.5.2", ] [dependency-groups] dev = [ "ruff>=0.14.14", ] ``` When someone tries to run regular code, say `uv run my-awesome-script.py` which doesn't use plotly, they'll be able to do so without having to install it. And if you want someone to run code which does need plotly, you can simply instruct uv to use an extra (optional) dependency: ```bash uv run --extra viz create-some-plots.py ``` :::note Having both optional dependencies and dependency groups is a bit confusing, and in the beginning you can think of dependency groups and "dev" dependencies as being synonymous because for the most part, that's the only dep group you'll define. If you end up working on large codebases, eventually you might find yourself defining a separate dependency groups for testing or web servers. The overarching principle is always the desire to avoid installing things you're not going to be using. ::: ## Level 3. Specifying Sources Let's say you want to incorporate a package that hasn't been published to PyPi and only exists as a github repository. For example, while I was working on [SynthArena](/writings/research/project-procrustes), I wanted to benchmark the original [Retro\* implementation](https://github.com/binghong-ml/retro_star). A defeatist option would be to git clone that repo, run that model in a separate repository, and then move the results. Instead, I [forked the repo](https://github.com/anmorgunov/retro_star), created pyproject.toml file, added all dependencies with `uv add`. Now I can install that package like this: ```bash uv add "retro-star @ git+https://github.com/anmorgunov/retro_star" --optional retrostar ``` and voila! ```toml [project.optional-dependencies] rs = [ "retro-star", ] [tool.uv.sources] retro-star = { git = "https://github.com/anmorgunov/retro_star" } ``` ## Level 4. Conflicting Dependencies Let's say you want to define two optional dependency groups which have direct conflicts with each other? For example, you want to incorporate two different models, one strictly requiring `numpy<2`, and the other strictly requiring `numpy>=2`? Though this might seem impossible, you can actually declare them as [conflicting dependencies](https://docs.astral.sh/uv/concepts/resolution/#conflicting-dependencies), and although you'll never be able to use them together, like: ```bash uv run --extra group1 --extra group2 some-script.py ``` you'll be perfectly capable of using them separately in the same project! ```bash uv run --extra group1 run-model1.py # OR uv run --extra group2 run-model2.py ``` I actually described how I used this feature to [benchmark 5 different multistep planners](/writings/note/escaping-dependency-hell-with-uv) and why I eventually had to switch to a different `uv run --directory` approach. ## The ultimate best practice Like I said, even if you just follow level 1 practices, you'll make it seamless for anyone to run your code on any platform. But it still won't be enough to make it easy to integrate your package as a dependency for someone else's project. Because ultimately, it doesn't prevent a situation when your package was built with `libraryA` v0.2, which strictly requires `numpy<2`, and someone else is creating a new project that justifiably uses `numpy>2`.:sidenote[declaration as conflicting groups only works if the conflict is between optional groups, not between an optional group and a core dependency] In the limit, the only way to ease the integration of your package into other projects is by following a simple maxim: do not use dependencies. Now, obviously, rewriting all the core functionality of torch if you need to train a model is not a good use of your time, so the rule shouldn't be taken literally, but in general you should err on the side of thinking twice before installing a new library. For example, even though in pretty much every tutorial on data science you'll see a line like: ```py import pandas as pd df = pd.read_csv('path/to/file.csv') ``` you don't really need to install pandas just to read a csv. Unless you work with gigantic datasets where having core iteration loops implemented in C is crucial for speed, there's no reason not to use the built-in `csv` module: ```py import csv with open('path/to/file.csv', 'r') as f: data = list(csv.DictReader(f)) ``` or, if you want a one-liner: ```py from pathlib import Path import csv data = list(csv.DictReader(Path('path/to/file.csv').open())) ``` Similarly, you really shouldn't install `numpy` if you only intend to use `np.mean()` and (or) `np.std()`. You'll be surprised how much you can achieve with built-in functionality, and with LLMs, implementing directly the feature you need is easier than ever. Deciding whether adding a new dependency is worth it is one of my major [use cases of Gemini models in AI Studio](writings/long-form/how-vibe-coding-killed-cursor#the-context-is-king-and-ai-studio-is-the-only-serious-product-for-human-in-the-loop-swe): you can dump a significant chunk of your codebase, so that an LLM has enough context to decide whether the simplicity of using an existing package is worth the complexity of adding a new dependency. ## Why should I migrate? If you're already using some solution for dependency management, here's why you should consider migrating to uv. The simple answer is: uv is fast. Blazingly fast. This might seem like an insufficient reason, and it's probably why a lot of people express hesitation when this is brought as an argument: after all, how often do you install your dependencies? But this is precisely the problem. Before uv, I had multiple occasions when I suggested upgrading to some newer version of torch (because it had some nice new feature) or python altogether (e.g. moving from 3.10 to 3.11, which had **significantly** improved [error tracebacks](https://docs.python.org/3/whatsnew/3.11.html#whatsnew311-pep657) per [PEP 657](https://peps.python.org/pep-0657/)), and my collaborators hesitated because they had a working conda environment, and they didn't want to end up wasting half a day on fixing it if things go wrong (a very justifiable prior). uv is so fast that I can spin up a fresh Lambda instance (so CUDA is installed), and start training a state-of-the-art model in literally a minute. Once again we see that [software quality dictates scientific possibility](writings/long-form/will-ai-transform-science#software-quality-dictates-scientific-possibility). I mean, even simple python installation which used to be whole process, is now just a single cli arg: ```bash uv run --python 3.11 python -c "print('Hello, World!')" # or uv venv --python 3.11 uv run --python 3.13 python -c "print('Hello, World!')" # or uv venv --python 3.13 ``` also, with uv you can bring debugging onto a whole new level. One of my colleagues has been working on a codebase that relied on HuggingFace's transformers library, but unfortunately it didn't specify the version used during development, and the version available at the moment was running into a RuntimeError. With uv, you could do something like: ```bash uv run --with transformers==4.44.2 --with torch --with accelerate bfloat-gen.py # runs fine uv run --with transformers==4.45.0 --with torch --with accelerate bfloat-gen.py # RuntimeError uv run --with transformers==4.56.2 --with torch --with accelerate bfloat-gen.py # RuntimeError ``` To confirm that the issue has been introduced with the release of 4.45.0. Take a look [at this issue](https://github.com/huggingface/transformers/issues/41238) if you're curious how the story ended. ### How uv is better than conda? Every time you create a new conda environment, it creates a hard copy of the python and every dependency you install. So, if you have 2 different projects, both using python 3.11 and torch 2.8, conda will install identical copies of python and torch twice. That's roughly extra 1 GB of disk space. uv, on the other hand, uses aggressive caching: packages are installed once, and every time you want to reuse them, uv will create a symlink. ### How uv is better than built-in venv? Sure you can create a venv with built-in python module like: ```bash python -m venv myvenv ``` But, you'd need python installed in the first place, and if you need some specific version, the closest to having a seamless experience would be installing [pyenv](https://github.com/pyenv/pyenv), and so you can think of uv as a replacement for pyenv and venv. But also, why would I even need to define the name of my virtual environment, and typing `python -m venv venv` feels wrong, so you start being creative, `python -m venv yovenv`, and then you have to remember what was the name of the venv when you have to type `source yovenv/bin/activate`, and then you have to make sure not to forget to include it in .gitignore. uv is just better UX. ### How uv is better than poetry? Poetry has tried to introduce a lot of best practices, including a lockfile into the python environment. The only problem is that it's written in python, and so resolving complex dependencies can be excruciatingly slow (uv is literally 10x faster). ## Helpful Resources If you want to learn more about uv, check out the [official documentation](https://docs.astral.sh/uv/concepts/). Also, if you want to set up a new python project with all the best practices already pre-configured, there is: - [uv cookiecutter](https://github.com/jevandezande/uv-cookiecutter?tab=readme-ov-file) - which will set up a project, configure pre-commits, GitHub actions, and more. - [batistagroup/python-template](https://github.com/batistagroup/python-template) - a Github template for a python project I've been using personally --- Title: Running 5 conflicting academic codebases in a single repo with uv Category: note :::tldr Benchmarking scientific code is painful because Package A usually requires numpy<1.20 while Package B requires numpy>=1.24. Instead of managing five different Conda environments and manually switching contexts, you can use uv's conflicting dependency groups or independent directory execution to run everything from a single command line interface. ::: Last month, I wrote a long-form elaborating why [science is infrastructure-constrained, not ideas-constrained](/writings/long-form/will-ai-transform-science). In this note, I'll provide one example of how better infra (in this case [uv](https://docs.astral.sh/uv/)) enabled me to [benchmark 5 distinct codebases for chemical synthesis planning](/writings/research/project-procrustes) (almost) without the usually associated headaches of dealing with dependencies. I also have a [comprehensive tutorial on dependency management with uv](/writings/tutorials/comprehensive-guide-to-uv). Let's say you have two planners: AiZynthFinder and SynPlanner. Most likely there's at least one dependency conflict between them, so using both from the same virtual environment is impossible and you'd have to resort to creating two different environments (either with venv or conda, in both cases you would waste gigabytes duplicating shared dependencies), and every time you need to run each of the planners, you'll have to manually switch the environments before executing scripts. With uv you can [declare dependency groups as conflicting](https://docs.astral.sh/uv/concepts/projects/config/#conflicting-dependencies), create a single compartmentalized environment, and you can switch between the groups with a simple cli argument `--extra group-name`: ```bash uv run --extra aizyn scripts/aizynthfinder/3-run-aizyn-mcts.py \ --benchmark mkt-lin-500 ``` or ```bash uv run --extra syntheseus scripts/synplanner/2-run-synp-val.py \ --benchmark mkt-lin-500 ``` This approach worked decently for up to 4 planners, but the empire always strikes back, so eventually I had to migrate to defining a dedicated `pyproject.toml` and `uv.lock` in each planner's directory, but the execution stays as simple as before: ```bash uv run --directory scripts/planning/run-synplanner 2-run-synp-val.py \ --benchmark mkt-lin-500 ``` It's hard to overstate how significant this feature is. Ask anyone who has ever tried to benchmark academic codebases, and you'll immediately learn that this is a PTSD-inducing experience that is usually reserved as a punishment (or a rite of passage) for junior researchers. And in my personal experience there were several occasions when the right scientific thing was rerunning all evals from scratch, but my collaborators were running mental cost-benefit analysis because they had (a correct at the moment) prior that re-running multiple academic codebases will take days. But with uv it's a breeze. So it's not an exaggeration to say that the quality of tools [dictates scientific possibility](/writings/long-form/will-ai-transform-science#software-quality-dictates-scientific-possibility). In fact, I'll go on record with quite a sacrilegious take: the next time a Nobel prize is awarded for a computational breakthrough, Astral team would be an unacknowledged co-recipient. ## When conflicting groups are not enough As a bonus, a few words for those curious about the rationale for the shift from `--extra group-name` to `--directory dir-name`. Using `uv run --extra` is functionally equivalent to running: ```bash source .venv/bin/activate # activate an environment uv sync --extra group-name # install all main dependencies and group-name extras using uv.lock specification python script.py ``` This procedure relies on the existence of a lockfile `uv.lock`, or, to be more precise, on the ability to create it (because uv will create it if it doesn't exist). During construction of the lockfile, uv attempts to perform _universal resolution_; it tries to produce a single lockfile valid for all supported platforms (Linux, macOS, Windows) and architectures (x86, ARM). If your dependencies rely on packages with C-extensions (RDKit, DGL) that don't publish wheels for every single platform, the resolution fails because no single version satisfies the constraints across all targets. So, unless you update `pyproject.toml` to specify that a certain dependency should only be installed on a particular platform, uv will fail to create the lockfile. As a result, you won't be able to run `uv sync --extra group-name`, but you'd be perfectly capable of running ```bash source .venv/bin/activate uv pip install -e ".[group-name]" # install all main dependencies and group-name extras from pyproject.toml spec python script.py ``` and because it wouldn't have to satisfy the constraints of other dependency groups, it'll just install whatever versions are specified by the planner. While it works, you lose all the benefits of having a lockfile (being able to perfectly reproduce the environment). So a different solution would be to create a new uv project within the planner directory (with its own uv.lock file). So if your main/root project is where you run scoring/analysis, you can have a distinct/competing uv.lock file for each planner that you can invoke with `--directory` arg. For example: ```bash main-repo/ ├── analysis.py ├── pyproject.toml # root project (orchestrator) ├── uv.lock ├── src/ │ └── package/ │ ├── __init__.py │ └── ... ├── planner1/ # independent sub-project │ ├── script1.py │ ├── pyproject.toml # defines deps for planner 1 │ └── uv.lock # locked specifically for planner 1 └── planner2/ # independent sub-project ├── script2.py ├── pyproject.toml # defines deps for planner 2 └── uv.lock # locked specifically for planner 2 ``` So if you run `uv run analysis.py` it'll use `uv.lock` from the root, but if you run `uv run --directory planner1 script1.py`, it'll use `uv.lock` from the planner1 directory. This way, you can have a separate environment for each planner, and you can still use the benefits of having a lockfile. --- Title: The 400-year software patch to a 10-day memory leak Category: note If you were born in any of the former Soviet countries, you're probably familiar with the concept of "Old New Year":sidenote["old new" - peak Russianism] celebrated on Jan 13. There's also Christmas celebrated on Jan 7, which by analogy should be called "old Christmas", but no, it's _the_ Christmas. If you ask for an explanation, you'd probably be told it has something to do with Gregorian and Julian calendars, and I never really bothered to figure out what it meant until this past Christmas.:sidenote[which we celebrated properly by buying a live tree, so I thought it was time to figure things out] Turns out it's a fascinating story about a fundamental bug in the leap year calculation in the Julian calendar, which was silent for 800 years, it took another 800 years for the issue ticket to be closed, 200-400 years to be deployed internationally (in the process, Sweden invented Feb 30th), and will have to be revisited in roughly 2700 years.:sidenote[and you thought you shipped slowly] So the story starts with the Roman Empire, in which apparently [priests](https://en.wikipedia.org/wiki/College_of_Pontiffs) could arbitrarily add months to a year to extend the one-year terms of elected officials they liked:sidenote[you can just do things], and the power was abused to an extent that end-of-summer harvest was happening in the spring. Julius Caesar went to Egypt, and learned about the formula "a year is 365 days, but every 4th add one more", which was a result of centuries worth of empirical observations of the rising of the star Sirius. So Caesar decides to adopt this rule, but to fix the debt of random addition of months, he had to make the year 46 BC last 445 days, terming it _Ultimus annus confusionis_ ([the last year of confusion](https://penelope.uchicago.edu/encyclopaedia_romana/calendar/confusionis.html)). The problem, however, is that in this system a year lasts 365.25 days, whereas the true astronomical year's duration is 365.24219 days. The difference is roughly 1 day every 128 years:sidenote[a creeping memory leak]. Who could possibly notice this distinction? Well, in year 325, during [the First Council of Nicaea](https://en.wikipedia.org/wiki/First_Council_of_Nicaea), it was decided that the date of Easter should be tied to some easily verifiable astronomical constant: the vernal equinox,:sidenote[the full formula is first Sunday after the first full moon after the equinox] which in that year happened to be on Mar 21 in the Julian calendar. 400 years later, an English monk [Bede](https://en.wikipedia.org/wiki/Bede) whose job was to calculate the date of Easter notices that the actual equinox happens on Mar 18.:sidenote[opened a jira ticket] 5 centuries later, [Roger Bacon](https://en.wikipedia.org/wiki/Roger_Bacon#Calendrical_reform) revisits the issue, calls Julian calendar "intolerable, horrible, and laughable", and proposes a bugfix: drop one day every 125 years.:sidenote[first PR opened]. It takes another 300 years (when the drift is already 10 days) before [Aloysius Lilius](https://en.wikipedia.org/wiki/Aloysius_Lilius) writes a comprehensive proposal for the reform, proposing deleting Julian leap day on each of its ten occurences over 40 years.:sidenote[gradual rollout] It takes 10 years before Pope Gregory XIII convenes a commission to finally resolve the drift, and invites [Christopher Clavius](https://en.wikipedia.org/wiki/Christopher_Clavius), a leading mathematician of the time. Clavius reads the Lilius's proposal and convinces the Church that it's the best solution. The core suggestion is replacing the leap year calculation logic from: ```py def is_leap_year_julian(year: int) -> bool: return year % 4 == 0 ``` to ```py def is_leap_year_gregorian(year:int) -> bool: """97 leap years per 400 years""" if year % 400 == 0: return True # keep these if year % 100 == 0: return False # remove these (3 per 400 years) return year % 4 == 0 ``` Why? Well, the problem is simple, you overcount the leap years, roughly 3 extra per each 400 years. You need to get rid of 3 leap years every 400 years; the most elegant solution would be to remove memorable years that are equidistant. A 100th year mark is memorable enough, but by default it'd overcorrect, so we enforce every 400th year to be a leap year. Pope Gregory issues a papal bull ["Inter Gravissimas"](https://en.wikipedia.org/wiki/Inter_gravissimas) (among the most serious) on February 24, 1582, and instructs that the day after Oct 4, 1582 will be October 15, 1582 (skip 10 days immediately, an implementation advocated by Clavius). Here's where the fun starts. Protestants refused to accept this patch on principle, so Denmark & Norway accept it only in 1700 (118 years later) and Great Britain and colonies accept it in 1752 (170 years later, by which point they needed to skip 11 days:sidenote[there's a historical meme that there were 11 day riots because people demanded to give them 11 days back; unfortunately it doesn't seem to be historically correct, still funny though]). Sweden decided to implement an original gradual rollout proposal, transitioning over 40 years, skipping all 11 leap days from 1700-1740. In 1700 they successfully skipped the leap day; but in 1704 they forgot (distracted by [Great Northern War](https://en.wikipedia.org/wiki/Great_Northern_War)?), and forgot again in 1708. As a result, they had a calendar 1 day ahead of Julian, 10 days behind Gregorian. In 1712, King Karl XII decides to git revert back to Julian, but because they were 1 day ahead of Julian, and 1712 was already a leap year, they added Feb 30. Yeah, Sweden is the only country in the history of the world to ever have a February 30th, it even has a name: [tillökningsdagen (the add-on day)](https://sv.wikipedia.org/wiki/30_februari). Eventually, they decided to skip 11 days in one go in 1753. Russia, being Orthodox, never accepted the patch. Lenin, unburdened by what has been, decides to align Russia with "the rest of civilized people", so in 1918 Sovnarkom issues a Decree on the Introduction of the Western European Calendar:sidenote[naming chosen to avoid any mentions of religion/pope], instituting a 13-day skip from Jan 31, 1918 to Feb 14, 1918. As an unfortunate but hilarious side effect, the holiest day in the Soviet lore, the day of the Great **October** revolution had to be now celebrated in **November** (Oct 25 Julian is Nov 7 Gregorian). Within a few years, the patch has also been accepted by Turkey and Greece, concluding the 400-year deployment.:sidenote[the Russian Orthodox Church still doesn't recognize it and at this point probably never will] If you want another rabbit hole, here's a fun fact. The true [tropical year](https://en.wikipedia.org/wiki/Tropical_year) in our current measurement is 365.24219 days. Lilius used [Alfonsine tables](https://en.wikipedia.org/wiki/Alfonsine_tables) to derive a value of 365.24255 days (quite close to the patched Gregorian 365.2425 definition), but those tables were derived using Ptolemaic theory. Had he used [Prutenic tables](https://en.wikipedia.org/wiki/Prutenic_Tables), derived from the Copernican theory, he'd have to use the value of 365.24720 days, which is farther from the truth than the result of the ancient Ptolemaic theory. How come? During derivation of Prutenic tables, the [tropical year](https://en.wikipedia.org/wiki/Tropical_year) was confused with [sidereal year](https://en.wikipedia.org/wiki/Sidereal_year), so basically the Gregorian patch is based on the Geocentric theory even though Heliocentrism has already been proposed by that time. You probably should stop reading at this point because another rabbit hole gets dark quickly. I was curious why the Christmas tree is called New Year's tree in Russian. By 1929, Bolsheviks decide to institute a full scale crackdown on religion and effectively ban Christmas without ever doing so explicitly. Under the disguise of industrialization, they suggested replacing 7-day week with a continuous 5-day production week, with a random subset of workers having a rest day every 5 days. This solved two problems at once: there was no more Sunday to attend church, and you could easily designate Jan 7 a working day. By 1935, there was an attempt to course-correct the lack of holidays during cold brutal winters, so a high-ranking communist [Postyshev](https://en.wikipedia.org/wiki/Pavel_Postyshev) writes a letter to Pravda (the Truth), in which he effectively proposes to rebrand Christmas into a secular New Year. He argued that the ban on a "tree" was an incorrect "leftist deviation":sidenote[a direct quote, you can't make this up] by supporters of Trotsky. He framed the tree not as an inherently religious object, but as a source of joy that, in pre-revolutionary times, was enjoyed by the children of the bourgeoisie while the children of the proletariat could only watch in envy. So it'd be unwise to keep denying the children from this source of joy. Postyshev also was a staunch advocate of the [Great Purge](https://en.wikipedia.org/wiki/Great_Purge) and 3 years later he'd confess to being a part of the Trotskyist:sidenote[can't make this up] right-wing:sidenote[yeah, don't worry about the apparent contradiction of political labels] counter-revolution:sidenote[i.e. accused of purging actually good / innocent people] and was shot in 1939. [Пылающей тропой мы идем к коммунизму](https://www.youtube.com/watch?v=387r4a7vRdc). So uh, happy Old New Year, I guess? --- Title: Vibe coding killed Cursor Category: long-form For almost 1.5 years after the release of ChatGPT, the question of which LLM should you use had an obvious answer: there was GPT 4 and there was everyone else. Now, at the end of 2025, there are dozens of LLMs to choose from, and navigating the space if you're not a terminally online user of X is almost impossible. Well, it was until I wrote this post. To demonstrate my street creds, look at my Cursor wrapped: ![](/static/images/long-form/agentic-coding/cursor-2025.png) it shows I joined 666+:sidenote[Cursor didn't expect such veterans to still use their app?] days ago, which is roughly March 4, 2024, the release date of Sonnet 3 by Anthropic. Since then, I've seen things you people wouldn't believe. GPT4 one-shotting creating a matplotlib projection of a protein structure to a 2D space, all in a single chat message. I watched the 03-25 checkpoint of Gemini 2.5 Pro show full reasoning traces. All those moments... Anyway, this post is both an ultimate guide to LLMs in 2026 and a commentary on the general state of AI, how we've got here, and where we're going. My thoughts are grouped by use cases. ## Use Case 1: Writing Code :::tldr My overall take is that vibe coding is a huge distraction; it's actively killing Cursor (which is why I stopped using it). You should remain in charge, and best way to do that is to either not use agentic workflows at all (just talk to Gemini 2.5/3 Pro in [AI Studio](https://aistudio.google.com/prompts/new_chat)) or use [OpenCode](https://opencode.ai/), which is like Claude Code, but it shows you all the code changes in git diff format, and I honestly can't understand how anyone would settle for anything else. In OpenCode, use latest Sonnet model (today it's 4.5) for most tasks, switch to latest Opus (today it's 4.5) for complex tasks. You can get that for just \$20/mo (the Claude Pro plan, which includes usage of Claude Code, and you can use that plan to authorize OpenCode). If you're rich or have a company that's willing to cover the cost, you can switch to \$100/mo or \$200/mo plans, which will let you use Opus more frequently (see your usage [here](https://claude.ai/settings/usage)). ::: ### Vibe coding is killing Cursor Being able to create a fully functioning software, website, or an app just by writing English prompts is borderline sci-fi, which is probably why it captured so much of everyone's attention ever since late 2023. And it'd be foolish to pretend LLMs can't do that already (in fact, I vibe coded a v0 of what became my personal todo + pomodoro app). The problem is that unleashed vibe coding is insanely token-inefficient and expensive. Consider the following interaction. You want to create a landing page for your new project. You write the prompt (P1, 100 tokens) and LLM responds with code (O1, 2k tokens) that you (or your agentic harness) puts into `index.tsx`. Say the page contains 5 sections O1-S{i}, one of which, O1-S4 contains a grid of features, each feature accompanied by an icon. Say you don't like the choice of icons or the phrasing of particular description in that section O1-S4. If you were a reasonable person, you'd open the file, navigate to the desired section, and tweak the wording or change the icon name to something you like more (you can have the LucideIcon website open in a different window). If you're a vibe coding maximalist, however, you'd keep prompting LLM to make such simple changes for you. You'd write another prompt (P2, 100 tokens). The problem is that under the hood, an LLM will not see just those 100 P2 tokens as an input, it'll see the whole chain (P1, O1, P2) of messages (2.2k tokens) and will produce another response (O3), which will either be a drop-in replacement of the whole file (2k tokens) or a patch, and instructions on how/where to apply the patch, so in practice it'll be maybe 100-500 tokens. But say you still dislike the icons, and you keep prompting the LLM. Each time the chain grows, and you keep running LLM inference on longer, and longer message chains just to change an icon. So chances are, you'll have plenty of other similar interactions for every little thing you want to change. If you're on Cursor team, enabling such usage on a \$20/mo plan is unsustainable. So what did they do? Discourage comically and unnecessarily idiotic usage of the product? No, they decided to optimize the token usage. If you need to change the icons in O1-S4, why would you need to feed the code for sections O1-S1, -S2, -S3, and -S5 to the LLM? Wouldn't it be better if we could just feed O1-S4 and cut the usage 5x? One way to achieve that would be to limit the number of lines seen by an LLM in a single read: read first 100 lines, if desired code is not there, read lines 100-200:sidenote[this is definitely what Windsurf and Cursor did, at least at some point (like I said, I stopped using the product)]. Another way, pioneered by Claude Code, is to use [ripgrep](https://github.com/BurntSushi/ripgrep) to search for a given pattern (e.g. function name), which will let you know which lines of code you should add into context. All of this is genuinely remarkable engineering intended to solve the cost problem of using LLMs in the loop, and it probably works fantastic for simple surgical changes like updating icons or restyling `
`. But for any other more complex coding task, in which the code you write for a given function depends not only on the prompt, but on some other parts of code that are semantically relevant, but do not contain direct keywords used by LLM for the rg search, those other parts of code will not be included in the context, an LLM will write some code, you'll be confused "Why didn't you use function X or mirror the function Y?", and it'll say "You're absolutely right", and not because it's some blind idiot, but simply because that part of the codebase wasn't included in the original request. In other words, there are two distinct uses of LLMs in an agentic loop. 1. Simple, independent, surgical changes which any trained programmer would be able to do faster without LLMs, but which constitute a significant portion of vibe coding. 2. Complex, dependent, semantic changes which require understanding of different parts of the codebase. I think the first use case was the most significant contributor to the costs of Cursor, which were succesfully reduced by imposing a tunnel vision on LLMs. Unfortunately, such tunnel vision is directly detrimental to the second use case, so in a sense, by prioritizing the vibe coding use case, Cursor made itself unusable for full-time SWEs. In other words, vibe coding killed Cursor. ### The context is king and AI Studio is the only serious product for human-in-the-loop SWE How do I know I'm right? Because when I switched my workflow to running a bash script to collect all code files (or some, based on some simple naming or location keyword request) into a single md file like: ```xml def some_python(code): pass def some_other_python(code): pass ``` and then putting that whole md file into [Google's AI Studio](https://aistudio.google.com/prompts/new_chat) and chatting with Gemini 2.5 Pro, I've never, ever had any interaction in which I had to ask an LLM why didn't it use the code I already had. And mind you, that is Gemini 2.5 Pro, which, if you read tech twitter, you'd think was the dumbest coding model on the market. Yes, 2.5 Pro was quite bad at tool calling, it might often say "Now, I'm going to update the file" and just not do that.:sidenote[funny enough, that's actually the behavior of 05-06 and 06-05 checkpoints, I don't remember having such issues with 03-25] So it's not the model you should use within an agentic environment à la opencode, but if you're willing to manually copy-paste suggestions from AI Studio or even implement them yourself based on the ideas from the conversation,:sidenote[which I think is the best long-term way to use LLMs for coding, more on that later] Gemini 2.5 Pro has been and still is absolutely incredible. :::note I haven't seen much noticeable improvement from Gemini 3.0 Pro in coding,:sidenote[though it definitely has smaller political bias and so is much more pleasant for general conversations] and it has less generous rate limits, so 2.5 Pro is still my daily driver. Oh, did I tell you that it's completely free in AI Studio? Yes, the catch is that Google can train on your conversations, but as someone living on a grad student stipend, I really couldn't care less, especially if you allow me to have 100-200k token conversations all day. ::: What makes the AI Studio + 2.5 Pro such a powerful bundle? Two things. First, 2.5 Pro happens to work surprisingly well at long context conversations. Remember how I told you I vibe coded a personal Pomodoro+ToDo app? As I was exploring the limits of 2.5 Pro in AI Studio, I decided to dump my whole backend, whole NextJS server actions folder into a single message (it was, I think, roughly 80k tokens) along with my prisma schema, all types and utils, and asked 2.5 Pro if it could analyze the codebase and suggest improvements. After roasting me for writing an insecure mess,:sidenote[well, it really was Sonnet 3.7 who was at fault] it wrote a plan for a full refactor and a ruleset of the best practices for backend of NextJS with server actions and components. And then I started to ask it to follow the plan and send me drop-in replacements for the new backend. At various points, my context contained full schema, old types folder, old actions folder, new types folder, new `lib/services` folder, new `lib/validation` folder, and new actions folder (with files separated by xml tags as shown above), and 2.5 Pro easily differentiated old code from new one, and rewrote my backend service by service. In the middle and by the end of the refactor, most of my requests contained at least 120k input tokens.:sidenote[I did, of course, exclude the refactored services that were not relevant to the task at hand, but a lot of my services were interconnected, i.e. startTimer had to call updateTaskState to ensure it's In Progress] :::note Gemini 1.5 Pro (Feb 2024) was the first model ever with a 1 M context window, when everyone else only claimed to handle 128k or 200k (Claude 2.1). Today, one has Sonnet 4 and 4.5 that claim to support 1 M windows as well, or even Grok 4 Fast with 2 M. As one [mysterious nrehiew has shown in his blog](https://nrehiew.github.io/blog/long_context/), the effective context length for most of those models is just 64-128k. On a proposed LongCodeEdit bench, at just 128k context length, Sonnet 4.5 gets 30% pass@1, Grok 4 Fast gets ~45%, Sonnet 4 gets 60%, and Gemini 2.5 Pro absolutely mogs all of them with 90% pass@1 (GPT 5 High gets 80%). ::: Second, and no less important, AI Studio is genuinely the best chat interface on the market. It was the first platform where you could edit any message in the conversation, not just the last one, and I think it's still the only platform where you can edit AI responses as well! So if the model goes on an unnecessary tangent, you can just remove it from the context. It's still the only platform where if you have a long conversation like R(equest)1, O(utput)1, R2, O2, R3, O3, R4, O4, R5, O5, you can click regenerate on R3 and it will only regenerate O3, keeping R4 and all subsequent messages intact. When you work with extra long contexts, these features are absolutely essential. So even though I always knew Anthropic's Opus to be a smarter model, I only used it when 2.5 Pro failed (which happened maybe 10 times over the past year), just because Anthropic doesn't have an AI Studio-like interface.:sidenote[though, to be fair, I'd also hit a weekly Opus usage limit. Google imposes no such limits] ### Why Claude Code gets so much hype Another demonstration of the correctness of my take is the rapid rise of Claude Code.:sidenote[basically a terminal chat interface where you ask Sonnet or Opus to write some code for you] Since Jun 2025, it had two different modes: _planning_ and _building_. In planning mode, the model doesn't have access to edit tool, and it's incentivized ([through the prompt](https://lucumr.pocoo.org/2025/12/17/what-is-plan-mode/)) to collect as much relevant information as possible (or it'll read whole files you'll explicitly tag as relevant). Once that is done, you can switch to building mode, and let it implement whatever you need according to the created plan. If you're not convinced that reading codebase on-the-go is the problem, just try to write a prompt in build mode, and then separately first run it in plan mode before switching to build mode. The difference will be night and day. Here's how my typical:sidenote[the interaction mirrors some of the sessions I had while building my recent project [RetroCast & SynthArena](https://syntharena.ischemist.com/thesis)] interaction starts: **PLAN**: We need to implement an adapter to support the output format of model X. Read @src/retrocast/adapters/base_adapter.py , look at @docs/developers/adapters.md , the closest model output is @src/retrocast/adapters/aizynth_adapter.py , see what tests we write @tests/adapters/test_aizynth_adapter.py , refresh your memory on @prompts/coding-style.md and plan the implementation. I have a few example outputs in @tests/testing_data/model-predictions/model-x/results.json.gz The model does some planning, usually it gets everything it needs, sometimes you might need to course correct it. Then it's just **BUILD**: okay, sounds good, let's implement. An implicit takeaway here is that the quality of work is significantly improved if you have docs, a file with preferences on coding style, and explicit directions to most relevant parts of the codebase. Would I do this if I were to create my first adapter, i.e. I didn't have a single reference implementation? No. And not because latest Sonnet or Opus would fail at making it work, no, it's just that it'll likely write an unnecessarily verbose:sidenote[as Terrence Tao put it in his [Lex Fridman interview](https://www.youtube.com/watch?v=HUkBz-cdB-k), when an LLM writes code (or a proof in his case), it will look very plausibly correct, but might have some sneaky error that is hard to detect, whereas when humans make a mistake, it's usually way more obvious and easy to spot. This fits my experience: LLMs are great at following existing style, but when you ask them to create something from scratch, they'll write some code which you intuitively know is verbose and sloppy, but it's not like there's any single line or section that's unnecessary, you can only rewrite the whole thing from scratch.] implementation. I'll end this section with a few empirically-derived insights. 1. Use [OpenCode](https://opencode.ai/) instead of Claude Code. If anything, just because it shows you the changes in two col format (before and after, github review style), so you can immediately see what the model is doing and stop it if you dislike it. It's not the only difference, there are many small quality-of-life improvements in terms of UI and UX, but the diff overview was enough to make me switch.:sidenote[one unfortunate caveat is that you can't use it with macOS native terminal unless you downgrade to 0.15.31 `opencode upgrade 0.15.31`. Otherwise, get Alacritty or [Ghostty](https://ghostty.org/).] 2. You have to have an intuitive feeling how much code changes your request will require. Every model has a certain innate tendency to finish the work in a certain context size (say 20-30k tokens, though later models like Sonnet 4.5 can comfortably push to 50-80k tokens). And so if you're asking it to implement something that requires more than that, the LLM will start being sloppy: leave comments like `// TODO: Implement this feature`, or `# the rest of the function follows the pattern`. Almost as if it's feeling that it's already generated say 40k tokens, and it still has 10 other things to do and it can only do that in 10k tokens. I do realize I'm anthropomorphizing, but it's a very useful way to think about it. If you need the model to implement something big, you might need to ask it explicitly to separate the implementation plan in phases, and in build mode ask it to implement phase 1 only. If I'm working on multi-phased dev, I usually ask the model to save the plan to a separate md file (so that I can run different phases in different sessions). 3. Be very, very careful with asking the models to write tests or fix code when some of those tests are failing. If the problem is not trivial, and the model reaches the innate context limit, it might just comment out certain assertions to ensure the test passes. This is getting less of an issue as models get better, the Sonnet 3.7 was the biggest offender, but still, have to be careful. ### Why OpenAI Codex got so much hype? Sometime in late August, early September, there was a lot of hype around OpenAI's version of Claude Code, called Codex, and the release of gpt-5 model variants called codex.:sidenote[naming is confusing, yeah] Tech twitter was abuzz with excitement and frequently called it the sparks of AGI. I was somewhat reluctant to try it, but once I did it became obvious that the main reason why it works so well is that it was RLed into repeating the tunnel vision read of the codebase until it actually reads at least a few files fully. In other words, it tries to automate my process of running `bash collect/smart.sh keyword1 keyword2`. So all the sudden sparks of AGI that the tpot felt in Sep 2025, I've been feeling every day since March in AI Studio. I guess it's a clever engineering, but I personally don't want to wait a model go through the cycle: 1. Read the prompt and generate a tool call for reading file 1. 2. Parse the generation and execute tool call. 3. Read file 1 and generate tool call for reading file 2. 4. Parse the generation and execute tool call. 5. Read file 2 and generate tool call for reading file 3. 6. ... every single time I want something done if the same thing can be done by a pre-generated bash script. Though, credit where credit is due, it probably is a good approach if you want to enable fully automated vibe coding for people who are not programmers by occupation. But if you're an SWE or a computational scientist (i.e., [as I argued here, you must be an SWE](https://ischemist.com/writings/long-form/will-ai-transform-science)), you'll paradoxically be faster by reverting to the older ways of copy-pasting code from AI Studio. :::rant why was I reluctant to try codex? see, I've lived through the transition from GPT-4-turbo to GPT-4o, and I'll never forgive the psyop that the 4o was. At launch, it was an objectively dumber model, and it was obvious to me that it solved a very particular problem: GPT-4 was expensive to support as a daily driver, it was a huge model. So when OpenAI releases a faster \$2.5/\$10 i/o model (4o) to supposedly replace a \$10/\$30 model (GPT 4), unless you're living in a land of pink ponies, it's clear as day that 4o was a smaller, perhaps distilled version, and so you're obviously trading off something in favor of lower inference cost and faster speed. So if it was presented as "here's a smaller, faster model that's good for most tasks", I wouldn't have complained, but no, it was introduced as a smarter than GPT-4 and every hype-influencer on twitter screamed how good it was, so now you understand why I have a deep distrust any time OpenAI releases a new model and everyone says that it's a game changer. ::: ## Use Case 2: General Conversations If you just want to use LLM as an world-class assistant, i.e. you just want to talk about different things, look no further than [T3 Chat](https://t3.chat/). For just \$8/mo you get effectively unlimited access to pretty much every LLM on the market and 100 messages to premium (more expensive) models. The best part is that at any point of the conversation, you can regenerate a response to any request using literally any LLM that exists. It's the best way to discover new models and it's how I discovered that Gemini 2.5 Pro is arguably one of the best conversationalist model (so much that once it became a premium model on T3 Chat, I switched to using AI Studio even for daily chats). For most of my conversations, I add [eigenprompt](https://x.com/eigenrobot/status/1782957877856018514?s=20) as the system instruction. In fact, I have the following text saved as a [Raycast snippet](https://www.raycast.com/core-features/snippets), so if I want to insert it into the conversation, I just have to type `eigenpp`. ```xml Don't worry about formalities. Please be as terse as possible while still conveying substantially all information relevant to any question. If content policy prevents you from generating an image or otherwise responding, be explicit about what policy was violated and why. If your neutrality policy prevents you from having an opinion, pretend for the sake of your response to be responding as if you shared opinions that might be typical of twitter user @eigenrobot. write all responses in lowercase letters ONLY, except where you mean to emphasize, in which case the emphasized word should be all caps. Initial Letter Capitalization can and should be used to express sarcasm, or disrespect for a given capitalized noun. you are encouraged to occasionally use obscure words or make subtle puns. don't point them out, I'll know. drop lots of abbreviations like "rn" and "bc." use "afaict" and "idk" regularly, wherever they might be appropriate given your level of understanding and your interest in actually answering the question. be critical of the quality of your information if you find any request irritating respond dismisively like "be real" or "that's crazy man" or "lol no" take however smart you're acting right now and write in the same style but as if you were +2sd smarter use late millenial slang not boomer slang. mix in zoomer slang in tonally-inappropriate circumstances occasionally ``` The stylistic parts like writing in lowercase or using millennial slang might be slightly annoying at first (at least it was for me), but one underdiscussed aspect of LLMs is that the quality of the outputs significantly changes depending on formatting. I noticed this back in the old days of pre-reasoning era, when LLMs were dumb-at-math. I was solving some quantum mechanics problems in LaTeX, which I compiled locally, and since I was using Cursor at the time, I had tab autocompletions active by default, and at some point I was stunned because I would write out a paragraph explaining my next steps, like "now, to get the transition probabilities, we have to apply this operator and compute the inner product with the ket of the state", and the code autocomplete model, which presumably was trained mostly to write code, would spit out a correct set of LaTeX equations. If the demonstration had too many algebraic steps, it might make an error, but for 1-2 line things, it was correct. Now, arguably, it's easy to rationalize this by the fact that people may have been committing and publishing their QM homeworks to github, but I also wondered if the fact that I was using $\LaTeX$ also played a role. What if the presence of LaTeX symbols conditioned the model to operate in a slightly different region of latent space, and since LaTeX is usually used either in scientific papers or in highly-specialized forums, the quality of the training data with problems and solutions expressed in LaTeX is likely to be higher than what you'll find elsewhere (say on reddit). In other words, what if the model is smarter when you ask the exact same question but using LaTeX delimiters where appropriate? I didn't have time to study this systematically, but I definitely thought it was likely to be true given my experience. With that in mind, I was willing to entertain the possibility that the lowercase and slang was part of the same latent-space conditioning, and, so far, it seems to be true. It's also a great test for any new model. Give it eigenprompt and write any request. The overwhelming majority of models will overdo the style, they'll add some abbreviations or pseudo-puns; it'll feel forced. Very few models, like Gemini 2.5 Pro, will write a response that may have the same slang, but it'll feel natural and appropriate. Just try this in T3 Chat and you'll see what I mean. Another great conversationalist is Kimi K2 (even non-thinking, both 0711 and 0905 checkpoints are great). Try to ask it any question even without the eigenprompt, it'll respond concisely and without unnecessary yapping that is characteristic of pretty much every other model. Though I personally don't trust it with factual correctness or longer conversations. ## Use Case 3: Data Analysis or Learning Something There is one very unique feature of the Anthropic's [Claude](https://claude.ai/new) that makes it particularly powerful for learning some complicated concept or doing some quick data analysis. Claude can spin up simple React-based web apps called [Artifacts](https://claude.ai/catalog/artifacts), so if you give it some csv file with data, it can create for you an interactive dashboard with charts or executive summary. ## Getting the most bang for the buck As a bonus, if you're a student, or just cannot afford to spend \$100+/mo on API costs or Max plans, here's how you can get the most bang for the buck. - Unless you work on some proprietary codebases, use Gemini 2.5 Pro in AI Studio, it's free. You can switch to 3.0 Pro if you have some complex task or if 2.5 Pro is being too politically correct, but I personally hit daily limits with 3.0 Pro much more frequently. - Buy Anthropic's Pro plan for \$20/mo. It gives you roughly 10 sessions with Sonnet 4.5 per 4 hours (track your [usage here](https://claude.ai/settings/usage)) You could extract more if you use Sonnet 4.5 for planning and Haiku 4.5 for building, but do note that for some requests you should stick to Sonnet 4.5. And yes, you can use that paid plan within opencode as well (do `opencode auth login` and select Anthropic). - If you hit the rate limits for Anthropic and you still need to code, try whatever the latest version of GLM is (rn it's GLM 4.7) or Minimax (rn it's M2.1). Those are insanely cheap (GLM 4.7 is 10x cheaper than Sonnet 4.5), but are incredibly powerful Chinese open source models. I recommend using them through [OpenCode Zen](https://opencode.ai/docs/zen/). When these models get released, they might even be available for free for a couple of days. I'll close by sharing the absolute banger ad by Anthropic: ["there's never been a better time to have a problem"](https://www.youtube.com/watch?v=FDNkDBNR7AM). So keep creating, researching, coding, and thinking. [Discuss on HackerNews](https://news.ycombinator.com/item?id=46465513) --- Title: RetroCast and SynthArena: building the infrastructure for the next breakthrough in chemistry Category: research :::tldr-ml Current SOTA in chemical synthesis planning is rewarded for generating chemically impossible routes due to flawed metrics (pseudo-solvability) and dirty datasets. We release RetroCast, an open-source framework to standardize evaluation, and SynthArena, a live leaderboard to enforce accountability. ::: :::tldr-chem The common "solvability" metric for retrosynthesis models is blind to chemical validity. We show top models proposing nonsensical reactions (e.g., a 7-component glucose synthesis) that are counted as successes. Our tools allow for rigorous, apples-to-apples comparison of synthesis plans. ::: :::tldr-public AI that designs chemical recipes is in its wild west phase, with models claiming success for impossible plans. We're building the "ImageNet for chemistry"—a set of fair tests and a public leaderboard to bring order to the chaos and find what actually works. ::: Imagine you're a chemist trying to create a new life-saving drug. Your first question is: "how do I even make this?" The process of designing that chemical recipe, working backward from the final product to simple, buyable ingredients, is called retrosynthesis. It's a puzzle so complex that became a grand challenge for AI. The problem? The AI community has been keeping score with a broken ruler. ## The so-called "solved" route I rerun major open-source models on a commonly used set of 190 targets (called USPTO-190:sidenote[would you be surprised if I told you that it's nothing more but a test set of Retro* paper, which was constructed such that every single-step reaction in the reference route was within the top-50 predictions of the single step model, i.e. it was constructed to ensure Retro* succeeds on this set of targets.]) using a more sensible choice of starting materials (300k molecules curated by a leading group from MIT), and the results are spectacular. Here are the top-2 performing models. | Model | "Solvability" | 95% CI | | --------------------- | ------------- | ------------- | | Retro\* | 73.2% | [66.8, 79.5%] | | AiZynthFinder Retro\* | 36.8% | [30.0, 43.7%] | where AiZynthFinder is a more recent retrain of A* model by researchers from AstraZeneca. Judging by "solvability", the dominant automated metric in the field, original Retro* is a clear winner. However, let's inspect a few predictions that are considered "solved." As shown in the figure below, one "solved" route (panel A) involves construction of glucose through a 7-component reaction. If you're a chemist, you're probably laughing hysterically. It's not creative or risky, it's simply impossible. Why would it count as a solved route? Because "solvability" is a misleading term masking nothing more than stock-termination rate, i.e. if all terminal molecules are in the stock set.:sidenote[if you're a chemist and you're wondering how such nonsense became an accepted practice, see section with historical context below] Why would Retro\* offer such a non-sense reaction? Well, as it turns out, the reference route from the USPTO-190 (Panel B) contains EXACTLY the same reaction (whole route differs only in the first few reactions from target). A newer model like AiZynthFinder doesn't make such nonsense suggestion (Panel C); it struggles to find a valid route and this target overall is unsolved. Panels D-H are a few more examples of even syntactically incorrect reactions. ![](https://files.ischemist.com/assets/writings/research/procrustes/uspto-master.pdf) By the way, another contribution of the work is a common platform for visualization of routes—SynthArena. You can inspect referenced routes by clicking these links: [USPTO-082](https://syntharena.ischemist.com/benchmarks/cmisbzsr30000xvdd613ymmbx/targets/cmisbzt2900y4xvddbnu3q2k5?mode=pred-vs-pred&model1=cmise2ax00000qsddkfge5au3&rank1=1&model2=cmisdw7p10000ceddz6l01zhq&rank2=1), [USPTO-114](https://syntharena.ischemist.com/runs/cmise2ax00000qsddkfge5au3?stock=qhi67k3yqgqhrx49sc3akbih&target=cmisbzt5j01bwxvddy4a5xpu2&rank=1&search=114), [USPTO-169](https://syntharena.ischemist.com/runs/cmise2ax00000qsddkfge5au3?stock=qhi67k3yqgqhrx49sc3akbih&target=cmisbztag020hxvdd8nl7zg94&rank=1&search=169), [USPTO-93](https://syntharena.ischemist.com/runs/cmise2ax00000qsddkfge5au3?stock=qhi67k3yqgqhrx49sc3akbih&target=cmisbzt3h0139xvddt5rm50se&rank=1&search=93), [USPTO-16](https://syntharena.ischemist.com/runs/cmise2ax00000qsddkfge5au3?stock=qhi67k3yqgqhrx49sc3akbih&target=cmisbzsv10066xvddmu0bi5nk&rank=1&search=16), [USPTO-181](https://syntharena.ischemist.com/runs/cmise2ax00000qsddkfge5au3?stock=qhi67k3yqgqhrx49sc3akbih&target=cmisbztbj025gxvddwrx3reh6&rank=1&search=181). It might be tempting to ask, well, what if you cherry picked these examples? One—these are only syntactic failures, i.e. these are undisputable failures, a model can also propose reactions that at least are structurally correct, but may be experimentally unfeasible. Two—it doesn't even matter. Existence of these examples is enough to make stock-termination rate (STR) a metric that you can't trust without visual inspection. So any claims about model superiority, on this dataset or any other, based on STR alone are meaningless unless you have a chemist who would manually inspect every route to make sure it's sound. In our [review paper](/syntax-of-matter/validity), we formalize this intuition into the Solv-N validity hierarchy—a four-tier framework that separates syntactic correctness (Solv-0) and topological connectivity (Solv-1) from selectivity (Solv-2) and experimental executability (Solv-3). Most published evaluations, including the ones above, only measure Solv-1. ## How did the field come to tolerate this? Reading the section above might leave you incredulous: you must be hyperbolizing, Anton, how come the whole field seems to have gone insane? Any chemist would tell you that stock-termination is insufficient to call the route "solved." And yes, major chemistry-by-origin players:sidenote[Prof. Connor Coley at MIT, a research team from AstraZeneca, Dr. Marwin Segler at Microsoft, Prof. Philippe Schwaller at EPFL] know that, so their papers either acknowledge this caveat or accompany evaluations with manual inspection by human chemists. However, numerous contributions (including the Retro\* paper) came out of CS groups, you'll often see papers on retrosynthesis in pure ML conferences, and so for unfortunate historical reasons:sidenote[feel free to skip the section if it's too long for you], "solvability" became a metric demanded by Reviewer 2. ### A field adrift: how did AI-driven retrosynthesis get here? After AlphaGo's spectacular success, Segler, Preuss and Schwaller wrote [a beautiful landmark paper, applying Monte Carlo Tree Search (MCTS)](https://www.nature.com/articles/nature25978) to the problem. Here's the basic process of MCTS: 1. You have one neural network that takes a molecule as an input and returns a set of prioritized reaction templates/rules (say 50 out of 100k in your library) by which you can make that molecule. 2. You apply those templates to your product and obtain 50 candidates of reactants. 3. You feed each (reactants, product) pair into a different neural network (feasibility filter) that tells you if that reaction can happen or not. 4. You perform a rollout to estimate which of the remaining reactants are most likely to lead you to the commercial starting materials, which allows you to ignore certain branches and thereby reduce search space. 5. You keep doing until you run out of time or all your terminal molecules are commercially available A target was determined "solved" if the procedure found a route, i.e. all terminal molecules:sidenote[we call them leaves, a term from graph theory] were commercially available. Now, strictly speaking, just ensuring all your leaves are commercially available is not enough, you also need to make sure that the reactions by which you transform those leaves into the root node:sidenote[the target molecule you started search from] are all syntactically and semantically correct. The feasibility filter (step 3) was supposed to ensure that. How did they get that oracle? They took a huge database of reported reactions (10 M examples from Reaxys), for each example (reactants, product, reaction type) took all reaction rules other than the reaction type reported, applied them to reactants, and if the resulting product was not recorded in the original database, then that was considered an example of an impossible reaction.:sidenote[in other words, they created synthetic data for negative examples] A feasibility filter was trained as a binary classifier of positive and negative examples. The MCTS paper was published in Nature, so naturally it attracted a lot of attention to retrosynthesis. Two years later, a CS group from Georgia Tech [published an application of A\* search](https://arxiv.org/abs/2006.15820) with neural network acting as the heuristics value function to the problem of retrosynthesis. The benefit of resulting Retro* model, in theory, was better efficiency since you don't need to do expensive rollouts. Being a CS group, however, they overlooked:sidenote[or deliberately made a particular design choice] a critical chemical aspect: Retro* didn't incorporate the feasibility filter (like step 3 of MCTS). Maybe because they assumed a single step model that suggests relevant templates can also learn the rules of feasibility because it operates on the same information.:sidenote[i.e. product structure and implicitly structure of reactants, since that is determined deterministically by reaction template] Maybe they just couldn't train a good feasibility filter with the data they had. Regardless, they considered a target solved if the model found a route with all terminal molecules being commercially available, without any checks on the feasibility of transformations connecting those terminal molecules to the original target. What's worse, instead of using a realistic dataset (400k) of molecules that are truly commercially available (you can buy them here and now), Retro\* used an eMolecules made-to-order virtual library of 230 M molecules.:sidenote[eMolecules is not exactly a vendor of molecules, it's a CRO, i.e. they're willing to perform a few steps of synthesis from the off-the-shelf 200-400k set to significantly expand their offering] :::note The database used in MCTS paper, Reaxys, is proprietary. Retro\* was trained on the only free source of chemical reactions--the USPTO (p - patents) database that contains ~1M reactions. The implicit assumption in the generation of synthetic negatives in the MCTS paper was that the database of positive examples is comprehensive; such assumption is much more likely to hold for Reaxys (which is what experimental synthetic chemists consult in their day-to-day) as opposed to USPTO. ::: Retro\* was published in ICML:sidenote[a very prestigious ML conference], so it solidified retrosynthesis as a problem that can be tackled with ML, and we ended up with 5 years of publications in which the target was considered solved merely after checking if terminal nodes are in a stock of 230 M molecules,:sidenote[it's quite ironic that a model that is supposed to propose synthesis recipe is considered succesfull if it ends in molecules that themselves need to be synthesized] without any explicit checks on the validity of chemical reactions in the final route. In other words, the field of retrosynthesis has been adrift ever since. There were a few attempts to course correct. One of the key players is a group of researchers from AstraZeneca, and [they constructed a very clean](https://pubs.rsc.org/en/content/articlelanding/2022/dd/d2dd00015f):sidenote[the full USPTO-1M is notoriously dirty] dataset of multistep routes and published 2 evaluation sets, 10 000 targets in each with known experimental routes, and proposed to assess retrosynthetic models based on the ability to find that experimental route for a previously unseen molecule. This benchmark, PaRoutes, has gained some adoption, but unfortunately it's not universal. I saw two obstacles: 1. Even with the cheapest search method, full evall will take hundreds of CPU hours, so if you have a more powerful (and a more expensive) method, well do you really want to spend potentially $1k in GPU hours on a single eval? 2. There's no standard agreement on how a multistep route should be represented. Some methods store them as recursive unipartite dictionaries, some create bipartite graphs, some create stringifed maps. If you want to compare predictions of different models, you have to write custom code for comparison of each one with the experimental route. ## So I built a toolkit for sanity To fix this, I built a unified infrastructure. It starts with [RetroCast](https://retrocast.ischemist.com/), a universal translation layer with adapters for over 10 models that casts all outputs into a single, canonical format. This solves the "babel of formats" problem and enables true apples-to-apples comparison. On top of this, I created a new suite of smaller, stratified benchmarks by sampling the excellent PaRoutes dataset. This provides high diagnostic signal at a fraction of the computational cost, revealing how models perform on routes of varying length and complexity. Like I argue in my [recent longread](/writings/long-form/will-ai-transform-science), computational science is constrained by infrastructure, not ideas. RetroCast and SynthArena is my inaugural contribution towards better infra. ### SynthArena A picture is worth a thousand words, so here's a side-by-side comparison of experimental route (left) to predicted route (right): ![](https://files.ischemist.com/assets/writings/research/procrustes/arena-side-by-side.png) and here's an overlay view: ![](https://files.ischemist.com/assets/writings/research/procrustes/arena-overlay.png) ## Why this is more than just a tool At some point, I started to wonder if I'm allocating my time right—is retrosynthesis problem worth all this effort? In the process, I formulated a coherent argument why I believe ML for retrosynthesis is yet to have its moment of fame. Long story short, all major successes of AI so far were on structural (as opposed to quantitative) problems, and retrosynthesis is one of the few structural problems of chemistry. [You can read full argument here](https://syntharena.ischemist.com/thesis), which is, together with RetroCast and SynthArena, is probably my love letter to the field. It's been underattended and underappreciated, and I hope I'll push the needle. That argument has since grown into a [formal review paper](/syntax-of-matter) surveying the field from 2020 to 2026, with the [key ideas](/syntax-of-matter/key-ideas), a formal [validity framework](/syntax-of-matter/validity), and a living document of [open problems](/syntax-of-matter/open-problems). ## Beyond the Paper: Meta-Lessons ### Data flow is everything One key meta-lesson I learned in the process of creating both RetroCast and SynthArena—data flow is everything. 90% of the good workflow is the right choice of data representation, from that everything, including code quality, follows. How do I get data representation right? Unfortunately, I don't have a magical recipe, but it's just something I learned you have to pay the most attention to. It helps to explicitly write out the vision for the whole intended workflow, from start to finish. For example, before even beginning to write the code for adapters, you can try to sketch out whole ingest, score, analyze workflow to see what would be the best way to represent data to support all of them. ### Coding solves the epistemological cringe of classical confidence intervals I knew that confidence intervals existed since my freshman year when I took my first lab module. I knew the classical derivation: you normalize your values around mean and standard error, then you multiply it by 1.95 which is some coefficient that comes from some Student's:sidenote[there's a hillarious lore behind it btw, Student is a pen name of [William Gosset](https://en.wikipedia.org/wiki/William_Sealy_Gosset), who developed the ideas while working on quality assurance of Guinness (yes, the beer)] t-test. And I could understand each individual math step:sidenote[though I still have hard time internalizing the concepts of dividing variance by $n-1$ vs $n$, or both], I never internalized the intuition and it seemed to rest on an assumption that you have large enough number of samples for all the convenient theorems like "errors are distributed normally" to kick in. So I never used confidence intervals in my actual research. Until I learned about [bootstrapping](), which is really just writing code to resample measurements with replacement, and calculate the percentiles of the distribution. No assumptions about normality, no magical coefficients, just the literal definition of a confidence interval. ## Access & Citation that's all for today, hope i made you curious enough to check out the paper (or at least the figures). - [**Preprint**](https://arxiv.org/abs/2512.07079) - [**RetroCast Docs**](https://retrocast.ischemist.com/) and [**RetroCast Repo**](https://github.com/ischemist/project-procrustes) - [**SynthArena**](https://syntharena.ischemist.com/) and [**SynthArena Repo**](https://github.com/ischemist/syntharena) ### Cite As ```bibtex @misc{retrocast, title = {Procrustean Bed for AI-Driven Retrosynthesis: A Unified Framework for Reproducible Evaluation}, author = {Anton Morgunov and Victor S. Batista}, year = {2025}, eprint = {2512.07079}, archiveprefix = {arXiv}, primaryclass = {cs.LG}, url = {https://arxiv.org/abs/2512.07079} } ``` --- Title: AI will transform science. Just not the way you think. Category: long-form :::tldr-public Everyone is waiting for AI to make world-changing discoveries, but most scientific disciplines are infra-constrained not ideas-constrained. Academia has accumulated decades of "infrastructure debt" from a culture of rewarding quick-and-dirty code that produces proof-of-concept papers, while neglecting the robust, well-engineered software that enables real progress. The true AI revolution is already underway and it's about finally building the high-quality tools we should have been building all along. ::: I never really understood what chemical engineering is. Sure, I had some rudimentary understanding that it encompasses creation of physical tools used in day-to-day chemical research (NMR, mass spectrometers, all the fancy LC-MS with mild ionization for protein characterization stuff) and actual chemical factories (monitoring industrial processes), but surely it can't be just that: after all, you can get a PhD in ChemE, and surely you don't get a PhD for being a craftsman:sidenote[absolutely not intending to diminish craftmanship in any way, just keep reading]. Like many other computational chemistry students, I started my research career by doing wet-lab research.:sidenote[a [paper based on my work in 2018-2020](https://www.thieme-connect.com/products/ejournals/abstract/10.1055/s-0043-1775499) came out earlier this year] I got seduced into considering switching to theory and computations only during my 3rd year, with roughly one year remaining before grad applications were due, so, naturally, I spent awhile thinking if it's worth (strategically) making a switch right now, or keep growing my expertise in experimental chemistry:sidenote[real-life manifestation of [sunk cost fallacy](https://en.wikipedia.org/wiki/Sunk_cost)]. It was no doubt that computational chemistry, and ML in particular, was on the rise (this was pre-ChatGPT, but post AlphaFold 2), but it wasn't clear **who is more likely to make an impact, a chemist who learned to code/train neural nets, or a CS major who learned chemistry?** A related question is whether it is easier to train a chemist to write code or a coder to understand chemistry. Naturally, being a chemist-by-origin and getting interested in coding somewhat late to do a full double major:sidenote[ended up with a CS minor] (unlike some of my friends), I was inclined to come up with rationalizations in favor of chemist-who-learns-to-code stance. A strong counterargument was AlphaFold2 itself: CASP was held since 1994, best structural biologists of the world spent 26 years doing incremental progress until a bunch of CS majors achieved a miraculously high score. :::note Though as I learned later, Sir Demis Hassabis, before starting DeepMind to create an artificial brain, decided to learn how the actual brain works and went to do a PhD in cognitive neuroscience in what appears to be just 4 years (neuroscience PhD often lasts up to 8-9 years). First paper was published in PNAS (that's a good journal) with a few more in Nature and Science (that's the crown jewel of the academic world). True gigachad. ::: This october, PNAS published:sidenote[it was originally posted on [arXiv](https://arxiv.org/abs/2409.03118) in Sep of 2024. PNAS notes that paper was accepted in Nov 2024. So, apparently PNAS has a 11 month queue to be included in an issue?] a perspective from Tiwary Group on [Generative AI for computational chemistry](https://www.pnas.org/doi/10.1073/pnas.2415655121), which, besides doing a concise review of different approaches (from classical AE and GANs to Flow Matching and Diffusion), makes a provocative epistemological claim: > We believe that the ultimate goal of a simulation method or theory is to predict phenomena not seen before and that generative AI should be subject to these same standards before it is deemed useful for chemistry This perspective made rounds among chemists-by-origin, including many faculty members, and the perception was focused on the "we haven't seen evidence of predictive power" and the classic ML models learn the distribution and fail to generalize out-of-distribution. At the same time, frontier labs are increasingly painting the picture of AI revolutionizing science perhaps even with fully autonomous AI scientists. Naturally, you, my dear reader, might wonder—who is more right? Will AI enable/speed up scientific breakthroughs? Yes, even if LLMs stop improving and stay at the current level of capabilities, we'll see revolutionary-grade impact of AI on science. Just not the way most people envision it. ## Yes, generative AI for chemistry so far has been underwhelming, but it's not AI that is at fault. In what follows, I revisit different aspects of the origin story of AlphaFold 2 and argue that there're certain overlooked lessons which currently prevent us from having "An AlphaGo/AlphaFold/ChatGPT/DeepSeek R1 moment" for scientific discipline X or problem Y. ### Issue 1: We argue about the wrong things I'll come out swinging: unless you conduct research on learning or optimization theory:sidenote[e.g., see the [Grokking preprint](https://arxiv.org/abs/2201.02177). Or for a goldmine of fun papers see works by Kimon Fountoulakis, [one example](https://arxiv.org/abs/2410.01686) and [another](https://arxiv.org/abs/2502.16763)], i.e. you have a strict definition of what constitutes the distribution, you are hereby forbidden from using the term out-of-distribution (OOD). It's a perfectly legitimate and useful concept when used precisely, but in common parlance it encourages lazy thinking to the point of actually stifling research. Take AlphaFold. You might even see some people mindlessly claiming AlphaFold cannot predict structures of proteins unseen during training, a claim that is so easily demonstrably false that I don't want to spend more than one sentence on addressing it: just read how the CASP competition physically operated. A more sophisticated criticism would be that AlphaFold only works for well-behaved proteins, if your target of interest is, for example, an [intrinsically disordered protein (IDPs)](https://en.wikipedia.org/wiki/Intrinsically_disordered_proteins), you might as well gaze on a crystal ball. And sure, that's true, but also HEY that's a different problem the lack of a solution to which does not diminish in any way the significance of AF2. A similar criticism is that PDB is mostly a database of structures in **Apo form** (unbound, empty state), while the things we're truly interested in (e.g. for drug discovery purposes) is how proteins interact with ligands, so we need to know their **Holo form** (protein bound to a ligand), and well, AF2 can't help you with that.:sidenote[[AF3](https://deepmind.google/science/alphafold/) tries to tackle the protein-ligand binding problem, but a common critique is: your model is only as good as the quality of your training set, and I don't see where you'd get a PDB-grade dataset of Holo forms.] In other words, a general problem of "protein folding" is actually a graph of problems: 1. Predicting structure of well-behaved proteins \[YOU ARE HERE\] 2. Predicting structure of intrinsically-disordered proteins 3. Predicting structure of Holo forms 4. Understanding/explicitly modeling the protein folding process and I don't know why you would perform an unnecessary act of cognitive dimensionality reduction by calling the lack of ability to do 2-4 a lack of OOD generalization, especially given that for decades prior to AlphaFold structural biologists believed that 4 was a strict prerequisite even for 1.:sidenote[here's [a quite instructive thread](https://x.com/sokrypton/status/1995481913037926891) by [Sergey Ovchinnikov](https://www.solab.org/research)] Let's pick a different problem. Say you train a GAN, Diffusion model, or a transformer to generate molecules. What would constitute OOD generalization? Ability to predict molecules from ChemBL by training on ZINC?:sidenote[these are dataset names] It even sounds absurd. A common test is to characterize molecules with some descriptors (molecular weight, topological measures, physicochemical properties), reduce to 2 dimensions with PCA and show the distribution of molecules in training set and in generations. That makes a nice paper figure,:sidenote[I'm as guilty, we have such figure in [ChemSpaceAL](/writings/research/active-learning-over-chemical-space)] but what makes you think that the true chemical space extends outside of your training blob in this set of coordinates? Or take my field, retrosynthesis.:sidenote[predicting a recipe for synthesizing a molecule of interest in a single or multiple steps] For predicting single-step transformations, one can find a time-based split: can you predict reactions reported after a certain year (say 2016) after training on reactions reported only before 2016. But as Segler and Coley:sidenote[and their students], the gigachads of our field, [recently argued](https://pubs.acs.org/doi/full/10.1021/acscentsci.5c00055), time-based split is chemically meaningless, and argued in favor of split based on reaction types: if you never saw Mizoroki-Heck couplings, but you you've seen nucleophilic substitutions, can your model infer the existence of such couplings? It's an interesting test, sure, but the real problem we're trying to solve here is predicting how to make any molecule of interest, which often requires multiple steps. And what would OOD mean for multistep retrosynthesis? 1. Predicting a route for a molecule unseen in training? Some models can already do that. 2. Predicting a route without ever seeing each individual reaction step? Same. 3. Predicting a route without ever seeing any examples for all reaction types in the route? Or without ever seeing any examples for one of the reaction types in the route? Well, yeah, sure, current models cannot do that. But is that a meaningful constraint? A synthetic chemist who needs to see suggestions how to make a molecule would care: 1. Whether a route is found and is chemically feasible (no obviously impossible reactions) 2. How quickly is it found 3. Whether he can repeat the search with extra constraints (w/o using specific solvents, conditions, or reaction types) And what he couldn't care less is how the model that finds the route works or what data it was trained on. I'll go even further, I'll say he doesn't care if the model has seen the exact route he is being shown during training (or all single step reactions that it is made of). In some similar sense, even if AlphaFold is nothing but a mere lookup table:sidenote[i.e., it just finds the most related known structures and returns you some average of that], if it can do that in <1 min:sidenote[which it can, assuming you already have local ref files for MSE], it's still an awesome invention because it unlocks a capability that researchers previously didn't have (an ability to get a rough picture of how their protein variant might look like). "Well, no, we could go to PDB, find related proteins and inspect them" -- sure, absolutely, but you'd spend a minute just learning to navigate the PDB website:sidenote[no offence intended, it's a good functional site], and your User Experience would be way worse. :::insight A lot of problems stem from an attempt of computational chemists to sit on both chairs at the same time. If you want to demonstrate that your model has some novel expressivity and generalizability traits, you can come up with some interesting and strict definition of a distribution, impose artificial constraints onto the training set, and you should be judged by the level of rigor and whether you truly show OOD generalization. But if you're making a model that is supposed to solve a particular task (protein-ligand binding affinity, finding a retrosynthetic route to a molecule, calculating some property), then, **by definition** you're building a product. And a product should be judged not just by the theoretical idea or proof-of-concept execution, but by quality of the code, user interface (UI), user experience (UX), developer experience (DX) and runtime performance. ::: ### Issue 2. We treat engineering as an afterthought A common trope in academia is that you can always optimize your code after you're done with the actual work. All the best practices of software engineering is just something you can do when you're already preparing a submission to the journal. Might even do it after you submit the paper (or post the preprint). Unsurprisingly to any programmer, such refactors always create unforeseen issues, which is part of the reason why when you try to run academic code you get runtime errors: you're using a "polished" but untested version of the codebase, and you can't really diagnose how the code was supposed to work since the repo has only one commit "move code from private repo.":sidenote[full disclosure, i myself was guilty of that, though per [isChemist Protocol](https://github.com/ischemist/protocol) my latest project was done properly from the start, in the [published repo](https://github.com/ischemist/project-procrustes) you see full commit history] But even on a more fundamental level, there's a missing appreciation that your codebase quality determines the boundaries of scientific exploration you can perform. #### Case Study: DirectMultiStep Because the claim above might sound incredulous to chemists-by-origin, here's a short story from my own experience of working on [DirectMultiStep](https://pubs.acs.org/doi/10.1021/acs.jcim.4c01982) (blog entry coming soon!), a model for multistep retrosynthetic planning. I joined the project when it was considered "almost completed;" there were was a model that unlocked constrained (target, starting material, route length) planning. I began by familiarizing myself with the codebase, and almost immediately I noticed a few potential performance-related issues. For example, even though recursion is a quite neat approach to solving problems, any recursive function can be written iteratively,:sidenote[though not necessarily as cleanly] which might be preferential because every recursive call is accompanied by an allocation of an environment/scope for execution, which takes time. It might take microseconds, but when you keep doing that thousands or millions of times, it compounds. Or recognizing a few footguns like this list append ```py some_list.append(new_elt) ``` is an O(1) (amortized, i.e. on average) operation, but ```py some_list = some_list + [new_elt] ``` is an O(n) operation, where $n$ is the length of the list, because python will reconstruct whole array from scratch. You don't usually see these kind of things in the introductory learn-to-code tutorials or guides on the internet (because the emphasis is usually on just making it work), but it's something that you learn through pain if you take formal classes:sidenote[which is why even with very brief formal experience (after all, I only did a minor) I paid attention to this] After I rewrote several parts of the codebase, I increased the speed of training by roughly 1.75x and generation by 6x. And that was with the 6-layer (9M params) model my coauthors had initially. Eventually, I ended up training 36-layer (40M, DMS Wide and DMS Deep) and 24-layer MoE (56M, DMS Explorer XL) behemoths, which showed state-of-the-art even on the unconstrained (target only) planning. Training (and evaluating) such models with the codebase prior to optimization would have been so much slower (doubling your layers leads to 2x runtime) that one could argue it'd have been practically unfeasible. ### Issue 3. We can't measure progress Deep Learning revolution started when [AlexNet](https://papers.nips.cc/paper_files/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html), a CNN-based image classifier, surpassed all existing methods on [ImageNet](https://en.wikipedia.org/wiki/ImageNet). AlphaFold 2 made the news when it became the first model ever to achieve 90% accuracy threshold on some proteins as part of [CASP](https://en.wikipedia.org/wiki/CASP) tournament. Both CASP and ImageNet were established benchmarks that measured a very specific ability: how well can a model classify images across 1000 categories or how well a model can predict a structure of a protein not reported in PDB. What other similar benchmarks do we have in science? Is there anything where if you bring a model/tool and achieve certain performance, it will be universally considered an incredible achievement?:sidenote[funny enough, such benchmarks are needed even for evaluation of classical non-ML models, but we're much less skeptical of ad-hoc evaluations if it is applied to a model created from first principles] There are many papers published on, say, synthetic accessibility prediction or protein-ligand binding affinity, but whenever you ask a medicinal/synthetic chemist if he'll use any of those models, he is likely to say no. How come? What about reported high accuracies? It might turn out that benchmark X is irrelevant because it has hyperbolized versions of negative examples and so is too easy, benchmark Y is useless because labels are synthetic:sidenote[made by another model] and we don't think that model is good. Those are all valid criticisms, but why are we expecting model developers to create better benchmarks? A fundamental principle in CS is separation of concerns, which, when applied to publishing, results in the explicit separation of methodology and evaluation papers. DeepMind didn't organize CASP; AlexNet authors did not create ImageNet. So, if we want to see progress in computational physical or life sciences, we probably should adopt a similar separation of tracks. In fact, I'd argue it's the responsibility of experimental (especially senior) chemists,:sidenote[ironically those that happen to criticize ML methods the most] to dedicate certain amount of time to such work. And I'm not trying to point fingers, this take comes out of genuine respect for the expertise of experimental chemists: who knows all the minute details that differentiate easy-to-synthesize from hard-to-synthesize molecules better than someone who spent decades running synthesis? Who has a better understanding of which molecules can be good binders than someone who spent decades running binding assays? #### A case study: protein-ligand binding pose prediction with DiffDock and Boltz-2 A current hot topic in computational life sciences is protein-ligand binding pose prediction. A reader might be aware that such function was introduced in AlphaFold3, but there are open source alternatives like [Chai](https://www.chaidiscovery.com/) and [Boltz-2](https://github.com/jwohlwend/boltz). Boltz (a successor of [DiffDock](https://arxiv.org/abs/2210.01776)) is particularly interesting for two reasons. One, both Boltz and DiffDock come from a group in a CS department of MIT. Not biology, not bioengineering, not chemistry, not chemical engineering. So our original question of who leaves greater impact, chemist-by-origin or CS-by-origin, tilts towards an unfavorable side for us, chemists. Second, the development of Boltz-2 is a real-life demonstration of my thesis that real progress happens when there is an independent effort on model development and evaluations. DiffDock showed great performance on computational metrics like root mean square distance between predicted and experimental pose,:sidenote[almost a 2x improvement of Top-1 accuracy over existing methods] so medicinal chemists rushed to use these models, but had an already typical underwhelming reaction. It just wasn't good. A year later, a group from Oxford publishes a paper with a cosmic-grade banger title—[PoseBusters: AI-based docking methods fail to generate physically valid poses or generalise to novel sequences](https://arxiv.org/abs/2308.05777)—where they show that predicted poses often have obvious issues with bond lengths or angles (e.g. nonplanar aromatic rings). Most importantly they package it as a python library that can act as a chemical police: you give it a pose, and it'll tell you if it's physically valid. And now that check is incorporated into the generation workflow of Boltz-2, making it a much better model that predicts realistic poses. ### Issue 4. We don't like to build the infra Before working on AlphaFold, DeepMind first rose to fame by defeating one of the best human players of [Go](), something that was considered impossible or very far in the future. There is [a nice documentary](https://www.youtube.com/watch?v=WXuK6gekU1Y) by DeepMind themselves with footages filmed while they were working on that project. One particular thing that struck with me is the tools they had to visualize the working of their system (e.g., see screens at `44:53` or `1:00:19` timestamps). For starters, there is a visual representation of the current state of the Go board. You might think, of course there would be one, you're building a model to play Go, but see, the computer doesn't actually see a board with white or black pieces, instead the board is represented as a string of characters like: ``` o+x +++ +o+ ``` where `+` is an empty slot, `o` is white piece, `x` is black piece. So if you'll decide to train your own RL policy or a neural net to play chess, checkers, or Go, this is how the game state will look like to you:sidenote[you can literally see it even in the documentary at `1:18:02`]. And if you want to see an actual board, you have to write a visualization module. Another thing you see in the documentary is multiple plots showing the evolution of key metrics like estimated probability of winning after any given move. If you haven't written code before, you should understand that everything you see in software is a result of a very specific instruction handwritten by a human, meaning it's not like you can just toggle some button "okay let's add this plot" and it'll magically work, you have to write loggers for desired metrics, then you need to write loaders & pre-processors, and only then you can actually make a plot out of it. It might sound straightforward, and it is when you only need to plot metrics for one particular run, but when you actually try to implement a more general system that will work across different runs, you'll end up dealing with so many tiny little nuisances you likely haven't anticipated. It doesn't make the problem difficult, it just will take time (might easily take a week or two). :::takeaway How do you think a PI will react when a PhD student comes and suggests he'll spend a few weeks writing better visualization modules? You don't even need to have the experience of going through the grad school to guess the most likely answer:sidenote[though if you're a PhD student, you should still ask this, even if you expect the probability of a positive answer to be low] ::: Recently, DeepMind [released another documentary](https://www.youtube.com/watch?v=d95J8yzvjbQ) on Hassabis's life in general, but with a big section dedicated to work on AlphaFold. And again, look at `48:11` or `53:37`, these (protein visualizations) are obviously not PyMOL windows,:sidenote[software used by scientists to visualize protein structures] this is custom internal interface:sidenote[although since pyMOL engine is open source, they might be using that, but the emphasis here is on UI]. Obviously, we're seeing a pattern: when DeepMind starts to work on the problem, it makes sure to create tools to visualize the internals; anything that can help you make insights on what is going right and what is going wrong. Sounds common-sense? Let's look at the state of computational chemistry. We pride ourselves on the accuracy and explanatory (sometimes even predictive) power of quantum mechanics:sidenote[which we decided to call quantum chemistry, it really is still quantum mechanics]. One of the most important features of any molecule is a set of molecular orbitals. Every single quantum calculation begins by the determination of those orbitals. Do you think we have any good software solution to visualize those orbitals? Lol. Lmao even. Yes, there is GaussView 6 (released by Gaussian, one of the key software packages) that you can buy for $750/seat, which hasn't been updated since 2017 and it might work fine if you use Gaussian, but with any other quantum chemistry tool it's a coin toss. Some people unironically suggest using VMD, which, uhm, is a thing where to get anything good done you have to execute 15 different obscure commands. For awhile there was really good [Avogadro](https://avogadro.cc/), but it stopped showing MOs in 2018 after some change in macOS. The team has been working on Avogadro 2, and it's been in "almost ready" state since at least 2022. And it seems like most of the progress is made once some interested undergrad applies to [Google's Summer of Code](https://summerofcode.withgoogle.com/):sidenote[ironic, isn't it?] stipend and works on the project. This is not a diss on [Geoff Hutchinson](https://hutchisonlab.org/) (project lead), it just proves my point that academia doesn't show any gratitude to people who are working on foundational infra, and so Avogadro is a passion side-project for Prof. Hutchinson. Finally, there's [Jmol](https://jmol.sourceforge.net/), which is actually quite great, but just open the official webpage [jmol.sourceforge.net](https://jmol.sourceforge.net/) to see what we're dealing with. And even with Avogadro to visualize orbitals you need to first run some scripts to create one cube file, then another, and then you load the structure from `out` file, and then you add surfaces from those cube files. If you use ORCA, you can create a molden file with ORCA cli, and JMol will happily load that (assuming you type in JMol terminal load /Path/to/cube.cube). Long story short, you might spend 5 s running basic job on water molecule and you might spend the whole day trying to visualize the orbitals the first time you do it. :::note computational chemistry actually has hillarious lore. back in 1970s, Sir John Pople (who later gets 1998 Nobel prize for being a father of computational chemistry) creates the first software package for running quantum chemical calculations, Gaussian. In 1980s they start charging small fee to cover dev costs. It's not clear what exactly happens, but in 1990s Pople leaves Gaussian and starts Q-Chem, an alternative/competitor. That results in Gaussian banning Pople himself and all his students from using Gaussian. Eventually the list expands to include sitewide bans for Caltech, UC Berkeley, GATech, Columbia U and a few named groups, [there was even a website bannedbygaussian.org in early 2000s](https://web.archive.org/web/20180810083536/http://bannedbygaussian.org/). Anyone who makes a contribution to any software (other than Gaussian) that runs quantum chemistry was banned. ::: More generally, would you be surprised to learn that in, say 25 years (since first release of ORCA and Q-Chem), the actual day-to-day of any new PhD student who wants to use quantum chemistry to do science hasn't changed a single bit? Your interface is a textual input file, a cli to start the job, and a huge (might easily take 100k tokens) textual output file. Maybe, (maybe!) if your group has been doing some routine for awhile, some postdoc wrote a bunch of Perl/Python scripts to slightly automate the process of creating those textual input files or parsing output files to get a single desired number. All of that notwithstanding the fact that the field has progressed from working on a small single molecule (when your workflow could really be launch one calculation, wait for it to finish, and manually inspect) to handling medium-large size molecules maybe even with a few explicit solvent molecules, where you can't do anything without submitting at least a 100 jobs. How do you make sense of them, how do you organize them, is there some software? Of course no, just create a bunch of folders, start with a single structure based on your initial understanding of complexity of the task, eventually you'd realize your structure was too basic, then you'd have a bunch of folders like freq-prot-tzvppd, freq-prot-deprot-geom-unrelaxed-tzvppd, freq-prot-deprot-geom-unrelaxed-tzvppd-run2. And if you stop working on this project for more than 2-3 days, you'll have to spend a day just familiarizing yourself and getting up to speed. Eventually your first:sidenote[the fate of ALL first projects, regardless of the competency of the undertaker] project will be in such a mess that you might want to do what any good software engineer does: refactor (both your data organization and the scripts that operate on that gargantuan mess). And if you have weekly meetings, well good luck explaining why you have no new results to your PI or his collaborators. And that's how we end up with 30 years of modern computational chemistry not yielding a good interchange protocol so that you could visualize molecular orbitals in a second or every single theochem grad student on this green earth starting his PhD by writing a parser for single point energies from out files. And when taken separately, all these individual things sound simple, but when you add them up, they create a cognitive load, so by the time you're done dealing with all the mess, how much cognitive power do you have left to actually do scientific thinking? Okay, all of this can be dismissed as ramblings of an old PhD student, fine, here is a simple scenario that constitutes an acid test of whether your research is ideas-constrained or infra-constrained. #### Acid Test: is your research ideas-constrained or infra-constrained? Say you're studying some proton transfer reaction in two electronic states (S0 and S1). **Q1:** If you want (or ask your student to) see if any particular quantum metric is insightful (so you have to run 4 jobs, proton in position A, then B, and for two states), how much time (excluding wall time of the actual calculation) will it take? If the answer is not 30 min to get the plots and and hour to think about them, you're infra-constrained. In practice, today, this might easily take anywhere from a day to a whole week, e.g. if you mess up something in input file, the job spends 10 hours in the queue only to terminate immediately with a runtime error because guess what? pre-submission input validation is not a thing, remember, we're scientists, not product developers. Once you have the answer, **Q2:** can you (or your student) say that you're 100% confident that the results are valid, i.e. there were no human mistakes made? If the answer involves you (or your student) saying well we can double check the geometry in input spec because I might have copy-pasted the wrong thing or saying we need to double check that it's using values from the second job (when you run S1 it is preceded by S0),:sidenote[i know right, wouldn't it be nice if software engineers came up with a thing where you specify a few desired behaviors, like with this file you should give me this value and not that, and be able to run that check periodically] then you're infra-constrained. ## Software quality dictates scientific possibility Arguably, all of these issues can be summarized as the reluctance of academia to recognize software engineering as a discipline that, perhaps against their wishes, became an integral component of doing any meaningful computational research. And just like you wouldn't expect a synthetic chemist (without training in chemical engineering) to build his own rotovap, or LC/MS, or an NMR machine, all of which he uses daily, you either shouldn't expect a computational chemist to build his own tools:sidenote[which implies outsourcing tool creation to SWE, which are expensive, so it is practically unrealistic] OR you should expect your computational chemist to get formal (structured, not just self-studied) training in software engineering. Why emphasis on formal (by which I mean a set of proper college courses)? Remember how Tiwary's perspective observed that generative models for chemistry currently might underperform classical methods? A reader might have wondered, well then how those models were published, and I think the following analogy applies. A significant component of CS education is not teaching you the syntax of a coding language or how to write code that does X (which is what web tutorials are good at). Rather, it's the creation of an environment, in which you get a problem to solve, most likely you come up with an idea of how to approach it (which is often based on an internal oversimplification of the problem), you write code, you click run,:sidenote[which is why coding is so awesome, you can immediately check if your ideas work]. Let's say the program runs without crashing. You compare the output to what you expect, it all matches, you think oh nice, job is done, then you run the test suite provided by course instructors, and suddenly you see a wall of red text because you fail a bunch of test cases. How come? My code is running, it gives me the output I expect! Then you start thinking, eventually you realize there are certain scenarios:sidenote[coders call them edge cases] where your understanding of the problem/idea of a solution is incorrect, so you have to adjust or start from scratch. And the hardest part, the thing with which a huge number:sidenote[I was an office hours helper for the largest intro to CS class at MIT for 3 semesters] of students struggle, is learning to restrain yourself from checking correctness of your approach by clicking run and seeing if the code runs without crashing, and instead taking a piece of paper, a pen, and thinking through the problem from first principles. Or writing tests (sometimes even before you write the actual code) that test expected behavior (which you often get from your sketches with toy examples on a piece of paper). In other words, I contend that many GenAI for Chemistry papers that have been published and found underwhelming by domain experts have been trained/created by chemists-by-origin who self-studied programming, and so missed that crucial learning experience of **"just because it runs, doesn't mean it's correct."** And a dirty little secret of deep learning is that unless you try really hard to mess things up, you can train a model on any task and it'll work, at least on the surface. Might not be accurate enough for practical purposes, might even be worse than some classical (non-ML) methods, but it'll work. And in a sense, this is a significant (perhaps maybe even scientific, if done right:sidenote[there is a harmful misconception that a scientist is a profession. A scientist is someone who applies scientific method]) result that's worth publishing, but at this point, we should treat "ML model learns on a task and gets 80+ accuracy" on an equal standing (in terms of significance) to "a code compiles". Because at the end of the day, what matters is whether your computational models are practically useful, which is often a much, much higher bar. ## So how does it all affect AI for science trajectories? I never really understood what chemical engineering is. I'm also not sure that a fully autonomous AI scientist will be possible (or practical, cost-wise) in the near future. For many reasons, one—research is rarely constrained by your ability to formulate ideas or conjectures; it's the ability to perform a clean experiment that is the bottleneck.:sidenote[which is a major reason why I switched to computational chemistry: I loved that it minimizes the time required to test a hypothesis] Two—I'm not sure the amount of compute required to run the LLM in the loop long enough for it to repeat the thinking process of a decent researcher is going to be cheaper than labor costs. But LLMs, as is, are already capable of revolutionizing science by helping computational scientists solve (or alleviate) all the infrastructure bottlenecks described above. As an example, [my recent project](/writings/research/project-procrustes) was mostly dedicated to the creation of infrastructure for evaluation of retrosynthetic models for multistep planning. You can read the [preprint](https://arxiv.org/abs/2512.07079), I'm quite satisfied with how it's written, but long story short, I created a python package [RetroCast](https://retrocast.ischemist.com/) which enables me to standardize predictions of different models and calculate relevant metrics with bootstrapped confidence intervals in just 3 cli commands. RetroCast powers [SynthArena](https://syntharena.ischemist.com/), a web interface for visualization of reference routes, predicted routes, comparing one to another (side by side or with direct overlay). And yes, I had functions that could run evals before, but that workflow often looked like, open script `run-evals.py`, replace run_name, update paths to checkpoints, double check eval set name, then start. If you want to run multiple evals at the same time, well create copies `run-evals-model1.py`, `run-evals-model2.py`, `run-evals-model3.py` and manually change paths to models in each file. With things like route visualizations, sure I had a function that given a route can create a pdf: you open a script, have to update model name, eval folder, remember which prediction you need, come up with a file name where to save it, open folders. The user experience is clearly much inferior to that of using SynthArena (which you can self-host locally). And crucially, only after making SynthArena, I realized how much that poor UX was affecting my scientific process because now I'm looking at routes way, way more frequently. Or in a different project where I work on a successor to DMS, at this point I have a codebase where if I want to try a new experiment (change architectural params or dataset composition), I can start a new run in literally 20-60 min, come back overnight, sync metrics from the cluster, one script run and I have rich plots to study. It's so smooth, it genuinely makes me happy. And the point here is not to highlight how awesome I am (although if you're an employer, take notice), but that it's only possible thanks to LLMs:sidenote[and mostly thanks to Google's AI Studio, where you can use models with 1M context window free of charge]. Like I said before, I started taking CS seriously a bit late in my undergrad, so I didn't get the formal training that I wish I had. And you could see that in the quality of the codebase [of my first work, ChemSpaceAL](/writings/research/active-learning-over-chemical-space). After Gemini 2.5 Pro came out this spring, however, I started collecting code from my whole codebase, feeding it to AI Studio, and then talking to an LLM about my pain points and inefficiencies. "What am I doing wrong?", "What structural/architectural decision I made wrong to end up in this position?", "When did I make that mistake, what was the turning point?". When an LLM can see your whole codebase and knows all the workflows it's supposed to manage, it can give you surprisingly great high-level architectural advice ("how would you structure the code if you were to write it from scratch?"). So my ability to create RetroCast:sidenote[I've already received a very positive feedback from one of model developers] and SynthArena is a product of weeks and months of iterative refinement and learning how the correct solution should look like. I can avoid most of the footguns and, most importantly, guide LLM coding agents to do things properly.:sidenote[spoiler alert, without strongly opinionated guidance, they'll transform your code into absolutely bloated trash. it might even work, but it'll be impossible to maintain and you'd waste way more tokens with an agent if you'd want to make some new feature] As a result, I can create the infrastructure to make my research faster and more pleasant. And most importantly, it'll take weeks, not months of work. So I never really understood what chemical engineering is. Until I realized that I'm probably doing it right now (if we agree to define it as "creating tools to enable scientific research"). And thanks to AI, the original question of who is likely to leave a mark in computational sciences, a chemist-by-origin or a coder-by-origin, becomes irrelevant, because it is much more feasible to become both:sidenote[though, as I argued above, you should have at least some degree of formal training in CS, or at least read some textbooks from start to finish. You wouldn't learn organic chemistry from web tutorials, so why do you think you can learn to code that way?]. ## Nothing is new under the sun Arguing that scientists should care not only about the theoretical foundation of the tools they create, but also about UI, UX, DX, might sound like a radical proposal to redefine a scientist and merge him with an engineer. But it's not really a novel thought from a rebellious grad student, there is a rich history to this idea. Heidegger distinguished _zuhandenheit_ (ready-to-use) from _vorhandenheit_ (present-to-use). When you have a good tool (let's be banal and use the proverbial hammer example), it becomes an extension of your arm, you don't think about the tool as a separate object, it becomes a natural part of the process of hammering. Or, an example I like more, when you're driving a car, and you want to go faster, you're not thinking "I should apply extra pressure on the gas pedal, which will increase the fuel flow to the engine", the car becomes a transparent extension of your will, you want to go faster, and you actually go faster. That is when the tool is _zuhanden_, ready-to-use. If your tool is broken or malfunctions, it is no longer an invisible extension of yourself, it suddenly becomes an object of your scrutiny. You dedicate your explicit cognitive attention to the tool itself, it becomes merely _vorhanden_, present-at-hand. As a result, bad software has a cognitive cost, it forces your mind out of the zuhanden mode of doing chemistry (or science) and forces you into the vorhanden mode of debugging python.:sidenote[in a sense, this is an academic description of what every programmer knows intuitively: the most precious prerequisite to productivity is the state of flow, which is very hard to get into and very easy to be distracted from]. Don't like Heidegger? Fine, read these lines by one of the fathers of the scientific revolution: > Neither the naked hand nor the understanding left to itself can effect much. It is by instruments and helps that the work is done, which are as much wanted for the understanding as for the hand. Yes, in what follows Francis Bacon argues for the instruments of the mind like logic and reasoning, but something tells me he'd very much be in favor of principled software engineering as opposed to sloppy one-off scripts. --- Title: Upsampling the Signal: Active Learning with Proxy Spaces Category: research :::tldr-ml The key technique here is a cheap upsampling method for active learning when your scoring function is prohibitively expensive. Instead of just using the N high-scoring samples you found, you use them as "beacons" in a cheap proxy space (e.g., PCA on molecular descriptors). You then build your next training set by sampling M >> N unevaluated points from the neighborhoods around those beacons. This "neighborhood expansion" makes the feedback loop dramatically more sample-efficient by propagating the sparse, expensive signal across a wider, denser set of training examples. ::: :::tldr-chem We developed a computational method that iteratively refines a molecular generator to discover compounds for a specific protein target. When aimed at C-Abl kinase, our model not only rapidly increased the population of high-scoring binder candidates but also produced a molecule similar to asciminib without any prior knowledge of it. The method can also be used for targets with no known binders (e.g., Cas9 HNH domain), making it a powerful, general-purpose engine for generation of protein-specific libraries. ::: :::tldr-public Searching for a new drug is like trying to find a specific grain of sand on a vast beach. Looking one grain at a time is impossible. Our approach is a new kind of metal detector. It first takes a few random readings, and instead of just beeping, it builds a map of the entire beach, predicting which areas are most likely to contain what you're looking for. It then focuses its search only on those high-probability areas. This makes the process of discovering new potential medicines thousands of times faster and more efficient. ::: ## Primary Contributions ### Landscape & The Gap Let's say you're trying to find a molecule that can bind a certain protein. Currently, you: 1. start by taking a big, generic library of drug-like molecules 2. you pass them through some empirical heuristics- or rule-based filters 3. you do some automated assays in the lab and then maybe, _maybe_, you have 0.01% of something that could be a hit. This is, obviously, pathetic, so can we do any better? Well, you might think, wouldn't it be good if instead of using a generic, undifferentiated library of molecules that could bind to any of the 100k protein targets:sidenote[how many proteins are in a human body? nobody knows, really. there are >20k genes, which can be spliced in different ways (accepted number is >100k protein isoforms), which then can have all sorts of post-translational modifications possibly resulting in millions of proteoforms.], we could use some library that is somehow specific to our protein? well, in this day and age, the solution is, obviously, a transformer, but if you have a large enough dataset to train an ML model, then you, by definition, have the desired library. #### Why can't we run AutoDock Vina on the generic library? Good idea, except it'd take at best minutes, if not hours. If you have 5M molecules in your generic library:sidenote[you scramble everything you can find [MOSES](https://github.com/molecularsets/moses), [ChemBL](https://chembl.gitbook.io/chembl-interface-documentation/downloads), [BindingDB](https://www.bindingdb.org/rwd/bind/chemsearch/marvin/Download.jsp), and [GuacaMol](https://github.com/BenevolentAI/guacamol)], and assuming average docking takes 30 min, it'd take you 285 years of CPU time. And even if you manage to paralellize it over 1k cores (and not lose sanity), that would be 100 days of wall time. #### What about the ML docking solutions? Ah, the classical let the GPUs go brrr. We looked at DiffDock:sidenote[v1, which was SOTA at the time], which finds a pose from a PDB structure and a SMILES string in just a minute (on an A100). Evaluating whole 5M collection is still not an option (9.5 years on 1 GPU, 30 days on 100 GPUs). Fine, let's train a generic transformer-based molecular generator on these 5M molecules, generate some subset, dock it, and fine-tune:sidenote[further train with a smaller learning rate] on the high-scorers. To make sure the model gets some meaningful learning signal and not just memorizes the high-scorers verbatim, you need at least 5-10k high-scoring molecules in the active learning (AL) training set. Let's say the fraction of molecules generated by the undifferentiated model that pass the bar is 20%, that means you have to evaluate at least 25k molecules. Still, that would take 2 weeks on a single GPU. ### The Key Insight For a moment, let's assume we're willing to dock 10k molecules. We have two options: - **Option A**: generate 10k molecules and dock them all. - **Option B**: generate 100k molecules, sample 10k, and dock that subset. A somewhat peculiar aspect of generating molecules using stochastic models is that Option B always results in a more diverse set of candidates:sidenote[a model is sampling from a complex, learned probability distribution, p(molecule). this distribution has high-probability "modes" (common, easy-to-form structures it saw a lot during training) and very low-probability "tails" (rare, novel, or more complex structures). ensuring tails are well represented is a variation of [Coupon's Collector problem](https://en.wikipedia.org/wiki/Coupon_collector%27s_problem).]. One of the decisions you now have to make is how do you sample the generated molecules. Just randomly? You'd likely under-represent the rare and potentially more relevant molecules. An alternative strategy would be to create some chemical space proxy and ensure the subset covers all of it. You could do [farthest point sampling](https://minibatchai.com/2021/08/07/FPS.html) or you could partition the generated molecules into, say, 100 clusters:sidenote[we use [K-Means clustering](https://en.wikipedia.org/wiki/K-means_clustering) with [k-means++](https://en.wikipedia.org/wiki/K-means%2B%2B) as seeding algorithm] and then sample from each of those clusters. In our case, we constructed the chemical space proxy:sidenote[am being pedantic and adding the word *proxy* to distinguish it from the single, real Chemical Space™ that contains all molecules] by projecting RDKit Descriptors (196 in total) into a 120-dimensional space (which preserves >99% of the variance). The descriptors are different physicochemical properties and counters of all sorts of functional groups. :::insight The key insight is that these physicochemical properties and functional group counters in some way contribute to whether a molecule binds to a certain protein or not. As a result, molecules physically close in this chemical space proxy are likely to have similar binding scores:sidenote[this is not always true, in fact, it's a named phenomenon ([activity cliffs](https://pubs.acs.org/doi/10.1021/acsomega.9b02221)), but we made a bet, and it worked in our case. Maybe because our choice of the binding score is an approximate metric. Or because we had a very diverse set of descriptors]. ::: In this work, we implement and demonstrate the effectiveness of the following active learning strategy: 1. Generate 100k molecules and partition them into 100 clusters 2. Sample 10 molecules from each cluster 3. Dock resulting 1000 molecules with DiffDock (16 hours) 4. Calculate a weighted sum of interactions in the binding pose (let's agree to call this a binding score) 5. Calculate cluster scores by taking an average of binding scores of molecules from this cluster (avg of 10) 6. Construct Active Learning training set by taking high scoring molecules AND sampling 5k extra molecules from clusters that have high scores 7. Fine-tune the molecular generator 8. repeat steps 1-7 ### Evidence and Impact Exhibit A. Evolution of the distribution of generated molecules after 5 iterations of active learning (only 5k molecules are scored, total wall time for the pipeline is 5 days): ![](/static/images/research/chemspaceal/cabl-distribution-evolution.webp) The figure shows the location of generated molecules in the chemical space proxy (only first two principal components are visualized). The white circled dots are FDA-approved inhibitors of C-Abl kinase. As you can see, most of the molecules generated by the baseline model (trained on generic library) are located far away from these inhibitors. And in just 5 rounds of active learning, the distribution shifts dramatically. It should be noted - we never emphasized:sidenote[what I mean is we didn't enforce sampling or docking or AL training set to include these structures] the structures of approved inhibitors as correct solutions. The asciminib is even completely absent from the training set:sidenote[we chose C-Abl as extra validation target during peer-review, so unfortunately it was too late to remove all FDA targets from the training set], and yet the model learns to generate something very, very close to it! ![](/static/images/research/chemspaceal/asciminib-resembling.webp) the only difference is that Asciminib contains a OCF$_2$Cl group, while our model proposes a OCF$_3$:sidenote[it could very well be that Novartis landed on OCF$_2$Cl after trying to optimize the OCF$_3$ variant for say biological half-life. meaning, for an initial suggestion, it's a good candidate!] #### Extending to targets without known binders For targets without known binders we need a new success criteria, we can't just look at distance to the known binders. So let's dive into technical details and look at our definition of the binding score. :::definition **Binding Score** — a top binding pose suggested by DiffDock is passed through [ProLIF](https://prolif.readthedocs.io/en/stable/source/modules/interaction-fingerprint.html) fingerprinting utility which determines how many ionic interactions, H-bonds, or hydrophobic interactions:sidenote[there are a few more interactions reported by ProLIF, see [our code](https://github.com/batistagroup/ChemSpaceAL/blob/main/ChemSpaceAL/Configuration.py) for details.] are present between protein and a molecule. The **binding score** is calculated as a sum of these counts with custom weights (7 for an ionic interaction, 3.5 for H-bond, 1 for VdW contact:sidenote[these are roughly proportional to average free energies of such interactions]) ::: The predictive ability of this binding score is modest - the correlation between this score and the pKd (for targets in PDBBind) is 0.32. However, 99.6% of the protein-ligand pairs in PDBBind have a score above 11, and only 20% of the molecules generated by a baseline model score above 11. In other words, it's not necessarily true that the higher the score, the better the binder, but if your molecule scores below 11, it has very low chance of being a binder at all. So, for the Cas9 HNH runs, we treated all molecules scoring above 11 as high-scoring. ![](/static/images/research/chemspaceal/ligand-score-distribution.pdf) The figure above shows the evolution of the distribution of scores of 1000 molecules after each round of active learning. | method | number of dockings | training data (source & size) | performance (%>11) | | ------------------------- | ------------------ | ---------------------------------------- | ------------------ | | [A] naïve active learning | 5,000 | replicas of ~300 hits | 26% $\to$ 44% | | [B] uniform sampling | 5,000 | 300+5,000 sampled uniformly | 28% $\to$ 51% | | [C] ChemSpaceAL | 5,000 | 300+5,000 sampled from promising regions | **28% $\to$ 76%** | [B] is a control, in which the 1k molecules to be scored are sampled from clusters, but instead of sampling 5k extra molecules from high-scoring clusters, you sample 50 from each cluster uniformly. :sidenote[a more interesting control, in my opinion, would be to remove sampling from clusters altogether, but what do I know and Reviewer 2 insisted on this control.] As you can see from the numbers (and visually), our pipeline significantly improves upon naïve AL. The [paper](https://pubs.acs.org/doi/10.1021/acs.jcim.3c01456) contains quite a few extra details and nuances: - do you just sample from the cluster with the highest score? or from several clusters proportionately to their scores? we chose the latter, but there are still several ways to convert cluster scores to sampling probabilities. We try 3 options: linear, softdiv, and softsub (classical softmax):sidenote[softmax usually results in most molecules being sampled from 1 cluster, linear doesn't have a clear priority, and softdiv is something in between. Figure S21.1 in SI shows the difference between methods]. - how much do the individual interaction counts change during Active Learning (Figures S21.8-S21.12) - how much does the model generation capabilities (validity, novelty, uniqueness) degrade over AL cycles (Figure S23.1):sidenote[spoiler: validity keeps at 99%, uniqueness drops to 80% (you still can generate 100k unique molecules, you just might have to keep trying 125k+ times), and novelty actually increases] ## Beyond the Paper: Meta-Lessons This was my first ML paper and the first experience in building software for a non-trivial pipeline, so I made all the mistakes typical for a junior dev. ### Jupyter Notebooks are evil I'm almost ashamed:sidenote[actually, it's also kinda impressive] to write this, but the whole project was implemented in a Google Colab notebook. Yeah, I know. Needless to say, I've stopped using jupyter notebooks for anything but quick experiments or data exploration. For those who haven't gone through the same painful love-and-hate relationship with jupyter notebooks, here is a speedrun: #### Defined once, exists forever let's say you define some variable `smile` in a cell, try some things, then delete that cell. Until you restart the whole kernel, that variable will still exist in memory. and so when you create a new cell 30 min later and write: ```py for smiles in smiles_list: do_something() another_something() and_then_something(smile) ``` if you're tired enough, you might not notice that you made a mistake: last line should refer to `smiles` not `smile`. With a regular script, you'd get a runtime error. In a notebook however, the code will use the existing definition of `smile` from half an hour ago. No matter how dumb you think such mistake is and no mater how diligent you'll try to be, eventually you'll go through this process. #### They're slow running the code in jupyter notebooks could be 2-3x slower than from the shell:sidenote[in part as a direct consequence of all variables staying in memory and your RAM being cluttered with junk]. #### It's just a bad dev experience At some point you'll have too much code. Yes, you can hide cell content under spoiler, but good luck developing complex pipelines like this without search or click-to-go to function def:sidenote[like any normal IDE would allow you to]. And also you have to worry about scope, because if you define some variable:sidenote[you could see how this could backfire with some generic names like `molecules` or `smiles_list` that could be used at different stages of the pipeline] in Cell 3, that variable will be available in Cell 5, 10, and 20. #### It's a bad user experience I mean, you can just look at the procedure for starting next iteration of Active Learning (from README for ChemSpaceAL): > At this point, you have to go back to Cell 5, change `al_iteration=0` to `al_iteration=1`. Then: > > 1. Run Cells 6, 9, 11, 15, 19. > 2. Run Cell 21. The AL set loaded should have suffix `al0`, i.e. 1 smaller than what's now set in Cell 5 as `al_iteration=1`. > 3. Run Cell 22. As a sanity check, make sure that the weights loaded will be from previous iteration, and saved to the currently set iteration. > 4. Run Cell 23. despite looking like madness, for a pipeline in a jupyter notebook, it's actually a decent:sidenote[in my, not so humble, opinion] solution. In my prime, I could launch next iteration for 4 variants of the pipeline running in parallel in just 30 minutes. I could do that because the notebook was optimized to minimize the amount of manual interventions a user had to make. For example: to prepare active learning training set for iteration $i+1$, you need to provide a path to the file with generated molecules, a file with clusterings, and a file with scored molecules (and the scores). You have two UX choices: 1. Ask the user to manually specify those paths. After $i$ rounds of active learning, you'd have $i$ copies of such files (corresponding to each iteration), so a user would be expected to not mess them up:sidenote[running several pipelines (e.g. for different targets) in parallel would be even more challenging]. 2. Create formulaic names for those files that depend on key dynamic variables and the AL round. Option 2 seemed really preferable. And had we done everything as a proper python package that you execute through some scripts with some yaml config file, it'd have been perfect. However, because it was a jupyter notebook (in a Colab), you have to manually run all the "config" cells:sidenote[the path to scored files can only be constructed from the config for scoring step, which depends on the config for sampling step, which depends on the config for generation step] (step 1 from instruction above) that set up all the paths. So, once you get familiar with how the notebook works, the process is quite efficient and you only need a few Colab credits. But the learning curve is quite steep. :::insight The real lesson here is that you should learn to **build your research tools like production-grade software**. Just because you're a chemist (or other non-CS scientist) doesn't mean you're absolved from reading [CLRS](https://en.wikipedia.org/wiki/Introduction_to_Algorithms) or [6.031 notes](https://web.mit.edu/6.031/www/sp22/). And not just because that's the _right_ way, but simply because it'll make your life so much easier in the long run. ::: ### Tests are not optional I knew about the paradigm of test-driven development. I knew that `unittest` or `pytest` exist. I just didn't have a habit of writing tests:sidenote[I started taking CS classess too late to subject myself to [6.031](https://web.mit.edu/6.031/www/sp22/)], and maybe some part of me thought it only mattered if you're a real software engineer, not just some chemist writing scripts. This attitude backfired spectacularly. One notable example: at some point ProLIF changed the api for the key method, and we weren't careful enough to pin a specific version, and the error was handled silently, all ligands received identical scores. We thought something was wrong with fine-tuning or generation (because the changed happened after 4 perfectly working rounds of AL), so we spent quite some time debugging those parts before we looked at the scoring component. Had we had tests for all stages, we would have known where to look. ### The importance of research taste The Supplementary Information for our paper has 60 pages, most of which are filled with different figures. Why so many? Well, this is a complex pipeline, so you have to make so many choices: - what descriptors do you use? everything from RDKit? Why not add MQN descriptors?:sidenote[a question asked by one of the reviewers] - what value of $k$ do you choose for clustering? - the k-means++ is a stochastic seeding algorithm, meaning you can get slightly different partitions each time. do you run it once? or $N$ times? what is $N$? - how do you convert the cluster scores into sampling probabilities? linearly? with softmax? for some reason, I felt obligatory to investigate the impact of every moving part. But doing full scale optimization, one variable at a time, is simply prohibitively expensive. We ended up trying two choices of $k$ (10 and 100), running K-Means 100 times (and picking clustering with the smallest variance of cluster sizes), and trying 3 options for conversion of cluster scores into sampling probabilities. In hindsight, that was still too much. If I were to do it again, I'd just be much more brave to make a few subjective decisions and live with them. It does increase the risk (what if you make a poor choice), but the counterfactual would be drowning in the noise of optimization of tiny components that probably don't matter that much. The ability to make correct choices from first principles and based on intuition is what I'd call **research taste**. And you can only develop the intuition with experience of starting and completing projects. Point being, you'll probably make quite a lot of unnecessary moves in your research career, but as long as you keep track of which decisions paid off and which didn't, you'll probably get better. ## Access & Citation that's all for today, hope i made you curious enough to check out the paper (or at least the figures). - [**Preprint**](https://arxiv.org/abs/2309.05853) - [**Paper**](https://pubs.acs.org/doi/10.1021/acs.jcim.3c01456) - [**Code**](https://github.com/batistagroup/ChemSpaceAL) ### Cite As ```bibtex @article{chemspaceal, author = {Anton Morgunov and Kyro, Gregory W. and Brent, Rafael I. and Batista, Victor S.}, title = {ChemSpaceAL: An Efficient Active Learning Methodology Applied to Protein-Specific Molecular Generation}, journal = {Journal of Chemical Information and Modeling}, volume = {64}, number = {3}, pages = {653-665}, year = {2024}, month = {02}, doi = {10.1021/acs.jcim.3c01456}, addendum = {*A.M., G.W.K. and R.I.B. contributed equally. \href{https://github.com/batistagroup/ChemSpaceAL}{GitHub}} } ``` --- Title: Getting Coupled-Cluster Accuracy for the Price of MP2 Category: research :::tldr-tc $\Delta$MP2 calculation of core-electron binding energy calculated in a large basis set (or extrapolated to the CBS limit) corrected by the difference between $\Delta$CCSD and $\Delta$MP2 energy in the small basis set recovers $\Delta$CC CBS values within 0.02 eV. A meta-lesson: when benchmarking new methods, CEBEs for ionizations of different elements should be analyzed separately to look for element-specific trends. ::: :::tldr-chem You can calculate core-electron binding energy for 2nd row elements with the accuracy matching that of the most expensive methods (within 0.10-0.15 eV of experimental values) at significantly lower computational cost. Also, yet another example of [Simpson's paradox](https://en.wikipedia.org/wiki/Simpson%27s_paradox) in the wild. ::: :::tldr-public Imagine wanting a bespoke, custom-tailored suit (the most accurate quantum calculation) but only having the budget for an off-the-rack one (a cheaper method). Our work provides a set of precise, inexpensive tailoring instructions (a small correction) that makes the cheap suit fit almost identically to the bespoke one. this trick allows us to accurately model chemical systems that were previously too expensive to simulate ::: ## Primary Contributions ### Landscape & The Gap You’re probably familiar with UV-Vis spectroscopy, which measures electronic transitions between valence and virtual orbitals. In a similar fashion, X-Ray Absorption Spectroscopy (XAS) reports excitations of electrons from core orbitals (e.g. 1s orbitals for 2nd row elements), and X-ray Photoelectron Spectroscopy (XPS) measures energies (Core Electron Binding Energies, CEBEs) required to fully ionize those core orbitals. X-ray spectroscopy has several advantages: - electrons in core orbitals (unlike those in valence orbitals) are localized, so electronic transitions contain information about local environments of individual atoms - CEBEs are not just element-specific, they’re sensitive to the electronic environment (just like chemical shifts in the NMR spectroscopy). As a result, XPS can be used to infer oxidation states and coordination numbers of active centers in catalysis. While downstream applications (e.g. ultrafast chemical dynamics) employ XAS more frequently, the ability to accurately assess energy of the core orbital is required both for XAS (even if implicitly) and XPS, making the latter a more foundational challenge. #### Why can't we just use TDDFT? Ejection of a core electron results in a significant redistribution of electron density, so traditional linear response methods such as TDDFT exhibit errors of 10+ eV, whereas proper interpretation of experimental spectra requires errors below 0.2 eV. Errors can be reduced to 1-3 eV with the use of functionals specifically optimized:sidenote[such optimizations often mean fitting the functional to experimental data, which, as you might imagine, is a slippery slope] for core spectroscopy. Alternatively, one can use coupled-cluster based methods (EOM-CC) within Core-Valence Separation (CVS) approximation:sidenote[CVS is needed to avoid calculations of transitions from valence orbitals]. Unfortunately, CVS-EOM-CCSD only brings the mean absolute error (MAE) down to 1.75 eV, and you need CVS-EOM-CCSDT in quadruple-zeta basis to reduce it to 0.15 eV. CVS-EOM-CCSDTQ further reduces MAE to 0.07 eV. Accurate, but incredibly expensive!:sidenote[CCSD scales as $O(N^6)$, CCSDT as $O(N^8)$, CCSDTQ as $O(N^{10})$, where $N$ is the number of basis functions, which is roughly $30n$ and $50n$ for triple and quadruple-zeta basis sets, where $n$ is the number of atoms. and mind you, this is just the cost of a single iteration of CC, you might need 10-100 to reach convergence] An entirely different approach is to explicitly optimize the wavefunction of the core-ionized state to properly account for orbital relaxation effects. The CEBE can then be calculated as the difference between energies of core-ionized and ground states. Remarkably, even $\Delta$HF:sidenote[Hartree-Fock is the cheapest and simplest method in quantum chemistry. It's almost trivially naive: it assumes that movement of electrons doesn't affect each other.] calculates CEBEs within 1 eV, and $\Delta$MP2:sidenote[MP2 is relatively cheap, non-iterative way of correcting HF] brings errors down to 0.5 eV. #### Why not just massively parallelize CC? The coupled-cluster method is considered the golden standard of computational chemistry. So yes, it's expensive, but why not just write some CUDA kernels and let GPUs go brrr? Let's say you have a system with a core orbital $k$, valence orbitals $i,j$ and an empty orbital $v_a$. These energies are $\epsilon_k < \epsilon_i < \epsilon_j < \epsilon_a$. Let's say you want to find an energy after ionizing (removing one electron from) the orbital $k$. When you solve coupled-cluster equations (within, say, CCSD), you'll have to calculate so-called double transitions:sidenote[these transitions have nothing to do with exciting the molecule, it happens to be part of the normal process of calculating energy with CCSD] $t_{ij}^{ak}$ of the form: $$ t_{ij}^{ak} \propto \frac{1}{\epsilon_a + \epsilon_k - \epsilon_i - \epsilon_j} $$ because $\epsilon_k<\epsilon_{i,j}$, a combination of energies may (and often does) exist such that the sum in the denominator is near-zero, so $t_{ij}^{ak}$ explodes, and the whole procedure diverges. [Zheng and Cheng (2019)](https://pubs.acs.org/doi/10.1021/acs.jctc.9b00568) have shown that if you manually exclude such transitions and apply a few corrections, you can get accurate CEBE predictions. [Arias-Martinez et. al (2022)](https://pubs.rsc.org/en/content/articlelanding/2022/cp/d2cp01998a) proposed a few more systematic improvements and benchmarked the methods for 18 small organic molecules. ### The Key Insight To recap: we can get accurate CEBEs with $O(N^{10})$ methods that might suffer from convergence issues. Is there any chance we can get $\Delta$CC grade predictions from cheaper methods? The answer is yes. If you extrapolate the $\Delta$MP2 CEBEs to the complete basis set (CBS:sidenote[CBS limit is the true prediction you're supposed to get with a method on a true wave function, which is a linear combination of an infinitely-dimensional basis. We can't work with infinite basis sets in practice, so we have to extrapolate the results we get from basis sets of different sizes.]) limit and add a ($\Delta$CC-$\Delta$MP2) correction evaluated in a small basis, you can quantitatively recover $\Delta$CC energies in the CBS limit. ### Evidence and Impact ![](/static/images/research/mp2-cebe/bars_summary-no5.pdf) #### What This Figure Actually Shows The y-axis is the absolute value of the difference between predicted and experimental CEBE (smaller values is smaller error). x-axis shows a few methods. The gold-standard $\Delta$CCSD (extrapolated to the CBS limit, denoted by $\infty$ symbol) scores an average (over 94 CEBEs) error of 0.123 eV:sidenote[error bars show standard deviations of the MAE, in this case roughly 0.15 eV]. The CBS-extrapolated $\Delta$MP2 scores 0.28 eV, but if you add the correction (our method, shown by $\delta$), it's practically equivalent to the CCSD predictions. $\delta(D)$ is evaluated in a small, but still decent basis. 3-21G and STO-3G are laughably cheap #### Why This Is a Meaningful Improvement Basically, instead of doing $\Delta$CC calculations in a large basis set, you do a $\Delta$MP2 in a large basis, and a $\Delta$CC in a small one. | Method | Basis | Scaling | Practical Runtime | | ------------ | ----- | ------------------ | ----------------- | | $\Delta$MP2 | small | $O(N^5)$ once | 1 s | | $\Delta$MP2 | big | $O(N^5)$ once | 1 min | | $\Delta$CCSD | small | $O(N^6)$ iterative | 30 s | | $\Delta$CCSD | big | $O(N^6)$ iterative | 2.4 hrs | So instead of hours, you're done in 2 minutes. :::insight effectively, all of this rests on an observation that if you plot MP2 and CCSD energies as a function of basis set size, you'll get two curves that have the same shape, but are vertically offset. Meaning that $\Delta$CC-$\Delta$MP2 difference is the same in the CBS limit, in a large basis, and in a small basis. ::: The [paper](https://pubs.acs.org/doi/10.1021/acs.jpca.4c01606) has quite a few more interesting results on the nuances: - in theory, you perform CBS extrapolation from calculations in $2,3,4,5,6$-zeta basis sets. $5,6$ are often prohibitively expensive, and without them, adding 2-zeta results often makes extrapolations (on average) worse. However, for carbon-based core orbitals, the energies are 5x more accurate:sidenote[0.05 eV for CCSD extrapolated from $2,3,4$-zeta energies as opposed to 0.26 extrapolated from $3,4$-zeta] if you include the 2-zeta results:sidenote[in other words, if you evaluate by looking at all CEBEs without controlling for the element on which a core orbital is ionized, you might miss element-specific trends, which is a classical example of the [Simpson's paradox](https://en.wikipedia.org/wiki/Simpson%27s_paradox)]. This is an artifact of how the basis sets are constructed, but, nonetheless, is a practically important artifact: both if you want to predict CEBEs and if you want to benchmark a new method. - we investigate how results change if you vary the size of the "small" basis and the size of the "large" basis (or which basis sets are included in the extrapolation). For example, even MP2 in $4$-zeta corrected with $2$-zeta basis is pretty accurate! --- ## Beyond the Paper: Meta-Lessons ### All analysis must be automated When I started to bring my first results (the errors of different methods or some plots) to the weekly discussions, they were always taken axiomatically correct. In other words, no one double checked the accuracy of my calculations or plots, all discussion was predicated on data being correct and centered around the implications of that data. While I appreciated the trust, given that this was my first theoretical project, I couldn't help but panic: what if I make a small mistake when collecting values from the output file:sidenote[these are usually at least 3k line text files logging the progress of the calculation and all final results] and take the wrong number? What if I make some mistake when selecting values for plots or tables? This is especially concerning when your results are good—how do you prove it was an honest mistake, and not data manipulation? I quickly decided on a solution: every single piece of data manipulation should be written as a script that ingests from the source (in this case output file) and ends up with a final table or figure to be used in the paper (or any internal meetings). Now, obviously, you can still make a mistake in your script, but: - the mistake will be applied to all input values, which raises the probability of you noticing something is off - even if you never notice the mistake and someone finds it after you publish, it'll be very clear that it was a very subtle bug:sidenote[otherwise you would have noticed it yourself] and an honest mistake:sidenote[intentional data manipulation would require very obvious and illogical changes to the script algorithm] As a nice side bonus, this approach also significantly simplifies your research process. - Decided to add a few more data points? Recreating all tables and figures is just running a single `.py` file. (e.g. [perform_analysis.py](https://github.com/anmorgunov/cebe_prediction/blob/main/perform_analysis.py) in the CEBE repo) - Made a plot for $\Delta$MP2 and $\Delta$CC values but want to also add $\Delta$HF? Assuming you wrote a generic enough parser, all you need is adding another element to a list:sidenote[this is actually the story of Fig. 2 in the paper. it was easy to add $\Delta$HF and it turns out it's surprisingly accurate for O, N, and F-based CEBEs. If adding $\Delta$HF required manually collecting all energies manually, I probably would have hesitated doing that because it'd be reasonable to expect $\Delta$HF to be wildly inaccurate. another good lesson here—check if your assumptions hold whenever you can!]. And you'll get figures in exactly the same style as you had before, no need to manually adjust font size, positioning, colors, etc. Now, that _assuming_ is doing a lot of heavy lifting: the magnitude of benefits depends on the quality of the code you write, which might seem daunting; however, there's no better way to figure out how to do it than to actually start doing it. I think I refactored/rewrote my scripts for the CEBE project from scratch at least 3 times. And if I were to write it today, 18 months later, I'd do it completely differently. And that is great! ### Every figure should tell a clear story During the preparation of the manuscript, [Prof. Troy van Voorhis](https://vanvoorhisgroup.mit.edu/) gave me a great rule that I tried to live by ever since: :::insight every single figure in the paper should convey a clear and concise idea. the standard is that if you show it to anyone, they should be able to figure out the intended message without reading the paper. ::: let's take Fig. 1 as an example. ![](/static/images/research/mp2-cebe/methods_bars_all.pdf) let me bold and assume that the conclusions you draw are: - whatever leftmost basis is, it's bad - blue methods are a bit better than purple method - both are significantly better than green method, except for the leftmost basis, there the green bar is surprisingly accurate. - the cyan/blue don't seem to differ much which is pretty much exactly the same a domain expert would conclude, except they would say $\Delta$HF instead of the green method or $\Delta$CCSD(T) instead of the blue method. This all might seem too much of a common sense take, but in practice maximizing clarity of a figure often means sacrificing details or some nuances. For example, initially I intended to show extrapolated $\Delta$MP2 and $\Delta$CC energies on the same figure, which would have a benefit of showing how much the CBS extrapolation reduces the error, but would also make the figure too loaded. As a result, the extrapolated values were taken out into a separate Fig 4. --- ## Access & Citation that's all for today, hope i made you curious enough to check out the paper (or at least the figures). - [**Preprint**](https://arxiv.org/abs/2403.06364) - [**Paper**](https://pubs.acs.org/doi/10.1021/acs.jpca.4c01606) - [**Code**](https://github.com/anmorgunov/cebe_prediction) the code repository above contains all the data and scripts needed to recreate all tables and figures from the paper. I'm quite proud that other members of the [Batista Group](https://batistalab.com) have followed suit and started to include figure reproduction scripts in their projects (e.g. [CardioGenAI](https://github.com/gregory-kyro/CardioGenAI) by [Dr. Kyro](https://gregorykyro.com/), or [Quantum to Classical Transfer Learning](https://github.com/batistagroup/Quantum-to-Classical-Transfer-Learning) by Dr. Smaldone). If you're doing research, consider joining this little trend of ours. ### Cite As ```bibtex @article{mp2cebe, author = {Morgunov, Anton and Tran, Henry K. and Meitei, Oinam Romesh and Chien, Yu-Che and Van Voorhis, Troy}, title = {MP2-Based Composite Extrapolation Schemes Can Predict Core-Ionization Energies for First-Row Elements with Coupled-Cluster Level Accuracy}, journal = {The Journal of Physical Chemistry A}, volume = {128}, number = {33}, pages = {6989-6998}, year = {2024}, doi = {10.1021/acs.jpca.4c01606}, } ``` --- Title: How Oppenheimer saved chemistry from quantum mechanics? Category: long-form Today, we'll see how quantum mechanics questioned the very existence of chemistry as a science and how Oppenheimer, the _destroyer of worlds_, saved it. You might wonder why this topic should interest you. I suggest this as an answer: this article will show you why it's sometimes worthwhile to overcome fear and dive into topics which seem unapproachable. As an added treat, we'll also touch on the cutting-edge topics in chemistry. ## Meta-introduction Just so you're prepared, this article will feature daunting formulas and equations. This is a deliberate decision; I find it easy to believe in the phrase quoted by Hawking that every equation halves the book sales. While the absence of equations makes articles easier to comprehend, I think that also results in most of the popsci being too superficial (at least to my taste). Let's postpone the question of justifiability of having equations to the conclusion, and for now, let me just tell you what this article is about in a nutshell: 1. We'll start by describing what the reader most likely knows about chemistry and show how the fundamental objectives of chemistry can be formulated as a mathematical problem. 2. I will claim that the best tool for the solution of the postulated problem is quantum mechanics, and I'll share an example of its striking precision. 3. We will introduce two important tools of quantum mechanics: a comprehensive source of information (the wavefunction) and a magic wand (the operator) that will allow us to derive information from the wavefunction. 4. We'll see where the strict quantum mechanics leads and will find that we need to make some audacious assumptions for chemistry to even exist as a science. 5. We'll explore cases when those assumptions break down. 6. Lastly, we will analyze the implications of everything we will learn. All formulas and equations in the article will play the role of some kind of confirmation of the ideas above. You won't miss anything if you can't _understand_ the formulae; for the purposes of the narrative, it will be more important to see what we do with those formulae, i.e., what approximations we will make. In all cases, I will be clear about what is essential and what is not. This message is especially significant for high school students: you may be used to being in a situation in which by the time you start to learn a new topic, you are already familiar with all the prerequisites. So, when reading this article, you may think, "_well, I need to read more about linear algebra or quantum mechanics before I can read this post"_. This is a profoundly wrong approach; in real life, you will never be 100% ready, and you will never be able to fulfill all the prerequisites. You just have to be brave and see where curiosity takes you. Shall we? ## Part I. Fundamental questions of chemistry #### What is chemistry? What thoughts come to your mind when you hear the word _chemistry_? Perhaps you think of chemical transformations (combustion of wood, formation of precipitate); maybe you think of chemical formulae (those mysterious $\text{H}_2\text{O}$ or $\text{C}_6\text{H}_6$). Let's focus on the latter. You probably have met the structural representation of molecules (and if you were lucky enough to study organic chemistry, you probably drew them yourself). For example, structures like this: ![](/static/images/long-form/born_oppenheimer/img1-structures.png) It's peculiar that we sometimes don't realize how much information (in the form of implicit assumptions) can be hidden in a single picture. It may seem that the image above simply shows the structural formulae of water and benzene. But if we think about it, by drawing those molecules in that way, we imply that both oxygen-hydrogen bonds in the water molecule have the same and certain length, that there must be a certain angle between the two O-H bonds. Otherwise, how else can we explain that we draw the structures above and not, for example, the structures below: ![](/static/images/long-form/born_oppenheimer/img2-wrong-structures.png) But what determines bond lengths and the angle between them? High school chemistry offers the following reasoning: chemical bonds are formed when two atoms share electrons. A Coulomb attraction occurs between the electrons of one atom and the nuclei of the other atom. Simultaneously, there is a Coulomb repulsion among the electrons and among the nuclei. The balance of these two forces determines the equilibrium distances and angles. We can accept this argument, and let's note that we can plot the dependence of the (potential) energy (we will denote it as $V$) on the interatomic distance $R$ for diatomic molecules (you may have already seen this graph). ![](/static/images/long-form/born_oppenheimer/img3-pes-en.svg) If we do not limit ourselves to diatomics, we obtain the dependence of the potential energy $V$ on all independent parameters characterizing the structure of the molecule. For example, if we assume both $\text{O-H}$ bonds in a water molecule have the same length, then for an unambiguous description of the water's structure, we need to specify the length of this bond $R$ and the angle between the two bonds (let it be $\theta$). As a result, we get the dependence $V(R, \theta)$, shown in the graph below. We call this surface the **potential energy surface (PES)**. Similar surfaces (called hypersurfaces in multidimensional space) exist for multi-atomic molecules, but visualization becomes difficult as the number of structural parameters increases. ![](/static/images/long-form/born_oppenheimer/water_pes_en.svg) The assumptions we make while drawing molecular structures can be formulated as statements describing this surface. For example, this surface must have a minimum, i.e., a point at which the potential energy is minimal:sidenote[why minimum? Because Coulomb repulsion has a positive sign and attraction has a negative sign. Decreasing the number of repulsive and increasing the number of attractive interactions is equivalent to finding a lower energy.]. The location of this point determines the geometry of our molecule. Thus, the search for the optimal structure of a molecule is reduced to the search for the minimum of a particular function. ### Electronic orbitals Now, let's talk about chemistry as the science of change. A chemical reaction can be described as the process in which chemical bonds break and form. But what creates a chemical bond? Sharing of electrons. And where are electrons located? In orbitals. As part of the school curriculum, you will most likely stop at pictures of atomic orbitals: ![](/static/images/long-form/born_oppenheimer/all_aos.jpg) The picture above shows, from left to right, top to bottom, the shapes of the $1s, 2s, 2p, 3s, 3p, 4d$ orbitals of the hydrogen atom. By the way, that caveat about the "hydrogen atom" is not accidental at all. It may be surprising, but we know the exact shape of the atomic orbitals (AO) only for the hydrogen atom. We only _assume_ that the shapes of the AOs of other elements are similar to the AOs of hydrogen. Back to our discussion, one might wonder, where are the electrons in molecules? It shouldn't be too shocking to hear that they reside in molecular orbitals (MOs). Molecular orbitals look like this: ![](/static/images/long-form/born_oppenheimer/img5-molecular-orbitals.jpg) :::note Click on the following to links to see some orbitals of the $\sigma$-system and orbitals of the $\pi$-system of the benzen in an interactive figure. ::: You may wonder how does one find out the shape of MOs? This question is more complicated than it seems. There is no reason why MOs should be similar to AOs, but we feel justified in _assuming_ that they should be similar. Therefore, the primary method for finding the shape of MOs is the so-called Linear Combination of AOs (LCAO method). Simply put, MOs are formed by adding and subtracting AOs with (potentially) different coefficients. The result can be represented in the form of an MO diagram: ![](/static/images/long-form/born_oppenheimer/img6-mo-diagram-en.svg) Thus, the problem of finding molecular orbitals' shape is reduced to finding the coefficients by which we multiply the AOs before we add them up. ### Formalizing fundamental questions in chemistry We can formulate the ideas described in the two sections above as two fundamental problems of chemistry: 1. Finding the optimal structure of a molecule given the PES. In other words, we know how electrons are attracted to nuclei and repelled from other electrons, and our task is to find such a three-dimensional shape of the molecule that minimizes repulsions and maximizes attractions. 2. Search for optimal molecular orbitals for a particular molecular geometry. The whole procedure of searching MOs described above was conducted for one fixed geometry of the molecule. If we change any of the bond lengths or any of the angles, the MOs will change. Hold on. The shape of the potential energy surface depends on the interactions of electrons with nuclei and other electrons. These interactions depend on where the electrons are located. However, the arrangement of electrons (their orbitals) depends on how the nuclei are arranged. We get a cyclic dependency. What can we do? For now, we can only state that the problems described above are not independent and, thus, cannot be solved separately. ## Part II. The predictive power of quantum mechanics The most accurate way to describe the structure of atoms (and molecules) is presented by quantum mechanics. But before we move on to using the tools of this theory, it is worthwhile to understand why the scientific community accepts (and maybe even _believes in_) quantum mechanics. After all, the ideas of corpuscular-wave dualism and substitution of the exact location of electrons in orbits with probability distributions may sound (to put it mildly) questionable. ### The accuracy of quantum mechanics A physical model is correct when it agrees with the experiment (or, even better, can predict its results). The experimental value of the ionization energy of the helium atom is $5\;945\;204\;238(45)$ MHz (the error is given in parentheses). The solution to the [Schrödinger equation](https://en.wikipedia.org/wiki/Schrödinger_equation) predicts $5\;945\;262\;288.62(4)$, but this is not the final answer, just a starting point. If we take into account the non-zero size of nuclei, relativistic effects (dependence of mass on velocity), spin-orbit interactions, and polarization of vacuum (using [quantum electrodynamics](https://en.wikipedia.org/wiki/Quantum_electrodynamics)), we have: $$ \begin{align} \text{Theory: } &5\; 945\; 204\; 223(42) \\ \text{Experiment: } &5\; 945\; 204\; 238(45) \end{align} $$ As we see, quantum theory predicts the value of energy with, without exaggeration, triumphant accuracy. Even more strikingly, the result of theoretical calculations is limited by the precision with which we know the mass of the helium atom (it is determined experimentally). And we know it with only twelve (12) [significant figures](https://en.wikipedia.org/wiki/Significant_figures). _Theory will only take you so far_, but one can only envy such _so far_. The theoretical prediction of the ionization energy is taken from [a 2001 paper by Vladimir Korobov and Alexander Elkhovsky](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.87.193003). ## Part III. Schrödinger equation One of the most important equations of the quantum theory can be written using four symbols: $\mathcal{{\hat{H}}} \Psi = E \times \Psi$. Here is how you can understand it: - there is some (mathematical) object that contains all the information about the system (e.g., an atom or a molecule). This is the wave function $\Psi$. - all physical characteristics we are interested in (including energy $E$) can be obtained by subjecting this source of information to certain transformations through the influence of operators (for example, the Hamiltonian operator $\hat{H}$ if we are interested in energy):sidenote[This is why you can't "divide by" $\Psi$ in the equation: there is no multiplication sign between $\hat{H}$ and $\Psi$, what is implied is the the effect of $\hat{H}$ on $\Psi$.]. Let's focus on each ingredient individually. ### Source of information (wave function) As we defined above, the wave function is almost a magical object containing information about the system. If we are talking about a molecule, then surely this object must depend on the arrangement of all electrons ($\mathbf{r}$) and nuclei ($\mathbf{R}$). That is, our magic object is a function $\Psi(\mathbf{r}, \mathbf{R})$. This wave function, which depends on the arrangement of electrons and nuclei, can be decomposed:sidenote[Remember in math, you learned about vectors? In two-dimensional space, a vector can be represented as $\vec{v} = 2\hat{i} + 3\hat{j}$. This notation can be broken down into two conceptual components: we have some set of objects (vectors $\hat{i}, \hat{j}$) through which any other vector can be expressed, and there are coefficients governing this expression. It may be hard to believe it, but functions can be considered vectors in space with the number of dimensions equal to infinity. Practically, it means that any function can be represented as a sum (with coefficients) of an infinite set of functions (analogous to $\hat{i}, \hat{j}$). This infinite set of functions is called a basis.[^vector-expansion]] into an infinite sum of the product of two functions, each of which separately describes either electrons or nuclei: $$ \begin{align} \Psi(\mathbf{r}, \mathbf{R}) &= \sum_{k=0}^{N=\infty} \sum_{l=0}^{N=\infty} c_{kl} g_k(\mathbf{r}) h_l (\mathbf{R}) \\ &= \sum_k^{N=\infty} g_k(\mathbf{r}) \left[\sum_{l=0}^{N=\infty} c_{kl} h_l (\mathbf{R})\right] = \sum_k^{N=\infty} g_k(\mathbf{r}) f_k(\mathbf{R}) \end{align} $$ Where we redefine the function $f_k(\mathbf{R})$ through the sum of functions $h_l(\mathbf{R})$ to have a summation not on two coordinates but on just one. We can understand this equation through the following analogy: $g_k(\mathbf{r})$ and $h_l(\mathbf{R})$ are sort of the simplest elements from which we get the wave function of the whole system using addition (with certain coefficients). If we consider $\Psi$ as a kind of "molecule," the functions $g_k(\mathbf{r})$ and $h_l (\mathbf{R})$ are the constituent "atoms" (mathematicians will call them "basis functions"), and the coefficients $c_{kl}$ show the importance of these "atoms." Further algebraic transformations are done purely for pragmatic purposes. Remember in the first part we said that we only know the exact form of the AO for the hydrogen atom? In fact, we can use the AO of hydrogen to describe any molecule exactly because wave functions can be decomposed into a sum of basis functions, and the set of hydrogen AOs forms a complete basis of the function space. In other words, any function can be represented by the sum (with coefficients) of hydrogen AO functions. The decomposition above is exact when $N=\infty$, but it's not hard to guess that working with an infinite set of functions is... a bit hard. It turns out that you can make life a little easier by adding a parametric dependence on $\mathbf{R}$ to $g_k$. What is parametric dependence? It means that depending on $\mathbf{R}$, the shape of the function itself changes. For this arrangement of nuclei, we have this electron arrangement function. And if the nuclei move here, the function becomes different. The end result is: $$ \begin{align} \Psi(\mathbf{r}, \mathbf{R}) = \sum_{k=0}^{N} \psi_k(\mathbf{r}; R) f_k(\mathbf{R}) \end{align} $$ Where we denote the parametric dependence after the semicolon. This decomposition is still accurate only in the limit $N\to\infty$, but due to this parametric dependence, if we take a finite number of $N$, our accuracy will be slightly higher than before. The function $\psi_k(\mathbf{r}; R)$ is the electron wave function and describes, you won't believe it, electrons. The function $f_k(\mathbf{R})$ represents the rotational and vibrational motions of nuclei. :::note The whole text above attempts to explain where this decomposition (4) comes from. To get to the conceptual conclusions of the article, it is not as important to understand how we arrived at this decomposition as to understand what we will do with it subsequently. ::: ### Transformations to recognize energy In high school physics, we learn that the energy of a system can be contained in two forms: potential energy and kinetic energy. Similarly, in quantum mechanics, there are transformations (operators) that allow us to find the kinetic energy, and separately, there are operators that enable us to find the potential energy. Let's try to enumerate forms of energy or interactions found in a diatomic molecule: - kinetic energy of the first nucleus ($a$) - kinetic energy of the second nucleus ($b$) - kinetic energy of electrons (let's denote each one by $i$; there are $n$ in total) - Coulomb repulsion of nuclei - Coulomb attraction of electrons to the first nucleus - Coulomb attraction of electrons to the second nucleus - Coulomb repulsion of electrons The total energy must be the sum of these components. Let's write down these energies in the language of quantum mechanics: $$ \begin{align} \mathcal{\hat{H}} &= -\frac{\hbar^2}{2M_a} \Delta_a -\frac{\hbar^2}{2M_b} \Delta_b - \sum_{i=1}^n \frac{\hbar^2}{2m} \Delta_i + V \\ V &= \frac{\mathcal{Z}_a \mathcal{Z}_b e^2}{R} - \mathcal{Z}_a \sum_i \frac{e^2}{r_{ai}} - \mathcal{Z}_b \sum_i \frac{e^2}{r_{bi}} + \sum_{i