Model Distillation: Same LLM Power but 3240x Smaller

Adam Lucek August 5, 2024
Video Thumbnail
Adam Lucek Logo

Adam Lucek

@adamlucek

About

teach them to long for the endless immensity of the sea For inquiries, refer to the email in my links section.

Video Description

Foundation model performance at a fraction of the cost- model distillation is a powerful technique to leverage the advanced generation capabilities of foundation models like Llama 3.1 405B, GPT-4, or Claude Opus as teachers, distilling their knowledge and performance on a given task to a student model. The result is a task-specific lightweight language model that provides the same performance, capability, or style as the foundation model without all the extra parameters. In this video we demonstrate this by using Llama 3.1 405B to perform sentiment analysis on a dataset of tweets, and use that generated dataset to train RoBERTa, a 125 million parameter model, to perform with the same accuracy on tweet sentiment classification tasks. Comparable performance using a model 3240 times smaller! Resources: Code: https://github.com/ALucek/LLM-distillation-guide Llama 3.1 405B Tweet Dataset: https://huggingface.co/datasets/AdamLucek/twittersentiment-llama-3.1-405B-labels Distilled Model: https://huggingface.co/AdamLucek/roberta-llama3.1405B-twitter-sentiment Moritz Laurer Blog: https://huggingface.co/blog/synthetic-data-save-costs AutoTrain: https://huggingface.co/autotrain A Survey on Knowledge Distillation of Large Language Models: https://arxiv.org/pdf/2402.13116 Chapters: 00:00 - Intro 01:11 - Model Distillation Trend 04:49 - Use Case: Instruction Following 05:45 - Use Case: Multi-Turn Dialogue 06:17 - Use Case: Retrieval Augmented Generation 06:59 - Use Case: Tool & Function Calling 07:52 - Use Case: Text Annotation 08:16 - Code: Distilling Llama 3.1 405B Overview 09:32 - Code: Initializing Tweet Dataset 10:57 - Code: Setting Up LLM & Annotation Prompt 15:10 - Code: Creating Annotated Dataset 17:25 - Training: RoBERTa & AutoTrain 18:30 - Training: Setting up AutoTrain Environment 19:02 - Training: Running Training Job on RoBERTa 21:42 - Evaluate: Using our Fine Tuned RoBERTa Model 22:23 - Evaluate: Visualizing Accuracy 23:37 - Evaluate: Visualizing Label Distribution 24:14 - Evaluate: Cost & Time Considerations 24:49 - Outro #machinelearning #ai #coding

You May Also Like

Master Model Distillation Today

AI-recommended products based on this video

Loading...
2026 New Embroidery Stitch Book Kit, Stitch Book Embroidery, All-in-One Embroidey StitchBook & Sewing Kit, Comes with a Complete Toolkit and Instructional Tutorial (1set)

2026 New Embroidery Stitch Book Kit, Stitch Book Embroidery, All-in-One Embroidey StitchBook & Sewing Kit, Comes with a Complete Toolkit and Instructional Tutorial (1set)

(1)
$14.90
FREE delivery Jan 23 - Feb 12
500+ bought in past month
Loading...
EZDIY-FAB RTX 3000 Series 12 Pin to Dual 8 Pin PCIe Sleeved Extension Cable 300 MM- Connector for NVIDIA Ampere GEFORCE RTX 3060ti 3070 3080 FE Funder Edition- White

EZDIY-FAB RTX 3000 Series 12 Pin to Dual 8 Pin PCIe Sleeved Extension Cable 300 MM- Connector for NVIDIA Ampere GEFORCE RTX 3060ti 3070 3080 FE Funder Edition- White

(122)
$15.99
FREE delivery Mon, Feb 16 on your first order
Loading...
Seasonic Focus V4 GX-1000 (ATX3) - 1000W - 80+ Gold - ATX 3.0 & PCIe 5.1 Ready -Full-Modular -ATX Form Factor -Premium Japanese Capacitor -10 Year Warranty -Nvidia RTX 30/40 Super & AMD GPU Compatible

