Source-linked AI summary
Improving Chemical Autoencoder Latent Space and Molecular De novo Generation Diversity with Heteroencoders
Esben Jannik Bjerrum, Boris Sattarov
TL;DR
SMILES-based autoencoders can learn serialization-dependent latent spaces rather than representations centered on molecular identity. The paper evaluates heteroencoders that translate between molecular representations and finds improved chemical relevance, while decoder enumeration increases decoding uncertainty.
Problem
SMILES-trained autoencoders may represent serialization patterns rather than molecular identity, because one molecule can have multiple SMILES strings.
Method
The study compares autoencoders and heteroencoders using canonical or enumerated SMILES and 2D representations, evaluating latent-space similarity, decoding, and QSAR vectors.
Results
Heteroencoder latent vectors showed greater relevance for QSAR modelling, while decoder enumeration most strongly influenced latent-space properties and increased decoding uncertainty.
Takeaways & Limitations
Transcoding between representations can produce latent spaces more balanced between SMILES similarity and molecular similarity for de novo design.
Takeaways & Limitations
Decoder enumeration increases uncertainty and can produce molecules different from the encoded input, while the initial fully enumerated dataset was limited in size and molecular complexity.
Abstract
from arXiv · showhide
Chemical autoencoders are attractive models as they combine chemical space navigation with possibilities for de-novo molecule generation in areas of interest. This enables them to produce focused chemical libraries around a single lead compound for employment early in a drug discovery project. Here it is shown that the choice of chemical representation, such as SMILES strings, has a large influence on the properties of the latent space. It is further explored to what extent translating between different chemical representations influences the latent space similarity to the SMILES strings or circular fingerprints. By employing SMILES enumeration for either the encoder or decoder, it is found that the decoder has the largest influence on the properties of the latent space. Training a sequence to sequence heteroencoder based on recurrent neural networks(RNNs) with long short-term memory cells (LSTM) to predict different enumerated SMILES strings from the same canonical SMILES string gives the largest similarity between latent space distance and molecular similarity measured as circular fingerprints similarity. Using the output from the bottleneck in QSAR modelling of five molecular datasets shows that heteroencoder derived vectors markedly outperforms autoencoder derived vectors as well as models built using ECFP4 fingerprints, underlining the increased chemical relevance of the latent space. However, the use of enumeration during training of the decoder leads to a markedly increase in the rate of decoding to a different molecules than encoded, a tendency that can be counteracted with more complex network architectures.
Introduction
Chemical autoencoders may encode properties of SMILES representations rather than molecules themselves. The paper proposes heteroencoders that translate between molecular representations to encourage a more chemically relevant latent space.
- Autoencoders compress molecular inputs into latent vectors and decode those vectors to reconstruct the original representation.
- Because molecular graphs can serialize into multiple SMILES strings, equivalent molecules may occupy different regions of a SMILES-trained latent space.Figure 1 shows differing projections for non-canonical SMILES of the same molecules, with some clustering.
- The resulting latent space likely combines information about SMILES serialization with information about molecular chemistry.
- Heteroencoders translate between representations such as canonical SMILES, enumerated SMILES, and 2D embeddings.
- The study examines how representation and enumeration choices affect latent-space similarity, de novo decoding, and QSAR vectors.
Methods
The study uses molecular datasets spanning small enumerated structures, ChEMBL23 molecules, and five property or bioactivity datasets for QSAR modelling. These datasets support evaluation of representation learning and downstream prediction.
- GDB-8 molecules were randomly split into training and test sets using a 0.9 to 0.1 ratio.
- The ChEMBL23 corpus supplied 1.2 million processed molecules, including 400 thousand training molecules, 300 thousand validation molecules, and 10 thousand held-out test molecules.Structures were standardized by stripping salts and solvents, neutralizing charges, and removing stereochemistry.
- Five QSAR datasets covered four EPA TEST endpoints—IGC50, BCF, MP, and LD50—and solubility.
1D and 2D Vectorization
The models encode molecular representations into bottleneck vectors and decode them with recurrent or convolutional architectures. Similarity, reconstruction, and sampling procedures compare how representation choices shape the learned latent space.
- Vectorization: SMILES and 2D molecular representations were vectorized with one-hot encoding or multichannel image-like arrays containing atom, bond-order, aromaticity, and randomized-coordinate information.
- Model architecture: Sequence-to-sequence models used LSTM encoders, dense ReLU bottlenecks, and LSTM decoders trained with teacher forcing.
- Training: Models were trained with categorical cross-entropy and Adam, using mini-batches of 256 sequences for 300 epochs.
- Model architecture: The image-to-sequence model used stacked Inception-like convolutional modules before decoding through an LSTM sequence model.
- Model configurations: Model names identify whether canonical SMILES, enumerated SMILES, or image embeddings were used for the encoder and decoder.
- Evaluation: Latent-space comparisons used PCA projections, SMILES alignment scores, and Morgan fingerprint similarity, while decoding quality assessed validity and molecular equivalence.
- ChEMBL model: The expanded ChEMBL encoder used bidirectional LSTM layers and a 256-neuron bottleneck before decoding with parallel dense layers and two unidirectional LSTM layers.
Results
The results show that heteroencoder design, especially decoder representation, shapes latent-space similarity, enumeration robustness, sampling diversity, and QSAR utility. Enumeration improves clustering and chemical relevance but increases reconstruction errors when decoding.
- Latent-space similarity: Models with canonical-SMILES decoders correlate more strongly with SMILES sequence similarity than fingerprint similarity, whereas image-embedding heteroencoders have the lowest correlations.Both alignment and fingerprint similarities correlate with latent-space similarity, but the balance depends on representation and decoder design.
- Error analysis: 494 of 1000 can2enum reconstructions were valid SMILES but different molecules, including 220 with wrong scaffolds and 251 with correct scaffold, atoms, and bonds but incorrect assembly order.Enumeration mainly complicates scaffold reconstruction and atom ordering; other heteroencoder models show qualitatively similar results.
- Enumeration Challenge: Training with enumerated SMILES produces tighter clustering of equivalent molecules, with enum2can tightest and can2enum tighter than can2can.Enum2enum shows clustering similar to enum2can, indicating that decoder heteroencoding can alter the latent space even without enumerated encoder training.
- Molecular generation: Multinomial sampling makes can2enum outputs more variable than can2can outputs because can2enum has greater early-step probability uncertainty.The can2can decoder repeatedly samples the same canonical SMILES, while can2enum can produce different sampled SMILES across runs.
- QSAR modelling using ChEMBL trained heteroencoders: Heteroencoder bottleneck vectors outperform autoencoder vectors and ECFP4 baselines in QSAR modelling across five molecular datasets.The heteroencoder configurations perform similarly, with average performance tending to rise from enum2can to enum2enum over can2enum.
- QSAR modelling using ChEMBL trained heteroencoders: Approximately 40% of bottleneck neurons are never activated across configurations, making the effective latent vector denser than the nominal bottleneck size.Changing bottleneck size produced nearly the same inactive-neuron percentage, and the authors relate this observation to ReLU activation.
Discussion
Heteroencoder design, especially the decoder representation, strongly shapes latent-space chemical relevance and QSAR performance. These gains come with reconstruction and generalization trade-offs, including decoder uncertainty and limitations from simple, enumerated datasets.
- Latent-space organization: Balanced correlations with SMILES and fingerprint similarities indicate that some heteroencoder latent spaces reflect molecular scaffolds as well as string serialization.The balance is presented as evidence that the latent space is not dominated by SMILES sequence similarity alone.
- Limitations and architecture: The first study used a limited eight-atom dataset whose full enumeration may place identical graph structures in training and test sets, permitting memorization.The authors also caution that low network capacity impaired enumerated-data fitting, with deeper models improving reconstruction and sampling.
- Limitations and architecture: Larger ChEMBL molecules required deeper bidirectional architectures and more LSTM cells, yet reconstruction uncertainty remained.The discussion suggests that still more complex architectures could be needed for larger molecular datasets.
- Latent-space organization: Decoder representation influences the latent space more than encoder representation, explaining why image-to-SMILES models did not substantially improve latent representations.The authors attribute this to encoders recognizing molecules while the latent space adapts primarily to the decoder’s reconstruction task.
- QSAR performance: Enumeration during training improves latent-space relevance for QSAR modelling, but enumeration in the decoder provides only marginal QSAR gains over enum2can while increasing decoding uncertainty.The authors suggest that greater decoding creativity could increase generated-library diversity, but this remains untested.
- QSAR performance: Heteroencoder-derived vectors generally outperform autoencoder-derived vectors and ECFP4 inputs in the tested QSAR models, with performance approaching highly optimized descriptor-based models.The comparison used five datasets spanning physicochemical properties and bioactivity, while the authors note that further hyperparameter tuning might improve latent-vector models.
- Practical implications: The choice between encoder and decoder enumeration should depend on whether the application prioritizes QSAR relevance, reconstruction reliability, or potentially greater generation diversity.The paper presents this as a use-case-dependent trade-off rather than a universally superior configuration.
Conclusion
The study finds that heteroencoder latent vectors better capture molecular similarity and support QSAR modelling, while enumerated-decoder training increases decoding variance. More complex decoders can improve this uncertainty trade-off.
- Conclusion: The decoder has greater influence on latent-space properties than the encoder in the pilot study.Canonical-SMILES decoder training produced representations that appeared more correlated with SMILES strings than molecular graphs.
- Conclusion: Decoder training on enumerated SMILES increases variance in both the predicted SMILES form and sampled molecules.This breaks the dependence on reproducing canonical SMILES.
- Conclusion: Heteroencoder latent vectors improve QSAR modelling performance and better describe biologically and physicochemically relevant chemical space.The authors characterize this as a more SMILES-independent molecular representation.
- Conclusion: More complex decoder architectures appear to counteract the greater uncertainty introduced by enumeration.The paper frames de-novo design as requiring a balance between similarity and variance.
Contributions
The work was divided between concept development and GDB-8 experiments, and ChEMBL network optimization, QSAR preparation, and evaluation.
- Contributions: Esben Jannik Bjerrum developed heteroencoders, conducted GDB-8 training and tests, and prepared the initial and final manuscripts.
- Contributions: Boris Sattarov optimized the ChEMBL network architecture, prepared QSAR datasets, evaluated latent vectors, and helped prepare the final manuscript.
Conflict of interests
The authors report professional affiliations involving pharmaceutical consulting, biotechnology and pharmaceutical services, data infrastructure, and machine learning for drug discovery.
- Conflict of interests: Esben Jannik Bjerrum owns Wildcard Pharmaceutical Consulting, which provides contracted research and IT services to biotechnology and pharmaceutical companies.
- Conflict of interests: Boris Sattarov works part time for Science Data Software LLC, which provides data infrastructure and machine learning capabilities for drug discovery and chemical research.