Module · RephoBayesian · Multi-objective · Closed-loop

The next experiment, chosen by the surrogate — not by intuition.

Rephois MolTrace's reaction-optimization module — it uses Bayesian optimization to recommend the next experiment to run.

Bayesian acquisition over a live Gaussian-process surrogate proposes the conditions most worth trying next — under hard constraints from your spectroscopy evidence and regulatory framework. The loop is half-closed by design: Repho proposes, a chemist approves, and nothing executes on its own.

Why this exists

Trial-and-error is expensive — and silent about what it missed.

A typical process-chemistry campaign often runs dozens of reactions to find a robust optimum. Many of those reactions are wasted — they sample regions the team already knew were bad, or repeat conditions a previous campaign explored two years ago and forgot.

At the same time, regulatory burden is climbing. Every condition tried is a potential data point that needs to be traceable. Every impurity that crosses an ICH limit is a campaign-restart event. Spreadsheet-tracked reaction histories can't withstand inspection — and don't survive the analyst who wrote them.

Repho runs the acquisition function in your stead. It remembers every prior campaign, respects every active regulatory constraint, and proposes the experiment most likely to advance the Pareto frontier — with an auditable trail of why.

The optimization loop

Seven stages, looping until the surrogate converges.

Each round emits a typed Pydantic record. The surrogate state, the acquisition proposal, the measured outcome, and the human decision are all recipe-hash-linked so any prior campaign replays bit-identically.

  1. 01

    Define

    Set the design space: input variables (solvent, temperature, equivalents, time, catalyst loading), discrete or continuous bounds, encoded categoricals. The same Pydantic model the backend's ConditionDomain consumes.

    Emits

    design_space · variable_bounds · categoricals

  2. 02

    Constrain

    Hard limits from Regentry auto-load: ICH Q3C residual-solvent ceilings, Q3D PDE limits, M7 nitrosamine alerts. Plus safety + cost guardrails from your operational profile.

    Emits

    objective_profile · cost · safety · regulatory_priors

  3. 03

    Propose

    Bayesian acquisition over a Gaussian-process surrogate. Expected Improvement (single objective), upper confidence bound for exploration, and constraint-aware ranking sliced into batches. Multi-objective campaigns surface a deterministic Pareto front. Reproducible — same seed, same batch.

    Emits

    recommendation_batch · acquisition_score · expected_improvement

  4. 04

    Run

    A chemist approves the proposed batch and runs it in the lab. Recipe + parameters pinned by recipe-hash; cross-modal evidence pulled in automatically when the batch finishes. Repho executes nothing itself.

    Emits

    run_id · recipe_hash · operator · timestamp

  5. 05

    Measure

    Spectroscopy evidence lands automatically. Yield, purity, selectivity, impurity profile, residual solvent — all per-condition, all hyperlinked to source spectra.

    Emits

    yield · purity · impurity_set · ee · spectra_uris

  6. 06

    Update

    Surrogate refit with the new observation. Posterior mean + variance over the design space recompute. Constraint-aware: violated points get masked out before the next proposal.

    Emits

    posterior · constraint_mask · pareto_set

  7. 07

    Decide

    Continue, stop, or pivot. Stopping rules built in: hypervolume convergence, budget exhaustion, hyper-parameter saturation. Human reviewer signs every campaign decision into the audit ledger.

    Emits

    decision · rationale · reviewer · audit_event

At a glance

     ┌─►  Define design space  ──►  Constrain (regulatory + safety + cost)
     │                                            │
     │                                            ▼
  Decide (stop / pivot / continue)         Propose (acquisition over GP surrogate)
     ▲                                            │
     │                                            ▼
  Update surrogate posterior  ◄──  Measure  ◄──  Run (manual or closed-loop)
        with constraint mask          (spectroscopy auto-attaches)

Methods we ship

Four optimization regimes. One typed API.

Switch regimes by argument — the design-space + objective + constraint contract stays identical across all four. The backend uses run_bayesian_optimization() with the same acquisition_score + expected_improvement fields.

BO

Bayesian Optimization

Single-objective · model-based

  • Gaussian-process surrogate with Matern / RBF kernels
  • Expected Improvement (EI) + UCB acquisition
  • Categorical encoding for solvents, catalysts, additives
  • Reproducible by seed — same campaign re-runs deterministically in the same environment
  • Backend: run_bayesian_optimization() · acquisition_score
MOBO

Multi-Objective Bayesian Optimization

Pareto-frontier · batch-aware

  • Yield × purity × cost × impurity-load trade-off
  • Deterministic Pareto front + hypervolume indicator (pure NumPy)
  • Batch recommendations — propose N reactions at once
  • Pareto-set visualization with non-dominated frontier
  • Diversity penalty against redundant proposals
AL

Active Learning

