Performance in OpenFold3 NIM#

NIM Accuracy#

OpenFold3 is an all-atom biomolecular complex structure prediction model from the OpenFold Consortium and the AlQuraishi Laboratory. OpenFold3 is a PyTorch implementation of the jax-based AlphaFold3 reported in Accurate structure prediction of biomolecular interactions with AlphaFold 3, and like AlphaFold3, OpenFold3 extends protein structure prediction capabilities to model complete biomolecular complexes including proteins, DNA, RNA, and small molecule ligands.

The OpenFold3 NIM’s accuracy should match that of the AlQuraishi Laboratory implementation of OpenFold3, when using equivalent parameters and inputs.

Note

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 (local distance difference test). These scores help assess the reliability of the predicted structures.

Factors Affecting NIM Performance#

The performance of the OpenFold3 NIM is determined by several key factors:

Hardware Factors#

  • GPU type and memory: Different GPU architectures provide different performance levels

  • System RAM: Larger proteins and complexes require more system memory

  • Storage speed: Fast NVMe SSD storage improves model loading and caching performance

Input Complexity#

  • Sequence length: Runtime increases with total sequence length

  • Number of chains: Multi-chain complexes require more computation than single chains

  • MSA size: Larger MSAs can improve accuracy but increase memory usage and computation time

  • Ligands, DNA, RNA: Additional molecular components increase computational cost

Model Configuration#

  • Diffusion samples: Multiple samples provide diversity but multiply computational cost

Performance Characteristics#

Typical Runtimes#

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

Structure Prediction (OpenFold3 NIM v1.6.0 on NVIDIA H100 80GB):

  • ~200 residues: 2.9-3.6 seconds

  • ~300-400 residues: 4.5-12.6 seconds

  • ~500-600 residues: 11.6-26.8 seconds

  • ~800-900 residues: 20.6 seconds

  • ~1300-1500 residues: 30.5-53.1 seconds

  • ~1700-1900 residues: 56.5-72.5 seconds

  • Memory usage: Varies with sequence length, typically 40-80GB GPU memory

Note

Short sequences improved substantially in 1.6.0. In earlier releases, runtime below roughly 400 residues was dominated by fixed per-request overhead rather than by the model itself, so a 186-residue input cost almost as much as a 600-residue one. CUDA graph capture removes most of that overhead, so runtime now tracks sequence length across the whole range.

Performance Notes The total runtime for structure prediction depends on:

  • Total number of residues in the complex

  • Total number of atoms in the complex

  • Number of molecules and chains

  • Number of sequences in the MSAs

  • Number of diffusion samples requested

Performance Results on H100#

The following table shows OpenFold3 NIM runtime on NVIDIA H100 80GB, with and without structural template processing.

Note

Structural template support is available starting from version 1.1.0.

Test ID

Seq Length

Without structural templates (s)

With structural templates (s)

8eil

186

2.93

4.62

7r6r

203

3.64

4.94

1a3n

287

12.63

22.54

8c4d

331

4.55

5.01

7qsj

375

5.80

6.57

8cpk

384

9.21

10.98

8are

530

11.56

12.47

8owf

575

12.68

12.94

8aw3

590

26.84

28.34

7tpu

616

9.76

10.66

7ylz

623

17.54

18.80

8gpp

628

15.28

21.33

8clz

684

16.36

17.96

8k7x

858

20.62

22.30

8ibx

1286

30.46

32.26

8gi1

1464

43.93

46.70

8sm6

1496

53.12

58.54

8pso

1499

42.72

45.76

8jue

1657

56.52

61.74

8bsh

1762

63.19

68.27

5xgo

1869

72.52

87.65

All runtimes are in seconds for end-to-end structure prediction with a single diffusion sample. The template measurements include an average of 4 CIF template files per protein chain. The additional time is primarily attributed to CIF parsing.

Performance Analysis#

Key Observations:

  • Scaling Behavior: Runtime increases with total sequence length and with the number of chains and atoms in the complex.

  • Change from 1.5.0: CUDA graph capture removed a fixed per-request cost of roughly 7-8 seconds on H100, so comparing these numbers with the 1.5.0 table shows a ratio that shrinks as inputs grow, from about 3.5x at 186 residues to about 1.15x at 1869, even though the same amount of time was saved in both cases. Read the difference between the two releases, not the ratio.

  • Hardware range: The fastest SKUs (GB200, GB300) complete typical predictions in roughly 75% of the H100 time, with B200, H200 and GH200 at 88-91%. A100-class parts take 1.4-1.7x the H100 time. Refer to Table 1 for per-SKU numbers.

  • Small proteins (<400 residues): Complete in ~3-13 seconds on H100.

  • Large proteins (>1500 residues): Complete in ~43-73 seconds on H100.

Template Processing Impact:

  • Template overhead: Structural templates add modest overhead (typically 1-9 seconds) depending on sequence length and chain count.

  • Primary cost: The additional time is mostly attributed to CIF parsing (average 4 templates per chain).

  • Overall impact: Templates provide structural guidance with minimal performance cost.

