ImageNet classification with deep convolutional neural networks
Alex Krizhevsky, Ilya Sutskever et al.
0
Citations
0
Influential Citations
—
Venue
2019
Year
Utilizes a shared Transformer network and specific self-attention masks to excel in both language understanding and generation tasks.
Before UniLM, the NLP community largely treated language understanding and generation as separate domains requiring distinct architectures. BERT excelled at understanding tasks like classification and extractive QA, while GPT and other autoregressive models dominated generation tasks like summarization and dialogue. UniLM challenged this dichotomy by showing that a single Transformer, trained with carefully designed self-attention masks, could master both. This unification simplified the model landscape and paved the way for later models like T5 and BART that also embraced multi-task pre-training. For practitioners, UniLM meant fewer models to maintain and fine-tune, and a more coherent approach to building NLP systems that need both comprehension and generation capabilities.

UniLM's core innovation lies in its use of a shared Transformer network where the only difference between pre-training tasks is the self-attention mask. The input sequence is always prepended with a [SOS] token and appended with [EOS] tokens per segment. Tokens are embedded as the sum of token, position, and segment embeddings, following BERT's input representation.

The backbone is an L-layer Transformer. In each layer, self-attention heads compute outputs using the standard query-key-value mechanism, but with a mask matrix M that determines which token pairs can attend to each other. For bidirectional tasks, M allows full attention to all tokens. For unidirectional (left-to-right) tasks, M restricts attention to only previous tokens. For sequence-to-sequence tasks, the encoder part uses bidirectional attention, while the decoder part uses unidirectional attention and can attend to the encoder's output.

Pre-training uses four cloze-style objectives: bidirectional (masked language modeling), unidirectional (left-to-right), unidirectional (right-to-left), and sequence-to-sequence. In each, 15% of tokens are masked, with 80% replaced by [MASK], 10% by random tokens, and 10% left unchanged. The model predicts these masked tokens using a softmax classifier whose weights are tied to the token embeddings.

UniLM uses the same architecture as BERT LARGE: 24 Transformer layers, hidden size 1024, 16 attention heads, and about 340M parameters. It is initialized from BERT LARGE and further pre-trained on English Wikipedia and BookCorpus with a vocabulary of 28,996 subword tokens and a maximum sequence length of 512.

On abstractive summarization, UniLM outperformed all previous abstractive systems on CNN/DailyMail, and even beat the best extractive model by 0.88 ROUGE-L points. On Gigaword, it achieved strong results, particularly in low-resource settings—using only 10,000 training examples, it outperformed MASS by 7.08 ROUGE-L points.

For question answering, UniLM consistently surpassed other models on both extractive and generative QA tasks. On SQuAD and CoQA, it achieved higher F1 scores, demonstrating its versatility across different QA formats.



On the GLUE benchmark, UniLM performed comparably to BERT LARGE, confirming that its unified pre-training did not degrade understanding capabilities.

UniLM's key insight—that different language modeling objectives can be unified through attention masks—was both elegant and practical. It showed that a single pre-trained model could serve as a strong foundation for both NLU and NLG tasks, reducing the need for task-specific architectures. This work directly influenced later models like T5, which adopted a text-to-text framework, and BART, which combined denoising autoencoding with autoregressive decoding. For AI practitioners, UniLM demonstrated the power of flexible attention control and multi-task pre-training, offering a blueprint for building versatile language models that can handle a wide range of applications with minimal task-specific engineering.
Alex Krizhevsky, Ilya Sutskever et al.
Ashish Vaswani, Noam Shazeer et al.
Douglas M. Bates, Martin Mächler et al.
Diederik P. Kingma, Jimmy Ba