NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Temporal Fusion Transformer for PyTorch
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Temporal Fusion Transformer for PyTorch

Temporal Fusion Transformer is a state-of-the-art architecture for interpretable, multi-horizon time-series prediction.

Benchmarking

The following section shows how to run benchmarks measuring the model performance in training and inference modes. Note that the first 3 steps of each epoch are not used in the throughput or latency calculation. This is due to the fact that the nvFuser performs the optimizations on the 3rd step of the first epoch causing a multi-second pause.

Training performance benchmark

In order to run training benchmarks, use the scripts/benchmark.sh script.

Inference performance benchmark

To benchmark the inference performance on a specific batch size and dataset, run the inference.py script.

Results

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

Training accuracy results

We conducted an extensive hyperparameter search along with stability tests. The presented results are the averages from the hundreds of runs.

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

Our results were obtained by running the train.sh training script in the PyTorch 22.11 NGC container on NVIDIA A100 (8x A100 80GB) GPUs.

DatasetGPUsBatch size / GPUAccuracy - TF32Accuracy - mixed precisionTime to train - TF32Time to train - mixed precisionTime to train speedup (TF32 to mixed precision)
Electricity810240.026 / 0.056 / 0.0290.028 / 0.058 / 0.029200s176s1.136x
Traffic810240.044 / 0.108 / 0.0780.044 / 0.109 / 0.079140s129s1.085x
Training accuracy: NVIDIA DGX-1 (8x V100 16GB)

Our results were obtained by running the train.sh training script in the PyTorch 22.11 NGC container on NVIDIA DGX-1 with (8x V100 16GB) GPUs.

DatasetGPUsBatch size / GPUAccuracy - FP32Accuracy - mixed precisionTime to train - FP32Time to train - mixed precisionTime to train speedup (FP32 to mixed precision)
Electricity810240.028 / 0.057 / 0.0280.027 / 0.059 / 0.030371s269s1.379x
Traffic810240.042 / 0.110 / 0.0800.043 / 0.109 / 0.080251s191s1.314x
Training stability test

In order to get a greater picture of the model's accuracy, we performed a hyperparameter search along with stability tests on 100 random seeds for each configuration. Then, for each benchmark dataset, we have chosen the architecture with the least mean test q-risk. The table below summarizes the best configurations.

Dataset#GPUHidden size#HeadsLocal BSLRGradient clippingDropoutMean q-riskStd q-riskMin q-riskMax q-risk
Electricity8128410241e-30.00.10.11290.00250.10740.1244
Traffic8128410241e-30.00.30.22620.00270.22070.2331

Training performance results

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

Our results were obtained by running the train.sh training script in the PyTorch 22.11 NGC container on NVIDIA A100 (8x A100 80GB) GPUs. Performance numbers (in items/images per second) were averaged over an entire training epoch.

DatasetGPUsBatch size / GPUThroughput - TF32Throughput - mixed precisionThroughput speedup (TF32 - mixed precision)Weak scaling - TF32Weak scaling - mixed precision
Electricity1102412435176081.42x11
Electricity81024943891307691.39x7.59x7.42x
Traffic1102412509175911.40x11
Traffic81024944761309921.39x7.55x7.45x

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

The performance metrics used were items per second.

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

Our results were obtained by running the train.sh training script in the PyTorch 22.11 NGC container on NVIDIA DGX-1 with (8x V100 16GB) GPUs. Performance numbers (in items/images per second) were averaged over an entire training epoch.

DatasetGPUsBatch size / GPUThroughput - FP32Throughput - mixed precisionThroughput speedup (FP32 - mixed precision)Weak scaling - FP32Weak scaling - mixed precision
Electricity110245932101631.71x11
Electricity8102445566756601.66x7.68x7.44x
Traffic110245971101661.70x11
Traffic8102445925756401.64x7.69x7.44x

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

The performance metrics used were items per second.

Inference Performance Results

Inference Performance: NVIDIA DGX A100

Our results were obtained by running the inference.py script in the PyTorch 22.11 NGC container on NVIDIA DGX A100. Throughput is measured in items per second and latency is measured in milliseconds. To benchmark the inference performance on a specific batch size and dataset, run the inference.py script.

DatasetGPUsBatch size / GPUThroughput - mixed precision (item/s)Average Latency (ms)Latency p90 (ms)Latency p95 (ms)Latency p99 (ms)
Electricity11272.433.673.703.874.18
Electricity12518.133.863.883.934.19
Electricity141039.313.853.893.974.15
Electricity182039.543.923.933.954.32
Traffic11269.593.713.743.794.30
Traffic12518.733.863.783.914.66
Traffic141021.493.923.943.954.25
Traffic182005.543.994.014.034.39
Inference Performance: NVIDIA DGX-1 V100

Our results were obtained by running the inference.py script in the PyTorch 22.11 NGC container on NVIDIA DGX-1 V100. Throughput is measured in items per second and latency is measured in milliseconds. To benchmark the inference performance on a specific batch size and dataset, run the inference.py script.

DatasetGPUsBatch size / GPUThroughput - mixed precision (item/s)Average Latency (ms)Latency p90 (ms)Latency p95 (ms)Latency p99 (ms)
Electricity11171.685.825.996.177.00
Electricity12318.926.276.436.607.51
Electricity14684.795.846.026.086.47
Electricity181275.546.277.317.367.51
Traffic11183.395.455.645.866.73
Traffic12340.735.876.076.777.25
Traffic14647.336.186.357.998.07
Traffic181364.395.866.076.407.31

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.