Standardizing the Measurement of Text Diversity: A Tool and a Comparative Analysis of Scores

Chantal Shaib, Joe Barrow, Jiuding Sun, Alexa F. Siu, Byron C. Wallace, Ani Nenkova · DOI

Introduction

As Large Language Models (LLMs) become increasingly integrated into daily workflows, a common qualitative observation has emerged: these models often exhibit a "canned" or "templated" vibe. While human readers can intuitively sense when a model is producing repetitive or boilerplate content, quantifying this "diversity" (or lack thereof) remains a significant challenge in natural language processing. To address this, researchers have introduced diversity, an open-source Python toolkit and interactive web interface designed to standardize the measurement of variety in generated text.

The Problem: Inconsistency and Confounding Factors

The current landscape of text diversity measurement is fragmented. Researchers typically employ a diverse array of metrics—ranging from Type-Token Ratios to Self-BLEU—making it nearly impossible to compare results across different studies. Beyond the lack of standardization, two major hurdles persist:

  1. Computational Cost: High-order metrics like Self-BLEU or BERTScore-based homogenization are computationally expensive, often requiring hours to process large datasets.
  2. The Length Bias: Most diversity metrics are highly sensitive to the length of the text. Longer documents naturally tend to appear less diverse due to the mathematical properties of the metrics, even if the content itself is not inherently more repetitive. This "length confounder" often leads to unfair comparisons between models that produce outputs of varying lengths.

A Standardized Framework for Diversity

The diversity package implements a comprehensive suite of metrics categorized into four primary areas:

  • Homogenization Scores: These measure the pairwise similarity between all documents in a set using metrics like Self-BLEU, ROUGE-L, and BERTScore.
  • Lexical Diversity: These focus on the ratio of unique n-grams to total n-grams (e.g., N-gram Diversity or NGD).
  • Compression Ratios (CR): By utilizing standard algorithms like gzip, the tool measures how much a corpus can be compressed. A higher compression ratio indicates higher redundancy and lower diversity.
  • Syntactic Diversity: This novel approach applies compression ratios specifically to Part-of-Speech (POS) tag sequences, identifying whether a model relies on a limited set of grammatical templates.

To complement the library, an interactive web UI allows researchers to visualize these patterns, highlighting repeated strings and syntactic structures across a corpus to provide qualitative grounding for the quantitative scores.

Key Insights from Comparative Analysis

The researchers evaluated outputs from six prominent LLMs (including GPT-4, Llama-2, Mistral, and FlanT5) across summarization and instruction-tuning benchmarks. Several critical insights emerged:

The Efficiency of Compression

One of the most significant findings is that simple Compression Ratios (CR) are highly correlated with more complex n-gram diversity scores. Given that CR is orders of magnitude faster to compute—taking seconds where Self-BLEU might take hours—it serves as an ideal proxy for large-scale redundancy analysis.

Controlling for Length

The study confirms that diversity scores are inextricably linked to text length. To ensure a fair comparison, the authors argue that truncating texts to a uniform length is a mandatory preprocessing step. Without this control, a model that generates longer summaries will almost certainly look "less diverse" by default, regardless of the actual variety in its vocabulary.

Syntactic "Fingerprints"

The analysis of POS tag compression revealed that humans utilize a significantly broader range of grammatical structures than LLMs. While models often achieve high lexical diversity, they frequently fall into predictable syntactic ruts. Measuring the diversity of POS sequences proved to be one of the most effective ways to distinguish human-authored text from machine-generated outputs.

Metric Redundancy

The researchers found that many popular metrics provide redundant information. They suggest that reporting a triad of Compression Ratio, Self-Repetition of long n-grams, and Self-BLEU is sufficient to capture the most meaningful dimensions of corpus diversity.

Results and Model Rankings

When controlling for length on the CNN/Daily Mail dataset, GPT-4 and FlanT5 emerged as the most diverse models. Conversely, StableLM and Llama-2 were found to be among the most repetitive. In the realm of instruction tuning, the Open Assistant dataset stood out for its high internal variety, whereas datasets like Unnatural Instructions exhibited high levels of internal repetition.

Conclusion and Future Work

The diversity toolkit provides a necessary foundation for standardizing how we evaluate LLM outputs. While the current version is focused on English and lexical/syntactic repetition, it opens the door for future research into semantic diversity and the correlation between mathematical scores and human perceptions of "boring" text. By providing an open-source, efficient, and standardized tool, the researchers aim to move the field toward more rigorous and comparable reporting of text variety.

Summary updated

BibTeX
@misc{shaib2024standardizing,
  author = {Chantal Shaib and Joe Barrow and Jiuding Sun and Alexa F. Siu and Byron C. Wallace and Ani Nenkova},
  title = {{Standardizing the Measurement of Text Diversity: A Tool and a Comparative Analysis of Scores}},
  year = {2024},
  eprint = {2403.00553},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.00553},
}
Figure