The era of ChatGPT has arrived. It’s a transformative time, so much so that it could be called the third industrial revolution. Nowadays, even my mother uses ChatGPT for her queries, showing how its usage spans generations and keeps expanding. Its broad appeal likely lies in its ability to accurately fetch and convey the information users seek. In an age overwhelmed by information, it selectively provides the necessary details.
Despite significant progress, challenges remain, such as the ‘hallucination’ phenomenon where inaccurate information is provided. This often results from misinterpreting user intent, leading to irrelevant data retrieval. Consequently, this issue causes hesitation in the enterprise world, preventing full adoption of the technology.
Efforts to improve involve four main approaches:
- Building models from scratch: Ensures clear data context but is costly.
- Fine Tuning: Cost-effective and accurate but difficult to balance general and domain-specific contexts and as constantly updated data.
- Adding additional context to queries: Cost-effective but risks subjectivity and bias.
- Providing extra context during responses: Allows for up-to-date, cost-effective responses but is complex to implement.
These methods can be compared based on cost, accuracy, domain-specific terminology, up-to-date responses, transparency, and interpretability.
What is RAG (Retrieval Augmented Generation)?
RAG is a technology designed to effectively interpret user queries, retrieve relevant information, process it into context, and incorporate it into responses. It stands out due to its cost-effectiveness, relative accuracy, capability in providing domain-specific context, ability to reflect the latest information, and transparency in tracing source documents. These characteristics make RAG a preferred approach in many applications.
Baseline RAG was created to address the hallucination issue in a cost effective manner, but there are situations where it underperforms:
- Connecting the dots: Baseline RAG struggles to traverse disparate pieces of information to provide synthesized insights.
- Holistic understanding: It performs poorly when asked to comprehend summarized semantic concepts over large data collections or even single extensive documents.
To address these issues, the tech community is developing methods to extend and enhance RAG. Microsoft Research’s new approach, GraphRAG, uses large language models to create a knowledge graph based on private datasets.
What is Graph RAG?
Before we get into GraphRag, lets understand what knowledge graphs are.
Knowledge graphs have been around for a while, with Google’s knowledge graph being the most notable example. Since 2012, any Google search would bring up cards displaying facts directly relevant to your search.
Historically, knowledge graphs were used to unveil hidden relationships across different data silos, requiring a time-consuming manual process that only big companies invested in due to the effort and domain expertise required.
However, with the rise of LLMs, knowledge graphs have taken a new turn. Now, LLM RAG systems use knowledge graphs differently. They create explicit connections between terms, reducing hallucinations, adding context, and providing memory and personalization for LLMs. This makes RAG systems enterprise-ready and automates knowledge graph creation, increasing their relevance and accessibility.
Knowledge graphs in RAG serve as:
- Data stores for information retrieval.
- Semantic structures for retrieving vector chunks.
Traditional RAG involves searching a text database to find content related to a userʼs query by understanding its intent and context. For example, if the query is about “the health benefits of green tea”, the model retrieves and selects relevant documents based on similarity.
GraphRAG enhances the RAG approach by incorporating a graph database to provide contextual information to LLMs. This method offers structured entity information, improving context, factual accuracy, and language understanding. By combining entity descriptions with their properties and relationships, GraphRAG facilitates deeper insights and better comprehension of specific domains.
Knowledge graphs on the most impactful technologies for 2024!
Why Graphs?
- Structured Representation: Unlike vector databases, knowledge graphs use nodes (entities) and edges (relationships) to create a network, capturing complex relationships and dependencies for nuanced queries.
- Contextual Understanding: Knowledge graphs are ideal for understanding relationships and broader context, using the semantic triple model (subject- predicate-object) to maintain data fidelity and robustness in retrieval.
- Explainability: With explicitly defined relationships, knowledge graphs enhance transparency and trust by allowing the RAG system to trace the path to its answers, making them suitable for applications requiring complex reasoning and inference.
Graph vs Traditional RAG Search on a Financial Report
Graph databases excel in providing comprehensive answers by exhaustively searching interconnected data, ensuring completeness in responses. In contrast, vector indices may miss broader context and interrelationships. For example, understanding all market conditions affecting Apple’s Mac product line requires considering various factors like economic conditions, supply-chain issues, and competitive dynamics.
Below is an experiment I have done following a financial analysis example done on Appleʼs earning transcripts provided by Chia Jeng Yang.
Here are the results:
Question | Traditional | Graph | Difference |
How did executives describe the impact of consumer behavior changes during the pandemic on Apple’s business model? | During the pandemic, changes in consumer behavior significantly impacted the supply of iPhone 14 Pro and iPhone 14 Pro Max. This led to extended shipping times, which Apple had not anticipated. Additionally, the company saw some impact across its products and services, with the most impact on Mac and Wearables, and the least on the iPhone. | Executives described the impact of consumer behavior changes during the pandemic as leading to increased demand for Apple’s products and services. This was particularly noted in remote work, online learning, and digital entertainment. Therefore, the pandemic has positively affected Apple’s business model. | The graph query mentioned the specific impact of consumer behavior within specific segments of consumer behavior (remote work, online learning, and digital entertainment). In the vector query, the answer appeared to talk more generically about pandemic-related impact. |
How did executive discussions detail the relationship between market conditions and Apple’s financial performance in Greater China? | Executive discussions detailed the relationship between market conditions in Greater China and Apple’s financial performance by examining the sales of various Apple products like iPhone, Mac, iPad, and Wearables. They also considered factors such as the installed base and AppleCare. The popularity of specific products like the iPhone 14 Pro and Apple Watch Series 8 was also considered. | The executive discussions detailed the relationship between market conditions and Apple’s financial performance in Greater China by discussing the impact of COVID restrictions and supply constraints on demand and growth. Despite these challenges, Apple saw a marked change in store traffic and demand beginning in December. Furthermore, despite supply shortages, they mentioned a strong cycle for their “Pro” products, indicating their ability to drive consumer choice toward higher-end products. | In the graph query, details about the popularity of specific products were mentioned and explored. In the vector query, the answer seemed to talk more generically about pandemic-related impacts, presumably because of the term ‘market conditions’ as opposed to tying it more closely to performance in China specifically. |
How does Apple balance technological innovation with cost management in its product development? | Apple balances technological innovation and cost management in its product development by adapting to rising component costs and other market conditions. They manage the net of rising and falling component costs, trying to navigate the challenging environment effectively. Apple also continues to invest in innovation and people, focusing on delivering technology that will enrich their customers’ lives and help unlock their creative potential. | Apple balances technological innovation with cost management by heavily investing in research and development for creating advanced products. They also optimize their supply-chain efficiency to manage costs. Additionally, they negotiate favorable pricing with their suppliers to keep costs low. | The graph query answer mentions specific actions like supplier negotiations and supply-chain management. The Vector DB answer is more vague as to ‘navigation of [a] challenging environment’ and ‘investing in innovation’. |
Where do we go from here?
GraphRAG, like RAG, has clear limitations, which include how to form graphs, generate queries for querying these graphs, and ultimately decide how much information to retrieve based on these queries. The main challenges are ‘query generationʼ, ‘reasoning boundaryʼ, and ‘information extraction’. Particularly, the ‘reasoning boundaryʼ poses a significant limitation as optimizing the amount of related information can lead to overload during information retrieval, negatively impacting the core aspect of GraphRAG, which is answer generation.
With that said with GraphRAG taking RAG to the next level, we see this as the start to taking RAG beyond the simple “hello worldˮ proof of concept technology and actually opening to gate for enterprise adaptation of Generative AI.
Are you ready to elevate your enterprise with the power of GraphRAG? Visit our Artificial Intelligence page to learn more and get in touch with our team of AI experts.
We’re also excited to share our next blog, where we’ll dive into how we maintain and update our knowledge base for enterprise RAG implementations to ensure the most up-to-date information is always at your fingertips.
Share your thoughts on GraphRAG and its potential applications in the comments below. Let’s innovate together!