Saved in:
Bibliographic Details
Main Authors: Ye, Tianzhu, Dong, Li, Xia, Yuqing, Sun, Yutao, Zhu, Yi, Huang, Gao, Wei, Furu
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2410.05258
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909567876595712
author Ye, Tianzhu
Dong, Li
Xia, Yuqing
Sun, Yutao
Zhu, Yi
Huang, Gao
Wei, Furu
author_facet Ye, Tianzhu
Dong, Li
Xia, Yuqing
Sun, Yutao
Zhu, Yi
Huang, Gao
Wei, Furu
contents Transformer tends to overallocate attention to irrelevant context. In this work, we introduce Diff Transformer, which amplifies attention to the relevant context while canceling noise. Specifically, the differential attention mechanism calculates attention scores as the difference between two separate softmax attention maps. The subtraction cancels noise, promoting the emergence of sparse attention patterns. Experimental results on language modeling show that Diff Transformer outperforms Transformer in various settings of scaling up model size and training tokens. More intriguingly, it offers notable advantages in practical applications, such as long-context modeling, key information retrieval, hallucination mitigation, in-context learning, and reduction of activation outliers. By being less distracted by irrelevant context, Diff Transformer can mitigate hallucination in question answering and text summarization. For in-context learning, Diff Transformer not only enhances accuracy but is also more robust to order permutation, which was considered as a chronic robustness issue. The results position Diff Transformer as a highly effective and promising architecture to advance large language models.
format Preprint
id arxiv_https___arxiv_org_abs_2410_05258
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Differential Transformer
Ye, Tianzhu
Dong, Li
Xia, Yuqing
Sun, Yutao
Zhu, Yi
Huang, Gao
Wei, Furu
Computation and Language
Machine Learning
Transformer tends to overallocate attention to irrelevant context. In this work, we introduce Diff Transformer, which amplifies attention to the relevant context while canceling noise. Specifically, the differential attention mechanism calculates attention scores as the difference between two separate softmax attention maps. The subtraction cancels noise, promoting the emergence of sparse attention patterns. Experimental results on language modeling show that Diff Transformer outperforms Transformer in various settings of scaling up model size and training tokens. More intriguingly, it offers notable advantages in practical applications, such as long-context modeling, key information retrieval, hallucination mitigation, in-context learning, and reduction of activation outliers. By being less distracted by irrelevant context, Diff Transformer can mitigate hallucination in question answering and text summarization. For in-context learning, Diff Transformer not only enhances accuracy but is also more robust to order permutation, which was considered as a chronic robustness issue. The results position Diff Transformer as a highly effective and promising architecture to advance large language models.
title Differential Transformer
topic Computation and Language
Machine Learning
url https://arxiv.org/abs/2410.05258