AI · 14.2
Designing AI Systems: Architecture, Cost and Safety
Name
Class
Date
Mark / 25
Section A
Circle the letter of the correct answer. One mark each.
- 1Which of these is a non-functional requirement?1
- AThe first words must appear within 2 seconds
- BExplain science topics step by step
- CLet students ask questions in plain English
- DAnswer questions about the course notes
- 2What does the gateway layer of an AI application do?1
- AWrites the answer to each question
- BStores the course documents
- CChecks who is asking and enforces rate limits
- DRuns the model on the GPUs
- 3Why does streaming make an AI app feel faster?1
- AIt shortens every answer
- BIt skips the safety checks
- CIt makes the model generate tokens faster
- DWords appear as soon as they are generated
- 4Why is token generation usually limited by memory bandwidth?1
- AEvery new token needs all the weights read from memory
- BGPUs cannot do arithmetic quickly
- CThe vocabulary is too large to search
- DTokens are stored on a slow hard disk
- 5300,000 requests a month each use 1,500 input tokens at £3 per million. What do the input tokens cost?1
- A£450
- B£1,350
- C£4,500
- D£135
- 6What is a model cascade?1
- AA small model answers easy requests and passes hard ones to a larger model
- BSeveral models trained one after another
- CA model that keeps retraining itself every night
- DA chain of layers inside one network
- 7A homework helper cannot read the grades database. Which principle is this?1
- AStreaming
- BLeast privilege
- CData drift
- DBatching
- 8Why is a keyword filter not enough against prompt injection?1
- AKeyword filters are too slow to run
- BPrompt injection only happens in images
- CAttackers can reword their instructions to avoid the keywords
- DFilters block every normal question
- 9What is a golden test set used for?1
- AMeasuring how much the GPUs cost each month
- BRunning checked examples after every change to catch regressions
- CStoring every user's conversation for later
- DTraining the next version of the model from scratch
- 10Which problem is often better solved by a classic machine learning model than by a language model?1
- AAnswering questions about course notes
- BSummarising a long report
- CTranslating a letter into French
- DPredicting sales from a table of past figures
Section B
Answer in the space provided. The number of marks tells you how many separate points to make.
- 1DescribeA company plans a chatbot that answers customers' questions using its product manuals. Describe an architecture for it, explaining the purpose of each part.6
- 2EvaluateA school's chatbot would cost £2,700 a month using a large model for every question. Evaluate ways to reduce the cost.5
- 3ExplainExplain why prompt injection is a serious risk for AI systems, and describe how layered defences reduce it.4
Mark scheme
Section A
Section B
1 A company plans a chatbot that answers customers' questions using its product manuals. Describe an architecture for it, explaining the purpose of each part. 6
One mark for each of the following, to a maximum of 6.
- Interface for customers (app or website)
- Gateway: authentication and rate limiting
- Retrieval: manuals chunked, embedded and stored in a vector database; relevant chunks found for each question
- Orchestration builds the prompt from the question and retrieved chunks
- Model serving: an LLM generates the answer (API or self-hosted)
- Guardrails check inputs and outputs (safety, personal data, prompt injection)
- Monitoring/logging of cost, latency, errors and feedback; evaluation set
Model answer. Customers use a chat interface on the company's website or app. Requests pass through a gateway that authenticates users and applies rate limits to prevent abuse. The product manuals are split into chunks, embedded and stored in a vector database; for each question, an orchestration layer embeds the question, retrieves the most relevant chunks and builds a prompt from them with clear instructions. A language model, either a provider's API or a self-hosted model, generates the answer, citing the manual sections. Guardrails check the question for attacks such as prompt injection and the answer for unsafe content or leaked personal data. Finally, logging and monitoring track cost, latency, errors and customer feedback, and a set of golden questions is re-run after every change.
2 A school's chatbot would cost £2,700 a month using a large model for every question. Evaluate ways to reduce the cost. 5
One mark for each of the following, to a maximum of 5.
- Use a smaller model where it is good enough; much cheaper
- But quality may drop on hard questions
- Model cascade/router: small model for easy questions, large for hard
- Caching shared prompts or repeated answers
- Shorter prompts / fewer retrieved chunks reduce input tokens
- A judgement: e.g. a cascade with caching balances cost and quality, tested against a golden set
Model answer. The simplest saving is a smaller model, which at the example prices would cost about £225 a month, but it may give worse answers to hard questions. A model cascade keeps most of that saving while protecting quality: a small model handles the easy majority of questions and passes hard ones to the large model, costing around £720 a month if it handles 80%, although the router must be reliable. Caching the long instruction prompt that every request shares, and storing answers to frequently repeated questions, cuts input costs further, and trimming the instructions or retrieving fewer chunks reduces the tokens paid for on every request. On balance, a cascade with caching is likely to bring the cost under budget with little loss of quality, but each change should be tested on a golden set of questions before release.
3 Explain why prompt injection is a serious risk for AI systems, and describe how layered defences reduce it. 4
One mark for each of the following, to a maximum of 4.
- The model cannot reliably tell instructions from data, so text in documents, web pages or emails can act as instructions
- Attackers can make it leak data or take harmful actions
- Filters and marking untrusted text help, but can be evaded by rewording
- Least privilege and human approval limit the damage when an attack gets through
Model answer. Prompt injection is serious because a language model reads trusted instructions and untrusted text, such as a web page, a document or an incoming email, in the same context, and cannot reliably tell them apart, so an attacker's text can act as instructions that make it leak data or take harmful actions. Input filters and clearly marking untrusted text as data catch some attacks, but attackers can reword their instructions to slip past. Layers therefore matter most: giving the model and its tools only the access the task needs, and requiring human approval for consequential actions, limit the damage when an attack does get through.