NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
GNMT v2 for TensorFlow1
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
GNMT v2 for TensorFlow1

The GNMT v2 model is an improved version of the first Google's Neural Machine Translation System with a modified attention mechanism.

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 training performance, run:

  • python nmt.py --output_dir=results --max_train_epochs=1 --num_gpus <num GPUs> --batch_size <total batch size> --amp for mixed precision
  • python nmt.py --output_dir=results --max_train_epochs=1 --num_gpus <num GPUs> --batch_size <total batch size> for FP32/TF32

The log file will contain training performance in the following format:

training time for epoch 1: 25.75 mins (3625.19 sent/sec, 173461.27 tokens/sec)

Inference performance benchmark

To benchmark inference performance, run the scripts/translate.py script:

  • For FP32/TF32: python scripts/translate.py --output_dir=/path/to/trained/model --beam_width <comma separated beam widths> --infer_batch_size <comma separated batch sizes>

  • For mixed precision python scripts/translate.py --output_dir=/path/to/trained/model --amp --beam_width <comma separated beam widths> --infer_batch_size <comma separated batch sizes>

The benchmark requires a checkpoint from a fully trained model.

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)

Our results were obtained by running the examples/DGXA100_{TF32,AMP}_8GPU.sh training script in the tensorflow-20.06-tf1-py3 NGC container on NVIDIA DGX A100 (8x A100 40GB) GPUs.

GPUsBatch size / GPUAccuracy - mixed precision (BLEU)Accuracy - TF32 (BLEU)Time to train - mixed precisionTime to train - TF32Time to train speedup (TF32 to mixed precision)
812825.124.3196 min139 min1.45
Training accuracy: NVIDIA DGX-1 (8x V100 16GB)

Our results were obtained by running the nmt.py script in the tensorflow-19.07-py3 NGC container on NVIDIA DGX-1 with (8x V100 16GB) GPUs.

GPUsBatch size / GPUAccuracy - mixed precision (BLEU)Accuracy - FP32 (BLEU)Time to train - mixed precisionTime to train - FP32Time to train speedup (FP32 to mixed precision)
112824.9024.84763 min1237 min1.62
812824.3324.34168 min237 min1.41

In the following plot, the BLEU scores after each training epoch for different configurations are displayed.

BLEUScore

Training stability test

The GNMT v2 model was trained for 6 epochs, starting from 6 different initial random seeds. After each training epoch, the model was evaluated on the test dataset and the BLEU score was recorded. The training was performed in the tensorflow-20.06-tf1-py3 NGC container.

In the following tables, the BLEU scores after each training epoch for different initial random seeds are displayed.

NVIDIA DGX A100 with 8 Ampere A100 40GB GPUs with TF32.
EpochAverageStandard deviationMinimumMedianMaximum
120.2720.16519.76020.29520.480
221.9110.14521.65021.91022.230
322.7310.14022.49022.72523.020
423.1420.16422.93023.09023.440
523.9670.13723.76023.94024.260
624.3580.14324.12024.36024.610
NVIDIA DGX-1 with 8 Tesla V100 16GB GPUs with FP32.
EpochAverageStandard deviationMinimumMedianMaximum
120.2590.22519.82020.30020.590
221.9540.19421.54021.95522.370
322.7290.15022.48022.69523.110
423.2180.21022.82023.22523.470
523.9210.11423.68023.91024.080
624.3810.13124.16024.37524.590

Inference accuracy results

Inference accuracy: NVIDIA DGX-1 (8x V100 16GB)

Our results were obtained by running the scripts/translate.py script in the tensorflow-19.07-py3 NGC container on NVIDIA DGX-1 8x V100 16GB GPUs.

  • For mixed precision: python scripts/translate.py --output_dir=/path/to/trained/model --beam_width 1,2,5 --infer_batch_size 128 --amp

  • For FP32: python scripts/translate.py --output_dir=/path/to/trained/model --beam_width 1,2,5 --infer_batch_size 128

Batch sizeBeam sizeMixed precision BLEUFP32 BLEU
128123.8023.80
128224.5824.59
128525.1025.09

Training performance results

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

Our results were obtained by running the examples/DGXA100_{TF32,AMP}_{1,8}GPU.sh training script in the tensorflow-20.06-tf1-py3 NGC container on NVIDIA DGX A100 (8x A100 40GB) GPUs. Performance numbers (in items/images per second) were averaged over an entire training epoch.

GPUsBatch size / GPUThroughput - mixed precision (tokens/s)Throughput - TF32 (tokens/s)Throughput speedup (TF32 - mixed precision)Weak scaling - mixed precisionWeak scaling - TF32
112829 91131 1100.961.001.00
8128181 384175 2921.036.065.63

To achieve these same results, follow the steps in the Quick Start Guide.

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

Our results were obtained by running the nmt.py script in the tensorflow-19.07-py3 NGC container on NVIDIA DGX-1 with 8x V100 16G GPUs. Performance numbers (in tokens per second) were averaged over an entire training epoch.

GPUsBatch size / GPUThroughput - mixed precision (tokens/s)Throughput - FP32 (tokens/s)Throughput speedup (FP32 - mixed precision)Weak scaling - mixed precisionWeak scaling - FP32
112823 01114 1061.631.001.00
8128138 10693 6881.476.006.64

To achieve these same results, follow the Quick Start Guide outlined above.

Inference performance results

The benchmark requires a checkpoint from a fully trained model.

To launch the inference benchmark in mixed precision on 1 GPU, run:

python scripts/translate.py --output_dir=/path/to/trained/model --beam_width 1,2,5 --infer_batch_size 1,2,4,8,32,128,512 --amp

To launch the inference benchmark in FP32/TF32 on 1 GPU, run:

python scripts/translate.py --output_dir=/path/to/trained/model --beam_width 1,2,5 --infer_batch_size 1,2,4,8,32,128,512

To achieve these same results, follow the Quick Start Guide outlined above.

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

Our results were obtained by running the python scripts/translate.py --infer_batch_size 1,2,4,8,32,128,512 --beam_width 1,2,5 {--amp} inferencing benchmarking script in the tensorflow-20.06-tf1-py3 NGC container on NVIDIA DGX A100 (1x A100 40GB) GPU.

FP16

Batch sizeBeam widthBleuSentences/secTokens/secLatency AvgLatency 50%Latency 90%Latency 95%Latency 99%Latency 100%
1123.8013.67737.8973.1567.69121.98137.20162.74201.06
1224.5813.40721.1874.6569.12123.99138.82169.58198.49
1525.1012.12647.7882.5376.53136.35152.59196.09216.55
2123.8021.551163.1692.8288.15139.88152.49185.18208.35
2224.5821.071134.4294.9189.62142.08158.12188.00205.08
2525.1019.591047.21102.1096.20152.36172.46211.96219.87
4123.8036.981996.27108.16105.07150.42161.56200.99205.87
4224.5734.921880.48114.53111.42160.29177.14205.32211.80
4525.1031.561687.34126.74122.06179.68201.38225.08229.14
8123.8064.523482.81123.99122.89159.89174.66201.12205.59
8224.5759.043178.17135.50135.23180.50191.66214.95216.84
8525.0955.512967.82144.11141.98198.39218.88223.55225.61
32123.80193.5410447.04165.34163.56211.67215.37221.07221.14
32224.57182.009798.09175.82176.04220.33224.25226.45227.05
32525.10141.637572.02225.94225.59278.38279.56281.61282.13
128123.80556.5730042.59229.98226.81259.05260.26260.74260.85
128224.57400.0221535.38319.98328.23351.31352.82353.01353.06
128525.10235.1412570.95544.35576.62581.95582.64583.61583.85
512123.80903.8348786.58566.48570.44579.74580.66581.39581.57
512224.58588.6331689.07869.81894.90902.65902.85903.00903.04
512525.10285.8615283.401791.061835.191844.291845.591846.631846.89

TF32

Batch sizeBeam widthBleuSentences/secTokens/secLatency AvgLatency 50%Latency 90%Latency 95%Latency 99%Latency 100%
1123.8213.25715.4775.4569.81125.63141.89169.70209.78
1224.5913.21711.1675.7270.06124.75140.20173.23201.39
1525.0812.38661.9980.7674.90131.93148.91187.05208.39
2123.8221.611166.5692.5587.25139.54151.77180.24209.05
2224.5921.241143.6394.1788.78139.70156.61189.09205.06
2525.1019.491042.17102.6296.14153.38172.89213.99219.54
4123.8135.841934.49111.62108.73154.52165.42207.88211.29
4224.5834.711869.20115.24111.24161.24177.73208.12212.74
4525.0932.241723.86124.07119.35177.54196.69221.10223.52
8123.8064.083459.74124.84123.61161.92177.06205.47206.47
8224.6159.313193.52134.89133.44182.92192.71216.04218.78
8525.1056.603026.29141.35138.61194.52213.65220.24221.45
32123.80195.3110544.22163.85162.80212.71215.41216.92217.34
32224.61185.669996.59172.36171.07216.46221.64223.68225.25
32525.11147.247872.61217.34214.97269.75270.71271.44272.87
128123.81576.5431123.19222.02219.25249.44249.75249.88249.91
128224.57419.8722609.82304.86314.47332.18334.13336.22336.74
128525.10245.7613138.84520.83552.68558.89559.09559.13559.13
512123.80966.2452156.34529.89534.82558.30559.33560.16560.36
512224.58642.4134590.81797.00812.40824.23825.92827.27827.61
512525.10289.3315468.091769.611817.191849.831855.171859.451860.51

To achieve these same results, follow the steps in the Quick Start Guide.

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

Our results were obtained by running the python scripts/translate.py --infer_batch_size 1,2,4,8,32,128,512 --beam_width 1,2,5 {--amp} inferencing benchmarking script in the tensorflow-20.06-tf1-py3 NGC container on NVIDIA DGX-1 with (1x V100 16GB) GPU.

FP16

Batch sizeSequence lengthThroughput AvgLatency AvgLatency 90%Latency 95%Latency 99%
1123.789.06489.00110.41102.80
1224.588.68467.35115.22107.17
1525.098.39448.32119.25109.79
2123.8214.59787.70137.04129.38
2224.5714.44777.60138.51131.07
2525.1113.78736.99145.11136.76
4123.8223.791284.24168.14164.13
4224.5922.671220.66176.45171.40
4525.0822.331194.00179.12174.04
8123.8143.332338.68184.63183.25
8224.6039.122106.44204.49200.96
8525.1037.161987.05215.26210.92
32123.82129.526992.15247.06245.81
32224.55123.286637.86259.57261.07
32525.0588.744744.33360.61359.27
128123.80332.8117964.83384.60382.14
128224.59262.8714153.59486.93506.45
128525.08143.917695.36889.42932.93
512123.80613.5733126.42834.46848.06
512224.59387.7220879.621320.541343.05
512525.10199.4810664.342566.672628.50

FP32

Batch sizeSequence lengthThroughput AvgLatency AvgLatency 90%Latency 95%Latency 99%
1123.808.37451.86119.46111.26
1224.598.83475.11113.31104.54
1525.097.74413.92129.15119.44
2123.8013.96753.79143.22135.73
2224.5912.96697.63154.33145.01
2525.0912.67677.23157.88148.24
4123.8022.421209.97178.44172.70
4224.5920.551106.07194.68188.83
4525.0921.191132.58188.81182.77
8123.8039.322122.26203.48201.89
8224.5937.512019.43213.26211.55
8525.0931.691694.02252.46245.33
32123.80118.516396.93270.02269.22
32224.59100.235395.33319.28318.89
32525.0968.593666.77466.55466.84
128123.80256.4913845.09499.04492.36
128224.59176.839519.12723.86754.89
128525.0996.215143.171330.481420.94
512123.80366.0719759.971398.631421.81
512224.59225.4812137.772270.752323.62
512525.09106.025667.784829.314946.65

To achieve these same results, follow the steps in the Quick Start Guide.

Inference performance: NVIDIA T4

Our results were obtained by running the scripts/translate.py script in the tensorflow-19.07-py3 NGC container on NVIDIA T4.

Reported mixed precision speedups are relative to FP32 numbers for corresponding configuration.

Batch sizeBeam sizeMixed precision tokens/sSpeedupMixed precision average latency (ms)Average latency speedupMixed precision latency 50% (ms)Latency 50% speedupMixed precision latency 90% (ms)Latency 90% speedupMixed precision latency 95% (ms)Latency 95% speedupMixed precision latency 99% (ms)Latency 99% speedupMixed precision latency 100% (ms)Latency 100% speedup
116431.278841.278781.2791381.3091541.3121801.3042201.296
125841.693921.692861.6861501.7431681.7372011.7702361.742
155521.702971.701901.6961581.7461761.7382181.7692441.742
219481.7761141.7761081.7691701.8031841.8072181.7832411.794
229121.7611181.7601121.7631751.7761921.7812261.7702461.776
258321.9001281.9001211.9101921.9122141.9222581.9222661.905
4115961.7921351.7921321.7911871.7991971.8152411.7842451.796
4214951.9281441.9271411.9262011.9272161.9362501.9562641.890
4513081.7021641.7021591.7022301.7222511.7422831.7082881.699
8127201.9811591.9811581.9922041.9752191.9862491.9872521.966
8225541.8091691.8081681.8292241.7972371.7832601.8072621.802
8519791.7682161.7682131.7802921.7973191.7933341.7603361.769
32174491.7752321.7742311.7772921.7893001.7603011.7683011.768
32255691.6703091.6693111.6723891.6523921.6654011.6514041.644
32530791.8675561.8675551.8656921.8586951.8607021.8477031.847
1281129861.6625321.6625291.6676071.6436081.6456091.6476091.647
128278561.7348781.7349111.7559661.7429671.7419681.7449681.744
128533611.68320361.68221861.67822101.67322101.67422111.67422111.674
5121149321.82518511.82518891.80819271.80119281.80019291.80019301.799
512281091.78634001.78635051.78335201.78235231.78135251.78135251.781
512533701.80281231.80183761.79883911.80483941.80483961.80583971.805

NVIDIA uses cookies to improve your experience on our web site. We and our third-party partners also use cookies and other tools to collect and record information you provide as well as information about your interactions with our websites for performance improvement, analytics, and to assist in marketing efforts. By clicking "Accept All", you consent to our use of cookies and other tools as described in our Cookie Policy. You can manage your cookie settings by clicking on "Manage Settings." By continuing to use this site or by clicking one of the buttons below, you agree to our Terms of Service (which contains important waivers). Please see our Privacy Policy for more information on our privacy practices.