--- license: apache-2.0 task_categories: - text-generation language: - en tags: - chemistry - molecules - smiles - safe - drug-discovery size_categories: - 1B **Note** > This is **version 2** of the SAFE dataset. The original v1 release contained invalid SAFE strings and is archived for reproducibility at > [https://huggingface.co/datasets/datamol-io/safe-gpt/tree/b83175cd7394](https://huggingface.co/datasets/datamol-io/safe-gpt/tree/b83175cd7394) ## SAFE Representation SAFE (Sequential Attachment-based Fragment Embedding) is a **fragment-based molecular string representation** that encodes molecules as **sequences of chemically meaningful fragments together with their attachment structure**. In SAFE, molecules are decomposed into fragments using rule-based fragmentation, and the resulting fragments are arranged into a **deterministic sequence** that explicitly represents how fragments are connected. The representation is **fully reversible**, allowing exact reconstruction of the original molecular graph. By operating at the **fragment level** rather than the atom level (as in SMILES), SAFE reduces syntactic fragility and naturally supports both **unconstrained molecular generation** and **structure-constrained tasks** (e.g., scaffold or fragment conditioning) using standard sequence models. Additional resources: * **SAFE GitHub repository**: [https://github.com/datamol-io/safe](https://github.com/datamol-io/safe) * **SAFE-based models on Hugging Face**: * [SAFE-GPT 87M](https://huggingface.co/datamol-io/safe-gpt) * [NovoMolGen 32M-BPE](https://huggingface.co/bisectgroup/NovoMolGen_32M_SAFE_BPE) * [NVIDIA's GenMol 89M](https://huggingface.co/nvidia/NV-GenMol-89M-v2) ## Dataset Description The dataset aggregates molecules from two major public chemical resources: * **ZINC20**: ~1.0 billion commercially available, purchasable compounds * **UniChem**: ~188 million compounds aggregated from multiple public databases After standardization and deduplication, the dataset contains **~1.17 billion unique molecules**. Each molecule is provided with: * `mol_id`: Source-specific molecule identifier * `smiles`: Canonical SMILES string * `safe`: Canonical SAFE string representation (BRICS-based fragmentation) * `source`: Origin of the molecule (`zinc20` or `unichem`) Due to the scale of the dataset, **streaming access is recommended** for most use cases. ## Dataset Splits | Split | Molecules | Proportion | | ---------- | --------- | ---------- | | Train | ~933M | 80% | | Validation | ~117M | 10% | | Test | ~117M | 10% | ## Usage Example ```python from datasets import load_dataset # Load dataset (streaming recommended) dataset = load_dataset("datamol-io/safe-gpt", streaming=True) train = dataset["train"] val = dataset["validation"] test = dataset["test"] ``` --- ## Citation If you use this dataset or the SAFE representation, please cite the SAFE paper: ```bibtex @article{noutahi2024gotta, title={Gotta be SAFE: a new framework for molecular design}, author={Noutahi, Emmanuel and Gabellini, Cristian and Craig, Michael and Lim, Jonathan SC and Tossou, Prudencio}, journal={Digital Discovery}, volume={3}, number={4}, pages={796--804}, year={2024}, publisher={Royal Society of Chemistry} } ```