Neo4j Inc. All rights reserved 2023
Neo4j and GenAI
Luis Salvador
PreSales Engineer EMEA South
Graph creates a
more intuitive and
connected view of
data relationships,
unlocking deeper
insights and context
2
THE PROPERTY GRAPH: SIMPLY POWERFUL
Employee City
Company
Nodes represent
objects (nouns)
Relationships are directional
Relationships connect nodes are
represent actions (verbs)
Relationships can have
properties (name/value pairs)
Nodes can have
properties (name/value
pairs)
name: Emil Eifrem
date_of_birth: 1979-03-01
employee_ID: 1
:HAS_CEO
start_date: 2008-01-20
:LOCATED_IN
3
Hybrid Workload Duality
Intelligent
Applications
Transactions -
Security -
Performance & Scalability -
ACID Consistency -
Intelligent Modeling
- Extensive & Supported Algo Library
- Scalable
- Graph Visualization
- Graph Transformations
Graph
Transactions
Graph Analytics
& Data Science
4
© 2023 Neo4j, Inc. All rights reserved.
Neo4j
Graph Data Science
5
What’s in it for you:
● Improve model accuracy by 30%
● Simplify processes and remove
headaches
● More projects into production without
additional hiring
Neo4j Graph Data Science
Analytics
Feature
Engineering
Data
Exploration
Graph
Data
Science
Queries & Search
Machine Learning Visualization
6
When do you need Graph Algorithms?
Query (e.g. Cypher)
Real-time, local decisioning
and pattern matching
Graph Algorithms
Global analysis and iterations
You know what you’re looking
for and making a decision
You’re learning the overall structure
of a network, updating data, and
predicting
Local Patterns Global Computation
7
What’s important?
Prioritization
Who has the most connections?
Who has the highest page rank?
Who is an influencer?
What’s unusual?
Anomaly & Fraud Detection
Where is a community forming?
What are the group dynamics?
What’s unusual about this data?
What’s next?
Predictions
What’s the most common path?
Who is in the same community?
What relationship will form?
Pl
ay
s
Lives_in
In_sport
Likes
F
a
n
_
o
f
Plays_for
K
n
o
w
s
Knows
Knows
K
n
o
w
s
Answer critical business questions
8
© 2023 Neo4j, Inc. All rights reserved.
Vector Index
Search
9
https://neo4j.com/blog/vector-search-deeper-insights/
10
What is a vector
● Length
● Direction
● Components have meaning
horizontal
vertical
11
Vector arithmetic
1
a
b
2
a
b
3
a + b
12
What are vector embeddings
● Same concepts, just “an arrow”
● 100s or 1000s dimensions
● Each dimension corresponds to an
interesting feature or characteristic
13
Kings and Queens
king − man + woman ≈ queen
k
i
n
g
man wom
an
1
k
i
n
g
man
wom
an
2
q
u
e
e
n
?
3
14
Neighborhoods
● cosine
● direction / angle based
vector point
query
nearest 4
● Euclidean
● distance based
15
KGs enable searches with explicit and
implicit (vectors) relationships
16
Neo4j and Vector Search
Find relevant documents and
content for user queries
Find entities associated to
content and patterns in
connected data.
Improve search relevance &
insights by enhancing a
Knowledge Graph. Use graph
algorithms and ML to
discover new relationships,
entities, and groups.
Vector Similarity
Search
Graph Traversals &
Pattern Matching
Knowledge Graph
Inference & ML
Vector Search
Graph Database
17
© 2023 Neo4j, Inc. All rights reserved.
LLMs and GenAI
18
19
20
Gen AI is everywhere
We’re at mile one of the marathon
21
The next big thing
22
23
24
Learns random
sentences from
random people
Talks like a person
but doesn’t really
understand what
it’s saying
Occasionally
speaks absolute
nonsense
Is a cute little bird
Yes Yes Yes Yes
Yes Yes Yes No
The limitations of GenAI
25
LLM Hallucinations
Definition: Language models generate text that
is incorrect, nonsensical, or unreal.
• Appear to answer questions confidently
even if they don’t have facts
• May provide contradicting or inconsistent
responses to similar prompts
26
The limitations of GenAI
Hallucinates
Limited
input sizes for
fine tuning
Lack
of enterprise
domain
knowledge
Inability
to verify
answers
Sensitive
to prompt (input)
phrasing
Ethical and
data bias
concerns
27
How to Help LLMs Do Better?
Fine-Tuning Grounding
Provide completed
examples “shots” to the AI
as context in prompts.
a.k.a In-Context Learning
Provide additional training
data to better tune GenAI
to your use case
Provide AI with the
information to use for
generating responses
All of these are useful, but grounding is where Neo4j adds value
Neo4j as the data source
for Grounding
28
Few-Shot Learning
Ground LLMs in Neo4j’s Knowledge Graph
29
29
30
31
1
2
LLMs for Language Generation
Gen AI use cases
Generate
personalized
Natural Language
experiences
Neo4j Inc. All rights reserved 2023
33
1
2
LLMs for Language Generation
RAG-based Applications
Gen AI use cases
Grounding with
Retrieval Augmented
Generation (RAG)
Neo4j Inc. All rights reserved 2023
Natural Language
(NL) Search on
explicit relationships
Neo4j Inc. All rights reserved 2023
Neo4j Inc. All rights reserved 2023
36
Natural Language
Search combining
explicit and implicit
relationships
37
1
2
3
LLMs for Language Generation
RAG-based Applications
Gen AI use cases
Knowledge Graph Construction
Creating a
Knowledge Graph
From Unstructured
Text was Difficult
Neo4j Inc. All rights reserved 2023
Knowledge Graph
Creation with
Cypher Templates
Neo4j Inc. All rights reserved 2023
39
© 2023 Neo4j, Inc. All rights reserved.
How will you
transform your
organization?
© 2023 Neo4j, Inc. All rights reserved.
Thank You!
See you 9th April 2024 at our
next GraphSummit Madrid!
41

