Training performance: OpenNN vs PyTorch
OpenNN trained faster than PyTorch, with lower peak memory and energy, across all 6 training configurations we measured (18 comparisons total).
Measured on 6 September 2026 on one reference computer: Intel Core i7-14700F, 32 GB RAM, NVIDIA GeForce RTX 5070 Ti, Linux. CPU runs use FP32 with Intel MKL. GPU runs use BF16 mixed precision. The benchmark code is on GitHub.
Contents
Workloads
We tested four common network types. Both libraries ran the same network on the same data, with the same batch size and parameter count. We measured CNN and Transformer on the GPU only.
| Model | Data | Network | Batch | Throughput unit |
|---|---|---|---|---|
| Dense | HIGGS particle-physics events, 28 features | 28 → 1024 → 1024 → 1 classifier, 1,080,321 parameters | 4,096 (CPU), 8,192 (GPU) | samples/s |
| LSTM | Beijing PM2.5 hourly air-quality records | 128 LSTM units over 24 steps × 15 features, 73,857 parameters | 256 | windows/s |
| CNN | ImageNet subset, 1,000 classes × 50 images, 224 × 224 pixels | ResNet-50 v1.5, 25,557,032 parameters | 64 (GPU only) | images/s |
| Transformer | WMT14 English–German text | Encoder–decoder, 6 + 6 layers, width 512, 8 heads, 20,000-token vocabulary, 74,878,496 parameters | 32 (GPU only) | sequences/s |
Speed
Training throughput is the amount of training data processed per second after a warm-up. It is not the time needed to reach a target accuracy; we compare quality separately. Each value is the median of three launches. The speedup is OpenNN’s throughput divided by PyTorch’s, so a value above 1 means OpenNN was faster.
| Configuration | Unit | OpenNN | PyTorch | Speedup |
|---|---|---|---|---|
| CPU · Dense | samples/s | 70,120 | 54,520 | 1.29× |
| CPU · LSTM | windows/s | 23,251 | 13,103 | 1.77× |
| GPU · Dense | samples/s | 11,406,741 | 10,048,603 | 1.14× |
| GPU · LSTM | windows/s | 823,255 | 95,842 | 8.59× |
| GPU · CNN | images/s | 1,667 | 1,401 | 1.19× |
| GPU · Transformer | seq/s | 1,352 | 1,145 | 1.18× |
Faster training lets you run more experiments, or larger ones, in the same time.
Memory
Peak memory is the highest value of the three launches. On the CPU, it is the process’s peak private (anonymous) resident memory. On the GPU, it is the device memory in use minus the idle baseline, which includes runtime and allocator overhead. 1 MiB = 1,048,576 bytes.
| Configuration | OpenNN (MiB) | PyTorch (MiB) | Reduction |
|---|---|---|---|
| CPU · Dense | 305.2 | 787.3 | 61.23% |
| CPU · LSTM | 209.5 | 591.4 | 64.58% |
| GPU · Dense | 507.6 | 631.6 | 19.63% |
| GPU · LSTM | 315.6 | 511.6 | 38.31% |
| GPU · CNN | 3,572.9 | 4,227.9 | 15.49% |
| GPU · Transformer | 2,321.2 | 3,349.6 | 30.70% |
Lower memory use leaves room for larger models, larger batches, or other applications on the same device. These figures do not set a maximum model or dataset size.
Energy
Energy is the median of three launches for the work each configuration performs. CPU readings cover the processor package (Intel RAPL). GPU readings cover the graphics board (NVIDIA NVML power samples). Neither is energy at the wall socket. Each configuration does a different amount of work, so compare OpenNN with PyTorch within a row, not one row with another.
| Configuration | OpenNN (mWh) | PyTorch (mWh) | Reduction |
|---|---|---|---|
| CPU · Dense | 86.23 | 97.42 | 11.48% |
| CPU · LSTM | 43.05 | 60.77 | 29.16% |
| GPU · Dense | 131.74 | 151.97 | 13.31% |
| GPU · LSTM | 29.20 | 132.00 | 77.88% |
| GPU · CNN | 3,757.44 | 4,254.47 | 11.68% |
| GPU · Transformer | 16,277.03 | 22,705.70 | 28.31% |
How we measured
- Before timing, the runner checked that both libraries reported the same number of samples, input shapes, and parameters.
- Each configuration ran three launches per library. We rotated the library order between launches and excluded the warm-up from timing. We synchronized GPU work at both ends of the timed region.
- We locked GPU clocks at 2,692 MHz, disabled CPU turbo, and sampled background activity before, during, and after every launch.
- Software: PyTorch 2.13.0 built for CUDA 13.0, Python 3.12, NVIDIA driver 610.43.02, Linux. OpenNN was built from development commits e76425bd3 (dense and LSTM) and 520f0f2f8 (CNN and Transformer), with clean working trees.
The programs for both libraries, the data preparation scripts, and the complete measurement rules are in the OpenNN repository’s benchmarks folder. For example, to repeat the GPU dense training run:
python benchmarks/prepare.py dense
python benchmarks/run.py --family dense --mode train --device cuda --precision bf16 --batch 8192 --rounds 3
Limits
- These results come from one computer and one software stack. Other hardware, drivers, or library versions can change the ratios.
- We did not measure CPU results for the CNN and Transformer in this set.
- In the GPU LSTM runs, PyTorch executed its recurrent kernels in FP16 while OpenNN used BF16. Treat the GPU LSTM ratios as indicative.
- The two programs for each model differ in several ways: the dense programs order the training samples differently, the LSTM programs scale and store the data differently, the CNN programs decode and transform images differently, and the Transformer programs differ in masking, dropout, and loss averaging. The input files were not content-hashed.
- PyTorch’s GPU dense training throughput varied by 3.4% between launches, above our 3% stability limit.
We will repeat these measurements with fully matched programs and add more models, datasets, and hardware. See also inference performance and prediction quality.