Fine-tuning Large Language Models (LLMs) | w/ Example Code
275,535
Published 2023-10-01
This is the 5th video in a series on using large language models (LLMs) in practice. Here, I discuss how to fine-tune an existing LLM for a particular use case and walk through a concrete example with Python code.
More Resources:
👉 Series Playlist: • Large Language Models (LLMs)
📰 Read more: towardsdatascience.com/fine-tuning-large-language-…
💻 Example code: github.com/ShawhinT/YouTube-Blog/tree/main/LLMs/fi…
Final Model: huggingface.co/shawhin/distilbert-base-uncased-lor…
🔢 Dataset: huggingface.co/datasets/shawhin/imdb-truncated
[1] Deeplearning.ai Finetuning Large Langauge Models Short Course: www.deeplearning.ai/short-courses/finetuning-large…
[2] arXiv:2005.14165 [cs.CL] (GPT-3 Paper)
[3] arXiv:2303.18223 [cs.CL] (Survey of LLMs)
[4] arXiv:2203.02155 [cs.CL] (InstructGPT paper)
[5] 🤗 PEFT: Parameter-Efficient Fine-Tuning of Billion-Scale Models on Low-Resource Hardware: huggingface.co/blog/peft
[6] arXiv:2106.09685 [cs.CL] (LoRA paper)
[7] Original dataset source — Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. 2011. Learning Word Vectors for Sentiment Analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 142–150, Portland, Oregon, USA. Association for Computational Linguistics.
--
Book a call: calendly.com/shawhintalebi
Socials
medium.com/@shawhin
www.linkedin.com/in/shawhintalebi/
twitter.com/ShawhinT
www.instagram.com/shawhintalebi/
The Data Entrepreneurs
🎥 YouTube: / @thedataentrepreneurs
👉 Discord: discord.gg/RSqZbF9ygh
📰 Medium: medium.com/the-data-entrepreneurs
📅 Events: lu.ma/tde
🗞️ Newsletter: the-data-entrepreneurs.ck.page/profile
Support ❤️
www.buymeacoffee.com/shawhint
Intro - 0:00
What is Fine-tuning? - 0:32
Why Fine-tune - 3:29
3 Ways to Fine-tune - 4:25
Supervised Fine-tuning in 5 Steps - 9:04
3 Options for Parameter Tuning - 10:00
Low-Rank Adaptation (LoRA) - 11:37
Example code: Fine-tuning an LLM with LoRA - 15:40
Load Base Model - 16:02
Data Prep - 17:44
Model Evaluation - 21:49
Fine-tuning with LoRA - 24:10
Fine-tuned Model - 26:50
All Comments (21)
-
👉Need help with AI? Reach out: shawhintalebi.com/ 🎥Series playlist: youtube.com/playlist?list=PLz-ep5RbHosU2hnz5ejezwa… -- [1] deeplearning.ai/ Finetuning Large Langauge Models Short Course: www.deeplearning.ai/short-courses/finetuning-large… [2] arXiv:2005.14165 [cs.CL] (GPT-3 Paper) [3] arXiv:2303.18223 [cs.CL] (Survey of LLMs) [4] arXiv:2203.02155 [cs.CL] (InstructGPT paper) [5] PEFT: Parameter-Efficient Fine-Tuning of Billion-Scale Models on Low-Resource Hardware: huggingface.co/blog/peft [6] arXiv:2106.09685 [cs.CL] (LoRA paper) [7] Original dataset source — Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. 2011. Learning Word Vectors for Sentiment Analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 142–150, Portland, Oregon, USA. Association for Computational Linguistic
-
Honestly the most straightforward explanation I've ever watched. Super excellent work Shaw. Thank you. It's so rare to find good communicators like you!
-
Great video Shaw! It was a good balance between details and concepts. Very unusual to see this so well done. Thank you.
-
Such a great video. This is the first one I watched from you. You explain everything so nicely, and in my opinion you provided just the right amount of information - not too little, so it doesn't feel superficial and you feel like you've learned something, but not too much, so that you can take what you've learned and read more about it yourself if you're interested. Looking forward to seeing more of your content!
-
Just came to this video from HF and I have to say, I love they way you describe this! Thanks for the great video!
-
A very clear and straightforward video explaining finetuning.
-
Your style of conveying information is wonderful. Good luck to you
-
You have explained this so clearly, that even a novice in NLP can understand it.
-
Great video, I wanted to hear further discussion on mitigation techniques for overfitting. Thanks for making the video!
-
Amazing video Shawhin. It was quite easy to follow and stuff were clearly explained. Thank you so much,
-
This was one of the best videos on this topic, really nice man, keep going.
-
Wow dude, just you wait, this channel is gonna go viral! You explain everything so clearly, wish you led the courses at my university.
-
excellent simple explanation to the point. Love it !
-
Thank you for the detailed explaination line by line. Finally a place, I can rely on with working example
-
Fantastic video. Thanks for the upload. Keep up the good work, you're awesome 😎
-
Excellent way of teaching. Keep doing this kind of good work.
-
Clear and straightforward to the point, thanks a lot for making this valuable content accessible on ytb💡
-
Im really gratful for youre work , you really help me when I had no one to ask .
-
Even though this was high level instruction, it was perfect. I can continue from here. Thanks Shahin jan!
-
Clear Explanation, Amazing