Menu

1 / 10

The Math Behind Using LoRA to Fine-Tune LLMs

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More ·Dev J. Shah·3 days ago
#HcYp5Kh4
#freecodecamp#news#weights#fine#tuning
Long article (3085 words) — no AI summary yet.
Reading 0:00
15s threshold

If you've been following the world of Large Language Models (LLMs), one term you have likely come across is fine-tuning. But what actually happens under the hood? What does it do to the LLM?

In this article, you'll first start by understanding what an LLM actually outputs. Then you'll learn how fine-tuning works. The method you'll focus on here is LoRA (Low-Rank Adaptation) which is one of the most popular approaches to fine-tuning.

Throughout the article, you'll follow one small example to understand how everything works. You don't need to have any prior machine learning or math background to follow along.

Table of Contents

How an LLM Picks the Next Token

What Is Fine-Tuning?

How LoRA Works Low-Rank Factorization

How LoRA Uses This Idea

How to Fine-Tune intern-llm with LoRA How to Prepare the Dataset

The Fine-Tuning Loop

The Adapter and Scaling

Conclusion

Take-Home Exercise

How an LLM Picks the Next Token

First, what's at the core of an LLM's behavior?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.