AIAI EngineerJun 27, 2025· 1:41:16

Graph Intelligence: Enhance Reasoning and Retrieval Using Graph Analytics - Alison & Andreas, Neo4j

Alison Cossette and Andreas Kollegger from Neo4j demonstrate how graph data science algorithms enhance GraphRAG systems by connecting, clustering, and curating unstructured data. They walk through running KNN similarity (K=25) on document embeddings, then applying Louvain community detection to identify clusters of near-identical chunks—one community had 49 documents with 0.98 average similarity—which can be collapsed via APOC to improve retrieval efficiency while preserving lineage. Using page rank and betweenness centrality, they show how to surface influential documents and track conversation paths across communities. The session uses a preloaded Neo4j AuraDB database with 17K nodes and 774K relationships from the Agent Neo project, and includes practical cipher queries for projecting graphs and running algorithms. They emphasize using graph analytics to diversify retrieval, manage content hygiene, and build accountable agent systems.

  1. 0:00Intro
  2. 3:00RAG Overview
  3. 10:19Knowledge Graph
  4. 26:01Hands-On Setup
  5. 56:50Graph Algorithms
  6. 1:10:40Curating Data
  7. 1:23:27Advanced Analytics
  8. 1:32:00Q&A

Powered by PodHood

Transcript

Intro0:00

Alison Cossette0:15

Hey y'all, how are you doing? How's the day? I'm pretty excited to be here. Um, I was here last year and then we were at the summit, the Agent Summit, not that long ago. I've definitely seen some familiar faces in all of those places.

So thank you for coming to our conversation today. Um, my name is Alison Cossette. I am with the Developer Relations team. You will likely recognize this face from all of the Graph RAG, um, videos on deep learning.

Guest0:44

Yeah.

Alison Cossette0:44

Chilling with Andrew Eng, like, you know.

Guest0:46

Yeah.

Alison Cossette0:46

All the guys in the AI.

Guest0:47

I do. I can imagine.

Alison Cossette0:48

Yeah, yeah. It's just, it's just how you roll.

Guest0:50

Yeah.

Alison Cossette0:50

Um, so what I'm going to be talking to you about today, so was anybody in the Neo4j workshop this morning with Sash?

Guest0:57

Oh, I'm sure.

Alison Cossette0:58

Oh, this is great. I love it. It's like Neo4j day here. Um, so yeah, we're going to do a few things. So that's good. Um, you may have, well, no, I'm going to just go like you didn't do that.

Okay. Um, so this is our repo that we're going to be working with today. It has, uh, yes.

Guest1:18

So is it?

Alison Cossette1:20

Is it not there?

Guest1:20

Like, because I can see your profile, but I can't really see your account.

Alison Cossette1:24

Mm-mm.

Guest1:25

Do you see? I do.

Alison Cossette1:26

Uh, you know, that would not surprise me that I made that mistake. One moment, please. Let's see my settings. Yep, it probably, I think it defaults to, da da da da da. I know it's in here somewhere. Change visibility.

Change to public. Sorry.

Allright.

Oh, now I got to, oh man. So much security. Ugh. Allright. Mm-mm.

Sorry about that, folks.

Yes. Confirming access. Okay. Is that better? Excellent. Allright. Sorry about that. Um, so yes.

Guest2:25

I think the third sense you can turn off the front lights so the PC.

Alison Cossette2:28

Oh, so you can actually see. Yeah. I'm always in dark mode. Sorry. Can we do, can we do that? I don't know.

Guest2:34

Just these lights along here?

Alison Cossette2:35

Yeah. Just the lights in front of the video screen.

We'll work on that. Um, I love that people are raising their hand. This makes me very excited. Like, I love talking to people. I love being in the room with folks. Um, so this is good. So I'll tell you a little bit about what our goals are for our next, you know, 120 minutes together.

What we're focusing on, obviously a lot of you went to the intro to Graph RAG this morning. How many people have been working on RAG applications already? Yes, yes, yes. Excellent. How many people have been working on Graph RAG already?

RAG Overview3:00

Alison Cossette3:16

A good number. Okay. Um, so what I'm going to be doing today is talking specifically about how you can use Graph Data Science to improve what you're working on in your, um, in your applications. The reason that we are doing this is because one of the beauties of having a graph is you now get access to new ways of thinking and understanding about the data that you have.

And so my goal today is to have everybody feel comfortable with some of the basics of the algorithms of graph. And, you know, hopefully while you're working through this, you can see something that's going to be of interest or might be something that you want to try when you get back to your application.

Um, I do this a lot, and I will say the most successful workshops we have are when people bring their real-world scenarios to bear. So we will be going over the code, but a lot of what we're going to be doing is talking through the, the con the concepts and around, um, graph as a tool for managing your RAG.

And we're really just going to be talking about graph algorithms. Anybody here come from the data science side of things? Oh, oh, allright. We got a few. We got a few. Um, one of the things that I think is really interesting about the term AI engineer is, you know, somebody said, "Oh, it's just engineering.

Like, it's still pipelines." I'm like, "No, it's not. It's different." Right? I came initially from the AI side, and I can tell you that none of us, none of us look at things the same way that we did, you know, a few years back.

It isn't the data scientists on one side and people putting things into production on the other. You know, we work really closely. And so what my hope now is, like, the there's this concept that people say all the time that, you know, developers are just building the pipes and that the data scientists are worried about the quality of the water inside the pipe.

But with AI engineers, we're all worried about the pipes and the water. Right? So what I really want is to give you as much as I can about the algorithms and about the data science and get us rolling.

So let me see. Where's my repo? Where's my repo? Okay. Um, yeah. So just clone this repo. You can, you'll have it. We'll, we're going to walk through it. It's, um, it's, it's really just like a click-through of a number of Jupyter notebooks.

Um, but really, like, it's mostly about the conversation that we're going to have today is where we're going. So obviously everybody here, like, we always start with the basics,right? I call them the, the GPS moments. So let's review all the things everybody knows first.

We know that in our RAG applications, what we're really trying to do is we're really, we're getting better answers. Right? That's what everybody here is struggling with. Um, like, some of the common things I hear people struggle with are, um, am I getting theright data?

Do I have theright chunking strategy? Um, how do I handle temporal data? How do I handle data quality? Um, what are, what are some of your biggest, like, RAG challenges? Anybody want to share? That what just irks you about what you've been working on?

Everybody's so quiet. I should have set up a Slack channel. Yeah.

Guest6:32

It's basically a couple of things. One is, uh, how to establish the relationship between the data.

Alison Cossette6:38

Mm-hmm.

Guest6:39

Two is the volume of data. Right?

Alison Cossette6:41

Yes.

Guest6:41

Those are the two limitations I see.

Alison Cossette6:43

Yeah. So we're definitely going to talk about, we're going to talk about that today. Um, I think one of the things that we found is that the management is, um.

Guest6:52

Question.

Alison Cossette6:52

What?

Guest6:53

What was the question?

Alison Cossette6:53

Oh, sorry. Um, the, the comment was, um, how to handle the volume of the data was a really big one. And the other element was.

Guest7:02

Relationships in the data.

Alison Cossette7:03

Understanding the relationships among the data. So did you go to this morning's workshop?

Guest7:08

No.

Alison Cossette7:08

Oh, okay. Well, you'll, we have lots of video on it, so we can, we can definitely get that to you. Yes.

Guest7:13

I would add, like, temporal relationships.

Alison Cossette7:16

Yes. Yeah. Temporal is a really interesting thing. Um, I don't, I didn't, I don't have temporal in the slides, but we can definitely talk about temporal 'cause it's really important for sure. Um, one of the things that we find is, you know, I, I, I will give you my apologies upfront.

I get super excited about graphs. So I apologize in advance if I am overly enthusiastic about what I do because I love graphs. And there's so many times where something comes up and you're like, "Oh, well, if you use graph, you could address it this way."

So I just want to, you know, keep bringing these things up and let's talk through all of them. But what we're really looking at is how do we give this complete and curated response? Right? What are we using for the external data?

I mean, initially everybody drops their stuff into Pinecone or Weaviate, you hit a vector store. Um, is anybody now working with multiple databases feeding into their RAG system? A little bit? Yeah. Still primarily vectors? Primarily vectors? Yeah. Yeah.

I mean, everybody uses vectors 'cause they work. Right? Um, and that's the starting point. But the thing about the vector is the vector really is, I, the analogy I always say is it's like you have a bunch of little index cards.

And so imagine if I'm the, my first day on the job and everything there is to know about my is about what I have to do is on an index card. And I say, "Oh, well, what do I know about this?"

And then somebody finds the index card with this little blurb. And so like, I've just got these little things, but I don't understand how it all puts together. Right? We don't understand what is it connected to. Right? What is it connected to?

What context do we need? And so what I want you to start thinking about is what are the projects that you've already been working on? When you're getting those answers back, what are some of the pieces of information that you wish your vector had?

Right? Does anybody have an idea of something they w you don't have to share, but like, you've thought about like, "Oh, if only it could do this." Right? If only it knew about that, I would get a much better answer.

If you haven't, then I'm sure like the, your business folks that you're responding to have because they always have an opinion. Right? So one of the things about the knowledge graph is that it's a way for us to bring our structured data and our unstructured data together.

The other thing that it will do is it will actually find knowledge inside of your unstructured documents. Right? So one of the things you brought up was how do we create the relationships among these documents or among these pieces of information?

And there's a couple of ways that happens. One is it's really explicit. Right? There's a table of information inside this document, and you can pull that out. Right? Old school regex, everybody's friend. Or it's something that is less explicit and more implicit.

And that's where the LLMs come in, finding out what is in there. So in the, this morning's one, and if you, um, want to hit us up, we can definitely show you how we actually extract and build the knowledge graph.

What we're working with today is I have a, a database already set for you folks that is a data dump that we're going to load into your pro trials. But the thing is, this data comes from lots of different places.

Knowledge Graph10:19

Alison Cossette10:33

So I guess most people here are familiar with the graph, but just in case, I do like the, my little GPS moments. Let's talk about all the things we already know. What is a graph? Right? Basically, we start with nodes.

Nodes are entities. They're your nouns. They're your items. Some people relate them to the tables in your, you know, relational database. These are your table names. Right? But the important thing is the relationships among those entities. So a customer and a product, a product and a part, a, you know, supplier and a buyer.

It's the relationships in and among these pieces of information that's where our business and where our information lives. In this case, we've got two people. One of them owns a car. One of them drives the car. They do know each other.

I'm not sure why person one lives with person two, but not the other way around. Who knows? Life is interesting. Right? Um, so we have these relationships, and this tells us what is the, the story of the interaction, um, between and among these.

And properties. This is where we get into the nitty-gritty. We get into the details. These are those extra columns within the table. Right? Our relationships are our foreign keys. Our properties are the columns. The entities are the tables.

Like roughly,right? You know, don't quote me on it, but pretty close. Right? As from a conceptual point. Um, these properties can live on the entities. They can also live on the relationships. Right? So we can see that this person has been driving the car since this date.

It's a very old car now. Um, but one of the other things that we're going to see is we see underneath this car, we see a couple of things. We've got, uh, the brand, the model, we have a description of the car.

