chevron-down Created with Sketch Beta.

GPSolo eReport

GPSolo eReport July 2024

AI and You: The Critical Role of Retrieval Augmented Generation (RAG) in Legal Practice

Mathew Kerbis

Summary

  • Retrieval augmented generation (RAG) is a game-changer for lawyers because it allows generative artificial intelligence (GenAI) results to be more precise and reliable.
  • RAG refers to the process by which a GenAI tool draws from specific, predetermined sources, such as databases containing case law, contracts, statutes, and other legal-specific documents.
  • AI tools using RAG might still produce errors, but these errors are more akin to human mistakes than “AI hallucinations” generating entirely fictitious case law and citations.
AI and You: The Critical Role of Retrieval Augmented Generation (RAG) in Legal Practice
fotosipsak via Getty Images

Jump to:

There are hundreds of artificial intelligence (AI) tools available to lawyers to use, dozens of which are specific to the legal industry, but what does that even mean? How can an AI tool, in particular a generative AI (GenAI) tool, be legal-specific? When questioning your legal AI vendors on things such as training data, confidentiality, and security, you are also going to want to ask whether their tool utilizes retrieval augmented generation (RAG). RAG is a game-changer for lawyers using AI tools because it allows GenAI results to be more precise and reliable.

Understanding RAG

RAG refers to the process by which a GenAI tool draws from a specific, predetermined source of truth when responding to prompts. These sources of truth can be databases containing case law, contracts, statutes, and other legal-specific documents. The concept of RAG isn’t entirely new. Even before the term became known, savvy legal professionals were providing generic AI tools with examples of preferred briefs or contracts to guide the output. It was a basic form of RAG, restricting the AI’s source of truth to specific examples. Think about creating a chart of responsibilities and deadlines from a franchise disclosure document. With RAG, you could feed that document to an AI tool and have it extract and organize that information in minutes—a task that would take hours to do manually.

Why do OpenAI’s ChatGPT and other GenAI tools hallucinate case law (i.e., respond to prompts with citations to cases that do not exist)? Because they are not using RAG, nor were they designed for that purpose. To understand RAG, it’s helpful to first grasp how GenAI functions. These large language models (LLMs), such as ChatGPT and Anthropic’s Claude, operate similarly to a neural network, mirroring the human mind’s processes. At their core, these models predict the most logical next word in a sequence, whether in writing or verbal communication, based on patterns and probabilities derived from their training data. This prediction mechanism allows GenAI to generate coherent and contextually appropriate responses. They’re trained on vast amounts of data, synthesizing information much like we do. Like humans, they typically don’t have perfect recall of everything they’ve been trained on.

The Limitations of General AI Models

For general purposes, this broad knowledge base can be incredibly useful. But for lawyers performing substantive legal tasks—not so much. We’ve all heard about the incidents where attorneys cited non-existent cases after relying on AI-generated responses. That’s exactly the kind of situation RAG helps prevent. RAG does not guarantee prevention, mind you, but in this author’s experience, it comes close. By restricting the AI’s source of truth to specific, relevant documents or databases, we can significantly enhance the accuracy of AI-generated outputs. Many legal AI tools are already implementing RAG. They’re connecting to databases of case law, statutes, and other legal resources. This ensures that the GenAI tool’s responses are not grounded only in generalized knowledge that might be outdated or inaccurate. Instead, the output is grounded in actual legal precedents, current laws, or actual legal documents.

RAG in Legal Practice

Some legal AI tools are even training their own competitive AI models on all regulations and statutes and millions of legal documents to do a better job of retrieving and understanding legal-related materials when leveraging RAG. Legal AI using RAG is like a human lawyer having access to legal research materials when answering a legal question. If they lacked access to legal research materials, even the most experienced lawyers would be less trustworthy to provide accurate legal research results than lawyers who were less experienced but did have access to traditional legal research tools. Similarly, even legal-specific GenAI that isn’t using RAG would be less likely to get accurate and useful results than GenAI using RAG. Granted, GenAI using RAG can still make mistakes, as can humans with access to actual case law or legal documents, but it’s going to be far less likely.

In practice, you might still encounter minor errors—AI might cite the wrong paragraph number in a contract. But these are more akin to human mistakes than “hallucinations” generating entirely fictitious information. Want to test if RAG is working with your AI tool? Do what lawyers do best: Ask questions that you already know the answer to. Prompt it for citations or summaries of case law or documents that you are intimately familiar with. It’s helpful to approach these AI tools as you would a highly capable human assistant with exceptional memory and expertise across multiple domains. This mindset encourages you to verify important information and maintain a critical perspective on AI-generated outputs. It will also help you refine your prompts; better communication in assigning tasks yields better results for both human team members and GenAI tools.

The Future of Legal Services with RAG

The implementation of RAG in legal AI tools represents a significant advancement in the field. It allows us to harness AI’s rapid information processing and pattern recognition capabilities while maintaining the accuracy and reliability we need in legal work. As AI technology continues to evolve, the importance of RAG in legal applications is likely to grow. We might see more sophisticated RAG implementations, allowing for even greater accuracy and nuance in AI-generated legal analyses and documents. But remember, while RAG significantly enhances the reliability of AI tools, it doesn’t eliminate the need for human oversight and verification, especially in high-stakes legal matters.

For those of you looking to integrate AI tools into your practice, understanding RAG is crucial. It allows you to ask informed questions when evaluating different AI solutions and to use these tools more effectively. By leveraging RAG-enabled AI tools, you can potentially save significant time on tasks such as document review, case research, and contract analysis while maintaining the high standards of accuracy required in legal work. For those billing their time as a source of revenue, this increased efficiency might prompt a consideration of alternative billing models (but that is subject for a different article). In essence, RAG is bridging the gap between AI’s vast processing capabilities and the precision required in legal work. As our field continues to adapt to and integrate AI technologies, understanding and effectively utilizing concepts such as RAG will be essential for lawyers seeking to enhance their practice while maintaining the highest standards of accuracy and professional responsibility.

    Author