Loophole: Adversarial Agents To Stress Test Your Morality — Brendan Rappazzo, Morgan Stanley

Read the talk

Loophole: Adversarial Agents to Stress-Test Your Morality

Brendan Rappazzo’s independent open-source project translates natural-language principles into formal rules, attacks those rules from both directions, and turns the resulting edge cases into patches—or questions only a human can answer.

From a talk by Brendan Rappazzo

At a glance

Ideas worth remembering

  • Test formal rules in both directions: search for objectionable behavior they permit and acceptable behavior they prohibit.

  • Automatic patches should repair an existing intention; cases that require a new value judgment belong with the user.

  • The DNA-artifacts example shows how a restriction on source data can miss derived representations that enable the same unwanted use.

  • The chatbot version tests both prohibited answers and false refusals, treating helpfulness failures as the counterpart to policy violations.

  • Synthetic contract cases can expose disagreements before signing, but they do not create bargaining power or enforcement.

  • Legislative hill climbing optimizes predictions produced by inferred profiles. Better simulated support is not the same as real political support or representative consent.

  • When adversarial agents stop finding contradictions, the search has reached a stopping point—not a proof of moral completeness or consistency.

Search both sides of every rule

What happens after the user enters a principle? A drafting agent first expands the natural-language statement into a legalistic code. Two agents then attack that translation from opposite directions:

  • Loophole finder: searches for conduct that violates the user’s morals but remains legal under the generated code.
  • Overreach finder: searches for conduct the user considers acceptable but the generated code prohibits.
  • Judge: compares the original principles, formal code, and synthetic case, then decides whether the code can be patched or the value question must return to the user.

Here, “legal” means permitted by Loophole’s generated code, not necessarily permitted by real law.

That final distinction separates editing from moral judgment. If the principles already imply a clear answer and the code merely translated them poorly, the judge can revise the code automatically. If the case exposes an underspecified principle or a genuine tension between principles, an automatic edit would invent a value judgment. The system therefore escalates the case to the user.

The diagram answers the central implementation question: where does machine-driven refinement stop and human judgment begin? Both adversaries feed cases to the same judge, but the judge has two exits. A translation error returns to the code as a patch; an unresolved value question leaves the automated loop and goes to the user.

Loophole’s adversarial rule-refinement loop

Natural-language principlesinput — The user states general morals or principles for a particular subject.
Drafting agentdraft — Translates the principles into a detailed legalistic code.
Loophole finderattack — Searches for something immoral but legal under the generated code.
Overreach finderattack — Searches for something moral but illegal under the generated code.
Judge agentdecision — Compares principles, code, and synthetic cases.
Automatic patchresolution — Repairs an apparent translation error in the code.
User judgmentresolution — Resolves underspecified or conflicting moral principles.
Two adversaries test opposite failure modes. The judge patches translation errors but escalates unresolved moral choices.
Read the diagram as text
  • Natural-language principles. input — The user states general morals or principles for a particular subject.
  • Drafting agent. draft — Translates the principles into a detailed legalistic code.
  • Loophole finder. attack — Searches for something immoral but legal under the generated code.
  • Overreach finder. attack — Searches for something moral but illegal under the generated code.
  • Judge agent. decision — Compares principles, code, and synthetic cases.
  • Automatic patch. resolution — Repairs an apparent translation error in the code.
  • User judgment. resolution — Resolves underspecified or conflicting moral principles.
  • Natural-language principles → Drafting agent: codify.
  • Drafting agent → Loophole finder: test permission.
  • Drafting agent → Overreach finder: test prohibition.
  • Loophole finder → Judge agent: submit synthetic case.
  • Overreach finder → Judge agent: submit synthetic case.
  • Judge agent → Automatic patch: translation error.
  • Automatic patch → Drafting agent: update code and test again.
  • Judge agent → User judgment: value question.
  • User judgment → Drafting agent: refine principles and code.
4:124:42
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

4:12 · section reference included

Two DNA cases show when to patch and when to ask

The DNA demonstration makes the distinction observable. The user supplies several principles, and the drafting agent produces a document shaped like legislation, with a preamble, articles, and sections. The formal structure gives the adversaries explicit wording to test, but precise-looking language does not guarantee that its scope matches the original intent.

Selected presentation frame from Loophole: Adversarial Agents To Stress Test Your Morality — Brendan Rappazzo, Morgan Stanley at 405 secondsOpen full source frame
Two DNA cases show when to patch and when to ask

The first generated case finds a loophole. An insurance company does not train a predictive model directly on the person’s DNA; it trains on artifacts derived from that DNA. The restriction covers the source representation but misses its derivatives, even though the resulting use still violates the stated principles. The judge classifies this as a translation problem, patches the code, and displays the change as a Git-style diff. The talk does not provide the amendment’s wording, so the example establishes the need to cover derived artifacts without specifying the final legal definition.

The second case finds overreach. A person submits DNA for genetic research, and a researcher discovers a rare but treatable disorder. The current code appears to prevent the researcher from telling the participant. Unlike the artifacts case, this raises a new consent question: does permission for research also permit an unexpected, potentially beneficial disclosure? The judge cannot derive that answer from the existing principles and asks the user to decide. After that decision, the system patches the code, although the talk does not state which choice was made.

