<figure><img src="image_1.png" /></figure>

HAL
open science

# Case Law as Data: Prompt Engineering Strategies for Case Outcome Extraction with Large Language Models in a Zero-Shot Setting

Guillaume Zambrano

► To cite this version:

Guillaume Zambrano. Case Law as Data : Prompt Engineering Strategies for Case Outcome Extraction with Large Language Models in a Zero-Shot Setting. Law, Technology and Humans, 2024, 6 (3), pp.80 - 101. 10.5204/lthj.3623 . hal-04870063

HAL Id: hal-04870063

https://hal.science/hal-04870063v1

Submitted on 7 Jan 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Case Law as Data: Prompt Engineering Strategies for Case Outcome Extraction with Large Language Models in a Zero-Shot Setting

Guillaume Zambrano

University of Nîmes, France

## Abstract

This study evaluates the effectiveness of Large Language Models (LLMs) for automated legal outcome extraction in a zero-shot setting. Two open-source LLMs were used - Meta-Llama3 (70B) which is considered state-of-the-art and a less performant Mixtral (8x7B) - comparing the accuracy of the data extracted. These models were selected for their accessibility using consumer-grade hardware, ensuring reproducibility of our research. The experiment utilized a dataset of 400 manually annotated decisions from French Courts of Appeal, spanning four categories: psychiatric commitment, undocumented immigrant detention, wrongful termination damages, and workplace harassment damages. For each decision, we extracted two critical data points: the trial court outcome and the appellate court ruling. Results demonstrate that Llama3 achieves exceptional accuracy (1 error in 100 documents) in data extraction when provided with domain-specific prompts in JSON format. Prompt engineering can yield highly accurate legal data extraction without requiring expensive model fine-tuning or access to proprietary state-of-the-art models. This research contributes to the growing body of evidence supporting LLMs as reliable tools for legal information extraction and offers practical insights for researchers to craft effective instructions for their specific needs.

**Keywords:** Natural Language Processing; Large Language Models; LLMs; prompt engineering; data extraction; Legal Judgment Prediction.

## 1. Introduction

**Why data extraction matters?** In theory, empirical analysis of judges' decisions could reveal patterns that enable legal practitioners to predict the judicial outcome of a case. Legal Judgement Prediction (LJP) has become a popular field of investigation.<fnref n="1" /> Such predictive analytics have been a long-standing goal of Legal Realism, tracing back to Holmes' Prediction Theory of Law<fnref n="2" /> and Loevinger's Jurimetrics Theory.<fnref n="3" />

**The data extraction bottleneck.** Despite theoretical promises, empirical legal research faces a significant practical obstacle. The sheer quantity of documents creates a bottleneck in data extraction.<fnref n="4" /> For instance, in the United States, US District Courts terminated 293,677 civil cases in 2023, while French Court of appeals generated approximately 220,000 new judgments. Manual extraction by human experts is impossible at this scale, highlighting the need for automated solutions.<fnref n="5" /> The primary challenge lies in developing efficient and accurate Natural Language Processing (NLP) techniques to extract reliable data from raw text.

<figure><img src="image_3.png" /></figure>

<footnote n="1">¹ Bertalan, "Using Attention Methods to Predict Judicial Outcomes," 87–115.</footnote>

<footnote n="2">² Holmes, "The Path of The Law," 991-1009.</footnote>

<footnote n="3">³ Loevinger, "Jurimetrics: The Methodology of Legal Inquiry," 5-35.</footnote>

<footnote n="4">⁴ Santosuosso, "Bottleneck or Crossroad?," 376-395.</footnote>

<footnote n="5">⁵ Ashley, Artificial Intelligence and Legal Analytics.</footnote>
**LLMs for data extraction.** The present paper argues that zero-shot learning capabilities of Large Language Models (LLMs), make them an efficient solution for data extraction. Zero-shot learning refers to the ability of LLMs to perform tasks or answer questions without any specific training or fine-tuning for those particular tasks. During training, LLMs are presented with texts, where some words are randomly masked and the model is tasked with predicting the missing words,<fnref n="6" /> and will learn patterns in large datasets of billions of text. The natural ability of LLMs to predict the next most probable word makes them perfect tools for data extraction. The goal of this study is to show that, given precise enough instructions, State-Of-The-Art (SOTA) LLMs that can run on consumer grade hardware, already possess sufficient zero-shot capabilities for accurate extraction, with no need for further fine-tuning or bigger models.

## 2. Related Work

Legal artificial intelligence has gained significant attention in recent years,<fnref n="7" /> particularly regarding the implementation of LLMs for answering legal questions.<fnref n="8" /> Some research has centered on fine-tuning LLMs with legal documents to enhance their performance on standardized legal tasks, such as those encompassed in LegalBench.<fnref n="9" /> Although LLMs can effectively cite applicable legal rules with additional training, they do not take into account the “open texture”<fnref n="10" /> of legal rules allowing for judicial discretion. Merely expanding LLM's training data cannot resolve this core challenge of legal reasoning: the law is certain, but judicial decision-making is probabilistic. Stating the law is insufficient to predict how the judge will rule in a particular case. Holmes’ Prediction Theory of Law defined legal knowledge as “prophecies of what the courts will do in fact, and nothing more pretentious.”<fnref n="11" /> In the same way, Llewellyn stressed the difference between the “Law-in-books and Law-in-action”: for legal scientists real rules are “the practices of the court.”<fnref n="12" /> And according to Cook<fnref n="13" />, the “past behavior of the judges can be described in terms of certain generalizations which we call rules and principles of law.”<fnref n="14" /> In this context, LLMs offer powerful capabilities for extracting data from case law repositories through systematic text mining operations. This technological approach to legal research enables efficient processing of vast judicial datasets, advancing the long-standing Legal Realist objective of grounding legal knowledge in empirical observations of judicial behavior.

Zero-shot learning LLMs are gaining traction outside the legal field, enabling reliable knowledge extraction from unannotated text without large training datasets.<fnref n="15" /> LLMs have successfully extracted information from medical<fnref n="16" /> and financial document,<fnref n="17" /> without task-specific training.<fnref n="18" /> Recent studies have showcased LLMs' ability to extract accurate information from clinical trials<fnref n="19" /> or clinical notes.<fnref n="20" />

In the legal field, recent studies demonstrate the superiority of LLMs over traditional machine learning approaches<fnref n="21" /> for legal data extraction. While earlier research employed various technical methods (including BERT and CNN-GRU),<fnref n="22" /> contemporary LLMs achieve high performance with diverse models such as Claude<fnref n="23" /> (93%), Claude3 Opus<fnref n="24" /> (87%) or GPT-3.5²⁵ (73%), without prior training.

Several international studies confirm this trend. Brazilian researchers found that ChatGPT outperformed traditional models in extracting specific legal provisions from court opinions, showing particular strength in handling unbalanced datasets.<fnref n="26" /> Canadian research reported 99% accuracy in extracting outcomes from Federal Court removal stays, though the validation

<footnote n="6">⁶ Devlin, “Bert: Pre-training of Deep Bidirectional Transformers for Language Understanding,” 2.</footnote>

<footnote n="7">⁷ Zhong, “How Does NLP Benefit Legal System,” 5218-5230.</footnote>

<footnote n="8">⁸ Satterfield, “Fine-tuning Llama with Case Law Data to Improve Legal Domain Performance”.</footnote>

<footnote n="9">⁹ Guha, “Legalbench.”</footnote>

<footnote n="10">¹⁰ Hart, “The Concept of Law.”</footnote>

<footnote n="11">¹¹ Holmes, “The Path of The Law,” 991-1009.</footnote>

<footnote n="12">¹² Llewellyn, “A Realistic Jurisprudence,” 444 and 447.</footnote>

<footnote n="13">¹³ Schlegel, “Empirical Legal Research At Johns Hopkins,” 147-210.</footnote>

<footnote n="14">¹⁴ Cook, “Scientific Method and the Law,” 308.</footnote>

<footnote n="15">¹⁵ Caufield, “Structured Prompt Interrogation and Recursive Extraction of Semantics (SPIRES).”</footnote>

<footnote n="16">¹⁶ Wadhwa, “Jointly Extracting Interventions, Outcomes, and Findings from RCT Reports with LLMs.”</footnote>

<footnote n="17">¹⁷ Yue, “Leveraging LLMs for KPIs Retrieval from Hybrid Long-Document.”</footnote>

<footnote n="18">¹⁸ Agrawal, “Large Language Models Are Few-Shot Clinical Information Extractors.”</footnote>

<footnote n="19">¹⁹ Kartchner, “Zero-Shot Information Extraction for Clinical Meta-Analysis,” 396-405.</footnote>

<footnote n="20">²⁰ McInerney, “CHiLL.”</footnote>

<footnote n="21">²¹ Mistica, “Information Extraction from Legal Documents,” 98-103.</footnote>

<footnote n="22">²² Petrova, “Extracting Outcomes from Appellate Decisions in US State Courts,” 133-142.</footnote>

<footnote n="23">²³ Izzidien, “LM vs. Lawyers.”</footnote>

<footnote n="24">²⁴ Sargeant, “Topic Modelling Case Law Using a Large Language Model and a New Taxonomy for UK Law”.</footnote>

<footnote n="25">²⁵ Savelka, “Unlocking Practical Applications in Legal Domain,” 447-451.</footnote>

<footnote n="26">²⁶ Coelho, “Information Extraction in the Legal Domain,” 579-586.</footnote>
methodology warrants further scrutiny.<fnref n="27" /> Chinese papers demonstrated LLMs' capability to extract legal events without requiring extensive manual annotation,<fnref n="28" /> a significant advancement over previous methods.<fnref n="29" />

In a recent paper on data extraction from UK Employment Tribunal judgments using GPT-4, a British team aimed to extract eight key aspects, including facts, claims, and legal statutes, in free-form text.<fnref n="30" /> While LLMs can extract diverse information simultaneously, the unstructured nature of their output poses challenges for systematic analysis. Spanish researchers addressed this limitation by developing structured prompting strategies incorporating detailed annotation guidelines, significantly improving extraction accuracy and consistency.<fnref n="31" /> The present study builds upon these methodological advances, incorporating their insights into our experimental design.

## 3. Experiment

The LLM operates using a dual-input: it receives a set of instructions for performing a data extraction task (the system prompt) and the document on which the task is to be executed (the user prompt). The model extracts data by answering questions given in the system prompt, regarding the document fed as user prompt.

In this study, 400 decisions from French Courts of Appeal were manually annotated to evaluate LLM performance in zero-shot legal information extraction. Our analysis focuses on extracting two critical data points from each appellate court decision: the first trial court outcome (Outcome#1) and the subsequent appellate court ruling (Outcome#2). Each decision was manually annotated by the author to record the outcome as a binary: a positive outcome if the claim was granted, or a negative outcome if the claim was rejected. The annotation was performed in a simple Excel spreadsheet and is available online with the rest of the experimental data (see below data availability).

**Evaluation metric.** The manually annotated dataset provides the ground truth (Gold Standard) against which the models' extraction accuracy will be assessed. Model performance is evaluated using accuracy, precision, recall and F1 score. Accuracy is a simple percentage of correct answers. Precision measures the proportion of true extracted outcomes (positives or negatives) among all outcomes generated by the model. Recall measures the proportion of true extracted outcomes among all true outcomes that should have been identified. The F1 score, ranging from 0 to 1, provides a harmonic mean of precision and recall. An F1 score of 1 represents perfect performance.

**Controlled variables.** Extraction accuracy was evaluated under various conditions: differences in model sophistication (section 3.1), differences in dispute types in the annotated dataset (section 3.2), and differences in the wording of the instructions given to the model as system prompt (section 3.3).

### 3.1 Models

The present study employed two open-source LLMs. LLaMA3 is the latest foundation model released by Meta AI in July 2024. According to the Llama team, Llama 3 (405b) rivals top-tier language models like GPT-4, achieving state-of-the-art performance. The smaller 70b version used in this study is considered best-in-class,<fnref n="32" /> surpassing other models with a comparable number of parameters.<fnref n="33" /> The second model used was Mixtral 8x7B by Mistral AI, implementing a Mixture of Experts (MoE) architecture comprising eight sparse expert submodels. Mixtral's performance is expected to be inferior to Llama3. These models were selected for their open-source availability and capability to operate on consumer-grade hardware, making them suitable for researchers with moderate computing resources. For this study, the models were accessed via the Groq REST API, a cloud-based inference service, utilizing a Python library interface implemented in Jupyter Lab.

The temperature hyperparameter is a control mechanism that regulates the predictability of the language model's responses. Set on a scale from 0 to 1, this parameter influences how the model selects its next words. At a temperature of 0, the model consistently chooses the most probable word at each step, resulting in highly deterministic and reproducible outputs. Conversely, higher temperatures (closer to 1) introduce more variability in word selection. A low temperature setting ensures

<footnote n="27">²⁷ Rehaag, “Luck of the Draw III,” 73.</footnote>

<footnote n="28">²⁸ Yue, “Event Grounded Criminal Court View Generation with Cooperative (Large) Language Models.”</footnote>

<footnote n="29">²⁹ Yao, “LEVEN.”</footnote>

<footnote n="30">³⁰ de Faria, “Automatic Information Extraction from Employment Tribunal Judgements.”</footnote>

<footnote n="31">³¹ Sainz, “GoLLIE.”</footnote>

<footnote n="32">³² Huang, “How Good are Low-bit Quantized Llama3 Models?”</footnote>

<footnote n="33">³³ Dubey, “The Llama 3 Herd of Models.”</footnote>
consistent outputs. For this study, we employed a temperature of 0.1, to allow a minimal degree of flexibility, which is useful when dealing with legal texts that may contain subtle nuances or require minimal contextual adaptation.

## 3.2 User Prompts

The second parameter of our experiment are the judicial documents that are the target of the data extraction task. The term "user prompt" refers to the raw decision provided to the model. The documents were not provided with any summary. Our dataset comprises 400 judicial decisions from French appellate courts (Cour d'appel), sourced from JURICA (2008-April 2022) and JUDILIBRE (May 2022 onwards). JUDILIBRE provides electronic access to appellate court decisions, with personal information pseudonymized. The dataset is divided in four subsets of 100 documents pertaining to different categories of common civil law disputes. Each category consists of 100 decisions. Documents were selected at random using regular expressions.

To manage the computational constraints imposed by the API's token rate limitations, we used a text truncation method, preserving the initial and final 2000 characters of each document. French legal documents follow a standardized structure: metadata header, facts and procedural history (first 20%), arguments and judicial reasoning (70%), and the court's ruling (last 10%). This truncation strategy ensured the retention of critical information regarding the trial court's initial decision and the appellate court's final ruling. Despite the truncation, the structured nature of the documents avoided any potential information loss. However, for future experiments, it will be useful to run Llama3 on a local server, to avoid these kind of limitations.

The first category (Dataset#1) involves orders to extend involuntary psychiatric commitments. In France, individuals can refuse psychiatric care unless they pose an immediate threat to themselves or others (Article L3212-1 CSP) or cause serious public disruption (Article L3213-1 CSP). Extensions beyond 72 hours require authorization from the Juge des Libertés et de la Détention (JLD). Following medical advice, judges extend commitments in about 90% of cases, leading to a highly imbalanced dataset with 90 positive outcomes (commitment extended) and 10 negative outcomes (patient released).

The second category (Dataset#2) involves orders to extend detention pending deportation of undocumented aliens. Initially, the administrative authority can detain a foreign national for 48 hours, but any extension requires authorization from the JLD. The foreign national can appeal the JLD's decision to the Court of Appeal. Similar to the first dataset, this category is heavily imbalanced, with judges upholding extensions in approximately 90% of cases. Specifically, the dataset contains 90 positive outcomes (detention extended) and 10 negative outcomes (foreigner released).

The third category (Dataset#3) consists of workers' compensation claims related to wrongful termination. Under French law, employers must provide a written notice specifying the grounds for termination. Employees may contest the validity of these grounds and seek compensatory damages. These cases are heard before a specialized Labor Court, elected among representatives of employees and employers. While trial court outcomes are balanced with a 50/50 split, at the appellate court level (with professional judges) outcomes favor employees in approximately 90% of cases. Outcome is recorded positive when the judge awards compensation.

The fourth category (Dataset#4) involves orders to pay damages for workplace harassment. In France, workplace bullying and sexual harassment are both criminal offenses and civil torts. Employers are obligated to prevent and address harassment, and victims can pursue both criminal charges and civil remedies for compensation and reinstatement. These cases are heard before the same specialized Labor Court. Our aim is to extract the outcomes of employees' claims for compensatory damages due to workplace bullying or sexual harassment. The outcome in this category is roughly 65% in favor of the claimant. Outcome is recorded positive when the judge awards compensation.

## 3.3 System Prompts

Prompt engineering has demonstrated significant potential in boosting models' performance, with no additional training<fnref n="34" />. LLMs exhibit significant sensitivity to the precise wording and structure of input, a phenomenon known as prompt sensitivity.<fnref n="35" /> Minor variations in prompt formulation - including changes in wording, formatting, or even punctuation - can lead to substantially different answers to the same question. The impact of prompt engineering is assessed by comparing model performance across two prompting strategies: Prompt#A with detailed instructions, and Prompt#B based on simple cues.

**JSON prompting.** Following Sainz et al. (2023), all prompts are formulated in JSON format (JavaScript Object Notation), to foster consistency and conciseness. Using JSON format allows the model to generate consistent data, that can be used for

<footnote n="34">³⁴ Shao, “Survey of Different Large Language Model Architectures.”</footnote>

<footnote n="35">³⁵ Sclar, “Quantifying Language Models’ Sensitivity to Spurious Features in Prompt Design.”</footnote>
statistical analysis of outcome. In JSON, data representation is structured using key fields. Keys are always strings enclosed in double quotes and must be unique within the same object to avoid ambiguity. In a departure from traditional approaches, which often rely on providing LLMs with explicit and detailed instructions in natural language, our system prompts employed directly the key field names to imply the questions and elicit the desired data. The key fields name in JSON format serve as cues to guide the LLM's generation process. The questions are directly embedded within the key field names, in a concise and implicit manner. Naming conventions are flexible, and can use CamelCase (no spacing with capital letters) or snake_case (replacing spacing by underscores) for readability.

**Role-based prompting.** Role-based prompting involves the model assuming a specific professional role. In this study, the model assumed the role of a lawyer. The system prompts begin with a header for common instructions that are the same for all system prompts, specifying task requirements, metadata extraction and role-based prompting. This is how the common instructions part reads:

Role: Lawyer.
Input: french judicial decisions.
Objective: Extract data.
Format: json UTF-8:
{
  "decisionDate": "YYYY-MM-DD",
  "decisionID": "string",
  "conseilPrudhommesCity": "string",
  "courtOfAppealCity": "string",

The study moved away from **Instruction Prompting**, which provides explicit instructions to elicit desired responses, due to its inconsistent results. Prompt#A complemented JSON cues with additional context. In contrast, Prompt#B relied solely on cues embedded in key field names to guide the extraction process, avoiding lengthy instructions and excessive context.

**Directional Stimulus Prompting** involves using specific cues within prompts to better align generated content with the intended topic or context. Designing a universal system prompt for the judicial outcome extraction task has proven challenging. General prompts such as “CaseOutcome” or “CourtOfAppealRuling” often yield inconsistent results, primarily because judicial decisions can encompass a wide array of responses to various questions. Without proper constraints, the model tends to generate summaries that only capture the main topic of the document. Through trial and error, it became clear that precise, domain-specific questions are essential for eliciting accurate and relevant answers. For example, rather than simply asking for an “outcome,” a more effective JSON cue might be formatted as `{"courtOfAppealRuledEmployeeHarassed": boolean}`. Using basic, essential terminology alongside concise prompts can significantly enhance performance. The responses are constrained to boolean formats, resulting in straightforward yes or no answers.

**Chain-of-Thought Prompting** decomposes complex problems into logical segments, guiding the model through intermediary steps. In this approach, the order of key fields in Prompt#A was rearranged in Prompt#B to create an implicit chain of thought. This method effectively directs the model's attention to the logical connection between the trial court outcome and the appellate court outcome, which are often far apart in the raw text. By creating a sequence of key fields that begins with the more easily extracted appellate outcome and concludes with the more challenging trial court outcome, the gap between these related but distant pieces of information is bridged.

**Generated Knowledge Prompting.** We also tried to enhance accuracy by prompting the model to first generate a free-text summary of the outcome before arriving at the boolean value for the outcome. Generated Knowledge Prompting encourages the model to produce relevant information prior to addressing the main task, thereby improving overall response quality. All system prompts are given below for clarity.
## Prompt#A for Dataset#1

"patientPathology": "string",
"patientSexMale": boolean,
"firstJudgeAuthorizedExtension": boolean, // true if the first Judge (Judge of Liberties and Detention) authorized the patient psychiatric commitment extension, otherwise false.
"reversed": boolean, // true if second judge reversed decision of first judge.
"affirmed": boolean, // true if second judge affirmed decision of first judge.
"secondJudgeAuthorizedExtension": boolean // true if the second Judge (Cour d'Appel) authorized the patient psychiatric commitment extension, otherwise false.

## Prompt#B for Dataset#1

"patientSexMale": boolean,
"patientDangerosityScore": number,
"psychiatristAdviceExtendCommitment": boolean,
"patientReleasedAfterCourtOfAppealDecision": boolean,
"courtOfAppealDecisionSummary20Words": "string",
"courtOfAppealRuledDetentionExtensionTrue": boolean,
"courtOfAppealDecisionIdenticalJudgeLibertyDetentionDecision": boolean,
"judgeLibertyDetentionDecisionSummary20Words": "string",
"judgeLibertyDetentionRuledDetentionExtensionTrue": boolean

## Prompt#A for Dataset#2

"foreignerCountryOrigin": "string",
"foreignerSexMale": boolean,
"firstJudgeAuthorizedExtension": boolean, // true if the first Judge (Judge of Liberties and Detention) authorized the foreigner detention extension, otherwise false.
"extensionLenght1": number,
"reversed": boolean, // true if second judge reversed decision of first judge.
"affirmed": boolean, // true if second judge affirmed decision of first judge.
"secondJudgeAuthorizedExtension": boolean, // true if the second Judge (Cour d'Appel) authorized the foreigner detention extension, otherwise false.
"extensionLenght2": number

## Prompt#B for Dataset#2

"foreignerCountryOrigin": "string",
"foreignerSexMale": boolean,
"foreignerReleasedAfterCourtOfAppealDecision": boolean,
"courtOfAppealRuling20WordsSummary": "string",
"courtOfAppealRuledForeignerDetentionExtension": boolean,
"courtOfAppealDetentionExtensionLenght": number,
"judgeLibertyDetentionDecisionReversed": boolean,
"courtOfAppealDecisionIdenticalToJudgeLibertyDetentionDecision": boolean,
"judgeLibertyDetentionRuling20WordsSummary": "string",
"judgeLibertyDetentionRuledForeignerDetentionExtension": boolean,
"judgeLibertyDetentionExtensionLenght": number
## Prompt#A for Dataset#3

"firstJudgeRuledWrongfulTermination": boolean, // true if the first Judge (Conseil Prudhommes) ruled "licenciement sans cause réelle et sérieuse", otherwise false.

"firstJudgeAwardedWrongfulTerminationDamages": number,

"WrongfulTerminationReversalbyAppeal": boolean, // true if second judge reversed decision of first judge on the matter of "Licenciement sans cause".

"WrongfulTerminationAffirmationbyAppeal": boolean, // true if second judge affirmed decision of first judge on the matter of "Licenciement sans cause".

"secondJudgeRuledWrongfulTermination": boolean, // true if the second Judge (Cour d'Appel) ruled "licenciement sans cause réelle et sérieuse", otherwise false.

"secondJudgeAwardedWrongfulTerminationDamages": number

## Prompt#B for Dataset#3

"TerminationMotives20WordsSummary": "string",

"employeeSexMale": boolean,

"courtOfAppealRulingOnLicenciementSansCause20WordsSummary": "string",

"courtOfAppealRuledLicenciementSansCause": boolean,

"courtOfAppealAcceptedWrongfulTerminationClaim": boolean,

"EmployeeReceivedWrongfulTerminationCompensationFromCourtOfAppeal": boolean,

"courtOfAppealCompensationAwardedLicenciementSansCause": number,

"courtOfAppealAgreedWithConseilPrudhommesOnLicenciementSansCause": boolean,

"conseilPrudhommesRulingOnLicenciementSansCause20WordsSummary": "string",

"conseilPrudhommesRuledLicenciementSansCause": boolean,

"conseilPrudhommesAcceptedWrongfulTerminationClaim": boolean,

"EmployeeReceivedWrongfulTerminationCompensationFromConseilPrudhommes": boolean,

"conseilPrudhommesCompensationAwardedLicenciementSansCause": number

## Prompt#A for Dataset#4

"firstJudgeJurisdiction": "string", // name of the first judge's tribunal.

"secondJudgeJurisdiction": "string", // name of the second judge's court of appeal.

"harassmentIncidents": "string",

"sexualHarassmentAllegations": boolean,

"moralHarassmentAllegations": boolean,

"employeeSexFemale": boolean,

"firstJudgeRuledHarassmentTrue": boolean, // true if the first Judge (Conseil Prudhommes) ruled employee was harassed, otherwise false.

"firstJudgeAwardedHarassmentDamages": number,

"reversed": boolean, // true if second judge reversed decision of first judge.

"affirmed": boolean, // true if second judge affirmed decision of first judge.

"secondJudgeRuledHarassment": boolean, // true if the second Judge (Cour d'Appel) ruled employee was harassed, otherwise false.

"secondJudgeAwardedHarassmentDamages": number
## Prompt#B for Dataset#4

```
"conseilPrudhommesCity": "string",
"courtOfAppealCity": "string",
"harassmentIncidents20WordsSummary": "string",
"sexualHarassmentAllegations": boolean,
"moralHarassmentAllegations": boolean,
"employeeSexFemale": boolean,
"courtOfAppealRulingOnHarassment20WordsSummary": "string",
"courtOfAppealRuledEmployeeHarassed": boolean,
"courtOfAppealRuledHarassmentClaimTrue": boolean,
"EmployeeReceivedHarassmentCompensationFromCourtOfAppeal": boolean,
"courtOfAppealAwardedHarassmentDamages": number,
"courtOfAppealAgreedWithConseilPrudhommesOnHarassment": boolean,
"conseilPrudhommesRulingOnHarassment20WordsSummary": "string",
"conseilPrudhommesRuledEmployeeHarassed": boolean,
"conseilPrudhommesRuledHarassmentClaimTrue": boolean,
"EmployeeReceivedHarassmentCompensationFromConseilPrudhommes": boolean,
"conseilPrudhommesAwardedHarassmentDamages": number
```

## 4. Results

The performance evaluation is conducted by comparing the LLM's answer with expert annotations on a random sample of 400 decisions. Precision, recall, and F1 score are essential metrics for evaluating the performance. Precision measures the accuracy of positive predictions, defined as the ratio of true positives (TP) to the sum of true positives and false positives (FP), indicating how many of the LLM generated answers are actually correct. Recall is the ratio of true positives to the sum of true positives and false negatives (FN), reflecting how many of the positive outcomes were identified by the LLM. The F1 score provides a single metric that balances precision and recall by calculating the harmonic mean of both, which is particularly useful in scenarios with imbalanced class distributions of positive and negative outcomes. F1 score is 2 times the product of precision and recall divided by their sum.

<table><caption>Figure 1a: Mixtral (8x7b) performance metrics</caption><thead><tr><th>User Prompt</th><th>System prompt</th><th>Outcome</th><th>Precision</th><th>Recall (sensitivity)</th><th>Specif.</th><th>F1</th><th>Accuracy</th></tr></thead><tbody><tr><td colspan="8" style="text-align: center; font-weight: bold;">Involuntary Psychiatric Commitment</td></tr><tr><td>Dataset #1</td><td>#A</td><td>#1</td><td>0,964</td><td>0,900</td><td>0,700</td><td>0,930</td><td>88%</td><td>12 errors</td></tr><tr><td>Dataset #1</td><td>#B</td><td>#1</td><td>0,962</td><td>0,866</td><td>0,700</td><td>0,912</td><td>85%</td><td>15 errors</td></tr><tr><td>Dataset #1</td><td>#A</td><td>#2</td><td>0,987</td><td>0,975</td><td>0,947</td><td>0,980</td><td>97%</td><td>3 errors</td></tr><tr><td>Dataset #1</td><td>#B</td><td>#2</td><td>1,000</td><td>0,913</td><td>1,000</td><td>0,954</td><td>93%</td><td>7 errors</td></tr><tr><td colspan="8" style="text-align: center; font-weight: bold;">Undocumented Alien Detention Pending Deportation</td></tr><tr><td>Dataset #2</td><td>#A</td><td>#1</td><td>0,833</td><td>0,733</td><td>0,560</td><td>0,779</td><td>69%</td><td>31 errors</td></tr><tr><td>Dataset #2</td><td>#B</td><td>#1</td><td>0,946</td><td>0,706</td><td>0,880</td><td>0,809</td><td>75%</td><td>25 errors</td></tr><tr><td>Dataset #2</td><td>#A</td><td>#2</td><td>0,935</td><td>0,900</td><td>0,750</td><td>0,917</td><td>87%</td><td>13 errors</td></tr><tr><td>Dataset #2</td><td>#B</td><td>#2</td><td>0,962</td><td>0,962</td><td>0,800</td><td>0,962</td><td>93%</td><td>7 errors</td></tr><tr><td colspan="8" style="text-align: center; font-weight: bold;">Damages for Worker Wrongful Termination</td></tr><tr><td>Dataset #3</td><td>#A</td><td>#1</td><td>0,870</td><td>0,886</td><td>0,723</td><td>0,878</td><td>81%</td><td>19 errors</td></tr><tr><td>Dataset #3</td><td>#B</td><td>#1</td><td>0,815</td><td>1,000</td><td>0,723</td><td>0,898</td><td>87%</td><td>13 errors</td></tr><tr><td>Dataset #3</td><td>#A</td><td>#2</td><td>0,937</td><td>0,852</td><td>0,583</td><td>0,893</td><td>82%</td><td>18 errors</td></tr><tr><td>Dataset #3</td><td>#B</td><td>#2</td><td>0,955</td><td>0,965</td><td>0,583</td><td>0,960</td><td>92%</td><td>8 errors</td></tr><tr><td colspan="8" style="text-align: center; font-weight: bold;">Damages for Workplace Bullying or Sexual Harassment</td></tr><tr><td>Dataset #4</td><td>#A</td><td>#1</td><td>0,921</td><td>0,795</td><td>0,892</td><td>0,853</td><td>85%</td><td>15 errors</td></tr><tr><td>Dataset #4</td><td>#B</td><td>#1</td><td>0,916</td><td>1,000</td><td>0,928</td><td>0,956</td><td>96%</td><td>4 errors</td></tr><tr><td>Dataset #4</td><td>#A</td><td>#2</td><td>0,919</td><td>0,876</td><td>0,828</td><td>0,896</td><td>86%</td><td>14 errors</td></tr><tr><td>Dataset #4</td><td>#B</td><td>#2</td><td>0,921</td><td>0,907</td><td>0,857</td><td>0,915</td><td>89%</td><td>11 errors</td></tr></tbody></table>

**Comments:** Mixtral performed poorly with both Prompt#A and #B. Failed generation (empty answer) are recorded as errors. Data generated is not accurate enough for large scale data extraction. Prompt engineering couldn't quite compensate for the model's size limitations, even if it improved performance.
<table><caption>Figure 1b: Llama3 (70b) performance metrics</caption><thead><tr><th>User Prompt</th><th>System prompt</th><th>Outcome</th><th>Precision</th><th>Recall (sensitivity)</th><th>Specif.</th><th>F1</th><th>Accuracy</th></tr></thead><tbody><tr><td colspan="8" style="text-align: center; font-weight: bold;">Involuntary Psychiatric Commitment</td></tr><tr><td>Dataset #1</td><td>#A</td><td>#1</td><td>0,965</td><td>0,933</td><td>0,700</td><td>0,948</td><td>91%</td><td>9 errors</td></tr><tr><td>Dataset #1</td><td>#B</td><td>#1</td><td><strong>0,988</strong></td><td><strong>0,988</strong></td><td><strong>0,900</strong></td><td><strong>0,988</strong></td><td><strong>98%</strong></td><td><strong>2 errors</strong></td></tr><tr><td>Dataset #1</td><td>#A</td><td>#2</td><td>0,963</td><td>0,987</td><td>0,842</td><td>0,974</td><td>96%</td><td>4 errors</td></tr><tr><td>Dataset #1</td><td>#B</td><td>#2</td><td><strong>1,000</strong></td><td><strong>0,987</strong></td><td><strong>1,000</strong></td><td><strong>0,994</strong></td><td><strong>99%</strong></td><td><strong>1 error</strong></td></tr><tr><td colspan="8" style="text-align: center; font-weight: bold;">Undocumented Alien Detention Pending Deportation</td></tr><tr><td>Dataset #2</td><td>#A</td><td>#1</td><td>0,960</td><td>0,960</td><td>0,880</td><td>0,960</td><td>94%</td><td>6 errors</td></tr><tr><td>Dataset #2</td><td>#B</td><td>#1</td><td><strong>0,958</strong></td><td><strong>0,933</strong></td><td><strong>0,880</strong></td><td><strong>0,946</strong></td><td><strong>92%</strong></td><td><strong>8 errors</strong></td></tr><tr><td>Dataset #2</td><td>#A</td><td>#2</td><td>1,000</td><td>0,962</td><td>1,000</td><td>0,981</td><td>97%</td><td>3 errors</td></tr><tr><td>Dataset #2</td><td>#B</td><td>#2</td><td><strong>1,000</strong></td><td><strong>0,987</strong></td><td><strong>1,000</strong></td><td><strong>0,993</strong></td><td><strong>99%</strong></td><td><strong>1 error</strong></td></tr><tr><td colspan="8" style="text-align: center; font-weight: bold;">Damages for Worker Wrongful Termination</td></tr><tr><td>Dataset #3</td><td>#A</td><td>#1</td><td>0,912</td><td>0,981</td><td>0,893</td><td>0,945</td><td>94%</td><td>6 errors</td></tr><tr><td>Dataset #3</td><td>#B</td><td>#1</td><td><strong>0,913</strong></td><td><strong>1,000</strong></td><td><strong>0,893</strong></td><td><strong>0,955</strong></td><td><strong>95%</strong></td><td><strong>5 errors</strong></td></tr><tr><td>Dataset #3</td><td>#A</td><td>#2</td><td>0,988</td><td>1,000</td><td>0,916</td><td>0,994</td><td>99%</td><td>1 error</td></tr><tr><td>Dataset #3</td><td>#B</td><td>#2</td><td><strong>0,977</strong></td><td><strong>1,000</strong></td><td><strong>0,833</strong></td><td><strong>0,989</strong></td><td><strong>98%</strong></td><td><strong>2 errors</strong></td></tr><tr><td colspan="8" style="text-align: center; font-weight: bold;">Damages for Workplace Bullying or Sexual Harassment</td></tr><tr><td>Dataset #4</td><td>#A</td><td>#1</td><td>0,880</td><td>1,000</td><td>0,892</td><td>0,936</td><td>94%</td><td>6 errors</td></tr><tr><td>Dataset #4</td><td>#B</td><td>#1</td><td><strong>0,900</strong></td><td><strong>1,000</strong></td><td><strong>0,800</strong></td><td><strong>0,941</strong></td><td><strong>95%</strong></td><td><strong>5 errors</strong></td></tr><tr><td>Dataset #4</td><td>#A</td><td>#2</td><td>0,901</td><td>0,984</td><td>0,800</td><td>0,941</td><td>92%</td><td>8 errors</td></tr><tr><td>Dataset #4</td><td>#B</td><td>#2</td><td><strong>0,901</strong></td><td><strong>0,984</strong></td><td><strong>0,800</strong></td><td><strong>0,941</strong></td><td><strong>92%</strong></td><td><strong>8 errors</strong></td></tr></tbody></table>

**Comments:** Llama3 performed well for both outcome#1 and #2. Remarkably, Llama3 achieved 99% accuracy for 3 datasets out of 4, which is satisfactory for a large scale data extraction task.

<table><caption>Figure 2a: Confusion Matrix Overview for Mixtral (8x7b)</caption><thead><tr><th>User Prompt</th><th>System prompt</th><th>Outcome</th><th>Expert Pos.</th><th>LLM True Pos.</th><th>LLM False Neg.</th><th>Expert Neg.</th><th>LLM True Neg.</th><th>LLM False Pos.</th><th>Failed Gen.</th><th>Total Errors</th></tr></thead><tbody><tr><td colspan="11" style="text-align: center; font-weight: bold;">Dataset#1: Involuntary Psychiatric Commitment</td></tr><tr><td>Dataset #1</td><td>#A</td><td>#1</td><td>90</td><td>81</td><td>9</td><td>10</td><td>7</td><td>3</td><td>0</td><td>12</td></tr><tr><td>Dataset #1</td><td>#B</td><td>#1</td><td>90</td><td>78</td><td>12</td><td>10</td><td>7</td><td>3</td><td>3</td><td>15</td></tr><tr><td>Dataset #1</td><td>#A</td><td>#2</td><td>81</td><td>79</td><td>2</td><td>19</td><td>18</td><td>1</td><td>0</td><td>3</td></tr><tr><td>Dataset #1</td><td>#B</td><td>#2</td><td>81</td><td>74</td><td>7</td><td>19</td><td>19</td><td>0</td><td>4</td><td>7</td></tr><tr><td colspan="11" style="text-align: center; font-weight: bold;">Dataset#2: Undocumented Alien Detention Pending Deportation</td></tr><tr><td>Dataset #2</td><td>#A</td><td>#1</td><td>75</td><td>55</td><td>20</td><td>25</td><td>14</td><td>11</td><td>0</td><td>31</td></tr><tr><td>Dataset #2</td><td>#B</td><td>#1</td><td><strong>75</strong></td><td><strong>53</strong></td><td><strong>22</strong></td><td><strong>25</strong></td><td><strong>22</strong></td><td><strong>3</strong></td><td><strong>1</strong></td><td><strong>25</strong></td></tr><tr><td>Dataset #2</td><td>#A</td><td>#2</td><td>80</td><td>72</td><td>8</td><td>20</td><td>15</td><td>5</td><td>1</td><td>13</td></tr><tr><td>Dataset #2</td><td>#B</td><td>#2</td><td><strong>80</strong></td><td><strong>77</strong></td><td><strong>3</strong></td><td><strong>20</strong></td><td><strong>16</strong></td><td><strong>4</strong></td><td><strong>2</strong></td><td><strong>7</strong></td></tr><tr><td colspan="11" style="text-align: center; font-weight: bold;">Dataset#3: Damages for Worker Wrongful Termination</td></tr><tr><td>Dataset #3</td><td>#A</td><td>#1</td><td>53</td><td>47</td><td>6</td><td>47</td><td>34</td><td>13</td><td>11</td><td>19</td></tr><tr><td>Dataset #3</td><td>#B</td><td>#1</td><td><strong>53</strong></td><td><strong>53</strong></td><td><strong>0</strong></td><td><strong>47</strong></td><td><strong>34</strong></td><td><strong>13</strong></td><td><strong>1</strong></td><td><strong>13</strong></td></tr><tr><td>Dataset #3</td><td>#A</td><td>#2</td><td>88</td><td>75</td><td>13</td><td>12</td><td>7</td><td>5</td><td>11</td><td>18</td></tr><tr><td>Dataset #3</td><td>#B</td><td>#2</td><td><strong>88</strong></td><td><strong>85</strong></td><td><strong>3</strong></td><td><strong>12</strong></td><td><strong>7</strong></td><td><strong>5</strong></td><td><strong>3</strong></td><td><strong>8</strong></td></tr><tr><td colspan="11" style="text-align: center; font-weight: bold;">Dataset#4: Damages for Workplace Bullying or Sexual Harassment</td></tr><tr><td>Dataset #4</td><td>#A</td><td>#1</td><td>44</td><td>35</td><td>9</td><td>56</td><td>50</td><td>6</td><td>7</td><td>15</td></tr><tr><td>Dataset #4</td><td>#B</td><td>#1</td><td><strong>44</strong></td><td><strong>44</strong></td><td><strong>0</strong></td><td><strong>56</strong></td><td><strong>52</strong></td><td><strong>4</strong></td><td><strong>0</strong></td><td><strong>4</strong></td></tr><tr><td>Dataset #4</td><td>#A</td><td>#2</td><td>65</td><td>57</td><td>8</td><td>35</td><td>29</td><td>6</td><td>7</td><td>14</td></tr><tr><td>Dataset #4</td><td>#B</td><td>#2</td><td><strong>65</strong></td><td><strong>59</strong></td><td><strong>6</strong></td><td><strong>35</strong></td><td><strong>30</strong></td><td><strong>5</strong></td><td><strong>0</strong></td><td><strong>11</strong></td></tr></tbody></table>

**Comments:** Prompt engineering didn't improve performance for Datasets#1 and #2. Minimalist prompt slightly improved performance for Datasets#3 and #4. Remarkably, minimalist prompting achieved perfect accuracy for positive outcome#1 of datasets#3 and #4, but missed negative outcomes.
<table><caption>Figure 2b: Confusion Matrix Overview for Llama3 (70b)</caption><thead><tr><th>User Prompt Dataset</th><th>System prompt</th><th>Out come</th><th>Expert Pos.</th><th>LLM True Pos.</th><th>LLM False Neg.</th><th>Expert Neg</th><th>LLM True Neg.</th><th>LLM False Pos.</th><th>Failed Gen. Errors</th><th>Total Errors</th></tr></thead><tbody><tr><td colspan="12">Dataset#1: Involuntary Psychiatric Commitment</td></tr><tr><td>Dataset #1</td><td>#A</td><td>#1</td><td>90</td><td>84</td><td>6</td><td>10</td><td>7</td><td>3</td><td>0</td><td>9</td></tr><tr><td>Dataset #1</td><td>#B</td><td>#1</td><td>90</td><td>89</td><td>1</td><td>10</td><td>9</td><td>1</td><td>0</td><td>2</td></tr><tr><td>Dataset #1</td><td>#A</td><td>#2</td><td>81</td><td>80</td><td>1</td><td>19</td><td>16</td><td>3</td><td>0</td><td>4</td></tr><tr><td>Dataset #1</td><td>#B</td><td>#2</td><td>81</td><td>80</td><td>1</td><td>19</td><td>19</td><td>0</td><td>0</td><td>1</td></tr><tr><td colspan="12">Dataset#2: Undocumented Alien Detention Pending Deportation</td></tr><tr><td>Dataset #2</td><td>#A</td><td>#1</td><td>75</td><td>72</td><td>3</td><td>25</td><td>22</td><td>3</td><td>0</td><td>6</td></tr><tr><td>Dataset #2</td><td>#B</td><td>#1</td><td>75</td><td>70</td><td>5</td><td>25</td><td>22</td><td>3</td><td>0</td><td>8</td></tr><tr><td>Dataset #2</td><td>#A</td><td>#2</td><td>80</td><td>77</td><td>3</td><td>20</td><td>20</td><td>0</td><td>0</td><td>3</td></tr><tr><td>Dataset #2</td><td>#B</td><td>#2</td><td>80</td><td>79</td><td>1</td><td>20</td><td>20</td><td>0</td><td>0</td><td>1</td></tr><tr><td colspan="12">Dataset#3: Damages for Worker Wrongful Termination</td></tr><tr><td>Dataset #3</td><td>#A</td><td>#1</td><td>53</td><td>52</td><td>1</td><td>47</td><td>42</td><td>5</td><td>0</td><td>6</td></tr><tr><td>Dataset #3</td><td>#B</td><td>#1</td><td>53</td><td>53</td><td>0</td><td>47</td><td>42</td><td>5</td><td>0</td><td>5</td></tr><tr><td>Dataset #3</td><td>#A</td><td>#2</td><td>88</td><td>88</td><td>0</td><td>12</td><td>11</td><td>1</td><td>0</td><td>1</td></tr><tr><td>Dataset #3</td><td>#B</td><td>#2</td><td>88</td><td>88</td><td>0</td><td>12</td><td>10</td><td>2</td><td>0</td><td>2</td></tr><tr><td colspan="12">Dataset#4: Damages for Workplace Bullying or Sexual Harassment</td></tr><tr><td>Dataset #4</td><td>#A</td><td>#1</td><td>44</td><td>44</td><td>0</td><td>56</td><td>50</td><td>6</td><td>0</td><td>6</td></tr><tr><td>Dataset #4</td><td>#B</td><td>#1</td><td>44</td><td>44</td><td>0</td><td>56</td><td>51</td><td>5</td><td>0</td><td>5</td></tr><tr><td>Dataset #4</td><td>#A</td><td>#2</td><td>65</td><td>64</td><td>1</td><td>35</td><td>28</td><td>7</td><td>0</td><td>8</td></tr><tr><td>Dataset #4</td><td>#B</td><td>#2</td><td>65</td><td>64</td><td>1</td><td>35</td><td>28</td><td>7</td><td>0</td><td>8</td></tr></tbody></table>

**Comments:** Remarkably, the total number of errors for outcome#1 and #2 stays constant for dataset#2 and #3. Prompt engineering managed to shave only 1 error for dataset#4. Best performance improvement for dataset#1, with 10 errors less. Llama3 already achieved perfect or near-perfect accuracy with baseline prompt for 3 datasets out of 4, and further improvement remained out of reach.

<table><caption>Figure 3a: Mixtral (8x7b) Prompt Engineering Performance Improvement: Delta #B - #A</caption><thead><tr><th>User Prompt Dataset</th><th>LLM Precis. Delta #B-#A</th><th>LLM Recall Delta #B-#A</th><th>LLM F1 Delta #B-#A</th><th>LLM Pos. Accur. Delta #B-#A</th><th>LLM Neg. Accur. Delta #B-#A</th><th>LLM Global Accur. Delta #B-#A</th></tr></thead><tbody><tr><td colspan="7">Dataset#1: Involuntary Psychiatric Commitment</td></tr><tr><td>Outcome #1</td><td>0,962 - 0,964<br>(-0,2%)</td><td>0,866 - 0,900<br>(-3,77%)</td><td>0,912 - 0,930<br>(-1,9%)</td><td>(78 - 81) / 90<br>(-3,33%)</td><td>(7 - 7) / 10<br>(0%)</td><td>(85 - 88) / 100<br>(-3%)</td></tr><tr><td>Outcome #2</td><td>1,000 - 0,987<br>(+1,3%)</td><td>0,913 - 0,975<br>(-6,3%)</td><td>0,954 - 0,980<br>(-2,6%)</td><td>(74 - 79) / 81<br>(-6,17%)</td><td>(19 - 18) / 19<br>(+5,26%)</td><td>(93 - 97) / 100<br>(-4%)</td></tr><tr><td colspan="7">Dataset#2: Undocumented Alien Detention Pending Deportation</td></tr><tr><td>Outcome #1</td><td>0,946 - 0,833<br>(+13,5%)</td><td>0,706 - 0,733<br>(-3,6%)</td><td>0,809 - 0,779<br>(+3,8%)</td><td>(53 - 55) / 75<br>(-2,6%)</td><td>(22 - 14) / 25<br>(+32%)</td><td>(75 - 69) / 100<br>(+6%)</td></tr><tr><td>Outcome #2</td><td>0,962 - 0,935<br>(+2,8%)</td><td>0,962 - 0,900<br>(+6,8%)</td><td>0,962 - 0,917<br>(+4,9%)</td><td>(77 - 72) / 80<br>(+6,25%)</td><td>(16 - 15) / 20<br>(+5%)</td><td>(93 - 87) / 100<br>(+6%)</td></tr><tr><td colspan="7">Dataset#3: Damages for Worker Wrongful Termination</td></tr><tr><td>Outcome #1</td><td>0,815 - 0,870<br>(-6%)</td><td>1,000 - 0,886<br>(+12,8%)</td><td>0,898 - 0,878<br>(+2,27%)</td><td>(53 - 47) / 53<br>(+11,32%)</td><td>(34 - 34) / 47<br>(0%)</td><td>(87 - 81) / 100<br>(+6%)</td></tr><tr><td>Outcome #2</td><td>0,955 - 0,937<br>(+1,9%)</td><td>0,965 - 0,852<br>(+13,2%)</td><td>0,960 - 0,893<br>(+7,5%)</td><td>(85 - 75) / 88<br>(+11,36%)</td><td>(7 - 7) / 12<br>(0%)</td><td>(92 - 82) / 100<br>(+10%)</td></tr><tr><td colspan="7">Dataset#4: Damages for Workplace Bullying or Sexual Harassment</td></tr><tr><td>Outcome #1</td><td>0,916 - 0,921<br>(-0,5%)</td><td>1,000 - 0,795<br>(+25,7%)</td><td>0,956 - 0,893<br>(+12%)</td><td>(44 - 35) / 44<br>(+20,45%)</td><td>(52 - 50) / 56<br>(+3,57%)</td><td>(96 - 85) / 100<br>(+11%)</td></tr><tr><td>Outcome #2</td><td>0,921 - 0,919<br>(+0,2%)</td><td>0,907 - 0,876<br>(+3,5%)</td><td>0,915 - 0,896<br>(+2,1%)</td><td>(59 - 57) / 65<br>(+3,07%)</td><td>(30 - 29) / 35<br>(+2,07%)</td><td>(89 - 86) / 100<br>(+3%)</td></tr></tbody></table>

**Comments:** Despite the model's modest size, prompt engineering managed to improve Mixtral performance across the board. Global accuracy for outcome#1 is solid: 93% for dataset#1, 93% for dataset#2, 92% for dataset#3 and 89% for dataset#4. Mean improvement was between 6% and 10% for 3 datasets out of 4.
<table><caption>Figure 3b: Llama3 (70b) Prompt Engineering Performance Improvement: Delta #B - #A</caption><thead><tr><th>User Prompt<br>Dataset</th><th>LLM<br>Precis.<br>Delta #B-#A</th><th>LLM<br>Recall<br>Delta #B-#A</th><th>LLM<br>F1<br>Delta #B-#A</th><th>LLM<br>Pos. Accur.<br>Delta #B-#A</th><th>LLM<br>Neg. Accur.<br>Delta #B-#A</th><th>LLM<br>Global Accur.<br>Delta #B-#A</th></tr></thead><tbody><tr><td colspan="7"><strong>Dataset#1: Involuntary Psychiatric Commitment</strong></td></tr><tr><td>Outcome #1</td><td>0,988 - 0,965<br>(+2,3%)</td><td>0,988 - 0,933<br>(+5,8%)</td><td>0,988 - 0,948<br>(+4,2%)</td><td>(89 - 84) / 90<br>(+5,55%)</td><td>(9 - 7) / 10<br>(+20%)</td><td>(98 - 91) / 100<br>(+7%)</td></tr><tr><td>Outcome #2</td><td>1,000 - 0,963<br>(+3,8%)</td><td>0,987 - 0,987<br>(0%)</td><td>0,994 - 0,974<br>(+2%)</td><td>(80 - 80) / 81<br>(0%)</td><td>(19 - 16) / 19<br>(+15,7%)</td><td>(99 - 96) / 100<br>(+3%)</td></tr><tr><td colspan="7"><strong>Dataset#2: Undocumented Alien Detention Pending Deportation</strong></td></tr><tr><td>Outcome #1</td><td>0,958 - 0,960<br>(-0,2%)</td><td>0,933 - 0,960<br>(-2,8%)</td><td>0,946 - 0,960<br>(-1,4%)</td><td>(70 - 72) / 75<br>(-2,6%)</td><td>(22 - 22) / 25<br>(0%)</td><td>(92 - 94) / 100<br><strong>-2%</strong></td></tr><tr><td>Outcome #2</td><td>1,000 - 1,000<br>(0%)</td><td>0,987 - 0,962<br>(+2,5%)</td><td>0,993 - 0,981<br>(+1,2%)</td><td>(79 - 77) / 80<br>(+2,5%)</td><td>(20 - 20) / 20<br>(0%)</td><td>(99 - 97) / 100<br><strong>+2%</strong></td></tr><tr><td colspan="7"><strong>Dataset#3: Damages for Worker Wrongful Termination</strong></td></tr><tr><td>Outcome #1</td><td>0,913 - 0,912<br>(+0,1%)</td><td>1,000 - 0,981<br>(+1,9%)</td><td>0,955 - 0,945<br>(+1%)</td><td>(53 - 52) / 53<br>(+1,8%)</td><td>(42 - 42) / 47<br>(0%)</td><td>(95 - 94) / 100<br>(+1%)</td></tr><tr><td>Outcome #2</td><td>0,977 - 0,988<br>(-1,1%)</td><td>1,000 - 1,000<br>(0%)</td><td>0,989 - 0,994<br>(-0,5%)</td><td>(88 - 88) / 88<br>(0%)</td><td>(10 - 11) / 12<br>(-8,3%)</td><td>(98 - 99) / 100<br>(-1%)</td></tr><tr><td colspan="7"><strong>Dataset#4: Damages for Workplace Bullying or Sexual Harassment</strong></td></tr><tr><td>Outcome #1</td><td>0,900 - 0,880<br>(+2,2%)</td><td>1,000 - 1,000<br>(0%)</td><td>0,950 - 0,936<br>(+1,4%)</td><td>(44 - 44) / 44<br>(0%)</td><td>(51 - 50) / 56<br>(+1,7%)</td><td>(95 - 94) / 100<br>(+1%)</td></tr><tr><td>Outcome #2</td><td>0,901 - 0,901<br>(0%)</td><td>0,984 - 0,984<br>(0%)</td><td>0,941 - 0,940<br>(+0,1%)</td><td>(64 - 64) / 65<br>(0%)</td><td>(28 - 28) / 35<br>(0%)</td><td>(92 - 92) / 100<br>(0%)</td></tr></tbody></table>

**Comments:** The different runs with Llama3 show that the model size and pre-training is the dominant factor for performance. Prompt engineering of the system prompt had a negligible impact on performance. Llama3 seems to have reached a glass ceiling of near-perfect accuracy, that can't be broken by clever prompt engineering. The resistant errors most likely are the consequence of the poor quality of judicial documents that were fed to the model.

## 4.1 Dataset #1

<caption>Figure 4: Confusion Matrix for Mixtral (8x7b): Prompt#A for Outcome 1</caption>

Precision 0,964 – Recall 0,900 – Specificity. 0,700 – F1 0,930 – Accuracy 88%

<table><caption>Figure 5: Confusion Matrix for Mixtral (8x7b): Prompt#A for Outcome 2</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(RELEASE)</td><td>TN: 7</td><td>FN: 9</td><td>16</td></tr><tr><td>Mixtral answer: Pos.<br>(EXTENSION)</td><td>FP: 3</td><td>TP: 81</td><td>84</td></tr><tr><td>Total (expert)</td><td>10</td><td>90</td><td>100</td></tr></tbody></table>

Precision 0,987 – Recall 0,975 – Specific. 0,947 – F1 0,980 – Accuracy 97%

<table><thead><tr><th>Outcome 2<br>2nd judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(RELEASE)</td><td>TN: 18</td><td>FN: 2</td><td>20</td></tr><tr><td>Mixtral answer: Pos.<br>(EXTENSION)</td><td>FP: 1</td><td>TP: 79</td><td>80</td></tr><tr><td>Total (expert)</td><td>19</td><td>81</td><td>100</td></tr></tbody></table>
<caption>Figure 6: Confusion Matrix for Llama3 (70b): Prompt#A for Outcome 1</caption>

Precision 0,965 – Recall 0,933 – Specif. 0,700 – F1 0,948 – Accuracy 91%

<table><caption>Figure 7: Confusion Matrix for Llama3 (70b) : Prompt#A for Outcome 2</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(RELEASE)</td><td>TN: 7</td><td>FN: 6</td><td>13</td></tr><tr><td>LlaMa answer: Pos.<br>(EXTENSION)</td><td>FP: 3</td><td>TP: 84</td><td>87</td></tr><tr><td>Total (expert)</td><td>10</td><td>90</td><td>100</td></tr></tbody></table>

Precision 0,963 – Recall 0,987 – Specif. 0,842 – F1 0,974 – Accuracy 96%

<table><caption>Figure 8: Confusion Matrix for Mixtral (8x7b) : Prompt#B for Outcome 1</caption><thead><tr><th>Outcome 2<br>2nd judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(RELEASE)</td><td>TN: 16</td><td>FN: 1</td><td>17</td></tr><tr><td>LlaMa answer: Pos.<br>(EXTENSION)</td><td>FP: 3</td><td>TP: 80</td><td>83</td></tr><tr><td>Total (expert)</td><td>19</td><td>81</td><td>100</td></tr></tbody></table>

Precision 0,962 – Recall 0,866 – Specif. 0,700 – F1 0,912 – Accuracy 85%

<table><caption>Figure 9: Confusion Matrix for Mixtral (8x7b) : Prompt#B for Outcome 2</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(RELEASE)</td><td>TN: 7</td><td>FN: 9</td><td>16</td></tr><tr><td>Mixtral answer: Pos.<br>(EXTENSION)</td><td>FP: 3</td><td>TP: 78</td><td>81</td></tr><tr><td>Empty: failed gen.</td><td></td><td>3</td><td>3</td></tr><tr><td>Total (expert)</td><td>10</td><td>90</td><td>100</td></tr></tbody></table>

Precision 1,000 – Recall 0,913 – Specif. 1,000 – F1 0,954 – Accuracy 93%

<table><thead><tr><th>Outcome 2<br>2nd judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(RELEASE)</td><td>TN: 19</td><td>FN: 3</td><td>22</td></tr><tr><td>Mixtral answer: Pos.<br>(EXTENSION)</td><td>FP: 0</td><td>TP: 74</td><td>74</td></tr><tr><td>Empty: failed gen.</td><td></td><td>4</td><td>4</td></tr><tr><td>Total (expert)</td><td>19</td><td>81</td><td>100</td></tr></tbody></table>
<caption>Figure 10: Confusion Matrix for Llama3 (70b): Prompt#B for Outcome 1</caption>

Precision 0,988 – Recall 0,988 – Specif. 0,900 – F1 0,988 – Accuracy 98%

<table><caption>Figure 11: Confusion Matrix for Llama3 (70b): Prompt#B for Outcome 2</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(RELEASE)</td><td>TN: 9</td><td>FN: 1</td><td>10</td></tr><tr><td>LlaMa answer: Pos.<br>(EXTENSION)</td><td>FP: 1</td><td>TP: 89</td><td>90</td></tr><tr><td>Total (expert)</td><td>10</td><td>90</td><td>100</td></tr></tbody></table>

Precision 1,000 – Recall 0,987 – Specif. 1,000 – F1 0,994 – Accuracy 99%

<table><thead><tr><th>Outcome 2<br>2nd judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(RELEASE)</td><td>TN: 19</td><td>FN: 1</td><td>20</td></tr><tr><td>LlaMa answer: Pos.<br>(EXTENSION)</td><td>FP: 0</td><td>TP: 80</td><td>80</td></tr><tr><td>Total (expert)</td><td>19</td><td>81</td><td>100</td></tr></tbody></table>

## 4.2 Dataset #2

<caption>Figure 12: Confusion Matrix for Mixtral (8x7b) : Prompt#A for Outcome#1</caption>

Precision 0,833 – Recall 0,733 – Specif. 0,560 – F1 0,779 – Accuracy 69%

<table><caption>Figure 13: Confusion Matrix for Mixtral (8x7b) : Prompt#A for Outcome#2</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(RELEASE)</td><td>TN: 14</td><td>FN: 20</td><td>34</td></tr><tr><td>Mixtral answer: Pos.<br>(EXTENSION)</td><td>FP: 11</td><td>TP: 55</td><td>66</td></tr><tr><td>Total (expert)</td><td>25</td><td>75</td><td>100</td></tr></tbody></table>

Precision 0,935 – Recall 0,900 – Specif. 0,750 – F1 0,917 – Accuracy 87%

<table><thead><tr><th>Outcome 2<br>2nd judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(RELEASE)</td><td>TN: 15</td><td>FN: 8</td><td>23</td></tr><tr><td>Mixtral answer: Pos.<br>(EXTENSION)</td><td>FP: 5</td><td>TP: 72</td><td>77</td></tr><tr><td>Total (expert)</td><td>20</td><td>80</td><td>100</td></tr></tbody></table>
<caption>Figure 14: Confusion Matrix for LlaMa3 (70b): Prompt#A for Outcome#1</caption>

Precision 0,960 – Recall 0,960 – Specif. 0,880 – F1 0,960 – Accuracy 94%

<table><caption>Figure 15: Confusion Matrix for LlaMa3 (70b): Prompt#A for Outcome#2</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(RELEASE)</td><td>TN: 22</td><td>FN: 3</td><td>25</td></tr><tr><td>LlaMa answer: Pos.<br>(EXTENSION)</td><td>FP: 3</td><td>TP: 72</td><td>75</td></tr><tr><td>Total (expert)</td><td>25</td><td>75</td><td>100</td></tr></tbody></table>

Precision 1,000 – Recall 0,962 – Specif. 1,000 – F1 0,981 – Accuracy 97%

<table><caption>Figure 16: Confusion Matrix for Mixtral (8x7b): Prompt#B for Outcome#1</caption><thead><tr><th>Outcome 2<br>2nd judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(RELEASE)</td><td>TN: 20</td><td>FN: 3</td><td>23</td></tr><tr><td>LlaMa answer: Pos.<br>(EXTENSION)</td><td>FP: 0</td><td>TP: 77</td><td>77</td></tr><tr><td>Total (expert)</td><td>20</td><td>80</td><td>100</td></tr></tbody></table>

Precision 0,946 – Recall 0,706 – Specif. 0,880 – F1 0,809 – Accuracy 75%

<table><caption>Figure 17: Confusion Matrix for Mixtral (8x7b): Prompt#B for Outcome#2</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(RELEASE)</td><td>TN: 22</td><td>FN: 21</td><td>43</td></tr><tr><td>Mixtral answer: Pos.<br>(EXTENSION)</td><td>FP: 3</td><td>TP: 53</td><td>56</td></tr><tr><td>Empty</td><td></td><td>1</td><td>1</td></tr><tr><td>Total (expert)</td><td>25</td><td>75</td><td>100</td></tr></tbody></table>

Precision 0,962 – Recall 0,962 – Specif. 0,800 – F1 0,962 – Accuracy 93%

<table><thead><tr><th>Outcome 2<br>2nd judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(RELEASE)</td><td>TN: 16</td><td>FN: 2</td><td>18</td></tr><tr><td>Mixtral answer: Pos.<br>(EXTENSION)</td><td>FP: 3</td><td>TP: 77</td><td>80</td></tr><tr><td>Empty</td><td>1</td><td>1</td><td>2</td></tr><tr><td>Total (expert)</td><td>20</td><td>80</td><td>100</td></tr></tbody></table>
<caption>Figure 18: Confusion Matrix for LlaMa3 (70b): Prompt#B for Outcome#1</caption>

Precision 0,958 – Recall 0,933 – Specif. 0,880 – F1 0,946 – Accuracy 92%

<table><caption>Figure 19: Confusion Matrix for LlaMa3 (70b): Prompt#B for Outcome#2</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(RELEASE)</td><td>TN: 22</td><td>FN: 5</td><td>27</td></tr><tr><td>LlaMA answer: Pos.<br>(EXTENSION)</td><td>FP: 3</td><td>TP: 70</td><td>73</td></tr><tr><td>Total (expert)</td><td>25</td><td>75</td><td>100</td></tr></tbody></table>

Precision 1,000 – Recall 0,987 – Specif. 1,000 – F1 0,993 – Accuracy 99%

<table><thead><tr><th>Outcome 2<br>2<sup>nd</sup> judge</th><th>Expert answer: Neg.<br>(RELEASE)</th><th>Expert answer: Pos.<br>(EXTENSION)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(RELEASE)</td><td>TN: 20</td><td>FN: 1</td><td>21</td></tr><tr><td>LlaMA answer: Pos.<br>(EXTENSION)</td><td>FP: 0</td><td>TP: 79</td><td>79</td></tr><tr><td>Total (expert)</td><td>20</td><td>80</td><td>100</td></tr></tbody></table>

## 4.3 Dataset #3

<caption>Figure 20: Confusion Matrix for Mixtral (8x7b): Prompt#A for Outcome#1</caption>

Precision 0,870 – Recall 0,886 – Specif. 0,723 – F1 0,878 – Accuracy 81%

<table><caption>Figure 21: Confusion Matrix for Mixtral (8x7b): Prompt#A for Outcome#2</caption><thead><tr><th>Outcome 1<br>(1st judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(REJECTED)</td><td>TN: 34</td><td>FN: 1</td><td>35</td></tr><tr><td>Mixtral answer: Pos.<br>(ACCEPTED)</td><td>FP: 7</td><td>TP: 47</td><td>54</td></tr><tr><td>Empty<br>(failed<br>generation)</td><td>6</td><td>5</td><td>11</td></tr><tr><td>Total (expert)</td><td>47</td><td>53</td><td>100</td></tr></tbody></table>

Precision 0,937 – Recall 0,852 – Specif. 0,583 – F1 0,893 – Accuracy 82%

<table><thead><tr><th>Outcome 2<br>(2nd judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(REJECTED)</td><td>TN: 7</td><td>FN: 2</td><td>9</td></tr><tr><td>Mixtral answer: Pos.<br>(ACCEPTED)</td><td>FP: 5</td><td>TP: 75</td><td>80</td></tr><tr><td>Empty<br>(failed<br>generation)</td><td>0</td><td>11</td><td>11</td></tr><tr><td>Total (expert)</td><td>12</td><td>88</td><td>100</td></tr></tbody></table>
<caption>Figure 22: Confusion Matrix LlaMa3 (70b): Prompt#A for Outcome#1</caption>

Precision 0,912 – Recall 0,981 – Specif. 0,893 – F1 0,945 – Accuracy 94%

<table><caption>Figure 23: Confusion Matrix for LlaMa3 (70b): Prompt#A for Outcome#2</caption><thead><tr><th>Outcome 1<br>(1st judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMA answer: Neg.<br>(REJECTED)</td><td>TN: 42</td><td>FN: 1</td><td>43</td></tr><tr><td>LlaMA answer: Pos.<br>(ACCEPTED)</td><td>FP: 5</td><td>TP: 52</td><td>57</td></tr><tr><td>Total (expert)</td><td>47</td><td>53</td><td>100</td></tr></tbody></table>

Precision 0,988 – Recall 1,000 – Specif. 0,916 – F1 0,994 – Accuracy 99%

<table><caption>Figure 24: Confusion Matrix for Mixtral (8x7b): Prompt#B for Outcome#1</caption><thead><tr><th>Outcome 2<br>(2nd judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(REJECTED)</td><td>TN: 11</td><td>FN: 0</td><td>11</td></tr><tr><td>LlaMa answer: Pos.<br>(ACCEPTED)</td><td>FP: 1</td><td>TP: 88</td><td>89</td></tr><tr><td>Total (expert)</td><td>12</td><td>88</td><td>100</td></tr></tbody></table>

Precision 0,815 – Recall 1,000 – Specif. 0,723 – F1 0,898 – Accuracy 87%

<table><caption>Figure 25: Confusion Matrix for Mixtral (8x7b): Prompt#B for Outcome#2</caption><thead><tr><th>Outcome 1<br>(1st judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(REJECTED)</td><td>TN: 34</td><td>FN: 0</td><td>34</td></tr><tr><td>Mixtral answer: Pos.<br>(ACCEPTED)</td><td>FP: 12</td><td>TP: 53</td><td>65</td></tr><tr><td>Empty: gen. failed</td><td>1</td><td></td><td>1</td></tr><tr><td>Total (expert)</td><td>47</td><td>53</td><td>100</td></tr></tbody></table>

Precision 0,955 – Recall 0,965 – Specif. 0,583 – F1 0,960 – Accuracy 92%

<table><thead><tr><th>Outcome 2<br>(2nd judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(REJECTED)</td><td>TN: 7</td><td>FN: 1</td><td>8</td></tr><tr><td>Mixtral answer: Pos.<br>(ACCEPTED)</td><td>FP: 4</td><td>TP: 85</td><td>89</td></tr><tr><td>Empty: gen. failed</td><td>1</td><td>2</td><td>3</td></tr><tr><td>Total (expert)</td><td>12</td><td>88</td><td>100</td></tr></tbody></table>
<caption>Figure 26: Confusion Matrix for LlaMa3 (70b): Prompt#B for Outcome#1</caption>

Precision 0,913 – Recall 1,000 – Specif. 0,893 – F1 0,955 – Accuracy 95%

<table><caption>Figure 27: Confusion Matrix for LlaMa3 (70b): Prompt#B for Outcome#2</caption><thead><tr><th>Outcome 1<br>(1st judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(REJECTED)</td><td>TN: 42</td><td>FN: 0</td><td>42</td></tr><tr><td>LlaMa answer: Pos.<br>(ACCEPTED)</td><td>FP: 5</td><td>TP: 53</td><td>58</td></tr><tr><td>Total (expert)</td><td>47</td><td>53</td><td>100</td></tr></tbody></table>

Precision 0,977 – Recall 1,000 – Specif. 0,833 – F1 0,989 – Accuracy 98%

<table><thead><tr><th>Outcome 2<br>(2nd judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(REJECTED)</td><td>TN: 10</td><td>FN: 0</td><td>10</td></tr><tr><td>LlaMa answer: Pos.<br>(ACCEPTED)</td><td>FP: 2</td><td>TP: 88</td><td>90</td></tr><tr><td>Total (expert)</td><td>12</td><td>88</td><td>100</td></tr></tbody></table>

## 4.4 Dataset #4

<caption>Figure 28: Confusion Matrix for Mixtral (8x7b): Prompt#A for Outcome#1</caption>

Precision 0,921 – Recall 0,795 – Specif. 0,892 – F1 0,853 – Accuracy 85%

<table><caption>Figure 29: Confusion Matrix for Mixtral (8x7b): Prompt#A for Outcome#2</caption><thead><tr><th>Outcome 1<br>(1st judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(REJECTED)</td><td>TN: 50</td><td>FN: 5</td><td>55</td></tr><tr><td>Mixtral answer: Pos.<br>(ACCEPTED)</td><td>FP: 3</td><td>TP: 35</td><td>38</td></tr><tr><td>Empty<br>(failed<br>generation)</td><td>3</td><td>4</td><td>7</td></tr><tr><td>Total (expert)</td><td>56</td><td>44</td><td>100</td></tr></tbody></table>

Precision 0,919 – Recall 0,876 – Specif. 0,828 – F1 0,896 – Accuracy 86%

<table><thead><tr><th>Outcome 2<br>(2nd judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(REJECTED)</td><td>TN: 29</td><td>FN: 2</td><td>31</td></tr><tr><td>Mixtral answer: Pos.<br>(ACCEPTED)</td><td>FP: 5</td><td>TP: 57</td><td>62</td></tr><tr><td>Empty<br>(failed<br>generation)</td><td>1</td><td>6</td><td>7</td></tr><tr><td>Total (expert)</td><td>35</td><td>65</td><td>100</td></tr></tbody></table>
<caption>Figure 30: Confusion Matrix for LlaMa3 (70b): Prompt#A for Outcome#1</caption>

Precision 0,880 – Recall 1,000 – Specif. 0,892 – F1 0,936 – Accuracy 94%

<table><caption>Figure 31: Confusion Matrix for LlaMa3 (70b): Prompt#A for Outcome#2</caption><thead><tr><th>Outcome 1<br>(1st judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(REJECTED)</td><td>TN: 50</td><td>FN: 0</td><td>50</td></tr><tr><td>LlaMa answer: Pos.<br>(ACCEPTED)</td><td>FP: 6</td><td>TP: 44</td><td>50</td></tr><tr><td>Total (expert)</td><td>56</td><td>44</td><td>100</td></tr></tbody></table>

Precision 0,901 – Recall 0,984 – Specif. 0,800 – F1 0,940 – Accuracy 92%

<table><caption>Figure 32: Confusion Matrix for Mixtral (8x7b): Prompt#B for Outcome#1</caption><thead><tr><th>Outcome 2<br>(2nd judge)</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(REJECTED)</td><td>TN: 28</td><td>FN: 1</td><td>29</td></tr><tr><td>Mixtral answer: Pos.<br>(ACCEPTED)</td><td>FP: 7</td><td>TP: 64</td><td>71</td></tr><tr><td>Total (expert)</td><td>35</td><td>65</td><td>100</td></tr></tbody></table>

Precision 0,916 – Recall 1,000 – Specif. 0,928 – F1 0,956 – Accuracy 96%

<table><caption>Figure 33: Confusion Matrix for Mixtral (8x7b): Prompt#B for Outcome#2</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(REJECTED)</td><td>TN: 52</td><td>FN: 0</td><td>52</td></tr><tr><td>Mixtral answer: Pos.<br>(ACCEPTED)</td><td>FP: 4</td><td>TP: 44</td><td>48</td></tr><tr><td>Total (expert)</td><td>56</td><td>44</td><td>100</td></tr></tbody></table>

Precision 0,921 – Recall 0,907 – Specif. 0,857 – F1 0,915 – Accuracy 89%

<table><thead><tr><th>Outcome 2<br>2nd judge</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>Mixtral answer: Neg.<br>(REJECTED)</td><td>TN: 30</td><td>FN: 6</td><td>36</td></tr><tr><td>Mixtral answer: Pos.<br>(ACCEPTED)</td><td>FP: 5</td><td>TP: 59</td><td>64</td></tr><tr><td>Total (expert)</td><td>35</td><td>65</td><td>100</td></tr></tbody></table>
<table><caption>Figure 34: Confusion Matrix for LlaMa3 (70b): Prompt#B for Outcome#1</caption><caption>Precision 0,900 – Recall 1,000 – Specif. 0,910 – F1 0,950 – Accuracy 95%</caption><thead><tr><th>Outcome 1<br>1st judge</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(REJECTED)</td><td>TN: 51</td><td>FN: 0</td><td>51</td></tr><tr><td>LlaMa answer: Pos.<br>(ACCEPTED)</td><td>FP: 5</td><td>TP: 44</td><td>49</td></tr><tr><td>Total (expert)</td><td>56</td><td>44</td><td>100</td></tr></tbody></table>

<table><caption>Figure 35: Confusion Matrix for LlaMa3 (70b): Prompt#B for Outcome#2</caption><caption>Precision 0,901 – Recall 0,984 – Specif. 0,800 – F1 0,941 – Accuracy 92%</caption><thead><tr><th>Outcome 2<br>2nd judge</th><th>Expert answer: Neg.<br>(REJECTED)</th><th>Expert answer: Pos.<br>(ACCEPTED)</th><th>Total (LLM)</th></tr></thead><tbody><tr><td>LlaMa answer: Neg.<br>(REJECTED)</td><td>TN: 28</td><td>FN: 1</td><td>29</td></tr><tr><td>LlaMa answer: Pos.<br>(ACCEPTED)</td><td>FP: 7</td><td>TP: 64</td><td>71</td></tr><tr><td>Total (expert)</td><td>35</td><td>65</td><td>100</td></tr></tbody></table>

## 5. Discussion

Overall, both LLMs achieved higher performance in data extraction, compared to machine learning techniques. For comparison, Petrova et al.<fnref n="36" /> reported a F1 score of 82,32%. Vacek et al.<fnref n="37" /> reported an average F1 score of 91%. On a very similar task with pre-trained models, Vaudaux et al. reached 92% with CamBERT, 94% with FlauBERT and 96% with JuriBERT.<fnref n="38" /> Llama3 clearly outperformed these results.

The Mixtral (8x7b) model exhibited variable performance when applied to datasets related to involuntary psychiatric commitment, undocumented alien detention, and workplace-related damages. This variability indicates challenges in consistently identifying true positives and negatives, particularly in datasets with a high number of negative outcomes. The model's performance metrics highlight its limitations in handling imbalanced class distributions.

On the other hand, the Llama3 (70b) model demonstrated superior performance across all datasets, consistently achieving high precision and recall metrics. This suggests that Llama3's larger size and extensive pre-training enable it to extract effectively judicial outcomes from complex documents.

While prompt engineering offered some potential improvements for Mixtral, it was inadequate in overcoming the model's inherent limitations, likely due to its smaller size and less comprehensive training. Mixtral's performance improvements were marginal and often inconsistent across different datasets, indicating that prompt adjustments can refine model responses but cannot fundamentally enhance a model's capabilities beyond its architectural constraints. This underscores the necessity for large-scale, well-trained models to tackle complex data extraction tasks effectively.

Llama3's performance reached a near-perfect accuracy plateau, that couldn't be improved by prompt engineering, suggesting its limitations were caused by the low-quality of input data. Despite high precision and recall rates, minor errors persistence highlights the critical importance of input data quality. While prompt engineering is essential to harness Llama3's full potential, it is insufficient to address errors from poor-quality documents, highlighting the need for robust data preprocessing.

Regarding prompt engineering, results from Prompt #A and Prompt #B align with Sainz et al. prompting strategy,<fnref n="39" /> with instructions in JSON format. Directional Stimulus prompting in JSON format is a reliable method for extracting judicial

<footnote n="36">³⁶ Petrova, "Extracting Outcomes from Appellate Decisions in US State Courts," 133–142.</footnote>

<footnote n="37">³⁷ Vacek, "Litigation Analytics," 45–54.</footnote>

<footnote n="38">³⁸ Vaudaux, "Pretrained Language Models v. Court Ruling Predictions," 38–43.</footnote>

<footnote n="39">³⁹ Sainz, "GoLLIE."</footnote>
outcomes from unstructured text. As shown in Figure 3, advanced techniques like chain-of-thought prompting or generated knowledge prompting could enhance a weaker model like Mixtral, but they have limited impact on a more advanced model like Llama3 when it already reached is plateau. Our results suggests that Llama3 can perform data extraction reliably without additional context, comments, definitions or detailed instructions. Llama3 is already well-suited for data extraction tasks, and is able to rely on simple cues in JSON format without lengthy and detailed instructions.

In conclusion, LLMs in zero-shot setting can perform accurate legal data extraction from unstructured text without fine-tuning. To further validate these results and explore the full potential of LLMs in legal data extraction, future research should expand the number of manually annotated cases to confirm the reliability of the results. It will also be useful to evaluate the extraction of numerical values, such as compensation amounts. Creating a large multilingual benchmark of annotated cases accessible to the research community will enable the testing of prompts and models, driving further innovation in this field. Finally, a qualitative investigation of errors should be implemented, to better understand their causes. If LLMs are confirmed as good data extractors, a large scale automated extraction could provide useful data for Legal Empirical research.

**Data availability statement**

All the data associated with the research is available online at: ZAMBRANO, Guillaume. 2024. "LILA: Litigation Data Extraction with LLMs." OSF. July 13. doi:10.17605/OSF.IO/M4FKT.

**Funding**

The author(s) declare that no financial support was received for the research, authorship, and/or publication of this article.
Bibliography

Agrawal, Monica, Stefan Hegselmann, Hunter Lang, Yoon Kim, and David Sontag. "Large Language Models Are Few-Shot Clinical Information Extractors." *ArXiv.org*. (2022). https://doi.org/10.48550/arXiv.2205.12689.

Ashley, Kevin. *Artificial Intelligence and Legal Analytics: New Tools for Law Practice in the Digital Age*. Cambridge University Press. 2017.

Bertalan, Vithor Gomes and Evandro Eduardo Ruiz. "Using Attention Methods to Predict Judicial Outcomes." *Artificial Intelligence and Law* 32, no 1 (2022): 87-115. https://doi.org/10.1007/s10506-022-09342-7.

Caufield, J. Harry, Harshad Hegde, Vincent Emonet, Nomi L Harris, Marcin P Joachimiak, Nicolas Matentzoglu, HyeongSik Kim, Sierra Moxon, Justin T Reese, Melissa A Haendel, Peter N Robinson, Christopher J Mungall. "Structured Prompt Interrogation and Recursive Extraction Of Semantics (SPIRES): A Method For Populating Knowledge Bases Using Zero-Shot Learning." *Bioinformatics* 40, no 3 (2024). https://doi.org/10.1093/bioinformatics/btae104.

Coelho, Gustavo, Alimed Celecia, Jefferson de Sousa, Melissa Lemos, Maria Lima, Ana Mangeth, Isabella Frajhof and Marco Casanova. "Information Extraction in the Legal Domain: Traditional Supervised Learning vs. ChatGPT." In *Proceedings of the 26th International Conference on Enterprise Information Systems*. Vol. 1, SciTePress, 579-586. 2024. https://www.scitepress.org/Documents/2024/124998/.

de Faria, Joana Ribeiro, Huiyuan Xie and Felix Steffek. "Automatic Information Extraction From Employment Tribunal Judgements Using Large Language Models." *University of Cambridge Faculty of Law Research Paper*, no 13 2024. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4776160.

Devlin, Jacob, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. "Bert: Pre-training of Deep Bidirectional Transformers for Language Understanding." In *Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics*. Volume 1 (Long and Short Papers), 4171-4186, Minneapolis, Minnesota. Association for Computational Linguistics. https://doi.org/10.18653/v1/N19-1423.

Dubey, Abhimanyu, Jauhri, Abhinav, Pandey, Abhinav, et al. "The Llama 3 Herd of Models." *arXiv preprint* 2024. https://doi.org/10.48550/arXiv.2407.21783.

Guha, Neel, Nyarko, Julian, HO, Daniel, et al. "Legalbench: A Collaboratively Built Benchmark for Measuring Legal Reasoning in Large Language Models." *arXiv preprint* 2023. https://doi.org/10.48550/arXiv.2308.11462.

Hart, H. L. A. *The Concept of Law*. Oxford University Press, 1961.

Huang, Wei, Xudong Ma, Haotong Qin, Xingyu Zheng, Chengtao Lv, Hong Chen, Jie Luo, Xiaojuan Qi, Xianglong Liu, Michele Magno. "How Good Are Low-Bit Quantized Llama3 Models? An Empirical Study." *arXiv preprint* 2024. https://doi.org/10.48550/arXiv.2404.14047.

Izzidien, Ahmed, Holli Sargeant and Felix Steffek. "LLM vs. Lawyers: Identifying a Subset of Summary Judgments in a Large UK Case Law Dataset." *arXiv preprint* 2024. https://doi.org/10.48550/arXiv.2403.04791.

Kartchner, David, Selvi Ramalingam, Irfan Al-Hussaini, Olivia Kronick and Cassie Mitchell. "Zero-Shot Information Extraction for Clinical Meta-Analysis using Large Language Models." In *The 22nd Workshop on Biomedical Natural Language Processing and BioNLP Shared Tasks*, Association for Computational Linguistics, 396-405. 2023. https://doi.org/10.18653/v1/2023.bionlp-1.37.

Loevinger, Lee. "Jurimetrics: The Methodology of Legal Inquiry." *Law and Contemporary Problems* (1963): 5-35.

McInerney, Denis. "CHiLL: Zero-shot Custom Interpretable Feature Extraction from Clinical Notes with Large Language Models." In *Findings of the Association for Computational Linguistics: EMNLP 2023, Singapore*. Association for Computational Linguistics. 2023. https://doi.org/10.18653/v1/2023.findings-emnlp.568.

Mistica, Meladel, Geordie Zhang, Hui Chia, Kabir Manandhar Shrestha, Rohit Gupta, Saket Khandelwal, Jeannie Paterson, Tim Baldwin and Daniel Beck. "Information Extraction from Legal Documents: A Study in the Context of Common Law Court Judgements." In *Proceedings of the 18th Annual Workshop of the Australasian Language Technology Association*, 98-103, ACLWeb. 2020. https://aclanthology.org/2020.alta-1.12/.

Petrova, Alina, John Armour and Thomas Lukasiewicz. "Extracting Outcomes from Appellate Decisions in US State Courts." In *33rd International Conference on Legal Knowledge and Information Systems (JURIX 2020)*. Volume 334: Legal Knowledge and Information Systems. Frontiers in Artificial Intelligence and Applications. 133-42. https://ebooks.iospress.nl/volumearticle/56170.

Rehaag, Sean. "Luck of the Draw III: Using AI to Using AI to Extract Data About Decision-Making in Federal Court Stays of Removal." *Queen's LJ*. (2024): 49:2 73. https://ssrn.com/abstract=4322881.

Sainz, Oscar, Iker García-Ferrero, Rodrigo Agerri, Oier Lopez de Lacalle, German Rigau and Eneko Agirre. "GoLLIE: Annotation Guidelines Improve Zero-Shot Information-Extraction." *ArXiv.org*. 2024. https://doi.org/10.48550/arXiv.2310.03668.

Santosuosso, Amedeo and Giulia Pinotti. "Bottleneck or Crossroad? Problems of Legal Sources Annotation and Some Theoretical Thoughts." *Stats* 3, no 3 (2020): 376-395. https://doi.org/10.3390/stats3030024.
Sargeant, Holli, Ahmed Izzidien and Feliz Steffek. "Topic Modelling Case Law Using a Large Language Model and a New Taxonomy for UK Law: AI Insights into Summary Judgment". University of Cambridge Faculty of Law Research Paper no 21 (2024). https://ssrn.com/abstract=4836558.

Satterfield, Nolan, Parker Holbrook and Thomas Wilcox. "Fine-tuning Llama with Case Law Data to Improve Legal Domain Performance." OSF Preprints. 2024. https://osf.io/preprints/osf/e6mjs.

Savelka Jaromir. "Unlocking Practical Applications in Legal Domain: Evaluation of GPT for Zero-Shot Semantic Annotation of Legal Texts." In Proceedings of the Nineteenth International Conference on Artificial Intelligence and Law (ICAIL '23). Association for Computing Machinery, 447-451. 2023. https://doi.org/10.1145/3594536.3595161.

Schlegel, John Henry. "Empirical Legal Research At Johns Hopkins: Walter Wheeler Cook And His Friends." In American Legal Realism and Empirical Social Science, 147-210. University of North Carolina Press, 1995. www.jstor.org/stable/10.5149/9780807864364_schlegel.9.

Sclar, Melanie, Yejin Choi, Yulia Tsvetkov and Alane Suhr. "Quantifying Language Models' Sensitivity to Spurious Features in Prompt Design or: How I learned to start worrying about prompt formatting." arXiv preprint. 2023. https://doi.org/10.48550/arXiv.2310.11324.

Shao, Minghao, Abdul Basit, Ramesh Karri and Muhammad Shafique "Survey of Different Large Language Model Architectures: Trends, Benchmarks, and Challenges." IEEE Access, 2024. http://dx.doi.org/10.1109/ACCESS.2024.3482107.

Shen, Shirong, Guilin Qi, Zhen Li, Sheng Bi and Lusheng Wang "Hierarchical Chinese Legal Event Extraction via Pedal Attention Mechanism." In Proceedings of the 28th International Conference on Computational Linguistics. 2020. https://doi.org/10.18653/v1/2020.coling-main.9.

Sun, Qi Kun Huang, Xiaocui Yang, Rong Tong and Kun Zhang and Soujanya Poria. "Consistency Guided Knowledge Retrieval and Denoising in LLMs for Zero-Shot Document-Level Relation Triplet Extraction." In Proceedings of the ACM on Web Conference, 4407-4416. 2024. https://doi.org/10.1145/3589334.3645678.

Vacek Thomas, Ronald Teo, Dezhao Song, Timothy Nugent, Conner Cowling and Frank Schilder. "Litigation Analytics: Case Outcomes Extracted from US Federal Court Dockets." In Proceedings of the Natural Legal Language Processing Workshop 2019, 45-54. ACLWeb. https://doi.org/10.18653/v1/W19-2206.

Vaudaux Olivia, Caroline Bazzoli, Maximin Coavoux, Géraldine Vial and Étienne Vergès. "Pretrained Language Models v. Court Ruling Predictions: A Case Study on a Small Dataset of French Court of Appeal Rulings." In Proceedings of the Natural Legal Language Processing Workshop 2023, ACLWeb. Singapore: Association for Computational Linguistics. 2023. https://doi.org/10.18653/v1/2023.nllp-1.5.

Wadhwa Somin, Jay DeYoung, Benjamin Nye, Silvio Amir and Byron C. Wallace. "Jointly Extracting Interventions, Outcomes, and Findings from RCT Reports with LLMs." ArXiv.org. 2023. https://doi.org/10.48550/arXiv.2305.03642.

Xiang, Wei, Xingyu Cui, Ning Cheng, Xiaobin Wang, Xin Zhang, Shen Huang, Pengjun Xie, Jinan Xu, Yufeng Chen, Meishan Zhang, Yong Jiang and Wenjuan Han. "Zero-Shot Information Extraction via Chatting with ChatGPT". ArXiv preprint. 2023. https://doi.org/10.48550/arxiv.2302.10205.

Yao Feng, Chaojun Xiao, Xiaozhi Wang, Zhiyuan Liu, Lei Hou, Cunchao Tu, Juanzi Li, Yun Liu, Weixing Shen and Maosong Sun. "LEVEN: A Large-Scale Chinese Legal Event Detection Dataset." Findings of the Association for Computational Linguistics : ACL 2022, January. https://doi.org/10.18653/v1/2022.findings-acl.17.

Yue Chongjian, Xinrun Xu, Xiaojun Ma, Lun Du, Hengyu Liu, Zhiming Ding, Yanbing Jiang, Shi Han and Dongmei Zhang. "Leveraging LLMs for KPIs Retrieval from Hybrid Long-Document: A Comprehensive Framework and Dataset." ArXiv preprint. 2023. https://doi.org/10.48550/arxiv.2305.16344.

Yue, Linan, Qi Liu, Lili Zhao, Li Wang, Weibo Gao and Yanqing An. "Event Grounded Criminal Court View Generation with Cooperative (Large) Language Models." ArXiv preprint. 2024. https://doi.org/10.48550/arXiv.2404.07001.

Zhong Haoxi, Chaojun Xiao, Cunchao Tu, Tianyang Zhang, Zhiyuan Liu, and Maosong Sun. "How Does NLP Benefit Legal System: A Summary of Legal Artificial Intelligence." ArXiv preprint. 2020. https://doi.org/10.48550/arXiv.2004.12158.