KG-FiD: Infusing Knowledge Graph in Fusion-in-Decoder for Open-Domain Question Answering

Donghan Yu, Chenguang Zhu, Yuwei Fang, Wenhao Yu, Shuohang Wang, Yichong Xu, Xiang Ren, Yiming Yang, Michael Zeng

Introduction

Open-Domain Question Answering (ODQA) is the task of answering natural language questions in open domains. A successful ODQA model relies on effective acquisition of world knowledge. A popular line of work treats a large collection of open-domain documents (such as Wikipedia articles) as the knowledge source, and design a ODQA system that consists of a retrieving module and a reading module. The retriever pulls out a small set of potentially relevant passages from the open-source documents for a given question, and the reader produces an answer based on the retrieved passages (Karpukhin et al., 2020; Guu et al., 2020; Izacard and Grave, 2020). An earlier example of this kind is DrQA (Chen et al., 2017), which used an traditional search engine based on the bag of words (BoW) document representation with TF-IDF term weighting, and a neural reader for extracting candidate answers for each query based on the dense embedding of the retrieved passages. With the successful development of Pre-trained Language Models (PLMs) in neural network research, dense embedding based passage retrieval (DPR) models (Karpukhin et al., 2020; Qu et al., 2021) have shown superior performance over BoW/TF-IDF based retrieval models due to utilization of contextualized word embedding in DPR, and generative QA readers (Lewis et al., 2020; Roberts et al., 2020) usually outperform extraction based readers (Devlin et al., 2019; Guu et al., 2020) due to the capability of the former in capturing lexical variants with a richer flexibility.

The recently proposed Fusion-in-Decoder (FiD) model (Izacard and Grave, 2021) is representative of those methods with a DPR retriever and a generative reader, achieving the state-of-the-art results on ODQA evaluation benchmarks. FiD also significantly improved the scalability of the system over previous generative methods by encoding the retrieved passages independently instead of encoding the concatenation of all retrieved passages (which was typical in previous methods).

Inspired by the success of FiD, this paper aims further improvements of the state of the art of ODQA in the paradigm with a DPR retriever and a generative reader. Specifically, we point out two potential weaknesses or limitations of FiD as the rooms for improvements, and we propose a novel solution namely KG-FiD to address these issues with FiD. The two issues are:

Issue 1. The independent assumption among passages is not justified. Notice that both the DPR retriever and the generative reader of FiD perform independent encoding of the retrieved passages, which means that they cannot leverage the semantic relationship among passages for passage embedding and answer generation even if such relational knowledge is available. But we know that rich semantic connections between passages often provide clues for better answering questions (Min et al., 2019).

Issue 2. Efficiency Bottleneck. For each input question, the FiD generative reader receives about 100 passages from the DPR module, with a relatively high computational cost. For example, the inference per question takes more than 6 trillion floating-point operations. Simply reducing the number of retrieved passages sent to the reader will not be a good solution as it will significantly decrease the model performance (Izacard and Grave, 2021). How to overcome such inefficient computation issue is a challenging question for the success of FiD in realistic ODQA settings.

We propose to address both of the above issues with FiD by leveraging an existing knowledge graph (KG) to establish relational dependencies among retrieved passages, and employing Graph Neural Networks (GNNs) to re-rank and prune retrieved passages for each query. We name our new approach as KG-FiD.

Specifically, KG-FiD employs a two-stage passage reranking by applying GNN to model structural and semantic information of passages. Both stages rerank the input passages and only a few top-reranked passages are fed into subsequent modules. The first stage reranks passages returned by the retriever, where we use the passage embeddings generated by DPR as the initial GNN node representation. This allows reranking a much larger set of initial candidate passages to enhance coverage of answers. The second stage performs joint passage reranking and answer generation, where the node embeddings are initialized by the embeddings of passage-question pairs output from the reader encoder. This stage operates on a smaller candidate set but aims for more accurate reranking and passage pruning.

To improve the efficiency, in the second-stage reranking, our GNN model adopts representations from the intermediate layer in the reader encoder instead of the final layer to initiate passage node embeddings. Then only a few top reranked passages will be passed into the higher layers of encoder and the decoder for answer generation, while other passages will not be further processed. This is coupled with a joint training of passage reranking and answer generation. As shown in Section 4.3, these strategies significantly reduce the computation cost while still maintaining a good QA performance.