Recommended Configuration:

  • For large proteins (>1800 residues): Prefer high-memory GPUs; actual requirements depend on workload (MSA depth, templates, and molecule composition). Refer to Table 1 for measured per-SKU results.

  • For template-guided predictions: Structural templates add minimal performance overhead.

Configuration#

The benchmarks use the following configuration:

Parameter

Setting

diffusion_samples

1

output_format

pdb

GPU

H100 80GB

structural_templates

Average 4 CIF files per chain

Performance Metrics#

The following table contains end-to-end runtime (seconds) for the OpenFold3 NIM across supported NVIDIA hardware units. Inputs are the same 21 benchmark cases, arranged by sequence length and annotated with PDB ID and sequence length.

Table 1: Performance Across the Supported NVIDIA Hardware Units#

The table shows the prediction times for tests with varying sequence lengths for hardware units. It features the following:

  • Hardware: Nineteen supported GPU SKUs (NVIDIA H100 80GB HBM3, H100 NVL, H100 PCIe, H200, H200 NVL, B200, B300, GB200, GB300, GH200, A100 SXM4 80GB, A100 80GB PCIe, A100 SXM4 40GB, A100 40GB PCIe, L40S, RTX PRO 6000 Blackwell Server Edition, RTX PRO 6000 Blackwell Workstation Edition, RTX 6000 Ada Generation, and DGX Spark GB10). One tab per SKU.

  • Metric: End-to-end predict time (seconds).

  • Configuration: Default model; no structural templates. Inputs sorted by sequence length and annotated with PDB ID and sequence length.

Note

A dash (—) means the case was not measured on that SKU. The benchmark suite caps input length on memory-constrained parts: 1500 residues on the 40-48 GB GPUs (L40S, RTX 6000 Ada, A100 SXM4 40GB, A100 40GB PCIe) and 1800 residues on GB10. These are benchmark limits, not limits the NIM enforces. The NIM itself imposes no maximum sequence length. Longer inputs on those GPUs may still run, but are not covered by these measurements.

Test ID

Seq Length

predict_time (s)

8eil

186

2.93

7r6r

203

3.64

1a3n

287

12.63

8c4d

331

4.55

7qsj

375

5.80

8cpk

384

9.21

8are

530

11.56

8owf

575

12.68

8aw3

590

26.84

7tpu

616

9.76

7ylz

623

17.54

8gpp

628

15.28

8clz

684

16.36

8k7x

858

20.62

8ibx

1286

30.46

8gi1

1464

43.93

8sm6

1496

53.12

8pso

1499

42.72

8jue

1657

56.52

8bsh

1762

63.19

5xgo

1869

72.52

Test ID

Seq Length

predict_time (s)

8eil

186

2.86

7r6r

203

3.56

1a3n

287

12.37

8c4d

331

4.45

7qsj

375

5.73

8cpk

384

8.74

8are

530

11.24

8owf

575

12.51

8aw3

590

25.93

7tpu

616

9.69

7ylz

623

16.92

8gpp

628

14.81

8clz

684

15.85

8k7x

858

20.94

8ibx

1286

30.33

8gi1

1464

46.15

8sm6

1496

55.16

8pso

1499

44.96

8jue

1657

59.89

8bsh

1762

68.00

5xgo

1869

78.09

Test ID

Seq Length

predict_time (s)

8eil

186

3.06

7r6r

203

3.96

1a3n

287

14.23

8c4d

331

5.12

7qsj

375

6.58

8cpk

384

10.44

8are

530

13.07

8owf

575

14.18

8aw3

590

29.84

7tpu

616

11.69

7ylz

623

19.59

8gpp

628

17.08

8clz

684

18.50

8k7x

858

25.11

8ibx

1286

37.68

8gi1

1464

56.81

8sm6

1496

66.62

8pso

1499

55.48

8jue

1657

73.93

8bsh

1762

82.75

5xgo

1869

95.95

Test ID

Seq Length

predict_time (s)

8eil

186

2.63

7r6r

203

3.26

1a3n

287

11.34

8c4d

331

4.09

7qsj

375

5.27

8cpk

384

8.08

8are

530

10.22

8owf

575

11.38

8aw3

590

23.46

7tpu

616

8.72

7ylz

623

15.46

8gpp

628

13.48

8clz

684

14.61

8k7x

858

18.60

8ibx

1286

26.43

8gi1

1464

39.14

8sm6

1496

47.36

8pso

1499

38.68

8jue

1657

51.20

8bsh

1762

57.24

5xgo

1869

66.04

Test ID

Seq Length

predict_time (s)

8eil

186

2.70

7r6r

203

3.41

1a3n

287

11.49

8c4d

331

4.34

7qsj

375

5.47

8cpk

384

8.51

8are

530

10.52

8owf

575

11.69

8aw3

590

23.78

7tpu

616

9.08

7ylz

623

15.59

8gpp

628

13.98

8clz

