huggingface.co
Total runs: 5.7K
24-hour runs: 0
7-day runs: 305
30-day runs: 818
Model's Last Updated: June 20 2025
feature-extraction

Introduction of MEL

Model Details of MEL

MEL: Legal Spanish Language Model

Model Name: MEL (Modelo de Español Legal)
Model Type: Encoder-only Transformer Language: Spanish
Domain: Legal Texts
Paper: Link to paper


Overview

MEL is a transformer-based language model designed specifically for processing and understanding Spanish legal texts. Built upon XLM-RoBERTa-large , it is further pre-trained on a large corpus of legal documents , including the Boletín Oficial del Estado (BOE), parliamentary transcripts, court rulings, and other legislative texts . MEL significantly improves the performance of legal NLP tasks, such as legal text classification and named entity recognition (NER) .


Model Description
Architecture
  • Base Model: XLM-RoBERTa-large
  • Training Objective: Masked Language Modeling (MLM)
  • Pre-training Strategy: Continued pre-training on Spanish legal texts
  • Context Window: 512 tokens
Training Data

MEL is trained on a curated corpus of 5.52 million legal texts (~92.7GB) sourced from:

  • BOE (Boletín Oficial del Estado)
  • Parliamentary records
  • Court rulings
  • Legal statutes

To ensure high-quality text processing, documents were preprocessed by removing unwanted characters, normalizing spacing, chunking texts, and filtering non-Spanish content .

Cutoff date: February 2024

Training Configuration
  • GPU: NVIDIA A100 80GB PCIe
  • Training Time: 13.9 days (~7 days per epoch, 2 epochs total)
  • Optimizer: AdamW (β1=0.9, β2=0.98, ϵ=1e-6)
  • Batch Size: 16 (Gradient Accumulation: 4, Effective Batch Size: 64)
  • Scheduler: Cosine Learning Rate Scheduler
  • Warmup Steps: 8% of total training steps
  • Learning Rate: 1e-4
  • Weight Decay: 0.01
drawing
Evaluation

MEL was benchmarked on two datasets:

1. Multieurlex (Spanish Legal Texts Classification)
2. Private Multiclass Classification Dataset
  • Task: Classify legal documents into one of 9 categories
  • Performance:
    • MEL achieves an F1 score of 0.9260 , surpassing XLM-RoBERTa-Large (0.9103) , Legal-XLM-RoBERTa (0.8935) , and RoBERTalex (0.7007) .
  • Small Data Learning: MEL shows better generalization even with limited training data, achieving an F1 score of 0.8812 in early training compared to the next best 0.7803 .

Model Performance
Key Findings

Outperforms general multilingual models (XLM-RoBERTa) and other domain-specific models in Spanish legal text classification.
Requires less fine-tuning, demonstrating strong domain adaptation from the pre-training phase.
Shows high sample efficiency, achieving strong results even with limited training data.

Limitations

Not evaluated on NER or token-level tasks due to the lack of annotated Spanish legal datasets.
Trained only on Spanish legal texts, so performance in multilingual legal contexts is unknown.
Potential bias in legal terminology due to corpus selection.


How to Use
from transformers import AutoModel, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("IIC/MEL")
model = AutoModel.from_pretrained("IIC/MEL")

text = "El artículo 45 de la Constitución establece que..."
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)

For fine-tuning on specific legal tasks, use Trainer from Hugging Face’s transformers library.


Future Work
  • Develop NER models for legal entity extraction .
  • Expand dataset to cover more diverse legal domains (e.g., contracts, case law, administrative procedures).
  • Fine-tune on additional downstream tasks (question answering, legal summarization, information retrieval).
  • Improve bias detection and mitigation strategies .

Citation

If you use MEL, please cite:

@misc{sánchez2025mellegalspanishlanguage,
      title={MEL: Legal Spanish Language Model}, 
      author={David Betancur Sánchez and Nuria Aldama García and Álvaro Barbero Jiménez and Marta Guerrero Nieto and Patricia Marsà Morales and Nicolás Serrano Salas and Carlos García Hernán and Pablo Haya Coll and Elena Montiel Ponsoda and Pablo Calleja Ibáñez},
      year={2025},
      eprint={2501.16011},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2501.16011}, 
}

Acknowledgements

This work has received funding from the Inesdata-project (Infrastructure to Investigate Data Spaces in Distributed Environments at UPM), a project funded under the UNICO I+D CLOUD call by the Ministry for Digital Transformation and the Civil Service, in the framework of the recovery plan PRTR financed by the European Union (NextGenerationEU)

Código del proyecto : TSI-063100-2022-0001

Contributors:

  • David Betancur Sánchez , Instituto de Ingeniería del Conocimiento (IIC)
  • Nuria Aldama García , Instituto de Ingeniería del Conocimiento (IIC)
  • Álvaro Barbero Jiménez , Instituto de Ingeniería del Conocimiento (IIC)
  • Marta Guerrero Nieto , Instituto de Ingeniería del Conocimiento (IIC)
  • Patricia Marsà Morales , Instituto de Ingeniería del Conocimiento (IIC)
  • Nicolás Serrano Salas , Instituto de Ingeniería del Conocimiento (IIC)
  • Carlos García Hernán , Instituto de Ingeniería del Conocimiento (IIC)
  • Pablo Haya Coll , Instituto de Ingeniería del Conocimiento (IIC)
  • Elena Montiel Ponsoda , Universidad Politécnica de Madrid
  • Pablo Calleja Ibáñez , Universidad Politécnica de Madrid

Runs of IIC MEL on huggingface.co

5.7K
Total runs
0
24-hour runs
173
3-day runs
305
7-day runs
818
30-day runs

More Information About MEL huggingface.co Model

MEL huggingface.co

MEL huggingface.co is an AI model on huggingface.co that provides MEL's model effect (), which can be used instantly with this IIC MEL model. huggingface.co supports a free trial of the MEL model, and also provides paid use of the MEL. Support call MEL model through api, including Node.js, Python, http.

MEL huggingface.co Url

https://huggingface.co/IIC/MEL

IIC MEL online free

MEL huggingface.co is an online trial and call api platform, which integrates MEL's modeling effects, including api services, and provides a free online trial of MEL, you can try MEL online for free by clicking the link below.

IIC MEL online free url in huggingface.co:

https://huggingface.co/IIC/MEL

MEL install

MEL is an open source model from GitHub that offers a free installation service, and any user can find MEL on GitHub to install. At the same time, huggingface.co provides the effect of MEL install, users can directly use MEL installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

MEL install url in huggingface.co:

https://huggingface.co/IIC/MEL

Url of MEL

MEL huggingface.co Url

Provider of MEL huggingface.co

IIC
ORGANIZATIONS

Other API from IIC

huggingface.co

Total runs: 694
Run Growth: 276
Growth Rate: 36.75%
Updated:November 21 2025
huggingface.co

Total runs: 274
Run Growth: 10
Growth Rate: 3.68%
Updated:March 12 2025
huggingface.co

Total runs: 76
Run Growth: 48
Growth Rate: 52.75%
Updated:March 24 2025
huggingface.co

Total runs: 65
Run Growth: 24
Growth Rate: 28.92%
Updated:November 25 2024
huggingface.co

Total runs: 13
Run Growth: 8
Growth Rate: 61.54%
Updated:January 17 2025