And what you'll see underneath is the description embedding. So we're all familiar with the embeddings. Right? The embedding is a way of taking some piece of text, putting it into, you know, many, many dimensions and creating a vector in space that represents the semantics of whatever that text is.

One of the things that's really great about a graph is that you have immediately that connection from the embedding to all of the other information. We see it in this microcosm here of the car, the embedding of the car.

And you can pretty quickly see, "Oh, if I did a vector search on, you know, this car,right, um, and I wanted to know who are the people that own cars described like X," it's a pretty quick traversal. You're going to do a vector search.

It's going to take you to that node, that entity. Right? Similar to your chunks that you've already been working with. But immediately you already have all the relationships built in because they're already in the database. Right? We don't have to, we don't have to, like, create new tables and views.

Everything's already there and it's connected. So when you go into Graph RAG and you're working with your retrievers, the beauty of the retriever is in this ability to traverse and traverse very quickly and get that immediate context. Right?

So these are the basic components of what we're going to be working with within the database. So we're going to start at the very beginning. Right? How does this, how does this work? We start with the entity. The first entity is the document, and the document has a chunk.

Right? Pretty straightforward. It's a row in your vector store. Right? But this is the interesting thing. You also have, like, anybody here working with agents already? MCP servers? Yeah. The other thing that we get and what we're going to be talking a lot about today is the application.

I call it the application graph. Like, they call it a memory graph. For me, it's what is the actual activity that's happening in the system? What is, what is it doing? What are the messages going in and out?

What are the context documents that are being used? Right? Everything that we're building is moving quickly, and it's moving at volume. There's massive amounts of documents and data. There's so, so much volume. How do we actually manage it?

What do we do? This is going to be a key part of what we talk about today, which is the actual understanding of what's happening in the application and how by monitoring and looking at what's going on in the application, you can do things like manage your documents at scale.

You can understand what are the actual important documents, what's influencing outcomes. Right? Um, I've got some, some good stories to, to share with you about what people have been working on. Um, one of the things you mentioned is what other elements are there.

So when we look at the entirety of the graph, we have like the memory graph or the application. It's connected to the chunks, and then those chunks are connected to the domain, the products, the people, basically all the other structured pieces of your business, or the structured elements that you've extracted from those unstructured documents.

So what you end up with is you end up with a fully connected network of your data and your system together. So much of the way that we have approached development prior is you had your data people over here and your building people over there.

We're all together now. Right? We all work together. And the way that we have to build is we build from that cohesive point. We build from the data and the application at the same time. So I'm just going to show you what becomes possible as you start taking this kind of an approach.

Everything that we're looking at today is just this little bit of the graph. Right? So we're going to be looking at prompts and responses, and we're going to be looking at the context documents that they're connected to. And then from there, we're going to say, "Okay, let's, let's figure out what, where we go now and what we can start to understand."

Anybody have any questions so far?

All sounds really obvious. Like, why are you still talking about this? Too slow, too fast? Are we good? You're good. Okay. Allright. Good pacing. Um, if I go too fast 'cause I'm from New York, I'm a fast talker, let me know.

If you're getting bored, just kind of give me one of these and be like, "Okay, like, let's go." Um, so that's fine too. Uh, but the best thing that you can do is like, when you have a question, just raise your hand because everybody has the same kinds of questions.

Everybody's struggling with things. And what I love about AI Engineer is I get to be with the people who are doing the things that are like, you are the people that are making everything happenright now. Right? I mean, our entire world is in like just this incredible transformation, and y'all are the people that are building it.

And so I want to be here to support you in this moment 'cause it's a pretty exciting time. So please don't be shy. Questions, comments? Yes.

Guest17:22

I'll find the slide deck.

Alison Cossette17:24

Oh, I will, I will drop it in. It's not inright now, but I will drop it in before, uh, before we leave.

Guest17:29

Thanks.

Alison Cossette17:30

Yeah. Allright. Um.

Guest17:33

Just a quick question.

Alison Cossette17:33

Yeah.

Guest17:33

Can you differentiate between the different in the previous slide?

Alison Cossette17:36

Yeah.

Guest17:37

How do you differentiate between, uh, domain graph, lexical graph, memory graph?

Alison Cossette17:42

Yeah. So they're all the same system. They're really just sort of like neighborhoods. Right? They're kind of neighborhoods in the system. Um, the reason that we draw it out is because oftentimes people think of them as separate. Right?

So, um, this one doesn't have everything. But what we see here is we've got, this has a, this one has the source. So the yellow nodes are things that are coming from your application. The blues came from unstructured data.

Um, we're not doing it today, but if you had structured data that you were also pulling in, like a, bringing in a table, bringing in some of, or whether it's, you know, already structured or has been brought out of your unstructured data, that would be just a different color.

It's all one system, but the reason that we do this is just so that people conceptually understand where it's coming from and like what does it do. Because the big thing really is understanding the fact that once it's all connected, your application is talking to all of the data, and then your structured and your unstructured are all working together.

And at any time, you have access to understanding across that system. It's like, you know, complex systems and system thinking and all that good juiciness. So they're not separate. They're just neighborhoods. Yes.

Guest18:57

So, so, um, what you are, you're proposing that you have like one massive graph?

Alison Cossette19:04

Yeah.

Guest19:05

Okay.

Alison Cossette19:06

I mean, don't start with a massive graph. Right? Like, let's be honest. Let's start with something small. I mean, my first piece of advice is always start small. Um, the other thing to really, as always, we always want to look at optimization.

We want to make sure that we're building for the latency that we need. There, there's always going to be context. Yes.

Guest19:24

Can you elaborate on that? They mentioned it this morning as well.

Alison Cossette19:27

Yeah.

Guest19:27

To start small, but we're trying to map, for example, the ontology of, of, of an organization and, and be able to have an assistant have access to that.

Alison Cossette19:34

Yeah.

Guest19:34

We've always had to go big.

Alison Cossette19:36

Yeah.

Guest19:36

How do you, how do you, how do you do small? Just break it apart or?

Alison Cossette19:40

Yeah. Um, well, I mean, that's probably an ABK question.

Andreas Kollegger19:45

Yeah. So some of the complexity, like for, for really big graphs, part of the bigness of it is not just the number of nodes and relationships you have, but the number of labels and relationship types that you have.

And for like a larger organization, don't over-specify. So you start up with like kind of generic terms, see if that works. And if you've got too many, too much volume in the generic terms to segment, then you get more specific.

And so, and the other part about that, I suppose, is that you start with not all of the data, but like some of the data, work with it, do some eval, figure out if it's doing what you want to, and then refine before you suck in everything and create the entire database.

So you kind of iterate on the schema with a subset of the data. It's normal data engineering, I guess. Right?

Alison Cossette20:28

Yeah.

Andreas Kollegger20:28

Do just some of the data, start generic, and then get more specific. Yep.

Guest20:33

Can we follow up? Uh, when you say.

Alison Cossette20:35

Sorry.

Guest20:36

The, um.

Alison Cossette20:37

Yeah, me too.

Guest20:38

When you say, um, uh, big versus small, you're talking ontology, not knowledge graph. Right?

Andreas Kollegger20:43

Correct. Yeah. That'sright. So on, so talking about the ontology or the schema, like the how the graph is actually laid out rather than the number of each kinds of things. Right? So starting there, iterating on that first and then bringing all the data.

Yeah.

Alison Cossette20:56

Yeah.

Guest20:57

What are your thoughts on that? After indexes are representing indexes in a tree-based structure based on some hierarchy versus knowledge graphs and what performs better in what scenarios?

Alison Cossette21:08

That's definitely a.

Andreas Kollegger21:10

Uh, the raptor-based indexes, like if you represent content in more hierarchical tree-based structures and then you are having summaries and hierarchical nodes searching through those versus knowledge graphs, which scenarios plays out better? Like we should go with raptor indexes versus knowledge graphs or?

Guest21:29

Yeah.

Andreas Kollegger21:30

Theright answer is the annoying answer of it depends. And so you should have your eval drive the structure. Right? So come up with some eval. What are the, what are you actually trying to do? What are the questions people are going to ask?

And it's the usual thing. The questions people that you're going to ask or people are going to ask should drive the data model here, the ontology. But that also ends up meaning do you put things into summarization over communities or do you have the knowledge graph representation of it that's going to be driven by the questions?

Guest21:56

Yeah. Makes sense. Thanks.

Andreas Kollegger21:57

Yeah. So if you can find your way to that, uh, workshop near for J, I've just pasted it in OpenAI key there. You're going to end up needing that at some point, um, while we get this repo updated.

And I guess at the meantime as well, I'll just answer any arbitrary questions you have.

Alison Cossette22:13

Yeah.

Guest22:13

Disambiguation.

Andreas Kollegger22:14

Yeah.

Guest22:14

Two channels. One is Neo4j, workshop Neo4j, and the other one, workshop Neo4j 2025.

Alison Cossette22:20

Yeah. It's neither of those.

Andreas Kollegger22:21

Really?

Alison Cossette22:22

It's the graph analytics workshop.

Andreas Kollegger22:23

What?

Alison Cossette22:25

I've done so many different workshops lately. Like it's, yeah. I'll see about the repo. Sorry.

Andreas Kollegger22:30

The Slack channel. Yeah.

Alison Cossette22:31

Oh.

Andreas Kollegger22:32

No. So.

Alison Cossette22:32

Oh, you have a Slack channel?

Andreas Kollegger22:33

There's a Slack channel in the AI Engineers workspace. There's two. Okay. So it should be the workshop dash Neo4j one, not the workshop dash Neo4j 2025. I didn't realize there was yet another one. Okay.

Guest22:46

Allright.

Alison Cossette22:49

Allright.

Andreas Kollegger22:51

Yeah. And thank you, Devin, for putting in the, the GitHub link.

Alison Cossette22:54

Oh, no.

Andreas Kollegger22:55

Where are you?

Alison Cossette22:55

Hold on. Hold the phone because

let me do this.

Andreas Kollegger23:04

So one of the things that we're going to end up exploring here, and we, we touched on this a little bit this morning, um, some of the motivation behind both Graph RAG and then also doing graph analytics on top of the graph.

One of the aspects I, I always like to call out, and it isn't as, as obvious, I think, until you get pointed out, and then it's super obvious, is that part of what we're doing is for the core data you start with, particularly with unstructured data, if you're doing chunking, of course, that by using Graph RAG and graph analytics, you're expanding the number of answerable questions for the same base data set that if you would say roughly for every chunk you've got, you can answer one question.

Right? And it's being linear. Number of chunks equals number of questions you can answer. If you think for every chunk you've got, you do the, and this is the upper bounds, take every pair of chunks, do the Cartesian product of all the chunks, say, what do these two chunks have together, have in common, or how are they different?

Create relationships or don't create relationships in them. In the upper bounds, that is now, you know, n squared number of possible connections. Every time you do that, that's new information that's possible. So now you've got an order of magnitude more, you know, questions that can be answered.

Once you've got everything connected, you can then also do the community detection stuff that they touched on this morning, and we'll get into maybe a little bit today as well, that now that you've got all these chunks connected, it's not just the pairwise connections that are new information.

It's the subsets that are through those connections that also can answer new bits of information. So that if you have, if I'm in the graph and you're in the graph and you're in the graph, you know, or you over there, whoever it may be, Alison, that it's not just us individually, but like how we're related and who we know, the connections between us and the connections across everybody else, all that ends up being slices of the graph that are particular to the individual places that you started.

