# FlashDecoding++
## 概要
FlashDecoding++ は、FlashAttention・FlashDecoding に続く LLM 推論エンジンの最適化手法であり、3 つの技術で構成される。(1) softmax 計算のスケーリング係数を動的最大値ではなく事前の統計に基づき決定することで同期オーバーヘッドを排除する「非同期 softmax」。(2) デコーディング時に次元が極端に縮小する GEMM ワークロード(次元サイズ 8 未満)を FlatGEMM として定式化し、fine-grained タイリングとダブルバッファリングで並列度とメモリアクセス遅延を改善する。(3) 入力サイズに応じて FastGEMV・FlatGEMM・cuBLAS GEMM から動的に選択するヒューリスティック機構。(Source: [[@2024__arXiv__A Survey on Efficient Inference for Large Language Models - Chapter 6.0 System-level Optimization - Inference Engine]] §6.1.1)
これらとカーネル融合(1 つの Transformer ブロックを 7 個の融合カーネルへ集約)を組み合わせることで、HuggingFace 実装比で最大 4.86 倍の高速化を達成する。(Source: [[@2024__arXiv__A Survey on Efficient Inference for Large Language Models - Chapter 6.0 System-level Optimization - Inference Engine]] §6.1.1)
複数オープンソース推論エンジンの比較(表6)では、FlashDecoding++ は演算子(Attention・Linear)と計算グラフの最適化を最も網羅的に実装し、106.636 token/s という最高の推論スループットを記録した(比較対象: HuggingFace, DeepSpeed, vLLM, OpenPPL, LightLLM, TensorRT-LLM)。ただしサービング機能(メモリ管理・バッチング・スケジューリング)は統合していない。(Source: [[@2024__arXiv__A Survey on Efficient Inference for Large Language Models - Chapter 6.2 System-level Optimization - Hardware Accelerator and Framework Comparison]] §6.4)
## 関連
- [[@2024__arXiv__A Survey on Efficient Inference for Large Language Models - Chapter 6.0 System-level Optimization - Inference Engine]] — Attention/Linear/Graph-Level 最適化の中心的な議論
- [[@2024__arXiv__A Survey on Efficient Inference for Large Language Models - Chapter 6.2 System-level Optimization - Hardware Accelerator and Framework Comparison]] — フレームワーク比較表(表6)での推論スループット最高値
- [[TensorRT-LLM]] / [[FlashAttention]]
## 出典
- [[@2024__arXiv__A Survey on Efficient Inference for Large Language Models - Chapter 6.0 System-level Optimization - Inference Engine]] §6.1.1
- [[@2024__arXiv__A Survey on Efficient Inference for Large Language Models - Chapter 6.2 System-level Optimization - Hardware Accelerator and Framework Comparison]] §6.4