#9307712
Q&A
Revolutionising Customer
Experience: Neo4j Based GraphRAG
and GenAI for Hyper Personalisation
Emil Pastor, Head of Solutions Engineering, ANZ
Samko Yun, Sr. Solutions Engineer
Agenda
● Neo4j Graph Overview and How Customers Benefit from Neo4j
● Neo4j Graph Platform
● Improving Customer Experience using Neo4j Knowledge Graph
● Neo4j GraphRAG and GenAI Interactive Session
● Neo4j Resources
Neo4j Inc. All rights reserved 2025
3
Neo4j Graph Overview
Neo4j Inc. All rights reserved 2025
4
6
Data in a Table (Relation)
7
Data, meet Graph.
Model your data like your business,
with a connected view of dynamic
relationships
What are the elements in a Graph?
Node
Represents an entity in the graph
Property
Describes a node or relationship:
e.g. name, age, address
Label
Grouping of similar nodes
Relationship
Connect nodes to each other
ANNE
MARK
Name: “Mark”
Role: Bank Staff
Mobile: 0410123456
Location: “125 Queen Street, Auckland”
Date: 2025-02-11
Event Date:
2025-09-21
PERSON
PERSON
BANK
Event Date:
2025-12-01
EMPLOYEE
RETAIL BANK
W
O
R
K
S
A
T HELP
KNOWS
V
I
S
I
T
E
D
Neo4j Inc. All rights reserved 2025
8
BANK
Top3 “Why” Native Graph DB and Analytics?
1 2
3
Neo4j Inc. All rights reserved 2025
9
Examples of How Customers
Benefit from Neo4j
Neo4j Inc. All rights reserved 2025
10
How Customers Benefits from Neo4j? (1/3)
Enterprise Search (LLM)
Network Observability Real-time
Recommendation
Understand system
dependencies and de-risk
cloud migration
Knowledge Graph +
Graph RAG + Bloom
Achieved complete network
observability over cloud’s
dynamic network
Need a quick way to search for
repair & maintenance data
GDS + n10s + Graph RAG
(Enterprise Chatbot J.AI)
Queries return relevant
project information with a
snippet generated based on
NLU intent
Connect masses of complex
buyer & product data
Knowledge Graph +
Graph RAG
Matching historical and
session data to personalise
the contents in real-time
?
!
?
!
?
!
How Customers Benefits from Neo4j? (2/3)
Protein Discovery Farm Efficiency
Increase our knowledge of our
planet’s biodiversity (0.001%)
Knowledge Graph
(BaseGraph™
)
Increase new protein
discovered by 50% every
month (2 years 1 month)
→
Analysing 60 years of complex
genomic data
Knowledge Graph +
GDS algorithm
Reduced the processing time
of real-time analysis from
hours to seconds
Deliver traceability reports to
the government (FSA) in time
Knowledge Graph +
Bloom visualisation
Real-time reports with
production data
?
!
?
!
?
!
Ingredient Traceability
How Customers Benefits from Neo4j? (3/3)
Customer 360
Distribution Centre
Optimisation
Knowledge Management
Disparate data sources delay
customer issue resolution
Knowledge Graph
Manual effort reduced from
weeks to 20 mins & Enabled
Real-time recommendation
Difficult to track “dark parcels”
Knowledge Graph
Use real-time events to
minimise and resolve
disruptions
Accessing decades of project
data siloed by department
Knowledge Graph
(Lesson Learned Database)
Saved more than $2 Million in
R&D cost on the mission to
Mars
?
!
?
!
?
!
Neo4j Graph Platform
Neo4j Inc. All rights reserved 2025
14
Neo4j Enterprise Platform Architecture
Neo4j Inc. All rights reserved 2025
15
Neo4j Inc. All rights reserved 2025
16
Fully-managed SaaS
Consumption-based pricing
Cloud-native
Self-service deployment
No access to underlying
infrastructure and systems
White-glove managed service
by Neo4j experts
Fully customizable deployment
model and service levels
Operate In own data centers
or Virtual Private Cloud
For private and hybrid
cloud, or on-prem
Bring your own license
Full control of your environment
Run in any cloud, in your account
Graph-as-a-Service Self-hosted
Cloud Managed
Services
Flexible Deployment Models
Neo4j Connectors and Integration Points
Neo4j BI
Connector
Apache Spark
Connector
Apache Kafka
Connector
Data Warehouse
Connector
Java Python .NET
JavaScript Go
Neo4j Inc. All rights reserved 2025
17
Improving Customer
Experience using Neo4j
Knowledge Graph
Neo4j Inc. All rights reserved 2025
18
: Recommendation Engine
Challenge: Optimise walmart.com user experience
• Connect complex buyer and product data to
gain super-fast insight into customer needs
and product trends
• RDBMS couldn’t handle complex queries
Solution: Replaced complex batch process real-
time online recommendations
• Built simple, real-time recommendation
system with low-latency queries
• Serve better and faster recommendations
by combining historical and session data
Neo4j Inc. All rights reserved 2025
19
Example: Walmart’s Product Knowledge Graph
Neo4j Inc. All rights reserved 2025
20
X360 Recommendations
→
Organisational Data
Customer Data
Product Data
Event Data
3rd
Party Data
Supply Chain Data
High Priority Questions:
● Which products or recipes should we
recommend to this customer?
● What complimentary items can be
recommend based what’s in their
basket? (realtime)
● What items are missing from their
basket, that we can recommend
based on prior shops?
● Which promotions should we
recommend on screen at self-service
checkouts?
● Which products can we recommend,
based on their browsing behaviour?
Neo4j Inc. All rights reserved 2025
21
Context-Driven Recommendations: Enriched
SIMILAR_TO
RECOMMEND_TO
SIMILAR_TO
PURCHASED_WITH
RECOMMEND_TO
cId: 12
cId: 12
Neo4j Inc. All rights reserved 2025
22
Customer Journey
Neo4j Inc. All rights reserved 2025
23
24
Context-Driven Recommendations: Enriched
Neo4j Inc. All rights reserved 2025
24
Capture customer
interactions and customer
journey using a knowledge
graph
Analyze customer
interactions using
graph queries and find
customer communities
based on common
purchase behavior
Construct node
embeddings and
resolve entities based
on weighted pairwise
similarity between
various entities
Generate product
recommendations
based on
correlations
between products,
search queries and
historical purchases
Neo4j GraphRAG and GenAI
Interactive Session
LLM Projects - How are they going ?
Neo4j Inc. All rights reserved 2025
26
Effectiveness
Time
Poor domain knowledge
Hallucinations
Limited explainability
Security concerns
Siloed data
Model selection
Fine tuning
Parameter tweaking
RAG
Your expectations !
An API Key,
17 lines of code
in a few weeks
Amazing !!!!
…. and still
Your opportunity with
Knowledge
Graphs
Neo4j Inc. All rights reserved 2025
27
Do you remember this news?
LLMs make things up
Hallucination
Avoiding Hallucination
Prompt Engineering
Iteratively refining instructions to achieve
more consistent results.
1
.
In-Context Learning
Provide examples to guide AI for accurate,
task-specific responses.
Also known as Few-Shot Prompting
2
.
Fine-tuning
Providing additional training to an LLM after
its primary training phase.
3
.
29 Neo4j Inc. All rights reserved 2025
30 Neo4j Inc. All rights reserved 2025
How can organizations use
domain-specific knowledge
to rapidly build accurate,
contextual, and explainable
GenAI applications?
The Big
Question
Retrieval-Augmented Generation Is Becoming
an Industry Standard
31 Neo4j Inc. All rights reserved 2025
RAG augments LLMs by
retrieving up-to-date external
data to inform responses:
● Provide domain-specific,
relevant responses
● Reduce hallucinations with
verified data
● Enable traceability back
to sources
Use-case where naive vector search fails miserably
Chunking
Indexing Retrieving
Text chunks
Contracts
Vector index
Retrieved chunks
from different
contracts
Example question: Who manages our contracts with Neo4j?
Why RAG With Vector Databases Fall Short
1
3
2
4
Similarity is insufficient for rich enterprise reasoning
Only leverage a fraction of
your data: Beyond simple
“metadata”, vector databases
alone fail to capture relationships
from structured data
Miss critical context: Struggle to
capture connections across
nuanced facts, making it
challenging to answer multi-step,
domain-specific, questions
Semantic Similarity ≠ Relevance:
Vector search uses an incomplete
measure of similarity. Relying on it
solely can result in irrelevant and
duplicative results
Lack explainability:
The black-box nature of
vectors lacks transparency
and explainability
33 Neo4j Inc. All rights reserved 2025
Why Knowledge Graphs ?
Neo4j Inc. All rights reserved 2025
34
Connecting
structured and
unstructured data
Structured Data
Unstructure
d Data
Extracted
Graph Data
Text
embeddings
Neo4j Inc. All rights reserved 2025
35
RAG with Neo4j
Find similar documents
and content
Identify entities
associated to content and
patterns
in connected data
Improve GenAI inferences
and insights. Discover new
relationships and
entities
Unify vector search, knowledge graph and data
science capabilities to improve RAG quality and
effectiveness
Vector Search
Graph
Data Science
Knowledge
Graph
#9307712
Q&A
Quick Break!
GraphRAG in Action
Personalisation Example Overview
● Real-world data from the Kaggle H&M Personalised Fashion
Recommendations Dataset
● Combines multiple structured datasets and unstructured data about
articles of clothing and customer purchases
● Leverages Neo4j’s Vector Index on nodes in the graph
Neo4j Inc. All rights reserved 2025
39
Demo Time!
Neo4j Inc. All rights reserved 2025
40
Semantic Search + Graph
Neo4j Inc. All rights reserved 2025
41
Vector Similarity
Search
Vector Similarity + Local
Graph Traversals
Vector Similarity +
GDS-Based Graph
Traversals
Find relevant documents and
content for user queries.
Find people, places, and
things associated to content.
Identify patterns in connected
data.
Further improve search
relevance using graph
algorithms and ML to
discover new relationships,
entities, and groups.
Vector Search
HNSW
Graph Database Graph Data Science
What Does “Similarity” Mean?
Neo4j Inc. All rights reserved 2025
42
It Depends:
● Text Embeddings => Semantic similarity, the meaning behind a text
sequence
● Graph Embeddings => Similarity in position or structure in a graph -
can have semantic meaning too
Step 1. Vector Similarity Search Only
Starts with an indexed vector
embedding on each node
Uses Neo4j as if it was a vector
database:
● Natural language search phrase
● Performs a vector similarity
search (i.e., cosine similarity)
● Return the top N results
● Each returned node is an
individual chunk of data
Neo4j Inc. All rights reserved 2025
43
Visualization of results from vector search-only approach
Neo4j Inc. All rights reserved 2025
44
Results: Vector Search Only
Product Code Product Type Document
Similarity
Score
842001 Sweater Product-- Name: Betsy Oversized || Type: Sweater… 0.945937
817392 Sweater Product-- Name: Japp oversize sweater || Type: Sweater… 0.944246
709418 Sweater Product-- Name: DIV Anni oversize hood || Type: Sweater… 0.932580
860833 Sweater Product-- Name: Runar sweater || Type: Sweater… 0.931568
893141 Sweater Product-- Name: Sandy || Type: Sweater… 0.930025
812167 Sweater Product-- Name: Macy || Type: Sweater… 0.929781
690623 Sweater Product-- Name: Simba || Type: Sweater… 0.928991
557247 Sweater Product-- Name: Petar Sweater(1) || Type: Sweater… 0.928751
538283 Sweater Product-- Name: TOR Sweater || Type: Sweater… 0.927127
687934 Sweater Product-- Name: Sister off shoulder || Type: Sweater… 0.927100
Search Term: “oversized sweater”
Step 2. Vector Similarity + Local Graph Traversal
Augments vector similarity search
with information already encoded in
the knowledge graph
● Start with a vector similarity
search
● Performs a local graph
traversal on each matching
node
● Return the additional context
that would not be available from
vector similarity search alone
Neo4j Inc. All rights reserved 2025
45
Visualization of results from
vector similarity + local traversal approach
Neo4j Inc. All rights reserved 2025
46
Semantic Search + Traversal
Purchases
in common
Customers
Target
Customer
Semantically
Similar
Products
Neo4j Inc. All rights reserved 2025
47
Only repeat result
Results: Vector Similarity + Local Traversal
Product
Code
Product
Type
Document
Search
Score
Purchase
Score
Vector-Only
Rank
677930 Sweater Product-- Name: Queen Sweater || Type: Sweater… 0.922999 6 NaN
516712 Top Product-- Name: Jess oversize LS || Type: Top… 0.922911 5 NaN
557247 Sweater Product-- Name: Petar Sweater(1) || Type: Sweater… 0.928751 4 7.0
675408 Sweater Product-- Name: Mother || Type: Sweater… 0.920846 4 NaN
669682 Sweater Product-- Name: Irma sweater || Type: Sweater… 0.921362 2 NaN
640755 Sweater Product-- Name: Allen Sweater || Type: Sweater… 0.926152 1 NaN
687948 Hoodie Product-- Name: Annie Oversized Hood || Type: Hoodie… 0.925855 1 NaN
709991 Sweater Product-- Name: SISTER OL || Type: Sweater… 0.924914 1 NaN
687856 Jacket Product-- Name: Jacket Oversize || Type: Jacket… 0.924428 1 NaN
674826 Sweater Product-- Name: Fine knit || Type: Sweater… 0.921296 1 NaN
kg_personalized_search.similarity_search(“oversized sweater”)
Step 3. Knowledge Graph Inference & ML
Neo4j Inc. All rights reserved 2025
48
Draw connections between highly
interconnected nodes and/or
those that have similar roles in
the graph
0.2
0.3
0.6
-0.6
0.1
0.4
0.5
-0.4
-0.1
0.5
0.4
-0.4
Neo4j Inc. All rights reserved 2025
49
Create a Co-purchase Projection
# graph projection - project co-purchase graph into analytics workspace
gds.run_cypher('''
MATCH (a1:Article)<-[:PURCHASED]-(:Customer)-[:PURCHASED]->(a2:Article)
WITH gds.graph.project("proj", a1, a2,
{sourceNodeLabels: labels(a1),
targetNodeLabels: labels(a2),
relationshipType: "COPURCHASE"}) AS g
RETURN g.graphName
''')
g = gds.graph.get("proj")
Neo4j Inc. All rights reserved 2025
50
Generate Graph Embeddings
# create FastRP node embeddings
gds.fastRP.mutate(g, mutateProperty='embedding', embeddingDimension=128,
randomSeed=7474, concurrency=4, iterationWeights=[0.0, 1.0, 1.0])
# Compute KNN and write relationships
knn_stats = gds.knn.write(g, nodeProperties=['embedding'],
nodeLabels=['Article'], writeRelationshipType='CUSTOMERS_ALSO_LIKE',
writeProperty='score', sampleRate=1.0, initialSampler='randomWalk',
concurrency=1, similarityCutoff=0.75, randomSeed=7474)
Neo4j Inc. All rights reserved 2025
51
Create a Recommender Graph
Neo4j Inc. All rights reserved 2025
52
MATCH (:Customer {customerId:$customerId})
-[:PURCHASED]->(:Article)
-[r:CUSTOMERS_ALSO_LIKE]->(:Article)
-[:VARIANT_OF]->(product)
RETURN
product.productCode AS productCode,
sum(r.score) AS recommenderScore
ORDER BY recommenderScore DESC
LIMIT $k
Product Code
Product
Type
Document
Recommender
Score
Vector-Only
Rank
562252 Trousers Product-- Name: Space 5 pkt tregging || Type: Trousers… 5.50 NaN
658030 Trousers Product-- Name: Push Up Jegging L.W || Type: Trousers… 3.68 NaN
607347 T-shirt Product-- Name: Beck L/S || Type: T-shirt… 3.68 NaN
863561 Bra Product-- Name: Alexis seamless top Rio Opt1 || Type: Bra… 2.78 NaN
647684 T-shirt Product-- Name: GABBE || Type: T-shirt… 1.89 NaN
860833 Sweater Product-- Name: Runar sweater || Type: Sweater… 1.86 4
657159 Flat shoe Product-- Name: OL ALFONS PQ Espadrille || Type: Flat shoe… 1.86 NaN
867240 Cardigan Product-- Name: OKLAHOMA OVERSHIRT || Type: Cardigan… 1.86 NaN
661417 Vest top Product-- Name: BAE top with inner bra || Type: Vest top… 1.85 NaN
674606 Skirt Product-- Name: CHARLIE SKIRT || Type: Skirt… 1.85 NaN
Neo4j Inc. All rights reserved 2025
53
Results: Vector Similarity + GDS Traversal
Search Term: “oversized sweater”
Only repeat result
Neo4j Inc. All rights reserved 2025
Langchain Chain
54
customer_id
searchPrompt Personalized
search
Reco
timeOfYear
customerName
prompt llm personalize
d email
{searchProds: searchPrompt | personalizedSearch
(customer_id)
recProds: customer_id | recommendations
customerName
timeOfYear}
prompt | llm | OutputParser
searchProds
recProds
Let’s take a look at the code !
Neo4j Inc. All rights reserved 2025
open genai-workshop.ipynb
https://github.com/neo4j-product-examples/genai-workshop
55
Neo4j Resources
Neo4j Inc. All rights reserved 2025
56
GenAI Ecosystem Integration
Neo4j Inc. All rights reserved 2025
57 dev.neo4j.com/genai
Graph Academy
What is Graph Academy?
Free, Self-Paced, Hands-on Online Training to help you learn how to build, optimize
and launch your Neo4j project, all from the Neo4j experts.
What’s more?
2 free certifications designed to test you on your overall knowledge of Neo4j:
● Neo4j Graph Data Science Certification
● Neo4j Certified Professional
Interested? For more information visit:
www.graphacademy.neo4j.com
58 Neo4j Inc. All rights reserved 2025
Thank You!
Appendix
Neo4j Inc. All rights reserved 2025
60