That ends up forming all this. It's not the full power set of all the subsets within the set, but it's hugely amount, like if you started with like 10 chunks, by just going to the pairwise connections, you end up with a hundred answerable questions.

And once you start doing the, the subcommunities, so the subset of all the sets, at the upper end, it ends up being exponential. This is the power of graphs.

Alison Cossette25:17

Yes.

Andreas Kollegger25:17

It's two to the n instead of n squared. Right? Which you love math.

Alison Cossette25:21

Thank you, ABK. Um, okay. So we have pushed. If you have pulled, you will want to refresh this poll, uh, this fork. So, um, what you're going to see is a few different things. One is, uh, I do have a link actually to the slides.

And then, um, actually we're not doing Docker. You can ignore that. Um, but when we go down to the bottom in connecting to Neo4j or a DB, you're going to see the link to, um, you're going to see the link to console@neo4j.io.

So we're going to have everybody go there. When you get in there, um, you're going to create a new instance. So let me, oops, sorry.

Yeah. It's console.neo4j.io.

Hands-On Setup26:01

Guest26:04

Oh, where do you get the link?

Alison Cossette26:06

Uh, this is in the README in the repository. Do you not, let me see.

Is it in the Slack channel?

Which, which Slack are we? Are we 2025?

Andreas Kollegger26:19

Not the 2024.

Alison Cossette26:21

We are not 2025. We're old school. We're not 2025. We're either in the future or deep in the past, but we are notright now. Allright. We're the other one. Um, so when you go in there, you're going to have a couple of different options for free tiers.

One is, um, the Oura Free in the Oura Free, which is smaller, doesn't work as, doesn't have as much of the optimization as the Pro trial. So we're going to be using the Pro trial today. Um, I believe it's 14 daysright now on the Pro trial, but you can, if you want to work on your own project later, go in and start an Oura Free instance as well.

And, um, that as long as you're querying it every so often, like it'll stay open and it will always stay free. Yes.

Guest27:03

Is there a preference on the cloud provider?

Alison Cossette27:05

What's that?

Guest27:06

Is there a preference on the cloud provider?

Alison Cossette27:08

Um, no. It's your choice. Your choice.

Guest27:12

What was the question?

Alison Cossette27:13

Oh, sorry. The question was, is there a preference for cloud provider? And I said, no, there is not. The more you spread it out, the easier it is. We move along. Um, yeah. So you're going to get the free trial up and running.

And so, um, what that is going to look like when you create the instance, you're going to see a couple of options. You're going to go with the Oura DB Professional. We're not taking your credit card. We're not doing anything.

Eventually, it'll turn off. Um, but it just is the most robust version that we have. So I guess it's seven days. Seven days. So you're just going to try that for free and you're going to get that up and running.

Why do we still have an Oura DS button? No? Okay. Allright. Don't worry about that. Yes.

Guest27:56

I see options like build a graph forward application before I get to the point you showed.

Alison Cossette28:02

Oh, yeah. Um, onboarding. Sorry. Um, yeah. It just passed. I mean, it's going to ask you some questions. You can just like, it does that thing where it makes you make the graph thing.

Andreas Kollegger28:12

Oh, yeah, yeah.

Alison Cossette28:13

Sorry.

Yeah. It doesn't, I mean, anything is fine. Like don't tell anybody. It's a marketing thing. Like just pass through it. We want to just get you enabled. Um, and then when you go through, you can just use the default.

It's going to default to four gigs. Um, you know, if you want to name your instance, you may. One of the things that's going to, you can definitely turn on graph analytics and vector optimization if you want. Um, and then just click accept and, and it'll start up your instance and it'll take a couple of minutes.

Once that instance is up and running, we'll get you to the dump and we'll get that loaded in. So I'm just going to give everybody a couple of minutes to work on this. If you get stuck on this process, just raise your hand 'cause I got lots of my people, my Neo4j people, wave.

Alexi, that's you too.

Andreas Kollegger29:03

Also, Alexi, that's me.

Alison Cossette29:05

Yeah. Yes. Yes. You're being, he's being called on in class,right? Um, he wasn't asleep, so that's good. He was just working. Um, yeah. So if you get stuck on anything, just let us know. Okay. But what I can do while we're, while y'all are getting that up and running is I can show you a little bit about what is inside of our database.

Um, the, the console, it makes it really easy. Not only do you have access to your instances, you have access to graph analytics, but, um, you know, the basic IDE, which is the query, uh, will be connected as well.

So

I got one of each. Let's see what's in the database. Oh, I know. That'sright. I, I emptied it because I wanted you guys to be able to like do the dump with me. Okay. Oh, no. There it is.

Okay. Allright. Okay. So we've got the query. And in the query, for those of you who love your cipher, you know, we can say return n, limit 10. Um, all the cipher that we're using today, like I've already, I've already got in the notebooks.

Um, but what, what you'll see is when, when you do a query, querying in cipher is really all about the pattern. So in this case, I'm just doing a match n. You probably, probably can't see that.

Andreas Kollegger30:21

Yeah. I was going to ask.

Alison Cossette30:23

Yeah. I'll fix it. Hold on. I got to make this so people can see all the things. See all, all that. No, that's not going to work. We're going to zoom in. Um, sorry. Yes.

Guest30:36

I think I don't see the option of selecting a different plan. I had already an account, so.

Alison Cossette30:40

Oh, okay. Okay. Um, if you already have an account.

Andreas Kollegger30:45

Oh, yeah.

Alison Cossette30:46

Oh, you know what you can do? Um, if you already have an account, one of the things you can do is you can log back in. And if you change your email to your email plus like workshop before the at symbol, it'll give you a fresh account.

So like if, if like mine, if I'm like Alison at, you know, Google, if I do Alison plus workshop at Google, it'll still be your email address. It'll still go to you, but it will be seen as a new account.

So that's another option.

Guest31:13

I see you create a new account.

Alison Cossette31:14

Yeah. Just create a new account. It'll make your life easy.

Has anybody been able to get their, theirs up and running? Ish. No? Yeah. Maybe. It's so interesting 'cause lately I've been noticing like people are so interested in engaging in conversation. There's, uh, less of that, but we definitely don't want to leave anybody behind.

So we'll let y'all do that. So, but just to understand what is actually happening inside Neo4j when you're working with it, um, we run these, we run these patterns,right? So it's similar to, you know, SQL. Like the good news is it's very user-friendly cipher.

Um, and we live in the age of like vibe coding and LLMs. So like there's plenty of help for all of this within our copilots. Um, but depending on what you get back, in this case, you can look at it as a graph, you can see the table, um, or you can see, you know, just the raw values, but the, the graph itself.

So, um, in this case, we're looking at a particular document, which is actually, you know, we call it a document. It's really the chunk. Um, I will tell you that what we have in our, what we, the data that we're working with is from a project that we actually have live.

Um, and it's called Agent Neo. And it was built a while ago now with the, by some of the guys who were helping build the first RAG application on our graph data science platform. Um, and our knowledge share there.

So this has been in play for a while, but when we look at the data model itself,right, what you're going to see is what I talked about before,right? That application understanding. So we've got a session. So somebody logs into the application, they start a conversation, they have their first message,right?

This is the user prompt. Then that prompt is going to get an answer,right? There, there's a message that comes back from the assistant. And then that assistant is going to be going out and pulling in context documents,right? So it's going to do your cosine similarity.

Who does Euclidean? I don't know. It's a thing, I guess. Um, does your cosine similarity, and it's going to bring those documents back and you're, we're going to start to see the chain of what that conversation looks like,right?

So this is that application base. And then these are, these are the chunks. So it's really just what we looked at in that previous view, but just to show you what it actually looks like. So what's in this, you know, lots of documents from our documentation, developer blogs, support.

Um, we, this was early on, our earliest chunking. We had a 512 chunk size. Um, we use a LangChain recursive splitter. So it was pretty early on. Um, let me see. Hold on a second. I want to show you.

Where are my oh, that's not what I want to show you. Where did it go?

Here we go.

Allright. So once the, the system actually starts running, what you see is this is, this is actually one user having two different conversations. This is their first conversation. This is their second conversation. The first question is, can you build graphs for me?

And then the next one was, what is GDS? And then you see the beginning of what that response was. Yes, I can build for you. GDS stands for. Um, and so you can, just to give you an idea of how this starts to build out.

Now, this might look a little bit frightening, but I'll walk you through what we're actually looking at. So what does it mean when we start looking in practice? So this is the same user,right? With those initial two conversations.

Um, what does graph data science, uh, yeah, what is GDS? This is also what is GDS? And then can you build graphs for me? And what we're looking at here is these are the conversations and these are the context documents that are being brought in.

And what's interesting or plausible, it makes sense, this person asked the same opening question. So it stands to reason that these same documents are going to be used in both of these first responses,right? Makes sense. Then what we find is this person's next conversation says, um, how can I have, how can I learn more about GDS?

Is their follow-up question,right? And that makes sense that it's going to now share things with can you build because this person is then having their next prompt, which is, oh no, that, that one just stopped after one. But what I wanted to show you is that what we see here is that in this middle conversation, the conversation started out in this area of information,right?

It started out in what is GDS? What are some of the basics? But then the conversation went into something similar to someone else. And the reason that we want you to see this is you want to be able to see how are the conversations connecting to the data itself?

Because what we're going to start to see is we're going to start to see that it's not just about a single row. It's not just about a vector. Because the way the documents are used and the way people travel through your data gives you information about what they're using.

The reason that becomes helpful is when you're trying to manage at scale, how do I know with all these documents, what are the ones that I should even be looking at? What is it that people are constantly going back to?

What are the areas of knowledge where things are happening? And so what we're seeing here is that these elementsright here were in both answers,right? So you see this first question had, this first response had context and this had context.

So it was in both of those. These are individuals. These over here were only in this one. Some of those were only in that one. You can imagine like how quickly this gets very, very hairy. Oh, where did it go?

Nope. I guess that's it. I didn't have the extra one. Um, so the, the point is we can, we can start to understand the movement of what's happening. Is there a question? Someone? No? Okay. Anybody have any questions so far?

Ponderings, waiting till we get to juicy things? Yes.

Guest37:15

Are the pink those chunks of documents?

Alison Cossette37:17

Yes. Yes. The pink ones are the chunks. The orange is the user prompt. The tan is the, um, the, the RAG application's response.

So you can already see how it's starting to connect to the system itself,right? So let me get back on point here. We got things. We got things, things, things, things, things. Okay.

Guest37:42

And sorry, are you storing the entire chunk into the graph? And how performant is that? And when does performance become a concern?

Alison Cossette37:49

Yeah. So what we're going to see is we are actually, we do actually have the chunk. Um, our chunks are pretty small. Um, I, the size of the, of the text doesn't really change the performance, does it? Like as far as like once it's stored in the property is really the traversal that is where things get.

Andreas Kollegger38:10

For most chunk sizes, it's fine because most chunks are like in the K and most it's not megabytes of chunk.

Alison Cossette38:15

Right.

Andreas Kollegger38:15

If it's megabytes, then it's like, okay, that becomes problematic.

