VKVlad KulikovPublic / lectures
RL for LLM3 / 13

Module 3. Bandits, exploration, and one-step decisions

Choose your answers and select “Check”. Numbers accept a decimal point, comma, or simple fraction. Answers and drafts are saved in this browser and shared between RU/EN.

Use the author’s worked answers to review open questions and code tasks yourself. Code does not run on this site.

Checked: 0 / 10 · Correct: 0

Question P01 · Why "pseudo"

single answer

Pseudo-regret RˉT=E[∑t(μ∗−μAt)]\bar R_T = \mathbb{E}\left[\sum_t (\mu^* - \mu_{A_t})\right] is not so named because it is fake. What does the prefix mean?

One correct option

Question P02 · Regret from gaps and pull counts

numeric answer · tolerance ±0.5

Three arms with gaps Δ=(0, 0.1, 0.3)\Delta = (0,\ 0.1,\ 0.3) were pulled on average E[Na(T)]=(700, 200, 100)\mathbb{E}[N_a(T)] = (700,\ 200,\ 100) times.

What is the expected regret RT=∑aΔaE[Na(T)]R_T = \sum_a \Delta_a \mathbb{E}[N_a(T)]?

Question P03 · The limits of the UCB1 guarantee

single answer

The UCB1 bound gives RT≤8log⁡T∑a:Δa>01/Δa+constR_T \le 8\log T \sum_{a:\Delta_a>0} 1/\Delta_a + \text{const}. What follows from it, and what does not?

One correct option

Question P04 · What transfers from UCB and Thompson

single answer

The module warns against porting bandit recipes to LLMs directly. Which transfer does it call useful?

One correct option

Question P05 · Conditions for IPS unbiasedness

multiple answers

Which conditions are needed for V^IPS\widehat V_{\mathrm{IPS}} to be unbiased? Select all that apply.

Select all correct options

Question P06 · IPS, SNIPS and the effective sample size

coding task

Specification: weights wi=π(ai∣xi)/μ(ai∣xi)w_i = \pi(a_i\mid x_i)/\mu(a_i\mid x_i). V^IPS=1n∑iwiri\widehat V_{\mathrm{IPS}} = \frac1n\sum_i w_i r_i; V^SNIPS=∑iwiri/∑iwi\widehat V_{\mathrm{SNIPS}} = \sum_i w_i r_i / \sum_i w_i; Kish effective sample size ESS=(∑iwi)2/∑iwi2\mathrm{ESS} = (\sum_i w_i)^2/\sum_i w_i^2.

Input format: line 1 — the number of records nn; then nn lines of r mu pi. Output format: lines 1–3 — IPS, SNIPS and ESS (4 decimals).

Starter code:

import numpy as np

def offline_estimates(rewards, behavior, target):
    """Return (ips, snips, ess)."""
    # YOUR CODE HERE
    raise NotImplementedError

if __name__ == "__main__":
    n = int(input())
    rows = [tuple(float(x) for x in input().split()) for _ in range(n)]
    r = [row[0] for row in rows]
    mu = [row[1] for row in rows]
    pi = [row[2] for row in rows]
    ips, snips, ess = offline_estimates(r, mu, pi)
    for value in (ips, snips, ess):
        print(f"{value:.4f}")

Open tests:

stdinstdout
3 ⏎ 1 0.2 0.6 ⏎ 0 0.5 0.1 ⏎ 1 0.3 0.31.3333 ⏎ 0.9524 ⏎ 1.7570
2 ⏎ 1 0.5 0.5 ⏎ 0 0.5 0.50.5000 ⏎ 0.5000 ⏎ 2.0000

Question P07 · What double robustness does not give

single answer

The DR estimator stays consistent if at least one of the two models is correct. What can it still not do?

One correct option

Question P08 · Generation temperature versus training exploration

single answer

Why can raising the decoding temperature not be called exploration in the RL sense?

One correct option

Question P09 · How many candidates Best-of-N needs

numeric answer · tolerance ±0.5

Each independent candidate succeeds with probability p=0.15p = 0.15, and the verifier detects success without error.

What is the minimum number of candidates for a success probability of at least 0.950.95?

Question P10 · Why Best-of-N is not a bandit

single answer

Why is ordinary Best-of-N with a frozen LLM not a standard online multi-armed bandit?

One correct option

Question P11 · The unbiased pass@k estimator

coding task

Specification: a task produced nn programs of which cc passed the tests, n≥kn \ge k. The finite-sample estimator is pass@⁡k^=1−(n−ck)/(nk)\widehat{\operatorname{pass@}k} = 1 - \binom{n-c}{k}\big/\binom{n}{k}, with (mk)=0\binom{m}{k} = 0 for m<km < k.

Input format: one line — nn, cc, kk. Output format: one line — the estimate (6 decimals).

Starter code:

from math import comb

def pass_at_k(n: int, c: int, k: int) -> float:
    # YOUR CODE HERE
    raise NotImplementedError

if __name__ == "__main__":
    n, c, k = (int(x) for x in input().split())
    print(f"{pass_at_k(n, c, k):.6f}")

Open tests:

stdinstdout
10 3 40.833333
8 2 20.464286
5 0 30.000000
6 6 21.000000

Question P12 · Entropy collapse: observation or theorem

single answer

A 2026 preprint reports a substantial entropy drop across several RLVR configurations on mathematics. How does the course ask you to read that?

One correct option