Author Login Chief Editor Login Reviewer Login Editor Login Remote Office

Computer Engineering

   

BiS-RQA: A Retrieval-Augmented Generation Question and Answer Model Based on a Two-Stage Filtering Mechanism

  

  • Published:2026-07-15

BiS-RQA: 基于两阶段过滤机制的语义检索增强生成问答模型

Abstract: Question answering models aim to enable machines to understand natural language questions and automatically reason over text or knowledge bases to generate accurate answers. Existing retrieval-augmented generation (RAG) based QA methods improve generation quality by incorporating external knowledge, yet they still face two challenges: first, insufficient semantic understanding makes it difficult to capture the relationship between the question and the retrieved knowledge; second, the retrieval stage inevitably introduces noisy information with low relevance to the question, which is then amplified during the generation process, easily leading to answer deviation or hallucination. To alleviate these issues, this paper proposes a Semantic Retrieval-Augmented Generation Question Answering model based on a two-stage filtering mechanism, named BiS-RQA. By constructing a progressive framework of explicit and implicit filtering, the model improves answer accuracy in QA scenarios while maintaining efficient inference. The model adopts a two-stage progressive filtering architecture: the first stage filters out obviously irrelevant knowledge entities, and the second stage performs noise suppression on the retained candidate knowledge, allowing the large model to focus on the most valuable pieces of information. The first stage is explicit filtering, which introduces a Semantic-guided Personalized PageRank algorithm (SPPR). In implementation, for an input natural language question, a pre-trained language model is used to extract the question embedding vector; entities and relations in the knowledge graph also obtain their respective embedding vectors through the same model. First, the similarity between the question vector and each entity vector is computed and used as a personalization vector to guide the initial preferences in a random walk with restart. Then, the similarity between the question vector and each relation vector is computed, and this similarity is employed to adjust the transition matrix from the current node to its neighbors during the walk, i.e., the jump probabilities are modified according to the question-relation similarity. On this basis, the algorithm iterates until convergence, yielding stationary distribution scores for all nodes. Finally, the nodes are sorted in descending order of scores, the top-K entities and their associated relations are selected, and a corresponding subgraph is constructed. This process explicitly filters out irrelevant nodes and edges from the original knowledge graph, thereby effectively improving the relevance of the retrieved information. The second stage is implicit filtering, which proposes a Multi-Attention Information Fusion method (MAIF). The MAIF method utilizes self-attention and cross-attention mechanisms to weight entities and relations, respectively. First, entities and relations are pooled to serve as the subgraph embedding; subsequently, the entities, relations, and subgraph pass through a self-attention module to capture internal dependencies, and then cross-attention is further performed to allow them to interact with each other to obtain the correlation degree between information at different granularities, thus achieving implicit filtering and weighting of the candidate information. Finally, the weights output by the cross-attention mechanism serve as soft prompts, while the entities and relations obtained from the first stage serve as hard prompts, and together with the question they are fed into the large language model for answer generation. On the dataset WebQSP, BiS-RQA achieves an accuracy of 77.21%, a relative improvement of 4.6% over the best baseline model G-Retriever (73.79%); on the dataset CWQ, BiS-RQA achieves an F1 score of 35.38%, a relative improvement of 8.1% over the second-best baseline (32.70%). In terms of memory consumption, BiS-RQA uses 31.5 GB of memory, an increase of 1.5% compared to the baseline G-Retriever; in terms of inference time, BiS-RQA requires 0.9427 seconds, an increase of 56% compared to GRAG. Experimental results on multiple public QA datasets validate the effectiveness of the proposed method in semantic retrieval and answer generation, and demonstrate strong competitive advantages.

摘要: 问答模型旨在使机器能够理解自然语言问题并从文本或知识库中自动推理生成准确答案。现有基于检索增强生成的问答方法虽通过引入外部知识提高了生成质量,但仍面临两个问题,一是语义理解能力不足,难以捕捉问题与检索知识之间的关系;二是检索阶段不可避免地引入与问题相关性较低的噪声信息,这些噪声在后续生成过程中被放大,容易导致答案偏离或幻觉现象。为缓解上述问题,本文提出一种基于两阶段过滤机制的语义检索增强生成问答模型(BiS-RQA)。该模型通过构建显式过滤与隐式过滤相递进的框架,在保持高效推理的同时提高问答场景下的答案准确率。该模型使用两阶段递进式过滤架构,第一阶段筛除明显不相关的知识实体,第二阶段对保留下来的候选知识进行噪声抑制,使得大模型能够聚焦于最有价值的信息片段。第一阶段为显式过滤,提出语义引导的个性化PageRank算法(SPPR)。具体实现上,对输入的自然语言问题,使用预训练语言模型提取问题的嵌入向量;知识图谱中的实体和关系也通过同一模型获得各自的嵌入向量。首先,计算问题向量与每个实体向量的相似度,以此作为个性化向量,用于引导带重启的随机游走中的初始偏好。然后,计算问题向量与每个关系向量的相似度,利用该相似度调整游走过程中当前节点到邻居节点的转移矩阵,即根据问题与关系的相似度修改跳转概率。在此基础上,执行算法迭代直至收敛,得到各节点的平稳分布得分。最后按得分降序排序,选取Top-K个实体及其关联关系,构建对应的子图。该过程能够从原始知识图谱中显式过滤掉无关节点与边,从而有效提升检索信息的相关性。第二阶段为隐式过滤,提出多种注意力知识融合方法(MAIF)。MAIF方法分别使用了自注意力与交叉注意力机制来加权实体和关系权重。首先,将实体和关系池化后作为子图嵌入;随后,实体、关系与子图通过自注意力模块捕捉内部依赖,再进一步执行交叉注意力互相交互得到不同粒度信息之间的关联程度,从而实现对候选信息的隐式过滤与加权。最后交叉注意力机制输出的权重作为软提示,并将第一阶段得到的实体和关系作为硬提示,与问题一同输入大语言模型进行回答。在WebQSP数据集上,BiS-RQA的准确率达到77.21%,相较最优基线模型G-Retriever(73.79%)相对提升4.6%;在CWQ数据集上,BiS-RQA的F1得分为35.38%,较次优基线(32.70%)相对提升8.1%。内存占用方面,BiS-RQA使用了31.5 GB内存,相较于基线模型G-Retriever增加了1.5%;推理时长方面,BiS-RQA需要0.9427秒,相较于GRAG增加了56%。在多个公开问答数据集上的实验结果验证了该方法在语义检索与答案生成上的有效性,并展现出优秀的竞争优势。