How Machine Learning Reads Chemical Structures

In this series, we're taking a deep technical dive into how chemical structures are read, represented, and interpreted in molecular machine learning.

4 min read

May 8th, 2025

Last updated: May 10th, 2025

How Machine Learning Reads Chemical Structures

Introduction


In molecular machine learning, whether we're working in drug discovery, material science, crop science, or any related field, data representation is foundational.

Molecules are inherently complex. They exist as high-dimensional structures with rich chemical behavior.

For a machine learning system to learn from them, it first needs to read and interpret them.

This means we have to choose the right way to encode these complex molecular structures.

So, before we build a model to predict solubility, generate a novel compound, or suggest a synthetic route, we first need to translate the molecule into a form the machine can understand.

We need to keep in mind that this translation isn't trivial. The format we choose directly influences what the model can learn and how well it performs.

About this series

In this series, we're going to take a deep technical dive into how chemical structures are represented, interpreted and used in molecular machine learning.

This post is Part I of the series How Machine Learning Reads Chemical Structures. In this series, we will cover:

  • Part II: SMILES to Molecules

  • Part III: Tokenizing Chemical Structures

  • Part IV: Embedding Molecules

  • Part V: Graph-Based Representations

  • Part VI: Molecular Generation Models

  • Part VII: Robust Representations and Augmentation

  • Part VIII: Hybrid and 3D Molecular Inputs

We’ll cover some basics, but we’ll go much deeper on the technical aspects, focusing on those of us already working on or interested in tasks like QSAR modeling, generative design, retrosynthesis, and molecular property prediction, etc.

If you’re just starting out, especially in cheminformatics and molecular machine learning, we recommend going through these guides first:

11 reasons to master cheminformatics before machine learning in drug discovery

Cheminformatics: an in-depth guide for beginners

A curated list of cheminformatics software and libraries

A beginner's guide to QSAR modeling in cheminformatics for biopharma

What are molecular representations in machine learning?


Molecular representations are methods for translating the complex 3D structure of molecules, including atoms, bonds, and spatial arrangements, into structured formats that machine learning models can process.

These representations may be numerical, symbolic, or graphical, and are essential for enabling models to learn chemical properties and relationships effectively.

Before we move forward, here’s a quick summary of some of the most commonly used representations.

Main types of molecular representations

FormatTypeCapturesIdeal forLimitations
SMILES1D StringAtoms, bonds, ringsQSAR, sequence models, generative modelsNon-unique, syntax-sensitive
InChI1D StringCanonical connectivitySearch, deduplicationHard to use in generative workflows
Graph2D TopologyAtom/bond relationshipsGraph neural networks, property predictionLoses 3D info unless extended
3D Coordinates3D SpatialAtom positions, molecular shapeDocking, conformer generation, QM tasksExpensive to compute, may not generalize
FingerprintsBit VectorSubstructure presence/absenceSimilarity search, classificationFixed size, loses structural context
EmbeddingsLearned VectorsLatent chemical/structural featuresProperty prediction, generative designData-hungry, lacks interpretability

Each format reveals different layers of chemical meaning. Some prioritize simplicity, while others focus on precision or generative potential. Choosing the wrong format can hurt model performance or even lead to invalid results.

If you want to dive deeper, you can also check out more details in our Beginner's Guide to Handling Chemical Files and Their Conversion.

Why is molecular representation a challenge in machine learning?

As we work with molecules in machine learning, we quickly realize they are anything but simple.

Molecules exist in three-dimensional space, with atoms connected by bonds and arranged in specific spatial patterns.

Translating this complexity into a format that a model can understand is not straightforward.

No single representation captures every aspect of a molecule’s structure and behavior.

Depending on what we are trying to do, we need to emphasize different features of the molecule.

For property prediction, atomic connectivity might matter most but for docking or conformer analysis, 3D geometry becomes critical.

This is why it's fair to say that molecular representation is a multi-format challenge, and no single format works for every task.

Instead, we rely on a diverse set of representations, each designed and optimized for specific tasks, model types, and practical constraints.

Why representation choice matters in molecular machine learning?

In molecular machine learning, the models we build are only as good as the structures they see.

The way we represent molecules determines which chemical signals the model can learn and which ones it might miss.

Choosing the right format is about balancing trade-offs. We consider accuracy, computational efficiency, and compatibility with our model architecture.

If we want to predict solubility or toxicity, SMILES or 2D descriptors might be enough. If we're designing new molecules, we may need SELFIES or graph-based generators.

