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. Hard labels can be binary (1/0) or continuous measurements; olinda detects which per column (--task overrides). A continuous head is capped at a lower blend weight than a binary one (0.25 against 0.4), a provisional figure that has not yet been validated against real measurements.

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.4.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.4.0
File Size Uploaded Provenance Actions
olinda-1.4.0.tar.gz 873.8 kB With provenance Details for olinda-1.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.8 MB

Release files / olinda-1.4.0.tar.gz

Download URL olinda-1.4.0.tar.gz
Size 873.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5308804c6a84f0ffd9eb2796308bc4f7b448a4b7a9e3fdf2aee17568ed7e3e41
BLAKE2b-256 checksum
How to use checksums
75758253dcd74688fe7bbc1ffdd0aaaf6b649b23b944f5674ace1d1b4395d0aa
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.4.0-py3-none-any.whl

Download URL olinda-1.4.0-py3-none-any.whl
Size 882.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
692bbce4d81fc525252ec96ce32e8162d0a20dcf3b630b4d1f75f2dda76fe4be
BLAKE2b-256 checksum
How to use checksums
d6edce2b9823df7fa1f115149168fdd977e6c3a70f76132456051e24f1e9c0eb
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.4.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.4.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