a
Define reinforcement learning and how it differs from another form of ML [4 marks]
4 marks
›
Model Answer
Reinforcement learning (RL) is a paradigm in which an agent learns to make sequential decisions by interacting with an environment. At each step the agent observes a state, takes an action, and receives a reward signal plus a new state. Its goal is to learn a policy (a mapping from states to actions) that maximises the expected cumulative reward over time, rather than just immediate reward.
The clearest contrast is with supervised learning. In supervised learning the model is trained on a labelled dataset where every input has a known correct output, and learning means minimising the error between predictions and those labels. RL has no labelled 'correct answers.' Instead it receives only an evaluative reward that says how good an action was, not what the right action would have been. Two further differences follow: RL involves delayed feedback (a reward may depend on a long sequence of earlier actions — the credit-assignment problem), and the agent's own actions determine the data it sees, whereas in supervised learning the data is fixed and independent of the model.
b
Compare RL with evolutionary algorithms [2 marks]
2 marks
›
Model Answer
RL typically learns from the experience of a single agent and uses the reward signal to update a value function or policy incrementally, exploiting the structure of states and actions within episodes. Evolutionary algorithms instead maintain a population of candidate solutions (policies), evaluate each by its overall fitness, and improve through selection, mutation, and crossover across generations. In short, RL learns within the lifetime of an agent using step-by-step feedback, while evolutionary methods search over whole policies using only end-of-trial fitness and ignore the internal state-action structure.
c
Explain the role of the reward signal in RL [2 marks]
2 marks
›
Model Answer
The reward signal defines the goal of the problem: it tells the agent what it should be trying to achieve. It is the only feedback that drives learning, so the agent adjusts its policy to favour actions that lead to higher cumulative reward and avoid those leading to lower reward. Because rewards can be delayed, the agent must learn to associate present actions with future consequences, which shapes value estimates and ultimately the policy.
d
Describe a real-world application of RL, including the state, actions, and reward [4 marks]
4 marks
›
Model Answer
A good example is autonomous robotic control, such as a robot learning to walk or grasp objects. The state is the robot's sensor readings (joint angles, velocities, camera input). The actions are motor commands. The reward is engineered to reflect the desired outcome — for instance, positive reward for forward distance travelled and staying upright, negative reward for falling or excessive energy use. The robot tries actions, observes the resulting states and rewards, and gradually updates its policy so that movements which keep it balanced and moving forward become more likely. Over many trials (often in simulation first to avoid hardware damage), it converges on a stable walking gait without anyone explicitly programming the joint motions.
Other strong examples include recommendation systems, traffic-light control, datacentre cooling optimisation, and game-playing systems like AlphaGo.
e
Explain the exploration–exploitation trade-off [2 marks]
2 marks
›
Model Answer
Exploitation means choosing the action currently believed to give the highest reward; exploration means trying other actions to gather information that might reveal a better option. The trade-off matters because pure exploitation can lock the agent into a suboptimal policy it never improves, while pure exploration never capitalises on what it has learned. Balancing the two (e.g. via an ε-greedy strategy) lets the agent both discover good actions and benefit from them.
f
Illustrate RL concepts using a simple game example [4 marks]
4 marks
›
Model Answer
Take Tic-Tac-Toe. The state is the current board configuration; the actions are placing a mark in an empty cell; the reward might be +1 for a win, −1 for a loss, and 0 for a draw or non-terminal move. The RL agent plays many games (often against itself or an opponent), and after each game propagates the outcome reward back to the moves that led to it, updating value estimates for board states. Early on it plays almost randomly (exploration), but as it accumulates experience it learns which positions tend to lead to wins and increasingly selects those moves (exploitation). Using something like ε-greedy action selection, it keeps occasionally trying new moves so it doesn't miss better strategies. Over thousands of games it converges on near-optimal play, blocking opponent wins and setting up its own.
g
Describe how a grid-world agent's policy evolves under Q-learning [4 marks]
4 marks
›
Model Answer
Initially the agent sits in a corner with equal probability (0.25 each) for up, down, left, right, and its Q-values for all state–action pairs start at zero, so its behaviour is essentially random. As it moves around and occasionally reaches a goal that gives reward, Q-learning updates the value of the state–action pair that led toward that reward using the rule:
Q(s,a) ← Q(s,a) + α [ r + γ · max_a' Q(s',a') − Q(s,a) ]
where α is the learning rate and γ the discount factor. The reward at the goal first raises the Q-value of the action that reached it, and on subsequent episodes that higher value propagates backwards to earlier states via the max term. Gradually, actions pointing along the shortest path to the goal acquire higher Q-values. If the agent acts greedily (or ε-greedily) with respect to these values, its policy shifts from uniform-random toward consistently choosing the direction that leads to the goal, while early-on exploration ensures it discovers the path rather than getting stuck. Over many episodes the policy converges to the optimal route out of the corner.
h
Explain the concept of Q-learning and what distinguishes it from other approaches [4 marks]
4 marks
›
Model Answer
Q-learning is a model-free, value-based RL algorithm that learns an action-value function Q(s,a) — the expected cumulative discounted reward of taking action a in state s and then following the optimal policy thereafter. It updates these estimates iteratively from experience using the temporal-difference update rule, and the policy is derived implicitly by choosing the action with the highest Q-value.
What distinguishes it: it is model-free, meaning it needs no model of the environment's transition probabilities or rewards — it learns purely from sampled experience. It is also off-policy, because it learns about the optimal (greedy) policy regardless of how the agent actually behaves while exploring; the max operator in the update targets the best possible next action rather than the one actually taken. Compared with supervised learning it uses no labelled examples, learning from delayed evaluative rewards instead; and unlike many other ML methods it explicitly handles sequential decision-making and the credit-assignment problem.
i
When is Q-learning an appropriate algorithm to use? [4 marks]
4 marks
›
Model Answer
Q-learning fits problems that can be framed as a Markov decision process: sequential decision-making where outcomes depend on the current state, actions have delayed consequences, and there is a definable reward. It is especially suitable when the state and action spaces are discrete and reasonably small, because the basic algorithm stores Q-values in a table, so the number of state–action pairs must be manageable. It is well-suited when a model of the environment is unavailable (its model-free nature) but experience can be sampled cheaply, for example in simulations or games.
Good examples include grid-world navigation, board games, maze-solving, and simple control tasks. It becomes impractical for very large or continuous state spaces (where the table explodes), in which case function approximation such as Deep Q-Networks is used instead.