Neo4j Knowledge for Customer Experience.pptx

  • 1.
  • 2.
    Revolutionising Customer Experience: Neo4jBased GraphRAG and GenAI for Hyper Personalisation Emil Pastor, Head of Solutions Engineering, ANZ Samko Yun, Sr. Solutions Engineer
  • 3.
    Agenda ● Neo4j GraphOverview and How Customers Benefit from Neo4j ● Neo4j Graph Platform ● Improving Customer Experience using Neo4j Knowledge Graph ● Neo4j GraphRAG and GenAI Interactive Session ● Neo4j Resources Neo4j Inc. All rights reserved 2025 3
  • 4.
    Neo4j Graph Overview Neo4jInc. All rights reserved 2025 4
  • 5.
    6 Data in aTable (Relation)
  • 6.
    7 Data, meet Graph. Modelyour data like your business, with a connected view of dynamic relationships
  • 7.
    What are theelements in a Graph? Node Represents an entity in the graph Property Describes a node or relationship: e.g. name, age, address Label Grouping of similar nodes Relationship Connect nodes to each other ANNE MARK Name: “Mark” Role: Bank Staff Mobile: 0410123456 Location: “125 Queen Street, Auckland” Date: 2025-02-11 Event Date: 2025-09-21 PERSON PERSON BANK Event Date: 2025-12-01 EMPLOYEE RETAIL BANK W O R K S A T HELP KNOWS V I S I T E D Neo4j Inc. All rights reserved 2025 8 BANK
  • 8.
    Top3 “Why” NativeGraph DB and Analytics? 1 2 3 Neo4j Inc. All rights reserved 2025 9
  • 9.
    Examples of HowCustomers Benefit from Neo4j Neo4j Inc. All rights reserved 2025 10
  • 10.
    How Customers Benefitsfrom Neo4j? (1/3) Enterprise Search (LLM) Network Observability Real-time Recommendation Understand system dependencies and de-risk cloud migration Knowledge Graph + Graph RAG + Bloom Achieved complete network observability over cloud’s dynamic network Need a quick way to search for repair & maintenance data GDS + n10s + Graph RAG (Enterprise Chatbot J.AI) Queries return relevant project information with a snippet generated based on NLU intent Connect masses of complex buyer & product data Knowledge Graph + Graph RAG Matching historical and session data to personalise the contents in real-time ? ! ? ! ? !
  • 11.
    How Customers Benefitsfrom Neo4j? (2/3) Protein Discovery Farm Efficiency Increase our knowledge of our planet’s biodiversity (0.001%) Knowledge Graph (BaseGraph™ ) Increase new protein discovered by 50% every month (2 years 1 month) → Analysing 60 years of complex genomic data Knowledge Graph + GDS algorithm Reduced the processing time of real-time analysis from hours to seconds Deliver traceability reports to the government (FSA) in time Knowledge Graph + Bloom visualisation Real-time reports with production data ? ! ? ! ? ! Ingredient Traceability
  • 12.
    How Customers Benefitsfrom Neo4j? (3/3) Customer 360 Distribution Centre Optimisation Knowledge Management Disparate data sources delay customer issue resolution Knowledge Graph Manual effort reduced from weeks to 20 mins & Enabled Real-time recommendation Difficult to track “dark parcels” Knowledge Graph Use real-time events to minimise and resolve disruptions Accessing decades of project data siloed by department Knowledge Graph (Lesson Learned Database) Saved more than $2 Million in R&D cost on the mission to Mars ? ! ? ! ? !
  • 13.
    Neo4j Graph Platform Neo4jInc. All rights reserved 2025 14
  • 14.
    Neo4j Enterprise PlatformArchitecture Neo4j Inc. All rights reserved 2025 15
  • 15.
    Neo4j Inc. Allrights reserved 2025 16 Fully-managed SaaS Consumption-based pricing Cloud-native Self-service deployment No access to underlying infrastructure and systems White-glove managed service by Neo4j experts Fully customizable deployment model and service levels Operate In own data centers or Virtual Private Cloud For private and hybrid cloud, or on-prem Bring your own license Full control of your environment Run in any cloud, in your account Graph-as-a-Service Self-hosted Cloud Managed Services Flexible Deployment Models
  • 16.
    Neo4j Connectors andIntegration Points Neo4j BI Connector Apache Spark Connector Apache Kafka Connector Data Warehouse Connector Java Python .NET JavaScript Go Neo4j Inc. All rights reserved 2025 17
  • 17.
    Improving Customer Experience usingNeo4j Knowledge Graph Neo4j Inc. All rights reserved 2025 18
  • 18.
    : Recommendation Engine Challenge:Optimise walmart.com user experience • Connect complex buyer and product data to gain super-fast insight into customer needs and product trends • RDBMS couldn’t handle complex queries Solution: Replaced complex batch process real- time online recommendations • Built simple, real-time recommendation system with low-latency queries • Serve better and faster recommendations by combining historical and session data Neo4j Inc. All rights reserved 2025 19
  • 19.
    Example: Walmart’s ProductKnowledge Graph Neo4j Inc. All rights reserved 2025 20
  • 20.
    X360 Recommendations → Organisational Data CustomerData Product Data Event Data 3rd Party Data Supply Chain Data High Priority Questions: ● Which products or recipes should we recommend to this customer? ● What complimentary items can be recommend based what’s in their basket? (realtime) ● What items are missing from their basket, that we can recommend based on prior shops? ● Which promotions should we recommend on screen at self-service checkouts? ● Which products can we recommend, based on their browsing behaviour? Neo4j Inc. All rights reserved 2025 21
  • 21.
  • 22.
    Customer Journey Neo4j Inc.All rights reserved 2025 23
  • 23.
    24 Context-Driven Recommendations: Enriched Neo4jInc. All rights reserved 2025 24 Capture customer interactions and customer journey using a knowledge graph Analyze customer interactions using graph queries and find customer communities based on common purchase behavior Construct node embeddings and resolve entities based on weighted pairwise similarity between various entities Generate product recommendations based on correlations between products, search queries and historical purchases
  • 24.
    Neo4j GraphRAG andGenAI Interactive Session
  • 25.
    LLM Projects -How are they going ? Neo4j Inc. All rights reserved 2025 26 Effectiveness Time Poor domain knowledge Hallucinations Limited explainability Security concerns Siloed data Model selection Fine tuning Parameter tweaking RAG Your expectations ! An API Key, 17 lines of code in a few weeks Amazing !!!! …. and still Your opportunity with Knowledge Graphs
  • 26.
    Neo4j Inc. Allrights reserved 2025 27 Do you remember this news?
  • 27.
    LLMs make thingsup Hallucination
  • 28.
    Avoiding Hallucination Prompt Engineering Iterativelyrefining instructions to achieve more consistent results. 1 . In-Context Learning Provide examples to guide AI for accurate, task-specific responses. Also known as Few-Shot Prompting 2 . Fine-tuning Providing additional training to an LLM after its primary training phase. 3 . 29 Neo4j Inc. All rights reserved 2025
  • 29.
    30 Neo4j Inc.All rights reserved 2025 How can organizations use domain-specific knowledge to rapidly build accurate, contextual, and explainable GenAI applications? The Big Question
  • 30.
    Retrieval-Augmented Generation IsBecoming an Industry Standard 31 Neo4j Inc. All rights reserved 2025 RAG augments LLMs by retrieving up-to-date external data to inform responses: ● Provide domain-specific, relevant responses ● Reduce hallucinations with verified data ● Enable traceability back to sources
  • 31.
    Use-case where naivevector search fails miserably Chunking Indexing Retrieving Text chunks Contracts Vector index Retrieved chunks from different contracts Example question: Who manages our contracts with Neo4j?
  • 32.
    Why RAG WithVector Databases Fall Short 1 3 2 4 Similarity is insufficient for rich enterprise reasoning Only leverage a fraction of your data: Beyond simple “metadata”, vector databases alone fail to capture relationships from structured data Miss critical context: Struggle to capture connections across nuanced facts, making it challenging to answer multi-step, domain-specific, questions Semantic Similarity ≠ Relevance: Vector search uses an incomplete measure of similarity. Relying on it solely can result in irrelevant and duplicative results Lack explainability: The black-box nature of vectors lacks transparency and explainability 33 Neo4j Inc. All rights reserved 2025
  • 33.
    Why Knowledge Graphs? Neo4j Inc. All rights reserved 2025 34 Connecting structured and unstructured data Structured Data Unstructure d Data Extracted Graph Data Text embeddings
  • 34.
    Neo4j Inc. Allrights reserved 2025 35 RAG with Neo4j Find similar documents and content Identify entities associated to content and patterns in connected data Improve GenAI inferences and insights. Discover new relationships and entities Unify vector search, knowledge graph and data science capabilities to improve RAG quality and effectiveness Vector Search Graph Data Science Knowledge Graph
  • 35.
  • 36.
  • 37.
  • 38.
    Personalisation Example Overview ●Real-world data from the Kaggle H&M Personalised Fashion Recommendations Dataset ● Combines multiple structured datasets and unstructured data about articles of clothing and customer purchases ● Leverages Neo4j’s Vector Index on nodes in the graph Neo4j Inc. All rights reserved 2025 39
  • 39.
    Demo Time! Neo4j Inc.All rights reserved 2025 40
  • 40.
    Semantic Search +Graph Neo4j Inc. All rights reserved 2025 41 Vector Similarity Search Vector Similarity + Local Graph Traversals Vector Similarity + GDS-Based Graph Traversals Find relevant documents and content for user queries. Find people, places, and things associated to content. Identify patterns in connected data. Further improve search relevance using graph algorithms and ML to discover new relationships, entities, and groups. Vector Search HNSW Graph Database Graph Data Science
  • 41.
    What Does “Similarity”Mean? Neo4j Inc. All rights reserved 2025 42 It Depends: ● Text Embeddings => Semantic similarity, the meaning behind a text sequence ● Graph Embeddings => Similarity in position or structure in a graph - can have semantic meaning too
  • 42.
    Step 1. VectorSimilarity Search Only Starts with an indexed vector embedding on each node Uses Neo4j as if it was a vector database: ● Natural language search phrase ● Performs a vector similarity search (i.e., cosine similarity) ● Return the top N results ● Each returned node is an individual chunk of data Neo4j Inc. All rights reserved 2025 43 Visualization of results from vector search-only approach
  • 43.
    Neo4j Inc. Allrights reserved 2025 44 Results: Vector Search Only Product Code Product Type Document Similarity Score 842001 Sweater Product-- Name: Betsy Oversized || Type: Sweater… 0.945937 817392 Sweater Product-- Name: Japp oversize sweater || Type: Sweater… 0.944246 709418 Sweater Product-- Name: DIV Anni oversize hood || Type: Sweater… 0.932580 860833 Sweater Product-- Name: Runar sweater || Type: Sweater… 0.931568 893141 Sweater Product-- Name: Sandy || Type: Sweater… 0.930025 812167 Sweater Product-- Name: Macy || Type: Sweater… 0.929781 690623 Sweater Product-- Name: Simba || Type: Sweater… 0.928991 557247 Sweater Product-- Name: Petar Sweater(1) || Type: Sweater… 0.928751 538283 Sweater Product-- Name: TOR Sweater || Type: Sweater… 0.927127 687934 Sweater Product-- Name: Sister off shoulder || Type: Sweater… 0.927100 Search Term: “oversized sweater”
  • 44.
    Step 2. VectorSimilarity + Local Graph Traversal Augments vector similarity search with information already encoded in the knowledge graph ● Start with a vector similarity search ● Performs a local graph traversal on each matching node ● Return the additional context that would not be available from vector similarity search alone Neo4j Inc. All rights reserved 2025 45 Visualization of results from vector similarity + local traversal approach
  • 45.
    Neo4j Inc. Allrights reserved 2025 46 Semantic Search + Traversal Purchases in common Customers Target Customer Semantically Similar Products
  • 46.
    Neo4j Inc. Allrights reserved 2025 47 Only repeat result Results: Vector Similarity + Local Traversal Product Code Product Type Document Search Score Purchase Score Vector-Only Rank 677930 Sweater Product-- Name: Queen Sweater || Type: Sweater… 0.922999 6 NaN 516712 Top Product-- Name: Jess oversize LS || Type: Top… 0.922911 5 NaN 557247 Sweater Product-- Name: Petar Sweater(1) || Type: Sweater… 0.928751 4 7.0 675408 Sweater Product-- Name: Mother || Type: Sweater… 0.920846 4 NaN 669682 Sweater Product-- Name: Irma sweater || Type: Sweater… 0.921362 2 NaN 640755 Sweater Product-- Name: Allen Sweater || Type: Sweater… 0.926152 1 NaN 687948 Hoodie Product-- Name: Annie Oversized Hood || Type: Hoodie… 0.925855 1 NaN 709991 Sweater Product-- Name: SISTER OL || Type: Sweater… 0.924914 1 NaN 687856 Jacket Product-- Name: Jacket Oversize || Type: Jacket… 0.924428 1 NaN 674826 Sweater Product-- Name: Fine knit || Type: Sweater… 0.921296 1 NaN kg_personalized_search.similarity_search(“oversized sweater”)
  • 47.
    Step 3. KnowledgeGraph Inference & ML Neo4j Inc. All rights reserved 2025 48 Draw connections between highly interconnected nodes and/or those that have similar roles in the graph 0.2 0.3 0.6 -0.6 0.1 0.4 0.5 -0.4 -0.1 0.5 0.4 -0.4
  • 48.
    Neo4j Inc. Allrights reserved 2025 49
  • 49.
    Create a Co-purchaseProjection # graph projection - project co-purchase graph into analytics workspace gds.run_cypher(''' MATCH (a1:Article)<-[:PURCHASED]-(:Customer)-[:PURCHASED]->(a2:Article) WITH gds.graph.project("proj", a1, a2, {sourceNodeLabels: labels(a1), targetNodeLabels: labels(a2), relationshipType: "COPURCHASE"}) AS g RETURN g.graphName ''') g = gds.graph.get("proj") Neo4j Inc. All rights reserved 2025 50
  • 50.
    Generate Graph Embeddings #create FastRP node embeddings gds.fastRP.mutate(g, mutateProperty='embedding', embeddingDimension=128, randomSeed=7474, concurrency=4, iterationWeights=[0.0, 1.0, 1.0]) # Compute KNN and write relationships knn_stats = gds.knn.write(g, nodeProperties=['embedding'], nodeLabels=['Article'], writeRelationshipType='CUSTOMERS_ALSO_LIKE', writeProperty='score', sampleRate=1.0, initialSampler='randomWalk', concurrency=1, similarityCutoff=0.75, randomSeed=7474) Neo4j Inc. All rights reserved 2025 51
  • 51.
    Create a RecommenderGraph Neo4j Inc. All rights reserved 2025 52 MATCH (:Customer {customerId:$customerId}) -[:PURCHASED]->(:Article) -[r:CUSTOMERS_ALSO_LIKE]->(:Article) -[:VARIANT_OF]->(product) RETURN product.productCode AS productCode, sum(r.score) AS recommenderScore ORDER BY recommenderScore DESC LIMIT $k
  • 52.
    Product Code Product Type Document Recommender Score Vector-Only Rank 562252 TrousersProduct-- Name: Space 5 pkt tregging || Type: Trousers… 5.50 NaN 658030 Trousers Product-- Name: Push Up Jegging L.W || Type: Trousers… 3.68 NaN 607347 T-shirt Product-- Name: Beck L/S || Type: T-shirt… 3.68 NaN 863561 Bra Product-- Name: Alexis seamless top Rio Opt1 || Type: Bra… 2.78 NaN 647684 T-shirt Product-- Name: GABBE || Type: T-shirt… 1.89 NaN 860833 Sweater Product-- Name: Runar sweater || Type: Sweater… 1.86 4 657159 Flat shoe Product-- Name: OL ALFONS PQ Espadrille || Type: Flat shoe… 1.86 NaN 867240 Cardigan Product-- Name: OKLAHOMA OVERSHIRT || Type: Cardigan… 1.86 NaN 661417 Vest top Product-- Name: BAE top with inner bra || Type: Vest top… 1.85 NaN 674606 Skirt Product-- Name: CHARLIE SKIRT || Type: Skirt… 1.85 NaN Neo4j Inc. All rights reserved 2025 53 Results: Vector Similarity + GDS Traversal Search Term: “oversized sweater” Only repeat result
  • 53.
    Neo4j Inc. Allrights reserved 2025 Langchain Chain 54 customer_id searchPrompt Personalized search Reco timeOfYear customerName prompt llm personalize d email {searchProds: searchPrompt | personalizedSearch (customer_id) recProds: customer_id | recommendations customerName timeOfYear} prompt | llm | OutputParser searchProds recProds
  • 54.
    Let’s take alook at the code ! Neo4j Inc. All rights reserved 2025 open genai-workshop.ipynb https://github.com/neo4j-product-examples/genai-workshop 55
  • 55.
    Neo4j Resources Neo4j Inc.All rights reserved 2025 56
  • 56.
    GenAI Ecosystem Integration Neo4jInc. All rights reserved 2025 57 dev.neo4j.com/genai
  • 57.
    Graph Academy What isGraph Academy? Free, Self-Paced, Hands-on Online Training to help you learn how to build, optimize and launch your Neo4j project, all from the Neo4j experts. What’s more? 2 free certifications designed to test you on your overall knowledge of Neo4j: ● Neo4j Graph Data Science Certification ● Neo4j Certified Professional Interested? For more information visit: www.graphacademy.neo4j.com 58 Neo4j Inc. All rights reserved 2025
  • 58.
  • 59.
    Appendix Neo4j Inc. Allrights reserved 2025 60