Alison Cossette38:18

Yeah. I mean, but it would be that for.

Andreas Kollegger38:20

It's, yeah, it's the same thing.

Alison Cossette38:21

Yeah. Um, but what we see is, is like, you know, we said we had these properties. So for this particular document, um, I've run some of these things already, but we've got the document, we've got the text, and we have the embedding.

The embedding is actually a property of the node itself. And that's one of the things that makes it really easy is that you don't have to have a separate vector database,right? The vector is actually stored and then the vector index is built on top.

So once you get all those vectors in, you can run the vector index. And people do really interesting things with vector indexes for sure. Um, so this is where, well, that's not what I want. This is where we start.

Yes.

Andreas Kollegger39:02

Question, question.

Guest39:03

I think, I think I have a question.

Alison Cossette39:06

You definitely have a question. Whether I have an answer is the only thing that's up for debate.

Guest39:11

So let's assume,right? Um, I have very large, let's say legal documents.

Alison Cossette39:15

Mm-hmm.

Guest39:15

Right? Which I'm trying to do something very similar.

Alison Cossette39:18

Yeah.

Guest39:18

Um, and I do these chunkings, you know.

Alison Cossette39:20

Yeah.

Guest39:21

Would I, are you saying I would store the chunks in Neo4j? I would not store the vectors in a vector database, but I'll also store that in Neo4j.

Alison Cossette39:29

Yeah.

Guest39:30

Um, now how would that be from a performance standpoint over time? Like assuming your system continues to grow, um, wouldn't there be a performance impact?

Alison Cossette39:40

Um, I don't know. What, do you know what the largest RAG application is that we have in production in clientsright now?

Andreas Kollegger39:46

That's a good question. I don't know. I know that's like, you know, tens of millions, you know, seems fine. Once it starts getting to hundreds of millions, you might start to have to worry about like what, how to scale past that.

Alison Cossette39:56

Yes.

Guest39:57

And does it still worry across look for similarity across all embeddings?

Alison Cossette40:01

Yeah. I mean, so it depends. So what it will do is it will look across whatever the vector index is that you have. And there are people who, I said, they do some really interesting things with vector indices.

So, um, I've seen people who like have multiple vector indices depending on what the use case is. So when you, when you create the vector index, you actually just do a query and you say, okay, for all of these, create an index on all of these nodes.

And so that's one way that I definitely know people have been doing it. So they'll have multiple indices that already sort of pre-sort or pre-filter what's going to be part of what's coming back from the vector index. So, um, I know one of the ways I've seen people do it is from a governance perspective.

So there's certain data that they want available to everybody, certain data they don't, and they manage that from the vector index.

Guest40:50

Sorry, one more question.

Alison Cossette40:51

Yes, please. I'll let you go for a third, really.

Guest40:56

Um, the other question is if we had documents that actually contained images.

Alison Cossette41:00

Mm-hmm.

Guest41:01

And we wanted to somewhat have a relationship between the text and images, how would you do it here? Does that make sense?

Alison Cossette41:07

Yeah. I mean, normally multimodal, I think most of the time they keep the images separate and then there's a, there's an embedding of the image on the node.

Andreas Kollegger41:15

That'sright.

Alison Cossette41:16

Yeah.

Andreas Kollegger41:16

Yeah. So you'd put the image like large media files, you would put that in an S3 bucket or something. You still wouldn't, you wouldn't put that into the database. So you'd have a URL to the S3 bucket, but you can put the embedding into Neo4j, so on the node.

Yeah.

Alison Cossette41:29

Yeah. We actually have an example of that. Yeah.

Guest41:31

Um, I have a question on, uh, for like normal vector indices,right? You have, uh, like multi-layer, uh, architecture to kind of, uh, query faster.

Alison Cossette41:41

Yeah.

Guest41:42

Is it, is there something similar to that happening here where you can have like different subsets of graphs at different layers?

Alison Cossette41:49

Yeah. I mean, it's not, it's, I mean, it's mostly just the way that the database is actually built. Because of the way the queries run, because you're running on a pattern, um, you actually, I, I kind of call it a, it's like GPS search where it's like start here and then go find what you need to find,right?

So I, I, I don't know if that's the best way to explain that, but, um, when you're running the query, it's going to be very specific. So when you're thinking about, um, like, like how you're running the vector retriever itself, are you talking about like when you're actually doing the retrieval from the vectors?

Yeah. So there's a whole, um, I don't even know how many, how many retrievers there areright now, like eight different retrievers or something, um, in the, the Graph RAG package. It's a Python-based package. Um, so there are some, if you go to actually great place to go is graphrag.com.

It's like an open like reference point and it talks about some of the different types of retrievers. So you can do pre-filtering, you can do post-filtering, um, you can manage it based on the index, which is another like easy way to do it.

Um, you know, sometimes folks will have them where they have different hierarchies. So like when you think about these large legal documents,right? Um, there are ways that you can actually like create the chunks, but use the natural structure of the element as well.

So like we have an example we use with SEC data. Every time somebody files something with the SEC, you know, paragraph one is always this, paragraph seven is that, paragraph nine is that. And so you'll take whatever that natural architecture is within the documents themselves, and then you can, you can leverage that as well.

So one of the other great things about, um, these entities is that you can actually have more than one label. Uh, let me see. Oh, I got to plug in.

So one of the things that you'll see is, so for this particular, this particular one, we see that it's a message, but it's also noted that it's the assistant. So you have some nodes that are, that have more than one label sometimes.

So it makes it so that if you wanted to go across all messages, but I know if I'm trying to understand, um, just the prompts from, they're just the assistant answers or just the prompts, I don't need all of those messages.

So by adding on dual labels, you can actually say, oh, I just want to see these or I just want to see those. So it, it, it allows you to get some of that nuance out of that complexity by leveraging multiple labels on a single node.

One of my favorite tricks personally, but that's just me. Sorry.

Guest 244:28

Yeah, I have a question.

Alison Cossette44:30

Ah, hi.

Guest 244:31

So now like if you have one vector index.

Alison Cossette44:34

Mm-hmm.

Guest 244:34

But don't want to actually search the entire index,right?

Alison Cossette44:38

Yeah.

Guest 244:38

So since that like, let's take this text for example, or like content for example.

Alison Cossette44:42

Uh-huh.

Guest 244:43

You want to only search the content of few nodes.

Alison Cossette44:47

Mm-hmm.

Guest 244:48

Via vector embedding. Is that possible?

Alison Cossette44:51

I mean, there's a number of ways that you can do that. Um, you know, you certainly could. I mean, I personally, I'm a big fan of multiple indices just because I find them to be very efficient. Um, that's one way to do it.

Um, there was a question earlier about temporal issues. Um, you can also use like multiple vector indices to address that temporal portion as well,right? So you can create an index from, why is this? Allright. It's starting up. Um, you can create a vector index.

So like, like if we wanted to, like if we wanted to have a vector index just on, you know, version 1.9 or version 2.6 or whatever, you could have that particular vector. So let's just say I'm building, building a chatbot and the, I know that the customer is currently running whatever version of something.

You can use that as the, as the actual index that you're searching for. So that's another way that you can, that you can address those kinds of things. Did that answer your question?

Guest45:54

So it's just like.

Guest 245:55

So it's just like multiple embeddings, I mean, multiple indices. So not one index.

Alison Cossette45:59

I mean, I don't know. I don't know if engineering would agree with me, but from like a purely like practical, like I got to hack this and get it done, that's my go-to. I mean, is there.

Andreas Kollegger46:12

Yeah. I think that's theright approachright now with Neo4j. I guess you're asking about metadata filtering within the vector index,right? Yeah. And so for us, the vector index is just an index. It's not a vector search.

Alison Cossette46:22

Right.

Andreas Kollegger46:23

Um, and so we don't do metadata filtering on the vector itself. We use the property graph itself for doing the filtering.

Alison Cossette46:29

Right. So you do it before you create the index 'cause the index is only going to go to what's connected to it,right? Um, so it's just.

Andreas Kollegger46:37

So you'll still have the index, but then you can do predicates on top of the nodes you found and then you filter.

Alison Cossette46:42

Yeah.

Andreas Kollegger46:42

After that.

Alison Cossette46:42

Yeah. So even within, once you get that, you can certainly filter in and around that as well.

Andreas Kollegger46:47

Yeah.

Alison Cossette46:47

And if you look at, um, any of our, the vector retriever materials we have, like we walk you through that. We've got, we've got a new ebook coming out. It's gone to print. It's happening. Um, that specifically talks about those retrievers.

Allright. Multiple labels, multiple indices, all the good things. So let's do this. So for those of you who have, let's go back to here. Um, the other thing you're going to see on the read me is you're going to see this Neo4j dump file.

Um, this is the actual dump file from, from our database from last year, I think. Um, then so we're going to, we're going to give that to you. So you can download that file and I'll show you how you can drop that into your, um, let's see.

Sorry.

Allright. So when we go back to our instances, so you should see instance, instance 01 most likely. If you go on theright-hand side of there, there are three little dots. What you're going to see is backup and restore.

So you're going to click on backup and restore and you're going to take that dump file and either browse or just drag and drop it. And it's going to drop in, um, our, our version of the Neo4j agent, uh, agent Neo GDS application data, I guess.

Thanks. Um, so yeah, so you just drag and drop it. It once pretty quick, it'll load pretty quick. Um, and then what you'll see is when you go to query, you'll see this will start to populate. The database information will populate and it'll show you which nodes you have, which nodes and entities you have.

Um, it'll bring in some of the indices. There is, we did run some of the algorithms already. So I'm going to show you how to run them so you can run them on your own. Um, but in the, in the interest of time, we, we have run those already.

So you'll see some of that. Some of them we'll, we'll do live here. They won't be there. Is anybody able to load? Yes.

Guest48:47

Can you repeat the file name?

Alison Cossette48:50

Oh, yeah. So on the read me, on the read me in the repository, if you go all the way down to the bottom where it says connect to Neo4j or a DB, there's a Neo4j dump file that it'll take you to.

Guest49:02

What do you do the next?

Alison Cossette49:05

Sorry. Yeah. And then you'll just download it from there. What's that? Oh, sorry. So when you're in, when you go to console,right, you should be seeing something like this,right? And then on theright-hand side for your instance, you'll see three little dots.

We're going to click on those dots and you're going to go to backup and restore.

And my data is yours. I give it to you. I just dumping itright on you. Allright.

Um, yeah, it's just easier. Nobody wants to load CSVs today. We have no time for these things. Um, yeah. And then from there, you can go straight into the query. So when you go to query, you should see that it's populated.

Is there anybody having trouble loading the data that wants to load the data?

Guest49:56

It's still uploading.

Alison Cossette49:57

It's still uploading. Okay. What's that?

Guest49:59

I couldn't find where in the read me is the dump file.

Alison Cossette50:02

If you, if you, did you, you might have had to repull because I, I, if you repull the repo.

Guest50:08

Oh.

Alison Cossette50:08

Yeah. I had to update it 'cause, you know, I'm well-intentioned, but sorry. Yes.

Guest50:16

Um, when I, uh, restored the dump file.

Alison Cossette50:19

Yeah.

Guest50:20

Should I expect that it'll work in like a few minutes?

Alison Cossette50:22

