A pre-trained or foundation model is further trained (or fine-tuned) with instructions datasets to help them learn about your specific data and perform humanlike tasks. These models are called instruction fine-tuning LLMs. In this blog, we will learn about the concepts and different examples of instruction fine-tuning models. You might want to check out this book to learn more: Generative AI on AWS.
Instruction fine-tuning LLMs, also called chat or instruct models, are created by training pre-trained models with different types of instructions. Instruction fine-tuning can be defined as a type of supervised machine learning that improves the foundation model by continuously comparing the model’s output for a given input (e.g., instruction prompt with dialogue) to the ground truth(e.g., human baseline summary). The weights of the foundation LLM are updated accordingly based on the comparison. This process is continued for each instruction prompt.
A pre-trained model can be fine-tuned with your custom dataset, such as conversations between your customer support agents and your customers to create instruction fine-tuned LLM specific to your needs.
For example, take a pre-trained LLM such as Llama-2-70b and train with specific instructions such as some of the following to create instruction fine-tuning LLM.
The following image represents the same:
You would need a lot many instructions like the above. The instructions can be related to some of the following tasks:
By training the model on a mixed-instruction dataset such as those related to the above tasks, the performance of the model can be improved on many tasks simultaneously thereby avoiding the issue of catastrophic forgetting, and maintaining the model’s ability to generalize to multiple tasks.
The following are some examples of instruction fine-tuned LLMs:
Prompt templates can be used to build an instruction dataset from a given dataset by formatting the text as instructions. Examples of prompt templates can be found on this page – Prompt template. Here is a glimpse of it:
("Multi-choice problem: {context}\n{options_}", "{answer}"),
("Complete the passage.\n\n{context}\n{options_}", "{answer}"),
("How does this following sentence end (see "
"options)?\n\n{context}\n{options_}", "{answer}"),
("What is the most logical completion for the following text (see "
"options)?\n\n{context}\n{options_}", "{answer}"),
("Multi-choice problem: How does this text "
"end?\n\n{context}\n{options_}", "{answer}"),
("Choose from the options on what happens "
"next.\n\n{context}\n{options_}", "{answer}"),
("Complete the following sentence.\n\n{context}\n{options_}",
"{answer}"),
("Choose from options: Fill in the remainder of the "
"sentence.\n\n{context}\n{options_}", "{answer}"),
("What is the next event listed in the options is "
"correct?\n\n{context}\n{options_}\nA:", "{answer}"),
("Complete the rest of the sentence by choosing from "
"options.\n\n{context}\n{options_}", "{answer}"),
There is a great chapter in this book, Generative AI on AWS, including how you could go about training your instruction fine-tuning LLM using Amazon Sagemaker Studio.
In recent years, artificial intelligence (AI) has evolved to include more sophisticated and capable agents,…
Adaptive learning helps in tailoring learning experiences to fit the unique needs of each student.…
With the increasing demand for more powerful machine learning (ML) systems that can handle diverse…
Anxiety is a common mental health condition that affects millions of people around the world.…
In machine learning, confounder features or variables can significantly affect the accuracy and validity of…
Last updated: 26 Sept, 2024 Credit card fraud detection is a major concern for credit…