Researchers from Peking University Introduce ChatLaw: An Open-Source Legal Large Language Model with Integrated External Knowledge Bases

Thanks to artificial intelligence’s ongoing growth and development, large-scale language models are now widely available. Models like ChatGPT, GPT4, LLaMA, Falcon, Vicuna, and ChatGLM have shown outstanding performance in various traditional tasks, opening up a world of opportunity for the legal profession. However, gathering reliable, current, high-quality data is essential to creating sizable language models. Therefore, creating open-source legal language models that are both effective and efficient has become crucial. 

Large-scale model development in artificial intelligence has impacted several industries, including healthcare, education, and finance: BloombergGPT, FinGPT, Huatuo, and ChatMed; these models have proven useful and effective in handling challenging problems and producing insightful data. On the other hand, the area of law demands thorough investigation and the creation of a unique legal model due to its intrinsic relevance and need for accuracy. Law is crucial in forming communities, regulating interpersonal relationships, and ensuring justice. Legal practitioners rely on accurate and current information to make wise judgments, understand the law, and offer legal advice. 

The nuances of legal terminology, complicated interpretations, and the dynamic nature of law offer special problems that call for specialized solutions. Even with the most cutting-edge model, like GPT4, there is frequently a hallucination phenomenon and incredible results regarding legal difficulties. People often think improving a model with relevant domain expertise would provide positive outcomes. However, early legal LLM (LawGPT) still has a lot of hallucinations and inaccurate results, so this isn’t the case. At first, they understood the demand for a Chinese legal LLM. However, there were no Chinese models that were commercially accessible at the time that were larger than 13 billion parameters. Combining training data from sources like MOSS and increasing the Chinese lexicon improved the foundation of OpenLLAMA, an economically feasible model. This enabled researchers from Peking University to build a fundamental model of the Chinese language to which they then added legal-specific data to train ChatLaw, their legal model. 

The following are the paper’s main contributions: 

1. A Successful Method to Reduce Hallucinations: They present a method to reduce hallucinations by improving the model’s training procedure and including four modules during inference: “consult,” “reference,” “self-suggestion,” and “response.” Hallucinations are less frequent because vertical models and knowledge bases are integrated through the reference module, which incorporates domain-specific knowledge into the model and uses reliable data from the knowledge base. 

2. A model that extracts legal feature words from users’ daily language has been trained. It is based on the LLM. With the help of this model, which recognizes terms with legal meaning, legal situations inside user input may be quickly and effectively identified and analyzed. 

3. A model that measures the similarity between users’ ordinary language and a dataset of 930,000 pertinent court case texts is trained using BERT. This makes it possible to build a vector database to quickly retrieve writings with a similar legal context, allowing additional research and citation. 

4. Development of a Chinese Legal Exam Assessing Dataset: They create a dataset to assess Chinese speakers’ legal expertise. They also make an ELO arena scoring system to determine how well various models perform in legal multiple-choice tests. 

They also noted that a single general-purpose legal LLM might only function well in this area across some jobs. As a result, they developed numerous models for various situations, including multiple-choice questions, keyword extraction, and question-answering. Using the HuggingGPT technique, they used a large LLM as a controller to manage the selection and deployment of these models. Based on each user’s request, this controller model dynamically chooses the specific model to activate, ensuring the best model is used for the task.

Check out the Paper and Github Link. Don’t forget to join our 25k+ ML SubRedditDiscord Channel, and Email Newsletter, where we share the latest AI research news, cool AI projects, and more. If you have any questions regarding the above article or if we missed anything, feel free to email us at

Featured Tools:

  • Aragon: Get stunning professional headshots effortlessly with Aragon.
  • StoryBird AI: Create personalized stories using AI
  • Taplio: Transform your LinkedIn presence with Taplio’s AI-powered platform
  • Otter AI: Get a meeting assistant that records audio, writes notes, automatically captures slides, and generates summaries.
  • Notion: Notion AI is a robust generative AI tool that assists users with tasks like note summarization
  • tinyEinstein: tinyEinstein is an AI Marketing manager that helps you grow your Shopify store 10x faster with almost zero time investment from you.
  • Boost your advertising and social media game with – the ultimate Artificial Intelligence solution. 
  • SaneBox: SaneBox’s powerful AI automatically organizes your email for you, and the other smart tools ensure your email habits are more efficient than you can imagine
  • Motion: Motion is a clever tool that uses AI to create daily schedules that account for your meetings, tasks, and projects. 

🚀 Check Out 100’s AI Tools in AI Tools Club

Aneesh Tickoo is a consulting intern at MarktechPost. He is currently pursuing his undergraduate degree in Data Science and Artificial Intelligence from the Indian Institute of Technology(IIT), Bhilai. He spends most of his time working on projects aimed at harnessing the power of machine learning. His research interest is image processing and is passionate about building solutions around it. He loves to connect with people and collaborate on interesting projects.

🚀 The end of project management by humans (Sponsored)