Skip to main content
QUICK REVIEW

[논문 리뷰] Transformers Can Achieve Length Generalization But Not Robustly

Yongchao Zhou, Uri Alon|arXiv (Cornell University)|2024. 02. 14.
Neural Networks and ApplicationsComputer Science인용 수 3
한 줄 요약

이 논문은 특정 조합의 FIRE 위치 인코딩, 뒤집힌 데이터 포맷, 인덱스 힌트를 사용함으로써, Transformer 모델이 훈련 시 본 것보다 2.5배 길이가 긴 시퀀스까지 길이 일반화를 달성할 수 있음을 보여준다. 그러나 이러한 성공은 무작위 가중치 초기화 및 훈련 데이터 순서에 매우 민감하여, 강력한 외삽 성능에도 불구하고 내구성은 여전히 핵심 과제로 남아 있다.

ABSTRACT

Length generalization, defined as the ability to extrapolate from shorter training sequences to longer test ones, is a significant challenge for language models. This issue persists even with large-scale Transformers handling relatively straightforward tasks. In this paper, we test the Transformer's ability of length generalization using the task of addition of two integers. We show that the success of length generalization is intricately linked to the data format and the type of position encoding. Using the right combination of data format and position encodings, we show for the first time that standard Transformers can extrapolate to a sequence length that is 2.5x the input length. Nevertheless, unlike in-distribution generalization, length generalization remains fragile, significantly influenced by factors like random weight initialization and training data order, leading to large variances across different random seeds.

연구 동기 및 목표

  • Transformer 모델이 알고리즘적 추론 작업에서 안정적인 길이 일반화를 달성할 수 있는지 조사하기.
  • 위치 인코딩과 데이터 포맷이 길이 일반화 성능에 미치는 영향 평가하기.
  • 아키텍처 설계 자체만으로 길이 일반화가 가능한지 여부를 판단하기.
  • 무작위 시드와 데이터 순서와 같은 다양한 훈련 조건 하에서 길이 일반화의 내구성 평가하기.

제안 방법

  • 연구는 Transformer의 길이 일반화 성능을 평가하기 위해 N자리 십진수 덧셈이라는 합성 작업을 사용한다.
  • 훈련 길이를 초월한 시퀀스 모델링을 향상시키기 위해 무작위 위치를 가진 FIRE 위치 인코딩을 적용한다.
  • 모델이 위치 의존성을 더 잘 학습할 수 있도록 데이터는 뒤집힌 순서로 포맷되고 인덱스 힌트가 포함된다.
  • 다양한 위치 인코딩과 데이터 포맷 조합을 여러 무작위 시드와 훈련 데이터 순서에서 비교하는 실험을 수행한다.
  • 모델 성능은 훈련 시 40자리 이내의 시퀀스로만 훈련된 상태에서 최대 100자리의 테스트 시퀀스에서 평가된다.
  • 정규화 계수와 드롭아웃 등의 하이퍼파라미터를 체계적으로 변화시켜 일반화 내구성에 미치는 영향을 분석한다.
Figure 1 : Using an appropriate position encoding and data formatting, we demonstrate that Transformers can generalize to 100-digit decimal addition tasks with more than 98% of accuracy when trained up to 40-digit addition, resulting in a length extension ratio of $2.5\times$ , which is much more th
Figure 1 : Using an appropriate position encoding and data formatting, we demonstrate that Transformers can generalize to 100-digit decimal addition tasks with more than 98% of accuracy when trained up to 40-digit addition, resulting in a length extension ratio of $2.5\times$ , which is much more th

실험 결과

연구 질문

  • RQ1최적의 데이터 포맷과 위치 인코딩을 사용할 경우, Transformer는 훈련 시 본 길이보다 훨씬 긴 시퀀스 길이로 일반화할 수 있는가?
  • RQ2다양한 위치 인코딩 방식이 데이터 포맷과 어떻게 상호작용하여 길이 일반화에 영향을 미치는가?
  • RQ3무작위 가중치 초기화 및 훈련 데이터 순서의 변동에 대해 길이 일반화가 어느 정도 내구성이 있는가?
  • RQ4정규화 기법(예: 정규화 계수 또는 드롭아웃)이 길이 일반화의 내구성 향상에 기여하는가?
  • RQ5특정 데이터 포맷과 위치 인코딩 조합이 다른 조합이 실패할 때 강력한 길이 일반화를 가능하게 하는 시너지 효과를 가질 수 있는가?

주요 결과

  • Transformer는 십진수 덧셈 작업에서 40자리에서 100자리 시퀀스로의 2.5배 길이 일반화를 달성하며, 98% 이상의 정확도를 기록한다.
  • 길이 일반화의 성공은 FIRE 위치 인코딩(무작위 위치 포함)과 뒤집힌 데이터 포맷에 함께 인덱스 힌트를 사용하는 조합에 매우 의존한다.
  • 강력한 일반화 성능에도 불구하고, 모델의 정확도는 무작위 시드에 따라 크게 변동하여 가중치 초기화에 매우 민감함을 시사한다.
  • 훈련 데이터 순서 역시 상당한 영향을 미치며, 예시가 제시되는 순서에 따라 성능이 크게 달라진다.
  • 정규화 기법(예: 정규화 계수 또는 드롭아웃)은 내구성 향상에 크게 기여하지 않으며, 높은 드롭아웃 비율(예: 0.2)은 일반화 성능을 심각하게 떨어뜨린다.
  • 결과적으로, 적절한 설계를 통해 길이 일반화가 가능하긴 하나, 표준 훈련 조건에서는 여전히 취약하고 신뢰할 수 없다는 점을 보여준다.
Figure 2 : Comparative overview of PEs and data formats: While most related studies focus on APE or NoPE, our approach integrates FIRE (Li et al., 2023 ) and Randomized PE (Ruoss et al., 2023 ) . All studies utilize a reversed format. Shen et al. ( 2023 ) enhance this with random space augmentation,
Figure 2 : Comparative overview of PEs and data formats: While most related studies focus on APE or NoPE, our approach integrates FIRE (Li et al., 2023 ) and Randomized PE (Ruoss et al., 2023 ) . All studies utilize a reversed format. Shen et al. ( 2023 ) enhance this with random space augmentation,

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.