Seasonic Focus V4 GX-1000 (ATX3) - 1000W - 80+ Gold - ATX 3.0 & PCIe 5.1 Ready -Full-Modular -ATX Form Factor -Premium Japanese Capacitor -10 Year Warranty -Nvidia RTX 30/40 Super & AMD GPU Compatible

(22)
$423.35
FREE delivery Oct 8 - 10
Loading...
PNY NVIDIA Quadro RTX 4000 - The World’S First Ray Tracing GPU

PNY NVIDIA Quadro RTX 4000 - The World’S First Ray Tracing GPU

(203)
$670.57$399.99
FREE delivery Feb 23 - 27
Loading...
Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code

Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code

(382)
$94.95
PrimeFREE delivery Sat, Jun 14
Loading...
NEXPOW Car Jump Starter,Car Battery Jump Starter Pack 1500A Peak Q10S for Up to 7.0L Gas and 5.5L Diesel Engine12V Auto Battery Booster,Jumper Cables,Portable Lithium Jump Box with LED Light/USB QC3.0

NEXPOW Car Jump Starter,Car Battery Jump Starter Pack 1500A Peak Q10S for Up to 7.0L Gas and 5.5L Diesel Engine12V Auto Battery Booster,Jumper Cables,Portable Lithium Jump Box with LED Light/USB QC3.0

(4,578)
$71.99
FREE delivery Sat, Jan 3
2K+ bought in past month
Loading...
Firefly Variety 8 Pack - Fire Starter Accessory for Swiss Army Victorinox Knives (Neon Green-Yellow Glow)

Firefly Variety 8 Pack - Fire Starter Accessory for Swiss Army Victorinox Knives (Neon Green-Yellow Glow)

(181)
$70.15$61.13
$5.05 delivery Thu, Jun 26Only 3 left in stock.
Loading...
9-in-1 5000A 150PSI Car Battery Booster Jump Starter with Air Compressor (All Gas/9L Diesel), Portable Car Battery Booster Pack, Safe Durable Car Jump Starter with Extended Jumper Cables, Glove, Light

9-in-1 5000A 150PSI Car Battery Booster Jump Starter with Air Compressor (All Gas/9L Diesel), Portable Car Battery Booster Pack, Safe Durable Car Jump Starter with Extended Jumper Cables, Glove, Light

(261)
$99.99
FREE delivery Sat, Sep 20
1K+ bought in past month
Loading...
BOSGAME P3 Mini PC Desktop, AMD Ryzen 9 6900HX, 32GB DDR5, 1TB PCIe 4.0 SSD, Dual LAN 2.5G/Wi-Fi 6E/BT5.2, 4K Triple Display, Micro Gaming Computer for Gaming, Office, Design

BOSGAME P3 Mini PC Desktop, AMD Ryzen 9 6900HX, 32GB DDR5, 1TB PCIe 4.0 SSD, Dual LAN 2.5G/Wi-Fi 6E/BT5.2, 4K Triple Display, Micro Gaming Computer for Gaming, Office, Design

(76)
$599.99
PrimeFREE delivery Sat, Jun 14
Loading...
BOSGAME P3 Mini Gaming PC, AMD Ryzen 9 6900HX, 16GB DDR5, 512GB PCIe 4.0 SSD, Dual LAN 2.5G/Wi-Fi 6E/BT5.2, 4K Triple Display, Micro Desktop PC for Gaming, Office, Design

BOSGAME P3 Mini Gaming PC, AMD Ryzen 9 6900HX, 16GB DDR5, 512GB PCIe 4.0 SSD, Dual LAN 2.5G/Wi-Fi 6E/BT5.2, 4K Triple Display, Micro Desktop PC for Gaming, Office, Design

