Sub topic 8
How Reward Prediction Strengthens Habits
This chapter assumes you know the cue, routine, and reward parts of the habit loop and what craving means. It also assumes you can read short Python programs. It explains the learning rule that makes a reward strengthen the link between a cue and a routine.
The problem: why does a reward change future behavior?
A reward does more than feel good. After a behavior, your brain compares what happened with what it expected to happen. The size of that gap decides how much the cue-routine link changes.
This idea comes from animal-learning research and computational models of reward learning. In those models, a reward teaches the most when it is surprising. A reward you fully expected teaches almost nothing.
Reward prediction error
The key quantity is the reward prediction error. It is the difference between the reward you got and the reward you predicted:
prediction error = actual reward - predicted rewardThe error can be positive, zero, or negative.
| Situation | Predicted | Actual | Error | Effect on the cue-routine link |
|---|---|---|---|---|
| First time a new routine pays off | Low | High | Large positive | Strong strengthening |
| Routine pays off as usual | High | High | Near zero | Little change |
| Reward is bigger than usual | High | Higher | Positive | Further strengthening |
| Reward is missing | High | None | Large negative | Weakening |
Recordings of dopamine neurons in monkeys, by Wolfram Schultz and colleagues, fit this pattern. The cells fire strongly for an unexpected reward. After learning, they fire at the cue that predicts the reward, and they stop responding to the expected reward itself. When an expected reward is left out, their firing dips below baseline. Researchers often describe dopamine as carrying a prediction-error signal. The full role of dopamine is still debated.
The prediction moves from the reward to the cue
Early in learning, the reward is the surprise. Later, the cue is the surprise, because the cue is the first sign that a reward is coming. Prediction moves backward in time, from the reward to the cue.
This is the mechanism behind craving. The cue now carries a learned prediction of reward. The pull you feel at the cue (the smell of coffee, a phone buzz, 3 pm fatigue) is the learned prediction itself.
A minimal simulation
A simple update rule from the Rescorla-Wagner family captures this. On each trial, the prediction moves a fraction of the way toward the actual reward. That fraction is the learning rate, written alpha.
def simulate(rewards, alpha=0.3):
"""Track the predicted reward for one cue across a series of trials."""
prediction = 0.0
history = []
for trial, actual in enumerate(rewards, start=1):
error = actual - prediction
prediction += alpha * error
history.append((trial, actual, error, prediction))
return history
# 10 rewarded trials, 5 trials with the reward missing, then 2 rewarded again.
schedule = [1.0] * 10 + [0.0] * 5 + [1.0] * 2
print("trial actual error prediction")
for trial, actual, error, prediction in simulate(schedule):
print(f"{trial:5d} {actual:6.1f} {error:+6.2f} {prediction:10.2f}")Running it shows three phases:
- Acquisition. On trial 1 the error is +1.00. By trial 10 the error is about +0.03, and the prediction is about 0.97. Most learning happens in the first few trials.
- Extinction. When the reward stops, the first error is about -0.97. The prediction decays toward zero over the next four trials.
- Reacquisition. When the reward returns, the error is positive again and the prediction climbs back up.
This is a toy model with one cue and one number. It shows the shape of learning, not real brain values.
What this explains about habits
Early repetitions matter most
The first rewarded repetitions produce the largest errors, so they change the most. A new routine needs a reward you can actually notice in those first repetitions. A benefit that is far away, such as "better health in a year", gives no immediate error to learn from.
Immediate rewards beat delayed ones
Learning works best when the reward follows the routine closely. A habit can be good for you and still be weak because its payoff arrives hours later. A small immediate reward helps bridge that gap. Examples are checking off a box, a pleasant drink after a workout, or a moment of satisfaction after finishing.
Unpredictable rewards can hold a habit firmly
If rewards come on an unpredictable schedule, the prediction never settles at "certain". Errors keep occurring, positive and negative. Compulsive checking of feeds or messages fits this pattern. Each check might pay off, so the prediction stays high and the urge persists. Behavior trained this way is also slower to fade when rewards stop, a result known from animal studies of partial reinforcement.
Habits can outlast the reward
With enough repetition, behavior may continue even when the outcome no longer matters to you. Experiments often test this by making a reward less valuable (for example, feeding an animal until it is full) and checking whether the behavior continues. Goal-directed behavior stops. Habitual behavior often continues for a while. Computational models connect this to two learning systems:
- A model-based system plans by thinking through outcomes. It is flexible and effortful.
- A model-free system learns cached values from prediction errors. It is fast and cheap, but slow to notice that the world has changed.
Habits are often linked to the model-free system. This is a useful framework, not a settled division of the brain.
Common errors
- Assuming a bigger reward always works better. The error is what matters. A large reward that you fully predict teaches little. A modest reward that is a bit better than expected teaches more.
- Rewarding the wrong thing. The reward must follow the routine you want. A treat given before the workout strengthens the treat, not the workout.
- Treating a missing reward as harmless. If the reward vanishes, the prediction weakens, as extinction shows. A habit that quietly stopped paying off often fades without any decision to quit.
- Reading the model as precise. Real rewards are noisy and vary in size. The learning rate differs between people and situations. Use the model to reason about direction, not to calculate numbers.
- Confusing the prediction with willpower. A strong craving at the cue is a learned prediction. It is not a sign of weak character, and it will weaken if the reward stops following.
Using this in practice
- Add a small, immediate reward right after a new routine, in the first days of repetition.
- Keep that reward honest. It should be something you actually enjoy, not a claim that the routine is "good for you".
- If a habit is fading, ask whether its reward has stopped arriving or has become fully expected and dull.
- If an unwanted habit has an unpredictable payoff, expect the urge to be stubborn at first. Removing the payoff weakens it over time, but expect urges to return at first.
The next chapters build on this. Automaticity covers what stable context adds, and the final chapter covers where the loop model stops being a good description.
Exercise
In the simulation, the prediction error on trial 10 is close to zero even though the reward is still delivered. Explain why, and say what would happen to the prediction if the reward were then doubled to 2.0.
Show answer
By trial 10 the prediction has risen to about 0.97, so the reward of 1.0 is almost fully expected and the error (actual minus predicted) is about +0.03. Little changes because nothing surprising happened. If the reward doubled to 2.0, the error would be about +1.03, a large positive error, and the prediction would move up toward 2.0 by a fraction (alpha) of that error on each trial.
Exercise
You start a daily stretching routine after brushing your teeth. The benefit is better flexibility in a few months. Using reward prediction error, explain why the habit may stay weak, and suggest one change.
Show answer
The flexibility benefit comes months later, so right after each repetition there is no actual reward and no positive prediction error. The cue-routine link has nothing to strengthen it. Adding a small immediate reward, such as a moment of enjoying a favorite drink or ticking a box on a tracker, gives each repetition a noticeable positive outcome so the link can strengthen.