NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Transformer-XL for PyTorch
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Transformer-XL for PyTorch

Transformer-XL is a transformer-based language model with a segment-level recurrence and a novel relative positional encoding.

The performance measurements in this document were conducted at the time of publication and may not reflect the performance achieved from NVIDIA's latest software release. For the most up-to-date performance measurements, go to NVIDIA Data Center Deep Learning Product Performance.

Benchmarking

The following section shows how to run benchmarks measuring the model performance in training and inference modes.

Training performance benchmark

To benchmark the training performance for a specific local (per-gpu) batch size <LBS>, with a specific number of GPUs <#GPUs> for a specific number of training iterations <ITER>, run:

bash run_wt103_{base,large}.sh train <#GPUs> --config trainbench --local_batch_size <LBS> --max_step <ITER> [--fp16]
  • use the run_wt103_base.sh script to run the benchmark for the base model, and use the run_wt103_large.sh script to run the benchmark for the large model
  • it's recommended to launch at least 500 training steps to get a reliable estimate of training performace.
  • the --fp16 flag is optional, however, if it's specified, then the script launches mixed precision training with Tensor Cores. If the flag is not present, then the script launches FP32 training on NVIDIA Volta GPUs and TF32 training on NVIDIA Ampere GPUs.

For more information about the available options, refer to the Training process section.

The training script prints information in the following format:

(...)

| epoch   1 step      499 | batches    499 / 16802 | lr 4.990e-03 | ms/batch 219.9 | tok/s   27947 | loss  6.43 | ppl    620.80
| epoch   1 step      500 | batches    500 / 16802 | lr 5.000e-03 | ms/batch 221.4 | tok/s   27747 | loss  6.42 | ppl    611.70
-------------------------------------------------------------------------------
(...)
Training time: 1.81 minutes
Training throughput: 28508.91 tok/s

The last two lines contain information on the total training time and on the average training throughput measured in tokens per second.

Training performance benchmark for multi-node

To benchmark the multi-node training performance of the large model on a specific number of DGX-2H nodes <NODES> and a specific local batch size <LBS>, run:

For mixed precision:

FP16=1 LOCAL_BATCH_SIZE=<LBS> CONFIG=trainbench_multinode sbatch -N <NODES> run.sub train

For FP32:

LOCAL_BATCH_SIZE=<LBS> CONFIG=trainbench_multinode sbatch -N <NODES> run.sub train

Inference performance benchmark

The inference performance and accuracy benchmarks require a checkpoint from a trained model.

To benchmark the inference performance on a specific global batch size <BS> with a specific number of GPUs <#GPUs>, run:

For the base model:

bash run_wt103_base.sh eval <#GPUs> --model <CHECKPOINT> --batch_size <BS> --save_data [--fp16] [--type {pytorch, torchscript}]

For the large model:

bash run_wt103_large.sh eval <#GPUs> --model <CHECKPOINT> --batch_size <BS> --save_data [--fp16] [--type {pytorch, torchscript}]

The inference script prints information in the following format:

Evaluating with math fp16 type torchscript bsz 16 tgt_len 64 ext_len 0 mem_len 640 clamp_len 400
Time : 5.25s, 21.88ms/segment
====================================================================================================

| test loss  3.15 | test ppl    23.304
====================================================================================================
Throughput Avg: 46316.64 tok/s
Latency Avg: 22.09 ms
Latency 90%: 22.22 ms
Latency 95%: 22.25 ms
Latency 99%: 22.37 ms
====================================================================================================

The output contains information on the achieved test loss and test perplexity, average inference throughput (measured in tokens per second), average inference latency and latency at 90%, 95% and 99% confidence intervals (measured in milliseconds).

The scripts/inference_benchmark.sh benchmarking script is provided for convenience, it automatically launches TF32/FP32 and FP16 inference for various batch sizes.

Results

The following sections provide details on how we achieved our performance and accuracy in training and inference.

