Knowledge Graph Efficient Construction: Embedding Chain-of-Thought into LLMs

Jixuan Nie, Xia Hou, Wenfeng Song, Xuan Wang, Xingliang Jin, Xinyu Zhang, ShuoZhe Zhang, Jiaqi ShiWorkshops @ VLDB 2024

Abstract

Knowledge Graph (KG) construction from unstructured text often suffers from inconsistent relational expressions and "semantic noise." This paper introduces the CoT_Ontology framework, which integrates domain-specific ontologies with Chain-of-Thought (CoT) prompting. By guiding Large Language Models (LLMs) through a structured three-step reasoning process—entity identification, relation extraction, and ontology alignment—the framework significantly improves extraction accuracy and schema conformance. Experimental results across ten domains demonstrate substantial gains in F1 scores and a marked reduction in relational diversity compared to standard zero-shot approaches.

Introduction

Building a Knowledge Graph involves extracting triples (Subject-Predicate-Object) from text. While LLMs excel at language understanding, they often lack the consistency required for structured data. In zero-shot settings, models frequently produce varied labels for the same relationship (e.g., "directed by" vs. "is the director of"), necessitating expensive manual alignment. Furthermore, models may extract irrelevant information that does not align with the target domain's schema.

The CoT_Ontology Framework

The proposed framework addresses these challenges by moving from simple extraction prompts to a guided cognitive process.

Comparison of traditional KG construction (A) vs. the proposed CoT-Ontology method (B).

The CoT_Ontology method consists of three primary components:

  1. Ontology Integration: A simplified domain ontology, listing valid entity types and allowed relationships, is included in the prompt to act as a structural constraint.
  2. Chain-of-Thought (CoT) Prompting: The model follows a sequential "Thinking Process":
  3. Step 1: Identify all entities within the sentence.
  4. Step 2: Determine the relationships between these entities.
  5. Step 3: Map the identified entities and relationships to the provided ontology.
  6. In-Context Learning (ICL) Format: Instructions are presented in a dialogue-like format. This approach prevents the "dilution" of the reasoning chain that often occurs in long, single-block prompts, ensuring the model remains focused on the structured output.

Experimental Setup

The framework was evaluated using the TekGen dataset, a benchmark for ontology-driven KG generation. The study covered ten diverse sub-domains, including Movie, Music, Sport, Book, Military, Computer, Space, Politics, Nature, and Culture. This dataset provides pre-defined ontologies and ground-truth triples, enabling direct comparison against a "gold standard."

Key Results and Discussion

The CoT_Ontology method was compared against a base extraction model (A) and a model with ontology constraints but no CoT reasoning (B). The CoT_Ontology method (C) showed superior performance across nearly all metrics.

Precision, Recall, and F1 scores across ten domains comparing base (A), ontology-only (B), and CoT-Ontology (C) methods.

Performance Gains

As shown in the results table, the F1 scores improved significantly. For example, in the Military domain, the F1 score rose from 0.2680 (Base) to 0.6205 (CoT_Ontology). Similar trends were observed in the Space and Computer domains.

Ontology Conformance and Noise Reduction

The method markedly increased Ontology Conformance (OC) values. By forcing the model to align with the schema during the reasoning phase, the diversity of relational expressions dropped. In the Movie domain, unique relationship types were reduced from 1,472 in the base model to just 246 with CoT_Ontology, greatly simplifying the resulting knowledge graph.

Insights

  • Constraints as Filters: Providing an ontology prevents the model from hallucinating irrelevant relationships by defining the boundaries of the domain.
  • Reasoning for Standardization: CoT prompting effectively standardizes natural language variations into consistent schema labels.
  • Prompt Engineering: Structuring prompts as dialogue (ICL) is more effective than monolithic instruction blocks for maintaining reasoning potency.

Limitations and Future Directions

Despite its success, the model faces challenges with pronoun resolution. Ambiguous references (e.g., "it") often lead to missed extractions (lower recall). Future work could explore integrating coreference resolution modules or training LLMs on ontology-aware datasets to embed structural awareness directly into the model weights. Additionally, expanding the framework to handle complex ontological axioms, such as hierarchical relationships, remains an open area for research.

Summary updated

BibTeX
@inproceedings{nie2024knowledge,
  author = {Jixuan Nie and Xia Hou and Wenfeng Song and Xuan Wang and Xingliang Jin and Xinyu Zhang and ShuoZhe Zhang and Jiaqi Shi},
  title = {{Knowledge Graph Efficient Construction: Embedding Chain-of-Thought into LLMs}},
  booktitle = {Workshops @ VLDB},
  year = {2024},
}
Figure