skip to content

When is a stochastic policy strictly better than any deterministic policy?

level: seniorimportance: nice to knowfreq 32%

answer

  1. ask who is watching your actions
  2. finite MDPs already have a deterministic optimum
  3. two situations that look the same
  4. the max is attained by one action
  5. a rival best-responds to a fixed bid

basics

~20 s

In a finite, fully observed MDP some deterministic policy is always optimal, so randomising gains nothing. Randomising wins when an opponent can exploit predictability, when distinct states look identical to the agent, or when the policy class is restricted.

solid answer

~50 s

A policy is a map from state to a distribution over actions; a deterministic policy puts all its mass on one action. For a finite MDP that is fully observed and has fixed dynamics, there is always at least one optimal deterministic policy — reading the argmax off `Q*` gives you one — so randomising cannot beat it. The cases where it can are the ones that break those assumptions. First, an adversary: in a repeated sealed-bid auction against a rival who watches your history, any fixed bid gets best-responded to, and mixing your bids is what stops the rival extracting your surplus. Second, state aliasing under partial observation: if two genuinely different situations produce the same observation, a deterministic rule must take the same action in both and can be badly wrong in one, while randomising bounds the loss. Third, a restricted or smoothed policy class where the deterministic optimum simply is not representable. Exploration during learning is a separate motivation.

go deeper

for a junior

Know that a policy maps states to actions, and that a stochastic one gives probabilities rather than a single choice. Recall that for the standard textbook setting a deterministic policy is enough.

for a middle

Explain why the max over a finite action set means a deterministic policy attains the optimum, and give at least one concrete setting where that argument breaks down.

for a senior

Recognise the escapes in real systems: a counterparty that adapts to your behaviour, sensors that cannot distinguish two situations, or a policy constrained by business rules. Say what you would change about the state representation first.

for a principal

Own the framing decision — whether the problem is genuinely a single-agent MDP or a game, and whether to fix aliasing by enriching state and adding memory rather than papering over it with randomisation.

## What the two policy types are A policy `pi(a|s)` assigns probabilities to actions in each state. It is **deterministic** when one action gets probability 1 — often written `pi(s) = a` — and **stochastic** otherwise. Note that a stochastic policy is not the same thing as a stochastic environment: transitions can be random while the policy is a fixed rule, and vice versa. ## The theorem that makes this question interesting For a finite Markov decision process with known, stationary dynamics and full observation of the state, there exists an optimal policy that is deterministic. The reason is visible in the optimality equation: `V*(s) = max over a of E[r + g*V*(s')|s,a]`. A maximum over a finite set is attained by some single action, so committing to that action loses nothing. Randomising over several actions can tie the optimum — mixing only among maximisers is also optimal — but it can never strictly beat it. So the honest answer to "is stochastic better?" starts with **no, not in the textbook setting**, and the interview value lies in naming precisely which assumption has to fail. ## Case 1: an adversary can best-respond Suppose you bid repeatedly in a sealed-bid auction against one rival who can observe your past bids. Model this as a single-agent MDP and you get a deterministic optimal bid — but the rival is not part of the environment's fixed dynamics; they adapt. Once your bid is predictable, the rival can position their own bid to win cheaply whenever it suits them and concede only when the item is not worth it, so your realised surplus collapses. A randomised bid schedule leaves the rival uncertain about the threshold they are bidding against, and their best response degrades. This is a game, not an MDP: the "environment" contains an optimiser working against you, and in general equilibria of such games require mixed strategies. Any competitive pricing, bidding, or security setting where the counterparty studies your behaviour has this shape. ## Case 2: state aliasing under partial observation The MDP theorem assumes the agent conditions on the true state. If the agent only sees an observation, two distinct underlying states can look identical. A deterministic policy is a function of what it can see, so it must emit the same action in both — and if the right action differs between them, it is guaranteed wrong in one, potentially forever (walking into the same wall, taking the same doomed action every visit). A policy that randomises over the two candidate actions is wrong only some of the time and, in aliased navigation-style problems, can achieve a strictly higher expected return than the best deterministic map from observation to action. The deep fix is a better state representation — adding memory or history so the states stop aliasing — but randomising is the direct mitigation when you cannot. ## Case 3: restricted or smooth policy classes If the policy is constrained — to a parametric family, to a smooth function for optimisation reasons, or by a constraint like "no more than 30% of traffic to one variant" — the deterministic optimum may not be inside the feasible set. Then the best available policy is stochastic simply because determinism is unavailable. Constrained MDPs, where you maximise return subject to a cost budget, are a clean example: the optimal solution there is often a randomisation between two deterministic policies, because that is the only way to hit the budget exactly. ## What this is not It is not an argument that randomness helps learning. During learning an agent must try actions its current estimates do not favour, and that is a separate topic with its own machinery. Nor is a stochastic policy a "noisy" version of a deterministic one — the mixing probabilities are part of the policy and are chosen, not injected as noise after the fact. And a stochastic policy still has a perfectly ordinary value function: `V_pi(s) = sum over a of pi(a|s) * Q_pi(s,a)`, the average over the actions it might take. ## How to answer in an interview Lead with the theorem — deterministic suffices for finite, fully observed MDPs — then name the escapes: adversarial or multi-agent settings, partial observability with aliasing, and restricted or constrained policy classes. Candidates who say "stochastic is always better because it explores" have skipped the theorem, and candidates who say "deterministic is always better because it is decisive" have missed the escapes.

  • Why does state aliasing make a deterministic policy suffer?
    Because the policy can only condition on what it observes. If two different underlying states share one observation and need different actions, a deterministic rule takes the same action in both and is guaranteed wrong in one, every time it visits. Randomising splits the loss across the two, which can raise expected return above the best deterministic observation-to-action map.
  • In a repeated sealed-bid auction, why does a fixed bid lose value against an adaptive rival?
    Because the rival learns the threshold and best-responds: they outbid by a hair when the item is worth it and stay out otherwise, so you win only the unprofitable rounds. Mixing your bid leaves them uncertain about what they are bidding against, which lowers the value of their best response and protects your surplus.
  • Does an optimal deterministic policy stop existing once you allow stochastic ones?
    No. In a finite, fully observed MDP the set of optimal policies includes at least one deterministic policy, and any mixture over equally optimal actions is also optimal. Allowing randomisation enlarges the set of optima but does not raise the optimal value.
  • Is a stochastic policy the same as a stochastic environment?
    No, and conflating them is a common slip. Environment stochasticity lives in the transition and reward distributions and is a property of the problem; policy stochasticity is a choice the agent makes about how to act. You can have a deterministic policy in a random world, or a randomised policy in a fully deterministic one.

A poker player who always raises with a strong hand is readable; the mixing is what makes them hard to beat.

saying these in an interview costs you the question

  • Says stochastic policies are always better because they explore
  • Claims finite MDPs have no deterministic optimal policy
  • Confuses a stochastic policy with a stochastic environment
  • Thinks randomisation only breaks ties between equal actions
  • Ignores adversaries and partial observability entirely

context