Bayes Test of Precision, Recall, and F1 Measure for Comparison of Two Natural Language Processing Models

Ruibo Wang, Jihong LiACL 2019

This research, originally presented at ACL 2019, addresses a critical gap in Natural Language Processing (NLP) evaluation: the lack of statistically rigorous methods for model comparison. While point estimates of Precision (P), Recall (R), and $F_1$ are standard, they fail to account for variance and data partitioning noise. The authors propose a Bayesian framework that replaces traditional t-tests with a more reliable and interpretable probabilistic approach.

The Problem with Traditional Significance Testing

In NLP, researchers typically compare models by looking at single-point metrics. However, saying "Model A (91.2%) is better than Model B (91.5%)" is often unscientific. Standard statistical tools like the t-test are ill-suited for this task for several reasons:

  1. Non-Normality: P, R, and $F_1$ scores are bounded between [0, 1] and often skewed. T-tests assume a normal distribution, which can lead to mathematically impossible confidence intervals.
  2. Fold Correlation: Cross-validation (CV) folds often overlap, violating the independence assumption of t-tests and leading to underestimated variance and "false discovery" (Type I errors).
  3. The p-value Trap: Null Hypothesis Significance Testing (NHST) only indicates if models are different; it does not provide the probability that one is actually better.

Methodology: The Bayesian Framework

The authors introduce a three-part solution to provide a scientifically grounded comparison:

  1. Block-Regularized $3 \times 2$ CV (3x2 BCV): The corpus is divided into four equal blocks to perform three repetitions of 2-fold cross-validation. This "regularized" approach ensures that linguistic unit distributions (e.g., specific entity types) are consistent across training and validation sets.
  2. Effective Confusion Matrix: To handle correlated CV folds, the authors derive an "effective" confusion matrix that calibrates the posterior distributions by estimating correlation coefficients between repetitions.
  3. Bayesian Hypothesis Testing: Instead of a p-value, the comparison is formulated as a Bayesian problem. Using Monte Carlo simulation (sampling 1,000,000 points), the framework calculates the actual probability $P(H_1)$ that Model B outperforms Model A.
Algorithm for the Bayesian hypothesis test

Experimental Evaluation

The Bayes test was evaluated across three standard NLP chunking tasks:

  • CWS (Chinese Word Segmentation): Using the Bakeoff-2005 PKU corpus.
  • NER (Named Entity Recognition): Using the CoNLL 2003 English set.
  • ORG Task: A specialized subset of NER focusing on the highly imbalanced "Organization" entity category.

Key Results and Insights

A central takeaway is that performance metrics should be viewed as distributions rather than fixed numbers. This perspective allows for more nuanced decisions; for instance, a model might significantly improve Precision while simultaneously harming Recall.

Task-Specific Findings

  • CWS Task: The Bayes test confirmed a near 100% probability ($P(H_1) \approx 1.0$) that the fine-grained "BB2B3MES" tag set outperformed the standard "BMES" set. As shown in the posterior distributions, the proposed method provides a more accurate and concentrated estimation than traditional normal approximations.
  • NER Task: While point estimates favored the "IOBES" tag set, the Bayes test revealed only a ~70% probability of improvement, suggesting the gain is not highly replicable.
  • ORG Task: For identifying organizations, the fine-grained "IOBES" set actually deteriorated performance compared to "IOB2" ($P(H_0) > 0.5$), a detail that standard point estimates might have missed.
Posterior distributions for the CWS task comparing tag sets and approximation methods

Conclusion and Future Work

The Bayesian framework offers a more rigorous and interpretable way to compare NLP models by providing the actual probability of improvement. Future research directions include extending this framework to sequence-to-sequence metrics like BLEU or ROUGE and testing its effectiveness across diverse neural architectures like Transformers.

Summary updated

BibTeX
@inproceedings{wang2019bayes,
  author = {Ruibo Wang and Jihong Li},
  title = {{Bayes Test of Precision, Recall, and F1 Measure for Comparison of Two Natural Language Processing Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1405},
}
Figure