SELF-EXPERTISE: Knowledge-based Instruction Dataset Augmentation for a Legal Expert Language Model

Minju Kim, Haein Jung, Myoung-Wan KooNAACL 2024 · DOI

TL;DR

This paper introduces SELF-EXPERTISE, a novel method for automatically generating instruction datasets for specialized domains, specifically focusing on legal language models. By extracting knowledge from existing legal texts and using it to generate new instructions, inputs, and outputs, SELF-EXPERTISE significantly reduces hallucinations and improves accuracy, leading to a specialized legal model (LXPERT) that outperforms general-purpose models like GPT-3.5-turbo.

What Problem Does This Paper Address?

The rapid advancement of instruction-tuned Large Language Models (LLMs) has been a boon for natural language processing. However, a critical bottleneck is the creation of high-quality instruction datasets. Manually curating these datasets is time-consuming and expensive. While LLMs can automate this process, they often suffer from "hallucinations" – generating factually incorrect or misleading information, especially in specialized domains like law where accuracy is paramount. Existing LLM-based augmentation methods struggle to inject the necessary expert-level knowledge, leading to unreliable outputs. This paper addresses the need for a method that can automatically generate accurate and reliable instruction data for knowledge-intensive domains, thereby enabling the development of specialized LLMs that go beyond general capabilities.

Methods

The core innovation is the SELF-EXPERTISE methodology, a four-step process designed to generate instruction data based on precise external knowledge:

  1. Knowledge Extraction Based on Output: Instead of relying solely on the LLM's inherent knowledge, this step extracts factual knowledge and legal basis (laws, precedents) from the outputs of a small, expert-written seed dataset. This grounds the generation process in verifiable information.
  2. Generation of User Instruction and Input Based on Knowledge: Using the extracted knowledge, the LLM acts like a teacher creating exam questions. It generates new user instructions and corresponding inputs that probe this knowledge, mimicking how a student might be tested on learned material.
  3. Creation of System Instructions: To guide the LLM's output generation and ensure it aligns with specialized reasoning structures, handcrafted system instructions are created. These instructions provide guidelines on tone, format, and reasoning processes (e.g., the IRAC framework in law).
  4. Output Generation Based on Previous Results: Finally, the system instruction, user instruction, input, and extracted knowledge are combined to generate the final output. The inclusion of accurate knowledge in the prompt is crucial here to prevent hallucinations.

This process is applied to create a structured dataset of <system instruction, user instruction, input, output>.

Datasets

  • Seed Dataset: A dataset of 980 legal instruction examples, created by legal experts, covering civil law, criminal law, legislative information, and legal consultations.
  • SELF-EXPERTISE Augmented Dataset: A dataset of approximately 19,000 instruction-following pairs generated using the SELF-EXPERTISE method on the seed dataset.
  • In-domain Evaluation Dataset: A dataset of 200 QA pairs related to the four legal domains, meticulously designed to have no overlap with the seed or training datasets.
  • Out-of-domain Evaluation Dataset: A dataset of 100 QA pairs crawled from an "Easy-to-Find Living Law Information" site, specifically chosen to require knowledge not present in the seed data, to test generalization.
  • Legal-based Self-Instruct Dataset: A dataset of 19,000 pairs generated using the Self-Instruct method for comparison.

Key Insights and Ideas

  • Knowledge Extraction is Key: The paper strongly advocates for extracting knowledge from outputs rather than relying on an LLM's internal knowledge. This is a crucial step in preventing hallucinations and ensuring factual accuracy, especially in high-stakes domains.
  • Mimicking Teacher-Student Dynamics: The analogy of a teacher designing exam questions based on textbook content is a powerful way to conceptualize the generation of user instructions and inputs. This approach ensures the generated data is relevant and tests specific knowledge.
  • System Instructions for Structure: Handcrafted system instructions are vital for guiding the LLM to produce outputs that adhere to domain-specific reasoning patterns and formats, rather than just generic responses.
  • Domain Specialization Pays Off: The results clearly show that a model trained on a specialized, knowledge-augmented dataset (LXPERT) significantly outperforms general-purpose models and even models trained on general instruction datasets, even when evaluated on out-of-domain legal tasks.

Key Results

  • LXPERT Outperforms Baselines: The trained model, LXPERT (a LLaMA-2 7B model fine-tuned on the SELF-EXPERTISE augmented dataset), significantly outperformed various baselines, including general domain instruction-tuned models, Self-Instruct tuned models, and even GPT-3.5-turbo, in both in-domain and out-of-domain legal evaluations.
  • GPT-4 Evaluation: In pairwise comparisons, LXPERT won against GPT-3.5-turbo in 54% of in-domain cases and 65% in out-of-domain cases, demonstrating its superior logical reasoning and accuracy.
  • Human Evaluation: Human evaluators rated LXPERT highly for accuracy and fluency, with scores significantly exceeding other 7B models and GPT-3.5-turbo. For instance, LXPERT achieved an accuracy of 3.88 and fluency of 4.80 on in-domain tasks, compared to GPT-3.5-turbo's 2.52 and 3.83, respectively.
  • Diversity of Generated Data: The length distribution of generated instructions, inputs, and outputs by SELF-EXPERTISE was more even and diverse compared to Self-Instruct, attributed to the varied system instructions.
  • Data Quality: Human review of the generated data showed high quality, with 90% of instructions describing valid legal tasks, 90% of inputs being appropriate, 88% of outputs being correct and acceptable, and 77% including correct legal terms and knowledge.

Limitations and Future Work

  • Cost: While SELF-EXPERTISE reduces costs compared to human annotation, using powerful LLMs like GPT-3.5-turbo and GPT-4 for generation can still incur significant costs, especially with multiple iterations.
  • Knowledge Expansion: The current method augments data based on the knowledge within the seed dataset. While this improves diversity of instructions and inputs, the core knowledge remains limited. Future work could involve retrieving a wider variety of knowledge sources for data augmentation to further enhance diversity.
  • Potential for Bias: As the data is generated by LLMs, it may inherit biases present in the backbone LLM. The authors note their method addresses some biases by generating knowledge from outputs rather than directly from inputs, and by avoiding personal information, but acknowledges this remains an area for consideration.
  • Future Work: The authors suggest exploring the combination of accurate knowledge acquisition methods with SELF-EXPERTISE to further improve precision. They also hypothesize that incorporating additional general domain datasets or expanding the knowledge base of the seed data could enhance model performance.

Summary updated

BibTeX
@inproceedings{kim2024self,
  author = {Minju Kim and Haein Jung and Myoung-Wan Koo},
  title = {{SELF-EXPERTISE: Knowledge-based Instruction Dataset Augmentation for a Legal Expert Language Model}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-naacl.69},
}
Figure