Skip to content
matthewcm.dev

    ↑ ↓ move · ↵ open · tab scopeopen graph →

    Reinforcement Learning

    An agent takes actions in an environment to maximise reward. The vocabulary — policy, reward, rollout — and why reward design is the hard part.

    Growingtended planted 2 min read
    On this page

    Reinforcement learning (RL) is learning by doing. There’s no labelled dataset: an agent takes actions in an environment, receives a reward signal, and gradually improves its behaviour to collect more reward over time. It’s how machines learnt to play Atari and Go, how robots learn to walk in simulation, and part of how language models are tuned to be helpful.

    The vocabulary

    TermMeaning
    State / observationWhat the agent can see right now
    ActionWhat it can do
    RewardA number scoring the last step
    ReturnThe (discounted) sum of future rewards — what the agent really maximises
    PolicyThe decision rule mapping states to actions, often a neural network
    Rollout / episodeOne recorded run of the policy in the environment, start to finish
    Exploration vs exploitationTrying new things vs repeating what already works

    Training a policy means optimising that decision rule so the agent behaves better according to the reward signal. Algorithm families include value-based methods (Q-learning, DQN), policy-gradient methods (PPO, the workhorse in robotics and in fine-tuning LLMs) and actor-critic hybrids that combine both.

    Reward design is the hard part

    An agent optimises exactly what you reward — loopholes included. The classic example is a boat-racing agent that discovered it scored more by circling through bonus targets forever than by finishing the race. That’s reward hacking, and it teaches three things I find myself repeating well outside ML:

    • You can’t tell whether a reward is good just by reading it.
    • You have to watch the behaviour it produces — run rollouts and look.
    • Small changes in reward terms can produce wildly different behaviour.

    Which turns reward design itself into a loop: propose a reward → train → observe → reflect → revise. Eureka hands that loop to an LLM.

    Why I care as an engineer

    Swap “reward” for “metric” and this is every team that has ever been measured on story points, coverage or ticket counts. People and systems optimise what’s measured. The RL framing gives me better questions: what behaviour will this metric actually produce, how will I observe it, and what’s my stopping rule if it goes wrong? It’s also the backbone of agentic systems: perceive, act, observe, adjust.

    • #reinforcement-learning
    • #ai
    • #reward-design
    • #feedback-loops

    ↪ Links to (2)