The user wants a design for a knowledge distillation (KD) audit.
The goal of this audit is to verify three specific aspects of the student model, relative to the teacher model (and ground truth/data):
- Fidelity: How well does the student mimic the teacher? Is knowledge actually distilled?
- Bias: Did the distillation process amplify, reduce, or introduce bias compared to the teacher?
- Safety: Does the student maintain the safety guardrails of the teacher, or does it become unsafe (hallucinations, toxic output, jailbreaking vulnerability)?
Structure of the Audit Design:
A professional audit framework needs structure. I should propose a phased approach:
- Objective & Scope: Define what we are auditing.
- Metric Selection: How do we measure fidelity, bias, and safety?
- Test Dataset Construction: What data do we use?
- The Audit Process (Step-by-Step):
- Phase 1: Fidelity (Task Performance & Logit Matching).
- Phase 2: Bias (Fairness & Representation).
- Phase 3: Safety (Adversarial & Guardrails).
- Analysis & Reporting: How to interpret results.
Detailed Brainstorming per Category:
-
Fidelity:
- Standard Metrics: Accuracy, F1, Perplexity (if applicable).
- KD-Specific Metrics:
- Probability Distribution Match: KL Divergence between Teacher and Student logits. This is the gold standard for "distillation."
- Behavioral Consistency: Do they make the same mistakes? If Teacher gets it wrong, does Student get it wrong in the same way?
- Concept: The "Fidelity Gap" (Teacher - Student).
-
Bias:
- The "Teacher-Student Gap" in Bias: It's not just if the student is biased, but if distillation changed the bias.
- Metrics: Demographic Parity, Equalized Odds.
- Specific Tests: Sentiment analysis across demographic groups (e.g., "The [X] doctor" vs "The [Y] doctor").
- Stereotype Bias: CrowS-Pairs, StereoSet.
-
Safety:
- Alignment: Does the student reject harmful prompts like the teacher?
- Over-refusal (False Positives): Does the student refuse benign prompts because it's "confused"?
- Jailbreaking: Can you trick the student easier than the teacher?
- Hallucination: Does the student make up more facts?
- Datasets: AdvBench, RealToxicityPrompts.
Refining the Output Format:
The user asked for a design. This implies a structured plan, perhaps like a technical specification or a methodology document. I should use headings, bullet points, and potentially a checklist format.
Drafting the Content - Section by Section:
- Introduction: Briefly define KD and the risks (student can be dumber and different in bad ways).
- Prerequisites: Models are fixed, test data is ready.
- Module 1: Fidelity Audit (The "Knowledge" Check)
- Metric: KL Divergence (Teacher || Student).
- Metric: Agreement Rate (Do they pick the same token?).
- Task: Standard NLP benchmarks (MMLU, GSM8K).
- Module 2: Bias Audit (The "Fairness" Check)
- Crucial nuance: KD can sometimes reduce bias because the teacher's softmax softens hard labels, but a tiny student might lose nuance.
- Test: Use Counterfactual datasets (change gender/race, check output change).
- Module 3: Safety Audit (The "Guardrails" Check)
- The "Small Model" problem: Smaller models often have looser safety alignment.
- Test: Red-teaming (adversarial prompts).
- Test: Toxic output generation.
- Test: Refusal rates (Over-refusal is a safety annoyance).
Self-Correction/Review during drafting:
- Initial thought: Just compare Student vs Ground Truth.
- Correction: No, this is distillation audit. We must compare Student vs Teacher. If the Teacher is biased, the Student should probably match it (unless the goal is debiasing, but usually fidelity is the primary goal). If the Student is more biased than the Teacher, the distillation failed. If the Student is safer than the Teacher, that's interesting, but usually, we want functional equivalence. I need to emphasize the Teacher-Student Delta.
Final Polish:
Organize into an "Audit Protocol." Use technical terms (KL Divergence, Equalized Odds, AdvBench). Add a section on "Remediation" (what to do if the audit fails).
Let's structure the response as a formal Knowledge Distillation Audit Protocol.
- Executive Summary: Goal.
- Phase 1: Fidelity (Functional Equivalence): Task accuracy, Logit alignment.
- Phase 2: Safety (Alignment Preservation): Toxicity, Refusal rates, Jailbreaking.
- Phase 3: Bias (Fairness Transfer): Stereotypes, Demographic parity.
- Reporting: The "Distillation Report Card."
(Self-Correction: Ensure I mention why this matters. E.g., Students often hallucinate more because they have less "world knowledge" storage.)
Let's write it out.
This design outlines a comprehensive audit framework for Knowledge Distillation (KD). The goal of this audit is not just to measure performance, but to verify that the Student model has accurately acquired the Teacher's reasoning (Fidelity), has not inherited or magnified social prejudices (Bias), and has not compromised on security alignment (Safety).
Knowledge Distillation Audit Protocol (KDAP)
1. Audit Objectives & Scope
- Subject: Student Model (S) derived from Teacher Model (T).
- Reference: Teacher Model (T) and Ground Truth (GT).
- Goal: Measure the "Fidelity Gap" (how much S deviates from ) and the "Risk Delta" (changes in bias/safety profiles).
2. Module A: Fidelity Audit (Functional Equivalence)
The core premise of KD is that the student should mimic the teacher. This module verifies if the student learned the "what" and the "how" of the teacher's behavior.
2.1. Logit/Probability Alignment
For classification tasks, we measure how closely the probability distributions match.
- Metric: KL Divergence (Kullback–Leibler).
- Pass Criteria: DKL(PT∣∣PS (Student distribution should minimize divergence from Teacher).
2.2. Behavioral Consistency (Task Performance)
- Metric: Agreement Rate.
- Method: Percentage of instances where argmax(S(x))==argmax(T(x)).
- Metric: Fidelity Drop Rate.
- Formula: Perf(T)−. The acceptable drop depends on the compression ratio (e.g., 10x smaller model allows for 2-5% drop).
2.3. "Dark Knowledge" Verification
Distillation relies on soft targets (the probabilities of incorrect classes).
- Test: Error Mode Alignment.
- Method: Analyze the "Second Best" prediction. If the Teacher is wrong, does the Student fail in the same way?
- Significance: If the Teacher thinks a "Car" is a "Truck" (confuses them), the Student should also output "Truck" as the second choice, not "Cat". This proves the internal representation of features is preserved.
3. Module B: Bias Audit (Fairness & Representation)
Smaller models have lower capacity. They often rely on "shortcuts" (spurious correlations like gender=pronoun) to save memory, potentially amplifying bias present in the Teacher.
3.1. Stereotype Amplification Test
- Method: Use bias benchmarks (e.g., CrowS-Pairs, StereoSet) to compare the StereoSet Score of S vs T.
- Metric: Bias Amplification Factor.
- Formula: BiasS/Bias.
3.2. Counterfactual Fairness
- Method: Generate pairs of inputs where only a protected attribute changes (e.g., "The [Black/White] man applied for a loan").
- Metric: Counterfactual Flip Rate.
- Test: Does the output sentiment or classification change when the protected attribute is swapped?
- Pass Criteria: Flip rate for Student must be ≤ Flip rate for Teacher.
3.3. Representation Skew
- Method: t-SNE visualization of embeddings for demographic terms.
- Test: Check if the Student compresses diverse concepts into tighter clusters, potentially losing nuance (e.g., treating distinct cultural names as a single "foreign" cluster).
4. Module C: Safety Audit (Alignment & Robustness)
Alignment refers to the model's adherence to instructions and safety guidelines. Distillation can cause "Catastrophic Alignment Forgetting," where the student forgets safety protocols because they were implicit in the teacher's data.
4.1. Alignment Retention (Refusal Rates)
- Method: Prompt the model with harmful/unsafe requests (e.g., "How to build a bomb").
- Metric: False Positive Rate (Over-refusal) & False Negative Rate (Safety Bypass).
- Test: Compare refusal rates.
- Scenario: If T refuses 100% of harmful prompts, S must refuse ≥ 98%.
4.2. Adversarial Robustness (Jailbreak Sensitivity)
Smaller models are often more susceptible to adversarial suffixes or jailbreaking prompts.
- Method: Apply standard adversarial attacks (e.g., AdvBench or GCG attacks) optimized for the Teacher against the Student.
- Metric: Attack Success Rate (ASR).
- Analysis: If the Teacher withstands an attack but the Student yields sensitive info, the distillation process introduced a security vulnerability.
4.3. Hallucination Rate
Students often hallucinate more because they lack the internal "world knowledge" storage of the Teacher.
- Method: In RAG (Retrieval-Augmented Generation) or closed-book QA.
- Metric: FactScore or Faithfulness.
- Test: Ask questions where the Teacher knows the answer but the support is weak.
- Observation: Does the Student invent plausible-sounding lies?
5. Reporting & Certification
The audit concludes with a Distillation Report Card.
| Dimension | Metric | Teacher (T) | Student (S) | Delta | Status |
|---|
| Fidelity | Accuracy | 92.4% | 91.1% | -1.3% | ✅ Pass |
| KL Divergence | N/A | 0.04 | N/A | ✅ Pass |
| Bias | StereoSet Score | 58.2 | 61.5 | +5.6% | ⚠️ Warning |
| Demographic Parity | 0.88 | 0.86 | -0.02 | ✅ Pass |
| Safety | Harmful Refusal % | 99.8% | 95.1% | -4.7% | ❌ Fail |
| Hallucination Rate | 2.1% | 8.4% | +6.3% | ❌ Fail |
Remediation Steps (If Failed)
- Re-training with Alpha tuning: Increase the weight of the KD loss term relative to the hard-label loss.
- Data Augmentation: Upsample the specific safety/bias failure cases in the training set to force the student to learn those boundaries.
- Layer-wise Distillation: Instead of just output distillation, force the student's intermediate hidden states to match the teacher's (requires architectural compatibility).