The first version of edge-agent-runtime worked perfectly for ninety seconds and then quietly got slower. This entry is about finding out why, and about the three changes that fixed it.
The measurement that mattered
Not average tokens per second. The metric was tokens per second sampled every five seconds over a ten-minute run. The average looked fine; the trace showed a monotonic decline starting around 90 s and flattening at roughly 45 percent of the initial rate.
That shape is thermal, not algorithmic.
Where an 18 W budget actually goes
On the E1 board, a single board with an NPU and 8 GB of LPDDR5:
| Component | Idle | Inference | Notes |
|---|---|---|---|
| SoC compute + NPU | 2.1 W | 8.4 W | scales with batch, not with seq length |
| DRAM | 0.4 W | 3.9 W | dominated by weight streaming |
| Board + regulator loss | 0.8 W | 2.1 W | ~12 percent at load |
| Thermal headroom | - | 3.6 W | the part that disappears |
The interesting row is DRAM. Weight streaming from memory was costing more than the arithmetic, which is why quantising to INT8 helped far more than expected.
Change one: stop reallocating
The first runtime allocated per token. On this board that alone accounted for about 11 percent of the budget and a large share of the jitter.
// A single arena for the whole generation, reused across steps.
using var arena = MemoryArena.Rent(_plan.WorkingSetBytes);
var state = _session.CreateState(arena);
for (var step = 0; step < maxTokens; step++)
{
_session.Advance(state, token => emit(token));
}
No allocations on the hot path means no GC pauses and a flatter power trace.
Change two: quantise for the memory bus, not for the FLOPs
INT8 weights cut DRAM traffic roughly fourfold. The accuracy cost, measured on the parity corpus from the dual-track entry, was a mean absolute logit difference of 0.004 with no input above 0.03. That was acceptable for the decision being made, and I only know that because the corpus existed.
Change three: give the scheduler a duty cycle
The NPU can burst above its sustained budget, and sustained bursting is exactly what hits the thermal wall. The scheduler now targets a duty cycle and lets throughput be whatever that produces, rather than chasing peak.
Result: a flat 10-minute trace at a lower peak rate. The average is lower and it is honest, which is a better property for a device that has to run for an hour.
The generalisation
On a cloud GPU, memory bandwidth is a line item. On a board with a power budget, it is often the whole story. Every optimisation that reduced instruction count and left memory traffic unchanged did approximately nothing.
Cite this entry
Copy the block you need.
@misc{huang2026fromcloudtoedgeond,
author = {Mr Huang},
title = {From Cloud to Edge: On-Device Inference and the Power Budget},
year = {2026},
url = {https://selfevo.dev/en/blog/tech/from-cloud-to-edge-inference},
note = {selfevo, blog}
} TY - GEN
AU - Mr Huang
TI - From Cloud to Edge: On-Device Inference and the Power Budget
PY - 2026
UR - https://selfevo.dev/en/blog/tech/from-cloud-to-edge-inference
PB - selfevo
ER - Mr Huang (2026). From Cloud to Edge: On-Device Inference and the Power Budget. selfevo. https://selfevo.dev/en/blog/tech/from-cloud-to-edge-inference