<!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>Using Ontologies for LLM Applications in Cultural Heritage</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Rocco Loffredo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Massimo De Santo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>DIIN, University of Salerno</institution>
          ,
          <addr-line>Via Giovanni Paolo II 132 84084 Fisciano</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Applying Large Language models (LLMs) offers the potential for transformative change in cultural heritage. This short paper is based on ongoing doctoral research. It examines innovative methodologies for enhancing the accessibility, comprehension, and preservation of cultural heritage by utilizing AI technologies such as LLM. This research aims to improve AI-generated responses' contextual precision and dependability by employing sophisticated knowledge representations, such as ontologies. The approach promises to overcome the challenges associated with data complexity and information retrieval, thereby creating new avenues for heritage documentation, education, and public engagement.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;large language model</kwd>
        <kwd>ontology</kwd>
        <kwd>cultural heritage</kwd>
        <kwd>retrieval augmented generation 1</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Cultural heritage represents a series of milestones of human civilization, serving as a collective
memory and identity. As technology advances, there is a growing need for innovative approaches to
preserving, understanding, and sharing those resources.</p>
      <p>Large Language Models (LLMs) and LLM enhancement offer a promising solution for addressing
these challenges. However, the practical application of LLMs in cultural heritage domains requires a
robust foundation of new external knowledge to specialize LLMs appropriately in that task. This is
why, the potential for hallucinations and the necessity for reliable, unbiased and error-free
knowledge resources represents a significant current challenge [1].</p>
      <p>Among the various techniques for LLM specialization, RAG (Retrieval-Augmented Generation)
method is proving particularly successful. It is based on associating the user's prompt with additional
documentation that the model can consult to provide a more precise and contextualized answer
within the given domain.</p>
      <p>This short paper describes our first steps in defining a methodology for enhancing LLMs for
cultural heritage applications using ontologies. Ontologies are formal representations of concepts
and their relationships, and they can play a central role in this context by being able to provide a
structured form of knowledge for LLMs to acquire more detailed information within a specific
domain.</p>
      <p>Section 2 presents an overview of existing research on the re-training of LLM, with particular
attention to its current applications in specific contexts. Section 3 outlines a proposed methodology
for enhancing LLM and discusses the competitive potential for its implementation. Section 4 provides
details of the proposed method. Finally, Section 5 offers conclusions and a discussion of future steps.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Works</title>
      <p>
        The scientific community has initiated to explore the applications of Large Language Models in
cultural heritage domains.
3rd Workshop on Artificial Intelligence for Cultural Heritage (AI4CH 2024, https://ai4ch.di.unito.it/), co-located with the 23nd
International Conference of the Italian Association for Artificial I
        <xref ref-type="bibr" rid="ref3">ntelligence (AIxIA 2024</xref>
        ). 26-28
        <xref ref-type="bibr" rid="ref3">November 2024</xref>
        , Bolzano, Italy
rloffredo@unisa.it (R. Loffredo); desanto@unisa.it (M. De Santo)
      </p>
      <p>© 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).</p>
      <p>The potential of well-known models such as ChatGPT to transform the visitor experience in
cultural settings is discussed in [2] and [3], while in [4], ChatGPT’s contribution to e-learning is
highlighted with a specific focus on the analysis and interpretation of lyrics and poems.
In particular, the utilization of enhanced LLM models through ontologies about cultural heritage
domains represents an area of promising research with considerable potential to become a big
challenge and one of the future directions of ontologies’ possibilities of use [5].</p>
    </sec>
    <sec id="sec-3">
      <title>3. Proposed Approach</title>
      <sec id="sec-3-1">
        <title>3.1. The Hallucinations Issue</title>
        <p>LLMs, such as GPT-4 or LLaMA 3, are potent tools capable of processing vast amounts of information
and generating responses across various topics. However, their generalist nature has some
significant drawbacks, which can lead to imprecise or incorrect answers and fabricated statements
in specific contexts. Those events in this field are known as “hallucinations,” they are pretty standard
if the LLM lacks sufficient information to provide accurate responses.</p>
        <p>One of the leading causes of hallucinations is the statistical nature of generating the next word
by evaluating the likelihood of different possible words based on the context provided by the
previous words. The model will always answer in this way, so hallucinations can happen.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Retrieval-Augmented Generation</title>
        <p>Enhancing LLMs with reliable external and new knowledge about well-defined new contexts is