Yeah. It should. Let me see what you got.

Guest50:24

Um, it keeps doing the loading.

Alison Cossette50:26

It's still loading.

Guest50:27

So that's normal. There's like a latency.

Alison Cossette50:29

It shouldn't be too slow. Oh, what is oh.

Guest50:33

You're probably having network issues. Wi-Fi's pretty slow here for the.

Alison Cossette50:37

Oh, sorry. Yeah. That's always the, the challenge with these things. Um, yeah. Wi-Fi. See, this is why we always have it loaded. I also have it loaded on my desktop because that happened to me recently. I was somewhere and I'm like, there's no Wi-Fi at all and I have to present.

So I also have Neo4j desktop. So if anybody ever, you know, you want to go local, you want to stay on prem, you don't want any of it up in your business, you can also like stay off the cloud, go local.

Also an option. Um, let's see. Where are we? So what are we going to do here? Allright. So I'm going to go into, so within our notebooks, we have three different notebooks. One is, uh, the get to know your graph.

And we'll start there. I don't need this. Um, and really it's like all this is going to do is you'll, you'll run it, you'll do your pip install of all your requirements. And then what you'll, what, oh, wait, I need to give you, is the OpenAI key on here too?

Hold on.

Andreas Kollegger51:38

Oh, I put it in the Slack channel.

Alison Cossette51:39

Oh, it's in the Slack channel. Okay.

Andreas Kollegger51:41

So anybody can find it anywhere in the conference.

Alison Cossette51:44

What's that?

Andreas Kollegger51:44

Enjoy.

Guest51:47

Security.

Andreas Kollegger51:47

Security, you know.

Alison Cossette51:48

So when you, when you set up your database, they should have given you the opportunity to download your credentials.

Guest51:54

Yes. I've set that up, but then.

Alison Cossette51:56

Got it.

Guest51:57

It's getting me probably not found or something.

Alison Cossette51:59

Um, what is this? Not, not supported supported anywhere. Oh, um, did you drop the, so you have to drop, I, sorry, I skipped a spot. You do need to drop the, those credentials that you downloaded into your, in your ENV file.

Guest52:12

I do have it.

Alison Cossette52:13

So you did that. This is your ENV?

Guest52:14

Yeah.

Alison Cossette52:14

Okay. And then.

Guest52:16

I thought you knew it was just that,right?

Alison Cossette52:17

Just pasted it. Yeah. It should be. Let me see.

Guest52:25

I'm not sure I can do it.

Alison Cossette52:27

Yeah. There it'sright here. Yeah. You've got that. Um, what is it actually? What's the actual error?

Andreas Kollegger52:34

Is it just Wi-Fi?

Guest52:35

Yeah.

Alison Cossette52:37

What does it say down here? Schema bolt. Oh.

Guest52:40

I think it's finding.

Alison Cossette52:41

Yeah. Um.

Guest52:42

The URI, I was just thinking.

Alison Cossette52:43

Yeah. The URI should be in your credentials.

Guest52:45

Exactly. I was just, I was just thinking I was just.

Alison Cossette52:47

Yeah.

Guest52:48

It should be it should be. I would take a peek at it. ABK, can you take a look and see what's happening here?

Alison Cossette53:00

Allright. So,

um, yeah. So again, the, the API key is there. We're not using it actually that much today. Um, but one of the things that we have obviously is we need to, oh God, you can't see anything. This thing, I can't see anything.

Oh goodness. Well, that's overwhelming. That's more reasonable. Okay. Is that good? You guys can see? We're good? Okay. Um, yeah. So the basics, obviously we're importing OS. We're bringing in our, our environment variables. Um, you see the Python driver,right?

This is our classic Python driver. And then what I like to do is I like to just do a run query, um, uh, function just because it just makes it easier. Like I, I just like it. Um, you don't have to do it this way.

You could just do driver.session, but, um, that's just how I like to do it. And then when you run this, it'll see that yes, you are actually connected. Uh, let's see. Maybe I should actually run everything.

Now we're connected. Okay. Um, the first thing that we're going to do is we're just going to take a look at what is actually in the database. So in this, um, APOC actually stands for awesome procedures on Cipher, which I just think is hilarious.

I think there's a double meeting on APOC too, but we'll have to ask, um, isn't there another APOC meeting? Something? I don't know.

Guest54:26

Something to do with matrix and Neo.

Alison Cossette54:28

Yeah. Some, some matrixy thing. Um, but what this is going to show you is we start out with 17,000 nodes,right? We have 774,000 relationships, um, seven different labels and 27 different relationship types. What does this tell us? What it tells us is obviously we got a lot of data.

It's actually not that much really, um, you know, for something small. Um, but you know, like almost a million relationships. And so really what you, we're running this just to make sure that everything is loaded. So if everybody who has loaded their data, are you seeing these numbers?

Anyone? Anyone? Maybe, maybe not. No?

Guest55:09

Which GitHub link do you get this from?

Alison Cossette55:11

Okay. This is, I will take you back. One moment, please. Hold the phone. There are three notebooks inside the notebooks folder inside the repository. So

you may have to repull it.

Guest55:27

I pulled it up again.

Alison Cossette55:28

You did?

Guest55:29

Yeah.

Alison Cossette55:29

Huh.

Guest55:31

And then this is the only one.

Alison Cossette55:32

Huh.

Guest55:33

And then.

Alison Cossette55:34

That's notright.

Guest55:34

This is the website here.

Alison Cossette55:36

Yeah. Yeah. This is not, can you reload this? 'Cause it was updated.

Guest55:41

Yeah. I, um, I did a repull it. That's why I feel.

Alison Cossette55:44

That's so weird.

Guest55:45

Are you having trouble getting the connection to Neo4j happening? It could be that it's not loading.

Alison Cossette55:49

Yeah.

Andreas Kollegger55:49

The ENV file. It's easier to just copy the values into the cell where it's loading from.

Alison Cossette55:54

Yeah. You can do that too. Yeah.

Andreas Kollegger55:56

That's my advice.

Alison Cossette55:57

Yep. That's actually really good advice. Um.

Guest55:59

Upload the dump file. I'm not able to download.

Andreas Kollegger56:02

I'm uploading it to the Slack channelright now.

Guest56:04

Thank you.

Alison Cossette56:05

Thank you. What's your name?

Guest56:06

Caleb.

Alison Cossette56:07

Caleb to the rescue. Thank you, Caleb. Everybody, round of applause. Round of applause. You're that helpful guy at work, aren't you? You're like, "Oh, I can just do this thing. It'll make it easy for everybody." Thank you, Caleb.

Guest56:18

Naya is also uploading it, I think.

Alison Cossette56:20

Naya. Also, Naya, round of applause. We love Naya. You probably see if you're from San Francisco, Naya is all places as is Alexi. They're around all the time. So hopefully they're familiar faces for you all. Um, so yeah.

So the first one is just really meant to get you to connect to the graph and make sure that your connection is working. Um, and just showing you how you can get some basic summary statistics. Um, you know, one of the things that we can do is we can preview some of these documents.

So. Um, so again, this is our data model just to get you familiar with what we're looking at. And then let's move on to our notebook number two is where things get, get more exciting. Um, in notebook number two, what we, what we're looking to do is we're looking to actually start leveraging these algorithms for, uh, where am I?

Graph Algorithms56:50

Alison Cossette57:15

Okay. So when we talk about graphs, like ultimately what we're trying to do is we're trying to help you do these things at scale. We're trying to help you be successful in production, and we're trying to help you get the best possible outcome from the applications that you're building.

And the way that I, that I suggest is my little moniker, which is connect, cluster, curate. To your point of how do we actually manage this at scale? What does that look like? What do we do? Um, what we have in these notebooks walks you through this very, this process.

The way that it works is we start out by running KNN on similarity. So we take the embedding for each of those documents and we create, uh, we leverage a similarity score. So, um, basically we take a K of 25, we run KNN, and we understand, we start making connections among very similar documents,right?

You'll see why we do that in a minute. But what this does is it sets us up for the next step, which is community detection, also known as clustering. Um, and what it allows you to do is it allows you to group these like items so that you can manage them together,right?

It's very hard to look at any one and know what's happening, but we can certainly look at all of the things. And then finally what it leads us to is we curate the grounding data set via these techniques that work at scale.

So this is a similarity graph of context documents, um, you know, connected to their source URLs,right? So it makes sense that there's a lot of overlap and similarity 'cause they're coming from the same source. And you may be saying, well, if they're all the same, like why do I need to know that they're similar?

How does that help me? Well, it helps you in a few different ways. Uh, what, what the, oh, this thing's going crazy. Um, what I first want to talk about is I want to talk, talk a little bit about the math and the understanding of how community detection works,right?

Um, I promise you there's no calculus and there's no quiz. Um, but when, so like if we're looking at this doc, you know, we're looking at a few different friends, a couple of friend groups, like it's pretty clear.

Like there's one click, there's another click. It's pretty obvious,right? Like that seems reasonable. And then when we start getting bigger, like these are, these are similar. And what we're seeing here, this is actually, these are actually sized by page rank, which is an important score.

Um, and they're still like, it still seems pretty obvious. Like, yeah, they're clustering together. Like it's still pretty logical. Like I get it. Um, but anybody who has worked with graph knows that it never looks like this. Has anybody ever actually seen anything that looks this tidy?

No, never. 'Cause it looks like this,right? This is what we're actually looking at,right? In this case, what we've got is we've got all these different nodes. They're sized by page rank, and then the edges are weighed, they're weighted edges,right?

It's very like the hairball, people call it, um, the bowl of spaghetti, whatever it is. And so like it's very complex. So how do we actually find things that work? How do we actually run commute? Oh my God, it's so sensitive.

My goodness. Um, this is the boring math part, but just so that you understand like what is happening under the hood. So when you're doing clustering in graph, it's based on something called modularity optimization. And a community is high modularity,right?

It's modular, makes sense,right? When the items within or the connections within it are highly interconnected with each other and have a very low connection to things outside,right? That's like the basics of the math. So what it's going to do is the algorithm's going to go through and it's going to say, okay, for every node, is the modularity score going to go up or is it going to go down if I put the same label as my neighbor,right?

So does it belong with this group or does it belong with that group? What does it do to the actual numbers,right? Louvain is a particular type of algorithm. And this is where it says it, yeah, that's exactly what we just talked about.

So how does it actually work? So what it will do is it will start by giving a single node a label, and then it does the calculation and says, okay, like let me figure out does it go up or does it go down?

And then it will do the first pass and then it'll say, okay, these are, these are the ones that are most, like most connected to each other. And then it'll say, okay, well, let me group and aggregate those and let me look at how many what you see in step two is you see the number of connections between each of those clusters,right?

So when we look at it, so, you know, it's pretty straightforward. The pinks and the yellows, there's three edges between them, but there's 14 within just pink and there's two within yellow and four within green and 14 within blue,right?

So what it shows you is it's showing you that like there's a lot connected within and not so many on the outside,right? Pretty straightforward. That's pretty easy math,right? Um, and then it just keeps going through and then eventually it goes down.

One of the things to know, um, there is another algorithm called Lydon. It is similar, but it, um, but if you need to work with unconnected graphs. So depending on whether your graph is completely connected or not, there are different ones.

