An embedding is a learned numerical vector that represents an object for a task. In drug discovery, embeddings can represent a molecular token, an entire molecule, a protein residue, or a graph. What the vector captures depends on the model and how it is trained. section 10.2.3 section 11.5.1 section 12.3.2
For a molecular autoencoder, a SMILES string—a text representation of a molecule—is split into tokens and mapped to integer IDs. An embedding layer turns each ID into a dense, learnable vector. The encoder then compresses the sequence of token vectors into one latent vector for the molecule, and a decoder tries to reconstruct the input. Token embeddings and the whole-molecule latent vector are different representations at different stages of the pipeline. section 10.2.2 section 10.2.3
From tokens to a molecular vector
With 100 tokens and an embedding dimension of 128, the embedding layer produces a 100 × 128 matrix. An encoder with latent dimension 64 compresses that matrix into 64 numbers. The decoder expands the latent vector into token scores, and reconstruction loss trains the model to preserve information needed to recreate the input. section 10.2.3
Figure 10.3 Three-step process of converting molecular SMILES strings into dense vector representations for neural network processing. (1) Character-level tokenization breaks the input sequence into individual tokens, including special tokens like <sos> (start of sequence) and <eos> (end of sequence). (2) Vocabulary mapping converts each token to its corresponding integer ID using a learnable lookup table. (3) The embedding matrix (30 tokens × 128 dimensions) transforms these integer IDs into dense, learnable vector representations. The bottom flow diagram shows how this embedding layer fits into the overall autoencoder pipeline, taking a molecular input and converting the tokenized text to numerical vectors before passing to the encoder for compression. This approach enables the model to learn semantic relationships between chemically similar tokens during training, providing a more efficient and meaningful representation than sparse one-hot encoding.

Follow the path from SMILES tokens and integer IDs to dense vectors and the encoder. section 10.2.3
A useful molecular latent space should support valid decoded molecules, accurate reconstruction, and continuity: small steps in the space should produce small, predictable changes. A variational autoencoder encourages a more continuous space by encoding a molecule as a distribution and sampling a latent vector from it. Its training balances reconstruction against regularization. section 10.2.1 section 10.3
Embeddings also support other drug-discovery tasks:
- Binding-affinity prediction: separate graph neural networks encode a drug and a protein. Pooling turns each graph’s node embeddings into a fixed-size graph vector; the two vectors are concatenated and used to predict affinity. section 11.5.1
- Protein representation: an encoder-only transformer produces one contextual embedding per residue, incorporating information from the protein sequence. section 12.3.2
- Virtual screening: pretrained MegaMolBART embeddings represent candidate compounds and known modulators for similarity search. ESM-2 protein embeddings can also feed ESMFold to predict a target structure. section 13.3.2
An embedding is not proof of biological function. Similarity-search results depend on the representation and metric, and structurally similar compounds do not necessarily have similar effects. Likewise, a predicted protein structure remains a model to validate, not an experimental structure. section 2.1.3 section 13.3.2







































































