<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>AGGILE: Automated Graph Generation for Inference and Language Exploration</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Victoria Firsanova</string-name>
          <email>vfirsanova@hse.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Yana Khlusova</string-name>
          <email>yakkhlusova@edu.hse.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Higher School of Economics (HSE University)</institution>
          ,
          <addr-line>Griboedova emb. 123, St Petersburg, 190068, Russian Federation</addr-line>
        </aff>
      </contrib-group>
      <abstract>
        <p>Knowledge graphs are widely used in Retrieval Augmented Generation (RAG) and Explainable AI (XAI), since they can illustrate semantic relationships generated by Large Language Models (LLMs). Recent studies focus on generating knowledge graphs from unstructured data to improve RAG performance; however, they do not explain the underlying graph structure. The analysis of synthetic graphs behind modern graph-based RAG systems shows that the structures generated by LLMs fail to capture semantic relations represented in the unstructured texts. The paper addresses these limitations by proposing a novel approach that enhances explainability and reduces hallucinations in knowledge graph generation for RAG systems. The paper introduces AGGILE, a tool for LLM-based graph generation from unstructured data and their visualization for enhanced explainability. Our approach extracts keywords and related concepts from unstructured data and generates predicates that denote semantic relations between the extracted entities. We evaluated our framework using qualitative linguistic criteria on a sample of unstructured Wikipedia data. The results of our qualitative analysis show that the AGGILE tool captures complex semantic relationships from unstructured data, allowing for in-depth LLMs' knowledge exploration. The method is scalable and domain-agnostic; however, a small rate of hallucinations occurs in the generated structures, and there are limitations in the input text size for proper graph modeling. Overall, this work contributes to improving the transparency and controllability of graph RAG. The AGGILE tool is open source: demo versions, source code, and software documentation are available in the project repository at https://github.com/vifirsanova/AGGILE/.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Large Language Models (LLMs)</kwd>
        <kwd>Automated Graph Generation</kwd>
        <kwd>Knowledge Graphs</kwd>
        <kwd>Explainable AI (XAI)</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        A knowledge graph is a data model that represents objects and relations between them with nodes and
edges. In Artificial Intelligence (AI), knowledge engineering, and Natural Language Processing (NLP),
knowledge graphs are often used to depict semantic and logical relations between concepts to represent
data, cognitive structures, or common knowledge. Graphs are often applied to enhance search engines
and information retrieval systems [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. In recent years, knowledge graphs has been widely applied in
Retrieval Augmented Generation (RAG).
      </p>
      <p>
        Retrieval Augmented Generation (RAG) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] is a type of NLP architecture that perform language