But ultimately what it's doing is it's saying, you know, are, are these things, which of these things is not like the other,right? So label propagation is a, is another way of doing clustering. And what label propagation does is it says, okay, I'm going to assign a random label to something, or I ha I know these labels, and then I'm going to go to the neighbors and I'm going to say, I'm going to assign what this one is to its neighbors.

And then eventually we have these iterations where they converge label propagation algorithm. Now, the nice thing about the label propagation algorithm is it's actually one of the fastest clustering algorithms. So especially if you've got lots and lots of values and you want to run something very big, it's a very fast way to do it.

Um, if you need something that's like highly nuanced, it's worth spending the time and the computation to use one of the other algorithms. But what I wanted to do is I just wanted to, to show you what this looks like because label propagation, it's, and modularity does the same thing.

It's really looking for density. It's looking for density in those graphs. So when we think about, you know, the, the craziness that we see here, like even in this, like you can see like little pockets of density,right? We see these pockets of density.

I always like to take the soft eye when we look at graphs. Um, and so that's what, that's what's happening with the math under the hood,right? So what does this actually mean in our, in our code? So what we've got is, let me close this out.

So what we're going to do is the first thing you do is you're going to run the KNN. So you run the KNN on similarity. Obviously we connect as always. Um, there's a weird little thing you have to do.

You have to create an empty relationship, but don't worry about that. Like I gave it to you. Um, but that's a little, little peek. What? That's probably 'cause we don't need it. Um, but then we run the query.

And I just want to walk through how the query is actually built and what it looks like. So the first thing that we have is, do I have my I want to, I want to see this. Sorry, somebody's got a question over here.

Yes. Then, then over there. Caleb.

There we go. Here we go. Did you have a question?

Guest1:04:34

Yes.

Alison Cossette1:04:34

Yeah.

Guest1:04:35

I see itright here and it says there's no procedure with gds.graph.project.

Alison Cossette1:04:42

Mm. graph.project. So just to go over like one, what, what the process is when you're, when you're actually, um, running the algorithms. The first thing you need to do is you need to project a graph. 'Cause most of the time when you're running the algorithm, you're not running it on the entire graph,right?

We're running it on something small. So in our case, we want to run K nearest neighbors just on the documents,right? So what we need to do is we create this, uh, this projection. So here we've got, we're calling the projection, we're calling it docs.

So the first thing you'll see is the name of the projection, which is docs. What then what we look at is we look at which nodes. The next thing you're going to see is nodes. So for us, we're using documents,right?

So we want documents. I want to include the property embedding. So you really want to make sure you're only bringing in what you need,right? 'Cause it's just going to make things run faster. Um, and then because it's just the documents aren't related to each other yet,right?

We know that from the data model, those documents are related to the responses, but they're not related to each other. We're building this similarity among them. And so it, it happens to be an empty relationship. And then what it will do is it will give us the graph name, the node count, and it'll, and it'll let us know that it ran.

And what that ends up looking like is, let me go to my Aura. Where's my Aura? I'm so not Aura as the middle school would sayright now. Okay. Um, so let's go into explore. Anybody here have middle schoolers or like know the whole like brain rot, like Riz, Aura, Skibidi, like it's insanity.

Allright. Um, so what we're going to be looking at is when we look at documents, I've run it already. Um, so we're going to see that there's similarity among them. Butright now we're going to see these documents. And what I want to look at is, oh yeah.

So I'm going to look at documents that are connected to,

come on, uh, similar to documents.

Oh, actually, let me, yeah, that'll work. It takes a second to run. Um, one of the, one of the things that, um, I did is I actually changed what the way that we look at it in the graph, just so that you know, I changed it so that it's actually the colors of the nodes are by community.

'Cause what I wanted to see is I wanted to see like do we start to see, let me run this one more time. Let me clear the scene. Do this.

Oh, dear sweet Wi-Fi. Maybe I should open up my Neo4j like desktop. Um, yeah. So what we're going to see is we're going to see the connections in and among the, hold on a second. I don't like this.

I don't like this at all. What it's eventually going to show you is it's going to show you the similarities in and among. And it's going to be like the greatest ever hairball. So in this particular case, like this is what it might look like.

Um, and what we see is like we saw with the big one, like you're going to see like clusters of documents that are very similar. The other thing that we're going to see is we're going to see what I call the bridge documents.

The ones that will often be the, the middleman. We call it, um, betweenness centrality. And so, but you want to understand, like I said, it's the soft eye. You want to understand what is the clustering of your documents.

And again, you might be asking yourself like why is that helpful? And I promise you the reason that it's helpful is because

what we end up being able to do is understand what's happening within the data. So this is a 2D version of, of these embeddings and, and these clusters. And what we see is we see, you know, it looks like a bowl of fruit loops.

Like how again, Alison, how is this helpful? I'm not a data scientist. Like what is happening here? Um, but when we zoom in, we see a couple of things. In one case, we have a single community document cluster.

So what we're seeing is there's a lot of similarity in the embedding,right? They're all in that same community. They're all very similar. And then in this other side, we've got some, they're kind of spread out, like nothing really clear on a perimeter,right?

Like you're like, is that good clustering or not? Um, and so my question to you is, which is better?

Which of these do you think might say, oh yeah, like we've got it, we've got what we need, we're good. Pros and cons. Somebody says some.

Guest1:09:26

It's a single community.

Alison Cossette1:09:27

Single community. What's the, what's the thought on a single community?

Guest1:09:32

Figure out if there is some relationship between those nodes.

Alison Cossette1:09:35

Yeah, they're very similar. Mm-hmm. That's awesome. And in traditional clustering, that would be great,right? If we're talking about clustering customers, we're doing customer 360, we're like, oh, this is a group, this is the thing. But one of the things that we have though, is that means we have a lot of very similar documents.

So the question is, do we really want it to look like that? Customers, yes. Documents, no. Right? Because one of the things that we need to understand is we need to really be efficient. So when we talk about what is a high-quality grounding data set in your retrieval augmented generation, these are our five basic principles that we, that we go by.

Is it relevant? Is it actually giving an augmenting answer? Is it reliable,right? Like do you have, do you, do you have like a lot of variety that's coming back on something? Like is it really disparate from these communities because there's a hole in your data?

'Cause we don't know,right? There's a gap in all this high-dimensional space. There's this like big blind spot that you don't know about. And again, is it efficient? How many people here are really worried about their applications being efficient?

Everybody, I know,right? It makes you crazy. So again, how do we do this at scale? What does that look like? So once we've done this clustering and we've assigned these communities to these nodes, then we can start looking at the data itself,right?

Curating Data1:10:40

Alison Cossette1:10:54

In this particular instance, one of the first things we did, and you'll, you'll see it, I left all the, the dump that you have has all the errors in it, so you can play with them. Um, we can see that the median average word length is 512 characters.

Well, our chunks are a length of 512. So that's probably not good data for us,right? That's not helpful. Um, and it's clearly very different from everybody else. So what does that look like? Median word count one. So all of these are summary statistics at that, at that cluster level, at that community level.

And so when we looked into it, we found this is very, you know, like again, we brought our data in from, you know, web pages and all these different places. So clearly this is not going to be helpful to an answer,right?

At least not to a human,right? So this is a way that we can start to clean something out. The basics,right? Like just the basics. The other thing that's going to come up in that high density, like that high similarity we saw is this, highly similar text chunks.

In this particular one here, community 4702, our average similarity is 0.98. We have 49 documents, 49 chunks that are almost completely identical. If you're doing a retriever that gives, you know, the top 10, that's not going to give you any context at all.

It's just going to be really confident about this one thing,right? How do you know that it's even theright thing,right? So one of the things that you want to start looking at is ways that you can sometimes increase the diversity,right?

Like I have a, I have a, a talk that I've submitted many, many times that has never been accepted and it's called The Dark Side of Distance Metrics. How cosine similarity broke America,right? I don't know why it doesn't get accepted.

Why is that,right? Because cosine similarity gives you exactly what you want. Gives you exactly what you want,right? Like I call it the chicken nuggets and tweakies. If I had a robot in my house and I went to San Francisco and it was responsible for cooking for my kids, when I came back, all it'd be making is chicken nuggets and tweakies,right?

That's the same thing that's happening in our algorithms. And so where this becomes really, really important, we're, everybody here is working with agents.

You are refining signal at every turn. So if you get a signal, it's going to pick up on it and it's going to run with it and it's going to go down to the next agent and the next agent and the next agent.

And whatever that, whatever that path that it got on, it's going to go,right? 'Cause that's what we programmed it to do. It's doing its job. It's doing exactly what we told it to do. But is that what we want it to do?

So one of the ways that like this community approach to documentation is really interesting is you can look at what are the variety of documents. You can actually use re-ranking for diversity in your responses. So let's say we do a vector retriever,right?

We take the vector retriever and it comes back with this scoring. These things are all really similar. Okay. Well, most of them are from this com, this community, but then the ones a little further down are from another community.

So you can actually do different ways of re-ranking. So you can wait for diverse, you can wait for diversity. You can wait for page rank,right? Like one of the examples we have in here is using page rank. Of these vectors, which ones are the most important?

Which are the ones that people go to the most? We want to be feeding that back,right? It's like, it's why Google made billions of dollars,right? Page rank. Change the way everybody searched. So what I want you to be thinking about is you need to be thinking about what I call intelligent outcome management.

It's not just about like, you know, AI, artificial intelligence, but what are the outcomes that we're getting and how do we give really good ones? And I'm here to show you how you can use these algorithms to help you like diversify that a little bit.

So when we looked at these highly similar text chunks, they're highly similar. It's because it comes from our documentation,right? We've got multiple versions,right? Like we've got a version for 1.5 and a version for 1.6. Well, the algorithm doesn't change,right?

The algorithm doesn't change. So that's why we have all these repeats. So the other great thing about graphs, 'cause you know, every chance I get to love on a graph, I will, um, is you actually can very easily in this one moment, APOC nodes collapse.

Awesome procedures on Cipher. So what it's going to do is it's going to do two things. One is going to make your retrieval much more efficient because you now have one version of it instead of many. But what it's also going to do is it's going to maintain the lineage, it's going to maintain the connections.

So now we've got a single document, but we can see all of those sources. We can see where it came from. So you don't lose the institutional understanding,right? Nobody like, and who likes dropping rows? Everybody gets worried when you drop a row,right?

Like maybe it's just me. I always get worried. I'm like, oh, I'm dropping rows. Is this what I want? So in this case, you don't have to. And that's what's so great about and flexible about the graph is that you can do these large scale management moments and you're, you get more efficient.

You get really clear. You don't, you're not overbundling something or overpowering something. Question.

Guest1:16:14

What does it mean to collapse here?

Alison Cossette1:16:15

Oh, so basically what we're doing here is we're saying these four are all the, basically all the same. The text and the embedding are the same. So we're going to collapse them into a single node and we're going to maintain the original relationships.

So in this case, when then when you hit that embedding, you're only hitting it once instead of 19 or 49 times in our case. Yes.

Guest1:16:34

So on the document that are pretty much very similar.

Alison Cossette1:16:36

Yeah.

Guest1:16:37

If they have various properties, slightly different. When you do the collapse, does it join all the properties together?

Alison Cossette1:16:43