Uncertainty-driven · explore + exploit

  • Variance-weighted sampling for under-explored regions
  • Curiosity-driven probes inside safety guardrails
  • Useful for discovery campaigns, not optimization
  • Integrates with literature priors + predicted-shift models
  • Stops automatically when surrogate variance plateaus
HCL

Half-Closed Loop

Human-gated · propose, approve, run

  • Repho proposes the next batch; a chemist approves before anything runs
  • Spectroscopy evidence flows back in automatically once a batch is measured
  • Every proposal and decision is attributed in the audit ledger
  • Reviewer signs each campaign decision, not just pivots
  • Autonomous execution is not wired — no arm, run-step, or abort surface exists

Use cases shipped

Six campaign templates, with inputs and outputs.

Each is a typed pipeline you parameterise — not a bespoke build. The same acquisition engine drives every template; the differences are in design-space encoding and objective weighting.

Reaction screening

Hit-finding across solvent / base / catalyst combinatorial space. Discrete-categorical Bayesian search with diversity-aware proposals.

Inputs

Categorical design space · screening budget

Outputs

Top-N hits · uncertainty bounds · suggested follow-up

Yield + selectivity optimization

Continuous-variable optimization over temperature, equivalents, residence time. Multi-objective when selectivity matters as much as yield.

Inputs

Continuous bounds · objective weights

Outputs

Pareto frontier · best-by-objective conditions

Impurity suppression

Regulatory-Hub impurity limits become hard constraints. Optimizer proposes only conditions predicted to clear ICH Q3A/Q3B thresholds.

Inputs

Impurity limits from regulatory · prior runs

Outputs

Compliant conditions · constraint-aware ranking

Cost-aware development

Cost surrogate co-trained alongside yield. Proposes the cheapest condition that still hits the objective — useful for late-stage process work.

Inputs

Reagent unit costs · time budget · operator load

Outputs

Cost-Pareto frontier · sensitivity report

Conditions for scale-up

Optimizes for robustness at scale: temperature insensitivity, mixing-time tolerance, work-up reproducibility. Variance-weighted objective.

Inputs

Lab-scale data · scale-up risk profile

Outputs

Robust conditions · sensitivity heatmap

Method-development DOE

HPLC method dev, work-up optimization, crystallisation polymorph search. Same engine, different objectives — purity + recovery + crystal habit.

Inputs

Design variables · purity targets

Outputs

Method parameters designed to support Q2(R2) validation

Anatomy of a campaign

Five rounds. One Pareto frontier. One audit ledger.

The campaign below is the worked example threading through every module page — acetic-acid impurity suppression. Round 4 violates the Q3C constraint mid-flight; Round 5's acquisition mask routes around it.

bayesian_optimization_run · run_4f7a · 5 rounds · convergence reached

RoundAcquisitionProposedMeasuredStatus
R01Latin Hypercube · seedT 25 °C · 1.2 eq · DCM · 4 hyield 41% · imp 3.2% · cost lowExplore
R02EI · α 0.84T 50 °C · 1.5 eq · DCM · 6 hyield 67% · imp 1.8% · cost lowExploit
R03Pareto-front batch · k=3T 65 °C · 1.5 eq · MeCN · 8 hyield 74% · imp 1.1% · cost midExploit
R04UCB · β 1.6T 80 °C · 2.0 eq · MeCN · 4 hABORT · imp 5.8% > Q3C capConstraint
R05EI · constrainedT 60 °C · 1.8 eq · MeCN · 6 hyield 81% · imp 0.7% · cost midBest so far

Yield trajectory · convergence after constraint mask

  R01  ████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░  41 %   explore
  R02  █████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░  67 %   exploit
  R03  ██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░  74 %   exploit
  R04  ██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░  ABORT  Q3C limit exceeded
  R05  ████████████████░░░░░░░░░░░░░░░░░░░░░░░░  81 %   best · constraint-aware

  Pareto best   81 % yield  ·  0.7 % impurity (Q3C compliant)  ·  mid cost
  Stop reason   hypervolume Δ < 0.01 over last 2 rounds

The honest comparison

What changes when the surrogate picks the next experiment.

Trial-and-error campaigns aren't bad — they're under-instrumented. Repho keeps the chemist as the decision-maker but moves the experiment-selection step from gut to acquisition function.

DimensionTrial-and-errorRepho
Experiment selectiontoday

Intuition + last-week's lab meeting + grad-school heuristics

with Repho

Acquisition-function-driven · Expected Improvement over the live surrogate

Constraint handlingtoday

Hope the operator remembers the impurity limit · catch in QC later

with Repho

Hard constraint at proposal time · violated points masked before the optimizer ever sees them

Batch parallelismtoday

One reaction at a time · serialised round-trip on the bench

with Repho

Batch proposal of N diverse runs · plate-aware suggestions

Replay 6 months latertoday

Lab notebook + memory · 'we tried that, didn't work, can't remember why'

with Repho

Recipe-hash replay · reproducible from the pinned recipe-hash

Stopping decisiontoday

