Skip to main content

Fine-tuning models: LoRA, QLoRA and specializing a language model

How to take an open 7- to 8-billion-parameter language model and teach it a narrow task well enough to put it into production, without renting an eight-GPU cluster.

Course duration: 8h​

What you will learn​

  • Decide between a better prompt, a RAG index and a fine-tune before writing any training code
  • Prepare an instruction dataset in the model's own chat template, deduplicated and split for validation
  • Estimate the memory footprint of a full fine-tune for a 7-billion-parameter model, in gigabytes and in dollars
  • Freeze the base weights and train a small set of parameter-efficient adapters instead
  • Configure LoRA with a rank and alpha that match the target modules and the dataset size
  • Run QLoRA on a single 24 GB GPU with NF4 quantization, double quantization and the paged optimizer
  • Pick a learning rate, an effective batch size and a warmup that will not blow up the loss
  • Read the two loss curves, catch overfitting early, and generate samples at each epoch
  • Merge the adapter into the base weights and export a GGUF file for llama.cpp and Ollama
  • Evaluate the specialized model on a held-out set, including regression on general capabilities

Prerequisites​

  • Course 16 — Large language models
  • Course 09 — PyTorch

Course modules​

  1. Prompting, RAG or fine-tuning: choosing the right answer
  2. Preparing an instruction dataset
  3. Full fine-tuning and its real cost
  4. Parameter-efficient fine-tuning
  5. LoRA: low-rank adapters
  6. QLoRA and 4-bit quantization
  7. Fine-tuning hyperparameters
  8. Monitoring training and stopping at the right time
  9. Merging adapters and exporting
  10. Evaluation before and after fine-tuning

The red thread​

Every module works on the same task: specializing a 7- to 8-billion-parameter open model to write structured meeting minutes from raw transcripts. The dataset is a couple of thousand (transcript, minutes) pairs written in English, in a fixed schema — attendees, decisions, action items with owner and due date. The decision to fine-tune is made in module 1, the dataset is prepared in module 2, and by module 6 the training fits on a single 24 GB consumer GPU thanks to QLoRA.

The reference stack is transformers, peft, trl and bitsandbytes. Everything runs either on a rented 24 GB card at less than one dollar per hour or on a Colab-class notebook, so the numbers you see in the memory tables and the cost tables of the course are the ones you will actually pay.

Assessment and certificate​

The course ends with a 40-question exam covering every module. On success, a certificate of completion is issued; its number can be verified by anyone on the platform.

Free courses, by contrast, end with a 5-question quiz and a certificate preview, without certification.