684

15.09

8k7x

858

19.44

8ibx

1286

28.37

8gi1

1464

42.25

8sm6

1496

50.46

8pso

1499

42.09

8jue

1657

55.16

8bsh

1762

61.68

5xgo

1869

71.70

Test ID

Seq Length

predict_time (s)

8eil

186

2.62

7r6r

203

3.16

1a3n

287

11.27

8c4d

331

3.98

7qsj

375

4.95

8cpk

384

7.87

8are

530

10.35

8owf

575

10.99

8aw3

590

23.56

7tpu

616

8.15

7ylz

623

15.75

8gpp

628

13.60

8clz

684

14.54

8k7x

858

19.37

8ibx

1286

28.07

8gi1

1464

34.75

8sm6

1496

43.01

8pso

1499

41.55

8jue

1657

56.35

8bsh

1762

63.47

5xgo

1869

74.35

Test ID

Seq Length

predict_time (s)

8eil

186

2.49

7r6r

203

2.95

1a3n

287

11.41

8c4d

331

3.86

7qsj

375

5.03

8cpk

384

7.92

8are

530

13.65

8owf

575

14.42

8aw3

590

23.09

7tpu

616

8.27

7ylz

623

15.53

8gpp

628

17.61

8clz

684

18.46

8k7x

858

23.19

8ibx

1286

32.76

8gi1

1464

39.51

8sm6

1496

51.06

8pso

1499

40.97

8jue

1657

55.87

8bsh

1762

63.18

5xgo

1869

73.23

Test ID

Seq Length

predict_time (s)

8eil

186

2.73

7r6r

203

3.23

1a3n

287

9.47

8c4d

331

3.71

7qsj

375

4.57

8cpk

384

6.49

8are

530

8.48

8owf

575

9.43

8aw3

590

19.40

7tpu

616

7.08

7ylz

623

12.29

8gpp

628

10.75

8clz

684

11.56

8k7x

858

15.32

8ibx

1286

22.52

8gi1

1464

27.58

8sm6

1496

33.20

8pso

1499

34.19

8jue

1657

46.35

8bsh

1762

52.04

5xgo

1869

61.60

Test ID

Seq Length

predict_time (s)

8eil

186

2.82

7r6r

203

3.25

1a3n

287

9.51

8c4d

331

3.79

7qsj

375

4.62

8cpk

384

6.63

8are

530

8.56

8owf

575

9.51

8aw3

590

19.43

7tpu

616

7.09

7ylz

623

12.33

8gpp

628

10.96

8clz

684

11.65

8k7x

858

15.40

8ibx

1286

22.58

8gi1

1464

27.67

8sm6

1496

33.17

8pso

1499

34.12

8jue

1657

46.28

8bsh

1762

52.15

5xgo

1869

61.44

Test ID

Seq Length

predict_time (s)

8eil

186

2.85

7r6r

203

3.31

1a3n

287

10.55

8c4d

331

4.24

7qsj

375

5.27

8cpk

384

7.03

8are

530

9.76

8owf

575

10.71

8aw3

590

22.62

7tpu

616

9.54

7ylz

623

14.14

8gpp

628

12.71

8clz

684

13.98

8k7x

858

19.01

8ibx

1286

29.27

8gi1

1464

47.74

8sm6

1496

53.82

8pso

1499

46.22

8jue

1657

62.32

8bsh

1762

71.89

5xgo

1869

82.37

Test ID

Seq Length

predict_time (s)

8eil

186

4.22

7r6r

203

5.02

1a3n

287

16.79

8c4d

331

6.60

7qsj

375

8.24

8cpk

384

12.10

8are

530

15.61

8owf

575

17.03

8aw3

590

34.98

7tpu

616

14.49

7ylz

623

22.80

8gpp

628

20.59

8clz

684

22.35

8k7x

858

29.62

8ibx

1286

43.61

8gi1

1464

66.33

8sm6

1496

77.76

8pso

1499

64.84

8jue

1657

87.04

8bsh

1762

95.62

5xgo

1869

114.93

Test ID

Seq Length

predict_time (s)

8eil

186

3.61

7r6r

203

4.73

1a3n

287

16.57

8c4d

331

6.25

7qsj

375

7.97

8cpk

384

12.17

8are

530

15.13

8owf

575

16.62

8aw3

590

34.70

7tpu

616

14.22

7ylz

623

23.24

8gpp

628

20.64

8clz

684

22.47

8k7x

858

30.17

8ibx

1286

44.84

8gi1

1464

69.88

8sm6

1496

82.40

8pso

1499

68.07

8jue

1657

91.98

8bsh

1762

101.94

5xgo

1869

121.19

Test ID

Seq Length

predict_time (s)

8eil

186

4.38

7r6r

203

5.62

1a3n

287

19.67

8c4d

331

7.27

7qsj

375

9.43

8cpk

384

14.38

8are

530

17.56

8owf

575

19.03

8aw3

590

41.09

7tpu

616

16.06

7ylz

623

26.55

8gpp

628

23.43

8clz

684

25.23

8k7x

858

33.33

8ibx

1286

48.26

8gi1

1464

73.28

8sm6

1496

87.23

8pso

1499

71.20

8jue

1657

—

8bsh

1762

—

5xgo

1869

—

Test ID

Seq Length

predict_time (s)

8eil

186

4.23

7r6r

203

5.53

1a3n

287

20.30

8c4d

331

7.33

7qsj

375

9.47

8cpk

384

14.60

8are

530

18.56

8owf

575

20.08

8aw3

590

43.77

7tpu

616

16.89

7ylz

623

28.38

8gpp

628

25.14

8clz

684

26.98

8k7x

858

35.76

8ibx

1286

53.41

8gi1

1464

80.47

8sm6

1496

95.66

8pso

1499

78.19

8jue

1657

—

8bsh

1762

—

5xgo

1869

—

Test ID

Seq Length

predict_time (s)

8eil

186

2.98

7r6r

203

3.92

1a3n

287

19.15

8c4d

331

5.81

7qsj

375

7.87

8cpk

384

11.74

8are

530

17.06

8owf

575

19.21

8aw3

590

40.26

7tpu

616

17.08

7ylz

623

25.96

8gpp

628

23.47

8clz

684

25.78

8k7x

858

35.98

8ibx

1286

58.12

8gi1

1464

93.17

8sm6

1496

106.68

8pso

1499

87.18

8jue

1657

—

8bsh

1762

—

5xgo

1869

—

Test ID

Seq Length

predict_time (s)

8eil

186

2.79

7r6r

203

3.37

1a3n

287

13.78

8c4d

331

4.50

7qsj

375

5.76

8cpk

384

9.17

8are

530

12.36

8owf

575

13.97

8aw3

590

28.57

7tpu

616

11.38

7ylz

623

18.88

8gpp

628

16.59

8clz

684

18.06

8k7x

858

24.48

8ibx

1286

37.60

8gi1

1464

57.13

8sm6

1496

67.16

8pso

1499

57.96

8jue

1657

78.68

8bsh

1762

86.09

5xgo

1869

102.24

Test ID

Seq Length

predict_time (s)

8eil

186

2.33

7r6r

203

2.86

1a3n

287

12.21

8c4d

331

3.88

7qsj

375

5.01

8cpk

384

8.34

8are

530

10.92

8owf

575

11.98

8aw3

590

25.72

7tpu

616

10.61

7ylz

623

17.22

8gpp

628

14.94

8clz

684

16.43

8k7x

858

22.64

8ibx

1286

35.02

8gi1

1464

55.24

8sm6

1496

64.27

8pso

1499

55.12

8jue

1657

75.62

8bsh

1762

83.73

5xgo

1869

98.91

Test ID

Seq Length

predict_time (s)

8eil

186

2.90

7r6r

203

3.73

1a3n

287

18.10

8c4d

331

5.59

7qsj

375

7.66

8cpk

384

11.88

8are

530

16.46

8owf

575

18.02

8aw3

590

38.80

7tpu

616

16.17

7ylz

623

25.11

8gpp

628

22.46

8clz

684

25.05

8k7x

858

35.61

8ibx

1286

54.70

8gi1

1464

88.55

8sm6

1496

101.91

8pso

1499

84.60

8jue

1657

—

8bsh

1762

—

5xgo

1869

—

Test ID

Seq Length

predict_time (s)

8eil

186

7.01

7r6r

203

11.69

1a3n

287

51.76

8c4d

331

18.41

7qsj

375

23.53

8cpk

384

25.21

8are

530

45.11

8owf

575

53.42

8aw3

590

94.69

7tpu

616

56.78

7ylz

623

65.16

8gpp

628

62.94

8clz

684

72.86

8k7x

858

111.42

8ibx

1286

184.24

8gi1

1464

456.44

8sm6

1496

511.18

8pso

1499

421.23

8jue

1657

657.04

8bsh

1762

751.01

5xgo

1869

—

Performance Optimization Tips#

  • GPU Selection: Use any of the supported GPUs listed in Table 1. For best throughput, prefer higher-performance SKUs such as B200, H100, and H200.

  • Sequence Length: Performance scales with sequence length.

  • Multiple Samples: Setting diffusion_samples > 1 increases runtime in affine fashion (input featurization time is independent of diffusion_samples).

  • MSA Size: While larger MSAs can improve accuracy, they also increase memory usage and computation time. Consider filtering MSAs for very large proteins.

  • Structural Templates: Templates add modest overhead (1-10 seconds) but can significantly improve prediction accuracy. Refer to Template Processing for guidance.

  • Batch Processing: For multiple independent predictions, process them sequentially or use multiple NIM instances.

  • Memory Management: Ensure adequate GPU memory for your target sequence lengths. Very long sequences (>1800 residues) are memory-intensive, and actual requirements depend on workload characteristics (MSA depth, templates, and molecule composition). Refer to Table 1 for measured per-SKU results.

Reproducing Performance Benchmarks#

Overview#

This section provides scripts and instructions for reproducing the performance metrics reported above. The benchmarking process is as follows:

  1. Run inference with OpenFold3 NIM to generate predicted structures

  2. Use OpenStructure (OST) to compare predictions against reference structures

  3. Extract accuracy metrics like lDDT (local Distance Difference Test)

Prerequisites#

Run the OpenFold3 NIM#

Before running benchmarks, ensure that OpenFold3 NIM is deployed and running. The benchmarking scripts send inference requests to the NIM service.

Verify NIM is Running:

# Check if NIM is accessible and ready
curl http://localhost:8000/v1/health/ready

# Expected response:
# {"object":"health.response","message":"ready","status":"ready"}

Note

The default NIM URL is http://localhost:8000. If your NIM is running on a different host or port, you’ll need to specify it using the --nim-url parameter when running benchmarks. For detailed deployment instructions and configuration options, refer to the Getting Started guide.

Install the OpenStructure Docker Image#

OpenStructure is a computational structural biology framework that provides tools for structure comparison and validation. You’ll need the OpenStructure Docker image for running benchmarks:

# Pull the latest OpenStructure image from the OST registry
docker pull registry.scicore.unibas.ch/schwede/openstructure:latest

# Verify the installation
docker run --rm -v $(pwd):/home registry.scicore.unibas.ch/schwede/openstructure:latest --version

# Expected response:
# OpenStructure 2.11.1

Download Reference Structures#

You’ll need reference structures (ground truth) in CIF format for comparison. These are experimentally determined structures from the Protein Data Bank (PDB):

  • CIF (Crystallographic Information File): A standard format for representing molecular structures, including atomic coordinates, experimental metadata, and structural annotations

  • Obtaining reference structures: Download from RCSB PDB using the PDB IDs from the performance table (e.g., 8eil, 7r6r, 1a3n)

Example:

# reate directories
mkdir -p references

# Download a reference structure (e.g., 8eil) to references folder
wget https://files.rcsb.org/download/8eil.cif -O references/8eil.cif

Preparing Input JSON Files#

What are Input JSON Files?

Input JSON files contain the sequence information needed for OpenFold3 NIM to make predictions. Each file specifies:

  • Protein sequences (amino acid chains)

  • Chain IDs

  • Optional: DNA, RNA, ligands, MSAs, templates

Example Input JSON Structure#

{
  "name": "8eil",
  "sequences": [
    {
      "protein": {
        "id": "A",
        "sequence": "MKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF..."
      }
    }
  ]
}

Create Input JSON Files#

You can create input JSON files by extracting sequences from PDB structures. Save this script as generate_inputs.py:

#!/usr/bin/env python3
"""Generate input JSON files from PDB structures."""
import argparse
import json
import requests
import sys
from pathlib import Path

def fetch_sequences_from_pdb(pdb_id):
    """Fetch protein sequences from RCSB PDB FASTA endpoint."""
    url = f"https://www.rcsb.org/fasta/entry/{pdb_id}"
    response = requests.get(url)
    if response.status_code != 200:
        raise Exception(f"Failed to fetch FASTA for {pdb_id}")
    
    sequences = []
    current_seq = []
    chain_index = 0
    
    for line in response.text.strip().split('\n'):
        if line.startswith('>'):
            if current_seq:
                # Use sequential chain IDs: A, B, C, D, ...
                chain_id = chr(65 + chain_index)
                sequences.append({
                    "protein": {
                        "id": chain_id,
                        "sequence": ''.join(current_seq)
                    }
                })
                chain_index += 1
            current_seq = []
        else:
            current_seq.append(line.strip())
    
    # Don't forget the last sequence
    if current_seq:
        chain_id = chr(65 + chain_index)
        sequences.append({
            "protein": {
                "id": chain_id,
                "sequence": ''.join(current_seq)
            }
        })
    
    return sequences

def create_input_json(pdb_id):
    """Create OpenFold3 input JSON file for a PDB structure."""
    output_dir = Path("inputs")
    output_dir.mkdir(parents=True, exist_ok=True)
    
    print(f"Fetching sequences for {pdb_id}...")
    sequences = fetch_sequences_from_pdb(pdb_id)
    
    input_data = {
        "name": pdb_id,
        "sequences": sequences
    }
    
    output_path = output_dir / f"{pdb_id}_input.json"
    with open(output_path, 'w') as f:
        json.dump(input_data, f, indent=2)
    
    print(f"Created {output_path} ({len(sequences)} chain(s))")
    return output_path

if __name__ == "__main__":
    # All benchmark PDB IDs from performance table
    benchmark_pdbs = [
        "8eil", "7r6r", "1a3n", "8c4d", "7qsj", "8cpk", 
        "8are", "8owf", "8aw3", "7tpu", "7ylz", "8gpp", 
        "8clz", "8k7x", "8ibx", "8gi1", "8sm6", "8pso", 
        "8jue", "8bsh", "5xgo"
    ]
    
    parser = argparse.ArgumentParser(
        description='Generate OpenFold3 input JSON files from PDB structures',
        epilog='Example: python generate_inputs.py --pdb 8eil'
    )
    parser.add_argument('--pdb', type=str, 
                        help='Specific PDB ID to generate input for (e.g., 8eil)')
    parser.add_argument('--all', action='store_true',
                        help='Generate input files for all benchmark PDB IDs')
    
    args = parser.parse_args()
    
    # For backwards compatibility: if no arguments provided, generate all
    if not args.pdb and not args.all:
        args.all = True
    
    if args.pdb:
        # Generate input for specific PDB ID
        try:
            create_input_json(args.pdb)
        except Exception as e:
            print(f"Error processing {args.pdb}: {e}", file=sys.stderr)
            sys.exit(1)
    elif args.all:
        # Generate all benchmark inputs
        print("Generating input files for all benchmark cases...")
        failed = []
        for pdb_id in benchmark_pdbs:
            try:
                create_input_json(pdb_id)
            except Exception as e:
                print(f"Error processing {pdb_id}: {e}")
                failed.append(pdb_id)
        
        if failed:
            print(f"\nFailed to generate inputs for: {', '.join(failed)}", file=sys.stderr)
            sys.exit(1)

Benchmarking Script#

The following is a complete script to benchmark OpenFold3 NIM predictions. Save this as benchmark_openfold3.py:

#!/usr/bin/env python3
"""
Benchmark OpenFold3 NIM predictions against reference structures.
"""

import argparse
import json
import subprocess
import time
from pathlib import Path
import requests

def run_inference(nim_url, input_json, output_dir):
    """
    Run OpenFold3 NIM inference and save the predicted structure.
    
    Args:
        nim_url: URL of the OpenFold3 NIM service (e.g., http://localhost:8000)
        input_json: Path to input JSON file with sequence information
        output_dir: Directory to save predicted structures
    
    Returns:
        tuple: (predicted_pdb_path, inference_time_seconds)
    """
    output_dir = Path(output_dir)
    output_dir.mkdir(parents=True, exist_ok=True)
    
    # Read input configuration
    with open(input_json, 'r') as f:
        input_data = json.load(f)
    
    # Convert to NIM API format
    molecules = []
    for seq in input_data.get("sequences", []):
        if "protein" in seq:
            protein = seq["protein"]
            # Create minimal MSA with just the query sequence
            msa_csv = f"key,sequence\n-1,{protein['sequence']}"
            molecules.append({
                "type": "protein",
                "id": [protein["id"]],
                "sequence": protein["sequence"],
                "msa": {
                    "main_db": {
                        "csv": {
                            "alignment": msa_csv,
                            "format": "csv"
                        }
                    }
                }
            })
    
    nim_request = {
        "inputs": [{
            "input_id": input_data.get("name", "prediction"),
            "molecules": molecules,
            "output_format": "pdb"
        }]
    }
    
    # Start timing
    start_time = time.time()
    
    # Run inference
    response = requests.post(
        f"{nim_url}/biology/openfold/openfold3/predict",
        json=nim_request,
        headers={"Content-Type": "application/json"}
    )
    
    # End timing
    inference_time = time.time() - start_time
    
    if response.status_code != 200:
        raise Exception(f"Inference failed: {response.text}")
    
    # Extract PDB data from response
    result = response.json()
    
    outputs = result.get('outputs', [])
    if not outputs:
        raise Exception(f"No outputs in response")
    
    structures = outputs[0].get('structures_with_scores', [])
    if not structures:
        raise Exception(f"No structures in response")
    
    # Get the first (best) structure
    pdb_content = structures[0].get('structure', '')
    if not pdb_content:
        raise Exception(f"No structure content in response")
    
    # Save predicted structure
    pdb_id = input_data.get('name', 'prediction')
    pred_path = output_dir / f"{pdb_id}_pred.pdb"
    
    with open(pred_path, 'w') as f:
        f.write(pdb_content)
    
    return pred_path, inference_time

def compare_structures(pred_pdb, reference_cif, output_dir):
    """
    Compare predicted structure against reference using OpenStructure.
    
    Args:
        pred_pdb: Path to predicted structure (PDB format)
        reference_cif: Path to reference structure (CIF format)
        output_dir: Directory to save comparison results
    
    Returns:
        dict: Comparison metrics including lDDT score
    """
    output_dir = Path(output_dir)
    output_dir.mkdir(parents=True, exist_ok=True)
    
    out_path = output_dir / "comparison_results.json"
    
    # Build OpenStructure comparison command
    cmd = [
        "compare-structures",
        "-m", str(pred_pdb),           # Model (predicted structure)
        "-r", str(reference_cif),      # Reference (ground truth)
        "--fault-tolerant",            # Handle minor structural differences
        "--min-pep-length", "4",       # Minimum peptide chain length
        "--min-nuc-length", "4",       # Minimum nucleotide chain length
        "-o", str(out_path),           # Output JSON file
        "--lddt",                      # Calculate lDDT metric
    ]
    
    # Run comparison using OpenStructure Docker container
    docker_cmd = [
        "docker", "run", "--rm",
        "-v", f"{Path.cwd()}:/home",
        "registry.scicore.unibas.ch/schwede/openstructure:latest"
    ] + cmd
    
    result = subprocess.run(
        docker_cmd,
        capture_output=True,
        text=True
    )
    
    if result.returncode != 0:
        raise Exception(f"Structure comparison failed: {result.stderr}")
    
    # Read comparison results
    with open(out_path, 'r') as f:
        metrics = json.load(f)
    
    return metrics

