How bytedance/protenix works
Project Purpose and Type
• Protenix is a trainable protein structure prediction tool (an AlphaFold3 reproduction) built in PyTorch.
• It supports both model training and inference, features a command-line interface (CLI), Docker deployment, and a web service (for online inference).
• Additional functionalities include MSA (Multiple Sequence Alignment) search, PDB/CIF conversion, and integration with external tools (e.g., Protenix-Dock for docking).
Main Components
A. Interface and Entry Points:
• CLI/Runner: Represented by the “runner” and “scripts” directories. This includes different command-line tools such as training (runner/train.py), inference (runner/inference.py), MSA search (runner/msa_search.py), and conversion utilities.
• Web Service: Represented by the “protenix/web_service” module. Capture that this component exposes endpoints (e.g., REST APIs) and integrates with the visualization tools (e.g., PyMOL integration).
• Notebooks: There’s a “notebooks” directory that provides example Jupyter notebooks (e.g., “protenix_inference.ipynb”) for interactive experimentation.
B. Core Processing Modules:
• Data Pipeline: Encompass the “protenix/data” module and related scripts. This component is responsible for data ingestion, preprocessing, JSON conversion from PDB/CIF files, MSA parsing (using “msa_featurizer.py” and “msa_utils.py”) and the pipeline to prepare training/inference input.
• Configuration: Both the “configs” directory and “protenix/config” package handle configurations (different settings for inference, training, and data pipelines).
• Model: Central to the project. The “protenix/model” module includes:
• Core network architecture (e.g., transformers, diffusion modules, embedders, pairformer).
• Loss functions and utility functions for predictions.
• The “layer_norm” submodule that shows custom CUDA kernels and integration of high-performance computing components.
• Extended Model Components: The “protenix/openfold_local” subdirectory integrates modules borrowed from OpenFold. These include additional data transformations, the dropout layer, triangular attention modules, and utilities for working with residue constants.
C. Supporting Components:
• Metrics and Evaluation: The “protenix/metrics” directory provides modules for computing metrics such as RMSD, LDDT, and clash calculations to evaluate model predictions.
• Utility Functions: “protenix/utils” (and nested subdirectories like permutation, torch_utils, etc.) encapsulate distributed training helpers, logging, file I/O, learning rate scheduling, and other support routines.
• Tests: A dedicated “tests” directory ensures the individual modules are verifiable via automated tests.
• Documentation and Examples: The “docs” and “examples” directories provide operational guides, MSA pipeline details, training setup, and inference examples.
Depicting Relationships and Data Flow
• That the “data” pipeline feeds into the “model” sub-system, where inputs are transformed into feature representations for training or inference.
• Once the model produces predictions, the results flow to:
• The output handling components (e.g., JSON converters, prediction visualization in the “web_service”).
• Evaluation modules (calculate metrics using code from “protenix/metrics”).
• Some dependency edges to external systems (e.g., Docker for deployment, PyTorch as the underlying compute framework, and optional integration with PyMOL or external MSA servers).
Architectural Patterns and Principles
• Modular separation by grouping components into distinct layers (Interface, Data Processing, Model, and Utilities).
• Clearly defined APIs between modules: the runners/scripts act as controllers that orchestrate calls to the data, model, and inference modules.
• That many modules (data parsing, configuration, and model utilities) adhere to separation-of-concerns, making it easier to extend or debug subsets of functionality.
Final Recommendations
• That each component has clear labels and that data flows (especially between the data pipeline, the model, and output reporting components) are explicit.