Skip to content

amazon-science/ab-binding-eval

Repository files navigation

MochiBind

License

This repository contains the training code for MochiBind and the evaluation framework used to benchmark baseline models for antigen–antibody binding affinity prediction, including Graphinity, GeoDock, and Boltz2. For details, refer to publication: A Systematic Evaluation Framework for Universal Antibody–Antigen Binding Affinity Prediction and Candidate Recommendation.

The code supports model training on curated antibody–antigen datasets and standardized evaluation using pairwise and ranking-based metrics across multiple antigen systems.

Release statement

This code is being released solely for academic and scientific reproducibility purposes, in support of the methods and findings described in the associated publication. Pull requests are not being accepted in order to maintain the code exactly as it was used in the paper.

Citation

Yunrui Li, Yue Zhao, Kemal Sonmez, Luca Giancardo, Lan Guo, Pengyu Hong, Nina Cheng, Melih Yilmaz. "A Systematic Evaluation Framework for Universal Antibody–Antigen Binding Affinity Prediction and Candidate Recommendation". iScience (under review).

License

This repository is released under the Creative Commons Attribution-NonCommercial 4.0 International License (CC-BY-NC-4.0). See LICENSE for the full license text.

This is a non-commercial research release. Use of this code is permitted for academic and scientific reproducibility purposes subject to the terms of CC-BY-NC-4.0.

Repository structure

cell_submission_code/
├── checkpoint/          # Pretrained MochiBind checkpoints
├── data/                # Sampled AlphaBind data and pair files
├── model_src/           # MochiBind model, dataset, training, and evaluation code
├── evaluation_src/      # Baseline and retrieval evaluation notebooks/scripts
├── requirements.txt     # Core Python dependencies
├── requirements-graphinity.txt  # Additional dependencies for Graphinity evaluation
├── LICENSE              # CC-BY-NC-4.0 license text
└── readme.md

Directory description

checkpoint/

Contains pretrained MochiBind model checkpoints for the following antigen systems:

  • PEM
  • PP489
  • TRA
  • VHH72

These checkpoints are intended for evaluation and reproducibility checks.

data/

Contains sampled AlphaBind-derived data used for training, validation, and testing. Data described in the following paper

AlphaBind, a domain-specific model to predict and optimize antibody–antigen binding affinity. Agarwal, A. A., Harrang, J., Noble, D., McGowan, K. L., Lange, A. W., Engelhart, E., et al. (2025).
mAbs, 17(1), 2534626. https://doi.org/10.1080/19420862.2025.2534626

with the following MIT License

The .csv files include antibody/antigen sequence information and experimentally measured binding-affinity values. The .pkl files contain preprocessed pair data used by the pairwise ranking workflow.

model_src/

Contains the MochiBind implementation, including:

  • model architecture
  • dataset and dataloader construction
  • training and validation routines
  • checkpoint loading and evaluation logic

The main training entry point is in model_src/main_mean.py

Note: full training expects precomputed ESM mean embedding files saved under data_processed_esm_mean/. These files are generated using generate_esm2_embedding.py.

evaluation_src/

Contains notebooks and scripts used to evaluate MochiBind and compare against baseline models, including:

  • finetuned Graphinity
  • GeoDock
  • Boltz2

The evaluation code supports pairwise accuracy and ranking/retrieval-style evaluation.

Installation and First Run

Create a clean Python environment, then install the core MochiBind requirements:

conda create -n mochibind python=3.10
conda activate mochibind
# for CPU only
pip install -r requirements.txt

For GPU use, install the PyTorch build that matches your CUDA version before installing the remaining packages. An example is provided in requirements-gpu.txt. See the official PyTorch installation selector for the correct command. For example:

conda create -n mochibind-gpu python=3.10
conda activate mochibind-gpu
pip install -r requirements-gpu.txt

Create embeddings by running:

python data_processed_esm_mean.py

then

python model_src/main_mean.py

Graphinity baseline environment

For details of the Graphinity model and its original implementation, please refer to:

Hummer, A. M., Schneider, C., Chinery, L., & Deane, C. M. (2025). Investigating the volume and diversity of data needed for generalizable antibody-antigen ΔΔG prediction. Nature Computational Science. https://doi.org/10.1038/s43588-025-00823-8

Reproducibility notes

  • The included checkpoints can be loaded for evaluation.
  • Full training requires the expected precomputed ESM embedding directory, data_processed_esm_mean/.
  • Baseline models are evaluated using their original inference procedures where applicable.
  • Data splits and evaluation protocols follow the associated publication.

Pull requests

Pull requests are not being accepted in order to maintain the code exactly as it was used in the paper.

About

Code to support "A Systematic Evaluation Framework for Universal Antibody–Antigen Binding Affinity Prediction and Candidate Recommendation"

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Used by

Contributors

Languages