ChatPaper.aiChatPaper

플래시 속의 LLM: 제한된 메모리에서의 효율적인 대형 언어 모델 추론

LLM in a flash: Efficient Large Language Model Inference with Limited Memory

December 12, 2023
저자: Keivan Alizadeh, Iman Mirzadeh, Dmitry Belenko, Karen Khatamifard, Minsik Cho, Carlo C Del Mundo, Mohammad Rastegari, Mehrdad Farajtabar
cs.AI

초록

대형 언어 모델(LLM)은 현대 자연어 처리의 핵심으로, 다양한 작업에서 뛰어난 성능을 제공합니다. 그러나 이들의 높은 계산 및 메모리 요구 사항은 특히 DRAM 용량이 제한된 장치에서 문제를 야기합니다. 본 논문은 사용 가능한 DRAM 용량을 초과하는 LLM을 플래시 메모리에 모델 파라미터를 저장하고 필요 시 DRAM으로 불러오는 방식으로 효율적으로 실행하는 문제를 다룹니다. 우리의 방법은 플래시 메모리 동작과 조화를 이루는 추론 비용 모델을 구축하여 두 가지 주요 영역에서 최적화를 유도합니다: 플래시 메모리에서 전송되는 데이터 양을 줄이고, 더 크고 연속적인 데이터 청크를 읽는 것입니다. 이 플래시 메모리 기반 프레임워크 내에서 우리는 두 가지 주요 기술을 소개합니다. 첫째, "윈도잉"은 이전에 활성화된 뉴런을 재사용하여 데이터 전송을 전략적으로 줄이고, 둘째, 플래시 메모리의 순차적 데이터 접근 강점에 맞춘 "행-열 번들링"은 플래시 메모리에서 읽는 데이터 청크의 크기를 증가시킵니다. 이러한 방법들은 사용 가능한 DRAM 크기의 최대 두 배에 달하는 모델을 실행할 수 있게 하며, CPU와 GPU에서 각각 단순 로딩 방식에 비해 4-5배 및 20-25배의 추론 속도 향상을 달성합니다. 희소성 인식, 상황 적응형 로딩, 하드웨어 지향 설계의 통합은 제한된 메모리를 가진 장치에서 LLM의 효과적인 추론을 위한 길을 열어줍니다.
English
Large language models (LLMs) are central to modern natural language processing, delivering exceptional performance in various tasks. However, their intensive computational and memory requirements present challenges, especially for devices with limited DRAM capacity. This paper tackles the challenge of efficiently running LLMs that exceed the available DRAM capacity by storing the model parameters on flash memory but bringing them on demand to DRAM. Our method involves constructing an inference cost model that harmonizes with the flash memory behavior, guiding us to optimize in two critical areas: reducing the volume of data transferred from flash and reading data in larger, more contiguous chunks. Within this flash memory-informed framework, we introduce two principal techniques. First, "windowing'" strategically reduces data transfer by reusing previously activated neurons, and second, "row-column bundling", tailored to the sequential data access strengths of flash memory, increases the size of data chunks read from flash memory. These methods collectively enable running models up to twice the size of the available DRAM, with a 4-5x and 20-25x increase in inference speed compared to naive loading approaches in CPU and GPU, respectively. Our integration of sparsity awareness, context-adaptive loading, and a hardware-oriented design paves the way for effective inference of LLMs on devices with limited memory.
PDF2578December 15, 2024