To learn about finetuning LLMs, I have read several online tutorials. I am about to teach a short course in this area, and I am looking for a book/paper/survey that discusses examples of different types of finetuning, as well as the reasons to choose specific methods in each case, considering different types of models and tasks (classification, summarization, etc). Where can I find a comprehensive guide for finetuning LLMs?
1 Answer
As to your question, about the comprehensive guide, I have not found any, but there is still some good knowledge scattered around:
Huggingface
I guess you have checked Huggingface - Transformers - Fine-tune a pretrained model. But you are right, that is just one example out of many. It is just a good beginning.
There is also a bunch of custom dataset examples with code that should already be almost what you need, see Huggingface - Transformers - Advanced Guides - Fine-tuning with custom datasets:
We include several examples, each of which demonstrates a different type of common downstream task:
- Sequence Classification with IMDb Reviews
- Token Classification with W-NUT Emerging Entities
- Question Answering with SQuAD 2.0
There is also the fine-tuning with AutoTrain, see LLM Finetuning.
Huggingface then offers a wide range of other models that you could put in such a fine-tuning training setup. As far as I know, Huggingface and its many linked guides scattered around the web should give you the full insight. But if I understand it right, this is not the comprehensive guide that you ask for.
There is the Manning 12/2023 AI-Powered Search with the chapter "14 Question answering with a fine-tuned large language model" that covers "Fine-tuning a transformer-based LLM":
You’ll use LLMs for embeddings, question answering, and results summarization, as well as learning how to fine tune them for the best results.
There is a chapter "10 ALBERT, adapters, and multitask adaptation strategies" in Manning 7/2021 Transfer Learning for Natural Language Processing that covers "Fine-tuning a model from the BERT family on multiple tasks".
On the whole, this is not an answer to your question of getting the latest things altogether in one go in one comprehensive guide with all of the examples you can think of, like a full book only on Fine-tuning, but you can build up your knowledge with that quite a bit, and I would start with all of the examples at Huggingface, and then go on with a Manning book. Since it is younger, I would begin with "AI-Powered Search" and then combine it with insights from the other Manning book "Transfer Learning for Natural Language Processing" and ask the ChatBot for help and look through the Huggingface tabs to step by step get examples for everything.
-
Other than cost, what are the advantages of fine-tuning a pre-trained model on domain specific dataset vs building an LLM from scratch for the domain specific dataset? Commented Mar 7 at 3:47
-
1@cogitoergosum You can fine-tune with only 50 to 100 messages (as said in the finetuning guide of ChatGPT), or be it 1000 messages, but you do not need to care for the main model to work well. The main model can be tweaked in that it is not so aggressive anymore or hides some knowledge. If you train your own LLM, you might have to care for that as well. You save developer time and do not need to set up so much hardware. Commented Mar 7 at 7:12
-
2@cogitoergosum I think your question in this last remark is worth a question on GenAI. Commented May 2 at 20:01