This repository provides a script and recipe to train the SIM model to achieve state-of-the-art accuracy. The content of this repository is tested and maintained by NVIDIA.
Search-based Interest Model (SIM) is a system for predicting user behavior given sequences of previous interactions. The model is based on Search-based User Interest Modeling with Lifelong Sequential Behavior Data for Click-Through Rate Prediction paper which reports that it has been deployed at Alibaba in the display advertising system. This repository provides a reimplementation of the code-base provided originally for SIM and DIEN models (SIM model's inner component).
There are several differences between this and the original SIM model implementation. First, this model is implemented in TensorFlow 2 using Python 3.8 instead of TensorFlow 1 in Python 2.7. Second, this implementation utilizes the user dimension (identifiers), which enables to train a personalized recommender system. Finally, the training code uses data preprocessed to TFRecord format, which improves data loading. We also include scripts necessary to preprocess Amazon Reviews dataset used in experiments.
The table below provides a fine-grained summary of the differences between this repository and the original implementation.
| Mode | Original implementation | This repository |
|---|---|---|
| Python | 2.7 | 3.8 |
| Dataset size | 135K samples | 12M samples |
| Dataset format | CSV | TFRecord |
| Model | - user id feature not included - batch normalization included but not used correctly - two-dimensional softmax output - hardcoded features cardinalities |
- includes user id feature - doesn`t include batch normalization - one-dimensional sigmoid output - features cardinalities deducted from dataset |
In the author’s SIM implementation, the internals of submodels differs slightly between code and original papers (DIN, DIEN, SIM). Our implementation core is based on the paper's modules. For exact implementation details, refer to the list below.
The model enables you to train a high-quality, personalized, sequential neural network-based recommender system.
This model is trained with mixed precision using Tensor Cores on NVIDIA Volta and the NVIDIA Ampere GPU architectures. Therefore, researchers can get results 1.48x faster than training without Tensor Cores, while experiencing the benefits of mixed precision training. This model is tested against each NGC monthly container release to ensure consistent accuracy and performance over time.
SIM model consists of two components: General Search Unit (GSU) and the Exact Search Unit (ESU). The goal of the former is to filter down possibly long historical user behavior sequence to a shorter and relevant sequence. On the other hand, ESU utilizes the most recent user behaviors for a candidate item, for example, estimate click-through rate for a candidate ad. Both parts are trained jointly using data on past user behaviors.
A model architecture diagram is presented below.
Figure 1. The architecture of the model.
Embeddings in model architecture diagram are obtained by passing each feature from the dataset through the Embedding Layer. Item features from target item, short behavior history and long behavior history share embedding tables.
Figure 2. Embedding of input features.
The following features are implemented in this model:
The following performance optimizations were implemented in this model:
This model supports the following features:
| Feature | SIM v1.0 TF2 |
|---|---|
| Horovod Multi-GPU (NCCL) | Yes |
| Accelerated Linear Algebra (XLA) | Yes |
| Automatic mixed precision (AMP) | Yes |
| Preprocessing on GPU with NVTabular | Yes |
| BYO dataset | Yes |
Multi-GPU training with Horovod Our model uses Horovod to implement efficient multi-GPU training with NCCL. For details, refer to the example sources in this repository or refer to the TensorFlow tutorial.
Accelerated Linear Algebra (XLA) XLA is a domain-specific compiler for linear algebra that can accelerate TensorFlow models with potentially no source code changes. Enabling XLA results in improvements to speed and memory usage: most internal benchmarks run ~1.1-1.5x faster after XLA is enabled.
Automatic Mixed Precision (AMP) AMP enables mixed precision training without any changes to the code-base by performing automatic graph rewrites and loss scaling controlled by an environmental variable.
Preprocessing on GPU with NVTabular Preprocessing on GPU with NVTabular - Amazon Reviews dataset preprocessing can be conducted using NVTabular. For more information on the framework, refer to this blog post.
Mixed precision is the combined use of different numerical precisions in a computational method. Mixed precision training offers significant computational speedup by performing operations in half-precision format while storing minimal information in single-precision to retain as much information as possible in critical parts of the network. Since the introduction of Tensor Cores in NVIDIA Volta, and following with Ampere architectures, significant training speedups are experienced by switching to mixed precision -- up to 3x overall speedup on the most arithmetically intense model architectures. Using mixed precision training previously required two steps:
This can now be achieved using Automatic Mixed Precision (AMP) for TensorFlow to enable the full mixed precision methodology in your existing TensorFlow model code. AMP enables mixed precision training on NVIDIA Volta, and NVIDIA Ampere GPU architectures automatically. The TensorFlow framework code makes all necessary model changes internally.
In TF-AMP, the computational graph is optimized to use as few casts as necessary and maximize the use of FP16, and the loss scaling is automatically applied inside of supported optimizers. AMP can be configured to work with the existing tf.contrib loss scaling manager by disabling the AMP scaling with a single environment variable to perform only the automatic mixed-precision optimization. It accomplishes this by automatically rewriting all computation graphs with the necessary operations to enable mixed precision training and automatic loss scaling.
For information about:
To enable SIM training to use mixed precision, use --amp flag for the training script. Refer to the Quick Start Guide for more information.
TensorFloat-32 (TF32) is the new math mode in NVIDIA A100 GPUs for handling the matrix math, also called tensor operations. TF32 running on Tensor Cores in A100 GPUs can provide up to 10x speedups compared to single-precision floating-point math (FP32) on NVIDIA Volta GPUs.
TF32 Tensor Cores can speed up networks using FP32, typically with no loss of accuracy. It is more robust than FP16 for models which require a high dynamic range for weights or activations.
For more information, refer to the TensorFloat-32 in the A100 GPU Accelerates AI Training, HPC up to 20x blog post.
TF32 is supported in the NVIDIA Ampere GPU architecture and is enabled by default.
This section describes how you can train the DeepLearningExamples RecSys models on your own datasets without changing the model or data loader and with similar performance to the one published in each repository. This can be achieved thanks to Dataset Feature Specification, which describes how the dataset, data loader, and model interact with each other during training, inference, and evaluation. Dataset Feature Specification has a consistent format across all recommendation models in NVIDIA’s DeepLearningExamples repository, regardless of dataset file type and the data loader, giving you the flexibility to train RecSys models on your own datasets.
The Dataset Feature Specification consists of three mandatory and one optional section:
feature_spec provides a base of features that may be referenced in other sections, along with their metadata.
Format: dictionary (feature name) => (metadata name => metadata value)<br>
source_spec provides information necessary to extract features from the files that store them.
Format: dictionary (mapping name) => (list of chunks)<br>
channel_spec determines how features are used. It is a mapping (channel name) => (list of feature names).
Channels are model-specific magic constants. In general, data within a channel is processed using the same logic. Example channels: model output (labels), categorical ids, numerical inputs, user data, and item data.
metadata is a catch-all, wildcard section: If there is some information about the saved dataset that does not fit into the other sections, you can store it here.
Data flow can be described abstractly: Input data consists of a list of rows. Each row has the same number of columns; each column represents a feature. The columns are retrieved from the input files, loaded, aggregated into channels and supplied to the model/training script.
FeatureSpec contains metadata to configure this process and can be divided into three parts:
Specification of how data is organized on disk (source_spec). It describes which feature (from feature_spec) is stored in which file and how files are organized on disk.
Specification of features (feature_spec). Describes a dictionary of features, where key is the feature name and values are the features’ characteristics such as dtype and other metadata (for example, cardinalities for categorical features)
Specification of model’s inputs and outputs (channel_spec). Describes a dictionary of model’s inputs where keys specify model channel’s names and values specify lists of features to be loaded into that channel. Model’s channels are groups of data streams to which common model logic is applied, for example categorical/continuous data, and user/item ids. Required/available channels depend on the model
The FeatureSpec is a common form of description regardless of underlying dataset format, dataset data loader form, and model.
The typical data flow is as follows:
Figure 3. Data flow in Recommender models in NVIDIA Deep Learning Examples repository. Channels of the model are drawn in green
As an example, let’s consider a Dataset Feature Specification for a small CSV dataset for some abstract model.
feature_spec:
user_gender:
dtype: torch.int8
cardinality: 3 #M,F,Other
user_age: #treated as numeric value
dtype: torch.int8
user_id:
dtype: torch.int32
cardinality: 2655
item_id:
dtype: torch.int32
cardinality: 856
label:
dtype: torch.float32
source_spec:
train:
- type: csv
features:
- user_gender
- user_age
files:
- train_data_0_0.csv
- train_data_0_1.csv
- type: csv
features:
- user_id
- item_id
- label
files:
- train_data_1.csv
test:
- type: csv
features:
- user_id
- item_id
- label
- user_gender
- user_age
files:
- test_data.csv
channel_spec:
numeric_inputs:
- user_age
categorical_user_inputs:
- user_gender
- user_id
categorical_item_inputs:
- item_id
label_ch:
- label
The data contains five features: (user_gender, user_age, user_id, item_id, label). Their data types and necessary metadata are described in the feature specification section.
In the source mapping section, two mappings are provided: one describes the layout of the training data, and the other of the testing data. The layout for training data has been chosen arbitrarily to showcase the flexibility. The train mapping consists of two chunks. The first one contains user_gender and user_age, saved as a CSV, and is further broken down into two files. For specifics of the layout, refer to the following example and consult the glossary. The second chunk contains the remaining columns and is saved in a single file. Notice that the order of columns is different in the second chunk - this is alright, as long as the order matches the order in that file (that is, columns in the .csv are also switched)
Let’s break down the train source mapping. The table contains example data color-paired to the files containing it.
The channel spec describes how the data will be consumed. Four streams will be produced and available to the script/model. The feature specification does not specify what happens further: names of these streams are only lookup constants defined by the model/script. Based on this example, we can speculate that the model has three input channels: numeric_inputs, categorical_user_inputs, categorical_item_inputs, and one output channel: label. Feature names are internal to the FeatureSpec and can be freely modified.
In order to train any Recommendation model in NVIDIA Deep Learning Examples, one can follow one of three possible ways:
One delivers preprocessed datasets in the Intermediary Format supported by data loader used by the training script (different models use different data loaders) together with FeatureSpec yaml file describing at least specification of dataset, features, and model channels
One uses a transcoding script (not supported in SIM model yet)
One delivers datasets in non-preprocessed form and uses preprocessing scripts that are a part of the model repository. In order to use already existing preprocessing scripts, the format of the dataset needs to match one of the original datasets. This way, the FeatureSpec file will be generated automatically, but the user will have the same preprocessing as in the original model repository.
Auxiliary loss is used to improve DIEN (so SIM as well) model training. It is constructed based on consecutive user actions from their short behavior history.
DIEN model was proposed in Deep Interest Evolution Network for Click-Through Rate Prediction paper as an extension of the DIN model. It can also be used as a backbone for processing short interaction sequences in the SIM model.
DIN model was proposed in Deep Interest Network for Click-Through Rate Prediction paper. It can be used as a backbone for processing short interaction sequences in the SIM model.
Long user behavior history is the record of past user interactions. They are processed by the General Search Unit part of the SIM model (refer to Figure 1). This typically is a lightweight model aimed at processing longer sequences.
Short user behavior history is the record of the most recent user interactions. They are processed by a more computationally intensive Exact Search Unit part of the SIM model (refer to Figure 1).
User behaviors are users' interactions with given items of interest. Example interactions include reviewed items for Amazon Reviews dataset or clicks in the e-commerce domain. All the systems contained in this repository focus on modeling user interactions.
The following section lists the requirements that you need to meet in order to start training the SIM model.
This repository contains a Dockerfile that extends the TensorFflow2 NGC container and encapsulates some dependencies. Aside from these dependencies, ensure you have the following components:
For more information about how to get started with NGC containers, refer to the following sections from the NVIDIA GPU Cloud Documentation and the Deep Learning Documentation:
For those unable to use the Tensorflow2 NGC container, to set up the required environment or create your own container, refer to the versioned NVIDIA Container Support Matrix.
To train your model using mixed or TF32 precision with Tensor Cores or using FP32, perform the following steps using the default parameters of the SIM model on the Amazon Reviews dataset. For the specifics concerning training and inference, refer to the Advanced section.
Clone the repository.
git clone https://github.com/NVIDIA/DeepLearningExamples
cd DeepLearningExamples/TensorFlow2/Recommendation/SIM
Build the SIM Tensorflow2 container.
docker build -t sim_tf2 .
Start an interactive session in the NGC container to run preprocessing, training, or inference (Amazon Books dataset can be mounted if it has already been downloaded, otherwise, refer to point 4). The SIM TensorFlow2 container can be launched with:
docker run --runtime=nvidia -it --rm --ipc=host --security-opt seccomp=unconfined -v ${AMAZON_DATASET_PATH}:${RAW_DATASET_PATH} sim_tf2 bash
(Optional) Download Amazon Books dataset:
scripts/download_amazon_books_2014.sh
export RAW_DATASET_PATH=/data/amazon_books_2014
Start preprocessing.
For details of the required file format and certain preprocessing parameters refer to BYO dataset.
python preprocessing/sim_preprocessing.py \
--amazon_dataset_path ${RAW_DATASET_PATH} \
--output_path ${PARQUET_PATH}
python preprocessing/parquet_to_tfrecord.py \
--amazon_dataset_path ${PARQUET_PATH} \
--tfrecord_output_dir ${TF_RECORD_PATH}
Start training (${GPU} is an arbitrary number of GPUs to be used).
mpiexec --allow-run-as-root --bind-to socket -np ${GPU} python main.py \
--dataset_dir ${TF_RECORD_PATH} \
--mode train \
--model_type sim \
--embedding_dim 16 \
--drop_remainder \
--optimizer adam \
--lr 0.01 \
--epochs 3 \
--global_batch_size 131072 \
--amp
Start inference.
mpiexec --allow-run-as-root --bind-to socket -np ${GPU} python main.py \
--dataset_dir ${TF_RECORD_PATH} \
--mode inference \
--model_type sim \
--embedding_dim 16 \
--global_batch_size 131072 \
--amp
For the explanation of output logs, refer to Log format section.
Now that you have your model trained and evaluated, you can choose to compare your training results with our Training accuracy results. You can also choose to benchmark your performance to Training performance benchmark, or Inference performance benchmark. Following the steps in these sections will ensure that you achieve the same accuracy and performance results as stated in the Results section.
The following sections provide greater details of the dataset, running training and inference, and the training results.
The main.py script provides an entry point to all the provided functionalities. This includes running training and inference modes. The behavior of the script is controlled by command-line arguments listed below in the Parameters section. The preprocessing folder contains scripts to prepare data. In particular, the preprocessing/sim_preprocessing.py script can be used to preprocess the Amazon Reviews dataset while preprocessing/parquet_to_tfrecord.py transforms parquet files to TFRecords for loading data efficiently.
Models are implemented in corresponding modules in the sim/models subdirectory, for example, sim/models/sim_model.py for the SIM model. The sim/layers module contains definitions of different building blocks for the models. Finally, the sim/data subdirectory provides modules for the dataloader. Other useful utilities are contained in the sim/utils module.
The main.py script parameters are detailed in the following table.
| Scope | Parameter | Description | Default Value |
|---|---|---|---|
| model | model_type | Model type | sim |
| model | embedding_dim | Embedding dimension for different entities (users, items & categories) | 16 |
| model | stage_one_mlp_dims | MLP hidden dimensions for the stage one component | 200 |
| model | stage_two_mlp_dims | MLP hidden dimensions for the stage two component | 200,80 |
| model | aux_mlp_dims | MLP hidden dimensions for the auxiliary loss | 100,50 |
| datasets | dataset_dir | Path to the directory containing feature specification file and dataset splits | -- |
| datasets | feature_spec | Name of the feature spec file in the dataset directory | feature_spec.yaml |
| training | optimizer | Optimizer to use | adam |
| training | lr | Learning rate for the optimizer selected | 0.01 |
| training | weight_decay | Parameters decay of the optimizer selected | 0 |
| training | epochs | Train for the following number of epochs | 3 |
| training | global_batch_size | Batch size used for training, evaluation and inference | 131072 |
| training | dropout_rate | Dropout rate for all the classification MLPs | -1 (disabled) |
| training | amp | Enable automatic mixed precision training (flag) | False |
| training | xla | Enable XLA conversion (flag) | False |
| training | drop_remainder | Drop remainder batch for training set (flag) | False |
| training | disable_cache | Disable dataset caching after the first time it is iterated over (flag) | False |
| training | repeat_count | Repeat training dataset this number of times | 0 |
| training | prefetch_train_size | Number of batches to prefetch in training. | 10 |
| training | prefetch_test_size | Number of batches to prefetch in evaluation. | 2 |
| training | long_seq_length | Determines the long history - short history split of history features | 90 |
| training | prebatch_train_size | Batch size of batching applied during preprocessing to train dataset. | 0 |
| training | prebatch_test_size | Batch size of batching applied during preprocessing to test dataset. | 0 |
| results | results_dir | Path to the model result files storage | /tmp/sim |
| results | log_filename | Name of the file to store logger output | log.json |
| results | save_checkpoint_path | Directory to save model checkpoints | "" |
| results | load_checkpoint_path | Directory to restore model checkpoints from | "" |
| run mode | mode | One of: train, inference. | train |
| run mode | benchmark | Perform benchmark measurements for, e.g., throughput calculation (flag) | False |
| run mode | benchmark_warmup_steps | Number of warmup steps to use for performance benchmarking | 20 |
| run mode | benchmark_steps | Number of steps to use for performance benchmarking | 200 |
| run mode | affinity | Type of CPU affinity | socket_unique_interleaved |
| run mode | inter_op_parallelism | Number of inter op threads | 0 |
| run mode | intra_op_parallelism | Number of intra op threads | 0 |
| run mode | num_parallel_calls | Parallelism level for tf.data API. If None, heuristic based on number of CPUs and number of GPUs will be used | None |
| reproducibility | seed | Random seed | -1 |
To view the full list of available options and their descriptions, use the --help command-line option, for example:
python main.py --help
The SIM model was trained on the Books department subset of Amazon Reviews dataset. The dataset is split into two parts: training and test data. The test set for evaluation was constructed using the last user interaction from user behavior sequences. All the preceding interactions are used for training.
This repository contains the scripts/download_amazon_books_2014.sh, which can be used to download the dataset.
The preprocessing steps applied to the raw data include:
Preprocessing scripts allow to apply batching prior to the models dataloader. This reduces the size of produced TFrecord files and speeds up dataloading.
To do so, specify--prebatch_train_sizeand--prebatch_test_sizewhile converting data usingscripts/parquet_to_tfrecord.py. Later, while using themain.py` script, pass the information about applied prebatch size via the same parameters.
Example
Start preprocessing from step 5. from Quick Start Guide:
python preprocessing/sim_preprocessing.py \
--amazon_dataset_path ${RAW_DATASET_PATH} \
--output_path ${PARQUET_PATH}
python preprocessing/parquet_to_tfrecord.py \
--amazon_dataset_path ${PARQUET_PATH} \
--tfrecord_output_dir ${TF_RECORD_PATH} \
--prebatch_train_size ${PREBATCH_TRAIN_SIZE} \
--prebatch_train_size ${PREBATCH_TEST_SIZE}
And then train the model (step 6.):
mpiexec --allow-run-as-root --bind-to socket -np ${GPU} python main.py \
--dataset_dir ${TF_RECORD_PATH} \
--mode train \
--model_type sim \
--embedding_dim 16 \
--drop_remainder \
--optimizer adam \
--lr 0.01 \
--epochs 3 \
--global_batch_size 131072 \
--amp \
--prebatch_train_size ${PREBATCH_TRAIN_SIZE} \
--prebatch_train_size ${PREBATCH_TEST_SIZE}
This implementation supports using other datasets thanks to BYO dataset functionality. BYO dataset functionality allows users to plug in their dataset in a common fashion for all Recommender models that support this functionality. Using BYO dataset functionality, the user does not have to modify the source code of the model thanks to the Feature Specification file. For general information on how the BYO dataset works, refer to the BYO dataset overview section.
For usage of preprocessing scripts refer to Quick Start Guide
There are currently two ways to plug in the user's dataset:
This model defines five channels:
Features in negative_history, positive_history and target_item_features channels must be equal in number and must be defined in the same order in channel spec.
The training script expects two mappings:
For performance reasons, the only supported dataset type is tfrecord.
Training can be run using main.py script by specifying the --mode train parameter. The speed of training is measured by throughput, that is, the number of samples processed per second. Evaluation is based on the Area under ROC Curve (ROC AUC) metric. Model checkpoints may be stored using Checkpoint manager via the --save_checkpoint_path and --load_checkpoint_path parameters. Training and inference logs are saved to a directory specified via the --results_dir parameter. Mixed precision training is supported via the --amp flag. Multi-GPU training is performed using mpiexec and Horovod libraries.
Inference can be run using main.py script by specifying the --mode inference parameter. It is performed using a dummy model initialized randomly, and it is intended to measure inference throughput. The most important parameter for inference is the batch size.
Example usage of training and inference are demonstrated in Quick Start Guide.
There are three type of log lines during model execution. Each of them have step value, however it is formatted differently based on the type of log:
[epoch, step]:DLLL {"timestamp": ..., "datetime": ..., "elapsedtime": ..., "type": ..., "step": [2, 79], "data": ...}
[epoch]:DLLL {"timestamp": ..., "datetime": ..., "elapsedtime": ..., "type": ..., "step": [2], "data": ...}
[]:DLLL {"timestamp": ..., "datetime": ..., "elapsedtime": ..., "type": ..., "step": [], "data": ...}
In those logs, data field contains dictonary in form {metric: value}. Metrics logged differ based on log type (step, end of epoch, summary) and model mode (training, inference).
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.
The following section shows how to run benchmarks measuring the model performance in training and inference modes.
To benchmark the training performance on a specific batch size, run:
mpiexec --allow-run-as-root --bind-to socket -np ${GPU} python main.py \
--dataset_dir ${TF_RECORD_PATH} \
--mode train \
--model_type sim \
--global_batch_size 131072 \
--drop_remainder \
--amp \
--benchmark \
--prebatch_train_size ${PREBATCH_TRAIN_SIZE} \
--prebatch_test_size ${PREBATCH_TEST_SIZE}
Equivalent:
scripts/run_model.sh \
--data_path ${TF_RECORD_PATH} \
--gpus ${GPU} \
--amp 1 \
--benchmark 1 \
--prebatch_train_size ${PREBATCH_TRAIN_SIZE} \
--prebatch_test_size ${PREBATCH_TEST_SIZE}
To benchmark the inference performance on a specific batch size, run:
mpiexec --allow-run-as-root --bind-to socket -np ${GPU} python main.py \
--dataset_dir ${TF_RECORD_PATH} \
--mode inference \
--model_type sim \
--global_batch_size 131072 \
--amp \
--benchmark \
--prebatch_train_size ${PREBATCH_TRAIN_SIZE} \
--prebatch_test_size ${PREBATCH_TEST_SIZE}
Equivalent:
scripts/run_model.sh \
--data_path ${TF_RECORD_PATH} \
--gpus ${GPU} \
--amp 1 \
--benchmark 1 \
--prebatch_train_size ${PREBATCH_TRAIN_SIZE} \
--prebatch_test_size ${PREBATCH_TEST_SIZE}
The following sections provide details on how we achieved our performance and accuracy in training and inference.
Our results were obtained by running the run_model.sh bash script in the TensorFlow2 21.10-py3 NGC container. Experiments were run on 1 and 8 GPUs, with FP32/TF32 Precision and AMP and with XLA-OFF/XLA-ON. Dataset was prebatched with the size of 16384. Other parameters were set to defaults.
There were 10 runs for each configuration. In the Training accuracy sections, average values are reported. In the Training stability sections, values from all runs are included in plots.
| GPUs | XLA | Time to train - TF32 (seconds) | Time to train - mixed precision (seconds) | AUC - TF32 | AUC - mixed precision | Time to train speedup (TF32 to mixed precision) |
|---|---|---|---|---|---|---|
| 1 | XLA-OFF | 133.62 | 109.29 | 0.82 | 0.811 | 1.22 |
| 1 | XLA-ON | 132.31 | 113.91 | 0.811 | 0.822 | 1.16 |
| 8 | XLA-OFF | 35.17 | 34.08 | 0.813 | 0.808 | 1.03 |
| 8 | XLA-ON | 39.19 | 40.16 | 0.814 | 0.811 | 0.98 |
| GPUs | XLA | Time to train - FP32 (seconds) | Time to train - mixed precision (seconds) | AUC - FP32 | AUC - mixed precision | Time to train speedup (FP32 to mixed precision) |
|---|---|---|---|---|---|---|
| 1 | XLA-OFF | 210.70 | 154.54 | 0.815 | 0.817 | 1.36 |
| 1 | XLA-ON | 203.61 | 159.80 | 0.816 | 0.813 | 1.27 |
| 8 | XLA-OFF | 48.643 | 44.02 | 0.811 | 0.817 | 1.11 |
| 8 | XLA-ON | 55.26 | 54.33 | 0.814 | 0.817 | 1.02 |
Training stability was tested over 10 runs for each configuration of double precision / AMP, XLA-ON / XLA-OFF on 1 GPU and 8 GPUs for both Volta and Ampere architectures. Each run used the same random seed and default values of training hyperparameters. Training was performed on DGX A100 80GB and DGX-1 V100 32GB setups. AUC metric achieved on test set after training is presented in the following plots.
(Plot represents XLA-OFF results, for XLA-ON results, check expandable part below)
Figure 4. Training stability plot, distribution of AUC across different configurations with XLA-OFF.
Figure 5. Training stability plot, distribution of AUC across different configurations with XLA-ON.
Figure 6. Impact of AMP on test set AUC (XLA-OFF)
Figure 8. ROC curve for different configurations of Ampere/Volta, 1/8 GPUs, double precision / AMP. (XLA-OFF)
| GPUs | XLA | Throughput - FP32 (samples/s) | Throughput - mixed precision (samples/s) | Throughput speedup (mixed precision / FP32) | Strong scaling - FP32 | Strong scaling - mixed precision |
|---|---|---|---|---|---|---|
| 1 | OFF | 209376.38 | 309752.48 | 1.48 | 1.00 | 1.00 |
| 1 | ON | 245414.62 | 348945.59 | 1.42 | 1.00 | 1.00 |
| 8 | OFF | 1310239.01 | 1689602.79 | 1.29 | 6.26 | 5.45 |
| 8 | ON | 1483120.32 | 1962226.32 | 1.32 | 6.04 | 5.62 |
| 16 | OFF | 2127221.65 | 2555926.79 | 1.20 | 10.16 | 8.25 |
| 16 | ON | 2450499.40 | 2788997.07 | 1.14 | 9.99 | 7.99 |
Our results were obtained by running the scripts/run_model.sh script in the TensorFlow2 21.10-py3 NGC container.
Numbers were averaged over 10 separate runs for each configuration.
For each run, performance numbers (in samples per second) were averaged over training steps from one epoch which gives reliable estimates of the throughput. We also exclude the first 20 steps of training as a warmup phase.
To achieve these same results, follow the steps in the Quick Start Guide.
| Batch Size | XLA | Throughput - TF32 (samples/s) | Throughput - mixed precision (samples/s) | Throughput speedup (mixed precision / TF32) |
|---|---|---|---|---|
| 4096 | ON | 618547.45 | 669640.65 | 1.08 |
| 8192 | ON | 722801.14 | 849101.88 | 1.17 |
| 16384 | ON | 859418.77 | 1051361.67 | 1.22 |
| 32768 | ON | 976771.70 | 1269000.97 | 1.30 |
| 65536 | ON | 1082688.51 | 1444729.52 | 1.33 |
| 131072 | ON | 1094733.64 | 1483542.86 | 1.36 |
| Batch Size | XLA | Throughput - FP32 (samples/s) | Throughput - mixed precision (samples/s) | Throughput speedup (mixed precision / FP32) |
|---|---|---|---|---|
| 4096 | ON | 444532.22 | 541975.24 | 1.22 |
| 8192 | ON | 505047.64 | 642784.48 | 1.27 |
| 16384 | ON | 549325.54 | 727077.63 | 1.32 |
| 32768 | ON | 587452.73 | 788606.35 | 1.34 |
| 65536 | ON | 605187.67 | 832651.59 | 1.38 |
| 131072 | ON | 599557.03 | 840602.90 | 1.40 |
May 2022
November 2022