Distilling Large Model Reasoning into a 9B Small Model: A Complete Practical Guide
This guide walks through a practical workflow for transferring reasoning ability from a very large language model into a 9B-parameter student model. It covers building reasoning-trace training data, supervised fine-tuning (SFT), lightweight reinforcement learning with automatically verifiable rewards, and a weight-level method that adjusts refusal behavior through activation analysis. It also explains which metrics to use when evaluating the result.
Introduction: Packing Large-Model Capability into a Small Model
For reasoning tasks, parameter count often sets the ceiling on capability. Models with trillions of parameters perform well on mathematical derivation and science and engineering problems. However, their deployment cost, inference latency, and resource consumption put them out of reach for most teams. A classic engineering approach has been validated repeatedly: use a large model as the “teacher” and a small model as the “student,” and use knowledge distillation to transfer the reasoning process, not just the answers.
This article follows a typical practical case and breaks down the capability transfer from a very large model to a 9B small model. The process has four key stages: reasoning sample construction, supervised fine-tuning (SFT), lightweight reinforcement learning, and a weight-level behavior adjustment method based on internal activation analysis. The workflow does not depend on any specific vendor product. All methods are common techniques in the industry.
1. Sample Construction: Data Quality Sets the Ceiling for Distillation
The effectiveness of distillation is largely capped by sample quality. In this case, the teacher model generated about 250,000 math and science samples. Their value lies not in the quantity but in the fact that each sample records the complete problem-solving process:
- Entry point: how to identify the problem type and choose a solving strategy when facing a question;
- Decomposition path: how a complex problem is broken into manageable subproblems;
- Step-by-step derivation: the intermediate conclusions and reasoning basis for each step;
- Final answer and verification: how the conclusion was reached and whether it is internally consistent.
This differs fundamentally from naive distillation that only uses questions and answers. Fine-tuning on answers alone tends to teach the small model a surface-level mapping, and it quickly fails on out-of-distribution problems. Learning from reasoning traces uses the teacher’s chain of thought (CoT) as the supervision signal. This lets the student model internalize how to think rather than only what to say.
Engineering recommendations: When constructing distillation samples, keep three points in mind. First, the teacher model should run in a high-reasoning-effort mode, such as an extended thinking configuration, to ensure trace quality. Second, the samples should cover a range of difficulty levels and problem types, so the student model does not overfit to a single style. Third, deduplicate samples, check their format, and filter them for answer consistency. Contamination from low-quality traces is more dangerous than a shortage of samples.
2. Supervised Fine-Tuning: Teaching the 9B Model to Reason
The student model is an open-source base model with 9 billion parameters. The choice of this size is practical. A 9B model can be fine-tuned and run for inference on a single consumer-grade or entry-level data-center GPU, which keeps deployment costs low. Its capacity is still large enough to hold the core patterns of mathematical reasoning.
Key points for the SFT stage include:
- Sequence length planning: Reasoning traces are usually long, so the training window must cover the complete chain of thought. Otherwise, the model learns the bad habit of stopping midway. If GPU memory is limited, techniques such as gradient accumulation, sequence packing, or long-sequence parallelism can help.
- Loss masking: Computing loss only on the response and masking the prompt is standard practice in SFT. This prevents the model from spending capacity on fitting the input text.
- Learning rate and epochs: Small-model distillation typically uses a smaller learning rate and 2 to 3 epochs. More epochs make the model memorize the samples instead of generalizing.
3. Lightweight Reinforcement Learning: From Imitation to Stable Output
After SFT, the case applied one round of lightweight reinforcement learning based on the Group Sequence Policy Optimization approach. This stage serves three purposes:
- Correcting exposure bias in SFT: SFT trains the model to imitate the teacher one token at a time, but at inference time the model generates autoregressively, so errors accumulate. Reinforcement learning optimizes at the level of the complete generated sequence, which is closer to real usage.
- Automatically constructed rewards: Answers to math and science tasks can usually be verified programmatically, through numerical comparison or equivalence checks. This provides reliable reward signals without manual annotation, which is the main reason this stage is low-cost.
- What “lightweight” means: Once the student model has basic reasoning ability, a small number of RL steps can noticeably improve stability. Training for too long, however, may lead to reward hacking or style degradation.
Both stages were strictly limited to math and science reasoning data. No data from other domains, such as programming, was included. This domain-focused strategy is worth adopting. Under a limited parameter budget, deep optimization in a narrow domain usually outperforms shallow coverage of a broad domain.
4. Weight-Level Behavior Adjustment: Refusal Intervention Based on Activation Analysis
The second stage of the case is more exploratory. On top of the completed science-focused weights, the team used an automated method, inspired by activation analysis, to adjust the model’s refusal behavior. The core principle has three steps:
- Activation contrast: Run the model on prompts that trigger refusals and on ordinary prompts, extract the internal activations of each layer, and use differential analysis to locate a direction in activation space that strongly correlates with the refusal behavior.
- Directional intervention: Remove the identified behavior direction from the weights or residual stream of the relevant layers, so that this signal has less influence on the final output.
- Scope control: Adjust only a specified range of middle layers, which in the case were layers 9 through 24. This avoids the layers responsible for low-level language modeling and high-level semantic integration, which preserves the original capabilities as much as possible.
The results include quantitative support for the method’s effect. On the same set of 100 trigger prompts, the distilled model refused all 100 before adjustment and refused only 3 after adjustment. The KL divergence between the output distributions before and after adjustment was only 0.0422. This indicates that the behavior changed significantly while the overall capability was barely disturbed. This is the key difference between a precise intervention and retraining through fine-tuning.
One caveat is important here. The refusal mechanism is itself a product of safety alignment. Interventions on it should serve the legitimate goal of reducing over-refusal, meaning cases where the model wrongly refuses completely normal science and engineering questions. Any technique that weakens safety behavior should be paired with rigorous red-team testing and strict usage boundaries. This helps ensure the model behaves in line with safety standards and regulatory requirements in real-world settings.
5. Evaluation: Which Metrics Matter
For a composite transformation that combines distillation and behavior adjustment, the evaluation should cover at least the following dimensions:
- Capability retention: Compare accuracy on standard mathematical reasoning benchmarks before and after the intervention to confirm that core abilities were not damaged.
- Behavioral metrics: Refusal rate, and the share of outputs that follow the required format (close to 97% in this case).
- Distribution shift: Metrics such as KL divergence measure how invasive the intervention was.
- Inference cost: A core value of a small model is lower cost, so token consumption and latency changes should be measured.
Conclusion: A Reusable Paradigm for Small-Model Capability Transfer
Looking back at the full pipeline, which includes high-quality reasoning-trace construction, domain-focused SFT, lightweight RL driven by verifiable rewards, and precise behavior adjustment based on activation analysis, the case shows a clear and reusable paradigm. Capability transfer depends on data and training, while behavior calibration depends on understanding and intervening in the model’s internal mechanisms. For teams that want to bring large-model capabilities into low-cost deployments, this methodology offers more long-term value than any single model. At the same time, behavior intervention techniques must stay within firm safety and compliance boundaries, so that a more obedient small model is also a more reliable one.
