Skip to navigation

Performance in Boltz-2 NIM

View as Markdown

NIM Accuracy

The Boltz-2 NIM is based on the state-of-the-art Boltz-2 architecture for biomolecular structure prediction. The NIM’s accuracy should match that of the reference implementation when using equivalent parameters and inputs.

Running on hardware that is not listed as supported in the prerequisites section may produce results that deviate from the expected accuracy.

The accuracy of the NIM is measured by structural quality metrics such as lddt. These scores help assess the reliability of the predicted structures.

Factors Affecting NIM Performance

The performance of the Boltz-2 NIM is determined by several key factors:

Hardware Factors

  • Number and type of GPUs: More GPUs generally improve throughput for concurrent requests
  • GPU memory: Larger proteins and complexes require more GPU memory
  • Storage speed: Fast NVMe SSD storage improves model loading and caching performance

Input Complexity

  • Sequence length: Runtime scales approximately quadratically with total sequence length
  • Number of chains: Multi-chain complexes require more computation than single chains
  • Ligands and constraints: Additional molecular components increase computational cost

Model Parameters

  • Sampling steps: Higher values improve quality but significantly increase runtime
  • Recycling steps: More iterations improve accuracy with modest runtime increase
  • Diffusion samples: Multiple samples provide diversity but multiply computational cost

Performance Characteristics

Typical Runtimes

For reference, approximate runtimes on high-end hardware (8x NVIDIA H100 80GB):

Structure Prediction (Boltz2 v1.3.0 on H100):

  • ~200 residues: 2.6-4.6 seconds (TensorRT) / 5.7-7.6 seconds (PyTorch)
  • ~500 residues: 9.0-9.3 seconds (TensorRT) / 13.1-13.5 seconds (PyTorch)
  • ~1000 residues: 29.2-35.2 seconds (TensorRT) / 35.5-50.4 seconds (PyTorch)
  • ~1500 residues: 32.1-41.3 seconds (TensorRT) / 51.3-68.5 seconds (PyTorch)
  • ~2000 residues: 85.8 seconds (TensorRT) / 123.1 seconds (PyTorch)
  • Confidence score: Typically > 0.7 for well-folded proteins
  • Memory usage: ~4-8 GB GPU memory per prediction

Binding Affinity Prediction (Boltz2 v1.3.0 on H100):

  • ~200 residues: 7.6-11.6 seconds (TensorRT) / 16.8-22.0 seconds (PyTorch)
  • ~500 residues: 13.6-16.6 seconds (TensorRT) / 25.2-26.4 seconds (PyTorch)
  • ~1000 residues: 35.2-50.8 seconds (TensorRT) / 50.4-79.3 seconds (PyTorch)
  • ~1500 residues: 35.7-50.8 seconds (TensorRT) / 61.6-80.9 seconds (PyTorch)
  • ~2000 residues: 89.2 seconds (TensorRT) / 130.7 seconds (PyTorch)

Boltz2 v1.3.0 Performance Results on H100

Structure Prediction Performance

The following table shows runtime performance for Boltz2 v1.3.0 on NVIDIA H100 GPUs for structure prediction across different sequence lengths:

Sequence LengthPyTorch Runtime (s)TensorRT Runtime (s)Speedup
1865.672.602.18x
3317.584.611.64x
3758.565.251.63x
38411.427.951.44x
53013.079.001.45x
57513.539.281.46x
61613.479.001.50x
62315.5510.921.42x
62815.0510.451.44x
68416.5911.771.41x
85823.1517.771.30x
128635.4829.221.21x
146451.6633.671.53x
149659.9941.331.45x
149951.3232.131.60x
158864.2842.531.51x
175585.2256.811.50x
2033123.0785.811.43x

Binding Affinity Prediction Performance

The following table shows runtime performance for binding affinity prediction on NVIDIA H100 GPUs:

Sequence LengthPyTorch Runtime (s)TensorRT Runtime (s)Speedup
18616.817.562.22x
33121.9911.641.89x
37523.1810.102.29x
38423.9411.512.08x
53025.2113.981.80x
57526.4216.621.59x
61625.6113.641.88x
62327.6217.861.55x
62829.1417.121.70x
68429.5618.741.58x
85836.5023.681.54x
128650.4135.241.43x
146468.4541.881.63x
149679.2650.751.56x
149961.5935.661.73x
158880.9449.851.62x
175593.2960.881.53x
2033130.6789.201.47x

Performance Analysis

Key Observations:

  • TensorRT Optimization: TensorRT consistently provides 1.2x to 2.3x speedup over PyTorch across all sequence lengths
  • Structure Prediction: Average speedup of ~1.5x with TensorRT, with higher speedups for shorter sequences
  • Affinity Prediction: Generally higher speedups (1.4x to 2.3x) compared to structure prediction, with peak performance at medium sequence lengths (300-400 residues)
  • Scaling Behavior: Performance scales approximately quadratically with sequence length for both PyTorch and TensorRT implementations
  • Memory Efficiency: TensorRT optimization also provides better memory utilization, enabling processing of larger proteins

Recommended Configuration:

  • For development/testing: Use TensorRT with reduced sampling steps (25-50) for faster iteration
  • For production: Use TensorRT with default settings for optimal balance of speed and accuracy
  • For large proteins (>1500 residues): Consider domain-based approaches or increased GPU memory allocation

Performance Testing

You can test basic performance and functionality with protein structure and binding affinity prediction:

