Title: Midterm Exam
Course: AIINFRA 303: Capstone Project > Section: Week 08 — Design Review and Working Vertical Slice

📝 Midterm Exam (100 pts)

Instructor note: the answer key below is hidden from students in the published version of this page.

Part A — Applied Scenario (40 pts)

You are three weeks into your capstone. Your architecture diagram (Week 3) shows a FastAPI gateway in front of a fine-tuned model served behind a REST endpoint, backed by a RAG pipeline for retrieval-augmented answers, with an agent layer that calls out to two MCP tools. Your instructor asks you to produce, before next week's design review, a short written plan (250–400 words) that covers:

1. How you will containerize the gateway and the model-serving component so they can be deployed identically in dev and in your Week 8 cluster (Weeks 1–3 skills).
2. What CI/CD pipeline stages you will add so that every push to main rebuilds and redeploys the containers automatically (Week 4 skills).
3. How you will choose between the fine-tuned model and a base model with strong RAG grounding for this specific task, and what evaluation you'd run to decide (Weeks 5–6 skills).
4. What guardrails you will put on the two MCP tools your agent calls, and one security control you will add so a malicious or malformed tool response can't compromise your system (Week 7 skills).
5. One FinOps control you will put in place before scaling this beyond your laptop (Week 7 skills).

→ A strong answer names specific artifacts (a multi-stage Dockerfile, a GitHub Actions workflow with build/test/push/deploy jobs, an evaluation harness comparing fine-tuned vs. RAG-grounded outputs on a held-out question set, tool-input/output schema validation plus an allowlist of callable MCP tools, and a budget alert or per-request cost cap) rather than vague generalities. It should also acknowledge trade-offs — e.g., fine-tuning gives consistency but costs more to iterate on; RAG is cheaper to update but depends on retrieval quality.

Part B — Short Answer (60 pts, 5 pts each)

1. (MC) Which of the following best describes a "walking skeleton"? (a) The finished MVP with all features (b) A minimal end-to-end system with real components wired together but trivial functionality (c) A UI mockup with no backend (d) A load-testing script

→ (b)

1. (TF) True or False: A multi-stage Dockerfile can produce a smaller final image by discarding build-time dependencies that aren't needed at runtime.

→ True

1. (Short answer) Name one advantage of deploying to a managed Kubernetes service (e.g., a cloud provider's managed cluster) over a single VM for a capstone-scale inference service.

→ Built-in scaling, self-healing (automatic restart of failed pods), and declarative rollout/rollback — any one is acceptable.

1. (MC) In a CI/CD pipeline, what is the purpose of a "canary" deployment stage? (a) Run unit tests (b) Roll out a change to a small subset of traffic/instances before full rollout (c) Encrypt secrets (d) Compile the container image

→ (b)

1. (Short answer) What is the difference between latency and throughput when evaluating an inference-serving endpoint?

→ Latency is the time for a single request to get a response; throughput is the number of requests the system can serve per unit time.

1. (TF) True or False: Fine-tuning is generally a better first choice than RAG when your model just needs access to frequently changing, factual information.

→ False — RAG is generally preferred for frequently changing factual information since it doesn't require retraining.

1. (MC) Which artifact records the reasoning behind a specific architecture choice, including alternatives considered and trade-offs? (a) A C4 diagram (b) An MADR (Markdown Architecture Decision Record) (c) A README (d) A Dockerfile

→ (b)

1. (Short answer) Name one MCP-specific security risk your agent's tool layer should guard against.

→ Any of: a malicious/compromised tool server returning crafted output to hijack the agent, prompt injection via tool results, an overly broad tool scope granting unintended access, or an unvalidated tool response being trusted without schema checks.

1. (MC) What does an SLO (Service Level Objective) typically define? (a) The exact hardware a service must run on (b) A measurable target for a service's reliability or performance, e.g., 99% of requests under 300ms (c) The org chart for the team (d) The git branching strategy

→ (b)

1. (TF) True or False: A vertical slice should ideally touch every layer of the architecture, even if each layer's functionality is minimal.

→ True

1. (Short answer) Name one FinOps practice you can apply to a capstone project that is still in active development (pre-production).

→ Any of: setting a budget alert/cap, tagging cloud resources by project for cost tracking, tearing down idle dev resources, choosing spot/preemptible instances for non-critical training jobs, right-sizing compute for the actual workload.

1. (MC) In the C4 model, which level shows how a single software system is broken into containers (applications, data stores, services)? (a) System Context (b) Container (c) Component (d) Code

→ (b)