---
title: "New Course: RL Fine-Tuning Qwen4 to Patch Security Bugs"
slug: "rl-fine-tuning-qwen4-security-patching-course"
date: "2026-12-05"
tag: "Application"
kind: "course"
products: ["agentic-lms"]
summary: "ibl.ai publishes a free, self-paced course on reinforcement-learning fine-tuning of the open-weight Qwen4-35B-A3B model for defensive security work, built on the Hugging Face TRL cyber recipe: verified tasks, GRPO rewards, run planning and an honest before and after evaluation."
author: "ibl.ai Engineering"
linkedin: |
  Hugging Face published a recipe this week for teaching an open-weight model, Qwen4-35B-A3B, to patch security bugs with reinforcement learning. ibl.ai now has a free course that takes it apart.

  The course is for people who have to decide whether a tuned model really got better:

  → Build one verified repair task on a laptop and prove its verifier works
  → Compute the reward and the GRPO group advantage by hand
  → Read every setting in the recipe and write a run plan with a budget ceiling
  → Reproduce the published p-values with an exact paired test

  It is plain about the evidence. The recipe's page says it had not been run as written; the numbers come from an earlier 24-step run. One result is significant (p = 0.017), one is not (p = 0.125), and in a separate run the step 50 checkpoint beat step 100.

  30 units, four labs that need no GPU and no account, a tutor in every unit and an assessor for every section.

  An open model on hardware you control is the point of the exercise. With ibl.ai you own all the code and the data, including the courses you build on it.

  The course: https://ibl.ai/updates/rl-fine-tuning-qwen4-security-patching-course

  #iblai #AgenticAI #EnterpriseAI #Cybersecurity #FineTuning
---

**ibl.ai publishes a free, self-paced course on reinforcement-learning fine-tuning of the open-weight Qwen4-35B-A3B model to fix flawed code, built on the Hugging Face TRL cyber recipe. It teaches how to verify a task, read the reward, plan a run and judge the result. It runs on a platform where, with ibl.ai, you own all the code and the data.**

The course is [RL Fine-Tuning Qwen4 to Patch Security Bugs (2027)](/courses/cybersecurity/rl-fine-tuning-qwen4-security-patching-2027), in the [Cybersecurity catalog](/courses/cybersecurity). It takes 10 to 12 hours and is written for ML engineers, security engineers and AppSec leads.

## What is the recipe the course is built on?

