Title: Lab 7 — Fine-Tune Gemma 270M with Unsloth + QLoRA and Benchmark the Speedup
Course: AIINFRA 201: Model Adaptation — Fine-Tuning & Quantization > Section: Week 07 — QLoRA and Training on Consumer GPUs with Unsloth

🛠️ Lab 7 — Fine-Tune Gemma 270M with Unsloth + QLoRA and Benchmark the Speedup (50 pts)

Goal: Fine-tune a small model end-to-end using Unsloth + QLoRA on a free Colab T4 GPU in under 20 minutes, then empirically compare its training speed and VRAM usage against the plain PEFT/LoRA run you did in Week 6 — so the "2.5x faster, 30% less VRAM" claim stops being a number in a lecture and becomes something you measured yourself. Steps:

1. Open a new Google Colab notebook. Go to Runtime \> Change runtime type and select T4 GPU (free tier). Confirm the GPU is attached by running !nvidia-smi in a cell.
2. Install Unsloth in the Colab environment following the setup instructions in the Unsloth "Fine-tuning for Beginners" guide (see Resources). Use the official Unsloth Colab notebook structure as your starting point rather than writing the training loop from scratch.
3. Load a small base model — Gemma 270M is recommended for speed, following the Codecademy walkthrough in Resources — with 4-bit NF4 quantization enabled through Unsloth's FastLanguageModel loader.
4. Configure the LoRA adapter (rank, target modules, alpha) using Unsloth's recommended defaults from the guide, and prepare a small instruction-tuning dataset (the Alpaca dataset is a solid default, as used in the Unsloth official notebook).
5. Before training, record your baseline: note the VRAM shown by !nvidia-smi right after model load, and note the timestamp.
6. Run the fine-tuning job. When it finishes, record: total wall-clock training time, peak VRAM usage (!nvidia-smi again, or Unsloth's built-in memory stats if printed), and the final training loss.
7. Save your fine-tuned adapter and run at least 3 test prompts through the fine-tuned model to sanity-check it produces sensible output.
8. Pull up your Week 6 non-Unsloth PEFT/LoRA lab results (or re-run a comparable short job if you didn't record them) and place your Week 6 numbers side by side with this week's Unsloth numbers in a comparison table: training time, peak VRAM, and loss.
9. Write a short reflection (150–250 words): Did your results roughly match the "\~2.5x faster, 30%+ less VRAM" claim from the lecture? What do you think accounts for any difference between your numbers and that claim (dataset size, model size, batch size, etc.)?

Deliverables: Submit your completed Colab notebook (shared link or exported .ipynb) plus a short written comparison (table + reflection) as a text entry or attached document, showing your Week 6 vs. Week 7 (Unsloth) benchmark numbers side by side.