Text Characterization Toolkit

Daniel Simig, Tianlu Wang, Verna Dankers, Peter Henderson, Khuyagbaatar Batsuren, Dieuwke Hupkes, Mona T. DiabarXiv 2022 · DOI

Introduction

In contemporary Natural Language Processing (NLP), model success is predominantly measured by aggregate benchmark scores, such as Accuracy or F1. While these metrics provide a high-level overview of performance, they often obscure critical underlying issues. Datasets are frequently characterized by hidden biases, linguistic artifacts, and spurious correlations that allow models to achieve high scores through "shortcuts" rather than genuine linguistic understanding.

The Text Characterization Toolkit (TCT) is an open-source framework designed to move beyond this "single-number" evaluation paradigm. By providing a suite of 61 diverse text metrics and automated analysis tools, TCT enables researchers to systematically investigate how specific data properties—ranging from syntactic complexity to lexical diversity—influence model outcomes.

The TCT Framework

TCT is structured into two primary components designed for both depth of analysis and computational efficiency:

  1. Metric Framework: The toolkit implements 61 text characteristics categorized into five domains:
  2. Descriptive: Basic statistics like sentence and word length.
  3. Lexical Diversity: Measures such as type-token ratios.
  4. Syntactic Complexity: Structural features, including the number of words preceding the main verb.
  5. Incidence Scores: Frequency of specific linguistic markers, such as causal connectives.
  6. Word Properties: Psycholinguistic features like age of acquisition, concreteness, and familiarity.
  7. Analysis Tools: TCT provides Python-based scripts and notebooks for visualizing these metrics and their correlations with model performance. A key feature is the ability to train regression models (e.g., logistic regression or random forests) to predict model accuracy based on text features, identifying which characteristics serve as signals for model difficulty.
The TCT workflow integrates data characterization into the standard evaluation pipeline, allowing for iterative improvements to both models and datasets.

Methodology and Scalability

TCT is engineered for high-throughput processing. It can analyze 20,000 paragraphs in less than a minute on standard hardware and maintains compatibility with PySpark for massive datasets like Common Crawl. This scalability ensures that granular data analysis can be integrated into large-scale pre-training and evaluation pipelines without becoming a bottleneck.

Case Studies and Key Results

The authors validated TCT across several diverse NLP tasks, revealing that model performance is highly heterogeneous and sensitive to specific text properties.

Common-Sense Inference (HellaSwag)

Evaluating the OPT (Open Pre-trained Transformer) model on HellaSwag revealed that accuracy fluctuated between 40% and 90% depending on prompt complexity. Regression analysis identified that features like "mean letters per word" significantly impacted the model's ability to predict correctly, highlighting specific subsets where even large models performed no better than a random baseline.

Machine Translation (NLLB)

Analysis of the No Language Left Behind (NLLB) model showed that translation quality dropped as the number of verbs and word polysemy increased. TCT identified that the model specifically struggled with multi-sentence inputs, leading to a practical fix: segmenting sentences before translation to reduce performance "jitter."

Bias Detection (WinoBias)

TCT simplifies the quantification of social biases. By correlating a custom "genderedness" metric with model errors in coreference resolution, the toolkit quantitatively demonstrated that models fail more frequently when gender roles in the text deviate from common stereotypes.

TCT visualizes the correlation between specific text metrics and model outcomes, helping to identify which features drive performance drops.

Discussion and Limitations

While TCT provides a robust framework for English-centric analysis, its primary limitation lies in language coverage. Many word-property metrics rely on English-specific databases like WordNet or the MRC Psycholinguistic Database. Extending these granular metrics to low-resource languages remains a priority for future development.

By standardizing the process of data characterization, TCT aims to make deep-dive analysis a default requirement for NLP research, ensuring that model evaluation is as transparent and nuanced as the data it processes.

Summary updated

BibTeX
@misc{simig2022text,
  author = {Daniel Simig and Tianlu Wang and Verna Dankers and Peter Henderson and Khuyagbaatar Batsuren and Dieuwke Hupkes and Mona T. Diab},
  title = {{Text Characterization Toolkit}},
  year = {2022},
  eprint = {2210.01734},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2210.01734},
}
Figure