Our experiments on ODQA benchmark datasets Natural Questions and TriviaQA demonstrate that KG-FiD can achieve comparable or better performance in answer prediction than FiD, with only 40% of the computation cost of FiD.

Related Work

ODQA usually assumes that a large external knowledge source is accessible and can be leveraged to help answer prediction. For example, previous works (Chen et al., 2017; Karpukhin et al., 2020; Izacard and Grave, 2021) mainly use Wikipedia as knowledge source which contains millions of text passages. In this case, current ODQA models mainly contains a retriever to select related passages and a reader to generate the answer. Thus, the follow-up works mainly aim to: (1) Improve the retriever: from sparse retrieval based on TF-IDF or BM25 (Chen et al., 2017; Yang et al., 2019) to dense retrieval (Karpukhin et al., 2020) based on contextualized embeddings generated by pre-trained language models (PLMs). Moreover, some further improvement are also proposed such as better training strategy (Qu et al., 2021), reranking based on retrieved passages (Wang et al., 2018; Nogueira and Cho, 2019; Mao et al., 2021), and knowledge distillation from reader to retriever (Izacard and Grave, 2020); (2) Improve the reader: changing from Recurrent Neural Network (Chen et al., 2017) to PLMs such as extractive reader BERT (Karpukhin et al., 2020; Iyer et al., 2021; Guu et al., 2020) and generative reader BART and T5 (Izacard and Grave, 2021; Lewis et al., 2020). Besides, some works (Guu et al., 2020; Lewis et al., 2020; Sachan et al., 2021) have shown that additional unsupervised pre-training on retrieval-related language modeling tasks can further improve ODQA performance. However, none of these methods modeled the relationships among different passages.

ODQA with knowledge graph

Besides the unstructured text corpus, world knowledge also exists in knowledge graphs (KGs), which represent entities and relations in a structural way and have been used in a variety of NLP tasks (Xu et al., 2021b; Yu et al., 2020; Xu et al., 2021a). Some works (Berant et al., 2013; Sun et al., 2018, 2019; Xiong et al., 2019) restrict the answer to be entities in the knowledge graph, while our work focus on more general ODQA setting where the answer can be any words or phrases. Under this setting, some recent efforts have been made to leverage knowledge graphs for ODQA (Min et al., 2019; Asai et al., 2020; Zhou et al., 2020). For example, UniK-QA (Oguz et al., 2020) transforms KG triplets into text sentences and combine them into text corpus, which loses structure information of KG. Other works use KG to build relationship among passages similar to ours. KAQA (Zhou et al., 2020) use passage graph to propagate passage retrieve scores and answer span scores. Graph-Retriever (Min et al., 2019) iteratively retrieve passages based on the relationship between passages, and also use passage graph to improve passage selection in an extractive reader. However, applying KG to improve the recent advanced FiD framework remains unstudied.

Method

In the following sections, we first introduce how to apply KG to build a graph structure among the retrieved passages (Section 3.1). Then we show how we adopt the graph-based stage-1 reranking with DPR retriever to improve passage retrieval (Section 3.2). Next we introduce joint stage-2 reranking and answer generation in the reading module (Section 3.3). Finally we illustrate the improvement of efficiency by using intermediate layer representation for stage-2 reranking (Section 3.4). The overview of our framework is illustrated in Figure 1.

The intuition behind using KG is that there exists the structural relationship among the retrieved passages which can be captured by the KG. Similar to Min et al. (2019), we construct the passage graph where vertices are passages of text and the edges represent the relationships that are derived from the external KGs as KG={(eh,r,et)}\mathcal{KG}=\{(e_{h},r,e_{t})\}, where eh,r,ete_{h},r,e_{t} are the head entity, relation and tail entity of a triplet respectively.

First, we formalize the definition of a passage. Following previous works (Wang et al., 2019; Karpukhin et al., 2020), each article in the text corpus is split into multiple disjoint text blocks of 100 words called passages, which serve as the basic retrieval units. We assume there is a one-one mapping between the KG entities and articles in the text corpus. Specifically, we use English Wikipedia as the text corpus and English Wikidata (Vrandečić and Krötzsch, 2014) as the knowledge graph, since there exists an alignment between the two resourcesEntity recognition and linking can be used if there is no such alignment.. For example, for the article titled with “New York Yankees”, it contains passages such as “The New York Yankees are an American professional baseball team …”. The article also corresponds to a KG entity with the same name as “New York Yankees”.

Then we define the mapping function e=f(p)e=f(p), where the KG entity ee corresponds to the article which pp belongs to. Note that one passage can only be mapped to one entity, but multiple passages could be mapped to the same entity. The final passage graph is defined as G={(pi,pj)}\mathcal{G}=\{(p_{i},p_{j})\}, where passages pip_{i} and pjp_{j} are connected if and only if their mapped entities are directly connected in the KG, i.e., (f(pi),r,f(pj))∈KG(f(p_{i}),r,f(p_{j}))\in\mathcal{KG}.

Since the total number of passages is very large, e.g., more than 20M in Wikipedia, constructing and maintaining a graph over all the passages is inefficient and memory-consuming. Thus, we build a passage graph on the fly for each question, based on the retrieved passages.

2 Passage Retrieving & Stage-1 Reranking

For an input question qq, DPR applies another BERT-based question encoder to obtain its representation QQ, then it builds on FAISS (Johnson et al., 2019) to conduct fast dot-product similarity search between QQ and MM, and returns N1N_{1} (N1≪NN_{1}\ll N) passages with the highest similarity scores.

Stage-1 Reranking: We see that the DPR retriever returns N1N_{1} passages which are independently retrieved based on the similarity between the question and each passage, without considering inter-passage relationship. Thus instead of directly retrieving N1N_{1} passages for the reader, we propose to first retrieve N0N_{0} (N0>N1N_{0}>N_{1}) passages, then rerank them and output top-N1N_{1} reranked passages into the reader.

Following Section 3.1, we construct a graph among the N0N_{0} retrieved passages denoted as G0\mathcal{G}_{0}. We aim to rerank the retrieved passages based on both the structural information and the textual semantic information of them.

To represent the semantic information of passages, one can use another pre-trained language model to encode the passage texts, but this will not only include lots of additional model parameters, but also incur heavy computational cost as N0N_{0} can be large. To avoid both additional memory and computation cost, we propose to reuse the offline passage embeddings MM generated from the DPR retriever in Equation 1 as the initial node representation: Ei(0)=MriE_{i}^{(0)}=M_{r_{i}} where {ri∣i∈{1,2,⋯ ,N0}}\{r_{i}|i\in\{1,2,\cdots,N_{0}\}\} is the set of retrieved passage indices.

Then we employ a graph attention network (GAT) (Velickovic et al., 2018) with LgL_{g} layers as GNN model to update representations for each node based on the passage graph and initial representation. The ll-th layer of the GNN model updates the embedding of node ii as follows:

where hh is usually a non-linear learnable function which aggregates the embeddings of the node itself and its neighbor nodes. The reranking score for each passage prip_{r_{i}} is calculated by sistage-1=QTEi(Lg)s_{i}^{\text{stage-1}}=Q^{T}E_{i}^{(L_{g})}, where QQ is the question embedding also generated by the DPR retriever. Then we sort the retrieved passages by the reranking scores, and input the top-N1N_{1} passages into the reader. The training loss of passage ranking for each question is:

where yi=1y_{i}=1 if prip_{r_{i}} is the gold passageWe follow Karpukhin et al. (2020) on the definition of gold passages. that contains the answer, and 0 otherwise.

As we only add a lightweight graph neural network and reuse the pre-computed and static DPR passage embeddings, our reranking module can process a large number of candidate passages efficiently for each question. In experiments, we set N0=1000N_{0}=1000 and N1=100N_{1}=100.

3 Joint Stage-2 Reranking and Answer Generation

In this section, we briefly introduce the vanilla FiD reading module before illustrating our joint reranking method. We suppose the reader takes N1N_{1} retrieved passages {pa1,pa2,⋯ ,paN1}\{p_{a_{1}},p_{a_{2}},\cdots,p_{a_{N_{1}}}\} as input.

Vanilla FiD Reading Module: We denote the hidden dimension as HH and number of encoder layers and decoder layers as LL, FiD reader first separately encodes each passage paip_{a_{i}} concatenated with question qq:

where TpT_{p} is the sequence length of a passage concatenated with the question. T5-Embed(⋅)\text{T5-Embed}(\cdot) is the initial embedding layer of T5 model (Raffel et al., 2019) and T5-Encoderl(⋅)\text{T5-Encoder}_{l}(\cdot) is the ll-th layer of its encoder module. Then the token embeddings of all passages output from the last layer of the encoder are concatenated and sent to the decoder to generate the answer tokens A:

