Skip to content

Courses / GenAI & LLM / Module 13

Module 13: Architecture and system design for LLM applications

12 h · theory 4 · hands-on 5 · project 2 · revision 1

You will be able to

  • Compare RAG, agentic, fine-tuned and hybrid architectures on cost, latency and risk
  • Apply a decision framework to an unseen brief
  • Draw and defend an end-to-end design
  • Plan a project from scope to rollout

Capstone increment: Architecture Decision Records (ADRs) for the capstone, plus 3 design exercises with model answers.

Job-description skills: System design, Architecture · Lab tools: mermaid

1. The shape of most LLM systems

Strip away the branding and most GenAI products share one shape: a client, an API with auth and rate limits, an orchestration layer (a fixed workflow or an agent), a model gateway, retrieval over your data, guardrails on the way in and out, and evaluation and observability around everything. Design is deciding which of these boxes you need, how big each must be, and what each one costs.

Start every design from requirements, not technology: who the users are, what a correct answer is worth and what a wrong one costs, latency targets, traffic, data sensitivity, budget and team size. The architecture follows from those.

Clientweb, app, SlackAPIauth, rate limitOrchestratorworkflow or agentGatewaymodels, fallbackGuardrailsin + outRetrievalindex + re-rankStoresPostgres, vectors, S3Queueasync jobsEvalsCI + onlineObservabilitytraces, costRequest pathData and platformcontextlong jobsevery call
Most GenAI systems are this shape. The design questions are which boxes you need, and what each one costs.

2. The main architectures and when to use them

Prompt only: one well-engineered call to a capable model. Fastest to build; fine for tasks the model already knows. Weak when answers depend on private or changing data.

RAG: retrieval over your documents plus generation with citations. The default for knowledge questions over private, changing content. Costs: an ingestion pipeline, index upkeep and retrieval evals.

Fine-tuned model: a small model trained for one behaviour. Best for high-volume, narrow tasks where latency and cost per call dominate, or data can't leave your servers. Costs: data work, training, and re-training when base models change.

Agent: a model choosing tools in a loop. For tasks whose steps can't be known in advance. Costs: higher latency and spend, harder testing, and a larger security surface.

Hybrids are normal: a workflow with RAG for context, a small fine-tuned model for the high-volume step, and a larger model as the escalation path.

Common misconception: “Pick the most capable architecture to be safe.” Every extra component adds latency, cost and failure modes. The best design is the simplest one that meets the requirements, with a path to grow.

3. A decision framework

Use the same steps for any unseen brief: (1) restate the problem and the success metric; (2) list constraints: latency, traffic, data residency, budget, team; (3) name two or three candidate architectures; (4) score them in a trade-off matrix against weighted requirements; (5) choose, and write down the main risks; (6) plan the rollout: a thin end-to-end slice first, evals before scale, and a staged release.

Record each significant decision as an Architecture Decision Record (ADR): context, decision, alternatives considered, consequences. ADRs are short, live in the repo, and are the best evidence in an interview that you made deliberate choices.

4. Numbers every design needs

Estimate traffic (average and peak queries per second), tokens per request, monthly model cost, and a latency budget split across stages (retrieval, re-ranking, first token, guardrails). These back-of-the-envelope numbers decide between an API and self-hosting, between a large and a small model, and whether caching is essential.

Design for failure: what happens when the model provider is down (fallback model, queue, graceful message), when retrieval returns nothing (honest not-found), and when costs spike (budgets and alerts).

In production: Write the cost estimate into the design doc and revisit it after launch. Teams that never estimate are routinely surprised by their first full month’s bill.

5. Design exercises

Practise on three briefs and compare your design with the model answers in the course repository: (1) a multilingual agri-advisory assistant for farmers on low-end phones with patchy connectivity; (2) contract review for a law firm where nothing may leave its servers; (3) an internal IT helpdesk agent that can reset passwords and open tickets.

For each: requirements, a diagram, the chosen architecture with an ADR, a cost and latency estimate, an evaluation plan, the top three risks, and a rollout plan. Time-box each to 90 minutes, like a take-home assignment.

Hands-on: coding window

The coding window and the full VS Code lab are available after you sign in.

Sign in to code

Labs

Lab 13.1: ADRs for the capstone (capstone increment)

Write ADRs for the capstone’s main decisions: model choice and routing, structured-output approach, confidence and review design, hosting, and observability tool. Each with context, decision, alternatives and consequences.

Expected: Five ADRs in docs/adr, each under one page, linked from the README.

Lab 13.2: Three design exercises

Complete the three design briefs from section 5 with a diagram, ADR, cost and latency estimate, eval plan, risks and rollout. Compare each with the model answer and note what you missed.

Expected: Three design documents and a list of the gaps you found against the model answers.

Lab 13.3: Defend a design

Present one design to a peer (or record yourself) in 10 minutes, then answer 10 minutes of hard questions on cost, failure modes and alternatives.

Expected: A recording or notes, and a revised ADR reflecting the best challenge you received.

Go deeper

Videos

Further reading

GitHub repositories

Checkpoint quiz

1. A bank wants answers about its frequently updated product terms, with sources. The default architecture is…
2. What should a design start from?
3. What does an ADR record?
4. Peak traffic is 5× average. Why does it matter for an LLM design?
5. The model provider has an outage. A good design…

Interview questions

  1. Design a multilingual support assistant for an Indian bank. Walk through requirements, architecture, cost and risks.
  2. RAG, fine-tuning or an agent: how do you decide for a new project?
  3. Estimate the monthly model cost for 50,000 users asking 3 questions a day.
  4. What happens in your design when the model provider goes down?
  5. Tell me about an architecture decision you made, the alternatives, and what you’d change now.

Ask the professor

Sign in to ask questions about this module.

Discussion

Community discussion appears here once giscus is configured (see README).