It depends on how you want to do it. Like you certainly could. I mean, it may be that you don't, you may only want to like adjust what's in the index,right? Like it could be a different way that you want to manage it, like depending on what you need to maintain,right?

If it's legal, then you probably don't want to lose anything. Um, you know, there's, there's options. Yeah.

Guest1:17:05

Can we impact it in some way if like.

Alison Cossette1:17:09

There's a microphone for you. 'Cause it's a good question. Everybody needs to hear it.

Guest1:17:13

So, um, the documents will be exactly the same.

Alison Cossette1:17:17

Mm-hmm.

Guest1:17:18

If for each one of the URL pages, the chunking was similar and.

Alison Cossette1:17:22

Yeah.

Guest1:17:22

The similar kind of things got picked up. So.

Alison Cossette1:17:25

Yeah.

Guest1:17:25

Will, does chunking impact when in these kinds of mechanisms? How the similarity.

Alison Cossette1:17:30

Yeah. I mean, 'cause it, it could be,right? Because if it's the same page, but one has like an extra paragraph for that version, then the chunking might split differently,right? So you're not going to, it's not going to, it's not like a magic wand,right?

It's no magic eraser, but it's definitely an easy way to increase your efficiency and increase the quality of the output in the data itself. Yes.

Guest1:17:51

So you did the clustering on documents or did you do the clustering on all different kinds of nodes that you have?

Alison Cossette1:17:58

I did the clustering just on the document nodes, which in this case are actually chunks,right? So it's just on those. So it takes the embedding,right, for that chunk, and then we run that KNN so that we understand like do we have these really high density places.

The other thing it allows you to do is understand like do I have theright information,right? So, um, where are we? Right. So again, like what are the most frequently used communities? We've seen this already,right? This is a conversation, you know, these are the original documents.

This is the, the next set, some of it,right? Um, like I've been doing more research into understanding like how people travel around the communities in different conversations. Do they, do they all end in one place or do they start in one place?

Or how long does it take someone to get to theright area,right? I mean, it's, you know, we're, we're basically tracking human cognition by watching the way people move around their thought process,right? Um, you know, this is like one particular visualization of a single conversation.

And for each of these, we've got, you know, 10 pieces that, 10 context documents that come back. We have a K of 10. And so it looked at which communities are they coming from across this conversation. So this person originally was starting out in this area and then clearly ended up over here.

And then when they got to whatever community group number or whatever it is, um, they got to their answer and then they moved on. So whether your conversations are short or long is going to depend what route you want people to take,right?

I think about, um, you know, I always go to product analytics,right? So what is it that someone might need to know? So so much becomes available. And you know, again, on the developer side, like maybe these things are important to us, maybe they're not, but as someone who's building agents, it has to be important to you,right?

We have to really take accountability for the signals that we're amplifying in our systems and be aware. It's why the data scientists and the developers aren't on the other, are on different sides anymore. We're all AI engineers. Question?

Someone? Someone? No? Okay. Allright. My soapbox. Thank you. I appreciate that. Um, document usage. We talked about this. We talked about all these things and I don't think there's, yeah, I think we're good. Yeah. Oh, this is just another, uh, you know, the between this centrality,right?

Like, um, to understand why, why it might be important. Um, again, if you think about what is it that we're delivering, you know, like somebody said like who's the most important person at the company? Is it the person that's connected to any, everybody?

Or is it, you know, the one person that talks to both sides of the, of the business,right? Between the centrality says it's this person. Page rank says it's somebody else. So that's the other thing too is when we're trying to figure out what's important, we have a variety of algorithms that do different things that make that available to you.

You know, conversation lengths,right? I mean, this is just some of the basics. Um, but this is just another really interesting one is we are looking at, um, good ratings and bad,right? Let me,right? So this is just an analysis based on the community,right?

How many are in the community? Um, and then are the ratings good or bad by community,right? If you find that there's a, that there's a cluster of documents where the ratings are significantly worse than the others, let me go look at that.

Let me go look at those documents. Maybe it's, you know, outdated. I had somebody, this is my interesting story. So, um, I do some work with some folks who do like DOD and Fed work and, um, former Navy SEAL, and he's just like, yeah, I couldn't believe it.

And I'm like, what? He's like, there, somebody was doing this proposal and they have like this one thing that they have to put in like some risk assessment thing and like it's just like they copy and paste it over and over and over again.

And so one day he got really curious and he wanted to actually track where it came from. It was almost word for word something from the Vietnam War that people are still putting into these documents,right? Like it's got re, like if we just threw it into a RAG application, it would have really high page rank.

Everybody's using it, but where did it come from? Is that what we want? So looking at the things that are influential, not because they're an anomaly, but because we're amplifying that signal is that the signal we want to amplify.

That's a whole other like AI observability thing. But the reason I bring it up is that our job is to build good, smart applications. We are responsible for the outcomes of these processes. And these are some ways that you can take a new approach to what you're doing,right?

Let me go back. Questions, comments, concerns. Yes.

Guest1:23:00

Is there, uh, is there like an out of the box feature to like detecting between centrality? Like I imagine you can make an algorithm for it, but.

Alison Cossette1:23:08

Yeah. Yeah. Um, I don't know that there's, I mean, you have to do the projection and run the, run the algorithm. Um, but we've got it in here. Community detection and assignment, I believe between this is in here.

Oh, between this might be in number three.

Creating secondary relationship. We're not even going to get to that. Yeah. So there's a between centrality. Um, so when you, when you look at the algorithms, they're all going to be pretty much the same. It's going to be GDS and then the name of the algorithm.

Advanced Analytics1:23:27

Alison Cossette1:23:38

And then there's a couple of different options. Stream means run the calculations and let me look at them. Just put them here. Mutate will actually change the, the projection. You can also write. So if you do the algorithm.write, it's going to write back to the node and we'll write that assignment back.

So sometimes you just want to play, you just want to look at it,right? Sometimes you may want to just change it within the production and just play around. So you've got a few different ways that you can apply the algorithm once those numbers come out.

Um, and the basic is you're always going to do a call. You're going to call the algorithm. And then the first thing you're going to do is say, which projection am I running this on? Right? In this projection, um, I actually had, um, like a, I, I created a new, a new relationship called co-occurrence.

Uh, where is it? Yeah. So what this did is it says, okay, I'm going to look at the message and I want to see the different documents for that, that are in the same message. And for each of those where the elements aren't the same,right?

So I don't want to create a connection to itself. I want to merge. Merge is, um, you can either create or merge a, a relationship. Um, merge just means if it doesn't exist, make it. Um, you're going to, I'm going to merge the chunk one or the context one with context two, and I'm going to create this new relationship co-occurs with.

And the reason I wanted to do this is I wanted to see like which things come up together a lot. 'Cause sometimes it's not just about the similarity. If I've done a really good job of curating my data set and I don't have a lot of that redundancy, I want to see like what are the concepts that are coming together?

Like what are the things that come together? From there, you can then look at the way they travel around each piece from one to another. So what I did is I created this co-occurrence,right? So yes. So like if we went back to our, um, uh.

Um, so basically co-occurrence just says all of these documents that were pulled in by this question will now have a relationship among them,right? And then we weight that by how often do they come up together,right? Um, you can do the same thing with traversal.

So these chunks come first, these chunks come second. So if you know that the conversations usually go in that direction, do you want to figure what's the probability? Can I predict the next thing? Can I figure out where the conversation is going to go?

So all of this to say that, you know, I love that there's a Graph RAG track. I love that it's just sort of like the way many people are doing things. And what I want you to know is you've done all the hard work of building the graph.

Now let's use it even more. Let's get even more out of it. There was a question somewhere. Yeah. Yeah.

Guest1:26:28

Co-occurrence is when like the, um, you ask a question and then the, the retrieved answer, like you, you have like two answers that are commonly retrieved together, like to that question. Is that co-occurrence? Am I understanding that correctly?

Alison Cossette1:26:41

Um, the co-occurrence is all everything that came into this one. Like if you're doing a K of 10, all those 10 will co-occur, meaning like they all were answered together.

Guest1:26:54

Okay.

Alison Cossette1:26:54

They all were fed back at the same time,right? So it's, it's almost like an affinity of like these things often come together. Then you can, like I said, you can do the same thing. You can expand it out into like follow on, like these things usually follow those things,right?

So we can start to see, and that's where, you know, things get juicy.

Guest1:27:14

Thank you.

Alison Cossette1:27:15

My nerdy like data science brain gets super excited. I'm like, oh my God, then we can check this, then we can check that, and maybe somebody cares. Yeah.

Andreas Kollegger1:27:22

You're so what?

Alison Cossette1:27:23

Oh, sorry, sorry, sorry. I'll be back.

Andreas Kollegger1:27:25

Uh, I got a question, more, more not technical question, more general. So you mentioned the DOD and Fed space. So we operate in the DOD space.

Alison Cossette1:27:34

Oh, nice.

Andreas Kollegger1:27:35

More on the industry side.

Alison Cossette1:27:36

Yeah.

Andreas Kollegger1:27:37

So what is the, you know, what are your thoughts on the adoption of these technologies within the, within the DOD, both on the government side and also on the human system?

Alison Cossette1:27:47

Yeah, I have, I have a lot of opinions on that. Nia will tell you. Um, I think when it, the, the most interesting conversations that I have are around accountability and traceability. There was, I was talking to someone literally this weekend and said there was an unnamed person who's currently running for Congress and they said about the military, oh, they're just going to need to learn to trust the AI.

I've never been so alarmed in my life. I was just like, no, no, trust but verify. Trust but verify, please. Right? I mean, like as someone who's been a data scientist for a long time, like we do our best, but there are unintended consequences.

Like we didn't know we were building an echo chamber. We just thought we were giving you chicken nuggets and Twinkies,right? Like we didn't know it was going to break America, but we did it,right? Like I was one of those people, like I built those algorithms.

Hello. Thank you. Um, you know, and so like I think the best thing that we can all do is to just keep those things in mind. And so that's where the conversations, like my conversations with them, I'm like, and I'm not like saying like, oh, you're so dumb.

Like you don't know. Like people don't know,right? Like, like I've been doing this for years. Like I've lived in the calculus,right? Like I've lived in like, you know, understanding the mathematics of the neural network,right? Like I've spent a lot of time, like the data scientists, we had rigor and we had mathematics and we like had every time we released a model, we had model reports and all this stuff.

And now it's just like, just trust it. It's good. We're fine,right? Um, and a lot of it is,right? Like we do, I mean, it's the world we live in. Like I'm certainly not, like I'm not a naysayer. Like I love AI.

I love what's possible. Um, but I just think that we just need to be a little bit thoughtful about what we're doing. And like that's why these are easy things to do,right? Like, and then once you're aware of it, you're like, oh, yeah, I'm going to get a much better answer.

That's awesome. Let's do that. Yes.

Guest1:29:44

Um, I have a question. So, um, on the more on the knowledge graph side of things.

Alison Cossette1:29:50

Yeah.

Guest1:29:50

Is there like an easier way to, is there an easier way to automatically create the knowledge graph? Because, uh, you know, things like Graphlets.

Alison Cossette1:30:00

Yeah.

Guest1:30:01

Have really made things a lot easier for a lot of people.

Alison Cossette1:30:04