Stage-2 Reranking: Note that vanilla FiD reader neglect the cross information among passages, and the joint modeling in the decoding process makes it vulnerable to the noisy irrelevant passages. Thus, we propose to leverage the passage graph to rerank the input N1N_{1} passages during the encoding and only select top-N2N_{2} (N2<N1N_{2}<N_{1}) reranked passages into the decoder, which is named as stage-2 reranking.

where A is the generated answer. Similar to stage-1 reranking, the training loss of passage ranking for each question is:

where yi=1y_{i}=1 if paip_{a_{i}} is the gold passage that contains the answer, and 0 otherwise.

The passage reranking and answer generation are jointly trained. We denote the answer generation loss for each question is La\mathcal{L}_{a}, then the final training loss of our reader module is L=La+λLrstage-2\mathcal{L}=\mathcal{L}_{a}+\lambda\mathcal{L}_{r}^{\text{stage-2}}, where λ\lambda is a hyper-parameter which controls the weight of reranking task in the total loss.

Note that the first stage reranking is based on DPR embeddings, which are are high-level (one vector per passage) and not further trained. While the second stage is based on reader-generated passage-question embeddings, which are semantic-level and trainable as part of the model output. Thus the second stage can better capture semantic information of passages and aims for more accurate reranking over a smaller candidate set. In the experiment, we set N1=100N_{1}=100 and N2=20N_{2}=20.

4 Improving Efficiency via Intermediate Representation in Stage-2 Reranking

Recall that in the stage-2 reranking, we take the passage representation from the last layer of reader encoder for passage reranking. In this section, we propose to further reduce the computation cost by taking the intermediate layer representation rather than the last layer. The intuition is that answer generation task is more difficult than passage reranking which only needs to predict whether the passage contains the answer or not. Thus we may not need the representation from the whole encoder module for passage reranking.

Suppose we take the representation from the L1L_{1}-th layer (1≤L1<L1\leq L_{1}<L), i.e., Zi(0)=Pi(L1)(0)Z_{i}^{(0)}=\textbf{P}_{i}^{(L_{1})}(0) for i∈{1,2,⋯ ,N1}i\in\{1,2,\cdots,N_{1}\}, and the reranking method remains the same. Then only the top N2N_{2} (N2<N1N_{2}<N_{1}) reranked passages will go through the rest layers of FiD-encoder. Suppose their indices are Ig={g1,g2,⋯ ,gN2}I_{g}=\{g_{1},g_{2},\cdots,g_{N_{2}}\}, for l≥L1+1l\geq L_{1}+1:

Then Pg1(L),Pg2(L),⋯ ,PgN2(L)\textbf{P}_{g_{1}}^{(L)},\textbf{P}_{g_{2}}^{(L)},\cdots,\textbf{P}_{g_{N_{2}}}^{(L)} are sent into the decoder for answer generation as in Equation 7. In Section 4.3, we demonstrate this can reduce 60% computation cost than the original FiD while keeping the on-par performance on two benchmark datasets.

5 Analysis on Computational Complexity

Here we analyze the theoretical time complexity of our proposed KG-FiD compared to vanilla FiD. More practical computation cost comparison is shown in Appendix A.5. Because both the computations of DPR retrieving and stage-1 reranking are negligible compared to the reading part, we only analyze the reading module here.

Suppose the length of answer sequence A is denoted as TaT_{a} and the average length of the passage (concatenated with question) is TpT_{p}. For vanilla FiD reader, the time complexity of the encoder module is O(L⋅N1⋅Tp2)O(L\cdot N_{1}\cdot T_{p}^{2}), where L,N1L,N_{1} denote the number of encoder layers and the number of passages for reading. The square comes from the self-attention mechanism. The decoder time complexity is O(L⋅(N1⋅Tp⋅Ta+Ta2))O(L\cdot(N_{1}\cdot T_{p}\cdot T_{a}+T_{a}^{2})), where N1⋅Tp⋅TaN_{1}\cdot T_{p}\cdot T_{a} comes from the cross-attention mechanism. For our reading module, all the N1N_{1} candidate passages are processed by the first L1L_{1} layers of encoder. But only N2N_{2} passages are processed by the remaining L−L1L-L_{1} encoder layers and sent into the decoder. Thus, the encoder computation complexity becomes O((L1⋅N1+(L−L1)⋅N2)⋅Tp2)O((L_{1}\cdot N_{1}+(L-L_{1})\cdot N_{2})\cdot T_{p}^{2}), and the decoder computation takes O(L⋅(N2⋅Tp⋅Ta+Ta2))O(L\cdot(N_{2}\cdot T_{p}\cdot T_{a}+T_{a}^{2})). Because L1<L,N2<N1L_{1}<L,N_{2}<N_{1}, both the encoding and decoding of our method is more efficient than vanilla FiD.

