Governors That Pay for Tomorrow: Policy-Regret Frequency Control for Coupled CPU–GPU–Memory Inference

Phones, laptops and servers set their own clock speeds. A piece of software called a governor raises or lowers each chip's frequency to trade speed against power. A known failure appears when one chip's choice changes the next chip's workload a few milliseconds later. On a phone running a language model, the CPU only prepares and submits GPU work, so it looks idle and its governor slows it down. Submission then slows, the GPU sees less work and slows down too, and latency grows by up to 40.4% at equal energy compared with the best frequency combination (Dissecting the Impact of Mobile DVFS Governors on LLM Inference Performance and Energy Efficiency). We argue that this "downward spiral" is a textbook case of a learner judged by the wrong kind of regret. Each governor minimizes the cost it sees this round. That cost depends on decisions made several rounds earlier. In online learning, a policy that looks good round by round against a history it created itself can still be far worse than simply holding a better choice fixed.

The proposal is to build a coordinated frequency controller from the online-learning theory of losses with memory. The theory supplies the controller's evaluation rule: judge a frequency setting by what happens when it is held long enough for the coupled system to settle, not by the round in which it was chosen. The key practical quantity is the coupling horizon, meaning how many decision intervals it takes for queue occupancy and memory stalls to respond after a frequency change. We measure it online from hardware counters, and it sets both the hold length and the learning rate. The thesis is that a joint learner that is myopic, even one that sees all three frequencies at once, can rediscover the spiral whenever the coupling horizon spans several decision intervals. A learner that holds and evaluates over the horizon should not.

Core Claim

Let $x_t$ be the joint setting (CPU, GPU and memory frequency, drawn from the discrete hardware steps) chosen at decision interval $t$. Let $f_t(x_t, x_{t-1}, \dots, x_{t-m})$ be the energy plus $\lambda$ times latency measured over that interval. Here $\lambda$ is an operator-chosen exchange rate, and $m$ is the coupling horizon. Online Learning for Adversaries with Memory: Price of Past Mistakes shows that the right yardstick in this setting is policy regret:

$$\text{PolicyRegret}_T=\sum_{t=1}^{T} f_t(x_t,\dots,x_{t-m})-\min_{x^*}\sum_{t=1}^{T} f_t(x^*,\dots,x^*),$$

That paper also shows that playing lazily (switching rarely) controls policy regret, because each switch "pollutes" at most $m$ future rounds. A per-interval learner minimizes external regret instead. It compares itself against $f_t(x^*, x_{t-1},\dots,x_{t-m})$, with the history it actually produced left in place. Under a spiral, that history makes "slow down further" look locally optimal.

Our claim has three parts. The spiral and similar cross-domain failures are an external-regret fixed point. A learner that commits to a setting for blocks of roughly $m$ intervals and scores each block by its settled cost escapes that fixed point. Finally, measuring $m$ at run time is what makes this practical, because $m$ varies with the model, sequence length and background memory contention.

The setting differs from prior theory in two ways. Actions are a finite set of hardware frequency triplets, and feedback is partial: we observe only the cost of the triplet we ran. Our analysis therefore uses blocked play over a finite action set rather than the continuous convex case. The price of discreteness is part of the analysis rather than assumed away.

Research Program

Measuring the coupling horizon. On the target devices, we apply step changes to each frequency domain during inference. We then fit how quickly GPU command-queue depth, memory-read-per-instruction counts and stall fractions settle. Memory reads per instruction is a counter that, as shown by AdaMD: Adaptive Mapping and DVFS for Energy-Efficient Heterogeneous Multicores and ITMD, measures memory intensity independently of clock speed. These measurements give an online estimator $\hat m$, the settling time divided by the decision interval. Running the estimator from counters alone, during normal operation, is itself a deliverable. We also measure the energy and time cost of each frequency transition directly on device. LithOS flags this switching overhead as the main obstacle to fine-grained frequency control but treats it heuristically. We turn it into an explicit switching term.

The learner. We build a blocked, context-conditioned learner over frequency triplets. The context is a coarse bin of clock-independent memory intensity and the inference phase: prefill, which is compute-heavy, or decode, which is memory-bound. Within each context, the learner keeps exponential weights over triplets. It commits to a sampled triplet for a block of length about $\hat m$, then discards the first $\hat m$ intervals of the block as transient. It updates on the settled cost plus the measured switching cost. This is the lazy, memory-aware play of Anava et al., adapted to finite actions and bandit feedback.

Safety envelope. Exploration on a user's phone must not be catastrophic. We therefore wrap the learner in the expert-envelope idea from Robustified Learning for Online Optimization with Memory Costs. In that paper, learned actions are restricted so cumulative cost stays within $(1+\lambda_{\text{trust}})$ of an expert's. ERL kept the competitive ratio near 5–6 where unconstrained models exceeded 50. Here the expert is a FUSE-style static profile, and we use a simple cumulative-cost check rather than ERL's differentiable projection.

Theory. We will derive a policy-regret bound for blocked play with an estimated $\hat m$. The analysis must show how error in $\hat m$ enters the bound. We expect underestimating $m$ to cost regret linearly in the misestimation, because truncated transients bias the block scores. Overestimating $m$ should cost only a slower learning rate. We expect the rate to degrade with block length, as is standard for blocking arguments. We will not claim a specific exponent until the derivation is done.

