<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ayub Abu zer</title>
    <description>The latest articles on DEV Community by Ayub Abu zer (@ayub_abuzer_24c9b58646e2c).</description>
    <link>https://dev.to/ayub_abuzer_24c9b58646e2c</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1991470%2Fb6ac63bc-1c3c-4a7d-b3da-a7b9f0ac4911.jpg</url>
      <title>DEV Community: Ayub Abu zer</title>
      <link>https://dev.to/ayub_abuzer_24c9b58646e2c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ayub_abuzer_24c9b58646e2c"/>
    <language>en</language>
    <item>
      <title>Improving Enterprise Multi-Hop Question Answering using Hybrid GraphReasoner</title>
      <dc:creator>Ayub Abu zer</dc:creator>
      <pubDate>Mon, 29 Jun 2026 09:35:10 +0000</pubDate>
      <link>https://dev.to/ayub_abuzer_24c9b58646e2c/teaching-llm-your-business-how-knowledge-graphs-took-multi-hop-accuracy-from-0-to-80-3jln</link>
      <guid>https://dev.to/ayub_abuzer_24c9b58646e2c/teaching-llm-your-business-how-knowledge-graphs-took-multi-hop-accuracy-from-0-to-80-3jln</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;General large language models lack awareness of enterprise-specific data relationships.&lt;/p&gt;

&lt;p&gt;I built a graph-grounded LLM reasoning system that transforms a synthetic supply-chain dataset into a knowledge graph and enables structured querying via the model. By holding GPT-4o constant across both conditions, I isolated the impact of graph-based retrieval.&lt;/p&gt;

&lt;p&gt;On complex multi-hop reasoning tasks requiring joins across multiple entity relationships, accuracy improved from 0% (no graph) to 80% (graph-grounded system).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The problem&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;capable models that don't know your business&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;large language models (LLMs) are excellent general reasoners, but they have no knowledge of an organization's specific-structured reality - its suppliers, contracts, products, customers and the relationships between them. &lt;/p&gt;

&lt;p&gt;Ask a base model "which of our customers are exposed to high-risk suppliers?"&lt;br&gt;
The model may either hedge when uncertain or, more problematically, hallucinate a confident but incorrect answer.&lt;br&gt;
The standard fix is retrieval-augmented generation (RAG): embed documents into a vector store and retrieve the most similar chunks for each question. This works well for lookup questions whose answer lives in a single paragraph. It breaks down for multi-hop questions  whose answer is spread across several connected facts:&lt;br&gt;
"Which customers buy products that contain a component made by a supplier whose contract is flagged high-risk?"&lt;br&gt;
That answer is spread across four different relationships. &lt;br&gt;
Vector similarity has no notion of a join, so it retrieves disconnected chunks and the model is left to guess the connections,  which is a primary source of hallucination in enterprise settings.&lt;/p&gt;

&lt;p&gt;In enterprise settings, incorrect multi-hop reasoning is not a hallucination problem—it is a financial and compliance risk problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The idea&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;put the relationships where they belong — in a graph&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Businesses already describe their world in terms of relationships: &lt;/p&gt;

&lt;p&gt;&lt;em&gt;a supplier supplies a product, a component is part of a product, a product is sold to a customer.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A knowledge graph stores those relationships as first-class connections, so a multi-hop question becomes a guided traversal instead of a lucky search.&lt;/p&gt;

&lt;p&gt;I designed the system to transform enterprise structured data into a knowledge graph that grounds LLM reasoning through structured traversal instead of pure retrieval.&lt;/p&gt;

&lt;p&gt;In a little more detail the approach has three steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Model the data of the business as a graph (Neo4j) — entities become nodes, relationships become the edges between them.&lt;/li&gt;
&lt;li&gt; Then, at query time, each question is converted into a precise graph query, the graph returns the exact matching facts that matter for that question.&lt;/li&gt;
&lt;li&gt; Let the model answer strictly from those facts — nothing else.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The result is an answer that is accurate, cheap (only the relevant sub-graph is sent to the model) and crucially for enterprise adoption — explainable: you can point at the exact Cypher query and rows behind every answer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzeiwtedbq2hgiwvz6kpj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzeiwtedbq2hgiwvz6kpj.png" alt=" " width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nothing in that loop is hard-coded to a specific domain: &lt;br&gt;
replacing the dataset preserves the same execution engine, because the Cypher is generated from whatever schema Neo4j reports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modelling the business as a graph&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To make the idea concrete (and the results verifiable) I used a deliberately generic supply-chain domain — the kind of interconnected data almost every company has in some form.&lt;br&gt;
• Nodes (entities): suppliers, products, components, contracts, customers, facilities, and business terms.&lt;br&gt;
• Edges (relationships): who supplies what, what a product is made of, who a product is sold to, which supplier depends on another, etc.&lt;/p&gt;

&lt;p&gt;Knowledge-graph schema: the node types and the relationship types that connect them&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4kmgx3wyv4j34u4ehiuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4kmgx3wyv4j34u4ehiuv.png" alt=" " width="800" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is what makes the questions hard for a plain LLM: the interesting ones ("which customers are exposed to a high-risk supplier through a shared component?") trace a path across four or five of these edges. There is no single document that states the answer — it only exists as a traversal of the graph. That is precisely the structure a knowledge graph captures and flat text retrieval cannot.&lt;/p&gt;

