Overview
AlphaFold 3 can be optimized for throughput and resource efficiency. Performance varies significantly based on:- Hardware: GPU model, CPU cores, RAM, disk speed
- Input size: Number of tokens (residues/atoms)
- Configuration: Pipeline stages, sharding, compilation
Running in Stages
Split the pipeline into CPU-only data processing and GPU inference for optimal resource utilization.- Why Split?
- Stage 1: Data Pipeline
- Stage 2: Inference
Benefits
Cost Optimization
Run genetic search on cheaper CPU instances, inference on expensive GPU instances
Reusability
Generate MSAs once, reuse for multiple inference runs with different seeds
Parallelization
Compute MSAs for individual chains, then combine for all chain pairs
Resource Matching
Use appropriate hardware for each stage
Pre-computing MSAs for Multimers
When folding multiple candidate chains with fixed chains, compute MSAs for fixed chains once.
1
Generate MSAs for Fixed Chains
chain_A_data.json with MSA and templates.2
Create Multimer Inputs
Copy
unpairedMsa, pairedMsa, and templates from pre-computed data JSONs into your multimer input:3
Run Inference
Combinatorial Optimization
For all combinations of n first chains and m second chains:Instead of n × m full runs, do n + m data pipeline runs, then n × m inference-only runs.
Data Pipeline Optimization
Disk Speed
Recommendations:- Use local SSD (not network-attached storage)
- Consider RAM-backed filesystem for maximum speed
- Avoid HDDs for databases
CPU Parallelization
AlphaFold 3 runs genetic search against 4 protein databases in parallel.
- 2 CPUs per Jackhmmer × 4 = 8 cores
- 4 CPUs per Jackhmmer × 4 = 16 cores
Sharded Databases
For multi-core systems with fast storage, shard databases to maximize parallelism.
How Sharding Works
1
Split Database
Split each database into s shards with equal distribution:
2
Rename Shards
Use pattern
prefix-<index>-of-<total> with 5-digit zero-padding:3
Reference with @
File spec:
prefix@<total_shards>Sharding Example
For a 64-core system with databases on RAM disk:- Proteins: 2 CPUs × 16 shards × 4 databases = 128 cores
- RNA: 2 CPUs × 16 shards × 3 databases = 96 cores
Model Inference Optimization
Inference Timings
Single NVIDIA A100 80GB (compile-free, in seconds):
Single NVIDIA H100 80GB (compile-free, in seconds):
This repository’s single-GPU configuration is 2-5× more efficient than the 16-GPU configuration from the paper.
GPU Memory Management
Default settings for A100/H100 80GB:Unified Memory (for larger inputs or smaller GPUs)
- Enable Unified Memory
- A100 40GB Config
For inputs >5,120 tokens or GPUs with <80GB:Trade-off: Prevents OOM by spilling to host memory, but slower due to host-device transfers.
Compilation Buckets
AlphaFold 3 uses compilation buckets to avoid excessive recompilation for different input sizes.
256, 512, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096, 4608, 5120
How it works:
- Input featurized to smallest bucket that fits
- Padded to bucket size
- If bucket exists, use cached compilation
- If not, trigger new compilation
- More buckets = more compilations, less padding
- Fewer buckets = fewer compilations, more padding
Custom Buckets
For specific input sizes:JAX Compilation Cache
Persistent compilation cache avoids recompilation between runs.
Hardware-Specific Optimizations
CUDA Capability 7.x (V100, etc.)
- With unified memory: Up to 1,280 tokens
- Numerically accurate with workaround
NVIDIA P100
- Up to 1,024 tokens
- No special configuration needed
- Numerically accurate
Required XLA Flags
Workaround for XLA compilation time issue (set by default in Dockerfile):
Performance Best Practices
1
Use Fast Storage
- SSD for databases (minimum)
- RAM disk for maximum performance
- Local storage (not network-attached)
2
Optimize CPU Usage
- Match CPU count to parallel database searches
- Consider sharding for >16 cores
- Use appropriate
jackhmmer_n_cpuvalues
3
Pre-compute When Possible
- Run data pipeline once, reuse for multiple seeds
- Pre-compute MSAs for common chains
- Share MSAs across related predictions
4
Right-size GPU
- A100 80GB: Best for ≤5,120 tokens
- H100 80GB: 1.8-1.9× faster than A100
- A100 40GB: Use with unified memory + sharding
5
Enable Caching
- JAX compilation cache for repeated runs
- Reuse
_data.jsonfiles - Consider shared cache for multi-user setups
6
Batch Strategically
- Run data pipeline in parallel for multiple inputs
- Queue inference jobs on GPU
- Use array jobs on HPC systems
Monitoring Performance
GPU Utilization
Profiling
Timing Breakdown
AlphaFold 3 logs timing information. Check logs for:
- Data pipeline time: Genetic search + template search
- Featurization time: Converting input to model features
- Compilation time: First run for each bucket size
- Inference time: Model forward pass
- Post-processing time: Generating outputs
Cost Optimization
Cloud Instance Selection
Google Cloud:- a2-ultragpu-1g: 1× A100 80GB (recommended)
- a2-highgpu-1g: 1× A100 40GB (smaller predictions)
- a3-highgpu-1g: 1× H100 80GB (fastest)
- p4d.24xlarge: 8× A100 40GB (use 1)
- p5.48xlarge: 8× H100 80GB (use 1)
- Standard_ND96asr_v4: A100 80GB
- Standard_ND96amsr_A100_v4: A100 80GB
Cost-Saving Strategies
1
Spot/Preemptible Instances
Use for data pipeline (can be interrupted and restarted)
2
Separate CPU and GPU
Run data pipeline on cheap CPU instances, inference on expensive GPU instances
3
Batch Processing
Maximize GPU utilization by queuing multiple jobs
4
Right-size Resources
Don’t over-provision RAM/CPUs. Start small and scale as needed.
Benchmark Your Setup
Test with a standard input:benchmark.json
Next Steps
Database Setup
Configure and optimize genetic databases
Output Format
Understand prediction outputs