impact of LLaMA fine tuning on hallucinations for name entity extraction in legal documents
Open Access
- 1 April 2025
- journal article
- Published by Universidad Nacional de La Plata in SADIO Electronic Journal of Informatics and Operations Research
- Vol. 24 (1) , e068
Abstract
The extraction of information about traffic accidents from legal documents is crucial for quantifying insurance company costs. Extracting entities such as percentages of physical and/or psychological disability and the involved compensation amounts is a challenging process, even for experts, due to the subtle arguments and reasoning in the court decision. A two-step procedure is proposed: first, segmenting the document identifying the most relevant segments, and then extracting the entities. For text segmentation, two methodologies are compared: a classic method based on regular expressions and a second approach that divides the document into blocks of n-tokens, which are then vectorized using multilingual models for semantic searches (text-embedding-ada-002/MiniLM-L12-v2). Subsequently, large language models (LLaMA-2 7b, 70b, LLaMA-3 8b, and GPT-4 Turbo) are applied with prompting to the selected segments for entity extraction. For the LLaMA models, finetuning is performed using LoRA. LLaMA-2 7b, even with zero temperature, shows a significant number of hallucinations in extractions which are an important contention point for named entity extraction. This work shows that these hallucinations are substantially reduced after finetuning the model. The performance of the methodology based on segment vectorization and subsequent use of LLMs significantly surpasses the classic method which achieves an accuracy of 39.5%. Among open-source models, LLaMA-2 70B with finetuning achieves the highest accuracy 79.4%, surpassing its base version 61.7%. Notably, the base LLaMA-3 8B model already performs comparably to the finetuned LLaMA-2 70B model, achieving 76.6%, highlighting the rapid progress in model development. Meanwhile, GPT-4 Turbo achieves the highest accuracy at 86.1%.Keywords
All Related Versions
This publication has 9 references indexed in Scilit:
- Parameter-Efficient Fine-Tuning Methods for Pretrained Language Models: A Critical Review and AssessmentIEEE Transactions on Pattern Analysis and Machine Intelligence, 2026
- The Faiss LibraryIEEE Transactions on Big Data, 2025
- How Is ChatGPT’s Behavior Changing Over Time?Harvard Data Science Review, 2024
- LLMs in e-commerce: A comparative analysis of GPT and LLaMA models in product review evaluationNatural Language Processing Journal, 2024
- A Comprehensive Evaluation of Quantization Strategies for Large Language Models2024
- QLoRA: Efficient Finetuning of Quantized LLMs2023
- Large Language Models Are Zero-Shot Reasoners2022
- A Joint Model for Document Segmentation and Segment Labeling2020
- Named Entity Recognition Using Web Document CorpusInternational Journal of Managing Information Technology, 2011