&lt;p&gt;Another important feature is that the business glossary lives inside the graph. Terms like "Single Point of Failure" or "Customer Exposure " are stored as their own nodes, each with a definition, an owner, and a pointer to the part of the model it governs. The organisation's own vocabulary becomes queryable alongside its data, so the system answers in the language the business already uses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;From table to graph&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Real enterprise data doesn't arrive as a graph. It arrives as database tables, CSVs, spreadsheets. The build phase is essentially a translation step, and it follows one simple rule:&lt;br&gt;
• Entity tables become the Nodes in the graph.&lt;br&gt;
• Relationships between tables become the edges between them.&lt;/p&gt;

&lt;p&gt;This matters a lot, it mirrors how the work would actually land on a real data platform, and it means a business doesn't have to re-shape its data to get started, its existing tables are the input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Grounding&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;why the answers can be trusted&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The key design choice is that the model is constrained to respond only using results returned from the graph. Each answer is therefore grounded in explicit facts, allowing a human reviewer to trace and audit the source of every claim.&lt;/p&gt;

&lt;p&gt;This approach also enables a capability that many systems lack: graceful abstention. If a query cannot be answered from the underlying data—for instance, requesting suppliers in a country where none exist, the graph simply returns no results. there is nothing to ground an answer on, and the model declines instead of inventing one. In regulated settings, "I don't have that information" is exactly the right answer, and here it happens by design rather than by luck.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Evaluation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To measure the value of the graph fairly, I ran a controlled comparison. The same model (gpt-4o) answered the same labelled question set two ways:&lt;br&gt;
• Without the graph — the model on its own.&lt;br&gt;
• With the graph — the same model, answering through the knowledge graph.&lt;/p&gt;

&lt;p&gt;Holding the model constant is the whole point: the only thing that changes is graph access, so the difference is the value the graph adds — not a difference in model strength.&lt;/p&gt;

&lt;p&gt;The metric is entity recall: of the entities the correct answer should mention, how many did the system actually get.&lt;br&gt;
Same model, with vs without the knowledge graph: overall and multi-hop accuracy&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How the evaluation works&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The process is deliberately simple and hard to game:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Generate the questions. A benchmark of 106 questions is built from the
real data — 82 single-hop lookups ("who produces the Lithium Cell?") and 24 multi-hop reasoning chains ("which customers are exposed to suppliers in a given country?"). They're produced from templates filled with real values plus a set of deliberately unanswerable questions, so nothing is cherry-picked.&lt;/li&gt;
&lt;li&gt; Answer each one twice — once with the graph, once without.&lt;/li&gt;
&lt;li&gt; A domain-aware human evaluator manually verified correctness of each answer and abstention. Crucially, when a question
genuinely can't be answered from the data, an honest "I don't know" is graded correct — refusing to fabricate is the right behaviour, not a failure.
Human evaluation (rather than automated string matching) was used to ensure correctness of answers and abstentions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What the numbers show&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkr2of2ic3temsrbckxtr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkr2of2ic3temsrbckxtr.png" alt=" " width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The plain model's 0% on multi-hop is the headline: with no way to perform the join, it can't answer a single question whose answer is a chain of relationships. It was unable to correctly resolve any multi-hop queries over the dataset. — it either gave a generic essay or confidently named real-world companies that aren't part of this business at all. Two real examples from the run make the gap concrete, including the exact query the graph ran to get the right answer.&lt;br&gt;
A single-fact question — "Who produces the Lithium Cell?"&lt;br&gt;
• With the graph (correct): "Asia Components Co produces the Lithium Cell."&lt;br&gt;
• Without the graph (wrong): a list of global battery brands — CATL, LG Chem, Panasonic, Samsung SDI — none of which exist in this company's data.&lt;br&gt;
The graph answer is backed by the exact query it ran (this is the provenance that makes every answer auditable):&lt;/p&gt;

&lt;p&gt;this query are generated dynamically from the graph schema:&lt;br&gt;
&lt;code&gt;MATCH (s:Supplier)-[:PRODUCES]-&amp;gt;(c:Component)&lt;br&gt;
WHERE toLower(c.name) CONTAINS toLower('Lithium Cell')&lt;br&gt;
RETURN s.name AS supplier&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A multi-hop question — "Who produces the components that go into the Industrial Robot Arm?" (supplier → component → product)&lt;/p&gt;

&lt;p&gt;• With the graph (correct): "Global Metals Ltd, Rhine Electronics GmbH, Shenzhen Microchips Inc and Andes Copper Mining" — the exact four suppliers, traced through the parts that make up the product.&lt;br&gt;
•&lt;br&gt;
    Without the graph (failed): generic robotics names — Fanuc, ABB, Siemens, Mitsubishi — plausible-sounding and entirely wrong for this business.&lt;/p&gt;

&lt;p&gt;Here the model wrote a genuine multi-hop traversal — product back to its components, then back to the suppliers that make them — in a single query:&lt;/p&gt;

