CoolFace
Modelpublic

fairydance/molexar-1-10m-it

sourceHugging Facemitupdated 13d agoView on Hugging Face
1likes152downloads
Model Card

Molexar-1-10M-IT

Molexar-1-10M-IT (IT stands for Instruction-Tuned) is the universal multi-condition model for Molexar, a unified multimodal molecular foundation model for drug design. It starts from `fairydance/molexar-1-10m-pt` and is supervised fine-tuned to generate Fragment-SELFIES molecules under scalar molecular-property, pharmacophore-fingerprint, protein-sequence, and protein-pocket conditions.

This model corresponds to the Universal Multi-Condition Model described in the Molexar paper.

Project resources:

  • Molexar code: https://github.com/fairydance/Molexar
  • Fragment-SELFIES code: https://github.com/fairydance/Fragment-SELFIES
  • Official website: https://molexar.com

Model Details

FieldValue
Model familyMolexar molecular causal language model
ArchitectureGemma2-style decoder with value-token embedding replacement for conditions
Base modelfairydance/molexar-1-10m-pt
LM component parameters10,534,912
Total model parameters14,756,261
Layers16
Hidden size256
Intermediate size640
Attention heads4 query heads, 1 key-value head
Vocabulary size127
Context length256 tokens
Sliding window128 tokens
Molecular languageFragment-SELFIES
Model filesconfig.json, pytorch_model.bin, tokenizer.json, tokenizer_config.json, training_args.bin

Parameter counts are unique nn.Parameter counts with tied token-embedding/LM-head weights counted once. The LM component includes the token embeddings, Gemma2-style decoder, final normalization, and tied output head; the total additionally includes condition encoders and the pocket GVP encoder.

Molexar uses a shared sequence template for pretraining, SFT, and inference:

text
<BOS><COND> conditions </COND><SEP><MOL> molecule </MOL><EOS>

The condition block contains ordered key-token/value-token pairs. During conditional generation, selected <VALUE> token embeddings are replaced in place by encoded condition vectors. This keeps all generation modes on the same autoregressive decoding path and remains compatible with key-value-cache generation.

Supported Conditions

KeyMeaningEncoding / Range
mol_hacHeavy atom countone-hot, 2 to 50
mol_hbdcHydrogen-bond donor countone-hot, 0 to 10
mol_hbacHydrogen-bond acceptor countone-hot, 0 to 22
mol_rotbcRotatable bond countone-hot, 0 to 20
mol_wtMolecular weight, DaRBF, 30 to 750, 128 steps
mol_logpLogPRBF, -6 to 12, 96 steps
mol_tpsaTopological polar surface areaRBF, 0 to 200, 96 steps
mol_qedQEDRBF, 0.3 to 1.0, 64 steps
mol_sasSynthetic accessibility scoreRBF, 1.0 to 5.0, 64 steps
mol_pharma_fp2D pharmacophore fingerprintdirect vector, 1032 dimensions
prot_seq_esm_embProtein sequence embeddingdirect vector, 1152 dimensions
prot_poc_gvp_embProtein pocket geometry embeddingGVP/pocket vector, 256 dimensions

Protein sequence conditioning uses mean-pooled ESMC-600M final embeddings in the paper. Pocket conditioning processes no-hydrogen pocket PDB structures with a 25 Angstrom radius, a maximum of 425 atoms, and a directed 8-nearest-neighbor atom graph.

Installation

Install Molexar and Fragment-SELFIES before loading the model:

bash
git clone https://github.com/fairydance/Molexar.git
git clone https://github.com/fairydance/Fragment-SELFIES.git

cd Molexar

conda create -n molexar python=3.13
conda activate molexar

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu130
pip install transformers accelerate datasets evaluate biopython loguru
conda install -c conda-forge rdkit scipy seaborn

python -m pip install -e ../Fragment-SELFIES
python -m pip install -e . --no-deps

python -c "import fragment_selfies; import molexar; print('Molexar environment ready')"

Install the runtime dependencies listed in the Molexar repository documentation. Fragment-SELFIES is required to convert generated Fragment-SELFIES strings to SMILES. Protein-sequence conditioning also requires the auxiliary ESM embedding environment described by the Molexar repository.

Download

bash
hf download fairydance/molexar-1-10m-it --local-dir molexar-1-10m-it

Usage

Property-conditioned generation:

bash
python scripts/run_inference.py --mode conditional \
  --model_path /path/to/molexar-1-10m-it \
  --mol_wt 450 \
  --mol_logp 3.5 \
  --mol_hbdc 2 \
  --num_samples 10 \
  --convert_to_smiles \
  --canonical \
  --output_file property_samples.jsonl \
  --output_format jsonl

Pharmacophore-fingerprint conditioning from a reference SMILES:

bash
python scripts/run_inference.py --mode conditional \
  --model_path /path/to/molexar-1-10m-it \
  --condition_key mol_pharma_fp \
  --reference_smiles 'Cc1nnc(N2CCNCC2)s1' \
  --num_samples 10 \
  --convert_to_smiles \
  --canonical

