5.1.5 · HinglishReinforcement Learning Foundations

Bellman equations

2,374 words11 min readRead in English

5.1.5 · AI-ML › Reinforcement Learning Foundations

WHY they matter: RL mein, ek agent ko ye jaanna hota hai ki "ye state kitni achi hai?" ya "ye action kitna acha hai?". Bellman equations hame in values ko bootstrapping se compute karne ka tarika deti hain—future values ke estimates use karke current estimates ko improve karna. Ye iska core dynamic programming hai.

WHAT they describe: Kisi bhi state ya action pair se expected return (cumulative discounted reward), jo immediate reward aur successor states ki value ke terms mein express hota hai.

HOW they work: Infinite-horizon value ko one-step reward + discounted future value mein decompose karke, hum ek intractable sum ko ek recursive formula mein badal dete hain jise iteratively solve kiya ja sakta hai.


Derivation from First Principles

jahan discount factor hai, time par reward hai, aur expectation policy se generate kiye gaye trajectories par hai.

WHY this definition? Hame long-term cumulative reward ki parwah hai, lekin door ke rewards kam matter karte hain (discount factor). Expectation environment aur policy dono mein stochasticity ko account karta hai.


Bellman Equation for (State Value)

Goal: ko recursively express karna.

Step 1: Return sum ko expand karo:

Step 2: Pehle reward ko factor out karo:

Why this step? Hum immediate reward (jo abhi hota hai) ko future rewards (jo is par depend karte hain ki hum aage kahan jaate hain) se alag kar rahe hain.

Step 3: Recognize karo ki doosra term next state ki discounted value hai:

Step 4: Actions aur transitions par expectation expand karo: Policy hame deti hai, dynamics hame dete hain:

Interpretation: Policy ke under state ki value, expected immediate reward plus discounted next-state value ka weighted average (un actions par jo choose karta hai) ke barabar hai.


Bellman Equation for (Action Value)

WHY? Kabhi kabhi hame specific actions evaluate karne hote hain (jaise Q-learning mein). hame batata hai ki "state mein action kitna acha hai?".

Derivation:

Step 1: Pehle action lene par condition karo:

Why? lene ke baad, hum par transition karte hain aur phir policy follow karte hain, jo hame deta hai.

Step 2: Environment dynamics par expand karo:

Step 3: ko ke terms mein express karo:

Step 4: Wapas substitute karo:


Bellman Optimality Equations

GOAL: Sabse best possible policy aur uske value functions aur dhundna.

KEY INSIGHT: Optimal policy ya ke respect mein greedy hoti hai:

Derivation of Bellman Optimality for :

Step 1: Optimal policy best action choose karti hai:

Step 2: definition substitute karo:

Why the max? Hum ab koi fixed policy follow nahi kar rahe—hum wo action choose kar rahe hain jo har step par value maximize kare.

Derivation of Bellman Optimality for :


Worked Examples

Bellman equation use karke compute karo.

Step 1: ke liye Bellman equation likho:

Step 2: Assume karo ki right move karke ya down move karke ja sakta hai, aur walls se takraane par wahi rehta hai:

  • Action "right": par jaata hai, reward
  • Action "down": par jaata hai, reward
  • Actions "left", "up": par hi rehta hai, reward

Step 3: Substitute karo:

Why this step? Uniform policy ke under har action ki probability 0.25 hai. Hum saare actions aur unke outcomes par sum karte hain.

Step 4: Simplify karo (symmetry assume karte hue ):

Result: Ye linear equations ka ek system hai. Iteratively ya exactly solve karne par value milti hai. Bellman equation ne ek sequential problem ko ek algebraic problem mein badal diya.


Bellman optimality equation ko update ke roop mein apply karo:

Step 1: Bellman optimality kehti hai:

Step 2: Hame ek sample mila, toh temporal difference target hai:

Why? Ye is experience ke base par "true" ka hamara bootstrapped estimate hai.

Step 3: ko target ki taraf update karo (learning rate ke saath):

Interpretation: ka hamara estimate Bellman optimality equation se predict ki gayi value ki taraf move karke improve hua.


Common Mistakes

Why it feels right: Simple lagta hai—bas rewards add karo.

