How Addleshaw Goddard tuned LLMs for M&A due diligence
Addleshaw Goddard's Innovation Group built a GPT-4 retrieval pipeline to review contracts for M&A due diligence, then tuned its chunking, search and prompts until it outscored a machine learning extraction tool.
Addleshaw GoddardUnited KingdomLegal servicesPilot
- Scenario
- Legal due diligence contract review
- Business function
- Legal and compliance
- Kind of solution
- Document review and drafting
- Who built it
- Built in-house
- Where it runs
- Public cloud
- Organization
- Enterprise, 1,000 to 9,999 employees
- AI types
- Generative AI, Document AI
- Team size
- 80-strong
tl;drTuned retrieval and prompts lifted the F1 score on contract extraction from 74% to 95% in tests.See the results
Addleshaw Goddard’s Innovation Group built a proof of concept that reviews contracts for M&A due diligence with GPT4-32K and a tuned retrieval pipeline13. The UK law firm published the research in October 2024 as The RAG Report1, 2.
The pipeline treats a diligence review as a list of provisions. For each provision, it searches the contract with its own keyword and vector queries and gives the top 10 chunks to GPT4-32K with a prompt written for that provision. It then tells the model that it missed something and asks it to look again13.
On publicly annotated contracts, the tuned pipeline extracted nine provisions with an average F1 score of 95%, which the firm reports as accuracy13, 1. GPT-4 Turbo reading whole contracts scored 74% on the same test. The pipeline also scored above a machine learning extraction tool and a generative AI contract review tool13.
Before the deployment
Addleshaw Goddard (AG) first brought machine learning to due diligence in 201412. In December 2016, after an 18-month pilot of a range of AI systems led by its Transaction Services Team, it signed a long-term deal with Kira Systems7. The deal covered contract and document review for its Corporate, Banking and Real Estate transactional teams7.
The firm picked Kira for the quality of what it extracts and for its Quick Study facility, which let AG build its own legal expertise into the system7. Kira takes a machine learning approach, and AG was still using it in 20246, 10. The team trained a model on a subset of documents, validated and scored it, and then ran the rest of the documents through it13. The process had the following results and limits:
- After multiple projects, AG could save around 50% of the total time spent on a diligence review and cut manual review by approximately 80%13.
- Paralegals or junior associates still checked the output, because the tool could miss a clause or give a yes or no answer from a wrong extraction13.
- The time saved per document didn’t grow when the tool was applied at scale13.
- Before a supervised model can find a new provision, someone has to label examples of it2.
- A generative AI tool that the firm bought for large-scale review had limits in how it presented its outputs and in the scale of review it could manage13.
Due diligence also looked like a poor place to start with large language models (LLMs). The sheer scale of such matters had kept many legal tech experts on older machine learning and natural language processing techniques that were proven to work2. In 2023, AG’s conversations with clients kept returning to how far the models could be trusted, hallucinations included4.
AG’s first generative AI answer was AGPT, a way to test GPT-4 inside the firm’s own secure environment so that colleagues could query and review documents without worrying about their data4. AGPT runs in the firm’s Microsoft Azure environment so that nothing leaves its networks, and it lets users query, review and translate documents3. Its developers used Azure OpenAI services to power it4.
“Our build strategy for Generative AI this year was to learn, by doing this we have enabled people in roles across the firm to learn. It allowed our developers to understand how to take advantage of the Azure OpenAI services to power a platform.”
A chat window over a document doesn’t run a diligence review, which asks the same questions of every contract in a deal. The Innovation Group set out to go beyond what it had built with AGPT and to be more than a simple wrapper for an LLM2.
What was built
The proof of concept finds and extracts provisions: the points that a buyer’s lawyers need answered for every contract in a deal13. It was a first step toward an M&A Transaction Platform that would apply pre-defined due diligence questions to each document type and generate a draft of the diligence report13. The work is divided as follows:
- Lawyers’ knowledge: Each provision gets its own advanced keyword query, vector search query and provision-specific prompt. The queries come from clause banks of hundreds of samples per provision13.
- Search code: Splits each contract into overlapping chunks, picks the top 10 chunks for each provision with a hybrid search, and passes them on in document order13.
- GPT4-32K: Reads only those chunks and extracts the provision verbatim, citing the clause it comes from. It answers Not found if it can’t identify the provision13.
- Follow-up prompt: Goes back to the model with its first answer and tells it directly that it missed relevant information13.
- Risk identification: A later stage, still under way, questions the extractions with risk query prompts that get to an answer instead of flagging language for a human to check2, 13.
Because the knowledge of what to look for lives in the prompts and queries, adding a provision means drafting new prompts instead of labeling examples2. The firm built the pipeline with a mix of technical and legal expertise, without significant expense and without training specific models1.
Alternatives considered
The team pursued the project itself, instead of partnering with a third party or buying software, to balance flexibility, control, reliability and cost effectiveness13, 2. In December 2024, the firm wrote that off-the-shelf products had struggled with its specific problems, while its own LLM builds had more success with the hard ones5. The team tested or weighed the following alternatives:
- Full In-Context: Feeding the whole contract to the model lost to retrieval-augmented generation (RAG), which gives the model the minimum context it needs. Larger context windows hadn’t brought better performance or reasoning13, 2.
- Other chunk sizes: Chunks of 2,500 and 4,500 characters retrieved worse than chunks of 3,50013.
- Ordering by search score: The team fed chunks in document order instead, because that keeps the agreement’s structure and lines of reasoning and lets consecutive chunks merge13.
- A neutral request to double-check: Brought no noticeable improvement, because the model just repeated its answer. Accusing it of missing information worked best13.
- A detailed system prompt: Too much granularity had a detrimental effect, and instructions there tended to be forgotten. The system prompt stayed short, and the specific instructions moved into each provision prompt13, 2.
- Fine-tuning: The team didn’t fine-tune a model, citing the technical hurdles, costs and time13.
Rollout
AG published The RAG Report as, it believed, the first report of its kind from a law firm1, 2. The firm then looked at how to offer an internally built M&A diligence solution on the same concepts, while its volume document review moved to bought platforms5, 12, 8.
Legora replaced a previous generative AI technology used specifically for volume document reviews12. Harvey goes to AG’s whole workforce of more than 3,400 people from January, after a three-month assessment led by the 80-strong Innovation Group8. Kerry Westland, partner and head of the Innovation Group, said that AGPT would continue but might be used more for testing than as the firm’s main AI system9.
Technology and architecture
The pipeline runs on two OpenAI models. GPT-4-32K-0613, served through the Microsoft Azure OpenAI service, reads and extracts. The embedding model text-embedding-ada-002, the only one used, turns text into vectors for the search13.
GPT4-32K runs at temperature 0, with output capped at 2,000 tokens and a constant seed value13, 2. These settings keep the model close to the document’s text, because the firm wanted verbatim answers without creativity. AGPT, the firm’s chat tool, runs at temperature 0.5 with an 800-token cap13.
The following table lists the parts of the solution.
| Layer | What they used | Role | Source |
|---|---|---|---|
| Language model | GPT4-32K | GPT-4-32K-0613 reads the retrieved chunks and extracts each provision verbatim, at temperature 0 with a constant seed | 13 |
| Embedding and ranking model | text-embedding-ada-002 | Turns chunks and sample-clause queries into vectors | 13 |
| Model hosting | Azure OpenAI Service | Serves the GPT-4 models for the research, chosen so anything built can go into production in the firm’s Microsoft Azure environment | 13 |
| Data preparation | Chunking Strategy 2 | Splits each contract into 3,500-character chunks with 700 characters of overlap either side | 13, 2 |
| Search and vector index | Hybrid keyword and vector search | Runs each provision’s keyword and vector queries and returns the top 10 chunks in document order | 13, 2 |
| Prompt and context management | System prompt and provision-specific prompts | A short persona and task prompt, then per provision a definition, the request and general instructions, with a Not found option | 13 |
| Prompt and context management | Follow Up Prompt | Sent after every first answer; tells the model it has missed relevant information | 13, 1 |
Data inputs
The pipeline uses the following data:
- Contracts under review: Commercial agreements such as services, supply, license and manufacturing contracts, which are the case input13.
- Clause banks: Hundreds of samples per provision, compiled from public and internal data. Each provision’s queries are built from them13.
- CUAD: Publicly available contracts annotated by The Atticus Project. The team tested on them so that it could use non-confidential documents and share results that others can check13.
How one provision flows through the system
The report’s worked example follows the Change of Control provision through the pipeline13:
- Chunking Strategy 2 splits the contract into chunks of 3,500 characters with 700 characters of overlap. The chunks and their vectors go into a vector index13.
- The hybrid search runs the vector query, a full sample change-of-control termination clause. It’s the sample most similar to the others in its clause bank, so the search compares answer with answer instead of question with answer13.
- The hybrid search runs the Advanced Keywords Query, word pairs mined from the clause bank. Chunks where change and control fall within five words of each other get a boost factor of five13.
- The search keeps the top 10 chunks and puts them back in the order that they appear in the contract. Consecutive chunks merge, so that a provision isn’t split13.
- GPT4-32K receives the system prompt, the chunks and the provision prompt. The system prompt sets a UK corporate lawyer’s persona and limits answers to the excerpts supplied13.
- The provision prompt defines change of control provisions and asks for every one verbatim and in its entirety, or Not found. It tells the model to review every excerpt, watch for terms such as merger, transfer and ownership, and cite the clause13.
- A follow-up prompt goes back with the first answer and tells the model that it missed relevant information13.
- In the example, the output is clause 2.4, which lets either party terminate on four weeks’ notice if the other undergoes a change of control13.
Results
The results come from the proof of concept’s tests, published in October 2024, all on CUAD contracts13, 1. The generation tests ran ten configurations and two outside tools over nine provisions in CUAD agreements of 40 to 60 chunks. Retrieval was tested over all 510 CUAD contracts13.
The following table lists the headline results.
| Metric | Before | After | Scope and timeframe | Reported by |
|---|---|---|---|---|
| Average F1 score, provision extraction | 74% (GPT-4 Turbo reading whole contracts, first prompt) | 95% (tuned RAG pipeline with follow-up prompt) | Nine provisions, CUAD agreements of 40 to 60 chunks, research published October 2024 | Addleshaw Goddard, pilot13 |
| Recall@10, optimized retrieval | 73.15% (question-like queries) | 95.36% | CUAD contracts of 20 or more chunks, weighted average | Addleshaw Goddard, pilot13 |
| F1 gain from the follow-up prompt | First answer | 9.2% higher on average, in percentage points | Across all configurations tested | Addleshaw Goddard, pilot13 |
| Average F1 score of the comparison tools | Not applicable | 0.86 (machine learning extraction tool), 0.72 (generative AI contract review tool) | Same generation test | Addleshaw Goddard, pilot13 |
The metrics measure the following:
- Average F1 score: Extraction was scored as classification against CUAD’s labels. An answer counted as a true positive when it returned at least 75% of the annotated provision with no hallucinated or misleading content. F1 balances precision and recall13.
- Accuracy: The firm reports the F1 pair as accuracy1. Measured as accuracy in the strict sense, the same two configurations scored 0.69 and 0.9213.
- Recall@10: Measures whether the chunk that holds an annotated provision came back among the top 10. The optimized retrieval components improved recall by between 14 and 22 points13, 2.
- Comparison tools: The machine learning extraction tool ran with the vendor’s pre-trained models. The generative AI contract review tool ran with AG’s provision prompts and kept rephrasing provisions instead of extracting them verbatim13.
Each component experiment changed one thing and kept the rest fixed. The following table lists the experiments, with F1 gains in percentage points13.
| Experiment | What was measured | Result | What it settled |
|---|---|---|---|
| Whole contract against 20 chunks, GPT-4 Turbo, first prompt | Average F1, nine provisions | 0.74 to 0.80, 6 points | Retrieval over Full In-Context13 |
| 20 chunks against 10, GPT-4 Turbo, follow-up prompt | Average F1 | 0.89 to 0.91, 2 points | Top 10 chunks13 |
| GPT-4 Turbo against GPT4-32K, 10 chunks | Average F1, first prompt and after follow-up | 0.81 to 0.85 and 0.91 to 0.92, 4 and 1 points | GPT4-32K13 |
| Improved prompt: keyword instruction added for the five provisions with recall under 90%, GPT4-32K, 10 chunks | F1 per provision after follow-up, and recall | F1 up 10 points on Cap on Liability and on Exclusivity, 4 on Audit Rights, none down; recall up to 16% on some provisions | The improved provision prompt13 |
The follow-up prompt added more than any other change, which is why it runs on every answer13.
Lessons learned
Retrieval and prompts mattered more than the model. Retrieval that gives the model the minimum context it needs beat feeding in the whole document, and prompt detail helped only up to a point13, 2. Optimization paid off most on variable provisions such as Exclusivity and little on uniform ones such as Governing Law, so the effort might not be needed for every provision13.
The pipeline still missed provisions. Its best configuration had a precision of 1.00 but a recall of 0.90, so it missed about one provision instance in ten13. Averaged across every tool and configuration, Cap on Liability scored an F1 of 0.67, Exclusivity 0.76 and Audit Rights 0.79, and longer provisions more often came back only in part13. The error analysis found the model overlooking straightforward instances, even with a context much shorter than its window13.
The report says the tuned pipeline outperformed the ML tool, but its takeaways call the LLM approach close to or on a par with ML extraction13, 2. Adding provisions on the go is a clear advantage only for bespoke extractions, because most market tools already have many pre-trained concepts2.
Hallucinations didn’t pose a problem in the tests, which the firm put partly down to the strict experiments and task. It still sees a near-zero chance of removing the risk completely13, 6. The scoring also counted a related provision, returned when the target was absent, as a true negative by design, because a later risk stage would filter it13.
Prompts tuned for one model didn’t always carry over. Some prompts that worked on one LLM or product worked less well on others and could clash with the system prompts built into products such as CoCounsel6.
Clients limited where the firm could use AI. In December 2024, AG said that it couldn’t use AI with some clients or on certain data, which it put largely down to a misunderstanding of risks and an overzealous approach to data5.
The figures are AG’s own, from tests of its own pipeline on a public dataset, scored against its own success criteria, and Artificial Lawyer relayed the headline13, 2. The report says that testing on AG’s own data ran alongside, with similar results13. Its text gives the best configuration’s first-prompt F1 as 92%, while its results table gives 0.8813.
Case study scorecard
- 95% average F1 score on provision extraction, which the firm reports as accuracy13, 1, 2
- 95.36% Recall@10 of the optimised retrieval on long contracts13
- 9.2% average F1 improvement from the follow-up prompt, in percentage points13, 1
Sources by publication date
- Organization 7
- Press, academic, and regulators 6
Build this solution yourself
Analysis
What you need
To build this pipeline, you need the following in place:
- Clause banks for each provision: The queries and prompts carry lawyers’ knowledge, built from hundreds of samples per provision from public and internal data13.
- An answer key: Every gain AG reports is a score against CUAD’s annotations. Without a labeled set, you can’t tell whether a change to chunk size or prompts helped13.
- A secure place to run the models: AG picked the Azure OpenAI service so that anything it built could go into production in its own Azure environment13.
- Clients who allow AI on their documents: Some of AG’s clients didn’t, which limited where the firm could use it5.
Reference architecture
Document review and drafting
A document review and drafting solution reads a case's documents against a written standard, precedents, or a list of questions and drafts a review, summary, clause, or report with its sources for an expert to finish. The solution pulls the case's documents, and a language model answers each question from the passages that bear on it, with its source. Fixed logic settles what must not vary, and an expert checks the draft against the sources and makes the decision.
- Source system
- Connector to the source system
- Review and drafting platform
- Text recognition
- Document preparation (documented in this case study)
- Passage index (documented in this case study)
- Access control
- Questions and templates (documented in this case study)
- Drafting model (documented in this case study)
- Private model endpoint (documented in this case study)
- Fixed logic
- Review workbench
- Reviewer feedback
- Tests on known cases
A check mark shows a building block that this case study's sources document.
Open the reference architectureOthers who built it
- Linklaters: Its ReportiQ due diligence platform, built with the US vendor WizDocs and launched out of pilot in 2023, had supported more than €35bn of deals by March 202510.
- A&O Shearman: As Allen & Overy, it rolled out Harvey to more than 3,500 lawyers across 43 offices in February 2023 for work such as contract analysis and due diligence11.
In the library
- How Nationwide uses generative AI to summarize claim notes Nationwide
- Merck drafts clinical study reports in days with gen AI Merck & Co.
- AI drafts clinical study reports in minutes at Novo Nordisk Novo Nordisk
- Corona, California speeds building plan review with AI City of Corona
- Denver pre-screens permit applications with CivCheck AI City and County of Denver
- Court strikes down DOGE's ChatGPT screening of NEH grants United States DOGE Service
Cite this case study
Enterprise AI Case Studies. "How Addleshaw Goddard tuned LLMs for M&A due diligence." Updated Nov 18, 2026. https://case-studies.ai/case-studies/document-intelligence/DI-007-legal-ma-due-diligence/
@misc{csai-di-007,
author = {{Enterprise AI Case Studies}},
title = {{How Addleshaw Goddard tuned LLMs for M&A due diligence}},
year = {2026},
note = {Updated 2026-11-18},
url = {https://case-studies.ai/case-studies/document-intelligence/DI-007-legal-ma-due-diligence/}
}Sources
The following reporting, and every passage quoted from it, belongs to its publisher, not to this site. Sources and ownership
- Source 1:
Harnessing the power of Large Language Models for legal document review
Supporting excerpts (12)
The RAG Report: Can Large Language Models be good enough for legal due diligence?
sets out the work carried out by our Innovation Group to develop and test a robust method of using Large Language Models to review documents in the context of an M&A transaction legal due diligence project.
Our research includes learnings from developing AGPT, Addleshaw Goddard's internal LLM based solution for chat and document review, the steps being taken to develop an M&A transaction specific platform and the optimisation process taken to get our RAG solution from a performance of 74% accuracy to upwards of 95%.
Through optimised retrieval techniques and improved prompting approaches, we can increase the accuracy of LLMs in commercial contract reviews from 74% to 95%, on average.
By employing an optimised retrieval approach we can improve the identification of provisions by an average of ~20%.
Including language instructing LLMs to pay attention to specific keywords improved recall accuracy by ~16%.
Use of a Follow Up Prompt gives an average accuracy improvement of 9.2% across all configurations.
without significant expense, we have been able to develop a sophisticated platform without reliance on largescale data gathering or structuring up front and without training specific models.
which we believe is the first of its kind from a law firm
Following months of research into the validity of Large Language Models and a Retrieval Augmented Generation approach to legal
With a mixture of expertise in the technical and legal aspects, and without significant expense
complete the form below to access a copy of the report
- Source 2:
AG Proves LLMs Can Do Well On Due Diligence
Supporting excerpts (33)
UK-based law firm, Addleshaw Goddard (AG), has tackled the challenge of using generative AI for large-scale tasks such as due diligence
Due to issues related to the sheer scale of such matters many legal tech experts have tended to rely on older ML/NLP techniques that are proven to work.
they used different LLM models and different approaches to 'chunking' i.e. taking limited blocks of text from documents to ensure better accuracy
Our testing has shown that, through optimised retrieval techniques and improved prompting approaches, we can increase the accuracy of LLMs in commercial contract reviews from 74% to 95%, on average.
We pursued this project ourselves in order to find a solution that balances flexibility, control, reliability and cost effectiveness.
The development of our PoC and the findings along the way is a significant milestone on this journey.
Combining a good Chunking Strategy with other retrieval components resulted in a clear accuracy improvement of between 14% and 22%.
We discovered that giving LLMs a more detailed and bespoke message does improve the quality of its responses, but being too granular did have a detrimental effect.
asking a model to pay extra attention and accusing it of missing relevant information both led to higher accuracy
with improvements of up to 16% in our experiments.
A RAG approach has major advantages over a Full In-Context configuration as you can accurately feed the LLM with the minimum amount of context needed.
chunks 3,500 characters long, with an overlap of 700 characters either side
Implementing a customised hybrid Retrieval Method combining both advanced keywords search and vector search.
Creating an optimised Advanced Keywords Query and Vector Search Query for each Provision.
Retrieving the Top 10 Chunks and feeding them back to an LLM in the order they appeared in the document.
Using GPT4-32K as the LLM for the task.
Setting the LLM Parameters as temperature 0, maximum tokens to 2,000, and a constant 'seed' value.
Drafting a targeted System Prompt that did not unduly increase the context length fed to the LLM.
Creating Provision Specific Prompts, improved by our findings in this research, that direct the LLM towards what it should be doing.
Employing a Follow Up Prompt asking the model to pay special attention to certain aspects and directly accusing it of missing information where necessary.
Is this a big deal? Yes, it is. Many, including this site, have seen due diligence as a real challenge for LLMs due to the huge volume of material and its complexity.
ML extraction is still effective at finding and extracting clauses; however, a well optimised retrieval approach using LLMs is close to or on a par with this performance.
it is possible to add new Provisions on the go, rather than labelling examples to run a supervised machine learning process, with the only overhead being the drafting of specific prompts.
this is only a clear advantage for bespoke extractions as most of the solutions in the market have a large list of pre- trained concepts.
An additional benefit with GenAI is the ability to get to the next stage of querying the extractions to identify risks
this is the next focus of our research
Using LLMs, we can create specific risk query prompts that get us to an answer, rather than just flagging the language a human would need to check.
Using Chunking Strategy 2 (see report)
to go beyond what we had built with AGPT
be more than a simple wrapper for an LLM
Our findings have highlighted the importance of Prompt Engineering, the use of follow-up prompts and the careful process of optimising retrieval components in increasing LLM performance.
LLMs do best on specific tasks that are clearly understood. The larger the task, the more risk things will go astray.
Great work by all of the Addleshaw Goddard team, and in particular Kerry Westland, Elliot White, Mike Kennedy, and Ron Raini.
- Source 3:
AG announces investment in suite of Generative AI tools
Supporting excerpts (8)
International law firm Addleshaw Goddard has chosen CoCounsel, Spellbook, and Microsoft Copilot alongside its own internally developed AGPT platform, as its suite of Generative AI solutions.
Over 50 technologies were reviewed, with five taken forward to trials and pilots involving 150 volunteers across the firm.
led from the team's R&D pillar managed by Mike Kennedy
AGPT is AG's own internally developed AI-powered platform that enables users to run standard queries, upload documents to be queried and reviewed, and translate documents.
Built within our secure Microsoft Azure environment to ensure nothing leaves the firm's networks
CoCounsel, an AI legal assistant powered by GPT-4, is a highly effective tool for bulk document analysis
It has become clear that no one existing platform can deliver everything we want to achieve, so we've decided to adopt a suite of tools as well as develop our own large language model-based platform, AGPT
created in close collaboration between our Innovation & Legal Technology and IT teams
- Source 4:
Our Generative AI Journey: A Year in Review, 2023
Supporting excerpts (10)
AGPT was a product of us trying to find a way of testing GPT-4 within our own secure environment, allowing colleagues to properly use it to answer queries or review documents without the worry around data.
we have had some great use cases come from across the entire firm since the full release of AGPT in September
It allowed our developers to understand how to take advantage of the Azure OpenAI services to power a platform.
Our build strategy for Generative AI this year was to learn
Elliot White, Director, Innovation and Legal Technology
An understanding of the reliability and trust of these models, including questions about hallucinations;
we still follow the usual processes around validation and feedback
we are also starting to see better results using Retrieval Augmented Generation (RAG) as an approach to help with large documents.
worked with our IT team to set up a safe space within our Microsoft Azure environment to carry out bespoke development
Our build strategy for Generative AI this year was to learn, by doing this we have enabled people in roles across the firm to learn. It allowed our developers to understand how to take advantage of the Azure OpenAI services to power a platform.
- Source 5:
Innovation: 2024 Level Complete, Loading 2025 Predictions
Supporting excerpts (11)
2024 saw us publish The RAG Report, which is a report detailing our research into the use of LLMs for M&A due diligence.
with over 90% of the firm now using it and averaging around 1,500 prompts per day across our offices
we have struggled to solve our specific problems with off the shelf solutions, especially in relation to GenAI. We are having more success using LLMs in our own internal builds for the difficult to solve problems.
At AG we have started to deliver this vision for clients already, and are looking at how we offer an internally built solution using the same concepts for M&A diligence.
for now there is a heavy validation and supervisory aspect still needed
we are coming up against the challenge of being unable to use it with clients or on certain data. A lot of this comes down to misunderstanding of risks and an overzealous approach to the use of data.
We think throughout 2025 we will see more detailed metrics in relation to performance on actual tasks. Hopefully this will be led or heavily contributed to by law firms / lawyers.
At AG we are building out solutions that could fall under the Agents definition more widely
Next year will start to see some teams deliver end to end review processes with GenAI as just a specific part of the extraction and analysis of data, within a wider platform.
we have been able to have much more in-depth conversations with software vendors about their approaches to search, chunking, LLM selection and RAG vs full document context reviews.
We have not seen the same kind of transparency in the industry when it comes to the accuracy advertised by vendors when using LLMs for specific tasks.
- Source 6:
What Addleshaw Goddard Has Learned From Its GenAI Journey (So Far)
Supporting excerpts (7)
which perhaps we can call a 'moderate thickness wrapper' around a GPT-4 LLM, but which is not connected to the firm's DMS
they're still using earlier AI tools such as Kira, which is part of Litera.
Team AG said that 0.55 is the best temperature.
they are clear that you cannot 100% remove hallucinations, but you can get to a point where they have the least chance to appear, or have an effect on the results.
some prompts used on one LLM or product won't work so well with others, and in fact can even clash with the system prompts already inserted into some, such as CoCounsel.
around 1,800 people at the firm have now used it
analysing small chunks of text tends to get the best results.
- Source 7:
Legal AI Company Kira Wins UK Law Firm Addleshaw Goddard as New Client
Supporting excerpts (4)
UK law firm Addleshaw Goddard today confirmed that it had signed a long term deal with Canadian legal AI pioneer Kira Systems.
The deal will provide Addleshaws with AI-powered contract and document review capabilities across its Corporate, Banking and Real Estate transactional teams
Addleshaws carried out an 18 month pilot of a range of AI systems, which was led by its Transaction Services Team (TST).
Kerry Westland, a Managing Associate in the TST, added: 'We chose Kira because of the quality of the information it extracts and the flexibility of the Quick Study facility which enables us to build our own legal expertise into the system.'
- Source 8:
Addleshaw Goddard and Harvey launch firmwide collaboration to shape AI-enabled legal delivery
Supporting excerpts (7)
has formed a firmwide collaboration with Harvey
From January, AG will provide Harvey to its entire workforce of more than 3,400 lawyers and business services professionals across Europe, the Middle East and Asia.
The collaboration with Harvey follows a rigorous three-month assessment led by AG's 80-strong Innovation Group
400 AG partners, lawyers, legal technologists and business services professionals tested leading platforms on real legal and business tasks.
Harvey's product team worked with the Innovation Group to further develop Review Tables, which help lawyers organise, compare and verify large volumes of information.
AG's feedback shaped improvements to source checking, preserving work already reviewed by lawyers
while keeping human judgement, supervision and accountability at the centre.
- Source 9:
Addleshaw Goddard Picks Harvey, Fieldfisher Opts For Legora
Supporting excerpts (5)
Kerry Westland (pictured), Partner and Head of the Innovation Group at Addleshaw Goddard, told Artificial Lawyer
We want to help push the development of features for large-scale projects.
The internally-developed AGPT
will continue, but may be used more in the future for testing, rather than as their main AI system.
they won't be doing a double-scoop and using Harvey and Legora at the same time.
- Source 10:
Linklaters' Approach to AI and Due Diligence
Supporting excerpts (3)
it will be closely connected to the Linklaters-developed tool ReportiQ, which was launched out of pilot in 2023 and is a collaboration with the US vendor WizDocs.
So far €35bn+ worth of deals have been supported through the platform.
used Kira, for example, and that has a machine learning approach
- Source 11:
Magic circle firm rolls out 'gamechanger' ChatGPT-type platform
Supporting excerpts (3)
Allen & Overy is integrating Harvey, the artificial intelligence platform built on a version of Open AI models enhanced for legal work, into its global practice.
Harvey will empower more than 3,500 of A&O's lawyers across 43 offices
This enhances various aspects of legal work such as contract analysis, due diligence, litigation and regulatory compliance, A&O said.
- Source 12:
Addleshaw Goddard enhances legal services by adopting Legora platform
Supporting excerpts (5)
Legora has been brought in to replace a previous GenAI technology, specifically used for volume document reviews.
Legora's Tabular Review tool enables the bulk upload of documents to answer specific questions or extractions and can analyse up to 100,000 documents in parallel.
first introducing machine learning solutions in 2014 for diligence
knowledge-sharing through The RAG Report and external workshops
A remarkable 95% of the firm's people already use AGPT, generating around 2,000 prompts per day.
- Source 13:
The RAG Report: Large Language Models in Legal Due Diligence
Supporting excerpts (131)
At the time of writing (October 2024)
Through our optimised approach, we can increase the accuracy of LLMs in commercial contract reviews on average, from 74% to 95%.
In-Context - GPT4-Turbo - First Prompt - 0.69 1.00 0.63 0.74
RAG 10 - GPT4-32K - Improved Prompt - First Prompt - 0.82 1.00 0.79 0.88
RAG 10 - GPT4-32K - Improved Prompt - Follow Up Prompt - 0.92 1.00 0.90 0.95
Machine Learning Extraction Tool - 0.79 1.00 0.76 0.86
GenAI Contract Review Tool - 0.64 0.97 0.60 0.72
configuration is our best performer
with an average F1 score of 92% for the First Prompt scenario and 95% for the Follow Up Prompt scenario.
our solution outperforming a traditional Machine Learning Tool, a Full In-Context solution and a GenAI Contract Review Tool in our testing.
The Machine Learning Extraction Tool lagged behind most of the LLM-based configurations we tested, with an average F1 score of 0.86.
models that were pre-trained by the vendor.
the GenAI Contract Review Tool was the worst performer, with an average F1 score of 0.72.
insisted on rephrasing Provisions rather than extracting them verbatim as requested
we framed our Provision extraction task as a classification problem and then calculated the corresponding recall, accuracy, precision and F1 scores.
the response returned at least 75% of the target Provision's instance (as annotated in CUAD), as long as it did not include Hallucinations or Misleading Information.
the response returned 'Not found' and/or extractions of Provisions that are conceptually related to the target Provisions.
The purpose of including conceptually similar Provisions within our True Positive classification was to not penalise a solution for extracting information that still has some relevance to the target Provision but may be considered over inclusive.
All the results shown in this paper are with respect to CUAD agreements only.
Further testing and development using AG data is being carried in out alongside this research, with similar results.
These are publicly available contracts that have been annotated and can be downloaded alongside specific extraction datasets.
This enabled us to run tests on non-confidential documents and freely share the results, in order to evaluate performance and make all results verifiable.
Although we tested more than 40 Provisions during the research
The types of commercial contracts we experimented with include, among others: services; supply; licence; development; manufacturing; collaboration; and maintenance.
For the generation tests, we used a subset of CUAD agreements. This consisted of agreements between 40 and 60 chunks in length
These alternative components resulted in 10 configuration variations that we tested on our Provision extraction task. These focused on nine Provisions
we chunked all of the 510 CUAD contracts in line with our selected Chunking Strategy (Strategy 2)
a non-optimised approach that takes a simple question-like query for each Provision
Weighted Average 81.31% 97.28% 15.97%
Weighted Average 73.15% 95.36% 22.21%
Weighted Average 83.07% 97.95% 14.88%
solely on the CUAD contracts that consisted of 20 or more chunks
result in a clear improvement in accuracy of retrieval of between 14 and 22%.
we selected the 100 longest contracts from the CUAD dataset
with 36.62% and 65.17% respectively
Chunking Strategy 1: 2,500 characters long with an overlap of 500 characters either side.
Chunking Strategy 3: 4,500 characters long with an overlap of 900 characters either side.
We used the Microsoft Azure OpenAI service for the research
Our choice was influenced by security and infrastructure factors, as well as the deliberate decision that anything we build in the future must be deployable into production within our Microsoft Azure environment.
The only embedding model we used was OpenAI's 'text-embedding-ada-002'.
Throughout this research, we used two models: OpenAI 'GPT-4-Turbo-0125-Preview' and 'GPT-4-32K-0613'.
These figures show how GPT4-32K performs better than GPT4-Turbo on our Provision extraction task, with an improvement of 4% in the First Prompt and 1% in the Follow Up Prompt
There is a 6% increase in the F1 score when considering the average across all Provisions
a larger context window has not resulted in increased performance or improved reasoning quality.
Based on public and internal data, we compiled clause banks containing hundreds of samples for each Provision.
we selected the samples that were, on average, most similar to the other samples within the same clause bank.
rather than the more traditional and less effective question-to-answer embedding similarity commonly used in conversational RAG
We preferred the Advanced Keywords Query over a simple keywords search, as it was more powerful and provided more flexibility and customisation given the advanced search operators it supported, such as proximity search, term boosting and more.
within five words of each other
apply a boost factor of five on the relevancy score of these chunks.
We found bringing back 10 chunks was the sweet spot for retrieval with this Chunking Strategy
we decided to adopt the second method, sorting chunks by the position in the original document.
This method preserved the original continuity and lines of reasoning as well as the hierarchical structure of the original document
It allowed us to merge consecutive chunks to reduce the chance of splitting Provisions
we decided to have a relatively simple System Prompt and only include the most high-level persona and task description instructions
they tended to be 'forgotten' when included in the System Prompt due to the amount of information being provided.
our prompts consisted of three main parts: a Provision Definition, the Main Request; and the General Instructions.
In our case, we gave the model the chance to respond with 'not found', adding to our other components and guarding against hallucinations.
Your answer must be based only on information appearing in the text excerpts, and you must avoid making any assumptions or providing speculative information.
please extract all such provisions verbatim and in their entirety
make sure to start each part of your answer with a reference to the specific clause, subclause, section or subsection from which the information is taken.
resulting in a recall improvement of up to 16% on some Provisions. We implemented this addition in five out of the nine Provisions.
with Cap on Liability and Exclusivity each achieving a 10% increase and Audit Rights achieving a 4% increase.
we decided to focus on the five Provisions where we had not achieved a recall score of at least 90%
We carried out an error analysis of the instances when the LLM failed to extract across the five Provisions
highlighting the fact that LLMs cannot reliably attend to their entire context even when it is much shorter than their context window length.
Initially we thought that a simple request using neutral language, asking the LLM to double check its response would be enough
this didn't seem to result in any noticeable improvement, as the LLM tended to just repeat its previous response.
The Follow Up Prompt variation that improved performance the most was when we directly accused the LLM of missing relevant information.
the use of a Follow Up Prompt gives us an average improvement of 9.2% across all configurations.
in certain cases, the Follow Up Prompt led to an F1 score increase of up to 30% to 35%.
such as Audit Rights, Exclusivity and Cap on Liability, with F1 scores of 0.79, 0.76, and 0.67 respectively.
Provisions that tend to be longer are more likely to only be partially extracted.
as well as why the effort involved may not be needed for every Provision.
These didn't pose a problem throughout our testing, potentially due to the strict nature of our experiments and the task we were carrying out.
we know that there is a near-zero chance of removing hallucination risk from the use of LLMs completely.
Typically, this involved training on a subset of documents, validating the output and scoring the models and then running the remaining documents through the system.
we could save around 50% of the total time spent on a diligence review, reducing the manual review process by approximately 80%.
There was always a risk that the tool would miss a clause or would identify a Yes / No based on an incorrect extraction.
This meant that a level of paralegal or junior associate review of the outputs was still required to ensure accuracy
the time savings per document did not increase when applied at scale.
we consequently invested in a solution. However, we found some limitations in how the outputs were presented and the scale of review that the tool could manage.
we began training our own machine learning models within a third-party tool
Our aim was to take a first step towards evaluating and validating whether LLMs are accurate enough to fulfil our vision for an M&A Transaction Platform.
Apply pre-defined due diligence questions that are relevant to each document type
Generate a comprehensive draft of the due diligence (DD) report
with risk identification currently ongoing
We will be running these same experiments with Claude, Gemini and Llama models
We don't believe that fine tuning a model would help to create the solution we are working towards, but this is partly due to the technical hurdles, costs and time investment needed.
Clause 2.4 of the agreement contains Change of Control provisions
Is there an ability for either party to terminate this agreement upon a change of control or ownership of the other party?
Yes - Both parties Reasoning: The agreement explicitly states
Chunking Strategy 2: 3,500 characters long with an overlap of 700 characters either side.
For example, in AGPT our parameters are temperature at 0.5 and maximum tokens at 800
The importance of prompting and optimising search queries as shown in this paper means that subject matter expertise in the area where GenAI is being deployed is crucial.
we wanted to assess alternative approaches beyond partnering with a third party or purchasing off the shelf software.
guiding it towards the relevant information and steering it away from irrelevant information.
which went back to the LLM alongside all of the above as well as the first response from the model.
as well as an additional increase in F1 score of 2% in the transition from a RAG 20 to a RAG 10 configuration.
We found that Chunking Strategy 2 was the best performing strategy
we used its specific 'Contract Review' feature together with our Provision Specific Prompts.
In this paper, we have focused on the retrieval and extraction aspects of the process
This output would then enable us to ask detailed questions to identify the relevant risks for our diligence report.
we wanted the model to adhere closely to the text in the document and avoid any unrequired creativity, providing verbatim citations.
You are a UK Lawyer specialising in Corporate and Commercial law.
stored the chunks together with their vector representations in a dedicated Vector Index.
CUAD is a dataset from The Atticus Project that contains publicly available contracts that have been annotated
Using this method, we created Advanced Keywords Queries containing word pairs found to be most associated with
This worked example shows the process for identifying a termination for change of control risk
Termination Upon Change of Control. Notwithstanding anything to the contrary herein
Make sure to review and analyse each provided excerpt thoroughly.
'merger', 'consolidation', 'sale', 'transfer', 'ownership'
Either party may terminate this Agreement at any time by giving not less than four weeks' notice in writing to the other party if the other party undergoes a change of control
Then provide the text you have used to come to this answer
Reasoning: The agreement explicitly states that either party may terminate the agreement if the other party undergoes a change of control
we applied very strict settings on these experiments
K equal to 5: Used alongside Strategy 2
We imagine that other formats such as tables, charts and images would pose different challenges and would require a different Chunking Strategy or OCR to keep the data together.
This is a similar argument to the one we put forward in 2014 when we began training our own machine learning models within a third-party tool
optimising specifically for certain concepts improves the performance in relation to those concepts
RAG 20 - GPT4-Turbo - First Prompt - 0.74 1.00 0.70 0.80
RAG 20 - GPT4-Turbo - Follow Up Prompt - 0.84 0.99 0.83 0.89
RAG 10 - GPT4-Turbo - First Prompt - 0.75 1.00 0.71 0.81
RAG 10 - GPT4-Turbo - Follow Up Prompt - 0.86 0.99 0.85 0.91
RAG 10 - GPT4-32K - First Prompt - 0.79 1.00 0.76 0.85
RAG 10 - GPT4-32K - Follow Up Prompt - 0.88 1.00 0.86 0.92
Weighted Average 27.56% 64.58% 36.62% 65.17% 32.44% 58.81%
we adjusted the Provision Specific Prompts of the five Provisions to include an additional instruction to pay attention to sections containing specific keywords that are associated with the target Provision.
We didn't see a decrease in either Change of Control or Licence Grant
to isolate the individual generation components and ascertain their impact on the overall performance
We were also starting to have conversations with clients about whether GenAI could be applied to contract playbooks, as well as the automation of red flag risk reviews of large document sets and other potential use cases, all without the need for manual human intervention.
Comments
Start the conversation.
Invited members of the library comment here. Sign in to join the conversation.