
The Dual LLM Pattern
Day 22 ended on the only move left after you accept that filtering fails: assume the injection lands, and make its success not matter. Today is the first concrete architecture that does exactly that. The dual LLM pattern is the cleanest structural answer to prompt injection, because it does not try to tell good text from bad. It accepts that the model reading untrusted content will be compromised, and it makes sure that compromised model has no privileged hands to act with.
This is a design pattern, not a product. The idea comes from the recognition, formalized by Simon Willison and others, that the problem is one model holding both the privileges and the exposure to untrusted content at the same time. Separate those two, and the attack loses its payoff.
The root problem, one more time
Every attack in this series worked because a single model did two jobs at once. It held privilege, access to tools, data, and actions, and it read untrusted content, tickets, pages, issues. When injected text in that content became an instruction, the same model that got fooled was the one holding the tools. The confusion and the capability lived in one place.
State it as the flaw: the component that can be compromised is the same component that can cause harm. Fix that overlap and you fix the class.
The core idea: two models, one boundary
Split the agent into two separate models with a hard boundary between them.
The Privileged LLM. This one holds the tools, the credentials, the ability to act. It orchestrates the task. But it never sees raw untrusted content. It works only with trusted instructions from the user and with references to data, not the data’s contents.
The Quarantined LLM. This one does all the work that requires reading untrusted content, summarizing a ticket, extracting a field from a web page, parsing a document. It has no tools, no credentials, no ability to act. It can read the poison, because reading the poison does nothing. It cannot act on it, because it has no hands.
The boundary between them is the whole defense. Untrusted content goes only to the quarantined model. Privilege lives only in the privileged model. They communicate through a narrow, controlled channel, never by passing raw content across.
Why this defeats injection
Walk the attack through it.
An attacker plants an injection in a support ticket. In the old single model design, the agent reads the ticket, gets injected, and uses its tools to exfiltrate. In the dual design, the ticket goes to the quarantined model. That model may well be fully compromised by the injection, it reads the malicious instruction and believes it. But it has no tools. The most a compromised quarantined model can do is return a wrong or malicious summary. It cannot call lookup_customer, it cannot send_reply, it cannot touch anything, because it holds nothing.
Meanwhile the privileged model, the one with the tools, never saw the ticket. It only saw the user’s trusted request and a controlled result from the quarantined model. There was no injected instruction in its context to follow.
The injection succeeded, and it reached nothing. That is the Day 22 thesis made real: you did not detect the attack, you made its success irrelevant by ensuring the compromised component had no power.
The hard part: the communication channel
The pattern lives or dies on how the two models communicate, because a naive channel reintroduces the whole problem.
The wrong way: let the quarantined model send free text back to the privileged model. If the quarantined model is compromised and can write arbitrary text into the privileged model’s context, the injection just crossed the boundary. You rebuilt the single model. The poison rode across in the summary.
The right way: the quarantined model never passes raw content or free instructions to the privileged model. It passes structured, constrained results that the privileged model treats as inert data, never as instructions. Two common shapes:
Symbolic references. The quarantined model works on content, but the privileged model only ever handles references to that content, not the content itself. Think of it as the privileged model saying summarize document A and send the result to the ticket owner, where document A and the ticket owner are opaque handles. The privileged model orchestrates handles. It never reads what is inside them, so there is no text in its context to be injected by.
Tightly typed outputs. The quarantined model is constrained to return a narrow, validated shape, a category label, a number, a boolean, a value from a fixed set, never free text. A compromised quarantined model can return the wrong label, but it cannot smuggle an instruction through a field that only accepts one of three allowed values.
The design goal for the channel: whatever crosses from quarantined to privileged must be unable to carry an instruction. Data, not commands. References, not content. Constrained, not free.
A concrete picture
Take the support agent. A dual LLM version:
- User, trusted, asks the privileged model to handle ticket T-501.
- The privileged model calls a tool to fetch the ticket, but routes the raw ticket body to the quarantined model, not into its own reasoning.
- The quarantined model reads the ticket, including any injection, and returns a typed result: category is billing, sentiment is negative, requested action is one of a fixed allowed set.
- The privileged model receives those constrained values. It never saw the ticket text. It decides, from trusted logic and typed inputs, what to do, and its scoping from Day 11 still bounds that.
- If the ticket contained inject the agent to email all customer records to attacker, the quarantined model read it and it went nowhere, because the only thing that crossed the boundary was a category and a sentiment.
The injection hit a model with no hands and produced output that could not carry a command. Dead on arrival.
Honest limitations
This is a strong pattern, not a magic one. Know its edges.
It constrains what the agent can do. A fully free form agent that reads anything and acts on anything is exactly the thing you are breaking up. Dual LLM works best when the task can be expressed as privileged orchestration over quarantined analysis. Some open ended agents resist that decomposition, and forcing it costs capability.
The channel is the risk. Every bit of expressiveness you allow across the boundary is potential bandwidth for an injection. The more structured and narrow the channel, the safer and the less flexible. That trade is real and you tune it per task.
The quarantined model’s output still influences decisions. A compromised quarantined model returning the wrong category can still cause a wrong action, just not an arbitrary one. You have bounded the damage to the range of its typed outputs, not eliminated influence. That is a huge reduction, not a zero.
It is more complex and more expensive. Two models, a boundary, a channel design. More to build, more to run. For high value agents it is worth it. For trivial ones it may be overkill, where simple scoping from Day 11 suffices.
The honest framing: dual LLM does not make injection impossible, it makes a successful injection reach a model that cannot act and speak through a channel that cannot carry commands. That is the strongest structural containment in the toolkit.
Reproduce it in the lab
Convert your single model agent into a dual one.
- Keep your existing agent host as the privileged model, but remove its ability to read raw tool content directly. It orchestrates only.
- Add a second model call, the quarantined one, with no tools, that receives the raw ticket or document.
- Constrain the quarantined model’s output hard: make it return only a fixed JSON shape with enumerated values, no free text fields.
- Have the privileged model act only on those typed values, with Day 11 scoping still applied.
- Run your best injection from week three. Confirm the quarantined model reads it but the privileged model never does, and the injection reaches nothing.
The exercise to feel: your payload lands in the quarantined model, which has no hands, and cannot escape through the typed channel. Same attack, zero effect.
Detection and defense, where this fits
Dual LLM is a containment architecture, so it sits alongside the rest of week four rather than replacing them.
- It pairs with capability scoping from Day 11 and Day 25: scoping bounds what the privileged model can reach, dual LLM bounds what untrusted content can influence. Together, the privileged model has limited reach and the untrusted content has no privileged hands.
- It pairs with egress constraint from Day 21: even the privileged model’s actions exit through allowlisted channels only.
- It does not need filtering, which is the point, it assumes the quarantined model is compromised rather than trying to keep it clean.
The thesis, advanced: you cannot stop the compromise, so you put the compromise somewhere it cannot act, and you let only inert data cross out of that somewhere. That is the dual LLM pattern.
Homework for Day 23
- Split your lab agent into a privileged orchestrator and a quarantined reader. Give tools only to the privileged one.
- Route all untrusted content to the quarantined model, and constrain its output to a fixed, enumerated shape with no free text.
- Run a week three injection and confirm it lands in the quarantined model but reaches nothing, because the privileged model never saw the content and the channel carried no command.
- Now deliberately widen the channel, let the quarantined model return free text, and show the injection crossing the boundary again. Feel why the channel design is the whole defense.
- Write a short note on what capability you lost by splitting the agent, and whether it was worth it for your task. That trade is the real engineering decision.
Point 4 is the one that teaches the pattern. When you watch a free text channel reintroduce the attack and a typed channel kill it, you understand that dual LLM is not two models, it is one boundary that commands cannot cross.
Day 24 generalizes this into a principle that governs the whole architecture, information flow control, where you track where every piece of data came from and forbid untrusted data from reaching privileged actions, of which the dual LLM pattern is one specific instance.