Find answers from the community

Updated 3 months ago

Knowledge Graph Process

I saw there's an auto KG creation via '''GPT Knowledge Graph Index.

Build a KG by extracting triplets, and leveraging the KG during query-time'''

How is this implemented? Running gpt through the whole text for task specific prompt (e.g. names entity recognition, conference, etc)? Or are there task specific models behind the creation of triplets?
L
q
3 comments
Hey Queso, llama index actually uses a single prompt to extract triplets across text chunks. It should make more sense when you check out the default prompt for this here: https://github.com/jerryjliu/llama_index/blob/main/gpt_index/prompts/default_prompts.py#L241

Also, check out the demo notebook as well: https://github.com/jerryjliu/llama_index/blob/main/examples/knowledge_graph/KnowledgeGraphDemo.ipynb

At query time, llama index extracts keywords from the query and look for triplets that have the same subject as each keyword.

If include_text is true (the deafult) llama index include the triplet and the text chunk where the triplet was found when we ask the LLM to answer the query
Thanks @Logan M!. Got it now! Do you know if there's a study that it's based on? Trying to get a gauge of how good it is and how good it works on a large document.
Hmm not sure if it was based on anything. Looking at Google scholar though, "LLM knowledge graph" brings up quite a few papers

In my experience, the performance is not too bad. You'll notice the demo limits to 2 triplets per 512 tokens, which means it doesn't really matter how big the document is since it only looks at chunks with 512 tokens (with some overlap of course)
Add a reply
Sign up and join the conversation on Discord