An Evaluation Dataset for Legal Word Embedding: A Case Study On Chinese Codex

Chun-Hsien Lin, Pu-Jen ChengarXiv 2022

Abstract

Word embedding is a modern distributed word representations approach widely used in many natural language processing tasks. Converting the vocabulary in a legal document into a word embedding model facilitates subjecting legal documents to machine learning, deep learning, and other algorithms and subsequently performing the downstream tasks of natural language processing vis-à-vis, for instance, document classification, contract review, and machine translation. The most common and practical approach of accuracy evaluation with the word embedding model uses a benchmark set with linguistic rules or the relationship between words to perform analogy reasoning via algebraic calculation. This paper proposes establishing a 1,134 Legal Analogical Reasoning Questions Set (LARQS) from the 2,388 Chinese Codex corpus using five kinds of legal relations, which are then used to evaluate the accuracy of the Chinese word embedding model. Moreover, we discovered that legal relations might be ubiquitous in the word embedding model.

Introduction

Word embeddings, which represent words as vectors in a high-dimensional space, are the backbone of modern Natural Language Processing (NLP). These models are typically evaluated using analogical reasoning tasks (e.g., king - man + woman ≈ queen). However, most existing evaluation datasets are general-purpose and often translated from English, presenting two major hurdles for specialized fields like law. First, legal terminology is highly idiosyncratic; general models often fail to capture domain-specific statutory implications. Second, Chinese lacks English-style morphological markers (e.g., plurals or verb tenses), making direct translations of English benchmarks ineffective as they often contain "empty" categories. This study addresses these issues by developing a specialized evaluation set for the Chinese legal domain.

Methodology

The researchers established a multi-step pipeline to process raw legal text into a validated benchmark. Word segmentation, the first critical step for Chinese text, was performed using CKIPTagger, which proved more accurate for formal legal language than the popular Jieba tool. The team then trained word2vec models using the gensim library, comparing Skip-gram and CBoW (Continuous Bag of Words) architectures. Skip-gram was found to be more effective for this specific corpus. To ensure high-quality data, legal experts manually reviewed vocabulary and identified key legal relationships, aided by TensorBoard for visual inspection of word clusters in vector space.

The LARQS Dataset

The core contribution of this research is the Legal Analogical Reasoning Questions Set (LARQS). This benchmark was derived from the Chinese Codex Corpus, a collection of 2,388 statutes and regulations comprising approximately 5.8 million words. LARQS consists of 1,134 questions organized into five categories of legal relations.

Table 1: Categories and examples of legal relations in the LARQS benchmark.

These categories include Prime and Deputy (e.g., President/Vice President), Rights and Obligations (e.g., Creditor/Debtor), Execute and Staff (e.g., Audit/Accountant), Operation (e.g., Vaccine/Vaccination), and Rights (e.g., Claims/Creditor).

Results and Discussion

The specialized legal word embedding model achieved a peak accuracy of 67.02% on the LARQS benchmark. This performance significantly outperformed general linguistic benchmarks like CA8 and translated Google benchmarks when applied to the legal corpus.

Dimensionality and Iteration Sensitivity

Experimental results indicated that legal embeddings require a higher-dimensional space to accurately capture complex relationships. Accuracy peaked at approximately 850 dimensions, which is notably higher than the 100–300 dimensions typically used in general NLP tasks. Furthermore, the model showed sensitivity to training iterations; accuracy was higher at 100 iterations than at 1,000, suggesting that excessive training on a relatively small specialized corpus can lead to overfitting.

Figure 1: Accuracy of the word embedding model across different vector sizes and training iterations.

A surprising finding was that a model trained on general Wikipedia data performed nearly as well on LARQS (65.24%) as the specialized legal model. This suggests that legal logic and terminology are deeply embedded in general public discourse. However, the specialized model remains necessary because general benchmarks fail to accurately reflect a model's domain-specific competence.

Conclusion

This research demonstrates that specialized benchmarks like LARQS are essential for evaluating the performance of NLP models in the legal domain. While the current manual creation process is labor-intensive, it provides a necessary ground truth for Chinese legal embeddings. Future work will focus on automating the discovery of legal relations and integrating these embeddings into downstream tasks such as automated contract review and machine translation.

Summary updated

Abstract

Word embedding is a modern distributed word representations approach widely used in many natural language processing tasks. Converting the vocabulary in a legal document into a word embedding model facilitates subjecting legal documents to machine learning, deep learning, and other algorithms and subsequently performing the downstream tasks of natural language processing vis-\`a-vis, for instance, document classification, contract review, and machine translation. The most common and practical approach of accuracy evaluation with the word embedding model uses a benchmark set with linguistic rules or the relationship between words to perform analogy reasoning via algebraic calculation. This paper proposes establishing a 1,134 Legal Analogical Reasoning Questions Set (LARQS) from the 2,388 Chinese Codex corpus using five kinds of legal relations, which are then used to evaluate the accuracy of the Chinese word embedding model. Moreover, we discovered that legal relations might be ubiquitous in the word embedding model.
BibTeX
@misc{lin2022evaluation,
  author = {Chun-Hsien Lin and Pu-Jen Cheng},
  title = {{An Evaluation Dataset for Legal Word Embedding: A Case Study On Chinese Codex}},
  year = {2022},
  eprint = {2203.15173},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.15173},
}
Figure