Training accuracy results

Training accuracy: NVIDIA DGX A100 (8x A100 40GB)
Base model

Our results were obtained by running the pytorch/run_wt103_base.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX A100 with 8x A100 40GB GPUs.

GPUsBatch Size / GPUAccuracy - TF32 (perplexity)Accuracy - Mixed precision (perplexity)Time to Train - TF32 (minutes)Time to Train - Mixed precision (minutes)Time to Train Speedup (TF32 to Mixed precision)
83223.2423.24110761.45
Large model

Our results were obtained by running the pytorch/run_wt103_large.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX A100 with 8x A100 40GB GPUs.

GPUsBatch Size / GPUAccuracy - TF32 (perplexity)Accuracy - Mixed precision (perplexity)Time to Train - TF32 (minutes)Time to Train - Mixed precision (minutes)Time to Train Speedup (TF32 to Mixed precision)
8818.1818.187354771.54
816N/A18.19N/A4301.71
Training accuracy: NVIDIA DGX-1 (8x V100 16GB)
Base model

Our results were obtained by running the pytorch/run_wt103_base.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-1 with 8x V100 16GB GPUs.

GPUsBatch Size / GPUAccuracy - FP32 (perplexity)Accuracy - Mixed precision (perplexity)Time to Train - FP32 (minutes)Time to Train - Mixed precision (minutes)Time to Train Speedup (FP32 to Mixed precision)
11623.1223.1321469602.24
81623.1723.143161671.89
132N/A23.15N/A7662.80
832N/A23.18N/A1212.61
Large model

Our results were obtained by running the pytorch/run_wt103_large.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-1 with 8x V100 16GB GPUs.

GPUsBatch Size / GPUAccuracy - FP32 (perplexity)Accuracy - Mixed precision (perplexity)Time to Train - FP32 (minutes)Time to Train - Mixed precision (minutes)Time to Train Speedup (FP32 to Mixed precision)
8218.2218.20298314802.01
84N/A18.17N/A9843.03
Training accuracy: NVIDIA DGX-2H (16x V100 32GB)
Base model

Our results were obtained by running the pytorch/run_wt103_base.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-2H with 16x V100 32GB GPUs.

GPUsBatch Size / GPUAccuracy - FP32 (perplexity)Accuracy - Mixed precision (perplexity)Time to Train - FP32 (minutes)Time to Train - Mixed precision (minutes)Time to Train Speedup (FP32 to Mixed precision)
161623.2223.22149801.86
Large model

Our results were obtained by running the pytorch/run_wt103_large.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-2H with 16x V100 32GB GPUs.

GPUsBatch Size / GPUAccuracy - FP32 (perplexity)Accuracy - Mixed precision (perplexity)Time to Train - FP32 (minutes)Time to Train - Mixed precision (minutes)Time to Train Speedup (FP32 to Mixed precision)
16818.2118.2010753942.73
Training accuracy: 8x NVIDIA DGX-2H (16x V100 32GB)
Large model

Our results were obtained by running the pytorch/run.sub training script in the pytorch-20.06-py3 NGC container on 8x NVIDIA DGX-2H with 16x V100 32GB GPUs.

DGX SystemNodesBatch Size / GPUAccuracy - FP32 (perplexity)Accuracy - Mixed precision (perplexity)Time to Train - FP32 (minutes)Time to Train - Mixed precision (minutes)Time to Train Speedup (FP32 to Mixed precision)
DGX-2H8418.2718.28156742.11
Training accuracy plots
Base model

TrainingLossBase

Large model (single-node)

TrainingLossLarge

Large model (multi-node)

TrainingLossLargeMultiNode

Training stability test
Base model

The Transformer-XL base model was trained for 40,000 training steps, starting from 16 different initial random seeds. After every 5,000 training steps, the model was evaluated on the validation dataset and validation perplexity was recorded. The training was performed in the pytorch-20.06-py3 NGC container on NVIDIA DGX A100 with 8x A100 40GB GPUs. The following table summarizes the perplexity of our validation dataset.

Training stepAverage perplexityStandard deviationMinimumMaximumMedian
500042.620.2731142.0143.0942.67
1000032.310.1281432.1032.5932.31
1500028.380.1076428.2328.5728.35
2000026.140.1021825.9626.3626.14
2500024.590.0906024.4224.8124.60
3000023.710.0725923.6123.8423.71
3500023.150.0478123.0523.2623.15
4000022.930.0559322.8323.0422.94

After training, the models were evaluated on the test dataset. The following table summarizes the final perplexity on the test set.

Average perplexityStandard deviationMinimumMaximumMedian
23.240.0779423.1123.3823.25
Large model (single-node)

The Transformer-XL large model was trained for 100,000 training steps, starting from 16 different initial random seeds. After every 10,000 training steps, the model was evaluated on the validation dataset and validation perplexity was recorded. The training was performed in the pytorch-20.06-py3 NGC container on NVIDIA DGX A100 with 8x A100 40GB GPUs. The following table summarizes the perplexity of our validation dataset.

Training stepAverage perplexityStandard deviationMinimumMaximumMedian
1000032.630.2043232.3433.0532.62
2000024.080.1098023.9024.2824.10
3000021.520.0906921.3621.6621.52
4000020.170.0692220.0620.2720.17
5000019.230.0597519.1119.3319.24
6000018.570.0600818.4718.7218.56
7000018.170.0647318.0818.3218.15
8000017.950.0650617.8218.0817.94
9000017.800.0435017.7117.9017.80
10000017.800.0359217.7417.8617.81

After training, the models were evaluated on the test dataset. The following table summarizes the final perplexity on the test set.

Average perplexityStandard deviationMinimumMaximumMedian
18.170.0401618.0918.2418.17
Large model (multi-node)

The Transformer-XL large model was trained for 25,000 training steps, starting from 10 different initial random seeds. After every 1,000 training steps, the model was evaluated on the validation dataset and validation perplexity was recorded. The training was performed in the pytorch-20.06-py3 NGC container on 8x NVIDIA DGX-2H with 16x V100 32GB GPUs. The following table summarizes the perplexity of our validation dataset.

Training stepAverage perplexityStandard deviationMinimumMaximumMedian
1000608.093.80116600.65613.73609.40
2000142.750.94452141.21143.84143.07
300062.190.4454461.3863.0162.18
400040.220.1639739.9340.5440.20
500032.000.1585031.6132.1932.02
600028.050.1785427.8128.4128.05
700025.650.1094625.5125.8725.65
800024.200.1138523.9824.3624.20
900023.180.1493622.8423.3723.20
1000022.880.2275222.5423.3322.94
1100021.990.1623221.7322.2921.97
1200021.690.1082421.4621.8121.73
1300021.420.0915421.2521.5721.44
1400021.330.1382121.1521.5521.27
1500021.240.1552620.9521.5721.20
1600021.190.1052121.0121.4421.18
1700020.890.1823920.6921.1820.82
1800020.360.1071520.2120.5320.34
1900019.740.1280319.4519.9219.75
2000019.180.1002019.0519.3919.15
2100018.490.0631918.3618.6018.49
2200018.170.0367418.1118.2218.16
2300017.980.0368217.9018.0417.99
2400017.880.0288017.8417.9217.89
2500017.850.0279317.8017.9017.86

After training, the models were evaluated on the test dataset. The following table summarizes the final perplexity on the test set.

Average perplexityStandard deviationMinimumMaximumMedian
18.300.0274718.2418.3318.30

Training performance results

Training performance: NVIDIA DGX A100 (8x A100 40GB)
Base model

Our results were obtained by running the pytorch/run_wt103_base.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX A100 with 8x A100 40GB GPUs. Performance numbers (in tokens per second) were averaged over 500 training iterations.