generation conditioned by data retrieved from an external source, such as a vector database or knowledge
graph [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. RAGs are often applied in knowledge-intensive tasks, such as question-answering, and their
performance is heavily dependent on the quality of content of the external knowledge source. The data
structure determines the RAG performance, and knowledge graphs are popular choice as an external
source for the retriever, because graphs allow extracting entities and their relations directly. Subgraphs
extracted through graph-based RAG signify facts as subsets of entities consisting of interrelated items.
      </p>
      <p>
        While there are various open-domain knowledge bases, such as Wikidata [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] and DBPedia [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], that
use specific formats, like Resource Description Framework (RDF) or Extensible Markup Language
(XML), they cannot be used for building a RAG system serving specific closed-domain field (e.g. a RAG
system for a company FAQ). Building a custom closed-domain knowledge graph is a resource-intensive
task that requires complex data structuring and manual data handling. Some RAG approaches [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
propose automated graph generation from unstructured data. Automated graph generation improves
RAG performance and simplifies model explainability through graph visualization.
      </p>
      <p>
        From our empirical findings and observations made with GraphRAG API [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] and a GraphRAG
visualization Gradio application [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], while automatically generated graphs successfully handle common
relations, such as locations or addresses (‘X is located in Y’), family relations (‘X is a brother / sister of
Y’), and hierarchical relations (e.g., see examples in LlamaIndex tutorial [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]), they often fail in capturing
professional terms. For example, in the text describing Minimoog, an analog synthesizer, the model
provides poor and uniformative graphs (see Fig. 1). In the provided example, the model repetitively
extracts relation ‘CONTAINS’ for the node ‘Minimoog’, focusing on the most frequent terms related
to synthesizers (‘oscillator’ and ‘controllers’), while ignoring other important technical terms, such as
‘knob’, ‘cursor’, or ‘waveforms’.
      </p>
      <p>We suggest that the limitation is caused by the fact the graph structure is generated end-to-end, i.e.
the graph is resulted from the input data directly without fragmenting the graph into its structural
elements (nodes and edges). The study hypothesis is that knowledge graph generation can become
more controllable, providing more advanced explainability options through visualization tools, if the
graph synthesis implies sequential generation of a graph components, i.e. nodes and edges. The study
proposes a novel approach called Automated Graph Generation for Inference and Language Exploration
(AGGILE) that uses prompt-tuning to build knowledge graphs from unstructured data sequentially
using the following algorithm:
• Extract entities from the unstructured data to form graph nodes
• Extract related items for the extracted entities (related nodes)
• Generate predicated between the extracted entities and the related items (edges)
• Form triplets from two nodes and edges between them
• Connect the triplets to a graph
• Set weights to edges according to the number of connections with other nodes</p>
      <p>The resulting structure is a weighted graph, where the nodes with more relations get higher weights.
This model allows for extracting topics, finding clusters and searching through subgraphs, as well as
visualizing weighted graphs allowing for fine-grained RAG explainability analysis. The AGGILE tool
provides the following functions:
• Graph structure generation from unstructured data
• Interactive graph visualization
• Graph-based RAG function</p>
      <p>The approach is evaluated using linguistic qualitative analysis based on criteria involving searching
for noise in the generated data, assessing nodes’ and edges’ accuracy and relevance to the data topic,
as well as evaluating graph scalability. The methods from linguistics are used to explore the semantic
relations built with the AGGILE tool, analyze the word forms and parts-of-speech used by the model to
denote nodes and edges, and identify LLM hallucinations and logical errors.</p>
      <p>The AGGILE tool is fully compatible with the HuggingFace infrastructure. The tool is open source
and available in the project repository at https://github.com/vifirsanova/AGGILE/. The tool generates
JSON object with graph structure, HTML file with interactive graph built with Plotly, and answer to user
question. The tool supports a wide range of LLMs, while the experiments described in this paper are
based on DeepSeek-R1-Distill-Qwen-32B model, a distilled model from DeepSeek-R1 based on Qwen.</p>
      <p>The study contributions are the following:
• A novel tool for RAG explainability based on automated knowledge graph generation and
visualization
• A novel method for generating knowledge graphs from unstructured data based on sequential
nodes and edges synthesis for RAG and XAI
• A novel approach to qualitative knowledge graph assessment for XAI based on linguistic theory
Overall, AGGILE provides a toolkit for automated graph generation, explainability analysis and
RAG implementation. The study findings show that sequential generation of graph components from
unstructured data allows for building scalable RAG models with high explainability potential, enabling
transparent and controllable language generation.</p>
      <p>The AGGILE tool demonstrate the ability to highlight target domain and topical clusters, as well as
iflter irrelevant information. The model can produce weighted relations, allowing to extract subgraphs
and learning how LLMs prioritize the information during the processing. Also, the model can extract
diverse semantic links, for example, hierarchical and associative relations.</p>
      <p>However, the proposed method has several limitations. The model implies several queries to the LLM,
increasing the time required to generate the graph. This limits the AGGILE eficiency, however, we plan
to solve the issue by using vector representations directly instead of using text-based prompt-tuning.
Also, the model shows some logical errors in forming edges between the nodes, and tends to generate
relations between identical nodes. The latter problem was fixed by applying a simple rule for filtering
triplets with duplicating nodes.</p>
      <p>In perspective, we plan to test the AGGILE performance on popular RAG benchmarks, expland the
tool interface with tablular representation of the generated nodes and edges, and present an analytical
framework for LLMs’ assessment based on the developed linguistic criteria for graph-based XAI.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Work</title>
      <p>
        A knowledge graph (KG) is a structured representation of real-world entities and the relationships
between them [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. In the context of our work, entities are understood as keywords and their
semantically related terms. Formally, a knowledge graph can be expressed as follows:  = ((), (), ()),
where  represents the set of keywords,  denotes the set of related words, and  signifies the set of
semantic links connecting these concepts.
      </p>
      <p>
        The semantic linking methodology employed in this study is inspired by WordNet [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], a well-known
lexical database. WordNet organizes synonyms into sets interconnected via various semantic relations
such as meronymy/holonymy, antonymy, hyponymy/hypernymy, troponymy, and entailment. A target
word is understood as a keyword. The keyword has some related words, e.g. particular synonyms or
antonyms. We rely on this terminology.
      </p>
      <p>A triplet (or triple) is a part of KG (subgraph), consisting of a keyword (subject), a related word (object)
and the semantic relation (predicate) between them: (, , ) = (, , ). Some
examples of such triplets include: Mathematics () is a branch of () Number Theory (), Geometry ()
studies () Shapes (), Analysis () is a branch of () Mathematic Logic ().</p>
      <p>
        Retrieval-augmented generation (RAG) is a technique designed to enhance the performance of large
language models (LLMs) by integrating them with an external knowledge base (KB) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. In its simplest
form, a RAG system processes a user query by vectorizing it, retrieving the most relevant information
from a pre-vectorized KB via semantic search, and generating a response based on the retrieved content.
      </p>
      <p>
        An advanced variant of RAG, known as GraphRAG [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], retrieves data from a KG. In this approach,
LLM is employed to extract entities and relationships from source documents to construct a KG.
Then the communities of the KG are summarized to generate response to user query. This method
has demonstrated notable improvements in question-answering (QA) task compared to conventional
semantic search-based RAG systems.
      </p>
      <p>
        SubgraphRAG [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] introduces a method for answer generation based on subgraphs extracted from the
main KG using a lightweight multilayer perceptron (MLP) combined with parallel triple-scoring. The
authors argue that LLMs should focus on interpreting data rather than constructing graphs. Explanations
are produced from relevant triplets, and the method achieves results that are either better or comparable
with state-of-the-art (SOTA) approaches.
      </p>
      <p>
        G-Retriever [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] similarly works with subgraphs but uses language model for indexing and data
retrieval. It further assesses the relevance and optimal size of subgraphs using the Prize-Collecting
Steiner Tree algorithm, returning the most pertinent subgraph to explain the LLM’s reasoning process.
The system architecture was evaluated in three ways: inference with a frozen LLM, prompt-tuning,
and fine-tuning with LoRA. The highest evaluation scores were observed in the fine-tuning scenario.
As a result, G-Retriever was able to decrease tokens, nodes and training time. Additionally, the study
highlights the challenges posed by KG complexity and data noise, both of which can negatively afect
answer quality.
      </p>
      <p>While the aforementioned works primarily focus on KG-based information retrieval, the following
studies concentrate on KG generation.</p>
      <p>
        In the first one [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] LLM predicts road users behavior and provides explanations using RAG. Video
content is converted into linguistic features, entities are extracted through deep learning techniques.
The resulting KG is constructed using the Ampligraph 2.0.0 library [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] in the form of triplets describing
the scene from the video. Explanations are provided in two ways: using fuzzy-logic and retrieved
linguistic features. This approach demonstrated notable improvements in prediction accuracy compared
to conventional methods.
      </p>
      <p>
        The second study is devoted to explanation generation for learning recommendations [
        <xref ref-type="bibr" rid="ref16 ref17">16, 17</xref>
        ] based
on the custom KG. The KG is constructed from structured data comprising learning object titles (short
text headings) and their extended textual descriptions. Titles are embedded using Sentence-BERT and
SpaCy. Keywords are extracted from descriptions using KeyBERT and then embedded. The overall
quality of explanations provided by LLM was improved; however, learning experts noted issues related
to the phrasing of generated responses and a lack of high-level abstraction in the explanations.
      </p>
      <p>None of the aforementioned works explicitly addresses the problem of explainability in graph
generation itself. They are aimed to assess LLM’s outputs and reasoning without identifying the specific
data components contributing most to KG construction. Our work is devoted to exploration of this
issue. Moreover, it is designed to handle unstructured user data and introduces a more controllable
graph generation method through structured prompt engineering.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Method</title>
      <p>The AGGILE is a Python-based tool designed to generate knowledge graphs from unstructured data for
the purposes of XAI. The graphs are generated from plain text using LLMs.</p>
      <p>The tool generate triplets, which is a set of 2 nodes and 1 edge denoting a relation between them.
Each triplet has the following form: subject-predicate-object, where subject and object are nodes, and
predicate is an edge.</p>
      <p>The tool is based on prompt-tuning methods, prompts are used to guide LLMs in identifying key
lexical entities to form the graph. The AGGILE Python class consists of methods for extracting entities,
identifying relations between them and forming triplets, as well as constructing and visualizing graph
in HTML-format.</p>
      <sec id="sec-3-1">
        <title>3.1. Algorithm</title>
        <sec id="sec-3-1-1">
          <title>The AGGILE Python class is built around three core functionalities:</title>
          <p>• Entity extraction: identifying key concepts, named entities, and keywords from the input text
• Relation extraction: determining relationships between extracted entities
• Graph construction: visualizing the extracted entities and relationships as a knowledge graph
First, the tool extracts N keywords, named entities or produces semantic concepts consisting of
one word or a phrase based on the provided text. N is the number of instances defined by user (10 by
default). The process is done through LLM prompt-tuning (see Appendix A "Subject extraction"). This
list is forms a list subject, and it will contain a list of nodes for the graph.</p>
          <p>Next, the tool extracts 5-10 related words for each primary node (subject) and produces a predicate
between them. Predicates define the relationship between subjects and objects as a verb or a phrase
describing it. The list of secondary nodes denoting related words forms the list of objects, and a list of
predicates form the edges of the graph. See Appendix A "Object extraction" and "Predicate generation".</p>
          <p>This way of generating graphs is more controllable and predictable due to the ordered prompt
structure. LLM inference is implemented through HuggingFace Hub’s InferenceClient, see the project
repository for more details.</p>
          <p>As a result, triplets are combined into a JSON object used to construct a graph. Visualization is made
in HTML-format using Plotly library. Nodes’ colour depends on their degree: the more relations has
the node, the higher weight is assigned to it. The weight defines the nodes’ degree.</p>
          <p>The AGGILE class also provides a method for implementing RAG based on the generated graphs.
However, this study focuses on the explainability potential of the developed tool.</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Model parameters</title>
        <sec id="sec-3-2-1">
          <title>The LLMs in AGGILE are set with the following parameters by default:</title>
          <p>• max_tokens = 1024 for subjects’ extraction,
• max_tokens = 512 for objects’ extraction and predicates’ generation,
• temperature = 0.5 in all cases,
• top_p = 0.1 in all cases.</p>
          <p>Either of three lists (subjects, objects, predicates) are generated as JSON objects. The resulting set of
prompt templates may be found in Appendix A.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Evaluation Setup</title>
      <p>
        The method was evaluated on several texts accessed through Wikipedia API. The experiments were
conducted using Deepseek-ai/DeepSeek-R1-Distill-Qwen-32B [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ]. The aim of the procedure was to
assess the generated graphs qualitatively according to the following criteria:
• noise in data,
• accuracy of data representation,
• hallucinations in comparison to source text,
• relationships and their relevancy,
• nodes representation (which words are used for this purpose),
• comprehensiveness,
• interpretability,
• scalability.
      </p>
    </sec>
    <sec id="sec-5">
      <title>5. Results and Discussion</title>
      <sec id="sec-5-1">
        <title>5.1. Qualitative Analysis</title>
        <p>The first graph was (see Fig. 2) constructed using the Wikipedia article Mathematics. Two dominants
are observed: Mathematics itself and Mathematical Logic. These nodes exhibit the highest number of
related nodes, thereby achieving the maximum degree score. All other nodes represent objects related
to them, although the source text contains more entities from other disciplines such as engineering,
medicine, natural sciences, etc. This fact suggests that the model labeled these concepts as the most
significant during the graph generation process.</p>
        <p>As for relations, mainly the triplet ’S is a branch of O’ is used, however, there are also some other
predicate types including studies, is a type of, includes, is related to, is a specialized field of , is a prerequisite
for, is a key component of, is a foundation of. Semantically, most of these relations represent meronymic
or holonymic structures (i.e., part–whole relationships), with the exception of studies, which reflects
agent-object relationships.</p>
        <p>Figure 3 illustrates the graph constructed from the Wikipedia article Pug. This graph demonstrates
greater granularity due to the structure of the source text, which contains not only a description of
the breed’s physical characteristics but also historical information regarding its origins. Following the
provided source, the graph is organized into two thematic clusters, connected by the most significant
node, Pug. The nodes above Pug represent the breed’s physical traits. Notably, the term Pekingese
appears within this cluster, despite the fact that there is no other direct relationship between pekingeses
and pugs apart from the fact that both ’are the breeds of dogs’, as presented in the graph. Most likely
the model included Pekingese because it has the similar appearance as Pug, according to Wikipedia
page.</p>
        <p>The ’historical’ cluster includes the Second Opium War, its events, and information about the pug’s
ancestor, the Happa or Hap-pah dog, as well as the role of pugs in the lives of Tibetan monks.</p>
        <p>The nodes are denoted with the key entities including the target Pug, its ancestors and Pekingese, the
Second Opium War, Chinese emperors, geographical places, monks and monasteries. An inaccuracy in
nodes extraction is observed: there is the node Pug as well as the node Pugs. Another cases include
Happah dog and its variations: Happa, Happa dog and Happa or Hap-pah dog; Lo-sze, Lo-Sze, Lo-Chiang-Sze;
Old Summer Palace, Old Summer Palace (Yuanmingyuan) and Yuanmingyuan. The model does not focus
on clustering diferent names of the same objects, probably because it is not queried in the prompt (see
Appendix A).</p>
        <p>Relations in the graph are represented in a variety of ways:
• using a verb: train, exhibits;
• using a verb with preposition or particle: is associated with, lived in, unrelated to;
• using a verb, a preposition and a noun: has no direct relationship with;
• using a noun and a preposition: ancestor of ;
• sometimes, the whitespace between words is replaced with an underscore: involved_participants,
has_short_coat.</p>
        <p>It is not clear at this moment how LLM decides between whitespace and underscore, or how it
determines whether to use a particle or preposition: unrelated VS. unrelated to. The grammatical
features of predicates depend on the subjects and objects (see ’has’ or ’have’). There are past and present
forms of verbs, passive constructions, the diference between singular and plural entities.</p>
        <p>The list of inaccuracies in generating predicates includes the following. Firstly, there is an instance
of predicate where the node is mentioned. The relation between monasteries and Pugs is expressed
as monasteries often have. This forms a triplet monasteries-monasteries often have-Pugs. Secondly, an
illogical relation is used — has no direct relationship with. On the one side, this may be considered as a
hallucination since the model is asked to extract related concepts. On the other side, the fact that a
subject and an object have nothing in common suggests that this is indeed the relationship between
them. Lastly, once incorrect information is given: Tibet is a type of royal dogs.</p>
        <p>It remains unclear why, despite the comparable length of the Wikipedia articles on Mathematics and
Pug, the former resulted in a smaller graph containing fewer concepts. The possible explanation is that
the article about Pug contains a broader range of topics, while Mathematics page is devoted only to
discipline and its elements. This interpretation is supported by the relations generated by LLM; as was
already mentioned, the majority of predicates in the Mathematics graph are expressed ’as a branch of’,
reflecting a more hierarchical, discipline-centered structure.</p>
        <p>Talking about scalability, the method has demonstrated adaptability to various topics, including
animals, history, and science, as concise graphs were generated for all of them. This fact proves that
our method is applicable to texts across diferent domains.</p>
        <p>Discussing the limitations of the method, the criteria by which the model selects entities for triplets
are not clear. In some cases, the subject and object coincide, or the hierarchical relationship between
them lacks clarity. Moreover, as previously mentioned, the model does not cluster the names of the
same object. Secondly, the actual version of the instrument requires three queries to LLM’s reasoning,
which increases computational time. Addressing these limitations will be a focus of our future research.</p>
      </sec>
      <sec id="sec-5-2">
        <title>5.2. User Interface</title>
        <p>A graphical user interface was built, using Plotly, Streamlit, and HuggingFace. It is shown on Figures 4
and 5.</p>
        <p>User is asked to provide a text into the window and press the Enter button. Then the text is processed
and HTML with the visualization is returned. Visualized graph may be zoomed. The color of nodes
represents their degree. This functionality was achieved with Plotly.</p>
        <p>Additionally, our app supports the function for graphRAG. An answer to user query is provided on
the basis of both provided source and generated triplets. However, it is not evaluated yet and is a next
step of our work.</p>
        <p>The app is hosted on HuggingFace Spaces and built with Streamlit.</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>6. Conclusion</title>
      <p>The paper presents a novel tool for RAG explainability, AGGILE. The model generates knowledge
graphs from unstructured data and visualizes the results using Plotly. The study describes primary
qualitative analysis based on linguistic criteria developed by the authors of the paper. The results of
qualitative evaluation show that the method is scalable, suggesting that AGGILE is a general-purpose
explainability instrument suitable for wide range of domains.</p>
      <p>We have proven that shifting from end-to-end graph generated to a more fine-grained procedure,
where the process of graph generation is split into separate stages (sequential node extraction and edge
generation) lead to improved controllability, enhanced transparency and decreased hallucination ratio.</p>
      <p>The proposed approach have notable advantages. The model demonstrate the ability to focus on key
concepts, define target domain, and filtering irrelevant entities, ensuring disambiguation (contextual
understanding) and the possibility of finding the root concepts from the point of view of the LLMs’
explainability.</p>
      <p>The approach can produce fine-grained graph structures, producing subgraphs, clusters, and complex
relations. The weighting technique introduced in the paper allows for using the AGGILE tool for
assessing concepts that gain more focus by the LLM during the processing.</p>
      <p>The model is capable of extracting diverse relations, including hierarchical (e.g. ’a branch of’),
associative (’is associated with’), and descriptive (’exhibits’) meanings. The method can be applied to a
wide range of topics, suggesting that the proposed tool is a general-purpose explainability instrument.</p>
      <p>The method has several limitations. For example, the model execution time is significant; the model
generates a graph structure for approximately 3 minutes, since it queries LLM 3 times to generate 2 sets
of nodes and 1 set of edges. In perspective, we plan to use vector storage for prompt-tuning to perform
all intermediate processes (generation of nodes and edges) directly through vectors, reducing the time
required for vectorization to optimize the model processing time.</p>
      <p>Also, the model struggles with recognizing word forms, synonyms, and variations of the same lexical
entity (e.g., ’Hap-pah dog’ and ’Happa dog’). The model might produce inconsistent redundant edges,
e.g. ’is a branch of’ or ’studies’ for the same semantic relation. This indicates that a study towards
improving the control over nodes and edges generation is required.</p>
      <p>Despite the decreasing amount of hallucinations in our graphs, some generated graphs still have
logical errors and hallucinations, especially in forming edges between the nodes. This can misrepresent
the source data.</p>
      <p>In some cases, the model tends to generate relation between one and the same entity, however, this
issue was fixed by a simple heuristics. We added a rule that ensures that 2 nodes in a triplet are always
diferent.</p>
      <p>The method allows for building representative graphs for with considerably long and
contextuallyrich texts. The produced graphs reflect both semantical and grammatical features of the input data, as
well as indicate, which parts of input data target the model output, contributing to XAI methodology.</p>
      <p>In perspective, we plan to develop methods for enhancing the AGGILE control over LLM outputs that
would result in reducing redundancies, filtering hallucination and improving the model consistency. A
possible solution is to define a standardized set of relations and semantic hierarchy in a form of rules
for prompt-tuning and response formatting through formal grammars and conditional text generation.</p>
      <p>Next, we plan to perform the model optimization through switching to intermediate vector
representations from text-based prompt-tuning in generating nodes and edges. This step should reduce the
model execution time and enhance user experience and the model scalability.</p>
      <p>Finally, we plan to develop a multilingual version of the AGGILE tool, and add such features as
generating tables with nodes and edges for improved explainability.</p>
    </sec>
    <sec id="sec-7">
      <title>Declaration on Generative AI</title>
      <p>During the preparation of this work, the authors used GPT-4 in order to: Grammar and spelling check.
After using these tool, the authors reviewed and edited the content as needed and take full responsibility
for the publication’s content.</p>
    </sec>
    <sec id="sec-8">
      <title>A. System Prompt Templates</title>
      <sec id="sec-8-1">
        <title>The AGGILE class is initialized with the following prompts: Subjects extraction:</title>
        <p>"""
extract {n} collocations describing key concepts,
keywords, named entities from the provided source
"""</p>
      </sec>
      <sec id="sec-8-2">
        <title>Objects extraction:</title>
        <p>"""
extract 5-10 most representative collocations
from the provided source that are related to the provided concept
"""</p>
      </sec>
      <sec id="sec-8-3">
        <title>Predicates generation:</title>
      </sec>
      <sec id="sec-8-4">
        <title>Graph-based question-answering (not tested):</title>
        <p>"""
answer the question using graph triplets and provided source
"""</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>L.</given-names>
            <surname>Ehrlinger</surname>
          </string-name>
          , W. Wöß,
          <article-title>Towards a definition of knowledge graphs</article-title>
          .,
          <source>SEMANTiCS</source>
          (Posters, Demos, SuCCESS)
          <volume>48</volume>
          (
          <year>2016</year>
          )
          <article-title>2</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P.</given-names>
            <surname>Lewis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Perez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Piktus</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Petroni</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Karpukhin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Goyal</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Küttler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lewis</surname>
          </string-name>
          , W. tau Yih, T. Rocktäschel,
          <string-name>
            <given-names>S.</given-names>
            <surname>Riedel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Kiela</surname>
          </string-name>
          ,
          <article-title>Retrieval-augmented generation for knowledge-intensive nlp tasks</article-title>
          ,
          <year>2021</year>
          . URL: https://arxiv.org/abs/
          <year>2005</year>
          .11401. arXiv:
          <year>2005</year>
          .11401.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Gao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Xiong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Gao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Jia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Pan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Bi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Dai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Sun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <article-title>Retrieval-augmented generation for large language models: A survey</article-title>
          ,
          <source>arXiv preprint arXiv:2312.10997 2</source>
          (
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>F.</given-names>
            <surname>Erxleben</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Günther</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Krötzsch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Mendez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Vrandečić</surname>
          </string-name>
          ,
          <article-title>Introducing wikidata to the linked data web</article-title>
          ,
          <source>in: The Semantic Web-ISWC 2014: 13th International Semantic Web Conference, Riva del Garda, Italy, October 19-23</source>
          ,
          <year>2014</year>
          .
          <source>Proceedings, Part I 13</source>
          , Springer,
          <year>2014</year>
          , pp.
          <fpage>50</fpage>
          -
          <lpage>65</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>C.</given-names>
            <surname>Bizer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Lehmann</surname>
          </string-name>
          , G. Kobilarov,
          <string-name>
            <given-names>S.</given-names>
            <surname>Auer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Becker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Cyganiak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Hellmann</surname>
          </string-name>
          ,
          <article-title>Dbpedia-a crystallization point for the web of data</article-title>
          ,
          <source>Journal of web semantics 7</source>
          (
          <year>2009</year>
          )
          <fpage>154</fpage>
          -
          <lpage>165</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>D.</given-names>
            <surname>Edge</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Trinh</surname>
          </string-name>
          , N. Cheng, J.
          <string-name>
            <surname>Bradley</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Chao</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Mody</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Truitt</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Metropolitansky</surname>
            ,
            <given-names>R. O.</given-names>
          </string-name>
          <string-name>
            <surname>Ness</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Larson</surname>
          </string-name>
          ,
          <article-title>From local to global: A graph rag approach to query-focused summarization</article-title>
          ,
          <year>2025</year>
          . URL: https://arxiv.org/abs/2404.16130. arXiv:
          <volume>2404</volume>
          .
          <fpage>16130</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <article-title>[7] GitHub - noworneverev/graphrag-api: GraphRAG Server - github</article-title>
          .com, https://github.com/ noworneverev/graphrag-api,
          <year>2024</year>
          . [Accessed 15-
          <fpage>03</fpage>
          -2025].
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>GitHub - GirishWangikar/GraphRAG-Visualization-</surname>
          </string-name>
          System - github.com, https://github.com/ GirishWangikar/GraphRAG-Visualization-System,
          <year>2024</year>
          . [Accessed 15-
          <fpage>03</fpage>
          -2025].
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Knowledge</given-names>
            <surname>Graph RAG Query Engine -</surname>
          </string-name>
          LlamaIndex - docs.llamaindex.
          <source>ai</source>
          , https://docs.llamaindex. ai/en/stable/examples/query_engine/knowledge_graph_rag_query_engine/, ???? [Accessed 15-
          <fpage>03</fpage>
          - 2025].
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>C.</given-names>
            <surname>Peng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Xia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Naseriparsa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Osborne</surname>
          </string-name>
          ,
          <article-title>Knowledge graphs: Opportunities and challenges, 2023</article-title>
          . URL: https://arxiv.org/abs/2303.13948. arXiv:
          <volume>2303</volume>
          .
          <fpage>13948</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>G. A.</given-names>
            <surname>Miller</surname>
          </string-name>
          ,
          <article-title>Wordnet: a lexical database for english</article-title>
          ,
          <source>Commun. ACM</source>
          <volume>38</volume>
          (
          <year>1995</year>
          )
          <fpage>39</fpage>
          -
          <lpage>41</lpage>
          . URL: https://doi.org/10.1145/219717.219748. doi:
          <volume>10</volume>
          .1145/219717.219748.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>M.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Miao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>Simple is efective: The roles of graphs and large language models in knowledgegraph-based retrieval-augmented generation</article-title>
          ,
          <source>in: The Thirteenth International Conference on Learning Representations</source>
          ,
          <year>2025</year>
          . URL: https://openreview.net/forum?id=
          <fpage>JvkuZZ04O7</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>X.</given-names>
            <surname>He</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Tian</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Sun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Chawla</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Laurent</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>LeCun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Bresson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Hooi</surname>
          </string-name>
          , Gretriever:
          <article-title>Retrieval-augmented generation for textual graph understanding and question answering</article-title>
          , in: A.
          <string-name>
            <surname>Globerson</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          <string-name>
            <surname>Mackey</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Belgrave</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Fan</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          <string-name>
            <surname>Paquet</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Tomczak</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          Zhang (Eds.),
          <source>Advances in Neural Information Processing Systems</source>
          , volume
          <volume>37</volume>
          ,
          <string-name>
            <surname>Curran</surname>
            <given-names>Associates</given-names>
          </string-name>
          , Inc.,
          <year>2024</year>
          , pp.
          <fpage>132876</fpage>
          -
          <lpage>132907</lpage>
          . URL: https://proceedings.neurips.cc/paper_files/paper/2024/file/ efaf1c9726648c8ba363a5c927440529-Paper-Conference.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <surname>M. M. Hussien</surname>
            ,
            <given-names>A. N.</given-names>
          </string-name>
          <string-name>
            <surname>Melo</surname>
            ,
            <given-names>A. L.</given-names>
          </string-name>
          <string-name>
            <surname>Ballardini</surname>
            ,
            <given-names>C. S.</given-names>
          </string-name>
          <string-name>
            <surname>Maldonado</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Izquierdo</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <article-title>Ángel Sotelo, Rag-based explainable prediction of road users behaviors for automated driving using knowledge graphs and large language models</article-title>
          ,
          <source>Expert Systems with Applications</source>
          <volume>265</volume>
          (
          <year>2025</year>
          )
          <article-title>125914</article-title>
          . URL: https://www.sciencedirect.com/science/article/pii/S0957417424027817. doi:https://doi.org/ 10.1016/j.eswa.
          <year>2024</year>
          .
          <volume>125914</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>L.</given-names>
            <surname>Costabello</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bernardi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Janik</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Creo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Pai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. L.</given-names>
            <surname>Van</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>McGrath</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>McCarthy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Tabacof</surname>
          </string-name>
          ,
          <source>AmpliGraph: a Library for Representation Learning on Knowledge Graphs</source>
          ,
          <year>2019</year>
          . URL: https: //doi.org/10.5281/zenodo.2595043. doi:
          <volume>10</volume>
          .5281/zenodo.2595043.
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>H.</given-names>
            <surname>Abu-Rasheed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Dornhöfer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Weber</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Kismihók</surname>
          </string-name>
          ,
          <string-name>
            <given-names>U.</given-names>
            <surname>Buchmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Fathi</surname>
          </string-name>
          ,
          <article-title>Building contextual knowledge graphs for personalized learning recommendations using text mining and semantic graph completion</article-title>
          ,
          <source>in: 2023 IEEE International Conference on Advanced Learning Technologies (ICALT)</source>
          , IEEE,
          <year>2023</year>
          , p.
          <fpage>36</fpage>
          -
          <lpage>40</lpage>
          . URL: http://dx.doi.org/10.1109/ICALT58122.
          <year>2023</year>
          .
          <volume>00016</volume>
          . doi:
          <volume>10</volume>
          . 1109/icalt58122.
          <year>2023</year>
          .
          <volume>00016</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>H.</given-names>
            <surname>Abu-Rasheed</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Weber</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Fathi</surname>
          </string-name>
          ,
          <article-title>Knowledge graphs as context sources for llm-based explanations of learning recommendations</article-title>
          ,
          <source>in: 2024 IEEE Global Engineering Education Conference (EDUCON)</source>
          , IEEE,
          <year>2024</year>
          , p.
          <fpage>1</fpage>
          -
          <lpage>5</lpage>
          . URL: http://dx.doi.org/10.1109/EDUCON60312.
          <year>2024</year>
          .
          <volume>10578654</volume>
          . doi:
          <volume>10</volume>
          .1109/educon60312.
          <year>2024</year>
          .
          <volume>10578654</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <surname>DeepSeek-AI</surname>
          </string-name>
          ,
          <article-title>Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning</article-title>
          ,
          <year>2025</year>
          . URL: https://arxiv.org/abs/2501.12948. arXiv:
          <volume>2501</volume>
          .
          <fpage>12948</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>