---
title: "What is LLM fine-tuning?"
description: "Fine-tuning adjusts a pretrained LLM's weights for a specific task or domain, often matching larger models' quality at lower cost and latency."
url: "https://swe.quest/articles/what-is-llm-fine-tuning-818b56b81ea17fe8"
canonical: "https://modal.com/blog/llm-fine-tuning-overview"
source: "Modal"
published: "2024-12-10"
difficulty: "medium"
kind: "How-to"
reading_minutes: 13
tags: ["model-training","llms"]
---

# What is LLM fine-tuning?

A post on [Modal](https://swe.quest/sources/modal.md), published 2024-12-10, 13 min read, How-to. Original: [https://modal.com/blog/llm-fine-tuning-overview](https://modal.com/blog/llm-fine-tuning-overview)

## Summary

Fine-tuning adjusts a pretrained LLM's weights for a specific task or domain, often matching larger models' quality at lower cost and latency. One cited example puts a fine-tuned Llama 7B at roughly 50x cheaper per token than GPT-3.5. The guide compares where to fine-tune (OpenAI, Predibase, Modal, Colab, SageMaker) and which frameworks to use (HuggingFace transformers, TRL, Axolotl). It then walks through choosing a base model, formatting and tokenizing an instruction dataset with optional custom special tokens, training, and efficiency techniques such as LoRA-based PEFT and quantization.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- Python basics ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- transformer language models

## Keywords

Modal, LoRA, HuggingFace transformers, Axolotl, TRL, Llama 2, PEFT, QLoRA

## Related posts

- [Beyond LoRA: Can you beat the most popular fine-tuning technique?](https://swe.quest/articles/beyond-lora-can-you-beat-the-most-popular-fine-tuning-technique-ce7bf6b22fef0efd.md): Hugging Face · 2026-06-18 · Medium · 13 min read · Model training, LLMs, Evaluation
  LoRA accounts for roughly 95–98% of PEFT usage across Hugging Face Hub model cards and image-generation checkpoints, but controlled benchmarks in the PEFT library show it is often not the best tradeoff.
- [Parameter-Efficient Fine-Tuning using 🤗 PEFT](https://swe.quest/articles/parameter-efficient-fine-tuning-using-peft-5c28b9ec4e65b0a1.md): Hugging Face · 2023-02-10 · Medium · 5 min read · Model training, LLMs, Python
  Hugging Face's PEFT library brings parameter-efficient fine-tuning methods (LoRA, Prefix Tuning, Prompt Tuning, P-Tuning) to Transformers and Accelerate.
- [Fine-tuning 20B LLMs with RLHF on a 24GB consumer GPU](https://swe.quest/articles/fine-tuning-20b-llms-with-rlhf-on-a-24gb-consumer-gpu-7ad6c7bb6c14c3cf.md): Hugging Face · 2023-03-09 · Hard · 11 min read · Model training, LLMs, Machine learning, Python
  Combining trl with peft and bitsandbytes makes RLHF fine-tuning of a 20B-parameter LLM feasible on a single 24GB consumer GPU.
- [Make LLM Fine-tuning 2x faster with Unsloth and 🤗 TRL](https://swe.quest/articles/make-llm-fine-tuning-2x-faster-with-unsloth-and-trl-5db8c0b6a40cf74e.md): Hugging Face · 2024-01-10 · Medium · 5 min read · Model training, LLMs, Performance engineering, Python
  Unsloth speeds up QLoRA fine-tuning of Llama and Mistral-family models by rewriting PyTorch modules as Triton kernels with manually derived backpropagation.
- [LoRA Explained: Faster, More Efficient Fine-Tuning with Docker](https://swe.quest/articles/lora-explained-faster-more-efficient-fine-tuning-with-docker-c2d6a36ff181eafe.md): Docker · 2025-10-09 · Medium · 8 min read · Model training, LLMs, Privacy
  Gemma 3 270M can be specialized into a compact PII-masking assistant using LoRA, which freezes the base weights and trains only small low-rank adapters, cutting compute and memory needs while avoiding catastrophic forgetting.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