Neo4j y GenAI

  • 1.
    Neo4j Inc. Allrights reserved 2023 Neo4j and GenAI Luis Salvador PreSales Engineer EMEA South
  • 2.
    Graph creates a moreintuitive and connected view of data relationships, unlocking deeper insights and context 2
  • 3.
    THE PROPERTY GRAPH:SIMPLY POWERFUL Employee City Company Nodes represent objects (nouns) Relationships are directional Relationships connect nodes are represent actions (verbs) Relationships can have properties (name/value pairs) Nodes can have properties (name/value pairs) name: Emil Eifrem date_of_birth: 1979-03-01 employee_ID: 1 :HAS_CEO start_date: 2008-01-20 :LOCATED_IN 3
  • 4.
    Hybrid Workload Duality Intelligent Applications Transactions- Security - Performance & Scalability - ACID Consistency - Intelligent Modeling - Extensive & Supported Algo Library - Scalable - Graph Visualization - Graph Transformations Graph Transactions Graph Analytics & Data Science 4
  • 5.
    © 2023 Neo4j,Inc. All rights reserved. Neo4j Graph Data Science 5
  • 6.
    What’s in itfor you: ● Improve model accuracy by 30% ● Simplify processes and remove headaches ● More projects into production without additional hiring Neo4j Graph Data Science Analytics Feature Engineering Data Exploration Graph Data Science Queries & Search Machine Learning Visualization 6
  • 7.
    When do youneed Graph Algorithms? Query (e.g. Cypher) Real-time, local decisioning and pattern matching Graph Algorithms Global analysis and iterations You know what you’re looking for and making a decision You’re learning the overall structure of a network, updating data, and predicting Local Patterns Global Computation 7
  • 8.
    What’s important? Prioritization Who hasthe most connections? Who has the highest page rank? Who is an influencer? What’s unusual? Anomaly & Fraud Detection Where is a community forming? What are the group dynamics? What’s unusual about this data? What’s next? Predictions What’s the most common path? Who is in the same community? What relationship will form? Pl ay s Lives_in In_sport Likes F a n _ o f Plays_for K n o w s Knows Knows K n o w s Answer critical business questions 8
  • 9.
    © 2023 Neo4j,Inc. All rights reserved. Vector Index Search 9
  • 10.
  • 11.
    What is avector ● Length ● Direction ● Components have meaning horizontal vertical 11
  • 12.
  • 13.
    What are vectorembeddings ● Same concepts, just “an arrow” ● 100s or 1000s dimensions ● Each dimension corresponds to an interesting feature or characteristic 13
  • 14.
    Kings and Queens king− man + woman ≈ queen k i n g man wom an 1 k i n g man wom an 2 q u e e n ? 3 14
  • 15.
    Neighborhoods ● cosine ● direction/ angle based vector point query nearest 4 ● Euclidean ● distance based 15
  • 16.
    KGs enable searcheswith explicit and implicit (vectors) relationships 16
  • 17.
    Neo4j and VectorSearch Find relevant documents and content for user queries Find entities associated to content and patterns in connected data. Improve search relevance & insights by enhancing a Knowledge Graph. Use graph algorithms and ML to discover new relationships, entities, and groups. Vector Similarity Search Graph Traversals & Pattern Matching Knowledge Graph Inference & ML Vector Search Graph Database 17
  • 18.
    © 2023 Neo4j,Inc. All rights reserved. LLMs and GenAI 18
  • 19.
  • 20.
  • 21.
    Gen AI iseverywhere We’re at mile one of the marathon 21 The next big thing
  • 22.
  • 23.
  • 24.
  • 25.
    Learns random sentences from randompeople Talks like a person but doesn’t really understand what it’s saying Occasionally speaks absolute nonsense Is a cute little bird Yes Yes Yes Yes Yes Yes Yes No The limitations of GenAI 25
  • 26.
    LLM Hallucinations Definition: Languagemodels generate text that is incorrect, nonsensical, or unreal. • Appear to answer questions confidently even if they don’t have facts • May provide contradicting or inconsistent responses to similar prompts 26
  • 27.
    The limitations ofGenAI Hallucinates Limited input sizes for fine tuning Lack of enterprise domain knowledge Inability to verify answers Sensitive to prompt (input) phrasing Ethical and data bias concerns 27
  • 28.
    How to HelpLLMs Do Better? Fine-Tuning Grounding Provide completed examples “shots” to the AI as context in prompts. a.k.a In-Context Learning Provide additional training data to better tune GenAI to your use case Provide AI with the information to use for generating responses All of these are useful, but grounding is where Neo4j adds value Neo4j as the data source for Grounding 28 Few-Shot Learning
  • 29.
    Ground LLMs inNeo4j’s Knowledge Graph 29 29
  • 30.
  • 31.
    31 1 2 LLMs for LanguageGeneration Gen AI use cases
  • 32.
  • 33.
    33 1 2 LLMs for LanguageGeneration RAG-based Applications Gen AI use cases
  • 34.
    Grounding with Retrieval Augmented Generation(RAG) Neo4j Inc. All rights reserved 2023
  • 35.
    Natural Language (NL) Searchon explicit relationships Neo4j Inc. All rights reserved 2023
  • 36.
    Neo4j Inc. Allrights reserved 2023 36 Natural Language Search combining explicit and implicit relationships
  • 37.
    37 1 2 3 LLMs for LanguageGeneration RAG-based Applications Gen AI use cases Knowledge Graph Construction
  • 38.
    Creating a Knowledge Graph FromUnstructured Text was Difficult Neo4j Inc. All rights reserved 2023
  • 39.
    Knowledge Graph Creation with CypherTemplates Neo4j Inc. All rights reserved 2023 39
  • 40.
    © 2023 Neo4j,Inc. All rights reserved. How will you transform your organization?
  • 41.
    © 2023 Neo4j,Inc. All rights reserved. Thank You! See you 9th April 2024 at our next GraphSummit Madrid! 41