Skip to main content
QUICK REVIEW

[논문 리뷰] Fast Inference from Transformers via Speculative Decoding

Yaniv Leviathan, Matan Kalman|arXiv (Cornell University)|2022. 11. 30.
Parallel Computing and Optimization TechniquesComputer Science인용 수 34
한 줄 요약

이 논문은 추정 샘플링으로 추정 디코딩을 도입하여, 더 작은 근사 모델을 병행 실행하고 그 출력을 재사용하되 대상 모델의 출력 분포를 보존하여 자 autoregressive Transformer 추론을 가속합니다. retraining 없이 T5-XXL에서 2배에서 3배의 walltime 속도를 달성합니다.

ABSTRACT

Inference from large autoregressive models like Transformers is slow - decoding K tokens takes K serial runs of the model. In this work we introduce speculative decoding - an algorithm to sample from autoregressive models faster without any changes to the outputs, by computing several tokens in parallel. At the heart of our approach lie the observations that (1) hard language-modeling tasks often include easier subtasks that can be approximated well by more efficient models, and (2) using speculative execution and a novel sampling method, we can make exact decoding from the large models faster, by running them in parallel on the outputs of the approximation models, potentially generating several tokens concurrently, and without changing the distribution. Our method can accelerate existing off-the-shelf models without retraining or architecture changes. We demonstrate it on T5-XXL and show a 2X-3X acceleration compared to the standard T5X implementation, with identical outputs.

연구 동기 및 목표

  • 크게 차지하는 시퀀셜 디코딩으로 느린 대형 자동회귀 Transformer의 추론을 더 빠르게 만드는 것을 동기부여한다.
  • 대상 모델과 병렬로 근사 모델을 실행하여 speculative tokens를 생성하는 방법을 제안한다.
  • retraining이나 아키텍처 변경 없이 최종 출력이 대상 모델의 분포와 일치하도록 보장한다.
  • 실제 모델들에 대한 이론적 가이드와 실험적 근거를 제공하여 실제 모델들에서의 속도 향상을 보여준다.

제안 방법

  • 같은 작업에 대해 대상 모델 Mp와 더 작은 근사 모델 Mq를 정의한다.
  • Mq에서 gamma 후보 토큰을 생성하고 Mp와 병렬로 평가하여 Mp의 분포를 보존하는 speculative sampling을 사용한다.
  • 최종 출력 분포가 Mp와 동일하게 유지되도록 샘플링 보정을 사용하며, 단계당 gamma+1 토큰까지 방출할 수 있다.
  • Mq의 수락 확률 alpha와 비용 계수 c에 따른 alpha 측정값 하에서 속도향상을 분석하고 최적의 gamma를 도출한다.
  • alpha, gamma, 하드웨어 비용 c에 의존하는 기대 생성 토큰 수와 walltime 개선을 나타내는 수식을 제시하고 속도 향상이 실현되는 시점을 식으로 식별한다.
  • 번역, 요약, 대화 등의 작업에서 실증적으로 검증하고 T5-XXL에서 T5X 기준선과 비교한다.

실험 결과

연구 질문

  • RQ1출력을 변경하지 않고 대형 Transformer 모델의 추론을 speculative decoding으로 얼마나 가속할 수 있는가?
  • RQ2근사 품질(alpha)와 속도향상 간의 관계는 무엇이며 gamma는 어떻게 선택해야 하는가?
  • RQ3다른 근사 모델과 샘플링 설정에서 walltime 및 계산 자원 간의 트레이드오프는 어떻게 나타나는가?

주요 결과

  • 실험적으로 T5-XXL에서 T5X와 비교하여 동일한 출력에서 2x에서 3x의 walltime 속도향상을 달성한다.
  • 속도향상은 수락 비율 alpha와 상관관계가 있으며, 높은 품질의 근사(alpha가 큰 경우)에서 적절한 gamma에서 더 큰 이익을 얻는다.
  • 무비용에 가까운 근사(예: unigram/bigram)도 측정 가능한 속도향상을 제공하지만 더 큰 근사 모델보다 작다.
  • 실험적 분석은 기대 생성 토큰 수와 walltime 개선에 대한 수식을 제공하며, alpha와 하드웨어 비용 c를 고려한 gamma 선택을 안내한다.

이 논문 읽기

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

누빈트에서 이 논문 읽기

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