Protein-sequence conditioning:

bash
python scripts/run_inference.py --mode conditional \
  --model_path /path/to/molexar-1-10m-it \
  --protein_sequence 'MKTIIALSYIFCLVFAKDRTEG' \
  --num_samples 10 \
  --convert_to_smiles \
  --canonical

Protein-pocket conditioning:

bash
python scripts/run_inference.py --mode conditional \
  --model_path /path/to/molexar-1-10m-it \
  --pocket_pdb /path/to/pocket.pdb \
  --pocket_radius 25 \
  --max_atoms 425 \
  --num_samples 10 \
  --convert_to_smiles \
  --canonical

Molexar-1-10M-IT also supports fragment-constrained generation with active conditions by combining condition flags with --generation_task and --start_smiles or --start_string. Supported generation tasks are de_novo, motif_extension, scaffold_decoration, linker_design, scaffold_morphing, and superstructure.

Training

Molexar-1-10M-IT was initialized from Molexar-1-10M-PT and trained with universal multi-condition SFT. The SFT objective masks the prefix through <MOL> and applies loss to the molecular continuation and closing tokens conditioned on the prompt and injected values.

Training script provenance:

text
examples/train/bjx_h800_sft_universal_multi_unleaky.sh

The SFT data combines molecule-context and target-context samples. Molecule-context samples use the UniChem-derived Fragment-SELFIES corpus with nine scalar properties and a 2D pharmacophore fingerprint. Target-context samples use protein-ligand pairs from SAIR and the PLINDER training set, with protein-sequence ESM embeddings and processed pocket structures. The Molexar paper reports removing target-context training pairs whose protein sequence had more than 30% identity to any CrossDocked2020 test protein; after filtering, the target-context pool contains 573,463 SAIR pair records and 21,770 PLINDER training-set pair records.

Main training settings from the release script and paper:

SettingValue
ObjectiveUniversal multi-condition supervised fine-tuning
Sequence length256
Epochs5
Batch size1000
Learning rate2e-4
Warmup steps2000
Molecule:target sample ratio4:1
Molecule-side active conditions1, 2, or 3 conditions with probabilities 0.6, 0.3, 0.1
Pharmacophore oversampling probability0.5
Mixed precisionbfloat16
Distributed trainingFull-shard FSDP on 8 H800 GPUs

Evaluation Highlights

The Molexar paper reports that the SFT model follows single-, dual-, and triple-property instructions and supports pharmacophore, protein-sequence, and pocket-geometry conditioning.

CrossDocked2020 target-conditioned generation highlights:

Conditioning modeValidityUniquenessDiversityQEDSALipinskiVinaHigh-affinity ratio
Sequence1.000.980.830.650.824.74-7.2543.1
Pocket1.000.970.840.650.834.82-7.4253.0
Pharmacophore1.000.910.760.590.714.69-6.7938.4

On MolGenBench, the paper reports high chemical-filter pass rates, strong active-molecule and scaffold recovery in de novo generation across protein targets, and favorable hit-to-lead potency when conditioning jointly on pocket and reference-ligand pharmacophore.

Intended Use

This model is intended for research use in molecular generation workflows, including:

  • Property-controlled molecule generation.
  • Pharmacophore-guided molecule generation.
  • Protein-sequence-conditioned target-aware generation.
  • Protein-pocket-conditioned target-aware generation.
  • Multi-condition molecular library ideation.
  • Fragment-constrained generation with optional active conditions.

Generated molecules should be treated as computational hypotheses. They require independent chemical-safety filtering, synthetic feasibility assessment, intellectual-property and dual-use review where relevant, expert medicinal-chemistry assessment, and experimental validation before downstream use.

Limitations

  • The model was trained on filtered drug-like chemistry; rare, contradictory, or out-of-distribution condition combinations may be followed less reliably.
  • Docking, pharmacophore, property, or sequence/pocket scores are not evidence of biological activity, safety, or clinical utility.
  • Protein-sequence and pocket conditioning depend on preprocessing quality, including ESM embeddings and pocket structure preparation.
  • Fragment-SELFIES decoding improves validity but does not guarantee synthetic accessibility, biological activity, safety, or developability.
  • The released tokenizer does not include the iodine token [I]; use bromine substitution in start constraints when necessary, as documented by the Molexar inference script.
  • Stereochemical and explicit 3D output control are outside the scope of this model.

License

This model is released under the MIT License.

Citation

If you use this model, please cite Molexar and Fragment-SELFIES:

bibtex
@misc{lin2026molexar,
  title = {Molexar: A Unified Multimodal Molecular Foundation Model for Drug Design},
  author = {Lin, Haoyu and Liao, Yiyan and Pan, Jinmei and Ling, Xinliao and Lai, Luhua and Pei, Jianfeng},
  year = {2026},
  url = {https://molexar.com}
}

Code and resources:

  • https://github.com/fairydance/Molexar
  • https://github.com/fairydance/Fragment-SELFIES
  • https://molexar.com