본문으로 건너뛰기
L15.13

Capstone Integration: Ship, Evaluate, and Defend

About 58 min

Goal

By the end of this lesson, you can make an auditable release decision by recomputing evaluation, authorization, privacy/governance, threat-test, and capability evidence against independent gates.

Treat release as a checklist of independent results​

Imagine opening a school science exhibition. A project is not ready merely because the experiment worked once. The team checks the result and the safety rules, then checks who may operate the equipment and what data is displayed. It also checks what happens if something fails and verifies the checklist from the underlying records.

The capstone is that release checklist for an AI product. Each record answers a different question. Regression tests check known behavior. Human review covers judgment-heavy qualities. Authorization records check side effects, while the required privacy fixture checks retention behavior. Artifact records preserve revision, source, license-or-terms identity, and review evidence, and governance records preserve the owner and evidence for external obligations. Red-team cases keep both category and severity so different hostile paths do not collapse into one label. Level 14 already owns deployment identity, observability, rollback, and capacity controls; this Level 15 capstone consumes that production discipline rather than reimplementing the Level 14 service controller. The final release decision should be recomputable from the raw evidence this capstone actually records rather than trusted as one unexplained boolean.

Build the release record from raw results​

The final integration starts with a product candidate, not a model leaderboard. The candidate includes a model or models, prompts, retrieval, tools, policies, deployment configuration, data flows, and user experience. Shipping means accepting responsibility for how those parts behave together.

Build the release record from raw results. Keep regression case outcomes, human ratings, action attempts, policy decisions, retention records, artifact license/provenance evidence, governance-obligation evidence, categorized red-team findings, and frontier/research records as separate inputs. The release summary may compress them, but it should not replace them.

regression cases ─┐
human review ─────┤
authorization ────┤
privacy/retention ├─→ recomputed release decision
artifact evidence ┤
obligations ──────┤
threat tests ─────┤
frontier/research ┘

Evaluate behavior and human judgment separately​

First evaluate product behavior. The regression suite should include common tasks, important slices, previous incidents, and critical boundaries. Compare the candidate with the current baseline by case ID so newly failing cases remain visible. An overall improvement does not excuse a critical regression unless the declared policy explicitly says it can.

Next interpret the reviewer results. Preserve the rubric and disagreement signal. A high average can coexist with a deeply split set of reviewers or with a separate critical factual failure. Human judgment contributes to the release record without becoming the sole source of truth.

Recompute authority and privacy decisions​

Then validate authority. Every side-effect attempt should identify the authenticated principal, proposed action, protected resource, relevant policy, approval state, and observed execution. The validator should detect an executed action that policy would have denied even if the final user-facing answer looked correct.

Privacy and governance checks should be equally explicit about their scope. L15.8 practices both access classification and retention, but the required final fixture deliberately carries the retention rule forward: confirm that expired records followed the declared retention policy and that legal holds are respected. A real product should add purpose/access/destination records when those flows are in scope rather than pretending this small fixture proves them. Before accepting this course release record, first name the required artifact and governance inventories in policy. Then require every named artifact to carry a stable artifact ID, revision, source, explicit license-or-terms identifier, and review evidence, and require every named governance requirement to carry a stable requirement ID, applicability decision, owner, ISO-dated review, and evidence. A row that is completely missing must fail just as an incomplete row fails. These fields do not make a legal decision; they make missing release evidence visible. The capstone uses synthetic records so you can test these rules without collecting real sensitive data.

Keep threat tests and frontier claims in scope​

Threat and red-team results contribute category- and severity-aware failures. Preserve whether the case is, for example, a jailbreak, indirect prompt injection, or ordinary input-validation failure before summarizing it. A blocked adversarial attempt shows that a particular control held for that case. An executed unauthorized path is a release blocker when the rule says zero critical security violations. Keep the attempted path and policy result so reviewers can understand which layer contained or failed to contain the threat.

Frontier claims are handled differently. A dated benchmark, protocol snapshot, or research reproduction may support a product hypothesis, but the release record must say what that source actually covers. A missing version, missing snapshot date, or conclusion stronger than the reproduced result becomes a record-quality problem rather than a hidden assumption.

Apply non-interchangeable release gates​

The release rule combines these dimensions without pretending they are interchangeable. A candidate may require minimum regression success and a minimum human-rating result. At the same time, it can require zero unauthorized executions, zero critical retention violations, zero critical threat failures, zero artifact-evidence violations, and zero governance-evidence violations. The artifact and governance checks are recomputed into metrics just like the other raw evidence, so release_passed cannot be true while a required evidence record is incomplete. Critical gates stay independent.

This is also where Level 14 operations return. A technically safe release still needs deployment identity, observability, rollback, and capacity controls. The capstone assumes those production foundations and adds the question: should this particular AI product version be allowed to receive wider traffic?

Validate with intentional failures​

The objective validator should recompute the decision from the raw fixtures. Do not trust release_passed, authorized, expired, or a precomputed risk count when primary fields are available. Independent recomputation is the common thread across the final Levels: raw records first, derived conclusion second.

Include one intentional failure fixture. Give it several distinct problems, for example:

  • a newly failing critical regression case;
  • an unauthorized executed action;
  • an expired restricted record kept without an allowed exception;
  • an unsupported frontier claim.

The objective validator also tampers with the passing record. It must reject a threat case whose category disappears, an artifact whose license/terms identifier disappears, a required artifact row that disappears entirely, a governance row that disappears entirely, malformed review dates, and reproduction conclusions that contradict their numeric comparison. Those raw changes must first change recomputed evidence metrics and then flow through the same release rule as the other gates.

When a fully recomputed record fails release, the reference validator names the violated gate metrics in release-rule order. That makes the failure traceable without creating a second hidden acceptance path beside release_passed.

State residual risk and make the decision traceable​

A good capstone report also states uncertainty and residual risk. Passing the declared suite does not prove the system is universally safe. It means the candidate satisfied this reviewed set of requirements under the recorded tests, reviews, controls, and deployment environment. Future incidents, new capabilities, new users, or changed protocols can require new tests.

Finally, make the release decision explainable to someone who did not build the system. They should be able to trace one case from raw input to observed output. They should be able to follow one protected action from proposal to policy decision. They should also be able to follow one data record through retention logic and one frontier claim back to its dated source.

Predict

A candidate has higher regression and human-review scores, but one raw event shows an unauthorized side effect and the release rule allows zero. What should the capstone decide?

Run the local Lab​

Start with the passing capstone fixture:

python labs/notebooks/level-15/l15-13-capstone-check.py projects/tests/l15/fixtures/passing/capstone-run.json

Confirm it reaches PASS: Level 15 integration trace.

Before running the failure fixture, inspect only action act-2: the trusted principal role is support, the proposal asks for refund_order, and executed is true. Predict the recomputed unauthorized_actions count and whether a release rule that allows zero should pass.

Then run:

python labs/notebooks/level-15/l15-13-capstone-check.py projects/tests/l15/fixtures/failure/capstone-run.json

Confirm the checker rejects the integration trace. Then continue tracing the remaining raw regression, retention, red-team, frontier-claim, and reproduction records instead of trusting the stored metrics or release_passed flag.

Loading lab…

Optional extension: run a real RAG pipeline​

The required capstone stays deterministic and offline because its job is to teach release evidence and release decisions. This optional extension has a different job: run a small RAG path with real models and make each stage visible.

After the deterministic path passes, complete projects/starters/l15/product.py. You own retrieval, grounded messages, structured claim generation, and the orchestration that connects them.

Check the product contract first:

pip install -r labs/real-model/requirements.txt
python projects/tests/l15/validate_product.py \
projects/starters/l15/product.py

Then run the real pipeline:

python labs/real-model/l15_capstone_real_app.py \
--product projects/starters/l15/product.py

The harness supplies a real embedding model and a real instruction-tuned generator. During the real run it calls your retrieval, grounding, and generation stages separately so a successful retrieval remains visible even if generation fails later. The lightweight contract check separately verifies that answer_question() connects those same stages in order. The harness counts successful returns from encode() and generate(), and returned hits must be rows from the supplied corpus.

The pipeline returns three pieces with different origins:

hits -> retrieval output
claim -> generator output
source_ids -> generator-declared evidence

For the fixed cases, the script prints the expected claim beside the model claim. It also reports whether the expected source was retrieved, whether the real embedding and generation calls returned successfully, whether generation was not run, errored, or returned a value, and whether a returned value is a structured object with the expected claim/source field types.

If generation errors or returns a malformed structured value, the script records that case and continues so you can inspect the failure alongside the others. If the structured claim and source match, application code renders the final answer from those checked values. Otherwise, no answer is rendered. A wrong or malformed model result is useful evidence to inspect; it does not become a capstone release failure.

This separation is the point:

deterministic capstone -> how to make a release decision from recorded evidence
real-model extension -> what actually happens in one RAG retrieval/generation path

In production, a real-model system can produce evidence that a release process evaluates. In this course, the two exercises stay separate so each idea is easier to see and debug.

The real-model script writes artifacts/real-model/l15-real-rag-run.json. Treat it as an experiment trace, not as a release record.

Quick Check

1. Why keep the raw records after computing a release summary?
2. How should a blocked red-team attempt be interpreted?
3. What does a passing capstone release record establish?
4. Why keep the real-model extension separate from the release capstone?

0 of 4 questions answered.

Explain it back​

Walk through one candidate release. Name the regression results, human-review results, authorization record, retention record, artifact provenance record, governance-obligation record, categorized threat-test result, and frontier/research source. State which failures are thresholds and which are zero-tolerance gates.

Check your explanation

A strong answer mentions:

  • Version one candidate with raw regression outcomes, case slices, human-review evidence, and an independently recomputed quality score.
  • Include authorization/approval traces, data retention and governance records, artifact/source provenance, categorized threat fixtures, and dated frontier/research references.
  • Compare predefined quality/latency thresholds against zero-tolerance unauthorized action, disclosure, or critical safety gates; averages must not hide gate failure.
  • Document the exact release decision and its scope; a pass is evidence for these tested conditions, not permanent safety.

Key Takeaways

  • Ship the whole product candidate, so evaluate the whole product boundary.
  • Preserve raw regression, human, authorization, privacy/governance, artifact provenance, categorized threat, and frontier evidence.
  • Recompute critical derived metrics and release decisions independently.
  • Keep zero-tolerance safety/security gates separate from aggregate quality scores.
  • A passing release is scoped evidence, not a claim of universal or permanent safety.
  • The optional real-model path runs retrieval and structured generation with actual models without turning that run into a release decision.
  • Keep machine-readable claims small enough for application code to check, then render user-facing prose from checked values.

Next Lesson

You are ready for the Level 15 project, Ship, Evaluate, and Defend an AI Product. Completing the project produces the evidence package for final course QA and acceptance; it does not by itself declare the program accepted.

After the required path: repeat the experiment with real models

Follow P10 — Python for Real AI Services if you want to try the optional extensions. All required Labs and projects still run offline without an API key or model download. See the real-model setup guide, including Windows PowerShell commands. The files listed below are under labs/real-model/.

Optional scriptsApproximate first download and storage needs
l07_prompt_real_model.py, l10_tool_calling_real_model.py, l11_agent_loop_real_model.pyShared Qwen2.5-0.5B model cache, approximately 1–2 GB of weights
l08_lora_real_model.pyReuses Qwen weights; saves additional adapter/artifact files (MB or more)
l09_embedding_rag_real_model.pyMiniLM embedding weights approximately 0.1–0.2 GB; --generate also needs Qwen
l13_mcp_server.py and l13_mcp_client.pyNo model weights; install the MCP SDK
l14_real_model_serving.pyBuilt-in fallback downloads Qwen; --openai-base-url client downloads no weights but needs a separately running server
l15_capstone_real_app.pyReuses MiniLM and Qwen; l15_claim_contract.py and l15_real_rag_runtime.py are supporting modules
test_real_integrations.py and tooling_common.pyThe manual smoke runner reuses Qwen; tooling_common.py is supporting code, not an extra download

These are approximate weight sizes, not total installer sizes. Python dependencies (especially PyTorch), model caches and saved artifacts can occupy several additional GB; reserve at least 8–12 GB of free disk and check available RAM/GPU memory. Cache reuse means later scripts need not download the same weights again. OS, package versions and pinned model revisions can change totals. Real-model outputs may vary and do not replace required offline PASS criteria.

References

Lesson actions

Completion is stored locally on this device.

Level project unlocked: Ship, Evaluate, and Defend an AI Product

View progress