Reinforcement Learning
AI · Advanced
Definition
In RL an agent learns by acting in an environment and maximizing cumulative reward.
Powers game-playing AIs, robotics and LLM fine-tuning (RLHF).
Diagram
Flowchart
Example: Q-learning update
q, r, gamma, alpha, next_max = 0.0, 1.0, 0.9, 0.5, 2.0
q += alpha * (r + gamma * next_max - q)
print(q)Output: 1.4
Key points
- Explore vs exploit (ε-greedy)
- γ discounts future rewards
Interview questions
What is a policy?
A mapping from states to actions the agent takes.