Data as of Sep 14, 2026 · Based on 293 AI responses from ChatGPT Search and Google AI Mode · See how Parse measures this
To build a knowledge graph queryable by an LLM, you must pair a graph database with an AI framework. Neo4j is widely recognized as the industry standard for graph-native storage, while
LangChain and
LlamaIndex serve as essential middleware to translate natural language queries into graph-readable operations. Depending on specific scale or performance needs, alternative databases like , TigerGraph, or PuppyGraph are recommended.
Brands AI recommends here
Named in 76% of answers
Named in 63% of answers
This framework acts as the vital bridge, using its LLM Graph Transformer to pull unstructured data and convert it into a graph format suitable for querying, simplifyng the developer workflow.
Named in 48% of answers
Named in 28% of answers
Yes. What you want is essentially a **GraphRAG architecture**: a knowledge graph acts as structured memory, while an LLM uses graph traversal + semantic retrieval to assemble the context needed to answer questions. A strong production architecture would look like: ```
Yes. What you want is essentially a GraphRAG architecture: a knowledge graph acts as structured memory, while an LLM uses graph traversal + semantic retrieval to assemble the context needed to answer questions.
A strong production architecture would look like:
┌──────────────────┐
│ Source data │
│ PDFs / DB / APIs │
└────────┬─────────┘
│
▼
┌─────────────────────┐
│ Entity/relationship │
│ extraction │
│ (LLM) │
└──────────┬──────────┘
│
▼
┌─────────────────────────────┐
│ Knowledge Graph │
│ │
│ Person ──WORKS_FOR──> Org │
│ │ │
│ └──LOCATED_IN──> City │
└─────────────┬───────────────┘
│
┌──────────────┴──────────────┐
▼ ▼
Graph traversal Vector search
/ Cypher / GQL / embeddings
│ │
└──────────────┬──────────────┘
▼
┌──────────────┐
│ Retriever │
└──────┬───────┘
▼
┌──────────────┐
│ LLM │
└──────┬───────┘
▼
Answer + sources
For a new system, I'd strongly consider:
Neo4j's current GraphRAG package explicitly supports a driver → retriever → LLM → GraphRAG pipeline, including vector retrieval and multiple LLM providers.
For example, conceptually your graph might contain:
(:Person {
id: "person:123",
name: "Jane Smith"
})
(:Company {
id: "company:456",
name: "Acme Corp"
})
(:Document {
id: "doc:789",
source: "...",
title: "Annual Report 2025"
})
(:Person)-[:WORKS_FOR {
since: 2021,
source: "doc:789"
}]->(:Company)
Then the LLM doesn't need to memorize the information. It can ask the retrieval layer something like:
"What companies has Jane Smith worked for, and when?" The retrieval system can traverse:
MATCH (p:Person {name: "Jane Smith"})-[r:WORKS_FOR]->(c:Company)
RETURN p.name, r.since, c.name
ORDER BY r.since
and feed the resulting structured facts—and ideally their source passages—into the LLM.
This is an important design decision.
I'd build a hybrid GraphRAG system, rather than expecting the LLM to answer everything through graph queries.
Use:
Graph retrieval for questions involving relationships:
"Which customers are connected to projects using technology X?" Vector retrieval for questions involving concepts or passages:
"What does our policy say about employee relocation?" Graph + vector retrieval for complex questions:
"Which customers affected by the 2025 pricing change are also using product X, and what concerns did they raise?" This is close to the approach Microsoft describes for GraphRAG: its indexing pipeline extracts entities, relationships and claims, creates communities/summaries, and also embeds text; its query layer supports local, global, DRIFT, and basic/vector search.
I would not start by dumping documents into an LLM and letting it invent arbitrary nodes and relationships.
Define a domain schema such as:
Person
Organization
Product
Project
Location
Document
Event
Claim
with controlled relationships:
WORKS_FOR
OWNS
MANAGES
USES
LOCATED_IN
PART_OF
DEPENDS_ON
MENTIONS
SUPPORTED_BY
CONTRADICTS
Then constrain extraction to that schema.
Neo4j's current knowledge-graph builder follows essentially this pattern: documents are chunked, a schema grounds the extracted node/relationship types, entities and relations are extracted, and the resulting graph can be pruned against the schema.
This is arguably the most important production feature.
Don't store merely:
Alice --WORKS_FOR--> Acme
Store something closer to:
Alice
│
│ WORKS_FOR
│
▼
Acme
Evidence:
document_id = 8472
chunk_id = 193
source_url = ...
extracted_at = ...
confidence = ...
That lets the LLM answer:
Jane Smith works for Acme Corp. and also give you:
Source: Annual Report 2025, page 42. It makes the system substantially easier to audit and debug.
There are two good patterns.
The safest approach is to expose tools such as:
search_entities(name, type)
get_entity(id)
get_neighbors(id, relationship_types)
find_path(source, target)
search_documents(query)
get_evidence(fact_id)
The LLM calls these tools rather than having unrestricted access to the database.
For more flexible analytical questions:
User question
↓
LLM
↓
Generate Cypher/GQL
↓
Validate query
↓
Execute against graph
↓
Return structured results
↓
LLM synthesizes answer
This is powerful, but don't execute arbitrary LLM-generated database queries without validation and permissions.
Neo4j specifically supports the Text-to-Cypher pattern as part of its GraphRAG ecosystem.
I'd build the ingestion pipeline like this:
PDF / HTML / Word / database
↓
text extraction
↓
chunking
↓
entity extraction
↓
relationship extraction
↓
entity resolution
↓
schema validation
↓
graph insertion
↓
embeddings/index
↓
provenance links
Entity resolution is particularly important.
For example, these should become the same entity:
"IBM"
"International Business Machines"
"IBM Corp."
"International Business Machines Corporation"
rather than four separate companies.
Microsoft's GraphRAG project is useful if your primary problem is turning a large corpus of unstructured documents into a graph-oriented retrieval system. It automatically extracts entities/relationships and builds hierarchical communities and summaries.
However, Microsoft currently describes the project as largely being in maintenance mode, so I would be cautious about making it the core long-term database layer.
For a system where you own the knowledge graph and expect to evolve its schema, I'd lean toward Neo4j + a custom/Neo4j GraphRAG retrieval layer.
┌─────────────────────┐
│ LLM / Agent │
└──────────┬──────────┘
│
tool calls / RAG
│
┌──────────▼──────────┐
│ Retrieval Layer │
│ │
│ Graph │ Vector │ KV │
└───┬─────┬──────┬────┘
│ │ │
┌───────▼─┐ ┌─▼────┐ │
│ Neo4j │ │Vector│ │
│ KG │ │Index │ │
└─────────┘ └──────┘ │
│
┌──────▼──────┐
│ Source data │
└─────────────┘
If you tell me what your source data is (documents, database records, APIs, etc.) and roughly how large it is, I can design the actual schema, ingestion pipeline, retrieval API, and LLM query flow for your use case—including a concrete Neo4j schema and Python implementation.
Neo4j's current GraphRAG package explicitly supports a driver → retriever → LLM → GraphRAG pipeline, including vector retrieval and multiple LLM providers.
For example, conceptually your graph might contain:
- Knowledge Graph (KG) integration for LLMs bridges the gap between static training data and dynamic, fact-based retrieval, often called GraphRAG. - Graph Database / Store: Neo4j, NebulaGraph, or Amazon Neptune to store nodes and edges. - LLM Orchestration Framework: LlamaIndex or LangChain to parse, extract, and…
SimpleGraphRAG ) to process unstructured text into triples:(S u b j e c t,P r e d i c a t e,O b j e c t).If you'd like, let me know:
I can help you write a starter script or design a custom schema for your project.
No sources cited
You can build an LLM-queryable knowledge graph by pairing a graph database like Neo4j or [Amazon Neptune](https://aws.amazon.com/neptune/) with an orchestration framework that supports **GraphRAG** or **Text-to-Cypher** agents.[](https://www.youtube.com/watch?v=XTymDPwJVWk&t=449)…
You can build an LLM-queryable knowledge graph by pairing a graph database like Neo4j or Amazon Neptune with an orchestration framework that supports GraphRAG or Text-to-Cypher agents.
To set this up effectively, you need a structured workflow that bridges natural language and structured graph data without relying purely on brittle syntax generation.
| Tool / Platform | Primary Function | Best For |
|---|---|---|
| Neo4j GenAI Tools | Graph construction & vector/graph retrieval | Extracting unstructured data (PDFs, web) directly into a queryable graph |
| Amazon Neptune | Managed graph database service | Cloud-scale deployments using Bedrock and custom agent toolsets |
| CocoIndex | Real-time data transformation | Automating semantic triple extraction and syncing documents to graph stores |
Watch this walkthrough on connecting a graph database directly to an LLM for natural language chats:
47s
Graph DB to LLM: Chat with Structured Data (NO Cypher/SQL)1.4K views · 10 months ago
YouTube · InfoQ
If you want to tailor this, tell me:
I can help you design the precise schema and retrieval pipeline.
Yes. What you want is essentially a **GraphRAG architecture**: a knowledge graph stores entities, relationships, facts, and provenance; an LLM translates natural-language questions into graph/vector retrieval operations; the retrieved subgraph is then supplied to the LLM as grounded context. Microsoft’s GraphRAG…
Yes. What you want is essentially a GraphRAG architecture: a knowledge graph stores entities, relationships, facts, and provenance; an LLM translates natural-language questions into graph/vector retrieval operations; the retrieved subgraph is then supplied to the LLM as grounded context.
Microsoft’s GraphRAG approach explicitly extracts entities, relationships, and claims from documents, builds communities/summaries, and supports local, global, and hybrid retrieval.
┌─────────────────────┐
│ Source Data │
│ PDFs / DB / APIs │
│ emails / webpages │
└──────────┬──────────┘
│
ingestion
▼
┌─────────────────────┐
│ Entity / Relation │
│ Extraction (LLM) │
└──────────┬──────────┘
│
▼
┌────────────────────────────────┐
│ Knowledge Graph │
│ │
│ Person ──WORKS_FOR──> Company │
│ │ │ │
│ └─AUTHORED──> Document │
│ │ │
│ SUPPORTS │
│ ▼ │
│ Claim │
└───────────────┬────────────────┘
│
┌─────────┴──────────┐
│ │
Graph search Vector search
Cypher embeddings
│ │
└─────────┬─────────┘
▼
┌─────────────────┐
│ Context Builder │
└────────┬────────┘
▼
┌─────────┐
│ LLM │
└────┬────┘
▼
Answer + citations
For a production system, I'd strongly consider Neo4j. Its GraphRAG tooling supports graph retrieval, vector retrieval, entity-based retrieval, cluster/global retrieval, and natural-language-to-Cypher querying.
An example graph might look like:
(:Person {
id: "person_123",
name: "Jane Smith"
})
(:Company {
id: "company_456",
name: "Acme Corp"
})
(:Document {
id: "doc_789",
title: "Annual Report 2026",
source: "...",
page: 42
})
(:Claim {
text: "Acme Corp acquired XYZ in 2025",
confidence: 0.94
})
With relationships:
(Jane)-[:WORKS_FOR]->(Acme)
(Acme)-[:ACQUIRED]->(XYZ)
(Claim)-[:ABOUT]->(Acme)
(Claim)-[:SUPPORTED_BY]->(Document)
The provenance relationship is extremely important. Don't just store:
Acme --ACQUIRED--> XYZ
Store where that assertion came from:
Acme
│
└── ACQUIRED ──> XYZ
▲
│
supported by
│
Document 789
│
page 42
That lets the LLM answer and explain why it believes the answer.
Don't give the LLM unrestricted database access.
Instead:
User question
↓
LLM
↓
Intent + entities
↓
Query planner
↓
Cypher / graph retrieval
↓
Validated query
↓
Knowledge graph
For example:
"Which companies acquired businesses founded by former Acme employees?" The LLM could generate something conceptually like:
MATCH
(employee:Person)-[:WORKED_FOR]->(acme:Company {name: "Acme"}),
(employee)-[:FOUNDED]->(target:Company),
(acquirer:Company)-[:ACQUIRED]->(target)
RETURN employee, target, acquirer
Then your application validates the generated query, executes it, and gives the results back to the LLM.
Neo4j explicitly documents this natural-language → graph-query pattern as one of its GraphRAG approaches.
I'd recommend a hybrid graph + vector architecture:
| Retrieval | Good for |
|---|---|
| Graph traversal | Relationships, multi-hop reasoning |
| Vector search | Semantic similarity |
| Full-text search | Names, IDs, exact terms |
| Document chunks | Precise source evidence |
| Community summaries | High-level/global questions |
For example:
Question: "What are the major risks associated with Acme's European expansion?"
Vector search might find relevant documents.
Graph retrieval might discover:
Acme
├── expanding_to → Germany
├── expanding_to → France
├── acquired → EuroCo
├── regulated_by → EU
└── has_risk → Currency Risk
│
└── discussed_in → Risk Report
The combination is much more powerful than either method alone. Neo4j's current GraphRAG documentation describes precisely this combination of vector and structural graph retrieval.
I'd make provenance a first-class part of the schema:
(:Claim)
├── [:ABOUT] → (:Entity)
├── [:SUPPORTED_BY] → (:Document)
├── [:EXTRACTED_FROM] → (:Chunk)
├── [:ASSERTED_AT] → timestamp
├── confidence
└── extraction_model
This gives you the ability to tell the LLM:
{
"claim": "Acme acquired XYZ in 2025",
"source": "annual_report_2025.pdf",
"page": 42,
"confidence": 0.94
}
rather than simply dumping graph nodes into the prompt.
Microsoft's GraphRAG pipeline already implements much of the indexing methodology:
Documents
↓
Text units
↓
Entity extraction
↓
Relationship extraction
↓
Claim extraction
↓
Community detection
↓
Community summaries
↓
Embeddings
↓
Query
It provides local search for questions about specific entities and global search for questions about themes across a corpus.
One caveat: Microsoft's current repository describes GraphRAG as a research project that is largely in maintenance mode, so I would treat it as an architectural reference/tool rather than automatically making it the foundation of a new production platform.
For a new system, my default would be:
┌──────────────────┐
│ Your documents │
└────────┬─────────┘
│
extraction
│
▼
┌──────────────────┐
│ Neo4j │
│ │
│ Graph + vectors │
│ + full text │
└────────┬─────────┘
│
┌─────────┴─────────┐
│ │
Graph retrieval Vector retrieval
│ │
└─────────┬─────────┘
▼
Context builder
│
▼
LLM/API
│
▼
Answer + sources
Neo4j also has a first-party Python GraphRAG package, including retrievers and LLM integration, which makes this architecture relatively straightforward to prototype.
There are actually three different things people mean when they say "knowledge graph for an LLM":
If your goal is "I have a large collection of documents/data and I want an LLM to answer questions by reasoning over the relationships in that data," I'd choose #1 + #2 together: a persistent graph database plus GraphRAG-style retrieval.
If you tell me what your source data is (PDFs, database tables, APIs, web pages, etc.), the approximate size, and the kinds of questions the LLM needs to answer, I can design the actual schema, ingestion pipeline, retrieval strategy, and sample implementation for you.
For a production system, I'd strongly consider Neo4j. Its GraphRAG tooling supports graph retrieval, vector retrieval, entity-based retrieval, cluster/global retrieval, and natural-language-to-Cypher querying.
An example graph might look like:
(:Person {
id: "person_123",
name: "Jane Smith"
})
(:Company {
id: "company_456",
name: "Acme Corp"
})
(:Document {
id: "doc_789",
title: "Annual Report 2026",
source: "...",
page: 42
})
(:Claim {
text: "Acme Corp acquired XYZ in 2025",
confidence: 0.94
})
With relationships:
(Jane)-[:WORKS_FOR]->(Acme)
(Acme)-[:ACQUIRED]->(XYZ)
(Claim)-[:ABOUT]->(Acme)
(Claim)-[:SUPPORTED_BY]->(Document)
The provenance relationship is extremely important. Don't just store:
Acme --ACQUIRED--> XYZ
Store where that assertion came from:
Acme
│
└── ACQUIRED ──> XYZ
▲
│
supported by
│
Document 789
│
page 42
That lets the LLM answer and explain why it believes the answer.
Don't give the LLM unrestricted database access.
Instead:
User question
↓
LLM
↓
Intent + entities
↓
Query planner
↓
Cypher / graph retrieval
↓
Validated query
↓
Knowledge graph
For example:
"Which companies acquired businesses founded by former Acme employees?" The LLM could generate something conceptually like:
MATCH
(employee:Person)-[:WORKED_FOR]->(acme:Company {name: "Acme"}),
(employee)-[:FOUNDED]->(target:Company),
(acquirer:Company)-[:ACQUIRED]->(target)
RETURN employee, target, acquirer
Then your application validates the generated query, executes it, and gives the results back to the LLM.
Neo4j explicitly documents this natural-language → graph-query pattern as one of its GraphRAG approaches.
I'd recommend a hybrid graph + vector architecture:
| Retrieval | Good for |
|---|---|
| Graph traversal | Relationships, multi-hop reasoning |
| Vector search | Semantic similarity |
| Full-text search | Names, IDs, exact terms |
| Document chunks | Precise source evidence |
| Community summaries | High-level/global questions |
For example:
Question: "What are the major risks associated with Acme's European expansion?"
Vector search might find relevant documents.
Graph retrieval might discover:
Acme
├── expanding_to → Germany
├── expanding_to → France
├── acquired → EuroCo
├── regulated_by → EU
└── has_risk → Currency Risk
│
└── discussed_in → Risk Report
The combination is much more powerful than either method alone. Neo4j's current GraphRAG documentation describes precisely this combination of vector and structural graph retrieval.
I'd make provenance a first-class part of the schema:
(:Claim)
├── [:ABOUT] → (:Entity)
├── [:SUPPORTED_BY] → (:Document)
├── [:EXTRACTED_FROM] → (:Chunk)
├── [:ASSERTED_AT] → timestamp
├── confidence
└── extraction_model
This gives you the ability to tell the LLM:
{
"claim": "Acme acquired XYZ in 2025",
"source": "annual_report_2025.pdf",
"page": 42,
"confidence": 0.94
}
rather than simply dumping graph nodes into the prompt.
Microsoft's GraphRAG pipeline already implements much of the indexing methodology:
Documents
↓
Text units
↓
Entity extraction
↓
Relationship extraction
↓
Claim extraction
↓
Community detection
↓
Community summaries
↓
Embeddings
↓
Query
It provides local search for questions about specific entities and global search for questions about themes across a corpus.
One caveat: Microsoft's current repository describes GraphRAG as a research project that is largely in maintenance mode, so I would treat it as an architectural reference/tool rather than automatically making it the foundation of a new production platform.
For a new system, my default would be:
┌──────────────────┐
│ Your documents │
└────────┬─────────┘
│
extraction
│
▼
┌──────────────────┐
│ Neo4j │
│ │
│ Graph + vectors │
│ + full text │
└────────┬─────────┘
│
┌─────────┴─────────┐
│ │
Graph retrieval Vector retrieval
│ │
└─────────┬─────────┘
▼
Context builder
│
▼
LLM/API
│
▼
Answer + sources
Neo4j also has a first-party Python GraphRAG package, including retrievers and LLM integration, which makes this architecture relatively straightforward to prototype.
There are actually three different things people mean when they say "knowledge graph for an LLM":
Setting up a knowledge graph (KG) for a Large Language Model involves choosing how you want to **store** the graph, how the LLM will **query or interact** with it, and how you plan to **extract** the data.[](https://www.kloia.com/blog/knowledge-base-vs-knowledge-graph-llm)…
Setting up a knowledge graph (KG) for a Large Language Model involves choosing how you want to store the graph, how the LLM will query or interact with it, and how you plan to extract the data.
Here is a clean, structured blueprint to get a production-ready LLM-queried knowledge graph up and running.
Phase 1: Choose Your Core Infrastructure
You need a database that handles graph structures natively or an orchestration framework that bridges text to graph.
Phase 2: Pick Your Query Pattern
How an LLM actually extracts value from a knowledge graph generally falls into three design patterns:
Phase 3: Step-by-Step Implementation Blueprint
Person, Organization, Concept ) and primary relationships (e.g., WORKS_FOR, RELATED_TO).(Entity) -> [Relationship] -> (Entity) triplets.To help narrow down the exact tech stack you should use, tell me:
Yes. What you want is essentially a **Knowledge Graph + GraphRAG layer**: the LLM should not just retrieve similar text chunks; it should be able to traverse entities, relationships, attributes, and source documents before generating an answer. A good production architecture is: ```
Yes. What you want is essentially a Knowledge Graph + GraphRAG layer: the LLM should not just retrieve similar text chunks; it should be able to traverse entities, relationships, attributes, and source documents before generating an answer.
A good production architecture is:
┌─────────────────────┐
│ Source Data │
│ PDFs / DB / APIs │
│ Docs / Web / CSV │
└──────────┬──────────┘
│
Entity / Relation
Extraction
│
▼
┌─────────────────────┐
│ Knowledge Graph │
│ │
│ Entity ──REL──> Entity
│ │ │
│ └── Property │
│ │
│ + source/provenance │
└──────────┬──────────┘
│
┌─────────────┼─────────────┐
│ │ │
Vector Graph Full-text
Search Search Search
│ │ │
└─────────────┼─────────────┘
▼
┌─────────────────┐
│ Retriever / │
│ GraphRAG │
└────────┬────────┘
│
relevant context
▼
┌─────────────────┐
│ LLM │
│ │
│ answer + │
│ citations │
└─────────────────┘
For a new system, I'd strongly consider Neo4j + its GraphRAG Python package + your LLM.
Neo4j's current GraphRAG tooling supports vector, full-text, hybrid, Cypher-based, and natural-language-to-Cypher retrieval. Its Text2Cypher retriever can translate a user's question into a Cypher query against the knowledge graph.
The important distinction is that you don't want the LLM directly "querying the graph" with unrestricted access. Instead, give it controlled retrieval tools such as:
search_entities(name)
get_entity(id)
find_relationships(entity_id)
traverse(entity_id, relationship_type, depth)
search_documents(query)
execute_cypher(read_only_query)
Then the LLM can reason over the results.
Suppose your graph contains:
Acme Corp
│
├── manufactures ──> Product X
│ │
│ ├── uses ──> Component A
│ │
│ └── regulated_by ──> FDA
│
└── acquired ──> Beta Corp
│
└── owns ──> Patent 123
The user asks:
"Which products manufactured by companies Acme acquired use components regulated by the FDA?" A vector database might retrieve documents mentioning Acme, FDA, and components.
A graph can actually traverse:
Acme
→ acquired
→ Beta Corp
→ owns
→ ...
and separately:
Acme/Beta
→ manufactures
→ Product
→ uses
→ Component
→ regulated_by
→ FDA
The LLM gets the resulting subgraph and explains the answer.
That's where knowledge graphs become particularly useful for LLMs: multi-hop reasoning over connected facts.
Microsoft's GraphRAG research similarly uses extracted entities and relationships, community detection, summaries, and graph-aware retrieval rather than relying solely on vector similarity.
I would structure each fact approximately like this:
(:Entity {
id,
name,
type,
description
})
(:Document {
id,
title,
uri,
date
})
(:Chunk {
id,
text,
embedding
})
with relationships such as:
(Entity)-[:RELATION {
confidence,
valid_from,
valid_to,
source_id
}]->(Entity)
(Document)-[:CONTAINS]->(Chunk)
(Chunk)-[:MENTIONS]->(Entity)
For example:
(:Person {name: "Alice"})
-[:WORKS_FOR {since: 2023, source: "doc-17"}]->
(:Company {name: "Acme"})
Provenance is critical. Every important relationship should be traceable back to the document/chunk/source from which it was derived. That lets the LLM say why it believes something rather than merely asserting it.
Don't make this "graph vs vector."
Use:
User question
│
┌───────────┴───────────┐
▼ ▼
Vector search Entity search
│ │
└───────────┬───────────┘
▼
Graph traversal
│
┌───────────┴───────────┐
▼ ▼
Relevant facts Source chunks
│ │
└───────────┬───────────┘
▼
LLM
Neo4j explicitly supports combinations such as vector + graph retrieval and hybrid retrieval, including retrieval that expands from matched nodes into their surrounding graph.
I'd build the ingestion pipeline like this:
Documents
↓
chunking
↓
LLM extraction
↓
entities + relationships + claims
↓
entity resolution / deduplication
↓
schema validation
↓
knowledge graph
↓
embeddings
Neo4j's current Knowledge Graph Builder follows essentially this pattern: document loading, text splitting, optional embeddings, schema construction, entity/relation extraction, and graph pruning. Structured LLM output can also be used to make extraction more reliable.
There are actually two different things people mean by "an LLM-queryable knowledge graph":
The LLM asks:
"What is relevant to this question?" The system finds entities, relationships, documents, and neighboring facts.
Best for:
The LLM translates:
"Which customers purchased Product X in 2025?" into something like:
MATCH (c:Customer)-[:PURCHASED]->(p:Product)
WHERE p.name = 'Product X'
AND ...
RETURN c
This is much better for:
In practice, I'd implement both. Neo4j's current tooling supports Text2Cypher alongside other retrieval strategies.
If I were building this today, my default stack would be:
| Layer | Choice |
|---|---|
| Graph DB | Neo4j |
| Graph query | Cypher |
| Embeddings | Your preferred embedding model |
| Vector search | Neo4j vector indexes |
| Retrieval | Hybrid graph + vector |
| LLM | Your preferred frontier model |
| Extraction | Structured LLM output |
| API | Python/FastAPI |
| Provenance | Document → Chunk → Entity/Relationship |
| LLM interface | Tool/function calling |
You can also use Microsoft's GraphRAG methodology, although its current repository describes itself as largely in maintenance mode; for a new production application, I'd lean toward a maintained graph database/GraphRAG framework rather than building directly around that research repository.
Don't make the architecture:
LLM → vector DB → text → answer
Make it:
LLM
│
▼
Query planner
│
├── semantic retrieval
├── entity lookup
├── graph traversal
├── Cypher query
└── source retrieval
│
▼
evidence set
│
▼
LLM
│
▼
answer + provenance
That gives you a queryable, inspectable memory layer rather than just a document-search system.
If you tell me what kind of data you want the graph to contain (e.g. company documents, scientific literature, customer data, code, legal documents, or a mix), I can design the actual schema, ingestion pipeline, retrieval strategy, and API for it.
Acme/Beta
→ manufactures
→ Product
→ uses
→ Component
→ regulated_by
→ FDA
The LLM gets the resulting subgraph and explains the answer.
That's where knowledge graphs become particularly useful for LLMs: multi-hop reasoning over connected facts.
Microsoft's GraphRAG research similarly uses extracted entities and relationships, community detection, summaries, and graph-aware retrieval rather than relying solely on vector similarity.
I would structure each fact approximately like this:
Connecting a knowledge graph (KG) to a Large Language Model—often referred to as **GraphRAG** or hybrid retrieval—is one of the best ways to eliminate hallucinations, handle multi-hop reasoning, and give your LLM a structured "memory".[](https://www.youtube.com/watch?v=XNneh6-eyPg&t=14)…
Connecting a knowledge graph (KG) to a Large Language Model—often referred to as GraphRAG or hybrid retrieval—is one of the best ways to eliminate hallucinations, handle multi-hop reasoning, and give your LLM a structured "memory".
To build or query a knowledge graph with an LLM, you typically choose between three implementation paths depending on your stack and goals:
If you want to ingest documents, automatically extract entities/relationships using an LLM, and query them without managing a heavy database infrastructure from scratch:
PropertyGraphIndex.LLMGraphTransformer ) to parse text into graph documents and query tools for Neo4j, NetworkX, and other backends.If you need high-performance querying, persistent storage, and transactional safety:
neo4j-graphrag ) that translate natural language queries into Cypher or perform hybrid vector + graph searches.To help narrow down the best architecture for your project, tell me:
Yes. If your goal is **“an LLM can ask questions over a structured body of knowledge, follow relationships, and produce grounded answers,”** I’d build a **Knowledge Graph + GraphRAG layer**, rather than giving the LLM direct access to a raw graph. A strong current architecture is **Neo4j + an LLM + vector/full-text…
Yes. If your goal is “an LLM can ask questions over a structured body of knowledge, follow relationships, and produce grounded answers,” I’d build a Knowledge Graph + GraphRAG layer, rather than giving the LLM direct access to a raw graph.
A strong current architecture is Neo4j + an LLM + vector/full-text retrieval + Cypher. Neo4j’s official GraphRAG package now supports knowledge-graph construction, vector retrieval, hybrid retrieval, and Text-to-Cypher.
┌─────────────────────┐
│ Source Material │
│ PDFs / DB / APIs / │
│ Documents │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ KG Construction │
│ │
│ Entity extraction │
│ Relation extraction│
│ Entity resolution │
│ Schema validation │
└──────────┬──────────┘
│
▼
┌──────────────────────────┐
│ Knowledge Graph │
│ │
│ Person ──WORKS_FOR──► Org│
│ │ │
│ └──LOCATED_IN──► Place │
│ │
│ + provenance + metadata │
└────────────┬─────────────┘
│
┌─────────────┴─────────────┐
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ Vector Search │ │ Graph / Cypher │
│ │ │ │
│ semantic │ │ exact relations │
│ retrieval │ │ multi-hop │
└────────┬────────┘ └────────┬────────┘
│ │
└─────────────┬─────────────┘
▼
┌─────────────────────┐
│ LLM / GraphRAG │
│ │
│ question → retrieve │
│ context → answer │
└──────────┬──────────┘
▼
User's answer
Because a knowledge graph gives the LLM something vectors don't naturally represent:
WORKS_FOR, OWNS, DEPENDS_ON, LOCATED_IN, etc.The best systems generally combine graph retrieval and vector retrieval, rather than choosing one.
I'd start with an explicit ontology rather than letting an LLM invent arbitrary nodes and relationships.
For example:
(:Person)
(:Organization)
(:Product)
(:Document)
(:Concept)
(:Location)
(:Person)-[:WORKS_FOR]->(:Organization)
(:Organization)-[:OWNS]->(:Organization)
(:Organization)-[:PRODUCES]->(:Product)
(:Product)-[:DEPENDS_ON]->(:Product)
(:Document)-[:MENTIONS]->(:Person)
(:Document)-[:MENTIONS]->(:Organization)
(:Concept)-[:RELATED_TO]->(:Concept)
Then put provenance on relationships/facts where appropriate:
(:Organization)-[
:ACQUIRED {
date: "...",
source: "...",
confidence: 0.96
}
]->(:Organization)
I'd also preserve the original document/chunk → extracted fact connection. That becomes extremely valuable when the LLM needs to explain why it believes something.
Neo4j's current KG Builder pipeline explicitly supports document loading, chunking, schema construction, entity/relation extraction, graph pruning, writing, and entity resolution.
Don't make the LLM blindly generate arbitrary database queries.
Give it controlled retrieval tools such as:
search_entities(query)
search_documents(query)
find_relationships(entity, relationship_type)
run_graph_query(query)
get_neighbors(entity, depth)
For questions that require exact graph traversal, an LLM can translate natural language into Cypher:
User:
Which suppliers provide components used by products
manufactured by Acme?
↓
LLM
↓
MATCH (acme:Organization {name:"Acme"})
-[:PRODUCES]->(product:Product)
-[:USES_COMPONENT]->(component:Component)
<-[:SUPPLIES]-(supplier:Organization)
RETURN supplier.name, component.name
Neo4j's current GraphRAG package includes a Text2CypherRetriever specifically for translating natural-language questions into Cypher and executing those queries against the knowledge graph.
For less structured questions, use semantic retrieval:
question
↓
embedding
↓
vector search
↓
relevant entities / chunks
↓
expand graph around them
↓
LLM
And ideally use a hybrid approach where the LLM can choose between vector retrieval and graph/Cypher retrieval. Neo4j's current package provides vector, hybrid, Cypher, and tool-based retrievers for this pattern.
I'd use:
| Layer | Recommendation |
|---|---|
| Graph database | Neo4j |
| Graph query language | Cypher |
| Embeddings | Your preferred embedding model |
| LLM | Your preferred frontier/local model |
| KG extraction | LLM-based entity/relation extraction |
| Retrieval | Hybrid vector + graph |
| Orchestration | Python |
| RAG framework | Neo4j GraphRAG or your own thin layer |
| Provenance | Document → Chunk → Fact relationships |
| API | FastAPI |
| UI | Whatever fits your application |
Neo4j currently provides an official neo4j-graphrag Python package for exactly this kind of application, including KG construction and retrieval.
I'd make the architecture:
┌──────────────┐
│ User │
└──────┬───────┘
│
▼
┌──────────────┐
│ LLM │
│ orchestrator│
└──────┬───────┘
│
┌─────────┼─────────┐
▼ ▼ ▼
Vector Graph Metadata
Search Search Search
│ │ │
└─────────┼─────────┘
▼
┌──────────────┐
│ Evidence │
│ + provenance │
└──────┬───────┘
▼
┌──────────────┐
│ LLM │
│ generation │
└──────┬───────┘
▼
Answer +
citations
That separation is important because it lets you audit what the LLM actually retrieved instead of treating the model's internal reasoning as the knowledge source.
The end-to-end pipeline I'd build is:
Documents → chunks → entities/relations → entity resolution → Neo4j → embeddings → hybrid retrieval → LLM
Neo4j's current KG Builder follows essentially this construction pattern, including entity resolution to merge similar entities.
If you tell me what your knowledge is about (e.g. company data, technical documentation, research papers, healthcare, product catalogs, internal business data) and roughly how much data you have, I can design the actual schema, ingestion pipeline, retrieval strategy, and LLM query interface for it.
I'd start with an explicit ontology rather than letting an LLM invent arbitrary nodes and relationships.
For example:
A knowledge graph for an LLM is usually built as a **structured retrieval layer** between your data sources and the model. The LLM does not typically “query the graph directly” in the same way a database client does; instead, you build a system where the LLM translates questions into graph queries, retrieves relevant…
A knowledge graph for an LLM is usually built as a structured retrieval layer between your data sources and the model. The LLM does not typically “query the graph directly” in the same way a database client does; instead, you build a system where the LLM translates questions into graph queries, retrieves relevant subgraphs, and uses those facts as grounded context. Knowledge-graph RAG approaches are increasingly used for this because they preserve relationships that chunk-based retrieval often loses.
A typical architecture looks like this:
Documents / APIs / Databases
|
v
Entity + Relation Extraction
|
v
Knowledge Graph Construction
|
+------------------+------------------+
| |
v v
Graph Database Vector Index
(facts, relations) (semantic search)
| |
+------------------+------------------+
|
v
LLM Retrieval Agent
|
Query Planning / Reasoning
|
v
LLM Response
A common representation is a property graph:
(Node) (Relationship) (Node)
Alice -------- works_at --------> OpenAI
| |
| |
knows founded_by
| |
v v
Bob ---------------------------> Greg
Example triples:
(Alice, works_at, OpenAI)
(OpenAI, founded_by, Greg)
(Alice, located_in, San Francisco)
You usually store:
Entities
people
companies
products
documents
concepts
events
Relationships
works_for
owns
created
depends_on
located_in
contradicts
Attributes
timestamps
confidence scores
provenance
source documents
Common choices:
For an LLM assistant, a property graph is often easier because relationships map naturally to reasoning paths.
Your pipeline might look like:
PDFs
Web pages
Databases
APIs
Emails
Code repositories
|
v
LLM extraction
|
v
Entities + Relationships
|
v
Knowledge Graph
Example extraction:
Input:
"Tesla acquired SolarCity in 2016 for approximately $2.6 billion." Generated graph:
Tesla
|
| acquired
|
SolarCity
properties:
date = 2016
value = 2.6B USD
source = document_123
confidence = 0.92
The LLM needs tools/functions such as:
User:
"Who founded companies acquired by Tesla?" LLM generates:
MATCH
(founder)<-[:FOUNDED_BY]-(company)<-[:ACQUIRED]-(Tesla)
RETURN founder, company
Graph returns:
SolarCity
founded_by:
Lyndon Rive
Peter Rive
The LLM turns that into an answer.
A strong design is hybrid retrieval:
"Find documents related to battery technology."
"Which companies supply batteries to Tesla suppliers?" The graph provides structure; vectors provide fuzzy semantic matching.
Modern KG-RAG systems commonly combine semantic retrieval with graph expansion to improve multi-hop reasoning.
A practical stack:
| Layer | Technology |
|---|---|
| Graph database | Neo4j / Neptune / TigerGraph |
| Embeddings | OpenAI embeddings, open-source embedding models |
| Vector database | pgvector, Pinecone, Weaviate, Milvus |
| Extraction | LLM-based entity/relation extraction |
| Query orchestration | LangGraph, custom agents, LLM tool calling |
| API layer | Python FastAPI / Node.js |
| Monitoring | provenance + evaluation pipeline |
Every fact should remember where it came from:
Fact:
Apple acquired Beats
Source:
SEC filing
Confidence:
0.98
Extracted:
2026-08-29
This lets the LLM cite evidence and avoid hallucinating.
Do not force every extraction to be true:
(Person A)-[possibly_related_to]->(Company B)
confidence = 0.63
Large graphs are too big to send to an LLM. Build:
This is the approach behind many graph-based RAG systems.
A simple flow:
question = "What products depend on Company X?"
entities = llm.extract_entities(question)
subgraph = graph.query("""
MATCH (company {name:$name})
-[:PROVIDES]->(product)
RETURN product
""", entities)
context = format_graph(subgraph)
answer = llm.generate(
prompt=f"""
Answer using only this knowledge:
{context}
Question:
{question}
"""
)
For a first implementation, I would build:
search_documents()query_graph()That gives you a knowledge graph that an LLM can actually reason over rather than just a static database.
question = "What products depend on Company X?"
entities = llm.extract_entities(question)
subgraph = graph.query("""
MATCH (company {name:$name})
-[:PROVIDES]->(product)
RETURN product
""", entities)
context = format_graph(subgraph)
answer = llm.generate(
prompt=f"""
Answer using only this knowledge:
{context}
Question:
{question}
"""
)
For a first implementation, I would build:
search_documents()query_graph()That gives you a knowledge graph that an LLM can actually reason over rather than just a static database.
To make a knowledge graph (KG) queryable by a Large Language Model, you need a setup where the LLM can either **translate natural language into a database query** (like Cypher or SQL) or **use graph traversal tools** to pull relevant context. Here is a practical, step-by-step architecture and toolkit to build one: -…
To make a knowledge graph (KG) queryable by a Large Language Model, you need a setup where the LLM can either translate natural language into a database query (like Cypher or SQL) or use graph traversal tools to pull relevant context.
Here is a practical, step-by-step architecture and toolkit to build one:
To help narrow down the best approach, tell me:
No sources cited