import requests
import json
import time
def test_boltz2_structure_performance():
"""Test basic protein structure prediction performance."""
url = "http://localhost:8000/biology/mit/boltz2/predict"
# Test protein: Green Fluorescent Protein (GFP) - ~240 residues
test_sequence = (
"MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTFCYGD"
"QIQEQYKGIPLDGDQVQAVNGHEFEIEGEGEGRPYEGTQTAQLNKFCDKLPVMHYKQFFDSGNYNTLS"
"AKAGFPFKVPHTYNNSSFVVKQKPGMVFKFIHGKDPGLNGQTVFLMVGGISQNLSGSSNLGVGYTFVQ"
"KTSVLLESEIKKRLRGFHTRGAVTQGLHQFVNLPTLVTQVLDGDMSQLLQVT"
)
data = {
"polymers": [
{
"id": "A",
"molecule_type": "protein",
"sequence": test_sequence
}
],
"recycling_steps": 3,
"sampling_steps": 50,
"diffusion_samples": 1,
"step_scale": 1.638,
"output_format": "mmcif"
}
print("Starting Boltz-2 structure prediction performance test...")
start_time = time.time()
response = requests.post(url, json=data)
end_time = time.time()
runtime = end_time - start_time
if response.status_code == 200:
result = response.json()
confidence = result.get('confidence_scores', [0])[0]
print(f"✓ Structure prediction successful")
print(f"✓ Runtime: {runtime:.1f} seconds")
print(f"✓ Confidence score: {confidence:.3f}")
print(f"✓ Structure format: {result['structures'][0]['format']}")
return True
else:
print(f"✗ Structure prediction failed: {response.status_code}")
print(f"✗ Error: {response.text}")
return False
def test_boltz2_affinity_performance():
"""Test binding affinity prediction performance."""
url = "http://localhost:8000/biology/mit/boltz2/predict"
# Smaller test protein for affinity testing - ~140 residues
hemoglobin_alpha = (
"MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHFDLSHGSAQVKGHGKKVADALT"
"NAVAHVDDMPNALSALSDLHAHKLRVDPVNFKLLSHCLLVTLAAHLPAEFTPAVHASLDKFLASVSTV"
"LTSKYR"
)
data = {
"polymers": [
{
"id": "A",
"molecule_type": "protein",
"sequence": hemoglobin_alpha
}
],
"ligands": [
{
"id": "HEME",
"smiles": "[Fe+2].C1=CC2=NC1=CC3=NC(=CC4=NC(=CC5=NC(=C2)C=C5)C=C4)C=C3",
"predict_affinity": True
}
],
"recycling_steps": 3,
"sampling_steps": 50,
"sampling_steps_affinity": 100, # Reduced for performance testing
"diffusion_samples_affinity": 3, # Reduced for performance testing
"output_format": "mmcif"
}
print("Starting Boltz-2 binding affinity performance test...")
start_time = time.time()
response = requests.post(url, json=data)
end_time = time.time()
runtime = end_time - start_time
if response.status_code == 200:
result = response.json()
confidence = result.get('confidence_scores', [0])[0]
print(f"✓ Affinity prediction successful")
print(f"✓ Runtime: {runtime:.1f} seconds")
print(f"✓ Confidence score: {confidence:.3f}")
if result.get("affinities"):
for ligand_id, affinity_data in result["affinities"].items():
if affinity_data.get("affinity_pic50"):
print(f"✓ Predicted pIC50 for {ligand_id}: {affinity_data['affinity_pic50'][0]:.2f} kcal/mol")
return True
else:
print(f"✗ Affinity prediction failed: {response.status_code}")
print(f"✗ Error: {response.text}")
return False
if __name__ == "__main__":
# Test both structure and affinity prediction
structure_success = test_boltz2_structure_performance()
print("\n" + "="*50 + "\n")
affinity_success = test_boltz2_affinity_performance()
if structure_success and affinity_success:
print("\n✓ All performance tests passed!")
else:
print("\n✗ Some performance tests failed.")

Performance Optimization Tips

  1. For development/testing: Use faster settings

    "recycling_steps": 2,
    "sampling_steps": 25
  2. For production quality: Use higher quality settings

    "recycling_steps": 5,
    "sampling_steps": 100
  3. For batch processing: Submit multiple concurrent requests with default settings

  4. For very large proteins (>1000 residues): Consider domain-based approaches or consult the literature for handling strategies

Troubleshooting Performance Issues

Common Issues and Solutions

General Performance Issues

  • Out of memory errors: Reduce sequence length, decrease sampling steps, or use fewer concurrent requests
  • Slow performance: Ensure fast storage (NVMe SSD), sufficient CPU cores (12+ per GPU), and adequate system RAM (48+ GB per GPU)
  • Poor quality predictions: Increase sampling steps, recycling steps, or check input sequence quality

Binding Affinity Specific Issues

  • Affinity prediction timeouts: Reduce sampling_steps_affinity and diffusion_samples_affinity for faster results
  • Unrealistic affinity values: Enable affinity_mw_correction for metal-containing ligands and verify SMILES format
  • Memory errors with affinity: Binding affinity requires 2-3x more memory than structure prediction alone
  • Inconsistent affinity results: Increase diffusion_samples_affinity to 5-7 for more reliable estimates
  • Cannot predict affinity for multiple ligands: Only one ligand per request can have predict_affinity=True

For detailed performance tuning guidance specific to your deployment, refer to the Optimization section.