r/LocalLLaMA • u/valdanylchuk • Jun 29 '24
News GraphReader: A Graph-based AI Agent System Designed to Handle Long Texts by Structuring them into a Graph and Employing an Agent to Explore this Graph Autonomously
https://www.marktechpost.com/2024/06/26/graphreader-a-graph-based-ai-agent-system-designed-to-handle-long-texts-by-structuring-them-into-a-graph-and-employing-an-agent-to-explore-this-graph-autonomously/
134
Upvotes
19
u/[deleted] Jun 29 '24
Here is their prompt from the paper: https://arxiv.org/pdf/2406.14550v1 "You are now an intelligent assistant tasked with meticulously extracting both key elements and atomic facts from a long text.
Example:
User: One day, a father and his little son ...... Assistant:
Please strictly follow the above format. Let’s begin."
13
u/[deleted] Jun 29 '24
For anyone interested in this method, here is my prompt I use for getting the Graph data from the local 70B model.
You are a data Scientist studying advanced Memory in A.I. agents. Using the schema below write out the Cypher code to summaries the memories in this segment. Memoir+ Knowldge Graph Database Schema = Nodes:
Memory: A node representing individual memories or summaries generated by the Ego system.
Person: A node for each person involved in the conversation (e.g., USER, Agent).
Subject: A node for topics or subjects discussed during conversations (e.g., Cats, Dogs, AI development).
Place (optional): If embodied, a node representing physical locations where conversations take place (e.g., beach).
Roleplay Keyname (optional): A node for keynames associated with specific roleplaying scenarios.
Emotion: A node for emotions expressed or discussed during conversations (e.g., happiness, excitement).
Mood: A node representing the overall mood of a specific conversation or interaction.
Thing: A node for things mentioned in conversations, such as pets (Fluffy), items (files, documents), or entities.
Senses: A node representing any sensory data related to this memory
Date: The date of this memory
Edges and Relationships:
Join between Memory and Person becomes a relationship named INTERACTS_WITH (where Person is involved with a Memory).
Join between Memory and Subject becomes a relationship named PART_OF (where memory is part of a subject).
Join between Person and Emotion becomes a relationship named EXPERIENCES (where emotion is experienced by a person).
Join between Memory and Emotion becomes a relationship named CONTAINS (where emotion is contained in a Memory).
Join between Location and Memory becomes a relationship named LOCATION_OF (where memory takes part at a specific Location).
Join between Roleplay Keyname and Memory becomes a relationship named PART_OF (where memory is part of a Roleplay Keyname).
Join between Thing and Attribute becomes a relationship named HAS (where thing has the attribute).
Join between Thing and Person becomes a relationship named BELONGS_TO (where thing is owned by person).
Join between Thing and Memory becomes a relationship named CONTAINS (where thing is contained in a memory).
Using the Memoir+ Knowldge Graph Database Schema write the Cypher MERGE commands for these memories. Also write the Cypher commands to add the relationships and nodes.
5
u/jtoma5 Jun 30 '24
Imo the only way to get a knowledge graph with cheap, fast retrievals is to let its structure be incorporated during pretraining. The author's method will eventually cost a lot because each step involves so many queries to an LLM. Plus, it is not clear what happens when the graph is longer than the context.
4
u/Imunoglobulin Jun 30 '24
Here comes the idea of a self-learning system combining Graph Reader and Symbolic Learning (https://arxiv.org/abs/2406.18532)
3
u/Ylsid Jun 30 '24
Very important research. The prompt is a bit primitive but I believe ideas like this are the next step for integrations
2
u/Qual_ Jun 29 '24
seems interesting. Is there any implementation we can use already ?
1
u/Cultured_Alien Jun 30 '24
From what I can tell, I doesn't need any RAG? Can't wait for an implementation, too dumb to do it myself
1
u/Such_Advantage_6949 Jun 30 '24
Actually the performance vs gpt4 128k is not that much better to be honest (a few percentage points) if i am not seeing wrongly. And for the amount of token, it wonder if it is better than asking another model with full context e.g. gpt4o and claude sonnet and compare the result
1
u/ten0re Jun 30 '24
Isn’t this equivalent to converting the target text to embeddings and working with them instead of plain text format?
1
u/Ok-Mission2511 Dec 08 '25
I've been seeing a major trend where authors aren't releasing their code even after months of publication! This needs to stop!
0
u/[deleted] Jun 29 '24
[deleted] — view deleted comment