Glossary Entry

What is Fine-Tuning?

Fine-tuning further trains a pre-trained model on task-specific examples to update its weights. Covers training data, LoRA and PEFT, and fine-tuning versus RAG.

Written by Alex Merced

What is Fine-Tuning?

Fine-Tuning is a Machine Learning process that continues training a pre-trained Foundation Model (like Llama 3, or GPT-4o through OpenAI’s fine-tuning API) to update its weights for a specific task. While Prompt Engineering attempts to steer an AI using temporary text instructions, and Retrieval-Augmented Generation (RAG) gives the AI a temporary document to read, Fine-Tuning changes the model itself, training it on many specific, often proprietary examples until it performs a specialized task reliably.

When an AI lab trains a base Large Language Model, it spends large sums training it on a huge share of the public web and other text. The resulting model is a capable generalist: it can write a poem, explain quantum physics, and write Python code. However, if a healthcare company wants the AI to extract medical billing codes from messy doctor notes and output them in a strict, proprietary JSON schema, the base model may often get the format wrong. Fine-Tuning takes that pre-trained generalist and specializes it for that medical billing task.

The Architecture of Fine-Tuning

Fine-Tuning requires a careful data engineering pipeline and access to GPU compute.

The Training Dataset

To fine-tune a model, the data science team must construct a “Gold Standard” training dataset. This dataset often contains hundreds to thousands of high-quality examples of the desired behavior, structured as Input/Output pairs.

  • Input: The raw, messy doctor’s note.
  • Output: The correct, human-verified JSON billing code string.

The Gradient Descent

The data engineers load an open-weight LLM (e.g., Llama 3) onto GPUs. They feed the Input/Output examples into the model. The model attempts the task and makes mistakes. Training uses Backpropagation and Gradient Descent to adjust the model’s parameters (the weights). Over the training run, the model learns the formatting and logic of the medical billing dataset.

PEFT and LoRA (Cost Optimization)

Full Fine-Tuning of a 70-billion parameter model means updating all 70 billion parameters. This requires a multi-GPU cluster and substantial cost, which puts it out of reach for many enterprises.

Parameter-Efficient Fine-Tuning (PEFT) methods address this, most notably a technique called LoRA (Low-Rank Adaptation). Instead of changing the 70 billion base parameters, LoRA freezes the base model’s weights. It adds small, low-rank adapter matrices (a tiny fraction of the model’s parameter count) to selected layers. Training only updates these adapters. This sharply reduces the number of trainable parameters and the GPU memory needed for training; combined with quantization (QLoRA), large models can be fine-tuned on a single high-memory GPU.

Fine-Tuning vs. RAG

Using Fine-Tuning to teach a model new facts is usually a mistake. If a company fine-tunes a model on their 2026 Employee Handbook, the model will memorize it. But when the 2027 Handbook is released, the company must pay to fine-tune the model again.

  • RAG is used to provide the model with dynamic, constantly changing Facts.
  • Fine-Tuning is used to teach the model a lasting Behavior, Tone, or proprietary Formatting.

Summary of Technical Value

Fine-Tuning is one of the main ways to customize Generative AI. By using efficient techniques like LoRA to adjust the weights of an open-weight model, organizations can turn a general-purpose LLM into a specialized, more accurate component for specific enterprise tasks.

Learn More

To learn more about the Data Lakehouse, read The Lakehouse Built for Everyone by Alex Merced. You can find this and other books by Alex Merced at books.alexmerced.com.

Work with Alex