If we're modeling binding affinity, 3D geometries become critical. And for retrosynthesis tasks, reaction SMILES and transformation graphs are usually the way to go.

Different tasks demand different representations, and knowing how to choose the right one is key to building models that are both effective and scalable.

Here’s a typical flow of how molecular structures feed into a machine learning model.

SMILES  →  Tokenizer  →  Embeddings  →  ML  Model  (LSTM/Transformer/GNN)  →  Output

Each stage adds its own complexity and nuance. How we tokenize and embed a SMILES string can directly influence how well a model generalizes.

The way we structure the model also depends on the type of representation we are working with, whether it is a sequence, a graph, or a spatial format.

In later posts, we will break each of these components down and explore how we can optimize them.

For now, to help you understand the basics more clearly, let’s take a look at the SMILES string for aspirin (acetylsalicylic acid).

The chemical structure can be represented in line notation.

In this case, the SMILES representation is:

CC(=O)OC1=CC=CC=C1C(=O)O

This compact line represents aspirin as a molecule with aromatic rings, ester groups, and carboxylic acids.

But it's just text, models must learn to link this text to chemical meaning.

The same structure can be represented and visualized in different formats.

The structure of aspirin is presented in different formats from a simple one line representation to complex 2D and 3D structures

Each of these formats, along with many others, can be used in building machine learning models.

A thorough understanding of them can help us improve model interpretability and design better debugging workflows.

By the way, did you notice that the SMILES string for aspirin shown in the image above and the SMILES written in the text are different? Yet, both are correct!

We will talk more about why that happens in the next part of this series.

What’s next in this series

This is just the start! In the posts that follow, we’ll explore the ML stack that surrounds molecular data.

Topics include:

  • How ML models learn chemistry from SMILES strings

  • Tokenizing chemical structures for molecular machine learning

  • Graph-based modeling with RDKit and PyTorch Geometric

  • Embedding architectures for molecular sequences

  • Variational autoencoders and generative models

  • Robust workflows for dataset curation and augmentation

  • Hybrid models with spatial or electronic features

Frequently Added Questions (FAQs)


A molecular representation is a way to express a molecule's structure in a format that a machine learning model can understand. This could be a string (like SMILES), a graph, or a set of 3D coordinates. The format you choose affects what the model can learn and how well it performs.


Different machine learning tasks focus on different molecular features. Some require only atom connectivity, while others need precise 3D geometry. No single format captures everything, so we use different representations based on the task, model type, and available data.


Because the representation determines what the model can learn. If important features are missing or poorly encoded, the model’s predictions will be limited or misleading. Good representation is the base for meaningful learning.


SMILES (Simplified Molecular Input Line Entry System) is a line notation that encodes molecular structure as a string. It’s widely used because it is compact, human-readable, and easy to integrate with text-based machine learning models like transformers and LSTMs.


SMILES is compact and widely used but lacks uniqueness and robustness. It's sensitive to syntax and does not encode stereochemistry or 3D geometry unless explicitly extended. This limits its utility for tasks requiring conformational or stereoelectronic understanding, such as docking or binding affinity prediction.


Start with the task. For classification or regression on simple properties, SMILES or fingerprints may be enough. For spatial tasks like docking or conformer prediction, you’ll need 3D coordinates. If you’re using graph-based models, molecular graphs are essential. Often, combining formats gives the best results.


Absolutely. Interpretable models depend on chemically meaningful input features. For example, graph-based models can localize predictions to atoms or substructures. In contrast, SMILES-based models may struggle unless equipped with well-designed token embeddings or attention mechanisms.


Pankaj specializes in small molecule AI and holds a PhD from the University of Freiburg, where he focused on low-data simulation and modeling. He has over 13 years of experience working with biomolecular systems in drug discovery. He also holds a Master’s degree in Pharmaceutical Chemistry from the prestigious Indian Institute of Technology (BHU), India. He is the co-founder of Neovarsity, a Berlin-based deep-tech skills platform, and the founder of Future Therapeutics, a Berlin-based therapeutics discovery company that develops and applies proprietary AI infrastructure to tackle data-poor and challenging targets. He enjoys writing and teaching about molecular AI, especially on how to better manage and utilize data for research and development in this field.

Subscribe to learn more about
Molecular ML

By proceeding, you agree to the processing of your data and the Terms of use and Privacy policy.
Latest blogs from Neovarsity