CoTK: An Open-Source Toolkit for Fast Development and Fair Evaluation of Text Generation

Fei Huang, Dazhen Wan, Zhihong Shao, Pei Ke, Jian Guan, Yilin Niu, Xiaoyan Zhu, Minlie HuangarXiv 2020

TL;DR

The paper introduces CoTK, an open-source toolkit designed to streamline the development and ensure fair evaluation of text generation models. It addresses common inconsistencies in experimental setups and metric implementations that lead to unreliable conclusions, offering standardized tools for data handling, evaluation, and reproducibility.

What Problem Does This Paper Address?

Developing and evaluating text generation models is fraught with challenges. Researchers often face issues with inconsistent experimental settings, such as variations in data preprocessing, tokenization, and vocabulary sizes, which make it difficult to compare models fairly. Furthermore, metric implementations can differ, leading to conflicting results and hindering the identification of state-of-the-art models. This lack of standardization makes reproducing previous work and building upon it a significant hurdle. The paper aims to solve this by providing a unified toolkit that standardizes these processes and promotes reproducible and fair evaluations.

Methods

CoTK offers a comprehensive solution across the entire model development lifecycle, broken down into four key aspects:

  • Data Processing: CoTK provides robust data loaders that handle the entire pipeline from reading files to tokenization, vocabulary building, and batching. This ensures consistency in how data is fed to models.
  • Model Implementation: While CoTK doesn't implement models itself, it's designed to be compatible with popular deep learning frameworks like TensorFlow and PyTorch, as well as other toolkits like Texar and Fairseq, allowing researchers to leverage existing model implementations.
  • Evaluation: A core contribution is CoTK's implementation of numerous common text generation metrics. Crucially, it introduces a "hash code" system for both data loaders and metrics. These hash codes act as unique identifiers for experimental settings and data configurations, allowing users to quickly verify if comparisons are fair. If hash codes differ, CoTK can flag when a metric might not be comparable.
  • Publication and Reproduction: CoTK includes tools to track experimental configurations, code versions, and results using Git. This information can be automatically published to a dashboard, facilitating community sharing and enabling others to reproduce experiments with ease.

Datasets

CoTK supports several standard datasets for text generation tasks, including:

  • MSCOCO (for text generation without input)
  • EMNLP2017 WMT2
  • OpenSubtitles (for single-turn dialog)
  • Ubuntu (for single-turn dialog)
  • SwitchBoard (for multi-turn dialog)

The paper does not introduce new benchmark datasets but rather provides a framework for using existing ones more consistently.

Key Insights and Ideas

  • The "Hash Code" for Reproducibility: The most significant innovation is the hash code system. By generating unique identifiers for data, vocabularies, and settings, CoTK provides a tangible way to ensure that experimental comparisons are apples-to-apples. This directly tackles the problem of subtle, often overlooked, differences that invalidate results.
  • Fairness by Design: CoTK doesn't just implement metrics; it implements them with fairness in mind. For example, its BLEU implementation standardizes tokenization and avoids matching n-grams containing <unk> tokens, addressing known pitfalls of the metric. Similarly, its perplexity calculation is adapted to handle rare words and different vocabulary sizes more equitably.
  • Holistic Toolkit: CoTK aims to be a one-stop shop for the entire text generation workflow, from data loading to model evaluation and publication. This integrated approach reduces the burden on researchers to stitch together disparate tools.
  • Compatibility is Key: By design, CoTK is not a monolithic framework but a complementary tool. Its compatibility with existing popular libraries and frameworks means researchers don't have to abandon their preferred tools to benefit from CoTK's standardization and evaluation capabilities.

Key Results

The paper demonstrates CoTK's utility through several examples:

  • Fairer Perplexity: Table 6 shows how CoTK's perplexity metric provides comparable results across different vocabulary sizes, unlike the original perplexity which yields drastically different and misleading scores. For instance, with a vocabulary size of 1900, CoTK's perplexity is 17.13, while the original is 11.49, highlighting the impact of vocabulary on standard metrics.
  • Consistent BLEU: Table 9 illustrates that CoTK's BLEU implementation yields comparable scores (e.g., 1.07 for Punkt and BERT tokenizers) even when different tokenizers are used, a feat not guaranteed by standard BLEU calculations.
  • Hash Code Efficacy: Figure 4 visually demonstrates how different hash codes are generated for variations in data shuffling, vocabulary size, tokenization, and data corruption, proving the system's ability to detect and flag these differences.

Limitations and Future Work

The authors acknowledge that CoTK is primarily developed for open-domain conversation generation but supports other text generation tasks. Future work will likely involve expanding the toolkit to include more tasks, metrics, resources, and benchmark models, further growing its utility as text generation research advances. The paper also implicitly suggests that the community adoption of such a standardized toolkit is crucial for its long-term success.

Summary updated

BibTeX
@misc{huang2020cotk,
  author = {Fei Huang and Dazhen Wan and Zhihong Shao and Pei Ke and Jian Guan and Yilin Niu and Xiaoyan Zhu and Minlie Huang},
  title = {{CoTK: An Open-Source Toolkit for Fast Development and Fair Evaluation of Text Generation}},
  year = {2020},
  eprint = {2002.00583},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2002.00583},
}
Figure