Transformer-based Lexically Constrained Headline Generation

Kosuke Yamada, Yuta Hitomi, Hideaki Tamori, Ryohei Sasano, Naoaki Okazaki, Kentaro Inui, Koichi Takeda

Abstract

Lexically constrained headline generation aims to produce summaries that include specific mandatory phrases, such as brand names or keywords. While traditional models struggle with 100% constraint satisfaction without sacrificing quality, we present a Transformer-based Seq2BF (Sequence to Backward and Forward) model. By utilizing custom attention masks and relative positional encoding, the model generates text bi-directionally from a central constraint. Our approach achieves a 100% success rate on Japanese news datasets and sets a new state-of-the-art in constrained summarization.

Introduction

In domains like automated journalism and advertising, headlines must often incorporate specific "must-have" keywords. Standard abstractive summarization models typically generate text in a unidirectional, left-to-right fashion. This makes it difficult to insert a specific phrase into the middle of a sentence without either breaking grammatical flow or employing computationally expensive constrained decoding techniques that often degrade output quality.

Previous research using Recurrent Neural Networks (RNNs) attempted outward generation but lacked global context. While Transformers are more robust, they often treat constraints as soft "hints." The proposed Seq2BF model addresses this by leveraging the Transformer's attention mechanism to enforce hard constraints through controlled generation orders.

Methodology

The core of the Seq2BF model is its ability to start generation from a "given phrase" and build the headline outward.

Generation Strategies

The authors propose four distinct generation strategies, categorized into sequential and alternating (step-wise) approaches:

  1. Seq-B/F: The model generates the entire backward sequence before starting the forward sequence, or vice versa.
  2. Tok-B/F: A "step-wise" approach where the model alternates between generating one token backward and one token forward.
Overview of generation orders and the Seq2BF architecture.

Specialized Attention Masking

To implement these non-linear generation paths, the standard Transformer decoder is modified with custom attention masks. These masks define the visibility of tokens at each step, ensuring that the model only "sees" the given phrase and previously generated tokens in the specified order. This allows the Transformer to maintain global context while generating text bi-directionally.

Attention masks for the four proposed generation strategies (Seq-B, Seq-F, Tok-B, Tok-F).

Relative Positional Encoding

To maintain spatial awareness during bi-directional generation, the model uses relative positional encoding. The center of the constrained phrase is assigned position 0, with tokens to the left receiving negative indices and tokens to the right receiving positive indices.

Experimental Setup

The model was evaluated using the 2019 Japanese News Corpus (JNC), which contains 1.9 million article-headline pairs. Noun phrases were extracted from reference headlines using the GiNZA NLP library to serve as constraints. Tokenization was performed using MeCab and Byte Pair Encoding (BPE).

Results and Discussion

The Seq2BF model was compared against a vanilla Transformer and the previous state-of-the-art (He et al., 2020).

  • Constraint Satisfaction: The Seq2BF models achieved a 100% Success Rate (SR), significantly outperforming the standard Transformer (36.3%) and the previous best method (90.2%).
  • Linguistic Quality: The Tok-B/F (alternating) strategy yielded the highest ROUGE-1/2/L scores. This suggests that building both sides of the phrase simultaneously helps the model maintain better contextual and grammatical consistency.
  • Efficiency: By avoiding the massive search space of traditional constrained beam search, the model remains computationally efficient despite a slight increase in parameters (~80M).

Conclusion

The Transformer-based Seq2BF model demonstrates that hard lexical constraints can be integrated into abstractive summarization with perfect reliability. Future work will focus on extending the architecture to handle multiple disjoint constraints and addressing issues related to headline length and factual faithfulness.

Summary updated

BibTeX
@inproceedings{yamada2021transformer,
  author = {Kosuke Yamada and Yuta Hitomi and Hideaki Tamori and Ryohei Sasano and Naoaki Okazaki and Kentaro Inui and Koichi Takeda},
  title = {{Transformer-based Lexically Constrained Headline Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.335},
}
Figure