TextBox 2.0: A Text Generation Library with Pre-trained Language Models

Tianyi Tang, Junyi Li, Zhipeng Chen, Yiwen Hu, Zhuohao Yu, Wenxun Dai, Wayne Xin Zhao, Jian-Yun Nie, Ji-Rong Wen

Introduction

The landscape of text generation has undergone a paradigm shift, moving from traditional recurrent neural networks (RNNs) to sophisticated Large Pre-trained Language Models (PLMs) such as BART, T5, and GPT. While these models have pushed the boundaries of natural language processing, the research ecosystem remains fragmented. Existing libraries often cater to outdated architectures or serve as general-purpose toolkits that lack specialized pipelines for text generation nuances, such as specific evaluation metrics and optimized decoding strategies.

TextBox 2.0 addresses this fragmentation by providing a comprehensive, open-source library that unifies text generation research. It offers a standardized "text-to-text" framework covering 13 tasks, 83 datasets, and 45 state-of-the-art models, enabling researchers to transition from data loading to evaluation with minimal boilerplate code.

The TextBox 2.0 Framework

The architecture of TextBox 2.0 is built upon three core pillars designed to streamline the research workflow:

  1. Unified Interface: By framing every task as a text-to-text problem, the library allows users to switch between models and datasets seamlessly using simple command-line arguments or configuration files.
  2. Extensive Model Zoo: The library integrates 45 PLMs, ranging from general-purpose models to specialized versions for translation, dialogue, and Chinese-specific tasks. It also supports lightweight fine-tuning methods like LoRA and Prefix-tuning.
  3. Optimized Pipeline: TextBox 2.0 incorporates Hyperopt for hyper-parameter optimization and FastSeq to accelerate the decoding process. This integration significantly reduces inference time through attention cache optimization and asynchronous I/O.
Code examples demonstrating the unified interface for various tasks including model reproduction, hyper-parameter optimization, and custom model implementation.

Comprehensive Dataset and Task Support

A major strength of TextBox 2.0 is its massive repository of benchmarks. It standardizes 83 diverse datasets across 13 distinct tasks, including summarization (CNN/DailyMail, XSum), translation (WMT 16), dialogue (PersonaChat), and various Chinese generation tasks. By providing a unified data format, the library eliminates the significant "data preprocessing tax" that often hinders research progress.

Performance and Deep Analysis

Beyond standardization, TextBox 2.0 excels in performance and analytical depth. In reproduction experiments, the library successfully matched or exceeded original paper results for BART across 13 tasks, achieving superior performance on 37 out of 44 evaluated metrics. This improvement is attributed to optimized training strategies like label smoothing.

Efficiency is another hallmark of the library. In head-to-head benchmarks for fine-tuning BART-large on CNN/DailyMail, TextBox 2.0 completed the generation stage in just 27 minutes, compared to 75 minutes for Hugging Face and 79 minutes for Fairseq.

Leaderboard and visualization tools for ROUGE-L scores by input length and N-gram overlap analysis.

Furthermore, the library provides advanced visualization tools that go beyond simple metrics like BLEU or ROUGE. Researchers can analyze ROUGE-L scores relative to input length and examine N-gram overlap between generated text and source documents. These tools are crucial for determining whether a model is truly summarizing content or merely copying input text.

Conclusion and Future Directions

TextBox 2.0 provides a robust and efficient foundation for modern text generation research. While it currently offers extensive support for text-to-text PLMs, future developments could expand into multi-modal generation (e.g., image-to-text) and further optimize for massive-scale distributed training. As the field of Large Language Models continues to evolve rapidly, the library's modular design ensures it can adapt to include the latest architectural advancements.

Summary updated

BibTeX
@inproceedings{tang2022textbox,
  author = {Tianyi Tang and Junyi Li and Zhipeng Chen and Yiwen Hu and Zhuohao Yu and Wenxun Dai and Wayne Xin Zhao and Jian-Yun Nie and Ji-Rong Wen},
  title = {{TextBox 2.0: A Text Generation Library with Pre-trained Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-demos.42},
}
Figure