GPUsBatch Size / GPUThroughput - TF32 (tok/s)Throughput - Mixed precision (tok/s)Throughput speedup (TF32 to Mixed precision)Weak Scaling - TF32Weak Scaling - Mixed precision
13241,52759,9611.4441.0001.000
23277,625113,2381.4591.8691.889
432153,945225,6091.4663.7073.763
832305,933449,8901.4717.3677.503

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Training performance benchmark section for instruction on how to launch the benchmark.

Large model

Our results were obtained by running the pytorch/run_wt103_large.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX A100 with 8x A100 40GB GPUs. Performance numbers (in tokens per second) were averaged over 500 training iterations.

GPUsBatch Size / GPUThroughput - TF32 (tok/s)Throughput - Mixed precision (tok/s)Throughput speedup (TF32 to Mixed precision)Weak Scaling - TF32Weak Scaling - Mixed precision
1814,49721,5541.4871.0001.000
2827,30440,2221.4731.8831.866
4853,75680,2261.4923.7083.722
88106,651159,1851.4937.3577.385
116N/A25,0841.730N/A1.000
216N/A48,5621.779N/A1.936
416N/A95,9971.786N/A3.827
816N/A191,1481.792N/A7.620

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Training performance benchmark section for instruction on how to launch the benchmark.

Training performance: NVIDIA DGX-1 (8x V100 16GB)
Base model

Our results were obtained by running the pytorch/run_wt103_base.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-1 with 8x V100 16GB GPUs. Performance numbers (in tokens per second) were averaged over 500 training iterations.

GPUsBatch Size / GPUThroughput - FP32 (tok/s)Throughput - Mixed precision (tok/s)Throughput speedup (FP32 to Mixed precision)Weak Scaling - FP32Weak Scaling - Mixed precision
11613,98126,6391.9051.0001.000
21623,16345,2991.9561.6571.700
41648,89392,6181.8943.4973.477
81697,005170,5321.7586.9386.402
132N/A36,6922.624N/A1.000
232N/A65,8892.845N/A1.796
432N/A133,8382.737N/A3.648
832N/A258,6482.666N/A7.049

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Training performance benchmark section for instruction on how to launch the benchmark.

Large model

Our results were obtained by running the pytorch/run_wt103_large.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-1 with 8x V100 16GB GPUs. Performance numbers (in tokens per second) were averaged over 500 training iterations.

GPUsBatch Size / GPUThroughput - FP32 (tok/s)Throughput - Mixed precision (tok/s)Throughput speedup (FP32 to Mixed precision)Weak Scaling - FP32Weak Scaling - Mixed precision
123,5586,9071.9411.0001.000
226,15311,2721.8321.7291.632
4212,49222,5301.8043.5113.262
8224,59540,9201.6646.9135.925
14N/A10,2102.870N/A1.000
24N/A17,9842.923N/A1.761
44N/A36,3402.909N/A3.559
84N/A66,7162.713N/A6.535

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Training performance benchmark section for instruction on how to launch the benchmark.

Training performance: NVIDIA DGX-2H (16x V100 32GB)
Base model

Our results were obtained by running the pytorch/run_wt103_base.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-2H with 16x V100 32GB GPUs. Performance numbers (in tokens per second) were averaged over 500 training iterations.

GPUsBatch Size / GPUThroughput - FP32 (tok/s)Throughput - Mixed precision (tok/s)Throughput speedup (FP32 to Mixed precision)Weak Scaling - FP32Weak Scaling - Mixed precision
11616,15032,8752.0361.0001.000
21629,71259,0581.9881.8401.796
41658,011113,9851.9653.5923.467
816114,655223,9071.9537.0996.811
1616222,920414,9941.86213.80312.623

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Training performance benchmark section for instruction on how to launch the benchmark.

Large model

