Goal: Distill a larger open-source causal language model ("teacher") into a smaller student model using two complementary approaches — a Trainer-API supervised distillation pattern, and TRL's on-policy GKDTrainer — then run a quality-vs-size tradeoff analysis comparing your distilled student to a same-size non-distilled baseline. All work happens in a free Google Colab notebook using free/local, open-source tools only. Steps:
transformers, trl, datasets, accelerate, and evaluate.transformers.Trainer pattern to your causal LM pair: run the teacher's forward pass to get logits over your dataset, and train the student with a combined loss (standard language-modeling loss on hard labels plus a KL term between student and teacher logits). Train for a small number of epochs.GKDTrainer (on-policy). Using the TRL GKD Trainer documentation, configure GKDTrainer with your same teacher/student pair. Train a second student copy this way, letting the student generate its own sequences during training with teacher feedback via the generalized JSD loss.GKDTrainer configurations with different values of the lambda parameter that blends the supervised JSD loss with the on-policy, student-generated-sequence loss (for example, a lower value favoring supervised loss vs. a higher value favoring on-policy loss). Record training loss curves for each.GKDTrainer lambda), and the non-distilled baseline, measure: (a) perplexity or task accuracy on a held-out split, (b) parameter count, and (c) inference latency (average seconds per generated response over a fixed batch of prompts, measured locally in the Colab runtime). Build one table with all four models as rows.GKDTrainer) performed better, and does that match what the reverse-KL / on-policy theory from lecture predicts? What was the accuracy (or perplexity) gained per parameter saved and per unit of latency change, relative to the teacher?Deliverables: Submit your Colab notebook (.ipynb, shared link or exported file) containing all training runs and code, your tradeoff-analysis table, and your written analysis — either as an uploaded file or pasted into the text entry box.