NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Wide & Deep for TensorFlow2
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Wide & Deep for TensorFlow2

Wide & Deep Recommender model.

Benchmarking

The following section shows how to run benchmarks measuring the model performance in training mode.

Training and evaluation performance benchmark

A benchmark script is prepared to measure the performance of the model during training (default configuration) and evaluation (--evaluation). Benchmark runs training or evaluation for --benchmark_steps batches; however measurement of performance starts after --benchmark_warmup_steps. A benchmark can be run for single and 8 GPUs and with a combination of XLA (--xla), AMP (--amp), batch sizes (--global_batch_size , --eval_batch_size), and affinity (--affinity).

To run a benchmark, follow these steps:

Run Wide & Deep Container (${HOST_OUTBRAIN_PATH} is the path with Outbrain dataset):

docker run --runtime=nvidia --gpus=all --rm -it --ipc=host -v ${HOST_OUTBRAIN_PATH}:/outbrain wd2 bash

Run the benchmark script:

horovodrun -np ${GPU} sh hvd_wrapper.sh python main.py --benchmark

Results

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

Training accuracy results

Training accuracy: NVIDIA DGX A100 (8x A100 80GB)

Our results were obtained by running the main.py training script in the TensorFlow2 NGC container on NVIDIA DGX A100 with (8x A100 80GB) GPUs.

GPUsBatch size / GPUXLAAccuracy - TF32 (MAP@12)Accuracy - mixed precision (MAP@12)Time to train - TF32 (minutes)Time to train - mixed precision (minutes)Time to train speedup (TF32 to mixed precision)
1131072Yes0.657290.6573217.3313.371.30
1131072No0.657320.6573021.9017.551.25
816384Yes0.657480.657546.786.531.04
816384No0.657480.657508.388.281.01

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

Training accuracy: NVIDIA DGX-1 (8x V100 32GB)

Our results were obtained by running the main.py training script in the TensorFlow2 NGC container on NVIDIA DGX-1 with (8x V100 32GB) GPUs.

GPUsBatch size / GPUXLAAccuracy - FP32 (MAP@12)Accuracy - mixed precision (MAP@12)Time to train - FP32 (minutes)Time to train - mixed precision (minutes)Time to train speedup (FP32 to mixed precision)
1131072Yes0.657260.6573272.0224.802.90
1131072No0.657320.6573379.4731.502.52
816384Yes0.657440.6575215.9510.321.55
816384No0.657460.6575618.5212.871.44

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

Training accuracy plots

Models trained with FP32, TF32, and Automatic Mixed Precision (AMP), with and without XLA enabled achieve similar accuracy.

The plot represents MAP@12 in a function of steps (step is single batch) during training for default precision (FP32 for Volta architecture (DGX-1) and TF32 for Ampere GPU architecture (DGX-A100)) and AMP for XLA and without it for NVTabular dataset. All other parameters of training are default.


Figure 2. Learning curves for different configurations on single gpu.

Training stability test

Training of the model is stable for multiple configurations achieving the standard deviation of 10e-4. The model achieves similar MAP@12 scores for A100 and V100, training precisions, XLA usage, and single/multi GPU. The Wide & Deep model was trained for 9140 training steps (20 epochs, 457 batches in each epoch, every batch containing 131072), starting from 20 different initial random seeds for each setup. The training was performed in the 22.03 Merlin Tensorflow Training NGC container on NVIDIA DGX A100 80GB, and DGX-1 32GB machines with and without mixed precision enabled, with and without XLA enabled for NVTabular generated dataset. The provided charts and numbers consider single and eight GPU training. After training, the models were evaluated on the validation set. The following plots compare distributions of MAP@12 on the evaluation set. In columns, there is single vs. eight GPU training in rows DGX A100 and DGX-1 V100.


Figure 3. Training stability plot, distribution of MAP@12 across different configurations. 'All configurations' refer to the distribution of MAP@12 for cartesian product of architecture, training precision, XLA usage, single/multi GPU.

Training stability was also compared in terms of point statistics for MAP@12 distribution for multiple configurations. Refer to the expandable table below.

Full tabular data for training stability tests
GPUsPrecisionXLAMeanStdMinMax
DGX A1001TF32Yes0.657290.000130.65710.6576
DGX A1001TF32No0.657320.000110.65710.6575
DGX A1001AMPYes0.657320.000100.65720.6575
DGX A1001AMPNo0.657300.000140.65700.6576
DGX A1008TF32Yes0.657480.000140.65730.6577
DGX A1008TF32No0.657480.000120.65720.6576
DGX A1008AMPYes0.657540.000120.65730.6578
DGX A1008AMPNo0.657500.000150.65720.6578
DGX-1 V1001FP32Yes0.657260.000110.65700.6574
DGX-1 V1001FP32No0.657320.000130.65710.6575
DGX-1 V1001AMPYes0.657320.000060.65720.6574
DGX-1 V1001AMPNo0.657330.000100.65720.6575
DGX-1 V1008FP32Yes0.657440.000140.65730.6578
DGX-1 V1008FP32No0.657460.000110.65720.6576
DGX-1 V1008AMPYes0.657520.000160.65730.6578
DGX-1 V1008AMPNo0.657560.000130.65730.6578
Impact of mixed precision on training accuracy

The accuracy of training, measured with MAP@12 on the evaluation set after the final epoch metric was not impacted by enabling mixed precision. The obtained results were statistically similar. The similarity was measured according to the following procedure:

The model was trained 20 times for default settings (FP32 or TF32 for NVIDIA Volta and NVIDIA Ampere architecture, respectively) and 20 times for AMP. After the last epoch, the accuracy score MAP@12 was calculated on the evaluation set.

Distributions for four configurations: architecture (A100, V100) and single/multi GPU for the NVTabular dataset are presented below.


Figure 4. Influence of AMP on MAP@12 distribution for DGX A100 and DGX-1 V100 for single and multi GPU training.

Distribution scores for full precision training and AMP training were compared in terms of mean, variance, and Kolmogorov–Smirnov test to state statistical difference between full precision and AMP results. Refer to the expandable table below.

Full tabular data for AMP influence on MAP@12
GPUsXLAMean MAP@12 for Full precision (TF32 for A100, FP32 for V100)Std MAP@12 for Full precision (TF32 for A100, FP32 for V100)Mean MAP@12 for AMPStd MAP@12 for AMPKS test value: statistics, p-value
DGX A1001Yes0.657290.000130.657320.000100.15000 (0.98314)
DGX A1008Yes0.657480.000140.657540.000120.20000 (0.83197)
DGX A1001No0.657320.000110.657300.000140.10000 (0.99999)
DGX A1008No0.657480.000120.657500.000150.15000 (0.98314)
DGX-1 V1001Yes0.657260.000110.657320.000060.40000 (0.08106)
DGX-1 V1008Yes0.657440.000140.657520.000160.20000 (0.83197)
DGX-1 V1001No0.657320.000130.657330.000100.10000 (0.99999)
DGX-1 V1008No0.657460.000110.657560.000130.30000 (0.33559)

Training performance results

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

Our results were obtained by running the benchmark script (main.py --benchmark) in the TensorFlow2 NGC container on NVIDIA DGX A100 with (8x A100 80GB) GPUs.

GPUsBatch size / GPUXLAThroughput - TF32 (samples/s)Throughput - mixed precision (samples/s)Throughput speedup (TF32 - mixed precision)Strong scaling - TF32Strong scaling - mixed precision
1131072Yes1640579.82312149.21.411.001.00
1131072No1188653.481569403.041.321.001.00
816384Yes5369859.035742941.11.073.272.48
816384No3767868.653759027.041.003.172.40
Training performance: NVIDIA DGX-1 (8x V100 32GB)

Our results were obtained by running the benchmark script (main.py --benchmark) in the TensorFlow2 NGC container on NVIDIA DGX-1 with (8x V100 32GB) GPUs.

GPUsBatch size / GPUXLAThroughput - FP32 (samples/s)Throughput - mixed precision (samples/s)Throughput speedup (FP32 - mixed precision)Strong scaling - FP32Strong scaling - mixed precision
1131072Yes346096.21102253.523.181.001.00
1131072No292483.81822245.682.811.001.00
816384Yes1925045.333536706.631.845.563.21
816384No1512064.592434945.551.615.172.96

Evaluation performance results

Evaluation performance: NVIDIA DGX A100 (8x A100 80GB)

Our results were obtained by running the benchmark script (main.py --evaluate --benchmark) in the TensorFlow2 NGC container on NVIDIA DGX A100 with 8x A100 80GB GPUs.

GPUsBatch size / GPUXLAThroughput [samples/s] TF32Throughput [samples/s] AMPThroughput speedup AMP to TF32
14096No5947735569040.94
18192No9320789194390.99
116384No135197714118661.04
132768No179085117941041.00
165536No210191822634521.08
1131072No233984825939551.11
84096No419968336685780.87
88192No675233264320230.95
816384No1007066395243310.95
832768No13331928130206970.98
865536No16155221170724601.06

For more results go to the expandable table below.

Full tabular data for evaluation performance results for DGX A100
GPUsBatch size / GPUXLAThroughput [samples/s] TF32Throughput [samples/s] AMPThroughput speedup AMP to TF32
14096Yes6238646340581.02
14096No5947735569040.94
18192Yes99819210874161.09
18192No9320789194390.99
116384Yes149167816174721.08
116384No135197714118661.04
132768Yes190588121226171.11
132768No179085117941041.00
165536Yes217494924995891.15
165536No210191822634521.08
1131072Yes249306228528531.14
1131072No233984825939551.11
84096Yes466946544284050.95
84096No419968336685780.87
88192Yes738408978897941.07
88192No675233264320230.95
816384Yes10275441114511381.11
816384No1007066395243310.95
832768Yes13824087153914781.11
832768No13331928130206970.98
865536Yes17042737193608121.14
865536No16155221170724601.06
Evaluation performance: NVIDIA DGX-1 (8x V100 32GB)

Our results were obtained by running the benchmark script (main.py --evaluate --benchmark) in the TensorFlow2 NGC container on NVIDIA DGX-1 with (8x V100 32GB) GPUs.

GPUsBatch size / GPUXLAThroughput [samples/s] FP32Throughput [samples/s] AMPThroughput speedup AMP to FP32
14096No2949013372611.14
18192No4319305722041.32
116384No5692869176861.61
132768No69141312118471.75
165536No35878714960224.17
1131072No78663116432772.09
84096No211585122880381.08
88192No322671042232431.31
816384No429753663368131.47
832768No509869983764281.64
865536No5310861103773581.95

For more results go to the expandable table below.

Full tabular data for evaluation performance for DGX-1 V100 results
GPUsBatch size / GPUXLAThroughput [samples/s] FP32Throughput [samples/s] AMPThroughput speedup AMP to FP32
14096Yes3284283762561.15
14096No2949013372611.14
18192Yes4566816773751.48
18192No4319305722041.32
116384Yes6115079657211.58
116384No5692869176861.61
132768Yes73686513451741.83
132768No69141312118471.75
165536Yes78126016395212.10
165536No35878714960224.17
1131072Yes42857418095504.22
1131072No78663116432772.09
84096Yes236819427504841.16
84096No211585122880381.08
88192Yes347038646978881.35
88192No322671042232431.31
816384Yes449297170045711.56
816384No429753663368131.47
832768Yes525710589166831.70
832768No509869983764281.64
865536Yes5564338116228792.09
865536No5310861103773581.95