Live data from Hacker News

KAG – Knowledge Graph RAG Framework

github.com

51–60 of 81 posts

Re: KAG – Knowledge Graph RAG Framework

#51
post #36

Earlier quoted context omitted.

I worked at a small company experimenting with RAG. We used neo4j as the graph database and used the LLM to generate parts of the spark queries.

not sure if this is addressing my question. as i understand it the RAG augments the knowledge base by representing its content as a graph. but this graph representation needs to be linguistically represented such that an llm can digest it by tokenizing and embedding.

There are lots of ways to go about RAG, many do not require graphs at all.

I recommend looking at some simple spark queries to get an idea of what’s happening.

What I’ve seen is using LLMs to identify what possible relationships some information may have by comparing it to the kinds of relationships in your database.

Then when building the spark query it uses those relationships to query relevant data.

The llm never digests the graph. The system around the llm uses the capabilities of graph data stores to find relevant context for the llm.

What you’ll find with most RAG systems is that the LLM plays a smaller part than you’d think.

It reveals semantic information (such as conceptual relationships) and generates final responses. The system around it is where the far more interesting work happens imo.

Re: KAG – Knowledge Graph RAG Framework

#52

Fancy, I think, but again no word on the actual work of turning a few bazillion csv files and pdf's into a knowledge graph. I see a lot of these KG tools pop up, but they never solve the first problem I have, which is actually constructing the KG itself.

> but they never solve the first problem I have, which is actually constructing the KG itself.

I’ve noticed this too and the ironic thing is that building the KG is the most critical part of making everything work.

Re: KAG – Knowledge Graph RAG Framework

#53
post #35

Earlier quoted context omitted.

Well the rate of new LLMs keep coming out, but since they’re all trying to model language, they should all be fairly interchangeable and potentially will converge. It’s not hard for a product to swap the underlying LLM for a given task.

I meant not a jump in text generation ability, but more like adding a completely new modality and the likes. With 4o, you can have a multimodal embedding space and provide more relevant context to a model for fewer tokens (and higher accuracy). Ideally everyone would get there, but upgrading your pipeline is more about getting the latest functionality faster rather than just a slightly better generation.

Well they did.

Then Google did.

Then llava.

The issue is that this technology has no most (other than the cost to create models and datasets)

There’s not a lot of secret sauce you can use that someone else can’t trivially replicate, given the resources.

It’s going to come down to good ol product design and engineering.

The issue is openai doesn’t seem to care about what their users want. (I don’t think their users know what they want either, but that’s another discussion)

They want more money to make bigger models in the hope that nobody else can or will.

They want to achieve regulatory capture as their moat.

For all their technical abilities at scaling LLM training and inference, I don’t get the feeling that they have great product direction.

Re: KAG – Knowledge Graph RAG Framework

#54
post #13

What do other HNers make out of this? Would you use this? Responsible for a legaltech startup here.

Fellow legal tech founder here. The first thing I look at in projects like this are the prompts: https://github.com/OpenSPG/KAG/blob/master/kag/builder/promp... All you’re doing here is “front loading” AI: Imstead of running slow and expensive LLMs at query time, you run them at index time. It’s a method for data augmentation or, in database lingo, index building. You use LLMs to add context to chunks that doesn’t ex…

Prompts are a great place to look for these, but the part you linked too isn't very important for knowledge graph generation. It is doing an initial semantic breakdown into more manageable chunks. The actual entity and fact extraction that actually turns this into a knowledge graph is this one:

https://github.com/OpenSPG/KAG/blob/master/kag/builder/promp...

GraphRAG and a lot of the semantic indexes are simply vector database with pre-computed similarity edges which does not allow you to perform any reasoning over (the definition and intention of a knowledge graph).

This is probably worth looking at, its the first opensource project I've seen that is actually using LLMs to generate knowledge graphs. This does look pretty primitive for that task but it might be a useful reference for others going down this road.

Re: KAG – Knowledge Graph RAG Framework

#55
post #3

Yet another RAG/knowledge graph implementation. At this point, the onus is on the developer to prove it's value through AB comparisons versus traditional RAG. No person/team has the bandwidth to try out this (n + 1) solution.

This is actually the first project I've seen that is actually doing any kind of knowledge graph generation. Most are just precomputing similarity scores as edges between document snippets that act as their nodes. People have basically been calling their vector databases with an index a knowledge graph.

This is actually attempting fact extraction into an ontology so you can reason over this instead of reasoning in the LLM.

Re: KAG – Knowledge Graph RAG Framework

#56
post #49

Earlier quoted context omitted.

You may want to take a look at Graphiti, which accepts plaintext or JSON input and automatically constructs a KG. While it’s primarily designed to enable temporal use cases (where data changes over time), it works just as well with static content. https://github.com/getzep/graphiti I’m one of the authors. Happy to answer any questions.

> Graphiti uses OpenAI for LLM inference and embedding. Ensure that an OPENAI_API_KEY is set in your environment. Support for Anthropic and Groq LLM inferences is available, too. Don't have time to scan the source code myself, but are you using the OpenAI python library, so the server URL can easily be changed? Didn't see it exposed by your library, so hoping it can at least be overridden with a env var, so we could…

On second look, it seems like you've already rejected a PR trying to add local LLM support: https://github.com/getzep/graphiti/pull/184

> We recommend that you put this on a local fork as we really want the service to be as lightweight and simple as possible as we see this asa good entry point into new developers.

Sadly, it seems like you're recommending forking the library instead of allowing people to use local LLMs. You were smart enough to lock the PR from any further conversation at least :)

Re: KAG – Knowledge Graph RAG Framework

#57
post #51

Earlier quoted context omitted.

not sure if this is addressing my question. as i understand it the RAG augments the knowledge base by representing its content as a graph. but this graph representation needs to be linguistically represented such that an llm can digest it by tokenizing and embedding.

There are lots of ways to go about RAG, many do not require graphs at all. I recommend looking at some simple spark queries to get an idea of what’s happening. What I’ve seen is using LLMs to identify what possible relationships some information may have by comparing it to the kinds of relationships in your database. Then when building the spark query it uses those relationships to query relevant data. The llm never…

i'm talking about a knowledge graph that explicitly stores data (=knowledge) as a graph and the question is how this solution establishes the connection to the llm. so that the llm uses the data ... anyway, never mind :)

Re: KAG – Knowledge Graph RAG Framework

#58
post #56
post #49

Earlier quoted context omitted.

> Graphiti uses OpenAI for LLM inference and embedding. Ensure that an OPENAI_API_KEY is set in your environment. Support for Anthropic and Groq LLM inferences is available, too. Don't have time to scan the source code myself, but are you using the OpenAI python library, so the server URL can easily be changed? Didn't see it exposed by your library, so hoping it can at least be overridden with a env var, so we could…

On second look, it seems like you've already rejected a PR trying to add local LLM support: https://github.com/getzep/graphiti/pull/184 > We recommend that you put this on a local fork as we really want the service to be as lightweight and simple as possible as we see this asa good entry point into new developers. Sadly, it seems like you're recommending forking the library instead of allowing people to use local LLM…

You can override the default OpenAI url using an environment variable (iirc, OPENAI_API_BASE). Any LLM provider / inference server offering an OpenAI-compatible API will work.

Re: KAG – Knowledge Graph RAG Framework

#59

"Whitepaper" is guarded behind this: https://survey.alipay.com/apps/zhiliao/n33nRj5OV > The white paper is only available for professional developers from different industries. We need to collect your name, contact information, email address, company name, industry type, position and your download purpose to verify your identity... That's new.

I've had just outstanding success with "view source" and grab the "on success" parameter out of the form. Some sites are bright enough to do real server-side work first, and some other sites will email the link, but I'd guess it's easily 75/25 for ones that include the link in the original page body, as does this one:

    ,after_submitting: 'https://spg.openkg.cn/en-US/download?token=0a735e9a-72ea-11ee-b962-0242ac120002'
https://mdn.alipayobjects.com/huamei_xgb3qj/afts/file/A*6gpq...

Re: KAG – Knowledge Graph RAG Framework

#60

Fancy, I think, but again no word on the actual work of turning a few bazillion csv files and pdf's into a knowledge graph. I see a lot of these KG tools pop up, but they never solve the first problem I have, which is actually constructing the KG itself.

txtai automatically builds graphs using vector similarly as data is loaded. Another option is to use something like GLiNER and create entities on the fly. And then create relationships between those entities and/or documents. Or you can do both.

https://neuml.hashnode.dev/advanced-rag-with-graph-path-trav...

Post reply on HN