Knowledge Distillation and Activation Steering: Optimizing Lightweight LLM Reasoning

    This article explains how a 9B-parameter open-source model was substantially improved for math and STEM reasoning through a two-stage approach: knowledge distillation from a 1.6-trillion-parameter teacher model, followed by targeted activation intervention to suppress over-refusal behavior. It covers the data generation pipeline, supervised fine-tuning and lightweight reinforcement learning, the ARA-based method for locating refusal signals, the evaluation results (a 36.1% reduction in tokens per correct answer and a refusal rate drop from 100% to 3%), and practical guidance for cloud-based training, deployment, and monitoring. Readers will gain a reusable paradigm for customizing lightweight models for specialized domains under limited compute budgets.

    In the engineering and production deployment of large language models, balancing inference cost against model capability remains a core pain point for developers and enterprises alike. Faced with giant models of hundreds of billions or even trillions of parameters, small and mid-sized teams are often constrained by compute resources and cannot deploy at scale. As a result, a key research direction has emerged: how to take a lightweight model—such as an open-source model at the 9B parameter scale—and, through efficient fine-tuning, endow it with large-model-level capability in specific vertical domains such as mathematical reasoning and STEM problem solving.

    Recently, a community developer demonstrated a two-stage transformation—knowledge distillation followed by internal activation intervention—that significantly boosted a 9B model’s STEM reasoning ability while effectively suppressing its over-refusal problem. This practice offers a highly instructive paradigm for the customized training of lightweight models.

    1. Knowledge Distillation: Transferring Capability from a Trillion-Parameter Model to a Lightweight One

    At its core, knowledge distillation for LLMs converts the implicit reasoning ability embedded in a very large model into explicit features that a small model can directly learn, via high-quality training samples. The first stage of this practice revolved around building high-quality data and performing supervised fine-tuning.

    1.1 Generating High-Quality Chain-of-Thought Data

    The developer first called a leading large model with 1.6 trillion total parameters, enabling its reasoning-enhanced mode to generate roughly 250,000 math and STEM training samples. Unlike ordinary question-answer pairs (which contain only a question and an answer), this dataset recorded the complete chain-of-thought process in detail. Each sample covered the following dimensions:

    • Entry-point analysis: how to extract key conditions from a complex problem statement.
    • Problem decomposition: breaking a complex problem down into multiple computable sub-problems.
    • Step-by-step derivation: showing the mathematical operations or logical reasoning at each step.
    • Conclusion synthesis: aggregating sub-problem results into the final answer.

    Data containing this kind of deep reasoning process is what allows a small model to “learn to think” rather than merely memorize.

    1.2 Supervised Fine-Tuning and Lightweight Reinforcement Learning

    After obtaining the high-quality distilled data, the developer applied it to an open-source 9B-parameter base model for supervised fine-tuning (SFT). At this stage, by fitting these long-sequence reasoning samples, the model gradually acquired the logical paradigms of STEM problem solving.

    Subsequently, to further align problem-solving behavior, the developer ran a round of lightweight reinforcement learning using GSPO-like algorithms. Notably, both training stages were tightly focused on math and STEM reasoning, with no programming-related data included. This domain-focused training strategy effectively avoided the “catastrophic forgetting” common in multi-task learning, maximizing the 9B model’s specialized STEM capability.

    2. Activation Intervention: Precisely Suppressing the Model’s Over-Refusal Mechanism

    Although the distilled model performed well on STEM reasoning, the developer found that it suffered from severe over-refusal. During safety alignment, models are trained to guard against malicious queries, but they often become overly conservative, refusing even legitimate STEM questions. To address this, the developer applied an intervention technique based on internal activation signals.

    2.1 Locating the Refusal Signal

    The ARA (Activation Representation Analysis) method from a specific tool was used in this step. The core idea is that a model’s internal activation states differ when it decides to refuse versus when it answers normally. By feeding the model different types of prompts—including sensitive prompts that trigger refusals and normal STEM questions—and comparing the layer-wise internal activations across these inputs, the developer could precisely identify neuron signals highly correlated with refusal behavior.

    2.2 Targeted Weight Modification

    Once the key signals were located, the developer did not retrain the full parameter set. Instead, they directly modified the weights of selected network layers. Specifically, the modification range was precisely set to layers 9 through 24. By adjusting part of the weights in these layers, the influence of the refusal signal on the final output was effectively weakened. This approach resembles “surgical” parameter tuning: it corrects the behavioral deviation while preserving the model’s existing STEM reasoning ability to the greatest extent possible.

    3. Evaluation: Dual Gains in Accuracy and Cost Efficiency

    The two-stage transformation delivered clearly visible gains across three dimensions: STEM accuracy, inference efficiency, and refusal rate.

    3.1 Reasoning Accuracy and Token Cost Optimization

    According to the evaluation records, the distilled and fine-tuned 9B model achieved a significant improvement in accuracy on the STEM test set compared to the original base model. More importantly, it made a breakthrough in inference efficiency—the average number of inference tokens consumed per correctly solved problem decreased by about 36.1%. This means the model gets “straight to the point” when solving problems, cutting redundant filler and meaningless generation steps, which directly reduces compute consumption and response latency in real deployments.

    3.2 A Dramatic Drop in Refusal Rate

    In testing the activation-intervened variant, the developer used 100 prompts prone to triggering over-refusal. The results showed that the non-intervened distilled model refused all 100 prompts (a 100% refusal rate), while the variant with layers 9–24 modified refused only 3, bringing the refusal rate down to 3%. Meanwhile, the evaluation reported a KL divergence of 0.0422. KL divergence measures the difference in output probability distributions before and after the weight adjustment; such an extremely low value demonstrates that the intervention was very restrained—the model’s overall output distribution did not shift drastically, and its core capabilities were well preserved.

    4. Engineering Deployment: Cloud Practices for Lightweight Models

    For enterprise developers, this practice provides a complete pipeline from data distillation and model fine-tuning to behavior correction. In real-world implementation, enterprises can leverage general-purpose cloud infrastructure—such as that offered by Baidu AI Cloud—to efficiently iterate on and deploy lightweight models of this kind.

    4.1 Elastic Training on Cloud Container Platforms

    Fine-tuning a 9B-scale model, while less demanding on GPU memory than a hundred-billion-parameter model, still requires multi-GPU parallelism. Enterprises can use cloud container platforms (such as Baidu AI Cloud’s container service) to build elastic training clusters. During the SFT and lightweight RL stages, GPU compute can be scheduled dynamically and released after training completes, maximizing cost control.

    4.2 Storage and Scheduling for Large-Scale Reasoning Data

    Generating 250,000 high-quality samples with long chains of thought places considerable demands on storage systems. General-purpose cloud products such as object storage provide high-throughput, low-latency data reads, ensuring that training frameworks (such as DeepSpeed and Megatron) can pull data efficiently during fine-tuning without I/O becoming a bottleneck.

    4.3 Continuous Monitoring of Model Services

    Once the model is deployed online, teams need to monitor not only inference latency and accuracy but also actual refusal behavior and token consumption. By integrating cloud log services and monitoring/alerting systems, developers can capture the model’s behavior under real traffic in real time. If abnormal refusals appear in legitimate business scenarios, the relevant logs can be captured to quickly locate the activation-layer signals and carry out the next round of parameter correction.

    Conclusion

    Bigger is not always better for LLMs. For specific business scenarios, lightweight models refined through precise distillation and targeted optimization often deliver far better cost-performance. This 9B model transformation demonstrates that deep knowledge distillation combined with fine-grained internal activation intervention enables lightweight models not only to exhibit strong reasoning in specialized domains but also to achieve a high degree of behavioral customization. It points to a viable technical path for enterprises to build private, efficient, and controllable AI platforms under resource-constrained conditions.