Our results were obtained by running the pytorch/run_wt103_large.sh training script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-2H with 16x V100 32GB GPUs. Performance numbers (in tokens per second) were averaged over 500 training iterations.

GPUsBatch Size / GPUThroughput - FP32 (tok/s)Throughput - Mixed precision (tok/s)Throughput speedup (FP32 to Mixed precision)Weak Scaling - FP32Weak Scaling - Mixed precision
185,16914,7872.8611.0001.000
289,97727,7102.7771.9301.874
4819,69154,2072.7533.8103.666
8839,157107,0732.7347.5767.241
16877,568211,3872.72515.00814.296

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Training performance benchmark section for instruction on how to launch the benchmark.

Training performance: 8x NVIDIA DGX-2H (16x V100 32GB)

Our results were obtained by running the pytorch/run.sub training script in the pytorch-20.06-py3 NGC container. Performance numbers (in tokens per second) were averaged over 500 training iterations.

Large model
DGX SystemNodesBatch Size / GPUThroughput - FP32 (tok/s)Throughput - Mixed precision (tok/s)Throughput speedup (FP32 to Mixed precision)Weak Scaling - FP32Weak scaling - Mixed precision
DGX-2H1469,070154,9502.241.001.00
DGX-2H24136,960307,5202.251.981.98
DGX-2H44270,120605,5302.243.913.91
DGX-2H84514,5001,189,7002.317.457.68

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and then proceed to the Training performance benchmark for multi-node section for instruction on how to launch the multi-node performance benchmark. The numbers presented above were obtained with LOCAL_BATCH_SIZE=4.

Inference performance results

Inference performance: NVIDIA DGX A100 (1x A100 40GB)
Base model

Our results were obtained by running the pytorch/scripts/inference_benchmark.sh inferencing benchmarking script in the pytorch-20.06-py3 NGC container on NVIDIA DGX A100 with 1x A100 40GB GPU.

The command to launch the inference performance benchmark is provided in the Inference performance benchmark section.

FP16, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646404,163.715.3815.5815.6616.12
2646407,915.416.1716.3616.4217.19
46464015,710.216.2916.4516.4917.38
86464032,712.115.6415.7715.8216.65
166464059,378.617.2317.3217.3618.39
326464091,654.222.3322.3922.5323.63

FP16, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646406,935.99.2319.3889.4459.534
26464012,649.410.12010.25310.29410.945
46464025,029.510.22310.34610.38110.475
86464052,666.39.7169.8089.85110.540
166464090,767.811.27411.32111.33411.800
3264640107,082.419.10919.13819.16219.608

TF32, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646404,003.815.9916.2616.3616.58
2646407,499.217.0717.3217.3917.86
46464014,835.417.2517.4617.5018.34
86464030,001.517.0617.2217.2818.40
166464050,189.720.3920.4820.5221.41
326464063,660.532.1432.1732.2933.19

TF32, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646406,084.510.5210.7410.8410.95
26464011,680.610.9611.1711.2211.76
46464022,867.311.1911.3511.4012.07
86464045,165.511.3311.4611.4912.03
166464061,042.016.7616.8416.8617.13
326464071,124.128.7728.8128.8428.86

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Inference performance benchmark section for instruction on how to launch the benchmark.

Large model

Our results were obtained by running the pytorch/scripts/inference_benchmark.sh inferencing benchmarking script in the pytorch-20.06-py3 NGC container on NVIDIA DGX A100 with 1x A100 40GB GPU.

The command to launch the inference performance benchmark is provided in the Inference performance benchmark section.

FP16, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,6007,033.018.2018.5718.6418.93
21281,60012,832.519.9420.2320.2921.07
41281,60021,500.223.8023.9924.0725.09
81281,60025,797.139.6639.7439.9141.00
161281,60028,143.572.7172.7473.1274.00
321281,60028,533.6143.44143.30143.48149.07

