SlowGuess/NAACL_2021_OCR huggingface dataset:
Table 5: Test accuracy on OpenBookQA leaderboard. All listed methods use the provided science facts as an additional input to the language context. The top 2 systems, UnifiedQA (11B params) and T5 (3B params) are  ${30}\mathrm{x}$  and  $8\mathrm{x}$  larger than our model.
Graph Connection (§3.1)	Dev Acc.
No edge between Z and KG nodes	74.81
Connect Z to all KG nodes	76.38
Connect Z to QA entity nodes (final)	76.54
GNN Attention & Message (§3.3)	Dev Acc.
Node type, relation, score-aware (final)	76.54
- type-aware	75.41
- relation-aware	75.61
- score-aware	75.56
Relevance scoring (§3.2)	Dev Acc.
Nothing	75.56
w/ contextual embedding	76.31
w/ relevance score (final)	76.54
w/ both	76.52
GNN Layers (§3.3)	Dev Acc.
L=3	75.53
L=4	76.34
L=5 (final)	76.54
L=6	76.21
L=7	75.96
Table 6: Ablation study of our model components, using the CommonsenseQA IHdev set.
MHGRN. The boost over MHGRN suggests that QA-GNN makes a better use of KGs to perform joint reasoning than existing LM+KG methods.
We also achieve competitive results to other systems on the official leaderboards (Table 3 and 5). Notably, the top two systems, T5 (Raffel et al., 2020) and UnifiedQA (Khashabi et al., 2020), are trained with more data and use  $8\mathrm{x}$  to  $30\mathrm{x}$  more parameters than our model (ours has  $\sim 360\mathrm{M}$  parameters). Excluding these and ensemble systems, our model is comparable in size and amount of data to other systems, and achieves the top performance on the two datasets.
4.6.1 Ablation studies
Table 6 summarizes the ablation study conducted on each of our model components (§3.1, §3.2, §3.3), using the CommonsenseQA IHdev set.
Graph connection (top left table): The first key component of QA-GNN is the joint graph that connects the  $z$  node (QA context) to QA entity nodes  $\nu_{q,a}$  in the KG (§3.1). Without these edges, the QA context and KG cannot mutually update their representations, hurting the performance:  $76.5\% \rightarrow 74.8\%$ , which is close to the previous LM+KG system, MHGRN. If we connected  $z$  to all the nodes in the KG (not just QA entities), the performance is comparable or drops slightly  $(-0.16\%)$ .
KG node relevance scoring (top right table): We find the relevance scoring of KG nodes (§3.2) provides a boost:  $75.56\% \rightarrow 76.54\%$ . As a variant of the relevance scoring in Eq. 1, we also experimented with obtaining a contextual embedding  $\boldsymbol{w}_v$  for each node  $v \in \mathcal{V}_{\mathrm{sub}}$  and adding to the node features:  $\boldsymbol{w}_v = f_{\mathrm{enc}}([text(z); text(v)])$ . However, we find that it does not perform as well ( $76.31\%$ ), and using both the relevance score and contextual embedding performs on par with using the score alone, suggesting that the score has a sufficient information in our tasks; hence, our final system simply uses the relevance score.
GNN architecture (bottom tables): We ablate the information of node type, relation, and relevance score from the attention and message computation in the GNN (§3.3). The results suggest that all these features improve the model performance. For the number of GNN layers, we find  $L = 5$  works the best on the dev set. Our intuition is that 5 layers allow various message passing or reasoning patterns between the QA context  $(z)$  and KG, such as “ $z \rightarrow 3$  hops on KG nodes  $\rightarrow z$ ”.
4.6.2 Model interpretability
We aim to interpret QA-GNN's reasoning process by analyzing the node-to-node attention weights induced by the GNN. Figure 4 shows two examples. In (a), we perform Best First Search (BFS) on the working graph to trace high attention weights from the QA context node (Z; purple) to Question entity nodes (blue) to Other (gray) or Answer choice entity nodes (orange), which reveals that the QA context  $z$  attends to "elevator" and "basement" in the KG, "elevator" and "basement" both attend strongly to "building", and "building" attends to "office building", which is our final answer. In (b),
(a) Attention visualization direction: BFS from Q
(b) Attention visualization direction:  $\mathbf{Q}\rightarrow \mathbf{0}$  and  $\mathsf{A}\to \mathsf{O}$
Figure 4: Interpreting QA-GNN's reasoning process by analyzing the node-to-node attention weights induced by the GNN. Darker and thicker edges indicate higher attention weights.
we use BFS to trace attention weights from two directions:  $\mathbf{Z} \rightarrow \mathbf{Q} \rightarrow \mathbf{O}$  and  $\mathbf{Z} \rightarrow \mathbf{A} \rightarrow \mathbf{O}$ , which reveals concepts ("sea" and "ocean") in the KG that are not necessarily mentioned in the QA context but bridge the reasoning between the question entity ("crab") and answer choice entity ("salt water"). While prior KG reasoning models (Lin et al., 2019; Feng et al., 2020) enumerate individual paths in the KG for model interpretation, QA-GNN is not specific to paths, and helps to find more general reasoning structures (e.g., a KG subgraph with multiple anchor nodes as in example (a)).
4.6.3 Structured reasoning
Structured reasoning, e.g., precise handling of negation or entity substitution (e.g., "hair"  $\rightarrow$  "art" in Figure 5b) in question, is crucial for making robust predictions. Here we analyze QA-GNN's ability to perform structured reasoning and compare with baselines (fine-tuned LMs and existing LM+KG models).
Quantitative analysis. Table 7 compares model performance on questions containing negation words (e.g., no, not, nothing, unlikely), taken from the CommonsenseQA IHtest set. We find that previous LM+KG models (KagNet, MHGRN) provide limited improvements over RoBERTa on questions with negation (+0.6%); whereas QA-GNN exhibits a bigger boost (+4.6%), suggesting its strength
Methods	IHTest-Acc. (Overall)	IHTest-Acc. (Question w/ negation)
RoBERTa-large (w/o KG)	68.7	54.2
+ KagNet	69.0 (+0.3)	54.2 (+0.0)
+ MHGRN	71.1 (+2.4)	54.8 (+0.6)
+ QA-GNN (Ours)	73.4 (+4.7)	58.8 (+4.6)
+ QA-GNN (no edge between Z and KG)	71.5 (+2.8)	55.1 (+0.9)
Table 7: Performance on questions with negation in CommonsenseQA. () shows the difference with RoBERTa. Existing LM+KG methods (KagNet, MH-GRN) provide limited improvements over RoBERTa (+0.6%); QA-GNN exhibits a bigger boost (+4.6%), suggesting its strength in structured reasoning.
in structured reasoning. We hypothesize that QA-GNN's joint updates of the representations of the QA context and KG (during GNN message passing) allows the model to integrate semantic nuances expressed in language. To further study this hypothesis, we remove the connections between  $z$  and KG nodes from our QA-GNN (Table 7 bottom): now the performance on negation becomes close to the prior work, MHGRN, suggesting that the joint message passing helps for performing structured reasoning.
Qualitative analysis. Figure 5 shows a case study to analyze our model's behavior for structured reasoning. The question on the left contains negation "not used for hair", and the correct answer is "B. art supply". We observe that in the 1st layer of QA-GNN, the attention from  $z$  to question entities ("hair", "round brush") is diffuse. After multiples rounds of message passing on the working graph,  $z$  attends strongly to "round brush" in the final layer of the GNN, but weakly to the negated entity "hair". The model correctly predicts the answer "B. art supply". Next, given the original question on the left, we (a) drop the negation or (b) modify the topic entity ("hair" → "art"). In (a),  $z$  now attends strongly to "hair", which is not negated anymore. The model predicts the correct answer "A. hair brush". In (b), we observe that QA-GNN recognizes the same structure as the original question (with only the entity swapped):  $z$  attends weakly to the negated entity ("art") like before, and the model correctly predicts "A. hair brush" over "B. art supply".
Table 8 shows additional examples, where we compare QA-GNN's predictions with the LM baseline (RoBERTa). We observe that RoBERTa tends to make the same prediction despite the modifications we make to the original questions (e.g., drop/insert negation, change an entity); on the other hand, QA-GNN adapts predictions to the modifications correctly (except for double negation
Original Question
GNN 1st Layer
If it is not used for hair, a round brush is an example of what? A. hair brush B. art supply*
GNN Final Layer
A. hair brush (0.38)  
B. art supply (0.64)
Model Prediction
Figure 5: Analysis of QA-GNN's behavior for structured reasoning. Given an original question (left), we modify its negation (middle) or topic entity (right): we find that QA-GNN adapts attention weights and final predictions accordingly, suggesting its capability to handle structured reasoning.
(a) Negation Flipped
If it is used for hair, a round brush is an example of what? A. hair brush B. art supply
GNN Final Layer
A. hair brush (0.81) B. art supply (0.19)
Model Prediction
(b) Entity Changed (hair → art)
If it is not used for art, a round brush is an example of what? A. hair brush B. art supply
GNN Final Layer
A. hair brush (0.72)  
B. art supply (0.28)
Model Prediction
Example (Original taken from CommonsenseQA Dev)	RoBERTa Prediction	Our Prediction
[Original] If it is not used for hair, a round brush is an example of what?A. hair brush B. art supply	A. hair brush (X)	B. art supply (✓)
[Negation flip] If it is used for hair, a round brush is an example of what?	A. hair brush (✓ just no change?)	A. hair brush (✓)
[Entity change] If it is not used for art a round brush is an example of what?	A. hair brush (✓ just no change?)	A. hair brush (✓)
[Original] If you have to read a book that is very dry you may become what?A. interested B. bored	B. bored (✓)	B. bored (✓)
[Negation ver 1] If you have to read a book that is very dry you may not become what?	B. bored (X)	A. interested (✓)
[Negation ver 2] If you have to read a book that is not dry you may become what?	B. bored (X)	A. interested (✓)
[Double negation] If you have to read a book that is not dry you may not become what?	B. bored (✓ just no change?)	A. interested (X)
Table 8: Case study of structured reasoning, comparing predictions by RoBERTa and our model (RoBERTa + QA-GNN). Our model correctly handles changes in negation and topic entities.
Methods	IHtest-Acc. (Question w/ ≤10 entities)	IHtest-Acc. (Question w/ >10 entities)
RoBERTa-large (w/o KG)	68.4	70.0
+ MHGRN	71.5	70.1
+ QA-GNN (w/o node relevance score)	72.8 (+1.3)	71.5 (+1.4)
+ QA-GNN (w/ node relevance score; final system)	73.4 (+1.9)	73.5 (+3.4)
Table 9: Performance on questions with fewer/more entities in CommonsenseQA. () shows the difference with MHGRN (LM+KG baseline). KG node relevance scoring (\$3.2) boosts the performance on questions containing more entities (i.e. larger retrieved KG).
in the table bottom, which is a future work).
4.6.4 Effect of KG node relevance scoring
We find that KG node relevance scoring (§3.2) is helpful when the retrieved KG  $(\mathcal{G}_{\mathrm{sub}})$  is large. Table 9 shows model performance on questions containing fewer  $(\leq 10)$  or more  $(>10)$  entities in the CommonsenseQA IHtest set (on average, the former and latter result in 90 and 160 nodes in  $\mathcal{G}_{\mathrm{sub}}$  respectively). Existing LM+KG models such as MHGRN achieve limited performance on questions with more entities due to the size and noisiness of retrieved KGs:  $70.1\%$  accuracy vs  $71.5\%$  accuracy on questions with fewer entities. KG node relevance scoring mitigates this bottleneck, reducing the accuracy discrepancy:  $73.5\%$  and  $73.4\%$  accuracy on questions with more/fewer entities, respectively.
5 Related work and discussion
Knowledge-aware methods for NLP. Various works have studied methods to augment NLP systems with knowledge. Existing works (Pan et al., 2019; Ye et al., 2019; Petroni et al., 2019; Bosselut et al., 2019) study pre-trained LMs' potential as latent knowledge bases. To provide more explicit and interpretable knowledge, several works integrate structured knowledge (KGs) into LMs (Mihaylov and Frank, 2018; Lin et al., 2019; Wang et al., 2019a; Yang et al., 2019; Wang et al., 2020b; Bosselut et al., 2021).
Question answering with LM+KG. In particular, a line of works propose LM+KG methods for question answering. Most closely related to ours are works by Lin et al. (2019); Feng et al. (2020); Lv et al. (2020). Our novelties are (1) the joint graph of QA context and KG, on which we mutually update the representations of the LM and KG; and (2) language-conditioned KG node relevance scoring. Other works on scoring or pruning KG nodes/paths rely on graph-based metrics such as PageRank, centrality, and off-the-shelf KG embeddings (Paul and Frank, 2019; Fadnis et al., 2019; Bauer et al., 2018; Lin et al., 2019), without reflecting the QA context.
Other QA tasks. Several works study other forms of question answering tasks, e.g., passage-based QA, where systems identify answers using given or retrieved documents (Rajpurkar et al., 2016; Joshi et al., 2017; Yang et al., 2018), and
KBQA, where systems perform semantic parsing of a given question and execute the parsed queries on knowledge bases (Berant et al., 2013; Yih et al., 2016; Yu et al., 2018). Different from these tasks, we approach question answering using knowledge available in LMs and KGs.
Knowledge representations. Several works study joint representations of external textual knowledge (e.g., Wikipedia articles) and structured knowledge (e.g., KGs) (Riedel et al., 2013; Toutanova et al., 2015; Xiong et al., 2019; Sun et al., 2019; Wang et al., 2019b). The primary distinction of our joint graph representation is that we construct a graph connecting each question and KG rather than textual and structural knowledge, approaching a complementary problem to the above works.
Graph neural networks (GNNs). GNNs have been shown to be effective for modeling graph-based data. Several works use GNNs to model the structure of text (Yasunaga et al., 2017; Zhang et al., 2018; Yasunaga and Liang, 2020) or KGs (Wang et al., 2020a). In contrast to these works, QA-GNN jointly models the language and KG. Graph Attention Networks (GATs) (Veličković et al., 2018) perform attention-based message passing to induce graph representations. We build on this framework, and further condition the GNN on the language input by introducing a QA context node (§3.1), KG node relevance scoring (§3.2), and joint update of the KG and language representations (§3.3).
We presented QA-GNN, an end-to-end question answering model that leverages LMs and KGs. Our key innovations include (i) Relevance scoring, where we compute the relevance of KG nodes conditioned on the given QA context, and (ii) Joint reasoning over the QA context and KGs, where we connect the two sources of information via the working graph, and jointly update their representations through GNN message passing. Through both quantitative and qualitative analyses, we showed QA-GNN's improvements over existing LM and  $\mathrm{LM + KG}$  models on question answering tasks, as well as its capability to perform interpretable and structured reasoning, e.g., correctly handling negation in questions.
We thank Rok Sosic, Weihua Hu, Jing Huang, Michele Catasta, members of the SNAP research group, P-Lambda group and Project MOWGLI
team, as well as our anonymous reviewers for valuable feedback.
We gratefully acknowledge the support of DARPA under Nos. N660011924033 (MCS); Funai Foundation Fellowship; ARO under Nos. W911NF-16-1-0342 (MURI), W911NF-16-1-0171 (DURIP); NSF under Nos. OAC-1835598 (CINES), OAC-1934578 (HDR), CCF-1918940 (Expeditions), IIS-2030477 (RAPID); Stanford Data Science Initiative, Wu Tsai Neuro-sciences Institute, Chan Zuckerberg Biohub, Amazon, JP-Morgan Chase, Docomo, Hitachi, JD.com, KDDI, NVIDIA, Dell, Toshiba, and United Health Group. Hongyu Ren is supported by Masason Foundation Fellowship and the Apple PhD Fellowship. Jure Leskovec is a Chan Zuckerberg Biohub investigator.
All code and data are available at  
https://github.com/michiyasunaga/qagnn.  
Experiments are available at  
https://worksheets.  
codalab.org/worksheets/  
0xf215deb05edf44a2ac353c711f52a25f.
Pratyay Banerjee and Chitta Baral. 2020. Knowledge fusion and semantic knowledge ranking for open domain question answering. arXiv preprint arXiv:2004.03101.
Pratyay Banerjee, Kuntal Kumar Pal, Arindam Mitra, and Chitta Baral. 2019. Careful selection of knowledge to solve open book question answering. In Association for Computational Linguistics (ACL).
Junwei Bao, Nan Duan, Zhao Yan, Ming Zhou, and Tiejun Zhao. 2016. Constraint-based question answering with knowledge graph. In International Conference on Computational Linguistics (COLING).
Lisa Bauer, Yicheng Wang, and Mohit Bansal. 2018. Commonsense for generative multi-hop question answering tasks. In Empirical Methods in Natural Language Processing (EMNLP).
Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. 2013. Semantic parsing on freebase from question-answer pairs. In Empirical Methods in Natural Language Processing (EMNLP).
Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. 2008. Freebase: a collaboratively created graph database for structuring human knowledge. In SIGMOD.
Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko.
2013. Translating embeddings for modeling multi-relational data. In Advances in Neural Information Processing Systems (NeurIPS).
Antoine Bosselut, Ronan Le Bras, and Yejin Choi. 2021. Dynamic neuro-symbolic knowledge graph construction for zero-shot commonsense question answering. In Proceedings of the AAAI Conference on Artificial Intelligence.
Antoine Bosselut, Hannah Rashkin, Maarten Sap, Chaitanya Malaviya, Asli Celikyilmaz, and Yejin Choi. 2019. Comet: Commonsense transformers for automatic knowledge graph construction. In Association for Computational Linguistics (ACL).
Peter Clark, Oren Etzioni, Daniel Khashabi, Tushar Khot, Bhavana Dalvi Mishra, Kyle Richardson, Ashish Sabharwal, Carissa Schoenick, Oyvind Tafjord, Niket Tandon, et al. 2019. From 'f'to'a'on the ny regents science exams: An overview of the aristo project. arXiv preprint arXiv:1909.01958.
Kshitij Fadnis, Kartik Talamadupula, Pavan Kapani-pathi, Haque Ishfaq, Salim Roukos, and Achille Fokoue. 2019. Heuristics for interpretable knowledge graph contextualization. arXiv preprint arXiv:1911.02085.
Yanlin Feng, Xinyue Chen, Bill Yuchen Lin, Peifeng Wang, Jun Yan, and Xiang Ren. 2020. Scalable multi-hop relational reasoning for knowledge-aware question answering. In Empirical Methods in Natural Language Processing (EMNLP).
Kelvin Guu, John Miller, and Percy Liang. 2015. Traversing knowledge graphs in vector space. Empirical Methods in Natural Language Processing (EMNLP).
Sergey Ioffe and Christian Szegedy. 2015. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International conference on machine learning (ICML).
Mandar Joshi, Eunsol Choi, Daniel S Weld, and Luke Zettlemoyer. 2017. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In Association for Computational Linguistics (ACL).
Nora Kassner and Hinrich Schütze. 2020. Negated and misprimed probes for pretrained language models: Birds can talk, but cannot fly. In Association for Computational Linguistics (ACL).
Daniel Khashabi, Tushar Khot, Ashish Sabharwal, Oyvind Tafjord, Peter Clark, and Hannaneh Hajishirzi. 2020. Unifiedqa: Crossing format boundaries with a single qa system. In Findings of EMNLP.
Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. Albert: A lite bert for self-supervised learning of language representations. In International Conference on Learning Representations (ICLR).
Bill Yuchen Lin, Xinyue Chen, Jamin Chen, and Xiang Ren. 2019. Kagnet: Knowledge-aware graph networks for commonsense reasoning. In Empirical Methods in Natural Language Processing (EMNLP).
Liyuan Liu, Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Jiawei Han. 2020. On the variance of the adaptive learning rate and beyond. In International Conference on Learning Representations (ICLR).
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692.
Shangwen Lv, Daya Guo, Jingjing Xu, Duyu Tang, Nan Duan, Ming Gong, Linjun Shou, Daxin Jiang, Guihong Cao, and Songlin Hu. 2020. Graph-based reasoning over heterogeneous external knowledge for commonsense question answering. In Proceedings of the AAAI Conference on Artificial Intelligence.
Kaixin Ma, Jonathan Francis, Quanyang Lu, Eric Nyberg, and Alessandro Oltramari. 2019. Towards generalizable neuro-symbolic systems for commonsense question answering. arXiv preprint arXiv:1910.14087.
Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. 2018. Can a suit of armor conduct electricity? a new dataset for open book question answering. In Empirical Methods in Natural Language Processing (EMNLP).
Todor Mihaylov and Anette Frank. 2018. Knowledgeable reader: Enhancing cloze-style reading comprehension with external commonsense knowledge. In Association for Computational Linguistics (ACL).
Xiaoman Pan, Kai Sun, Dian Yu, Jianshu Chen, Heng Ji, Claire Cardie, and Dong Yu. 2019. Improving question answering with external knowledge. arXiv preprint arXiv:1902.00993.
Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. 2013. On the difficulty of training recurrent neural networks. In International conference on machine learning (ICML), pages 1310-1318.
Debjit Paul and Anette Frank. 2019. Ranking and selecting multi-hop knowledge paths to better predict human needs. In North American Chapter of the Association for Computational Linguistics (NAACL).
Fabio Petroni, Tim Rocttäschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, and Sebastian Riedel. 2019. Language models as knowledge bases? In Empirical Methods in Natural Language Processing (EMNLP).
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text