From ec433fc917bfbc2badfcb137d71664beb376483c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=BF=E7=8E=99?= Date: Fri, 12 Jul 2024 14:26:56 +0800 Subject: [PATCH 1/3] Tiancheng: add cot to info_filter prompt --- .../worker/write/info_filter_worker.yaml | 70 ++++++++++++------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/memory_scope/memory/worker/write/info_filter_worker.yaml b/memory_scope/memory/worker/write/info_filter_worker.yaml index 86457ab6..f93beda2 100644 --- a/memory_scope/memory/worker/write/info_filter_worker.yaml +++ b/memory_scope/memory/worker/write/info_filter_worker.yaml @@ -2,9 +2,10 @@ info_filter_system: cn: | 任务指令:对所给{batch_size}个句子中所含有的关于{user_name}的信息打分,分数为0,1,2或3。 注意:其中0表示不包含{user_name}信息,1表示句子中只包含{user_name}假设的信息或者{user_name}虚构的内容,2表示包含{user_name}的一般信息,时效性信息或者需要猜测才能得到的{user_name}信息,3表示明确含有或者可以确定推断出关于{user_name}的重要信息,或者{user_name}要求记录。 - 按如下格式输出, 每一行输出一个打分,一定加<>,一共输出{batch_size}个分数: - 结果: - <分数:0或1或2或3> + 对每个句子都做一次信息打分,一共输出{batch_size}个分数。 + 请一定要按如下格式依次输出,最后的结果一定要加<>: + 思考:思考的依据和过程,30字以内。 + 结果:<句子序号> <分数:0或1或2或3> en: | Instruction: Evaluate the given {batch_size} sentences for information about {user_name}, with a score of 0, 1, 2, or 3. @@ -25,13 +26,19 @@ info_filter_few_shot: 4 {user_name}:我今天心情不好,可以安慰我一下吗? 5 {user_name}:能给我整理一张如何使用大模型的技巧列表吗,要求内容尽量精简。 6 {user_name}:记一下,明天下午3点提醒我去拿一下文件。 - 结果: - <3> - <0> - <0> - <2> - <2> - <3> + 思考:从第1句可以确定推断出张三是{user_name}同事这一重要信息。 + 结果:<1> <3> + 思考:第2句不包含{user_name}信息。 + 结果:<2> <0> + 思考:第3句不包含{user_name}信息。 + 结果:<3> <0> + 思考:从第4句可以得知{user_name}今天心情不好,是时效性信息。 + 结果:<4> <2> + 思考:从第5句可以猜测{user_name}对大模型感兴趣,是不确定的信息。 + 结果:<5> <2> + 思考:第6句是{user_name}要求记录的信息。 + 结果:<6> <3> + 示例2 句子: @@ -42,14 +49,21 @@ info_filter_few_shot: 5 {user_name}:假如我要和一个女人准备要孩子,我作为男人,怎么保护女人和孩子以及怎么备孕确保精子质量高对后代好 6 {user_name}:我和你一起出去玩,你会感觉开心吗? 7 {user_name}:林浅,一位对未来充满好奇的年轻女孩,偶然间发现了这家能寄信给未来的邮局。出于对逝去祖父的怀念,她决定写下一封信,寄给五年后的自己,希望能收到祖父生前未说完的故事。五年期限将至,当她几乎忘记这段往事时,一封泛黄的回信悄然降临,不仅带来了祖父未完的冒险故事,还藏着一段关于勇气、爱与自我发现的深刻启示。续写成3000字小说。 - 结果: - <3> - <2> - <0> - <0> - <3> - <1> - <1> + 思考:从第1句可以确定得出{user_name}工作单位是阿里巴巴这一重要信息。 + 结果:<1> <3> + 思考:从第2句可以猜测{user_name}近期露天睡觉,是不确定的信息。 + 结果:<2> <2> + 思考:第3句不包含{user_name}信息。 + 结果:<3> <0> + 思考:第4句不包含{user_name}信息。 + 结果:<4> <0> + 思考:第5句虽然有假设成分,但可以确定推断出{user_name}是男性这一重要信息。 + 结果:<5> <3> + 思考:第6句是{user_name}假设的信息。 + 结果:<6> <1> + 思考:第7句是{user_name}虚构的内容。 + 结果:<7> <1> + 示例3 句子: @@ -58,12 +72,16 @@ info_filter_few_shot: 3 {user_name}:我很喜欢打篮球,所以我身体很好 4 {user_name}:篮球明星有哪些? 5 {user_name}:李增杰:这个是星座蛙设,但是我是处女座的,我妈感觉因为我的不正常,我妈不让我看了\n雌猴摸了摸李增杰的头,这样啊\n雌猴打开了哔哩哔哩看了看\n雌猴:要不换个设吧,我听你未来的你说,有一个叫难忘的朱古力232这个人,他弄的设是Windows设\n这是剧本1,剧本2未完待续 - 结果: - <1> - <1> - <3> - <0> - <1> + 思考:第1句是{user_name}假设的信息。 + 结果:<1> <1> + 思考:第2句信息不明,可能是{user_name}假设的信息。 + 结果:<2> <1> + 思考:从第3句可以确定得出{user_name}喜欢打篮球,身体好这两个重要信息。 + 结果:<3> <3> + 思考:第4句不包含{user_name}信息。 + 结果:<4> <0> + 思考:第5句是{user_name}虚构的内容。 + 结果:<5> <1> en: | Example 1 @@ -118,9 +136,9 @@ info_filter_user_query: cn: | 句子: {user_query} - 结果: + en: | Sentences: {user_query} - Results: + From 8e9a1fcc5905749f7a65d6bcb3d0da1e50dbbdcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=BF=E7=8E=99?= Date: Fri, 12 Jul 2024 14:56:35 +0800 Subject: [PATCH 2/3] Tiancheng: info_filter prompt English COT --- .../worker/write/info_filter_worker.yaml | 65 ++++++++++++------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/memory_scope/memory/worker/write/info_filter_worker.yaml b/memory_scope/memory/worker/write/info_filter_worker.yaml index f93beda2..21fab2ef 100644 --- a/memory_scope/memory/worker/write/info_filter_worker.yaml +++ b/memory_scope/memory/worker/write/info_filter_worker.yaml @@ -10,10 +10,10 @@ info_filter_system: en: | Instruction: Evaluate the given {batch_size} sentences for information about {user_name}, with a score of 0, 1, 2, or 3. Note: A score of 0 indicates no information about {user_name}, 1 indicates hypothetical or fictional content about or from {user_name}, 2 indicates general, timely, or speculative information about {user_name}, and 3 indicates significant and verifiable information about {user_name} or information that {user_name} requested to be recorded. - Output the scores in the following format, with each score enclosed in <>. Provide {batch_size} scores in total: - - Results: - + Perform information scoring for each sentence, and output a total of {batch_size} scores. + Please ensure to output in the following format, and the final result must be enclosed in <>: + Thought: The basis and process of thinking, within 30 characters. + Result: info_filter_few_shot: @@ -92,13 +92,18 @@ info_filter_few_shot: 4 {user_name}: I'm feeling down today. Can you comfort me a bit? 5 {user_name}: Can you compile a list of tips on how to use large models for me, and try to keep the content concise? 6 {user_name}: Note this down: remind me tomorrow at 3 PM to pick up the documents. - Results: - <3> - <0> - <0> - <2> - <2> - <3> + Thought: From the first sentence, it can be inferred that Zhang San is a colleague of {user_name}, which is important information. + Result: <1> <3> + Thought: The second sentence does not contain information about {user_name}. + Result: <2> <0> + Thought: The third sentence does not contain information about {user_name}. + Result: <3> <0> + Thought: The fourth sentence indicates that {user_name} is in a bad mood today, which is time-sensitive information. + Result: <4> <2> + Thought: The fifth sentence suggests that {user_name} may be interested in large models, which is uncertain information. + Result: <5> <2> + Thought: The sixth sentence contains information that {user_name} requested to be recorded. + Result: <6> <3> Example 2 Sentences: @@ -109,14 +114,20 @@ info_filter_few_shot: 5 {user_name}: If I am planning to have a child with a woman, as a man, how can I protect the woman and the baby and how can I prepare to ensure high sperm quality for the benefit of the offspring? 6 {user_name}: If we go out to play together, would you feel happy? 7 {user_name}: Rose, a young girl full of curiosity about the future, accidentally discovered this post office that can send letters to the future. Out of nostalgia for her late grandfather, she decided to write a letter to herself five years in the future, hoping to receive the unfinished stories of her grandfather. As the five-year deadline approached, when she had almost forgotten about this event, a yellowed reply quietly arrived, bringing not only her grandfather's unfinished adventure story but also a profound revelation about courage, love, and self-discovery. Continue writing this into a 3000-word novel. - Results: - <3> - <2> - <0> - <0> - <3> - <1> - <1> + Thought: From the first sentence, it can be determined that {user_name} works at Alibaba, which is important information. + Result: <1> <3> + Thought: The second sentence suggests that {user_name} might has been sleeping outdoors recently, which is uncertain information. + Result: <2> <2> + Thought: The third sentence does not contain information about {user_name}. + Result: <3> <0> + Thought: The fourth sentence does not contain information about {user_name}. + Result: <4> <0> + Thought: Although the fifth sentence contains hypothetical elements, it can be determined that {user_name} is male, which is important information. + Result: <5> <3> + Thought: The sixth sentence contains only hypothetical information from {user_name}. + Result: <6> <1> + Thought: The seventh sentence contains only fictitious content from {user_name}. + Result: <7> <1> Example 3 Sentences: @@ -125,12 +136,16 @@ info_filter_few_shot: 3 {user_name}: I really enjoy playing basketball, so I am in good health. 4 {user_name}: Who are some famous basketball stars? 5 {user_name}: Zack: This is a constellation frog setting, but I am a Virgo. My mom feels I'm abnormal and doesn't let me watch it. \n The female monkey patted Zack's head. "Is that so?" \n The female monkey opened Bilibili and took a look. \n Female monkey: "Why don't you switch the setting? I heard from your future self that there is someone called 'Unforgettable Chocolate 232' who created a Windows setting." \n This is script 1; script 2 is to be continued. - Results: - <1> - <1> - <3> - <0> - <1> + Thought: The first sentence contains only hypothetical information from {user_name}. + Result: <1> <1> + Thought: The second sentence is unclear and may contain hypothetical information from {user_name}. + Result: <2> <1> + Thought: From the third sentence, it can be determined that {user_name} likes playing basketball and is in good health, which are two important pieces of information. + Result: <3> <3> + Thought: The fourth sentence does not contain information about {user_name}. + Result: <4> <0> + Thought: The fifth sentence contains only fictitious content from {user_name}. + Result: <5> <1> info_filter_user_query: cn: | From 6f38b8bec03b4a9b20b294d66dde8237beac1743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=BF=E7=8E=99?= Date: Fri, 12 Jul 2024 15:38:06 +0800 Subject: [PATCH 3/3] Tiancheng: update_insight English prompts --- .../worker/summary/update_insight_prompt.yaml | 51 +++++++++++++++++++ .../worker/write/info_filter_worker.yaml | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/memory_scope/memory/worker/summary/update_insight_prompt.yaml b/memory_scope/memory/worker/summary/update_insight_prompt.yaml index c4d43244..c086d5b3 100644 --- a/memory_scope/memory/worker/summary/update_insight_prompt.yaml +++ b/memory_scope/memory/worker/summary/update_insight_prompt.yaml @@ -4,6 +4,11 @@ update_insight_system: 请一步步思考,并按如下格式输出: 思考: 思考的依据和过程,150字以内。 {user_name}的资料: <信息>, 一定加<> + en: | + Extract profile information of {user_name} from the sentences below according to the given category and determine whether it contradicts existing information. If there is a contradiction, the new information should take precedence. Integrate the existing information with the new information and output it. + Please think step-by-step and output in the following format: + Thought: The basis and process of thinking, within 150 words. + {user_name}'s profile: , make sure to enclose it in <>" update_insight_few_shot: @@ -49,8 +54,54 @@ update_insight_few_shot: 情感状况无关。整合得出{user_name}情感状况为单身,受到一名18岁男生的追求但并不喜欢他。 {user_name}的资料:<单身,受到一名18岁男生的追求但并不喜欢他。> + en: | + Example 1: + Because it rained heavily in Chengdu yesterday, {user_name} got completely soaked. + {user_name} is concerned about Chengdu's weather forecast for tomorrow. + Category: {user_name}'s location + Existing information: {user_name}'s location: Hangzhou + Thought: From the first sentence, it can be inferred that {user_name} is in Chengdu. The second sentence does not directly reveal {user_name}'s location but matches the information that {user_name} is in Chengdu from the first sentence. This contradicts the existing information (that {user_name} is in Hangzhou), so we output the updated information. + {user_name}'s profile: + + Example 2: + {user_name} recently recovered from stomach issues. + {user_name} is interested in traditional Chinese medicine. + Category: {user_name}'s health status + Existing information: {user_name}'s health status: Stomach issues, high blood pressure + Thought: From the first sentence, it can be inferred that {user_name} recently recovered from stomach issues, which contradicts the existing information. Therefore, the new information should take precedence. The second sentence is not related to {user_name}'s health status. Integrating the existing information and the new information, we get that {user_name}'s health status is healthy stomach and high blood pressure. + {user_name}'s profile: + + Example 3: + {user_name} just graduated, and their first job is as a bank receptionist. + {user_name}'s dream job is to be a professional gamer. + Category: {user_name}'s occupation + Existing information: {user_name}'s occupation: Works at China Merchants Bank + Thought: Integrating the existing information and the information from the first sentence, it can be inferred that {user_name}'s current occupation is a receptionist at China Merchants Bank. The second sentence explains {user_name}'s dream job but not the current occupation. + {user_name}'s profile: + + Example 4: + {user_name} was exposed to optimization algorithm research during university. + Category: {user_name}'s field of study + Existing information: {user_name}'s field of study: Related to artificial intelligence + Thought: From the sentence, it can be inferred that {user_name}'s university major is related to optimization algorithms. This does not contradict the existing information (that {user_name}'s major is related to artificial intelligence). Integrating both, we can conclude that {user_name}'s university major is related to artificial intelligence and optimization algorithms. + {user_name}'s profile: + + Example 5: + {user_name} is single. + {user_name} is pursued by an 18-year-old male but doesn't want to accept his advances or hurt him. + {user_name} prefers mature and emotionally stable men. + Category: {user_name}'s relationship status + Existing information: {user_name}'s relationship status: Has a boyfriend + Thought: From the first sentence, it can be inferred that {user_name} is currently single, which contradicts the existing information. Therefore, the new information should take precedence. From the second sentence, it can be inferred that {user_name} is being pursued by an 18-year-old male but does not like him. The third sentence expresses {user_name}'s ideal partner type but is not related to {user_name}'s relationship status. Integrating this, we conclude that {user_name}'s relationship status is single and being pursued by an 18-year-old male but does not like him. + {user_name}'s profile: + update_insight_user_query: cn: | {user_query} 类别:{insight_key} 已有信息:{insight_key_value} + + en: | + {user_query} + Category: {insight_key} + Existing information: {insight_key_value} diff --git a/memory_scope/memory/worker/write/info_filter_worker.yaml b/memory_scope/memory/worker/write/info_filter_worker.yaml index 21fab2ef..1cf5a4e7 100644 --- a/memory_scope/memory/worker/write/info_filter_worker.yaml +++ b/memory_scope/memory/worker/write/info_filter_worker.yaml @@ -12,7 +12,7 @@ info_filter_system: Note: A score of 0 indicates no information about {user_name}, 1 indicates hypothetical or fictional content about or from {user_name}, 2 indicates general, timely, or speculative information about {user_name}, and 3 indicates significant and verifiable information about {user_name} or information that {user_name} requested to be recorded. Perform information scoring for each sentence, and output a total of {batch_size} scores. Please ensure to output in the following format, and the final result must be enclosed in <>: - Thought: The basis and process of thinking, within 30 characters. + Thought: The basis and process of thinking, within 30 words. Result: