Distilling a 9B Model: Process Data, Lightweight RL, and Refusal Tuning Explained

    This article breaks down how a 9B open-source model reached the top of a community leaderboard through two stacked changes: capability distillation from a trillion-scale teacher model and behavior alignment via mid-layer weight edits. It covers the full pipeline—generating process-style STEM samples, supervised fine-tuning, lightweight RL with verifiable rewards, and adjusting refusal-related activations in layers 9–24—along with the paired evaluation metrics (97% format compliance, refusal rate dropping from 100% to 3%, KL divergence of 0.0422) and practical deployment, monitoring, and safety recommendations. Note that no coding data was involved, so the findings do not extend to code generation.

    1. What Actually Happened: The Technical Story Behind a Top-Ranked 9B Model

    A small-parameter model reaching the top of an open-source community leaderboard may look like a win for parameter efficiency, but it is really the result of two stacked modifications.

    The first is capability distillation: transferring a much larger model’s problem-solving process on math and STEM questions into a base model in the 9-billion-parameter range. The second is behavior alignment: adjusting the weights of several internal layers to weaken refusal-related activation signals, without retraining the core reasoning ability.

    Separating these two threads makes the engineering implications clearer:

    • Capability transfer addresses “can it solve the problem, and can it follow the required format.”
    • Behavior alignment addresses “is it willing to answer, and where is the refusal boundary.”
    • Both share the same weights, but their goals differ, so their evaluation criteria must be kept separate.

    It is worth stressing that this pipeline introduced no coding data. Training and evaluation focused entirely on math and STEM reasoning, so the conclusions cannot be directly extrapolated to code generation.

    2. Step 1: Using a Large Model to Mass-Produce “Process-Oriented” Samples

    The key to distillation is not the answer but the process. The original approach can be abstracted as follows:

    1. Select a teacher model with a total parameter count in the trillion range.
    2. Enable a high-compute / high-thinking-budget mode (the common “deep thinking” style configuration in the industry).
    3. Batch-generate roughly 250,000 samples against a math and STEM question bank.
    4. Each sample must include: an entry point, problem decomposition, step-by-step derivation, and the final answer.

    Illustrative data construction logic (pseudocode, structure only):

    1. for item in stem_benchmark:
    2. sample = teacher.generate(
    3. prompt=item.question,
    4. mode="max_effect", # high thinking budget
    5. require=["entry_point", "decomposition", "derivation", "answer"]
    6. )
    7. dataset.append(normalize(sample))

    Three things are mandatory in engineering terms. First, deduplication and difficulty stratification, so long-tail duplicate samples do not dilute the training signal. Second, format normalization, fixing “where to start / how to decompose / how to derive” into a parseable structure. Third, answer verification, using verifiable numerical or symbolic results to filter out incorrect derivations and prevent wrong processes from being distilled into the small model.

    3. Step 2: Supervised Fine-Tuning to Teach the 9B Model the Solving Process

    Next, this sample set is used to run supervised fine-tuning on an open-source base model in the 9-billion-parameter range. The objective function at this stage is still standard next-token prediction, but the data distribution determines that the model learns a “reasoning trajectory” rather than a “final answer.”

    Practical points:

    • Keep the learning rate and number of epochs restrained; small models have limited capacity, and overfitting sacrifices generality.
    • Retain general-purpose data for small-scale mixing to avoid catastrophic forgetting.
    • Apply length bucketing to long-derivation samples to improve memory utilization and throughput.
    • Evaluate format compliance first, then talk about accuracy.

    4. Step 3: Lightweight Reinforcement Learning for Preference-Level Tuning

    After supervised fine-tuning, add a round of lightweight reinforcement learning (such as sequence-level policy optimization methods). Its role is not to inject new knowledge but to make the model more consistently select high-scoring paths along its existing reasoning trajectories, reducing the share of cases where it “can solve it but gets the format wrong or drifts midway.”

    Illustration:

    1. # Lightweight RL: rely mainly on verifiable rewards to avoid reward hacking
    2. reward = correctness(answer) * 1.0 + format_follow(json_schema) * 0.3
    3. policy = grpo_step(policy, prompts, reward_fn=reward, kl_coef=0.02)

    Two cautions: rewards must be verifiable and reproducible; the KL constraint must not be missing, or the small model will drift very easily.

    5. Step 4: Activation-Layer Weight Adjustment for Refusal Behavior

    The second modification targets refusal. The method can be abstracted as: compare the model’s internal activations when handling different types of prompts, locate the signals strongly correlated with refusal, then modify the weights of some layers to reduce the influence of those signals on the output. The original configuration limited the adjustment range to layers 9 through 24, a typical “mid-layer intervention.”

    It can be understood as the following illustration:

    1. activations = collect_activations(model, prompts_safe, prompts_refuse)
    2. signal = locate_refusal_direction(activations) # find the refusal-related direction
    3. for layer in range(8, 24): # layers 9-24
    4. model.layers[layer].weight -= alpha * project(signal, layer)

    The risk of this kind of intervention is that weakening it too much also damages the safety boundary and factuality. So three classes of metrics must be monitored at the same time: refusal rate, accuracy, and safety red lines.

    6. Evaluation: Read Metrics in Pairs, Not One at a Time

    The original experiment recorded two key sets of results:

    • After distillation, STEM scores improved slightly, and the proportion of outputs in the required format was close to 97%.
    • In the refusal comparison, for the same set of 100 prompts, the distilled version refused all of them, while after adjustment only 3 were refused.
    • The change in the output probability distribution before and after the weight adjustment was measured with KL divergence, at 0.0422.

    Key takeaways:

    1. A 97% format compliance rate shows that process-oriented data yields clear benefits for structured output.
    2. Refusal dropping from 100% to 3% indicates that refusal comes more from alignment-layer signals than from a lack of capability.
    3. KL = 0.0422 is a fairly mild perturbation, meaning the general distribution was not substantially rewritten, but “mild” does not mean “risk-free”; regression testing is still required.

    Recommended evaluation matrix:

    Dimension Metric Purpose
    Capability Math/STEM accuracy Verify distillation gains
    Format Structured output ratio Verify effectiveness of process data
    Behavior Refusal rate Verify effect of weight adjustment
    Stability KL divergence, perplexity Verify drift magnitude
    Safety Red-line case pass rate Backstop risk control

    7. Engineering Deployment Recommendations

    • Data side: build a verifiable-answer pipeline where process samples must pass both an answer check and a format check.
    • Training side: decouple supervised fine-tuning from lightweight RL and keep separate checkpoints for each, making rollback easy.
    • Alignment side: tune the three parameters—layer range, strength coefficient, and KL ceiling—together with a small-step grid search.
    • Launch side: turn refusal rate and accuracy into a monitoring and alerting dashboard, with automatic rollback to the previous weight version on abnormal fluctuation.
    • Compliance side: any weakening of refusal must be paired with safety evaluation, avoiding sacrificing boundaries for the sake of metrics.

    8. Conclusion

    This chain—a large-parameter teacher model producing process samples → supervised fine-tuning of the small model → lightweight reinforcement learning → weakening of mid-layer refusal signals—is a typical paradigm for small models to efficiently acquire STEM reasoning ability. Its value lies not in a leaderboard position but in providing a reusable engineering method: trade process data for capability, trade activation intervention for behavior, and trade paired metrics for certainty.