Skip to main content

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.

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

This creates 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

Genetic search is I/O intensive. Disk speed significantly impacts performance.
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.
Optimal CPU allocation:
For example:
  • 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:
Resource utilization:
  • Proteins: 2 CPUs × 16 shards × 4 databases = 128 cores
  • RNA: 2 CPUs × 16 shards × 3 databases = 96 cores
Aim for consistent shard sizes. If database A is 3× smaller than B and A has 16 shards, B should have 48 shards.

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)

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.
Default buckets: 256, 512, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096, 4608, 5120 How it works:
  1. Input featurized to smallest bucket that fits
  2. Padded to bucket size
  3. If bucket exists, use cached compilation
  4. If not, trigger new compilation
Trade-off:
  • More buckets = more compilations, less padding
  • Fewer buckets = fewer compilations, more padding

Custom Buckets

For specific input sizes:
This compiles once for 5376-token bucket, avoiding 3 separate compilations.

JAX Compilation Cache

Persistent compilation cache avoids recompilation between runs.
For Google Cloud Storage:

Hardware-Specific Optimizations

CUDA Capability 7.x (V100, etc.)

Numeric issues with custom kernel fusion. Must disable:
V100 capabilities:
  • 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):
For CUDA 7.x, combine both:

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_cpu values
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.json files
  • 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)
AWS:
  • p4d.24xlarge: 8× A100 40GB (use 1)
  • p5.48xlarge: 8× H100 80GB (use 1)
Azure:
  • 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