Assessing Graph Data Serialization and Context Selection for Knowledge-Augmented Question Answering with Large Language Models

Large language models (LLMs) can produce inaccurate answers even when relevant facts are supplied in the prompt. This study examines how graph data serialization, entity identifiers, and context selection affect factual question answering in knowledge-augmented prompting. Four synthetic knowledge graph datasets containing 6, 10, 14, and 20 people entities were constructed using the familiar FOAF ontology, which was expanded with custom properties. Eight separate serialization formats were evaluated: natural language, XML, JSON, and RDF/XML and their variants. These formats were combined with two separate LLMs: Llama-3.2-3B-Instruct and Qwen2.5-3B-Instruct. Data was supplied through system prompts without training or fine-tuning the models. Three experimental stages examined complete graph contexts, answers obtained using predefined SPARQL queries in AllegroGraph, and descriptions of individual entities. In total, 19,044 model responses were evaluated in the experiment. Results indicate a clear accuracy–complexity trade-off: replacing natural language with XML using full-name identifiers leads to an increase in accuracy, from 54.50% to 89.17% for Llama and from 72.33% to 82.67% for Qwen when considering the 10-person-entity dataset. The findings indicate that optimal LLM reasoning requires a balance between structural rigidity and readability; using explicit, human-readable identifiers instead of numeric abstractions improves context retention and minimizes errors. However, this approach demands caution, as it can lead to up to a 29.72% relative increase in token consumption compared with using natural language. Ultimately, improving LLM information recall requires a carefully calibrated balance between symbolic representation, semantic expressiveness, and knowledge scalability.

Authors

Institutions

Publication Details

Journal
Applied Sciences
Published
2026-10-07
DOI
https://doi.org/10.3390/app16199919
Primary Topic
Topic Modeling
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Assessing Graph Data Serialization and Context Selection for Knowledge-Augmented Question Answering with Large Language Models

Marko Horvat, Marko Delimar, Sven Leo Kupres
Applied Sciences
Topic Modeling
article

Assessing Graph Data Serialization and Context Selection for Knowledge-Augmented Question Answering with Large Language Models

Marko Horvat, Marko Delimar, Sven Leo Kupres
article en

Abstract

Large language models (LLMs) can produce inaccurate answers even when relevant facts are supplied in the prompt. This study examines how graph data serialization, entity identifiers, and context selection affect factual question answering in knowledge-augmented prompting. Four synthetic knowledge graph datasets containing 6, 10, 14, and 20 people entities were constructed using the familiar FOAF ontology, which was expanded with custom properties. Eight separate serialization formats were evaluated: natural language, XML, JSON, and RDF/XML and their variants. These formats were combined with two separate LLMs: Llama-3.2-3B-Instruct and Qwen2.5-3B-Instruct. Data was supplied through system prompts without training or fine-tuning the models. Three experimental stages examined complete graph contexts, answers obtained using predefined SPARQL queries in AllegroGraph, and descriptions of individual entities. In total, 19,044 model responses were evaluated in the experiment. Results indicate a clear accuracy–complexity trade-off: replacing natural language with XML using full-name identifiers leads to an increase in accuracy, from 54.50% to 89.17% for Llama and from 72.33% to 82.67% for Qwen when considering the 10-person-entity dataset. The findings indicate that optimal LLM reasoning requires a balance between structural rigidity and readability; using explicit, human-readable identifiers instead of numeric abstractions improves context retention and minimizes errors. However, this approach demands caution, as it can lead to up to a 29.72% relative increase in token consumption compared with using natural language. Ultimately, improving LLM information recall requires a carefully calibrated balance between symbolic representation, semantic expressiveness, and knowledge scalability.

Applied SciencesVol. 16(19)
University of Zagreb (HR), Faculty of Electrical Engineering and Computing in Zagreb (HR)
Openalex Percentile: Top 12%
Topic Modeling
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.