End-to-end fine-tuning pipeline
Run one reproducible pipeline from raw data through dedup, contamination checks, SFT, DPO, quantization and served inference, ending with an eval matrix and a model card.
The capstone and what it builds on
- 1End-to-End Fine-Tuning Pipeline (Data to SFT to DPO to Serve)The capstone brief
- 2Data Pipelines for Pre-TrainingPhase 10: LLMs from scratch
- 3Instruction Tuning (SFT)Phase 10: LLMs from scratch
- 4DPO: Direct Preference OptimizationPhase 10: LLMs from scratch
- 5Fine-Tuning with LoRA & QLoRAPhase 11: LLM engineering and RAG
- 6Evaluation: Benchmarks, Evals, LM HarnessPhase 10: LLMs from scratch
- 7Quantization: Making Models FitPhase 10: LLMs from scratch
- 8EAGLE-3 Speculative Decoding in ProductionPhase 17: Infrastructure and production
- 9Model, System, and Dataset CardsPhase 18: Ethics, safety and alignment
What You'll Build
A single command that takes a raw task dataset of your choosing through data hygiene, supervised fine-tuning, preference tuning, quantization and serving, then evaluates base vs SFT vs SFT+DPO and writes a model card. Reproducibility and honest ablations are the deliverable, not a record score.
Requirements
- One entry point (
./pipeline.sh config.yamlormake all) runs every stage; seeds are pinned and the config is versioned in the repo. - Data stage: exact and near-duplicate removal (MinHash or equivalent), a quality filter (heuristic or classifier), PII scrubbing (Presidio or documented regexes) and a seeded train/val/test split. Print counts after each step.
- Contamination check: n-gram or MinHash overlap between training data and every eval set you use; the pipeline fails if overlap exceeds a threshold. Include a test that injects contamination and shows the gate catches it.
- SFT stage (LoRA, QLoRA or full) with a logged loss curve saved to the repo.
- Preference stage: DPO (TRL or your own implementation) on preference pairs that are human-labelled or model-judged; sweep at least two beta values.
- Quantize to at least two formats (for example GGUF Q4KM and Q8_0, or AWQ and GPTQ) and record file size and throughput.
- Serve behind an OpenAI-compatible endpoint (llama.cpp server, vLLM or similar) with and without speculative decoding (draft model or n-gram); report tokens/s at two or more batch or concurrency levels, p99 latency and acceptance rate where the server exposes it, plus an estimated $ per 1M tokens from your hardware cost.
- Eval matrix: base vs SFT vs SFT+DPO on your held-out task set plus at least one public benchmark slice run through lm-evaluation-harness or an equivalent script.
- Safety eval: pass rate of a moderation classifier (a Llama Guard model or another open safety classifier) on outputs for a dev prompt set.
- Model card covering data sources and licences, training configs, eval results, safety results, intended use, limitations and reproducibility (configs, seeds, commit SHA).
Constraints
- Model-agnostic: any OpenAI-compatible endpoint (including the KatalockAi API) or a local model (for example via Ollama, llama.cpp or vLLM) may be used. No named commercial model is required; record which model you used in the README. Here the model you train is an open-weight base model; an endpoint is only needed if you use a model judge for preference pairs.
- Hardware: a single consumer GPU or a free Colab T4 handles LoRA on a 0.5B to 3B model. CPU-only toy path: a roughly 135M-parameter model on a few thousand examples; the full pipeline must still run end to end.
- Substitution: the lesson uses an 8B model on 8xH100, EAGLE-3 on vLLM and four large benchmarks. Here a 0.5B to 3B model, any speculative method your server supports, and your own task set plus one public benchmark slice are accepted.
- Pick your own task and dataset (with a licence that allows use); state it in the README.
Stretch Goals
- Compare DPO with GRPO on a task with a verifiable reward.
- Inject 1% benchmark answers into training and show the inflated score and the gate catching it in CI.
- Compare LoRA vs full fine-tune quality at matched compute.
How to Submit
- Public GitHub repo with
pipeline.sh(or Makefile),configs/,data/scripts (not raw data if large),train/,quant/,serve/,eval/(results table),MODEL_CARD.mdandREADME.md. - README: task and data choice, hardware used, how to run the whole pipeline, the eval matrix, serving numbers and limitations.
- Paste the full pipeline summary output, the eval matrix and the serving benchmark table.
How It's Reviewed
Professor Katalock reads your repository and the evidence you paste, and scores each criterion out of 100. You pass with a weighted total of 70 or more and no criterion below 40. A copied or padded submission is flagged and fails.
Submit
Push your work to a public GitHub repository with a README that explains how to run it, then paste the evidence below. Up to 3 reviews a day, free.
- Full pipeline summary output from the one-command run
- Eval matrix (base vs SFT vs SFT+DPO)
- Serving benchmark table (format, speculative on or off, tokens/s per load level, p99, $ per 1M tokens)
- Contamination gate test output
- Short reflection on which stage gave the biggest gain or the biggest surprise
Reviews are done by AI against the rubric above. They check the evidence in your repository; they are not a substitute for a human code review, and a review can be wrong. If you think it is, improve the README so the evidence is unmistakable and resubmit.