A latent distribution represents an input molecule with a probability distribution over hidden variables rather than a single fixed point. In a molecular variational autoencoder, an encoder reads a tokenized SMILES string and produces distribution parameters such as the mean μ and log-variance. Sampling from those parameters yields a latent vector z that summarizes the molecule for generation. section 10.4.3 section 10.4.5
The latent distribution connects molecular encoding, generation, and training:
- A bidirectional GRU processes the complete SMILES sequence in both directions and summarizes its dependencies. section 10.4.3
- Linear projections convert the encoder summary into parameters for the latent distribution, enabling reparameterized sampling of z. section 10.4.5
- A unidirectional GRU decoder receives z and generates the output SMILES string one token at a time. section 10.4.3
- Training combines reconstruction loss with KL-divergence regularization; cyclical annealing helps prevent the decoder from ignoring z through posterior collapse. section 10.4.5
Molecular generation pipeline
A VAE-CYC implementation tokenizes a molecule with SmilesPE, encodes it with a bidirectional GRU, projects the summary to a latent distribution, samples z, and decodes z with a unidirectional GRU. New molecules are generated by sampling latent vectors from the prior and decoding them, then evaluating validity, uniqueness, novelty, and diversity. section 10.4.5
Figure 10.8 Bidirectional RNN Encoder Architecture for VAE-CYC. The encoder processes input molecules by first converting them from chemical structure to SMILES representation, then through an embedding layer that converts text to numerical vectors. A multi-layer bidirectional RNN encoder processes the sequence in both forward and backward directions. The final hidden states from both directions are concatenated and passed through a linear projection layer to generate latent distribution parameters. These parameters, combined with random noise through the reparameterization trick, produce the final latent vector representation of the input molecule.

Trace how chemical structures become SMILES tokens, bidirectional hidden states, latent distribution parameters, and sampled molecular representations. section 10.4.5
