Skip to main content
QUICK REVIEW

[논문 리뷰] LLMCad: Fast and Scalable On-device Large Language Model Inference

Daliang Xu, Wangsong Yin|arXiv (Cornell University)|2023. 09. 08.
Topic ModelingComputer Science인용 수 13
한 줄 요약

LLMCad는 메모리에 상주하는 작은 LLM을 사용해 후보 토큰을 생성하고 더 큰, 정확한 LLM이 이를 검증하고 수정하여 IoT devices에서 토큰 생성이 최대 9.3x 빠르고 스마트폰에서 3.5–4.7x 빠르게 수행되며 정확도는 손실되지 않는다.

ABSTRACT

Generative tasks, such as text generation and question answering, hold a crucial position in the realm of mobile applications. Due to their sensitivity to privacy concerns, there is a growing demand for their execution directly on mobile devices. Currently, the execution of these generative tasks heavily depends on Large Language Models (LLMs). Nevertheless, the limited memory capacity of these devices presents a formidable challenge to the scalability of such models. In our research, we introduce LLMCad, an innovative on-device inference engine specifically designed for efficient generative Natural Language Processing (NLP) tasks. The core idea behind LLMCad revolves around model collaboration: a compact LLM, residing in memory, takes charge of generating the most straightforward tokens, while a high-precision LLM steps in to validate these tokens and rectify any identified errors. LLMCad incorporates three novel techniques: (1) Instead of generating candidate tokens in a sequential manner, LLMCad employs the smaller LLM to construct a token tree, encompassing a wider range of plausible token pathways. Subsequently, the larger LLM can efficiently validate all of these pathways simultaneously. (2) It employs a self-adjusting fallback strategy, swiftly initiating the verification process whenever the smaller LLM generates an erroneous token. (3) To ensure a continuous flow of token generation, LLMCad speculatively generates tokens during the verification process by implementing a compute-IO pipeline. Through an extensive series of experiments, LLMCad showcases an impressive token generation speed, achieving rates up to 9.3x faster than existing inference engines.

연구 동기 및 목표

  • 모바일 기기에서 LLM의 온-디바이스 확장 법칙을 저해하는 메모리 병목 문제를 해결한다.
  • 프라이버시를 보호하는 온-디바이스 추론으로 실시간 생성형 NLP 작업(예: 텍스트 생성, 질의응답)을 가능하게 한다.
  • 기기 메모리 한계 내에서 속도를 높이면서 정확도를 유지하기 위한 모델 협업 기술을 제안한다.

제안 방법

  • 메모리에 상주하는 작은 LLM을 토큰 생성기로 사용해 다중 그럴듯한 연속의 토큰 트리를 구축한다.
  • 더 크고 정밀한 LLM을 비-autoregressive 검증기로 활용해 한 번에 모든 가지를 검증한다.
  • 신뢰도 기반 가지 페이싱 메커니즘을 도입해 가지 간 컴퓨트 자원을 할당한다(최대-최소 형평성).
  • 다중 가지 토큰 생성을 가능하게 하면서 자동회귀 마스킹을 보존하는 트리 디코더를 구현한다.
  • 배치로 토큰 트리를 검증하기 위해 비자 autoregressive 검증(NAV)을 적용하여 더 빠른 오류 탐지와 롤백을 가능하게 한다.
  • 트리 누적 신뢰도와 자동 적응 임계치를 이용한 자기적응형 폴백 전략을 통합해 검증 트리거를 조정한다.
  • 메모리 캡을 인지하는 compute-IO 파이프라인 내에서 생성과 검증을 중첩시키는 추측적 생성 파이프라인을 도입한다.
(a) Emergent abilities across various LLMs.
(a) Emergent abilities across various LLMs.

실험 결과

연구 질문

  • RQ1온-디바이스 LLM 추론이 생성 품질을 유지하면서 메모리 벽을 어떻게 극복할 수 있는가?
  • RQ2생성-검증 모델 협업이 자원 제약 기기에서 높은 속도와 정확도를 모두 달성할 수 있는가?
  • RQ3토큰 트리 생성 프레임워크에서 어떤 메커니즘이 검증을 가장 잘 트리거하고 낭비되는 계산을 최소화할 수 있는가?
  • RQ4추측적 생성과 IO/컴퓨트 파이프라이닝이 출력 손상 없이 활용도를 어떻게 개선할 수 있는가?

주요 결과

  • LLMCad는 State-of-the-art 기준에 비해 IoT devices에서 토큰당 평균 생성 시간을 2.9–9.3x, 스마트폰에서 3.5–4.7x 줄인다.
  • 10B 이상 LLMs(예: LLaMA2-13B)에 대해 LLMCad는 모바일 기기에서 매 초당 한 토큰 이상 생성할 수 있다.
  • LLMCad는 여러 모델과 데이터셋에서 속도 면에서 경쟁적 기준선보다 우수하면서 정확도도 유지한다.
  • 토큰 트리 생성과 비자 autoregressive 검증은 자동회귀 검증보다 병렬 검증과 더 빠른 오류 탐지를 가능하게 한다.
  • 트리 누적 신뢰도를 이용한 자기적응형 폴백은 검증 결정 타이밍을 개선하고 불필요한 확인을 줄인다.
  • 메모리-IO 인지 파이프라인에서 생성과 검증을 중첩시켜 검증 대기 시간을 숨긴다.
(b) Generation latency of LLMs across various devices.
(b) Generation latency of LLMs across various devices.

이 논문 읽기

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

누빈트에서 이 논문 읽기

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