A Novel Perspective to Look At Attention: Bi-level Attention-based Explainable Topic Modeling for News Classification (2022)

Abstract: Many recent deep learning-based solutions have adopted the attention mechanism in various tasks in the field of NLP. However, the inherent characteristics of deep learning models and the flexibility of the attention mechanism increase the models’ complexity, thus leading to challenges in model explainability. To address this challenge, we propose a novel practical framework by utilizing a two-tier attention architecture to decouple the complexity of explanation and the decision-making process. We apply it in the context of a news article classification task. The experiments on two large-scaled news corpora demonstrate that the proposed model can achieve competitive performance with many state-of-the-art alternatives and illustrate its appropriateness from an explainability perspective. We release the source code here.

## introduction the attention mechanism is one of the most important components in recent deep learning-based architectures in natural language processing (nlp). in the early stages of its development, the encoderdecoder models @xcite often adopted an attention mechanism to improve the performance achieved by capturing different areas of the input sequence when generating an output in the decoding process to solve issues arising in encoding long-form inputs. subsequently, researchers have applied the attention mechanism to large-scale corpora and developed a range of pre-trained language models @xcite , such as bert @xcite and gpt-1 @xcite . this has yielded great progress across a range of nlp tasks, including sentiment analysis @xcite and news classification @xcite . however, the inherent characteristics of deep learning models and the flexibility of the attention mechanism increase these models' complexity, thus leading to challenges in model explainability. today, there is still no consensus among researchers regarding whether attention-based models are explainable in theory. some researchers believe that attention weights may reflect the importance of features during the decision-making process and thus can provide an explanation of their operation if we visualize features according to their weight distribution @xcite . however, other researchers have disagreed with this hypothesis. for example, jain and wallance's study demonstrated that learned attention weights are often uncorrelated with feature importance @xcite . some researchers have supported this viewpoint @xcite , but treated with skepticism by others @xcite . in this paper, rather than validating the attention explainability theoretically, we propose a novel, practical explainable attention-based solution. inspired by the idea of topic models @xcite , our proposed solution decouples the complexity of explanation and the decision-making process by adopting two attention layers to capture topicword distribution and document-topic distribution, respectively. specifically, the first layer contains multiple attentions, and each attention is expected to focus on specific words from a topic. the attention in the second layer is then used to judge the importance of topics from the perspective of the target document. in order to further improve the model's explainability, we add an entropy constraint for each attention in the first layer. to prove the effectiveness of our proposed solution, we apply it in the context of a news article classification task and conduct experiments on two largescaled news article datasets. the results presented later in section 4 show that our model can achieve competitive performance with many state-of-the-art transformer-based models and pre-trained language models, while also demonstrating its appropriateness from an explainability perspective. ## methodology this section describes our proposed architecture bi-level attention-based topical model (batm) as illustrated in figure 1 . it uses two attention layers to uncover a latent representation of the data and then makes use of attention weights as a form of topic distribution. we describe this architecture from the perspective of a news classification task. our architecture consists of three components: an embedding layer, two attention layers, and a classification layer. after generating embedding vectors of words for the given news articles, we pass them to two attention layers to obtain the weight distribution of different words in each head (i.e. topic) and the weight distribution of different heads in the input articles. then we generate the document representation vector based on these weights and finally classify the articles into different categories using a single linear layer. by analyzing the weight distribution of the attention layer on the entire news corpus, we find that some heads focus on the words related to the specific topics. these concentrated words help us understand the behavior of the attention mechanism. ## experiments we now evaluate the batm model on two largescale real-world datasets, and compare its performance with a number of state-of-the-art methods. ## effect of entropy constraints in the previous sections, the proposed batm-base-glove model demonstrates its competitive classification performance and excellent explainability. we now study the effect of adding an entropy constraint, as discussed in section 3.5. in the extended model, referred to as batm-ec, λ determines the degree of constraint that is imposed, so the batm-base-glove model is a special case when λ is zero. this study assumes that a good topic (a first-level of attention) should only focus on specific words related to that topic. its weight distribution on a news article should not be flat for the whole document, while its global weight distribution should also not be widely spread out across the entire vocabulary (i.e., it should have a relatively lower entropy ). therefore, we observe the dynamic of two entropy metrics e doc and e token (see calculation in eqn. 8 and eqn. 9) by setting different values of λ. we present the performance and entropy changes along with the values of λ in ## discussion and future work while the variant of our proposed model, batmbase-db, which is initialized by the contextual embeddings, can outperform all alternatives, the meaning of its topics is much worse than batm-base-glove. each contextual embedding learned by pre-trained language models will merge the information from its surrounding words, which increases the difficulties of the proposed attention layer to capture the topics it focuses on, thus leading to more noise in their representations. another challenge we will address in the future is how to balance the computation cost, topic granularity, and classification performances. as discussed in the previous sections, it will affect the model's classification performance if we only introduce entropy constraints without incrementing the number of attention heads. however, increasing the number of attention heads will lead to the proportional increment of parameters, increasing the complexity of the model and resulting in a high computation cost. we will consider increasing the number of heads and the extending entropy constraint further, to improve classification performance while maintaining strong explainability. ## conclusion in this paper, we presented a novel approach that harnesses a bi-level attention framework to decouple the text classification process as topic capturing, topic importance recognition and decision-making process to benefit explainability. we conducted the experiments on two large-scale text corpora. compared with a number of state-of-the-art alternatives on a text classification task, our model can not only achieve a competitive performance, but also demonstrates a strong ability to capture intuitive meanings in the form of topical features, thus improving its explainability and transparency. in addition, by initializing it with contextual embeddings, our model outperforms all the baseline models.