Skip to main content
QUICK REVIEW

[논문 리뷰] Long-Short Transformer: Efficient Transformers for Language and Vision

Chen Zhu, Wei Ping|arXiv (Cornell University)|2021. 07. 05.
Multimodal Machine Learning Applications참고 문헌 62인용 수 56
한 줄 요약

Transformer-LS는 동적 저랭크 롱-레인지 주의와 로컬 슬라이딩 윈도우 주의를 결합하여 긴 시퀀스에 대한 선형 시간의 자기 주의(self-attention)를 달성하고, 다양한 작업에서 최신의 효율적 트랜스포머를 능가합니다.

ABSTRACT

Transformers have achieved success in both language and vision domains. However, it is prohibitively expensive to scale them to long sequences such as long documents or high-resolution images, because self-attention mechanism has quadratic time and memory complexities with respect to the input sequence length. In this paper, we propose Long-Short Transformer (Transformer-LS), an efficient self-attention mechanism for modeling long sequences with linear complexity for both language and vision tasks. It aggregates a novel long-range attention with dynamic projection to model distant correlations and a short-term attention to capture fine-grained local correlations. We propose a dual normalization strategy to account for the scale mismatch between the two attention mechanisms. Transformer-LS can be applied to both autoregressive and bidirectional models without additional complexity. Our method outperforms the state-of-the-art models on multiple tasks in language and vision domains, including the Long Range Arena benchmark, autoregressive language modeling, and ImageNet classification. For instance, Transformer-LS achieves 0.97 test BPC on enwik8 using half the number of parameters than previous method, while being faster and is able to handle 3x as long sequences compared to its full-attention version on the same hardware. On ImageNet, it can obtain the state-of-the-art results (e.g., a moderate size of 55.8M model solely trained on 224x224 ImageNet-1K can obtain Top-1 accuracy 84.1%), while being more scalable on high-resolution images. The source code and models are released at https://github.com/NVIDIA/transformer-ls .

연구 동기 및 목표

  • 긴 언어 시퀀스와 고해상도 비전 입력을 다루는 확장 가능한 트랜스포머의 필요성을 자극한다.
  • 긴-단계 Long-Short Transformer(Transformer-LS)를 제안하여 장거리 동적 투사 주의와 짧은 기간 로컬 윈도우 주의를 결합한다.
  • Long-Range와 Short-Term 구성 요소 간의 스케일 불일치를 해결하기 위해 DualLN을 도입한다.
  • 언어 및 비전 벤치마크에서 최첨단 성능과 효율성을 입증한다.
  • 구현 세부사항을 제공하고 다양한 작업에서의 강건성과 확장성을 보여준다.

제안 방법

  • 동적 저랭크 롱-레인지 주의와 로컬 윈도우 단기 주의를 하나의 듀얼 주의 방식으로 결합하는 체계를 도입한다.
  • K로부터 파생된 동적 투영 P_i를 정의하여 K와 V를 저랭크 bar{K}_i, bar{V}_i로 투영하며 복잡도는 O(rn)이다.
  • 롱-레인지 주의를 bar{H}_i = A_i (P_i^T W^V V)로 계산하는데, A_i는 softmax(QW_i^Q bar{K}_i^T)/sqrt(d_k)이다.
  • 듀얼 LN 체계를 통해 노름을 정렬시키면서 [tilde{K}_t; bar{K}_i] 및 [tilde{V}_t; bar{V}_i]에 주의를 기울여 헤드별로 롱-레인지와 숏-텀 주의를 집계한다.
  • 선형 시간/공간 복잡도로 자기 회귀(autoregressive) 및 양방향(bidirectional) 모델링 모두에 효율적 주의를 적용한다.
  • Dynamic Projection가 시퀀스 길이 변화 및 섭동에 대해 얼마나 강건한지 Demonstrate 한다.

실험 결과

연구 질문

  • RQ1 unified Long-Short Transformer가 긴 거리의 언어와 고해상도 비전 작업에서 성능을 보존하거나 개선하면서 선형 시간의 자기 주의를 달성할 수 있는가?
  • RQ2Dynamic한 롱-레인지 투영과 로컬 윈도우 주의를 결합하는 것이 LRA, IMDb, enwik8, text8, ImageNet 등 다양한 설정에서 기존의 효율적 트랜스포머 접근법을 능가하는가?
  • RQ3제안된 DualLN 정규화가 롱-레인지와 숏-텀 주의 간의 스케일 불일치를 완화하는 데 효과적인가?
  • RQ4언어와 비전 벤치마크에서 Autoregressive 대 Bidirectional 모델링에서 Transformer-LS의 성능은 어떠한가?
  • RQ5제안된 주의 집계가 입력 섭동(삽입/삭제) 및 가변 시퀀스 길이에 대한 강건성에 어떤 영향을 미치는가?

주요 결과

  • Transformer-LS는 효율적 트랜스포머 중 Long Range Arena 벤치마크에서 최첨단 결과를 달성한다.
  • 자(auto-regressive) 언어 모델링에서 Transformer-LS는 enwik8에서 0.97의 테스트 BPC를 달성하고, 동일 하드웨어에서 기존 방법의 절반 매개변수로 더 길이가 3배까지 긴 시퀀스를 처리한다.
  • 비전 작업에서 Transformer-LS 기반 CvT 및 ViL 변형은 FLOPs를 줄이거나 견줄 만한 수준으로 ImageNet에서 경쟁력 있거나 최첨단 결과를 달성한다.
  • DualLN 정렬은 DualLN이 없는 모델에 비해 최적화 및 검증 손실을 크게 개선한다.
  • Dynamic Projection은 삽입/삭제 섭동에 대해 강건성을 보여주고 고정된 Linformer류 투영보다 우수한 성능을 제공한다.
  • 작업 전반에 걸쳐 w 및 r 구성의 Transformer-LS가 정확도, FLOPs, 시퀀스 길이 지원 간의 유리한 절충을 자주 달성한다.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.