1. Home
  2. Explore
  3. Computer Science
  4. Reinforcement Learning Overview

Study methods

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

Reinforcement Learning Overview

Speaker 1Speaker 2

Reinforcement Learning Overview

18:25
0:00-18:25
  1. Anna

    Welcome to Reinforcement Learning, or RL. At its simplest, reinforcement learning is about an automated agent learning through experience to make good decisions. That sounds straightforward, but it combines several difficult problems: deciding what “good” means, learning under uncertainty and limited data, dealing with consequences that arrive later, exploring actions whose outcomes are unknown, and generalizing to situations the agent has not seen before.

  2. Michael

    And that connects RL to a much broader question about intelligence. Machine learning has made tremendous progress in perception, such as recognizing faces, cats, or cars. But intelligent behavior also requires using perceptions and information to choose actions. The challenge is not merely identifying what is happening; it is learning how to make effective decisions when the future is uncertain.

  3. Anna

    Exactly. Questions about learning to make decisions under uncertainty have been studied since at least the 1950s, with Richard Bellman’s ideas playing a foundational role. Bellman’s equation will become important because it helps connect the value of a decision now with the value of what may happen later. One major reason to study RL, then, is that decision-making is an essential part of intelligence and artificial intelligence.

  4. Michael

    There is also a very practical reason. RL has produced striking results in important domains. In Go, for example, researchers combined reinforcement learning with Monte Carlo Tree Search to create systems that played better than the strongest human players, much earlier than many people expected.

  5. Anna

    Other examples show that RL is not limited to games. In fusion science, deep reinforcement learning was used to control coils and manipulate the shape of material inside a vessel, with more flexibility than previously imagined. In Greece, RL helped decide whom to test at the border during COVID-19, using limited testing resources in a changing epidemic.

  6. Michael

    And ChatGPT is another useful example because its training illustrates several RL ideas. First, the system used behavior cloning, also called imitation learning: it learned to produce responses from examples of prompts and human-written answers. That is essentially a supervised learning problem in which the system tries to reproduce the demonstrated behavior.

  7. Anna

    The next step was to model utility more explicitly. People compared or ranked different outputs, and those preference judgments were used to learn a reward model. The system could then use reinforcement learning with that learned reward. This approach is called reinforcement learning from human feedback, or RLHF.

  8. Michael

    So imitation learning and RLHF are related but not identical. Imitation learning can treat internet examples or expert demonstrations as targets and directly learn to imitate them. RLHF instead gathers preference information about alternative outputs, learns what people tend to prefer, and then optimizes behavior using the learned reward.

  9. Anna

    That distinction matters because demonstrations are not always perfect, and imitation alone cannot normally exceed the quality of the demonstrations. RL can potentially discover better behavior, as AlphaGo did when it found Go strategies that humans had not previously used. RL is especially promising when there are no examples of desired behavior, when a task has to be learned from scratch, or when we want to go beyond human performance.

  10. Michael

    RL can also help with enormous search and optimization problems that have delayed outcomes. AlphaTensor, for example, used reinforcement learning to discover faster algorithms for matrix multiplication while still producing the correct result, not an approximation with some error. Similar ideas have been applied to discovering faster sorting algorithms.

  11. Anna

    The field has grown enormously. Interest increased after systems learned to make decisions directly from pixel inputs in Atari games, followed by successes such as AlphaGo and many others. But there have also been skeptics about how central RL should be to machine learning. Yann LeCun famously described machine learning as a cake: unsupervised learning as the main body, supervised learning as the icing, and reinforcement learning as the cherry.

  12. Michael

    The point of that metaphor was not that RL has no value. It was that RL might play a smaller role than unsupervised and supervised learning in overall progress. It is still useful to ask where each approach is most appropriate, rather than assuming one technique should solve every machine learning problem.

  13. Anna

    A helpful way to characterize reinforcement learning is through four themes: optimization, delayed consequences, exploration, and generalization. Optimization means that RL explicitly cares about how desirable different outcomes are. For example, if you are finding a route between two cities, a shorter route is preferred to a longer one.

  14. Michael

    Delayed consequences mean that an action now can affect rewards much later. Saving for retirement may have an immediate cost but a future benefit, and an early move in a video game may determine what happens much later. This creates a planning challenge even when the rules are known, as in chess, because choosing well requires reasoning about long-term consequences.

  15. Anna

    It also creates a learning challenge called temporal credit assignment. Suppose an agent takes many actions and eventually receives a good or bad outcome. How can it determine which earlier action caused that outcome? Human examples make this difficult too: if someone succeeds in getting into Stanford, it may be hard to know how much came from their high school, test scores, essay, or choices made years earlier.

  16. Michael

    Exploration is another defining feature. The agent learns about the world through direct experience, and information is censored: it only learns about what it tries. If a company gives a promotion to some customers, it cannot observe what those same customers would have done without the promotion. The alternative outcome is a counterfactual, which makes exploration closely related to causal inference.

  17. Anna

    Generalization becomes essential when the space of possible situations is huge. A simple robot might follow rules such as turning left at the end of a hallway. But a video game can present an enormous number of possible images. With an image of roughly 300 by 400 pixels and at least 256 colors, the number of possible inputs is at least 256 to the power of 300 times 400, so we cannot simply make a table listing an action for every image.

  18. Michael

    That is why realistic RL systems often need deep neural networks or other function approximators. These systems try to map many related situations to appropriate decisions without storing a separate rule for every possible input.

  19. Anna

    These four themes help distinguish RL from neighboring areas. AI planning usually involves optimization and delayed consequences, and it may require generalization in very large spaces. Supervised learning learns from labeled data and generalizes, but it normally does not involve sequential decisions or exploration. Unsupervised learning uses data without labels and also seeks useful generalization, but it does not usually define utility in the RL sense.

  20. Michael

    Imitation learning uses expert trajectories or demonstrations of good behavior. A person might drive a car while recording steering actions, and a model can learn what steering action to take in similar situations. The simplest version reduces the decision problem to supervised learning, although more advanced imitation methods can also try to recover a reward function.

  21. Anna

    That reduction is powerful because progress in supervised learning can then be used for the imitation problem. But it also removes or weakens important RL features: the agent is not choosing its own experience through exploration, and it may simply reproduce the limitations of the demonstrator. RL remains valuable when data are absent, when performance must exceed the demonstrations, or when search over delayed outcomes is central.

  22. Michael

    The course builds these ideas in stages. It begins with Markov decision processes and planning, then covers model-free policy evaluation and model-free control. It moves to policy-search methods such as REINFORCE and proximal policy optimization, followed by offline reinforcement learning, where a fixed dataset is used to learn a good policy.

  23. Anna

    The course also includes reinforcement learning from human feedback, direct preference optimization, exploration, Monte Carlo Tree Search, and advanced topics. The main learning goals are to define RL’s key features, formulate applications as RL problems, judge whether RL is appropriate, implement common algorithms, and understand theoretical and empirical ways to evaluate RL algorithms.

  24. Michael

    One important practical lesson concerns how to learn the material. Evidence from massive open online courses found that doing activities produced a much larger learning benefit than simply watching videos or reading, even though each activity took less time than reading a page. So actively solving problems, completing homework, using understanding checks, and practicing forced recall are generally more effective than repeatedly rewatching lectures.

  25. Anna

    Now let’s formulate a simple education problem as reinforcement learning. Imagine an AI tutor working with a student who is learning addition and subtraction. The tutor can choose an addition problem or a subtraction problem, and it receives a reward of plus one if the student answers correctly and minus one if the student answers incorrectly.

  26. Michael

    The state could represent the student’s knowledge, perhaps as a pair such as 0.9 mastery of addition and 0.4 mastery of subtraction. Another valid representation is the entire history of previous questions, answers, observations, and rewards. Histories are expressive, but they can grow without bound, so a practical system may summarize them using a sufficient statistic or a model such as an LSTM.

  27. Anna

    The actions are the tutor’s choices: present addition practice or present subtraction practice. The dynamics model describes how the student’s state changes after receiving a question. For example, after an addition problem, the student might become more likely to master addition. The reward model specifies the immediate feedback, here plus one for a correct answer and minus one for an incorrect one.

  28. Michael

    But this setup reveals reward hacking. If the tutor only maximizes correctness, it may give extremely easy questions forever. The student will answer them correctly, producing lots of reward, but may learn very little. The specified reward does not fully capture the designer’s real goal, which was to help the student learn addition and subtraction.

  29. Anna

    The same issue appears in other applications. A robot rewarded merely for having no dishes on a counter might push the dishes onto the floor. A better reward would require the dishes to be placed in the dishwasher and cleaned. In blood-pressure control, an agent might recommend exercise or medication, observe blood pressure, and receive a reward for staying in a healthy range, perhaps with a penalty that increases as blood pressure moves farther outside that range.

  30. Michael

    More generally, sequential decision-making involves an agent taking actions, interacting with the world, and receiving observations and rewards. The objective is to maximize total expected future reward, not just the immediate reward. That often means balancing short-term benefits against long-term consequences.

  31. Anna

    For example, in web advertising, an agent might choose which advertisement or product to show, observe whether the person views, clicks, or purchases, and optimize clicks, viewing time, or revenue. In robotics, an action might move a joint, while the observation could be a camera image of a kitchen. In health applications, actions might be recommendations and observations might include measurements such as blood pressure.

  32. Michael

    We usually model this interaction in discrete time. At each time step, the agent takes an action, the world updates, and the agent receives an observation and reward. The agent uses that new information to choose its next action, creating a feedback loop.

  33. Anna

    The complete history at time t, often written as h sub t, consists of the previous actions, observations, and rewards. An agent could make decisions using the entire history. But we often look for a state that summarizes the relevant information more compactly.

  34. Michael

    A state is Markov when the probability of the next state, given the current state and action, is the same as the probability obtained by conditioning on the entire history. In plain language, the future is independent of the past once we know the present. If the state is a sufficient summary, we do not need to retain everything the agent has ever experienced.

  35. Anna

    The Markov assumption is popular because it simplifies computation and can reduce the data needed for learning. But there is a trade-off. A small state representation is easier and faster to use, yet it may omit important information and lead to poor decisions. A richer representation captures more of the world but may take more time and data to learn.

  36. Michael

    State and observation are not always the same. An observation is the immediate information received after an interaction, while the state is the information needed to predict the future. In Atari games, using the last four frames rather than only the latest frame can reveal motion, such as an object’s velocity or acceleration.

  37. Anna

    When the agent cannot directly identify the true state, the world is partially observable. A student’s actual mastery of addition may be hidden, while correct or incorrect answers are noisy observations because people can guess correctly or make occasional mistakes. Similarly, a robot using laser rangefinders may see identical wall distances on different floors and therefore cannot determine its unique location.

  38. Michael

    Other important distinctions concern the dynamics and the actions. Dynamics may be deterministic, as when a Go piece reliably lands where it is placed, or stochastic, as with a coin flip or an imperfect Mars rover. Also, some actions affect only immediate rewards, while others change the next state. In a contextual bandit-style advertising problem, one customer’s advertisement outcome does not affect the next customer.

  39. Anna

    A useful running example is a Mars rover on a tiny planet with seven locations. The state is the rover’s location, and its actions are attempts to move left or right. Because the rover is imperfect, trying to move right might lead to the location on the right only some of the time, while it might stay put or move elsewhere on other attempts.

  40. Michael

    The reward could be plus one for visiting one interesting site, plus ten for visiting another, and zero elsewhere. The dynamics model describes the distribution over next locations after each action. The reward model describes the immediate reward expected from a state and action, although different references may define reward as a function of the current state, the state and action, or the state, action, and next state.

  41. Anna

    A model is the agent’s representation of how the world works, not necessarily the true world. The rover may believe that an action succeeds with a particular probability even if that estimate is wrong. In model-based settings, the agent uses a dynamics model and reward model to reason about decisions; in model-free settings, it learns useful values or policies without explicitly representing those models.

  42. Michael

    A policy maps states to actions. A deterministic policy chooses one action for each state, such as always attempting to move right. A stochastic policy assigns probabilities to actions, such as choosing one advertisement with 90 percent probability and another with 10 percent. Both kinds of policies are useful, depending on the domain and the role of exploration.

  43. Anna

    Two central questions are evaluation and control. Policy evaluation asks how good a fixed policy is. Control asks us to find a good or optimal policy, which generally requires trial and error and strategic exploration. Evaluation is often part of control because knowing the value of a current policy can help us improve it.

  44. Michael

    The course begins with a simpler setting: finite state and action spaces, known models of the world, evaluation of policies, and computation of an optimal policy. That is closely related to AI planning. Later, the course considers learning, where the agent must make decisions and gather experience in order to identify a good policy.

  45. Anna

    To build toward Markov decision processes, we first consider a Markov chain. A Markov chain is a memoryless random process with a finite set of states, a transition or dynamics model, and no rewards or actions. With finitely many states, the transition model can be written as a matrix whose rows give the probabilities of moving from one state to the possible next states; each row must sum to one.

  46. Michael

    A Markov reward process adds rewards to the Markov chain. It has the same state-transition structure, plus a reward function and a discount factor. In the Mars example, one state might provide a reward of one, another a reward of ten, and the remaining states zero.

  47. Anna

    For an episode with a finite or infinite horizon, the return at time t is the discounted sum of rewards from that time through the end of the horizon. The value function is the expected return. Because the process can be stochastic, the actual return from one trajectory may differ from the expected value.

  48. Michael

    The discount factor gives more weight to rewards that arrive sooner. It is mathematically convenient, especially for infinite-horizon problems, because it helps keep the total reward bounded. It also reflects the fact that people and organizations often value immediate rewards more than equally sized rewards far in the future.

  49. Anna

    If every episode has a finite length, it is possible to use a discount factor of one. With an infinite horizon, a value below one is generally important; otherwise sums can diverge and it becomes difficult to compare policies whose total rewards are all infinite. That foundation leads directly to computing values for Markov reward processes and then connecting them to full decision processes.

  50. Michael

    So the central picture is this: an agent observes a state or informative summary, chooses an action, receives feedback, and tries to maximize expected future reward. RL is challenging because decisions have delayed effects, experience is limited to what the agent tries, rewards may be misspecified, and the agent must generalize across an enormous range of situations.

  51. Anna

    And that is the roadmap for studying reinforcement learning: understand the formal decision process, evaluate and improve policies, learn from models or experience, handle exploration and delayed credit assignment, and assess whether an algorithm actually achieves the behavior we intended. With those ideas in place, we are ready to move from the overview into the mathematics of values, policies, and Markov decision processes.

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent