Module 6: Evaluation & Production Ops · 2h
01 · UNDERSTAND
Day 35 Theory — Regression Engineering: Prompt/Model Versions, Drift and CI Gates
AI systems regress differently
A dependency upgrade, prompt edit, model version change or retrieval change can alter behavior without causing a compiler error.
Regression engineering makes those changes visible before release.
Version the behavior inputs
Track at least the artifacts that materially affect outputs:
- application code,
- prompt templates,
- model/provider configuration,
- embedding model,
- retrieval/reranking configuration,
- tool schemas,
- policy versions.
A production result should be traceable to the versions that created it.
Evaluation in CI
A CI gate can run deterministic tests and a controlled evaluation suite on proposed changes.
Do not make every probabilistic score a hard binary gate immediately. Some metrics fluctuate.
Use statistically and operationally meaningful thresholds based on baseline behavior and risk.
Golden sets and holdouts
A regression set should include known important cases, especially past failures.
Keep a holdout or periodically refreshed set so the team does not tune only to known examples.
Drift
Drift can come from:
- user traffic changing,
- source documents changing,
- provider/model changes,
- policy changes,
- new attack patterns.
CI catches pre-release regressions. Production monitoring catches drift after release.
Rollback and reproducibility
If a new prompt/model combination is worse, the system should be able to identify and restore the previous known configuration.
Service Desk connection
Today the Service Desk gets an engineering release discipline around AI behavior.
The principle is:
Treat prompts, models and retrieval settings as versioned production dependencies, compare them against stable eval baselines, and make regressions block or roll back releases according to risk.
02 · APPLY
Lesson Overview
This is the applied companion for Day 35. Read DAY_35_THEORY.md first for the beginner-first teaching of Regression Engineering: Prompt/Model Versions, Drift and CI Gates. Then use the real service-desk-day-35/ project to trace, run, debug, and explain the concept.
Service Desk Alignment
Day 35 adds Regression Engineering: Prompt/Model Versions, Drift and CI Gates to the running Service Desk. Start with eval/golden_set.py, eval/gate.py, eval/runner.py, eval/reporter.py, eval/evaluator.py, models.py, then follow imports and tests to identify the actual runtime path.
Why This Topic Matters
The theory chapter explains why Regression Engineering: Prompt/Model Versions, Drift and CI Gates is needed. Here the goal is evidence: identify where the capability is implemented, what observable behavior changes, and how the repository proves both success and failure behavior.
System Architecture
This is a repository surface map, not a claim that modules call each other in the displayed order. The modules are ranked by relevance to today's theory.
graph LR
T[Day 35: Regression Engineering - Prompt/Model Versions, Drift and CI Gates]
T --> M1[eval/golden_set.py]
T --> M2[eval/gate.py]
T --> M3[eval/runner.py]
T --> M4[eval/reporter.py]
T --> M5[eval/evaluator.py]
T --> M6[models.py]
T --> M7[agent/core.py]
T --> M8[agent/tools.py]
Follow imports and tests to discover the actual runtime flow.
Repository Implementation Map
Use the real Day 35 repository, not a fabricated sample, to connect theory to implementation.
Theory concepts to locate:
- AI systems regress differently
- Version the behavior inputs
- Evaluation in CI
- Golden sets and holdouts
Most relevant implementation modules first:
service_desk/eval/golden_set.pyservice_desk/eval/gate.pyservice_desk/eval/runner.pyservice_desk/eval/reporter.pyservice_desk/eval/evaluator.pyservice_desk/models.pyservice_desk/agent/core.pyservice_desk/agent/tools.pyservice_desk/config.py
Follow imports/calls from the relevant module and confirm behavior in tests. Record input → mechanism → observable output/state → failure evidence.
Code Walkthrough & Mechanics
Read eval/golden_set.py, eval/gate.py, eval/runner.py, eval/reporter.py, eval/evaluator.py, models.py, agent/core.py, agent/tools.py, config.py with these theory sections beside you:
- AI systems regress differently — locate its implementation and evidence.
- Version the behavior inputs — locate its implementation and evidence.
- Evaluation in CI — locate its implementation and evidence.
- Golden sets and holdouts — locate its implementation and evidence.
- Drift — locate its implementation and evidence.
For each concept identify the real function/class/protocol boundary, its input/state, its observable result, and the assertion in tests/test_golden_set.py that proves the behavior. If a concept has no implementation or evidence, record that as a gap rather than inventing one.
Common Mistakes & Debugging Guidance
Use the theory—not generic timeout or .env advice—to decide what can fail today.
Failure lens: revisit Golden sets and holdouts, Drift.
- Reproduce the smallest case that violates one of those expectations.
- Trace the real Day 35 modules until you find the first incorrect state/output/decision.
- Use
tests/test_golden_set.pyas executable evidence. - Add a regression test if the failure is not already represented.
- Fix the smallest responsible boundary and rerun the relevant test before the full suite.
Your debugging explanation must name the topic-specific invariant that failed, not merely say “an exception occurred.”
Practical Lab Instructions
- Summarize these theory ideas before opening the implementation:
- AI systems regress differently
- Version the behavior inputs
- Evaluation in CI
- Golden sets and holdouts
- Inspect the most relevant real Day 35 modules first:
service_desk/eval/golden_set.pyservice_desk/eval/gate.pyservice_desk/eval/runner.pyservice_desk/eval/reporter.pyservice_desk/eval/evaluator.pyservice_desk/models.pyservice_desk/agent/core.pyservice_desk/agent/tools.pyservice_desk/config.py
- Inspect the automated evidence:
tests/test_golden_set.py
- Establish the baseline:
cd service-desk-day-35 PYTHONPATH=. pytest tests/test_golden_set.py -q - Trace one theory concept through the actual nested modules and tests.
- Run one success case and record input → mechanism → observable result.
- Exercise one topic-specific failure/boundary case and name the invariant that protects the system.
- Re-run the relevant tests and explain theory → implementation → evidence.
Done when: another student can reproduce your trace without relying on an invented sample.
Key Takeaways
- Be able to explain AI systems regress differently and point to its implementation/evidence in Day 35.
- Be able to explain Version the behavior inputs and point to its implementation/evidence in Day 35.
- Be able to explain Evaluation in CI and point to its implementation/evidence in Day 35.
Knowledge Check & Scenario Questions
- Concept: Using AI systems regress differently, explain the engineering problem Day 35 is solving without naming a framework as the answer.
- Mechanism: How does Version the behavior inputs appear in the real project? Start from
service_desk/eval/golden_set.pyand name the observable state/output/event that changes. - Failure: For Evaluation in CI, describe one incorrect implementation or boundary condition and the evidence you would expect in
tests/test_golden_set.py. - Design review: Which assumption in today's design would you verify before reusing this implementation in a different production system?
Official References
- Promptfoo CI/CD Evaluation Gates: https://www.promptfoo.dev/docs/ci/
- MLflow Model Registry & Versioning: https://mlflow.org/docs/latest/model-registry.html
03 · EXPLAIN
Interview checkpoint
Explain one design decision from this lesson, the alternative you rejected, and the failure mode or evidence that justified your choice.