Sub topic 8
How Reward Prediction Strengthens Habits
This chapter assumes you know the three parts of the habit loop (cue, routine, reward) and the idea of craving from earlier chapters. It explains the learning process that turns a repeated behavior into a habit.
The working model: learning from surprise
Your brain keeps a running guess about how good an outcome will be. When the real outcome differs from the guess, the brain adjusts. Researchers call the gap a reward prediction error:
- Better than expected: the error is positive, and the link between cue and routine gets stronger.
- Exactly as expected: the error is zero, and the link stays about the same.
- Worse than expected: the error is negative, and the link gets weaker.
Dopamine, a chemical messenger in the brain, is closely tied to this signal. Early on, dopamine activity rises when the reward arrives. After many repetitions, it rises earlier, at the cue. The cue has become a prediction of the reward. This is the source of craving: the pull you feel at the cue comes from the expected reward.
A small simulation
The code below uses a simple update rule from reinforcement learning. Each repetition moves the prediction a fraction of the way toward the actual reward. That fraction is the learning rate.
def learn(rewards, learning_rate=0.3):
prediction = 0.0
for day, reward in enumerate(rewards, start=1):
error = reward - prediction
prediction += learning_rate * error
print(f"Day {day}: reward={reward}, error={error:+.2f}, prediction={prediction:.2f}")
learn([1, 1, 1, 1, 1, 0])On day 1 the error is large (+1.00). By day 5 it is small, because the prediction has caught up. On day 6 the reward is missing, so the error is negative and the prediction drops. The same rule explains why a habit is strongest when its reward is reliable, and why it fades if the reward stops.
What this means in practice
- Reward soon after the routine. A reward that arrives right away is linked to the routine more easily than one that arrives hours later. If the real benefit is delayed, add a small immediate one, such as ticking a box or a favorite song.
- Reliable rewards build predictions faster. An uncertain reward keeps the error large, so the prediction never settles.
- Boring rewards stop teaching. Once a reward is fully expected, the error is near zero and little new learning happens. The habit persists because the link is already strong.
Common errors
- Treating the reward as a prize for finishing a long streak. The signal works on each repetition, so reward each one.
- Choosing a reward that conflicts with the goal, such as a sugary snack after exercise. The strongest link may form with the snack.
- Expecting the model to be exact. Real brains are more complicated, and a later chapter covers where the simple model falls short.
Exercise
You start stretching after brushing your teeth. For two weeks you feel noticeably looser each time. In week three the feeling is still there but no longer new. Using prediction error, explain why the habit can continue even though the reward feels less exciting.
Show answer
Early on, the looser feeling was better than predicted, so the errors were positive and the cue-routine link strengthened. By week three the brain predicts the feeling, so the error is near zero and little new strengthening occurs. The link was already built, and the cue now triggers the routine by itself. The habit continues as long as the reward does not fall well below the prediction.