NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Transformer-XL Base TensorFlow checkpoint (AMP, Base)
Model
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Transformer-XL Base TensorFlow checkpoint (AMP, Base)

Transformer-XL Base Base TensorFlow checkpoint trained with AMP

Model Overview

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

Model Architecture

The Transformer-XL "base" model for WikiText-103 dataset available in this repository was modified to use the following hyperparameter values:

HyperparameterDescriptionOriginal setting for the base modelOur modification to the base model
d_modelhidden size410512
n_headnumber of attention heads108
d_headsize of each attention head4164
d_innerhidden size in fully-connected layers21002048
tgt_lennumber of tokens to predict during training150192
mem_lennumber of tokens cached from previous iterations during training150192

Changes described above were made to align certain hyperparameters with powers of two, with this modification, the model is able to achieve better hardware utilization, and therefore higher training throughput.

The following table lists the hyperparameters for the base Transformer-XL model for WikiText-103 dataset available in this repository.

HyperparameterDescriptionBase model
n_layernumber of layers16
d_modelhidden size512
n_headnumber of attention heads8
d_headsize of each attention head64
d_innerinner hidden size in fully-connected layers2048
dropoutdropout0.1
dropattdropout after softmax in the attention0.0
lrbase learning rate0.01
min_lr_ratiominimum ratio learning rate (for cosine decay)0.1
max_stepnumber of training steps40,000
warmup_stepnumber of learning rate warmup steps1,000
batch_sizetraining batch size256
tgt_lennumber of tokens to predict during training192
mem_lennumber of tokens cached from previous iterations during training192

The Transformer-XL model addresses the limitations of vanilla transformer-based language models, which are only able to use relatively short context, bounded by the segment length. The Transformer-XL introduces a recurrence mechanism, which is able to use a cached hidden state from previous segments. During training, the context consists of a concatenation of the current segment's hidden state and cached states from previous iterations. Gradients are backpropagated only through the current segment, although the model is able to take advantage of the extra information stored in the cache and therefore is able to model long-term dependencies.

An illustration of the recurrence mechanism taken from the Transformer-XL paper is shown below. model

Training

This model was trained using script available on NGC and in GitHub repo.

Dataset

The following datasets were used to train this model:

  • WikiText-103 - A collection of over 100 million tokens extracted from the set of verified Good and Featured articles on Wikipedia.

Performance

Performance numbers for this model are available in NGC.

References

License

This model was trained using open-source software available in Deep Learning Examples repository. For terms of use, please refer to the license of the script and the datasets the model was derived from.

Publisher
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
Latest Version20.06.1_amp
UpdatedApril 4, 2023 UTC
Compressed Size2.97 GB
Labels