CB.EN.U4AIE20001
Project Review : MiniProject
LLM
Prompt
Output
LLM
Prompt
Output
LLMs are "closed". Only way to feed in information about external world is through the prompts.
LLM
Prompt
Output
LLMs are "closed". Only way to feed in information about external world is through the prompts.
LLM
Prompt
Output
LLMs are "closed". Only way to feed in information about external world is through the prompts.
However, amount of information you can put in prompts is limited by the model's "Context Length".
LLM
Prompt
Output
LLMs are "closed". Only way to feed in information about external world is through the prompts.
However, amount of information you can put in prompts is limited by the model's "Context Length".
Hence there is a need to efficiently and smartly choose what to put in prompts based on user's input and past conversation.
LLM
Prompt
Output
However, amount of information you can put in prompts is limited by the model's "Context Length".
Hence there is a need to efficiently and smartly choose what to put in prompts based on user's input and past conversation.
For example: A long Open Domain conversation, we cannot put entire conversation in context (It might go for even years)
Retrieval
Agumented
Memory
Agumented
[1]Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Mingwei Chang. 2020. Retrieval augmented
language model pre-training. In ICLR.
[2] Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Hein-
rich Kuttler, Mike Lewis, Wen tau Yih, Tim Rock- täschel, Sebastian Riedel, and Douwe Kiela. 2020.
Retrieval-augmented generation for knowledge- intensive nlp tasks. In NeurIPS.
[3]Xinchao Xu, Zhibin Gou, Wenquan Wu, Zheng-Yu Niu, Hua Wu, Haifeng Wang, and Shihang Wang. 2022b.
Long time no see! open-domain conversation with long-term persona memory. In Findings of ACL
- Some sort of retrieval system is employed to retrieve "Relevant chunk" and inject to prompt
- "Train" a memory management model
Retrieval
Agumented
Memory
Agumented
[1]Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Mingwei Chang. 2020. Retrieval augmented
language model pre-training. In ICLR.
[2] Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Hein-
rich Kuttler, Mike Lewis, Wen tau Yih, Tim Rock- täschel, Sebastian Riedel, and Douwe Kiela. 2020.
Retrieval-augmented generation for knowledge- intensive nlp tasks. In NeurIPS.
[3]Xinchao Xu, Zhibin Gou, Wenquan Wu, Zheng-Yu Niu, Hua Wu, Haifeng Wang, and Shihang Wang. 2022b.
Long time no see! open-domain conversation with long-term persona memory. In Findings of ACL
- Some sort of retrieval system is employed to retrieve "Relevant chunk" and inject to prompt
- "Train" a memory management model
- We should go over entire corpus
- We need "training data" which is expensive
* Preprint Just Released on 29th Aug,2023
* Today: November
Lots of these papers and preprints gets accepted in conferences like NeurIPS, ACL, ICLR,etc. That underscores the relevance of the current work
This work proposes sort of "Running Summary" of the information.
This work proposes sort of "Running Summary" of the information.
However, prone to forgetting finer details, if required. And not scalable to data's like books,novels,etc.
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
The tree consists of "nodes"
HST of memory length 2
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
Nodes in HAT
Attributes
Operations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
Nodes in HAT
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
Nodes in HAT
Attributes
Operations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
Nodes in HAT
Operations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
Nodes in HAT
Operations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
Nodes in HAT
Operations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Attributes
Operations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Attributes
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Attributes
Operations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Operations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Insert(node,L)
L.append(node)
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Insert(node,L)
Check if Number of nodes is a multiple of memory length. If not, add it as a child to last node in the above layer
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Insert(node,L)
Check if Number of nodes is a multiple of memory length. If yes, remove recent memory length childs from last node in above layer and add new node(np). call insert(np,L-1)
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Insert(np,L-1)
Check if Number of nodes is a multiple of memory length. If yes, remove recent memory length childs from last node in above layer and add new node(np). call insert(np,L-1)
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Insert(np,L-1)
This recursively goes on. If L==0, then create a new layer and add children
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Insert(np,L-1)
This recursively goes on. If L==0, then create a new layer and add children
Note: Because we are hashing children, When we remove children, we need not compute the summaries again.
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
Speaker 1 chat
Speaker 2 chat
Level 1 Summary
Level 2 Summary
Entire Summary
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
More Generally
Given a Task T, We should now find best strategy to traverse the tree
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
More Generally
Given a Task T, We should now find best strategy to traverse the tree
Actions at each state: Up,Down,Left,Right
states: nodes
Train an Agent?
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
More Generally
Given a Task T, We should now find best strategy to traverse the tree
Actions at each state: Up,Down,Left,Right
states: nodes
Train an Agent?
Baseline: GPT as Agent
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
Baseline: GPT as Agent
memory
agent
context
user query
action
mem
manager
if A== "OK"
Retrieved context
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
Baseline: GPT as Agent
memory
agent
context
user query
action
mem
manager
if A== "OK"
Retrieved context
Memory Module
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
Baseline: GPT as Agent
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
Baseline: GPT as Agent
Note: This framework can be used for a variety of tasks. However, now we concentrate on open domain conversations
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT for Conversations
Stratergy
Start from Root node. If you need details go down. If you need information from the past go right.
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
HAT
Insert(node)
Check if Number of nodes is a multiple of memory length. If yes, remove recent memory length childs from last node in above layer and add new node
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
Prompt Used
You are an agent traversing a tree. Given a user message and details/personas from a conversation, your task is to determine if the context provided is sufficient to answer the user's question by the other speaker. You begin at the root node, which should contain a high-level summary of all information up to this point. If more information is needed, you can explore the tree, following the traversal history provided. Avoid circular paths and make sure to explore effectively based on the traversal history. If after 7-8 traversals the information remains unavailable, use the 'U' action. If you reach the bottom or edge of the tree, reset with the 'S' action. The tree's structure is as follows:
1) Tree depth corresponds to information resolution. Leaf nodes are individual sentences from chats, and higher nodes summarize their children. Descend for more details, ascend for high-level information.
2) Horizontal position reflects time. The rightmost node is the most recent. Depending on the query and information, decide whether to search in the past or future. Move left for past information, right for future information.
Layer '0' is the root. Layer number increases with depth, and node number increases to the right. Stay within the permitted limits of layers and nodes.
Pay attention to the 'err' field for feedback on your moves.
Your actions can only be:
- U: Up
- D: Down
- R: Right
- L: Left
- S: Reset (Return to root node)
- O: Current Information Sufficient to Respond
- U: Current Information Insufficient to Respond
#############
Traversal History: {self.memory.get_current_traversal()}
Latest Moves and Reasons: {self.memory.traversals[:-3]}
#############
Current Location: Layer: {self.memory.layer_num}, Node: {self.memory.node_num}
Total Layers: {len(self.memory.hst.layers)},
Total Nodes in Current Layer: {len(self.memory.hst.layers[self.memory.layer_num]) if (self.memory.layer_num < len(self.memory.hst.layers)) else 0}
#############
Details/Personas: {self.memory._get_memory()}
#############
User Message: {user_message}
############
Errors: {err}
############
Action:
Reason: (Tell reason why you chose the action)
"""
I propose to use a new data structure called "Hierarchical Aggregate Tree" (HAT)
Prompt Used
You are in a natural conversation. Given with a memory and user query, respond (You are Speaker 2) such that you continue the conversation and
answer the user query if any from the memory. If memory is not sufficient to answer, tell i dont know.
###########
memory: {mem}
###########
user query: {user_query}
##########
Speaker 2:
We use the "Multi Session Chat" dataset [5]
[5] Xu, Jing, Arthur Szlam, and Jason Weston. "Beyond goldfish memory: Long-term open-domain conversation." arXiv preprint arXiv:2107.07567 (2021).
We use the "Multi Session Chat" dataset [5]
[5] Xu, Jing, Arthur Szlam, and Jason Weston. "Beyond goldfish memory: Long-term open-domain conversation." arXiv preprint arXiv:2107.07567 (2021).
weights
ratio of the number of n-grams in the candidate that match n-grams in any reference
Brevity Penalty
Precision: proportion of words (or n-grams) in the candidate sentence that are also found in the reference sentence.
Recall: proportion of words (or n-grams) in the reference sentence that are also found in the candidate sentence
Measures the diversity of the response
Text
Text
F1 | BLEU-1/2 | |
---|---|---|
Ours | 38.88 | 37.98/16.18 |
[7] | 25.35 | 28.52/11.63 |
[7]Wang, Qingyue, et al. "Recursively summarizing enables long-term dialogue memory in large language models." arXiv preprint arXiv:2308.15022 (2023).
* Results are reported just for Session 2. Results for other sessions are yet to be obtained
DISTINCT-1/2 | |
---|---|
Ours | 0.76/0.88 |
Text
Text
Beyond Numbers: A example
Speaker 1: What kind of car do you own? I have a jeep.
Speaker 2: I don't own my own car! I actually really enjoying walking and running, but then again, I live in a small town and semi-close to work.
Speaker 1: Ah I see! I like going to the gym to work out.
Speaker 2: I'm a computer programmer. What do you do for work?
Speaker 1: I work in marketing. Do you have any hobbies?
Speaker 2: I love to grill! I love meat, especially steak.
Speaker 1: Oh neat! I don't eat meat but I do like some grilled veggies.
Speaker 2: My family is from Alaska. Where are you from?
Speaker 1: I'm from New England. It must be cold up there.
Speaker 2: It's so cold! I think that's why I love wearing warm pants!
Speaker 1: Haha I feel you. I love wearing warm pants in the winter.
Speaker 2: Do you play any sports?
Session 2
Text
Beyond Numbers: A example
Speaker 1: What kind of car do you own? I have a jeep.
Speaker 2: I don't own my own car! I actually really enjoying walking and running, but then again, I live in a small town and semi-close to work.
Speaker 1: Ah I see! I like going to the gym to work out.
Speaker 2: I'm a computer programmer. What do you do for work?
Speaker 1: I work in marketing. Do you have any hobbies?
Speaker 2: I love to grill! I love meat, especially steak.
Speaker 1: Oh neat! I don't eat meat but I do like some grilled veggies.
Speaker 2: My family is from Alaska. Where are you from?
Speaker 1: I'm from New England. It must be cold up there.
Speaker 2: It's so cold! I think that's why I love wearing warm pants!
Speaker 1: Haha I feel you. I love wearing warm pants in the winter.
Speaker 2: Do you play any sports?
Session 2
Session 3
Speaker 1:Did you manage to go for a run today?
Text
Beyond Numbers: A example
Session 3
Speaker 1:Did you manage to go for a run today?
Note: No where did Speaker 2 Explicitly mentioned he went for a run today till now
Usual LLM Behaviour
Text
Beyond Numbers: A example
Speaker 1:Did you manage to go for a run today?
Our Method
Action: 'D' (Descending the tree)
Action: 'S' (Resetting and exploring the tree)
Action: 'D' (Descending the tree)
Action: '' (No specific action)
Action: 'D' (Descending the tree)
Action: 'R' (Moving right in the tree)
Action: 'D' (Descending the tree)
Action: 'O' (OK with the current context)
Text
Beyond Numbers: A example
Speaker 1:Did you manage to go for a run today?
Our Method
Action: 'D' (Descending the tree)
Action: 'S' (Resetting and exploring the tree)
Action: 'D' (Descending the tree)
Action: '' (No specific action)
Action: 'D' (Descending the tree)
Action: 'R' (Moving right in the tree)
Action: 'D' (Descending the tree)
Action: 'O' (OK with the current context)
Text
Beyond Numbers: A example
Speaker 1:Did you manage to go for a run today?
Our Method
Action: 'D' (Descending the tree)
Action: 'S' (Resetting and exploring the tree)
Action: 'D' (Descending the tree)
Action: '' (No specific action)
Action: 'D' (Descending the tree)
Action: 'R' (Moving right in the tree)
Action: 'D' (Descending the tree)
Action: 'O' (OK with the current context)
When we return this reason and context, LLM is more likely to tell yes I went for a run
Text
Beyond Numbers: A example
Speaker 1:Did you manage to go for a run today?
Our Method
When we return this reason and context, LLM is more likely to tell yes I went for a run
Actual Response: 'Yes I actually was able too. I am considering joining the local gym. Do you prefer going to the gym?' (From Dataset)