Yeah.

Guest1:30:04

Um, versus like this is, to me, it's kind of like old school way of creating graph, which is.

Alison Cossette1:30:10

Yeah.

Guest1:30:11

Really going to be the domain expert and know.

Alison Cossette1:30:14

Yeah. Yeah.

Guest1:30:14

All the ontologies and all the relationships.

Alison Cossette1:30:16

Yeah.

Guest1:30:16

But what if you wanted to do that automatically many times over for different types of businesses?

Alison Cossette1:30:20

Yeah.

Guest1:30:21

How do you do that?

Alison Cossette1:30:22

So, yeah, there, it's a really excellent question. And so hopefully everybody heard the question is like how, how do you like build graphs at scale,right? Like how do you do it without having to be an expert? Um, the, the knowledge graph builder, the KG builder that Neo4j built, 'cause these are, these are questions that people have,right?

Um, there's some really interesting ways like you can actually use the simple KG pipeline and just throw your documents in and just say, tell me what's important,right? It's going to go through and do basic named entity recognition based on those entities.

It'll do another pass and say, how are they related? And what it'll do is it'll look at each document individually. But then what you start to see is you start to see like the natural organic, like what's actually in there, what comes up.

Um, so I love that for experimentation and for understanding, 'cause oftentimes as builders, we don't know, we're not the subject matter experts, but we're responsible for building the architecture for them to get theright answer,right? So how, what tools do we have to try and service it?

Because then you can run it and it'll be noisy. Like it will look like spaghetti. It will be noisy. But then you can say, okay, tell me how many of this label, how many of that label. Show me like what is the, what is the page rank?

What is the between this centrality,right? You can run these kinds of algorithms to understand. And then from there you say, oh, okay, according to this set of documents, this is the ontology that has risen out of it. So you can take a very organic approach.

Um, sometimes people will go in with a very specific data model in mind. And even in those cases, I always encourage people to run, run the KG builder for experimentation purposes because it could be that there's something in your documents that you didn't even know was valuable,right?

Q&A1:32:00

Alison Cossette1:32:01

Like let them speak, like let them like let the ontology rise. Yeah.

Andreas Kollegger1:32:06

Um, question is like I think today our industry has been writing content more for consumption by humans. Now this is changing towards consumption by agents.

Alison Cossette1:32:16

Yeah.

Andreas Kollegger1:32:16

Do you see this playing the graph analytics and what you're showcasing is playing for persona for content writers and whether for completeness, how are they writing and producing more content? It's helping them. Is that the primary persona we are targeting here?

Alison Cossette1:32:30

I mean, I mean, listen, it can go in any direction,right? Like one of the things that I'm really excited about is, um, the concept of like, I call it, um, it's not about human in the loop, it's about accountability in the loop,right?

Like, like we said, we're going agent to agent to agent. And so what do we then pass to that agent,right? So if we have some of this information,right? Like if we're concerned about amplifying signal,right? And if we're concerned about, you know, like a series of agents going in the wrong direction,right?

You think of a ship. If it's off by one degree now, it's fine. You know, a hundred miles later, not so fine. Um, so how do we, how do we keep steering the ship when it's autonomous? And so that's some of the interesting things too.

Like when we look at this memory graph,right, we can say like this application graph, we can say, okay, I'm going to pass this to the agent and I'll pass, uh, like this context or this particular information about what came before or, you know, like you can look at like, um, sort of like the velocity of how quickly it's going from one community to another,right?

Like there's so many interesting ways you can do the math to look at it. Um, but yeah, like I think like really understanding like how do we drive our agents, how do we drive our agents and chains is super sexy, super exciting for me.

Yeah.

Andreas Kollegger1:33:51

I have a question about content hygiene.

Alison Cossette1:33:53

Yes.

Andreas Kollegger1:33:54

So a lot of times we realize that, um, it's garbage in, garbage out.

Alison Cossette1:34:00

Yeah.

Andreas Kollegger1:34:01

And, uh, we ourselves sometimes aren't aware of like some issues with our own content.

Alison Cossette1:34:08

Yeah.

Andreas Kollegger1:34:08

Whether one part is contradicting another.

Alison Cossette1:34:11

Yeah.

Andreas Kollegger1:34:11

Or something's just inaccurate.

Alison Cossette1:34:14

Yeah.

Andreas Kollegger1:34:15

Is there any fancy math with graphs that can help us identify potential issues with content hygiene?

Alison Cossette1:34:21

I mean, I would, I would want to give you a more thoughtful answer than something off the top of my head. Like I don't want to, I don't want to throw something out that's just kind of like, oh, what is this?

Um, yes. Is it going to solve everything? No. But again, some of it has to do with what is it connected to,right? So if we think of, um, you know, how fraud detection works,right? Like, like, or so I worked on the Syracuse, they did election graph for with Syracuse University last year for the presidential election and they were tracking advertising like across Facebook and Instagram.

And, and I, Jenny, who ran the program, she said something really interesting to me, which is if you want to know how someone's going to vote, it's actually not their friends, but if you look at the friends of friends, that second hop out is actually more predictive of how someone's going to vote than their immediate group, which I thought was fascinating,right?

Like why is that a thing? But it's the same kind of thing that might be possible,right? So let's look at what is it connected to. Are we finding that there's like some sort of like density of something like in that area potentially?

Um, the other thing about me is I love to be available. I love to chat, as you can see. So, uh, feel free to connect with me on LinkedIn and DM me. And if you ever want to noodle, like I'm always happy to noodle on like all the things because my hope is that you leave here today and you start thinking about like what might be interesting to you.

What could you look at a little bit differently? Um, yeah, another question. Yeah, go ahead.

Andreas Kollegger1:35:54

Yeah. Thank you, Alison. It's a great session, really. Um, I wanted to ask, um, about, uh, the embeddings.

Alison Cossette1:36:02

Mm.

Andreas Kollegger1:36:02

Versus the structure.

Alison Cossette1:36:04

Yeah.

Andreas Kollegger1:36:04

And yes, it's a, it's a research question.

Alison Cossette1:36:07

Yeah.

Andreas Kollegger1:36:07

There's a lot of approaches out there. And of course, it depends upon, uh, depends upon the domain.

Alison Cossette1:36:13

Mm-hmm.

Andreas Kollegger1:36:14

But I wanted to ask you if you or the team has any specific experiences in terms of how to leverage the embedding per note, let's say.

Alison Cossette1:36:22

Yeah.

Andreas Kollegger1:36:22

Versus the structure of the graph. Because, for example, in the morning session, we've seen just simple aggregation of the two.

Alison Cossette1:36:29

Yeah.

Andreas Kollegger1:36:29

Close the eyes, the eyes, and let's see how we can. You spoke to a little bit about the ranking. So my question is, how would you start approaching a given specific domain where we have embedding in the same embedding space for every note.

Alison Cossette1:36:41

Yeah.

Andreas Kollegger1:36:41

Plus the structure.

Alison Cossette1:36:43

Yeah. Um, there are actually really interesting ways that you can do combinations of, uh, not just the text embedding, but the embedding of the note itself.

Guest1:36:51

Yeah.

Alison Cossette1:36:51

Right? So, so for those of you who don't know, the concept that we have of this text embedding, you can also do on the node. And so it's an embedding really of the structure of any given node and which relationships it's connected to.

Um, so yeah, there's some really interesting things that you can do there. Um, one of the things that we like didn't get to today, but is like, you know, leveraging page rank and, you know, vector to like re-rank.

So there's definitely some interesting things that you can do. I don't know if we have content on that specifically, um, but definitely reach out to me and I will reach out to our people and we'll get you a really good answer on that.

For sure. Yes.

Andreas Kollegger1:37:25

Thank you.

Alison Cossette1:37:27

We're, we're coming up on time.

Andreas Kollegger1:37:32

I still understand the community detection a little bit.

Alison Cossette1:37:34

Yeah.

Andreas Kollegger1:37:35

So like.

Alison Cossette1:37:37

How does it work? What is happening? Allright.

So

we got a few different ways that we can look at it. This is one example how, how Louvain actually works. So like I said, what it'll start to do is it'll, it'll assign, it'll assign a label. And then what it says is, okay, let me look at its neighbors.

And if I give the neighbors the same label, does that modularity, does that interconnectedness number get better or worse? Right? So different, different clustering algorithms are going to do things different ways,right? Um, but in this case, this is what we're looking at is like, and if you think about it, it's like, you know how you have some friends and you all know each other, you're all really tight, but then you have this other friend who's got like all these different like friend groups that they're a part of.

They don't have like their one little niche. It's kind of like that. So the more interconnected it is, the more relationships they have among each other, that's what it's looking for in the math.

Andreas Kollegger1:38:36

In terms of like cipher query like.

Alison Cossette1:38:38

Mm.

Andreas Kollegger1:38:38

How would this be of any use in terms of like getting the actual data from the query?

Alison Cossette1:38:43

Yeah. So when we talk about the community detection, the community detection is really meant to be like a production helper. It's going to allow you to curate at scale. It's going to allow you to understand at scale like where things are moving.

Um, the, the community itself may not necessarily be part of your answer unless, as I mentioned, you want more diversity in an answer. You want to cover a larger domain than just what's really close to the vector,right? So think of, um, if I'm, you know, I don't know, I'm in sales at Amazon, like I don't want to, you just bought luggage.

I'm not going to show you more luggage,right? I want to show you the things that are often bought with,right? The connected pieces,right? It's sort of like that. So in that case, it could be helpful. Um, but from a content perspective, it's like, do I want to give you just what you have or is there some benefit to spreading the net a little wider in what's being brought back by that vector retriever?

Andreas Kollegger1:39:45

Okay. So instead of just getting that one embedding, it gets like all the surrounding embeddings as well.

Alison Cossette1:39:49

Yeah. So depending on how you build your retrievers,right? Depending on what your thresholds are, depending on, you know, lots of, lots of different ways to do it. Um, but I, again, I'm happy to noodle with anyone anytime. I literally get paid to help people build things.

So I love my job. Like help me keep doing my job by asking me lots of questions and letting me help you.

Andreas Kollegger1:40:08

And one last question.

Alison Cossette1:40:10

Yeah.

Andreas Kollegger1:40:10

So like when it detects what's a community.

Alison Cossette1:40:13

Mm-hmm.

Andreas Kollegger1:40:13

Does it only like check its surrounding nodes or even like nodes across the entire graph?

Alison Cossette1:40:17

You know, I'll, I'll, why don't you and I, we can talk about more community after 'cause I don't want to keep everybody 'cause I know we're getting close to time, but it's a good question. So thank you for that.

Um, what I do want to say is if you've been with us this morning and this afternoon, your day with Neo4j is not over because our lovely friend Alexi is here. Um, and he's hosting our AI agent meetup this evening.

There we go. Everybody say hi to Alexi. If you don't know him, you should. Like he's just one of the most like vivacious and passionate people about tech that I've ever met in my life. Um, so yeah, please join us for the agent protocols tonight on graphs and MCP.

Feel free to reach out to me on LinkedIn. And I just want to thank you all for your attention. I know that it was a, it was a lot, but please like just be curious. Be curious.

That's it.

Andreas Kollegger1:41:06

Thank you, Alison.

Alison Cossette1:41:07

Thank you.