Learning which action to take

David I. Inouye

Dynamic Content · Last Updated: November 18, 2026

How can we formalize the choice of Netflix artwork?

Six Dragons banners, A through C across the top and D through F across the bottom.

Pick a banner for the first viewer. Suppose you show C and they press play. For the next viewer, would you show C again or try another banner?

Our goal is to get as many viewers as possible to start the title within ten minutes.

The \(K\)-armed bandit problem is to maximize cumulative reward

Environment. Each arm \(a\in\{1,\ldots,K\}\) has a fixed, unknown reward distribution \(P_a\) with mean \(q(a)\). Here \(K=6\) and a reward is either 0 or 1.

Interaction. On round \(t\), the policy chooses \(A_t\) using past actions and rewards. The environment draws \(R_t\sim P_{A_t}\). The learner observes \((A_t,R_t)\).

Objective. Choose a policy \(\pi\) that maximizes \(\mathbb{E}_{\pi}\!\left[\sum_{t=1}^{T}R_t\right]\) over \(T\) rounds.

Learning counts toward the objective. Every trial earns a reward while supplying evidence for later decisions.

Bandits simplify RL to one state while retaining trial-and-error learning

Stationary bandit Sequential RL example
Decision Pick a banner for a fresh viewer. Pick a banner, then a trailer if the title page opens.
State One situation. All six arms are available each round. The banner affects which situation and actions come next.
Value of a choice Expected reward from this arm. Expected return, including rewards from later decisions.

Bandits isolate learning from evaluative feedback. The learner still chooses, receives reward, and explores under uncertainty. A single state removes the need to plan through transitions.

Supervised action labels are instructive. Bandit rewards are evaluative.

Suppose the learner chooses C. Compare the records two training setups could supply.

Training setup Feedback for this choice What can the learner infer?
Supervised action prediction Target label E C differs from the supplied target. Predicting A would give the same label.
Bandit Shown C, observed play (1) C earned 1. The outcomes for A, B, D, E and F are missing.

Instructive feedback specifies a target action. Evaluative feedback scores the action taken. A high reward on one trial does not identify the best action.

The value of an action is its expected reward

Six Dragons banners, A through C across the top and D through F across the bottom.

Banner A B C D E F
Hidden play probability 6% 8% 10% 7% 12% 9%

E has the highest mean. On any one impression it still earns zero with probability 88%.

Action value \(q(a)=\mathbb E_{R\sim P_a}[R]\) is the expected reward for choosing arm \(a\). One observed reward is a draw from that distribution.

A sample average estimates action value

Suppose C and E both have a 10% observed play rate. Update the sample means as two more viewers arrive.

Round Banner Reward C plays / trials E plays / trials
Before — — 1/10 = 10% 10/100 = 10%
Next C 1 2/11 ≈ 18.2% 10/100 = 10%
Following E 1 2/11 ≈ 18.2% 11/101 ≈ 10.9%

Uncertainty about value depends on the evidence behind the estimate. More independent trials sharpen a mean estimate. Individual rewards can still vary.

A greedy policy can be suboptimal when its value estimates are inaccurate

Try each banner once, then always choose the highest sample mean. Suppose only A gets an initial play.

Observations so far A B C D E F Next
One trial per arm 1/1 0/1 0/1 0/1 0/1 0/1 A
A earns 0 1/2 0/1 0/1 0/1 0/1 0/1 A
A earns nine more zeros 1/11 0/1 0/1 0/1 0/1 0/1 A

The policy controls its own training data. Greedy exploitation can leave a better arm permanently underexplored.

When is trying an uncertain banner worth it?

C has the highest estimated play rate. E has had few impressions. When is trying E most valuable?

A. Many similar viewers will arrive.

B. All six banners will be replaced tomorrow, before the next viewer.

C. This is the final viewer.

A. Exploration has value when information can improve future decisions. A longer horizon gives the learner more chances to use what it learns.

Exploration gives other banners a chance to earn a play

  • Greedy starts each estimate at zero and chooses a highest estimate.
  • Optimistic greedy starts each estimate at one. An early failure lowers that estimate, so an untried banner becomes more attractive.
  • Epsilon-greedy usually chooses a leader and otherwise samples uniformly. Compare exploration probabilities 0.05 and 0.20 against the uniform random baseline.

Which policies learn to show banner E more often?

Share of choices going to E across rounds for five policies.

Early trials can correct a misleading estimate. Uniform sampling keeps choosing E about once every six rounds.

Bandit feedback can be delayed even when only one action earns the reward

Time Event Reward for showing E E plays / completed trials
4:00 Show E Pending 10/100
4:03 No play yet Pending 10/100
4:08 Viewer presses play 1 11/101

If the ten-minute window had closed without a play, the update would be 10/101.

Feedback delay changes when an estimate can be updated. With one action per viewer, the eventual reward still has a known action to evaluate.

When does a banner choice become a sequential decision?

A contextual bandit can choose a different banner for each audience

Suppose half the viewers are new and half are returning. Before showing a banner, we learn which group the viewer belongs to.

Hypothetical play rate Banner C Banner E
New viewer 14% 6%
Returning viewer 6% 18%
All viewers 10% 12%

Always showing E gives 12 plays per 100 viewers on average. Showing C to new viewers and E to returning viewers gives 7 + 9 = 16.

