What is fine-tuning?

What does fine-tuning do?

The process of fine-tuning a model is similar to the process of initial model training

Pros of fine-tuning:

Fine-tuning your own LLM can have several benefits like performance, privacy, cost, reliability, customization, stability, etc.

llama library (Lamini): [INST] and [/INST] tags for sending instructions to llama2 model.


<aside> 💡

Pre-training → Fine-tuning, the fine-tuning process is mostly done after the pre-training.

</aside>

In Pre-training, initially the model has zero knowledge of the world and thus can’t form english sentence structures, and can only predict next tokens leading to gibberish outputs.

However, as the model trains on a large corpus of unlabelled data, it keeps getting better at predicting the right tokens and thus the next word.

Once the model is trained using self-supervised learning, it learns the language and gains knowledge of sentence structures.

ElutherAI: “The Pile” is a dataset for representing the entire scraped data from the internet. (https://github.com/EleutherAI/the-pile)

The pre-training process results in a base model that can predict next token sequences, however the limitation is that it is not suitable for a chatbot interface.

Fine-tuning can be used to train/update the model on new data which can either be self-supervised unlabelled data, curated labelled data with much less cost. The process of fine-tuning updates the entire model and not just part of it (whereas in other traditional machine learning cases fine-tuning is often performed on a subset of the weights).

Outcomes of fine-tuning:

Some of the tasks where you would want to fine-tune a model are:

Having a clarity on the task to be performed will help in fine-tuning the model well.

Steps for fine-tuning first time: