8 ms·
KAG – Knowledge Graph RAG Framework
- nextworddev 2y agoConstructing and maintaining a knowledge graph is one thing. Retrieving one with low latency is another.
- slowmovintarget 2y agoHow does this compare to the Model Context Protocol? https://modelcontextprotocol.io/introduction https://modelcontextprotocol.io/introduction
- febin 2y agoMCP is a protocol for tool usage, where as KAG is for knowledge representation and information retrieval.
- dcreater 2y agoYet 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.
- ertdfgcvb 2y agoI enjoy the explosion of tools. Only time will tell which ones stand the test of time. But this is my day job so I never get tired of new tools but I can see how non-industry folks can find it overwhelming
- trees101 2y agoCan you expand on that? Where do big enterprise orgs products fit in, eg Microsoft, Google? What are the leading providers as you see them? As an outsider it is bewildering. First I hear that llama_index is good, then I hear that its overcomplicating slop. What sources or resources are reliable on this? How can we develop anything that will still stand in 12 months time?
- lmeyerov 2y agoMay help to think of these tools as on the opposite end of the spectrum. As an analogy: 1. langchain, llamaindex, etc are the equivalent of jquery or ORMs for calling third-party LLMs. They're thin adapter layers with a bit of consistency and common tasks across. Arguably like React, where they are thin composition layers. So complaints of being leaky abstractions is in the sense of an ORM getting in the way vs helping. 2. KG/graph RAG libraries are the LLM equivalent of, when regex + LIKE sql statements aren't enough, graduating to a full-blown lucene/solr engine. These are intelligence engines that address index-time, query-time, and likely, both. Thin libraries and those lacking standard benchmarks are a sign of experiments vs production-relevant: unless you're just talking to 1 pdf, not likely what you want. IMO, no 'winners' here yet: llamaindex was part of an early wave of preprocessors that feed PDFs etc to the KG, but not winning the actual 'smart' KG/RAG. In contrast, MSR Graph RAG is popular and benchmarks well, but if you read the github & paper, not intended for use -- ex: it addresses 1 family of infrequent query you'd do in a RAG system ("n-hop"), but not the primary kinds like mixing semantic+keyword search with query rewriting, and struggles with basics like updates. Most VC infra/DB $ goes to a layer below the KG. For example, vector databases -- but vector DBs are relatively dumb blackboxes, you can think of them more like S3 or a DB index, while the LLM KG/AI quality work is generally a layer above. (We do train & tune our embedding models, but that's a tiny % of the ultimate win, mostly for smarter compression for handling scaling costs, not the bigger smarts.) + 1 to presentation being confusing! VC $ on agents, vector DB co's, etc, and well-meaning LLM enthusiasts are cranking out articles on small uses of LLMs, but in reality, these end up being pretty crappy in quality if you'd actually ship them. So once quality matters, you get into things like the KG/graph RAG work & evals, which is a lot more effort & grinding => smaller % of the infotainment & marketing going around. (We do this stuff at real-time & data-intensive scales as part of Louie.AI, and are always looking for design partners, esp on graph rag, so happy to chat.)
- elbi 2y agoInteresting! Would like to chat!
- ertdfgcvb 2y ago>What sources or resources are reliable on this? imo, none. Unfortunately, the landscape is changing too fast. May be things will stabilize, but for now I find experimentation a time-consuming but essential part of maintaining any ML stack. But it's okay not to experiment with every new tool (it can be overwhelming to do this). The key is in understanding one's own stack and filtering out anything that doesn't fit into it.
- dcreater 2y agoBut unfortunately its like a game of musical chairs or whoever is pushing their wares the hardest that we may get stuck with rather than the actual best solution. In fact, im wondering if thats what happened in the early noughts and we had the misfortune of Java, and still have the misfortune of Javascript.
- TrueDuality 2y agoThis 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.
- rastierastie 2y agoWhat do other HNers make out of this? Would you use this? Responsible for a legaltech startup here.
- leobg 2y agoFellow 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/prompt/semantic_seg_prompt.py 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 exist on either the word level (searchable by BM25) or the semantic level (searchable by embeddings). A simple version of this would be to ask an LLM: “List all questions this chunk is answering.” [0] But you can do the same thing for time frames, objects, styles, emotions — whatever you need a “handle” for to later retrieve via BM25 or semantic similarity. I dreamed of doing that back in 2020, but it would’ve been prohibitively expensive. Because it requires passing your whole corpus through an LLM, possibly multiple times, once for each “angle”. That being said, I recommend running any “Graph RAG” system you see here on HN over some 1% or so of your data. And then look inside the database. Look at all text chunks, original and synthetic, that are now in your index. I’ve done this for a consulting client who absolutely wanted “Graph RAG”. I found the result to be an absolute mess. That is because these systems are built to cover a broad range of applications and are not adapted at all to your problem domain. So I prefer working backwards: What kinds of queries do I need to handle? What does the prompt to my query time LLM need to look like? What context will the LLM need? How can I have this context for each of my chunks, and be able to search by match air similarity? And now how can I make an LLM return exactly that kind of context, with as few hallucinations and as little filler as possible, for each of my chunks? This gives you a very lean, very efficient index that can do everything you want. [0] For a prompt, you’d add context and give the model “space to think”, especially when using a smaller model. Also, you’d instruct it to use a particular format, so you can parse out the part that you need. This “unfancy” approach lets you switch out models easily and compare them against each other without having to care about different APIs for “structured output”.
- isoprophlex 2y agoFancy, 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.
- kergonath 2y ago> 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. I have heard good things about Graphrag [1] (but what a stupid name). I did not have the time to try it properly, but it is supposed to build the knowledge graph itself somewhat transparently, using LLMs. This is a big stumbling block. At least vector stores are easy to understand and trivial to build. It looks like KAG can do this from the summary on GitHub, but I could not really find how to do it in the documentation. [1] https://microsoft.github.io/graphrag/ https://microsoft.github.io/graphrag/
- isoprophlex 2y agoIndeed they seem to actually know/show how the sausage is made... but still, no fire and forget approach for any random dataset. check out what you need to do if the default isnt working for you (scroll down to eg. entity_extraction settings). there is so much complexity there to deal with that i'd just roll my own extraction pipeline from the start, rather than learning someone elses complex setup (that you have to tweak for each new usecase) https://microsoft.github.io/graphrag/config/yaml/ https://microsoft.github.io/graphrag/config/yaml/
- kergonath 2y ago> i'd just roll my own extraction pipeline from the start, rather than learning someone elses complex setup I have to agree. It’s actually quite a good summary of hacking with AI-related libraries these days. A lot of them get complex fast once you get slightly out of the intended path. I hope it’ll get better, but unfortunately it is where we are.
- 2y ago
- zbyforgotp 2y agoLLMs are not that different from humans, in both cases you have some limited working memory and you need to fit the most relevant context into it. This means that if you have a new knowledge base for llms it should be useful for humans too. There should be a lot of cross pollination between these tools. But we need a theory on the differences too. Now it is kind of random how we differentiate the tools. We need ergonomics for llms.
- andai 2y ago>ergonomics for LLMs When I need to build something for an LLM to use, I ask the LLM to build it. That way, by definition, the LLM has a built in understanding of how the system should work, because the LLM itself invented it. Similarly, when I was doing some experiments with a GPT-4 powered programmer, in the early days I had to omit most of the context (just have method stubs). During that time I noticed that most of the code written by GPT-4 was consistently the same. So I could omit its context because the LLM would already "know" (based on its mental model) what the code should be.
- matthewsinclair 2y ago> the LLM has a built in understanding of how the system should work, because the LLM itself invented it Really? I’m not sure that the word “understanding” means the same thing to you as it does to me.
- EagnaIonat 2y ago> the LLM has a built in understanding of how the system should work, Thats not how an LLM works. It doesn't understand your question, nor the answer. It can only give you a statistically significant sequence of words that should follow what you gave it.
- photonthug 2y ago> This means that if you have a new knowledge base for llms it should be useful for humans too. There should be a lot of cross pollination between these tools. This is realistic but hence going to be unpopular unfortunately, because people expect magic / want zero effort.
- mentalgear 2y agoIt has come to the point that we need benchmarks for (Graph)-Rag systems now, same as we have for pure LLMs. However vendors will certainly then optimize for the popular ones, so we need a good mix of public, private and dynamic eval datasets.
- mentalgear 2y agoI like their description/approach for logical problem solving: 2.2. "The engine includes three types of operators: planning, reasoning, and retrieval, which transform natural language problems into problem solving processes that combine language and notation. In this process, each step can use different operators, such as exact match retrieval, text retrieval, numerical calculation or semantic reasoning, so as to realize the integration of four different problem solving processes: Retrieval, Knowledge Graph reasoning, language reasoning and numerical calculation."
- swyx 2y agoadvice to OP - that gif showing how you zoom in and star the repo is a giant turnoff. i closed my tab when i saw that.
- alt187 2y agoAgreed. Do you think potential users of your repo don't know how to star it?
- OJFord 2y ago> Star our repository to stay up-to-date with exciting new features and improvements! Get instant notifications for new releases That's not even correct, starring isn't going to do that. You'd need to smash that subscribe button and not forget the bell icon (metaphorically), not ~like~ star it.
- Dowwie 2y agoIf, on the other hand, it were a long, drawn-out animation of moving the mouse pointer to the button, hovering for a few seconds, and then slowing clicking while dragging the mouse away so that the button didn't select and they had to repeat the task again-- that would be art.
- swyx 2y agosounds agentic
- tessierashpool9 2y agoa quick look leaves me with the question: what exactly is being tokenized? RDS, OWL, Neo4j, ...? how is the knowledge graph serialized?
- tessierashpool9 2y agoisn't this a key question? anybody here knowledgeable and care to reply?
- dartos 2y agoI 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.
- tessierashpool9 2y agonot 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.
- dartos 2y agoThere 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.
- djoldman 2y ago"Whitepaper" is guarded behind this: https://survey.alipay.com/apps/zhiliao/n33nRj5OV 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.
- BOOSTERHIDROGEN 2y agoFor industrial plant white papers, a common practice is to submit your company email address and name as part of the access process.
- mdaniel 2y agoI'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*6gpqRomoqIsAAAAAAAAAAAAADtmcAQ/Semantic-enhanced%20Programmable%20Knowledge%20Graph%20(SPG)%20%20White%20paper%20v1.0.pdf https://mdn.alipayobjects.com/huamei_xgb3qj/afts/file/A*6gpq...
- flimflamm 2y agoPaper also here https://arxiv.org/pdf/2409.13731 https://arxiv.org/pdf/2409.13731
- iamnotempacc 2y ago'tis different. It's 112 vs 33 pages. And the content is not the same.
- Kerbiter 2y agoSomehow the first time I see such pop up in my feed. Glad that someone (judging by the comments that is not the only one project) is working on this, of course I am rather far from the field but to me this feels like a step in the right direction for advancing AI past the hyperadvanced parrot stage that is the current "AI" is (at least per my perception).
- ritiksharma23 2y agoHow will this work on Scale??