Run until budget runs out · or until someone gets frustrated

with Repho

Hypervolume convergence · explicit stopping criteria · auditable decision

Cross-module evidencetoday

Yield in a spreadsheet · impurity in a PDF · cost in an email

with Repho

One typed record per round · spectra hyperlinked · cost + impurity + audit entry together

Three pillars, one loop

The whole platform, on one acetic-acid impurity.

Picking up the cross-module worked example from Spectroscopy + Regentry — here's the role Repho plays when the impurity threshold is crossed mid-campaign.

  1. Spectroscopy says

    Round 4 shows acetic acid impurity at 2.10 ppm climbed to 5.8% — over the ICH Q3C Class 3 informational threshold for this drug substance.

  2. Regentry routes

    Constraint flips from 'informational' to 'hard limit' for subsequent rounds. Repho receives the new constraint vector via the typed cross-module API.

  3. Repho reacts

    Surrogate masks the violating region. Round 5 acquisition function only proposes conditions predicted to keep acetic acid below 2%. Result: 81% yield, 0.7% impurity.

  4. Audit ledger records

    Cross-module handoff captured as a single audit_event with full provenance. Inspector can replay every decision from FID hash to recipe update.

Trust & reproducibility

Bayesian, yes. Black-box, no.

Every campaign is replayable from any prior date. Every proposal is acquisition-attributed. Every pivot is signed. The surrogate is a tool — the chemist is the decision-maker.

  • Seed-reproducible campaigns

    Same design space + same seed + same observations are designed to yield the same proposals. Recipe-hash-linked surrogate state pinned per round.

  • Constraint-aware by design

    Regulatory limits, safety thresholds, and cost ceilings enter the optimizer as hard constraints — not soft hints. Proposals are masked against known limits before they reach you.

  • Human signoff per pivot

    AI proposes batches. Humans approve campaigns. Every pivot (stop, continue, escalate) is signed and recorded with reviewer + role + rationale.

  • Safety abort wired live

    Closed-loop campaigns include live sensor streams. Out-of-bounds temperature / pressure / off-gas triggers immediate abort + ledger entry.

  • Spectra linked per round

    Every measured outcome carries the SpectraCheck SHA-256 of the source spectrum + the regulatory verdict + the cost line — one row, full provenance.

  • Campaign replay from any prior date

    Re-derive any historic Pareto front, any historic proposal, any historic decision from any prior date. Deterministically reproducible from the pinned recipe-hash and seed, same-environment.

Bring us a stalled campaign.

Pick a reaction where you've already run 30+ conditions and can't tell what to try next. We'll show you the Pareto frontier Repho would propose — with your regulatory constraints already enforced.

FAQ

Frequently asked questions about Repho

What optimization methods does Repho use for reaction optimization?

Repho runs Bayesian optimization over a Gaussian-process surrogate, using Expected Improvement and upper-confidence-bound acquisition, plus random-forest and TPE-style alternatives. Multi-objective campaigns produce a deterministic non-dominated Pareto front with a hypervolume indicator, computed in pure NumPy.

Does Repho calculate green chemistry metrics like E-factor and PMI?

Yes. Repho computes Sheldon E-factor (simple and complete), Trost atom economy, process mass intensity (PMI), reaction mass efficiency, and a CHEM21-derived solvent green-score deterministically from RDKit and transparent arithmetic — no model produces the numbers. Each is selectable as an optimization objective alongside yield and selectivity.

Can Repho design HTE or DoE plates for lab robotics?

Yes. Repho generates a deterministic 24-, 96-, or 384-well plate over a project's design space using Sobol or Latin-hypercube space-filling, full-factorial enumeration, or a Bayesian-optimization seed set, honoring fixed conditions and excluded combinations. Plates are reproducible per seed and export to CSV/JSON for lab robotics.

How does Repho enforce ICH impurity limits during optimization?

Impurity action items from a Regentry dossier (for example ICH Q3A/B or Q3C limits) are injected as reaction constraints, and recorded experiment outcomes are evaluated against those limits with provenance back to the source action item. A high or critical limit flags an experiment as exceeding the limit; lower tiers apply an advisory penalty. This is decision support, not batch disposition.

Does Repho run experiments on its own or is it fully autonomous?

No — Repho is decision support and human-gated; nothing auto-executes. Its half-closed design-make-test-analyze loop only proposes the next batch as a draft cycle, which still requires qualified human sign-off and a cleared structural-safety gate before any execution. An optional advisor agent can plan and narrate but never computes a quantitative value.

Is Repho's reaction optimization reproducible and audit-ready for regulated work?

Repho campaigns are designed to be reproducible from a pinned recipe-hash and seed in the same environment, and every proposal, measured outcome, and human decision is written to MolTrace's tamper-evident audit ledger. The controls are built to support 21 CFR Part 11 and GAMP 5 workflows; MolTrace does not claim the product is itself compliant or validated.