essential to making them more focused, thereby mitigating hallucination risk. A promising technique
to achieve this is the use of the RAG (Retrieval-Augmented Generation) method [6] shown in Figure
1.</p>
        <p>This technique entails the utilization of a Retrieval Model in conjunction with the LLM. In
response to the user's query, the Retrieval Model identifies the documents within an external
knowledge base most closely aligned with the request through a semantic similarity calculation. In
this manner, the LLM will receive both the user's query, modified as necessary, and the documents
the model can reference to provide a more precise and coherent response within the specified
context. In this way, without changing the model's internal parameters, it is possible to obtain more
context-related, reliable, and up-to-date responses.</p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. LLMs Enhancement with Ontologies</title>
        <p>Unlike traditional documents, which are often unstructured, ontologies utilize explicit and
formalized relationships, such as subject-predicate-object triples, which clarify and formalize the
links between concepts. This approach is particularly advantageous for RAG, as it allows the retrieval
of relevant text fragments and structured knowledge that can be integrated with the model's
generative capabilities, thereby improving the precision and coherence of responses.</p>
        <p>Ontologies provide a formal structure for representing relationships between concepts, making it
easier to navigate a vast set of information. Compared to standard documents, ontologies offer an
organized and hierarchical view of knowledge based on semantic links between entities, facilitating
the retrieval of relevant information. In an RAG context, ontologies can serve as structured
knowledge bases upon which retrieval methods are applied, ensuring that retrieved information is
relevant and accurately connected.</p>
        <p>Enhancing LLM systems to comprehend the specifics of an artifact or a heritage site is possible.
This enables the provision of a highly accurate research experience for the end user, with the ability
to answer complex questions and provide detailed information very quickly.</p>
      </sec>
      <sec id="sec-3-4">
        <title>3.3.1. Possible Advantages</title>
        <p>In this way, LLMs can be employed to analyze substantial quantities of textual and visual data [4],
identifying patterns and anomalies that may indicate conservation issues or risks to cultural
property. Furthermore, they can facilitate the development of innovative heritage documentation
and enhancement tools, such as immersive virtual realities or augmented reality applications.
Moreover, the capacity of these models to process natural language makes it possible to make
cultural heritage information accessible to a broader audience, overcoming language barriers [7],
adapting the responses to the user’s specific context or knowledge level and simplifying the
consultation of complex databases [8].</p>
        <p>By leveraging ontologies, RAG can provide LLMs with a structured understanding of the domain,
enabling them to comprehend complex queries better, provide more accurate and relevant responses
to real-world facts and prevent the generation of hallucinations or misleading information [9].</p>
        <p>From a competitive standpoint, in contrast to conventional sources of cultural heritage that
employ disparate formats, LLMs can leverage ontologies to integrate and normalize diverse datasets,
facilitating a unified approach across multiple resources. This would enable more straightforward
and consistent general access to content.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Methodology</title>
      <p>The proposed methodology is designed to enhance the performance of LLM systems using
ontologydriven information retrieval techniques within the cultural heritage domain. The use of structured
representations of knowledge enables LLMs to gain a deeper understanding of the context of cultural
artefacts, historical events and their relationships.</p>
      <p>The approach illustrated in Figure 2 involves embedding ontologies, an approach that is being
documented in the literature [10], [11]. Embedding these ontologies into vector databases enables
LLMs to retrieve more relevant and accurate information in response to user queries.</p>
      <p>The system comprises three main parts: the Ontology Embedding, the Prompt Generation Model
and the Text Generation Model.</p>
      <sec id="sec-4-1">
        <title>4.1. Ontology Embedding</title>
        <p>The Ontology Embedding block is the sole component that does not require repetition during the
session between the user and the model. Its responsibility is to convert the input ontology into a
vectorized format that can be efficiently queried by the Prompt Generation Model.</p>
        <p>This process represents the most critical aspect of the entire framework, as it involves
transforming the ontology from an RDF format into a textual representation compatible with the
embedding process. The challenge is to ensure that this conversion does not compromise the
semantic relationships inherent in the ontology, which are fundamental to its structure and utility.</p>
        <p>In particular, the proposed approach involves converting the subject-predicate-object triples