Furthermore, the answer is usually much shorter than the passage (which is the case in our experiments), i.e., Ta≪TpT_{a}\ll T_{p}. Then the decoding computation can be negligible compared to the encoding. In this case, the approximated ratio of saved computation cost brought by our proposed method is:

This shows that we can reduce more computation cost by decreasing L1L_{1} or N2N_{2}. For example, if setting L1=L/4,N2=N1/5L_{1}=L/4,N_{2}=N_{1}/5, we can reduce about 60%60\% of computation cost. More empirical results and discussions will be presented in Section 4.3.

Experiment

In this section, we conduct extensive experiments on two most commonly-used ODQA benchmark datasets: Natural Questions (NQ) (Kwiatkowski et al., 2019) which is based on Google Search Queries, and TriviaQA (Joshi et al., 2017) which contains questions from trivia and quiz-league websites. We follow the same setting as Izacard and Grave (2021) to preprocess these datasets, which is introduced in Appendix A.1. All our experiments are conducted on 8 Tesla A100 40GB GPUs.

Knowledge Source: Following Karpukhin et al. (2020); Izacard and Grave (2021), we use the English Wikipedia as the text corpus, and apply the same preprocessing to divide them into disjoint passages with 100 words, which produces 21M passages in total. For the knowledge graph, we use English Wikidata. The number of aligned entities, relations and triplets among these entities are 2.7M, 974 and 14M respectively.

Model Details: For the retrieving module, we use the DPR retriever (Karpukhin et al., 2020) which contains two BERT (base) models for encoding question and passage separately. For the GNN reranking models, we adopt 3-layer Graph Attention Networks (GAT) (Velickovic et al., 2018). For the reading module, same as Izacard and Grave (2021), we initialize it with the pretrained T5-base and T5-large models (Raffel et al., 2019), and we name the former one as KG-FiD (base) and the latter one as KG-FiD (large). Our implementation is based on the HuggingFace Transformers library (Wolf et al., 2019). For number of passages, we set N0=1000,N1=100,N2=20N_{0}=1000,N_{1}=100,N_{2}=20. The training process of our method is introduced in Appendix A.3. More results about model design and hyper-parameter search is in Appendix A.4.

Evaluation: We follow the standard evaluation metric of answer prediction in ODQA, which is the exact match score (EM) (Rajpurkar et al., 2016). A generated answer is considered correct if it matches any answer in the list of acceptable answers after normalizationThe normalization includes lowercasing and removing articles, punctuation and duplicated whitespace.. For all the experiments, we conduct 5 runs with different random seeds and report the averaged scores.

2 Baseline Methods

We mainly compare KG-FiD with the baseline model FiD (Izacard and Grave, 2021). For other baselines, we compare with representative methods from each category: (1) not using external knowledge source: T5 (Roberts et al., 2020) and GPT-3 (Brown et al., 2020); (2) reranking-based methods: RIDER (Mao et al., 2021) and RECONSIDER (Iyer et al., 2021); (3) leveraging knowledge graphs or graph information between passages: Graph-Retriever (Min et al., 2019), Path-Retriever (Asai et al., 2020), KAQA (Zhou et al., 2020), and UniK-QA (Oguz et al., 2020). We also compare with methods (4) with additional large-scale pre-training: REALM (Guu et al., 2020), RAG (Lewis et al., 2020) and Joint Top-K (Sachan et al., 2021).

3 Main Results

Comparison with Baselines: Table 1 shows the results of our method and all baselines. We see that our proposed model KG-FiD consistently and significantly improves FiD on both NQ and TriviaQA datasets over both base and large model. Specifically, for large model, KG-FiD improves FiD by 1.5%1.5\% and 1.1%1.1\% on two datasets respectively, which has larger improvement compared to base model. We think the reason is that more expressive reader will also benefit the stage-2 reranking since the initial passage embeddings are generated by the reader encoder module. We also see that our proposed method outperforms all the baseline methods except UniK-QA (Oguz et al., 2020). However, UniK-QA uses additional knowledge source Wikipedia-Table for retrieval, which is highly related with the NQ dataset and makes it unfair to directly compare with our method.

