Ontology-to-tools compilation for executable semantic constraint enforcement in LLM agents
Xiaochi Zhou, Patrick Bulter, Changxuan Yang, Simon D. Rihm, Thitikarn Angkanaporn, Jethro Akroyd, Sebastian Mosbach, Markus Kraft
TL;DR
The paper presents a framework to enforce semantic constraints during LLM-driven knowledge extraction by compiling ontologies into executable tool interfaces within The World Avatar. It demonstrates end-to-end knowledge-graph construction from metal-organic polyhedra synthesis literature, producing grounded synthesis procedures, canonical species, and CBUs, while enabling lexical grounding to reference data sources. End-to-end evaluation on 30 papers shows strong semantic validity and content accuracy, with constraint feedback improving the completeness of synthesis steps; analysis identifies dominant error modes and prioritizes targeted improvements. Limitations include analysis limited to a single ontology and dataset, with plans for broader domain testing, ontology evolution studies, and larger, more diverse evaluation. The approach reframes constraint enforcement as run-time interaction with a persistent symbolic state, enabling ontology-aware, stateful agent behavior in complex scientific extraction tasks.
Abstract
We introduce ontology-to-tools compilation as a proof-of-principle mechanism for coupling large language models (LLMs) with formal domain knowledge. Within The World Avatar (TWA), ontological specifications are compiled into executable tool interfaces that LLM-based agents must use to create and modify knowledge graph instances, enforcing semantic constraints during generation rather than through post-hoc validation. Extending TWA's semantic agent composition framework, the Model Context Protocol (MCP) and associated agents are integral components of the knowledge graph ecosystem, enabling structured interaction between generative models, symbolic constraints, and external resources. An agent-based workflow translates ontologies into ontology-aware tools and iteratively applies them to extract, validate, and repair structured knowledge from unstructured scientific text. Using metal-organic polyhedra synthesis literature as an illustrative case, we show how executable ontological semantics can guide LLM behaviour and reduce manual schema and prompt engineering, establishing a general paradigm for embedding formal knowledge into generative systems.
