[論文レビュー] LLMCad: Fast and Scalable On-device Large Language Model Inference
LLMCadは、メモリ内に常駐する小型LLMを用いて候補トークンを生成し、より大きく正確なLLMがそれを検証・修正する、端末上での推論エンジンです。これにより、IoTデバイスで最大9.3倍、スマートフォンで3.5–4.7倍のトークン生成速度を実現しつつ、精度を犠牲にしません。
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のオンデバイススケーリング法則を阻害するメモリのボトルネックに対処する。
- プライバシー保護を実現するオンデバイス推論で、テキスト生成やQAなどのリアルタイムな生成型NLPタスクを可能にする。
- デバイスのメモリ制限内で精度を維持しつつ速度を向上させるためのモデル協調技術を提案する。
提案手法
- メモリ内に常駐する小型LLMをトークン生成器として用い、複数のもっともらしい継続のトークンツリーを構築する。
- より大きく高精度のLLMを非自己回帰型検証器として用い、すべての分岐を一度に検証する。
- 信頼度ベースの分岐ペースメカニズムを導入し、分岐間で計算資源を割り当てる(最大-最小の公平性)。
- 自己回帰マスキングを保持しつつ複数分岐のトークン生成を可能にするツリーDecoderを実装する。
- 非自己回帰検証(NAV)を適用してトークンツリーをバッチ検証し、エラー検出とロールバックを高速化する。
- 木構造の累積信頼度と自己適応閾値を用いた自己適応型フォールバック戦略を組み込み、検証を発動させる。
- メモリ容量を意識した計算-IOパイプライン内で、推定生成パイプラインによる推定生成と検証を重ね合わせる。

実験結果
リサーチクエスチョン
- RQ1オンデバイスのLLM推論は、生成品質を維持しつつどのようにメモリ壁を克服できるか。
- RQ2リソース制約のあるデバイスで、生成→検証モデルの協調が高速度と高精度の両方を達成できるか。
- RQ3トークンツリー生成フレームワークで、検証を最も適切に発動させ、無駄な計算を最小化する仕組みは何か。
- RQ4推定生成とIO/計算パイプラインを組み合わせて、出力を損なうことなく利用率を向上させるにはどうすればよいか。
主な発見
- LLMCadは、IoTデバイスで平均トークン生成時間を2.9–9.3x、スマートフォンで3.5–4.7x短縮し、最先端のベースラインと比較している。
- >10B規模のLLM(例:LLaMA2-13B)の場合、LLMCadはモバイルデバイス上で1秒以上に1トークンを生成できる。
- LLMCadは速度で競合ベースラインを上回しつつ精度を維持する。
- トークンツリー生成と非自己回帰検証は、自己回帰検証より並列検証と迅速なエラー検出を可能にする。
- 木構造累積信頼度を用いた自己適応フォールバックは、検証の意思決定タイミングを改善し、不要な検証を減らす。
- メモリ-IO awareパイプラインで、推定生成と検証を重ねることで検証待ちの遅延を隠す。

この論文を読む
Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。
Nubintでこの論文を読むこのレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。