共享上下文,独立引擎:边缘系统芯片上的流式视觉-语言推理
Shared Context, Separate Engines: Stateful Streaming Inference for Multimodal LLMs on Edge SoCs
AI总结:
本文针对边缘SoC上VLM运行时引擎闲置问题,提出协调异构加速器的有状态VLM推理方法,通过分离上下文与KV状态、有感知状态调度,在多平台提升了吞吐量并降低了延迟。
摘要:
边缘系统芯片(SoC)集成了中央处理器(CPU)、图形处理器(GPU)和神经网络处理器(NPU),但视觉-语言模型(VLM)的运行时仍将生成任务放在单一引擎上执行,导致其他引擎闲置。流式VLM还存在进一步的并行性:新帧到达时,早期查询仍在处理中。不同引擎的计算能力和内存访问特性存在差异,协同运行时会产生资源竞争,因此在不同SoC和工作负载下,单一的阶段部署方案无法取得最优效果。后端本地的键值(KV)状态会阻碍其他引擎继续处理任务。本文提出的方法协调异构加速器执行有状态VLM推理,将流的版本化上下文与各引擎的KV状态分离,使任意引擎可通过复用、导入或重建该状态来继续处理流任务。有状态流式生成在一个引擎处理新帧的同时,另一个引擎响应查询;并发序列生成则并行处理不同就绪的请求。有感知状态的调度策略将每个请求分配给预计最先完成的引擎。每个响应读取固定的已发布历史版本,并匹配其序列引用。实验在苹果M4 Max、瑞芯微RK3588和高通QCS6490平台上,该方法优于最强的单引擎基线(即使基线复用上下文)。在两个RK3588视频流场景中,其吞吐量比最佳的复用上下文单引擎高19.6%,比无共享状态的并行引擎高27.2%。跨引擎KV导入相比前缀重计算,将首token延迟降低4.6倍;有状态流式生成的吞吐量最高达串行执行的2.48倍,有感知状态的调度策略将查询完成时间最多降低72.7%。
英文摘要:
Streaming multimodal large language models (MLLMs) must take in new video frames while answering questions about what they have already seen. On an edge SoC, if one engine does both, ingestion and answering compete for its time while the other engines sit idle. To take over a query, another engine must first import or rebuild the accumulated history, because each runtime keeps it as KV state in its own format. \name lets one engine answer from history that another engine built. Each query reads the history as it stood when the query was asked, so one engine can keep ingesting while another answers. The CPU and GPU can also decode answers to different queries simultaneously. Phase-level state continuation lets an engine prefill a query, pass its KV state to another engine for decoding, and return to ingestion. State-Driven Execution Planning (SDEP) chooses where each query is prefilled and decoded, based on the state each engine holds and the work queued on it. Across M4 Max, RK3588, and QCS6490, \name outperforms single-engine execution. On a live M4 Max stream, SDEP cuts p95 time to first token by $76\%$, and every query receives its first token within one second. Under backlog, it raises request throughput by up to $35\%$. For two concurrent video streams on RK3588, SDEP delivers $19.6\%$ higher request throughput than single-engine execution and $27.2\%$ more than running both engines in parallel without shared state. \name delivers up to $2.48\times$ the throughput of the same engines run serially. Every answer matches serial execution token for token.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。