RAG (retrieval-augmented generation) is the technique that lets an AI model answer with your company's information: before replying, it looks for the document fragments most similar to the question and passes them to the model as context. GraphRAG adds a step: it builds a knowledge graph, that is, a map of identities (each customer, contract or person, only once) and of how they relate, and uses it to answer questions that span many documents. Both handle questions about text well. Neither handles "how much have we invoiced this customer this quarter" well: that is a query on the data, not a text search. In this article I explain what each technique is, where it falls short, how they differ and how to choose.
What RAG is and how it works
RAG connects a language model to documents it does not know, without retraining it. The term comes from a 2020 research paper (Lewis et al., "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks"), and today it is the most common way to make an assistant answer with a company's documents.
It works in three steps:
- Prepare. Documents are split into fragments and each fragment is turned into an embedding: a list of numbers that represents its meaning. They are stored in a vector database.
- Retrieve. When someone asks, the question is also turned into an embedding and the fragments with the closest meaning are retrieved.
- Generate. The model receives the question together with those fragments and writes the answer, ideally citing where it comes from.
Its great advantage is that it is quick to set up and does not require organising anything first: having the documents is enough. That is why it is the starting point of almost every internal assistant.
Where RAG falls short
RAG finds fragments similar to the question, but it does not understand how things relate. It works well when the answer is written in one or two fragments, and badly in three cases:
- Questions that span documents. "Which contracts with healthcare customers expire this year and who signed them?". The answer is spread across the contract, the customer record and the signature log. No single fragment contains all of it.
- Global questions. "What are the most frequent customer complaints this year?". You have to read everything, not the five most similar fragments. The GraphRAG authors point it out themselves: RAG fails on questions directed at an entire collection of documents (Edge et al., 2024).
- Questions with figures. "How much did we invoice this customer in September?". A fragment may mention an amount, but there is no guarantee that it is the right one or that it is complete. A sum is not searched for: it is calculated.
What a semantic graph (or knowledge graph) is
A semantic graph, also called a knowledge graph, is a map of the business made of identities and relationships: each customer, contract, invoice or person appears only once, and the connections between them are written explicitly and with their meaning. Google popularised the term "knowledge graph" in 2012 with an idea that sums it up well: searching for "things, not strings" (Google, "Introducing the Knowledge Graph"). At Opendome we call it a semantic graph because what matters is not the drawing, but that each thing has an agreed meaning.
It has three parts:
- Identities. They are the business objects, each one only once. The same customer appears in the ERP, in the CRM and in billing, sometimes written in different ways ("ACME", "Acme Ltd"), and in the graph it is a single identity. That is why the first step is always identity resolution.
- Relationships. They are the connections between identities, and each one has a name: the customer has the contract, the contract was signed by a person, the invoice belongs to an order.
- Definitions. They say what each thing means and how each metric is calculated: what an active customer is or when an invoice is overdue. They are the same for people, applications and agents.
Documents are also anchored to the graph. The contract PDF hangs from the contract's identity, and the email with a complaint, from the customer's. That way, a single question can walk the relationships and read only the text it needs.
The difference from a folder of documents is that the relationships are explicit. To find out who signed the contracts that expire this year, you walk the graph: contracts that expire → who signed them. You do not have to trust that a text fragment says so.
A semantic graph does not have to be built from documents. In a company, much of what it needs is already in the ERP and the CRM: customers, invoices, orders, owners. The layer that resolves those identities, relates them and gives them meaning is called a semantic layer.
What GraphRAG is
GraphRAG is RAG supported by a knowledge graph. The best-known version was published by Microsoft in 2024 (GraphRAG): a language model reads the documents and extracts identities and relationships from them. It then groups related identities and writes a summary of each group. When answering, it uses those summaries and the relationships, not just the similar fragments.
It wins on questions that span documents and on global questions. In exchange:
- It costs more to prepare. Building the graph requires the model to read every document. Microsoft's documentation warns that it can consume a lot of resources and recommends starting with little data and cheap models.
- The graph can be wrong. It is extracted by a model, so it can invent a relationship or resolve identities badly: if it does not recognise that "ACME" and "Acme Ltd" are the same customer, it creates two. It has to be reviewed.
- It has to be kept up to date. When the documents change, the extraction has to be run again.
RAG, GraphRAG and querying the data: differences
| RAG | GraphRAG | Querying the data (SQL over a semantic layer) | |
|---|---|---|---|
| What it solves | Questions whose answer is written in a few fragments | Questions that span documents and global questions | Exact figures, lists and filters |
| What it works on | Documents | Documents and the graph extracted from them | Structured data: ERP, CRM, accounting |
| Example | "What does the internal travel guideline say about hotels?" | "Which topics recur in this year's complaints?" | "How much did we invoice this customer in September?" |
| Preparation cost | Low | High | Medium: resolve identities once and define the metrics |
| Reliability of the answer | Depends on which fragments it finds | Depends on the quality of the graph | Exact, if the metric definition is correct |
Most business questions mix all three. "Which customers with overdue invoices have a maintenance contract, and what does the penalty clause say?" needs a query (overdue invoices), a relationship (customer → contract) and a text fragment (the clause). Choosing a single technique forces the questions that do not fit.
How to choose: four questions
- Is the answer written somewhere? If it is an internal guideline, a manual or a contract, start with RAG.
- Do you need to combine information from many documents or from the whole collection? Then you need a graph.
- Does it involve figures, sums, dates or exact filters? Then it is not a text search: it is a query on the data, and the AI must generate it and run it, not guess it.
- Are your customers, contracts and invoices already in your systems? If they are in the ERP and the CRM, the graph does not have to be extracted from documents: it is built from that data, which is more reliable, by resolving its identities.
What no technique changes: access policy and data quality
Neither RAG nor GraphRAG nor a query knows, on its own, what each person may see. If the document index is built without respecting who could see each document in its source system, an assistant can answer a salesperson with a fragment from the payroll folder. OWASP lists it among the top ten risks of applications built on language models: inadequate access controls on embeddings lead to unauthorised access and data leaks (OWASP LLM08:2025).
The rule is the same as for any system: each subject sees only what its policy allows: the user with their role and the agent, which is a subject in its own right, with its own policies, and never uses a user's credentials. That is decided by an access policy, evaluated on every query, not when the index is built. A policy is more than a list of permissions: it can limit which entities, which rows and which columns each subject sees. We explain it in guardrails and data security.
And quality rules: if the ERP has three records for the same customer, the graph will have three customers. Preparing the data includes resolving identities: making those three records recognised as a single customer, a single identity, even if it is written in three ways. No retrieval technique fixes badly prepared data.
How we do it at Opendome
At Opendome we do not choose between the three techniques: we put them under one layer. OSL, Opendome's semantic layer, is a semantic graph of your business: it starts from identities that are already resolved (each customer, contract or invoice, only once even if it lives in several systems), defines how they relate and what each metric means, and anchors documents to them.
When an agent asks, OSL decides the path:
- it turns the figures part into a SQL query that runs on Trino;
- it turns the text part into a search over the documents, stored in Lance;
- it applies the same access policy to both, by subject, entity, row and column.
Each metric has a single definition, the same for applications, APIs and agents. More detail in Technology and in AI memory is in the data.
Conclusion
RAG is the starting point for making AI answer with your documents. GraphRAG adds the relationships RAG cannot see. Exact figures need a query on the data, not a text search. The useful question is not "RAG or GraphRAG?", but "what kind of questions will the agent answer?". Most business questions mix all three kinds, and that is why it pays to have a common map of identities, a single definition of each metric and an access policy applied the same way on every path.
Sources
- Lewis, P. et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. arXiv.
- Edge, D. et al. (2024). From Local to Global: A Graph RAG Approach to Query-Focused Summarization. arXiv.
- Microsoft. GraphRAG documentation.
- Google (2012). Introducing the Knowledge Graph: things, not strings.
- OWASP (2025). LLM08:2025 Vector and Embedding Weaknesses.