Skip to content

Building Knowledge Graphs

Knowledge graphs can be created with the help of Generative AI. Understanding relationships between pieces of information allows the technology to create visual representations of connections, improving information processing.

General Approaches

Natural Language is All a Graph Needs is a very powerful manner of fusing LLMs with KGs using natural language
  • Node classification and self-supervised link predictions.
  • Scaleable natural-English graph prompts for instruction tuning
  • Identifying a central node and doing neighbor sampling and explorations using LLMs.
  • Avoids complex attention mechanisms and tokenizers.

image image

Applications and Examples

Healthcare and Biomedical

Drug Discovery and Repurposing

Knowledge Graph RAG (KG-RAG) consistently enhanced the performance of LLMs across various prompt types, including one-hop and two-hop prompts, drug repurposing queries, biomedical true/false questions, and multiple-choice questions (MCQ). Notably, KG-RAG provides a remarkable 71% boost in the performance of the Llama-2 model on the challenging MCQ dataset.

Disease Validation

Establishing Trust in ChatGPT BioMedical Generated Text

Methods: Through an innovative approach, we construct ontology-based knowledge graphs from authentic medical literature and AI-generated content. Our goal is to distinguish factual information from unverified data.

Results: The findings revealed that while PubMed knowledge graphs exhibit a wealth of disease-symptom terms, some ChatGPT graphs surpass them in the number of connections. The factual link ratio between any two graphs reached its peak at 60%.

Natural Language Processing

Named Entity Recognition

GLiner

A compact NER model trained to identify any type of entity. Leveraging a bidirectional transformer encoder, GLiNER facilitates parallel entity extraction, outperforming both ChatGPT and fine-tuned LLMs in zero-shot evaluations on various NER benchmarks.

Question Answering Systems

Factoid QA using KG lookups

Complex question decomposition and multi####hop reasoning

Recommender Systems

Leveraging KGs for explainable recommendations

LLM-movieagent

This project is designed to implement an agent capable of interacting with a graph database like Neo4j through a semantic layer using OpenAI function calling. The semantic layer equips the agent with a suite of robust tools, allowing it to interact with the graph database based on the user's intent.

Tools and Frameworks

GitHub Repo stars GPT Graph for Knowledge Graph Exploration

Medium

A knowledge graph is a type of database that is used to store and represent knowledge in a machine-readable format. It uses a graph-based model, consisting of nodes (entities) and edges (relationships), to represent information and the connections between them. Knowledge graphs are often used to represent complex information in a structured and intuitive way, making it easier for machines to understand and analyze. They can be used in various domains, such as natural language processing, search engines, recommendation systems, and data analytics.

It's a unique way to explore information in an organized and intuitive manner. With GPT Graph, you can easily navigate through different topics, discover new relationships between them, and generate creative ideas.

It leverages the power of GPT-3 to generate relevant and high-quality content. Unlike traditional keyword-based searches, GPT Graph takes a more semantic approach to explore the topics and generate the graph. It helps to uncover hidden relationships between different topics and provides a comprehensive view of the entire knowledge domain.

Moreover, GPT Graph provides a user-friendly interface that allows users to interact with the graph easily. Users can ask questions, generate prompts, and add their own ideas to the graph. It's a powerful tool that enables users to collaborate, brainstorm, and generate new insights in a very efficient way.

iText2KG

🔥 A zero-shot method for incremental knowledge graph (KG) construction with resolved entities and relations. This method demonstrates superior performance across three scenarios: converting scientific papers to graphs, websites to graphs, and CVs to graphs.

✅ iText2KG addresses key limitations in current KG construction methods: - Reliance on predefined ontologies - Topic dependency - Need for extensive supervised training - Entity and Relation Resolution challenges

Key modules: 💡 Document Distiller 💡 Incremental Entity Extractor (iEntities Extractor) 💡 Incremental Relation Extractor (iRelations Extractor) 💡 Graph Integrator and Visualization module

The package integrates with Neo4j for intuitive graph visualization.

Docs2KG: Unified Knowledge Graph Construction

Even for a conservative estimate, 80% of enterprise data reside in unstructured files, stored in data lakes that accommodate heterogeneous formats. Classical search engines can no longer meet information seeking needs, especially when the task is to browse and explore for insight formulation. Knowledge graphs, due to their natural visual appeals that reduce the human cognitive load, become the winning candidate for heterogeneous data integration and knowledge representation.

Semantic Layer Integration

Blog

Knowledge graphs provide a great representation of data with flexible data schema that can store structured and unstructured information. You can use Cypher statements to retrieve information from a graph database like Neo4j. One option is to use LLMs to generate Cypher statements. While that option provides excellent flexibility, the truth is that base LLMs are still brittle at consistently generating precise Cypher statements. Therefore, we need to look for an alternative to guarantee consistency and robustness. What if, instead of developing Cypher statements, the LLM extracts parameters from user input and uses predefined functions or Cypher templates based on the user intent? In short, you could provide the LLM with a set of predefined tools and instructions on when and how to use them based on the user input, which is also known as the semantic layer.

Ontology Mapping

Shows how LLMs can be used for ontology mapping and knowledge graph extraction through prompting.

GitHub Repo stars OntoGPT

Uses two different methods to query knowledge graphs using LLMs: - SPIRES: Structured Prompt Interrogation and Recursive Extraction of Semantics - SPINDOCTOR: Structured Prompt Interpolation of Narrative Descriptions Or Controlled Terms for Ontological Reporting

Universal Preprocessing Operators for Embedding Knowledge Graphs with Literals

Github Proposes a set of preprocessing operators that can transform KGs to be embedded within any method. image

Multimodal learning with graphs

While not strictly GenAI focused, this introduces a comprehensive manner of combining cross-modal dependencies using geometric relationships. image