AI Engineer World's Fair 2025
When Vectors Break Down: Graph-Based RAG for Dense Enterprise Knowledge
Read the talk
When Vectors Break Down: Graph-Based RAG for Dense Enterprise Knowledge
Writer’s retrieval architecture evolved from keyword and vector search toward graph relationships, JSON storage, and Fusion-in-Decoder to handle dense enterprise knowledge.
From a talk by Sam Julien
Before you start: Familiarity with embeddings, document chunking, and the basic retrieve-then-generate RAG workflow will help.
When similarity is not enough
What does a retrieval system need beyond vector similarity to answer sophisticated questions reliably? The expansion of RAG made semantic search widely accessible, but retrieving similar text is only one part of assembling the right evidence. Sam Julien opens with Jo Kristian Bergum’s article about the rise and fall of the vector database infrastructure category and his subsequent Latent Space interview: the infrastructure boom following ChatGPT was giving way to recognition that sophisticated retrieval needs multiple strategies.
Writer had already described its approach in a November 2023 article on enterprise RAG. The company builds its own models, graph-based retrieval system, and tools for enterprise agents and applications. Working with large organizations, including regulated healthcare and finance businesses, made accuracy and hallucination reduction central engineering constraints. The resulting architecture grew through successive attempts to solve those constraints; the lessons from that process matter alongside the final combination of techniques.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Research organized around customer problems
Julien, introducing himself as Writer’s director of developer relations, describes the architecture as a historical sketch rather than a blueprint of current production. That scope matters: the presentation explains why components were added or replaced, without specifying every layer of the deployed system.
Writer’s research program connects four areas:
| Area | Example or purpose |
|---|---|
| Enterprise models | Palmyra X5, then powering the AI Engineer website chat |
| Practical evaluations | Failsafe QA, a finance benchmark |
| Domain specialization | Palmyra Med and Palmyra Fin |
| Retrieval and knowledge integration | Connecting enterprise data to models securely and reliably |
These areas share a practical feedback loop: customer problems inform research, which informs the product. The problem determines the technique, rather than a commitment to a particular database or model architecture.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Two ways chunked vector retrieval loses the answer
Enterprise knowledge can comprise terabytes of documents written in specialized, repetitive language. Writer initially searched a knowledge base and passed the results to an LLM. That supported basic keyword queries, but the need for similarity matching led to the familiar vector pipeline: split documents into chunks, embed them, store the embeddings, retrieve similar chunks, and pass the results to the model. Two problems emerged.
The first was losing the association between a fact and its subject. In Julien’s Apple history example, a reader can distinguish the Macintosh’s 1984 introduction from the Lisa’s 1983 introduction. Naive chunking places nearby information together, and a nearest-neighbor retrieval pipeline can supply context that leads to the wrong answer: 1983 for the Macintosh. The passage is relevant to Apple history, but relevance alone does not preserve which date belongs to which machine.
The second was concentrated vocabulary. A mobile phone company may have thousands of documents discussing cameras, megapixels, and battery life. Asking for a comparison between two phone models can retrieve many plausible passages without clearly separating the facts belonging to each model. Semantic proximity helps find the topic; the comparison still requires the correct entity-to-attribute relationships.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Preserving relationships with graph retrieval
Graph-based retrieval introduced an explicit way to retain those relationships. Writer queried a graph database, used keys to retrieve relevant documents, and supplied the results for answer generation. Combined with full-text and similarity search, the graph added context about how the retrieved information fit together. Julien reports that this improved accuracy by preserving relationships in the text.
The approach also introduced four operating challenges:
- Graph construction: Converting source data into a structured graph became difficult and costly at scale.
- Database operation: Growth exposed both cost pressures and limits in the team’s graph database expertise.
- Similarity matching: Cypher was difficult to use for the advanced matching the application required.
- Query representation: The team observed better LLM results with text-based queries than with complex graph structures.
These were Writer’s historical constraints, not fundamental limitations of graph databases. The next design decision was therefore to preserve the useful relationships while changing the implementation to fit the team’s expertise.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Extract a graph, store JSON
Writer’s team knew how to build models, so it addressed graph construction with a specialized model designed to run on CPUs or smaller GPUs. Julien notes that, by the time of the talk, fine-tuning an available small model could offer an alternative to building one from scratch. Writer’s model mapped text into nodes and edges, while context-aware splitting and chunking helped preserve semantic relationships across the extraction process.
The storage decision separated graph representation from graph database infrastructure. Writer serialized graph data as JSON and stored it in a Lucene-based search engine. To make that representation concrete, the earlier Apple example could retain the product-to-year associations as explicit records:
json
{
"nodes": [
{ "id": "lisa", "name": "Lisa" },
{ "id": "macintosh", "name": "Macintosh" }
],
"edges": [
{ "source": "lisa", "relation": "introduced_in", "year": 1983 },
{ "source": "macintosh", "relation": "introduced_in", "year": 1984 }
]
}
This illustrative JSON makes the associations explicit; it is not Writer’s published storage schema. The underlying design choice is to keep relationship information while using search infrastructure the team can operate well. Julien reports that this supported large data volumes without speed degradation, but supplies no workload measurements for that claim.
The historical ingestion pipeline now had three distinct responsibilities:
- Split the source with enough context to preserve meaning.
- Convert text into graph relationships with the specialized model.
- Pass the resulting representation to the search engine.
This improved the retrieval foundation, but did not yet resolve how to combine retrieved evidence effectively for generation.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Encode passages separately, combine evidence in the decoder
Similarity matching and query representation remained open problems. The team returned to retrieval research to reconsider its assumptions. The original RAG paper combines a retriever with a pretrained sequence-to-sequence generator. Julien contrasts that trained architecture with the now-common practice of placing retrieved context and a question into an instruction prompt. The distinction is architectural: the original paper does use retrieved context and concatenate it with the input, so it should not be read as omitting question-and-context conditioning.
Fusion-in-Decoder offers another way to combine retrieval and generation. Instead of jointly encoding all retrieved passages as one long sequence, it encodes passages independently. The decoder then attends to their representations together, allowing evidence from different passages to contribute to one answer.
For a fixed passage length, separate encoding makes encoder work grow linearly with the number of passages, rather than incurring the quadratic self-attention growth of encoding their concatenation. That comparison concerns passage encoding, not a guarantee about total system latency or every part of decoding. The useful separation is that passages remain independent during encoding while their evidence is combined during generation.
Julien points to the Facebook Research FiD repository as a practical way to explore the technique. It provides a concrete research implementation of the encoder–decoder approach behind this alternative to a single assembled prompt.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Use graph relationships to select better evidence
The connection back to graphs is KG-FiD: Infusing Knowledge Graph in Fusion-in-Decoder. Retrieved passages are not necessarily independent pieces of evidence: graph relationships can connect them and inform which passages deserve further processing. The research architecture uses graph-based passage reranking in two stages, at retrieval and at an intermediate encoder stage. This addresses an efficiency bottleneck by improving the selection of evidence passed through the system.
Writer drew on this research to build its own Fusion-in-Decoder implementation, using its existing model-building capabilities. Julien reports that the addition reduced hallucinations and that Writer published a white paper describing its findings. He does not give a numerical reduction, and the research paper’s results are not measurements of Writer’s implementation. Fusion-in-Decoder became another component in a system assembled from multiple techniques; other techniques remained outside the presentation’s scope.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
What the evaluation and product expose
Writer evaluated its combined system using Amazon’s RobustQA benchmark, comparing it with seven vector-based RAG configurations. Those alternatives included hybrid search, so the comparison was broader than seven pure nearest-neighbor systems. In Writer’s 2024 report, its system has the highest reported RobustQA average score among the eight tested pipelines. Julien also describes it as the fastest, but the published table gives both Writer and the LangChain/Pinecone/Cohere configuration the same response-time bound of less than 0.6 seconds. That table does not establish a unique fastest system. The result is a vendor evaluation whose scoring and timing details are insufficient for a fully reproducible performance comparison.
The architecture also supports a visible evidence trail. Writer can expose snippets, subqueries, and sources through its product and API, giving users and developers material to inspect when assessing an answer. Although Julien describes this as exposing the thought process, these are observable retrieval artifacts, not access to a model’s private internal reasoning.
Writer also presents the system as supporting multi-hop questions that combine evidence across documents and topics. Related cases include answers spread across multiple pages and passages containing similar terms that do not match the user’s intent. Graph relationships help maintain the connections among those pieces, while Fusion-in-Decoder provides a way to aggregate their evidence. These are the capabilities Writer attributes to the combined architecture, rather than guarantees that graph retrieval will answer every such question correctly.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Keep the relationships, choose the implementation
The benefits of graph relationships do not require one storage technology. A graph database, a design built with Postgres, or a search engine can each support an approach that preserves and uses relationships in retrieval. Writer’s journey illustrates why that distinction matters: changing storage did not require abandoning the information structure that improved its answers.
The engineering process followed the same logic. Customer needs set the objective; team expertise shaped which implementations were workable; research challenged assumptions about how retrieval and generation should fit together. Those principles allowed the team to change components while continuing to pursue the same goal: reliable answers from dense enterprise knowledge.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Resources
From the talk
Writer’s early account of Knowledge Graph, retrieval-aware compression and the costs of assembling enterprise RAG infrastructure.
The original RAG architecture combines a dense retriever with a pretrained sequence-to-sequence generator. This is the April 2021 revision.
Izacard and Grave investigate generative question answering with evidence from multiple retrieved passages.
Research implementation for exploring Fusion-in-Decoder.
Uses graph relationships to rerank passages during retrieval and reading, reducing noisy evidence passed to answer generation.
Writer’s comparison of eight retrieval and generation pipelines, reporting RobustQA scores and response-time bounds.
Introduces an eight-domain benchmark for testing how open-domain question-answering systems generalize beyond their training domain.
Read the complete timestamped transcript
- 0:00
[on hold music] Welcome.
- 0:16
So glad to see you all here. Uh, welcome to When Vectors Break Down: Graph-Based RAG for Dense Enterprise Knowledge, and big thank you to Swix and Ben for putting on yet another amazing event.
- 0:28
Um, so it's a pretty interesting signal that we have an entire track dedicated to graph-based RAG, and I think in addition to all of the agentic, uh, promise of graph-based RAG, we're also seeing that the market is starting to catch up, that vector search is just not enough for RAG at scale.
- 0:46
You may have seen this really interesting article by Joe Christian Bergam, who is around here somewhere, on the rise and fall of the vector database infrastructure category, and his subsequent interview on Latent Space, where he talked about how vector databases have experienced this gold rush after ChatGPT's launch, uh, but that the industry is starting to recognize that
- 1:06
vector search alone is just insufficient for sophisticated retrieval, and that we're going to need multiple strategies beyond simple vector similarity. This is music to our ears at Writer because we've actually been talking about this for a long time.
- 1:20
We've been, uh, talking about the benefits of graph-based RAG for a couple of years now. In fact, if you look at this article from November twenty twenty-three, which in AI time is, like, prehistoric times, um, we actually talk about the benefits of knowledge graphs and the shortcomings of vector databases and simple similarity search for enterprise RAG at
- 1:40
scale. And if, if you're not familiar with Writer, we're this end-to-end agentic platform for enterprises where we build our own models, we build our own graph-based RAG system, and have this suite of software tools on top of that for enterprises to be able to build agents and AI applications.
- 1:56
And so as we've been building knowledge graph over the years, it's been an interesting journey as we've been working with these Fortune five hundred and Global two thousand companies at scale.
- 2:07
Most of them, or many of them are in highly regulated industries like healthcare and finance, where accuracy and low hallucinations are super important. And so our team has been putting together this system over the years of different components put together and different techniques that we could really drive our accuracy rate up high and reduce our hallucinations.
- 2:28
And so what I wanted to share in this talk was kind of the journey of how we got there, and the main takeaway being, as you're seeing in several of these talks, like the first talk about hybrid search, there are many different ways that you can get the benefits of knowledge graphs in RAG.
- 2:42
And also what-- how you get there and what you learn along the way is actually often very valuable as you're building out your retrieval system, uh, uh, j- almost just as valuable as the end result itself.
- 2:54
So I'm gonna weave together these two stories of our journey to graph-based RAG and sort of the first principles thinking that I think has made our team successful in putting together this system as we continue to iterate and improve on it.
- 3:06
So I'm Sam Julien. I'm the director of developer relations at Writer, and you can find most of my writing and books and newsletters and all of those things at samjulien.com.
- 3:15
So I talked about this system composed of multiple pieces put together over a couple of different years, and I wanna talk about sort of how we got to this point and where we are now.
- 3:26
And I'm just gonna put a blanket caveat on here that please consider this a sketch and not a blueprint of what is currently in production. Of course, there are, like, many moving pieces and many layers to this, uh, but I wanna abstract it enough to make it something that is practical and, and usable for people.
- 3:42
So our research team, we have a cracked research team at Writer, and they have four main areas of focus. Enterprise models, like, like our Palmyra X5 model. That's the one powering the chat on the AI Engineer website right now.
- 3:55
Practical e-evaluations like our finance, uh, benchmark called Failsafe QA. Domain-specific, uh, uh, specialization. These are our domain-specific models like Palmyra Med and Palmyra Fin. And then what our focus is here, retrieval and knowledge integration, so bringing enterprise data to work with our models in a secure, reliable way.
- 4:16
And I think what's really cool about the way our research team works is that they're very focused on solving practical problems for our customers. Uh, they're not just sort of, like, working in isolation, uh, working on theoretical things.
- 4:28
They're actually driven by customer insights, and that's, uh, really what I would consider, like, sort of the first meta lesson of wha-why I think this is working so well for Writer right now.
- 4:38
We're really focused on solving the customer problems rather than implementing specific solutions.
- 4:44
So the problem that we are trying to solve kind of constantly, as most of us are here, is that enterprise data is really dense, specialized, and massive. So we're often dealing with terabytes of data, and it uses very specific language, and it's often very clustered together.
- 5:00
There's not a lot of diversity in the language used in these documents, and that's what our research and engineering teams have been focused on these last few years. So like most, we kind of started out with a regular search of, you know, querying a knowledge base u-using an algorithm and passing that to the LLM.
- 5:17
But that quickly sort of, like, ran out because of, you know, it was good for basic keyword searches, but not really great for that advanced similarity search that we needed.
- 5:26
So then again, like most, we went to vector embeddings and did chunking and embeddings and put it in a database and then similarity search, uh, and passing it to the LLM for the end user to query.
- 5:39
But we ran into two major problems with this.
- 5:43
The first is that with vector retrieval, chunking and nearest neighbors can give inaccurate answers. Uh, so if you look at this example of kind of this text about the founding of Apple and the timeline, it's very easy for us as humans to look at these text chunks and pick out the fact that the Macintosh was created in
- 6:01
1984. But when you chunk this text naively and you just give it to a nearest-neighbor search, uh, it can get confused, and it thinks that it was actually in 1983 instead of 1984 because it's in the same chunk as the introduction of the Lisa.
- 6:14
Uh, side note, I'm a huge, uh, Apple-- vintage Apple nerd, and so I, I liked this example. The other big problem that we ran into with vector retrieval was that it was failing with really concentrated data.
- 6:25
So if you think about a lot of large enterprises, it's not like they're dealing with documents where, like, some of them are talking about animals and some of them are talking about fruit, right?
- 6:33
Like, so if you have a mobile phone company, for example, and they have thousands and thousands of documents that all use megapixels and cameras and battery life and things like that, and you ask the RAG system and the LLM to compare two different phone models, it's gonna really struggle with that because it's gonna find all these answers
- 6:50
and have no idea how to make sense of them.
- 6:54
And so that's what took, took us to graph-based RAG, where instead we would query, uh, a graph database and get back the relevant documents using keys, uh, and generate an answer.
- 7:04
And especially powerful if you combine that with, like, full text and similarity search and things like that. Um, and so this really helped us with our accuracy because we were able to preserve the relationships with the text and provide more context to, to the model.
- 7:20
Uh, and this was really interesting because at the time, there actually weren't that many pe-people doing graph-based RAG o-last-- over the last couple of years. And that's why I think the focus of the team on really trying to solve the problem of the customer rather than chase whatever was, uh, being hyped up at the time was really
- 7:36
important. So that was really great, but we did run into some challenges back then with using graph databases. Now, this is not an indictment of any graph database technology.
- 7:46
It's just that we were running into these issues at the time, a couple of years ago. And so there were four things that we ran into. First, that converting the data into the structured graph was getting really challenging and costly at scale.
- 8:01
Uh, as the, as the graph database scaled, we were hitting the limits of our team's expertise as well as hitting some cost issues. And then we were running into some problems where Cypher was struggling with the ad-advanced similarity matching that we needed, and we were noticing that LLMs were doing better with text-based queries rather than complex graph
- 8:18
structures. Now again, if you were to do this now, you might not run into those problems, but this is what we ran into historically. And so I think the way that the team approached this is also very interesting, where they decided to stay flexible based on their expertise.
- 8:32
So they were running into these problems at-- that I think were not necessarily fundamental to the technology itself, but more like, okay, how can we solve the problems for our customers using the expertise that we have on the team?
- 8:43
And so they came up with a few really interesting solutions to this problem-- to these problems. So first, when it came to converting the data into the graph structure, the team went back to their expertise, and they say, "What do we know how to do?
- 8:54
We know how to build models. So let's build a specialized model that can scale and run on CPUs or smaller GPUs," which I think is a really clever solution.
- 9:05
Now, if you were to do this now, there's probably enough fast, small models out there that you could fine-tune something like that. You wouldn't have to build it yourself.
- 9:12
But at the time, we didn't really have any options like that. So the team built it themselves and fine-tuned a model that was trained to map this data into graph structures of nodes and edges, and we did some, uh, better context-aware splitting and chunking to, uh, preserve the context and the semantic relationships.
- 9:28
And this really helped, uh, preserve the reliability. Okay, and so then the issues with the scaling of the graph databases and the limitations of the, the expertise on the team with the cost at scale.
- 9:40
So again, we went back and, and thought about, like, what is our team's expertise in, and what can we do? And so what we did was instead, we stored the data points as JSON in a Lucene-based search engine.
- 9:50
So we take the graph structure, we convert it into JSON, and we put it in the search engine, and this allowed us to easily handle the large amounts of data without any performance or speed degradation, uh, at scale, while still w-being, uh, something that the team was really good at.
- 10:06
And so the team had started to assemble this concept of, of what our RAG system was look-- was looking like. And again, this is kind of more of a historical snapshot and a, and a, and a sketch over time, but, uh, where we do the context-aware splitting and text to graph with this specialized model and then pass
- 10:22
it to a search engine. Uh, and we were really starting to drive up our accuracy.
- 10:28
But, uh, we still have those problems with the similarity matching and the text-based queries doing better than the complex graph structures. And so again, the team sort of like went back to first principles and thought, "Okay, what, what is it that we're trying to solve here?
- 10:42
And let's go back to the research and figure out, like, what we can build on to build a solution that's best for our customers and our specific needs." And I think this is kind of the final meta point of letting research challenge your assumptions.
- 10:55
So rather than st-staying focused on the solution, you know, step back, look at the research, and figure out what you can do to solve the challenges for your customers.
- 11:04
So they went back to the original RAG paper, and if you go back to the original RAG paper, it doesn't actually ever talk about using prompt context and questions, which is super interesting, right?
- 11:12
That's sort of like the de facto way of doing RAG now. But the, the original RAG paper actually proposed this whole, like, two, uh, component architecture with a retriever and a generator with a, uh, pre-tr-pre-trained sequence-to-sequence model.
- 11:25
Never actually talks about prompt and context and questions. And so that's where they came across Fusion-in-Decoder, which I kind of think of as like an alternate timeline for RAG, like if we, if we didn't go down the road of, uh, prompt and context and questions.
- 11:38
And so Fusion-in-Decoder is this technique that kind of builds upon the original proposal of the original RAG paper, where it processes the passages independently in the encoder to get linear scaling instead of quadratic scaling, but then jointly in the decoder for better evidence aggregation.
- 11:53
So big efficiency breakthrough and lots of state-of-the-art performance. I know this is super abstract, so if you go to Facebook, they actually have a f- a Fusion-in-Decoder, uh, library that you can play around with and actually do the steps of Fusion-in-Decoder.
- 12:07
I also know that at this point you're going like, "What the heck is this guy talking about in a GraphRAG track? Why are we talking about Fusion-in-Decoder?" Well, I'm glad you asked, because the next big breakthrough was knowledge graph with Fusion-in-Decoder.
- 12:17
So you can use knowledge graphs with Fusion-in-Decoder, uh, as a technique, and this sort of improves upon the Fusion-in-Decoder paper by using knowledge graphs to understand the relationships between the retrieved passages.
- 12:30
And so it helps with this efficiency bottleneck and improves, uh, the, the pr- the process. I'm not gonna walk through this diagram step by step, but this is the diagram in the paper of the architecture where it, it uses the graph and then does this kind of two-stage re-ranking of the passages, and it helps with, uh, improving
- 12:46
the efficiency while also lowering the cost. And so the team took all this research and came toge- came together to build their own, um, implementation of Fusion-in-Decoder since we actually build our own models, uh, to make that kind of the final piece of the puzzle, and it really helped our hallucination rate.
- 13:01
It really drove it down, and then we published a white paper with our own findings of it.
- 13:06
And so then we kind of had that piece of the puzzle, and there's a few other techniques that we don't have time to go over, but, uh, point being, we're, we're assembling together multiple techniques based on research to get the best results we can for our customers.
- 13:19
So that's all well and good, but, like, does it actually work? Like, that's the important part, right? So we did some benchmarking last year. We used Amazon's RobustQA dataset and compared our retrieval system with knowledge graph and Fusion-in-Decoder and everything, uh, with our-- with seven different vector search, uh, systems.
- 13:36
And we found that we had the, the best accuracy and the fastest response time. So encourage you to check that out and kind of check out this process. Benchmarks are really cool, but what's even cooler is, like, what it unlocks for our customers, which are various features in the product.
- 13:52
Um, for one, becau-- uh, like most graph structures, we can actually expose the thought process because we have that relationships and the additional context where you can show the snippets and the sub-queries and the sources for how the RAG system is actually getting the answers, and we can expose this in the API to developers as well as
- 14:10
in the product. And then we're also to have-- able to have knowledge graphics sell at multi-hop questions- There's someone over there with a- ... where we can, um, reason across multiple documents and multiple topics without any struggles.
- 14:23
And then lastly, it can handle complex data formats where vector retrieval struggles, where an answer might be split into multiple pages, or maybe there's a similar term that doesn't quite match what the user is looking for.
- 14:35
But we c-- because we have that graph structure and, and the, and Fusion-in-Decoder with the additional context and relationships, we're able to, uh, formulate these correct answers.
- 14:46
So again, my main takeaway here is that there are many ways that you can get the benefits of knowledge graphs in RAG. That could be through a graph database.
- 14:54
It could be through doing something creative with posters. It could be through a search engine. Uh, but you can, uh, y- take advantage of the relationships that you can build with knowledge graphs, uh, in your RAG system.
- 15:05
And as you get there, you can challenge your assumptions and focus on the customers to be able to get to the end result to, to make the team successful.
- 15:12
And so for our team, it was focusing on the customer needs instead of what was hyped, staying flexible based on the expertise of the team, and letting research challenge their assumptions.
- 15:23
Um, so if you wanna join this amazing team, we're hiring across research, engineering, and product. Uh, we would love to talk to you about any of our open roles.
- 15:30
Uh, and I'm available for questions. You can come find me in the hallway or reach out to me on Twitter or LinkedIn, and that's all I've got for you.
- 15:38
Thank you so much. [applause] [upbeat music]