Citation Needed: Provenance for LLM-Built Knowledge Graphs — Daniel Chalef, Zep AI

summarized

TLDR

Provenance for LLM-built knowledge graphs is challenging because synthesis destroys the paper trail. Graffiti and Zep solve this by modeling lineage as a graph, linking facts back to source episodes, enabling compliance, verification, debugging, and deletion.

Key points

  • LLMs synthesize data from multiple sources non-deterministically, destroying the paper trail of how outputs were originated.
  • Provenance is essential for legal compliance, debugging, and deciding which sources to trust.
  • Graffiti is an open-source temporal graph framework that models provenance as a graph with episodes, entities, and edges.
  • Tracing a fact to its source is a graph walk, but keeping it correct during entity merges and fact invalidations is hard.
  • Metadata projection allows tagging episodes, and facts inherit tags, enabling filtering by source veracity.
  • Deletion of source data requires checking if facts are still supported by remaining episodes to avoid losing lineage.
  • Graffiti uses LLMs for extraction but also traditional NLP techniques like sim hash and entropy for deduplication to reduce cost.

Tools mentioned

Techniques

  • graph walk for provenance
  • metadata projection
  • entity deduplication
  • fact deconfliction
  • structured extraction
  • reflection step
  • temporal graph modeling
  • episode modeling
