HTML conversions sometimes display errors due to content that did not convert correctly from the source. This paper uses the following packages that are not yet supported by the HTML conversion tool. Feedback on these issues are not necessary; they are known and are being worked on.

  • failed: inconsolata
  • failed: inconsolata

Authors: achieve the best HTML results from your LaTeX submissions by following these best practices.

License: CC BY 4.0
arXiv:2402.04335v1 [cs.CL] 06 Feb 2024

LegalLens: Leveraging LLMs for Legal Violation Identification in Unstructured Text

Dor Bernsohn{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT   Gil Semonormal-⋆{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT   Yaron Vazananormal-⋆{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT   Gila Hayatnormal-⋆{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT   Ben Hagagnormal-⋆{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT
Joel Niklausnormal-†{}^{{\color[rgb]{1,0.5390625,0}\dagger}}start_FLOATSUPERSCRIPT † end_FLOATSUPERSCRIPT   Rohit Sahanormal-‡{}^{{\color[rgb]{0.21875,0.4609375,0.11328125}\ddagger}}start_FLOATSUPERSCRIPT ‡ end_FLOATSUPERSCRIPT   Kyryl Truskovskyinormal-‡{}^{{\color[rgb]{0.21875,0.4609375,0.11328125}\ddagger}}start_FLOATSUPERSCRIPT ‡ end_FLOATSUPERSCRIPT

{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPTDarrow AI Ltd., Tel Aviv, Israel {firstname.lastname}@darrow.ai
{}^{{\color[rgb]{1,0.5390625,0}\dagger}}start_FLOATSUPERSCRIPT † end_FLOATSUPERSCRIPTNiklaus.ai, Bern, Switzerland [email protected]
{}^{{\color[rgb]{0.21875,0.4609375,0.11328125}\ddagger}}start_FLOATSUPERSCRIPT ‡ end_FLOATSUPERSCRIPTGeorgian.io, Toronto, Canada {firstname}@georgian.io
Abstract

In this study, we focus on two main tasks, the first for detecting legal violations within unstructured textual data, and the second for associating these violations with potentially affected individuals. We constructed two datasets using Large Language Models (LLMs) which were subsequently validated by domain expert annotators. Both tasks were designed specifically for the context of class-action cases. The experimental design incorporated fine-tuning models from the BERT family and open-source LLMs, and conducting few-shot experiments using closed-source LLMs. Our results, with an F1-score of 62.69% (violation identification) and 81.02% (associating victims), show that our datasets and setups can be used for both tasks. Finally, we publicly release the datasets and the code used for the experiments in order to advance further research in the area of legal natural language processing (NLP).

LegalLens: Leveraging LLMs for Legal Violation Identification in Unstructured Text


Dor Bernsohnnormal-⋆{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT   Gil Semonormal-⋆{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT   Yaron Vazananormal-⋆{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT   Gila Hayatnormal-⋆{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT   Ben Hagagnormal-⋆{}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPT Joel Niklausnormal-†{}^{{\color[rgb]{1,0.5390625,0}\dagger}}start_FLOATSUPERSCRIPT † end_FLOATSUPERSCRIPT   Rohit Sahanormal-‡{}^{{\color[rgb]{0.21875,0.4609375,0.11328125}\ddagger}}start_FLOATSUPERSCRIPT ‡ end_FLOATSUPERSCRIPT   Kyryl Truskovskyinormal-‡{}^{{\color[rgb]{0.21875,0.4609375,0.11328125}\ddagger}}start_FLOATSUPERSCRIPT ‡ end_FLOATSUPERSCRIPT {}^{{\color[rgb]{0,0.046875,0.78125}\star}}start_FLOATSUPERSCRIPT ⋆ end_FLOATSUPERSCRIPTDarrow AI Ltd., Tel Aviv, Israel {firstname.lastname}@darrow.ai {}^{{\color[rgb]{1,0.5390625,0}\dagger}}start_FLOATSUPERSCRIPT † end_FLOATSUPERSCRIPTNiklaus.ai, Bern, Switzerland [email protected] {}^{{\color[rgb]{0.21875,0.4609375,0.11328125}\ddagger}}start_FLOATSUPERSCRIPT ‡ end_FLOATSUPERSCRIPTGeorgian.io, Toronto, Canada {firstname}@georgian.io

1 Introduction

The widespread use of the internet has changed how information moves and connects in our society. Every day, the digital domain is flooded with a multitude of textual data, spanning from news articles and reviews to social media posts 111https://www.internetlivestats.com/total-number-of-websites. Within this sea of unstructured text, legal violations can often go unnoticed, concealed by the vast amount of surrounding information. These violations not only pose potential harm to individuals and entities but also challenge the very fabric of legal and ethical standards in the digital era. The significance of addressing these hidden violations cannot be overstated; as they have widespread implications for individual rights, societal norms, and the principles of justice. As a result, there is a pressing need to develop sophisticated methods to sift through the noise and identify these breaches.

Refer to caption
Figure 1: A visual representation of the data generation flow, illustrating the step-by-step process from raw input to the final synthesized dataset.

Legal violations often leave data trails. To detect these trails for pinpointing the violations, previous studies have often relied on specialized models tailored for specific domain applications Silva et al. (2020); Yu et al. (2020). These models, while effective in their specific domains, lack the versatility needed to address the wide array of legal violations that can occur across different contexts.

Legal violation identification aims to automatically uncover legal violations from unstructured text sources and assign potential victims to these violations. We designed two setups, one for each task, the first for solving the legal violation identification task (a.k.a Identification Setup) using named entity recognition (NER), and the other for associating these violations with potentially affected individuals (a.k.a Resolution Setup) using natural language inference (NLI). Our dataset for the NER task is not limited to any specific domain, while the NLI dataset is focused on four common legal domains. Followed by recent research in the field of data generation Leiker et al. (2023); Veselovsky et al. (2023); Hämäläinen et al. (2023), we chose to employ GPT-4 OpenAI (2023) for synthetic data generation due to his ability to produce a large, diverse, and high-quality dataset that closely mimics the syntactic complexity of legal language, offering a scalable and ethically sound alternative to manual data crafting. We employed a thorough verification process to validate the data for both its realistic and complexity. Our approach involved automated data generation based on real-world event contexts in the English language, complemented by manual reviews conducted by seasoned legal annotators on the generated data.

Contributions

The contributions of this paper are three-fold:

  • We introduce two dedicated datasets for legal violation identification, based on previous class action cases and legal news. These datasets, which include new legal entities, were generated using LLMs and validated by domain experts.

  • We evaluate various language models, including BERT-based models and LLMs, across two different NLP tasks, offering valuable insights into their applicability and limitations in the context of legal NLP.

  • We implement a two-setup approach employing both NER and NLI tasks, providing a methodology for legal violation detection and resolution.

Main Research Questions

We believe numerous violations exist in unstructured text. Our aim is to uncover these violations and link them to relevant prior class actions. This study focuses on the following key research questions:
RQ1: To what extent do our newly introduced datasets enhance the performance of language models in identifying legal violations within unstructured text and associate victims to them?
RQ2: How effectively do the language models adapt to new, unseen data for the purpose of identifying legal violations and correlating them with past resolved cases across different legal domains?
RQ3: What is the level of difference between machine-generated and human-generated text in the context of legal violation identification?

2 Related Work

Previous works in the field of legal violation identification mostly focused on domain-specific topics, encompassing areas such as compliance, data privacy, and industry-specific regulations. For instance, Amaral et al. (2023) evaluates data agreements for compliance with European privacy laws using NLP techniques. Silva et al. (2020) used NER to identify personal information in datasets, thereby uncovering instances of online data privacy breaches. Nyffenegger et al. (2023) used LLMs to attempt re-identification of anonymized persons from court decisions. Additionally, neural networks have been used to classify and annotate violation cases in specific industries like power supply Yu et al. (2020). These studies, while valuable, have generally been limited to specific types of legal domains or particular sectors. Our work contributes to this existing body of research by introducing a dataset designed for broader applicability in identifying various types of legal violations.

Prior research has explored the use of Large Language Models (LLMs) for synthetic data generation Rosenbaum et al. (2022a, b), beneficial in situations with scarce authentic data Brown et al. (2020). In fact, training models on synthetic data led to improved outcomes in benchmarks like SQUAD1.1 Puri et al. (2020). However, human-curated data often provides a richness that is hard to replicate Møller et al. (2023); Ding et al. (2022). In this paper, we present a multi-step validation method to discern between real-world and machine-generated content, addressing the inherent limitations of relying solely on synthetic data.

Previous studies indicate that LLMs are capable of explaining legal terms present in legislative documents by drafting explanations of how previous courts explained the meaning of statutory terms Savelka et al. (2023b). Moreover, the models demonstrated analytical depth in court decision analysis, rivaling seasoned law students Savelka et al. (2023a). In this study, we created a dataset based on a previous lawsuits legislation background, rather than examining existing records.

While LLMs Radford et al. (2019) have been employed to enhance datasets for event detection tasks Veyseh et al. (2021), our methodology advances this by generating pairs of specific violations and their corresponding events, using data from previously settled lawsuits. Unlike Koreeda and Manning (2021), who concentrated on NLI in the context of legal contracts, our research introduces an NLI dataset based on class-action cases. Additionally, NER has been increasingly applied in the legal domain, including efforts to extract entities from Indian court judgments Kalamkar et al. (2022) and other legal texts Luz de Araujo et al. (2018); Angelidis et al. (2018); Leitner et al. (2019). Despite these advancements, existing research has largely focused on a standard set of entity types, such as parties (plaintiff and defendant), judges, court name and law/citation. Our work introduces a new set of entity types that have not been previously explored in legal NER research Păi\textcommabelows et al. (2021); Luz de Araujo et al. (2018); Dozier et al. (2010); Leitner et al. (2020); Skylaki et al. (2020); Kalamkar et al. (2022), thereby expanding the scope and applicability of NER in legal contexts.

3 Curating Custom Legal Datasets: A Multi-stage Approach to NER and NLI Tasks

Existing datasets may not adequately address the diverse range of legal violations and contexts central to our study, which is not in specific areas. To overcome these challenges, we employed a systematic and carefully planned data generation process, consisting of three stages: prompting, labeling, and data validation. This approach aimed at creating two robust datasets for two NLP tasks in the legal domain. We chose to focus on two key tasks:

  • NER (classifying tokens into predefined entities) for identifying violations. NER has been employed to define novel legal entities, enabling precise localization of pertinent information necessary for the extraction of legitimate legal violations, as detailed in Table 4 in Appendix C.

  • NLI (classifying a hypothesis and a premise into entailed/contradict/neutral) for matching these violations with known, resolved class-action cases. NLI facilitates the correlation of multiple unstructured text associated with the same violation, thereby enabling the matching of extracted violations identified by the NER task with pre-existing legal complaints of class action cases.

This dual-setup approach was designed to mimic the process of legal violation detection and resolution, generating high-quality data that closely resembles real-world scenarios.

Based on recent research in prompt-based methods Liu et al. (2023), our study employs prompts for a variety of reasons. LLMs have been shown to adapt to specialized tasks through techniques like instruction tuning Wei et al. (2021), reinforcement learning from human feedback Ouyang et al. (2022), and in-context learning Brown et al. (2020) when prompted with natural language instructions. Prompts facilitate task-specific optimization, a quality emphasized by DialogPrompt Gu et al. (2021), which aligns with our focus on NER and NLI in the legal domain by fine-tuning on the generated dataset. Additionally, the sensitivity of prompts in context, as demonstrated in Time-aware Prompts in Text Generation Cao and Wang (2022), is crucial for understanding specific legal contexts like resolved class-action cases. As a result, our methodology leverages a prompt-based approach, optimized for the legal domain, to generate high-quality data for NER and NLI tasks.

3.1 Interconnection Between NER and NLI

The process of identifying and resolving legal violations in unstructured text involves the collaborative use of NER and NLI. Initially, a NER model scans the text to detect ’VIOLATION’ entities, and if a potential violation is tagged with a high-confidence score, it’s considered for further analysis. Subsequently, the text is processed through an NLI model in a pair-wise fashion against a dataset of closed settlements. If the NLI model finds a logical entailment between the text and any of the settled cases, indicating a substantial similarity, the corresponding complaints are flagged as candidates for matching with the specific user’s complaint, potentially qualifying them for inclusion in a settlement fund. This streamlined approach harnesses the strengths of both NER and NLI to efficiently identify and associate potential legal violations with relevant precedents.

3.2 NER Data Generation

NER can be framed as a token classification task, wherein, the objective is to classify each word in a sentence as an entity class. In our dataset, there are four such entities; Law, Violation, Violated By, and Violated On.

For the NER task, our foundational data source was class action complaints, as described in Semo et al. (2022). A complaint, often referred to as a plaintiff’s plea, is a formal legal document that initiates a lawsuit. It outlines the complaints of the plaintiff and specifies the relief sought from the court. From each of these complaints, we extracted relevant sections such as allegations, counts, and legal arguments that were pertinent to our study, ensuring relevance and precision. These sections encapsulate the main context of the alleged violations. They were subsequently summarized through the utilization of GPT-4 OpenAI (2023) to capture the core essence of the violation content, and were employed as the context in the subsequent prompts.

For a visual representation of our data generation process, refer to Figure 1.

Prompt

For the NER task, we devised two unique prompting strategies: explicit and implicit. The explicit method not only emphasizes the inclusion of multiple distinct entities but also underscores the specific order of their appearance, adding a layer of complexity and structure to the generated content (refer to figure 6 in the Appendix). This approach ensures that the content is not only diverse but also adheres to certain structural guidelines, which contain task descriptions, specific instructions, and few-shot examples. Conversely, the implicit strategy focuses solely on a singular entity, specifically the content that describes the violation, refer to figure 6 in the Appendix.

Furthermore, both strategies incorporate additional parameters such as the cause of action, industry, and context. The inclusion of these parameters refines the generated content, tailoring it to specific scenarios and ensuring its relevance to the desired domain. By employing the explicit approach, we capture the comprehensive nature of a scenario, whereas the implicit method provides a concise perspective on one specific aspect.

3.3 NLI Data Generation

NLI can be framed as a classification task, wherein, the objective is to compare a premise to a hypothesis, and predict one of the three classes: (1) Entailment - where the hypothesis is contained and can be supported by the premise, (2) Contradiction - when the hypothesis contradicts the premise, (3) Neutral - when the premise neither entails nor contradicts the hypothesis.

For the NLI task, our data source consisted articles taken from a legal news website. Each news article was first summarized, by prompting GPT-4 OpenAI (2023), to capture its legal grounds. By summarizing, we ensured that the data was concise yet comprehensive by kee** only the legal violation section and removing background parts. This summarized content served as the premise. Using this premise, the model was tasked to generate a hypothesis that mimicked real-world scenarios. The intention behind this design was to create diverse records that spanned various legal areas. Table 5 in Appendix C presents the NLI data distributions.

Prompt

In this setup, we aimed to create scenarios that mirror real-life accounts of potential violations. We generated texts that mimic common situations where individuals share concerns, like online reviews or social media posts. The goal was to produce narratives that implicitly describe the effects of a violation. We added variations in attributes such as the writers age and gender and the text format to capture a wide range of experiences.

Table 1: Comparison of different methodologies for NER. The table showcases various models, their sizes, and the method employed, along with their performance metrics.
Model Size Method F1 Precision Recall
nlpaueb/legal-bert-small-uncased 35M Fine-tune 48.90±0.39subscript48.90plus-or-minus0.3948.90_{\pm 0.39}48.90 start_POSTSUBSCRIPT ± 0.39 end_POSTSUBSCRIPT 41.92±0.80subscript41.92plus-or-minus0.8041.92_{\pm 0.80}41.92 start_POSTSUBSCRIPT ± 0.80 end_POSTSUBSCRIPT 58.69±0.52subscript58.69plus-or-minus0.5258.69_{\pm 0.52}58.69 start_POSTSUBSCRIPT ± 0.52 end_POSTSUBSCRIPT
distilbert-base-uncased 66M Fine-tune 49.71±0.83subscript49.71plus-or-minus0.8349.71_{\pm 0.83}49.71 start_POSTSUBSCRIPT ± 0.83 end_POSTSUBSCRIPT 42.19±0.89subscript42.19plus-or-minus0.8942.19_{\pm 0.89}42.19 start_POSTSUBSCRIPT ± 0.89 end_POSTSUBSCRIPT 60.50±0.77subscript60.50plus-or-minus0.7760.50_{\pm 0.77}60.50 start_POSTSUBSCRIPT ± 0.77 end_POSTSUBSCRIPT
bert-base-cased 108M Fine-tune 54.80±0.64subscript54.80plus-or-minus0.6454.80_{\pm 0.64}54.80 start_POSTSUBSCRIPT ± 0.64 end_POSTSUBSCRIPT 47.23±1.06subscript47.23plus-or-minus1.0647.23_{\pm 1.06}47.23 start_POSTSUBSCRIPT ± 1.06 end_POSTSUBSCRIPT 65.28±1.01subscript65.28plus-or-minus1.0165.28_{\pm 1.01}65.28 start_POSTSUBSCRIPT ± 1.01 end_POSTSUBSCRIPT
bert-base-uncased 109M Fine-tune 53.22±1.42subscript53.22plus-or-minus1.4253.22_{\pm 1.42}53.22 start_POSTSUBSCRIPT ± 1.42 end_POSTSUBSCRIPT 45.86±1.68subscript45.86plus-or-minus1.6845.86_{\pm 1.68}45.86 start_POSTSUBSCRIPT ± 1.68 end_POSTSUBSCRIPT 63.42±1.11subscript63.42plus-or-minus1.1163.42_{\pm 1.11}63.42 start_POSTSUBSCRIPT ± 1.11 end_POSTSUBSCRIPT
roberta-base 125M Fine-tune 62.69±0.69plus-or-minus0.69{}_{\pm\textbf{0.69}}start_FLOATSUBSCRIPT ± 0.69 end_FLOATSUBSCRIPT 56.58±1.12subscript56.58plus-or-minus1.1256.58_{\pm 1.12}56.58 start_POSTSUBSCRIPT ± 1.12 end_POSTSUBSCRIPT 70.30±0.73plus-or-minus0.73{}_{\pm\textbf{0.73}}start_FLOATSUBSCRIPT ± 0.73 end_FLOATSUBSCRIPT
nlpaueb/legal-bert-base-uncased 109M Fine-tune 57.50±0.94subscript57.50plus-or-minus0.9457.50_{\pm 0.94}57.50 start_POSTSUBSCRIPT ± 0.94 end_POSTSUBSCRIPT 50.34±1.26subscript50.34plus-or-minus1.2650.34_{\pm 1.26}50.34 start_POSTSUBSCRIPT ± 1.26 end_POSTSUBSCRIPT 67.04±0.71subscript67.04plus-or-minus0.7167.04_{\pm 0.71}67.04 start_POSTSUBSCRIPT ± 0.71 end_POSTSUBSCRIPT
lexlms/legal-roberta-base 124M Fine-tune 59.73±2.03subscript59.73plus-or-minus2.0359.73_{\pm 2.03}59.73 start_POSTSUBSCRIPT ± 2.03 end_POSTSUBSCRIPT 53.11±2.27subscript53.11plus-or-minus2.2753.11_{\pm 2.27}53.11 start_POSTSUBSCRIPT ± 2.27 end_POSTSUBSCRIPT 68.25±1.86subscript68.25plus-or-minus1.8668.25_{\pm 1.86}68.25 start_POSTSUBSCRIPT ± 1.86 end_POSTSUBSCRIPT
joelito-legal-english-roberta-base 124M Fine-tune 59.01±1.74subscript59.01plus-or-minus1.7459.01_{\pm 1.74}59.01 start_POSTSUBSCRIPT ± 1.74 end_POSTSUBSCRIPT 52.52±2.52subscript52.52plus-or-minus2.5252.52_{\pm 2.52}52.52 start_POSTSUBSCRIPT ± 2.52 end_POSTSUBSCRIPT 67.40±0.85subscript67.40plus-or-minus0.8567.40_{\pm 0.85}67.40 start_POSTSUBSCRIPT ± 0.85 end_POSTSUBSCRIPT
lexlms/legal-longformer-base 148M Fine-tune 62.30±1.76subscript62.30plus-or-minus1.7662.30_{\pm 1.76}62.30 start_POSTSUBSCRIPT ± 1.76 end_POSTSUBSCRIPT 56.78±2.14plus-or-minus2.14{}_{\pm\textbf{2.14}}start_FLOATSUBSCRIPT ± 2.14 end_FLOATSUBSCRIPT 69.04±1.32subscript69.04plus-or-minus1.3269.04_{\pm 1.32}69.04 start_POSTSUBSCRIPT ± 1.32 end_POSTSUBSCRIPT
lexlms/legal-roberta-large 355M Fine-tune 50.23±28.1subscript50.23plus-or-minus28.150.23_{\pm 28.1}50.23 start_POSTSUBSCRIPT ± 28.1 end_POSTSUBSCRIPT 46.07±25.8subscript46.07plus-or-minus25.846.07_{\pm 25.8}46.07 start_POSTSUBSCRIPT ± 25.8 end_POSTSUBSCRIPT 55.22±30.8subscript55.22plus-or-minus30.855.22_{\pm 30.8}55.22 start_POSTSUBSCRIPT ± 30.8 end_POSTSUBSCRIPT
lexlms/legal-longformer-large 434M Fine-tune 37.63±34.4subscript37.63plus-or-minus34.437.63_{\pm 34.4}37.63 start_POSTSUBSCRIPT ± 34.4 end_POSTSUBSCRIPT 34.26±31.3subscript34.26plus-or-minus31.334.26_{\pm 31.3}34.26 start_POSTSUBSCRIPT ± 31.3 end_POSTSUBSCRIPT 41.76±38.1subscript41.76plus-or-minus38.141.76_{\pm 38.1}41.76 start_POSTSUBSCRIPT ± 38.1 end_POSTSUBSCRIPT
joelito-legal-english-roberta-large 355M Fine-tune 58.92±4.28subscript58.92plus-or-minus4.2858.92_{\pm 4.28}58.92 start_POSTSUBSCRIPT ± 4.28 end_POSTSUBSCRIPT 52.88±4.95subscript52.88plus-or-minus4.9552.88_{\pm 4.95}52.88 start_POSTSUBSCRIPT ± 4.95 end_POSTSUBSCRIPT 66.59±3.22subscript66.59plus-or-minus3.2266.59_{\pm 3.22}66.59 start_POSTSUBSCRIPT ± 3.22 end_POSTSUBSCRIPT
Falcon 7B QLoRA 1.00±0.50subscript1.00plus-or-minus0.501.00_{\pm 0.50}1.00 start_POSTSUBSCRIPT ± 0.50 end_POSTSUBSCRIPT 39.50±16.8subscript39.50plus-or-minus16.839.50_{\pm 16.8}39.50 start_POSTSUBSCRIPT ± 16.8 end_POSTSUBSCRIPT 0.50±0.20subscript0.50plus-or-minus0.200.50_{\pm 0.20}0.50 start_POSTSUBSCRIPT ± 0.20 end_POSTSUBSCRIPT
Llama-2 7B QLoRA 16.3±4.10subscript16.3plus-or-minus4.1016.3_{\pm 4.10}16.3 start_POSTSUBSCRIPT ± 4.10 end_POSTSUBSCRIPT 34.10±11.1subscript34.10plus-or-minus11.134.10_{\pm 11.1}34.10 start_POSTSUBSCRIPT ± 11.1 end_POSTSUBSCRIPT 11.20±2.60subscript11.20plus-or-minus2.6011.20_{\pm 2.60}11.20 start_POSTSUBSCRIPT ± 2.60 end_POSTSUBSCRIPT
OpenAI GPT-3.5 175B Few-shot 2.77±0.12subscript2.77plus-or-minus0.122.77_{\pm 0.12}2.77 start_POSTSUBSCRIPT ± 0.12 end_POSTSUBSCRIPT 1.78±0.08subscript1.78plus-or-minus0.081.78_{\pm 0.08}1.78 start_POSTSUBSCRIPT ± 0.08 end_POSTSUBSCRIPT 6.23±0.29subscript6.23plus-or-minus0.296.23_{\pm 0.29}6.23 start_POSTSUBSCRIPT ± 0.29 end_POSTSUBSCRIPT
OpenAI GPT-4 - Few-shot 13.55±0.54subscript13.55plus-or-minus0.5413.55_{\pm 0.54}13.55 start_POSTSUBSCRIPT ± 0.54 end_POSTSUBSCRIPT 8.29±0.37subscript8.29plus-or-minus0.378.29_{\pm 0.37}8.29 start_POSTSUBSCRIPT ± 0.37 end_POSTSUBSCRIPT 37.1±0.99subscript37.1plus-or-minus0.9937.1_{\pm 0.99}37.1 start_POSTSUBSCRIPT ± 0.99 end_POSTSUBSCRIPT
Table 2: Entity-specific F1 score for the best-performing NER model, ‘roberta-base‘.
LAW VIOLATION VIOLATED BY VIOLATED ON
77.57±1.35subscript77.57plus-or-minus1.3577.57_{\pm 1.35}77.57 start_POSTSUBSCRIPT ± 1.35 end_POSTSUBSCRIPT 59.06±0.55subscript59.06plus-or-minus0.5559.06_{\pm 0.55}59.06 start_POSTSUBSCRIPT ± 0.55 end_POSTSUBSCRIPT 76.88±2.06subscript76.88plus-or-minus2.0676.88_{\pm 2.06}76.88 start_POSTSUBSCRIPT ± 2.06 end_POSTSUBSCRIPT 62.83±2.57subscript62.83plus-or-minus2.5762.83_{\pm 2.57}62.83 start_POSTSUBSCRIPT ± 2.57 end_POSTSUBSCRIPT

4 Human Expert Annotations

Data validation holds particular importance in our study due to the synthetic nature of the dataset. To ensure that the dataset is both realistic and challenging, we have implemented several validation methods. In this structured process, summaries of complaint documents and tasks for the NER and NLI models were generated automatically. Legal experts then carefully examined these auto-generated summaries and tasks. Their primary role was to meticulously review each output, ensuring that the summaries accurately reflected the key points of the complaints and that the tasks were correctly aligned with the context provided by these summaries. Additionally, each record was subjected to examination by several annotators, which serves to reduce potential bias in the evaluation. These annotators were tasked with identifying and suggesting any missing entities, as well as in checking for hallucinations—instances where the generated content might stray from factual accuracy. To maintain a rigorous and unbiased validation, all annotators received identical instructions, and the data presented to them was systematically shuffled. Their detailed examination was crucial in pinpointing discrepancies, unclear areas, or potential inaccuracies in both the summaries and the associated tasks. This thorough validation process, attentive to both content accuracy and the prevention of hallucinations and bias through multiple annotators review, ensures the integrity and quality of our synthetic dataset. Figure 4 in Appendix B presents a screenshot of the annotation platform we used.

Upon further examination of our data, a comparison between machine-generated and human-authored content revealed significant similarities. This comparison involved analyzing various linguistic and structural features of the texts. Both displayed identical average sentence lengths. Moreover, there was not significant difference between the character count between the generated content and the human-authored text. Additionally, when comparing the POS tags between the real text and the generated text, by averaging the total counts of each tag occurrences, the average difference was found to be 26% and the median was 16%.

A key part of our validation process was the classification task. In this task, three independent annotators had to distinguish between machine-generated and human-written records, a challenge also noted in recent research Mitchell et al. (2023); Kirchenbauer et al. (2023). Our annotators’ goal was to label each record based on its origin: machine-generated or human-written. The annotators achieved an average F1-score of 44.86%. However, their Cohen’s Kappa scores, which were 0.0821, 0.2149, and 0.0988, showed only minor agreement among them. This low level of agreement, as indicated by Cohen’s Kappa scores, points out the complexity of the task. It also suggests that our machine-generated content closely resembled human writing, making it difficult even for experts to tell them apart. The use of Cohen’s Kappa in our study is supported by its well-known effectiveness in binary classification tasks, especially in data annotation scenarios Wang et al. (2019).

5 Experiments

In this section, we explore several methods to tackle the challenging and realistic setups that we created. More precisely, we analyzed the performance of language models on these setups by conducting three sets of experiments. (1) We evaluated models that are inspired by the BERT architecture through the process of fine-tuning Sun et al. (2020). (2) We explored LLMs such as Falcon-7B, Llama-2-7B and Llama-2-13B through the process of parameter efficient fine-tuning Houlsby et al. (2019); Hu et al. (2021). (3) Thanks to their out-of-the-box generalization capabilities, we assessed OpenAI’s GPT-3.5 Brown et al. (2020) and GPT-4 OpenAI (2023) models.

5.1 Setup

NER

Our dataset is categorized by Cause of Action (CoA). CoA refers to a set of facts or legal reasons that justify the right to sue or seek legal remedy in a court of law. Due to the potential overlap and similarities between different CoAs, there’s a risk of data leakage when training models. To mitigate this, we adopted a strategy where CoAs present in the training set were excluded from the test set. This ensures that the model is evaluated on entirely distinct CoAs, preventing any inadvertent training on test data.

NLI

Our dataset contains news articles across four legal domains. Given the similarities in the legal merits between these domains, there is a potential risk of data leakage related to the legal attributes of the cases. To address this issue, we employed a leave-one-out approach. In this method, we tested each legal domain separately while training the model on the other domains. This ’leave-one-out’ method strengthens the model’s ability to generalize by ensuring it is evaluated on entirely unseen data, reducing the risk of overfitting by its small size. By exposing the model to a variety of legal domains during training, but withholding one domain for testing, we mimic real-world scenarios where the model will encounter previously unseen data.

5.2 Model Classes

BERT Models

In this setting, we assess the effectiveness of transformer-based language models Vaswani et al. (2017). We fine-tuned RoBERTa Liu et al. (2019), DistilBERT Sanh et al. (2019) and BERT Devlin et al. (2018) models. Additionally, we evaluated their legal counterparts, i.e., Legal-BERT Chalkidis et al. (2020) and Legal-RoBERTa Chalkidis* et al. (2023). Furthermore, we evaluated models Mamakas et al. (2022) based on the Longformer architecture Beltagy et al. (2020). Following this, we also assessed the Legal-English-RoBERTa models, which are specialized versions tailored for legal English Niklaus et al. (2023). We utilized the AutoModel family classes from the HuggingFace Transformers library to train the models. Each model was trained for 10 epochs with an initial learning rate of 2e52𝑒52e-52 italic_e - 5. In addition, we used early-stop** to prevent overfitting.

Open-Source LLMs

In this setting, we evaluated Falcon Almazrouei et al. (2023) and Llama2s Touvron et al. (2023) performance. More precisely, we considered the 7 billion parametric version of Falcon, and 7 and 13 billion versions of Llama2. Following the success of Parameter Efficient Fine-Tuning methodologies for fine-tuning LLMs, we leveraged QLoRA Dettmers et al. (2023) due to its superior performance over other methods. Figure 8 shows the prompt that we designed to guide the tuning process.

The prompt has two parts: Input and Output. The Input contains the sentence on which NER and NLI have to be performed. The Output contains the format in which the LLM has to predict the entities contained in the sentence. It is important to note that during inference, we prompt the model to generate the required output by only including the Input section.

We employed HuggingFace’s AutoModelForCausalLM class for fine-tuning, available under an Apache-2.0 license222https://github.com/huggingface/transformers. Each model underwent training for 20 epochs with an initial learning rate of 2e-4, a QLoRA rank of 64, and a dropout rate of 0.25. We used this configuration across both NER and NLI tasks.

Closed-Source LLMs

We evaluate OpenAI’s GPT-4 OpenAI (2023) and OpenAI’s GPT-3.5 Brown et al. (2020) models for few-shot NER and NLI without any fine-tuning, using the matching production models of August 2023. We use the Langchain333https://github.com/langchain-ai/langchain client, available under an Apache-2.0 license, with few-shot prompts, as demonstrated in Figure 9. In all experiments, we set the temperature to 0.7 and used 9 random samples from the training dataset as few-shot examples. We employed the same prompts as those used for open-source models and the same evaluation mechanism. Each API call was repeated five times.

Table 3: Macro F1 evaluation of various model architectures for the NLI task across different legal entities.
Model Consumer Protection Privacy TCPA Wage
nlpaueb-legal-bert-small-uncased 60.8±7.1subscript60.8plus-or-minus7.160.8_{\pm 7.1}60.8 start_POSTSUBSCRIPT ± 7.1 end_POSTSUBSCRIPT 49.6±14.subscript49.6plus-or-minus1449.6_{\pm 14.}49.6 start_POSTSUBSCRIPT ± 14 . end_POSTSUBSCRIPT 47.6±11.subscript47.6plus-or-minus1147.6_{\pm 11.}47.6 start_POSTSUBSCRIPT ± 11 . end_POSTSUBSCRIPT 56.7±6.0subscript56.7plus-or-minus6.056.7_{\pm 6.0}56.7 start_POSTSUBSCRIPT ± 6.0 end_POSTSUBSCRIPT
distilbert-base-uncased 79.8±2.0subscript79.8plus-or-minus2.079.8_{\pm 2.0}79.8 start_POSTSUBSCRIPT ± 2.0 end_POSTSUBSCRIPT 53.9±13.subscript53.9plus-or-minus1353.9_{\pm 13.}53.9 start_POSTSUBSCRIPT ± 13 . end_POSTSUBSCRIPT 72.1±9.3subscript72.1plus-or-minus9.372.1_{\pm 9.3}72.1 start_POSTSUBSCRIPT ± 9.3 end_POSTSUBSCRIPT 71.2±7.3subscript71.2plus-or-minus7.371.2_{\pm 7.3}71.2 start_POSTSUBSCRIPT ± 7.3 end_POSTSUBSCRIPT
bert-base-cased 65.5±9.2subscript65.5plus-or-minus9.265.5_{\pm 9.2}65.5 start_POSTSUBSCRIPT ± 9.2 end_POSTSUBSCRIPT 39.9±18.subscript39.9plus-or-minus1839.9_{\pm 18.}39.9 start_POSTSUBSCRIPT ± 18 . end_POSTSUBSCRIPT 58.9±16.subscript58.9plus-or-minus1658.9_{\pm 16.}58.9 start_POSTSUBSCRIPT ± 16 . end_POSTSUBSCRIPT 65.5±13.subscript65.5plus-or-minus1365.5_{\pm 13.}65.5 start_POSTSUBSCRIPT ± 13 . end_POSTSUBSCRIPT
bert-base-uncased 69.3±7.7subscript69.3plus-or-minus7.769.3_{\pm 7.7}69.3 start_POSTSUBSCRIPT ± 7.7 end_POSTSUBSCRIPT 36.3±16.subscript36.3plus-or-minus1636.3_{\pm 16.}36.3 start_POSTSUBSCRIPT ± 16 . end_POSTSUBSCRIPT 69.5±7.2subscript69.5plus-or-minus7.269.5_{\pm 7.2}69.5 start_POSTSUBSCRIPT ± 7.2 end_POSTSUBSCRIPT 64.0±16.subscript64.0plus-or-minus1664.0_{\pm 16.}64.0 start_POSTSUBSCRIPT ± 16 . end_POSTSUBSCRIPT
roberta-base 82.9±4.5subscript82.9plus-or-minus4.582.9_{\pm 4.5}82.9 start_POSTSUBSCRIPT ± 4.5 end_POSTSUBSCRIPT 62.0±5.0subscript62.0plus-or-minus5.062.0_{\pm 5.0}62.0 start_POSTSUBSCRIPT ± 5.0 end_POSTSUBSCRIPT 69.5±31.subscript69.5plus-or-minus3169.5_{\pm 31.}69.5 start_POSTSUBSCRIPT ± 31 . end_POSTSUBSCRIPT 69.7±29.subscript69.7plus-or-minus2969.7_{\pm 29.}69.7 start_POSTSUBSCRIPT ± 29 . end_POSTSUBSCRIPT
lexlms-legal-roberta-base 45.8±5.8subscript45.8plus-or-minus5.845.8_{\pm 5.8}45.8 start_POSTSUBSCRIPT ± 5.8 end_POSTSUBSCRIPT 27.3±7.9subscript27.3plus-or-minus7.927.3_{\pm 7.9}27.3 start_POSTSUBSCRIPT ± 7.9 end_POSTSUBSCRIPT 48.6±14.subscript48.6plus-or-minus1448.6_{\pm 14.}48.6 start_POSTSUBSCRIPT ± 14 . end_POSTSUBSCRIPT 44.4±19.subscript44.4plus-or-minus1944.4_{\pm 19.}44.4 start_POSTSUBSCRIPT ± 19 . end_POSTSUBSCRIPT
joelito-legal-english-roberta-base 61.6±14.2subscript61.6plus-or-minus14.261.6_{\pm 14.2}61.6 start_POSTSUBSCRIPT ± 14.2 end_POSTSUBSCRIPT 33.1±12.2subscript33.1plus-or-minus12.233.1_{\pm 12.2}33.1 start_POSTSUBSCRIPT ± 12.2 end_POSTSUBSCRIPT 55.8±9.95subscript55.8plus-or-minus9.9555.8_{\pm 9.95}55.8 start_POSTSUBSCRIPT ± 9.95 end_POSTSUBSCRIPT 48.6±17.9subscript48.6plus-or-minus17.948.6_{\pm 17.9}48.6 start_POSTSUBSCRIPT ± 17.9 end_POSTSUBSCRIPT
lexlms-legal-longformer-base 58.3±16.subscript58.3plus-or-minus1658.3_{\pm 16.}58.3 start_POSTSUBSCRIPT ± 16 . end_POSTSUBSCRIPT 27.8±4.6subscript27.8plus-or-minus4.627.8_{\pm 4.6}27.8 start_POSTSUBSCRIPT ± 4.6 end_POSTSUBSCRIPT 54.8±11.subscript54.8plus-or-minus1154.8_{\pm 11.}54.8 start_POSTSUBSCRIPT ± 11 . end_POSTSUBSCRIPT 54.5±11.subscript54.5plus-or-minus1154.5_{\pm 11.}54.5 start_POSTSUBSCRIPT ± 11 . end_POSTSUBSCRIPT
lexlms-legal-roberta-large 18.1±0.7subscript18.1plus-or-minus0.718.1_{\pm 0.7}18.1 start_POSTSUBSCRIPT ± 0.7 end_POSTSUBSCRIPT 20.2±8.1subscript20.2plus-or-minus8.120.2_{\pm 8.1}20.2 start_POSTSUBSCRIPT ± 8.1 end_POSTSUBSCRIPT 15.3±1.8subscript15.3plus-or-minus1.815.3_{\pm 1.8}15.3 start_POSTSUBSCRIPT ± 1.8 end_POSTSUBSCRIPT 16.6±0.0subscript16.6plus-or-minus0.016.6_{\pm 0.0}16.6 start_POSTSUBSCRIPT ± 0.0 end_POSTSUBSCRIPT
lexlms-legal-longformer-large 19.2±1.3subscript19.2plus-or-minus1.319.2_{\pm 1.3}19.2 start_POSTSUBSCRIPT ± 1.3 end_POSTSUBSCRIPT 17.5±0.6subscript17.5plus-or-minus0.617.5_{\pm 0.6}17.5 start_POSTSUBSCRIPT ± 0.6 end_POSTSUBSCRIPT 25.5±24.subscript25.5plus-or-minus2425.5_{\pm 24.}25.5 start_POSTSUBSCRIPT ± 24 . end_POSTSUBSCRIPT 26.3±21.subscript26.3plus-or-minus2126.3_{\pm 21.}26.3 start_POSTSUBSCRIPT ± 21 . end_POSTSUBSCRIPT
joelito-legal-english-roberta-large 16.4±3.3subscript16.4plus-or-minus3.316.4_{\pm 3.3}16.4 start_POSTSUBSCRIPT ± 3.3 end_POSTSUBSCRIPT 20.2±5.8subscript20.2plus-or-minus5.820.2_{\pm 5.8}20.2 start_POSTSUBSCRIPT ± 5.8 end_POSTSUBSCRIPT 47.3±30.3subscript47.3plus-or-minus30.347.3_{\pm 30.3}47.3 start_POSTSUBSCRIPT ± 30.3 end_POSTSUBSCRIPT 27.3±23.9subscript27.3plus-or-minus23.927.3_{\pm 23.9}27.3 start_POSTSUBSCRIPT ± 23.9 end_POSTSUBSCRIPT
Falcon 7B 87.2±3.1plus-or-minus3.1{}_{\pm\textbf{3.1}}start_FLOATSUBSCRIPT ± 3.1 end_FLOATSUBSCRIPT 84.5±8.8plus-or-minus8.8{}_{\pm\textbf{8.8}}start_FLOATSUBSCRIPT ± 8.8 end_FLOATSUBSCRIPT 83.9±0.9plus-or-minus0.9{}_{\pm\textbf{0.9}}start_FLOATSUBSCRIPT ± 0.9 end_FLOATSUBSCRIPT 68.5 ±11.plus-or-minus11{}_{\pm 11.}start_FLOATSUBSCRIPT ± 11 . end_FLOATSUBSCRIPT
Llama-2 7B 47.2±5.9subscript47.2plus-or-minus5.947.2_{\pm 5.9}47.2 start_POSTSUBSCRIPT ± 5.9 end_POSTSUBSCRIPT 47.8±10.subscript47.8plus-or-minus1047.8_{\pm 10.}47.8 start_POSTSUBSCRIPT ± 10 . end_POSTSUBSCRIPT 63.5±7.3subscript63.5plus-or-minus7.363.5_{\pm 7.3}63.5 start_POSTSUBSCRIPT ± 7.3 end_POSTSUBSCRIPT 63.7±14.subscript63.7plus-or-minus1463.7_{\pm 14.}63.7 start_POSTSUBSCRIPT ± 14 . end_POSTSUBSCRIPT
Llama-2 13B 63.1±8.0subscript63.1plus-or-minus8.063.1_{\pm 8.0}63.1 start_POSTSUBSCRIPT ± 8.0 end_POSTSUBSCRIPT 75.2±6.5subscript75.2plus-or-minus6.575.2_{\pm 6.5}75.2 start_POSTSUBSCRIPT ± 6.5 end_POSTSUBSCRIPT 63.9±10.subscript63.9plus-or-minus1063.9_{\pm 10.}63.9 start_POSTSUBSCRIPT ± 10 . end_POSTSUBSCRIPT 86.5±5.6plus-or-minus5.6{}_{\pm\textbf{5.6}}start_FLOATSUBSCRIPT ± 5.6 end_FLOATSUBSCRIPT
OpenAI GPT-3.5 17.8±2.6subscript17.8plus-or-minus2.617.8_{\pm 2.6}17.8 start_POSTSUBSCRIPT ± 2.6 end_POSTSUBSCRIPT 18.12±3.1subscript18.12plus-or-minus3.118.12_{\pm 3.1}18.12 start_POSTSUBSCRIPT ± 3.1 end_POSTSUBSCRIPT 15.09±1.9subscript15.09plus-or-minus1.915.09_{\pm 1.9}15.09 start_POSTSUBSCRIPT ± 1.9 end_POSTSUBSCRIPT 12.91±5.4subscript12.91plus-or-minus5.412.91_{\pm 5.4}12.91 start_POSTSUBSCRIPT ± 5.4 end_POSTSUBSCRIPT
OpenAI GPT-4 49.83±19.subscript49.83plus-or-minus1949.83_{\pm 19.}49.83 start_POSTSUBSCRIPT ± 19 . end_POSTSUBSCRIPT 48.44±9.4subscript48.44plus-or-minus9.448.44_{\pm 9.4}48.44 start_POSTSUBSCRIPT ± 9.4 end_POSTSUBSCRIPT 37.04±7.4subscript37.04plus-or-minus7.437.04_{\pm 7.4}37.04 start_POSTSUBSCRIPT ± 7.4 end_POSTSUBSCRIPT 52.48±11.6subscript52.48plus-or-minus11.652.48_{\pm 11.6}52.48 start_POSTSUBSCRIPT ± 11.6 end_POSTSUBSCRIPT

6 Results

6.1 NER

Table 1 presents the performance metrics of various models. Interestingly, BERT-based models with fewer parameters outperform LLMs by a significant margin. This disparity in performance is due to the difference in objective functions that the different model classes use. BERT-based models employ the cross-entropy objective function per token, providing a stronger gradient signal. Furthermore, the label space is well constrained by the number of possible entities in our data set. On the other hand, LLMs have been fine-tuned via causal language modeling, wherein the task is to learn the joint probability distribution of all tokens by maximizing the likelihood of the data. The gradient signal in the case of fine-tuning LLMs is not as fine-grained as cross-entropy. This is because the label space, i.e., the number of possibilities to predict the next token from, far exceeds the number of required entities.

Across BERT-based models, we notice interesting trends. First, roberta-base model attains the best performances, achieving an F1 score of 62.69%percent62.6962.69\%62.69 % and Recall of 70.3%percent70.370.3\%70.3 %. Second, the performance across all metrics improved as model complexity grew, except for Longformer-based models and joelito-legal-english-roberta-based models.

Focusing on LLMs, we observed that both open-source and close-source models perform poorly on this task. Closer analysis of predictions indicated incorrect B-token prediction in generated text. These errors were propagated to the next predictions, causing the LLMs to misclassify the tokens and place them into incorrect entities.

6.2 NLI

Table 3 shows domain-specific performances across all model classes. In contrary to trends discovered in the NER experiments, in NLI we noticed that LLMs outperform BERT-based models by a very significant margin. Unlike NER, in NLI, LLMs are fine-tuned to predict only one token, i.e., either of entailed, contradict, and neutral. Additionally, the NLI task had only 312 samples, and LLMs learn relatively better in low data situations and generalize well to out-of-distribution (OOD) test data sets Brown et al. (2020).

Except for domain Wage, Falcon 7B achieved the highest performance across domains (Consumer Protection, Privacy, and TCPA). Falcon 7B attained the highest Macro F1 metric, demonstrating its OOD capabilities. Among BERT-based models, roberta-base once again achieved the best performance, similar to NER tasks.

7 Error Analysis

To improve our models and enrich our understanding, we conducted a thorough error analysis of top-performing models across tasks. This analysis identifies their limitations, providing a clear roadmap for future refinements.

7.1 NER

In evaluating our NER model, the entity type "VIOLATION" exhibited the lowest F1 score. This entity is often lengthy and contextually complex, making it a challenging target for accurate identification. We conducted an error analysis on a subset of hard cases to understand the model’s limitations.

The errors fall into three categories: truncation errors, context misunderstanding, and incorrect entity identification. For instance, in the sentence "I’ve been getting these [VIOLATION] constant calls on my cell phone from some company that won’t quit [VIOLATION].", the model predicted "constant calls on" instead of the actual entity. This truncation error suggests the model captures only the initial segment but fails to include the entire scope. In another example, "They’ve been [VIOLATION] failing to disclose that their educational programs were underperforming [VIOLATION].", the model predicted "disclose", indicating a context misunderstanding. Notably, when the model completely misses the target, it often predicts a much shorter entity, suggesting a bias towards shorter answers when uncertain.

The model struggles with the "VIOLATION" entity type, particularly with longer and more complex entities. Fine-tuning the model with a diverse, context-rich training set could improve its performance. Existing literature also suggests that NER models often struggle with complex entities Dai (2018), underscoring the need for continued research in this area.

Refer to caption
Figure 2: NLI Confusion Matrix derived from the top performer model (Falcon 7B’s) predictions.

7.2 NLI

In the error analysis of our best performing NLI model, Falcon 7B, we consolidated the model errors across different legal domains to form a comprehensive view. Our focus was on two types of classification errors: first-class errors, which involve confusions between "Contradict" and "Entailed", and second-class errors, which are misclassifications of "Contradict" or "Entailed" as "Neutral". Figure 2 shows that while Falcon 7B performs well in avoiding first-class errors, it exhibits a substantial number of second-class errors. The high rate of such errors indicates that the model finds it challenging to handle more nuanced cases where it is difficult to discern whether the person was affected by the violation or not.

Although Falcon 7B outperforms other models in this task, it strugglesin accurately classifying statements related to wage areas. This could be attributed to the complexities and ambiguities of the wage norms, which make it challenging to clearly determine whether a wage violation has occurred. Therefore, investigating different token lengths to provide more context or fine-tuning the model to better navigate these intricate wage scenarios could be valuable directions for future work.

8 Conclusions and Future Work

8.1 Answers to the Research Questions

RQ1: To what extent do our newly introduced datasets enhance the performance of language models in identifying legal violations within unstructured text and associate victims to them? The study introduced new entities in the datasets. This addition improved the ability of language models to identify legal violations in unstructured text. With these new entities, the roberta-base model achieved an F1-score of 62.69% in identifying violations and 81.02% (Falcon 7B model) in linking them to victims. This demonstrates that our new approach, which focuses on identifying and associating violations to victims, has been successful, yet there remains potential for further refinements and improvements.

RQ2: How effectively do the language models adapt to new, unseen data for the purpose of identifying legal violations and correlating them with past resolved cases across different legal domains? Our experiments assessed language models’ adaptability to unseen data, especially in the context of identifying legal violations and correlating them with past resolved cases across different legal domains. While BERT-based models demonstrated strong performance in certain tasks, LLMs like Falcon-7B excelled in low-data scenarios, particularly in associating violations with resolved cases. This suggests that these models effectively adapt to new data, especially when the data is limited.

RQ3: What is the level of difference between machine-generated and human-generated text in the context of legal violation identification? Our validation process involved a comparison between machine-generated and human-authored content. The findings revealed that the two types of content were strikingly similar in terms of average sentence lengths and character count. When expert annotators were tasked to distinguish between machine-generated and human-written records, they achieved an average F1-score of 44.86%. The low level of agreement among the annotators indicates that our machine-generated content closely resembles human writing, making it challenging even for experts to differentiate between the two.

8.2 Conclusion

In this study, by leveraging LLMs and expert validation, we introduced a dual setup approach to identify legal violations from text. Our approach uses (1) NER to pinpoint violations, resulting in an F1-score of 62. 69% and (2) NLI to associate these violations with resolved cases, resulting in an F1-score of 81.02%. We created two specialized datasets to advance research in this field.

8.3 Future Work

Expanding Legal Areas

In future iterations, we aim to expand the dataset to include a broader range of legal areas. By incorporating diverse legal texts, we hope to create a more representative dataset for legal violation identification.

Incorporating Multiple Jurisdictions

While our current dataset is heavily focused on common law in US courts, future work will aim to integrate legal texts from various global jurisdictions, including civil law systems. This will not only enhance the datasets diversity but also improve the robustness and applicability of models trained on it.

Fact Matching

An avenue for future work is the integration of fact matching. Develo** algorithms for cross-referencing facts across sources can enhance the accuracy of legal violation identification, especially when a single source might not provide a complete picture. Thorne et al. (2018); Jiang et al. (2020)

Limitations

Focus on Common Law in US Courts

A primary limitation of our dataset is its focus on US common law. While this deepens understanding of US legal principles and precedents, it may not apply to civil law jurisdictions or non-US legal systems. The nuances, interpretations, and applications of laws can vary significantly across different jurisdictions, and our dataset, being US-centric, might not capture these variations adequately.

Coverage of Areas of Law

While our dataset provides a comprehensive overview of legal violations from various text sources, it does have its limitations in terms of the breadth of legal areas covered. The current dataset predominantly focuses on specific areas of law, potentially overlooking nuances and intricacies of other legal domains. For instance, while we have extensively covered areas like consumer protection and privacy, other equally significant areas such as intellectual property, environmental law, or international law might not have been represented with the same depth.

Ethics Statement

The primary objective of this research is to revolutionize the identification and understanding of legal violations within the sprawling landscape of online text. By introducing a novel dataset specifically tailored for Named Entity Recognition (NER) and Natural Language Inference (NLI) tasks in the legal context, we aim to significantly advance the field of Natural Language Processing (NLP) and its applications in law. Our research holds the potential to greatly assist legal professionals in efficiently identifying and addressing legal violations, thereby contributing to a safer and more equitable digital society.

In the pursuit of this objective, we have employed LLMs, specifically GPT-4 OpenAI (2023), for data generation, and have subjected the generated data to rigorous validation by expert annotators. This dual-layered approach ensures the quality and reliability of our dataset, while also providing a comprehensive range of examples that can be generalized across various domains.

However, we acknowledge that the deployment of machine learning models in the legal domain is fraught with ethical considerations Tsarapatsanis and Aletras (2021). Automating the detection of legal violations could inadvertently lead to false positives or negatives, with serious implications for individual rights and the rule of law. Therefore, we stress that our technology is intended to serve as a supplementary tool for legal professionals, rather than a replacement. It is essential that any application of our dataset and subsequent models be conducted responsibly with a thorough understanding of the limitations and biases that may be inherent in automated systems.

Moreover, we recognize the ethical imperative of data privacy and confidentiality, especially given the sensitive nature of legal texts. All data used in this research have been anonymized and stripped of personally identifiable information to the best of our ability, in compliance with relevant data protection regulations. All the data utilized in this study is sourced from publicly accessible online platforms and does not infringe on any individuals or entities proprietary rights.

Acknowledgements

We express our gratitude to the annotation group at Darrow.ai for their contributions to the dataset.

References

  • Almazrouei et al. (2023) Ebtesam Almazrouei, Hamza Alobeidli, Abdulaziz Alshamsi, Alessandro Cappelli, Ruxandra Cojocaru, Merouane Debbah, Etienne Goffinet, Daniel Heslow, Julien Launay, Quentin Malartic, Badreddine Noune, Baptiste Pannier, and Guilherme Penedo. 2023. Falcon-40B: an open large language model with state-of-the-art performance.
  • Amaral et al. (2023) Orlando Amaral, Muhammad Ilyas Azeem, Sallam Abualhaija, and Lionel C Briand. 2023. Nlp-based automated compliance checking of data processing agreements against gdpr. IEEE Transactions on Software Engineering.
  • Angelidis et al. (2018) Iosif Angelidis, Ilias Chalkidis, and Manolis Koubarakis. 2018. Named entity recognition, linking and generation for greek legislation. In JURIX, pages 1–10.
  • Beltagy et al. (2020) Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The long-document transformer. CoRR, abs/2004.05150.
  • Brown et al. (2020) Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901.
  • Cao and Wang (2022) Shuyang Cao and Lu Wang. 2022. Time-aware prompting for text generation. arXiv preprint arXiv:2211.02162.
  • Chalkidis et al. (2020) Ilias Chalkidis, Manos Fergadiotis, Prodromos Malakasiotis, Nikolaos Aletras, and Ion Androutsopoulos. 2020. LEGAL-BERT: the muppets straight out of law school. CoRR, abs/2010.02559.
  • Chalkidis* et al. (2023) Ilias Chalkidis*, Nicolas Garneau*, Catalina Goanta, Daniel Martin Katz, and Anders Søgaard. 2023. LeXFiles and LegalLAMA: Facilitating English Multinational Legal Language Model Development. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics, Toronto, Canada. Association for Computational Linguistics.
  • Dai (2018) Xiang Dai. 2018. Recognizing complex entity mentions: A review and future directions. In Proceedings of ACL 2018, Student Research Workshop, pages 37–44.
  • Dettmers et al. (2023) Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. 2023. Qlora: Efficient finetuning of quantized llms.
  • Devlin et al. (2018) Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805.
  • Ding et al. (2022) Bosheng Ding, Chengwei Qin, Linlin Liu, Lidong Bing, Shafiq Joty, and Boyang Li. 2022. Is gpt-3 a good data annotator? arXiv preprint arXiv:2212.10450.
  • Dozier et al. (2010) Christopher Dozier, Ravikumar Kondadadi, Marc Light, Arun Vachher, Sriharsha Veeramachaneni, and Ramdev Wudali. 2010. Named entity recognition and resolution in legal text. Springer.
  • Gu et al. (2021) Xiaodong Gu, Kang Min Yoo, and Sang-Woo Lee. 2021. Response generation with context-aware prompt learning. arXiv preprint arXiv:2111.02643.
  • Hämäläinen et al. (2023) Perttu Hämäläinen, Mikke Tavast, and Anton Kunnari. 2023. Evaluating large language models in generating synthetic hci research data: a case study. In Proceedings of the 2023 CHI Conference on Human Factors in Computing Systems, pages 1–19.
  • Houlsby et al. (2019) Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin de Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. 2019. Parameter-efficient transfer learning for nlp.
  • Hu et al. (2021) Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. 2021. Lora: Low-rank adaptation of large language models.
  • Jiang et al. (2020) Yichen Jiang, Shikha Bordia, Zheng Zhong, Charles Dognin, Maneesh Singh, and Mohit Bansal. 2020. Hover: A dataset for many-hop fact extraction and claim verification. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 3441–3460.
  • Kalamkar et al. (2022) Prathamesh Kalamkar, Astha Agarwal, Aman Tiwari, Smita Gupta, Saurabh Karn, and Vivek Raghavan. 2022. Named entity recognition in indian court judgments. arXiv preprint arXiv:2211.03442.
  • Kirchenbauer et al. (2023) John Kirchenbauer, Jonas Gei**, Yuxin Wen, Jonathan Katz, Ian Miers, and Tom Goldstein. 2023. A watermark for large language models. arXiv preprint arXiv:2301.10226.
  • Koreeda and Manning (2021) Yuta Koreeda and Christopher D Manning. 2021. Contractnli: A dataset for document-level natural language inference for contracts. arXiv preprint arXiv:2110.01799.
  • Leiker et al. (2023) Daniel Leiker, Sara Finnigan, Ashley Ricker Gyllen, and Mutlu Cukurova. 2023. Prototy** the use of large language models (llms) for adult learning content creation at scale. arXiv preprint arXiv:2306.01815.
  • Leitner et al. (2019) Elena Leitner, Georg Rehm, and Julian Moreno-Schneider. 2019. Fine-grained named entity recognition in legal documents. In International Conference on Semantic Systems, pages 272–287. Springer.
  • Leitner et al. (2020) Elena Leitner, Georg Rehm, and Julián Moreno-Schneider. 2020. A dataset of german legal documents for named entity recognition. arXiv preprint arXiv:2003.13016.
  • Liu et al. (2023) Pengfei Liu, Weizhe Yuan, **lan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. 2023. Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing. ACM Computing Surveys, 55(9):1–35.
  • Liu et al. (2019) Yinhan Liu, Myle Ott, Naman Goyal, **gfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized BERT pretraining approach. CoRR, abs/1907.11692.
  • Luz de Araujo et al. (2018) Pedro Henrique Luz de Araujo, Teófilo E de Campos, Renato RR de Oliveira, Matheus Stauffer, Samuel Couto, and Paulo Bermejo. 2018. Lener-br: a dataset for named entity recognition in brazilian legal text. In Computational Processing of the Portuguese Language: 13th International Conference, PROPOR 2018, Canela, Brazil, September 24–26, 2018, Proceedings 13, pages 313–323. Springer.
  • Mamakas et al. (2022) Dimitris Mamakas, Petros Tsotsi, Ion Androutsopoulos, and Ilias Chalkidis. 2022. Processing long legal documents with pre-trained transformers: Modding legalbert and longformer.
  • Mitchell et al. (2023) Eric Mitchell, Yoonho Lee, Alexander Khazatsky, Christopher D Manning, and Chelsea Finn. 2023. Detectgpt: Zero-shot machine-generated text detection using probability curvature. arXiv preprint arXiv:2301.11305.
  • Møller et al. (2023) Anders Giovanni Møller, Jacob Aarup Dalsgaard, Arianna Pera, and Luca Maria Aiello. 2023. Is a prompt and a few samples all you need? using gpt-4 for data augmentation in low-resource classification tasks. arXiv preprint arXiv:2304.13861.
  • Niklaus et al. (2023) Joel Niklaus, Veton Matoshi, Matthias Stürmer, Ilias Chalkidis, and Daniel E Ho. 2023. Multilegalpile: A 689gb multilingual legal corpus. arXiv preprint arXiv:2306.02069.
  • Nyffenegger et al. (2023) Alex Nyffenegger, Matthias Stürmer, and Joel Niklaus. 2023. Anonymity at risk? assessing re-identification capabilities of large language models.
  • OpenAI (2023) OpenAI. 2023. Gpt-4 technical report.
  • Ouyang et al. (2022) Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. 2022. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730–27744.
  • Păi\textcommabelows et al. (2021) Vasile Păi\textcommabelows, Maria Mitrofan, Carol Luca Gasan, Vlad Coneschi, and Alexandru Ianov. 2021. Named entity recognition in the romanian legal domain. In Proceedings of the Natural Legal Language Processing Workshop 2021, pages 9–18.
  • Puri et al. (2020) Raul Puri, Ryan Spring, Mostofa Patwary, Mohammad Shoeybi, and Bryan Catanzaro. 2020. Training question answering models from synthetic data. arXiv preprint arXiv:2002.09599.
  • Radford et al. (2019) Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9.
  • Rosenbaum et al. (2022a) Andy Rosenbaum, Saleh Soltan, Wael Hamza, Amir Saffari, Macro Damonte, and Isabel Groves. 2022a. Clasp: Few-shot cross-lingual data augmentation for semantic parsing. arXiv preprint arXiv:2210.07074.
  • Rosenbaum et al. (2022b) Andy Rosenbaum, Saleh Soltan, Wael Hamza, Yannick Versley, and Markus Boese. 2022b. Linguist: Language model instruction tuning to generate annotated utterances for intent classification and slot tagging. arXiv preprint arXiv:2209.09900.
  • Sanh et al. (2019) Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. 2019. Distilbert, a distilled version of BERT: smaller, faster, cheaper and lighter. CoRR, abs/1910.01108.
  • Savelka et al. (2023a) Jaromir Savelka, Kevin D Ashley, Morgan A Gray, Hannes Westermann, and Huihui Xu. 2023a. Can gpt-4 support analysis of textual data in tasks requiring highly specialized domain expertise? arXiv preprint arXiv:2306.13906.
  • Savelka et al. (2023b) Jaromir Savelka, Kevin D Ashley, Morgan A Gray, Hannes Westermann, and Huihui Xu. 2023b. Explaining legal concepts with augmented large language models (gpt-4). arXiv preprint arXiv:2306.09525.
  • Semo et al. (2022) Gil Semo, Dor Bernsohn, Ben Hagag, Gila Hayat, and Joel Niklaus. 2022. Classactionprediction: A challenging benchmark for legal judgment prediction of class action cases in the us. arXiv preprint arXiv:2211.00582.
  • Silva et al. (2020) Paulo Silva, Carolina Gonçalves, Carolina Godinho, Nuno Antunes, and Marilia Curado. 2020. Using nlp and machine learning to detect data privacy violations. In IEEE INFOCOM 2020 - IEEE Conference on Computer Communications Workshops (INFOCOM WKSHPS), pages 972–977.
  • Skylaki et al. (2020) Stavroula Skylaki, Ali Oskooei, Omar Bari, Nadja Herger, and Zac Kriegman. 2020. Named entity recognition in the legal domain using a pointer generator network. arXiv preprint arXiv:2012.09936.
  • Sun et al. (2020) Chi Sun, Xipeng Qiu, Yige Xu, and Xuan**g Huang. 2020. How to fine-tune bert for text classification?
  • Thorne et al. (2018) James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. 2018. Fever: a large-scale dataset for fact extraction and verification. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 809–819.
  • Touvron et al. (2023) Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, and Thomas Scialom. 2023. Llama 2: Open foundation and fine-tuned chat models.
  • Tsarapatsanis and Aletras (2021) Dimitrios Tsarapatsanis and Nikolaos Aletras. 2021. On the ethical limits of natural language processing on legal text. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 3590–3599.
  • Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. CoRR, abs/1706.03762.
  • Veselovsky et al. (2023) Veniamin Veselovsky, Manoel Horta Ribeiro, Akhil Arora, Martin Josifoski, Ashton Anderson, and Robert West. 2023. Generating faithful synthetic data with large language models: A case study in computational social science. arXiv preprint arXiv:2305.15041.
  • Veyseh et al. (2021) Amir Pouran Ben Veyseh, Viet Lai, Franck Dernoncourt, and Thien Huu Nguyen. 2021. Unleash gpt-2 power for event detection. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 6271–6282.
  • Wang et al. (2019) Juan Wang, Yongyi Yang, and Bin Xia. 2019. A simplified cohen’s kappa for use in binary classification data annotation tasks. IEEE Access, 7:164386–164397.
  • Wei et al. (2021) Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. 2021. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652.
  • Yu et al. (2020) Yaoquan Yu, Yuefeng Guo, Zhiyuan Zhang, Mengshi Li, Tianyao Ji, Wenhu Tang, and Qinghua Wu. 2020. Intelligent classification and automatic annotation of violations based on neural network language model. In 2020 International Joint Conference on Neural Networks (IJCNN), pages 1–7.

Appendix A Experiments Setting

All experiments were conducted on AWS g5.4xlarge instance, equipped with 1111 NVIDIA A10G GPU. The total GPU hours are 85. For each model, the reported metrics are obtained by computing the mean and standard deviation across five runs with randomly initialized weights. All code444https://github.com/darrow-labs/LegalLens and datasets (NER555https://huggingface.co/datasets/darrow-ai/LegalLensNER and NLI666https://huggingface.co/datasets/darrow-ai/LegalLensNLI) are available.

A.1 Library Versions

We used the following libraries and associated versions: python 3.8, transformers 4.31.0, seqeval 1.2.2, streamlit 1.25.0, datasets 2.14.2, evaluate 0.4.0, wandb 0.15.7, torch 2.0.1, accelerate 0.21.0, sentencepiece 0.1.99, google cloud aiplatform 1.28.1, openai 0.27.8, langchain 0.0.248, ipython 8.12.2, typer 0.9.0, nltk 3.8, matplotlib 3.7.2.

Refer to caption
Figure 3: Prompt design for generating NLI data set. Prompt contains the task description, specific instructions, and few-shot examples.

Appendix B Annotation Platform

Refer to caption
Figure 4: The platform for the human annotations.

We ran our annotation platform with the Argilla library 777https://github.com/argilla-io/argilla available under an Apache-2.0 license.

Figure 4 shows a screenshot of the annotation platform our human experts used.

Appendix C Data Distribution

Figure 5 shows the datasets tokens distribution.

Entity Description # Labeled Samples
LAW

Specific law or regulation breached.

292
VIOLATION

Content describing the violation.

1326
VIOLATED BY

Entity committing the violation.

292
VIOLATED ON

Victim or affected party.

292
Table 4: Distribution of the NER entities produced by the generation process (2202 in total).
Entity Description Labels # Labeled Samples
Consumer Protection

Deceptive advertising, fraud and unfair business practices.

16/17/29 62
Privacy

Unauthorized collection, use, or disclosure of personal data.

56/54/53 163
TCPA

Unauthorized telemarketing calls, faxes and text messages.

26/27/21 74
Wage

Illegal underpayment and unfair compensation practices by employers.

6/3/4 13
Table 5: Distribution of labeled samples across various legal domains for the NLI task. The number of samples is in the format of Contradiction/Neutral/Entailment.
Refer to caption
Figure 5: Token Distributions for (left) NER and (right) NLI.

Appendix D Prompts

In this appendix, we detail the data generation prompts utilized for the GPT-4 model. The prompts for the datasets creation are illustrated in Figures 6 and 3. Meanwhile, the prompts for fine-tuning can be found in Figure 8. The prompt for the Few-shot approach is depicted in Figure 9

Refer to caption
(a) Prompt design for Implicit NER data set. Prompt contains the task description, few-shot examples, and specific instructions.
Refer to caption
(b) Prompt design for Explicit NER data set. Prompt contains the task description, few-shot examples, and specific instructions.
Figure 6: The prompts used for generating the NER data set.
Refer to caption
Figure 7: (Top to Bottom) Iterations of prompt design for generating the Explicit NER data set. Prompts contain the task description, and few-shot examples. Figure 6-b contains the final version of prompt used.
Refer to caption
(a) Prompt design for NER. (Top) Training prompt, containing the input and output tags, input text, output text and corresponding NER tags. (Bottom) Inference prompt, containing only the input and output tags, input text.
Refer to caption
(b) Prompt design for NLI. (Top) Training prompt, containing the input and output tags, premise and hypothesis texts, and corresponding labels. (Bottom) Inference prompt, containing relevant tags, and premise and hypothesis texts.
Figure 8: The prompts used for fine-tuning open-source LLMs across (a) NER and (b) NLI tasks.
Refer to caption
Figure 9: Few-shot prompt designs for (top) NER and (below) NLI experiments using OpenAI GPT models. Prompts contain input, general task-specific instructions, labels for each task and few-shot examples.