Skip to content

Lab: fine-tune a model with LoRA using PEFT and TRL, from data to a merged model

A complete, tested fine-tuning run you can repeat on a laptop CPU in about three minutes: build a support-ticket dataset, measure the base model (0% valid JSON), train a LoRA adapter with TRL, measure again (100% valid JSON, 72% exact), save the 19.6 MB adapter and merge it. Includes the CPU pitfalls and how to move the same script to a GPU.

25 min·Verified 2026-111 animated diagramPro+50 XP
Share

This is the hands-on core of the course. You will fine-tune a real model, end to end, and measure what changed. The task is small on purpose, so the whole run finishes in a few minutes on an ordinary laptop with no GPU. The same script moves to a GPU and a larger model by changing a few lines (see the end).

Everything in this lab was run exactly as shown, with the library versions listed below. Library APIs change often, so if a call fails on your machine, check the release notes of the version you installed.

Pro content

Keep reading with Inference Academy Pro

Unlock the rest of this lesson, including 1 animated diagram, plus every advanced lesson, hands-on lab, the larger playground models and completion certificates.