Manuscript Offprint

arXiv:2610.25185

Reranking Answers of Large Language Models with Knowledge Graphs

Mikhail Salnikov, Hai Le, Olga Tsymboi, Ivan Lazichny, Dmitrii Iarosh, Egor Cheremiskin, Andrey Savchenko, Dmitry Simakov, Alexander Panchenko

Mikhail Salnikov a,b^{a,b}, Hai Le b^{b}, Olga Tsymboi c,d^{c,d}, Ivan Lazichny a,d^{a,d}, Dmitrii Iarosh b^{b}, Egor Cheremiskin c,e^{c,e}, Andrey Savchenko c,f^{c,f}, Dmitry Simakov c^{c} and Alexander Panchenko b,a^{b,a}

a^{a} Artificial Intelligence Research Institute, Moscow, Russia

b^{b} Skolkovo Institute of Science and Technology, Moscow, Russia

c^{c} Sber AI Lab, Moscow, Russia

d^{d} Moscow Institute of Physics and Technology, Moscow, Russia

e^{e} Moscow State University, Moscow, Russia

f^{f} Laboratory for Theoretical Foundations of AI Models, HSE University, Moscow, Russia

Accepted for the Semantic Web journal, tracking no. 4075-5289; not published

Abstract. Answering natural language questions over knowledge graph data is challenging due to the vast number of facts, which can be difficult to process and navigate. One potential solution for this issue is to use mined subgraphs related to the query, although this process still requires extracting these subgraphs. This research presents a solution for extracting subgraphs related to entity candidates from a question-and-answer set, which can be obtained by inferring a large language model by calculating the shortest paths between entities. The proposed approaches detail various features that can be extracted from the subgraphs and reranking models to select the most probable answers from a list of candidates. Experiments were conducted on Wikidata to evaluate the effectiveness of the proposed approaches. This involved enumerating all the main feature types that can be extracted from mined subgraphs and a detailed analysis of the proposed features and reranking method combinations. In addition, a public web application that provides a useful web tool for studying the graph space between question and answer entities has been developed to work with subgraphs. This includes visualization of the extracted subgraph and automatic generation of natural language text to describe it.

Keywords: Large Language Model, Knowledge Graph, Shortest Path, Question Answering

Accepted by: Guest Editors of the special issue on Large Language Models, Generative AI and Knowledge Graphs

1. Introduction

Answering factoid questions is a challenging task for any QA system, especially when the system does not have access to relevant knowledge from a Knowledge Graph (KG) or other external source. Despite the lack of a guaranteed correct answer, people still use Large Language Models (LLM) to address this challenge [32, 46], especially since the release of InstructGPT [22]. Given a natural language question and a knowledge base, this paper aims to generate an answer given the context of the KG. In addition to addressing the LLMs themselves, leveraging external structured knowledge bases such as Wikidata [40], DBPedia [1], and NELL [20] can potentially boost the suboptimal performance of these language models. These Knowledge Bases (Knowledge Graphs) are excellent examples of the implementation of Semantic Web principles. They demonstrate how ontologies, RDF (Resource Description Framework), and SPARQL can be used to create complex, interconnected, and machine-readable knowledge

© 2026 – The authors.

systems. While LLMs are great at generating human-like text, Semantic Web technologies are better at providing structured, interpretable, and reusable knowledge. This makes them very useful for tasks that require precision and explainability.

As an alternative, unstructured data, such as plain text, can enhance the performance of LLM-powered factoid question answering through in-context learning. However, these techniques, known as Retrieval-Augmented Generation (RAG) [15], may suffer from factual inaccuracies due to the use of untrusted general plain text sources. As a result, RAG platforms frequently require data source filtering and fine-tuning of the retrieval model for downstream applications to ensure accuracy or some other engineering hacks and tricks. Additionally, performance degradation may arise from either the controversially retrieved context or the model's inability to process context properly. LLM-based systems have been observed to suffer from hallucinations in their answer generation and reasoning processes, which has limited their utility for Knowledge Graph Question Answering (KGQA) tasks [38]. Furthermore, there is a challenge with long-tail facts, as dealing with information related to less frequent or obscure entities is difficult for all KGQA systems [10], and particularly for language models due to the limited knowledge available in training corpora about this type of facts. At the same time, state-of-the-art KGQA systems perform poorly on complex datasets [31].

