Large Language Model Distillation and Refusal Behavior Tuning: A Practical Breakdown

    This article breaks down a three-stage engineering pipeline behind small-parameter models that climb open-source leaderboards: process-level distillation from a trillion-parameter teacher, lightweight reinforcement learning, and targeted refusal behavior adjustment through intermediate-layer activation analysis. It covers sample design, supervised fine-tuning practices, layer selection, and the evaluation metrics—accuracy, format compliance, refusal rate, and KL divergence—that teams need to monitor together.

    1. Background: Why Small-Parameter Models Keep Reaching the Top of Leaderboards

    A recent pattern has drawn attention: a derivative of a 9B-class small model reaching the top of an open-source model community leaderboard. The technical core is not mysterious. First, a model with trillions of parameters generates high-quality problem-solving samples. Those samples are then used to supervised fine-tune a mid-sized open-source base model. A round of lightweight reinforcement learning is added on top. Finally, refusal behavior is adjusted in a targeted way on the trained weights. The whole process involves two rounds of modification, corresponding to two goals: capability transfer and behavior shaping.

    Note that this article does not discuss the names of any specific model, community, or tool. It abstracts only the technical paradigm. For developers, what is genuinely valuable is the reusable engineering workflow and evaluation methodology.

    2. Stage One: Transferring Capability from a Giant Model’s Problem-Solving Samples to a Small Model

    2.1 Sample Generation: Record the Process, Not Just the Answer

    The key to distillation is not the answer but the reasoning trajectory. Have a teacher model with a total parameter count in the trillions generate roughly 250,000 math and STEM samples in high reasoning-effort mode. Each sample must contain: where to start, how to break the problem down, how each step is derived, and what the final conclusion is. This data shape lets a 9B-parameter student model learn the “problem-solving process” rather than only memorization-style answer matching.

    An illustrative data structure (with neutralized fields):

    1. {
    2. "prompt": "text of a subject problem",
    3. "reasoning_trace": ["starting point", "decomposition step 1", "derivation step 2", "..."],
    4. "final_answer": "conclusion",
    5. "domain": "math|physics|chemistry",
    6. "difficulty": 3
    7. }

    2.2 Supervised Fine-Tuning: Align the Student Model with the Teacher’s Problem Decomposition

    Supervised fine-tuning the 9B-parameter base on the samples above is essentially pushing the student’s output distribution toward the teacher’s. Three engineering points matter. First, deduplicate samples and stratify by difficulty to avoid overfitting caused by long-tail repetition. Second, control context length; reasoning trajectories tend to be long, so memory and throughput must be balanced. Third, preserve a general-purpose corpus ratio to prevent capability collapse where the model “can only solve problems and cannot hold a conversation.”

    2.3 Lightweight Reinforcement Learning: A Second Polish with Sequence-Level Objectives

    Adding a round of lightweight reinforcement learning after supervised fine-tuning (a sequence-level preference optimization approach common in the industry) can further improve the stability of math and STEM reasoning without introducing coding data. The learning rate at this stage is typically significantly lower than in the fine-tuning stage, and the number of update steps is limited. The goal is to “trim the edges,” not to “reshape.”

    It should be pointed out that both stages revolve around STEM reasoning and use no coding data, which explains why the derivative has no inherent advantage on code tasks.

    3. Stage Two: Refusal Behavior Adjustment Based on Internal Activation Analysis

    The second stage no longer changes “whether it can solve problems” but “whether it is willing to answer.” A class of methods based on activation-difference analysis (generically referred to here as ARA-type methods) compares the model’s internal activations when processing different types of prompts, identifies the signal directions strongly correlated with refusal behavior, and then makes small modifications to the weights of some layers to weaken the influence of those signals on the final output.

    3.2 Configuration: Modify Only Intermediate Layers to Control Side Effects

    The public configuration sets the adjustment range to layers 9 through 24, a typical “intermediate-layer surgery.” In practice, changes that are too shallow damage basic language ability, while changes that are too deep tend to affect the alignment safety boundary. Intermediate layers are the most cost-effective compromise.

    Illustrative pseudocode:

    1. # Pseudocode: illustrates the flow only, not any specific implementation
    2. acts_ref = collect_activations(model, prompts_type_a)
    3. acts_rej = collect_activations(model, prompts_type_b)
    4. direction = normalize(acts_rej.mean(0) - acts_ref.mean(0))
    5. for layer in range(8, 24): # layers 9 to 24
    6. W = model.layers[layer].weight
    7. W -= lr * outer(direction, direction @ W.T)

    3.3 Evaluation: Refusal Rate and Distribution Drift Must Be Read Together

    The derivative model’s card places a refusal comparison at the top and reports a KL divergence of 0.0422 to describe the change in the output probability distribution before and after adjustment. On the same set of 100 prompts, the distilled version refused all of them, while after adjustment only 3 were refused. At the same time, STEM accuracy improved slightly, and the proportion of outputs in the required format was close to 97%.

    The engineering meaning of these numbers is that the adjustment is effective, but distribution drift is kept at a low level, indicating the change is “targeted” rather than “blunt.” When putting this into practice, developers should monitor three metrics simultaneously—task accuracy, format compliance rate, and KL divergence. None can be omitted.

    4. A Reusable Practice Checklist

    1. Data layer: teacher samples must contain complete reasoning chains, sampled in strata by subject and difficulty.
    2. Training layer: first supervised fine-tuning to align the process, then lightweight reinforcement learning to trim edges, with a decreasing learning rate.
    3. Behavior layer: use activation differences to locate the refusal direction, and modify only a few intermediate layers.
    4. Evaluation layer: read accuracy, format compliance rate, refusal rate, and KL divergence together across all four.
    5. Safety layer: refusal behavior adjustment must retain safety red-line samples for regression testing to avoid over-correction.

    5. Conclusion

    A “9B small model reaching the top” is not magic. It is the stacked result of three engineering stages: strong-teacher process distillation + lightweight reinforcement learning + intermediate-layer activation-targeted adjustment. For teams with limited resources, the lesson from this path is clear: rather than pursuing a larger base model, make the reasoning-process data thicker, make the behavior adjustment more precise, and make the evaluation more complete. Building the training and evaluation pipeline on general capabilities such as the container platform, object storage, and monitoring and alerting offered by Baidu AI Cloud can further reduce engineering complexity.