Deleter: Leveraging BERT to Perform Unsupervised Successive Text Compression

Text compression has diverse applications such as Summarization, Reading Comprehension and Text Editing. However, almost all existing approaches require either hand-crafted features, syntactic labels or parallel data. Even for one that achieves this task in an unsupervised setting, its architecture necessitates a task-specific autoencoder. Moreover, these models only generate one compressed sentence for each source input, so that adapting to different style requirements (e.g. length) for the final output usually implies retraining the model from scratch. In this work, we propose a fully unsupervised model, Deleter, that is able to discover an"optimal deletion path"for an arbitrary sentence, where each intermediate sequence along the path is a coherent subsequence of the previous one. This approach relies exclusively on a pretrained bidirectional language model (BERT) to score each candidate deletion based on the average Perplexity of the resulting sentence and performs progressive greedy lookahead search to select the best deletion for each step. We apply Deleter to the task of extractive Sentence Compression, and found that our model is competitive with state-of-the-art supervised models trained on 1.02 million in-domain examples with similar compression ratio. Qualitative analysis, as well as automatic and human evaluations both verify that our model produces high-quality compression.


Introduction
Text compression can be applied to various tasks such as Summarization, Text Editing and even Data Augmentation where the compressed text can be employed as additional training examples. However, almost all existing approaches require either parallel data, hand-crafted rules, or extra syntactic information such as dependency labels or part-of-speech tag features trees (McDonald, 2006;Filippova and Strube, 2008;Zhao et al., 2018). Even for one model that achieves this task in an unsupervised setting, its architecture necessitates a task-specific "sequence-to-sequenceto-sequence" autoencoder (Baziotis et al., 2019). Moreover, these models only generate one compressed sentence for each source input, making adaption to different style requirements difficult.
In this work, we propose a fully unsupervised model, DELETER, that is able to discover an "optimal deletion path" for a sentence, where each intermediate sequence along the path is a coherent subsequence of the previous one. DELETER relies exclusively on a pretrained bidirectional language model, BERT (Devlin et al., 2018), to score each candidate deletion based on the average Perplexity of the resulting sentence and performs progressive greedy look-ahead search to select the best deletion(s) for each step. 1 Table 1 shows a real example of how the DELETER gradually turns "i think america is still a fairly crowded country by the way ." into "america is a country .", where each intermediate sequence between them is a completely grammatical sentence. Interestingly, the model can also be used to delete extra words in a sentence, such as turning "i work work at a company ." into "i work at a company ." As shown in the table, unlike previous pureblack-box approaches, our model not only provides the final compression, but also exposes the full deletion path, making the compression process more comprehensible and controllable, so that it is easy to freeze certain key words from the original sentence or enforce a certain minimum/maximum compression ratio.
We apply DELETER to the task of extractive Sentence Compression, and found that our 1 We will release all our code and model outputs soon. is a country 7.55 Table 1: The optimal deletion path our model finds (without applying a termination condition) for the sentence "i think america is still a fairly crowded country by the way ." model is competitive with state-of-the-art supervised models trained on 1.02 million in-domain examples. Qualitative analysis, as well as automatic and human evaluations, both verify that our model produces high-quality compression.

The DELETER Model
Our DELETER employs progressive lookahead greedy search based on a pretrained BERT, which is used to assign a negative log likelihood for each token in a sentence to derive a score for each intermediate sentence. The algorithm aims to minimize the average score along the path to ensure that each intermediate sentence is grammatical. Task Formulation Given a sentence, there are finite possible tokens we could keep deleting until running out of tokens. In our setting, we do not go back and add tokens to an intermediate sentence.
We thus formulate the task of Sentence Compression as finding an optimal deletion path along a Directed Acyclic Graph. Each node in this graph is either the original sentence itself (i.e., the root node, which has no incoming edges) or a subsequence of it. Each node has outgoing edges pointing to each sentence resulting from a legal deletion of the current node (note that our model allows deletion of multiple tokens in one step). Each edge is also associated with a cost, which is the Average Perplexity Score (AvgPPL) of all tokens in the sentence as assigned by BERT. We consider a path optimal if the average score of all nodes along the path is minimized. Sentence Scoring The DELETER assigns each sentence in the graph an AvgPPL score as shown in the equation below. Lower score indicates more syntactically coherent sentence. {T i } are tokens present in the current sentence and {D i } refer to the collection of all deleted tokens. Note that each log D i is obtained by scoring the corresponding token in the original sentence. This second term is crucial to the algorithm because otherwise the model would prefer to delete rarer tokens, whose unigram probabilities are lower (i.e., of higher negative log likelihood). Progressive Lookahead Greedy Search DELETER allows deleting multiple tokens at a time, but naively probing for deletions consisting of multiple tokens will result in computation workload scaling with O(m k ) , where m is the the number of tokens in the current intermediate sentence and k is the maximum deletion length for each step. We thus adopt a progressive approach to help reduce the search space. Figure 1 shows how a real probing step looks like for the sentence "she sings with me .". For each step, we first probe for deletions consisting of only one token; if no candidate obtains a score below a threshold, we increase the lookahead length to 2, and so forth. A candidate is above this threshold T if: where α (set to 0.04 in our experiments) is a hyperparameter controlling the extent of increase on AvgPPL for each step. The lower it is, the better the compression quality (with the price of being slower). L root is the number of tokens in the original sentence. We include this term because shorter sentences tend to have lower percentage of increase on AvgPPL, in which case we want to lower the threshold. Note that during inference, this threshold also functions as the termination condition in case we are only allowed to select one sentence from the deletion path (e.g. for Sentence Compression).
During probing, we also want to slightly discourage the model from deleting multiple tokens at a time, since we want it to traverse the deletion path as gradually as possible to have more intermediate compressions. We thus further multiply AvgPPL by L β s when probing for the next deletion, where L s is the length of the current sentence and β (set to 0.04 in our experiments) indicates how "gradual" we want the DELETER to proceed.

