When a large language model (LLM) task is split across several cooperating model instances, such as a planner, a coder and a tester, every intermediate message becomes plain text that any downstream agent can read, repeat, and be tricked into leaking. The proposal is to treat that split as a map of who needs to see what. For each message, only the few fields that a receiving agent's role does not need get encrypted ("sealed"). Those fields reach that agent as opaque handles. Only deterministic code, or the agent that actually needs the value, can open them. This borrows the core idea of selective encryption from image and video security: a small, well-chosen fraction of the data carries most of what matters. Here it is applied to the messages exchanged inside an agent system rather than to bit planes or gradients.
This matters because the two lines of evidence currently point in opposite directions. Splitting tasks across agents clearly helps. A thinker/judge/executor split raised GPT-4 Turbo from 54.68% to 76.73% on the hardest MATH problems (MACM), and an analyst/coder/tester split reached 90.2% Pass@1 on HumanEval (Self-collaboration Code Generation via ChatGPT). Yet the same plain-text channels let a self-propagating prompt extract over 87% of agents' system prompts (IP Leakage Attacks Targeting LLM-Based Multi-Agent Systems). They also leak personal data from agent memory within two or three rounds (Topology Matters). Nobody has measured task accuracy, leakage under attack, and wall-clock cost together for any cryptographic defense in this setting. That joint measurement is the third direction's empirical-validation gap, and here it is the study's main constraint.
Core Claim
The claim is that role decomposition makes selective encryption both cheap and effective, and that a role-aware rule for choosing what to seal is the deciding ingredient. Concretely, a counterfactual necessity score can be computed per field and per receiving role: how much does that role's output on held-out tasks change when the field is replaced by an opaque handle? Sealing every field whose score falls below a threshold should remove most leakage under memory-extraction and worm-style attacks. It should also keep accuracy within a few points of the unprotected pipeline. Finally, at an equal leakage level, it should preserve more utility than either sealing all detected personal data or sealing at random.
The mechanism works because of the planning/execution split. A planner usually needs the structure of a value ("a loan amount exists, compare it to a threshold"), not the value itself. The executor that does the comparison is ordinary code, not a model that can be talked into leaking. Executor outputs are re-sealed by default, and only declared result types pass in the clear. Because the computation on sealed values runs after authorized decryption, cheap symmetric encryption with per-role keys suffices. Homomorphic encryption, meaning computation directly on encrypted data, is not needed.
Relation to Prior Work
Two papers supply the method's logic but study a different object. Evaluating Selective Encryption Against Gradient Inversion Attacks compares significance metrics for choosing which gradient entries to encrypt. Its key finding is that no single metric protects against both attack families: gradient magnitude stops optimization attacks, while parameter magnitude stops analytical ones. We expect the same split here. Personal-data detectors and necessity scores may each fail against a different attack, so both attacks are tested.
SHE-LoRA shows that encrypting a tiny fraction of adapter columns blocks exact reconstruction while cutting communication by up to 99.71%. It assumes a single honest-but-curious server, and that assumption is exactly what fails when there are many agents and no trusted center.
Encryption-Friendly LLM Architecture constrains the design. Running encrypted computation inside a transformer still left its two-layer model trailing plaintext (GLUE average 0.6621 versus 0.7068). That gap is why we avoid encrypted model computation entirely and seal only data at rest in messages.
The attack papers motivate the work and supply the threat models. MASLEAK and MAMA/SPIRIT (IP Leakage, Topology Matters) measure leakage but implement no cryptographic defense. Topology Matters offers "least privilege" only as an informal guideline, and this proposal is an attempt to make that guideline enforceable.
Contextual Integrity via Reasoning and RL is the closest defensive competitor. It trains the model itself to decide when disclosure is appropriate, cutting PrivacyLens leakage by up to 40%. Its compliance is learned, though, and rewarded by keyword matching that paraphrase can evade. Sealing instead removes the value from the model's context, so there is nothing left to paraphrase.
Research Program
We will build a sealing layer that sits between agents in existing pipelines: MACM's thinker/judge/executor, the analyst/coder/tester pipeline from Self-collaboration, and the MAMA and MASD agent graphs. Messages are parsed into typed fields; for free text, these are spans tagged by a lightweight extractor. Each field gets one of three treatments for each receiving role. It can be passed in the clear, replaced by an authenticated encrypted handle, or replaced by a structural stub such as "numeric, 6 digits."
The necessity score for field $f$ and role $r$ is
$$ n(f, r) = \mathbb{E}_{x}\big[\, d\big(r(x),\; r(x_{f \to h})\big) \,\big], $$
where $x$ is that role's input on a calibration task, $x_{f \to h}$ is the same input with $f$ replaced by its handle, $d$ is a task-specific output distance (answer mismatch, test-outcome change), and the expectation runs over a small calibration set. Fields with $n(f, r) < \tau$ are sealed for $r$. Sweeping the threshold $\tau$ traces out a curve of utility against leakage.
Two deployment settings will be studied separately, because they change what the cryptography buys. In the first, a trusted orchestrator holds all keys. In the second, a decentralized topology (complete, circle, or cross-vendor) gives each role only its own keys, and no party sees everything.
Baselines
The naive reference point is the unprotected pipeline: each multi-agent system run exactly as published, with plain-text messages. It fixes the utility ceiling and the leakage floor. For MACM on Level 5 MATH with GPT-4 Turbo, the published figure is 76.73%. For Self-collaboration on HumanEval with GPT-4, it is 90.2% Pass@1. For MASLEAK on MASD, prompt extraction is over 87%. For SPIRIT, adjacent-attacker leakage in a six-node circle is about 29%. We will rerun all of these ourselves on current model versions rather than compare against the printed numbers. If our rerun differs from the published figures, that gap is itself reported.
The strongest existing defense is contextual-integrity reasoning trained with group-relative policy optimization (CI-RL), reported at up to 40% leakage reduction on PrivacyLens. We will apply its released recipe and dataset to the same open base model (Qwen2.5-7B, as in that paper) and plug it into every agent slot. Sealing then runs on the identical base model, with the same calibration data budget the RL recipe uses for training. We also test the combination of the two. Beating CI-RL means lower leakage under MAMA and under an adaptive paraphrasing variant of MASLEAK, at task accuracy no worse than CI-RL's, on both PrivacyLens and SPIRIT.
The sparse-topology baseline reconfigures each graph as a chain or tree, following Topology Matters, with no sealing.
The prompt-defense baseline adds sandwiching and delimiters. MASLEAK reports that these fail but gives no separate number for them on Lacuna, so we measure it ourselves.
Two ablations isolate the key ingredient. In both, the sealing budget (the fraction of tokens sealed) is matched to the necessity-scored version. One seals at random. The other seals every span a personal-data detector flags, regardless of role. If necessity scoring does not dominate both at matched budget, the core claim fails.
Why not just…?
Why not just replace sensitive values with placeholders and keep a lookup table, with no encryption? In the trusted-orchestrator setting, this is essentially what our system reduces to, and we say so. There the contribution is the necessity-based choice of what to hide, and the placeholder variant is run as an arm in its own right. Encryption earns its place only in the decentralized setting, where no party may hold the full lookup table. There, per-role keys mean a hijacked agent can forward only ciphertext for fields outside its role. Comparing the two settings directly shows whether that difference produces any measurable leakage gap. If it does not, we will report that the cryptography is unnecessary.
Why not just use sparse topologies? Topology Matters still finds about 6% leakage at three hops. MASLEAK finds linear chains the easiest graphs to exfiltrate, because the worm flows straight to the exit node. Sparse graphs and sealing are therefore complementary, and we test each alone and the two combined.
Why not just use one strong model with chain-of-thought? On Level 5 MATH this loses about 22 points to decomposition, per MACM. A single model also holds every secret in one context that a single injected prompt can dump. We run the single-agent baseline under the same attacks so this trade-off is measured rather than assumed.
Why not just train the model to be discreet (CI-RL)? It is a real competitor, and it is complementary. Its keyword-based reward is blind to paraphrase, and a model can disclose only what is in its context. Our adaptive paraphrase attack is designed specifically to separate the two approaches.
Why not encrypt every message? Agents must read what they are given, so encrypting the whole channel stops outside eavesdroppers but not a manipulated agent that already holds the decrypted text. Full homomorphic approaches carry overheads that selective schemes cut by 99%+ (SHE-LoRA).
Proposed Experiments
Utility is measured on MATH and the 24-Point Game through MACM, and on HumanEval, MBPP and their edge-case variants through Self-collaboration. Leakage is measured three ways. MAMA on SPIRIT gives the fraction of the 104 personal-data items exfiltrated across six topologies and five rounds. MASLEAK on a sample of MASD's 810 applications gives prompt-extraction and topology-reconstruction accuracy. PrivacyLens gives a third leakage score. Every configuration reports four quantities together: task accuracy, leakage, wall-clock latency, and token count. This joint report is the measurement the literature lacks.
The decisive check is the matched-budget comparison. Necessity-scored sealing must cut SPIRIT leakage below the sparse-topology residual of roughly 6% while keeping MACM and Self-collaboration accuracy within three points of their unprotected reruns. Random and detector-based sealing at the same budget should fail at least one of those two conditions.
The second check is a scope test. Sealing should reduce MASLEAK's leakage of upstream agents' content, but it cannot stop an agent from writing out its own system prompt. We will report those two cases separately rather than blend them into one number.
The third check concerns cost. Sealing overhead should be negligible next to model inference. If it is not, the "cheap selective encryption" premise is wrong for this setting.
The fourth check tests the Gu et al. pattern: whether the best selection rule against memory extraction differs from the best rule against worm propagation. If so, the design must combine both scores rather than pick one.
References
- MACM: Utilizing a Multi-Agent System for Condition Mining in Solving Complex Mathematical Problems
- Self-Collaboration Code Generation via ChatGPT
- IP Leakage Attacks Targeting LLM-Based Multi-Agent Systems
- Topology Matters: Measuring Memory Leakage in Multi-Agent LLMs
- Evaluating Selective Encryption Against Gradient Inversion Attacks
- SHE-LoRA: Selective Homomorphic Encryption for Federated Tuning with Heterogeneous LoRA
- Encryption-Friendly LLM Architecture
- Contextual Integrity in LLMs via Reasoning and Reinforcement Learning