1. Home
  2. Explore
  3. Computer Science
  4. Value Functions and Q Functions

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Value Functions and Q Functions

  • 37Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Value Functions and Policy Gradient Recap
  • spaceFlip card
  • KI knew it
  • DI didn't know it
  • ←Previous card
  • →Next card

What is the definition of a value function Vπ(s)V^\pi(s)Vπ(s) in reinforcement learning?

Tap to flipClick to flipspace

The expected sum of future discounted rewards starting from state sss and following policy π\piπ: Vπ(s)=E[∑t=0∞γtrt∣s0=s,π]V^\pi(s) = \mathbb{E}\left[\sum_{t=0}^{\infty} \gamma^t r_t \mid s_0 = s, \pi\right]Vπ(s)=E[∑t=0∞​γtrt​∣s0​=s,π].

Or swipe the card

37 cards

  1. What is the definition of a value function Vπ(s)V^\pi(s)Vπ(s) in reinforcement learning?

    The expected sum of future discounted rewards starting from state sss and following policy π\piπ: Vπ(s)=E[∑t=0∞γtrt∣s0=s,π]V^\pi(s) = \mathbb{E}\left[\sum_{t=0}^{\infty} \gamma^t r_t \mid s_0 = s, \pi\right]Vπ(s)=E[∑t=0∞​γtrt​∣s0​=s,π].

  2. What is the definition of a QQQ-function Qπ(s,a)Q^\pi(s,a)Qπ(s,a)?

    The expected sum of future discounted rewards after taking action aaa in state sss and then following policy π\piπ: Qπ(s,a)=E[∑t=0∞γtrt∣s0=s,a0=a,π]Q^\pi(s,a) = \mathbb{E}\left[\sum_{t=0}^{\infty} \gamma^t r_t \mid s_0 = s, a_0 = a, \pi\right]Qπ(s,a)=E[∑t=0∞​γtrt​∣s0​=s,a0​=a,π].

  3. In policy gradient methods, how is the policy updated?

    By increasing the log-likelihood of actions that lead to higher rewards, often using a baseline to reduce variance: ∇log⁡π(a∣s)⋅(R−b)\nabla \log \pi(a|s) \cdot (R - b)∇logπ(a∣s)⋅(R−b), where RRR is the return and bbb is a baseline.

  4. What is the role of a baseline in policy gradient?

    To reduce the variance of the gradient estimate without introducing bias, typically an estimate of the value function.

  5. How does actor-critic combine policy gradient and value function learning?

    The actor updates the policy using a gradient that incorporates a QQQ-function (the critic), which reduces variance compared to REINFORCE.

  6. In value-based RL, how can you derive a policy from a QQQ-function?

    Define a deterministic policy π′(s)=arg⁡max⁡aQπ(s,a)\pi'(s) = \arg\max_a Q^\pi(s,a)π′(s)=argmaxa​Qπ(s,a) that picks the action with the highest QQQ value.

  7. Is the greedy policy derived from QπQ^\piQπ always optimal? Why or why not?

    Not necessarily. In the navigation example, the greedy policy only improved in regions where QπQ^\piQπ was non-zero; from starting states, it still followed the original, suboptimal policy.

  8. What does the policy improvement theorem state?

    The greedy policy with respect to QπQ^\piQπ is at least as good as π\piπ, i.e., Vπ′(s)≥Vπ(s)V^{\pi'}(s) \geq V^{\pi}(s)Vπ′(s)≥Vπ(s) for all states.

  9. What are the two steps of policy iteration?

    Policy evaluation (estimate QπQ^\piQπ) and policy improvement (set π′\pi'π′ to greedy policy w.r.t. QπQ^\piQπ).

  10. How is policy evaluation performed in QQQ-learning?

    By fitting a QQQ-function using the Bellman equation as a target: Q(s,a)≈r+γEs′[max⁡a′Q(s′,a′)]Q(s,a) \approx r + \gamma \mathbb{E}_{s'}[ \max_{a'} Q(s',a') ]Q(s,a)≈r+γEs′​[maxa′​Q(s′,a′)].

  11. Write the Bellman equation for the QQQ-function of a policy π\piπ.

    Qπ(s,a)=r(s,a)+γEs′∼p,a′∼π[Qπ(s′,a′)]Q^\pi(s,a) = r(s,a) + \gamma \mathbb{E}_{s' \sim p, a' \sim \pi}[Q^\pi(s',a')]Qπ(s,a)=r(s,a)+γEs′∼p,a′∼π​[Qπ(s′,a′)].

  12. Write the Bellman optimality equation for the optimal QQQ-function Q∗Q^*Q∗.

    Q∗(s,a)=r(s,a)+γEs′∼p[max⁡a′Q∗(s′,a′)]Q^*(s,a) = r(s,a) + \gamma \mathbb{E}_{s' \sim p}[\max_{a'} Q^*(s',a')]Q∗(s,a)=r(s,a)+γEs′∼p​[maxa′​Q∗(s′,a′)].

  13. What does the Bellman optimality equation represent?

    A condition that uniquely characterizes the optimal QQQ-function; if QQQ satisfies it, then the policy π(s)=arg⁡max⁡aQ(s,a)\pi(s) = \arg\max_a Q(s,a)π(s)=argmaxa​Q(s,a) is optimal.

  14. What is the QQQ-learning update rule in tabular form?

    Q(s,a)←Q(s,a)+α[r+γmax⁡a′Q(s′,a′)−Q(s,a)]Q(s,a) \leftarrow Q(s,a) + \alpha \left[ r + \gamma \max_{a'} Q(s',a') - Q(s,a) \right]Q(s,a)←Q(s,a)+α[r+γmaxa′​Q(s′,a′)−Q(s,a)].

  15. Is QQQ-learning an on-policy or off-policy algorithm? Why?

    Off-policy, because the update uses the max over actions, which may not correspond to the policy that generated the data.

  16. Under what conditions does tabular QQQ-learning converge to the optimal QQQ-function?

    If all state-action pairs are visited infinitely often (sufficient exploration) and the learning rate decays appropriately.

  17. Does QQQ-learning with function approximation always converge? Why or why not?

    No, it can diverge, especially with neural networks, because the moving target and max operation create a non-stationary optimization.

  18. What is ϵ\epsilonϵ-greedy exploration in QQQ-learning?

    With probability ϵ\epsilonϵ, take a random action; otherwise take the greedy action arg⁡max⁡aQ(s,a)\arg\max_a Q(s,a)argmaxa​Q(s,a).

  19. What is Boltzmann (softmax) exploration?

    Sample actions with probability proportional to exp⁡(Q(s,a)/τ)\exp(Q(s,a) / \tau)exp(Q(s,a)/τ), where τ\tauτ is a temperature parameter.

  20. Why is exploration important in QQQ-learning?

    To ensure that all actions are sampled enough for the max operation to be accurate; otherwise, overestimation can occur due to noisy QQQ estimates for unsampled actions.

  21. What is the purpose of a replay buffer in DQN?

    To store past transitions (s,a,r,s′)(s, a, r, s')(s,a,r,s′) and sample i.i.d. batches during training, reducing correlation between consecutive updates.

  22. What is the purpose of a target network in DQN?

    To provide fixed targets for QQQ-learning updates, making the learning problem stationary and more stable.

  23. How often is the target network updated in DQN?

    Periodically, e.g., every CCC gradient steps (commonly every 100 or 1000 steps).

  24. What is the loss function used in DQN?

    Mean squared error: L=E[(r+γmax⁡a′Qtarget(s′,a′)−Qcurrent(s,a))2]\mathcal{L} = \mathbb{E}\left[ \left( r + \gamma \max_{a'} Q_{\text{target}}(s',a') - Q_{\text{current}}(s,a) \right)^2 \right]L=E[(r+γmaxa′​Qtarget​(s′,a′)−Qcurrent​(s,a))2].

  25. Why might the QQQ-learning loss increase during training, even when the policy is improving?

    Because QQQ values scale up as the agent accumulates higher returns, so the magnitude of the loss increases naturally.

  26. What causes overestimation in QQQ-learning?

    The max operation over noisy QQQ values tends to select actions with inflated estimates, leading to systematic overestimation.

  27. How does double DQN reduce overestimation?

    By using the current QQQ network to select the action and the target network to evaluate it, decorrelating the noise: amax=arg⁡max⁡aQcurrent(s′,a)a^{\text{max}} = \arg\max_a Q_{\text{current}}(s',a)amax=argmaxa​Qcurrent​(s′,a), then target =r+γQtarget(s′,amax)= r + \gamma Q_{\text{target}}(s', a^{\text{max}})=r+γQtarget​(s′,amax).

  28. In double DQN, which QQQ network is used to select the action and which is used to evaluate it?

    The current (online) network selects the action; the target network evaluates it.

  29. What is the nnn-step return target for QQQ-learning?

    target=∑i=0n−1γirt+i+γnmax⁡aQ(st+n,a)\text{target} = \sum_{i=0}^{n-1} \gamma^i r_{t+i} + \gamma^n \max_a Q(s_{t+n}, a)target=∑i=0n−1​γirt+i​+γnmaxa​Q(st+n​,a).

  30. What is a potential issue with using nnn-step returns in QQQ-learning when the data is off-policy?

    The rewards in the nnn-step return come from the behavior policy, not the optimal policy, introducing bias.

  31. How is the off-policy issue of nnn-step returns commonly handled in practice?

    Often ignored; alternatives include dynamic nnn or using only data where actions match the greedy policy.

  32. When is PPO a good choice for reinforcement learning?

    When stability and ease of use are priorities and data efficiency is not critical.

  33. When is DQN a suitable algorithm?

    For problems with discrete action spaces; it is data-efficient and works well with low-dimensional action spaces.

  34. When is Soft Actor-Critic (SAC) preferred?

    When data efficiency is most important, especially for continuous action spaces, though it requires more tuning.

  35. How can QQQ-learning be applied to continuous action spaces?

    By optimizing over actions using methods like sampling, gradient ascent, or cross-entropy method to find max⁡aQ(s,a)\max_a Q(s,a)maxa​Q(s,a).

  36. What was a landmark achievement of DQN in 2013?

    Achieving human-level performance on many Atari games using only pixel inputs.

  37. Give an example of QQQ-learning applied to robotics.

    Robot grasping, where a DQN-based system achieved 96% success rate in grasping objects.

Card 1 of 37
Card 1 of 37

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent