“We’ll train an agent to pick the best inference settings per device.” It sounds principled. It is often the wrong tool. A reinforcement learning framework earns its place only when the decision is genuinely sequential and uncertain — and choosing per-platform inference settings usually is not. That distinction is what this guide is about. A reinforcement learning (RL) framework gives you a training loop, an environment abstraction, and a set of policy-optimisation algorithms so an agent can learn a control policy from reward signals instead of labelled data. Libraries like Stable-Baselines3, RLlib, and Gymnasium exist precisely to standardise that machinery. The trouble starts when a team reaches for one before asking whether the problem in front of them is a control problem at all. When the decision space is small and directly measurable — which per-platform inference tuning almost always is — an RL framework buys you weeks of environment construction and returns nothing that a grid search would not have found deterministically. What does a reinforcement learning framework actually do? Strip away the marketing and an RL framework is a harness around one idea: an agent interacts with an environment, takes actions, and receives a scalar reward; over many episodes it adjusts a policy so future actions accumulate more reward. The framework’s job is to make that loop reproducible. It standardises how the environment exposes state and accepts actions (Gymnasium’s reset/step contract is the de facto interface), it implements the optimisation algorithms — PPO, SAC, DQN and their variants — and it manages the rollout, replay, and logging plumbing that would otherwise be re-invented per experiment. The value of the framework is real but narrow: it removes the cost of re-instrumenting each experiment and lets you compare policies on the same reward and latency budget. That is a genuine benefit once you have decided RL is the right method. It does nothing to tell you whether you should have. Five components have to be present and well-defined before any of this works: Component What it is Failure signal if it’s ill-defined Environment The system the agent acts on; exposes state, accepts actions, returns reward You are simulating something you could just measure directly Agent The learner that maps observed state to an action The mapping is a lookup table with no real state to observe Policy The learned function the agent optimises The “policy” has one input and one output — it’s a constant Reward The scalar objective the agent maximises You can enumerate every reward value in an afternoon Training loop The rollout–update cycle the framework runs The loop converges instantly because the space is tiny If more than one of those failure signals is firing, you do not have a reinforcement learning problem. You have a configuration search wearing an RL costume. When is reinforcement learning the right tool for tuning inference behaviour? Here is the divergence point, stated plainly: RL is warranted when the action space is large, the decisions are sequential, and the reward is expensive to enumerate exhaustively. If any of those three is false, a deterministic method is faster, cheaper, and more auditable. Take the concrete case that motivated this guide. On cross-platform text-to-speech work, the question was whether to distil a model or quantise it for each target device. That reads like a policy problem — “learn the best compression strategy per platform.” It is not. The choice was settled by direct on-device latency measurement: run both candidates on the actual hardware, read the numbers, pick the one that meets the budget. There are two actions, one decision per platform, and a reward you can measure in minutes. Building an environment to learn that answer would have added weeks and yielded no accuracy over the measurement you can take today. The same logic governs whether to reach for FP4 quantisation on edge inference — it is a measured trade-off, not a learned one, and choosing precision by benchmark is a form of right-sized inference rather than a control policy. Contrast that with a case where RL genuinely fits: an on-device agent that must decide, frame by frame, whether to run a full detection pass, a cheap tracker update, or skip inference entirely — under a fluctuating latency budget, where each choice changes the state the next choice sees. Now the decisions are sequential, the state is real (recent motion, queue depth, thermal headroom), and the reward — sustained quality within a rolling latency envelope — cannot be enumerated because it depends on trajectories, not single settings. That is a control problem, and a framework-standardised loop earns its keep. How do you tell a sequential decision problem from a static search? Run the problem through this checklist before you write a single line against Stable-Baselines3 or RLlib: Does an action change the state the next action sees? If actions are independent, it is a search, not a policy. Is the action space too large to enumerate? A dozen discrete configurations is a grid. Thousands of state-conditioned choices is a policy space. Is the reward cheap to measure directly? If you can read the reward off the device in minutes per candidate, measure it — don’t learn it. Is there genuine uncertainty at decision time? RL exists to act under uncertainty. If the environment is fully known and deterministic, dynamic programming or plain search is exact and faster. Do you need to generalise across unseen states? A lookup table covers what you’ve seen. A learned policy is justified when the state space is too large to tabulate. If you answered “no” to the first four, stop. Grid search, a decision table, or a lookup table will settle the question deterministically, and you will keep the auditability that a learned policy quietly costs you. What does a reward signal look like under a latency or quality budget? This is where teams most often go wrong even when RL is legitimately warranted. A reward that is “minimise latency” produces an agent that skips all work. A reward that is “maximise quality” produces one that blows every budget. The signal has to encode the constraint, not just the objective. A workable shape, for the frame-scheduling example, is a quality term with a hard penalty when the rolling latency envelope is breached — for example, reward the detection quality delivered this window and subtract a steep penalty proportional to any overshoot past the budget. The penalty being steep and non-linear matters: it stops the agent from trading a small quality gain for a latency violation the product cannot tolerate. Designing that shaping term is itself an engineering task, and it is where most of the real effort goes — not in picking PPO over SAC. The reward also has to be cheap enough to sample during training but faithful to the deployed objective. When those two pull apart — the simulator is fast but wrong, or the on-device measurement is faithful but slow — you inherit a sim-to-real gap that no amount of algorithm tuning closes. This is the same class of problem that makes cross-platform inference portability hard: what you measure in one environment does not transfer cleanly to another, and the discipline is in knowing which measurement is the ground truth. The real costs of adopting an RL framework None of this is free, and the costs are structural rather than incidental. In our experience the three that sink projects — observed across engagements, not a benchmarked figure — are environment construction, reward design, and reproducibility. Environment construction is the big one. If your environment is a simulator, it has to be faithful enough that a policy trained in it survives contact with the device; if it is the device itself, every training step costs real wall-clock time and the loop crawls. Reward design, as above, is where subtle objective errors hide until the agent exploits them. Reproducibility is the quiet tax: RL runs are notoriously seed-sensitive, and without disciplined experiment tracking you cannot tell whether a policy improved because of your change or because of a lucky seed. A framework helps with the last of these — a standardised loop and logging surface make runs comparable — but it cannot manufacture a faithful environment or a correct reward for you. The honest accounting is this. Where RL is genuinely warranted, the framework reduces reproduction cost and lets you compare policies on the same reward and latency budget instead of re-instrumenting each experiment. Where it is not — the far more common case for inference tuning — correctly scoping RL out of a deterministic configuration problem saves the multi-week cost of building and validating an environment that yields nothing over grid search. Getting that scoping right is the decision this guide exists to inform. Deciding it well is close to the work described in scoping edge deployment trade-offs, and it is a decision that recurs across the telecom and media-edge deployments we work on across media and telecom systems. FAQ What matters most about a reinforcement learning framework in practice? A reinforcement learning framework wraps the core RL loop — an agent takes actions in an environment, receives a scalar reward, and updates a policy over many episodes to accumulate more reward. In practice the framework standardises the environment interface, implements the optimisation algorithms (PPO, SAC, DQN), and handles rollout, replay, and logging so experiments are reproducible. Libraries like Stable-Baselines3, RLlib, and Gymnasium provide this machinery so you do not re-invent it per experiment. What core components does an RL framework provide — environment, agent, policy, reward, and training loop — and how do they fit together? The environment exposes state and accepts actions; the agent maps observed state to an action; the policy is the learned function the agent optimises; the reward is the scalar objective it maximises; and the training loop is the rollout–update cycle the framework runs. They fit together as one feedback loop: the agent acts, the environment returns state and reward, the loop updates the policy. If any component collapses to a trivial form — a constant policy, a one-input agent, an enumerable reward — the problem is not an RL problem. When is reinforcement learning the right tool versus a deterministic search or supervised approach for tuning inference behaviour? RL is warranted only when the action space is large, the decisions are sequential, and the reward is expensive to enumerate exhaustively. If actions are independent, the configuration set is small, and you can measure each candidate’s reward directly on the device, a grid search or lookup table settles the question faster and remains auditable. Supervised learning fits when you have labelled examples of the right action; RL fits when you only have a reward signal from acting under uncertainty. How does an RL framework differ from the deterministic configuration search used to decide distillation vs quantisation for cross-platform inference? The distillation-vs-quantisation choice for cross-platform inference has a tiny action space — usually two candidates per platform — and a reward you can read directly by measuring on-device latency in minutes. That makes it a deterministic configuration search, not a control problem: you run both, read the numbers, and pick the one that meets the budget. An RL framework would add weeks of environment construction to learn an answer that direct measurement already gives you exactly. What does a reward signal look like when the objective is a latency or quality budget on-device? It has to encode the constraint, not just the objective. A workable shape rewards the quality delivered in a window and subtracts a steep, non-linear penalty when the rolling latency envelope is breached, so the agent cannot trade a small quality gain for a budget violation. The reward must also be cheap enough to sample during training yet faithful to the deployed objective — when those pull apart you inherit a sim-to-real gap no algorithm tuning closes. How do you know if your problem is a genuine sequential decision problem under uncertainty rather than a static configuration search? Ask whether an action changes the state the next action sees, whether the action space is too large to enumerate, whether the reward is expensive to measure directly, and whether there is genuine uncertainty at decision time. If actions are independent, the configuration set is small, and you can measure each reward cheaply, it is a static search dressed up as a control problem. A learned policy is justified only when the state space is too large to tabulate and you must generalise across unseen states. What are the practical costs — environment construction, reward design, reproducibility — of adopting an RL framework? Environment construction is the largest cost: a simulator must be faithful enough to survive contact with the device, while training on the device itself makes every step cost real wall-clock time. Reward design hides subtle objective errors the agent will exploit, and reproducibility is a quiet tax because RL runs are seed-sensitive and need disciplined experiment tracking. A framework reduces reproduction cost and makes runs comparable, but it cannot manufacture a faithful environment or a correct reward for you. The sharper question is not “which RL algorithm should we use” but “is this a sequential decision under uncertainty at all?” Answer that first. If the reward is cheap to measure and the action space enumerable, the deterministic search you were trying to avoid is the correct optimisation method — and the multi-week environment build is the failure mode to recognise before it starts.