Microblog Hashtag Generation via Encoding Conversation Contexts

Yue Wang, Jing Li, Irwin King, Michael R. Lyu, Shuming Shi

Abstract

Microblogging platforms like Twitter and Weibo rely on hashtags for content categorization, yet the majority of posts lack them. This paper presents a novel neural hashtag generation framework that addresses the limitations of traditional classification and extraction methods. By treating hashtags as sequences of words and leveraging the surrounding conversation context through a bidirectional attention mechanism, our model effectively captures the "gist" of a post even when key terms are absent from the original text. Experimental results on Twitter and Weibo datasets demonstrate significant improvements in F1 scores and the ability to generate hashtags for previously unseen topics.

The Challenge of Hashtag Sparsity

Hashtags are essential for navigating the chaotic stream of microblogs, yet most users do not provide them. Automating this process is difficult because microblogs are notoriously short and informal—a problem known as data sparsity.

Existing approaches typically fall into two categories:

  1. Classification: Treating hashtags as fixed labels. This fails to account for the daily creation of new hashtags and the effectively infinite label space.
  2. Extraction: Pulling phrases directly from the post. This fails when the most relevant hashtag is not explicitly mentioned in the text. For example, a tweet about a tennis player's "weird noises" might require the hashtag #AusOpen, even if the words "Australian" or "Open" never appear.

A Dual-Encoder Generation Framework

To overcome these hurdles, we propose a sequence-to-sequence (seq2seq) architecture that treats hashtags as sequences of words rather than atomic labels. This allows the model to compose new hashtags it has never seen during training.

The core of the model is a dual-encoder system using Bidirectional Gated Recurrent Units (Bi-GRUs). One encoder processes the target post, while the other processes the conversation context—a concatenated string of replies triggered by the post.

The proposed neural hashtag generation architecture featuring dual encoders and a bidirectional attention mechanism.

Leveraging Conversation Context via Bi-Attention

A key insight of this work is that replies act as a crowd-sourced expansion of a post's content. If a post is vague, the replies often clarify the topic, providing the "missing link" for the hashtag. However, social media replies are often noisy.

To filter this noise, we implement a Bidirectional Attention (Bi-attention) layer. Inspired by machine reading comprehension, this layer captures the interaction between the post and its replies, highlighting words in the conversation that are most relevant to the post. This mechanism ensures that the model focuses on semantically relevant context rather than irrelevant chatter.

Attention heatmap illustrating how the model aligns keywords in the post (e.g., 'azarenka') with relevant topical terms in the conversation context (e.g., 'nadal', 'tennis').

Experimental Results

We evaluated the model on two large-scale datasets: a Twitter dataset (44,793 posts) and a Weibo dataset (40,171 posts). Our model consistently outperformed baselines across all metrics (F1@1, MAP, and ROUGE):

  • Superiority over Classification: On the Weibo dataset, the model achieved a 45.03% ROUGE-1 F1 score, more than doubling the performance of state-of-the-art classification models (25.34%).
  • Handling Unseen Tags: In tests for "new" hashtags, the model achieved a ROUGE-1 score of 12.55% on Weibo, whereas classification models are mathematically incapable of predicting unseen labels.
  • Ablation Studies: Removing the conversation context or the bi-attention mechanism led to a significant drop in performance, confirming that context is the critical factor in successful generation.

Conclusion and Future Directions

By treating hashtags as language and utilizing conversation threads as external memory, our framework effectively addresses the data sparsity inherent in microblogs. While the model excels at topical tags, future work will focus on incorporating semantic similarity into evaluation metrics and exploring "pseudo-conversations" for brand-new posts that have not yet received replies.

Summary updated

BibTeX
@inproceedings{wang2019microblog,
  author = {Yue Wang and Jing Li and Irwin King and Michael R. Lyu and Shuming Shi},
  title = {{Microblog Hashtag Generation via Encoding Conversation Contexts}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/n19-1164},
}
Figure