&lt;p&gt;this query are generated dynamically from the graph schema:&lt;br&gt;
&lt;code&gt;MATCH (p:Product)&amp;lt;-[:PART_OF]-(:Component)&amp;lt;-[:PRODUCES]-(s:Supplier)&lt;br&gt;
WHERE toLower(p.name) CONTAINS toLower('Industrial Robot Arm')&lt;br&gt;
RETURN DISTINCT s.name AS supplier&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That's the pattern across the whole benchmark: the plain model reasons fluently about the world in general but knows nothing about this organization, while the graph-grounded model answers from the company's own facts — with the query as evidence — and says "I don't know" when the data can't support an answer.&lt;br&gt;
These are measured results from a synthetic benchmark, judged by a human, not projections. Because the queries are generated live, exact figures vary slightly between runs; the large, reproducible finding — graph grounding makes the model accurate on a business's own multi-hop questions — does not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this matters for a business&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This approach makes enterprise LLM systems practical to deploy because it improves accuracy on multi-hop queries, provides traceable answers through explicit graph queries, and enables safe failure through structured abstention. The same reasoning engine can be reused across domains by changing only the underlying data model.&lt;/p&gt;

&lt;p&gt;Explainability you can sign off on. Every answer comes with its evidence.&lt;br&gt;
That is the difference between a tool a regulated business can adopt and one it&lt;br&gt;
cannot.&lt;/p&gt;

&lt;p&gt;Honesty under uncertainty. The system abstains rather than guessing, which&lt;br&gt;
turns the biggest risk of enterprise AI — confident fabrication — into a managed&lt;br&gt;
behaviour.&lt;/p&gt;

&lt;p&gt;Reusable across the business, not locked to one domain. Nothing about the&lt;br&gt;
approach is specific to supply chains. To point it at a different part of the&lt;br&gt;
business — finance, HR, operations, logistics — you swap in that domain's tables&lt;br&gt;
and a small mapping, and the question-answering engine is untouched, because it&lt;br&gt;
generates its queries from whatever data is loaded. One build, many domains:&lt;br&gt;
every new area reuses the same engine instead of a fresh bespoke project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limitations and Practical Trade-offs&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Evaluation scope&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The benchmark was conducted on a curated set of 106 human-judged questions designed to test single-hop and multi-hop reasoning. While the results demonstrate strong gains in structured reasoning tasks, performance may vary across broader, real-world distributions and more diverse query types.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Maintenance and adjustability&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The system requires ongoing maintenance of the knowledge graph and prompt layer. In cases where the LLM fails to retrieve or reason correctly, improvements often involve iterative adjustments such as refining prompts, improving entity linking rules, or expanding graph coverage to handle missing or ambiguous entities.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Latency trade-off&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Introducing graph traversal alongside vector retrieval improves reasoning accuracy but adds additional query-time overhead. In practice, this creates a trade-off between response latency and multi-hop reasoning performance, particularly for deeper or more complex graph queries.&lt;/p&gt;

&lt;p&gt;These trade-offs are typical in hybrid GraphRAG systems and reflect the balance between accuracy, control, and runtime efficiency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where this goes next: from proof of concept to production&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A proof of concept earns the right to ask "what next?". Taking this into production&lt;br&gt;
comes down to three priorities.&lt;/p&gt;

&lt;p&gt;Make it richer. Let the system draw on documents as well as the graph, so it&lt;br&gt;
can answer both relationship questions and plain lookups. The more the business&lt;br&gt;
invests in its shared vocabulary, the sharper the answers become.&lt;/p&gt;

&lt;p&gt;Keep the graph fresh automatically. Feed it from the company's existing data&lt;br&gt;
pipelines so it updates as the business changes, rather than from a one-off load.&lt;br&gt;
A knowledge graph is only as trustworthy as its last refresh.&lt;/p&gt;

&lt;p&gt;Keep people in the loop. Let experienced domain experts review answers, refine&lt;br&gt;
how questions are phrased to the model, and confirm what "correct" looks like. This&lt;br&gt;
steadily teaches the system the business's own logic and language — turning the&lt;br&gt;
hard-won judgement of experienced people into accuracy the whole organization&lt;br&gt;
benefits from.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Closing thought&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Knowledge graphs give a model something it fundamentally lacks: the business knowledge - an explicit, queryable map of the relationships that define a business. By translating structured data into a graph and grounding the model on what that graph returns, the result is higher accuracy on the hard, multi-hop questions and full explainability, while staying generic enough to move from one domain to the next.&lt;br&gt;
The single sentence I'd want a decision-maker to remember:&lt;br&gt;
Holding the model constant, introducing a knowledge graph grounding layer increased multi-hop accuracy from 0% to 80% on a human-judged 106-question benchmark.&lt;/p&gt;

&lt;p&gt;The accompanying proof of concept is a complete, runnable implementation with a reproducible benchmark.&lt;/p&gt;

</description>
      <category>rag</category>
      <category>llm</category>
      <category>graph</category>
      <category>langchain</category>
    </item>
  </channel>
</rss>
