Skip to main content
QUICK REVIEW

[논문 리뷰] Dynamic Context Pruning for Efficient and Interpretable Autoregressive Transformers

Sotiris Anagnostidis, Dario Pavllo|arXiv (Cornell University)|2023. 05. 25.
Topic ModelingComputer Science인용 수 8
한 줄 요약

논문은 적응적으로 희소한 주의를 도입하여 디코더-전용 트랜스포머에서 과거 맥락을 동적으로 제거하고, 최소한의 퍼플렉시티 손실로 최대 80%의 맥락 제거와 최대 2배의 추론 처리량 증가를 가능하게 한다.

ABSTRACT

Autoregressive Transformers adopted in Large Language Models (LLMs) are hard to scale to long sequences. Despite several works trying to reduce their computational cost, most of LLMs still adopt attention layers between all pairs of tokens in the sequence, thus incurring a quadratic cost. In this study, we present a novel approach that dynamically prunes contextual information while preserving the model's expressiveness, resulting in reduced memory and computational requirements during inference. Our method employs a learnable mechanism that determines which uninformative tokens can be dropped from the context at any point across the generation process. By doing so, our approach not only addresses performance concerns but also enhances interpretability, providing valuable insight into the model's decision-making process. Our technique can be applied to existing pre-trained models through a straightforward fine-tuning process, and the pruning strength can be specified by a sparsity parameter. Notably, our empirical findings demonstrate that we can effectively prune up to 80\% of the context without significant performance degradation on downstream tasks, offering a valuable tool for mitigating inference costs. Our reference implementation achieves up to $2 imes$ increase in inference throughput and even greater memory savings.

연구 동기 및 목표

  • 표현력을 손실하지 않으면서 장맥락 자기회귀 트랜스포머의 메모리 및 컴퓨트 병목을 완화하도록 동기를 부여한다.
  • 생성 중 비정보적 과거 토큰을 가지치기하는 학습 가능한 계층별 메커니즘을 제안한다.
  • 경량 미세조정과 희소성 제어 메커니즘을 통해 사전학습된 모델과의 통합을 가능하게 한다.
  • GPT-2 변형들 간의 희소성, 퍼플렉시티, 제로샷 성능 간의 트레이드오프를 정량화한다.

제안 방법

  • W_Q_int 및 W_K_int를 통해 각 층별로 상호작용 쿼리/키를 포함한 적응적으로 희소한 주의를 도입한다.
  • 인과성을 보장하며 자르는 결정을 내리기 위해 희소 시그모이드(alpha-sigmoid)를 사용하여 토큰별 상호작용 지시자 I_{k,j}^l를 계산한다.
  • 삭제된 토큰이 이후 단계에서 영구적으로 무시되는 계층별 가지치기 스킴을 사용한다.
  • 드롭을 장려하기 위해 희소성 정규화항 L_sparsity를 언어 모델링 목적에 보강한다.
  • 메모리 및 처리량 이점을 가능하게 하는, 드롭된 토큰을 키-값 캐시에서 제거하는 효율적인 배치 데이터 구조를 구현한다.
  • 제안된 메커니즘과 추론 시 희소성을 제어하기 위한 알파의 코사인 스케줄을 사용하여 사전학습된 GPT-2 모델을 미세조정한다.
Figure 1: Visualization of the causal attention weights associated with standard, local, sparse causal attention, and our approach. Adaptively sparse attention (rightmost) prunes weights dynamically for each token, and it does not impose any restricting inductive biases on the final attention struct
Figure 1: Visualization of the causal attention weights associated with standard, local, sparse causal attention, and our approach. Adaptively sparse attention (rightmost) prunes weights dynamically for each token, and it does not impose any restricting inductive biases on the final attention struct

실험 결과

연구 질문

  • RQ1동적 계층별 가지치기가 자기회로 생성 중 맥락 길이를 줄이면서도 모델의 표현력을 유지할 수 있는가?
  • RQ2GPT-2 변형들에 걸친 적응적 희소성이 퍼플렉시티와 제로샷 성능에 미치는 영향은 무엇인가?
  • RQ3적응적 가지치기 하에서 맥락 크기가 커질 때 메모리 사용량과 처리량은 어떻게 변하는가?
  • RQ4계층별 및 토큰 유형(예: 구두점, 불용어) 간의 토큰 드롭 결정은 얼마나 해석 가능합니까?

주요 결과

  • 특정 맥락 크기에 대해 퍼플렉시티의 성능 저하 없이 최대 80%의 맥락을 가지치기할 수 있다.
  • 적응형 가지치기는 메모리 감소를 크게 가져오고 긴 맥락에서 벽 시간(latency)을 최대 50% 감소시켜 더 큰 배치 크기를 가능하게 한다.
  • 일부 설정에서 처리량이 2배 이상 증가하고 상당한 메모리 절감이 있다.
  • 여러 작업에서 희소성 하에 제로샷 성능이 보존되거나 개선된다.
  • 가지치기는 구두점과 불용어를 제거하는 경향이 있어 계층별 결정 패턴에 대한 해석 가능성을 제공한다.
Figure 2: We illustrate the state of the memory buffer at the start at each iteration for our proposed approach. Dropped tokens are irrelevant for any subsequent generation step and their cached activations are erased. Since self-attention is a set operation, the buffer (keys/values) of the dropped
Figure 2: We illustrate the state of the memory buffer at the start at each iteration for our proposed approach. Dropped tokens are irrelevant for any subsequent generation step and their cached activations are erased. Since self-attention is a set operation, the buffer (keys/values) of the dropped

이 논문 읽기

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

누빈트에서 이 논문 읽기

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