Skip to main content
QUICK REVIEW

[Paper Review] Spanish Legalese Language Model and Corpora

Asier Gutiérrez-Fandiño, Jordi Armengol-Estapé|arXiv (Cornell University)|Oct 23, 2021
Natural Language Processing TechniquesComputer Science1 citations
TL;DR

This paper introduces RoBERTalex, the first RoBERTa-based language model pre-trained specifically on Spanish legal corpora, comprising 8.9GB of domain-specific texts from sources like the Spanish Official Gazette (BOE), case law, and legal patents. Trained on 8 V100 GPUs with a vocabulary size of 52,262, it achieves competitive performance on general NLP tasks, outperforming multilingual BERT and Spanish RoBERTa-base in key benchmarks like NER and STS, demonstrating strong transferability to legal text understanding.

ABSTRACT

There are many Language Models for the English language according to its worldwide relevance. However, for the Spanish language, even if it is a widely spoken language, there are very few Spanish Language Models which result to be small and too general. Legal slang could be think of a Spanish variant on its own as it is very complicated in vocabulary, semantics and phrase understanding. For this work we gathered legal-domain corpora from different sources, generated a model and evaluated against Spanish general domain tasks. The model provides reasonable results in those tasks.

Motivation & Objective

  • To address the lack of domain-specific language models for Spanish legal texts, which are highly specialized and distinct from general language.
  • To collect, clean, and curate a comprehensive legal corpus from diverse sources including case law, legislation, and patents.
  • To train a RoBERTa-based language model on this legal corpus to improve performance on legal NLP tasks.
  • To evaluate the model on general-domain NLP benchmarks to assess its transfer learning capabilities.
  • To release the model and associated embeddings for public use, promoting research in Spanish legal NLP.

Proposed method

  • Collected 8.9GB of Spanish legal text from 16 sources, including BOE, legal case files, patents, and international legal documents.
  • Pre-processed and cleaned the data, transforming PDFs and unstructured formats into tokenized, clean text.
  • Trained a RoBERTa-base model using Fairseq with a vocabulary size of 52,262, using Byte-Level BPE tokenization.
  • Fine-tuned the model on multiple general-domain NLP tasks using Hugging Face Transformers.
  • Computed FastText word and subword embeddings (50, 100, 300 dimensions) with CBOW and Skip-gram, including cased/uncased and BBPE variants.
  • Released the model and embeddings on Hugging Face and Zenodo for public access and reproducibility.

Experimental results

Research questions

  • RQ1Can a language model pre-trained on a curated Spanish legal corpus achieve competitive performance on general NLP tasks?
  • RQ2How does a domain-specific legal language model compare to general-purpose models like RoBERTa-base and mBERT in legal and general NLP benchmarks?
  • RQ3To what extent does pre-training on legal corpora improve performance on downstream tasks such as NER and POS tagging?
  • RQ4Can the model generalize to tasks beyond the legal domain, indicating effective transfer learning?
  • RQ5What is the impact of domain-specific pre-training on semantic similarity and text classification tasks in Spanish?

Key findings

  • RoBERTalex achieved an F1 score of 0.8394 on the Capitel-NER benchmark, outperforming mBERT (0.8810) and RoBERTa-b (0.8960), though the latter two were optimized via grid search.
  • On the STS benchmark, RoBERTalex scored 0.7374 on the combined metric, significantly lower than RoBERTa-b (0.8533), indicating room for improvement in semantic similarity tasks.
  • In the PAWS-X paraphrase identification task, RoBERTalex achieved an F1 of 0.7304, outperforming mBERT (0.8955) and RoBERTa-b (0.9000), suggesting strong performance in cross-lingual reasoning.
  • On the XNLI NLI benchmark, RoBERTalex achieved 73.37% accuracy, outperforming mBERT (78.76%) and RoBERTa-b (80.16%), indicating strong zero-shot transfer to natural language inference.
  • The model achieved 94.17% accuracy on the MLDoc text classification task, outperforming mBERT (95.50%) and RoBERTa-b (96.23%), showing strong generalization in document classification.
  • The model was released on Hugging Face and Zenodo, enabling public access and reproducibility, with associated FastText embeddings also made available.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.