On 4 December 2026 the [TRL recipes Space](https://huggingface.co/spaces/trl-lib/trl-recipes) on Hugging Face added a recipe for cyber defense. It trains a LoRA adapter for [Qwen4-35B-A3B](https://huggingface.co/Qwen/Qwen4-35B-A3B), an Apache-2.0 model, with the AsyncGRPO trainer.

The model works as a coding agent in an offline sandbox. It reads a security report, finds the flawed code and writes a patch. Hidden tests then check that the hostile inputs fail and normal behavior still works, and each pass or fail becomes a training signal.

The tasks come from [UltraCyber](https://huggingface.co/datasets/harness-hub/UltraCyber), a dataset of 7,417 execution-verified defensive tasks: 2,601 code repair and triage tasks in eight languages, and 4,816 authorization policy tasks.

## What will you be able to do after the course?

<table style="width:100%; border-collapse:collapse; margin:1.5rem 0; font-size:0.95rem;">
  <thead>
    <tr style="background:#f5f5f0; border-bottom:2px solid #2175C5;">
      <th style="text-align:left; padding:0.75rem; color:#5f6368;">Section</th>
      <th style="text-align:left; padding:0.75rem; color:#5f6368;">What you learn</th>
      <th style="text-align:left; padding:0.75rem; color:#5f6368;">What you build</th>
    </tr>
  </thead>
  <tbody>
    <tr style="border-bottom:1px solid #e5e7eb;">
      <td style="padding:0.75rem;"><strong>1. The task and the verifier</strong></td>
      <td style="padding:0.75rem;">What "solved" means, and the controls that prove a verifier can be trusted</td>
      <td style="padding:0.75rem;">One verified repair task, on a laptop</td>
    </tr>
    <tr style="border-bottom:1px solid #e5e7eb;">
      <td style="padding:0.75rem;"><strong>2. Reward and GRPO</strong></td>
      <td style="padding:0.75rem;">How a pass or fail becomes a gradient, and why some tasks carry no signal</td>
      <td style="padding:0.75rem;">Rewards and group advantages, computed by hand</td>
    </tr>
    <tr style="border-bottom:1px solid #e5e7eb;">
      <td style="padding:0.75rem;"><strong>3. The run</strong></td>
      <td style="padding:0.75rem;">The model, the two-GPU layout, the agent harnesses and every setting in the recipe</td>
      <td style="padding:0.75rem;">A run plan with a budget ceiling and stop conditions</td>
    </tr>
    <tr style="background:#f0f9ff; border-bottom:1px solid #e5e7eb;">
      <td style="padding:0.75rem;"><strong>4. Did it get better?</strong></td>
      <td style="padding:0.75rem;">Held-out sets, paired evaluation, checkpoint choice and release</td>
      <td style="padding:0.75rem;">The published p-values, reproduced yourself</td>
    </tr>
  </tbody>
</table>

The capstone is your own training and evaluation plan for a defensive adapter, or a run report if you ran one. All four labs run on a laptop with no GPU and no account.

## How strong is the evidence that the recipe works?

Modest, and the course says so. The recipe's own page states that it had not been run as written when the course was verified on 5 December 2026. Its numbers come from an earlier 24-step run on different hardware with 96 tasks.

<table style="width:100%; border-collapse:collapse; margin:1.5rem 0; font-size:0.95rem;">
  <thead>
    <tr style="background:#f5f5f0; border-bottom:2px solid #2175C5;">
      <th style="text-align:left; padding:0.75rem; color:#5f6368;">Evaluation in the earlier run</th>
      <th style="text-align:right; padding:0.75rem; color:#5f6368;">Base model</th>
      <th style="text-align:right; padding:0.75rem; color:#5f6368;">After 24 steps</th>
      <th style="text-align:right; padding:0.75rem; color:#5f6368;">Exact p-value</th>
    </tr>
  </thead>
  <tbody>
    <tr style="border-bottom:1px solid #e5e7eb;">
      <td style="padding:0.75rem;">UltraCyber dev set, 100 tasks, 2 attempts each</td>
      <td style="text-align:right; padding:0.75rem; font-variant-numeric:tabular-nums;">105 of 200</td>
      <td style="text-align:right; padding:0.75rem; font-variant-numeric:tabular-nums;">123 of 200</td>
      <td style="text-align:right; padding:0.75rem; font-variant-numeric:tabular-nums;">0.017</td>
    </tr>
    <tr style="border-bottom:1px solid #e5e7eb;">
      <td style="padding:0.75rem;">CWE-bench sample, 25 tasks, 2 attempts each</td>
      <td style="text-align:right; padding:0.75rem; font-variant-numeric:tabular-nums;">2 of 50</td>
      <td style="text-align:right; padding:0.75rem; font-variant-numeric:tabular-nums;">6 of 50</td>
      <td style="text-align:right; padding:0.75rem; font-variant-numeric:tabular-nums;">0.125</td>
    </tr>
  </tbody>
</table>

The first result clears the usual 0.05 threshold and the second does not. In a separate run described in the Qwen4 blog post, the step 50 adapter solved 6 of 12 held-out tasks and the step 100 adapter solved 3, so more training was worse.

Lab 4 has you reproduce both p-values from the gained and lost counts, then work out how many tasks a result needs before it means something. That skill outlasts this recipe.

## Is the course defensive only?

Yes. It trains a model to fix flawed code, reproduce a reported crash for triage and audit authorization policy. It contains no attack code. The labs use a small function you write yourself and inputs that a fixed function must refuse.

Section 4 ends with a release unit: what an adapter was trained on, what it was evaluated on, what it must not be used for, and who signs off. A tuned model's patch still needs human review before it merges.

## How do the tutor and assessor agents work?

The course carries six agents. A tutor agent sits beside every unit, teaches one idea at a time and coaches the labs from the output you paste. An assessor agent grades each section and the capstone against a written rubric.

ibl.ai wrote the course from the published recipe, the dataset card, the trainer documentation and the papers behind them. Hugging Face, the TRL maintainers, the Qwen team and the dataset's authors did not write, review or endorse it.

## How do you enroll?

The course is free. Open [RL Fine-Tuning Qwen4 to Patch Security Bugs (2027)](/courses/cybersecurity/rl-fine-tuning-qwen4-security-patching-2027), choose Enroll, and sign in to lms.ibl.ai.

An organization that wants courses like this on its own subject can have ibl.ai's team build them on [Agentic LMS](/product/agentic-lms), on infrastructure it controls.
