[논문 리뷰] Generating Long Sequences with Sparse Transformers
이 논문은 희소 인자화 자기-attention(Sparse Transformers)을 도입하여 트랜스포머를 길은 시퀀스로 확장하고, 텍스트, 이미지, 오디오에서 최상위 밀도 모델링을 달성하며, 수백 겹의 매우 긴 컨텍스트를 가능하게 한다.
Transformers are powerful sequence models, but require time and memory that grows quadratically with the sequence length. In this paper we introduce sparse factorizations of the attention matrix which reduce this to $O(n \sqrt{n})$. We also introduce a) a variation on architecture and initialization to train deeper networks, b) the recomputation of attention matrices to save memory, and c) fast attention kernels for training. We call networks with these changes Sparse Transformers, and show they can model sequences tens of thousands of timesteps long using hundreds of layers. We use the same architecture to model images, audio, and text from raw bytes, setting a new state of the art for density modeling of Enwik8, CIFAR-10, and ImageNet-64. We generate unconditional samples that demonstrate global coherence and great diversity, and show it is possible in principle to use self-attention to model sequences of length one million or more.
연구 동기 및 목표
- 텍스트, 이미지, 오디오에 걸친 긴 시퀀스에 대한 확장 가능한 자기회귀 모델링의 동기를 부여한다.
- 희소 인자화로 어텐션의 메모리 및 계산을 2차에서 거의 선형에 가깝게 감소시킨다.
- 구조적 및 최적화 변경으로 매우 깊은 트랜스포머 유사 모델의 학습을 가능하게 한다.
- 여러 데이터 모달리티에서 최상위 밀도 모델링을 입증한다.
제안 방법
- 각 위치가 이전 위치의 희소 부분집합에 주의(attend)하도록 하는 인자화된(분해된) 자기-attention을 도입한다.
- 제어 가능한 인접성(locality)과 커버리지를 갖는 스트라이드형과 고정 패턴의 2차원 인자화 어텐션 패턴을 탐구한다.
- 깊은 네트워크를 가능하게 하기 위해 사전 활성화 잔차 및 계층 정규화를 갖춘 Sparse Transformer 블록을 도입한다.
- 백프로파게이션 동안 어텐션 및 피드포워드 블록의 재계산을 사용하여 메모리를 절약한다.
- 혼합 희소 어텐션, 로컬 윈도우, 블록 단위 계산을 위한 효율적인 GPU 커널을 구현한다.
- 혼합 정밀도, 워밍업이 포함된 Adam, 코사인 학습률 감소, 그래디언트 클리핑으로 학습한다.
실험 결과
연구 질문
- RQ1길이가 긴 시퀀스에서 텍스트, 이미지, 오디오에 대해 희소 인자화된 어텐션이 전체 어텐션과 대등한 성능을 낼 수 있는가?
- RQ2다양한 데이터 모달리티에서 어떤 희소 패턴(스트라이드형 대 고정형)이 최상의 성능을 발휘하는가?
- RQ3Sparse Transformers를 얼마나 깊게 훈련시킬 수 있으며 어떤 메모리/학습 기술이 이를 가능하게 하는가?
- RQ4이 패턴들이 밀도 모델링 벤치마크와 샘플 품질에 어떤 영향을 미치는가?
주요 결과
| 모델 | 데이터셋 / 작업 | 바이트당 비트 |
|---|---|---|
| PixelCNN | CIFAR-10 | 3.03 |
| PixelCNN++ | CIFAR-10 | 2.92 |
| Image Transformer | CIFAR-10 | 2.90 |
| PixelSNAIL | CIFAR-10 | 2.85 |
| Sparse Transformer 59M (strided) | CIFAR-10 | 2.80 |
| Deeper Self-Attention (Al-Rfou et al., 2018) | Enwik8 | 1.06 |
| Transformer-XL 88M (Dai et al., 2018) | Enwik8 | 1.03 |
| Transformer-XL 277M (Dai et al., 2018) | Enwik8 | 0.99 |
| Sparse Transformer 95M (fixed) | Enwik8 | 0.99 |
| PixelCNN (Oord et al., 2016) | ImageNet 64x64 | 3.57 |
| Parallel Multiscale (Reed et al., 2017) | ImageNet 64x64 | 3.70 |
| Glow (Kingma & Dhariariwal, 2018) | ImageNet 64x64 | 3.81 |
| SPN (Menick & Kalchbrenner, 2018) | ImageNet 64x64 | 3.52 |
| Sparse Transformer 152M (strided) | ImageNet 64x64 | 3.44 |
| Sparse Transformer 152M (strided) | Classical music (audio) | 1.97 |
- 희소 트랜스포머는 CIFAR-10, Enwik8, ImageNet-64 및 음악 데이터에서 Dense 어텐션과 동등하거나 더 나은 밀도 모델링 성능을 달성한다.
- 스트라이드형과 고정형 희소 패턴은 Dense 어텐션보다 상당한 속도 향상을 제공하며, 경우에 따라 더 나은 압축도 달성한다(바이트당 비트 수 낮음).
- 수백 계층의 모델이 아키텍처 변경 및 그래디언트 재계산으로 학습될 수 있어 긴 컨텍스트 모델링이 가능하다.
- On CIFAR-10, strided sparse attention reaches 2.80–2.82 bits per dim, beating prior state-of-the-art (2.85).
- On Enwik8, Sparse Transformer with fixed attention reaches 0.99 bits per dim, matching or improving Transformer-XL with more parameters.
- On ImageNet-64, the strided sparse transformer achieves 3.44 bits per dim, better than several prior generative models.
더 나은 연구,지금 바로 시작하세요
연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.