Coding Hubs School of AI – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 8448811540
Back to Machine Learning Notes
Topic #108

Reinforcement Learning

Reinforcement learning (RL) trains an agent to make a sequence of decisions by interacting with an environment — taking actions, receiving rewards or penalties, and learning a policy that maximizes long-term reward.

The RL Loop

ComponentMeaningExample (game-playing agent)
AgentThe decision-maker being trainedThe game-playing program
EnvironmentThe system the agent interacts withThe game itself
StateThe current situationCurrent board position
ActionWhat the agent can doA legal move
RewardFeedback signal after an action+1 for winning, -1 for losing, 0 otherwise
PolicyThe strategy the agent learns — state → action"In this position, play this move"

The agent tries actions, observes the resulting reward, and gradually adjusts its policy to favor actions that lead to higher long-term reward — not just immediate reward, which is what makes RL harder than standard supervised learning.

Why RL Is Different from Supervised Learning

  • There's no dataset of "correct answers" upfront — the agent generates its own experience through trial and error.
  • Rewards are often delayed (you don't know a chess move was bad until you lose the game many moves later) — this is called the credit assignment problem.
  • The agent's own actions affect what data it sees next (unlike supervised learning, where the training set is fixed).

Practical Use Cases

  • Game-playing agents (board games, video games)
  • Robotics — learning to walk, grasp objects
  • Resource allocation and recommendation ranking (as a sequential decision problem)
  • Reinforcement learning from human feedback (RLHF), used to align large language models

Advantages

  • Can learn strategies for problems where no labeled "correct action" dataset exists
  • Optimizes for long-term outcomes, not just single predictions

Limitations

  • Needs a large number of interactions (trial and error) to learn — expensive or risky in the real world (e.g. a physical robot)
  • Reward design is hard: a poorly specified reward can cause the agent to learn unintended, exploit-y behavior
  • Training can be unstable and harder to reproduce than supervised learning

Common Mistakes

  • Applying RL to problems that are really just standard supervised learning in disguise (RL is usually overkill when labeled input-output data already exists).
  • Designing a reward function that's easy to "hack" — e.g. rewarding a cleaning robot for "not detecting mess" instead of "actually cleaning," which it can satisfy by disabling its own sensor.

Interview Relevance

Q: "Why is reward design considered one of the hardest parts of reinforcement learning?" Because the agent will optimize exactly what the reward function measures — if that's a flawed proxy for what you actually want, the agent finds a shortcut ("reward hacking") rather than the intended behavior.

Practice Question

You're designing a reward function for a self-driving car RL agent. What's wrong with rewarding it purely for "distance traveled without stopping"?

Related ML Notes

Want to go beyond the notes?

Join Coding Hubs School of AI's Machine Learning course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →