Datasets:
metadata
license: apache-2.0
language:
- vi
tags:
- legal
- corpus
- pre-training
- legal-documents
- vilegallm
- 16GB
- vietnamese
pretty_name: ViLegalText
size_categories:
- 100K<n<1M
ViLegalTexts: A 16GB Vietnamese Legal Pre-training Corpus
This repository contains the pre-training corpus used to train ViLegalLM. The corpus was crawled from four publicly available Vietnamese legal repositories. For full details, please refer to the paper: Read paper
π Overview
| Property | Value |
|---|---|
| Language | Vietnamese |
| Domain | Legal |
| Corpus size | 16 GB |
| Format | .zip containing multiple .txt files |
| Sources | 4 public Vietnamese legal repositories |
| License | Apache 2.0 |
π§ Data Processing Pipeline
The raw corpus underwent a 4-stage preprocessing pipeline:
Content Extraction β Text Cleaning β Language Identification β Deduplication
For full details of each stage, please refer to the paper.
The final corpus is distributed as .zip files, each containing multiple .txt files (one document per file), with a total uncompressed size of 16 GB.
π Usage
Clone this repository
apt-get install -y git-lfs
git lfs install
git clone https://your_username:YOUR_HF_TOKEN@huggingface.co/datasets/ntphuc149/ViLegalText
Unzip pre-training corpus
import os
os.makedirs("/process", exist_ok=True)
zip_path = f"/ViLegalText/ViLegalText.zip"
print(f"π¦ GiαΊ£i nΓ©n: ViLegalText.zip")
os.system(f'unzip -q "{zip_path}" "*.txt" -d /process/')
print("β
Xong!")
Preview a sample file
with open("/process/doc_0.txt", encoding="utf-8") as f:
print(f.read())
π€ Models Trained on This Corpus
This corpus was used to continually pretrain the following models, all publicly available:
| Model | Architecture | Parameters | Max Length | HuggingFace |
|---|---|---|---|---|
| ViLegalBERT | Encoder-only (MLM) | 135M | 256 | ntphuc149/ViLegalBERT |
| ViLegalQwen2.5-1.5B-Base | Decoder-only (CLM) | 1.54B | 2,048 | ntphuc149/ViLegalQwen2.5-1.5B-Base |
| ViLegalQwen3-1.7B-Base | Decoder-only (CLM) | 1.72B | 4,096 | ntphuc149/ViLegalQwen3-1.7B-Base |
π Citation
If you use this corpus in your research, please cite:
@inproceedings{nguyen-etal-2026-vilegallm,
title = "{V}i{L}egal{LM}: Language Models for {V}ietnamese Legal Text",
author = "Nguyen, Truong-Phuc and
Nguyen, Quy-Nhan and
Nguyen, Minh-Tien",
editor = "Liakata, Maria and
Moreira, Viviane P. and
Zhang, Jiajun and
Jurgens, David",
booktitle = "Findings of the {A}ssociation for {C}omputational {L}inguistics: {ACL} 2026",
month = jul,
year = "2026",
address = "San Diego, California, United States",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2026.findings-acl.1801/",
pages = "36136--36150",
ISBN = "979-8-89176-395-1",
abstract = "We present **ViLegalLM**, comprising **ViLegalBERT** and **ViLegalQwen**, the first suite of Vietnamese pretrained language models for legal text understanding and generation. It includes one encoder-only model (ViLegalBERT, 135M parameters) and two decoder-only models (ViLegalQwen2.5-1.5B-Base and ViLegalQwen3-1.7B-Base), all continually pretrained on a newly curated 16GB Vietnamese legal corpus, significantly larger than previous work. To mitigate data scarcity, we construct three synthetic datasets using LLM-based generation and hard negative mining for True/False QA, Multiple Choice QA, and Natural Language Inference. We establish state-of-the-art results among open-source models on four main Vietnamese legal downstream tasks spanning ten benchmarks, demonstrating that continual pretraining from base models consistently outperforms instruction-tuned adaptation. Source codes, corpus, datasets, and model checkpoints are publicly available at https://github.com/ntphuc149/ViLegalLM."
}
β οΈ Intended Use & Limitations
- This corpus is intended for research purposes in Vietnamese legal NLP.
- Documents are collected from publicly available Vietnamese legal repositories. No personally identifiable information is included.
- Models trained on this corpus are not intended to replace professional legal counsel. Users should not rely solely on model outputs for consequential legal decisions without qualified professional consultation.
- The corpus may inherit biases present in the source repositories, including temporal bias, regional variations, and domain coverage imbalances.
π Related Resources
- GitHub: ViLegalLM
- ViLegalLM Models: ViLegalBERT, ViLegalQwen2.5-1.5B-Base, ViLegalQwen3-1.7B-Base,
- Synthetic Datasets: ViLegalTF, ViLegalMCQ, ViLegalNLI