Collaborative Device-Cloud LLM Inference through Reinforcement Learning
Wenzhi Fang, Dong-Jun Han, Liangqi Yuan, Christopher Brinton
TL;DR
This work tackles the efficiency–accuracy trade-off in device–cloud LLM inference by enabling on-device models to autonomously decide cloud offloading through reinforcement learning. It introduces a unified post-training framework with a collaboration-aware hierarchical reward and a Group-Adaptive Policy Gradient (GAPG) algorithm that uses a group-level gradient estimator and adaptive prompt filtering to jointly optimize local reasoning and cloud invocation under a cloud-usage budget. Empirical results on symbolic and mathematical reasoning tasks demonstrate that the approach consistently outperforms baselines and substantially narrows the gap to full cloud LLM performance, while maintaining stable training and favorable call budgets. The method advances practical device–cloud collaboration by eliminating external routers and enabling end-to-end optimization of both reasoning and routing in a resource-constrained setting.
Abstract
Device-cloud collaboration has emerged as a promising paradigm for deploying large language models (LLMs), combining the efficiency of lightweight on-device inference with the superior performance of powerful cloud LLMs. An essential problem in this scenario lies in deciding whether a given query is best handled locally or delegated to the cloud. Existing approaches typically rely on external routers, implemented as binary classifiers, which often struggle to determine task difficulty from the prompt's surface pattern. To address these limitations, we propose a framework where the on-device LLM makes routing decisions at the end of its solving process, with this capability instilled through post-training. In particular, we formulate a reward maximization problem with carefully designed rewards that encourage effective problem solving and judicious offloading to the cloud. To solve this problem, we develop a group-adaptive policy gradient algorithm, featuring a group-level policy gradient, designed to yield an unbiased gradient estimator of the reward, and adaptive prompt filtering, developed to enforce the constraint on cloud LLM usage. Extensive experiments across models and benchmarks show that the proposed methodology consistently outperforms existing baselines and significantly narrows the gap to full cloud LLM performance.
