< Will Bosler

Knowledge Distillation ยท

Knowledge distillation aims to compress a larger more performant teacher model into a smaller, cheaper student model whilst minimising performance degradation.

Cheap in this context refers to how computationally expensive it is to run the model. Ceteris paribus, a larger model, based on number of parameters, will require more compute resources to facilitate inference. This has downstream implications for the speed of token generation and financial costs.

There are three primary categories of distillation techniques. Supervised Fine Tuning (SFT), Divergence Based Methods (DBM) and Reinforcement learning (RL). With SFT, we use the larger Teacher model to generate synthetic data. We then fine tune the student on this data. For DBM, we include a term in the loss function that penalises deviation from the teacher, and during training minimise this new composite loss function. For RL, we solicit preference data and create a new loss function that accounts for these preferences.

In the video walkthrough, we discuss different distillation techniques and include a deep dive on Direct Preference Optimization (DPO).