KG + RAG & Schema Inspiration Board

Chia Jeng Yang
WhyHow.AI
Published in
4 min readJun 25, 2024

This is a collection of practical design patterns for KG & RAG that I’ve found in the wild, as well as schemas (not necessarily in KG & RAG systems) used in various systems. The purpose of this article is for people new to schemas or KG & RAG architectures to find inspiration, and not endorsement. It is certainly not exhaustive (or necessarily a measure of quality). I aim to treat this as a living document, and will return to update this article over time. Feel free to comment with any other architectures that deserve to be put in here!

The criteria of which I included examples were:

  • Had a clearly defined architecture that was not a simple KG & RAG implementation. A simple KG & RAG implementation where a graph is created from documents and queried against can be seen here.
  • Ideally had a clearly defined real-life use-case, and were aiming at specific answers for practical questions

A Simple KG & RAG Implementation

For those new to the exciting space of Knowledge Graphs & RAG, check out this primer about how companies have been adopting KGs within RAG pipelines.

Knowledge Graphs are simply structured data stores. A simple KG & RAG Implementation can see a Knowledge Graph working in parallel to a vector database, and sometimes in replacement of a vector database, depending on the use-case. The below image from Langchain demonstrates an architecture that features a parallel search of both a vector database and a graph database when a question is asked, and can be considered a simple KG & RAG implementation.

Customer Service

  • Created by LinkedIn
  • Classifies questions to retrieve most similar historical tickets, and the associated resolution steps, or associated information. The main benefit is around query reformulation into structured categories (i.e. specific tickets), automatic categorization and classification of issues for ancillary flags (Priority/Root Cause), and structured retrieval of ancillary data (“Has_Steps_To_Reproduce”) to ultimately return related but non-semantically similar information.
  • Source: https://arxiv.org/pdf/2404.17723

Healthcare information retrieval

Electronic Healthcare Records

  • Created by a range of Chinese institutions
  • Uses KGs as a means for grounded retrieval of entities, increasing entity extraction
  • Source: https://arxiv.org/pdf/2406.00036

Chain of Reasoning and Context Expansion with KGs

  • Created by a range of Chinese institutions
  • Uses a KG to expand the potentially relevant context so as to bring in additionally potentially relevant information
  • Source: https://arxiv.org/pdf/2312.15883

Schemas

These schemas are not necessarily related to a specific KG & RAG system, but can form inspiration of the type of schemas for different use-cases.

Patient healthcare Record Schema

https://www.slideshare.net/slideshow/harnessing-the-power-of-nlp-and-knowledge-graphs-for-opioid-research/269724649

European Space Agency Space Mission Schema

Clinical Trials Schema

Chemical Reaction Schema

Medical Procedure Booking Schema

Travel Personalization Schema

User Consent Schema

Modeling Time-Series Events Schema

Contractor <> Job Matching Schema

For other schema examples, check out WhyHow.AI’s Open-Source Schema Library here: https://github.com/whyhow-ai/schemas/

WhyHow.AI is building tools to help developers bring more determinism and control to their RAG pipelines using graph structures. If you’re thinking about, in the process of, or have already incorporated knowledge graphs in RAG for accuracy, memory and determinism, we’d love to chat at team@whyhow.ai, or follow our newsletter at WhyHow.AI. Join our discussions about rules, determinism and knowledge graphs in RAG on our Discord.

--

--