Level 2 · Module 9 · 10 minutes
Rewards: the feedback that shapes behaviour
- Describe what a reward is and how dense and sparse rewards differ.
- Explain delayed reward, credit assignment and discounting in plain words.
- Explain reward hacking and how better reward design reduces it.
A reward is a number that tells a learning system how good an outcome was. The agent's whole aim is to collect more reward over time, so the design of the reward decides what it learns. A carelessly written reward teaches exactly the behaviour it measures, including behaviour you did not intend.
What a reward can look like
A reward can be a point for success, a penalty for damage, or a running score for progress. Dense rewards arrive often, for example a small point for every metre moved toward a goal. Sparse rewards arrive rarely, for example a single point when a whole task is finished. Sparse rewards are easier to describe but much slower to learn from, because most attempts return no feedback at all.
Delayed rewards are the hard case. If the only point comes at the end of a long task, the agent must work out which of many earlier actions earned it. This is called credit assignment, and it is why rewards are often shaped: small intermediate rewards are added to guide learning. Shaping speeds learning but also risks teaching shortcuts.
The balance sheet in a score table
In Q-learning a score is revised using the reward just received plus a discounted estimate of the best score available in the next situation. The discount means a reward now counts for more than the same reward later. It expresses that waiting has a cost, and it stops the agent from chasing a payoff that never quite arrives.
Reward design is the real work
Because the agent optimises the reward rather than the intention behind it, a badly designed reward invites gaming. A warehouse robot rewarded for speed may skip safety checks. A cleaning system rewarded for a low dirt reading may learn to hide the dirt from its sensor. This is sometimes called reward hacking. The remedy is to measure the outcome you actually care about, test the reward on small examples, and keep human limits around anything that can be gamed.
Practice versus a live system
Reward design in this lesson is done on paper. A real commercial training run needs a simulation or a controlled environment where the agent can fail safely, and it needs time for very many attempts. No model is trained here and no reward is paid to anything.
Common misconception
A reward is simply a prize for finishing the task, so any reasonable prize will do. The agent optimises the measured signal, not the outcome you had in mind. Dense or sparse, immediate or delayed, every reward design steers behaviour, and a poorly chosen signal invites shortcuts such as hiding problems or skipping safety checks.
Guided practice
Design the reward rules for a hypothetical learning robot that collects empty cups from an office kitchen. Write two rules that earn reward, one penalty for unsafe behaviour, and one way the robot could game each rule. Revise the rules to close the worst gap. This is a paper design exercise; no model is trained.
Knowledge check
Independent practice
Write a short example from your own work or daily life and decide whether it is AI, ordinary software or a mixture. Then explain why. Save it in your notes; no account is required.
Last reviewed: · Report a problem