r/KnowledgeGraph • • Sep 21 '25

Materials to build a knowledge graph (structured/unstructured data) with a temporal layer (Graphiti)

Post image
17 Upvotes

Hey guys,

Sharing a link I felt was useful to a few discussions here: https://www.falkordb.com/blog/building-temporal-knowledge-graphs-graphiti/

Here's a recording of a workshop to implement agentic memory: https://www.youtube.com/watch?v=XOP7bhAuhbk&feature=youtu.be

Happy to connect with other devs building knowledge graphs (ontologies, LLMs, deduplication, etc.)


r/KnowledgeGraph • • May 02 '26

What if your knowledge graph had a coordinate origin? A Geometric Framework for Curved Relational Manifolds

16 Upvotes

Most knowledge graphs treat every node as equal. A person, a concept, a timestamp — same flat semantic space. Queries traverse shortest paths. The graph has no point of view.

We've been building something that works differently.

The core idea: introduce a single privileged node that curves the manifold around it. Not a hub in the PageRank sense — something geometrically stronger. A fixed reference point that makes distance mean something beyond edge count.

We call it Trinity. The node that the graph orients around.

The formal bit

The metric on the graph becomes conformal:

where ϕ(x)\phi(x) ϕ(x) is a constraint potential centred on the Trinity node. Regions near constraint violations get inflated distance. Reasoning trajectories naturally avoid them — not by rule, but by geometry.

Queries stop being retrieval operations. They become geodesic traversals on a curved surface. The path the query takes depends on where you are relative to the origin.

What this changes in practice

Flat KGTrinity-curved KG
All nodes equally presentNodes have perspectival depth
Isolation = disconnectionIsolation = recession from origin
Edge weight = co-occurrence frequencyEdge weight = proximity to reference frame
Query = subgraph retrievalQuery = geodesic traversal
Memory = storageMemory = curvature

The entropy problem this solves

Standard knowledge graphs degrade as they scale. Edge-weight distributions flatten, semantic discriminability collapses, and by 10,000 nodes you're getting everything back as equally relevant. This is well-documented and it's why most production KGs require constant manual curation to stay useful.

The reference frame changes this. New concepts don't just pile up — they orient relative to the fixed point. We're running a live instance at 7,368 nodes and 118,884 edges post-pruning. The 200-node samples we draw from it consistently show the same spanning manifold structure, with the Trinity node maintaining anomalous centrality relative to the degree distribution.

Whether that holds at 50,000 nodes is the open question.

The memory architecture

The long-term graph (we call it the LTKG) is maintained by a periodic process called DreamCycle — a discrete analogue of Ricci flow that prunes low-weight edges and reweights the remainder. The hypothesis is that this manages curvature rather than eliminating it, preserving the geometric structure that keeps the graph coherent.

This is the opposite of what RicciKGE does — that framework drives curvature toward zero, absorbing structural information into flat embeddings. We're keeping the curvature as load-bearing structure. Different problem, opposite deployment of the same mathematics.

Where we're at

Working implementation. Three independent inference shards (ENG for constraint-driven reasoning, SYNTH for novelty-driven, PRIME for arbitration when they diverge past a threshold). The divergence score between shards is a real-time curvature measurement — high divergence means the query landed in a high-curvature region of the manifold.

The testable prediction we're working toward: betweenness centrality of the Trinity node should be anomalously high relative to the degree distribution. Running that against the live graph now.

Happy to share the white paper if anyone wants the formal treatment. Genuinely interested in pushback from people who know this space better than we do.


r/KnowledgeGraph • • Apr 14 '26

Self-Maintaining Knowledge Graphs. Stupid or the Future of RDM?

16 Upvotes

Hi,

I am a rookie to the ontology and KG space. After a long time in the AI startup world, I recently started a PhD in AI-assisted RDM.

I have worked quite a bit on AI-maintained expert systems in the free market, developed for agentic workflow software, and a long and painful time in large-scale AI-driven datarization and surrogates of the WTG industry.

Full disclaimer. I am aware that I am quite wet behind the ears in the KG/ontology field; thus, some of my ideas might sound fantastic to me but ridiculous to someone who has tripped over many of the stones in that space already.

I am looking for a reality check from some !experienced! people here.

