# Retention Time Prediction

> Use when you have a set of small-molecule structures (SMILES, InChI, or SDF format) and need to predict their chromatographic retention times for a specific method, either to support metabolite annotation, validate experimental assignments, or project RTs across different chromatographic platforms.

- Skill: `holobiomicslab/retention-time-prediction-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add holobiomicslab/retention-time-prediction-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/holobiomicslab/retention-time-prediction-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: CC-BY-4.0
- Author: HolobiomicsLab (https://skillmd.com/u/holobiomicslab)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/holobiomicslab/retention-time-prediction-2

---


# retention-time-prediction

## Summary

Train a heavily regularized deep neural network to predict chromatographic retention times (RTs) for small molecules using molecular fingerprints and descriptors. This skill enables high-accuracy RT estimation (MAE 39.2±1.2 s) on novel compounds, which can be integrated into metabolite annotation workflows to rank candidate identifications by RT likelihood.

## When to use

You have a set of small-molecule structures (SMILES, InChI, or SDF format) and need to predict their chromatographic retention times for a specific method, either to support metabolite annotation, validate experimental assignments, or project RTs across different chromatographic platforms. Use this skill when you have access to the METLIN SMRT dataset or a similar large RT reference collection (≥10,000 molecules) for training.

## When NOT to use

- Input molecules are from a very different chemical space or ionization mode than the METLIN SMRT training set (e.g., lipids, large polymers, or non-small-molecule analytes); transfer learning or retraining on domain-specific data is needed.
- Retention times are already available and validated for your analytes; skip directly to meta-learned projection or metabolite annotation.
- You lack access to alvaDesc software or a pre-computed descriptor/fingerprint matrix; the pipeline cannot generate feature inputs without this proprietary tool.

## Inputs

- SMILES strings, InChI, SDF, mol, or mol2 chemical structure files
- Experimental retention time labels (in seconds)
- Molecular descriptor and fingerprint matrix (5,666 descriptors + 2,214 fingerprints per molecule, pre-generated by alvaDesc)

## Outputs

- Trained DNN regressor (model weights and architecture)
- Predicted retention times (point estimates in seconds)
- Mean absolute error (MAE) and median absolute error (MdAE) metrics with uncertainty bounds
- Model uncertainty estimates for each prediction

## How to apply

First, generate 5,666 molecular descriptors and 2,214 fingerprints (MACCS166, Extended Connectivity, Path Fingerprints) for all molecules using alvaDesc software. Construct a feature matrix concatenating descriptors and fingerprints as inputs and experimental retention times as regression targets. Train a deeply regularized DNN (L1/L2 penalties) with cosine annealing warm restarts as the learning rate scheduler and apply stochastic weight averaging to improve generalization. Evaluate performance on a held-out test set by computing mean absolute error (MAE) and median absolute error (MdAE). If MAE is near or below 39.2±1.2 s and MdAE near 17.2±0.9 s, the model has achieved competitive performance on SMRT-like datasets.

## Related tools

- **alvaDesc** (Generates 5,666 molecular descriptors and 2,214 fingerprints (MACCS166, Extended Connectivity, Path Fingerprints) for input molecules) — https://www.alvascience.com/alvadesc/
- **cmmrt** (Reference implementation of DNN training, evaluation, and hyperparameter tuning for RT prediction; includes Makefile rules for train_predictor and test_predictor) — https://github.com/constantino-garcia/cmmrt

## Examples

```
python cmmrt/rt/train_model.py --storage sqlite:///results/optuna/train.db --save_to saved_models --train_size 0.8 --param_search_folds 5 --trials 100
```

## Evaluation signals

- Mean absolute error (MAE) on held-out test set is ≤39.2±1.2 s, indicating competitive performance relative to the reported baseline
- Median absolute error (MdAE) is ≤17.2±0.9 s, confirming accuracy across the distribution of predictions
- Fingerprints-only features achieve comparable or better performance than descriptors-only or combined features, consistent with the paper's finding
- Nested cross-validation results (using train_predictor and test_predictor from the Makefile) show stable error metrics across folds
- Uncertainty estimates (error bounds) on predictions reflect the observed residual distribution in validation data

## Limitations

- The model is trained on METLIN SMRT (80,038 molecules) and may not generalize well to chemical spaces distant from this reference set without retraining or domain adaptation.
- Prediction uncertainty is estimated as ±1.2 s (MAE) or ±0.9 s (MdAE) on average; individual predictions may have larger errors, especially for outlier molecules.
- Feature generation requires the proprietary alvaDesc software; open-source alternatives (RDKit, mordred) were not evaluated in the paper and may produce different performance.
- The DNN architecture and hyperparameters were optimized for SMRT; full retraining via Bayesian hyperparameter search is recommended when switching to a different chromatographic method or dataset.
- Stochastic weight averaging and cosine annealing warm restarts impose additional computational cost during training compared to standard SGD.

## Evidence

- [readme] 5,666 molecular descriptors and 2,214 fingerprints (MACCS166, Extended Connectivity, and Path Fingerprints fingerprints) were generated with the alvaDesc software: "5,666 molecular descriptors and 2,214 fingerprints (MACCS166, Extended Connectivity, and Path Fingerprints fingerprints) were generated with the alvaDesc software"
- [readme] The best results were obtained by a heavily regularized DNN trained with cosine annealing warm restarts and stochastic weight averaging, achieving a mean and median absolute errors of 39.2±1.2 s and 17.2 ± 0.9 s, respectively: "The best results were obtained by a heavily regularized DNN trained with cosine annealing warm restarts and stochastic weight averaging, achieving a mean and median absolute errors of 39.2±1.2 s and"
- [readme] We have trained state-of-the-art machine learning regressors using the 80,038 experimental RTs from the METLIN small molecule dataset (SMRT): "We have trained state-of-the-art machine learning regressors using the 80,038 experimental RTs from the METLIN small molecule dataset (SMRT)"
- [readme] Results suggest that fingerprints tend to perform better: "Results suggest that fingerprints tend to perform better"
- [readme] To train your own model or to predict the RT of your own set of compounds it is necessary to generate the fingerprints using alvaDesc software: "To train your own model or to predict the RT of your own set of compounds it is necessary to generate the fingerprints using alvaDesc software"

