Distilling a 9B Model: Reproducing Large-Model Reasoning and Tuning Refusal Behavior
This article breaks down a practical pipeline for compressing large-model reasoning into a privately deployable 9B open-source model. It covers verifiable sample construction, supervised fine-tuning (SFT) for process imitation, lightweight reinforcement learning with verifiable rewards, and representation-level tuning of over-refusal behavior across layers 9 to 24. It also explains the two evaluation curves teams must track together, along with deployment, cost, and compliance guidance for enterprise adoption.
1. The Technical Problem: Why a Small Model Can Inherit a Large Model’s Problem-Solving Ability
A 9B-class open-source model has recently ranked near the top on several public benchmarks. Its capability does not come from pre-training from scratch, but from two rounds of modification: first, a much larger model generated problem-solving samples to transfer its ability; second, its refusal behavior was adjusted in a targeted way.
This points to a practical technical question: in production environments constrained by compute and inference cost, can a large model’s reasoning ability be compressed into a small model that can be deployed privately?
To be clear, this approach is a common industry route and does not depend on any vendor’s proprietary capability. Its core is a combination of three mature techniques: knowledge distillation (using output sequences or internal representations as the supervision signal), supervised fine-tuning (SFT), and lightweight reinforcement learning based on verifiable rewards. Understanding the boundaries between these three is the prerequisite for reproducing the pipeline.
2. Pipeline Breakdown: From Large-Model Samples to Small-Model Weights
1. Sample Construction: Record “How It Was Derived,” Not Just “What the Answer Is”
In the original practice, a model with roughly 1.6 trillion total parameters generated about 250,000 math and STEM samples in a high reasoning-effort mode. The value of these samples lies not in the problem statement or the final answer, but in the fact that they fully expose the solution path: where to start, how to decompose subproblems, the basis for each derivation step, and how the conclusion is verified.
For engineering purposes, it helps to structure each sample into four parts for later filtering and deduplication:
{"problem": "Problem statement (math/STEM)","plan": "Starting point and subproblem decomposition","derivation": "Step-by-step derivation and intermediate quantities","answer": "Final answer and verification notes"}
Key quality-control points during construction include: prioritizing answer verifiability (numbers, expressions, and dimensions that can be checked automatically), checking reasoning-chain consistency (intermediate conclusions do not contradict each other), difficulty stratification (to make it easier to analyze where capability gains come from), and decontamination (removing problems that overlap heavily with evaluation sets).
2. Stage One: Supervised Fine-Tuning to Teach a 9B Model “Process Imitation”
Fine-tuning an open-source base of the same scale (about 9B parameters) on the samples above is essentially teaching the model the conditional distribution P(reasoning chain | problem statement). This stage determines more than 80% of the capability ceiling. In practice, keep the learning rate and batch size conservative, balance samples by difficulty and subject, and retain a general-capability regression set to avoid catastrophic forgetting that leaves the model “able to solve problems but unable to hold a conversation.”
3. Stage Two: Lightweight Reinforcement Learning to Turn “Similar” into “Correct”
Supervised fine-tuning only guarantees formal similarity. Reinforcement learning then tightens the distribution further using verifiable rewards (whether the answer is correct, whether steps can be checked for executability). A lightweight round of sequence-level policy optimization can improve accuracy and step robustness without significantly increasing inference overhead. Both stages limit the training objective to math and STEM reasoning and contain no coding data, which explains why the model shows no matching gains on code tasks.
3. The Second Modification: Targeted Tuning of Refusal Behavior
1. Principle: Locating the “Refusal Signal” in Internal Activations
On top of weights that already have specialized STEM ability, the second modification addresses an alignment side effect: over-refusal. The approach collects the model’s internal activations when handling different types of prompts, runs a comparative statistical analysis, identifies the signal direction strongly correlated with refusal outputs, and then makes small corrections to the weights of some layers to weaken that signal’s influence on the final output. This belongs to the category of representation engineering and is lower in cost and more controllable than redoing an alignment training run.
2. Configuration: Only Middle Layers Are Modified, with a Reproducible Scope
The public configuration limits the adjustment to layers 9 through 24, meaning only the middle representation layers are touched, while the bottom-layer language ability and the top-layer output distribution are preserved. The engineering implication is a controllable blast radius and a low rollback cost. A schematic flow:
# Pseudocode: locate refusal-related signals and apply layer-wise weight correctionacts_safe = collect_activations(model, safe_prompts) # normal answeringacts_refuse = collect_activations(model, refuse_prompts) # triggers refusaldirection = normalize(mean(acts_refuse) - mean(acts_safe))for layer in range(9, 25): # adjust middle layers onlyW = model.layers[layer].weightW -= strength * outer(direction, direction @ W) # project out along the signal directionmodel.layers[layer].weight = W
3. Evaluation: Two Curves Must Be Read Together
- Capability curve: changes in STEM scores after distillation, and inference cost per answer (generation length, latency, memory usage).
- Behavior curve: the drop in refusal count, and whether a reverse risk appears where the model fails to refuse when it should.
Looking only at the refusal drop hides safety regressions; looking only at scores ignores cost inflation. For enterprise deployment, put both curves in the same report alongside the general-capability regression set to form an auditable comparison.
4. Enterprise Deployment Advice and Compliance Boundaries
- Prioritize data compliance: confirm the source and licensing of distillation samples, and keep problem statements and solutions free of personal information and protected content.
- Balance capability and cost: the value of a small model lies in private deployment and unit inference cost, so always include inference overhead in acceptance metrics.
- Tune behavior with caution: weakening the refusal signal is a high-risk operation, so set a minimum necessary strength, use staged rollouts and two-way evaluation, and keep a fast rollback path.
- Use general-purpose capabilities for engineering: samples and weights can be stored in object storage, training and inference can run on a container platform, task scheduling can be handled by a message queue, and results and cost can be continuously observed through logging services and monitoring alerts.
- If an enterprise lacks in-house training capacity, it can complete the same pipeline using the general compute, storage, and model service categories offered by Baidu AI Cloud, keeping the method neutral and the metrics reproducible.
5. Conclusion
This repeatedly validated pipeline can be summarized as: verifiable sample construction → SFT to establish process imitation → lightweight RL to tighten correctness → targeted representation-layer adjustment to correct behavior → two-dimensional evaluation as the gate. It does not rely on any single product’s proprietary capability; it is the combined result of data quality, training mix, and evaluation discipline. Making each step a measurable, rollback-ready engineering stage turns a small model inheriting a large model’s reasoning ability from a “benchmark phenomenon” into a sustainable production practice.
