LearnQuestion bank

Design the guardrail layer for a UK bank’s customer-facing assistant. What runs before, during and after generation?

Applied LLMTechnicalMedium

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • Before: validate/normalize input; detect and minimise PII; classify intent and regulated-advice boundary; run abuse/jailbreak and vulnerability checks; route high-risk or out-of-scope cases to humans.
  • During: system-prompt policy plus vetted, jurisdiction- and date-aware knowledge base; grounded retrieval with citations; least-privilege tool permissions and human approval for sensitive actions; constrained output format.
  • After: compliance classifier for regulated advice, promises and unfair treatment; grounding/hallucination check against sources; tone and Consumer Duty fairness review; PII leakage check; regenerate, block or hand off.
  • Latency: run lightweight checks in parallel, fail closed for high-risk intents, and avoid streaming unsafe content by buffering or gating chunks.
  • Monitoring: track flag rates, false positives, hand-offs and outcomes; keep audit trails and review against the Consumer Duty outcomes: products and services, price and value, consumer understanding and consumer support.

In full

I would treat the guardrail layer as a pipeline around the model, not a prompt alone. Before generation, I would validate and normalise the request, detect and minimise PII, classify intent and whether the user is asking for regulated advice (for example on investments, mortgages or insurance) or for a decision the assistant must not make, such as a credit decision, and run abuse/jailbreak and vulnerability checks so distress, hardship or high-risk cases go to a human rather than being answered by the assistant. During generation, the model should operate under explicit system-prompt policy, answer only from a vetted, UK-appropriate and date-aware knowledge base with citations, and use tools only with least-privilege permissions, with human approval for anything that moves money or changes an account. After generation, I would run a compliance classifier for regulated advice, promises and unfair treatment, check grounding and hallucination against the retrieved sources, review tone and fairness, and scan for PII leakage, then regenerate, block or hand off when checks fail. For latency, I would run lightweight checks in parallel and fail closed for high-risk intents, while being careful with streaming so unsafe or unverified content is not shown before the checks complete. Finally, I would monitor flag rates, false positives, regeneration and hand-off rates, and keep audit trails tied to the Consumer Duty outcomes (products and services, price and value, consumer understanding and consumer support), with thresholds set by risk assessment rather than invented numbers.

Corrected by an independent AI reviewer.

What a strong answer covers

  • Input: PII handling, scope/intent classification (regulated advice boundaries), abuse/jailbreak detection, vulnerability signals → human
  • Generation: grounded answers from a vetted knowledge base; tool permissions; policy in the system prompt
  • Output: compliance classifier (no regulated advice, no promises), grounding/hallucination checks, tone, PII leakage → regenerate or hand off
  • Latency: lightweight checks in parallel; streaming implications
  • Monitoring: flag rates, false positives, audit trails aligned with Consumer Duty outcomes

Common mistakes

  • Guardrails so strict that legitimate queries fail, with no over-refusal metric
  • chaining several sequential LLM checks that triple latency