def extract_lddt(comparison_results):
    """
    Extract lDDT score from comparison results.
    
    Args:
        comparison_results: Dictionary containing comparison metrics
    
    Returns:
        float: lDDT score (0.0 to 1.0, higher is better)
    """
    # lDDT is directly a float value in the comparison results
    lddt_score = comparison_results.get('lddt', 0.0)
    return lddt_score

def benchmark_structure(nim_url, input_json, reference_cif, output_dir):
    """
    Complete benchmark pipeline for a single structure.
    
    Args:
        nim_url: URL of OpenFold3 NIM service
        input_json: Input configuration for prediction
        reference_cif: Reference structure for validation
        output_dir: Output directory for results
    
    Returns:
        dict: Benchmark results including timing and accuracy
    """
    output_dir = Path(output_dir)
    
    print(f"Running inference...")
    pred_path, inference_time = run_inference(nim_url, input_json, output_dir)
    print(f"Inference completed in {inference_time:.2f} seconds")
    
    print(f"Comparing structures...")
    metrics = compare_structures(pred_path, reference_cif, output_dir)
    lddt_score = extract_lddt(metrics)
    print(f"lDDT score: {lddt_score:.4f}")
    
    return {
        'inference_time': inference_time,
        'lddt_score': lddt_score,
        'predicted_structure': str(pred_path),
        'full_metrics': metrics
    }

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Benchmark OpenFold3 NIM predictions')
    parser.add_argument('--nim-url', default='http://localhost:8000', 
                        help='URL of the OpenFold3 NIM service')
    parser.add_argument('--input', required=True, 
                        help='Path to input JSON file')
    parser.add_argument('--reference', required=True, 
                        help='Path to reference CIF file')
    parser.add_argument('--output', required=True, 
                        help='Output directory for results')
    
    args = parser.parse_args()
    
    results = benchmark_structure(args.nim_url, args.input, args.reference, args.output)
    
    print("\nBenchmark Results:")
    print(f"  Inference Time: {results['inference_time']:.2f}s")
    print(f"  lDDT Score: {results['lddt_score']:.4f}")
    print(f"  Predicted Structure: {results['predicted_structure']}")

Running a Single Benchmark#

To run a benchmark for a single structure, follow these steps in order:

# Step 1: Install dependencies
pip3 install requests

# Step 2: Create directories
mkdir -p inputs results

# Step 3: Generate the input JSON file
python3 generate_inputs.py --pdb 8eil

# Step 4: Verify files exist before running benchmark
ls -l inputs/8eil_input.json references/8eil.cif

# Step 5: Run the benchmark (requires OpenFold3 NIM to be running)
python3 benchmark_openfold3.py \
    --nim-url http://localhost:8000 \
    --input inputs/8eil_input.json \
    --reference references/8eil.cif \
    --output results/8eil

Note

Each step must complete successfully before proceeding to the next. Verify that input and reference files exist (Step 4) before running the benchmark (Step 5).

Understanding lDDT Metric#

lDDT (local Distance Difference Test) is a robust metric for assessing the quality of predicted protein structures:

  • Score Range: 0.0 to 1.0 (or 0 to 100 when expressed as percentage)

  • Interpretation:

    • lDDT > 0.90: Excellent accuracy, very high confidence

    • lDDT 0.70-0.90: Good accuracy, reliable predictions

    • lDDT 0.50-0.70: Moderate accuracy, some structural features correct

    • lDDT < 0.50: Low accuracy, limited reliability

How lDDT Works:

  • Measures local geometric agreement between predicted and reference structures

  • Evaluates distances between atoms within local neighborhoods (typically 15Å radius)

  • More robust to domain movements and flexible regions compared to global metrics like RMSD

  • Focuses on local structural correctness rather than global superposition

Why lDDT for OpenFold3:

  • AlphaFold3 and OpenFold3 models are trained to optimize lDDT during the training process

  • Well-suited for evaluating multi-chain complexes and structures with flexible regions

  • Provides per-residue metrics in addition to global metrics

  • Standard metric used in CASP (Critical Assessment of protein Structure Prediction) competitions

Running Benchmarks for Performance Table#

To reproduce the performance metrics from the table above, follow these steps in order:

Important

