KatalockAi AcademyBack to KatalockAi
Capstone 7, counts toward Phase 18

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.

about 35 h Earns its own certificate Reviewed against a 7-point rubric
Submit your project Get coached by Professor Katalock

The capstone and what it builds on

  1. 1End-to-End Fine-Tuning Pipeline (Data to SFT to DPO to Serve)The capstone brief
  2. 2Data Pipelines for Pre-TrainingPhase 10: LLMs from scratch
  3. 3Instruction Tuning (SFT)Phase 10: LLMs from scratch
  4. 4DPO: Direct Preference OptimizationPhase 10: LLMs from scratch
  5. 5Fine-Tuning with LoRA & QLoRAPhase 11: LLM engineering and RAG
  6. 6Evaluation: Benchmarks, Evals, LM HarnessPhase 10: LLMs from scratch
  7. 7Quantization: Making Models FitPhase 10: LLMs from scratch
  8. 8EAGLE-3 Speculative Decoding in ProductionPhase 17: Infrastructure and production
  9. 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

  1. One entry point (./pipeline.sh config.yaml or make all) runs every stage; seeds are pinned and the config is versioned in the repo.
  2. 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.
  3. 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.
  4. SFT stage (LoRA, QLoRA or full) with a logged loss curve saved to the repo.
  5. Preference stage: DPO (TRL or your own implementation) on preference pairs that are human-labelled or model-judged; sweep at least two beta values.
  6. Quantize to at least two formats (for example GGUF Q4KM and Q8_0, or AWQ and GPTQ) and record file size and throughput.
  7. 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.
  8. 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.
  9. Safety eval: pass rate of a moderation classifier (a Llama Guard model or another open safety classifier) on outputs for a dev prompt set.
  10. 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.md and README.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.

CriterionWeightHow it's checked
Eval delta vs base20Eval matrix shows base, SFT and SFT+DPO on the held-out task set and a public benchmark slice, with the learner's own numbers.
Pipeline reproducibility15One command runs all stages with pinned seeds and versioned configs; the summary output matches committed results.
Data hygiene15Dedup, quality filter and PII scrub counts are printed; contamination gate exists and its injection test passes.
Serving efficiency15Two quant formats with size and throughput; tokens/s at two or more load levels, p99 and $ per 1M tokens, with and without speculative decoding.
Model card and safety eval15MODEL_CARD.md covers data, training, eval, safety pass rate, licence, limitations and reproducibility details.
Code quality and structure10Stages are separate scripts with clear inputs and outputs; config driven; tests for data and contamination steps.
README: design decisions and limitations10README justifies model size, beta choice and quant formats, reports what failed and states limits.

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.