Algorithm for Automatic Legislative Text Consolidation (2024)

Abstract: This study introduces a method for automating the consolidation process in a legal context, a time-consuming task traditionally performed by legal professionals. We present a generative approach that processes legislative texts to automatically apply amendments. Our method employs light quantized generative model, finetuned with LoRA, to generate accurate and reliable amended texts. To the authors knowledge, this is the first time generative models are used on legislative text consolidation. Our dataset is publicly available on HuggingFace. Experimental results demonstrate a significant improvement in efficiency, offering faster updates to legal documents. A full automated pipeline of legislative text consolidation can be done in a few hours, with a success rate of more than 63% on a difficult bill.

## introduction every year in france, the projet de loi finance 2 (plf), annually introduces numerous modifications to the general tax @xcite . the objective of this study is to automate the process of legislative text consolidation, which is the act of combining modifications from a modification section, contained inside the plf, to an existing article to generate a modified article. example 1 illustrates a dummy consolidation, where the original text of a law is updated by incorporating amendments directly into it, resulting in a revised, coherent version. legislative text consolidation is a critical yet time-consuming task, traditionally performed manually by legal professionals. a sample of the plf is presented in example 3 2. it modifies article 1586 ter and article 1586 quater of the general tax code. 1 link to dataset 2 link to projet de loi finance for 2024 3 all examples are translated from french to english. example 1: illustration of legislative consolidation existing article: paris is the capital of france. modification section: i.-replace the word « is » with « has been ». ii.-add « since the late 10th century » at the end of the sentence. modified article: paris has been the capital of france since the late 10th century. the conventions represented on figure 1 are adhered to: three primary modification categories are identified: a deletion, involving the removal of a word, sentence, or paragraph; an addition, encompassing the insertion of a word, sentence, or paragraph and a substitution, where a word, sentence, or paragraph is exchanged for another. example 2 demonstrates one instance of addition and four instances of substitutions. the automation of legislative text consolidation has the potential to significantly expedite example 2: extract of article 79 of the plf 2024 modification sections: i.-the general tax code is amended as follows: a.-the following words are added to the first sentence of the second paragraph of 1 of ii of article 1586 ter: « , as it stood prior to finance act 2023-1322 of 29 december 2023 for 2024 »; b.-article 1586 quater is amended as follows: 1°i is amended as follows a) the second paragraph of b and c is amended as follows: ## dataset our first objective is to construct a dataset for automatic consolidation. each sample in this dataset is a triplet of texts (existing article, modification section, modified article) in which the modification section specifies the changes to be made to the existing article to obtain the modified article. our research shall primarily concentrate on the national consolidation. on a national scope, laws, decrees, and regulations revise existing legal regulations. the publication of legal texts has seen significant growth over the past 20 years. figure 2 shows the evolution of the number of modifying articles recorded in france. in 2022, 17487 texts were published from 2512 laws providing modifications on existing laws. we create a dataset of 5000 triplets (existing article, modification section, modified article). we only keep existing articles that are modified only once. this condition helps avoid existing articles modified by two modification sections simultaneously. the links between (existing article, modification section, modified article) are publicly available through the légifrance platform. in the end, we accumulated a dataset comprising 3124 triplets. example 3 shows a complete sample of the dataset, publicly ## approaches & developped methods the objective is to modify an existing article by incorporating alterations delineated within a modification document. initially, a foundational baseline employing a span extraction methodology was developed. subsequently, this baseline is evaluated against our advanced methodology, which encompasses the fine-tuning of a pre-trained language model. ## application on a bill encouraged by our model's promising performance, we embarked on live automatic consolidation of the projet de loi de finance 2024 from september 2023 to december 2023. this bill was proposed on 26th of september, 2023 and contained 60 articles. after multiples debates at the parliements, the bill was promulgated on 29th of december, 2023 with 264 articles. this is a highly complex bill. ## conclusion this research implements a generative method to automate legislative text consolidation, demonstrating a significant capability to process and automatically apply changes to legislative texts. we determined that the quality of the dataset and the size of the pre-trained model were two parameters that most significantly influenced consolidation performance. despite exceptional performances of gpt4, in the end, we ideally prefer to use an open-source model for handling legal data due to its sensitivity. the consolidation, led on a real-time legislative bill, proved to be highly effective, although occasional issues in the generation process could result in nonsensical consolidations. moving forward, our objective is to delve into advanced fine-tuning strategies and broaden our methodology to encompass additional models. on one side, there exists a variety of models equipped with commercial licenses, such as llama 3.1, that offer new possibilities for exploration. these models often feature larger context windows, enabling the consolidation of more samples. on the other side, innovative fine-tuning techniques are being developed, such as the mixture of lora experts approach. this technique is designed to fine-tune each expert within a mixture of experts. this research opens promising avenues for integrating generative methods into legal processes, with the hope of radically transforming legal practice.