within the RDF into a textual format, which is then loaded into a vector database using ChromaDB
[12]. ChromaDB is an open-source vector database and it plays a crucial role in this embedding and
retrieval process. It supports semantic search using algorithms based on cosine similarity. In this
approach, when a query is issued, ChromaDB retrieves the most relevant ontology triples by
computing the cosine similarity between the vector representation of the query and the
preembedded vectors of the ontology. This ensures that even if the exact wording of the query does not
match the text derived from the ontology, semantically similar triples will still be retrieved,
maintaining the integrity of the ontology's semantic structure during the process. With this
approach, semantic relationships are preserved during the conversion from RDF triples to a vector
database. The effectiveness of this process depends on the quality of the embedding model, as it must
capture the underlying meaning of the relationships within the ontology.</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Prompt Generation Model</title>
        <p>The Prompt Generation Model employs the RAG method and prompt engineering techniques [13]
to repurpose the user's query and obtain the most accurate answer from the LLM.</p>
        <p>Specifically, the Retrieval Model consults the vector database generated from the ontology, and
prompt engineering techniques are used to propose a new prompt to the LLM based on the latest
relevant information obtained from the database.</p>
        <p>In particular, the new prompt could underline the audience to whom the LLM is chatting so it
could adapt to the desired knowledge level or set the temperature.</p>
      </sec>
      <sec id="sec-4-3">
        <title>4.3. Text Generation Model</title>
        <p>The Text Generation Model is the pre-trained LLM itself. When the query from the Prompt
Generation Model is obtained, it generates a response using its intrinsic capabilities and the new
information retrieved from the vectorial database.</p>
      </sec>
      <sec id="sec-4-4">
        <title>4.4. Preliminary Experimental Results</title>
        <p>To reinforce the effectiveness of this methodology, preliminary tests were conducted to verify that
the use of RDF triples instead of actual texts reduces the actual hallucination rate of LLM models. In
particular, six works of art at the University of Salerno were taken as case studies.</p>
        <p>Three questions were asked for each work to three different models:
•
•
•
“Who is the author of the work {work name} located at the University of Salerno?”
“When was the work {work name} located at the University of Salerno created or
inaugurated?”
“What are the materials used and the symbolic or conceptual meaning, if indicated, of the
work {work name} located at the University of Salerno?”</p>
        <p>The questions were asked in three different situations: in the first situation the models were not
given any additional material to consult, in the second situation a document with a description of all
the works of art was provided each time, in the third situation a text file was provided with RDF
triples inside indicating the same information as the previous text file.</p>
        <p>Precision, Recall and F1-Score of the responses were evaluated and compared. The results can be
seen in Figure 3.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusion</title>
      <p>Compared to traditional solutions, such as essential databases or non-semantic search engines, LLMs
enhanced with ontologies offer a more dynamic, intelligent, and accurate way to navigate and
interact with cultural heritage data. This enables institutions and businesses in this domain to
provide a richer, more informative, and user-friendly experience, driving innovation in research,
education, tourism, and cultural industries.</p>
      <p>This proposed approach has considerable potential for enhancing the comprehension of cultural
artifacts and for addressing significant challenges, including reducing hallucinations and enhancing
the factual reliability of AI-generated outputs through the RAG method.</p>
      <p>Furthermore, there needs to be more literature on work related to the RAG approach using
ontologies devoted to cultural heritage. This makes the scope of this research exciting from the
standpoint of its potential for innovation and usefulness.</p>
      <p>The next phase of the project will entail continuous updating from the literature and the parallel
