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

AI Engineer · 17 min · 124 sentences · from YouTube's caption track

Each timecode opens YouTube at the start of that sentence. Line anchors (#s42) are the cue ids in the WebVTT, and every line carries its start and end seconds. All transcripts has every talk, and the whole corpus as one file.

  1. 00:12I'll be talking about my project loophole.
  2. 00:15And I'm actually a machine learning researcher at Morgan Stanley, but this has nothing to do with Morgan Stanley.
  3. 00:20This is just a open-source project I've been building for fun.
  4. 00:25And to give sort of the high level flavor to start, it's really this uh game you can play that's built on top of this adversarial agent framework.
  5. 00:34So you specify your morals, one agent codifies that into a legal system and then these two adversarial agents try to find contradictions in your morals.
  6. 00:44And lately I've been building different extensions on top.
  7. 00:48Um, but I wanted to, you know, start with sort of the origin story and and how I came up with this this idea.
  8. 00:55And so this really started, you know, a long time ago, I had sent my DNA into 23 and me for uh ancestry testing.
  9. 01:04Um, and I kept hearing about, you know, more recently how DNA samples can be used, of course, to help solve crimes and all these forensics and cold cases.
  10. 01:15And I was thinking about how I had sort of opted out of of everything because, you know, I was scared of the kind of slippery slope and and how my DNA would be used.
  11. 01:24Um, but you know, there there are certain cases that I would be okay with.
  12. 01:30And it's sort of interesting.
  13. 01:31I was thinking like, you know, if someone could present to me case by case, you know, we'll use your DNA to solve, you know, help solve this cold case or this murder.
  14. 01:40I could sort of say yes or no. and I know where the the definition of like the and the nuance of my morals are.
  15. 01:47Um, and but you know, of course, like enumerating all of this case by case is really sort of cognitively prohibitive.
  16. 01:56Like there's not a good way to do this currently.
  17. 02:00And then I was thinking sort of more zoomed out that there's a lot of analogies to sort of the legal system as a whole.
  18. 02:06So, you know, one way to think of what a legal system is in our society is really just a way that we are trying to c codify our own moral beliefs.
  19. 02:15And I think sort of in a similar way like finding the true nuance of our morals and what the law should be as this really hard translation task.
  20. 02:24And I think often we kind of heir on the side of being too general because you know finding that nuance is really difficult and if you try to have a perfect translation it can we lead to these kind of weird corner cases or or weird failure modes
  21. 02:40and I even think kind of like peer-to-peer when we're relating to each other politically a lot of times the disagreements are more kind of fighting over core values which we don't really disagree on um instead of exploring the really nuanced
  22. 02:54points of our our morals and I think you know following that kind of broader legal example I think in the you know the English common law system that's why we sort of lean on case law so heavily because we know that
  23. 03:10finding this this nuance and these nuance boundaries is difficult and so we kind of rely on smart judging to interpret and apply the law um correctly and you know of course even with like the Supreme Court things can get elevated
  24. 03:24and we can decide whether a law is valid at all.
  25. 03:27Um and so that was sort of you know the idea is like can you take your morals and can you do this kind of synthetic case law generation.
  26. 03:37So you know um this is overwhelming to do by hand but it seems like the new generation of LLMs are finally sort of smart enough to do this kind of highle moral reasoning
  27. 03:48and so that was sort of the the the starting point for this game.
  28. 03:52Um, and I just want to take you through sort of the initial release of the game, the setup, how it works, and then also talk about some of the different branches I've been building on top of this open source project because I think it could go in some interesting directions.
  29. 04:07And so at a high level, how the game works is you in natural language and this all happens.
  30. 04:13It's sort of like a terminal based game.
  31. 04:15You specify your morals and it could be uh your general morals or maybe about a specific subject and then there's one agent that takes those morals and drafts sort of a really rich
  32. 04:27legally codified legal system and then it just operates in this loop where one agent is instructed to try and find loopholes in your system.
  33. 04:36So something that is uh immoral but legal and another is uh prompted to find overreach.
  34. 04:43So things that are actually moral but illegal given your system.
  35. 04:47And a judging agent looks at the your morals the produced legal code and these sort of synthetic case law examples and first sees can it auto patch.
  36. 04:57So, like maybe the original draft of your your legal code sort of was an imperfect translation and there's not really a contradiction and it can just sort of autodo this update.
  37. 05:09Or maybe it's really kind of an underspecification of your morals um or some kind of contradiction in your morals and in that case it raises it to you as the user to sort of be the judge and make a determination.
  38. 05:23Uh
  39. 05:24is it still on for you?
  40. 05:25It disappeared for me.
  41. 05:47Okay.
  42. 05:48Um, so I know that, you know, if you I hope if you're curious about the game, you'll play it.
  43. 05:53It's all on GitHub.
  44. 05:54But I just wanted to show some examples.
  45. 05:56And this is a lot of text.
  46. 05:57So it's more about just showing the kind of shape of the the input and output.
  47. 06:01So this is sort of how you would provide your input.
  48. 06:03And going back to the DNA example, you might you know specify some number of of moral principles.
  49. 06:11And then the sort of codified legal system again just kind of looking at the shape has this really like legal ease, you know, preamble articles uh sections really trying to be uh you know write it in precise legal language.
  50. 06:25And then these the different kind of synthetic case laws get suggested.
  51. 06:29So in this case it's talking about this is a loophole it found where an insurance company um trained a predicted machine learning model not on your DNA but on artifacts of the DNA.
  52. 06:41And so it's saying you know this is actually immoral but currently legal given your system.
  53. 06:46And in this case, it's it found that it could do sort of this auto patching and then you get this sort of like get style difference of of your original legal system and then the the difference it had to make to ensure
  54. 06:59you know this was consistent with your morals.
  55. 07:02And then this is a an example of overreach and in this case it found that it couldn't do the auto patch.
  56. 07:07It's talking about, you know, someone submits their DNA for uh genetic research, but the researcher finds they have a rare but treatable genetic disorder.
  57. 07:17Uh but currently your morals kind of say this shouldn't be allowed that they could disclose this disease to the the person submitting.
  58. 07:25And so this was raised to the user to me to kind of make a judgment.
  59. 07:28And then similarly, when you make the judgment, you get this this patch legal system.
  60. 07:34And so, you know, it's just sort of a a fun game and I posted on Twitter and shared it open source on GitHub.
  61. 07:41And for me at least, it was by far the most viral post I've had.
  62. 07:46And it sort of made me think like I think a lot of people just said it was sort of fun.
  63. 07:50You could stress test your morals, see if you have any interesting contradictions.
  64. 07:54But it also made me think, you know, is there maybe something more here?
  65. 07:58like could this be um you know have more like practical or bigger scope implications and so I'll just talk about three different branches I'm kind of exploring um the first and sort of leave leaving the legal
  66. 08:12area and really more practical is thinking about sort of an auto way to make constitutions for chat bots or really you know for agents in general where you know say you're a company and you want to have a
  67. 08:26um agent or chatbot that's customerf facing and you want it to sort of adhere to a moral code but also have things it will and will not talk about.
  68. 08:35Um I've kind of in one branch formulated it so you in a similar way write your morals.
  69. 08:42You write what the chatbot should and not talk about and then it tries to write this codified system prompt and then you have these kind of adversarial agents trying to get it to
  70. 08:52either talk about something it shouldn't or refuse to talk about something it should.
  71. 08:56And I see it as this sort of analogy or analogous method to GEA um but really aimed at kind of building these codified system prompts.
  72. 09:07The uh second use case that I'm I'm particularly interested in is thinking of it as a way to sort of do more ad hoc or decentralized contracts.
  73. 09:17So I think in in a simple case say like you can specify how you want your data or privacy to be handled online and you can go through this sort of adversarial
  74. 09:28game to get this codified legal system of how you want your your data handled and if you go to you know say Apple releases a new terms of service or something
  75. 09:38you can run the um contradictions between your legal system and between Apple's terms of service and like surface any interesting contradictions or like synthetic cases where this would lead to
  76. 09:52a difference between how you know your morals, what you want and what the company is doing.
  77. 09:57And you know in the case that it's a big company, maybe you can't really change anything.
  78. 10:01It's not a negotiation, but you can at least be sort of have better information about the contract you're signing.
  79. 10:09But I also think in the case of you know thinking more decentralized like if you're trying to have contracts without you know some central authority kind of enforcing them and you're trying to maybe do contracts across
  80. 10:22different countries.
  81. 10:24Um, thinking about like if you can specify your morals and how you want to like interface, you know, maybe it's just like contracted work, how you want your work to be paid for and and and
  82. 10:36the different morals surrounding that.
  83. 10:38And the other party can do the same.
  84. 10:41And then you both get this kind of stress tested codified contract.
  85. 10:45And then you can kind of find the the disagreements if there are any and surface them before you agree.
  86. 10:51And then you can kind of be more confident in the the contract as a whole.
  87. 10:58And the last thing and maybe the kind of more aspirational angle is thinking about smarter government or more efficient government.
  88. 11:07Um I think there would be a lot of different privacy issues and logistical issues but sort of ignoring those for now and just thinking big picture.
  89. 11:15I think for voters or constituents, you know, this could be a really interesting way if you you defined your morals, you have this stress- tested legal code, sort of any new bill or politician that comes out, you could kind of run
  90. 11:30your contract against theirs and surface, you know, what are the the cases you would disagree or or interesting uh points that are kind of immoral to you or or a contradiction.
  91. 11:42Um, I also think, you know, relating to one another, it's like a more I think we all have a lot of nuance in the way we feel about things and this is a way to kind of
  92. 11:54get to that nuance instead of arguing over just values which is, you know, often the values are not in contradiction.
  93. 12:01And then I think maybe a little more practically for legislators, you could imagine um if you want to propose a bill and you can have like a a simulation of
  94. 12:12all the other legislators and a and a legislative body, you could sort of stress test it before submission.
  95. 12:19And so the the third branch I've been building on this project is I I tried to do this for the US Senate.
  96. 12:26And so what I did is I first had Claude go through all current US senators and look at, you know, kind of all their voting history and anything else that was public
  97. 12:36and build their kind of moral system and then ran it through the loophole process to get a codified sort of legal code.
  98. 12:45And then on this system, you can, you know, take any current bill that's being proposed or even propose your own and submit it.
  99. 12:52And you can have Claude sort of simulate how each senator would vote.
  100. 12:57And so here you can see like a breakdown of um some senators, which way they're leaning and sort of their reasoning behind the vote.
  101. 13:06Um and I think you know it's sort of interesting just to think about like seeing what you know a proposed piece of legislation how people would vote but also this sort of becomes and I think on theme of the conference its own verifiable
  102. 13:21domain or loop and you could think about even kind of hill climbing the bill towards um getting like a super majority or whatever you need it to pass.
  103. 13:30And so in this case, like this this Medicare bill I was testing, you know, it found that I think it originally started at like a 5050 vote and it found ways to hill climb
  104. 13:41the language of the bill such that it passed with um 52 votes.
  105. 13:46And I think, you know, this is an example of it can find um like the sort of the core tenants of the bill and it can try to find like
  106. 13:56run the the bill against each senator's contract and find is there any way I can change the language such that I don't violate sort of the core tenants or morals of the bill and kind of do those auto patching that way.
  107. 14:09And then it can also find um you know kind of rank order the changes that would need to be in place to maximize votes and you as a user can kind of choose the trade-offs that way.
  108. 14:23And then the last thing I I've been trying out more recently with this branch is actually looking at, you know, kind of even bigger picture, like can this lead to an even more efficient of government where you have
  109. 14:36every sort of constituent in a in a state or whatever the district is sort of have their legal code and then you could just submit any bill and actually measure
  110. 14:46sort of the agreement between like the the actual voters.
  111. 14:50And so for this, I took the Nvidia has this really great data set of USA personas.
  112. 14:56And so I took 500 personas per state and it's supposed to be sort of well representative of the state's population.
  113. 15:03Did the same process of having them given the persona, draft their morals, draft their sort of legal contract, and then take any bill you're interested in and kind of run it against each state.
  114. 15:14And you can also, you know, measure how much people like this bill or how much it's in agreement with their morals and then also do this hill climbing where you kind of optimize the bill for the people.
  115. 15:27And so just to conclude, you know, at at minimum, I think it's a pretty fun game.
  116. 15:32I'm biased, but it's a lot of fun to just try out different um you know, things you care about, put in your morals, see if there's any contradictions.
  117. 15:40you know, often it will raise some really interesting questions and then once you kind of provide that nuance, the game, you know, the the agents won't be able to find any more contradictions and you can kind of feel good that you have like a a consistent nuanced
  118. 15:55uh moral system.
  119. 15:57Um, but I I am interested in, you know, exploring could this be are there kind of real applications here for some kind of like decentralized or better contracts and maybe even for legislators as a way to sort of
  120. 16:10stress test your bills and even think about how to write um better laws that are, you know, better for the people in your district or more representative of what the people in your district want.
  121. 16:21Um, and so this QR code is to the the Senate simulator.
  122. 16:26So I encourage you if you're interested to play and um the other one is to my website which has the the full GitHub to loophole um and please you know play with it fork it uh I'd love to have
  123. 16:40other contributors.
  124. 16:41Thank you.