[논문 리뷰] R-Transformer: Recurrent Neural Network Enhanced Transformer
R-Transformer는 LocalRNN을 로컬 구조와 다중 헤드 어텐션으로 글로벌 의존성에 결합하여 위치 임베딩 없이도 강력한 성능을 달성하고, 여러 시퀀스 모델링 작업에서 Transformer와 TCN보다 우수한 성능을 보입니다.
Recurrent Neural Networks have long been the dominating choice for sequence modeling. However, it severely suffers from two issues: impotent in capturing very long-term dependencies and unable to parallelize the sequential computation procedure. Therefore, many non-recurrent sequence models that are built on convolution and attention operations have been proposed recently. Notably, models with multi-head attention such as Transformer have demonstrated extreme effectiveness in capturing long-term dependencies in a variety of sequence modeling tasks. Despite their success, however, these models lack necessary components to model local structures in sequences and heavily rely on position embeddings that have limited effects and require a considerable amount of design efforts. In this paper, we propose the R-Transformer which enjoys the advantages of both RNNs and the multi-head attention mechanism while avoids their respective drawbacks. The proposed model can effectively capture both local structures and global long-term dependencies in sequences without any use of position embeddings. We evaluate R-Transformer through extensive experiments with data from a wide range of domains and the empirical results show that R-Transformer outperforms the state-of-the-art methods by a large margin in most of the tasks. We have made the code publicly available at \url{https://github.com/DSE-MSU/R-transformer}.
연구 동기 및 목표
- 로컬 구조를 포착하면서 장기 의존성을 보존하여 시퀀스 모델링을 개선하려는 동기 부여.
- LocalRNN과 다중 헤드 어텐션을 결합한 하이브리드 아키텍처를 제안합니다.
- 위치 임베딩 없이도 베이스라인을 다양한 도메인에서 능가할 수 있음을 모델이 보여줍니다.
제안 방법
- 각 위치에서 끝나는 로컬 윈도를 처리하는 LocalRNN을 도입하여 로컬 순차 정보를 인코딩하는 위치 표현을 생성합니다.
- 다중 헤드 어텐션을 활용한 풀링 하위 계층을 적용하여 위치 간의 글로벌 장기 의존성을 포착합니다.
- 로컬RNN, 어텐션 및 피드포워드 하위 계층 간에 잔차 연결 및 계층 정규화 체계를 따라 R-Transformer의 각 계층을 구성합니다.
- 로컬(R-LOCAL), 글로벌(Multi-Head Attention), 위치별 피드포워드의 3단 계층 구조를 사용하며 공유 파라미터와 병렬 계산이 가능하게 합니다.
- R-Transformer를 RNN, TCN, Transformer와 여러 데이터셋에서 비교하여 성능 향상을 평가합니다.
실험 결과
연구 질문
- RQ1LocalRNN이 로컬 순차 구조를 효과적으로 인코딩하여 글로벌 어텐션 기반 모델을 향상시킬 수 있는가?
- RQ2위치 임베딩을 제거하면 성능이 저하되는가, 아니면 LocalRNN과 어텐션이 보완할 수 있는가?
- RQ3로컬성 및 장거리 의존성의 균형이 필요한 다양한 작업에서 R-Transformer가 RNN, TCN, Transformer에 비해 어떤 성능를 보이는가?
- RQ4모델의 학습 및 추론이 비순환 아키텍처와 유사하게 병렬화 가능하는가?
주요 결과
| 모델 | # 레이어 / 은닉 크기 | 지표 |
|---|---|---|
| R-Transformer | 8 / 32 | 99.1% on MNIST test accuracy |
| Transformer | 8 / 32 | 98.2% on MNIST test accuracy |
| TCN | 8 / 25 | 99.0% on MNIST test accuracy |
| GRU | - | 96.2% on MNIST test accuracy |
| LSTM | 1 / 130 | 87.2% on MNIST test accuracy |
| RNN | - | 21.5% on MNIST test accuracy |
- R-Transformer는 픽셀 단위 MNIST에서 Transformer 및 TCN보다 더 높은 테스트 정확도를 달성합니다(99.1% 대 Transformer 98.2%, TCN 99.0%).
- polyphonic Nottingham 음악 모델링에서 R-Transformer는 NLL 2.37로 LSTM(3.29), GRU(3.46), TCN(3.07), Transformer(3.34)을 능가합니다.
- Penn Treebank 문자 수준 언어 모델링에서 R-Transformer는 NLL 1.24를 달성하여 Transformer(1.45)보다 낫고 RNN 기반 베이스라인과 비교 가능하거나 더 나은 성능을 보입니다.
- 단어 수준 PTB 언어 모델링에서 R-Transformer의 혼합 perplexity는 84.38로 Transformer(122.37) 및 다른 베이스라인(RNN/GRU/LSTM/TCN)을 능가합니다.
- 전반적으로 R-Transformer는 LocalRNN을 활용하여 지역성을, 다중 헤드 어텐션을 활용하여 장거리 의존성을 활용하면서 TCN 및 Transformer를 꾸준히 상회합니다.
- 모델은 시퀀스 위치에 대한 완전한 병렬화를 가능하게 설계되었으며 위치 임베딩에 의존하지 않습니다.
더 나은 연구,지금 바로 시작하세요
연구 설계부터 논문 작성까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.