ChatPaper.aiChatPaper

メモリ制約下での効率的な大規模言語モデル推論:LLM in a flash

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に転送する手法を提案します。我々の手法は、フラッシュメモリの動作特性と調和する推論コストモデルを構築し、以下の2つの重要な領域を最適化することを指針としています:フラッシュメモリからのデータ転送量を削減すること、およびより大きく連続したデータチャンクを読み取ることです。このフラッシュメモリを考慮したフレームワーク内で、2つの主要な技術を導入します。まず、「ウィンドウ化」は、以前に活性化されたニューロンを再利用することでデータ転送を戦略的に削減します。次に、「行-列バンドリング」は、フラッシュメモリのシーケンシャルデータアクセスの強みを活かし、フラッシュメモリから読み取るデータチャンクのサイズを増大させます。これらの手法を組み合わせることで、利用可能なDRAMの2倍のサイズのモデルを実行可能にし、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