development of an efficient solution capable of efficient ontology embedding without sacrificing the
links that characterize these formal knowledge representations.
[12]
[13]</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <string-name>
            <surname>G. M. Currie</surname>
          </string-name>
          , “
          <article-title>Academic integrity and artificial intelligence: is ChatGPT hype, hero or heresy?</article-title>
          ,”
          <year>2023</year>
          . doi:
          <volume>10</volume>
          .1053/j.semnuclmed.
          <year>2023</year>
          .
          <volume>04</volume>
          .008.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <given-names>G.</given-names>
            <surname>Trichopoulos</surname>
          </string-name>
          , “
          <article-title>Large Language Models for Cultural Heritage</article-title>
          ,” in ACM International Conference Proceeding Series,
          <year>2023</year>
          . doi:
          <volume>10</volume>
          .1145/3609987.3610018.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <string-name>
            <given-names>N.</given-names>
            <surname>Constantinides</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Constantinides</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Koukopoulos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Fidas</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Belk</surname>
          </string-name>
          , “
          <article-title>CulturAI: Exploring Mixed Reality Art Exhibitions with Large Language Models for Personalized Immersive Experiences,”</article-title>
          <source>in UMAP 2024 - Adjunct Proceedings of the 32nd ACM Conference on User Modeling, Adaptation and Personalization</source>
          ,
          <year>2024</year>
          , pp.
          <fpage>102</fpage>
          -
          <lpage>105</lpage>
          . doi:
          <volume>10</volume>
          .1145/3631700.3664874.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <surname>Tsichrintzi</surname>
          </string-name>
          , “
          <article-title>ChatGPT in Artificial Intelligence-Empowered E-Learning for Cultural Heritage: The case of Lyrics and Poems,”</article-title>
          <source>in 14th International Conference on Information, Intelligence, Systems and Applications</source>
          ,
          <string-name>
            <surname>IISA</surname>
          </string-name>
          <year>2023</year>
          ,
          <year>2023</year>
          . doi:
          <volume>10</volume>
          .1109/IISA59645.
          <year>2023</year>
          .
          <volume>10345878</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <given-names>J.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Mashkova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Zhapa-Camacho</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Hoehndorf</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>He</surname>
          </string-name>
          ,
          <string-name>
            <surname>and I. Horrocks</surname>
          </string-name>
          , “
          <article-title>Ontology embedding: A survey of methods, applications</article-title>
          and resources,”
          <year>2024</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <given-names>Y.</given-names>
            <surname>Gao</surname>
          </string-name>
          et al.,
          <article-title>“Retrieval-Augmented Generation for large Language Models: A survey</article-title>
          ,”
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <article-title>“Breaking language barriers: The role of large language models in multilingual communication</article-title>
          ,”
          <source>International Research Journal of Modernization in Engineering Technology and Science</source>
          , Jun.
          <year>2024</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <surname>Oh</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          <string-name>
            <surname>Naumann</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Globerson</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          <string-name>
            <surname>Saenko</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Hardt</surname>
          </string-name>
          , and S. Levine, Eds., Curran Associates, Inc.,
          <year>2023</year>
          , pp.
          <fpage>42330</fpage>
          -
          <lpage>42357</lpage>
          . [Online]. Available: https://proceedings.neurips.cc/paper_files/paper/2023/file/83fc8fab1710363050bbd1d4b8cc00 21-
          <string-name>
            <surname>Paper-Datasets</surname>
            _and_Benchmarks.pdf
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          <string-name>
            <surname>Yuan</surname>
            , and
            <given-names>Z.</given-names>
          </string-name>
          <string-name>
            <surname>Zhang</surname>
          </string-name>
          , “
          <article-title>Enhancing LLM factual accuracy with RAG to counter hallucinations: A case study on domain-specific queries in private knowledge-bases</article-title>
          ,”
          <year>2024</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <string-name>
            <given-names>J.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Hu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Jimenez-Ruiz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O. M.</given-names>
            <surname>Holter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Antonyrajah</surname>
          </string-name>
          ,
          <string-name>
            <surname>and I. Horrocks</surname>
          </string-name>
          , “OWL2Vec*
          <article-title>: embedding of OWL ontologies,” Mach Learn</article-title>
          , vol.
          <volume>110</volume>
          , no.
          <issue>7</issue>
          ,
          <year>2021</year>
          , doi: 10.1007/s10994-021- 05997-6.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <surname>T. G. M. M. S. M. E. C.</surname>
          </string-name>
          <article-title>Darya Shlyk, “REAL: A Retrieval-Augmented Entity Linking Approach for Biomedical Concept Recognition,”</article-title>
          <source>Proceedings of the 23rd Workshop on Biomedical Natural Language Processing</source>
          , pp.
          <fpage>380</fpage>
          -
          <lpage>389</lpage>
          , Aug.
          <year>2024</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          “https://github.com/chroma-core/chroma.”
          <string-name>
            <given-names>O.</given-names>
            <surname>Fagbohun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. M.</given-names>
            <surname>Harrison</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Dereventsov</surname>
          </string-name>
          , “
          <article-title>An Empirical Categorization of Prompting Techniques for Large Language Models: A Practitioner's Guide,”</article-title>
          <source>Journal of Artificial Intelligence, Machine Learning and Data Science</source>
          , vol.
          <volume>1</volume>
          , no.
          <issue>4</issue>
          ,
          <year>2023</year>
          , doi: 10.51219/jaimld/oluwole-fagbohun/15.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>