Sadly Not, Havoc Dinosaur

Translate Legalese

An AI tool for rewriting texts in plain language

Headshot of the author, Colarusso. David Colaursso

This is the 29th post in my series 50 Days of LIT Prompts.

Instead of feeding 5 words to a large language model (LLM) and expecting 500 (e.g., write me an essay discussing the lessons of the French Revolution), more folks should be feeding their AIs 500 words and asking them to generate 5. This funneling approach tends to mitigate hallucinations and the biases that creepin when LLM's free associate. If you're feeding in more than you expect to get out, you're looking through the wrong end of the telescope. Consequently, we've created a good number of templates that work with summarization and entity extraction. Restructuring existing text is one of the things LLMs excel at. So, today we'll ask our prompt to help turn complicated texts into plain language.

This is actually a use case I have some experience with as my lab has experimented with getting LLMs to make such rewrites when summarizing court forms. Generally speaking, LLMs do a pretty good job of making legalese into something more people could understand. That being said, a word of caution. I don't actually think these tools are at the stage where they can be trusted to rewrite complex text in plain language absent human supervision.

There's a quote I've included alongside every prompt pattern from the statistician George Box, "[A]ll models are wrong, but some are useful." It reminds us not to confuse the map for the teritory. Remember, maps are models and they are to some extent wrong. They don't show everything, but they can be useful. I tend to draw two actionable insights from the Box quote. "Because models are wrong, their output should start, not end, discussion. To determine if a model is useful, one must ask 'compared to what?'" So, the plain language write up produced by these tools should start the discussion. It's a first draft, and I think it could be helpful esp. when you consider the alternative is rewriting the text from scratch. In the hands of someone who can properly evaluate and edit the output before sharing widely, it's a great first step, but don't fall alseep at the wheel.

Let's see what today's template can do. Here's the current OpenAI Business Terms (the terms governing their API).

Here's what I see when I run the above through the tools at WordCounter: 4,646 words; Reading level: college graduate; Reading time: 17 minutes.

And here's the output from today's prompt with the above as input.

Here's what I see when I run the above through the tools at WordCounter: 1,138 words; Reading level: 9th-10th grade; Reading time: 4 minutes.

I'm particularly tickled by the rewritten Force Majeure:

Stuff happens: If something totally outside our control happens and we can't do what we promised, we won't be in trouble for it."

That being said...

Let's build something!

We'll do our building in the LIT Prompts extension. If you aren't familiar with the LIT Prompts extension, don't worry. We'll walk you through setting things up before we start building. If you have used the LIT Prompts extension before, skip to The Prompt Pattern (Template).

Up Next

Questions or comments? I'm on Mastodon @Colarusso@mastodon.social


Setup LIT Prompts

7 min intro video

LIT Prompts is a browser extension built at Suffolk University Law School's Legal Innovation and Technology Lab to help folks explore the use of Large Language Models (LLMs) and prompt engineering. LLMs are sentence completion machines, and prompts are the text upon which they build. Feed an LLM a prompt, and it will return a plausible-sounding follow-up (e.g., "Four score and seven..." might return "years ago our fathers brought forth..."). LIT Prompts lets users create and save prompt templates based on data from an active browser window (e.g., selected text or the whole text of a webpage) along with text from a user. Below we'll walk through a specific example.

To get started, follow the first four minutes of the intro video or the steps outlined below. Note: The video only shows Firefox, but once you've installed the extension, the steps are the same.

Install the extension

Follow the links for your browser.

  • Firefox: (1) visit the extension's add-ons page; (2) click "Add to Firefox;" and (3) grant permissions.
  • Chrome: (1) visit the extension's web store page; (2) click "Add to Chrome;" and (3) review permissions / "Add extension."

If you don't have Firefox, you can download it here. Would you rather use Chrome? Download it here.

Point it at an API

Here we'll walk through how to use an LLM provided by OpenAI, but you don't have to use their offering. If you're interested in alternatives, you can find them here. You can even run your LLM locally, avoiding the need to share your prompts with a third-party. If you need an OpenAI account, you can create one here. Note: when you create a new OpenAI account you are given a limited amount of free API credits. If you created an account some time ago, however, these may have expired. If your credits have expired, you will need to enter a billing method before you can use the API. You can check the state of any credits here.

Login to OpenAI, and navigate to the API documentation.

Once you are looking at the API docs, follow the steps outlined in the image above. That is:

  1. Select "API keys" from the left menu
  2. Click "+ Create new secret key"

On LIT Prompt's Templates & Settings screen, set your API Base to https://api.openai.com/v1/chat/completions and your API Key equal to the value you got above after clicking "+ Create new secret key". You get there by clicking the Templates & Settings button in the extension's popup:

  1. open the extension
  2. click on Templates & Settings
  3. enter the API Base and Key (under the section OpenAI-Compatible API Integration)

Once those two bits of information (the API Base and Key) are in place, you're good to go. Now you can edit, create, and run prompt templates. Just open the LIT Prompts extension, and click one of the options. I suggest, however, that you read through the Templates and Settings screen to get oriented. You might even try out a few of the preloaded prompt templates. This will let you jump right in and get your hands dirty in the next section.

If you receive an error when trying to run a template after entering your Base and Key, and you are using OpenAI, make sure to check the state of any credits here. If you don't have any credits, you will need a billing method on file.

If you found this hard to follow, consider following along with the first four minutes of the video above. It covers the same content. It focuses on Firefox, but once you've installed the extension, the steps are the same.


The Prompt Patterns (Templates)

When crafting a LIT Prompts template, we use a mix of plain language and variable placeholders. Specifically, you can use double curly brackets to encase predefined variables. If the text between the brackets matches one of our predefined variable names, that section of text will be replaced with the variable's value. Today we'll be using {{highlighted}}. See the extension's documentation.

The {{highlighted}} variable contains any text you have highlighted/selected in the active browser tab when you open the extension. To use this template, select the text you wish to decomplexify and run the template. Note: we've set the Post-run Behavior to CHAT so you can reshape or question the text after it provides your rewrite.

Here's the template's title.

Translate into plain language

Here's the template's text.

You're a helpful editor. Here is some text I'd like you to rewrite:

{{highlighted}}

Now rewrite the above text in plain language. That is, make sure it us using active voice and that it reads at a sixth-grade reading level. Replace any jargon with cogent and concise explanations. 

And here are the template's parameters:

Working with the above template

To work with the above template, you could copy it and its parameters into LIT Prompts one by one, or you could download a single prompts file and upload it from the extension's Templates & Settings screen. This will replace your existing prompts.

You can download a prompts file (the above template and its parameters) suitable for upload by clicking this button:


Kick the Tires

It's one thing to read about something and another to put what you've learned into practice. Let's see how this template performs.


TL;DR References

ICYMI, here are blubs for a selection of works I linked to in this post. If you didn't click through above, you might want to give them a look now.