KGGen: Extracting Knowledge Graphs from Plain Text with Language Models

Belinda Mo, Kyssen Yu, Joshua Kazdan, Proud Mpala, Lisa Yu, Charilaos I. Kanatsoulis, Sanmi Koyejo

Abstract

Knowledge Graphs (KGs) are essential for structured reasoning, yet automatically extracting high-quality, dense graphs from unstructured text remains a significant challenge. Existing tools often produce sparse graphs with redundant or overly specific entities and relations. We introduce KGGen, a framework that leverages Large Language Models (LLMs) and iterative clustering to resolve entity and relation ambiguity. Evaluated on a new benchmark, MINE, KGGen demonstrates superior information retention and triple validity compared to state-of-the-art baselines like Microsoft’s GraphRAG.

The Challenge of Automated Knowledge Graph Construction

While the volume of available plain text is vast, converting it into structured subject-predicate-object triples is notoriously difficult. This "Knowledge Bottleneck" stems from two primary issues: entity resolution and relation normalization. Automated extractors often fail to recognize that "Olympic Winter Games" and "Winter Olympics" refer to the same entity, or that "is located in" and "was held in" describe similar relationships. The resulting "sparse" graphs contain isolated nodes, making them unsuitable for downstream tasks like graph embeddings or multi-hop reasoning.

The KGGen Architecture

KGGen addresses sparsity through a multi-stage pipeline that combines structured extraction with iterative resolution. The process begins with extraction using the DSPy framework and Google’s Gemini 2.0 Flash. Unlike simple extractors, KGGen uses a two-step signature: it first identifies all key entities in a text chunk and then predicts relationships specifically between those identified entities to ensure internal consistency.

The KGGen pipeline: iterative entity and relation extraction followed by semantic clustering and LM-based resolution.

The core innovation lies in the Iterative Entity and Edge Resolution phase. The system generates semantic embeddings for all extracted items using S-BERT and groups them via k-means clustering. Within each cluster, an LLM identifies exact duplicates—such as "MRI" and "Magnetic Resonance Imaging"—and selects a canonical representative. This parallelizable process allows KGGen to handle massive datasets efficiently while forcing the graph to "collapse" synonyms into a denser, more interconnected web of knowledge.

Benchmarking and Evaluation

To evaluate performance, the authors introduced the MINE (Measure of Information in Nodes and Edges) benchmark.

  • MINE-1: Evaluates knowledge retention across 100 diverse articles, each paired with 15 ground-truth facts.
  • MINE-2: Measures performance in Retrieval-Augmented Generation (RAG) tasks using the WikiQA dataset.
  • SemEval-2010: Used to validate entity extraction against human-annotated ground truth.

Experimental Results

KGGen significantly outperforms existing tools in both quality and efficiency. On the MINE-1 benchmark, KGGen achieved an information retention score of 66.07%, compared to 47.80% for GraphRAG and 29.84% for OpenIE.

Distribution of facts captured across 100 articles (MINE-1 benchmark), showing KGGen's superior information retention compared to GraphRAG and OpenIE.

Beyond retention, the validity of the extracted triples is notably higher. A manual audit of 100 triples revealed that 98% of KGGen’s extractions were valid. In contrast, OpenIE achieved 55% validity, and GraphRAG struggled with overly verbose, non-standard structures.

Furthermore, KGGen demonstrates superior scaling. In a test involving a 1-million-character corpus, KGGen reused each relation type an average of 10 times, whereas GraphRAG reused them only twice. This indicates that KGGen learns a more generalizable and useful "vocabulary" of relationships as the dataset grows. Processing this corpus took KGGen 551 seconds at a cost of $0.84, while GraphRAG required over 2,000 seconds for the extraction phase alone.

Conclusion and Future Work

KGGen provides a robust solution to the sparsity problem in automated KG construction. While highly effective, the authors note that entity resolution remains a "Goldilocks" problem, where over-consolidation can lead to loss of nuance in specialized domains like medicine. Future iterations of KGGen aim to integrate adaptive ontologies, allowing the system to align extractions with pre-defined domain structures for even greater precision.

Summary updated

BibTeX
@inproceedings{mo2025kggen,
  author = {Belinda Mo and Kyssen Yu and Joshua Kazdan and Proud Mpala and Lisa Yu and Charilaos I. Kanatsoulis and Sanmi Koyejo},
  title = {{KGGen: Extracting Knowledge Graphs from Plain Text with Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=YyhRJXxbpi},
}
Figure