OA-RAG:基于本体的智能体式检索增强生成,用于忠实的大语言模型推理

arXiv cs.AI 论文

摘要

OA-RAG 是一种智能体框架,将基于形式化本体的推理与大语言模型(LLM)推理相结合,以提高检索增强生成的忠实性,报告依据级别(逻辑蕴含、有支持、相关、不相关),并在基于大规模本体构建的医学问答基准上取得领先表现。

arXiv:2610.36335v1 Announce Type: new Abstract: Large language models (LLMs) perform well across many real-world tasks but remain prone to hallucination, limiting their reliability in domains such as biomedicine and healthcare, where answers must be grounded in established knowledge. Retrieval-augmented generation (RAG) mitigates this problem by incorporating external information, but often overlooks logical relationships and relies heavily on the LLM's own reasoning, which can compromise answer faithfulness. We propose OA-RAG, an agent that integrates formal reasoning with LLM reasoning, drawing on both the logical structure and informal annotations of domain ontologies. For each answer, OA-RAG reports the ontology observations used as evidence and a model-assessed grounding level (entailed, supported, related, or unrelated) that characterises the strength of that evidence. Across benchmarks derived from three large-scale ontologies and six real-world medical question-answering tasks, OA-RAG achieves the best overall performance among the evaluated ontology-fine-tuned and popular RAG methods, with particularly strong results on reasoning-intensive tasks. The reported grounding levels also offer a useful indication of answer reliability, with stronger grounding generally associated with higher accuracy. Finally, our results demonstrate the value of ontologies as knowledge sources: OA-RAG is competitive with, and sometimes outperforms, domain-specific RAG systems that draw on sources such as textbooks.
查看原文
查看缓存全文

缓存时间: 2026/10/28 07:38

