Exercises

ex-sp-ch37-01

Easy

Compute the number of trainable parameters for LoRA with r=16 applied to Q,K,V,O projections of a model with d=4096 and 32 layers.

ex-sp-ch37-02

Easy

Convert 10 wireless Q&A pairs into the instruction-tuning format with system, user, and assistant roles.

ex-sp-ch37-03

Easy

Calculate GPU memory requirements for full fine-tuning vs LoRA vs QLoRA for a 7B model.

ex-sp-ch37-04

Easy

Implement a simple character-level GPT (1M params) following nanoGPT style and train on 100KB of text.

ex-sp-ch37-05

Medium

Fine-tune a 3B model on a wireless Q&A dataset using LoRA (r=8). Compare performance before and after fine-tuning.

ex-sp-ch37-06

Medium

Implement the LoRA forward pass from scratch (without PEFT library). Show that merging adapters reproduces the same output.

ex-sp-ch37-07

Medium

Train the same model with LoRA ranks r=1, 4, 16, 64 and plot validation loss vs rank.

ex-sp-ch37-08

Medium

Implement instruction tuning with proper loss masking (only on response tokens). Compare with naive full-sequence loss.

ex-sp-ch37-09

Medium

Build a data quality pipeline: deduplicate, filter, and score instruction-response pairs using an LLM judge.

ex-sp-ch37-10

Hard

Fine-tune a 7B model with QLoRA and benchmark against the base model on 3GPP terminology comprehension.

ex-sp-ch37-11

Hard

Implement curriculum learning for fine-tuning: start with easy examples and gradually increase difficulty.

ex-sp-ch37-12

Hard

Train a domain-adapted tokenizer on telecom text and compare token efficiency with GPT-2's tokenizer.

ex-sp-ch37-13

Hard

Implement DPO alignment on your fine-tuned model using synthetic preference data generated by a stronger model.

ex-sp-ch37-14

Challenge

Train a small multimodal model that can analyze constellation diagram images and identify the modulation scheme.

ex-sp-ch37-15

Challenge

Build a complete fine-tuning pipeline: data curation, training with LoRA, evaluation on multiple benchmarks, and model merging.