Group SELFIES: a robust fragment-based molecular string representation

Austin H. Cheng, Andy Cai, Santiago Miret, Gustavo Malkomes, Mariano Phielipp, Alán Aspuru-Guzik

Abstract

Group SELFIES is a molecular string representation that incorporates tokens which represent substructures while maintaining robustness, which improves the performance of molecular generative models.

Introduction

In the rapidly evolving field of AI-driven drug discovery, the choice of molecular representation significantly impacts the success of generative models. For decades, SMILES (Simplified Molecular Input Line Entry System) has been the standard. However, SMILES is notoriously fragile; a single character substitution or deletion often results in a string that is either synthetically impossible or synthetically invalid. While SELFIES (Self-Referencing Embedded Strings) solved the issue of syntactic validity by ensuring every string decodes into a valid molecular graph, both representations operate at the atom-and-bond level.

Human chemists, by contrast, conceptualize molecules through functional groups and structural motifs—such as benzene rings, carboxyl groups, or sulfonamides. When generative models like Variational Autoencoders (VAEs) or Genetic Algorithms (GAs) manipulate atom-level strings, they frequently disrupt these meaningful motifs. This paper introduces Group SELFIES, a novel representation that bridges the gap between machine-readable strings and human-centric chemical intuition. By treating functional groups as first-class citizens (tokens), Group SELFIES introduces a powerful inductive bias that helps models learn chemical space more effectively.

Methodology

The fundamental innovation of Group SELFIES is the extension of the SELFIES grammar to include Group Tokens. Instead of building a molecule atom-by-atom, the representation allows for the inclusion of pre-defined substructures.

Illustration of a molecule decomposed into functional groups for Group SELFIES representation.

The Group Set and Connectivity

Users define a "group set," which acts as a dictionary mapping tokens (e.g., [:1toluene], [:2pyrazole]) to specific molecular fragments. To ensure these fragments can be integrated into a larger structure, Group SELFIES utilizes attachment points. When the decoder encounters a group token, it looks at the subsequent token in the string as a relative index to determine which atom in the fragment should serve as the connection point for the continuing chain.

Robustness and Chirality

Maintaining the "unbreakable" nature of SELFIES is a core requirement. The Group SELFIES decoder tracks the available valency of every atom in real-time. If a group token would lead to a chemically impossible bond (such as a pentavalent carbon), the decoder automatically adjusts the bond order or ignores the invalid connection. Furthermore, chirality is handled by defining chiral centers as specific groups within an "essential set," ensuring that stereochemical information is preserved during the encoding and decoding process without the need for fragile symbols like the @ used in SMILES.

Experimental Evaluation

The researchers evaluated Group SELFIES using several large-scale datasets:

  • ZINC-250k and eMolecules: Used to verify the robustness and efficiency of the encoder/decoder across millions of diverse chemical structures.
  • ZINC Clean Leads (MOSES): A benchmark dataset of 2 million molecules used to train and evaluate the performance of VAEs.
  • Nonfullerene Acceptors (NFA): A specialized dataset for organic photovoltaics used to test the representation's ability to preserve specific, domain-relevant structural motifs.

Results and Discussion

The primary advantage of Group SELFIES is its ability to capture the underlying distribution of chemical data more accurately than atom-based representations. In VAE training benchmarks on the MOSES dataset, Group SELFIES achieved a Fréchet ChemNet Distance (FCD) of 0.1787, vastly outperforming the 0.6351 achieved by standard SELFIES. A lower FCD indicates that the generated molecules are significantly more similar to the training distribution.

Comparison of standard SELFIES and Group SELFIES strings and the results of token shuffling.

Furthermore, Group SELFIES strings are substantially more compact. Shorter sequences are easier for deep learning architectures, such as Transformers or Recurrent Neural Networks, to process and remember. As illustrated in Figure 2, the representation also excels in random sampling "stress tests." Shuffling tokens in Group SELFIES preserves the integrity of functional groups, resulting in molecules with synthetic accessibility (SAScore) and drug-likeness (QED) distributions that closely mirror real-world molecules. In contrast, atom-level shuffling in standard SELFIES often produces valid but physically unlikely "nonsense" structures.

Limitations and Future Work

While Group SELFIES offers significant improvements, several areas for future development remain. The encoding process is currently slower than SMILES due to the need for substructure searches using RDKit. Additionally, the current implementation does not support overlapping groups, which complicates the representation of certain polycyclic systems. Future work will explore automated fragment selection algorithms (such as BRICS) to optimize group sets for specific chemical libraries and extending the framework to handle global chirality in complex systems like allenes or helicenes.

Summary updated

BibTeX
@inproceedings{cheng2023group,
  author = {Austin H. Cheng and Andy Cai and Santiago Miret and Gustavo Malkomes and Mariano Phielipp and Alán Aspuru-Guzik},
  title = {{Group SELFIES: a robust fragment-based molecular string representation}},
  booktitle = {Digital},
  year = {2023},
  doi = {10.1039/d3dd00012e},
}
Figure