Asimo/hnet-smiles
a suite of byte-level models for molecular analysis
2 min readupdated
This repository contains eight compact H-Net models by Asimo, trained to work directly with chemical formulas in SMILES format (a text notation for molecular structures). All models share a two-stage architecture (grouping bytes into chunks and segments using a Transformer and a cosine router) but are trained with different objective functions. As a result, they slice molecules into meaningful pieces in different ways to tackle distinct tasks—from next-character prediction to calculating chemical properties. Useful for cheminformatics researchers and developers building AI tools for chemistry.
Key features
- Eight variants for different tasks: available in ~20M and ~30M parameter versions across four training objectives—generation (next-byte), masked fragment reconstruction (masked-fragments), Morgan fingerprint prediction (fingerprint), and RDKit descriptor calculation (descriptors).
- Adaptive molecular segmentation: the
masked-fragmentsmodel learns to split formulas closely along real chemical bonds (BRICS) while rarely breaking apart multi-character atoms. - Large-scale dataset: trained on 90.95 million canonical SMILES strings sourced from PubChem, COCONUT, ChEBI, and LIPID MAPS.
- Permissive license: model weights are released under the MIT license, with the source code available in an open GitHub repository.
What you can do
- Predict 2048-bit Morgan molecular fingerprints or 185 physicochemical RDKit descriptors directly from a SMILES text string.
- Use the segmentation from
masked-fragments-30mor20mas a smart tokenizer to break chemical compounds down into structural fragments. - Reconstruct missing regions of molecules (up to 25–45% masked bytes) or generate new sequences byte by byte.
Example
import torch
from data import encode, split
from model import load
model = load("Asimo/hnet-smiles/masked-fragments-30m")
x, n = encode(["CC(C)S(=O)(=O)CCSc1cccc(C(=O)O)c1"])
with torch.no_grad():
out, r = model(x, n)
print(split("CC(C)S(=O)(=O)CCSc1cccc(C(=O)O)c1", r["b"][0]))
Read more
DetailsHeld-out validation metrics (50,000 molecules): descriptors reach an R² of 0.998, fingerprint achieves a Tanimoto similarity of 0.832 (20M) and 0.831 (30M), and masked-fragments recovers 93.2% (20M) and 92.8% (30M) of masked bytes.
Training details: 30M models were trained for 3 epochs using the AdamW optimizer, while 20M versions ran for 5 epochs with the Muon optimizer.
Limitations: small parameter count, support limited to canonical SMILES without stereochemistry, and the use of Transformer layers instead of Mamba-2 from the original H-Net paper.










Comments