Editor's Notes

  • #6 These valuable patterns cannot be exploited with legacy systems, they were not conceived to look at data structurally. For decades, enterprises have been shackled by the need to force connected data into rigid relational tables
  • #7 These valuable patterns cannot be exploited with legacy systems, they were not conceived to look at data structurally. For decades, enterprises have been shackled by the need to force connected data into rigid relational tables
  • #20 Ontologies help to provide clearer
  • #28 This is a phenomenon known as hallucination.
  • #29 It may just be a case that you need to iteratively refine the instructions provided to the LLM to achieve constant results. You may need to provide specific examples to guide the LLM to complete a task. As I mentioned, you may also fine-tune an existing model.
  • #32 However, despite its advantages, VectorRAG needs help with the hierarchical nature of financial documents, often leading to the loss of critical contextual information necessary for precise analysis.
  • #33 “Vector DBs are amazing at showing art-of-the-possible with GenAI. However, most business applications with requirements more demanding than a “hello world” chatbot demo will need a well-constructed knowledge base with multiple forms of search and enrichment. This eventually requires expanding beyond just a Vector database. While VectorDBs may solve some hallucination issues and offer basic source traceability, they have several limitations: You can only leverage a fraction of your data: You can only really use your unstructured data, and perhaps some “metadata” but not the relationships in your structured data(unless you stand up another solution - like your own graph embedding service). Miss critical domain-specific context: Because you cannot use all your data and because Vector DBs just enable embedding search, your LLM apps will miss critical domain-specific knowledge which can compromise the quality and effectiveness of your business applications. Example: Both a knowledge graph and a vector database can easily return an answer to “Who is the CEO of my company?” but a knowledge graph will outpace a vector database on a question like “Which board meetings in the last twelve months had at least two members abstain from a vote?” “Which products in the last 12 months had 5 returns?” A vector database is likely to find an answer in the middle of the subjects within the vector space, and not the specific answer. A knowledge graph looks for and returns precise information based on traversing a graph that is connected by relationships. Poor retrieval results - Vector similarity ≠ Relevance: Even leaving the above aside, the algorithms used by Vector DBs just measure semantic similarity which doesn’t always equate to relevance. Vector Database retrieval also doesn’t come with sophisticated filters and this can result in many duplicative, irrelevant, and/or inaccurate results for RAG. Example: If you asked: “Who is on the product management team?”, a vector database might incorrectly infer that someone was on the product team because they have frequent commenting access to documents (fact) produced by the product team (fact) and return their name in the results. Because a knowledge graph uses nodes and relationships to identify how people in an organization are related, it would return only those on the product team. Lack of Explainability and understanding of grounding data: While Vector Databases offer basic source citation in metadata, they do not offer visibility into how and why certain sources were retrieved over others. Moreover, it can be difficult to inspect and analyze your grounding data, which can result in difficult-to-understand “black-box” data quality issues that hinder LLM performance and your ability to improve and iterate overtime. Example: When a member of the product team is misidentified, a vector database will not be able to identify the facts it used to infer the misinformation. This means it isn’t possible to undo it or even understand the source of the error.