Skip to main content

Olinda, model distillation for chemistry

Some ML-for-chemistry models are too slow to run on a million compounds. Olinda makes a fast one that behaves like them: score the slow model once over a reference library of ~1.4M molecules, train a compact gradient-boosting student to reproduce it, and ship the result as a single ONNX file.

Installation

Olinda is pip-installable:

pip install olinda                 # run models from Python: numpy, onnxruntime, wasmtime
pip install "olinda[cli]"          # + the `olinda` command: click, rich-click, rich, loguru, tqdm
pip install "olinda[report]"       # + `olinda validate` and its figures: pandas, pyarrow, matplotlib, onnx, stylia
pip install "olinda[train]"        # + distillation: XGBoost, LightGBM, lazy-qsar, onnxmltools, h5py

Each extra includes the one above it, so olinda[train] installs everything. No install needs RDKit: Olinda featurizes molecules with RDKit compiled to WebAssembly, which ships inside the package.

Check that the command-line tool is installed (it needs olinda[cli] or above):

olinda --help

Before distilling, download the pre-calculated fingerprints of the reference library (1.4M compounds; 2.8GB):

olinda setup

Running a model at inference time

A distilled model is one self-describing ONNX file. You can load and run the model in Python:

from olinda import OlindaArtifact

model = OlindaArtifact("model.onnx")
model.run(["CCO", "c1ccccc1"])  # one row per molecule, one column per task (model.columns)

Alternatively, you can use the CLI:

olinda predict --model-onnx model.onnx --input my_smiles.csv --output my_output.csv

Or, with nothing installed, in the browser at ersilia-os.github.io/olinda: upload the model.onnx, paste SMILES, and get the predictions as a table. It all runs locally in the browser; the model and the molecules never leave your machine.

Distilling a model

Getting your soft labels

Olinda relies on a reference library that is maintained by the Ersilia team.

Use the following command to obtain a 1-column file with the SMILES structures of the reference library:

olinda library -o ersilia_reference_library.csv

Use this file to make predictions with your model of choice. Feel free to explore models from the Ersilia Model Hub, or models trained with ZairaChem. We refer to the result of these predictions as soft labels.

Training a distilled model

Assuming you have your soft labels calculated, you can simply get a distilled (surrogate model) as follows:

olinda fit --soft-labels my_soft_labels.csv --model-onnx my_model.onnx

Optionally, you can provide hard labels (ground truth) if you have them. For now, only binary (1/0) labels are allowed as hard labels.

olinda fit --soft-labels my_soft_labels.csv --hard-labels my_hard_labels.csv --model-onnx my_model.onnx

Evaluating a distilled model

The easiest way to evaluate a distilled model is to pass an additional set of soft-labels (and optionally hard labels):

olinda validate --soft-labels my_validation_soft_labels.csv --model-onnx my_model.onnx --output-dir my_report_folder

Commands

The olinda command comes with olinda[cli]; validate also needs olinda[report], and the distilling commands need olinda[train].

Command What it does
setup Download the reference library's Morgan fingerprints
library Write the reference library's SMILES to a CSV
fit Distil a teacher into a student end-to-end
predict Run a distilled model.onnx on SMILES
validate Score a model against labelled data and write a report

fit drives the step-by-step pipeline below; run the steps yourself to inspect or redo one of them.

Command What it does
prepare Set up a run directory from the soft (and hard) labels
learn-soft Train the surrogate on the teacher's soft labels
learn-hard Train on hard labels and calibrate onto the soft-label scale
export Rebuild model.onnx for a trained run
clean Move the model out of the run and delete the working folder

About the Ersilia Open Source Initiative

The Ersilia Open Source Initiative is a tech-nonprofit organization fueling sustainable research in the Global South. Ersilia's main asset is the Ersilia Model Hub, an open-source repository of AI/ML models for antimicrobial drug discovery.

Ersilia Logo

Metadata

Release files for olinda 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for olinda 1.3.0
File Size Uploaded Provenance Actions
olinda-1.3.0.tar.gz 869.8 kB With provenance Details for olinda-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for olinda 1.3.0
File Interpreter ABI Platform Actions
olinda-1.3.0-py3-none-any.whl Python 3 none any Details for olinda-1.3.0-py3-none-any.whl

Total release size: 1.8 MB

Release files / olinda-1.3.0.tar.gz

Download URL olinda-1.3.0.tar.gz
Size 869.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f6bad5739fa624cdae61ce784c600740ea236c6528bfbcdf4ee39ee2fdf0bfd6
BLAKE2b-256 checksum
How to use checksums
1c931a8403d99094724ec8e96d03235d29915d17ca52ed93861c956b9236c531
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / olinda-1.3.0-py3-none-any.whl

Download URL olinda-1.3.0-py3-none-any.whl
Size 880.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61ede09ca288920fe2481e89e64fbc0fa677159e50b7a15ab44c2a26afb53284
BLAKE2b-256 checksum
How to use checksums
b22c9b3de9beb6561c98a88924e4196192bc45071cc1c8c340c724e0f36b52e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for olinda 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for olinda-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page