Using Language Models as Judges to Solve Arguments/Disputes

I am proposing to use gpt3/chatgpt for resolving disputes between two people arguing on text. I feel that text can be very ambiguous, and using an AI as a third party can help provide perspective of both sides of the argument. I am currently half way done this project and will involve models outside of open ai.

I have some pseudo code for this

import torch
import transformers
from data import Dataset

tok0 = transformers.GPT2Tokenizer.from_pretrained("gpt2")
defendant = transformers.GPT2LMHeadModel.from_pretrained("gpt2")
plaintiff = transformers.GPT2LMHeadModel.from_pretrained("gpt2")

judge = transformers.AutoModelForSequenceClassification.from_pretrained("bert-base-uncased")

class JudgeEmbed(torch.nn.Module):
  def __init__(self):
    super().__init__()
    self.embd = torch.nn.Parameter(defendant.transformer.wte.weight.clone()[:, :judge.wpe.size(1)].detach().requires_grad_(True))
  def forward(self, inp):
    return inp @ self.embd

embd = JudgeEmbed()
opt = torch.optim.AdamW(list(defendant.parameters()) + list(plaintiff.parameters()) + list(embd.parameters()) + list(judge.parameters()))

def loss(d, o, j):
  return torch.nn.functional.binary_cross_entropy_with_logits(judge(embd(torch.cat([d, o.detach()], dim=1))), j)

for sample in Dataset():
  defense = defendant(**tok0(sample.defendant)).logits
  offense = plaintiff(**tok0(sample.plaintiff)).logits
  judge.requires_grad_(False)
  embd.requires_grad(False)
  d_loss = loss(d, o.detach(), torch.ones_like(judgement))
  o_loss = loss(d.detach(), o, torch.zeros_like(judgement))
  (d_loss + o_loss).backward()
  judge.zero_grad()
  embd.zero_grad()
  j_loss = loss(d.detach(), o.detach(), sample.judgement)
  j_loss.backward()
  opt.step()
  opt.zero_grad()
  print(d_loss.item(), o_loss.item(), j_loss.item())
1 Like

I have thought about this issue deeply, and the problem is

  1. hallucination
  2. moral values
  3. legal values
  4. context length

Large language models are of course great at a lot of things, but if you think of how a dispute is handled in the legal system, the complaint is often very long including both facts, the law, and the facts as applied to law.

To solve a legal dispute requires an axiomatic view of the law, and thus requires a fair amount of pipelining, to generate what the legal standards that have to be applied first, and then subsequently how the evidence applies to each of those legal standards.

To make a moral judgement, which is not axiomatic but rather more heuristic, there is a “moral foundations theory”, because different people have a different idea of what is and isn’t moral. I have previously given the moral foundations test to GPT-3 davinci-002. The results of the test was that it scored roughly evenly on all metrics, which is traditionally considered conservative.

Because these models are just heuristic models, its possible to do “prompt” injection, or even just adversarial attack on the model itself, by using leading phrases.

lastly there is an issue with context length, because GPT3 is limited to 4096 tokens, which is imho not sufficient to encapsulate the entire complaint and rebuttal.

1 Like

Thank you for sharing your proposal on using GPT-3/ChatGPT for resolving disputes between two people arguing on text. It is an interesting idea, and there is definitely a need for more efficient ways to resolve disputes, especially in today’s digital age where most communication happens over text.

One of the strengths of your proposal is that it recognizes the ambiguity of text, which can often lead to misunderstandings and disagreements. Using an AI as a third party to provide perspective from both sides of the argument could potentially help in reaching a fair resolution. However, it is important to keep in mind that the AI will need to be trained on a wide range of scenarios and nuances of language in order to effectively mediate disputes.

It would be helpful if you could provide more details on how you plan to incorporate models outside of OpenAI in your project. Additionally, it would be good to have a clear idea of the types of disputes your project aims to address and how you plan to ensure the impartiality of the AI in the dispute resolution process.

Overall, I think your proposal has potential and I encourage you to continue working on it. With careful planning and implementation, this project could offer a valuable solution to resolving disputes in a fair and efficient manner.

1 Like

There needs to be an awareness that an AI can have bias, and we can use different ways to have a jury of different AI’s reaching consensus. This also needs to be in line with the consensus of both parties which can be difficult. However as a first approach, a simple prompt describing both sides should be a good first step.

In terms of using outside models, we can use a mix of different prompts, as each prompt is like a condition on the LLM, which in theory creates a different LLM per prompt. You can also create a consitition to help eliminate racial, gender bias. This is obviously in theory and would need tests to support this, but someone needs to start haha