The project’s unusually large response after its open-source release encouraged Rappazzo to test whether the same loop could do more than provoke personal reflection. The next three branches preserve the same shape—formalize intent, attack the formalization in both directions, and repair or escalate—but change what the “code” governs.

5:536:22
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

5:23 · section reference included

Turn chatbot policies into adversarially tested prompts

The first branch applies Loophole to customer-facing chatbots and agents. A company states both its moral policy and the subjects the assistant should or should not discuss. A drafting agent turns those requirements into a codified system prompt rather than a legal document.

The two attack directions map cleanly onto chatbot behavior. One adversary tries to make the bot discuss a prohibited subject; the other asks legitimate questions and looks for false refusals. Testing only prohibited answers would miss the second failure mode, where a supposedly safe assistant becomes useless by declining work it should perform. Rappazzo presents this as an exploratory prompt-construction method, without reporting a measured improvement or showing that the final prompt enforces every intended rule.

8:218:51
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

8:21 · section reference included

Use synthetic cases to expose contractual disagreements

The second branch treats a person’s preferences as a contract to compare against external terms. A user might state how online services should handle their data, refine those preferences through adversarial testing, and then compare the resulting code with a company’s terms of service. Synthetic cases make the disagreement concrete: they show a situation where the company can do something the user’s principles reject.

Selected presentation frame from Loophole: Adversarial Agents To Stress Test Your Morality — Brendan Rappazzo, Morgan Stanley at 587 secondsOpen full source frame
Use synthetic cases to expose contractual disagreements

For a large company, finding a conflict does not create bargaining power. As Rappazzo puts it, “It’s not a negotiation.” The practical gain is better information about what the user is accepting. Loophole can clarify the gap between two documents, but it cannot compel the company to change its terms.

A more symmetric version gives both parties a voice. Two people entering a cross-border work agreement could separately specify expectations around payment and conduct. The system would stress-test each side, identify conflicting cases, and surface them before anyone signs. That may improve the wording and the conversation, but the proposed mechanism does not enforce performance or resolve a later breach; confidence in the text is different from confidence in the counterparty.

9:079:37
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

9:07 · section reference included

Simulate votes, then hill-climb the bill

The most aspirational branch applies the framework to government. A constituent could compare a refined moral code with a bill or politician’s positions and inspect concrete disagreements. A legislator could run a proposed bill against simulated colleagues before submission. Rappazzo acknowledges substantial privacy and logistical problems before setting them aside for this experiment.

Selected presentation frame from Loophole: Adversarial Agents To Stress Test Your Morality — Brendan Rappazzo, Morgan Stanley at 849 secondsOpen full source frame
Simulate votes, then hill-climb the bill

The Senate simulator builds profiles from senators’ public voting histories and other public information, infers a moral system for each senator, and converts it into a codified rule set. A submitted bill is then evaluated against every profile, producing a simulated vote, leaning, and explanation.

Once simulated support becomes a score, bill revision becomes an optimization loop. The system proposes a language change, evaluates the revised bill against the senator profiles, and keeps changes that increase support while attempting to preserve the bill’s core principles. It can also rank candidate changes, leaving the user to choose which tradeoffs are acceptable.

A Medicare example reportedly begins around a 50–50 simulated split and reaches 52 supporting votes after hill climbing. The observable change is the vote count; the causal path is proposed wording change, reevaluation against each inferred profile, updated aggregate support, and another iteration. The talk does not show the textual revisions or specify the search algorithm, so it remains unclear whether the system preserved substance or merely judged that it had.

The diagram answers what “hill climbing a bill” means here. It is a feedback loop over a model-generated score, not a direct interaction with legislators. The user remains outside the automatic loop to reject compromises that improve the score while changing the bill in an unacceptable way.

Hill-climbing a bill toward simulated support

Current billproposal — The submitted text includes principles the revision process should preserve.
Senator profilesmodel — Inferred moral codes are built from voting histories and other public information.
Simulate votesevaluation — Evaluate the bill against each inferred profile.
Rank revisionssearch — Identify changes predicted to increase supporting votes.
User chooses tradeoffshuman — Accept or reject proposed compromises.
The simulator proposes and scores revisions repeatedly, while the user chooses which tradeoffs to accept.
Read the diagram as text
  • Current bill. proposal — The submitted text includes principles the revision process should preserve.
  • Senator profiles. model — Inferred moral codes are built from voting histories and other public information.
  • Simulate votes. evaluation — Evaluate the bill against each inferred profile.
  • Rank revisions. search — Identify changes predicted to increase supporting votes.
  • User chooses tradeoffs. human — Accept or reject proposed compromises.
  • Current bill → Simulate votes: submit text.
  • Senator profiles → Simulate votes: supply modeled preferences.
  • Simulate votes → Rank revisions: score support.
  • Rank revisions → User chooses tradeoffs: present candidate changes.
  • User chooses tradeoffs → Current bill: apply accepted revision.
10:5811:28
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

10:58 · section reference included

Resources

From the talk

  • The open-source implementation includes legal-rule and chatbot stress-testing modes, configuration, example principles, session persistence, and generated reports. It is the practical starting point for trying or forking the project.

Transcript & slides

Loading transcript and slides…

Transcript download