A 2-billion-parameter model out of the box got 16% of kernel-crash decisions right. After training, it got 97.5%. That's the result Ring -1 Kernel Surgeon reports for MiniCPM5-2B, on its author's own synthetic test set. The recipe behind it is now common for turning small models into specialists: distillation, then supervised fine-tuning with LoRA, then reinforcement learning with GRPO. Here's what each step does.

10,000x
Fewer trainable parameters with LoRA (GPT-3 175B)
LoRA paper
0
Critic models GRPO needs, vs one for PPO
DeepSeekMath paper
16% → 97.5%
Ring -1 Surgeon test pass rate, base vs GRPO
Project README

Diagram: three steps. Distillation (a big teacher model writes example answers), SFT with LoRA (the small model learns to copy them using small add-on matrices), and RL with GRPO (sample a group of answers per prompt, score each with a checker, push toward above-average ones)

What is distillation?

The term comes from a 2015 paper by Geoffrey Hinton, Oriol Vinyals and Jeff Dean, "Distilling the Knowledge in a Neural Network". Its goal: compress "the knowledge in an ensemble into a single model" that is cheaper to run. The original method trains the small model on the big model's probabilities, "soft targets," rather than just the right answer. It raises "the temperature of the final softmax" so those probabilities carry more information.

Today the word is used more loosely. It often just means having a strong model write the training data. Ring -1 Kernel Surgeon did this: a DeepSeek model wrote answers for 600 synthetic crash scenarios through its API, according to the project's README.

What is supervised fine-tuning?

Supervised fine-tuning (SFT) teaches a model to reproduce example answers. Hugging Face's TRL library calls it "the simplest and most commonly used method to adapt a language model to a target dataset." Its SFT guide says the goal is to minimise "the negative log-likelihood (NLL) of the target sequence, conditioning on the input." In plain terms: make the example answers as likely as possible.

What does LoRA do?

Updating every weight in a large model is expensive. LoRA, short for Low-Rank Adaptation, introduced in a 2021 paper, avoids that. The LoRA paper "freezes the pre-trained model weights and injects trainable rank decomposition matrices." Rather than change a big weight matrix, you learn two thin matrices whose product is added to it.

The savings are large. For GPT-3 175B, the authors report LoRA "can reduce the number of trainable parameters by 10,000 times and the GPU memory requirement by 3 times" compared with full fine-tuning. Because the add-on can be merged back into the weights, there is "no additional inference latency."

A worked example (our arithmetic): a 4,096 × 4,096 weight matrix has about 16.8 million numbers. A rank-8 LoRA update for it trains two matrices of 4,096 × 8, about 65,500 numbers, 256 times fewer. Hugging Face's PEFT library packages this kind of method. As its docs put it, such methods "only fine-tune a small number of (extra) model parameters."

What is GRPO?

Fine-tuning teaches a model to imitate. Reinforcement learning teaches it to score well, which can take it beyond its examples. GRPO, Group Relative Policy Optimization, was introduced by DeepSeek in its February 2024 DeepSeekMath paper as "a variant of Proximal Policy Optimization (PPO)."

PPO, a 2017 method by John Schulman and colleagues (arXiv), trains a second "value" or critic model alongside the main one, to estimate how good each answer is. DeepSeekMath points out that this value model "is typically another model of comparable size as the policy model." GRPO drops it. In the paper's words, "GRPO foregoes the critic model, instead estimating the baseline from group scores, significantly reducing training resources."

How it works, per Hugging Face's GRPO trainer docs:

  1. For each prompt, sample a group of answers. TRL's documentation calls this group size G.
  2. Score each answer "using a reward model or reward function."
  3. Compare each score with the group's average, divided by the spread: (r_i - mean(r)) / std(r). Answers above average get reinforced and those below get discouraged. That comparison within the group gives the method its name.

Why do checkable rewards matter?

GRPO became famous with DeepSeek-R1. Its paper says DeepSeek used GRPO with "rule-based rewards": an accuracy reward that checks whether the answer is right, and a format reward. The team deliberately avoided neural reward models for reasoning tasks because they "are susceptible to reward hacking," where the model learns to fool the judge instead of solving the problem.

The pattern carries over well. When a computer can check the answer, the reward is honest. For maths, that means comparing the final number. For code, it means running tests.

Ring -1 Kernel Surgeon's checker applies the patch and runs it. Its three-level verifier checks the output's format and instruction safety, checks the safety policy, then executes the patched kernel code in a throwaway Linux virtual machine. The project reports test pass rates of 16.4% for the base model, 95.9% after SFT, and 97.5% after GRPO. Those are on synthetic scenarios from its own generator, not real-world kernel bugs.

FAQ

What is knowledge distillation?

Training a smaller model to reproduce a larger model's outputs. The 2015 Hinton paper used the big model's softened probabilities. Today the term often covers having a big model write training data.

What is LoRA?

A fine-tuning method that freezes a model's weights and trains small low-rank matrices added to them. The original paper reports 10,000x fewer trainable parameters for GPT-3 175B.

How is GRPO different from PPO?

PPO trains a separate critic model to judge answers. GRPO drops the critic. It samples a group of answers per prompt and scores each against the group's average.

Who created GRPO?

DeepSeek, in its DeepSeekMath paper (February 2024). It was later used to train DeepSeek-R1.

Do I need a reward model for GRPO?

No. A reward can be a plain function: tests passing, an exact maths answer, or a valid output format. DeepSeek-R1 used rule-based rewards for reasoning tasks.

Reader poll

Have you fine-tuned a small model?

Vote to see results.

  • #fine-tuning
  • #lora
  • #grpo
  • #distillation
  • #explainer