A computer-implemented method for generating a prediction of a set of a plurality of predicted reactants (122, 212) that are combinable to generate a target compound (112, 214), the generating comprising: processing, for each of a plurality of candidate sets of reactants, a network input characterizing the candidate set using a neural network (130, 200), the network input being generated from (i) data identifying the target compound and (ii) data identifying the candidate set of reactants, the processing comprising: processing the network input using a first subnetwork (210, 310) to generate a predicted prior probability of the candidate set of reactants according to a data distribution of sets of predicted reactants and target compounds; processing the network input using a second subnetwork (220, 320) to generate a predicted conditional probability of the target compound conditioned on the candidate set of reactants according to the data distribution; processing the network input using a third subnetwork (230, 330) to generate a predicted conditional probability of the candidate set of reactants conditioned on the target compound according to the data distribution; determining, for each candidate set of the plurality of candidate sets, a score using the generated probabilities; and selecting a particular candidate set of one or more reactants using the determined scores. processing, for each of a plurality of candidate sets of reactants, a network input characterizing the candidate set using a neural network (130, 200), the network input being generated from (i) data identifying the target compound and (ii) data identifying the candidate set of reactants, the processing comprising: processing the network input using a first subnetwork (210, 310) to generate a predicted prior probability of the candidate set of reactants according to a data distribution of sets of predicted reactants and target compounds; processing the network input using a second subnetwork (220, 320) to generate a predicted conditional probability of the target compound conditioned on the candidate set of reactants according to the data distribution; processing the network input using a third subnetwork (230, 330) to generate a predicted conditional probability of the candidate set of reactants conditioned on the target compound according to the data distribution; processing the network input using a first subnetwork (210, 310) to generate a predicted prior probability of the candidate set of reactants according to a data distribution of sets of predicted reactants and target compounds; processing the network input using a second subnetwork (220, 320) to generate a predicted conditional probability of the target compound conditioned on the candidate set of reactants according to the data distribution; processing the network input using a third subnetwork (230, 330) to generate a predicted conditional probability of the candidate set of reactants conditioned on the target compound according to the data distribution; determining, for each candidate set of the plurality of candidate sets, a score using the generated probabilities; and selecting a particular candidate set of one or more reactants using the determined scores.