AttentionRank: Unsupervised Keyphrase Extraction using Self and Cross Attentions

Haoran Ding, Xiao LuoEMNLP 2021

Introduction

Keyphrase extraction is a fundamental task in natural language processing, serving as a building block for search engines, recommendation systems, and text summarization. While supervised models currently lead in performance, they are often limited by the high cost of labeled data and poor generalizability across different domains.

AttentionRank addresses these challenges by introducing a novel unsupervised method that "recycles" the internal attention mechanisms of pre-trained Large Language Models (LLMs) like BERT. By leveraging both self-attention and cross-attention weights, the model identifies keyphrases based on their contextual importance and semantic relevance without requiring any domain-specific training.

Methodology

AttentionRank operates through a structured four-step pipeline designed to capture both local and global importance signals from a document.

  1. Candidate Generation: The system utilizes Part-of-Speech (PoS) tagging to identify noun phrases as potential keyphrase candidates.
  2. Accumulated Self-Attention ($a_c$): The model extracts self-attention weights from a pre-trained BERT. It sums the attention a word receives from all other words in a sentence and aggregates this across the document. This captures the "focus" the model naturally places on a word within its local context.
  3. Cross-Attention Relevance ($r_c$): Inspired by Hierarchical Attention Retrieval (HAR), this component measures the semantic alignment between a candidate phrase and the document's sentences. It generates a document embedding tailored to the candidate to evaluate their thematic match.
  4. Hybrid Ranking: The final score is calculated as a linear combination of the two signals: $$Score = d \cdot (Self\text{-}Attention) + (1-d) \cdot (Cross\text{-}Attention)$$ A post-processing step filters out generic high-frequency words using a document frequency threshold ($df_\theta$).
The AttentionRank architecture integrates accumulated self-attention and cross-attention relevance to score candidates.

Experimental Results

The authors evaluated AttentionRank against seven state-of-the-art baselines (including RAKE, YAKE!, and SIFRank) across three benchmarks: Inspec (short abstracts), SemEval2017 (short snippets), and SemEval2010 (long scientific articles).

Performance on Long Documents

AttentionRank demonstrates significant robustness on long-form content. On the SemEval2010 dataset, it outperformed the strongest baseline, SIFRank, by at least 3% in F1-score. The researchers found that for long documents, the self-attention signal ($a_c$) becomes the dominant indicator of importance. As important concepts are repeated and emphasized across many sentences, the accumulated self-attention reliably filters out noise.

F1 scores on the SemEval2010 dataset (long documents) show performance improving as the weight of self-attention (d) increases.

Performance on Short Documents

On shorter datasets like Inspec and SemEval2017, cross-attention plays a more critical role. In limited contexts where phrases may not appear frequently enough to build high self-attention scores, the semantic alignment provided by cross-attention ensures that the extracted phrases are relevant to the overall document theme.

Key Insights

  • Attention as Importance: BERT’s internal attention serves as an effective proxy for human-perceived importance. If multiple words in a sentence attend to a specific noun, it is likely a key concept.
  • Zero-Shot Capability: Because it utilizes pre-trained weights, AttentionRank is highly portable and requires no domain-specific fine-tuning to achieve competitive results.
  • Efficiency: Despite the complexity of the underlying LLM, extracting attention weights is computationally efficient, with long documents being processed in approximately 74 seconds on standard hardware.

Conclusion and Future Work

AttentionRank proves that internal model weights can be effectively repurposed for unsupervised tasks. While the model currently requires some hyperparameter tuning for the integration ratio ($d$) based on document length, it offers a powerful, plug-and-play solution for cross-domain keyphrase extraction. Future research may explore domain-specific fine-tuning of the underlying BERT model to further refine attention signals in specialized fields like law or medicine.

Summary updated

BibTeX
@inproceedings{ding2021attentionrank,
  author = {Haoran Ding and Xiao Luo},
  title = {{AttentionRank: Unsupervised Keyphrase Extraction using Self and Cross Attentions}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.146},
}
Figure