VKVlad KulikovPublic / lectures
RL for LLM6 / 13

Module 6. The LLM as a policy: tokens, log-probabilities, and KL

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 / 2 · Correct: 0

Question P01 · A stop-reason matrix

For each row, assign terminated, truncated, and a justification: (a) the model selects EOS and the task treats it as response completion; (b) a length limit is reached; (c) an external timeout fires at the same instant as a genuine task success; (d) the engine returns an unknown server_cancelled reason. May the final row be silently classified as terminal?

Question P02 · EOS in the action and in displayed text

A model samples [17, 42, EOS], while the UI shows only the first two tokens. Which tokens belong to the policy action, and which belong to the displayed text? Why does removing EOS before computing old_logprob change the mathematical object?

Question P03 · Diagnosing causal alignment

For tokens [BOS, A, B], a log stores logits at positions [0,1,2] against targets [BOS,A,B]. Identify two errors and write the correct alignment.

Question P04 · Why perplexity changed with the mask

One implementation computes PPL over four response tokens. Another also includes two highly predictable prompt tokens and reports a lower PPL. Does this establish a better response policy?

Question P05 · Three log-probability roles

Match old_logprobs, current_logprobs, and ref_logprobs to their PPO/KL roles. Which must remain fixed across several update epochs on one rollout batch?

Question P06 · Exact KL versus one signed sample

For one token, log π=-3.0 and log π_ref=-2.5, so log π-log π_ref is negative. What follows, and what does not?

Only your selection or numeric part is checked automatically. Compare your reasoning with the author’s worked answer.

Question P07 · A counterexample to unconditional k3

Let q=(1,0)q=(1,0) and p=(0.8,0.2)p=(0.8,0.2). Compute Eq[p/q]\mathbb E_q[p/q] on the observable support and explain why the control variate no longer has zero mean.

Only your selection or numeric part is checked automatically. Compare your reasoning with the author’s worked answer.

Question P08 · Light and heavy ratio tails

Two problems have a small exact KL, but the second contains a rare action with a large p/qp/q. Why can k3 have much larger variance even though every k3 sample is non-negative?

Question P09 · Temperature and stored old log-probability

Generation divides logits by T=2T=2, but old_logprob is stored from the T=1T=1 softmax. What happens to the PPO ratio even if model weights never change?

Question P10 · The order of top-k and top-p

Why is storing only top_k=2 and top_p=0.7 insufficient? Give an example in which processor order changes the support.

Question P11 · Find the rollout-contract defect

A batch stores rendered text, reward, and current log-probabilities, but omits token IDs, response mask, policy version, and stop reason. Name at least four operations that become impossible or unreliable.

Question P12 · Tool tokens and the response mask

A model emits a tool call, the environment inserts search results, and the model continues. Which tokens are policy actions and which are environment observations? How should the policy-loss mask behave?