Abstract
Previous studies have shown that demonstrations can significantly help Large Language Models (LLMs) perform better on given tasks. However, this so-called In-Context Learning (ICL) ability is very sensitive to the presenting context, and often dozens of demonstrations are needed. In this work, we investigate if we can reduce the shot number while still maintaining competitive performance. We present SeCoKD, a self-Knowledge Distillation (KD) training framework that aligns the student model with a heavily prompted variation, thereby increasing the utilization of a single demonstration. We experiment with SeCoKD across three LLMs and six benchmarks focusing mainly on reasoning tasks. Results show that our method outperforms the base model and Supervised Fine-tuning (SFT), especially in zero-shot and one-shot settings by 30% and 10%, respectively. Moreover, SeCoKD brings few negative artifacts when evaluated on new tasks, demonstrating greater robustness than standard Supervised Fine-tuning.
Introduction
In-Context Learning (ICL) has emerged as a powerful paradigm, allowing Large Language Models (LLMs) to solve new tasks by simply providing a few examples (shots) within the prompt. Despite its success, ICL is notoriously fickle; performance is highly sensitive to the number of examples, their order, and their quality. While "many-shot" prompting can stabilize performance, it consumes significant portions of the context window and increases computational costs.
Humans are excellent one-shot learners, typically requiring only a single example to grasp a task's logic. In contrast, there is a significant gap between the internal knowledge an LLM possesses and its ability to activate that knowledge with minimal guidance. SeCoKD aims to bridge this gap, making models more efficient and robust when provided with very few demonstrations.
Methodology
The core of the proposed framework is Self-Context Knowledge Distillation (SeCoKD). The central idea is to use the model to teach itself how to perform complex tasks with fewer examples. The process involves two main phases:
- The Teacher Phase: The base LLM is provided with a "heavy" prompt, typically an 8-shot prompt utilizing Chain-of-Thought (CoT) reasoning. Given these extensive examples and reasoning paths, the model generates high-quality rationales and correct answers for a training set.
- The Student Phase: The same model is then fine-tuned (using LoRA for efficiency) to produce those same high-quality rationales and answers. However, during this phase, the model is only given a "light" prompt (0 to 4 shots).
Through this alignment, the model learns to trigger the same high-quality reasoning with a single demonstration that previously required eight. Two variants were tested: SeCoKD-S (trained strictly on 1-shot) and SeCoKD-M (trained on a mix of 1-4 shots).
Experimental Setup
The researchers evaluated SeCoKD across six diverse reasoning benchmarks:
- Arithmetic Reasoning: GSM8K (grade school math), SVAMP (math word problems), and AQUA-RAT (algebraic multiple choice).
- Commonsense Reasoning: ARC-C (science questions) and CSQA (general commonsense).
- Symbolic Reasoning: Coin-Flip (tracking state changes).
Experiments were conducted using three popular open-source model families: Llama 3-8B, Llama 2-7B, and Mistral-7B.
Results and Discussion
SeCoKD consistently outperformed both base models and SFT baselines. On average, it improved zero-shot performance by 30% and one-shot performance by 10%.
As shown in the performance curves, SeCoKD models reach their performance ceiling much faster than base models. In many cases, adding more than one or two demonstrations provides diminishing returns, making the model highly efficient for real-world deployment where context space is limited.
Activation vs. Internalization
Unlike standard Supervised Fine-Tuning (SFT), which often attempts to bake new knowledge into model weights, SeCoKD focuses on activating existing internal knowledge. It teaches the model how to better utilize the information provided in a single demonstration. This approach proves more robust; while SFT can lead to "negative artifacts" (degrading performance on non-target tasks), SeCoKD often demonstrates "positive transfer," where training on one task (e.g., math) improves performance on unrelated tasks (e.g., commonsense reasoning).
Conclusion
SeCoKD effectively converts difficult queries into manageable ones by making the model more responsive to minimal prompt guidance. While current experiments focused on models under 10B parameters and reasoning tasks, future work will explore scaling to larger models (70B+) and broader task varieties such as summarization and translation. Additionally, the potential for cross-model distillation—using a larger model as a teacher for a smaller student—remains a promising avenue for further efficiency gains.
Summary updated