Applications of Large Language Models on the Legal and Accounting Fields
Exploring the upsides and risks of LLMs in terms of operating on data versus code
I spend a lot of time thinking about LLMs, (large language models), ChatGPT and their impact on the world. It’s pretty clear to me that we’ve hit an inflection point in the world. Even if AI research grinds to a halt now, the tools we have now are already incredibly revolutionary.
In this post, I am going to talk a little about ChatGPT, whether it is under- or over-rated, what I think the risks are and some applications in the legal and accounting fields. I argue that the legal field has a data problem, where LLMs can provide great upside with significant risks. In accounting, there is a code problem. LLMs can solve this, with less benefit but less risk.
Is ChatGPT Overrated?
In general, I think ChatGPT is incredibly overrated but at the same time incredibly underrated, but for different reasons. I see ChatGPT and other language models as force multipliers for experts, as opposed to a tool to equalize capabilities.
The two big risks with LLMs are the hallucination problem, where the data you get back from ChatGPT is both confident and garbage at the same time, and the privacy problem: Prompts you send to OpenAI can be used to improve the model - but that means your data is potentially sticking around forever, being remixed by unknown people.
I’ve been exploring uses of LLMs in ways that get around those two problems: you can’t trust them unless you’re an expert, and you can’t really trust OpenAI with your data, but also keeping in mind the potential. I have been thinking about two particular fields recently, given discussions at work about this: legal/compliance and accounting (obviously, since I’m a CPA). Both fields are pretty untouched by any sort of automation but there are applications of LLMs that can provide value, with some tradeoffs.
Legal
The legal and compliance field deals with large volumes of unstructured data that are difficult to analyze manually in the form of contracts. Language has historically been a challenge for computers to properly analyze with all of its edge cases. The ability to properly analyze and summarize documents is either impossible, or inaccessible to most (due to availability, cost, etc). Part of my job as an auditor was to read through contracts and summarize significant points. We did not pay for software that could do this. LLMs can provide significant value in this field by analyzing large amounts of data quickly and accurately, and for basically free.
LLMs can provide tons of value in analyzing and summarizing contracts, but run into the privacy problem. Do you really want to give OpenAI all of your contractual data? Some contracts are not a big deal (you signed a contract with Google when you opened your account, with standard terms and conditions), but others can be very sensitive.
The amount of text (tokens, in LLM parlance) that LLMs can realistically consider at one time is limited as well, and I find that there is a significant quality dropoff in output if the prompt gets too long. Many contracts are probably too long anyways for current LLMs (but I don’t have GPT-4 access yet, which should be much better). There’s also the hallucination problem. How can you verify that your contract was summarized correctly?
Accounting
In contrast to the legal and compliance field, accounting data is already largely structured. This is due to innovations in the 1970s and 1980s that led to the creation of accounting software, spreadsheets, ERPs, etc. The introduction of these systems allowed businesses to automate accounting processes and produce structured data, which could be easily analyzed by traditional computer programs.
At the same time, there’s tons of manual work in accounting that you think computers could do instead. As an auditor, a big part of my job was to format spreadsheets that software designed for printing on paper instead of analyzing in excel. This is a very different concern though to the legal problem: the accounting data is already well structured in a machine readable form, it just needs better software written for it. Accounting is a complex field though where many developers just don’t understand it or the challenges enough to solve many of these problems.
Here’s an example of how powerful LLMs can be for accounting. Yesterday, I wanted to generate an ad hoc report of all of the expense accounts that we use for expense reimbursements, and the total of all reimbursements in those accounts. This was a tricky problem though: it required finding expense reimbursements with a single SQL query, then making more queries based on each reimbursement’s unique transaction id to get the other legs of the transaction, then summarizing it all.
I could have written SQL to do this, but it was a multiple step problem, it would have been pretty gross and complicated. It would have been impossible to do in Excel without taking hours of work. It took me about five minutes to walk ChatGPT through the steps of the report. I had to describe the data, which fields to join, etc, but I got a working python script out of it.
Data vs Code
You might say that your accounting software can generate that report. That’s great! Someone coded that though, and it probably cost tens of thousands of dollars in development time, if not more. This report took me five minutes to answer, basically no development time or cost. I didn’t need expensive, capable software, a team of people to implement it, etc. All I needed was an API, a text editor, and access to the general ledger. I look at this and think that maybe these type of things were available to large corporations, but now they are available to practically anyone.
I don’t think anyone could do this though: I needed to know both the shape of the accounting data, but also how SQL/python work generally. Again, LLMs are force multipliers. They let experts do more with less. This is something that isn’t really possible for contracts without running into the pre-LLM problems. There’s too many edge cases to write code to analyze contracts.
The legal field has a data problem: the data is unstructured and LLMs can provide significant value, with significant tradeoffs. Accounting has a code problem: the data is structured, but accountants need a platform for operating. They avoid the data problem as LLMs never touch the accounting data. There is less upside, but much less downside as well, but we can also start generating significant value today without risking sensitive data because the data never leaves your servers.
Writing code as opposed to summarizing data is also a big win over the hallucination problem. You can read code and (assuming you understand code) can be assured on what it will do. It’s much more difficult to trust text coming out of an LLM.