Building intelligent systems that truly "understand" their environment requires more than just raw data; it requires ontologies—structured frameworks that define concepts, properties, and the relationships between them. However, populating these ontologies with real-world instances (e.g., moving from a class called "Fruit" to a list containing "Gala Apple" and "Cavendish Banana") is a notorious bottleneck. It is traditionally a manual, time-consuming, and bias-prone process.
In their recent paper, "Large language models as oracles for instantiating ontologies with domain-specific knowledge," Giovanni Ciatto and his colleagues at the University of Bologna introduce KGFiller, a framework that treats Large Language Models (LLMs) as "oracles" to automate this tedious task.
TL;DR
KGFiller is a domain-independent framework that uses LLMs to automatically populate ontology schemas with instances and relations. By leveraging the internal knowledge of models like GPT-4 and Mistral, it achieves up to five times higher quality and ten times fewer errors than previous state-of-the-art automated methods.
What Problem Does This Paper Address?
The "semantic gap" remains a major hurdle in AI. While we have plenty of data, turning it into machine-interpretable knowledge (ontologies) usually requires human experts to manually map out every entity.
Existing automated "ontology population" methods typically rely on mining specific text corpora. This creates a "chicken and egg" problem: to build a specialized ontology, you first need a massive, high-quality dataset for that specific domain. If the domain is too niche, the data doesn't exist; if it's too broad, the results are noisy. KGFiller bypasses the need for external documents entirely by tapping into the vast, latent knowledge already stored within pre-trained LLMs.
Methods
KGFiller operates as a four-phase pipeline that transforms a bare-bones schema (classes and properties) into a rich knowledge graph:
- Population Phase: The system performs a depth-first traversal of the class hierarchy. It queries the LLM using templates (e.g., "List examples of [Class]") to generate initial instances.
- Relation Phase: It identifies links between these new instances based on the properties defined in the schema (e.g., linking "Basil" to "Pesto" via the
ingredientOfproperty). - Redistribution Phase: LLMs can be vague. If a model assigns "Siamese" to the general class "Animal," KGFiller asks the oracle to find the most specific fit among subclasses (e.g., "Cat").
- Merge Phase: To handle synonyms or pluralities (e.g., "Apple" vs. "Apples"), the system identifies syntactically similar pairs and asks the LLM if they represent the same semantic entity, merging them if so.
The authors conceptualize this interaction through an "LLM-as-a-Service" model, where the client manages prompts, temperature, and rate limits to interact with the model via HTTP, as shown in Figure 1.
Datasets
To evaluate KGFiller, the authors designed a custom nutritional ontology focused on food and recipes. It consists of 54 classes (ranging from Edible to specific cuisines like Italian or Japanese) and properties like ingredientOf.
The researchers chose a custom ontology rather than a public benchmark to prevent "data contamination"—ensuring the LLM wasn't simply reciting an ontology it had already seen during its training phase. They tested the framework across eight different LLMs, including closed models (GPT-3.5, GPT-4) and open-source ones (Llama 2, Mistral, OpenChat, Gemma).
Key Insights and Ideas
- Document-Free Population: Unlike previous methods that require a "gold standard" text corpus, KGFiller is "training-free" and "document-free." The LLM is the corpus.
- The Specificity Fix: A major contribution is the Redistribution Phase. LLMs often default to broad categories. By recursively asking "is there a better subclass for this?", KGFiller forces the knowledge into the leaf nodes of the hierarchy, where it is most useful.
- Error Correlation: The study found a strong proportionality between individual errors (wrongly named entities) and relation errors. If a model is "smart" enough to name a correct entity, it is usually smart enough to link it correctly.
- MoE Superiority: Mixture-of-Experts (MoE) models like Nous Hermes performed exceptionally well for their size, often rivaling much larger models in accuracy while generating more instances than GPT-3.5.
Key Results
- Accuracy: GPT-3.5 Turbo emerged as the top performer, reaching a quality metric (Q) of 0.924 (where 1.0 is perfect).
- KGFiller vs. State-of-the-Art: When compared to Harvest (a leading baseline), KGFiller’s quality metric was up to 5x higher.
- Error Reduction: KGFiller reduced erroneous entities and relations by up to 10x compared to the baseline.
- Efficiency: While open-source models are free, they suffered from tighter rate limits on Hugging Face. GPT models, though costing a few dollars per run, were significantly faster due to higher API throughput.
Limitations and Future Work
The authors are transparent about the "Oracle's" flaws:
- Hallucinations: In one worrying example, the model Gemma suggested Amanita muscaria (a poisonous mushroom) as an instance of the
Edible Mushroomclass. This highlights that while KGFiller is highly automated, a "human-in-the-loop" is still vital for safety-critical domains. - Sampling Bias: The ontology is limited by what is on the web. Under-represented cultures or niche scientific domains may result in unbalanced ontologies.
- Future Directions: The team aims to expand KGFiller to handle Hierarchy Construction—letting the LLM suggest new classes and sub-classes, not just instances—and extracting procedural knowledge (e.g., the steps of a recipe).
Summary updated