Attend and select: A segment selective transformer for microblog hashtag generation

Qianren Mao, Xi Li, Bang Liu, Shu Guo, Peng Hao, Jianxin Li, Lihong Wang · DOI

TL;DR

This paper introduces SEGTRM, a novel Transformer-based model for automatically generating concise and relevant hashtags from microblog posts. By incorporating a "segment selection mechanism" (SSM), SEGTRM effectively filters out noise and identifies crucial textual segments, leading to improved hashtag generation quality compared to existing methods.

What Problem Does This Paper Address?

Microblogging platforms like Twitter and Weibo are rich sources of information, but often lack user-generated hashtags, or have low-quality, inconsistent ones. Manually tagging is time-consuming and costly. Existing automatic hashtag generation methods, primarily based on keyword extraction or sequence-to-sequence models, struggle to filter out irrelevant information and select the most salient tokens for generating condensed, semantically coherent hashtags. This can lead to hashtags that are either too generic, too specific, or don't accurately reflect the post's core message.

Methods

The core innovation of this paper is the Segments Selective Transformer (SEGTRM). It extends the standard Transformer architecture with a novel Segments Selection Mechanism (SSM).

Here's a breakdown:

  • Segmentation: The input microblog post is first divided into fixed-length segments. Special tokens [SEG] are added to mark these segments.
  • Encoder (SgT): A modified Transformer encoder processes these segments. It employs three types of attention: text attention (for global context), segment attention (for segment-level context), and token attention (for token-level context). This hierarchical attention allows the model to capture relationships at different granularities.
  • Segments Selection Mechanism (SSM): This is the key component. It calculates a similarity score between the global post representation (H[s]) and each local segment representation (H[SEG]). Based on these scores, it selects the top k most relevant segments. The paper proposes two variants:
  • Soft SSM: Selects the top k [SEG] tokens and their collateral textual tokens.
  • Hard SSM: Selects only the top k [SEG] tokens themselves.
  • Decoder: A standard Transformer decoder then takes the selected segment representations as input to generate the hashtag sequence. The generation process is sequential, using # as a separator between multiple hashtags and [SEP] as a terminator.

Datasets

The authors constructed two new large-scale datasets for hashtag generation:

  • Chinese Weibo Hashtag Generation (WHG) dataset: Contains 312,762 post-hashtag pairs.
  • English Twitter Hashtag Generation (THG) dataset: Contains 204,039 post-hashtag pairs.

These datasets are noted to be larger and more representative of real-world microblogging data than previous benchmarks, which were often small, sparse, and domain-biased (e.g., heavily focused on entertainment).

Key Insights and Ideas

  • Segment-level filtering is crucial: The success of SEGTRM highlights that simply processing the entire text or relying on token-level attention isn't enough. Identifying and selecting key segments of text is vital for distilling relevant information for hashtag generation.
  • Hierarchical attention captures complex dependencies: The multi-level attention in the encoder helps the model understand how tokens, segments, and the entire post relate to each other, which is important for capturing nuanced semantic relationships.
  • Soft vs. Hard selection trade-offs: While both SSM variants improve over the base model, the soft selection (including collateral tokens) generally performs better, especially on shorter texts like Twitter posts. The hard selection, which only uses [SEG] tokens, struggles with very short posts where segments might not contain enough distinct information.
  • ROUGE is a suitable metric: The paper argues for the use of ROUGE, particularly n-gram overlaps, as it can evaluate the usability of generated hashtags even if they aren't exact matches to the ground truth, which is common in hashtag generation.

Key Results

  • State-of-the-art performance: SEGTRM (specifically the soft version) achieved state-of-the-art results on both the WHG and THG datasets, outperforming strong baselines like SEASS, BOTTOMUP, and TRANSABS in terms of ROUGE F1 scores.
  • Significant improvements: The paper reports significant improvements over keyword extraction methods (Ext.TFIDF) and other neural generation models.
  • SSM effectiveness: Ablation studies showed that the SSM significantly boosts performance, with the soft SSM generally outperforming the hard SSM, especially on the shorter Twitter posts.
  • N-gram overlap analysis: The #MhtS (Manhattan-distance Similarity) metric for SSM showed strong n-gram overlap with golden hashtags, indicating the model's ability to accurately extract and reorganize key details.

Limitations and Future Work

  • Fixed segment length: The current segmentation uses a fixed length, which might not always align with natural linguistic boundaries (e.g., clauses). The authors suggest exploring indefinite length segmentation schemes in future work.
  • Arbitrary number of hashtags: The model generates a fixed sequence of hashtags separated by #. It cannot generate an arbitrary number of hashtags for a given input.
  • Pre-training: The authors mention that pre-training language models could be a promising avenue for further exploration.

Summary updated

BibTeX
@article{mao2022attend,
  author = {Qianren Mao and Xi Li and Bang Liu and Shu Guo and Peng Hao and Jianxin Li and Lihong Wang},
  title = {{Attend and select: A segment selective transformer for microblog hashtag generation}},
  journal = {Knowledge-Based Systems},
  year = {2022},
  doi = {10.1016/j.knosys.2022.109581},
}
Figure