Experimental Setup DELETER Model Details
We use a pretrained BERT uncased model implemented by Hugging-Face. 2 To score any token in a sentence, we use the special token [mask] to mask out the target token, and then prepend a [CLS] and append a [SEP], which function as [START] and [END] tokens. We use both tokens to help the model evaluate whether the current first or last token can function as a sentence start or end. This is also the main reason that we did not choose other competitive language models such as GPT-2 (Radford et al., 2019): because these models are not bidirectional, they will be much less sensitive to deletions from the very end of a sentence. However, note that since BERT is not intended to be a language model, 3 we mask one token at a time to obtain the negative log probability of each. The maximum lookahead length in our work is set to 3 to facilitate deletion of phrases which contain multiple tokens, such as "by the way" in Table 1.
Datasets We experiment on two datasets. Google sentence compression dataset (Filippova and Altun, 2013) (2015), we used the first 1, 000 sentences of evaluation set as our test set. The Gigaword dataset (Napoles et al., 2012) with 1.02 million examples, where the first 200 are labeled for extractive Sentence Compression by two annotators (Zhao et al., 2018). 5 Automatic and Human Evaluation Following Wang et al. (2017), we use the ground truth compressed sentences to compute F1 scores. Although F1 can be indicative of how well a compression model performs, we note that their could be multiple viable compressions for the same sentence, which single-reference ground-truth cannot cover (Handler et al., 2019). Thus to faithfully evaluate the quality of the compressions generated by our model, we follow Zhao et al. (2018) and conducted human studies on the Gigaword dataset with Amazon Mechanical Turk (MTurk). 6 Specifically, we sample 150 examples from the test set, and put our model output side-by-side with the two compressions created by the two annotators. 7 The three compressions were randomly shuffled to anonymize model identity. We hire annotators who have an approval rate of at least 98% and 10, 000 approved HITs. Following (Zhao et al., 2018), we employed Readability and Informativeness as criteria on a five-point Likert scale.

Results and Analysis
Automatic Evaluation We report F1 scores on both Google and Gigaword dataset. Since each of the 200 sentences from Giga test set has two references (by Annotator 1 and 2, respectively), we report two F1's following Zhao et al. (2018). As shown in Table 2, our model is competitive (esp. for Annotator #2) with state-of-the-art supervised models trained on 1.02 million examples with similar compression ratio.
We also report F1 results on the Google dataset (Table 4). We can see that for this dataset our F1 is still far away from state-of-the-art. We reason that   this is partly because the ground-truth compressions in Google dataset are based on news headlines (later edited by human) rather than compressions generated directly by human beings. 8 Human Evaluation As mentioned in Section 3, we conducted human evaluation on Gigaword. As shown in Table 4, the Readability of our model is close to that of Annotator #1, while there is a larger gap on Informativeness between the two. This is expected because our model is syntaxaware rather than semantic-aware. For example, the DELETER would readily delete negation words (e.g., from "i do not love NLP" to "i do love NLP"), which usually causes abrupt change in meaning. We leave enforcing semantic consistency by leveraging Neural Language Inference datasets (Williams et al., 2017) as future work. It is also interesting to note that there is a larger gap between Annotator #1 and #2 than between Annotator #1 and our model, indicating that the quality of compression is a fairly subject matter.

Related Work
Sentence Compression task has been investigated by various previous work (Jing, 2000;Knight and Marcu, 2000;Clarke and Lapata, 2006;McDonald, 2006;Clarke and Lapata, 2008;Filippova and Strube, 2008;Berg-Kirkpatrick et al., 2011), where the more recent work tend to adopt a neural approach (Filippova and Alfonseca, 2015; Wang   Kamigaito et al., 2018;Cífka et al., 2018). Our model is also neural-based since it leverages a neural language model. Our work differs from previous work in that it does not require any syntactic information such as POS tags or dependency parse tree, which is an advantage especially for low-resource language where training data for tagger or parser is scarce. We note that Baziotis et al. (2019) also built an unsupervised model for abstractive sentence compression. They trained a "sequence-to-sequence-tosequence" autoencoder to first compress the original sentence, and then reconstruct it. Similar to our AvgPPL, Zhao et al. (2018) also employed average Perplexity (though without our length correction terms) as the reward to a policy network trained with reinforcement learning.
Another characteristic of our model is that we obtain a sequence of sentences which are all valid compressions of the original one, while other models usually generate only one compression.

Conclusion
We introduced DELETER which finds an optimal deletion path of a sentence where each node along the path is a grammatical subsequence. We applied this model to two Sentence Compression datasets and found that they are comparable with state-of-the-art supervised models. Note that Sentence Compression has not explored the full power of this model since it only selects one sentence as the output. We plan to apply DELETER to tasks such as Data Augmentation, where the training data of each epoch is dynamically assembled by randomly sampling an intermediate sentence along the deletion path of each sentence. This approach can also be leveraged as a way to generate adversarial examples (Niu and Bansal, 2018) because deleting a few tokens usually preserve semantics of the original sentence.