Context changes which action has the highest expected reward. The learner still makes one choice per viewer and observes only that choice’s reward.

A banner can change which decision comes next

Now the viewer can open the title page. Netflix chooses a trailer only if the page opens. A play still earns 1.

Possible path after showing C Next decision Final reward
Viewer leaves Visit ends 0
Viewer opens the page Show the action trailer → viewer leaves 0
Viewer opens the page Show the comedy trailer → viewer plays 1

To judge banner C, we need to know how often it gets viewers to the page and what happens under the trailer policy once they arrive.

Sequential RL tracks how actions change the next state. An action’s value includes rewards earned after later decisions.

One visit gives a sequence of states, actions and rewards

Suppose a viewer sees banner E, opens the title page, watches the comedy trailer and presses play.

Step State before the choice Action Netflix takes Next state Reward
0 Browsing Show E On title page 0
1 On title page Show comedy trailer Visit ended 1

The viewer’s response determines where the visit goes. A viewer who leaves after E ends the visit at step 0 with reward 0.

A trajectory records the interaction in order. From state \(\textnormal{S}_t\), the agent chooses \(\textnormal{A}_t\), then observes \(\textnormal{S}_{t+1}\) and \(\textnormal{R}_{t+1}\).

A state must retain the history that matters for prediction

Two viewers reach the same title page, one through C and one through E. Both see the comedy trailer.

Suppose earlier artwork… What state would we use on the page?
Has no further effect on how viewers respond On title page can describe both visits.
Still affects which trailer a viewer responds to Keep on title page after C and on title page after E distinct.

The Markov assumption says that given the current state and action, earlier history adds no information about the distribution of the next state and reward.

The policy chooses a banner while browsing and a trailer on the page

① Our choice · Browsing → show E. On the page → choose comedy with probability ½, otherwise action.

② Viewer response · After E, 30% reach the page and 70% leave. Either outcome earns 0 immediately.

③ Reward and next state · Both trailers end the visit. Comedy earns a play with probability 0.50 and action with probability 0.40.

Two distributions generate a visit, starting from an initial state

Start with \(S_0\sim\rho_0\), where \(\rho_0(s)\) is the probability of starting in state \(s\). Here every visit starts in browsing.

① The agent controls the policy \(\pi(a\mid s)=\Pr(A_t=a\mid S_t=s)\).

②③ The environment supplies the dynamics \(p(s',r\mid s,a)=\Pr(S_{t+1}=s',R_{t+1}=r\mid S_t=s,A_t=a)\).

The MDP specifies states, available actions and environment dynamics. Choosing a policy determines how the agent interacts with it.

Repeating the two draws defines a trajectory

\[S_0 \xrightarrow{\pi} A_0 \xrightarrow{p} (R_1,S_1) \xrightarrow{\pi} A_1 \xrightarrow{p} (R_2,S_2)\longrightarrow\cdots\]

① The current state determines which action distribution to use.
② The current state and chosen action determine the next outcome distribution.
③ The next state and reward are drawn jointly. The next state becomes the input for the following choice.

An episode stops at a terminal state. A continuing task can generate an infinite sequence.

Multiply the policy and environment probabilities along one visit

Path: browsing → E → page (0) → comedy → ended (1).

\[\begin{aligned} \Pr(\text{this path})={}&\rho_0(\text{browsing})\,\pi(E\mid\text{browsing})\,p(\text{page},0\mid\text{browsing},E)\\ &\times\pi(\text{comedy}\mid\text{page})\,p(\text{ended},1\mid\text{page},\text{comedy})\\ ={}&1\times1\times0.30\times0.50\times0.50=0.075. \end{aligned}\]

About 7.5% of visits follow this exact path. Plays after the action trailer follow another path.

Choose the policy with the highest expected return from the start

The return from time \(t\) is the discounted sum of future rewards: \[G_t=\sum_{k=0}^{T-t-1}\gamma^k R_{t+k+1},\qquad \pi^*\in\arg\max_\pi\mathbb E_{S_0\sim\rho_0,\,\pi,\,p}[G_0].\]

Which trailer policy earns more plays? With \(\gamma=1\), always showing comedy earns \(0.30(0.50)=0.15\) expected plays per visit. Mixing trailers equally earns \(0.30[0.5(0.50)+0.5(0.40)]=0.135\).

Discount sets the weight on later rewards. Bounded episodes can use \(\gamma=1\). For continuing tasks with bounded rewards, \(0\le\gamma<1\) guarantees a finite discounted sum.

Reinforcement learning uses experience to improve the policy

Hide the probability table. Suppose we try E on 100 visits and show comedy every time the page opens.

Evidence in this hypothetical log Estimate
28 of 100 visits reach the page \(28/100=0.28\)
13 of those 28 end in play \(13/28\approx0.46\)
Total plays under this policy \(13/100=0.13\) per visit

What evidence do we have about the action trailer? This log contains no trials of it.

With known dynamics, we can plan using the model. In reinforcement learning, we use sampled experience to learn a policy that earns high expected return.

Which visits can share a state?

Viewers reaching the page through C and E respond differently to the same trailer.

What should the page state include?

A. Page location and the eventual play reward

B. Page location and earlier banner

C. Page location only

B. Retain the known history that changes the next-outcome distribution. The eventual reward is not yet observed.