Duration: 8 hours (planning + kickoff; full build spans your capstone window) | Difficulty: Advanced | Prerequisites: Modules 1–15, comfortable with Python, APIs, and basic Docker
Learning Objectives
By the end of this module, you will be able to:
- Choose among three capstone tracks (production RAG, agentic system, or fine-tuned model) based on portfolio goals and constraints.
- Design a production-grade architecture for your chosen track, including data flow, evaluation, and safety boundaries.
- Build a complete AI application that composes skills from this track: embeddings, retrieval, agents, evaluation, guardrails, and/or training.
- Ship deployment-oriented artifacts: API surface, tests, monitoring hooks, and reproducible setup.
- Self-assess using an expanded rubric with sub-criteria and peer-review prompts.
- Anticipate common integration failures (latency, eval leakage, tool misuse) and document mitigations.
- Present your work with architecture diagrams, metrics, and honest limitations.
- Cross-reference the canonical spec in projects/capstone.md for deadlines and submission format.
1. Capstone Overview
You synthesize the Generative AI engineering track by shipping one primary path. Every path must include evaluation, basic safety, and documentation.
Default (Path A): production RAG assistant over your corpus with citations, streaming API, and automated quality checks.
Details, deadlines, and submission bundles live in projects/capstone.md.
2. Project Path Options (Detailed)
Path A — Production RAG system (default)
Goal: Grounded Q&A over a corpus you control.
| Must-have | Stretch |
|---|---|
| Ingestion + justified chunking | Hybrid + reranker |
| Citations to chunk or URI | Semantic cache |
| Streaming answers | Agent helper for retrieval only |
Key Example: Persistent Chroma collection—swap in your chunks and metadata.
[object Object], chromadb ,[object Object], PersistentClient
client = PersistentClient(path=,[object Object],)
col = client.get_or_create_collection(,[object Object],)
col.add(
ids=[,[object Object],, ,[object Object],],
documents=[,[object Object],, ,[object Object],],
metadatas=[{,[object Object],: ,[object Object],}, {,[object Object],: ,[object Object],}],
)
,[object Object],(,[object Object],, col.count())Path B — AI agent with tools
Goal: Plan → act → reflect with ≥3 tools, explicit budgets, and audit logs.
| Must-have | Why it matters |
|---|---|
| JSON schemas per tool | Testability |
| Max steps / tokens | Prevents runaway spend |
| Memory story | Long sessions need trimming |
Sketch: TOOLS list + naive_plan() that picks calculator vs kb_search—replace with real LLM routing in your build.
Path C — Fine-tuned or instruction-tuned model
Goal: Measurable lift on a narrow task using SFT / LoRA—not pretraining.
| Must-have | Storytelling |
|---|---|
| 500+ curated rows (license cleared) | Data card in README |
| Baseline vs tuned on held-out set | Table of metrics |
| Hyperparameters + data version logged | Reproducibility |
Dataset row shape: instruction / input / output in JSONL—tokenize + LoRA per Hugging Face PEFT docs.
3. Project Phases (All Paths)
Phase 1: Foundation (~2 hours)
Repo layout, .env.example, pins, one happy-path smoke test.
Phase 2: Intelligence (~2 hours)
Path A: better retrieval; Path B: agent loop + tool errors; Path C: first training + eval delta.
Phase 3: Quality (~2 hours)
Eval harness, guardrails, optional cache if latency hurts.
Phase 4: Production (~2 hours)
Streaming API, structured logs, Docker, architecture diagram.
4. Milestone Table (Weekly Deliverables)
| Week | Deliverable | Path A | Path B | Path C |
|---|---|---|---|---|
| 1 | Contracts | Ingest + index | Tool schemas + fakes | Dataset v0 + license |
| 2 | Core loop | RAG + citations | ≥3 tools demo | Baseline metrics |
| 3 | Quality | Eval suite | Guardrails + audit log | LoRA + delta table |
| 4 | Hardening | Cache / rerank | Recovery + memory caps | Failure analysis |
| 5 | Production | Docker + API | + agent metrics | Served adapter demo |
| 6 | Polish | README + tests | README + tests | Training report |
Tune weeks to your academic calendar—keep one concrete artifact per week.
5. Technical Requirements
| Layer | Representative deps |
|---|---|
| LLM clients | openai, anthropic, google-generativeai |
| Orchestration | langchain, langgraph |
| Vectors | chromadb, sentence-transformers |
| API | fastapi, uvicorn, pydantic |
| Eval | ragas, datasets |
| Safety | guardrails-ai (optional) |
| Path C | transformers, peft, accelerate |
Pin versions in requirements.txt or pyproject.toml—“works on my laptop” isn’t a deployment strategy.
6. Architecture Reference (Path A — RAG + Agent)
┌──────────────────────────────────────────────────────────┐
│ FastAPI Service │
│ /chat (stream) │ /ingest │ /evaluate │
│ ▼ │
│ Guardrails: input → PII/toxic → policy │
│ ▼ │
│ Orchestrator: RAG + tools + memory │
│ ▼ │
│ Retrieval: rewrite? hybrid? rerank? → vector store │
│ ▼ │
│ Monitoring: cost, latency, quality, alerts │
└──────────────────────────────────────────────────────────┘7. Getting Started — Project Scaffold
Suggested tree (adapt freely):
| Folder | Responsibility |
|---|---|
app/ | FastAPI entry, config, schemas |
core/ | RAG, agent, retriever, memory |
ingestion/ | loaders, chunkers, embedders |
safety/ | input/output guards |
evaluation/ | metrics + batch runner |
tests/ | API, RAG, safety |
Try This! Create the folders before you write clever code—structure forces interfaces.
8. Evaluation Rubric (Expanded with Sub-Criteria)
| Criterion | Weight | What “excellent” looks like |
|---|---|---|
| RAG / Grounding | 25% | Hybrid or rerank + traceable citations + ablation note |
| Agent / Tools | 20% | ≥3 tools, tests for routing, strict budgets |
| Safety | 15% | Layered defenses + short threat write-up |
| Evaluation | 15% | Automated metrics and small human spot check |
| Production | 15% | Docker + streaming + observability hooks |
| Code Quality | 10% | Modules, types, CI-friendly tests |
Path C swap: replace RAG row emphasis with data hygiene + baseline gap + no leakage; confirm weight tweaks with your instructor.
9. Practice Exercises
- One-page memo: pick Path A/B/C with two risks + mitigations each.
- Draft 20 eval items tagged easy / medium / adversarial.
- Latency budget math: retrieval + LLM + cache opportunities.
- Injection case study via poisoned doc—list two defenses.
- Mermaid diagram peer review.
10. Common Pitfalls
| Pitfall | Mitigation |
|---|---|
| Eval leakage | Split by document ID; version indexes |
| Tool sprawl | Three tools first; contract tests each |
| Ignoring p95 latency | End-to-end timers + timeouts |
| Judge-only eval | Add deterministic checks |
| No observability | Request IDs + retrieval logging |
11. Submission Checklist
- Path stated in README
- Core loop works (RAG or agent or tuned model)
- Guardrails proportionate to risk
- Eval pipeline with 5+ checks/metrics
- Streaming API where applicable
- Cache or documented why not
- Cost/latency logging
- Docker instructions
- 10+ automated tests
- Architecture diagram
12. Mini-Project (Module-Level)
Vertical slice (4–6 hours): ingest five docs or wire two tools or one short training run on ~100 rows.
Deliver: branch mini-capstone, scripts/demo_slice.py, stdout table + “Known limitations” (≥3 bullets).
13. Key Takeaways
- Discipline is shared: contracts, eval, ops—not just model picks.
- README + diagram are graded artifacts; draft them in week one.
- Most failures are leakage, latency, observability—plan for them explicitly.
14. Resources
Key Takeaway
- Pick a path that fits your data and story, not the flashiest buzzword.
- Ship a vertical slice early, then widen—scope creep kills capstones.
- Evaluation + safety + Docker are part of the product, not stretch goals.
- Document limitations honestly; interviewers trust that maturity.
- Keep syncing with projects/capstone.md for authoritative deadlines.