daily-tech:2026-11-27 從 ART 記憶體管理看端側 LLM 垃圾回收 (GC) 停頓消除:從 Generational CC 到停頓控制 / Eliminating GC Pauses in Edge LLMs via Android ART Memory Management: From Generational CC to Pause Suppression 現象: 隨著小型語言模型(如 Gemma-2B、Llama-3.2-1B/3B 等 SLM)在 Android 行動裝置上的廣泛普及,開發者常使用 ExecuTorch 或 LiteRT 搭建端側對話或即時助手應用。然而,許多團隊在實測流式輸出(Token Streaming)時發現:儘管 NPU 或 GPU 的純推論時間相當穩定(例如每秒可產出 20 到 30 個 Token),文字輸出卻會不定期出現「瞬間凍結」或斷續卡頓,單一 Token 的產出時間偶爾會從 40ms 暴增至 150ms 以上。這種嚴重的 Token-to-Token 延遲抖動,其根源往往不在底層模型推論,而在於 Android 執行階段(ART, Android Runtime)在 Java 堆積(Java Heap)中觸發了垃圾回收(Garbage Collection, GC)停頓。 Symptom: With the rapid adoption of edge small language models (such as Gemma-2B and Llama-3.2-1B/3B) across Android mobile devices, developers frequently leverage ExecuTorch or LiteRT to power on-device conversational agents. However, during token streaming evaluations, teams frequently observe erratic frame freezes and stuttering: despite consistent NPU/GPU neural execution (e.g., 20 to 30 tokens per second), toke...
從 EEVDF 看 Linux 核心對端側 AI 延遲敏感度的排程配額優化 / Optimizing Edge AI Latency via Linux EEVDF: Scheduling Quotas and Virtual Deadlines
daily-tech:2026-11-26 從 EEVDF 看 Linux 核心對端側 AI 延遲敏感度的排程配額優化 / Optimizing Edge AI Latency via Linux EEVDF: Scheduling Quotas and Virtual Deadlines 現象: 在 Linux 與 Android 邊緣裝置上部屬端側 AI(例如即時語音辨識、手勢追蹤或端側小型語言模型 SLM Token 生成)時,許多開發團隊在處理高負載背景任務時,常發現 AI 推論會出現不可預期的延遲抖動(Latency Jitter)。即便系統已經透過前篇討論的 DMA-BUF 零拷貝技術消除了大部分的記憶體搬移開銷,但當 AI 執行緒被硬體中斷(如相機新圖框就緒、麥克風音訊緩衝區填滿)喚醒時,往往無法第一時間搶佔 CPU 核心,而是在就緒佇列(Runqueue)中痛苦排隊 5 到 15 毫秒。這類延遲使得即時互動系統的影音同步失效,嚴重傷害端側 AI 的流暢體驗。 Symptom: When deploying on-device AI workloads (such as real-time keyword spotting, gesture tracking, or edge small language model SLM token streaming) on Linux and Android devices under concurrent system loads, developers frequently encounter severe latency jitter. Even after eliminating redundant memory copies using the DMA-BUF zero-copy pipeline analyzed in our previous article, AI threads awakened by hardware interrupts (e.g., camera frame completions or audio buffer fills) often fail to seize CPU cores immediately. Instead, they languish in run...