Ask a pretrained model for SQL
Define the task, inspect a real mistake, and establish a baseline before training.
Open lesson →5 lessons · Basic Python · Builds on the Shakespeare project
Take a pretrained model, teach it using an existing dataset, and find out whether its answers improve. Learn to run the experiment and question the score.
The task is concrete: a table schema and a question go in; one SQL query comes out. We use WikiSQL and a small Qwen model, train LoRA adapters, and inspect both improvements and mistakes. You can follow every lesson using recorded examples before installing anything.
Bring basic Python and the ideas of next-token prediction, loss, updates, and saved weights from Building Language Models from Scratch. No matrix calculus is required; the ML fundamentals course is optional support.
Define the task, inspect a real mistake, and establish a baseline before training.
Open lesson →Separate training from evaluation and find which response tokens receive a penalty.
Open lesson →Distinguish the SFT objective from LoRA, and identify what changes in the model.
Open lesson →Follow batches, loss, gradients, updates, validation, and saved adapters.
Open lesson →Compare answers, examine failures, and design a check beyond the benchmark.
Open lesson →Download the source and recorded results. The lab uses Apple Silicon and Python 3.12, with no API key. The measured training run took four minutes on an M3 Max with 36 GiB RAM; this is not a runtime or memory guarantee for other Macs. Source and recorded outputs are included; model weights download separately and your run produces an adapter.
Lessons and prepared examples work without an account. Sign in for AI feedback, page chat, and account-saved work. All lessons remain accessible without completing an assessment.
Compare six AI learning resources when you want a broader introduction to machine learning or the Hugging Face fine-tuning ecosystem.