Transformative Potential of Generative AI and Law: A New Era
Written by Nasir.AI
Pacta sunt servanda. This universal principle notoriously sets out the elementary rules of any legal game - agreements must be kept. And yet, we know that the enforcement of contractual terms constitutes a millennia-old problem, with archaeological evidence dating back to ancient Mesopotamia. Indeed, historical records have shown that in c. 1750 BC, customer Nanni complained about inadequate delivery of copper by a merchant named Ea-nāṣir. Fast-forward to 2024 AD, the rapid advancement in AI technology is positioned to bring dreams to reality. It finally allows for the development of an agentic tool which identifies and oversees the enforcement of contractual terms automatically, and this is just the beginning. Hence, our name: Nasir AI - a solution overdue for centuries.
On Sunday, 23 June 2024, King’s Entrepreneurship Lab generously organised the very first Cambridge LLM x Law Hackathon, in collaboration with Stanford CodeX and Liquid Legal Institute. 150 participants arrived from all over the world to solve real-life problems in the legal sector with the use of large language models (LLMs) in AI. Five friends (Vid, Stuart, Hana, Robin, and Zahra) gathered to come up with ideas to tackle legal problems with AI solutions. The atmosphere at Cambridge was inspiring, with a sense of a new exciting era on its way. An opportunity of limitless possibilities, and certainly a wave to catch now, with a vision to transform the future of the legal profession.
It was evident from the very beginning of the first keynote speech in the Keynes Lecture Hall that we are witnessing “a Cambrian explosion of legal tech innovation”, as Jay Mandal from Stanford CodeX put it. With significant investment flowing into AI development, top law firms and businesses are investing millions in generative AI solutions. However, we noticed that there is often a discrepancy between these investments and the enforcement of the meticulously negotiated contracts they are meant to serve. This is where Nasir AI, our pitch at the hackathon, comes into play.
Our idea emerged following a productive brainstorming session in the morning. We further honed our vision over an excellent brunch in the stunning Hall of Georgian Gothic character. The idea was simple: Nasir AI is an agentic generative AI tool designed to identify contract terms, write executable code to monitor their completion, and autonomously notify relevant stakeholders (e.g., payables teams and suppliers). We realised the critical need to prevent breaches of contract by alerting procurement teams in large business organisations to potential supply chain disruptions while they are still remediable. Despite the fact that many legal tech innovations focus on reducing legal fees for clients, we proposed a different approach: preventing litigation altogether by proactively addressing contractual compliance. This shift in perspective underscores the importance of innovation in the legal sector, not just for cost savings but for enhancing operational integrity and efficiency.
With our focus and motivation clear, we began to conceptualise what Nasir AI would look like. By the end of afternoon, we developed a model that extracts key information from supply agreements, such as delivery dates, item specifications, quantities, and more. Vid and Stuart took charge of building the demo, while Hana and Zahra handled the legal aspects. In the meantime, Robin managed the strategy and business side of our pitch. Hana and Zahra sourced sample contracts to help Vid and Stuart understand the typical structure of a supply agreement as a next step for our solution. The entire day at King's College was exceptionally well-organised, with mentors from different sponsors available to provide guidance and feedback, which helped us refine our pitch. We were especially grateful for a chance to debate our idea with Jay Mandal from Stanford CodeX, who has given us valuable insights when imagining and designing the potential of our product.
Essentially, our technical solution consists of two parts, both powered by an LLM (Llama 70B instruct was used for both). In the first step, we extracted all the relevant contract terms from a contract and checked their correctness in the second. In the second step, we verified each of the conditions by accessing the company database. The entire database was described to the LLM and to avoid hallucinations, the program was then executed repeatedly to check the correctness of each claim. This approach is private, explainable, and scalable because the generated program can be inspected and run locally on the customer database without active interaction with the LLM. For the demo, this was demonstrated by generating code that uses the Pandas library and a simple database of transactions and deliveries. The same approach, however, could be applied to more complex and larger SQL or ERP databases with programmatic access.
The idea of using AI as an assistive tool that constantly thinks of ways to help the user was, for our team, a key takeaway from the morning lecture by Stanford CodeX fellow, Jay Mandal. In fact, this philosophy significantly influenced our approach to Nasir AI. We designed it to continuously monitor a contract during its lifetime and notify the user of any breaches or issues. We deliberately planned to avoid creating another iteration of an AI chatbot to which we have all become accustomed. Instead, we focused on integration, developing our tool so that it would seamlessly fit into the user's workflow. Our goal was precisely to create a tool that complements the human expert using it, providing simple yet effective assistance.
After the first round of judging, we took a well-deserved break to enjoy the choir singing on the river Cam at sunset, and chanted among other spectators in the punts - only to find out that we made it into the top 12 teams and were to pitch in front of the full panel of judges and the other brilliant hackers! Back to Keynes Lecture Hall, we demonstrated our idea to a room packed with an engaged audience of brilliant minds: judges from tech companies, international law firms and fellow AI developers. An hour later, we found out that the judges too believed in our idea and Nasir.AI was awarded the second-place prize, as well as the Stanford CodeX category prize for creating an agentic solution.
Throughout the day of teamwork, among old and new friends, we realised that the legal sector's embrace of AI serves as a model for other industries. It demonstrates that AI can be a valuable tool in enhancing professional services without undermining the human expertise at their core. Participating in the Hackathon was an invaluable experience, showing firsthand the potential of AI to drive meaningful change in the legal industry. It was a day filled with innovation, collaboration, and the exciting realisation that the future of legal tech is bright and full of possibilities. It was also a perfect Sunday of five friends building something that they love. We extend our sincere gratitude to the organisers of the event and all of the sponsors and contributors.
Nasir.AI
Zahra Farzanekhoo
Zahra graduated from Oxford with an undergraduate degree in Law. Following this, she commenced a postgraduate degree in Criminology at the University of Cambridge, where she was awarded the QuantEdge-Cambridge Refugee Scholarship by King’s College.
Stuart Johnson
Stuart dropped out of Cardiff University, to work in startups. He previously founded Simple Construction, a venture-backed workflow automation tool for the construction industry.
Vid Kocijan
Vid Kocijan holds a PhD in computer science from Oxford (St Hugh's College) with a focus on natural language processing and commonsense reasoning. Currently, he works as an ML engineer at Kumo.ai with a particular interest in text and graph processing.
Hana Šerbec
Hana Šerbec holds an LL.M. degree from the University of Cambridge (Clare College) and is passionate about various aspects of commercial, European, comparative and international law. She is a lawyer, particularly keen to explore the transformative potential of new technologies for the legal sector.
Robin Van Aeken
Robin Van Aeken graduated from the University of Oxford (Hertford College) with a degree in Economics and Management. He works at McKinsey & Company with a focus on technology.