Efficiency & Accuracy: Table 2 show the detailed comparison between our method and FiD in the large model version. The results of base model version is shown in Appendix A.4. Besides EM score, we also report the ratio of computation flops (#FLOPs) and inference latency (per question). The detailed calculation of #FLOPs is shown in Appendix A.5. From table 2, we see that (1) for KG-FiD, decreasing L1L_{1} can improve the computation efficiency as analyzed in Section 3.4, while increasing L1L_{1} can improve the model performance. We think the performance improvement comes from the noise reduction of passage filtering. For a larger L1L_{1}, the passage embeddings for reranking will have a better quality so that the gold passages are less likely to be filtered out. (2) Simply reducing the number of passages N1N_{1} into vanilla FiD reader can reduce computation cost, but the performance will also drop significantly (from 51.9 to 50.3 on NQ dataset). (3) Our model can achieve the performance on par with FiD with only 38%38\% of computation cost. When consuming the same amount of computations (L1=24L_{1}=24), our model significantly outperforms FiD on both NQ and TriviaQA datasets. These experiments demonstrate that our model is very flexible and can improve both the efficiency and effectiveness by changing L1L_{1}.

4 Ablation Study

Effect of Each Reranking Stage: Since our proposed graph-based reranking method are applied in both retrieving stage (Section 3.2) and reading stage (Section 3.3). We conduct ablation study to validate the effectiveness of each one. Table 3 shows the experiment results by removing each module. We see the performance of KG-FiD drops when removing any of the two reranking modules, demonstrating both of them can improve model performance. Another thing we observe is that stage-1 reranking is more effective in base model while stage-2 reranking is more effective in large model. This is reasonable since stage-2 reranking relies on the effectiveness of reader encoder module, where the large model is usually better than the base model.

Passage Ranking Results: We additionally show that our proposed GNN reranking method can improve the passage retrieval results. This is demonstrated in Figure 2, where we report Hits@K metric over NQ test set, measuring the percentage of top-K retrieved passages that contain the gold passages (passages that contain the answer). We see that DPR+stage-1 reranking consistently outperforms DPR for all the K∈{10,20,50,100}K\in\{10,20,50,100\}. With two stages of reranking, the retrieval results are further improved for K∈{10,20}K\in\{10,20\} (We only cares about K≤20K\leq 20 for stage-2 reranking since N2=20N_{2}=20). This shows that such reranking can increase the rank of gold passages which are previously ranked lower by DPR retriever and improve the efficacy of passage pruning.

Conclusion

This work tackles the task of Open-Domain Question Answering. We focus on the current best performed framework FiD and propose a novel KG-based reranking method to enhance the cross-modeling between passages and improve computation efficiency. Our two-stage reranking methods reuses the passage representation generated by DPR retriver and the reader encoder and apply graph neural networks to compute reranking scores. We further propose to use the intermediate layer of encoder to reduce computation cost while still maintaining good performance. Experiments on Natural Questions and TriviaQA show that our model can significantly improve original FiD by 1.5%1.5\% exact match score and achieve on-par performance with FiD but reducing over 60%60\% of computation cost.

Acknowledgements

We thank all the reviewers for their valuable comments. We also thank Woojeong Jin, Dong-Ho Lee, and Aaron Chan for useful discussions. Donghan Yu and Yiming Yang are supported in part by the United States Department of Energy via the Brookhaven National Laboratory under Contract No. 384608.

References

Appendix A Appendix

The datasets we use are Natural Questions (NQ) and TriviaQA. The open-domain version of NQ is obtained by discarding answers with more than 5 tokens. For TriviaQA, its unfiltered version is used for ODQA. We also convert all letters of answers in lowercase except the first letter of each word on TriviaQA. When training on NQ, we sample the answer target among the given list of answers, while for TriviaQA, we use the unique human-generated answer as generation target. For both datasets, we use the original validation data as test data, and keep 10% of the training set for validation.

A.2 Preliminary Analysis

We conduct preliminary analysis on the graph constructed among passages. Note that for each question, we first apply the retriever to retrieve a few candidate passages, then build edge connection only among the retrieved passages, which means that the passage graph is question-specific. Since the passage graph depends on the retrieved passages, before further utilizing the graph, we need avoid two trivia situations: (1) all the retrieved passages come from the same article; (2) The number of graph edges is very small. Thus we conduct statistics of the passage graphs on two ODQA benchmark datasets, which is shown in Figure 3. For each question, the number of retrieved passages is 100. We see that the two trivia situations only happen for a small portion of questions.

A.3 Training Process

For training our framework, we adopt the separate-training strategy to avoid out-of-memory issue: we first train the DPR model following its original paper, then freeze the DPR model to train the stage-1 reranking module, and finally jointly train stage-2 reranking and reader part. For the training of stage-1 reranking, the optimizer is AdamW (Loshchilov and Hutter, 2019) with learning rate as 1e-3 and linear-decay scheduler. The weight decay rate is 0.01. Batch size is set as 64. The number of total training steps is 15k, and the model is evaluated every 500 steps and the model with best validation results is saved as the final model. For the training of reading part, we adopt the same training setting except that the learning rate is 1e-4 for the base model and 5e-5 for the large model. We also adopt learning rate warm up with 1000 steps.

A.4 Additional Experiment Results

We show additional experiment results in this section, which includes the efficiency and performance comparison between FiD (base) and KG-FiD (base) shown in Table 4, and hyper-parameter search results listed below:

GNN Model Design: We conduct tuning on the model type and number of layers of our GNN based reranking model. For efficiency, we rerank 100 passages returned by DPR retriever and search them based on the passage retrieval results. Table 5 shows the Hits scores for different choices. We see that GAT outperforms vanilla GCN model (Kipf and Welling, 2017) which is reasonable since GAT leverage attention to reweight neighbor passages by their embeddings. The best choice for the number of GNN layers is 3. Note that other GNN models such as GIN (Xu et al., 2019), DGI (Velickovic et al., 2019) can also be applied here and we leave the further exploration of GNN models as future work.

N2N_{2} and λ\lambda. For the stage-2 reranking part in Section 3.3, we also conduct hyper-parameter search on the number of passages after filtering: N2∈{10,20,30}N_{2}\in\{10,20,30\} and the weight of reranking loss when training the reading module: λ∈{0.01,0.1,1.0}\lambda\in\{0.01,0.1,1.0\}. As shown in Table 6, N2=20N_{2}=20 achieves better results than N2=10N_{2}=10, but further increasing N2N_{2} does not bring performance gain while decreasing the efficiency of model since the number of passages to be processed by the decoder is increased. Thus we choose N2=20N_{2}=20. For the loss weight λ\lambda, we found that with its increment, the performance first increases then significantly drops. This shows that it’s important to balance the weight of two training losses, as we want the model to learn better passage reranking while not overwhelming the training signal of answer generation.

A.5 FLOPs Computation

In this section we compute the FLOPs of each moduleOur computation is based on https://github.com/google-research/electra/blob/master/flops_computation.py. The results are shown in Table 7 and 8 for base model and large model respectively. Before the computation, we first show some basic statistics on two benchmark datasets: the average question length is 20, and the average answer length is 5. For the reading part, the length of concatenated passage question pair is 250, number of input passages is N1=100N_{1}=100.

We first calculate the number of FLOPs of vanilla FiD model. For the retrieving part, it contains both question encoding and passage similarity search. We only consider the former part as the latter part depends on the corpus size and search methods and is usually very efficient. The question encoding flops by BERT-based model is about 4.4 Gigaflops (GFLOPs). For the reading part, the encoding of each question passage pair takes about 57/174 GFLOPs for base/large model, and the encoding of 100 passages takes 5772/17483 GFLOPs. The decoder part only costs 714.2/2534.5 GFLOPs for base/large model since the average length of answer is very small. In summary, vanilla FiD base/large model costs 6491.0/20022.0 GFLOPs.

For our model, the computation cost of retrieving part is the same as vanilla FiD. Since we set N0=1000N_{0}=1000 and N1=100N_{1}=100, the GAT (Velickovic et al., 2018) computation in stage-1 reranking takes about 3.5 GFLOPs, and the stage-2 reranking takes only 0.4/0.6 GFLOPs for base/large model. For the reader encoding part, the computation cost depends on L1L_{1} and N2N_{2}, which is analyzed in Section 3.5. For the reader decoding part, where cross attention takes most of the computation, KG-FiD only takes about N2/N1=1/5N_{2}/N_{1}=1/5 cost of vanilla FiD, which is 143.9/510.0 for base/large model respectively. The detailed flops are shown in Table 7 and 8.