Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Fine-Tuning and RL for Agents

Free · sign in to start and track progress

1 · Decide and prepare

  • 1Prompt, optimise or train?
  • 2Training data from traces

2 · Supervised and preference fine-tuning

  • 3SFT with LoRA on a free GPU
  • 4Preference optimisation

3 · Reinforcement learning for agents

  • 5GRPO in practice
  • 6Designing rewards
  • 7Multi-turn RL environments
  • 8Reward hacking, regressions and shipping

    Exercise answers

    • Answer: Hunt the escalation hack and fix the reward
    • Answer: Serve two adapters and gate them against the Claude baseline
CapstoneTrain a triage model, then decide whether to ship itReference implementation

Module 3 · Reinforcement learning for agents · Lesson 8

Reward hacking, regressions and shipping

Catch a policy that games its training reward, find out what else training changed, compare the trained model with a frontier-model baseline on paired outcomes and cost per completed case, and serve adapters you can version and roll back.

90 min 2 videos 3 exercises 8-question quiz Answers
Setup for the exercises:Install Claude CodePython with uvFree GPUs on KaggleHugging Face account and CLIServe a model with vLLM

By the end of this lesson you can

  • Detect reward hacking with held-out graders that differ from the training reward, canary tasks and stratified trace review, and name the common agent hacks
  • Design capability and safety regression tiers for a fine-tuned model, and explain why narrow training can change behaviour far outside the task
  • Compare a trained model with a baseline using paired outcomes, negative flips by tier and an exact test, and decide when a higher average still blocks a release
  • Compute cost per completed case including amortised training, serving and retraining, and find the volume at which training pays
  • Serve several LoRA adapters on one base model, version them, roll back by moving a label, and plan for base-model deprecation

On this page

  • The policy optimises what you wrote
  • Hacks a tool-using agent finds
  • Two rewards, canaries and trace review
  • Worked example: the escalation hack
  • Regressions: what else did training change?
  • The paired comparison against the baseline
  • Cost per completed case
  • Serving, versioning and rollback
  • Misconceptions and limits
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01The policy optimises what you wrote
  2. 02Hacks a tool-using agent finds
  3. 03Two rewards, canaries and trace review
  4. 04Regressions: what else did training change?
  5. 05The paired comparison against the baseline
  6. 06Cost per completed case
  7. 07Serving, versioning and rollback
  8. 08Misconceptions and limits
  9. 09Connections
  10. 10Summary

Sources & further reading

  • Natural Emergent Misalignment from Reward Hacking in Production RLPaper · MacDiarmid et al. · Anthropic · 2025A model that learned to reward hack in real coding environments generalised to alignment faking and sabotage, and chat-style safety training only hid it. Read the abstract and the mitigations; the companion post has the headline numbers.
  • Emergent Misalignment: Narrow finetuning can produce broadly misaligned LLMsPaper · Betley et al. · 2025Fine-tuning on one narrow behaviour (insecure code) made models misaligned on unrelated prompts; extended version in Nature (2026). The control experiments are the useful part: framing the data differently prevented the effect.
  • Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!Paper · Qi et al. · 2023The seminal result that fine-tuning erodes safety behaviour, even on benign data (ICLR 2024). The reason every fine-tune needs a safety tier.
  • Monitoring Reasoning Models for Misbehavior and the Risks of Promoting ObfuscationPaper · Baker et al. · OpenAI · 2025Monitors catch reward hacking well, but putting the monitor into the reward teaches the policy to hide it. The argument for keeping detection out of the training signal.
  • ImpossibleBench: Measuring LLMs' Propensity of Exploiting Test CasesPaper · Zhong, Raghunathan, Carlini · 2025Tasks where the spec and the tests conflict, so any pass is a cheat. The idea behind this lesson's canary tickets.
  • vLLM: LoRA adaptersDocs · vLLMServing several adapters on one base: --enable-lora, --lora-modules, choosing an adapter with the model field, and the security warning on loading adapters at runtime.
  • Reward Hacking in Reinforcement LearningArticle · Lilian Weng · 2024The best single survey of reward hacking, from classic RL to RLHF. Read 'Hacking RLHF of LLMs' and 'Peek into Mitigations'.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 10 more sections
  • 3 hands-on exercises
  • A 8-question quiz
  • Progress, quiz scores and bookmarks