FP16, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,60011,068.211.5711.8311.8812.42
21281,60019,847.012.8913.0913.1113.27
41281,60024,450.720.9221.0821.1021.15
81281,60027,938.436.6236.7236.7536.86
161281,60030,783.066.4866.5466.5966.98
321281,60032,161.6127.26127.19127.34131.64

TF32, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,6006,558.819.5219.8719.9520.44
21281,60010,658.424.0024.2824.3625.17
41281,60014,769.634.6434.8234.8935.74
81281,60016,852.660.7160.8261.0562.17
161281,60018,071.8113.23113.28113.37114.64
321281,60017,619.2234.04229.98239.30328.15

TF32, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,6009,084.414.0914.3714.4014.46
21281,60012,839.419.9220.1520.1720.25
41281,60015,582.432.8333.0033.0233.28
81281,60017,825.057.4057.5557.5957.94
161281,60019,419.2105.38105.49105.54105.91
321281,60020,079.4203.81203.77203.84207.47

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Inference performance benchmark section for instruction on how to launch the benchmark.

Inference performance: NVIDIA DGX-1 (1x V100 16GB)
Base model

Our results were obtained by running the pytorch/scripts/inference_benchmark.sh inferencing benchmarking script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-1 with 1x V100 16GB GPU.

The command to launch the inference performance benchmark is provided in the Inference performance benchmark section.

FP16, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646402,999.621.3621.7221.9024.86
2646405,738.522.3222.6422.8925.97
46464011,773.521.7321.9222.0622.68
86464022,604.722.6322.9223.0823.56
166464041,481.624.6724.8324.9925.73
326464058,556.934.9535.1335.2435.85

FP16, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646405,199.912.3112.5912.6512.98
2646409,802.513.0613.3013.4213.82
46464019,609.413.0513.1713.2413.94
86464037,598.713.6113.7113.7714.62
166464057,840.217.6917.7317.7618.36
326464066,955.930.5730.7830.8630.96

FP32, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646402,940.021.7922.2322.4225.52
2646405,652.022.6623.0023.2026.86
46464010,526.024.3024.6224.7225.03
86464015,767.232.4532.6732.7833.32
166464020,303.250.3950.8250.8951.07
326464021,707.194.2694.7694.9495.26

FP32, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646404,974.112.8813.2513.3713.69
2646409,625.313.3013.5813.7214.15
46464015,069.916.9817.2717.3517.54
86464018,269.828.0028.2328.2828.37
166464020,884.548.9949.4649.5049.63
326464022,289.291.8092.2592.5692.67

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Inference performance benchmark section for instruction on how to launch the benchmark.

Large model

Our results were obtained by running the pytorch/scripts/inference_benchmark.sh inferencing benchmarking script in the pytorch-20.06-py3 NGC container on NVIDIA DGX-1 with 1x V100 16GB GPU.

The command to launch the inference performance benchmark is provided in the Inference performance benchmark section.

FP16, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,6005,119.625.0025.4725.6626.12
21281,6008,676.129.4929.8129.9430.88
41281,60012,960.939.4739.8439.9140.69
81281,60014,870.668.8169.2869.4269.76
161281,60015,528.5131.78132.74132.86133.07
321281,60015,649.4261.54262.45262.99271.10

FP16, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,6008,718.214.6815.0115.0715.50
21281,60012,157.821.0421.2921.3121.38
41281,60014,534.835.2035.4835.5335.93
81281,60015,863.864.5064.9065.1565.31
161281,60016,674.0122.73123.34123.66123.92
321281,60017,154.1238.60239.48239.73247.48

FP32, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,6003,009.842.5243.0143.0943.53
21281,6003,838.466.6467.2467.4567.83
41281,6004,265.3119.94120.87121.00121.39
81281,6004,646.5220.19221.30221.50221.68
161281,6004,805.4426.39426.25426.47427.25
321281,6004,787.4855.09854.95855.46912.05

