VKVlad KulikovPublic / lectures
RL for LLM5 / 13

Module 5. Learning from fixed data: imitation, deep Q-methods, and offline RL

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

Question P01 · Terminal transition versus external truncation

A transition has reward r=0.2r=0.2, γ=0.95\gamma=0.95, and max⁡a′Qθ−(s′,a′)=1.6\max_{a'}Q_{\theta^-}(s',a')=1.6.

  1. Compute the DQN target after a true terminal trap.
  2. Compute the target when collection stops at an external time limit, s′s' is observed, and the task could continue.
  3. Explain why a single done=True flag can corrupt learning.

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

Question P02 · Map the support of a fixed log

At state ss, a log contains 900 left transitions, 100 up transitions, and no right or down transitions. A Q-network outputs

Q(s,⋅)=(0.4, 0.3, 2.8, 2.1)Q(s,\cdot)=(0.4,\ 0.3,\ 2.8,\ 2.1)

in the order left, up, right, down.

Which actions are empirically supported? What does a naive greedy policy choose? What extra assumption would be required to trust right?

Question P03 · Replay memory is not a fixed offline dataset

Two systems train from one million transitions.

  • System A keeps interacting, evicts old replay entries, and adds new ones.
  • System B receives one immutable file and never runs the environment while training.

Both use the same DQN target. Which system is offline RL, and why does the common local loss not make the regimes equivalent?

Question P04 · What feedback standard DAgger requires

For each signal, decide whether it is sufficient for a standard DAgger iteration:

Why does the phrase “feedback on current-policy behavior” not make all four algorithms identical?

One correct option

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

Question P05 · Find the sign error in a CQL penalty

The function below operates on one state. q_values contains all action values and logged_action is the dataset action.

import numpy as np

def cql_penalty_bad(q_values: np.ndarray, logged_action: int) -> float:
    q = np.asarray(q_values, dtype=float)
    return float(np.log(np.exp(q).sum()) + q[logged_action])
  1. Find the sign error.
  2. Make the computation numerically stable.
  3. Explain why this term alone is not a full CQL algorithm.

Question P06 · An expectile above the mean

For one state, dataset-action values are Q=(0,1,4)Q=(0,1,4). Let V=1V=1 and τ=0.8\tau=0.8.

  1. Compute the weighted squared residuals.
  2. Which way will VV move?
  3. Why is this not the same as taking the maximum 4?

Question P07 · One FQE target

At the next state, the evaluation policy chooses two actions with probabilities (0.25,0.75)(0.25,0.75). The target Q-model outputs (2,4)(2,4). The transition has r=−0.1r=-0.1, γ=0.9\gamma=0.9, and is non-terminal.

  1. Compute the FQE target.
  2. Compare it with a Q-learning target.
  3. What changes at a true terminal?

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

Question P08 · A Decision Transformer target outside the data

Training return-to-go values lie between −1-1 and 11. Deployment requests G1target=20G_1^{\mathrm{target}}=20.

Name three possible outcomes. Which one is guaranteed by the DT training loss, and how should the regime be tested?

Question P09 · Causal leakage in Decision Transformer

A preprocessing pipeline feeds current return-to-go, state, the current correct action, and asks the model to predict that same action.

Why is training accuracy misleading? What causal shift is required?

Question P10 · Match data to method

Match each dataset to the most direct baseline objective: SFT/BC, classical offline RL, DPO, or ILQL.

  1. a prompt and one demonstration response without reward;
  2. preferred/rejected response pairs;
  3. prefix–token sequences with an outcome reward;
  4. environment transitions (s,a,r,s′)(s,a,r,s').

For each, name one object absent from the other settings.

Match each item to an answer

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

Question P11 · Hidden tests for a behavior-support mask

A student implements

def behavior_support_mask(probabilities, threshold):
    """Return a Boolean mask for actions whose behavior probability is supported."""

Propose at least six hidden tests that reject return probabilities > 0 and constant masks.

Question P12 · Report an internal experiment without overclaiming

In one pinned run, naive offline DQN solved no episodes while CQL and IQL solved all episodes. Choose the defensible statement and reject the others.

One correct option

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