GitHub - NVIDIA-BioNeMo/bionemo-framework: BioNeMo Framework: For building and adapting AI models in drug discovery at scale (original) (raw)

BioNeMo Recipes

BioNeMo Recipes provides an easy path for the biological foundation model training community to scale up transformer-based models efficiently. Rather than offering a batteries-included training framework, BioNeMo Recipes provide model checkpoints with TransformerEngine (TE) layers and training recipes that demonstrate how to achieve maximum throughput with popular open-source frameworks and fully sharded data parallel (FSDP) scale-out.

Overview

The biological AI community actively prototypes model architectures and needs tooling that prioritizes extensibility, interoperability, and ease-of-use, alongside performance. BioNeMo Recipes addresses this by offering:

Performance Benchmarks

ESM2 native TE benchmarks chart showing performance results
Training benchmarks for ESM-2 using the esm2nativete recipe.

Use Cases

The use cases of BioNeMo Recipes include:

Supported Recipes and Models

Directory Description FSDP BF16 FP8[1] THD FP8 + THD MXFP8[2] NVFP4[3] CP
models/amplify, available on Hugging Face TE accelerated protein BERT, Amgen 🚧 🚧
models/esm2, available on Hugging Face TE accelerated protein BERT, Meta
models/llama3 TE accelerated Llama 3, Meta
models/mixtral TE accelerated Mixtral-style MoE model 🚧
models/qwen TE accelerated Qwen2.5/Qwen3 model 🚧
recipes/esm2_native_te Recipe for esm2/amplify + native PyTorch mFSDP, FSDP2
recipes/llama3_native_te Recipe for llama3 + native PyTorch FSDP2
recipes/opengenome2_llama_native_te OpenGenome2 recipe for llama3 + native PyTorch FSDP2 🚧
recipes/codonfm_native_te Native PyTorch recipe for CodonFM FSDP2
recipes/esm2_accelerate_te Recipe for esm2/amplify TE + HF Accelerate FSDP, FSDP2 🚧 🚧 🚧 🚧
recipes/codonfm_ptl_te PyTorch Lightning recipe for CodonFM FSDP 🚧 🚧 🚧 🚧
recipes/geneformer_native_te_mfsdp_fp8 Recipe for geneformer HF model mFSDP 🚧 🚧 🚧 🚧
recipes/vit Recipe for vision transformer mFSDP 🚧

✅: Supported
🚧: Under development, will be supported soon
❌: Not supported

Abbreviations:

[1]: Requires compute capability 9.0 and above (Hopper+)
[2]: Requires compute capability 10.0 and 10.3 (Blackwell), 12.0 support pending
[3]: Requires compute capability 10.0 and above (Blackwell+)

Repository Structure

This repository contains three types of components:

Models (models/)

Huggingface-compatible PreTrainedModel classes that use TransformerEngine layers internally. These are designed to be:

Example models include ESM-2, Geneformer, and AMPLIFY.

Recipes (recipes/)

Self-contained training examples demonstrating best practices for scaling biological foundation models. Each recipe is a complete Docker container with:

Recipes are not pip-installable packages but serve as reference implementations that users can adapt for their own research.

Interpretability (interpretability/)

Research tools and workflows for inspecting biological foundation models, including sparse autoencoder training, feature analysis, and model behavior exploration.

Quick Start

This section describe how you can get started with BioNeMo Recipes.

Loading Models

Run the following to load the BioNeMo model.

from transformers import AutoModel, AutoTokenizer

Load a BioNeMo model directly from Hugging Face

model = AutoModel.from_pretrained("nvidia/AMPLIFY_120M") tokenizer = AutoTokenizer.from_pretrained("nvidia/AMPLIFY_120M")

Running Recipes

Build and run recipes with the following.

Navigate to a recipe

cd recipes/esm2_native_te

Build and run

docker build -t esm2_recipe . docker run --rm -it --gpus all esm2_recipe python train.py

Setting Up the Development Environment

  1. Install pre-commit hooks:
    Run hooks manually:
    pre-commit run --all-files
  2. **Test your changes:**Each model and recipe has its own build and test setup following this pattern:
    cd models/my_model # or recipes/my_recipe
    docker build . -t my_tag
    docker run --rm -it --gpus all my_tag pytest -v .

Coding Guidelines

BioNeMo Recipes prioritize readability and simplicity over comprehensive feature coverage:

Testing Strategy

BioNeMo Recipes use a three-tier testing approach:

L0 Tests (Pre-merge)

L1 Tests (Performance Monitoring)

L2 Tests (Release Validation)

Adding New Components

With BioNeMo Recipes, you can add new components including models and recipes.

Adding a New Model

Models should be pip-installable packages that can export checkpoints to Hugging Face. Refer to themodels README for detailed guidelines on:

Adding a New Recipe

Recipes should be self-contained Docker environments demonstrating specific training patterns. Refer to the recipes README for guidance on:

CI/CD Contract

All components must pass this basic validation:

docker build -t {component_tag} . docker run --rm -it --gpus all {component_tag} pytest -v .

Running CI/CD

To run the CI/CD pipeline locally, run the following command:

Performance Expectations

We aim to provide the fastest available training implementations for biological foundation models, with documented benchmarks across NVIDIA hardware (A100, H100, H200, B100, B200, etc.).

Contributing

We welcome contributions that advance the state of biological foundation model training. Ensure your contributions:

For detailed contribution guidelines, refer to our individual component READMEs:

License

This project is licensed under the terms described in LICENSE/license.txt.

Support

For technical support and questions: