Gaps or Hallucinations? Scrutinizing Machine-Generated Legal Analysis for Fine-grained Text Evaluations (2024)

Abstract: Large Language Models (LLMs) show promise as a writing aid for professionals performing legal analyses. However, LLMs can often hallucinate in this setting, in ways difficult to recognize by non-professionals and existing text evaluation metrics. In this work, we pose the question: when can machine-generated legal analysis be evaluated as acceptable? We introduce the neutral notion of gaps – as opposed to hallucinations in a strict erroneous sense – to refer to the difference between human-written and machine-generated legal analysis. Gaps do not always equate to invalid generation. Working with legal experts, we consider the CLERC generation task proposed in Hou et al. (2024b), leading to a taxonomy, a fine-grained detector for predicting gap categories, and an annotated dataset for automatic evaluation. Our best detector achieves 67% F1 score and 80% precision on the test set. Employing this detector as an automated metric on legal analysis generated by SOTA LLMs, we find around 80% contain hallucinations of different kinds.

## introduction legal professionals write legal analysis to help precisely communicate a legal issue or persuade judges @xcite . despite recent work demonstrating that llms have the potential to generate realistic legal analyses to aid lawyers, they severely hallucinate @xcite . in order to drive improvements, it is important to develop insights on the nature, categories, and sources of these hallucinations. evaluating legal analysis generation is challenging because the generation may: (1) have multiple ground truths, as legal practitioners can write an acceptable piece of analysis in many ways, (2) have 1 we release the code and data at https://github.com/ bohanhou14/gaphalu . figure 1 : detection results among the best detectors with different base models. m #ds means the best detector of base model m has d in-context demonstrations. gpt-4o#20s achieves the highest mgem and mgp , while mistral-nemo-instruct-2407#16s achieves the highest mgr and mgf 1 . we also note that the general notion of gaps is not specific to legal analysis generation, but applicable to any generation setting when multiple ground truths are possible. we focus on gaps in legal analysis generation as it is a domain especially suitable for this exploration. unlike multiple translations or abstract summarizations which may have differences in syntax and word choice or the facts deemed essential to carry into a summary, valid legal analyses can illustrate significantly higher variability. moreover, the creation of multiple references for legal analysis is cost prohibitive, as it requires legal experts to create an alternative writing that leads to the same result. in this work, our contributions include: the rest of the work is laid out as follows: we provide background on legal analysis and hallucination in section 2, then explain our proposed gap taxonomy in section 3. we develop detectors for classifying gaps according to the taxonomy in section 4 and apply these to evaluate legal analysis generations in section 5. lastly, we provide suggestions for mitigating legal hallucinations in section 6 and discuss related work in section 7. ## a taxonomy of gaps as popular reference-based metrics such as rouge and bartscore @xcite and factuality metrics like factscore @xcite only partially indicate validity of legal analysis generation @xcite , an automated metric for evaluating legal analysis generation is necessary. we first study the nature and typology of hallucinations, motivating a detailed taxonomy and error analysis, and then apply it to enable text evaluations (see section 5). we systematically review generation data from clerc and propose a detailed taxonomy of gaps in figure 2 . we classify the gaps into two types, in line with @xcite : intrinsic, which refer to gaps that derive from the internal inaccuracies of llms in following prompts and previous contexts; and extrinsic, which refer to gaps due to mismatches with cited sources and lacks of grounding on logical rules and existing facts. we attach examples in figure 3 and appendix a, and for each fine-grained gap category in appendix b. ## gap detection in this section, we build a detector to classify gap categories according to our proposed taxonomy. ## mitigation suggestions in this section, we discuss general strategies to mitigate legal hallucinations as well as specific suggestions related to each gap category. ## conclusion and future work to facilitate a fine-grained evaluation of generated legal analysis, we propose a taxonomy of gaps and develop detectors to analyze the sources of legal hallucinations, also experimenting with gap-score and gaphalu to assess the validity of generated legal analysis. for future work, we will extend our framework of analyzing gaps on the general text domain for fine-grained text evaluations.