(246)
$599.99
PrimeFREE delivery Sat, Jun 14
Loading...
ASUS ROG Strix G16 Gaming Laptop, GeForce RTX 5070 Ti 12GB GDDR7, AMD Ryzen 9 8940HX, 64GB DDR5, 2TB SSD, Backlit Keyboard, Wi-Fi 6E, 16" WUXGA 165Hz Display, Win 11, Gray, 1TB Docking Station Set

ASUS ROG Strix G16 Gaming Laptop, GeForce RTX 5070 Ti 12GB GDDR7, AMD Ryzen 9 8940HX, 64GB DDR5, 2TB SSD, Backlit Keyboard, Wi-Fi 6E, 16" WUXGA 165Hz Display, Win 11, Gray, 1TB Docking Station Set

(10)
$4,269.00
FREE delivery Feb 24 - Mar 5
Loading...
Lenovo Legion Pro 5 16" WQXGA 165Hz Gaming Laptop, AMD Ryzen 9 9955HX, GeForce RTX 5070, 32GB DDR5, 3TB Storage (2TB SSD+1TB Docking Station Set), 24-Zone RGB Backlit Keyboard, WiFi 7, Win 11, Black

Lenovo Legion Pro 5 16" WQXGA 165Hz Gaming Laptop, AMD Ryzen 9 9955HX, GeForce RTX 5070, 32GB DDR5, 3TB Storage (2TB SSD+1TB Docking Station Set), 24-Zone RGB Backlit Keyboard, WiFi 7, Win 11, Black

(2)
$3,199.00
FREE delivery Feb 24 - Mar 5
Loading...
Crucial 64GB DDR5 RAM, 5600MHz (or 5200MHz or 4800MHz) Desktop Memory Kit, UDIMM 288-Pin, Compatible with 13th Gen Intel Core and AMD Ryzen 7000 - CT2K32G56C46U5

Crucial 64GB DDR5 RAM, 5600MHz (or 5200MHz or 4800MHz) Desktop Memory Kit, UDIMM 288-Pin, Compatible with 13th Gen Intel Core and AMD Ryzen 7000 - CT2K32G56C46U5

(2,409)
$181.38
FREE delivery Mon, Aug 11
Loading...
Western Digital 4TB Elements Desktop External Hard Drive, USB 3.0 external hard drive for plug-and-play storage - WDBWLG0040HBK-NESN

Western Digital 4TB Elements Desktop External Hard Drive, USB 3.0 external hard drive for plug-and-play storage - WDBWLG0040HBK-NESN

(25,657)
$183.49
FREE delivery Tue, Jun 17
Loading...
Western Digital 4TB My Book Desktop External Hard Drive, USB 3.0, External HDD with Password Protection and Backup Software - WDBBGB0040HBK-NESN

Western Digital 4TB My Book Desktop External Hard Drive, USB 3.0, External HDD with Password Protection and Backup Software - WDBBGB0040HBK-NESN

(4,704)
$148.98$138.55
FREE delivery Tue, Jun 17
Loading...
Western Digital 4TB My Passport Portable External Hard Drive HDD, USB 3.0, USB 2.0 Compatible, Black - WDBPKJ0040BBK-WESN

Western Digital 4TB My Passport Portable External Hard Drive HDD, USB 3.0, USB 2.0 Compatible, Black - WDBPKJ0040BBK-WESN

(111,552)
$154.99$139.49
FREE delivery Tue, Jun 17
100+ bought in past month
Loading...
PNY GeForce RTX™ 4070 Super 12GB Verto™ OC Dual Fan Graphics Card DLSS 3 (NVIDIA GeForce SFF-Ready, 192-bit, GDDR6X, PCIe 4.0, HDMI/DisplayPort, Supports 4k, incl. Adapter, 2 Slot)

PNY GeForce RTX™ 4070 Super 12GB Verto™ OC Dual Fan Graphics Card DLSS 3 (NVIDIA GeForce SFF-Ready, 192-bit, GDDR6X, PCIe 4.0, HDMI/DisplayPort, Supports 4k, incl. Adapter, 2 Slot)

(262)
$994.99