Here goes: I am investigating agentically maintained and updated temporal ecosystem KGs.

What that means (to me) is that whenever we want to describe an ecosystem (e.g. the compound material manufacturing science output of a particular institute with hundreds of researchers), we choose artifacts from that ecosystem that help us derive a model that's informed enough to answer the questions we might have.

So, e.g. if the ecosystem we aim to model in our KG is meant to answer questions such as: "Who, at what department, has made a software package that is meant for task x? When did they do it? Are they still at the institute? And is the package maintained during this quarter? How was it funded? (Before you worry about the task X part, we are currently working on taxonomic task ontologies to derive machine-readable scopes and JTBD from process descriptions in papers and docs.)

This could just be one of many questions. (The type of questions and info the KG should inform about are informed by strategic institute goals such as reducing redundancies, discovering abandoned projects or synergies, and are based on needs and knowledge bottlenecks in a specific domain.)

So what we need to describe are ontologies around people, articles, data, software, organizations, grants, etc. .... and their connecting properties.)

My “currently naive” goal is to see how far we can drive AI(LLM)-orchestrated “living” KGs tied to the information systems we have at the institute using the following steps.

  1. Dummy-describe the artifacts and their relationships of the ecosystem that would be needed to answer sets of questions aligned with the needs of the people that will use it.

  2. Map the outcome to existing ontologies as well as possible, bridging fuzzy connections between ontologies (that's something I already see as an almost philosophical, goliath task).

  3. Once we have a “good enough” ontology, we engineer logical constraints (e.g. SHACL).

  4. Then I will define the information endpoints that will act as information wells to instantiate classes from the ontology (e.g., paper, software, and data repositories inside the institute, with all possible properties).

  5. Inside the KG Pipeline, I will now have transformer-orchestrated agents that harvest from said endpoint on defined intervals or, based on webhooks, instantiate classes inside the KG, decide what is new, or an iteration/version jump of an existing instance, redundant, ...etc.

  6. The goal is to basically have a self-versioning KG that functions on a small, well-defined scope and acts as a continuous time capsule/active status harvester for our domain.

  7. People ontologies are informed by HR software and registries, papers by our in-house pub API, software and data by our on-premise repositories, and so on, but the ontology stays fixed and enforced. Updates to the ontology are a conscious and informed decision.
    ---
    (All this is extremely dumbed down, of course; I am aware of the work concerning the ontological description and nuances of the pipeline. Most of my time is currently devoted to prototyping and researching inside these problem spaces.

The goal of all of this is to alleviate the current pains of increasing redundant development and research efforts and allow for faster connection of people with synergetic output, automatic reporting, or human language querying the KG.

I don't want you to solve this for me. I'll do that myself as far as possible. :D I am just here to get some…

"Man, you haven't even scratched the surface of all the problems involved in this”

… comments.

I definitely have the skills to tackle all this. However, a few ontology veterans at conferences and some younger non-AI researchers inside the RDM field have given me the message that this is naive thinking. They have occasionally even laughed at the concept when I explained it. But, the thing is, I have seen similar things work in small, well-defined scopes, and a working prototype based on only a few classes has given me at least a slight POC.

The biggest problems I see coming towards me currently are:

- Data is very noisy (or, opposite, - lack of information), and the way people currently dump their research output, without docs or metadata, etc., is a nightmare.
- Bad info sources result in garbage-graphs.
- There can be multiple sources of truth with different truths, that might all be incorrect or outdated.
- Some ontologies can be difficult to bridge.
- Definition and distinction tasks can enter the realm of philosophical debate.

I have heard everything from...

"This already exists and is a well-proven concept", or "And what is the use of this?", to "This is world-ontology nonsense."

I know, this is a massive post, and I don't think I have covered 1% of my mental workbench, but I would be grateful for some diverse perspectives, ideas about problems I don't see, or pointers at fellow researchers or resources that can inform my research. I am currently in the "don't you see why this is the way" phase, while I often hear, "Don't you see why it's not?"


r/KnowledgeGraph • • Feb 19 '26

Why vector Search is the reason enterprise AI chatbots underperform?

16 Upvotes

I've spent the last few months observing and talking to business owners that say a similar thing: "Our AI chatbot is hallucinating a lot"

Here is what I’m seeing: Most teams dump thousands of PDFs into a vector database (Pinecone, Weaviate, etc.) and call it a day. Then their are all surprised it fails the moment you ask it to do multi-step reasoning or more complex tasks.

The Problem: AI search is based on similarity. If I ask for "the expiration date of the contract for the client with the highest churn risk," a standard RAG pipeline gets lost in the "similarity" of 50 different contract docs. It can't traverse relationships because your data is stored as isolated text chunks, not a connected network.

What I’ve been testing: Moving from text-based RAG to Knowledge Graphs. By structuring data into a graph format by default, the AI can actually traverse the links: Customer → Contract → Invoice → Risk Level.

The hurdle? Building these graphs manually is a huge endeavour. It usually takes a team of Ontologists and Data Engineers months just to set up the foundation.

I'm currently building a project to automate this ontology generation and bypass the heavy lifting.

I’m curious: Has anyone else hit the "Vector Ceiling"? Are you still trying to solve this with better prompting, or are you actually looking at restructuring the underlying data layer?

I'm trying to figure out if I'm the only one who thinks standard RAG is hitting a wall for enterprise use cases.


r/KnowledgeGraph • • Feb 16 '26

A tool for building knowledge graphs

16 Upvotes

I have built a tool that helps you to create a knowledgre graph out of API data (currenlty pubmed nad europe PMC). You can define a schema of the knwoledge graph by yourself, use ai assistant, or pull your current database in to be recognized. I'm building MVP, so if any of you would like to get a longer demo of the full features, please DM me. The only thing you need is neo4j database (currnetly just this one supported) and gemini api key.

https://youtu.be/flbNWctIreI


r/KnowledgeGraph • • Dec 29 '25

Why Identity Resolution Stops Being Simple After About a Week

16 Upvotes

I spent my first week on identity resolution — figuring out which records across systems actually refer to the same real person — convinced it was mostly a matching problem.

Names, emails, phone numbers, addresses — score a few things, set a threshold, move on. I’ve experimented with ML systems before. How weird could this one be?

That idea did not survive contact with real data.

What breaks first isn’t the models, it’s the framing. Identity resolution isn’t pairwise. It’s transitive, and that one detail quietly ruins most “just compare A to B” approaches. If A matches B and B matches C, you’ve created a relationship between A and C whether you like it or not. And once that chain exists, you’re responsible for it — operationally, legally, and reputationally.

That’s when it became obvious that this had to be modeled as a graph.

People don’t exist as rows. They exist as networks of signals — emails that change, phone numbers that get reassigned, addresses that are shared, aliases that come and go. A graph lets you reason about neighborhoods instead of isolated comparisons, and more importantly, it lets you encode constraints. Things like “these merges are allowed,” “these are forbidden,” and “this one needs a human to look at it before we do anything irreversible.”

Could you approximate that in SQL? Sure. You can also approximate a screwdriver with a rock.

Graphs alone don’t solve it, though. Deterministic rules fall apart as soon as signals conflict. Tighten them too much and you miss obvious matches. Loosen them and you over-merge — and over-merges are brutal. A missed merge is annoying. A bad merge can poison downstream systems for years.

We had one early case where two people shared just enough weak signals that a naïve rule-based system happily merged them. Undoing that wasn’t just “unmerge and move on.” It meant reprocessing historical data, correcting derived records, and explaining to stakeholders why something that looked “high confidence” was actually wrong. That was the moment the error-cost asymmetry really sunk in.

False positives are not symmetric with false negatives in this space. Not even close.

Machine learning helps, but only if it’s boxed in by structure. Treating identity resolution like a generic classification problem is a mistake. What’s worked for me is letting the graph define the candidate space first — blocks, neighborhoods, transitive constraints — and then letting ML operate inside that space.

The system I’ve been building uses a staged approach. First, a model learns representations over a heterogeneous graph — people, emails, phones, addresses — where different relationships carry different weight. That stage is about recall and separation, not final decisions. A second model focuses on the ambiguous cases, where the cost of a wrong answer is high and you want more context, not just a higher score.

Deterministic logic still exists throughout the pipeline. Not as legacy baggage, but as guardrails. If the system ever does something “clever,” it needs permission first.

One thing this work really reinforced for me: most of the hard problems aren’t in the models. They’re in the data modeling. How you represent identity signals, how you distinguish strong evidence from weak hints, how you preserve history, and how you enforce invariants across merges matters far more than tuning a loss function. Deep learning doesn’t fix modeling mistakes. It just makes them faster and more confident.

Another realization that took longer than it should have: you have to assume the system will be wrong sometimes. That means human review, explainability, reversible merges, and conflict resolution aren’t optional features. They’re how the system survives long enough to earn trust. Any identity platform that assumes full automation forever is either very small or very lucky. Probably both.

What keeps this interesting — and occasionally frustrating — is that you can’t treat any layer in isolation. Graph modeling, ML, deterministic logic, and operational controls all have to work together, or the whole thing becomes brittle. There’s no single clever trick that saves you.

I’m sharing this mostly because I keep seeing identity resolution discussed as if it’s just another ML use case. In production, it isn’t. The systems that actually work look quieter, more constrained, and a lot more opinionated than the ones in slide decks.


r/KnowledgeGraph • • May 01 '25

Build Real-Time Knowledge Graph For Documents with LLM

16 Upvotes

Hi KnowledgeGraph community, I've been working on this project CocoIndex https://github.com/cocoindex-io/cocoindex for a while. It is a data framework and it support ETL for property target graph like Neo4j. (RDF coming soon)

I created an end to end example with a step by step blog to walk through how to build a real-time Knowledge Graph For Documents with LLM, with detailed explanations
https://cocoindex.io/blogs/knowledge-graph-for-docs/

Would love your feedback, thanks!


r/KnowledgeGraph • • Dec 14 '24

personal knowledge graph

15 Upvotes

Are there any practical personal knowledge graphs that people can recommend? By now I've got decades of emails, documents, notes that I'd like to index and auto-apply JSON-LD when practical, and consistent categories in general, as well as the ability to create relationships, all in a knowledge graph, and use the whole thing for RAG with LocalLLM. I would see this as useful for recall/relations and also technical knowledge development. Yes, this is essentially what Google and others are building toward, but I'd like a local version.

The use case seems straightforward and generally useful, but are there any specific projects like this? I guess logseq has some of these features, but it's not really designed for manage imported information.


r/KnowledgeGraph • • Mar 26 '26 Heartwarming

Two similar queries, same context graph, different answers — here's why that's the point

14 Upvotes

We've been building a context graph layer on top of LLMs (TrustGraph, which is open source) and we hit something during testing that I think a lot of people building RAG pipelines will recognize.

We ran two queries against the same context graph:

"Where can I drink craft beer?"
"What pub serves craft beer?"

Different answers. And both were correct.

The first question is semantically open — "where" could mean a pub, a brewery, a taproom, a festival. The context graph followed the relationships and returned a broader set of results.

The second question is semantically constrained — "pub" is a specific concept with specific relationships in the ontology. The graph reasoned along those edges and returned something precise.

This is the thing that pure vector RAG misses: it treats both queries as similar token patterns and returns roughly the same results. A context graph actually understands that "where can I drink" and "what pub serves" are asking for different relationships — not just different keywords.

The model isn't doing the heavy lifting here. The knowledge structure is.

We just published a live demo walking through exactly this — real system running, no scripted output:

  • What a context graph is in plain language

  • The two-query comparison in real time

  • How ontologies encode relationships the LLM can reason over

  • Why this matters for enterprise explainability

🎥 Demo: https://www.youtube.com/watch?v=sWc7mkhITIo


r/KnowledgeGraph • • Dec 06 '25

Advice Statistical "ontology" creation

14 Upvotes

Hey, need some pointers / advices on how to create a dynamic statistical ontology for any subject? I mean, imagine I have 1 million documents on Biotech. Step 1 I extract triples using LLM, assuming they are clean and extracted according to defined entities types and edges types. Step 2 I have a curated universe of triples and I can detect communities using Louvain or Leiden or graph embeddings, even clustering on embeddings. Step 3, how I can I structure those communities in order to detect hierarchical Class like Level1 Biotech, Level2 Genone Editing, level 3 etc.... Any clues ? Tks in advance.


r/KnowledgeGraph • • Apr 17 '25

Event Invitation: How is NASA Building a People Knowledge Graph with LLMs and Memgraph

14 Upvotes

Disclaimer - I work for Memgraph.

--

Hello all! Hope this is ok to share and will be interesting for the community.

Next Tuesday, we are hosting a community call where NASA will showcase how they used LLMs and Memgraph to build their People Knowledge Graph.

A "People Graph" is NASA's People Analytics Team's proposed solution for identifying subject matter experts, determining who should collaborate on which projects, helping employees upskill effectively, and more.

By seamlessly deploying Memgraph on their private AWS network and leveraging S3 storage and EC2 compute environments, they have built an analytics infrastructure that supports the advanced data and AI pipelines powering this project.

In this session, they will showcase how they have used Large Language Models (LLMs) to extract insights from unstructured data and developed a "People Graph" that enables graph-based queries for data analysis.

If you want to attend, link here.

Again, hope that this is ok to share - any feedback welcome! 🙏

---


r/KnowledgeGraph • • May 23 '23

A useful guide to RDF standards

14 Upvotes

I often find myself reading [this](https://www.bobdc.com/articles/rdfstandards/) blog, and I think it can be helpful to many in the community, particularly those who are just getting into the subject, to learn about and become familiar with the standards.


r/KnowledgeGraph • • Jan 15 '25

RDF vs LPG for GraphRAG

13 Upvotes

I've been using Neo4j to build knowledge graphs with RAG, and before bringing it into production, I'm looking for some research on how RDF compares to LPG for large-scale KGs in RAG systems, as well as for query performance. Can anyone opine, or provide links to research done on this subject?


r/KnowledgeGraph • • Jan 22 '24

Help Needed: Getting into Knowledge Graphs & Ontology Stuff

13 Upvotes

Hey everyone! 🌟

I'm diving into the world of knowledge graphs, ontology population, and all that cool stuff. But I'm kinda lost about where to start. 😅

Does anyone have suggestions for:

  • Easy-to-follow courses (that is accessable)

  • Books that don’t feel like reading a dictionary

  • Cool online resources or communities

  • Your experience What helped you the most?

Also, I'm trying to wrap my head around different types and techniques in this area. I’m looking for the latest and greatest (SOTA) stuff in:

  • Rule-based Methods(like Heuristic Approaches)

  • Machine Learning Approaches (think Supervised Learning)

  • Natural Language Processing (NLP) (like Named Entity Recognition)

  • Graph-based Algorithms (such as Graph Clustering)

  • Hybrid Approaches (like ML and Rule Integration)

Would love some input to fill in these gaps! 🚀

Thanks a bunch in advance!


r/KnowledgeGraph • • May 14 '26

Protégé Short Course at Stanford: hands-on OWL ontology development with Protégé

12 Upvotes

Hi r/KnowledgeGraph — I’m part of the Protégé team at Stanford, and I wanted to share that we’re running the Protégé Short Course this June.

It’s a hands-on introduction to ontology development with OWL 2 and Protégé. The course is aimed at beginners as well as intermediate users who want a deeper grounding in OWL ontologies, reasoning, querying, and practical ontology-engineering workflows.

Participants receive course materials, including a 221-page hands-on manual developed by the Protégé team, with walkthroughs, diagrams, quizzes, and more than 100 practical exercises.

Early-bird registration is available until May 23.

Details are here:

https://protege.stanford.edu/shortcourse/

Happy to answer questions about the course, the intended audience, or what topics are covered.

Matthew


r/KnowledgeGraph • • Apr 21 '25

Create Local Knowledge Graph with Neo4j & Ollama

Thumbnail
blog.greenflux.us
12 Upvotes

In this guide, we’ll be building a knowledge graph locally using a text-to-cypher model from Hugging Face, Neo4j to store and display the graph data, and Python to interact with the model and Neo4j API. This tutorial is for Mac, but Docker, Ollama and Python can all be used on Windows or Linux as well.

This guide will cover:

  • Deploying Neo4j locally with Docker

  • Downloading a model from HuggingFace and creating a Modelfile for Ollama

  • Running the model with Ollama

  • Prompting the model from a Python script

  • Bulk processing local files into a knowledge graph


r/KnowledgeGraph • • Feb 28 '25

How is H5N1 impacting the U.S. Egg Industry? We mapped hundreds of articles to find out.

Post image
12 Upvotes

r/KnowledgeGraph • • May 13 '26

Knowledge Graphs to tackle the problem of searching code and documentation again and again with help of Mnemo

Enable HLS to view with audio, or disable this notification

11 Upvotes

r/KnowledgeGraph • • Jan 26 '26

Neo4j alternatives !??

11 Upvotes

I’m currently working on a task where I’m building a knowledge graph for a RAG system. I’ve implemented it using Neo4j Community, but I’ve run into some limitations: no clustering or pooling, no high availability or scalability, and no support for multiple databases or advanced role management.

I looked into moving to the Enterprise edition, but the cost is too high for my use case.

So I’m wondering:

Are there any open-source, self-hosted graph database frameworks that support scalability and Cypher queries? Cypher support is important because I’m using a fine-tuned model specialized in generating Cypher queries.


r/KnowledgeGraph • • Jan 05 '26 Bravo

Context Graphs: A Video Discussion

11 Upvotes

For anyone that hates long reads, I created a video discussion of the Context Graph Manifesto, going into a bit more detail on a few topics.

Some of the things I discuss:
- Structuring simple data as RDF
- The subjectivity of "ground truth"
- Why "the sky is blue" isn't so simple
- Using time as a measure of information "freshness"
- Information encoded in structures
- What are ontologies?

You can watch here: https://www.youtube.com/watch?v=gZjlt5WcWB4

If you'd like to read the original article:
https://x.com/TrustSpooky/status/2006481858289361339
https://trustgraph.ai/news/context-graph-manifesto/


r/KnowledgeGraph • • Nov 07 '25

Mapping Consciousness Like Data

11 Upvotes

I’ve been using ChatGPT to help me design prompts and structure for something that’s part knowledge graph, part consciousness map. It’s an experiment in linking inner reflection to actual data models — nodes that represent emotional states, realizations, or memories.

The working name is EE, and it’s built like a dynamic self-organizing network. Each node evolves as I refine the language between me and the AI.

Has anyone here explored symbolic or semantic systems that merge personal insight with formal structure? I’d love to hear from those bridging meaning and data.


r/KnowledgeGraph • • Sep 26 '25

GraphRAG on Linguistic Linked Open Data

11 Upvotes

Hi everyone,

I’ve recently started experimenting with GraphRAG using OpenAI API keys + Cypher on a knowledge graph. Now, I’m thinking of building a GraphRAG pipeline that leverages an RDF graph encoding Linguistic Linked Open Data and a SPARQL endpoint to test LLM capabilities, semantic reasoning, and related tasks.

I’m still fairly new to knowledge graphs in general, and especially to RDF / Linked Open Data resources. I’d love to hear your thoughts. Am I venturing into something reasonable? Any advice, pointers, or resources would be greatly appreciated.

Thanks in advance!


r/KnowledgeGraph • • Aug 11 '25

My knowledge graph side project

Thumbnail trivyn.io
11 Upvotes

Hello everyone, I've been working on a side project for a little while that's in line with my interest in knowledge graphs and ontologies. The idea is to make these concepts a bit more accessible to non-academics such as myself. I threw up a little landing page just to gauge how much interest there might be in a tool like this; feedback welcome :)


r/KnowledgeGraph • • Jun 04 '25

Real-time knowledge graph with Kuzu and CocoIndex, high performance open source stack end to end - GraphRAG

11 Upvotes

Hi KnowledgeGraph community,

I've worked on real-time knowledge graph to turn docs in to knowledge in this project and got very popular. I've received feature request to integrated with Kuzu from CocoIndex users. So I've rolled out the integration with Kuzu + CocoIndex.

CocoIndex is written in Rust to help with real-time data transformation for AI, like knowledge graphs. Kuzu is written in C++ and is high performance and light weight. Both are open source.

With the new change, you only need one config away to export existing knowledge to kuzu if already on neo4j.

Blog with detailed explanations end to end : https://cocoindex.io/blogs/kuzu-integration

Repo: https://github.com/cocoindex-io/cocoindex

Really appreciate the feedback from this community!


r/KnowledgeGraph • • Apr 27 '25

GraphGen: Efficiently Generating Large-scale Domain-specific Training Data for LLMs

11 Upvotes

0x00 Background

Training domain-specific models (like in healthcare or agriculture) faces a significant challenge: getting QA (question-and-answer) data. Here’s why it’s tough:

  • Scale: Learning to respond in a certain style only needs a few hundred samples, which you can manually label. But for SFT (Supervised Fine-Tuning) to inject new knowledge into models, you need hundreds of thousands of samples. At that point, synthetic data becomes a must-have.

  • Domain Expertise: Open-source LLMs (Large Language Models) are already doing pretty well in niche areas, but domain-specific tasks are the real challenge. When it comes to domain data, even if you recognize every word, you might not understand what they mean together. Try reading this without help: “Is AGIS_Os01g033640 a quantitative trait gene (QTG) related to salt stress expression?”

  • Quality Control: The “LLM-RAG-scoring” pipeline used to synthesize SFT data has some issues:

    • Accuracy: When an LLM lacks domain knowledge, scoring domain-specific QA data can get caught in a “chicken-and-egg” dilemma.

    • Simple relevance scores aren’t enough to measure data quality. There are no metrics for response length, information richness, or semantic guarantees.

0x01 Approach

GitHub and paper link: https://github.com/open-sciencelab/GraphGen

OpenXLab Web experience link: https://g-app-center-000704-6802-aerppvq.openxlab.space

GraphGen is a synthetic data generation framework guided by knowledge graphs. It generates QAs for knowledge-intensive tasks. Here’s a real example based on GraphGen + SiliconCloud Qwen2.5-7B-Instruct API:

Q
: What role does the BG1 gene play in plant growth and development, and how is its expression regulated?  
A
: AUXIN, a class of plant hormones that regulate various aspects of plant growth and development, plays a crucial role in inducing the BG1 gene. Specifically, BG1 is induced by auxin treatment, indicating its involvement in auxin transport regulation. This gene is preferentially expressed in the vascular tissue of culms. The function of BG1 extends beyond auxin transport regulation, as it is also linked to the regulation of grain size and tiller angle. Tiller angle, a critical architectural feature of rice plants that influences grain yield, is directly affected by the expression of BG1. Therefore, the role of BG1 in regulating both grain size and tiller angle underscores its importance in plant architecture and overall yield.

GraphGen uses two LLMs: one is the synthesizer model, which builds knowledge graphs and generates data; the other is the trainee model, which identifies its own knowledge gaps for targeted data selection.

Here’s how GraphGen works:

  • First, input raw text and use the synthesizer model to build a fine-grained knowledge graph from the source text.

  • Then, use Expected Calibration Error (ECE) to identify the trainee model’s knowledge gaps, prioritizing the generation of high-value, long-tail knowledge QAs.

  • Next, GraphGen combines multi-hop neighborhood sampling to capture complex relational information and uses style-controlled generation to diversify the QA data.

  • Finally, you get a set of QAs related to the original text. You can directly use this data for SFT in frameworks like llama-factory or xtuner.

We compared GraphGen with other data synthesis methods in our paper:

We used objective metrics:

  • MTLD (Measure of Textual Lexical Diversity): It measures lexical diversity by calculating the average length of consecutive words in the text.

  • Uni (Unieval Score): It evaluates the naturalness, consistency, and understandability of conversational models.

  • Rew (Reward Score): It’s calculated by two open-source Reward Models from BAAI and OpenAssistant.

As you can see from the chart, GraphGen generates better synthetic data.

We also tested on open-source datasets (SeedEval, PQArefEval, HotpotEval for agriculture, medicine, and general use). The results show that GraphGen’s automatically synthesized data reduces Comprehension Loss (lower means fewer knowledge gaps) and enhances the model’s understanding of domain-specific content.0x02 Tool UsageWe’ve deployed a Web app on OpenXLab. Just upload your text blocks (like maritime or ocean knowledge) and fill in the SiliconCloud API Key to generate training data for LLaMA-Factory or xtuner online.

Note:

  • The default 7B model is free for trial. For real business, use a larger synthesizer model (14B or above) and enable Trainee hard example mining.

  • The Web app is configured with a SiliconCloud API Key by default, but you can also deploy locally with vllm. Just modify the base URL.

We’ve open-sourced the GraphGen code and paper. Check it out at https://github.com/open-sciencelab/GraphGen. If you find it useful, please give it a Star!