
NVIDIA/BioNeMo MolMIM
NVIDIA NIM for MolMIM molecule generation, embedding, and property optimization.
MolMIM is a latent variable model developed by NVIDIA for molecule generation, trained in an unsupervised manner over a large-scale dataset of molecules represented as SMILES strings. It uses a transformer architecture with Mutual Information Machine (MIM) learning to learn an informative, fixed-size latent space that promotes clustered, meaningful latent codes — enabling it to sample novel molecules from that space.
MolMIM supports two core workflows:
Similarity-based generation — generates molecules similar to a seed molecule by encoding it into the latent space, applying random perturbation (e.g., zero-centered Gaussian noise with a chosen variance), and decoding the result back into a SMILES string.
Property-optimized generation — performs optimization using the CMA-ES algorithm within the latent space to sample molecules with improved values for a desired scoring function.
Call BioNeMo MolMIM on Baseten using the NIM molecule generation route.
Input
import os
import requests
MODEL_ID = os.environ["BASETEN_MODEL_ID"]
BASETEN_API_KEY = os.environ["BASETEN_API_KEY"]
BASETEN_URL = (
f"https://model-{MODEL_ID}.api.baseten.co/environments/production/sync"
"/generate"
)
payload = {
"smi": "CN1C=NC2=C1C(=O)N(C(=O)N2C)C",
"algorithm": "CMA-ES",
"num_molecules": 5,
"property_name": "QED",
"minimize": False,
"min_similarity": 0.4,
"particles": 8,
"iterations": 3,
}
response = requests.post(
BASETEN_URL,
headers={
"Authorization": f"Bearer {BASETEN_API_KEY}",
"Content-Type": "application/json",
},
json=payload,
timeout=300,
)
response.raise_for_status()
result = response.json()
print(result)
Output
{
"generated": [
"<SMILES>",
"<SMILES>"
]
}