The problem: Discounting ke bina, infinite-horizon returns diverge ho jaate hain. Agar har state deti hai, toh . Discount convergence ensure karta hai aur near-term rewards ko prefer karta hai.

Fix: Recursive term mein hamesha include karo: .


Why it feels right: Dono mein actions aur values hain—aasaani se mix up ho jaate hain.

The problem:

  • ek fixed policy se tied hai, isliye hum ke chosen actions par expectation lete hain.
  • optimal value hai, isliye hum saare actions par max lete hain (best choose karte hain).

Fix:

  • Bellman expectation ( ke liye):
  • Bellman optimality ( ke liye):

Why it feels right: Deterministic environments mein, per sirf ek hota hai.

The problem: Zyaadatar environments stochastic hote hain. Different probabilities ke saath kai possible next states ho sakte hain.

Fix: Possible next states par hamesha sum/integrate karo:


Active Recall Prompts

Recall Ek 12-Saal-Ke Bachche Ko Bellman Equations Explain Karo

Soch ki tum ek video game khel rahe ho aur ye figure out karne ki koshish kar rahe ho: "Is level se mujhe kitne points milenge?"

Bellman equation kehti hai: Tere total points = points jo tujhe abhi milte hain + (thode kam valuable) points jo agli level se milenge.

"Thode kam valuable" kyun? Kyunki baad ke points abhi ke points se thode kam matter karte hain (jaise aaj ₹100 milna ek saal baad ₹100 milne se better hai—yahi discount factor hai).

Toh poore game ke points ek saath add karne ki bajay (jo mushkil hai), tum bas socho: "Mujhe abhi kya milta hai, aur agli level kitni worth hai?" Phir tum agli level ki value ka apna guess use karte ho is level ki value figure out karne ke liye. Ye backward karte raho, aur tum har level ki value figure out kar lete ho!

"Expectation" wala part ka matlab hai: agar game random hai (kabhi kabhi power-up milta hai, kabhi nahi), tum saari possibilities par average karte ho.



Connections

  • Dynamic Programming — Bellman equations DP methods enable karte hain (policy iteration, value iteration)
  • Temporal Difference Learning — TD learning Bellman equations ko update rules ke roop mein use karta hai
  • Q-Learning ke liye Bellman optimality par directly built off-policy algorithm
  • Policy Gradient Methods — Contrast: explicit value functions ke bina directly policy optimize karna
  • Markov Decision Process — Bellman equations MDPs ki value structure ko formalize karte hain
  • Discount Factor — Immediate aur future rewards ke beech tradeoff control karta hai
  • Bootstrapping — Key RL concept: value estimates update karne ke liye value estimates use karna

#flashcards/ai-ml

What is the Bellman expectation equation for ? :: — policy ke under state ki value, expected immediate reward plus discounted next-state value ke barabar hai.

What is the Bellman optimality equation for ?
— optimal value wo action choose karke milti hai jo expected reward plus discounted optimal next-state value ko maximize kare.
What is the difference between Bellman expectation and Bellman optimality equations?
Expectation equations ek fixed policy ke liye use karte hain (policy ki action distribution par average); optimality equations optimal policy ke liye use karte hain (best action choose karo).
Why do we need the discount factor in Bellman equations?
Ye ensure karne ke liye ki infinite-horizon returns converge hon (sum blow up na ho), aur near-term rewards ko distant ones par preference express karne ke liye. Iske bina, diverge ho jaata.

What is the recursive structure of the Bellman equation? :: — infinite-horizon value ko one-step reward + discounted future mein todta hai, iterative solution enable karta hai.

What is the action-value function ?
State se start karke, action leke, phir policy follow karte hue expected return: .
How is related to ?
— state value, policy ki action distribution ke under expected action value hai.
What is bootstrapping in the context of Bellman equations?
Full Monte Carlo returns ka wait karne ki bajay, value estimates update karne ke liye current value estimates use karna (jaise compute karne ke liye use karna).

Concept Map

defines

weights future in

decomposed via

yields

averages actions in

weights transitions in

relates

relates

enables

foundation of

Expected return sum of discounted rewards

Discount factor gamma

State value function V pi s

Action value function Q pi s a

Bellman equations recursive

Immediate reward plus discounted future value

Policy pi a given s

Dynamics p s prime r given s a

Dynamic programming bootstrapping

RL algorithms