Priors over priors
Why we are called Hyperpriors: what a hyperprior means in Bayesian terms, and why the control plane for production AI is exactly that — beliefs about how a system should hold beliefs.
Safety · Observability

Essay
·Safety·Whitepaper·11 min read
No single control makes an LLM product safe, and none needs to. A layered architecture — input mediation, capability scoping, output enforcement, human review, audit — works because the layers fail independently. A whitepaper on building it deliberately.
By Dr Gareth Roberts

Every few months a team discovers that their carefully worded system prompt did not, in fact, prevent the model from doing the thing the prompt forbade. The discovery is usually followed by a better prompt, which fails less often, and then a moderation filter, which fails differently, and eventually — sometimes after an incident — the realisation that they have been building a layered safety architecture all along, just reactively and in the wrong order.
This paper makes the case for building it deliberately. The organising principle is old: defence in depth, the assumption that every individual control is leaky and that safety comes from stacking controls whose leaks do not line up. What is specific to LLM applications is which layers you need, where each one leaks, and the engineering required to keep their failures independent — because independence is the entire value of the design, and it is easy to build five layers that fail as one.
The architecture has five layers. In order, from the outside in: input mediation, capability scoping, output policy enforcement, human review, and audit. Each is described below with its job, its characteristic failure, and its relationship to the others.
Everything that enters the model’s context is either an instruction you wrote or data you did not. The first layer’s job is to keep that distinction legible — to the system, since the model itself cannot be trusted to maintain it.
Concretely, input mediation covers:
Where it leaks. Input mediation is a classifier problem over adversarial, natural-language input; it will miss things. A well-crafted injection reads exactly like benign content. The layer’s realistic goal is to stop the casual and the accidental, raise the cost of the deliberate, and label everything so that later layers know what they are looking at.
If input mediation limits what the model hears, capability scoping limits what the model can do. This is the layer with the best return on engineering effort, because it is the one place where controls are deterministic: a credential the process does not hold cannot be exfiltrated, and an API the tool cannot reach cannot be misused.
The design rule is that the model’s tool list is a vocabulary, not a permission set. Authority lives in the execution layer, and it is scoped along four axes:
send_email tool because the platform happens to offer one.Sandboxing belongs here too: code execution in disposable containers, network egress denied by default, filesystem access scoped and ephemeral. The question to keep asking is the blast-radius question — if the model made the worst plausible sequence of calls this layer permits, what is the damage? If the answer is unacceptable, the fix is in this layer, not in the prompt.
Where it leaks. Scoping fails through composition. Each tool is individually safe; a sequence is not — a read tool that ingests attacker-controlled content followed by a send tool with a permissive argument policy is an exfiltration pipeline assembled from two “safe” parts. Reviewing tools one at a time misses this; you have to review the reachable combinations.
Between the model producing an output and that output reaching a user or a system sits the third layer: enforcement of what the product is allowed to say and emit, checked mechanically on the way out.
This layer has two distinct kinds of check, and conflating them causes trouble:
Two design decisions matter more than the checks themselves. First, fail closed: when an output check errors or times out, the safe default is to withhold or route to review, not to ship the unchecked output. This must be an explicit decision because the convenient default in most codebases is the opposite. Second, define what happens on rejection: silently retrying the model with the violation appended is often fine; doing so more than twice usually means the case should escalate rather than iterate.
Where it leaks. The statistical checks share a weakness with the model they police: they are pattern-matchers over language, and content designed or unlucky enough to sit off their training distribution passes through. The deterministic checks leak differently — they only catch what someone anticipated. The pairing is the point: one catches the unanticipated-but-typical, the other the anticipated-and-precise.
The fourth layer inserts people, and the engineering challenge is inserting them where they change outcomes rather than where they merely add latency. Human review is a scarce, expensive, fatigable resource; the architecture’s job is to spend it precisely.
Three placements cover most products:
The known failure of this layer is rubber-stamping: flood reviewers with escalations that did not need them and approval becomes reflexive, at which point the layer is theatre. Queue precision — the fraction of escalations where the human actually changed the outcome — is the health metric, and it should be on a dashboard next to the error rates.
Where it leaks. Humans miss things, tire, anchor on the model’s proposal, and inherit the model’s framing of the case. Review catches a different distribution of errors than the automated layers — obvious-to-a-person absurdities, contextual inappropriateness, judgement calls — and misses some things a regex would catch. That is acceptable. It is one layer, not the layer.
The final layer prevents nothing in the moment, and is for that reason the easiest to deprioritise and the most regretted omission after an incident. The audit trail is the record of every boundary crossing in the previous four layers: what entered the context and from where, what the model proposed, what the mediation and scoping layers decided and under which policy version, what the output checks scored, who reviewed what and what they decided.
The requirements that distinguish an audit trail from ordinary logging:
Where it leaks. Trails fail by omission (the one unlogged code path is where the incident happened), by unqueryability (the data exists but no one can extract the answer under incident pressure), and by becoming a liability themselves — an audit trail full of unredacted personal data is a second breach waiting inside the first. Treat the trail as a production system with its own access controls and minimisation policy.
Stacking five leaky layers only helps if their leaks are uncorrelated. This is the part of defence in depth that decays silently, because correlations creep in through convenience:
The test worth running periodically: take each layer, assume it silently fails open, and trace what the remaining layers catch. If any single-layer failure yields an unacceptable outcome, that is not a five-layer architecture; it is one control with four decorations.
There is a converse signal, too. A layer that never fires in production is either redundant or broken, and monitoring should distinguish the two. Healthy defence in depth shows each layer catching a modest, boring stream of real events — that stream is the evidence the layer exists in practice and not just in the architecture diagram.
For teams starting from a prompt and a hope, sequence matters, because the layers differ sharply in cost and coverage:
None of these layers will hold on its own. Each will fail in production, observably, and if the architecture is sound that will be an ordinary Tuesday rather than an incident: one layer’s miss, another layer’s catch, a line in the audit trail, a new case in the evaluation suite. That is what safety looks like in systems built from statistical components — not the absence of failure, but the refusal to let any single failure be enough.
Share
More
Why we are called Hyperpriors: what a hyperprior means in Bayesian terms, and why the control plane for production AI is exactly that — beliefs about how a system should hold beliefs.
Safety · Observability

An agent harness is the structured runtime between a model and the world: tool mediation, context management, retries, fallbacks, and human escalation. A prompt and a while-loop is not an architecture.
Harnesses · Safety

A five-stage maturity model for LLM evaluation practice — from ad hoc spot checks to continuous production evaluation — with the failure modes of each stage and the exit criteria that mark genuine progress to the next.
Evals · Whitepaper
