S acre ROUGE : An Open-Source Library for Using and Developing Summarization Evaluation Metrics (2020)

Abstract: We present SacreROUGE, an open-source library for using and developing summarization evaluation metrics. SacreROUGE removes many obstacles that researchers face when using or developing metrics: (1) The library provides Python wrappers around the official implementations of existing evaluation metrics so they share a common, easy-to-use interface; (2) it provides functionality to evaluate how well any metric implemented in the library correlates to human-annotated judgments, so no additional code needs to be written for a new evaluation metric; and (3) it includes scripts for loading datasets that contain human judgments so they can easily be used for evaluation. This work describes the design of the library, including the core Metric interface, the command-line API for evaluating summarization models and metrics, and the scripts to load and reformat publicly available datasets. The development of SacreROUGE is ongoing and open to contributions from the community.

## introduction evaluating models is a critical step of the machine learning workflow. however, unlike classificationbased tasks, evaluating models which generate text is difficult and is a research area on its own. the basic workflow for developing a new automatic evaluation metric is to design/implement the metric, calculate its correlation to human judgments, then use that metric to evaluate text generation systems. while there have been significant efforts to build libraries for developing machine learning models @xcite @xcite , no equivalent library exists for developing evaluation metrics. in this work, we present sacrerouge, an open-source, python-based li-brary for using and developing text generation metrics, with an emphasis on summarization. sacrerouge removes many obstacles that researchers face when they use or develop evaluation metrics. first, the official implementations of various metrics do not share a common interface or programming language, so using many metrics to evaluate a model can be frustrating and time consuming. sacrerouge provides python-based wrappers around many evaluation metrics so they all implement a simple, easy-to-use interface regardless of how they are implemented internally ( §2). second, evaluating metrics themselves can be tricky. correlations between metric values and human judgments are calculated at several different granularities, there are multiple commonly used correlation coefficients, and fairly comparing human-written references to system output requires implementing jackknifing. since the evaluation code in sacrerouge is shared across all of the metrics, any metric which implements the common metric interface can be evaluated without writing additional code ( §3). third, datasets that contain judgments which are commonly used to evaluate metrics do not share the same format, so writing code to load each dataset requires writing a significant amount of effort. sacrerouge provides scripts for popular summarization datasets that load and reformat them into a common schema so they can easily be used for evaluation ( §4). the development of sacrerouge is ongoing. we intend to add more metrics and datasets to the library as they become available. further, we encourage researchers to use the sacrerouge framework to use existing metrics and develop new ones. sacrerouge is released under the apache 2.0 license and is open to contributions from the community. ## the metric interface the development of evaluation metrics for summarization has been an active area of research for two decades. however, the community has not converged on a consistent format for the input data, so each metric uses its own custom schema. further, the published code for evaluation metrics is written in various programming languages based on which language was popular when the metric was proposed. these challenges make it very cumbersome to use multiple metrics to evaluate a summarization system. sacrerouge addresses these two problems by unifying all of the metrics' implementations into a common interface called metric. the interface provides a pythonic api that allows for evaluating an individual summary or batch of summaries. since all of the metrics share the same interface, evaluating a summarization system with several different metrics is trivial. in order to support older evaluation metrics written in languages such as perl or java, we have written python wrappers around the original code that still implement the metric interface. internally, the wrappers serialize the input summaries to the format required by the underlying metric, a subprocess is created to run the original metric's code, and the output is then loaded from disk again in python. this way, we do not have to port the original metric's code to python and end-users can still use the metrics with the python api. sacrerouge currently supports the following evaluation metrics: handling dependencies many of the evaluation metrics rely on external resources in the form of code, models, or data files. setting up these dependencies in the right format to use the metrics can be difficult. the sacrerouge library addresses this problem by providing setup scripts for each metric which download or compile any required resources. to make this process as easy as possible for the end-user, these scripts are run through a setup-metric command. the command takes the name of the metric to setup, then downloads the required dependencies to a common folder which is managed by sacrerouge. abstracting the metric setup by a simple command makes it such that the end-user can quickly and easily begin using all of the metrics within the library. while there is nothing technically to prevent sacrerouge from being used in a windows environment, thus far the scripts for handling the metrics' dependencies have been written for linuxbased systems. ## evaluating systems and metrics the two most common use cases of an evaluation metric are to evaluate a summarization system and to evaluate a metric itself by calculating its correlation to human judgments. since all of the metrics in sacrerouge implement a common interface, the code for these procedures is shared, so developers of new metrics do not need to rewrite the code to implement these procedures. this logic is exposed through evaluate, score, and correlate, which are subcommands of sacrerouge, the entry point for the library's command-line interface. the evaluate subcommand the purpose of the evaluate subcommand is to calculate a metric's score for one summarization system on one dataset, which most typically occurs when researchers compare their system's performance to others'. the evaluate subcommand accepts a specific metric and an input file that contains the output of a summarization system for an input corpus. the command will load the input data, pass it to the metric, and save the metric's output at the summarylevel and system-level. the summary-level output contains the metric's value for each individual summary, whereas system-level output represents the average performance across the dataset and is most often reported in papers. the score subcommand the typical workflow for an evaluation of a metric is to first calculate the metric's score on a large number of summaries produced by multiple summarization systems on the same set of inputs. then, a correlation coefficient is calculated between those scores and human judgments on the same set of summaries. the first step of this methodology is handled by the score subcommand. the score subcommand is very similar to evaluate except for two key differences. first, the input data is not expected to be the output from a single system. instead, it is expected to be the outputs from several summarization systems for the same sets of input documents. providing the output from multiple systems at once allows sacrerouge to score each of the summaries more efficiently than repeated calls to evaluate because it can avoid duplicate work, such as calculating reference summary-specific statistics. second, the score subcommand will run jackknifing on the input data when possible and necessary. jackknifing is a procedure which allows the value of a metric on system-produced and humanwritten summaries to be fairly compared when the human-written summaries are used to assess the quality of the system summary. briefly, if there is more than one reference summary, each reference is evaluated against all of the others. each system summary is repeatedly evaluated against each possible subset of the reference summaries that has one reference removed. the final system summary score is an average across those evaluations. when jackknifing is performed, a jk suffix is appended to the name of the metric which makes it clear that it is not comparable to the non-jackknifed version. the correlate subcommand after all of the summaries have been scored using the score subcommand, the second step of the meta-evaluation of a metric is to calculate the correlation of those scores to human judgments. this step is done via the correlate subcommand. sacrerouge calculates the three correlation coefficients most commonly used in summarization: pearson, spearman, and kendall. further, these correlations are computed at three different granularities: the summary-level, the system-level, and globally. the summary-level correlation calculates the average correlation per input. the system-level calculates the correlation between average system performances for each metric. the global correlation directly calculates the correlation between all of the observed metric values. the former two granularities are most often used in the summarization literature, and we refer the reader to @xcite for a more detailed description of how to calculate each of them. handling different input requirements it is often the case that different metrics require different input data (e.g., some metrics use reference summaries, others need access to the input documents). therefore, the required data must be loaded from the input file and the evaluate and score subcommands must pass the required data to the metric. the interface for loading data from an input file in sacrerouge is called a datasetreader. for a given input file(s), a datasetreader loads the fields for the evaluation instances. a field is a base class which contains the data for an input instance, such as a documentsfield that maintains the contents of the input documents. then, each evaluation instance contains a mapping from the name of a field to its data. in order to pass the appropriate fields to the summarization metrics, we require that every class that implements the metric interface lists the names of the fields that it uses. for instance, the wrapper for the document-based evaluation metric simetrix specifies it needs a field called documents, a key in the evaluation instance field mapping. then, once the input data has been loaded, the evaluate and score commands can pass the required data to a metric for evaluation. automatically generated subcommands it is desirable to have a different evaluate and score subcommand for each individual metric so that developers can easily specify different metric parameters on the command line. a naive implementation of this would require manually creating the subcommand for each metric. however, in order to eliminate as much boilerplate code as possible, sacrerouge includes a feature to automatically generate these subcommands for any metric that implements the metric interface. using python's inspect and typing libraries, we are able to examine the constructor of each metric and generate a command-line argument for each parameter. for parameters with primitive types, the argparse library directly supports casting command line parameters to the correct types. however, some metrics may use complex types, such as a list of integers. in such situations, sacrerouge assumes that the command line argument will be a string-serialized json object that can be deserialized into the required type at runtime. this allows us to automatically generate evaluate and score subcommands for every metric supported by the library. ## a common dataset format over the past two decades, the summarization community has collected a large number of summarization datasets and human quality annotations. however, these very useful datasets are seldom saved in a common format, forcing every researcher who wants to train a model on the datasets or use the judgments to evaluate a metric to write boilerplate code to load the data. to mitigate this issue, sacrerouge provides scripts that will load the datasets and their corresponding judgments, then serialize them to new files with a common format. the data is serialized in such a manner that it can be directly used in the evaluate, score, and correlate subcommands, thereby making it incredibly easy to run or evaluate any metric in the library on the dataset. the preprocessing scripts will save the data in a human-readable form into three different jsonl files: 2 one for the summarization task data, one for the summaries that have been scored by the human judges, and one for the corresponding metric scores for those summaries. each object in the task file is uniquely identified by an instance 2 a jsonl file contains one serialized json per line. id and contains the input documents and groundtruth summaries for one instance. the scored summaries and metric scores files have parallel data. the objects in both files contain an instance id that identifies the input documents that were used to generate the summary, a summarizer id that identifies the summarization model used to produce the summary, and a string that identifies the type of summarization (either model-generated or humanwritten). the summaries file contains the actual summary output by the system and the references for the input instance, and the metrics file contains the corresponding metric scores for that summary. example json objects from all of the files can be seen in appendix a the scripts to preprocess the datasets are exposed through the setup-dataset subcommand. the subcommand accepts the name of a dataset, an output directory, and any potential dataset-specific arguments. then, sacrerouge will load and preprocess the respective dataset. for datasets which are publicly available, the scripts will download the data automatically. however, many summarization datasets are licensed, so the corresponding preprocessing scripts require paths to the original data supplied to the command. the datasets which are currently supported by sacrerouge are the document understanding conference from 2001 to 2007, foot_1 text analysis conference from 2008 to 2011, foot_2 the multiling 2011, 2013, 2015, 2017, and 2019 workshops, 5 and the cnn/dailymail dataset judgments provided by @xcite . we intend to add more datasets as they become available, and other researchers can easily incorporate their own datasets to our library by serializing the data into the shared format. ## related work the idea for sacrerouge came from the sacre-bleu @xcite library. sacrebleu was developed to standardize and simplify calculating bleu @xcite for machine translation. like sacrerouge, it provides a simple command-line interface to download and evaluate on common machine translation datasets. whereas sacrebleu is mainly for evaluating machine translation models with bleu, our library focuses on summarization and includes a large number of evaluation metrics. further, sacrerouge also provides a framework for developing and evaluating new metrics. one goal of sacrerouge is to standardize the implementation and meta-evaluation of metrics. the perl-based asiya @xcite and python-based easse (alva-manchego et al., 2019) have been developed with similar goals for machine translation and text simplification, respectively. much of the design of sacrerouge was inspired by allennlp @xcite , a library built on pytorch @xcite for developing deep learning models. allennlp provides useful abstractions over different models and neural network modules that allows for the sharing of boilerplate code so developers can quickly create and train new machine learning models. sacrerouge provides similar abstractions for evaluation metrics. two concurrent works set out to achieve similar goals to sacrerouge, the nlp library from hugging face foot_4 and summeval @xcite . both libraries provide easy-to-use interfaces for running many evaluation metrics. however, sacrerouge provides much more functionality for developing and evaluating new metrics, including providing dataset readers for benchmark metric evaluation datasets, implementations of features such as jackknifing, and calculating common correlation coefficients. ## conclusion we have presented sacrerouge, an open-source library dedicated to the development of summarization evaluation metrics. with a unified metric interface and common data format, our library makes it very simple to use existing evaluation metrics as well as develop new ones with a minimum amount of effort. we hope that future researchers will contribute their own metrics and datasets to the library so that it is as easy as possible to run and evaluate summarization metrics. agency (darpa). approved for public release, distribution unlimited. the views expressed are those of the authors and do not reflect the official policy or position of the department of defense or the u.s. government. this research is supported by a focused award from google.