Transcript (captions)
[music] So, LLMs are really great at pulling together data from many sources. Uh, but they do so non sorry, they do so non-deterministically. They interpret and synthesize data generating a summary, an extracted fact, uh a structured record. And this output artifact may not appear verbatim in the source inputs. Synthesis often destroys the paper trail of how these outputs were originated. And I'm going to be talking today about provenence, which is tracing how an artifact was built and why. Legal compliance often demands provenence, but it's also useful for debugging. Deciding which sources you trust and which artifacts to delete. And solving this at scale presents a real engineering challenge. If I can get my next slide going here. So my team and I built Graffiti uh the open-source temporal graph framework and Zep, our enterprise agent memory infrastructure is built on graffiti. Our customers derive context or agent memory for many user touch points. Those could be chat, but not only chat. Often it's voice transcripts, email, business data. And our customers have struggled with provenence. Where did this fact come from? What is the veracity of this fact? And over the next few slides, I'll share how we engineered solutions to this problem. So here's an stylized failure mode. An agent retrieves context about a patient. So this is a healthcare scenario. And what comes back is a clean confident fact. Patient has a penicellin allergy. And the context was synthesized from three sources. A lengthy EHR record, electronic health record, a PDF lab report, and something a patient typed into an AI intake chat. If the agent presents the fact to a doctor in treat in a treatment scenario without clearly indicating the source was from the patient themselves, it may mislead the doctor. When an agent retrieves context, can we point to the exact source and its veracity? For complex agent applications, the answer is often no. So, I can imagine you're probably thinking, um, but can't we just store like a source ID on the fact? This can work well in structured data warehouses or data lakes. A pipeline outputs one value copied or mutated deterministically, and the sources are known and easily marked. But with context pipelines run by LLMs, this breaks in several ways. You prompt an LLM with several sources. Many facts are each synthesized from one or more of the sources. Somebody like J. Smith and John Smith are merged into a single entity, one identity. And John's facts are derived from many different places. So new data might invalidate old facts. The store keeps changing underneath your pointer and an appendon log which often might you know might come to mind here gets very hard to manage at scale as there's so many changes occurring. So lineage needs to be an evolving set and survive mutation. So sets of links between facts and their sources can be modeled on a graph as relationships. So provenence in a context store containing facts is a knowledge graph. We have three in this example we have three source data in graffiti that turned episodes. We have two entities extracted from the episodes patient and penicellin and an edge between them. This graph triple the two entities and the edge can be hydrated as a fact. Patient has a penicellin allergy. Tracing a fact to its source is just a graph walk. So it's pretty simple and easy to map source to fact on the first right but keeping it correct while the graph changes can be really hard when new data uh so for example when two entities merge the merged entity needs to keep all source links from both otherwise we silently drop a source and we lose lineage. And when new data contradicts existing data, mutating it, we need to capture this lineage too. In the rightmost card, a fact is rendered invalid by new data. And in graffiti, an invalid date is added to the mutated edge. And the source episodes that resulted in the edge mutating are noted against the fact. So gaining graffiti, the relationship between source data and derived artifacts such as facts is easily modeled on the graph. With metadata projection, we can also model classifications that span many different episodes. and facts derived from them. And so I'll give you an example here. In in the prior healthc care scenario, episodes may originate from an EHR record and have an EHR tag associate associated with them, but not all records are. And so on ingestion, we tag the episodes with the EHR tag. All subsequent entities and facts derived from the episode inherit the tag. And so if the agent wants to retrieve only facts from verified clinical sources, it's very simple to filter for the appropriate tag as we walk the graph. So one tagging action at ingestion supports evaluating the veracity of a fact. But what if the fact is three parents or more? Here we have a verified flag as our metadata and in this case one parent is not verified. So is the fact verified for the allergy flag which could be a life and death situation. the agent missing it, missing that particular flag could be a deadly mistake. So not retrieving the fact and any source of the three should block that prescription being issued. But for something like a consent on file for procedure fact, the mistake is operating on unverified consent. So the patient hasn't actually given their consent and every parent needs to be verified. So every single episode should have that tag. So the facts are very similar shapes. They have three three parent episodes but opposite policies. And here graffiti or the underlying store exposes that choice. It exposes which of the episodes have the gra the particular tag, but your agent needs to execute or apply your business rules. So that's not necessarily something that we bake into the graph. [snorts] It's situational. Another situation where lineage is really important, we may have to delete source data due to retention policies or right to be forgotten requests. So privacy compliance and this is really tricky because if we have context derived from multiple sources, how do we do so? Mapping lineage here is really useful. We know which facts are derived from the source data we intend on deleting. But what if only some of the source data needs to be deleted but not all? So in this example, we need to delete the intake chart data. So what the patient filled in, which is only one of three source data. In graffiti's model, the allergy fact survives the deletion and that's because there are two parents parent episode still supporting the fact. However, the contact preference fact is deleted as it was derived solely from the deleted source data. So, the rule is pretty simple here and it's easier to apply because the link exists. A fact is only deleted if no remaining episodes support it. So to sum it all up, deriving context is lossy and generative. Lineage needs to be built in to the data structure, engineered into the data structure, which is a graph, not logged afterwards. And in graffiti we keep the sources verbatim and we link everything back everything derived from those sources back to the source. And provenence offers many benefits to users of graffiti. You have compliance built in which makes your chief compliance officer very happy. You can verify a fact based on its sources so you understand veracity. Should I trust this fact? It's easy to debug where something came from. So, why do I have this fact? How was it generated? And also determining what to delete. And most of what I've covered today is in the graffiti framework. So, you can go to uh the graffiti repo on GitHub and I have a little uh QR code QR code later that you can zap um and try it out. So, by the way, as an aside, lineage and provenence is expensive. Graph construction is really expensive uh in the way that graffiti does it. And so we've put significant effort into reducing cost and latency of generating graph artifacts. And I'd be happy to speak to how we've done that uh in in the Q&A. So thanks for attending. Um if you'd like to learn a little bit more about Zep or Graffiti, you can zap the QR codes. Uh Zep is on the left and graffiti on the right. And I don't know if we're doing Q&A here or outside. Okay, happy to do Q&A. >> Just repeat the question. >> Yeah, >> we have time. >> Anybody have a question? >> Yeah, one right from the front. >> How do we mutate the graph at the edge? >> Oh, to account for weight changes in relevancy. Um that is some structure that we've actually built into Zap not into graffiti and um what we do is we do have for that a some tracing that we do which is kind of x of the graph. So not all of the um provenence is in the graph. Sorry, you >> if you have 50 edges, >> uh, sorry, is was that a question? If you have 50. Oh, there you go. >> I said I I use 50. >> You use 50. >> Yeah, >> 50 edges. Um, so so you know, Zep is able to uh look at provenence across those but using a separate data structure from the graph. >> Okay. Thank you. Thank you >> for that particular problem. >> So uh does the agent also create the edges edge types and the entities itself or how does it resolve those edges types? >> So in graffiti you can search across the entire graph. Uh it has um vector similarity search against various textual artifacts um full text search as well as graph relational operations things like BFS um it depends on the underlying uh graph database that's used and so your agent can walk the graph it can search semantically etc. And obviously from anywhere you hit in the graph you're then able to understand the provenence of a particular artifact that you've hit. Uh I find it very uh fascinating this temporal support out right out of the gravity database. Can you uh tell just a little more um under the hood what are those really the the episodes are nodes in the graph just like the other nodes and how do you extract so I saw the API that let's say I give some uh ad ed episode how do we extract information from the ad episode call under the hood like large language models and and edges >> yeah yeah so uh yes episodes are an entity on the graph uh or a node on the graph. Um it makes sense to model them that way. Um in Zep and graffiti we have various derived artifacts that are um nodes on the graph as well because they too need to have lineage and we need to understand how they were derived. Um, and in terms of how the ad episode method works, there's a pretty complicated uh, pipeline that gets run on um, uh, episode ingestion and I'll just give it the very high level uh, uh, outline for you. So there's a structured extraction extracting entities and the relationships between them and candidate facts and those are the materialized or hydrated fact triples. So two entities and a fact. Um and it's structured as uh a fact is structured as um um uh subject well subject uh verb object. Um and after that there is a uh deconliction process that runs dduplication and deconliction process. We dduplicate entities and we deconlict facts because there might be existing facts in the graph that are going to be mutated by a new learned fact. So Daniel loves Adidas shoes. Three months later, Daniel's shoes fell apart. He sends it back to those the shoes back to the return application and he sends a nasty gram along with it. We now Daniel returned shoes as a fact and Daniel was unhappy about Adidas. We need to invalidate the Daniel loves Adidas shoes fact and so that is part of that pipeline as well. A lot of what we do uses LLMs but we try very hard not to use LLMs in this process as well. So where we're able to deploy more traditional information retrieval techniques, more traditional NLP techniques, uh looking at things like entropy and a bunch of other, you know, using um sim hash and a bunch of other approaches to ddupe, uh we do so uh far cheaper, far faster, deter more more far more deterministic. So hopefully that answer your questions. >> Yep. Uh thank you for the great talk. Um just wanted to ask a question. So it seems like a common theme these days in uh memory systems is more filebased memory and wikis and knowledge bases and uh I'm just wondering have is Zep working on something like that and also uh could some of the ideas here be represented in that paradigm? >> Yeah. uh markdown suffers from provenence. File-based um file-based uh memory starts to break down with provenence. It's very difficult when you m mutate lines in a file to understand the lineage or the provenence of why those changes occurred. Um, not only that, but in multi- aent, multi-user, and multi-source scenarios, it can be very challenging to manage markdown files at scale. I think they work really well um for desktop usage. Uh, they sometimes work well in uh agentic use cases that are server based, not necessarily desktop or single user, single agent scenarios. Um but what we found is that it's um they just break down with the types of enterprise problems that we solving in particularly in particular provenence as an example. Does that answer your question? Oh more I don't know how much time we have left but maybe one more >> uh Daniel thank you. Um question on the right bag. How do you do that explicitly or implicitly? Um, how do you create the facts? Do you ask the LLM to summarize the conversation or at every turn you do that? And and which component does it, Zep or? >> Uh, >> yeah. So, so we do um as part we actually as part of the extraction, we've managed to get um a singleshot extraction working that extracts entities and the relationships between them and facts. and we're able to do so really cheaply as a consequence. Um, and so yes, we're using an LLM for that. Uh, we do have a reflection step or some reflection built in to ensure that the things that we've retrieved um are actually accurate um as well as to do some other stuff around uh uh more more richness to lineage. So why did something change? Not just this was related but also why did it change. Uh that's uh partly in graffiti partly in zap. Yeah. All right. Well, thank you everybody.

Frontier News · by Hyperjump Technology