FP32, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,6003,319.038.5638.9139.0139.19
21281,6003,925.265.1665.7465.8966.12
41281,6004,344.1117.76118.46118.55118.69
81281,6004,716.2216.94217.99218.27218.69
161281,6004,922.1415.72417.16417.32417.59
321281,6004,965.2824.98821.79831.71952.47

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Inference performance benchmark section for instruction on how to launch the benchmark.

Inference performance: NVIDIA T4
Base model

Our results were obtained by running the pytorch/scripts/inference_benchmark.sh inferencing benchmarking script in the pytorch-20.06-py3 NGC container on NVIDIA T4.

The command to launch the inference performance benchmark is provided in the Inference performance benchmark section.

FP16, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646403,775.316.9717.5117.8418.18
2646406,417.419.9620.4920.5621.52
4646409,988.625.6426.0726.1427.32
86464011,878.943.0743.4243.4644.24
166464013,630.075.0775.2675.3276.07
326464014,511.2141.01141.38141.41142.16

FP16, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646406,132.510.4710.9311.3111.45
2646408,319.415.3915.8915.9216.10
46464011,259.122.7423.1623.2323.30
86464013,120.338.9939.3539.3739.42
166464015,120.067.6767.9067.9468.06
326464016,158.1126.65126.97127.03127.18

FP32, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646402,323.127.5929.3929.5629.86
2646403,094.841.3942.4942.7843.47
4646403,889.865.8266.6066.7167.57
8646404,270.1119.80120.61120.68120.89
16646404,765.7214.68215.87216.01216.14
32646404,985.2410.43413.58413.67413.92

FP32, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
1646402,486.325.7827.5227.6627.92
2646403,260.739.2840.3240.4940.84
4646404,033.363.4864.2864.3564.56
8646404,411.4115.96116.74116.85116.89
16646404,924.9207.74208.91209.04209.21
32646405,163.1396.29399.42399.50399.70

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Inference performance benchmark section for instruction on how to launch the benchmark.

Large model

Our results were obtained by running the pytorch/scripts/inference_benchmark.sh inferencing benchmarking script in the pytorch-20.06-py3 NGC container on NVIDIA T4.

The command to launch the inference performance benchmark is provided in the Inference performance benchmark section.

FP16, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,6002,978.042.9943.4043.4444.40
21281,6003,161.480.9881.3881.4581.75
41281,6003,459.3147.89148.11148.14148.49
81281,6003,657.8279.74279.82279.86280.48
161281,6003,762.9543.92543.48543.55544.43
321281,6003,794.41079.151076.231076.371158.93

FP16, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,6003,066.441.7442.0842.1242.19
21281,6003,399.275.3175.5475.5775.64
41281,6003,721.5137.47137.65137.70137.82
81281,6003,932.9260.19260.23260.29260.50
161281,6004,057.9504.43503.97504.01504.14
321281,6004,117.8994.54991.40991.461079.17

FP32, pure Python

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,600786.9162.7163.2163.3163.9
21281,600889.6287.8288.1288.2288.4
41281,600992.1515.6516.0516.0516.5
81281,6001,047.0977.2977.6977.6977.8
161281,6001,069.31913.51914.71914.71915.0
321281,6001,069.53826.33823.73823.83915.8

FP32, TorchScript

Batch sizeSequence lengthMemory lengthThroughput Avg (tok/s)Latency Avg (ms)Latency 90% (ms)Latency 95% (ms)Latency 99% (ms)
11281,600792.5161.5161.9162.0162.2
21281,600904.7283.0283.3283.3283.4
41281,6001,009.0507.0507.3507.4507.5
81281,6001,065.0960.7961.1961.1961.2
161281,6001,088.61879.71880.91881.01881.1
321281,6001,102.03713.73710.03718.13819.0

To achieve these same results, follow the steps in the Quick Start Guide to download the dataset and setup the container, and then proceed to the Inference performance benchmark section for instruction on how to launch the benchmark.