MM Ep-114 – Semantics Shift Left: Knowledge Graph to Augment RAG Capabilities!

Semantic KNowledge Graph

Knowledge graphs have been there for quite some time.

However, they have now evolved from niche semantic web experiments into the architectural backbone of modern enterprise AI. In fact, this has done shift-lefting of data semantics from applications directly into the data infrastructure.

Hence, knowledge graphs provide a deterministic, context-rich foundation for AI-first agents.

Generative AI and agentic systems drastically enhance their capability by using these knowledge graphs.

In this episode of our newsletter, we are going to walk through two very important aspects of knowledge graphs and how they are fundamentally different from Vector database.

We will look at how they compensate for the design limitations of Retrieval-Augmented Generation (RAG) supported by vector databases using content chunks.

So, Let's dive in.

Connecting the Dots

Vector databases excel in providing contextual information in a single semantic lookup.

However, it encounters a problem when an user asks a multi-hop question like:

"What components in our software supply chain are vulnerable to the exploit that affected Project Alpha last month?"

This is called a multi-hop blind spot. Because multiple queries are needed to find out the answer to this question.

Retrieval-Augmented Generation using simple vector chunks to solve this problem is difficult. If it has to do this, it would need to look for chunks of text containing "supply chain", "vulnerable", and "Project Alpha".

It will likely pull back the post-mortem of Project Alpha. But it cannot traverse the actual dependency tree to find out the other projects using the exact same sub-components.

With strong reasoning models (LLM), you might address this with a large corpus of documents, ONLY at a higher token cost. But you still run the risk of hallucinating the answer (unless you control the temperature switch in API call).

So, neither with standard Retrieval-Augmented generation nor with the LLM alone can we solve this problem easily.

This is where Graph Retrieval-Augmented Generation with graph approaches tackles this problem.

  • It uses a vector search to identify Project Alpha.
  • Then it physically hops along the graph relationships:
    Project Alpha –> Uses Component X –> Component X is Used By Project Alpha/Beta.

This delivers a mathematically precise, structural answer. This works because the knowledge graph has the information stored in the form of nodes.

And those relationships help in analysing the causal relationships or the dependencies of factors as asked in the question.

Surprisingly, in this case, the token cost is low because we are still using a RAG solution. And the rate of hallucination is also extremely low because the LLM is not guessing the connection logic.

The Global Summary Problem

The global summary problem is similar to the earlier problem but has a slightly different implication.

Traditional vector RAG chunks data into isolated paragraphs.

Assume that an user asks, "What were the top three main causes of product delays across all Q3 project reports?"

Then a vector RAG solution merely pulls in 10 to 20 random text chunks (top k) that mention "delays".

And then it tries to find out a cause-and-effect relationship amongst that extracted output and craft and summary (potentially using a LLM). Consequently, it completely misses the broader systemic themes because it lacks a global view of how these chunks relate to each other.

So, the operative word here is "relationship".

And this is super important for using "relationships" as additional contextual information. While we are looking for the relationship of information in traditional RAG, we miss out that context..

Knowledge Graph RAG architectures (e.g. Microsoft's Graph RAG framework) address this problem differently. And hence, while you are working on Copilot, since it uses the graph architecture of documents stored in SharePoint or Teams, it uses those causal relationships available in the knowledge graph much more efficiently.

As a result, the output is going to be much more insightful.

Big Picture vs Specialized Opinions

In calculus, there is an important concept of Global and Local maxima.

When you look at a curved, non-linear function like a mountain range with many peaks and valleys. The mathematical derivative, or the slope, becomes zero at the top of any peak. And so, those peaks are determined based on their surroundings.

A peak that is higher than its immediate neighbours is a local maximum.

And the highest peak across the entire domain is a global maximum.

Traditional vector RAG operates like a local optimisation algorithm, trying to find out the local maximum. It is highly localised and narrow.

When you give it a query, it searches for your specific data points and text chunks that are closest to the exact phrase in the vector space, which is called a collection lookup.

GraphRAG, on the other hand, is built to solve the global optimisation problem in unstructured data retrieval.

This has massive usage in summarising information, finding out causal relationships, and being able to relate one set of information with another set of information – more efficiently when accessing enterprise data.

In conclusion…

During World War II, translating a single intercepted German radio message could give local tactical data, such as the current and past location of a specific boat, but it would have failed to tell us the adversary's grand, overarching strategy across the Atlantic.

Alan Turing and the Bletchley Park team changed this by building the Bombe machine.

They mapped the entire communication network of the German military. They used metadata, recurring weather patterns, repetitive sign-offs, and the relationships across thousands of messages.

Through this, they achieved a global network of intelligence that shortened World War II by several years.

Using a tech break through.

In a way, they found out the first knowledge graph of our race.

And it was much more powerful to have a broad overview of the landscape & strategy than just specific information.

That's all for this week's episode of the newsletter.

Hope, this was useful..

Till the next episode.


This post originally appeared in the Monday Muse newsletter – weekly insights for enterprise and solution architects navigating digital transformation. Subscribe here.

Leave a Reply

Your email address will not be published. Required fields are marked *