The Case for Specialized Models
Follow a bookshop request, learn what makes a model a specialist, and see where prompting and fine-tuning fit.
Build and evaluate a router, invoice extractor, and SQL specialist with LoRA, QLoRA, synthetic data, model scaling, and a measured path to deployment.
Download as an EPUB 21 chapters โ read offline on any e-reader
Follow a bookshop request, learn what makes a model a specialist, and see where prompting and fine-tuning fit.
Compare instructions, demonstrations, dynamic example selection, retrieval, and training by following the evidence a bookshop request needs.
Follow one small weight update, connect it to the router's training examples, and understand what full fine-tuning, LoRA, and QLoRA change and save.
Prepare the router project, check one answer, and save a reproducible baseline before looking inside the inference code.
Read the prompting results, investigate missed routes, and build up the quality and timing measures that a fine-tuned router must improve.
Turn a routing policy into supervised examples, separate evaluation before expansion, and distinguish more rows from more useful coverage.
Train every parameter of the small router, supervise only destination tokens, and judge the saved checkpoint against an unchanged model.
Understand low-rank updates, train a small router adapter, and compare its behavior, memory, and artifacts with full fine-tuning.
Keep the base in four-bit storage, train higher-precision adapters, and measure the quality and runtime costs of that memory trade.
Measure six dataset sizes, compare useful coverage with repeated rows, and interpret a learning curve without confusing data volume with evidence.
Use a larger model to propose training text, preserve known answer fields, filter candidates, and compare generated data without inventing human supervision.
Turn observed errors into a targeted repair set, keep a matched training control, and use a fresh audit without recycling the test as a source of labels.
Turn bookshop invoice text into a strict record, compare prompting with LoRA, and separate valid JSON from correct facts.
Stress the invoice extractor with missing facts, conflicting totals, ambiguous dates, noise, and new layouts, then measure what targeted augmentation repairs.
Train a bookshop SQL specialist and grade query results against independent oracles, with explicit limits on syntax, permissions, and semantic correctness.
Compare Qwen3 0.6B, 1.7B, 4B, and 8B under one SQL training plan, then choose capacity from task quality and measured costs.
Use the book's measured router, extractor, and SQL results to choose an intervention from the failure it can actually repair.
Connect the router, extractor, and SQL specialist through typed inputs, independent authorization, validation, and an explicit fallback path.
Compare API calls, hosted large models, and specialist pipelines with explicit utilization, fallback, staffing, and amortization assumptions.
Turn a trained adapter into a versioned release, gate changes with regressions, monitor drift, and rehearse rollback without confusing a local demo with production readiness.
Dependency roles, inference calls, example-selection rules, and full reports for the prompting baseline in Chapters 4โ5.