Complete Steps 1 and 2 before running Step 3. The benchmark workflow requires:

  1. Both Python scripts (generate_inputs.py and benchmark_openfold3.py) saved as files

  2. The bash script (run_benchmarks.sh) saved as a file

  3. All scripts must be in the same directory before execution

Running steps out of order results in “File Not Found” errors.

Step 1: Prepare the Python scripts#

Save the two Python scripts provided earlier in this document:

Step 2: Create the benchmark workflow script#

Save the following as run_benchmarks.sh:

#!/bin/bash
# Complete benchmark workflow for all test cases

NIM_URL="http://localhost:8000"
PDB_IDS=("8eil" "7r6r" "1a3n" "8c4d" "7qsj" "8cpk" "8are" "8owf" "8aw3" "7tpu" "7ylz" "8gpp" "8clz" "8k7x" "8ibx" "8gi1" "8sm6" "8pso" "8jue" "8bsh" "5xgo")

# Create directories
mkdir -p references inputs results

# Step 1: Generate input JSON files from PDB
echo "Step 1: Generating input JSON files..."
python3 generate_inputs.py
echo "✓ Input files created in inputs/"

# Step 2: Download reference structures
echo "Step 2: Downloading reference structures..."
for pdb_id in "${PDB_IDS[@]}"; do
    if [ ! -f "references/${pdb_id}.cif" ]; then
        echo "  Downloading ${pdb_id}.cif..."
        wget -q "https://files.rcsb.org/download/${pdb_id}.cif" -O "references/${pdb_id}.cif"
    fi
done
echo "✓ Reference structures downloaded"

# Step 3: Verify NIM is running
echo "Step 3: Checking NIM availability..."
curl -sf "${NIM_URL}/v1/health/ready" > /dev/null || {
    echo "Error: NIM not accessible at ${NIM_URL}"
    exit 1
}
echo "✓ NIM is ready"

# Step 4: Run benchmarks
echo "Step 4: Running benchmarks..."
for pdb_id in "${PDB_IDS[@]}"; do
    echo "  Benchmarking ${pdb_id}..."
    python3 benchmark_openfold3.py \
        --nim-url "$NIM_URL" \
        --input "inputs/${pdb_id}_input.json" \
        --reference "references/${pdb_id}.cif" \
        --output "results/${pdb_id}"
done

echo ""
echo "Benchmarking complete! Results saved in results/"

Step 3: Run the complete workflow#

# 1. Install dependencies
pip3 install requests

# 2. Make the benchmark script executable
chmod +x run_benchmarks.sh

# 3. Run the complete workflow (generates inputs, downloads references, and runs benchmarks)
./run_benchmarks.sh

Note

The run_benchmarks.sh script handles all steps automatically: generating input files, downloading reference structures, and running benchmarks for all test cases. Make sure the OpenFold3 NIM is running before executing the script.

Expected Output Format#

The comparison results JSON file contains detailed metrics:

{
  "lddt": 0.9234,
  "chain_mapping": {
    "A": "A",
    "B": "B"
  },
  "aln": [
    ">reference:A\nMKQLYGHSTI...",
    ">model:A\nMKQLYGHSTI..."
  ],
  "model_clashes": [],
  "model_bad_bonds": [],
  "model_bad_angles": [],
  "reference_clashes": [],
  "reference_bad_bonds": [],
  "reference_bad_angles": [],
  "status": "SUCCESS",
  "ost_version": "2.11.1"
}

The primary metric of interest is lddt, which is a float value (0.0 to 1.0) representing the overall structural quality of the prediction. Higher values indicate better agreement with the reference structure.

Troubleshooting#

General Performance Issues#

  • Out of memory errors: Reduce MSA depth, decrease sequence length, or upgrade to GPUs with more memory

  • Slow performance: Ensure fast storage (NVMe SSD), sufficient CPU cores, and adequate system RAM

  • Poor quality predictions: Check input sequence quality, increase MSA depth if available, or adjust diffusion parameters

Benchmarking Issues#

The following are “File not found” errors.

  • “Input file not found”: Generate input JSON files first using generate_inputs.py

    python3 generate_inputs.py --all  # Creates all input files
    python3 generate_inputs.py --pdb 8eil  # Or for specific PDB
    
  • “Reference file not found”: Download CIF files from RCSB PDB

    wget https://files.rcsb.org/download/8eil.cif -O references/8eil.cif
    

The following are structure comparison issues.

  • OpenStructure comparison failures: Ensure both predicted and reference structures have compatible chain IDs and residue numbering

  • Missing atoms in predictions: Use --fault-tolerant flag to handle incomplete structures (already included in script)

  • lDDT score of 0.0: Check that sequences match between prediction and reference; may indicate alignment failure

The following are NIM connection issues.

  • “Connection refused”: Ensure OpenFold3 NIM is running

    curl http://localhost:8000/v1/health/ready  # Should return {"object":"health.response","message":"ready","status":"ready"}
    

Note

For detailed performance tuning guidance specific to your deployment, refer to the documentation on configuration and optimization.