Compressing Large Language Models (LLMs) | w/ Python Code

Shaw Talebi β€’ September 1, 2024
Video Thumbnail

About

No channel description available.

Video Description

🀝 Work with me: https://www.shawhintalebi.com πŸš€ Ship AI apps in weeks, not months: https://aibuilder.academy/ Here, I discuss 3 ways to do model compression on LLMs (i.e. Quantization, Pruning, and Knowledge Distillation/Model Distillation) with example Python code. Resources: πŸ“° Blog: https://medium.com/towards-data-science/compressing-large-language-models-llms-9f406eea5b5e?sk=2e8a9606c78e60eab725c9a5d4170299 πŸŽ₯ Training the Teacher Model: https://youtu.be/4QHg8Ix8WWQ πŸ’» GitHub Repo: https://github.com/ShawhinT/YouTube-Blog/tree/main/LLMs/model-compression πŸ‘©β€πŸ« Teacher Model: https://huggingface.co/shawhin/bert-phishing-classifier_teacher πŸ§‘β€πŸŽ“ Student Model: https://huggingface.co/shawhin/bert-phishing-classifier_student πŸ‘Ύ 4-bit Student Model: https://huggingface.co/shawhin/bert-phishing-classifier_student_4bit πŸ’Ώ Dataset: https://huggingface.co/datasets/shawhin/phishing-site-classification References: [1] https://arxiv.org/abs/2001.08361 [2] https://arxiv.org/abs/1710.09282 [3] https://machinelearning.apple.com/research/model-compression-in-practice [4] https://arxiv.org/abs/1710.09282 [5] https://arxiv.org/abs/2308.07633 [6] https://arxiv.org/abs/2402.17764 [7] https://arxiv.org/abs/1710.01878 [8] https://arxiv.org/abs/1503.02531 [9] https://crfm.stanford.edu/2023/03/13/alpaca.html [10] https://arxiv.org/abs/2305.14314 [11] https://www.researchgate.net/publication/372248458_ChatGPT_in_the_Age_of_Generative_AI_and_Large_Language_Models_A_Concise_Survey Intro - 0:00 "Bigger is Better" - 0:40 The Problem - 1:35 Model Compression - 2:14 1) Quantization - 3:11 2) Pruning - 5:44 3) Knowledge Distillation - 8:04 Example: Compressing a model with KD + Quantization - 11:10

Elevate Your Lash Game

AI-recommended products based on this video

Loading...
Magnetic Nasal Strips Starter Kit: Comfortable Nasal Breathing Support for Sleep, Helps Reduce Snoring Noise, Includes 60 Tabs (30 Uses) with 4 Sizes

Magnetic Nasal Strips Starter Kit: Comfortable Nasal Breathing Support for Sleep, Helps Reduce Snoring Noise, Includes 60 Tabs (30 Uses) with 4 Sizes

(40)
$17.99
FREE delivery Wed, Mar 18 on your first orderOnly 7 left in stock.
1K+ bought in past month
Loading...
Premium Nose Pore Strips - Deep Cleansing Blackhead Remover for Men & Women, Oil & Dirt Removal, 30 Count, Designed in Canada

Premium Nose Pore Strips - Deep Cleansing Blackhead Remover for Men & Women, Oil & Dirt Removal, 30 Count, Designed in Canada

(18)
$13.99
$5.90 delivery Wed, Feb 11
Loading...
25 Tests Pack: 20 LH Strips, 4 HCG Strips and 1 QuadSense HCG Cassette. The Most Complete Fast & Accurate Home Fertility Solution for Women. Ovulation & Pregnancy for Both Early Detection & Pregnancy Progress Tracking. Proudly Made in Canada.

25 Tests Pack: 20 LH Strips, 4 HCG Strips and 1 QuadSense HCG Cassette. The Most Complete Fast & Accurate Home Fertility Solution for Women. Ovulation & Pregnancy for Both Early Detection & Pregnancy Progress Tracking. Proudly Made in Canada.

(3)
$24.99
FREE delivery Tue, Dec 30 on your first order
Loading...
Nasal Strips for Snoring, Extra Strength Nose Strips Breathing, Nose Tape for Sports and Sleep, Anti Snoring Help Stop and Nasal Congestion Relief 30Pcs

