How to automate contract redlining with AI

Kai Henthorn-Iwane

Kai Henthorn-Iwane

@KaiHenthorn
How to automate contract redlining with AI

Contract redlining is the process of reviewing and editing a contract by marking up changes. It is essential in every industry and business.

However, it’s time-consuming and prone to errors, given the length of contracts.

LLMs are extremely good at reading documents and highlighting certain elements based on criteria. This is why companies around the globe are automating this process.

Here is a guide on how to easily deploy an assistant that redlines your contracts with Stack AI.

High-Level Design

Contract
Redlining

Use Case Architecture

The process starts with analyzing a contract. First, you need to provide the document through a user interface and send it to the model.

Additionally, you want to provide instructions to the AI model for specific contracts. You would also want the model to know best practices, that could be stored in a knowledge base such as SharePoint.

An LLM receives all this information and redlines the contract, with citations included.

Let's deep dive into the implementation in Stack AI.

Implementing the Logic

Contract
Redlining

Stack AI Architecture

Step 1: Focus on the inputs to the model. Go to the Data Loaders section and drag and drop a Documents node. Toggle the ‘Expose as input’ to make it available in your UI.

Contract
Redlining

Inputs setup

Add an Input node from the Inputs section and a knowledge base. Use Documents + Search to upload documents, or connect to SharePoint, OneDrive, Google Drive, etc. Set it up with your credentials and start using your folders/documents.

The input on top of the knowledge base means a query extracts relevant information based on the input.

In our case, we use a summarizer node to summarize the contract, then query the knowledge base, sending only relevant sections to the LLM. This improves the model’s accuracy, respects its context window limitations, and reduces hallucinations.

Contract
Redlining

LLM setup

Step 2: Select the LLM of your choice. We use an OpenAI model hosted in an Azure tenant for increased performance and security, avoiding global traffic on OpenAI servers.

You should include the rules you would follow if redlining the contract yourself. The more specific, the better the results.

See below the prompt instructions of an AI system in production:

Instructions:

You are an AI contract redlining assistant.
1) Be brief.
2) Be polite.
3) Be professional.

Prompt:

Instructions from the user:

<instructions>
{in-0}
</instructions>

Contract document to review:

<contract>{doc - 0}</contract>

Context on how to redline a contract:

<guidance>{docemb - 0}</guidance>

As an AI assistant specializing in contract redlining, your task is to thoroughly review the provided contract text. Follow these steps:
- Identify Problematic Clauses: Highlight sections that contain legal terms, inconsistencies, or potential risks.
- Recommend Amendments: Suggest specific changes to improve clarity, fairness, and balance in the contract.
- Risk Assessment: Evaluate the potential risks associated with each highlighted clause and assign a risk grade out of 10, where 10 represents the highest risk.

Format of Output:

List of Sections Redlined:
Section [Number/Title]:
Issue Identified: [Brief description of the problem]
Recommended Amendment: [Suggested changes to the clause]
Reason for Change: [Explanation of why the amendment is necessary]
Risk Grade: [Risk grade out of 10]

1. Section 4.2: Payment Terms

   - Issue Identified: Payment due date is vague.
   - Recommended Amendment: Specify payment due date as "30 days from the invoice date."
   - Reason for Change: To avoid ambiguity and ensure timely payment.
   - Risk Grade: 6

2. Section 7.1: Termination Clause
   - Issue Identified: Unilateral termination without cause.
   - Recommended Amendment: Add requirement for a 30-day notice period for termination.
   - Reason for Change: To provide fair notice and prevent abrupt contract termination.
   - Risk Grade: 8

Selecting the Right UI

We’ve seen this use case deployed in different formats with customers. We’ll explore three interfaces:

Contract
Redlining

Chat Assistant: contract review through a conversation with an LLM

1. Chat Assistant: Set up a custom chatGPT if reviewing contracts requires a conversation with the AI model.

Contract
Redlining

Form Interface: fully automate the process

2. Form Interface: Users upload the contract, describe their needs, and click submit to get a fully redlined contract with comments and suggestions. Use this interface if you need a more structured process, where you get the rights outcomes in one go.

Contract
Redlining

Batch Processing Interface: upload multiple contracts

3. Batch Processing Interface: Redline contracts at scale by uploading multiple contracts, providing instructions, and clicking Run.

Contract
Redlining

Security settings

Make your assistant secure by adding a password or enabling SSO.

Results

By using LLMs, you can shorten your contract redlining time by up to 80%, reducing the probability of omitting important clauses or considerations.

With Stack AI, you can build it yourself—no coding or AI experience required—in a few hours. Schedule a demo with us and start getting LLMs working for your business.