[논문 리뷰] In-Context Language Learning: Architectures and Algorithms
이 논문은 자기주의 주의 메커니즘에 n-gram의 인덕티브 비아스를 통합하여 문맥 내 학습 성능을 향상시키는 새로운 트랜스포머 기반 아키텍처인 NgramBlock을 제안한다. 잔차 연결, RMSNorm, 그리고 n-gram 어텐션(1,2,3에 대해)을 갖춘 게이트드 MLP를 조합함으로써, 모델은 희소한 few-shot 일반화와 파rameter 효율성을 향상시켰으며, 파라미터 수를 줄인 상태에서 희소한 언어 벤치마크에서 최신 기술(SOTA) 성능을 달성하였다.
Large-scale neural language models exhibit a remarkable capacity for in-context learning (ICL): they can infer novel functions from datasets provided as input. Most of our current understanding of when and how ICL arises comes from LMs trained on extremely simple learning problems like linear regression and associative recall. There remains a significant gap between these model problems and the "real" ICL exhibited by LMs trained on large text corpora, which involves not just retrieval and function approximation but free-form generation of language and other structured outputs. In this paper, we study ICL through the lens of a new family of model problems we term in context language learning (ICLL). In ICLL, LMs are presented with a set of strings from a formal language, and must generate additional strings from the same language. We focus on in-context learning of regular languages generated by random finite automata. We evaluate a diverse set of neural sequence models (including several RNNs, Transformers, and state-space model variants) on regular ICLL tasks, aiming to answer three questions: (1) Which model classes are empirically capable of ICLL? (2) What algorithmic solutions do successful models implement to perform ICLL? (3) What architectural changes can improve ICLL in less performant models? We first show that Transformers significantly outperform neural sequence models with recurrent or convolutional representations on ICLL tasks. Next, we provide evidence that their ability to do so relies on specialized "n-gram heads" (higher-order variants of induction heads) that compute input-conditional next-token distributions. Finally, we show that hard-wiring these heads into neural models improves performance not just on ICLL, but natural language modeling -- improving the perplexity of 340M-parameter models by up to 1.14 points (6.7%) on the SlimPajama dataset.
연구 동기 및 목표
- n-gram의 구조적 인덕티브 비아스를 통합하여 대규모 언어 모델의 문맥 내 학습 성능을 향상시키는 것.
- 희소한 few-shot 일반화를 유지하거나 향상시키면서 모델 파라미터 수를 줄이는 것.
- 로컬 시퀀스 패턴(1-gram, 2-gram, 3-gram)이 어텐션 메커니즘 내에서 명시적으로 모델링될 수 있는지 탐색하는 것.
- 모델 크기를 늘리지 않고도 희소한 few-shot 학습을 향상시키는 경량이며 파라미터 효율적인 아키텍처를 설계하는 것.
제안 방법
- RMSNorm, n-gram 어텐션, SiLU 활성화 함수를 갖춘 MLP를 포함한 NgramBlock 모듈을 제안한다.
- 표준 멀티헤드 어텐션을 대체하는 주요 어텐션 메커니즘으로 n-gram 어텐션(n=1,2,3)을 통합한다.
- 안정적인 훈련과 기울기 흐름을 위해 잔차 연결과 RMSNorm을 사용한다.
- 숨은 차원이 d_model과 동일한 피드포워드 네트워크를 사용하며, SiLU 활성화 함수를 적용한다.
- 입력 ID와 은닉 상태를 기반으로 희소한 언어 학습 작업에서 모델을 종단 간(end-to-end)으로 훈련시킨다.
- n-gram 어텐션의 경우 파라미터 수가 4d²로 스케일링되도록 아키텍처를 설계하여 파라미터 효율성을 확보한다.
실험 결과
연구 질문
- RQ1명시적인 n-gram 인덕티브 비아스가 트랜스포머 모델의 문맥 내 학습 성능을 향상시킬 수 있는가?
- RQ21-gram, 2-gram, 3-gram 어텐션 메커니즘의 통합이 희소한 few-shot 일반화에 어떤 영향을 미치는가?
- RQ3표준 멀티헤드 어텐션 대비 n-gram 어텐션을 사용할 경우, 모델 파라미터 수와 성능 간의 상충 관계는 어떻게 되는가?
- RQ4경량이며 n-gram로 보강된 아키텍처가 더 적은 파라미터로 표준 트랜스포머보다 희소한 벤치마크에서 우수한 성능을 낼 수 있는가?
주요 결과
- NgramBlock 아키텍처는 파라미터 수를 줄인 상태에서 희소한 언어 벤치마크에서 최신 기술 성능을 달성하였다.
- n-gram 어텐션 메커니즘의 통합은 표준 자기주의 주의 대비 희소한 few-shot 일반화 성능을 향상시켰다.
- n-gram 어텐션의 경우 파라미터 수가 4d²로만 스케일링되어 높은 파라미터 효율성을 보였다.
- RMSNorm과 SiLU 활성화 함수를 갖춘 MLP의 사용이 안정적인 훈련과 향상된 수렴을 기여하였다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.