# OA-RAG: Ontology-based Agentic RAG for Faithful LLM Reasoning
Source: [https://arxiv.org/html/2610.36335](https://arxiv.org/html/2610.36335)
Hui Yang[https://orcid.org/0000-0002-4262-4001](https://orcid.org/0000-0002-4262-4001)Affiliation:The University of Manchester,Manchester,United Kingdomemail:[hui\.yang\-2@manchester\.ac\.uk](mailto:[email protected])Jiaoyan Chen[https://orcid.org/0000-0003-4643-6750](https://orcid.org/0000-0003-4643-6750)Affiliation:The University of Manchester,Manchester,United Kingdomemail:[jiaoyan\.chen@manchester\.ac\.uk](mailto:[email protected])andYongsheng Gao[https://orcid.org/0000-0002-3468-2930](https://orcid.org/0000-0002-3468-2930)Affiliation:SNOMED International,London,United Kingdomemail:[yga@snomed\.org](mailto:[email protected])

© none

###### Abstract\.

Large language models \(LLMs\) perform well across many real\-world tasks but remain prone to hallucination, limiting their reliability in domains such as biomedicine and healthcare, where answers must be grounded in established knowledge\. Retrieval\-augmented generation \(RAG\) mitigates this problem by incorporating external information, but often overlooks logical relationships and relies heavily on the LLM’s own reasoning, which can compromise answer faithfulness\. We propose OA\-RAG, an agentic framework that integrates formal reasoning with LLM reasoning, drawing on both the logical structure and informal annotations of domain ontologies\. For each answer, OA\-RAG reports the ontology observations used as evidence and a grounding level \(*entailed*,*supported*,*related*, or*unrelated*\) that characterises the evidence’s faithfulness\. Across benchmarks derived from three large\-scale ontologies and six real\-world medical question\-answering tasks, OA\-RAG achieves the best overall performance among the evaluated ontology\-fine\-tuned and popular RAG methods, with particularly strong results on reasoning\-intensive tasks\. The reported grounding levels also offer a useful indication of answer reliability, with stronger grounding generally associated with higher accuracy\. Finally, our results demonstrate the value of ontologies as knowledge sources: OA\-RAG is competitive with, and sometimes outperforms, domain\-specific RAG systems that draw on sources such as textbooks\.

## 1\.Introduction

INPUT / EVIDENCEQUERY\(Natural Language\)WEBONTOLOGYFormal AxiomsA⊑BA\\sqsubseteq BA⊑∃r\.BA\\sqsubseteq\\exists r\.BInformalAnnotations• Definitions• Comments• Synonyms\(a\)Formal ReasoningAxiomsA⊑BA\\sqsubseteq BA⊑∃r\.BA\\sqsubseteq\\exists r\.BExactAnswerFormal AxiomsFormal Reasoner\(b\)Ontology\-Grounded LLM Reasoning AxiomsA⊑BA\\sqsubseteq BA⊑∃r\.BA\\sqsubseteq\\exists r\.B\+LLMOntology\-GroundedAnswerFormalAxiomsInformalAnnotationsLLMReasoning\(c\)Ontology\-Assisted LLM Reasoning\+LLMLLMOntology\-AssistedAnswerOntologyEvidenceLLM ParametricKnowledgeLLMReasoning

Figure 1\.Three ontology\-augmented LLM reasoning patterns, ordered from greatest to least faithfulness to the ontology: \(a\) the answer is can be inferred from the ontology’s formal axioms; \(b\) an LLM can infer the answer based on the ontology’s formal axioms and informal annotations; and \(c\) an LLM generates the answer freely, with optional grounding in relevant ontology content \(classic RAG\)\.Large language models \(LLMs\) have demonstrated strong capabilities across a wide range of knowledge\-intensive tasks\. However, their answers remain constrained by the knowledge encoded in their parameters and may contain hallucinations, that is, plausible but factually incorrect statements\([Ji et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib21);[Huang et al\., 2025](https://arxiv.org/html/2610.36335#bib.bib20)\)\. Their reliability is further limited by the lack of transparent reasoning and by gaps in domain\- or organization\-specific knowledge\.

Retrieval\-augmented generation \(RAG\) augments LLMs by prompting with external evidence extracted from documents\([Gao et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib10)\), tables\([Wang et al\., 2024](https://arxiv.org/html/2610.36335#bib.bib53)\), and knowledge graphs\([Luo et al\., 2024b](https://arxiv.org/html/2610.36335#bib.bib32)\), while tool\-using agents enable more adaptive, dynamic and autonomous access to such sources\([Yao et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib61);[Schick et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib45);[Sun et al\., 2024](https://arxiv.org/html/2610.36335#bib.bib50);[Ma et al\., 2025](https://arxiv.org/html/2610.36335#bib.bib33)\)\. However, existing methods mainly leverage textual and structured knowledge, leaving explicit logical knowledge under\-utilised\. Consequently, logical inference still relies heavily on the LLM’s internal reasoning, which can make its conclusions less faithful to the given knowledge\.

Meanwhile, many scientific and biomedical domains already provide rich shared, explicit and formal knowledge through ontologies in Semantic Web standards like Description Logic underpinned OWL \(Web Ontology Language\)\([Horrocks, 2008](https://arxiv.org/html/2610.36335#bib.bib19);[Smith et al\., 2007](https://arxiv.org/html/2610.36335#bib.bib47)\)\. These ontologies on the Web, such as the Gene Ontology \(GO\)\([Ashburner et al\., 2000](https://arxiv.org/html/2610.36335#bib.bib2)\), FoodOn\([Dooley et al\., 2018](https://arxiv.org/html/2610.36335#bib.bib9)\), and SNOMED CT\([Donnelly, 2006](https://arxiv.org/html/2610.36335#bib.bib8)\), encode domain concepts and relations using Description Logic axioms, allowing dedicated reasoners to derive implicit relations soundly and efficiently\([Baader et al\., 2017b](https://arxiv.org/html/2610.36335#bib.bib4)\)\. Moreover, ontologies can contain rich textual annotations, including definitions and comments, providing informal but relatively important and complementary domain knowledge\. This combination of formal semantics and textual annotations motivates our central question:

Can ontologies bridge formal reasoning and LLM reasoning to produce more faithful answers to domain\-specific questions?

According to the knowledge used, answering domain\-specific questions utilisng LLM and ontology may include the following three reasoning patterns, as illustrated in Figure[1](https://arxiv.org/html/2610.36335#S1.F1):

- •*Formal reasoning*: the answer is faithful to the ontology’s formal axioms and can be derived by a symbolic ontology reasoner\.
- •*Ontology\-grounded LLM reasoning*: the answer is faithful to the ontology’s formal axioms and informal annotations \(e\.g\., natural language labels and definitions\), and requires an LLM for inference based on these ontology’s information\.
- •*Ontology\-assisted LLM reasoning*: the answer is not faithful to the ontology, and the LLM reasoning relies on the LLM’s parametric knowledge as well\.

Importantly, the appropriate reasoning pattern is not known in advance and may vary across questions, requiring the system to adaptively select among the three reasoning strategies\.

To address this question, we propose OA\-RAG, an agentic framework that combines ontology reasoning with LLM reasoning in three stages \(§[4](https://arxiv.org/html/2610.36335#S4)\): \(1\) pre\-tool reasoning using the LLM’s parametric knowledge; \(2\) ReAct\-based querying, where logical inference results and textual annotations are accessed via SPARQL; and \(3\) answer generation, which consolidates the evidence, and reports the ontology evidence supporting the answer with a grounding level \(§[4\.1\.3](https://arxiv.org/html/2610.36335#S4.SS1.SSS3.Px2)\)\. Rather than treating the retrieved evidence as equally informative, the four levels distinguish evidence that logically entails the answer \(*entailed*\), supports the answer without strictly entailing it \(*supported*\), is merely relevant \(*related*\) to the answer, or is irrelevant \(*unrelated*\) to the answer\. This reflects the answer’s faithfulness to the ontology, where entailed, supported and related correspond to formal reasoning, ontology\-grounded LLM reasoning and ontology\-assisted LLM reasoning in Figure[1](https://arxiv.org/html/2610.36335#S1.F1), respectively\.

We developed an automatic procedure for constructing evaluation datasets for the first two patterns—formal reasoning and ontology\-grounded LLM reasoning—using three large\-scale, real\-world ontologies: GO, FoodOn, and SNOMED CT\. For the third pattern, we evaluated OA\-RAG on six real\-world medical question\-answering tasks following the experimental setup of OntoTune\([Liu et al\., 2025a](https://arxiv.org/html/2610.36335#bib.bib30)\)\.

Our main contributions are as follows:

- •We propose trustful LLM reasoning based on ontology’s both formal and informal knowledge, and develop an ontology\-based agentic RAG framework OA\-RAG, which answers a domain\-specific question with evidence and their grounding levels\.
- •We formulate ontology\-based faithful LLM reasoning in terms of three patterns with ranging faithfulness, and construct a QA benchmark with corresponding datasets for comprehensive evaluation\.
- •OA\-RAG achieves strong performance across all three reasoning patterns\. On the first two patterns, it outperforms the strongest baseline by 10–15 percentage points on average \(44\.3% vs\. 28\.9% with Llama\-3\-8B\-Instruct; 59\.7% vs\. 49\.7% with Qwen3\.5\-9B\)\. On the third pattern, it remains competitive with specialized medical QA methods while using10×10\\timesfewer tokens than the strongest baseline with Qwen3\.5\-9B \(9\.7k vs\. 96\.7k per question\)\.

## 2\.Related Work

##### LLMs with external knowledge\.

Retrieval\-augmented generation \(RAG\) augments LLMs with external knowledge from diverse sources, including unstructured text\([Gao et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib10)\)and structured sources such as tables\([Wang et al\., 2024](https://arxiv.org/html/2610.36335#bib.bib53)\)and knowledge graphs\([Luo et al\., 2024b](https://arxiv.org/html/2610.36335#bib.bib32)\)\. Domain\-specific RAG has also received much attention, particularly in medicine\([Xiong et al\., 2024a](https://arxiv.org/html/2610.36335#bib.bib56);[Xiong et al\., 2024b](https://arxiv.org/html/2610.36335#bib.bib57);[Yang et al\., 2024](https://arxiv.org/html/2610.36335#bib.bib60);[Su et al\., 2025](https://arxiv.org/html/2610.36335#bib.bib49);[Wu et al\., 2025](https://arxiv.org/html/2610.36335#bib.bib55)\)\. More recently, growing interest has focused on RAG agents that iteratively retrieve information throughout the reasoning process\([Trivedi et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib51);[Jiang et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib22);[Xiong et al\., 2024b](https://arxiv.org/html/2610.36335#bib.bib57)\)\. For example, in knowledge\-base question answering\([Lan et al\., 2021](https://arxiv.org/html/2610.36335#bib.bib27)\), graph agents traverse knowledge graphs step by step\([Sun et al\., 2024](https://arxiv.org/html/2610.36335#bib.bib50);[Ma et al\., 2025](https://arxiv.org/html/2610.36335#bib.bib33)\), often following the reasoning\-and\-acting paradigm of tool\-using LLMs\([Yao et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib61);[Schick et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib45);[Qin et al\., 2025](https://arxiv.org/html/2610.36335#bib.bib40)\)\. However, these methods still rely primarily on LLMs to reason over retrieved knowledge and may therefore be less faithful and trustworthy than our approach, which additionally incorporates formal reasoning\.

##### LLMs as interfaces to formal reasoning\.

A prominent line of work combines LLMs with formal reasoning through neuro\-symbolic methods, which typically translate natural language into formal representations and delegate inference to symbolic engines\. Examples include executing structured queries over knowledge bases\([Li et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib28);[Luo et al\., 2024a](https://arxiv.org/html/2610.36335#bib.bib31)\)and translating problems into logical forms for external solvers\([Pan et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib38);[Olausson et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib36)\)\. Most existing methods, however, assume a fully symbolic problem representation, where either all premises are explicitly provided or the question is entirely expressible in the vocabulary of a knowledge base\. In contrast, we study a hybrid setting in which the relevant premises span formal axioms, informal annotations, and the LLM’s parametric knowledge, and a question cannot necessarily be resolved by formal reasoning alone\.

##### LLMs and ontologies\.

Language models have been studied for probing factual and ontological knowledge\([He et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib17);[Zhang et al\., 2026](https://arxiv.org/html/2610.36335#bib.bib62)\), learning ontology embeddings\([He et al\., 2024b](https://arxiv.org/html/2610.36335#bib.bib18);[Yang et al\., 2025](https://arxiv.org/html/2610.36335#bib.bib58)\), reasoning over incomplete ontologies\([Yang et al\., 2026](https://arxiv.org/html/2610.36335#bib.bib59)\), and supporting ontology matching and learning\([He et al\., 2022](https://arxiv.org/html/2610.36335#bib.bib15);[He et al\., 2024a](https://arxiv.org/html/2610.36335#bib.bib16);[Babaei Giglou et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib5)\)\. Retrieval\-based methods have also begun to exploit ontological structure: OG\-RAG\([Sharma et al\., 2025](https://arxiv.org/html/2610.36335#bib.bib46)\)and ORT\([Liu et al\., 2025b](https://arxiv.org/html/2610.36335#bib.bib29)\)use ontologies to structure or constrain information retrieved from documents and knowledge graphs, respectively\. OntoTune\([Liu et al\., 2025a](https://arxiv.org/html/2610.36335#bib.bib30)\)and TaxoLLaMA\([Moskvoretskii et al\., 2024](https://arxiv.org/html/2610.36335#bib.bib34)\)instead incorporate ontology knowledge into model parameters through fine\-tuning\. However, prior work has largely treated ontologies as sources of structured or textual knowledge, rather than as knowledge bases with both formal and informal knowledge as well as logical reasoning capabilities\. To the best of our knowledge, none of the existing works explicitly integrates ontology\-based logical reasoning with LLMs within an agentic framework\.

1\. Pre\-Tool Reasoning2\. ReAct with the Ontology Tool \(Iterative Loop\)3\. AnsweringQueryLLM reasoningInitial reasoning\(without theontology tool\)“Think step by step briefly toreason about the question…”ThoughtPlanning & Reasoning\(with the ontology tool\)“An ontology is availablethrough the tool below…”Action query\(SPARQL\)DESCRIBE “<name\>”SELECT ?x \{ … \}ASK \{ … \}SELECT ?o / ?r \{ … \}Query fallback for an empty SELECT ?xAnswer orlimit reached?NoYesLLM answeringfrom the cleanevidence digest\{\}OutputAnsweroption BEvidenceE1E2Grounding levelentailedsupportedrelatedunrelatedsupported ✓Step 1“The tool phase is over\. Using the question and the observations below, …”Step 2“Your answer above is final; do not change it\. Now state what it rests on …”OntologyServiceConcept CardsName LinkingFormal AxiomsOntology Reasoner

Figure 2\.Overall framework of OA\-RAG: \(1\) pre\-tool reasoning; \(2\) a ReAct loop of SPARQL queries to the ontology service \(name linking, reasoner, query fallback\); \(3\) answering from the evidence digest, with the cited evidence and a grounding level\.

## 3\.Preliminaries

An OWL ontology\([Horrocks, 2008](https://arxiv.org/html/2610.36335#bib.bib19)\)represents domain knowledge using concepts \(classes\), relations \(object properties\), and logical axioms, whose semantics can be characterised by Description Logics \(DLs\)\. For the lightweight DLℰ​ℒ\+\\mathcal\{EL\}^\{\+\}, with concept namesA∈𝖭𝖢A\\in\\mathsf\{N\_\{C\}\}and role namesr∈𝖭𝖱r\\in\\mathsf\{N\_\{R\}\}, concepts are built by

C::=⊤∣A∣​C⊓D\|∃r\.CC::=\\top\\mid A\\mid C\\sqcap D\\mid\\exists r\.Cand ontologies contain General Concept Inclusions \(GCIs\) contain General Concept Inclusions \(GCIs\)C⊑DC\\sqsubseteq D, equivalencesC≡DC\\equiv D, and role inclusionsr1∘⋯∘rn⊑rr\_\{1\}\\circ\\cdots\\circ r\_\{n\}\\sqsubseteq r\([Baader et al\., 2017a](https://arxiv.org/html/2610.36335#bib.bib3)\)\. We write𝒪⊧α\\mathcal\{O\}\\models\\alphawhen the axiomα\\alphacan be inferred from ontology𝒪\\mathcal\{O\}\. For example, givenGraduate⊑Student\\texttt\{Graduate\}\\sqsubseteq\\texttt\{Student\}andStudent⊑∃affiliatedWith\.Department\\texttt\{Student\}\\sqsubseteq\\exists\\texttt\{affiliatedWith\}\.\\texttt\{Department\}, we have

𝒪⊧Graduate⊑∃affiliatedWith\.Department\.\\mathcal\{O\}\\models\\texttt\{Graduate\}\\sqsubseteq\\exists\\texttt\{affiliatedWith\}\.\\texttt\{Department\}\.OWL ontologies may additionally contain*annotations*, such asrdfs:labelandrdfs:comment, which provide lexical and descriptive information, including alternative labels, definitions, and cross\-references\. Under OWL direct semantics, annotations do not affect DL entailments and are therefore ignored by DL reasoners\.

Given an OWL ontology, one can construct an RDF graph consisting of\(𝑠𝑢𝑏𝑗𝑒𝑐𝑡,𝑝𝑟𝑒𝑑𝑖𝑐𝑎𝑡𝑒,𝑜𝑏𝑗𝑒𝑐𝑡\)\(\\mathit\{subject\},\\mathit\{predicate\},\\mathit\{object\}\)triples and execute SPARQL 1\.1\([Harris and Seaborne, 2013](https://arxiv.org/html/2610.36335#bib.bib14)\)queries over the graph to retrieve answers matching specified graph patterns\. In particular, an axiom of the formA⊑∃r\.BA\\sqsubseteq\\exists r\.B, whether explicitly stated in the ontology or inferred by a DL reasoner, can be materialised as a class\-level triple\(A,r,B\)\(A,r,B\)\. Ontology annotations can likewise be represented as triples in the same graph\. SPARQL can then query both types of information using graph patterns with variables:SELECTreturns variable bindings,ASKtests whether a matching pattern exists, andDESCRIBEreturns an RDF description of selected resources\. These SPARQL query patterns form the basis of OA\-RAG\.

## 4\.OA\-RAG

We now present our main architecture, OA\-RAG, illustrated in Figure[2](https://arxiv.org/html/2610.36335#S2.F2)\. OA\-RAG consists of two main components\. The first is the core agentic framework, which follows a standard ReAct\([Yao et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib61)\)architecture to answer a given question through iterative reasoning and tool interaction \(§[4\.1](https://arxiv.org/html/2610.36335#S4.SS1)\)\. The second is the ontology service, which provides textual ontology representations and a backend that interfaces LLM\-generated queries with ontology reasoners \(§[4\.2](https://arxiv.org/html/2610.36335#S4.SS2)\)\.

### 4\.1\.Main ReAct Architecture

As illustrated in Figure[2](https://arxiv.org/html/2610.36335#S2.F2), OA\-RAG adopts a reasoning\-and\-acting architecture\([Yao et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib61)\)comprising three stages: \(1\) pre\-tool reasoning, \(2\) iterative reasoning and acting with access to the ontology, and \(3\) answer generation\. The full prompts are provided in Appendix[E](https://arxiv.org/html/2610.36335#A5)\.

#### 4\.1\.1\.Pre\-tool Reasoning

Before entering the main ReAct loop, OA\-RAG prompts the LLM to perform an initial analysis of the input context and question\. Given a pre\-tool reasoning prompt𝒫pre\\mathcal\{P\}\_\{\\mathrm\{pre\}\}and a questionqq, the modelℳ\\mathcal\{M\}produces an initial reasoning state

h0=ℳ⁡\(𝒫pre,q\)\.h\_\{0\}=\\mathcal\{M\}\(\\mathcal\{P\}\_\{\\mathrm\{pre\}\},q\)\.
The purpose of this stage is to encourage the LLM to reason first using only the information already available in the input context and, when that information is sufficient, to form a preliminary answer\. In the subsequent stage, the ontology is introduced as an additional source of structured knowledge\. The model can then use the ontology to retrieve information missing from the original context and to verify, refine, or revise the preliminary answer when one has been formed\.

#### 4\.1\.2\.ReAct Loop

Following the pre\-tool reasoning stage, OA\-RAG enters the main ReAct loop, in which the model can interact with an ontology tool to retrieve ontology information and invoke the corresponding reasoner\. The loop continues within the same conversation\. After producing the initial reasoning stateh0h\_\{0\}, the model receives an agent prompt𝒫agent\\mathcal\{P\}\_\{\\mathrm\{agent\}\}as a new user turn, which introduces the available tool and specifies when it should be used\.

At iterationtt, the model generates a single actionata\_\{t\}conditioned on the conversation history, including its previous actions and the corresponding observations returned by the ontology service \(§[4\.2](https://arxiv.org/html/2610.36335#S4.SS2)\)\. Formally,

at=ℳ⁡\(𝒫pre,q,h0,𝒫agent,\{\(aj,oj\)\}j<t\),ot=𝒮⁡\(at\),a\_\{t\}=\\mathcal\{M\}\\bigl\(\\mathcal\{P\}\_\{\\mathrm\{pre\}\},q,h\_\{0\},\\mathcal\{P\}\_\{\\mathrm\{agent\}\},\\\{\(a\_\{j\},o\_\{j\}\)\\\}\_\{j<t\}\\bigr\),\\qquad o\_\{t\}=\\mathcal\{S\}\(a\_\{t\}\),where𝒮\\mathcal\{S\}denotes the ontology service\. The resulting observationoto\_\{t\}is appended to the conversation and becomes part of the context for the next iteration\. This process repeats until the model produces a final answer or reaches the per\-item interaction budget\.

Agent Prompt𝒫agent\\mathcal\{P\}\_\{\\mathrm\{agent\}\}\(condensed\)An ontology is available through the tool below\. Continue from your answer above\. You can use tools of the formquery\(sparql\)to execute SPARQL queries over ontology concepts and relations, includingDESCRIBE,ASK, andSELECTqueries\.Use the ontology when the question concerns how its concepts are defined, classified, or related\. For questions that do not depend on the ontology, answer using your own knowledge\.

##### Action\.

In OA\-RAG, actions are expressed as SPARQL queries\([Harris and Seaborne, 2013](https://arxiv.org/html/2610.36335#bib.bib14)\)\. We support three types of queries:DESCRIBE, which retrieves detailed information about a concept;ASK, which checks whether a subsumption is entailed by the ontology reasoner; andSELECT, which retrieves concepts or relations satisfying specified conditions\. The three action types are defined as follows:

1. \(1\)DESCRIBE "A": Given a concept nameAA, this query returns the concept card ofAA\(§[4\.2\.1](https://arxiv.org/html/2610.36335#S4.SS2.SSS1)\): its names, definition, parents, children, stated relations, and other annotations\.
2. \(2\)ASK \{"A" "r" "B"\}: This query checks whether the subsumption𝒪⊧A⊑∃r\.B\\mathcal\{O\}\\models A\\sqsubseteq\\exists r\.Bholds\. By settingrrto"is a"or"subclass of", we can also check subsumptions of the form𝒪⊧A⊑B\\mathcal\{O\}\\models A\\sqsubseteq B\. The query returnsEntailedif the entailment is verified by the ontology reasoner andNot Entailedotherwise\. Importantly, under the open\-world assumption,Not Entaileddoes not imply that the corresponding subsumption is false, since the ontology may be incomplete\. We explicitly instruct the model about this distinction in the prompt\.
3. \(3\)SELECT ?x WHERE \{<conditions\>\}: This query retrieves concepts or relations that satisfy the specified conditions\. For example, a condition of the form\{?x "rr" "BB"\}returns concept namesAAsuch that𝒪⊧A⊑∃r\.B\\mathcal\{O\}\\models A\\sqsubseteq\\exists r\.B\. Similarly,\{"A" "r" ?x\}asks for conceptsBBsuch that𝒪⊧A⊑∃r\.B\\mathcal\{O\}\\models A\\sqsubseteq\\exists r\.B, while\{"A" ?x "B"\}returns relationsrrsuch that𝒪⊧A⊑∃r\.B\\mathcal\{O\}\\models A\\sqsubseteq\\exists r\.B\.

##### Query fallback\.

An exactSELECT ?xquery may return no results, particularly in ontology\-grounded LLM reasoning, where relevant information may appear only in informal annotations, which are inaccessible to the exact reasoner\. To handle such cases, we introduce a query fallback\. When aSELECT ?xquery yields no matching concept, we retrieve the top\-kkcandidate concepts by comparing the query against the concept cards \(§[4\.2\.1](https://arxiv.org/html/2610.36335#S4.SS2.SSS1)\) using BM25\([Robertson and Zaragoza, 2009](https://arxiv.org/html/2610.36335#bib.bib44)\)\. OA\-RAG can then examine these candidates, inspect their associated information viaDESCRIBE, and continue the ReAct loop\.

#### 4\.1\.3\.Answering

Finally, we introduce a dedicated answering step that constructs a clean context from the observations gathered during reasoning\. It proceeds in two steps \(Figure[2](https://arxiv.org/html/2610.36335#S2.F2), stage 3\)\.

##### Step 1: Answer\.

We discard observations produced by failed or uninformative tool calls, such as execution errors and queries that return empty results\. If the preceding ReAct loop has already produced a candidate answer, we retain it as a draft, denoted asy~\\tilde\{y\}\. LetEEdenote the observations retained after filtering \(the*evidence digest*\)\. The final answer is

y^=\{ℳ⁡\(𝒫fin,q,E,y~\)if​E≠∅,ℳ⁡\(𝒫own,q\)otherwise\.\\hat\{y\}=\\begin\{cases\}\\mathcal\{M\}\\bigl\(\\mathcal\{P\}\_\{\\mathrm\{fin\}\},q,E,\\tilde\{y\}\\bigr\)&\\text\{if \}E\\neq\\emptyset,\\\\ \\mathcal\{M\}\\bigl\(\\mathcal\{P\}\_\{\\mathrm\{own\}\},q\\bigr\)&\\text\{otherwise\.\}\\end\{cases\}We distinguish these two cases using separate prompts\. When informative observations remain after filtering \(E≠∅E\\neq\\emptyset\),𝒫fin\\mathcal\{P\}\_\{\\mathrm\{fin\}\}instructs the model to answer using the question, the retained observations, and the draft\. Otherwise,𝒫own\\mathcal\{P\}\_\{\\mathrm\{own\}\}asks the model to answer from its parametric knowledge\.

##### Step 2: Evidence and grounding level\.

When the observation setEEis non\-empty, we continue the Step 1 conversation with one more turn, the prompt𝒫att\\mathcal\{P\}\_\{\\mathrm\{att\}\}, to identify which observations its answer relies on and to assess the strength of their support:

\(C^,g^\)=ℳ⁡\(Step 1,𝒫att,E\),\(\\hat\{C\},\\hat\{g\}\)=\\mathcal\{M\}\\bigl\(\\textit\{Step 1\},\\mathcal\{P\}\_\{\\mathrm\{att\}\},E\\bigr\),whereC^⊆E\\hat\{C\}\\subseteq Edenotes the set of cited evidence andg^\\hat\{g\}denotes the grounding level\. We distinguish four grounding levels: \(1\)*entailed*, when the answer can be logically derived from the facts stated in the observations; \(2\)*supported*, when the answer can be reasonably inferred from the observations, possibly in combination with the LLM’s parametric knowledge, but does not follow as a strict logical consequence; \(3\)*related*, when the observations are relevant to the question but insufficient to determine the answer; and \(4\)*unrelated*, when the observations are irrelevant to the question and the answer\. Accordingly, we expect formal reasoning \(Figure[1](https://arxiv.org/html/2610.36335#S1.F1)\) to produce entailed answers; ontology\-grounded LLM reasoning, entailed or supported answers; and ontology\-assisted LLM reasoning, mostly related answers, although unrelated, supported, and entailed cases may also occur\. Although it does not provide a formal guarantee of answer correctness, the reported grounding level reflects the model’s assessment of the extent to which the available evidence supports the answer and the answer is faithful to the ontology\.

### 4\.2\.Ontology Service

#### 4\.2\.1\.Ontology Concept Cards

To make the ontology accessible to the agent through standard text\-based retrieval, we convert each concept into a*concept card*, as illustrated below\. Each card preserves the information in the ontology, with each item represented as a*key: value*line using the property’s original label\. The fields appear in a fixed order: the name, annotation definition, parents, children, stated relations, comments, and remaining annotations\. All values are preserved as stated in the ontology, with three exceptions\. The*parents*and*children*fields list the concept’s inferred direct parents and children, respectively111BBis a direct parent ofAAif𝒪⊧A⊑B\\mathcal\{O\}\\models A\\sqsubseteq Band there is no other conceptB′B^\{\\prime\}such that𝒪⊧A⊑B′⊑B\\mathcal\{O\}\\models A\\sqsubseteq B^\{\\prime\}\\sqsubseteq B\. Direct children are defined analogously\.\. The*stated relations*field lists each pair\(r,B\)\(r,B\)for which the ontology contains an axiom of the formA⊑∃r\.B⊓CA\\sqsubseteq\\exists r\.B\\sqcap CorA≡∃r\.B⊓CA\\equiv\\exists r\.B\\sqcap C, represented as “r \-\> B”\.

Concept card formitotic chromosome condensation\(GO\)mitotic chromosome condensationdefinition:The cell cycle process in which chromatin structure is compacted prior to and during mitosis in eukaryotic cells\. \{database\_cross\_reference: GOC:mah, …\}parents:chromosome condensation; mitotic cell cycle processchildren:mitotic chromosome arm condensation; …stated relations:part of \-\> mitotic cell cycle; …database\_cross\_reference:Reactome:R\-HSA\-2299718 \{rdfs:label: Condensation of Prophase Chromosomes\}; …has\_obo\_namespace:biological\_processid:GO:0007076

#### 4\.2\.2\.Name Linking

For a SPARQL query generated by OA\-RAG to be executable by the ontology service, every concept and relation name in the query must be linked to an ontology entity\. We first attempt exact matching; if this fails, we retrieve candidate entities for OA\-RAG to inspect and use for query repair\. The procedure is as follows:

- •Exact match\.We first normalise each name \(e\.g\., by standardising case, whitespace, and underscores\) and match it against every given alternative name\. If every name maps uniquely to an ontology entity, the query is executed directly\. If a name matches multiple entities, it is marked as ambiguous, and the candidate entities are returned for further disambiguation\. If a name cannot be matched to any ontology entity, we proceed to the fallback step\.
- •Unknown\-name fallback\.For each concept or relation name that cannot be matched exactly, we return the five closest ontology names as candidate replacements\. For concepts, we first retrieve a pool of 200 candidate names using BM25 and then rerank them by string similarity\([Ratcliff and Metzener, 1988](https://arxiv.org/html/2610.36335#bib.bib42)\)\. For relations, we match against the relation vocabulary directly\. Given these suggestions, OA\-RAG can revise the query using an appropriate ontology name or reformulate the query if none of the candidates is suitable\.

## 5\.Dataset Construction

We construct evaluation datasets for the two reasoning patterns in which the ontology serves as the primary source of knowledge:*formal reasoning*\(§[5\.1](https://arxiv.org/html/2610.36335#S5.SS1)\) and*ontology\-grounded LLM reasoning*\(§[5\.2](https://arxiv.org/html/2610.36335#S5.SS2)\)\. For ontology\-assisted LLM reasoning, we do not construct a new dataset; instead, we reuse existing domain question answering benchmarks following\([Liu et al\., 2025a](https://arxiv.org/html/2610.36335#bib.bib30)\), with details deferred to Section[6](https://arxiv.org/html/2610.36335#S6)\.

### 5\.1\.Formal Reasoning

In the formal reasoning setting, we focus on the case where the answer to a question can be computed directly by ontology reasoning\. Specifically, we consider two kinds of questions: \(1\) multiple\-choice questions \(MCQ\), where options are given and several of them may be correct; and \(2\) open questions \(OQ\), which give no options, so that the LLM has to find the answers in the ontology itself\.

#### 5\.1\.1\.MCQ Construction

Our central idea is to construct questions directly from valid ontological subsumption statements by masking one component of each statement and treating the masked component as the prediction target\. This process can be fully automated using an ontology reasoner\. Specifically, given an entailed axiom

𝒪⊧A⊑∃r\.B,\\mathcal\{O\}\\models A\\sqsubseteq\\exists r\.B,we construct a query by masking either a concept, namelyAAorBB, or the relationrr\. The masked symbol determines the reference answer, while additional concepts or relations are introduced as candidate options\.

First, we obtain the entailed axioms of the form𝒪⊧A⊑∃r\.B\\mathcal\{O\}\\models A\\sqsubseteq\\exists r\.Bby exhaustively applying the following decomposition rule:

A⊑C⊓∃r\.B→A⊑∃r\.B,A⊑CA\\sqsubseteq C\\sqcap\\exists r\.B\\;\\rightarrow\\;A\\sqsubseteq\\exists r\.B,\\qquad A\\sqsubseteq Cto the asserted axioms in𝒪\\mathcal\{O\}\. Here,AAandBBdenote atomic concepts andCCdenotes an arbitrary, possibly complex,ℰ​ℒ\+\\mathcal\{EL\}^\{\+\}\-concept\. Then, we maskAA,rr, orBBto obtain questions\. For each generated question, we construct six candidate options as follows\.

- •When the masked answer is a concept, we randomly select 1–3 semantically valid concepts as correct options\. IfAAis masked, the correct options are sampled fromAAand its descendants; ifBBis masked, they are sampled fromBBand its ancestors\. To avoid selecting concepts that are overly general or overly specific, we restrict these candidates to those within a taxonomy distance of at most two fromAAorBB, respectively\. The remaining options are sampled from sibling concepts ofAAorBB, with randomly sampled concepts used when there are insufficient siblings\.
- •When the masked answer is a relation, the original relation is used as the correct option, and five distractors are sampled randomly from the other relations appearing in existential restrictions in the ontology\.

Finally, to ensure the correctness of the constructed query–answer pairs, we verify each candidate option with an ontology reasoner and replace any incorrectly labeled option\.

Example 1:A generated multiple\-choice item \(GO, filler masked\)Source axiom\.*mesoderm formation*⊑⁣∃\\sqsubseteq\\exists\\,*part of*\.\\,*mesoderm morphogenesis*\.
Question\.Which concept completes this statement about “mesoderm formation”: is part of \[?\]? Select the option or options that this ontology supports, and no option that is merely plausible\.
Options\.
Amesoderm morphogenesisBtissue morphogenesisCmorphogenesis of an epitheliumDcartilage morphogenesisEfibrous ring of heart morphogenesisFmuscle tissue morphogenesis
Gold\.AandB: the asserted filler and its parent*tissue morphogenesis*
#### 5\.1\.2\.OQ Construction

We construct an OQQQby specifyingn≥2n\\geq 2conditions and asking for concepts that satisfy all of them\. We restrict the search to the taxonomy branch rooted at a designated general conceptA0A\_\{0\}, that is, to conceptsAAsuch that𝒪⊧A⊑A0\\mathcal\{O\}\\models A\\sqsubseteq A\_\{0\}\.222For example,A0A\_\{0\}is*biological process*in GO,*food product*in FoodOn, and*Clinical finding*in SNOMED CT\.An answer must additionally satisfy the relation restrictions∃ri\.Bi\\exists r\_\{i\}\.B\_\{i\}, fori=1,…,ni=1,\\ldots,n\. Thus,AAis an answer toQQif

𝒪⊧A⊑A0⊓∃r1\.B1⊓⋯⊓∃rn\.Bn\.\\mathcal\{O\}\\models A\\sqsubseteq A\_\{0\}\\sqcap\\exists r\_\{1\}\.B\_\{1\}\\sqcap\\cdots\\sqcap\\exists r\_\{n\}\.B\_\{n\}\.
We generate OQs by first selecting a conceptAAin the target branch and then constructing query conditions thatAAis known to satisfy\. Specifically, for each conceptAAsuch that𝒪⊧A⊑A0\\mathcal\{O\}\\models A\\sqsubseteq A\_\{0\}, we first collect relation restrictions known to hold forAA, and then samplennmutually non\-subsuming restrictions as the query conditions\. Since all selected conditions hold forAA, the resulting OQ is guaranteed to have at least one answer\. Appendix[C](https://arxiv.org/html/2610.36335#A3)gives the details\.

Table 1\.Overall accuracy \(%\)\. Average: mean across the three tests after within\-test averaging\.†: from OntoTune\([Liu et al\., 2025a](https://arxiv.org/html/2610.36335#bib.bib30)\)\. \(262k\): full 262k\-token context\.Red/blue: best / second best\.MethodTest 2\(ontology\-grounded\)Test 3\(ontology\-assisted\)AverageontdocMCQOQMCQOQPubMedQAMedQAMedMCQAUSMLE 1USMLE 2USMLE 3Base LLMsLlama\-3\-8B\-Instruct––45\.17\.845\.48\.170\.3†51\.7†51\.7†57\.4†52\.3†58\.2†36\.7Qwen3\.5\-9B––56\.48\.356\.78\.672\.278\.368\.186\.282\.689\.348\.2Ontology Fine\-Tuned LLMs \(Backbone: Llama\-3\-8B\-Instruct\)OntoTune\-sft––44\.411\.244\.711\.572\.0†51\.5†56\.7†57\.4†54\.1†60\.7†38\.2OntoTune\-dpo––46\.46\.546\.86\.765\.5†53\.3†57\.2†58\.5†51\.4†59\.0†36\.9OntoTune\-sft\+\+dpo––45\.69\.845\.910\.166\.3†51\.9†56\.7†53\.2†54\.1†63\.1†37\.8TaxoLLaMA∗––––––73\.4†50\.5†46\.1†42\.6†39\.4†47\.5†–Prompting and RAG Methods \(Backbone: Llama\-3\-8B\-Instruct\)CoT––38\.23\.038\.53\.167\.755\.655\.364\.964\.264\.834\.5RAGont\{\}\_\{\\texttt\{ont\}\}\(text\)✓–50\.93\.053\.44\.665\.551\.751\.856\.456\.957\.437\.5RAGont\{\}\_\{\\texttt\{ont\}\}\(query\)✓–45\.310\.042\.62\.464\.855\.654\.562\.857\.863\.936\.7RAGdoc\{\}\_\{\\texttt\{doc\}\}\(text\)–✓43\.02\.843\.32\.961\.654\.055\.556\.455\.055\.734\.1MedRAGdoc\{\}\_\{\\texttt\{doc\}\}–✓40\.05\.740\.35\.877\.055\.155\.764\.955\.059\.035\.7ReActont\{\}\_\{\\texttt\{ont\}\}✓–45\.09\.848\.112\.567\.654\.853\.363\.851\.463\.938\.9i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}–✓38\.70\.538\.80\.566\.061\.656\.278\.764\.261\.534\.6OA\-RAG✓–62\.045\.052\.218\.071\.657\.657\.466\.056\.967\.250\.5Prompting and RAG Methods \(Backbone: Qwen3\.5\-9B\)CoT––61\.112\.761\.413\.076\.482\.469\.089\.487\.290\.252\.2RAGont\{\}\_\{\\texttt\{ont\}\}\(text\)✓–68\.718\.269\.120\.172\.684\.470\.491\.582\.689\.356\.6RAGont\{\}\_\{\\texttt\{ont\}\}\(query\)✓–68\.226\.256\.95\.875\.584\.871\.291\.588\.186\.953\.8RAGdoc\{\}\_\{\\texttt\{doc\}\}\(text\)–✓61\.05\.361\.35\.374\.582\.671\.591\.581\.784\.449\.1MedRAGdoc\{\}\_\{\\texttt\{doc\}\}–✓58\.90\.559\.20\.579\.381\.170\.594\.779\.882\.847\.0ReActont\{\}\_\{\\texttt\{ont\}\}✓–69\.231\.565\.332\.975\.484\.772\.191\.588\.186\.960\.9i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}–✓40\.10\.540\.40\.571\.269\.866\.473\.465\.154\.135\.8i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}\(262k\)–✓40\.91\.041\.21\.077\.288\.672\.994\.791\.786\.142\.4OA\-RAG✓–79\.962\.073\.723\.277\.086\.371\.794\.791\.787\.768\.1Example 2:A generated open question \(GO,n=2n=2\)Concept\.*negative regulation of receptor signaling pathway via STAT*
Question\.Find one or more biological processes in this ontology that satisfy all of these conditions: negatively regulates signaling; regulates cell surface receptor signaling pathway via STAT\.
Answer set\.*negative regulation of receptor signaling pathway via STAT*;*negative regulation of receptor signaling pathway via JAK\-STAT*;*negative regulation of tyrosine phosphorylation of STAT protein*\.

### 5\.2\.Ontology\-Grounded LLM Reasoning

Ontology\-grounded LLM reasoning targets questions that can be answered using information contained in the ontology but cannot be solved by an ontology reasoner alone\. In such cases, part of the information required to answer the question is not represented as formal axioms, but instead appears in other forms, such as annotations of natural language comments and definitions\. Answering these questions therefore requires combining textual evidence with the remaining logical structure of the ontology\.

To construct a dataset for this setting, we reuse the same questions, options, gold answer sets, answer schemas, and sample identifiers, while replacing the original ontology with a deterministically revised version, as described below\. The key idea is to move part of the information encoded in logical axioms into the concepts’ natural\-language definitions\. As a result, the revised ontology still contains sufficient information to answer the questions when both its textual and logical content are considered, while an ontology reasoner operating only on the remaining formal axioms can no longer recover all required information\.

The ontology is revised as follows\. For every asserted axiom with a named concept on the left\-hand side, we remove its existential restrictions from the logical layer\. Specifically,

A⋈D⊓⨅i=1m∃ri\.Ci​with⋈∈\{⊑,≡\},⟼A⊑D\.A\\bowtie D\\sqcap\\textstyle\\bigsqcap\_\{i=1\}^\{m\}\\exists r\_\{i\}\.C\_\{i\}\\text\{ with \}\\bowtie\\in\\\{\\sqsubseteq,\\equiv\\\},\\quad\\longmapsto\\quad A\\sqsubseteq D\.If no logical content remains, i\.e\.,D=⊤D=\\top, the revised axiom is removed entirely\. Each removed restriction∃ri\.Ci\\exists r\_\{i\}\.C\_\{i\}is then verbalised\([He et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib17)\)and appended to the annotation definition ofAA\(a definition is added ifAAhas none\)\. We further verify that each question from Section[5\.1](https://arxiv.org/html/2610.36335#S5.SS1)is answerable from the revised axioms combined with the informal annotations, but not from the axioms alone, and exclude 23 questions that fail these criteria \(detailed in Appendix[C](https://arxiv.org/html/2610.36335#A3)\)\.

## 6\.Evaluation

\(a\) Grounding level percentage \(%\)\(b\) Answer accuracy \(%\)entailedsupportedrelatedunrelatedentailedsupportedrelatedunrelated0255075100LlamaLlamaTest 1Test 2Test 3Test 1Test 2Test 361\.8\(m=1251\)24\.8\(m=117\)7\.7\(m=13\)0\.0\(m=1\)45\.3\(m=811\)29\.6\(m=402\)5\.4\(m=37\)50\.0\(m=2\)61\.3\(m=2843\)58\.2\(m=1408\)45\.5\(m=44\)52\.6\(m=19\)QwenQwenTest 1Test 2Test 3Test 1Test 2Test 383\.0\(m=1257\)34\.5\(m=116\)0\.0\(m=19\)33\.3\(m=3\)75\.1\(m=924\)40\.7\(m=209\)0\.0\(m=133\)0\.0\(m=23\)94\.9\(m=59\)82\.1\(m=2630\)54\.3\(m=35\)66\.4\(m=738\)Figure 3\.Grounding levels reported by OA\-RAG\. \(a\) Percentage of all questions at each level; note that a part of answers have no grounding levels\. \(b\) Answer accuracy within each grounding level;mmis the number of corresponding questions\.### 6\.1\.Experimental Setup

Benchmarks\.We apply the procedure of Section[5](https://arxiv.org/html/2610.36335#S5)to three widely used ontologies that differ in scale, terminology, and modeling conventions: GO\([Ashburner et al\., 2000](https://arxiv.org/html/2610.36335#bib.bib2)\), FoodOn\([Dooley et al\., 2018](https://arxiv.org/html/2610.36335#bib.bib9)\), and SNOMED CT\([Donnelly, 2006](https://arxiv.org/html/2610.36335#bib.bib8)\), and created 300 MCQs and 200 OQs per ontology \(see Appendix[C](https://arxiv.org/html/2610.36335#A3)for details\)\.Test 1\(formal reasoning\) asks these 1,500 questions against the source ontologies\.Test 2\(ontology\-grounded LLM reasoning\) ask 1,477 questions against the revised ontologies\.Test 3\(ontology\-assisted LLM reasoning\) follows OntoTune\([Liu et al\., 2025a](https://arxiv.org/html/2610.36335#bib.bib30)\): 6,781 single\-answer test questions from MedQA\([Jin et al\., 2021](https://arxiv.org/html/2610.36335#bib.bib23)\), USMLE Step 1/2/3\([Han et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib13)\), MedMCQA\([Pal et al\., 2022](https://arxiv.org/html/2610.36335#bib.bib37)\), and PubMedQA\([Jin et al\., 2019](https://arxiv.org/html/2610.36335#bib.bib24)\), with SNOMED CT as the underlying ontology\.

Baselines\.Besides the base LLMs, Llama\-3\-8B\-Instruct\([Grattafiori et al\., 2024](https://arxiv.org/html/2610.36335#bib.bib12)\)and Qwen3\.5\-9B\([Qwen Team, 2026](https://arxiv.org/html/2610.36335#bib.bib41)\)\(hereafter Llama and Qwen, respectively\), we evaluate the following two categories of baselines:

- •*Ontology fine\-tuned LLMs\.*We include the three released OntoTune variants \(sft, dpo, and sft\+dpo\) and TaxoLLaMA∗, OntoTune’s non\-public re\-implementation of TaxoLLaMA\([Moskvoretskii et al\., 2024](https://arxiv.org/html/2610.36335#bib.bib34)\); all four are fine\-tuned to integrate SNOMED CT knowledge into Llama, and the Test 3 results of the Llama\-based models \(marked with†\\dagger\) are quoted from OntoTune\.
- •*Prompting and retrieval methods\.*We consider standard chain\-of\-thought \(CoT\) prompting\([Wei et al\., 2022](https://arxiv.org/html/2610.36335#bib.bib54)\)and four retrieval\-augmented methods: RAG, ReAct\([Yao et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib61)\), MedRAG\([Xiong et al\., 2024a](https://arxiv.org/html/2610.36335#bib.bib56)\), and i\-MedRAG\([Xiong et al\., 2024b](https://arxiv.org/html/2610.36335#bib.bib57)\)\. We consider two retrieval sources:\(1\)ont, the ontology concept cards introduced in Section[4\.2\.1](https://arxiv.org/html/2610.36335#S4.SS2.SSS1), and\(2\)doc, comprising the medical textbooks\([Jin et al\., 2021](https://arxiv.org/html/2610.36335#bib.bib23)\)and StatPearls\([StatPearls Publishing, 2026](https://arxiv.org/html/2610.36335#bib.bib48)\)used by MedRAG and i\-MedRAG\. For RAG, we evaluate bothdocandontas retrieval sources with textual retrieval, RAGdoc\{\}\_\{\\texttt\{doc\}\}\(text\) and RAGont\{\}\_\{\\texttt\{ont\}\}\(text\), as well as a structured query variant, RAGont\{\}\_\{\\texttt\{ont\}\}\(query\), which replaces textual retrieval with a single SPARQL query as in OA\-RAG\. ReActont\{\}\_\{\\texttt\{ont\}\}usesont, while MedRAGdoc\{\}\_\{\\texttt\{doc\}\}and i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}usedoc\. In particular, i\-MedRAG can be viewed as a medically specialized variant of ReAct\. Implementation details are provided in Appendices[A](https://arxiv.org/html/2610.36335#A1)and[B](https://arxiv.org/html/2610.36335#A2)\.

For a fair comparison, we use an 8,192\-token context window for all methods, matching the maximum supported by Llama\. We also report i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}on Qwen with a 262k\-token window, as its performance degrades markedly under the shorter context\.

Metrics\.We report accuracy \(%\) of the all tested questions\. An MCQ question is correct if the predicted set of options exactly matches the gold set\. An OQ is correct if the response is non\-empty and entirely correct\.

### 6\.2\.Main Results

The overall results are shown in Table[1](https://arxiv.org/html/2610.36335#S5.T1)\. For methods that do not use the ontology, the Test 2 results are directly reused from Test 1\. The slight performance differences are due to the 23 excluded questions described in Section[5\.2](https://arxiv.org/html/2610.36335#S5.SS2)\.

OA\-RAG achieves the best average accuracy with both backbones \(50\.5% and 68\.1%\)\. OnTests 1 \(formal reasoning\)andTests 2 \(ontology\-grounded LLM reasoning\), OA\-RAG outperforms all baselines in every setting except two: the Test 2 MCQs with Llama \(RAGont\{\}\_\{\\texttt\{ont\}\}\(text\), 53\.4% vs\. 52\.2%\) and the Test 2 OQs with Qwen \(ReActont\{\}\_\{\\texttt\{ont\}\}, 32\.9% vs\. 23\.2%\)\. This is consistent with the fact that these tasks are constructed directly from ontologies and require reasoning over explicit ontological knowledge\. Notably, two of the ontology fine\-tuning methods, OntoTune\-sft and OntoTune\-sft\+\+dpo, slightly improve over their base model on the OQs \(e\.g\., from 7\.8% to 11\.2% on Test 1 for OntoTune\-sft\), indicating that ontology knowledge can be partially internalised through fine\-tuning\. In contrast, medical RAG methods such as MedRAGdoc\{\}\_\{\\texttt\{doc\}\}and i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}fall below the base model on the OQs with both backbones, and on the MCQs too, except for MedRAGdoc\{\}\_\{\\texttt\{doc\}\}with Qwen\. These results suggest that existing medical RAG methods may struggle when questions require explicit logical reasoning and to be answered with high faithfulness to the ontology rather than primarily retrieving relevant evidence\.

OnTest 3 \(ontology\-assisted LLM reasoning \), OA\-RAG remains competitive with the best\-performing baseline, i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}\. However, with Qwen, i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}\(262k\) requires a substantially larger retrieval and generation budget \(about4×4\\timesthe LLM calls and10×10\\timesthe tokens per question of OA\-RAG: 22 vs\. 5\.8 calls and 96\.7k vs\. 9\.7k tokens, counting the input and generated tokens of all LLM calls of a question\)\. Most of the difference lies in the retrieved text that the model reads, which is about66×66\\timeslarger for i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}, and i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}also generates about5×5\\timesas many tokens \(Appendix[A](https://arxiv.org/html/2610.36335#A1)\)\. Moreover, when restricted to the same 8,192\-token context window as OA\-RAG, its average Test 3 accuracy drops markedly to 66\.7%, compared with 84\.9% for OA\-RAG\. We further find that RAGont\{\}\_\{\\texttt\{ont\}\}\(text\) outperforms RAGdoc\{\}\_\{\\texttt\{doc\}\}\(text\) on Test 3 with both backbones, and outperforms MedRAGdoc\{\}\_\{\\texttt\{doc\}\}with Qwen\. These findings highlight the potential of ontologies as retrieval sources: compared with medical textbooks, ontologies provide more concise and structured knowledge, which may also benefit real\-world QA tasks in related domains\.

Beyond answer accuracy, OA\-RAG reports thegrounding levelof each answer \(§[4\.1\.3](https://arxiv.org/html/2610.36335#S4.SS1.SSS3.Px2)\)\.Figure[3](https://arxiv.org/html/2610.36335#S6.F3)ashows the distribution of grounding levels in the final outputs\. Because some answers lack grounding annotations \(e\.g\., when no evidence is available\), the percentages do not sum to 100%\. Entailed and supported answers dominate, accounting for 70\.0% of all questions for Llama and 53\.2% for Qwen, whereas unrelated answers are rare, comprising only 0\.2% for Llama and 7\.8% for Qwen\.Figure[3](https://arxiv.org/html/2610.36335#S6.F3)bshows that, among answers labeled*entailed*,*supported*, or*related*, stronger reported grounding is generally associated with higher accuracy\. For example, with Qwen on Test 3, 94\.9% of*entailed*and 82\.1% of*supported*answers are correct \(together accounting for 39\.7% of the questions\), compared with 72\.1% of the remaining answers\. The reported grounding level therefore provides a useful signal of answer reliability beyond the answer itself\. Note that*unrelated*answers are unsuitable for direct comparison, as they tend to arise from questions that are less closely aligned with the scope of the ontology\. For example, some may depend primarily on reading comprehension or calculation rather than ontology\-based reasoning, making their accuracy more reflective of the LLM’s general capabilities\.

### 6\.3\.Analysis

#### 6\.3\.1\.Evidence Retrieval and Selection

Gold evidence retrieved:completelypartlynot at allRetrieved evidence output:fullynot fullyLlamaMCQ64\.129\.631\.713\.355\.0OQ36\.88\.055\.299\.0QwenMCQ81\.314\.169\.618\.711\.7OQ47\.222\.530\.39\.324\.766\.0Test 1\(formal reasoning\)Test 2\(ontology\-grounded LLM reasoning\)Figure 4\.Ratio of questions whose gold evidence is retrieved and selected \(%\)\.Unlike the grounding level, the*gold evidence*can be traced directly from the ontology for Tests 1 and 2, allowing us to evaluate exactly whether the required evidence is retrieved and subsequently cited \(Figure[4](https://arxiv.org/html/2610.36335#S6.F4)\)\. The results suggest that retrieval, rather than reasoning over retrieved evidence, is the primary bottleneck\. MCQs achieve a substantially higher rate of fully retrieved gold evidence than OQs \(61\.7 vs\. 23\.6% over all items\), which is reasonable as the candidate answer options provide additional cues that constrain retrieval\. Moreover, once the relevant evidence is retrieved, it is usually among the observations cited for the answer \(95\.1–98\.4% of the MCQs and at least 77\.8% of the OQs\)\. Qwen also demonstrates a substantially stronger ability than Llama to retrieve useful evidence\. Nevertheless, both models perform poorly on Test 2 OQs\. This is expected because much of the relevant information in Test 2 is encoded in definitions and is therefore less directly accessible to the retrieval process\. The absence of candidate options in OQs further increases the difficulty of identifying the relevant evidence\.

#### 6\.3\.2\.Ablation Study

To analyse the contribution of each component, we report an ablation study in Table[2](https://arxiv.org/html/2610.36335#S6.T2)\. Across both backbones, adding the ReAct loop and the final answering step consistently improves over pre\-tool reasoning alone, with the largest gains on the first two test patterns \(59\.7 vs\. 36\.5% on Tests 1–2, with Qwen\)\. This highlights the importance of ontology\-grounded reasoning through SPARQL queries when the answer depends on structured ontology knowledge\. The finalanswering stepprovides a further consistent gain \(68\.1 vs\. 65\.2% on average, with Qwen\), showing that synthesizing the intermediate reasoning and retrieved evidence remains important even after tool use\. Thequery fallbackexhibits a more nuanced trade\-off\. While it improves overall performance \(68\.1 vs\. 67\.7% on average, with Qwen\), removing it can benefit some settings, such as Test 1 MCQs, likely because doing so avoids introducing less targeted retrieval when the structured ontology is already sufficient\.

#### 6\.3\.3\.Case Study

Table 2\.Ablation of OA\-RAG \(accuracy %\): each indented row changes one component;↓\\downarrow:drop of percentage points over the original OA\-RAG\.\(a\) The ontology names halothane as the causative agent MedQAQ:Five days after undergoing an emergency appendectomy under general inhalational anesthesia … she received a transfusion of 1 unit of packed red blood cells … Examination shows jaundice … Eosinophils 13% … A biopsy of the liver shows massive centrilobular necrosis\. Which of the following is the most likely underlying cause …?\(A\) Adverse effect of anesthetic\(B\) Gram negative bacteria in the bloodstream\(C\) Trauma to the bile duct\(D\) Acalculous inflammation of the gallbladder\(E\) Excessive lysis of red blood cellsPre\-tool:“… The hemolysis releases free hemoglobin, which is toxic to the liver …”⇒\\RightarrowE✗Tool phase\(call 4 of 4\):4\.DESCRIBE "Halothane hepatitis"→\\toHalothane hepatitis … parents: Drug\-induced hepatitis; Poisoning caused by halothane … stated relations: …; Causative agent \-\> Halothane; Finding site \-\> Liver structureAnswer:“… is diagnostic of Halothane hepatitis, which is an adverse effect of the anesthetic”⇒\\RightarrowA✓

\(b\) The ontology maps blind staggers to selenium MedMCQAQ:Poisoning by which of these elements causes blind staggers alkali disease in livestock?\(A\) Magnesium\(B\) Manganese\(C\) Selenium\(D\) MolybdenumPre\-tool:“… Molybdenum: Toxicity \(or high levels relative to sulfur/copper\) is the direct cause of the condition described as alkali disease leading to blind staggers”⇒\\RightarrowD✗Tool phase\(calls 1 and 3 of 3\):1\.DESCRIBE "blind staggers"→\\toSelenium poisoning … stated relations: Causative agent \-\> Selenium; skos:altLabel: Alkali disease; Blind staggers3\.ASK \{ "blind staggers" "Causative agent" "Selenium" \}→\\toevery Selenium poisoning is related by Causative agent to some Selenium: ENTAILEDAnswer:“… The provided observations explicitly link ‘Selenium poisoning’ with the alternative labels ‘Alkali disease’ and ‘Blind staggers’ and identify Selenium as the causative agent”⇒\\RightarrowC✓

Figure 5\.Two Test 3 trajectories of OA\-RAG \(Qwen\), with intermediate reasoning omitted for brevity\.Figure[5](https://arxiv.org/html/2610.36335#S6.F5)illustrates a common correction pattern: the model’s pre\-tool answer is plausible but based on a loose association, whereas the ontology provides an explicit relation that directly supports the correct option\. In case \(a\), the model attributes the liver injury to hemolysis after the transfusion, whereas the ontology describes*Halothane hepatitis*as a drug\-induced hepatitis whose causative agent is halothane, leading to A\. In case \(b\), the model associates*blind staggers*with molybdenum, while the ontology identifies it as an alternative name for*Selenium poisoning*and directly links the condition to selenium, leading to C\. These cases show that the tool phase is most useful when the ontology contains a direct, question\-relevant relation that can override an incorrect model association\.

## 7\.Conclusion

We presented OA\-RAG, which, to our knowledge, is the first agentic RAG framework that combines LLM reasoning with formal OWL ontology reasoning\. It can adaptively address three distinct reasoning patterns: formal reasoning, ontology\-grounded LLM reasoning, and ontology\-assisted LLM reasoning\. Experiments across all three patterns with QA over three large\-scale real\-world ontologies demonstrate its strong and consistent performance\. They also show that ontologies provide an effective and efficient knowledge resource, with competitive performance but substantially fewer input and generated tokens in comparison with textual resources\.

For future work, we plan to extend OA\-RAG toward agentic web that coordinates knowledge across multiple ontologies, supporting more complex questions that require reasoning across domains\.

## References

- Ashburner et al\.\(2000\)Michael Ashburner, Catherine A\. Ball, Judith A\. Blake, David Botstein, Heather Butler, J\. Michael Cherry, et al\.2000\.Gene Ontology: Tool for the Unification of Biology\.*Nature Genetics*25, 1 \(2000\), 25–29\.[doi:10\.1038/75556](https://doi.org/10.1038/75556)
- Baader et al\.\(2017a\)Franz Baader, Ian Horrocks, Carsten Lutz, and Ulrike Sattler\. 2017a\.*An Introduction to Description Logic*\.Cambridge University Press\.
- Baader et al\.\(2017b\)Franz Baader, Ian Horrocks, Carsten Lutz, Uli Sattler, et al\.2017b\.*An introduction to description logic*\. Vol\. 24\.Cambridge University Press Cambridge\.
- Babaei Giglou et al\.\(2023\)Hamed Babaei Giglou, Jennifer D’Souza, and Sören Auer\. 2023\.LLMs4OL: Large Language Models for Ontology Learning\. In*ISWC*\. 408–427\.
- Balhoff and Mungall \(2024\)James P\. Balhoff and Christopher J\. Mungall\. 2024\.Whelk: An OWL EL\+RL Reasoner Enabling New Use Cases\.*Transactions on Graph Data and Knowledge*2, 2 \(2024\), 7:1–7:17\.[doi:10\.4230/TGDK\.2\.2\.7](https://doi.org/10.4230/TGDK.2.2.7)
- Cormack et al\.\(2009\)Gordon V\. Cormack, Charles L\. A\. Clarke, and Stefan Buettcher\. 2009\.Reciprocal Rank Fusion Outperforms Condorcet and Individual Rank Learning Methods\. In*SIGIR*\. 758–759\.[doi:10\.1145/1571941\.1572114](https://doi.org/10.1145/1571941.1572114)
- Donnelly \(2006\)Kevin Donnelly\. 2006\.SNOMED\-CT: The Advanced Terminology and Coding System for eHealth\.*Studies in Health Technology and Informatics*121 \(2006\), 279–290\.
- Dooley et al\.\(2018\)Damion M\. Dooley, Emma J\. Griffiths, Gurinder S\. Gosal, Pier L\. Buttigieg, Robert Hoehndorf, Matthew C\. Lange, Lynn M\. Schriml, Fiona S\. L\. Brinkman, and William W\. L\. Hsiao\. 2018\.FoodOn: A Harmonized Food Ontology to Increase Global Food Traceability, Quality Control and Data Integration\.*npj Science of Food*2 \(2018\), 23\.[doi:10\.1038/s41538\-018\-0032\-6](https://doi.org/10.1038/s41538-018-0032-6)
- Gao et al\.\(2023\)Yunfan Gao, Yun Xiong, Xinyu Gao, Kangxiang Jia, Jinliu Pan, Yuxi Bi, Yi Dai, Jiawei Sun, Meng Wang, and Haofen Wang\. 2023\.Retrieval\-Augmented Generation for Large Language Models: A Survey\.arXiv:2312\.10997\.
- Glimm et al\.\(2014\)Birte Glimm, Ian Horrocks, Boris Motik, Giorgos Stoilos, and Zhe Wang\. 2014\.HermiT: An OWL 2 Reasoner\.*Journal of Automated Reasoning*53, 3 \(2014\), 245–269\.[doi:10\.1007/s10817\-014\-9305\-1](https://doi.org/10.1007/s10817-014-9305-1)
- Grattafiori et al\.\(2024\)Aaron Grattafiori, Abhimanyu Dubey, et al\.2024\.The Llama 3 Herd of Models\.arXiv:2407\.21783\.
- Han et al\.\(2023\)Tianyu Han, Lisa C\. Adams, Jens\-Michalis Papaioannou, Paul Grundmann, Tom Oberhauser, Alexei Figueroa, Alexander Löser, Daniel Truhn, and Keno K\. Bressem\. 2023\.MedAlpaca – An Open\-Source Collection of Medical Conversational AI Models and Training Data\.arXiv:2304\.08247\.
- Harris and Seaborne \(2013\)Steve Harris and Andy Seaborne\. 2013\.SPARQL 1\.1 Query Language\.W3C Recommendation, 21 March 2013\.[https://www\.w3\.org/TR/sparql11\-query/](https://www.w3.org/TR/sparql11-query/)\.
- He et al\.\(2022\)Yuan He, Jiaoyan Chen, Denvar Antonyrajah, and Ian Horrocks\. 2022\.BERTMap: A BERT\-Based Ontology Alignment System\. In*AAAI*\. 5684–5691\.
- He et al\.\(2024a\)Yuan He, Jiaoyan Chen, Hang Dong, Ian Horrocks, Carlo Allocca, Taehun Kim, and Brahmananda Sapkota\. 2024a\.DeepOnto: A Python Package for Ontology Engineering with Deep Learning\.*Semantic Web*15, 5 \(2024\), 1991–2004\.
- He et al\.\(2023\)Yuan He, Jiaoyan Chen, Ernesto Jiménez\-Ruiz, Hang Dong, and Ian Horrocks\. 2023\.Language Model Analysis for Ontology Subsumption Inference\. In*Findings of ACL*\. 3439–3453\.[doi:10\.18653/v1/2023\.findings\-acl\.213](https://doi.org/10.18653/v1/2023.findings-acl.213)
- He et al\.\(2024b\)Yuan He, Zhangdie Yuan, Jiaoyan Chen, and Ian Horrocks\. 2024b\.Language Models as Hierarchy Encoders\. In*NeurIPS*, Vol\. 37\. 14690–14711\.
- Horrocks \(2008\)Ian Horrocks\. 2008\.Ontologies and the Semantic Web\.*Commun\. ACM*51, 12 \(2008\), 58–67\.[doi:10\.1145/1409360\.1409377](https://doi.org/10.1145/1409360.1409377)
- Huang et al\.\(2025\)Lei Huang, Weijiang Yu, Weitao Ma, Weihong Zhong, Zhangyin Feng, Haotian Wang, Qianglong Chen, Weihua Peng, Xiaocheng Feng, Bing Qin, and Ting Liu\. 2025\.A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questions\.*ACM Transactions on Information Systems*43, 2 \(2025\), 1–55\.[doi:10\.1145/3703155](https://doi.org/10.1145/3703155)
- Ji et al\.\(2023\)Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung\. 2023\.Survey of Hallucination in Natural Language Generation\.*Comput\. Surveys*55, 12 \(2023\), 1–38\.
- Jiang et al\.\(2023\)Zhengbao Jiang, Frank F\. Xu, Luyu Gao, Zhiqing Sun, Qian Liu, Jane Dwivedi\-Yu, Yiming Yang, Jamie Callan, and Graham Neubig\. 2023\.Active Retrieval Augmented Generation\. In*EMNLP*\. 7969–7992\.
- Jin et al\.\(2021\)Di Jin, Eileen Pan, Nassim Oufattole, Wei\-Hung Weng, Hanyi Fang, and Peter Szolovits\. 2021\.What Disease Does This Patient Have? A Large\-Scale Open Domain Question Answering Dataset from Medical Exams\.*Applied Sciences*11, 14 \(2021\), 6421\.[doi:10\.3390/app11146421](https://doi.org/10.3390/app11146421)
- Jin et al\.\(2019\)Qiao Jin, Bhuwan Dhingra, Zhengping Liu, William Cohen, and Xinghua Lu\. 2019\.PubMedQA: A Dataset for Biomedical Research Question Answering\. In*EMNLP\-IJCNLP*\. 2567–2577\.[doi:10\.18653/v1/D19\-1259](https://doi.org/10.18653/v1/D19-1259)
- Jin et al\.\(2023\)Qiao Jin, Won Kim, Qingyu Chen, Donald C\. Comeau, Lana Yeganova, W\. John Wilbur, and Zhiyong Lu\. 2023\.MedCPT: Contrastive Pre\-trained Transformers with Large\-scale PubMed Search Logs for Zero\-shot Biomedical Information Retrieval\.*Bioinformatics*39, 11 \(2023\), btad651\.
- Kazakov et al\.\(2014\)Yevgeny Kazakov, Markus Krötzsch, and František Simančík\. 2014\.The Incredible ELK: From Polynomial Procedures to Efficient Reasoning with EL Ontologies\.*Journal of Automated Reasoning*53, 1 \(2014\), 1–61\.[doi:10\.1007/s10817\-013\-9296\-3](https://doi.org/10.1007/s10817-013-9296-3)
- Lan et al\.\(2021\)Yunshi Lan, Gaole He, Jinhao Jiang, Jing Jiang, Wayne Xin Zhao, and Ji\-Rong Wen\. 2021\.A Survey on Complex Knowledge Base Question Answering: Methods, Challenges and Solutions\. In*IJCAI*\. 4483–4491\.[doi:10\.24963/ijcai\.2021/611](https://doi.org/10.24963/ijcai.2021/611)
- Li et al\.\(2023\)Tianle Li, Xueguang Ma, Alex Zhuang, Yu Gu, Yu Su, and Wenhu Chen\. 2023\.Few\-shot In\-context Learning on Knowledge Base Question Answering\. In*ACL*\. 6966–6980\.[doi:10\.18653/v1/2023\.acl\-long\.385](https://doi.org/10.18653/v1/2023.acl-long.385)
- Liu et al\.\(2025b\)Runxuan Liu, Bei Luo, Jiaqi Li, Baoxin Wang, Ming Liu, Dayong Wu, Shijin Wang, and Bing Qin\. 2025b\.Ontology\-Guided Reverse Thinking Makes Large Language Models Stronger on Knowledge Graph Question Answering\. In*ACL*\. 15269–15284\.
- Liu et al\.\(2025a\)Zhiqiang Liu, Chengtao Gan, Junjie Wang, Yichi Zhang, Zhongpu Bo, Mengshu Sun, Huajun Chen, and Wen Zhang\. 2025a\.OntoTune: Ontology\-Driven Self\-training for Aligning Large Language Models\. In*WWW*\. 119–133\.
- Luo et al\.\(2024a\)Haoran Luo, Haihong E, Zichen Tang, Shiyao Peng, Yikai Guo, Wentai Zhang, Chenghao Ma, Guanting Dong, Meina Song, Wei Lin, Yifan Zhu, and Anh Tuan Luu\. 2024a\.ChatKBQA: A Generate\-then\-Retrieve Framework for Knowledge Base Question Answering with Fine\-tuned Large Language Models\. In*Findings of ACL*\. 2039–2056\.[doi:10\.18653/v1/2024\.findings\-acl\.122](https://doi.org/10.18653/v1/2024.findings-acl.122)
- Luo et al\.\(2024b\)Linhao Luo, Yuan\-Fang Li, Gholamreza Haffari, and Shirui Pan\. 2024b\.Reasoning on Graphs: Faithful and Interpretable Large Language Model Reasoning\. In*ICLR*\.
- Ma et al\.\(2025\)Shengjie Ma, Chengjin Xu, Xuhui Jiang, Muzhi Li, Huaren Qu, Cehao Yang, Jiaxin Mao, and Jian Guo\. 2025\.Think\-on\-Graph 2\.0: Deep and Faithful Large Language Model Reasoning with Knowledge\-guided Retrieval Augmented Generation\. In*ICLR*\.
- Moskvoretskii et al\.\(2024\)Viktor Moskvoretskii, Ekaterina Neminova, Alina Lobanova, Alexander Panchenko, and Irina Nikishina\. 2024\.TaxoLLaMA: WordNet\-based Model for Solving Multiple Lexical Semantic Tasks\. In*ACL*\. 2331–2350\.
- Muennighoff et al\.\(2025\)Niklas Muennighoff, Zitong Yang, Weijia Shi, Xiang Lisa Li, Li Fei\-Fei, Hannaneh Hajishirzi, Luke Zettlemoyer, Percy Liang, Emmanuel Candès, and Tatsunori Hashimoto\. 2025\.s1: Simple Test\-Time Scaling\. In*EMNLP*\. 20275–20321\.
- Olausson et al\.\(2023\)Theo Olausson, Alex Gu, Ben Lipkin, Cedegao Zhang, Armando Solar\-Lezama, Joshua Tenenbaum, and Roger Levy\. 2023\.LINC: A Neurosymbolic Approach for Logical Reasoning by Combining Language Models with First\-Order Logic Provers\. In*EMNLP*\. 5153–5176\.[doi:10\.18653/v1/2023\.emnlp\-main\.313](https://doi.org/10.18653/v1/2023.emnlp-main.313)
- Pal et al\.\(2022\)Ankit Pal, Logesh Kumar Umapathi, and Malaikannan Sankarasubbu\. 2022\.MedMCQA: A Large\-scale Multi\-Subject Multi\-Choice Dataset for Medical Domain Question Answering\. In*CHIL*\. 248–260\.
- Pan et al\.\(2023\)Liangming Pan, Alon Albalak, Xinyi Wang, and William Wang\. 2023\.Logic\-LM: Empowering Large Language Models with Symbolic Solvers for Faithful Logical Reasoning\. In*Findings of EMNLP*\. 3806–3824\.
- Pellissier Tanon \(2023\)Thomas Pellissier Tanon\. 2023\.Oxigraph: a graph database implementing the SPARQL standard\.[doi:10\.5281/zenodo\.7408022](https://doi.org/10.5281/zenodo.7408022)Software,[https://oxigraph\.org](https://oxigraph.org/)\.
- Qin et al\.\(2025\)Yujia Qin, Shengding Hu, Yankai Lin, Weize Chen, Ning Ding, Ganqu Cui, Zheni Zeng, Xuanhe Zhou, Yufei Huang, Chaojun Xiao, et al\.2025\.Tool Learning with Foundation Models\.*Comput\. Surveys*57, 4 \(2025\), 1–40\.[doi:10\.1145/3704435](https://doi.org/10.1145/3704435)
- Qwen Team \(2026\)Qwen Team\. 2026\.Qwen3\.5: Towards Native Multimodal Agents\.[https://qwen\.ai/blog?id=qwen3\.5](https://qwen.ai/blog?id=qwen3.5)\.
- Ratcliff and Metzener \(1988\)John W\. Ratcliff and David E\. Metzener\. 1988\.Pattern Matching: The Gestalt Approach\.*Dr\. Dobb’s Journal*13, 7 \(1988\), 46\.
- Reimers and Gurevych \(2019\)Nils Reimers and Iryna Gurevych\. 2019\.Sentence\-BERT: Sentence Embeddings using Siamese BERT\-Networks\. In*EMNLP\-IJCNLP*\. 3982–3992\.
- Robertson and Zaragoza \(2009\)Stephen Robertson and Hugo Zaragoza\. 2009\.The Probabilistic Relevance Framework: BM25 and Beyond\.*Foundations and Trends in Information Retrieval*3, 4 \(2009\), 333–389\.[doi:10\.1561/1500000019](https://doi.org/10.1561/1500000019)
- Schick et al\.\(2023\)Timo Schick, Jane Dwivedi\-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Eric Hambro, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom\. 2023\.Toolformer: Language Models Can Teach Themselves to Use Tools\. In*NeurIPS*\.
- Sharma et al\.\(2025\)Kartik Sharma, Peeyush Kumar, and Yunqing Li\. 2025\.OG\-RAG: Ontology\-Grounded Retrieval\-Augmented Generation for Large Language Models\. In*EMNLP*\. 32962–32981\.[doi:10\.18653/v1/2025\.emnlp\-main\.1674](https://doi.org/10.18653/v1/2025.emnlp-main.1674)
- Smith et al\.\(2007\)Barry Smith, Michael Ashburner, Cornelius Rosse, Jonathan Bard, William Bug, Werner Ceusters, Louis J\. Goldberg, Karen Eilbeck, Amelia Ireland, Christopher J\. Mungall, et al\.2007\.The OBO Foundry: Coordinated Evolution of Ontologies to Support Biomedical Data Integration\.*Nature Biotechnology*25, 11 \(2007\), 1251–1255\.[doi:10\.1038/nbt1346](https://doi.org/10.1038/nbt1346)
- StatPearls Publishing \(2026\)StatPearls Publishing\. 2026\.StatPearls\.NCBI Bookshelf NBK430685,[https://www\.ncbi\.nlm\.nih\.gov/books/NBK430685/](https://www.ncbi.nlm.nih.gov/books/NBK430685/)\.Archive of 27 September 2026\.
- Su et al\.\(2025\)Xiaorui Su, Yibo Wang, Shanghua Gao, Xiaolong Liu, Valentina Giunchiglia, Djork\-Arné Clevert, and Marinka Zitnik\. 2025\.KGARevion: An AI Agent for Knowledge\-Intensive Biomedical QA\. In*ICLR*\.
- Sun et al\.\(2024\)Jiashuo Sun, Chengjin Xu, Lumingyuan Tang, Saizhuo Wang, Chen Lin, Yeyun Gong, Lionel M\. Ni, Heung\-Yeung Shum, and Jian Guo\. 2024\.Think\-on\-Graph: Deep and Responsible Reasoning of Large Language Model on Knowledge Graph\. In*ICLR*\.
- Trivedi et al\.\(2023\)Harsh Trivedi, Niranjan Balasubramanian, Tushar Khot, and Ashish Sabharwal\. 2023\.Interleaving Retrieval with Chain\-of\-Thought Reasoning for Knowledge\-Intensive Multi\-Step Questions\. In*ACL*\. 10014–10037\.
- Wang et al\.\(2020\)Wenhui Wang, Furu Wei, Li Dong, Hangbo Bao, Nan Yang, and Ming Zhou\. 2020\.MiniLM: Deep Self\-Attention Distillation for Task\-Agnostic Compression of Pre\-Trained Transformers\. In*NeurIPS*, Vol\. 33\. 5776–5788\.
- Wang et al\.\(2024\)Zilong Wang, Hao Zhang, Chun\-Liang Li, Julian Martin Eisenschlos, Vincent Perot, Zifeng Wang, Lesly Miculicich, Yasuhisa Fujii, Jingbo Shang, Chen\-Yu Lee, and Tomas Pfister\. 2024\.Chain\-of\-Table: Evolving Tables in the Reasoning Chain for Table Understanding\. In*ICLR*\.
- Wei et al\.\(2022\)Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc V\. Le, and Denny Zhou\. 2022\.Chain\-of\-Thought Prompting Elicits Reasoning in Large Language Models\. In*NeurIPS*\.
- Wu et al\.\(2025\)Junde Wu, Jiayuan Zhu, Yunli Qi, Jingkun Chen, Min Xu, Filippo Menolascina, Yueming Jin, and Vicente Grau\. 2025\.Medical Graph RAG: Evidence\-based Medical Large Language Model via Graph Retrieval\-Augmented Generation\. In*ACL*\. 28443–28467\.
- Xiong et al\.\(2024a\)Guangzhi Xiong, Qiao Jin, Zhiyong Lu, and Aidong Zhang\. 2024a\.Benchmarking Retrieval\-Augmented Generation for Medicine\. In*Findings of ACL*\. 6233–6251\.
- Xiong et al\.\(2024b\)Guangzhi Xiong, Qiao Jin, Xiao Wang, Minjia Zhang, Zhiyong Lu, and Aidong Zhang\. 2024b\.Improving Retrieval\-Augmented Generation in Medicine with Iterative Follow\-up Questions\. In*PSB*\. 199–214\.[doi:10\.1142/9789819807024\_0015](https://doi.org/10.1142/9789819807024_0015)
- Yang et al\.\(2025\)Hui Yang, Jiaoyan Chen, Yuan He, Yongsheng Gao, and Ian Horrocks\. 2025\.Language Models as Ontology Encoders\. In*ISWC*\. 443–461\.
- Yang et al\.\(2026\)Hui Yang, Jiaoyan Chen, Yiping Song, Renate Schmidt, and Wen Zhang\. 2026\.NeurOWL: An LLM\-Based Neural\-symbolic Framework for Incomplete OWL Ontology Reasoning\.arXiv:2607\.15776\.
- Yang et al\.\(2024\)Rui Yang, Haoran Liu, Edison Marrese\-Taylor, Qingcheng Zeng, Yuhe Ke, Wanxin Li, Lechao Cheng, Qingyu Chen, James Caverlee, Yutaka Matsuo, and Irene Li\. 2024\.KG\-Rank: Enhancing Large Language Models for Medical QA with Knowledge Graphs and Ranking Techniques\. In*BioNLP Workshop*\. 155–166\.
- Yao et al\.\(2023\)Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao\. 2023\.ReAct: Synergizing Reasoning and Acting in Language Models\. In*ICLR*\.
- Zhang et al\.\(2026\)Xiao Zhang, Huiyuan Lai, Qianru Meng, and Johan Bos\. 2026\.OntoURL: A Benchmark for Evaluating Large Language Models on Symbolic Ontological Understanding, Reasoning and Learning\.*Journal of Web Semantics*91 \(2026\), 100886\.[doi:10\.1016/j\.websem\.2026\.100886](https://doi.org/10.1016/j.websem.2026.100886)

## Appendix AImplementation Details

Agent and service\.For each item, OA\-RAG allows up to 10 tool actions and 5,000 generated tokens across pre\-tool reasoning, the ReAct loop, and Step 1 of answering, plus 512 tokens for Step 2\. The ontology service decidesASKandSELECTqueries over the entailment closure of the ontology, precomputed with the OWL EL reasoner Whelk\([Balhoff and Mungall, 2024](https://arxiv.org/html/2610.36335#bib.bib6)\)and stored in Oxigraph\([Pellissier Tanon, 2023](https://arxiv.org/html/2610.36335#bib.bib39)\); the datasets are built and checked with ELK\([Kazakov et al\., 2014](https://arxiv.org/html/2610.36335#bib.bib26)\)and HermiT\([Glimm et al\., 2014](https://arxiv.org/html/2610.36335#bib.bib11)\)\.

Cost\.On Test 3 with Qwen, OA\-RAG uses 9\.7k tokens per question over 5\.8 LLM calls on average, including 7\.9k input tokens \(1\.0k from ontology observations\) and 1\.8k generated tokens\. In contrast, i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}\(262k\) uses 96\.7k tokens over 22\.0 calls, including 87\.8k input tokens \(63\.6k from retrieved documents\) and 8\.9k generated tokens\.

Tool calls\(Figure[6](https://arxiv.org/html/2610.36335#A2.F6)\)\. Query choice varies systematically with question type and model\. On the OQs of Tests 1 and 2, Llama relies almost exclusively onSELECT\(97% of calls\), whereas Qwen primarily usesDESCRIBE\(56%\)\. On the MCQs, Llama divides its calls betweenASKandSELECT\(40–45% each\), while Qwen again favorsDESCRIBE\(49–53%\)\. On Test 3, Llama averages 4\.9 calls per question, split evenly betweenASKandSELECT\(40 and 42%\), whereas Qwen averages 2\.0 calls and usesDESCRIBEfor 84% of them\.

## Appendix BRetrieval and Document Baselines

The retrieval baselines differ primarily in their knowledge source: RAGont\{\}\_\{\\texttt\{ont\}\}\(text\), ReActont\{\}\_\{\\texttt\{ont\}\}, and the ablationsearchtool retrieve ontology concept cards, whereas RAGdoc\{\}\_\{\\texttt\{doc\}\}\(text\), MedRAGdoc\{\}\_\{\\texttt\{doc\}\}, and i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}retrieve medical documents\.

LlamaQwenTest 1 MCQ3\.6Test 1 OQ3\.8Test 2 MCQ4\.8Test 2 OQ4\.9Test 34\.9Test 1 MCQ2\.2Test 1 OQ4\.5Test 2 MCQ3\.3Test 2 OQ6\.1Test 32\.00246

Figure 6\.Tool calls of OA\-RAG per question by query form \(SELECT: all its variants\)\. Test 3 pools its six sets\.Ontology retrieval\.Each field of a concept card \(§[4\.2\.1](https://arxiv.org/html/2610.36335#S4.SS2.SSS1)\) forms a retrieval unit, grouped by type \(names, definitions, etc\.\)\. Units are retrieved using BM25\([Robertson and Zaragoza, 2009](https://arxiv.org/html/2610.36335#bib.bib44)\)and sentence embeddings \(all\-MiniLM\-L6\-v2\([Reimers and Gurevych, 2019](https://arxiv.org/html/2610.36335#bib.bib43);[Wang et al\., 2020](https://arxiv.org/html/2610.36335#bib.bib52)\)\), with the resulting rankings combined by reciprocal rank fusion\([Cormack et al\., 2009](https://arxiv.org/html/2610.36335#bib.bib7)\); each concept is scored according to its highest\-ranked unit\. RAGont\{\}\_\{\\texttt\{ont\}\}\(text\) performs a single retrieval using the question and answer options, then inserts the top\-5 concept cards together with the top\-5 verbalized axioms retrieved using the same scoring procedure\. ReActont\{\}\_\{\\texttt\{ont\}\}uses the same underlying retrieval mechanism as RAGont\{\}\_\{\\texttt\{ont\}\}\(text\) but each search returns the top\-5 concepts, each with only the field that matched rather than its complete concept card, followed by the top\-5 matching verbalized axioms\. Unlike RAGont\{\}\_\{\\texttt\{ont\}\}\(text\), ReActont\{\}\_\{\\texttt\{ont\}\}generates search queries dynamically using the LLM\. Thesearchtool used in our ablation study follows the same approach\.

Document baselines\.Following i\-MedRAG, we use MedCPT\([Jin et al\., 2023](https://arxiv.org/html/2610.36335#bib.bib25)\)to retrieve from medical textbooks\([Jin et al\., 2021](https://arxiv.org/html/2610.36335#bib.bib23)\)and StatPearls\([StatPearls Publishing, 2026](https://arxiv.org/html/2610.36335#bib.bib48)\)\. RAGdoc\{\}\_\{\\texttt\{doc\}\}\(text\) replaces ontology cards with the top\-5 retrieved snippets\. Under their standard settings, MedRAGdoc\{\}\_\{\\texttt\{doc\}\}\([Xiong et al\., 2024a](https://arxiv.org/html/2610.36335#bib.bib56)\)answers from 32 snippets in a single call, while i\-MedRAGdoc\{\}\_\{\\texttt\{doc\}\}\([Xiong et al\., 2024b](https://arxiv.org/html/2610.36335#bib.bib57)\)issues three follow\-up queries in each of four rounds\. Both are run with the authors’ toolkit using a 7,168\-token document budget, with a forced answer when the response reaches the context\-window limit\([Muennighoff et al\., 2025](https://arxiv.org/html/2610.36335#bib.bib35)\)\.

Table 3\.Test 1 and Test 2 accuracy \(%\) by source ontology\.Red/blue: best / second best per model and test\.Results by source ontology\(Table[3](https://arxiv.org/html/2610.36335#A2.T3)\)\. OA\-RAG achieves the best performance in 19 of the 24 settings, one of them tied\. In the other five, it falls behind RAGont\{\}\_\{\\texttt\{ont\}\}\(text\) \(with Llama on the Test 2 GO and FoodOn MCQs, 53\.7 vs\. 55\.7% and 46\.8 vs\. 51\.8%\) or ReActont\{\}\_\{\\texttt\{ont\}\}\(on three Test 2 OQ settings\); the largest gap is on the Test 2 GO OQs with Qwen \(22\.0 vs\. 42\.0%\), mainly because Qwen’s exact queries rarely retrieve a correct concept there \(for 15 of the 200 questions, vs\. 106 on Test 1\), so it gives no answer to 62\.5% of them\.

BBAArrBBAArr00252550507575100100Test 1Test 2accuracy \(%\)MCQ:masked slot123123Test 1Test 2MCQ:\#Ans234234Test 1Test 2OQ:conditionsnn

Figure 7\.OA\-RAG on Test 1 and Test 2 by item construction \(accuracy %; dashed: MCQs scored with at least one correct and no wrong choice\)\.Table 4\.Sizes of the ontologies \(Test 1: source; Test 2: revised\)\.
## Appendix CBenchmarks

Table[4](https://arxiv.org/html/2610.36335#A2.T4)summarizes the sizes of the three ontologies\. We use the GO release of 2026\-07\-26, the FoodOn release of 2022\-08\-12 \(with imports merged\), and the SNOMED CT International Edition release of 2025\-07\-01, converted to OWL using the SNOMED OWL Toolkit\. SNOMED CT is in the OWL 2 EL profile \(ℰ​ℒ\+⁣\+\\mathcal\{EL\}^\{\+\+\}\)\. GO uses only⊓\\sqcapand∃\\existsin its class expressions and lies inℰ​ℒ\+⁣\+\\mathcal\{EL\}^\{\+\+\}except for one inverse\-object\-property axiom relating*part of*and*has part*\. FoodOn additionally uses∀\\forall,¬\\neg,⊔\\sqcup, and cardinality restrictions, placing it in𝒮​ℛ​ℐ​𝒬\\mathcal\{SRIQ\}\. The revised ontologies used in Test 2 preserve the signature and use a subset of the same constructors\.Table[5](https://arxiv.org/html/2610.36335#A3.T5)summarizes the sizes of Tests 1 and 2\. For each ontology, we construct 300 MCQs by masking the filler, subject, or relation of 100 axioms each, together with 200 OQs\. Test 2 uses the same questions as Test 1, except for 23 questions that fail the checks described below\.

Table 5\.Tests 1 \(T1\) and 2 \(T2\): MCQs by the number of correct options \(\#Ans\), and OQs by the number of conditionsnn\.GOFoodOnSNOMED CTAllT1T2T1T2T1T2T1T2MCQ\#Ans=1\{\}=1203203230230236235669668\#Ans=2\{\}=2585843433939140140\#Ans=3\{\}=33939272625219186OQn=2n=2676767676765201199n=3n=3676767656761201193n=4n=4666666626663198191All questions5005005004935004841,5001,477OQ conditions\.We construct the candidate OQ conditions as follows\. LetS⁡\(A\)S\(A\)contain the restrictions∃r\.B\\exists r\.Bthat the MCQ decomposition rule \(§[5\.1](https://arxiv.org/html/2610.36335#S5.SS1)\) yields from the asserted axioms ofAAand its ancestors, and let the filler be lifted by up to two taxonomy levels:

S¯\(A\)=\{∃r\.B′:∃r\.B∈S\(A\),B′∈\{B\}∪Parent≤2\(B\)\}\.\\overline\{S\}\(A\)=\\left\\\{\\exists r\.B^\{\\prime\}:\\exists r\.B\\in S\(A\),\\ B^\{\\prime\}\\in\\\{B\\\}\\cup\\mathrm\{Parent\}\_\{\\leq 2\}\(B\)\\right\\\}\.A lifted restriction still holds forAA, sinceB⊑B′B\\sqsubseteq B^\{\\prime\}\. For eachAAwith\|S¯​\(A\)\|≥n\|\\overline\{S\}\(A\)\|\\geq n, we samplennconditions fromS¯​\(A\)\\overline\{S\}\(A\)and resample until none subsumes another \(𝒪⊧̸∃ri\.Bi′⊑∃rj\.Bj′\\mathcal\{O\}\\not\\models\\exists r\_\{i\}\.B^\{\\prime\}\_\{i\}\\sqsubseteq\\exists r\_\{j\}\.B^\{\\prime\}\_\{j\}for alli≠ji\\neq j\)\.

Test 2 checks\.We apply two checks to ensure that Test 2 remains in the intended pattern \(§[5\.2](https://arxiv.org/html/2610.36335#S5.SS2)\)\. First, the revision may remove information needed to preserve the original answer\. In particular, replacing an equivalence \(⋈=≡\\bowtie=\\equiv\) withA⊑DA\\sqsubseteq Ddrops the reverse implicationD⊓⨅i∃ri\.Ci⊑AD\\sqcap\\bigsqcap\_\{i\}\\exists r\_\{i\}\.C\_\{i\}\\sqsubseteq A, which is not preserved by the informal annotations\. We therefore verify that each question retains the same gold answer when both the revised axioms and the informal annotations are considered\. Second, we require that the gold answer cannot be derived from the revised ontology by an ontology reasoner alone\.

## Appendix DConstruction and Difficulty

Figure[7](https://arxiv.org/html/2610.36335#A2.F7)shows how the performance of OA\-RAG varies with item construction, including the number of correct MCQ options, the number of OQ conditions, and the masked slot\.

Correct options\.For Llama on Test 1, accuracy drops from 73\.8% on single\-answer MCQs to 32\.1% and 20\.9% with two and three correct options, respectively, because all entailed options must be identified\. Despite this drop, OA\-RAG remains well above all baselines \(at most 14\.3%\), as it can verify each option independently with anASKquery\.

Conditions\.On Test 1, OQ accuracy is stable up ton=3n=3conditions \(46\.3% for Llama at bothn=2n=2andn=3n=3\) and drops to 42\.4% only atn=4n=4, since a singleSELECTcan evaluate the full conjunction\. On Test 2, however, accuracy is far lower throughout and already falls atn=3n=3\(from 19\.6% atn=2n=2to 17\.1%\), as the required conditions must be recovered from separate definition sentences\.

Masked slot\.For both models, masking the relation is easiest, while masking the filler is consistently hardest, because the filler’s ancestors may also constitute correct answers\.

## Appendix EPrompts

OA\-RAG uses four prompts, reproduced verbatim below: pre\-tool reasoning \(𝒫pre\\mathcal\{P\}\_\{\\mathrm\{pre\}\}\), the ReAct loop \(𝒫agent\\mathcal\{P\}\_\{\\mathrm\{agent\}\}\), final answering \(𝒫fin\\mathcal\{P\}\_\{\\mathrm\{fin\}\}or𝒫own\\mathcal\{P\}\_\{\\mathrm\{own\}\}, Step 1\), and attribution \(𝒫att\\mathcal\{P\}\_\{\\mathrm\{att\}\}, Step 2\)\.Color code\.Black text is fixed;this colormarks ontology\- or dataset\-specific content; andredmarks the question blockqq, including the question, answer options, PubMedQA abstract, and answer format\.Persona\.The persona is prepended to the pre\-tool and final\-answer prompts\. For Tests 1 and 2, SNOMED CT questions use the persona shown in𝒫pre\\mathcal\{P\}\_\{\\mathrm\{pre\}\}, and GO and FoodOn questions replace its first sentence with*“You are an expert in molecular biology”*and*“You are an expert in the science of foods, their ingredients, origins and preparation”*, respectively\. For Test 3, we use the dataset\-specific OntoTune header\.

Pre\-tool reasoning𝒫pre\\mathcal\{P\}\_\{\\mathrm\{pre\}\}\(SNOMED CT persona\)System:You are an expert physician in clinical medicine and healthcare terminology, answering questions about how the entities of that field are defined, organized and related\. Answer the following question carefully\.Think step by step briefly to reason about the question\. Use the information provided with the question\. Additional records are context; use them only when they bear on the question\. A draft is unverified\. End your reply with the final answer as a single JSON object matching the answer schema, on its own last line\. User:\{question blockqq\}

Agent prompt𝒫agent\\mathcal\{P\}\_\{\\mathrm\{agent\}\}\(the user turn after the pre\-tool reply\)An ontology is available through the tool below\. Continue from your answer above: where the ontology decides the question, verify that answer with the tools; then give the final answer in the format below\. \#\# Tool query\(sparql\): exact reasoning over the ontology’s axioms, asked as a short SPARQL query over names: every concept and relation is written as its exact name in double quotes \(there are no identifiers or IRIs to use\); the relation"is a"means classification \(a kind of\)\. Inheritance and sub\-relations are applied for you\. The four query forms, each with a toy example:•DESCRIBE "name"– the ontology’s record of one concept: definition, parents, children, the relations it states, annotations\. E\.g\.DESCRIBE "grand piano"•ASK \{ "subject" "relation" "object" \}– is every subject related by relation to some object? Verdicts: ENTAILED, NOT ENTAILED,UNKNOWNNAME\. E\.g\.ASK \{ "grand piano" "part of" "orchestra" \}•SELECT ?x WHERE \{ ?x "relation" "object" \. \.\.\. \}– the concepts that satisfy ALL the listed conditions; addVALUES ?x \{ "name" "name" \.\.\. \}to test only these candidates, one verdict each\. E\.g\.SELECT ?x WHERE \{ ?x "part of" "orchestra" \. ?x "made of" "brass" \}•SELECT ?o WHERE \{ "subject" "relation" ?o \}– what the subject is related to by that relation; likewiseSELECT ?r WHERE \{ "subject" ?r "object" \}lists the relations that hold between the two\. E\.g\.SELECT ?o WHERE \{ "grand piano" "part of" ?o \}\#\# How to use it Use the ontology when the question is about how its concepts are defined, classified or related to each other: query decides such a question exactly, so verify the candidate answers with it before answering\. Answer a question about a situation, a case, a measurement or general knowledge from your own knowledge\. Names must be spelled exactly as the ontology spells them; if a name comes backUNKNOWNNAME, retry with one of the similar names it lists\. \#\# What the verdicts mean ENTAILED is certain: the ontology’s axioms derive it\. NOT ENTAILED is not a denial: the ontology is incomplete \(open world\), so a statement it does not derive may still hold\. Decide such a statement yourself from the records shown and from what you know, and accept it when it is clearly true\. \#\# Format Thought:reason about the question and about what to do next – take as much room as you need Action:one tool call, written as a function call:query\(<SPARQL query\>\) Observation:the tool’s result, given to you – never write one yourself … \(this repeats as often as needed\) Thought:I now know the answer Answer:<ONLY the JSON object in the answer schema the question states\> Write a Thought before every Action and before the Answer\. A Thought may also stand on its own; the reply after it must be an Action or an Answer\. Begin\.

Final answer:𝒫fin\\mathcal\{P\}\_\{\\mathrm\{fin\}\}\(non\-empty digest\) and𝒫own\\mathcal\{P\}\_\{\\mathrm\{own\}\}\(empty digest\)𝒫fin\\mathcal\{P\}\_\{\\mathrm\{fin\}\},System:The tool phase of this session is over\. Using the question and the observations below, think step by step briefly, then end your reply with the final answer JSON object that the question’s answer schema requests, on its own last line\. ENTAILED is certain: the ontology’s axioms derive it\. NOT ENTAILED is not a denial: the ontology is incomplete \(open world\), so a statement it does not derive may still hold\. Decide such a statement yourself from the records shown and from what you know, and accept it when it is clearly true\. 𝒫fin\\mathcal\{P\}\_\{\\mathrm\{fin\}\},User:\{persona\}\{question blockqq\} Observations so far: \{the digestEE\} Draft answer from the tool phase:\{drafty~\\tilde\{y\}\} 𝒫own\\mathcal\{P\}\_\{\\mathrm\{own\}\},System:Answer the question from your own knowledge\. Think step by step briefly, then end your reply with the final answer JSON on its own last line\. 𝒫own\\mathcal\{P\}\_\{\\mathrm\{own\}\},User:\{persona\}\{question blockqq\}

Attribution𝒫att\\mathcal\{P\}\_\{\\mathrm\{att\}\}\(one more user turn after the reply of𝒫fin\\mathcal\{P\}\_\{\\mathrm\{fin\}\}; §[4\.1\.3](https://arxiv.org/html/2610.36335#S4.SS1.SSS3.Px2)\)Your answer above is final; do not change it\. Now state what it rests on\. The observations you were given, numbered: \[E1\] \{observatione1e\_\{1\}\} \[E2\] \{observatione2e\_\{2\}\} … Reply with only this JSON object: \{"evidence": \[<the ids of the observations your answer relies on, e\.g\. "E1", "E3"; empty if none\>\], "grounding": "<one word: entailed, supported, related or unrelated\>"\} Choose the grounding as the first of these that holds:•entailed: your answer follows from the observations by strict logical reasoning: for each option or name in your answer, the facts stated in the observations derive it, with nothing added from your own knowledge\. A fact counts whether the tool states it formally \(an ENTAILED verdict, a listing of the concepts entailed to satisfy the question’s conditions, a stated relation, parent or child\) or a text field states it as explicitly as an axiom would, naming the concepts and the relation \(e\.g\. a definition sentence “Every X is related by R to some Y”\)\. Concept names, synonyms and keyword records marked “not verified” state no fact\.•supported: your answer follows from the observations by sound reasoning that is not such a derivation: it interprets text that does not state the fact explicitly \(a paraphrasing definition, a name or synonym match, a “not verified” keyword record\), or it combines the facts shown with your own knowledge\.•related: the observations give some valid information relevant to the question, but not enough to arrive at your answer, or they point to a different answer\.•unrelated: the observations are essentially irrelevant to the question and to your answer\.NOT ENTAILED or “0 concepts” only means that the axioms do not derive a statement \(open world\); it does not deny it\. So an empty answer \(no option selected, an empty list\), which claims that nothing satisfies the question, is at most related\. If the reply holds no such object with one of the four levels, one re\-ask follows:*Reply with only the JSON object\{"evidence": \[\.\.\.\], "grounding": "\.\.\."\}\. The first character of the reply must be ‘\{’ and the last must be ‘\}’\.*

相似文章

OCC-RAG:面向忠实问答的最优认知核心

arXiv cs.CL

OCC-RAG 引入了一系列紧凑型小语言模型,这些模型针对忠实问答进行了优化,采用新颖的流程来合成多上下文多跳问答数据。该模型在推理和忠实度基准测试中表现出与大型模型相当的竞争性能。

AgenticRAG:面向企业知识库的代理检索

arXiv cs.AI

本文介绍了 AgenticRAG,这是一个来自微软的框架,通过为大型语言模型(LLM)配备迭代搜索、文档导航和分析工具,增强了企业知识库的检索能力。它在多个基准测试中展示了相比标准 RAG 流水线在召回率和事实准确性方面的显著提升。