Figure

Fig. 1. The motivation of our research: LLM's top-1 QA prediction accuracy is often incorrect. However, the correct answer is often in the top 10-40 alternative generations. Thus, a better reranking, such as the one presented in this article, is required. Dependence of Hit@N metric on the size of answer pool N on Mintaka [32] full dataset and Mistral [11], Mixtral [12], T5-Large-SSM and T5-XL-SSM [26] tuned models using Diverse Beam Search [39] as an inference strategy.

Despite all problems, LLMs can answer factoid questions correctly in some cases, especially when prompted to generate multiple answers using some variation of Beam Search [30, 39]. In other words, this shows that although the most likely option from the model's predictions can be incorrect, the answer pool can contain the correct answer. This highlights the importance of reranking answer pools and the use of accurate external data sources to improve the performance of a base language model after fine-tuning. As seen in Figure 1, where the Hit@N metric is evaluated for 1⩽N⩽401 \leqslant N \leqslant 40, LLMs can generate accurate responses, at least for some beams. Therefore, if we have a method to select the correct responses, we can significantly improve the initial quality, bringing the performance closer to the ceiling. Our study will focus on the different reranking methods to enhance the base model's quality.

This paper presents a collection of methods to address the KGQA challenge by accurately reranking possible answers using subgraphs. Firstly, we utilize LLM-produced responses that have previously demonstrated satisfactory outcomes on a complex factoid question-answering dataset, further described in Section 3.1.1. In addition, it has been shown that incorporation of the KG information into LLMs significantly improves the results for various Natural Language Processing task [24]. Thus, this work focuses on extracting and utilizing the information about each question-answer pair by employing the information-dense Wikidata KG. To build upon the discussed novelty, we propose to look into this problem further in a reranking scope while still leveraging Wikidata as our external source. Our hypothesis for this study is that there is important information in the space between entities in the KG related to a question and its answer. According to the graph theory, such space can be represented as a subgraph. This information can help to justify the correctness of an answer. To investigate these subgraphs, we have developed a web application that allows us to explore them and study their relevance to the question-and-answer pair.

The contributions of our work are as follows:

  1. We propose a novel approach to the KGQA that utilizes subgraphs generated from paths from entities mentioned in a question to answer candidate entities. This approach is based on the observation that, while the correct answer may not always be the most likely according to language model predictions, it often appears later within the sequence of generated predictions. Our study consistently improves the Hit@N metric by using various features and models in KG-based reranking.

  2. Through our experiments, we have comprehensively compared the proposed method with well-known reranking techniques, ranging from classical algorithms based on graph features to more recent approaches using sentence transformers.

  3. A publicly available web application 1^{1} for KGQA, subgraph generation, visualization, and graph-to-text generation. This application demonstrates the relationships between the entities in the question and the answer, providing a better understanding of the graph’s structure and motivation for one or another candidate to answer.

Our paper leverages extracted subgraphs and their features to rerank the language model (LM)'s generated answers. The main novelty compared to previous paper [31] is defined as follows:

  1. The KGQA problem has been reformulated as a ranking problem, in contrast to previous work that focused on the top-1 answer, which does not provide sufficient information for a detailed understanding.

  2. We conducted in-depth experiments on all possible features and combinations that can be extracted from subgraphs to address the lack of such detailed experiments in previous studies.

  3. The system incorporates graph-to-natural text generation features, which enhances the interpretability and usability of generated answers.

  4. A subgraph visualization and graph-to-text representation have been added to the demo to understand better the graph's structure and the relationships between its entities.

In this study, we have examined various aspects of working with subgraphs in KGQA and demonstrated that features derived from subgraphs can significantly enhance the ability of LLMs to answer questions. We release the publicly available source code on Github 2^{2} for reproducibility and transparent research.

References (37)