MLCrack

    REINFORCEMENT LEARNING ยท INTERVIEW QUESTION

    What are value functions and how do they relate to reinforcement learning policies?

    ๐ŸŸก intermediate ยท Fundamentals & MDPs

    Hint: V(s) and Q(s,a) evaluate how good states/actions are under a given policy.

    Answer

    Value functions estimate expected future reward, providing a way to evaluate and compare policies.

    State-Value Function

    Vฯ€(s)=Eฯ€[โˆ‘k=0โˆžฮณkrt+k+1โˆฃSt=s]V^\pi(s) = \mathbb{E}_\pi\left[\sum_{k=0}^{\infty} \gamma^k r_{t+k+1} \mid S_t = s\right]

    How good is it to be in state ss under policy ฯ€\pi?

    Action-Value Function

    Qฯ€(s,a)=Eฯ€[โˆ‘k=0โˆžฮณkrt+k+1โˆฃSt=s,At=a]Q^\pi(s,a) = \mathbb{E}_\pi\left[\sum_{k=0}^{\infty} \gamma^k r_{t+k+1} \mid S_t = s, A_t = a\right]

    How good is taking action aa in state ss under ฯ€\pi?

    Relationship

    Vฯ€(s)=โˆ‘aฯ€(aโˆฃs)Qฯ€(s,a)V^\pi(s) = \sum_a \pi(a|s) Q^\pi(s,a)

    In Practice

    • Value-based methods (DQN): Learn Qโˆ—Q^* โ†’ derive optimal policy
    • Policy gradient methods (PPO): Use VV as baseline for variance reduction
    • Actor-critic: Actor uses policy, critic estimates VV or QQ

    The advantage function A(s,a)=Q(s,a)โˆ’V(s)A(s,a) = Q(s,a) - V(s) measures how much better an action is compared to the average.