跳到主要內容

發表文章

目前顯示的是有「ExecuTorch」標籤的文章

從 LiteRT 與 ExecuTorch 看 Android 端側 AI 記憶體預算:為什麼模型不大卻容易 OOM / On-Device AI Memory Budgeting: Why Models OOM Despite Small Weights

daily-tech:2026-11-24 從 LiteRT 與 ExecuTorch 看 Android 端側 AI 記憶體預算:為什麼模型不大卻容易 OOM / On-Device AI Memory Budgeting: Why Models OOM Despite Small Weights 現象: 在 Android 手機上部署端側 AI 模型時,許多團隊常遇到令人困惑的記憶體崩潰。直覺上,開發者看到量化後的 INT8 或 INT4 權重檔案只有約 1.2GB,心想設備還有超過 2GB 的可用記憶體,應該游刃有餘。然而一旦實際載入並開始接收推論請求,系統卻迅速觸發 Low Memory Killer(LMK),將前台 App 或重要的背景服務強制終止。這並非模型參數本身膨脹,而是推論時伴隨的動態暫存空間與系統底層限制悄悄耗盡了預算。 Symptom: When deploying on-device AI models on Android, developers often face puzzling memory crashes. Intuitively, seeing an INT8 or INT4 quantized weight file of only 1.2 GB makes one assume that 2 GB of available device RAM is more than enough. Yet in practice, as inference begins, the Android Low Memory Killer (LMK) quickly terminates the foreground app or background tasks. The weight parameters do not expand; rather, dynamic runtime buffers and system-level allocations quietly exhaust the available memory budget. 端側 AI 執行期記憶體組成拆解 / On-Device AI Runtime Memory Breakdown 靜態權重參數 Static Model Weights INT8 / INT4 量...