We deliberately do not use the heavier continuous machinery: Meta-OFW from Efficient Online Learning with Memory via Frank-Wolfe Optimization, or the dual-variable decomposition in Fairness-Regularized Online Optimization with Switching Costs. The action set is a few hundred triplets at most, so a finite-action learner is cheaper and exact. These papers motivate the formulation, but they operate on continuous decisions at datacenter or simulation scale. The second one is a natural follow-on if a long-horizon energy budget is added.

Baselines

The naive reference point is the stock Android setup: independent CPU, GPU and memory governors running ShareGPT prompts on a Google Pixel 7. This configuration produces the spiral, and every other method is reported relative to it. It is run unmodified on the same prompts, models and thermal starting state.

The strongest existing method is FUSE (Dissecting the Impact of Mobile DVFS Governors on LLM Inference Performance and Energy Efficiency). FUSE runs a two-step offline search for the best frequency triplet for prefill and for decode, then pins those triplets at run time. Relative to the default governors, it reports a 7.0–16.9% reduction in time-to-first-token and a 25.4–36.8% average reduction in time-per-output-token at the same energy per token. At matched latency it reports up to 16.6% energy savings. We will re-implement FUSE's search with the same profiling budget and the same models: TinyLlama 1.1B, Phi-2, StableLM-Zephyr 3B and Llama-2 7B.

In the clean single-tenant setting FUSE was profiled for, we expect at best to match it. Our learner beats FUSE if three things hold. It must stay within a few percent of FUSE's latency and energy in the clean setting. It must beat FUSE on energy per token at matched time-per-output-token under background memory contention and unseen prompt-length distributions. It must do both without offline profiling of the target model.

A second strong baseline is AdaMD's rule (AdaMD). AdaMD checks utilization and memory intensity every 100 ms and steps frequency down in memory-bound phases. It reports up to 28% energy savings over ITMD on PARSEC with 0.6–1.4 ms of overhead. We run it with added hysteresis, with thresholds tuned on the same held-out prompts we use to tune our learner's single hyperparameter. That tuning set is a separate prompt split from the test prompts.

The ablation that isolates the key ingredient is the same learner with block length fixed at one. This version is a joint, context-aware, switching-cost-penalized bandit that updates every interval: everything except the memory-aware evaluation. A second ablation fixes the block length at a constant instead of the measured $\hat m$, to test whether online horizon estimation matters.

Why not just…?

Why not just pin FUSE's offline triplets? In the setting FUSE was built for, this is likely nearly optimal, and we say so. Its weakness is that the profile is a snapshot. Background memory traffic, new models and different prompt lengths shift both the energy-versus-frequency "valley" (The Impact of GPU DVFS on the Energy and Performance of Deep Learning) and the coupling horizon. The contention and shift experiments test exactly this. If FUSE remains within noise of our learner there, the online component is not worth its complexity, and we would report that.

Why not just add hysteresis to a memory-intensity threshold? Hysteresis suppresses rapid switching, but it still chooses each domain's frequency from that domain's own current reading. It therefore cannot see that a CPU slowdown shows up as a GPU penalty several intervals later. It fixes the switching problem but not the misattribution problem. The tuned-hysteresis AdaMD baseline above settles the question empirically. If it matches our learner, the spiral is an oscillation problem, not a memory problem, and our thesis is wrong.

Why not just run a joint bandit over triplets every interval? This is the most serious threat, because jointness alone removes the "each governor blames the other" structure. Our prediction is narrower. A per-interval joint learner should match ours when $m$ is about one interval, and should fall behind as $m$ grows. In the second case, the backlog lets a slow CPU setting look free for a few intervals before the cost lands. The block-length-one ablation, swept against measured $m$, is designed to confirm or refute this directly.

Why not just shorten the decision interval? Shorter intervals make $m$ larger, measured in intervals. They also multiply the transition overhead that LithOS identifies as the limit on fine-grained control. Shorter intervals therefore make the problem worse for myopic methods, not better.

Proposed Experiments

The main testbed is the FUSE setup: Pixel 7, ShareGPT, and the four models listed above. Metrics are time-to-first-token, time-per-output-token, energy per token, and number of frequency transitions. We report results on the latency–energy frontier, not at a single point. Three regimes are tested. The clean regime reproduces FUSE's setting. The contention regime adds a co-running memory-streaming background process at several intensities. The shift regime tests on prompt-length distributions the profile never saw.

A secondary testbed is the Odroid-XU3 running concurrent PARSEC applications, the platform used by AdaMD. There, the coupling runs through the shared memory bus between co-running applications rather than through a CPU-to-GPU queue. This tests whether the horizon-estimation idea transfers.

The decisive check is a plot of the gap between our learner and the block-length-one ablation against the measured coupling horizon, across all models and regimes. The thesis predicts a gap near zero at $m \approx 1$ that grows with $m$. A flat gap would falsify the central claim.

Two further checks follow. First, we induce a spiral deliberately under the stock governors and under the per-interval joint bandit, then measure whether our learner exits it, and how quickly. Second, we inject errors into $\hat m$ to test the predicted asymmetry: underestimating $m$ should be costly and overestimating it cheap. We will also report controller overhead against the decision interval. AdaMD's 0.6–1.4 ms routine is the reference for what an embedded system tolerates.