Fine-tuning LLMs with instruction
Tags: aws, llm, deeplearning, ai
Published: 2023-07-13 13:40:12

Fine-tuning is a way to improve a pre-trained language model (LLM) by using labelled examples. It helps the model generate better completions for a specific task. This process helps the model improve its behaviour for specific tasks, like instruction fine-tuning. Instruction fine-tuning trains the model using examples that show how it should respond to a specific instruction. The process creates a new version of the model with updated weights, known as an instruct model, that is more suitable for the tasks you want to do.

You can use prompt template libraries to turn your current datasets into instruction prompt datasets for fine-tuning. The most common method to fine-tune LLMs is instruction fine-tuning. It involves creating a dataset with prompt completion pairs and dividing it into training, validation, and test sets. The model's weights are then updated using backpropagation and cross-entropy loss. Fine-tuning improves the base model to make it better for the tasks we want to do. Fine-tuning on one task can cause catastrophic forgetting, where the model forgets how to perform other tasks. To prevent this problem, you can fine-tune across multiple kinds of instructions or use parameter efficient fine-tuning (PEFT) techniques. Parameter efficient fine-tuning (PEFT) is a method that tunes specific tasks with minimal memory usage. It keeps the original model's weights and only trains a few adapter layers and parameters for specific tasks.This method is more resistant to catastrophic forgetting and is currently being actively researched.

LoRA is a technique that uses low-rank matrices to achieve good performance while using less computational power and memory. Efficient fine-tuning techniques improve performance when prompting reaches its limit.

Evaluation steps involve measuring the model's performance by using validation and test datasets to determine its accuracy. Using multitask fine-tuning on multiple tasks can help the model stay versatile, but it needs more data and computing resources. Prompt templates are used to give general instructions for different tasks. We can make the model perform better on specific tasks by using domain-specific datasets. Evaluation metrics and benchmarks are used to measure the quality of the model's completions and compare the fine-tuned version with the base model.

To understand the capabilities of language models, we need evaluation metrics. Researchers use existing datasets and benchmarks to measure and compare the models. Selecting the appropriate evaluation dataset is extremely important. It is essential to consider the specific skills of the model and any potential risks involved. Assessing LLM performance on new data gives a more accurate evaluation. GLUE, SuperGLUE, HELM, and BIG-bench are benchmarks that measure and compare model performance for various tasks and scenarios. Leaderboards and results pages help track progress in LLM. MMLU and BIG-bench evaluate LLMs on tasks in various fields like law, software development, and biology.

HELM benchmarks use a multimetric approach. They measure seven metrics across 16 core scenarios, including fairness, bias, and toxicity. Evaluators can check the HELM results page to find LLMs that have been evaluated based on specific scenarios and metrics that are relevant to their requirements.

The [paper](https://arxiv.org/abs/2210.11416) presents FLAN, a method for fine-tuning instructions, and explains how it can be used. FLAN improves generalisation, human usability, and zero-shot reasoning by fine-tuning the 540B PaLM model on 1836 tasks and incorporating Chain-of-Thought Reasoning data. The study evaluates each aspect.