A learned policy compresses past optimization into parameters:
at∼πθ(⋅∣st).
Most computation happens during training, so acting may require only one forward pass. Planning takes the opposite bargain. Given a model, it spends computation on the current decision:
at=PLAN(st,p,r,budget).
The model may be exact game rules, a conventional simulator, or a learned dynamics model. A planner only needs to query consequences such as
s′∼p(⋅∣s,a).
Dynamic programming attempts to solve the MDP globally:
V∗(s)=amax[r(s,a)+γs′∑p(s′∣s,a)V∗(s′)],∀s∈S.
A planner can instead approximate only the decision rooted at the current state:
at≈argamaxQ∗(st,a).
It ignores states unreachable from st and branches that do not matter to the present action. This gives the basic tradeoff:
learning:planning:compute now so later decisions are cheap,compute later to improve the current decision..
Strong systems combine them. A policy proposes promising actions, a value function estimates distant consequences, and local search improves the final recommendation.
An open-loop plan fixes an entire action sequence
A=(a1,…,aH)
before any future state is observed. Conditioned on A,
p(s1:H+1∣A)=p(s1)t=1∏Hp(st+1∣st,at).
A closed-loop policy reacts to each realized state:
Optimizing H actions is simpler than optimizing a mapping from every possible future state to an action. The price is that a fixed sequence cannot react when reality differs from prediction.
More particles reduce Monte Carlo noise but require more model calls.
Random shooting
Random shooting samples candidates from a proposal
A(1),…,A(N)∼q(A),
scores each through the model, and selects
A∗=argA(i)maxJ(A(i)).
Its model-step cost is approximately
O(NBH).
Candidates are independent, so evaluation parallelizes almost perfectly. But a near-optimal sample teaches the planner nothing about where to sample next.
Cross-entropy method
The cross-entropy method, or CEM, repeatedly moves its proposal toward high-return action sequences. At iteration j,
A(1),…,A(N)∼qϕj(A).
Let Ej contain the top M candidates. The next proposal solves
ϕj+1=argϕmaxi∈Ej∑logqϕ(A(i)).
This is maximum-likelihood fitting to the elite set.
›See derivation
Define the empirical elite distribution
pE(A)=M1i∈E∑δ(A−A(i)).
We want qϕ to approach this distribution. Expanding the forward KL,
Practical implementations often use diagonal covariance and smooth the update:
μ←αμE+(1−α)μold,
with an analogous covariance update.
Cross-Entropy Trajectory OptimizationInitialize qϕ0(a1:H).For j=0,…,J−1:sample N sequences from qϕj,estimate each return with model rollouts,Ej←top M sequences,ϕj+1←argϕmaxi∈Ej∑logqϕ(A(i)).Return the best sequence or the final proposal mean.
CEM is derivative free, parallel, and compatible with non-smooth rewards. Its search space still has dimension Hda, so long horizons and high-dimensional actions require rapidly increasing computation.
Replanning Creates Feedback
Model-predictive control, or MPC, repeatedly solves the open-loop problem. At time t,
At∗=argat:t+H−1maxJ(at:t+H−1;st).
It executes only the first action,
at=at,t∗,
observes the real next state, and replans:
At+1∗=argat+1:t+HmaxJ(at+1:t+H;st+1).
Each internal optimization is open loop, but their composition defines a state-dependent controller:
πMPC(s)=first[argAmaxJ(A;s)].
MPC therefore recovers feedback without optimizing a complete policy inside each plan.
Replanning limits propagated error
Suppose the model predicts
st+1=fϕ(st,at),
but the real transition produces
st+1=st+1+ϵt.
Full open-loop execution continues from the incorrect prediction:
st+2=fϕ(st+1,at+1).
MPC resets the next plan at the observed state:
st+2=fϕ(st+1,at+1).
It does not remove model bias, but it prevents one incorrect predicted state from being propagated indefinitely.
Horizon is a three-way tradeoff
A longer horizon sees delayed consequences but increases optimization dimension, computation, and accumulated model error. A short horizon is reliable but myopic.
A terminal value compresses the tail:
JH(A)=k=0∑H−1γkr(st+k,at+k)+γHV(st+H).
The planner handles the near future explicitly, while the value function amortizes everything beyond the search horizon.
With uncertain learned models, an ensemble can propagate particles through different plausible dynamics. A risk-sensitive score is
Jrisk(A)=E[J(A)]−βVar[J(A)].
The mean rewards actions with high predicted return; the penalty rejects candidates whose quality depends on unsupported model behavior.
CEM Model-Predictive ControlAt each real state st:warm-start an action-sequence proposal,run CEM for a fixed compute budget,score candidates across stochastic or ensemble particles,execute only the first action of the best plan,observe st+1 and shift the proposal forward.
Forward Search
Trajectory optimization searches over complete action sequences. Forward search instead builds a tree rooted at the current state.
At a state node, the agent chooses an action. At the following chance node, the environment chooses a next state according to the transition distribution.
With h decisions remaining, exact finite-depth expectimax obeys
Starting at the root, a tree policy selects edges until it reaches a terminal state, a depth limit, or an unexpanded action. The model then generates a successor:
s′∼p(⋅∣s,a).
Only that local part of the tree is expanded. MCTS does not enumerate every child at every depth before looking deeper.
Leaf evaluation
At the new leaf sL, estimate the remaining value with a rollout,
V(sL)=k=0∑T−L−1γkrL+k,
an average over several rollouts, or a value network:
V(sL)=vθ(sL).
Rollouts require more model steps and inherit the rollout policy's weakness. A value network is faster but adds approximation error.
In a two-player zero-sum game, the player perspective alternates, so value changes sign at each level:
vparent=−vchild.
The root decision
The planner can select the root action with the highest estimated value,
at=argamaxQ(st,a),
or the greatest visit count,
at=argamaxN(st,a).
Visit counts aggregate both estimated quality and the search algorithm's confidence, so they are often more stable than a noisy maximum of empirical means.
Monte Carlo Tree SearchInitialize a tree rooted at the current state s0.For k=1,…,K:select edges with the tree policy,expand one unvisited successor with the model,evaluate the leaf by rollout or value function,back up discounted returns along the path.Choose the root action with the largest visit count.
MCTS is an anytime algorithm. One simulation gives a crude answer; every additional simulation can refine it; and the current recommendation is available whenever the compute budget expires.
Upper Confidence Trees
Selection must exploit actions with high empirical value while exploring actions with little evidence. UCT treats each state node as a multi-armed bandit and chooses
a=argamax[Q(s,a)+cN(s,a)logN(s)].
The first term exploits known value. The second is an uncertainty bonus.
Deriving the exploration bonus
Assume returns for action a are independent and bounded in an interval of width R. If na=N(s,a) samples have empirical mean μa, Hoeffding's inequality gives
Pr(μa≥μa+ϵ)≤exp(−R22naϵ2).
Choosing failure probability δ=N(s)−α produces
ϵ=R2N(s,a)αlogN(s).›See derivation
Set the concentration bound equal to the desired failure probability:
exp(−R22naϵ2)=N(s)−α.
Taking logarithms,
−R22naϵ2=−αlogN(s).
Solving for ϵ gives
ϵ=R2naαlogN(s).
UCT absorbs Rα/2 into the tunable constant c.
Replacing na with N(s,a) yields the UCT exploration term.
The bonus is large when an action has few visits, shrinks as that edge is sampled, and grows slowly when the parent receives more visits. Unvisited actions are assigned infinite priority so every legal action is tried.
The coefficient c sets the allocation strategy:
c↓⇒more exploitation,c↑⇒more exploration.
This is not ordinary online bandit exploration. Simulated rewards have no direct value; only the final real root action matters. UCT uses a bandit rule at the metalevel to decide which computation is most likely to improve that final choice.
Neural-Guided Search
Plain MCTS wastes simulations rediscovering which actions look plausible and estimating every leaf from scratch. A neural network can provide both answers:
fθ(s)=(pθ(⋅∣s),vθ(s)).
When a state is expanded, store the policy prior
P(s,a)=pθ(a∣s),
and use
V(s)=vθ(s)
instead of a long random rollout. The policy focuses search; the value head shortens it.
PUCT
PUCT incorporates the learned prior into selection:
a=argamax[Q(s,a)+cpuctP(s,a)1+N(s,a)N(s)].
Each factor has a separate role:
Q(s,a)=backed-up evidence,P(s,a)=network preference,N(s)=pressure to revisit alternatives,1+N(s,a)=decay after an edge is explored.
A wrong prior delays an action but does not permanently remove it. As the parent is revisited, search can accumulate enough evidence to overturn the network.
After K simulations, visit counts define a search-improved policy:
πMCTS(a∣s)=∑bN(s,b)1/τN(s,a)1/τ.
At τ=1, this is the normalized visit distribution. As τ→0, it concentrates on the most visited action. A higher temperature preserves diversity during early self-play.
Search as Policy Improvement
Neural-guided MCTS creates a stronger local policy than the raw network:
pθ(⋅∣s)searchπMCTS(⋅∣s).
The network can then learn to imitate search, amortizing that expensive computation into its next forward pass:
πMCTS(⋅∣s)trainingpθ′(⋅∣s).
AlphaZero-style learning repeats these two operations through self-play.
At state st, MCTS produces
πt(a)=πMCTS(a∣st).
The player samples or selects
at∼πt,
applies the exact game dynamics, and continues until outcome
z∈{−1,0,+1}.
For each visited state, store
(st,πt,zt),
where zt is expressed from the perspective of the player to move at st.
Therefore minimizing policy cross-entropy is equivalent to minimizing
DKL(π∥pθ).
Self-Play with Neural MCTSInitialize policy-value network fθ.Repeat:generate games against the current network,at every state, run PUCT-guided MCTS,store (st,πMCTS,t,zt),fit the policy head to search visit counts,fit the value head to terminal outcomes.Use the improved network to guide the next search.
The loop is
fθkMCTSπkself-playDktrainingfθk+1.
Search improves the network locally; training distills those improvements globally; the stronger network then makes the next search more efficient.
Self-play also creates a moving curriculum. The opponent improves with the learner, keeping states and outcomes informative without human move labels. This works especially well when the environment supplies exact rules, legal actions, terminal outcomes, and unlimited simulated experience.
When Planning Is Worth the Cost
Planning trades latency for decision quality. Approximate costs make the contrast concrete:
policy:CEM:MCTS:O(one network pass),O(NBHJ) model steps,O(KD) model steps,
where J is the number of CEM iterations, K the number of tree simulations, and D their average depth.
Trajectory optimization and CEM are natural for continuous actions:
at∈Rda.
MCTS is natural when actions are discrete, legal moves can be enumerated, and the branching factor is manageable. A continuous action space has infinitely many potential children, so ordinary visit-count search needs additional action sampling or progressive widening.
Planning is most attractive when individual decisions are valuable, model queries are cheap, computation is available between actions, and similar states do not recur often enough to justify solving everything in advance.
A learned policy is preferable when latency is strict or the same decision structure is repeated at massive scale. In practice, the strongest compromise is often
learned policy and value+ limited online search.
The policy supplies breadth, the value function supplies depth, and planning spends the remaining budget only on branches relevant to the state in front of us.