Nasal Strips for Snoring, Extra Strength Nose Strips Breathing, Nose Tape for Sports and Sleep, Anti Snoring Help Stop and Nasal Congestion Relief 30Pcs

(0)
$12.98
FREE delivery Tue, Dec 30 on your first order
Loading...
eufy Security 5-Piece Home Alarm Kit, Home Security System, Keypad, Motion Sensor, 2 Entry Sensors, Home Alarm System, Control from The App, Links with eufyCam

eufy Security 5-Piece Home Alarm Kit, Home Security System, Keypad, Motion Sensor, 2 Entry Sensors, Home Alarm System, Control from The App, Links with eufyCam

(975)
$169.99
FREE delivery Wed, Aug 20
100+ bought in past month
Loading...
Smart Hydroponics Growing System, LetPot 12 Pods Indoor Garden, 24W Light, App&WiFi Control, Water Shortage Remind, 20" Adjustable Rod, 5.5L Tank, Herb Garden for Home Kitchen, Stainless Steel
Amazon's Choice

Smart Hydroponics Growing System, LetPot 12 Pods Indoor Garden, 24W Light, App&WiFi Control, Water Shortage Remind, 20" Adjustable Rod, 5.5L Tank, Herb Garden for Home Kitchen, Stainless Steel

(1,781)
$139.99
PrimeFREE delivery Sat, Jun 14
50+ bought in past month
Loading...
ICEPURE 1 Micron 2.5" x 10" Whole House CTO Carbon Sediment Water Filter Cartridge Compatible with Dupont WFPFC8002, WFPFC9001, SCWH-5, WHCF-WHWC, WHCF-WHWC, FXWTC, CBC-10 (4 Count (Pack of 1))

ICEPURE 1 Micron 2.5" x 10" Whole House CTO Carbon Sediment Water Filter Cartridge Compatible with Dupont WFPFC8002, WFPFC9001, SCWH-5, WHCF-WHWC, WHCF-WHWC, FXWTC, CBC-10 (4 Count (Pack of 1))

(5,342)
$40.79
FREE delivery Tue, Sep 23
100+ bought in past month
Loading...
Krispy Kreme Doughnuts Smooth House Roast Single Serve Keurig Certified K-Cup pods for Keurig brewers, 30 Count (Pack of 1)

Krispy Kreme Doughnuts Smooth House Roast Single Serve Keurig Certified K-Cup pods for Keurig brewers, 30 Count (Pack of 1)

(9,653)
$18.97
FREE delivery Sat, Jun 14 on your first order
7K+ bought in past month
Loading...
Lash Glue for Eyelash Extensions - LANKIZ 5ML Eyelash Extension Glue, 1-2 Sec Fast Drying Semi-Permanent Eyelash Glue with 6 Weeks Retention for Professional Use

Lash Glue for Eyelash Extensions - LANKIZ 5ML Eyelash Extension Glue, 1-2 Sec Fast Drying Semi-Permanent Eyelash Glue with 6 Weeks Retention for Professional Use

(547)
$13.99
FREE delivery Thu, Sep 11 on your first order
50+ bought in past month
Loading...
LAUBESS Lash Bond and Seal Eyelash Glue Lash Glue Waterproof Lash Cluster Glue LAUBESS Eyelash Bond and Seal Long Lasting 10ml

LAUBESS Lash Bond and Seal Eyelash Glue Lash Glue Waterproof Lash Cluster Glue LAUBESS Eyelash Bond and Seal Long Lasting 10ml

(0)
$9.98
Loading...
AYASAL Lash Lift Kit Eyelash Perm Kit, with Detailed Instruction Eyelash Lift Kit, Easy for Beginner and Professional Lash Perm Kit, Achieve Salon-Quality Lashes Lift with Safe and Effective Result

AYASAL Lash Lift Kit Eyelash Perm Kit, with Detailed Instruction Eyelash Lift Kit, Easy for Beginner and Professional Lash Perm Kit, Achieve Salon-Quality Lashes Lift with Safe and Effective Result

(54)
$22.99
FREE delivery Sun, Jun 15 on your first order
Loading...
Magnetic Eyelashes-Reusable Fake Lashes with Applicator,No Eyeliner & Glue, Natural Look, 2 Pairs, Easy to Wear and Remove

Magnetic Eyelashes-Reusable Fake Lashes with Applicator,No Eyeliner & Glue, Natural Look, 2 Pairs, Easy to Wear and Remove

(12)
$9.86$9.82
FREE delivery Thu, Sep 11 on your first order
500+ bought in past month
Loading...
AYASAL Lash Lift Kit Eyelash Perm Kit, with Detailed Instruction Eyelash Lift Kit, Easy for Beginner and Professional Lash Perm Kit, Achieve Salon-Quality Lashes Lift with Safe and Effective Result

AYASAL Lash Lift Kit Eyelash Perm Kit, with Detailed Instruction Eyelash Lift Kit, Easy for Beginner and Professional Lash Perm Kit, Achieve Salon-Quality Lashes Lift with Safe and Effective Result

(54)
$22.99
FREE delivery Sun, Jun 15 on your first order
Loading...
Sunrad Foil Art Kit for Kids Unicorns & Princesses Arts and Crafts, No Mess Art for Kids, Fun Craft Kits & Supplies, DIY Creative Activities, Travel Toys Gifts for Girls & Boys Ages 4 5 6 7 8 9+

Sunrad Foil Art Kit for Kids Unicorns & Princesses Arts and Crafts, No Mess Art for Kids, Fun Craft Kits & Supplies, DIY Creative Activities, Travel Toys Gifts for Girls & Boys Ages 4 5 6 7 8 9+

(162)
$23.99$19.72
FREE delivery Sat, Jun 14 on your first order
100+ bought in past month
Loading...
10ft Rolling Library Ladder Hardware Kit, Sliding Track Kit with Floor Rollers, Loft Hardware for Home Bookshelf Warehouse (No Ladder)

10ft Rolling Library Ladder Hardware Kit, Sliding Track Kit with Floor Rollers, Loft Hardware for Home Bookshelf Warehouse (No Ladder)

(4)
$144.99
FREE delivery Sat, Jun 28
Loading...
Cat Scratch Deterrent Spray, Cat Repellent Spray Indoor and Outdoor for Cat and Kitten, No Scratch Spray Training Aid for Furniture, Sofas, Curtains - Non-Toxic, Alcohol-Free Formula 120ML

Cat Scratch Deterrent Spray, Cat Repellent Spray Indoor and Outdoor for Cat and Kitten, No Scratch Spray Training Aid for Furniture, Sofas, Curtains - Non-Toxic, Alcohol-Free Formula 120ML

(20)
$17.98
FREE delivery Fri, Feb 27 on your first order
Loading...
eufy Security, eufyCam S220 (eufyCam 2C Pro) 2-Cam Kit, Wireless Home Security Camera, 2K Resolution, 180-Day Battery Life, HomeKit Compatibility, IP67, Night Vision, Motion Only Alert, No Monthly Fee

eufy Security, eufyCam S220 (eufyCam 2C Pro) 2-Cam Kit, Wireless Home Security Camera, 2K Resolution, 180-Day Battery Life, HomeKit Compatibility, IP67, Night Vision, Motion Only Alert, No Monthly Fee

(2,743)
$219.99
FREE delivery Thu, Sep 4
100+ bought in past month
Loading...
eufy Security 5-Piece Home Alarm Kit, Home Security System, Keypad, Motion Sensor, 2 Entry Sensors, Home Alarm System, Control from The App, Links with eufyCam

eufy Security 5-Piece Home Alarm Kit, Home Security System, Keypad, Motion Sensor, 2 Entry Sensors, Home Alarm System, Control from The App, Links with eufyCam

(975)
$169.99
FREE delivery Wed, Aug 20
100+ bought in past month
Loading...
Smart Hydroponics Growing System, LetPot 12 Pods Indoor Garden, 24W Light, App&WiFi Control, Water Shortage Remind, 20" Adjustable Rod, 5.5L Tank, Herb Garden for Home Kitchen, Stainless Steel
Amazon's Choice

Smart Hydroponics Growing System, LetPot 12 Pods Indoor Garden, 24W Light, App&WiFi Control, Water Shortage Remind, 20" Adjustable Rod, 5.5L Tank, Herb Garden for Home Kitchen, Stainless Steel

(1,781)
$139.99
PrimeFREE delivery Sat, Jun 14
50+ bought in past month