Skip to content

Knowledge graphs

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

Description of Graphs for LLMs

Unifying Large Language Models and Knowledge Graphs: A Roadmap


[GPT4Graph: Can Large Language Models Understand Graph sTructure Data? An Empirical Evaluation and Benchmarking"]

image image

Other examples

GitHub Repo stars Enhancing LLMs with Semantic-layers

Blog Enhancing Interaction between Language Models and Graph Databases via a Semantic Layer

"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."

GitHub Repo stars OntoGPT uses two different methods to query knowledge graphs using LLMS

Uses SPIRES: Structured Prompt Interrogation and Recursive Extraction of Semantics A Zero-shot learning (ZSL) approach to extracting nested semantic structures from text This approach takes two inputs - 1) LinkML schema 2) free text, and outputs knowledge in a structure conformant with the supplied schema in JSON, YAML, RDF or OWL formats Uses GPT-3.5-turbo, GPT-4, or one of a variety of open LLMs on your local machine SPINDOCTOR: Structured Prompt Interpolation of Narrative Descriptions Or Controlled Terms for Ontological Reporting

Universal Preprocessing Operators for Embedding Knowledge Graphs with Literals proposes a set of preprocessing operators that can transform KGs to be embedded within any method.

Github image

Other Papers and utilities

Multimodal learning with graphs

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


GitHub Repo stars is an open-source Python library for generating synthetic yet realistic schemas and (KGs) PyGraft based on user-specified parameters.