Skip to main content
QUICK REVIEW

[論文レビュー] LLM as a System Service on Mobile Devices

Wangsong Yin, Mengwei Xu|arXiv (Cornell University)|Mar 18, 2024
Business Process Modeling and Analysis被引用数 5
ひとこと要約

本論文はLLMSを提案する。システムサービス設計で、チャンク単位のKVキャッシュ圧縮とスワッピングによってオンデバイスのLLMコンテキストを管理し、アプリ間で低遅延・永続的なLLMサービスを実現する。ベースラインより最大100倍の切替遅延削減を示し、精度低下なく大幅な改善を達成。

ABSTRACT

Being more powerful and intrusive into user-device interactions, LLMs are eager for on-device execution to better preserve user privacy. In this work, we propose a new paradigm of mobile AI: LLM as a system service on mobile devices (LLMaaS). Unlike traditional DNNs that execute in a stateless manner, such a system service is stateful: LLMs execution often needs to maintain persistent states (mainly KV cache) across multiple invocations. To minimize the LLM context switching overhead under tight device memory budget, this work presents LLMS, which decouples the memory management of app and LLM contexts with a key idea of fine-grained, chunk-wise, globally-optimized KV cache compression and swapping. By fully leveraging KV cache's unique characteristics, it proposes three novel techniques: (1) Tolerance-Aware Compression: it compresses chunks based on their measured accuracy tolerance to compression. (2) IO-Recompute Pipelined Loading: it introduces recompute to swapping-in for acceleration. (3) Chunk Lifecycle Management: it optimizes the memory activities of chunks with an ahead-of-time swapping-out and an LCTRU (Least Compression-Tolerable and Recently-Used) queue based eviction. In evaluations conducted on well-established traces and various edge devices, \sys reduces context switching latency by up to 2 orders of magnitude when compared to competitive baseline solutions.

研究の動機と目的

  • プライバシー、可用性、効率性を向上させるために、モバイルデバイス向けにLLMをシステムサービス(LLMaaS)として動機づける。
  • 永続的なLLMコンテキストにおけるメモリのボトルネックと、伝統的なアプリレベルのメモリ管理の不適切さを指摘する。
  • アプリメモリとLLMコンテキストメモリを分離するメモリ管理フレームワークとしてLLMSを導入する。
  • メモリ制約下でのコンテキストスイッチ性能を最大化する新技術を開発する。

提案手法

  • KVキャッシュを固定サイズのチャンク(例:16トークン)に分割し、独立した圧縮とスワッピングを可能にする。
  • 情報密度が低いチャンクにはより高い圧縮を割り当てる許容度認識圧縮を適用する。
  • コンテキスト読込時に再計算とI/Oを重ねるスワッピング再計算パイプラインを導入する。
  • LCTRU排除キューと事前スワッピングを備えたチャンクライフサイクル管理戦略を使用し、解放待機時間を隠す。
  • アプリがLLMCtxコンテキストを保持し、callLLMを通じて相互作用するAndroid-サービス風のAPI設計を提供する。
  • 72時間のトレースを通じてLlama2-7B/OPT-7Bを搭載した市販デバイス上で実証的評価を行い、LMK、ディスクスワッピング、vLLMベースラインと比較する。
(a) The architecture of an LLM. We use Llama2 as an illustrative example. Embedding layer is omitted for simplicity.
(a) The architecture of an LLM. We use Llama2 as an illustrative example. Embedding layer is omitted for simplicity.

実験結果

リサーチクエスチョン

  • RQ1LLMsがシステムサービスとして公開される場合、モバイルデバイス上でLLMコンテキストメモリを効率的に管理するにはどうすればよいか?
  • RQ2チャンク化、圧縮、スケジューリング戦略で、精度を保ちながらコンテキストスイッチング遅延を最小化するには?
  • RQ3スワッピング再計算パイプラインとLCTRUベースの排除ポリシーは、LLMコンテキストの従来のアプリレベルのメモリ管理を上回ることができるか?
  • RQ4実デバイスのトレースと一般的なLLMに対して、LLMSのベースライン比較での性能向上はどの程度か?

主な発見

  • LLMSは従来のアプリレベルのメモリ管理およびディスクスワッピングベースラインと比較して、LLMコンテキストスイッチ遅延を最大100倍(2桁のオーダー)削減する。
  • 最先端のvLLM(静的8ビット量子化)と比較して、LLMSは最大20xの切替遅延削減を達成し、平均で9.7x。
  • LLMSのチャンク単位の許容度認識圧縮を用いた場合、6つのデータセットで精度の損失は観察されない。
  • LLMSはJetson Orin NX、Jetson TX2、MI14スマートフォン上でLlama2-7BおよびOPT-7Bを用いた実用的なオンデバイスLLMaaSの実現性を示す。
  • 本手法はKVキャッシュの固有特性(チャンク単位の構造、圧縮性、再計算性)を活用してコンテキスト管理を最適化する。
(b) The autoregressive inference with KV cache.
(b) The autoregressive inference with KV cache.

より良い研究を、今すぐ始めましょう

論文設計から論文執筆まで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。