Fine-tuning Llama 3 LLM for RAG

Fine-tuning Llama 3 LLM for RAG

How to make LLMs better for your specific use case?

Fine-tuning process

Fine-tuning process

Are you happy with the performance of your large language model (LLM) on a specific task? If not, fine-tuning might be the answer. Even a simpler, smaller model can outperform a larger one if it's fine-tuned correctly for a specific task.

In this tutorial, you'll learn how to fine-tune a Llama 3 LLM for a financial question-answering (and RAG system) task. We'll cover:

  • Building a complete dataset
  • Picking a base model
  • Setting up a LoRA adapter
  • Training the model
  • Evaluating its performance

Let's get started!

Tutorial Goals

In this tutorial you will:

  • Create a dataset for fine-tuning
  • Establish baseline with the untrained model
  • Setup and monitor the training
  • Evaluate the performance of the trained model

Why Fine-tune LLM for RAG?

MLExpert is loading...



  1. Financial QA Dataset (opens in a new tab)

  2. How to Fine-Tune LLMs in 2024 with Hugging Face (opens in a new tab)

  3. Final model on HF hub (opens in a new tab)