← Questions

Predict the reaction factor of two molecules

0
GoogleAI/ML designLast asked Sep 2025

An AI/ML design interview question asked in Google's first round (coding), last asked Sep 2025. It tests regression, feature engineering and transformers.

You get a table of chemical reactions with three columns: molecule1_name, molecule2_name and a real-valued reaction_factor. Build an end-to-end approach that predicts the reaction factor for a new pair. Walk through exploring the data, turning molecule names into features, splitting the data so the evaluation is honest, choosing and training models, improving generalisation, and running it in production. Expect quick probing questions on any architecture you propose.

Requirements

  • Functional: predict reaction_factor for any pair, including pairs and molecules never seen in training, with an uncertainty estimate.
  • Non-functional: an evaluation that reflects how the model will be used; reproducible training; results scientists can trust and inspect.

Clarifying questions

  • How many rows and distinct molecules? How many molecules appear in only a few reactions?
  • Will predictions be needed mainly for new pairs of known molecules, or for brand-new molecules?
  • Is the reaction symmetric, so A + B should equal B + A?
  • Are measurement conditions (temperature, solvent) recorded, and how noisy are repeat measurements?
  • Can names be mapped to structures (SMILES, InChI)?

What a strong answer covers

  • Exploration: the label distribution and outliers, missing values, duplicates, the same reaction listed in reversed order, name normalisation (synonyms, casing), and leakage through duplicates.
  • Representations: names looked up to structures, then descriptors and fingerprints (for example from RDKit), learned embeddings, or molecular graphs. Pair features that respect symmetry: sums and products of the two vectors, or a symmetric model.
  • Splits and what each measures: random (optimistic), grouped by molecule or leave-one-molecule-out (cold start), scaffold-based (new chemistry), time-based. Pick the one that matches the use case and justify it.
  • Models in order: a linear baseline, gradient-boosted trees on descriptors, then an MLP, a graph neural network or a transformer over SMILES; why the simple ones go first and how each handles unseen molecules.
  • Training and evaluation: MAE, RMSE and R², cross-validation with the chosen grouping, error analysis by molecule family and by how often a molecule appears.
  • Generalisation: regularisation, ensembling, SMILES enumeration as augmentation, pretraining on large unlabelled molecule sets; calibrated uncertainty for out-of-domain pairs.
  • Production: a feature pipeline shared by training and serving, versioned data and models, drift monitoring, and retraining when new measurements arrive.

Follow-ups

  • Half the molecules in a new batch were never seen. What do you expect, and how would you show it beforehand?
  • How does attention in your transformer handle two molecules? How would you make the model symmetric by construction?
  • Which new experiments should the lab run to improve the model most (active learning)?

Where it's asked

  • Google · First round: coding · Last asked Sep 202545 min · Coding in a Google Doc, no syntax highlighting or autocomplete · No AI

What it tests

regression · feature engineering · transformers

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing