Skip to main content
QUICK REVIEW

[논문 리뷰] Teaching Arithmetic to Small Transformers

Nayoung Lee, Kartik K. Sreenivasan|arXiv (Cornell University)|2023. 07. 07.
Topic ModelingComputer Science인용 수 8
한 줄 요약

본 논문은 소형 디코더-전용 Transformer가 정교하게 형식화된 데이터를 사용해 처음부터 산술을 학습할 수 있으며, output-reversal과 chain-of-thought 스크래치패드가 표본 효율성 및 일반화를 표준 행렬 완성의 직관을 넘어 크게 향상시킨다는 것을 보여준다.

ABSTRACT

Large language models like GPT-4 exhibit emergent capabilities across general-purpose tasks, such as basic arithmetic, when trained on extensive text data, even though these tasks are not explicitly encoded by the unsupervised, next-token prediction objective. This study investigates how small transformers, trained from random initialization, can efficiently learn arithmetic operations such as addition, multiplication, and elementary functions like square root, using the next-token prediction objective. We first demonstrate that conventional training data is not the most effective for arithmetic learning, and simple formatting changes can significantly improve accuracy. This leads to sharp phase transitions as a function of training data scale, which, in some cases, can be explained through connections to low-rank matrix completion. Building on prior work, we then train on chain-of-thought style data that includes intermediate step results. Even in the complete absence of pretraining, this approach significantly and simultaneously improves accuracy, sample complexity, and convergence speed. We also study the interplay between arithmetic and text data during training and examine the effects of few-shot prompting, pretraining, and model scale. Additionally, we discuss length generalization challenges. Our work highlights the importance of high-quality, instructive data that considers the particular characteristics of the next-word prediction objective for rapidly eliciting arithmetic capabilities.

연구 동기 및 목표

  • 무작위 초기화로 학습된 소형 Transformer가 산술 연산을 학습할 수 있는지 조사한다.
  • 다음 토큰 예측 하에서 데이터 형식과 샘플링이 산술 학습에 미치는 영향을 평가한다.
  • 산술 과제 학습에서 chain-of-thought(CoT) 데이터의 역할을 탐구한다.
  • 사전 학습, 모델 규모 및 텍스트/산술 데이터의 혼합이 산술 학습과 일반화에 미치는 영향을 분석한다.
  • 산술 학습의 길이 일반화 및 매핑으로서의 학습과 알고리즘으로서의 한계를 분석한다.

제안 방법

  • 무작위 초기화에서 산술 작업에 대해 NanoGPT(6 layers, 384 hidden, ~10.6M parameters)를 학습시킨다.
  • 덧셈에 대한 네 가지 데이터 형식 평가: Plain, Reverse, Simplified Scratchpad, Detailed Scratchpad.
  • n자리 입력에서 숫자와 올림수를 균형 있게 분포시키기 위해 구조화된 샘플링을 사용한다.
  • 학습을 저랭크 행렬 완성과 관련시키고 샘플 복잡도에서의 페이즈 전이(상전이)를 분석한다.
  • 학습 속도와 정확도에 미치는 영향을 평가하기 위해 chain-of-thought 스타일 데이터를 사용한 실험을 확장한다.
  • 스케일 및 전이 효과를 연구하기 위해 더 큰 모델에서의 사전 학습/미세 조정 설정과 비교한다.

실험 결과

연구 질문

  • RQ1다음 토큰 예측을 사용하여 소형 Transformer 모델이 처음부터 산술을 학습할 수 있는가?
  • RQ2데이터 형식화 및 샘플링이 산술 학습의 샘플 효율성 및 정확도에 어떤 영향을 미치는가?
  • RQ3특히 처음부터, chain-of-thought 스타일 데이터가 산술 과제 학습을 더 개선하는가?
  • RQ4산술 능력 습득에서 모델 규모와 사전 학습의 역할은 무엇인가?
  • RQ5학습된 산술 능력이 본 적 없는 숫자나 숫자 조합 및 더 긴 자릿수에 얼마나 잘 일반화되는가?

주요 결과

  • Plain 덧셈 데이터는 비효율적인 성능을 보이며, output-reversal은 정확도를 크게 향상시키고 필요한 학습 데이터를 줄인다.
  • 훈련 데이터가 증가함에 따라 덧셈 학습에서 뚜렷한 상전이가 나타나며, 이는 저랭크 행렬 완성의 직관과 일치한다.
  • NanoGPT가 학습한 덧셈은 표준 LRMC 한계를 넘어 보지 않은 숫자와 부분적으로 누락된 숫자 세트에 일반화될 수 있어 단순한 행렬 완성 이상의 능력을 나타낸다.
  • chain-of-thought 데이터는 처음부터라도 덧셈 학습의 샘플 효율성과 정확도를 크게 향상시키며, 중간 단계 세부 수준에 따라 성능이 달라진다.
  • 3자리 덧셈 과제에서 숫자와 올림수의 균형 샘플링이 무작위 샘플링에 비해 성능을 향상시킨다.
  • Transformer 기반 학습은 LRMC와 다르며, 행렬 완성 이외의 추가 일반화 메커니즘이 있음을 시사한다.

이 논문 읽기

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

누빈트에서 이 논문 읽기

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