Generative Agents and Their Construction Methods

The generative intelligent agent addresses limitations of non-generative agents by integrating sensors, memory, and multiple LLMs to enhance long-term memory, self-awareness, and social interaction, facilitating learning and adaptive behavior.

CN117634546BActive Publication Date: 2024-12-10引力城(广州)智能技术院(有限合伙)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410040341.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-11
Publication Date
2024-12-10
Estimated Expiration
2044-01-11

AI Technical Summary

Technical Problem

Existing intelligent agents are non-generative and have narrow application areas, lacking long-term memory, self-awareness, and social interaction capabilities, which limits their ability to learn and adapt to diverse environments.

Method used

A generative intelligent agent is constructed with components such as sensors, memory, a message bus, search engine, reflection engine, planning engine, and an LLM Hub, utilizing a scoring algorithm and multiple large language models (LLMs) to process data, summarize insights, plan actions, and execute behaviors.

Benefits of technology

The generative agent enhances long-term memory, self-awareness, and social interaction, enabling it to learn from diverse sources, maintain unique personalities, and demonstrate realistic and traceable behavior.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117634546B_ABST
    Figure CN117634546B_ABST
Patent Text Reader

Abstract

The present invention discloses a generative intelligent agent and a construction method thereof. The generative intelligent agent at least includes a sensor, a memory, a message bus, a search engine, a reflection engine, a planning engine, an action engine, and an LLM Hub; the sensor collects data to form an event memory record; the LLM Hub processes the query of the search engine, the reflection engine, the planning engine, and the action engine to multiple LLMs. The present invention continuously obtains event memory records through the sensor, summarizes and generates insight memory records through the reflection engine, and generates plan memory records through the planning engine. All memory records are stored in the memory, thereby expanding the memory size; the action engine uses the corresponding memory record in the memory as the context, and calls the LLM through the LLM Hub to obtain behavior guidance. Based on this behavior, the environmental feedback information when and after the behavior is executed is obtained through the sensor to form a new event memory record, and finally construct a generative intelligent agent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet, and in particular to a generative intelligent agent and a construction method thereof. Background Art

[0002] An intelligent agent refers to a computational entity that resides in a certain environment, can function continuously and autonomously, and has characteristics such as residence, responsiveness, sociality, and initiative. Its full English name is: Intelligent Individual.

[0003] The agent has the following basic characteristics:

[0004] (1) Autonomy: The intelligent body can automatically adjust its behavior and state according to changes in the external environment, rather than just passively accepting external stimuli, and has the ability to self-manage and self-regulate.

[0005] (2) Reactive: The ability to respond to external stimuli.

[0006] (3) Proactive: The ability of an intelligent body to take proactive actions in response to changes in the external environment.

[0007] (4) Sociality: Intelligent agents have the ability to cooperate with other intelligent agents or humans. Different intelligent agents can interact with other intelligent agents according to their own intentions to achieve the goal of solving problems.

[0008] (5) Evolution: Intelligent agents can accumulate or learn experience and knowledge and modify their behavior to adapt to new environments.

[0009] The solutions of existing intelligent agents are all non-generative and have narrow application areas. Summary of the invention

[0010] The purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and provide a generative intelligent agent.

[0011] Another object of the present invention is to provide a method for constructing a generative agent.

[0012] The purpose of the present invention is achieved through the following technical solutions:

[0013] A generative agent includes at least the following components: a sensor, a memory, a message bus, a search engine, a reflection engine, a planning engine, an action engine, and an LLM Hub; wherein:

[0014] Perceptrons collect data from the external environment / external world through a variety of sensors and describe them in natural language to form "event" information records. All "event" information records will be recorded in the memory. This record in the memory is called "event memory record";

[0015] Memory is a medium used to store "memory records";

[0016] A message bus for transmitting command messages for driving the work of functional components, wherein the functional components include a search engine, a reflection engine, a planning engine, an action engine, a sensor, and an LLM Hub;

[0017] The search engine retrieves the relevant "memory records" from the memory, and the search result set is named "retrieved memory records";

[0018] The reflection engine summarizes or infers the "memory records" of a certain area of ​​memory to form summary "insight memory records" and stores these records in memory;

[0019] A planning engine, for generating a "planning memory record" and storing it in a memory;

[0020] The action engine is used to send messages to the message queue to call the LLM Hub. By applying the currently perceived "event memory record" and the "retrieved memory record" retrieved based on it, it constructs a query for the context to query the LLM, and obtains the appropriate behavior that should be performed and executes it;

[0021] LLM Hub, connected to several LLMs, is used to process queries to LLMs from the search engine, reflection engine, planning engine, and action engine.

[0022] The search algorithm of the search engine scores a certain range of "memory records" in the memory, selects the top n with high scores, and forms "retrieved memory records";

[0023] The search algorithm is

[0024] Score=ɑ recency *Recency+ɑ importance *Importance+ɑ relevance * Relevance;

[0025] Among them, the meanings of the factors Recency, Importance, and Relevance are as follows:

[0026] Recency is an exponential decay function, which is calculated by the time from the last retrieval time LastAccessTime of the memory record to the present.

[0027] Importance, assigned an initial value when the memory record is created. You can get this value by sending a message to the message queue to call the LLM Hub for query (by asking the LLM a cloze test question and letting the LLM score the "event" type of the memory record). Of course, the agent can also give this value based on the importance of the "event" to itself, and it is not necessary to query the LLM's general knowledge score to assign a value.

[0028] Relevance correlation, by sending a message to the message queue to call the LLM Hub for query, you can get the embedding vector Embedding Vector of the "event" description information of the memory record; by calling the same LLM for query, you can get the embedding vector Embedding Vector of the query statement Query that triggered this retrieval; calculate the cosine similarity of the two EmbeddingVectors and assign it to the value of Relevance.

[0029] ɑ recency is the weight of Recency; importance is the weight of Importance; relevance is the weight of Relevance.

[0030] The reflection engine uses the memory records of the reflection area in the memory (such as the latest N "memory records") to reflect: send a message to the message queue to call the LLM Hub, and query the LLM by using the data in the reflection area to construct a query to obtain the reflection topic; for each reflection topic, send a message to the message queue to call the LLM Hub, and query the LLM by using the data in the reflection area to construct a query to obtain the "insight memory record" of the current topic. The reflection engine can trigger reflection periodically or by importance conditions.

[0031] The plan engine divides plan types into regular plans and special plans. The plan engine sends a message to the message queue to call the LLM Hub, generates a "plan memory record" by querying the LLM, and stores it in the memory. The memory establishes an independent index for the "plan memory record".

[0032] The LLM Hub includes a Dispatcher and several Adaptors, each of which is connected to a LLM. The dispatching strategies of the Dispatcher include:

[0033] (1) Cost-first strategy: Searching for LLMs has a cost. This strategy selects the LLM with the lower cost. LLM(a) <Cost LLM(b) , then select LLM(a);

[0034] (2) Utility priority strategy: Each LLM may have different utility for a search in a certain field. This strategy selects the LLM with high utility. LLM(a) >Utility LLM(b) , then select LLM(a);

[0035] (3) Random strategy: This strategy selects LLM based on a random number, select LLM(random(n));

[0036] (4) Summarization strategy: A search query will be distributed to several LLMs at the same time, and the returned result sets will be summarized and merged into one result set by the dispatcher;

[0037] (5) Judge decision strategy, which performs the following steps:

[0038] a) A search query will be distributed to several LLMs at the same time, such as LLM(a), LLM(b), and LLM(c). The returned result set will be simply summarized by the Dispatcher to construct another "selective" or "requires further in-depth summary" search query 2;

[0039] b) Distribute Query2 to another LLM, such as LLM (d), to obtain the final result set; this LLM is called the "Judge" LLM, and the Judge LLM selects a third-party LLM, that is, the LLM not used in step a);

[0040] (6) Diversified strategy for deep processing: For some search queries with path dependence, the "diversified strategy for deep processing" can be applied; the path dependence refers to the dependency of the current search query on the previous search query 0; the "diversified strategy for deep processing" refers to assigning these search queries to different LLMs respectively, so as to obtain more diversity in the overall result.

[0041] The intelligence or strength of the generative agent is calculated in the following way:

[0042] Intelligence (i)= ɑ*Size ofMemory(i) ;

[0043] Power (i) =Intelligence (i) +......;

[0044] Among them, ɑ is the weight coefficient of the memory.

[0045] The memory stores various different types of records, and the different types of records at least include "event memory records", "insight memory records" and "plan memory records";

[0046] The memory can be constructed in layers, and the weight of each layer is different; the memory of the same layer is further classified, and the weight of each type of memory will be different; the principle of memory layering: when the layering is conducive to reasoning and faster retrieval, and thus can be reflected as higher intelligence, then the layering is carried out;

[0047] Principle of classification for the same-layer memory: Classification is performed when classification is conducive to data alignment, making record access more efficient and economical.

[0048] The evaluation and scoring formula for the memory constructed by hierarchical classification is:

[0049]

[0050] Among them, Score size_of_memory(i) The evaluation score of the memory built for the hierarchical classification of the generative agent; λ l is the weight of the memory in the first layer; n is the maximum number of memory layers; α k is the weight of the k-th memory; m is the maximum number of categories of the memory in this layer; Size(memory (k) ) is the size of the k-th memory;

[0051] Score size_of_memory(i) Equivalent to Size ofMemory(i)Therefore, Intelligence (i) =Score size_of_memory(i) .

[0052] Another object of the present invention is achieved by the following technical solutions:

[0053] The method for constructing a generative agent includes the following steps:

[0054] The sensor collects data from the external environment / external world through a variety of sensors and describes it in natural language to form an "event" information record. All "event" information records will be recorded in the memory. This record in the memory is called an "event memory record";

[0055] The search engine retrieves the relevant "memory records" from the memory, and the search result set is named "retrieved memory records";

[0056] The reflection engine summarizes or infers the "memory records" of a certain area of ​​memory to form summary "insight memory records" and stores these records in the memory;

[0057] The planning engine generates a "planning memory record" and stores it in the memory;

[0058] The action engine sends a message to the message queue to call the LLM Hub. By applying the currently perceived "event memory record" and the "retrieved memory record" retrieved based on it, it constructs a query for the context to query the LLM and derives the appropriate behavior to be performed and executed;

[0059] The LLM Hub connected to several LLMs is used to process the queries of the search engine, reflection engine, planning engine, and action engine to the LLMs;

[0060] As a result, the "event memory records" continuously obtained through the sensor are stored in the memory, and then summarized and concluded through the reflection engine to generate "insight memory records". At the same time, the "memory plan records" are generated through the planning engine. These memory records are all stored in the memory, thereby expanding the memory size of the intelligent agent; the action engine uses the corresponding memory records in the memory as the context, calls LLM through the LLM Hub to obtain behavioral guidance, and then obtains the external environment feedback information when and after these behaviors are executed through the sensor, forming a new "event memory record", and finally constructing a generative intelligent agent.

[0061] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0062] The generative agent of the present invention can meet the following requirements:

[0063] 1) Long-term memory and growth of agents. In order to build deep and stable relationships with people, agents need to be able to remember interactions, statements, and behaviors over long periods of time. As interactions evolve, agents should not only maintain their unique personalities, but also grow and learn like people.

[0064] 2) Self-awareness of the agent. For the agent, it is also necessary to clearly understand the boundaries of its own knowledge and to be clear about what it knows and what it does not know. This self-awareness helps to increase the attractiveness and credibility of the interaction, enabling it to respond appropriately according to the situation.

[0065] 3) Social interaction between agents. Agents can learn and develop not only from human input, but also from interactions with other agents. Such a setting can provide a richer and more diverse source of information for the learning and development of agents.

[0066] 4) The internal cognitive process of the intelligent agent. Integrating cognitive processes into the intelligent agent may help achieve more realistic and traceable intelligent agent behavior. In addition to responding to inputs such as text, images, sounds, and smells, the intelligent agent should also demonstrate an understanding of people's potential intentions, emotions, and social behaviors. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 Schematic diagram of the structure of the generative agent described in the present invention.

[0068] Figure 2 The data flow diagram of the summary and induction strategy of the Dispatcher scheduler described in the present invention.

[0069] Figure 3 It is a schematic diagram of a first data flow related to the memory of the present invention.

[0070] Figure 4 It is a schematic diagram of a second data flow related to the memory of the present invention.

[0071] Figure 5 A diagram showing how memory is constructed using three levels.

[0072] Figure 6 Schematic diagram of the connection relationship between the generative agent (i.e., agent i) described in the present invention and several LLMs. DETAILED DESCRIPTION

[0073] The present invention is further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.

[0074] like Figures 1 to 5 , the overall scheme of the generative agent is as follows:

[0075] LLM refers to Large Language Model.

[0076] Generally speaking, large language models refer to those that are trained on large-scale text corpora and contain tens of billions or trillions of parameters or even larger, such as GPT-3, PaLM, LLaMA, etc. Large-scale language models have demonstrated amazing capabilities (called emergent capabilities) in solving a range of complex tasks. These capabilities are the key to the performance of language models on complex tasks, making artificial intelligence algorithms unprecedentedly powerful and effective.

[0077] Large-scale language models will revolutionize the way humans develop and use AI algorithms. Unlike small pre-trained language models, the main way to access large-scale language models is through prompt interfaces (such as the GPT-4 API). People must understand how large-scale language models work and formalize their tasks in a way that large-scale language models can follow.

[0078] Today, large-scale language models have had a significant impact on the AI ​​community, and the emergence of ChatGPT and GPT-4 has prompted people to rethink the possibility of general artificial intelligence (AGI).

[0079] 1. Multiple LLM Application Modes

[0080] Large-scale language models (LLMs) will become infrastructure, just like water plants and power plants, operated by large capital private or state-owned companies.

[0081] Because of human concerns about AI (or the controllers of AI), there will be multiple large-scale language models (LLMs) that provide services to the public. There is market competition between multiple LLMs. Multiple LLMs are homogeneous, but there are also differences. For example, OpenAI's GPT3 / ChatGPT / GPT4, Google's Gemini 1.0 (Gemini Ultra / GeminiPro / Gemini Nano), Baidu's Wenxin Yiyan, xAI's (Musk's new startup) Grok, Beijing Zhiyuan Artificial Intelligence Research Institute's Wudao Tianying Aquila, etc.

[0082] To some extent, the present invention will simultaneously use / call multiple large-scale language models LLM to build and run the generative intelligent agent of the present invention. Figure 6 As shown, the generative agent (i.e., agent i) is simultaneously connected to 5 LLM large models.

[0083] 2. Generative Agent Architecture

[0084] (I) System Architecture

[0085] like Figure 1 ,The generative agent includes sensor, memory storage, message bus, retrieval engine, reflection engine, planning engine, action engine, and LLM Hub.

[0086] 1) Sensors, whose functions are: using various sensors (such as cameras, microphones, odor sensors, etc.) to collect data from the external environment / external world, and describe it in natural language to form "event" information records. All "event" information records will be recorded in the memory storage, and this record in the memory is called "event memory record".

[0087] 2) Memory Storage: is a medium used to store "memory records".

[0088] 3) Message bus, whose function is to transmit command messages used to drive the work of functional components such as retrieval engine, reflection engine, planning engine, action engine, sensor, LLM Hub, etc.

[0089] 4) Retrieval engine, whose function is to retrieve relevant memory records from the memory storage, and the result set is named "retrieved memory records".

[0090] Search algorithm:

[0091] Score=ɑ recency *Recency+ɑ importance *Importance

[0092] +ɑ relevance * Relevance;

[0093] Score is a score for each memory record in the memory storage (in implementation, it can be a sufficiently wide capacity area, not necessarily all). The top n memory records with the highest scores are selected as the result set.

[0094] The meanings of the three consideration factors, Recency, Importance, and Relevance, are as follows:

[0095] Recency is an exponential decay function, which is calculated by the time from the last retrieval time LastAccessTime of the memory record to the present.

[0096] Importance, assigned an initial value when the memory record is created. You can get this value by sending a message to the message queue to call the LLM Hub for query (by asking the LLM a cloze test question and letting the LLM score the "event" type of the memory record). Of course, the agent can also give this value based on the importance of the "event" to itself, and it is not necessary to query the LLM's general knowledge score to assign a value.

[0097] Relevance correlation, by sending a message to the message queue to call the LLM Hub for query, you can get the embedding vector Embedding Vector of the "event" description information of the memory record; by calling the same LLM for query, you can get the embedding vector Embedding Vector of the query statement Query that triggered this retrieval; calculate the cosine similarity of the two EmbeddingVectors and assign it to the value of Relevance.

[0098] ɑ recency is the weight of Recency; importance is the weight of Importance; relevance is the weight of Relevance.

[0099] 5) Reflection engine, whose function is to summarize or infer the memory records in a certain area to form summary "insight memory records" and store these records in memory storage.

[0100] (i) Data Scope

[0101] The most recent N memory records in the memory storage can be used for reflection. The reflection area can also be time-related, such as reflecting on memory records within a year.

[0102] (ii) Main Subject

[0103] What topics should we reflect on?

[0104] Send a message to the message queue to call the LLM Hub, and query the LLM by constructing a query using the data in the reflection area to obtain the subject of reflection.

[0105] (iii) Insight Memory Record

[0106] For each reflection topic, a message is sent to the message queue to call the LLM Hub. By using the data in the reflection area to construct a query to query the LLM, the insight memory record of the current topic is obtained.

[0107] (iv) When is the trigger for reflection?

[0108] Perform reflection periodically, such as once every 24 hours. Timer trigger.

[0109] When the sum of the importance scores of the latest memory records exceeds a certain threshold, the data in the reflection area is used for reflection. Importance condition trigger.

[0110] Note: The query Query(string) constructed in (ii) and the query Query(string) constructed in (iii) are different.

[0111] 6) Planning engine, whose function is to generate "plan memory records" and store them in memory storage.

[0112] Plans belong to the "future", events that have not yet "happened".

[0113] The plan types can be subdivided into Regular Plan type and Specify Plan type.

[0114] Regular Plan is a regular plan with a periodic schedule, such as getting up at 6:00 a.m. every day; having breakfast at 6:30 a.m.; having lunch at 12:00 p.m.; having dinner at 7:00 p.m.; and going to bed at 11:00 p.m.

[0115] Specify Plan is a specific plan, such as going to the Zhuhai Sun Moon Bay Grand Theater on December 29, 2023 to watch the concert of the St. Petersburg Symphony Orchestra of Russia.

[0116] Because plans are possible "future" events and are explicit constraints on future events, independent indexes should be created for plan memory records in the memory storage to facilitate quick retrieval of constraints.

[0117] (i) Generate a plan

[0118] You can send a message to the message queue to call the LLM Hub, and generate a plan memory record by querying the LLM, especially when a Regular Plan needs to be generated. And store the generated plan memory record in the memory storage.

[0119] (ii) When is the trigger for generating a plan?

[0120] When there is a current event memory record that mentions "future" events or an appointment, you can (try to) generate a planned memory record.

[0121] Or when you reflect and realize that "generating a plan (for a certain matter) is very beneficial", then you can proceed with the "generating plan".

[0122] 7) Action engine, whose function is to send a message to the message queue to call LLM Hub, construct a query Query by applying the currently perceived event memory record and the retrieved memory record as the context to inquire LLM, and deduce the appropriate behavior and execute the behavior (including operating other peripheral functional components such as robot arms, speakers, etc.).

[0123] The sensor does not necessarily perceive the environment (including people) all the time. It may obtain perception through periodic sampling in implementation. The sampling frequency can also be dynamic, high or low. When not sampling, the sensor is in a sleep state. When the action engine executes an action, in principle, the sensor should get timely feedback on the consequences of the action. Therefore, at this time, the action engine sends a message to the message queue to wake up the sensor to sample and obtain new perception of the environment. The sampling work strategy of the sensor can be designed by referring to the priority principle of "interrupt" in the computer system.

[0124] 8) LLM Hub, its function is to connect to multiple LLMs and process the queries of LLMs from the search engine, reflection engine, planning engine, and action engine.

[0125] The LLM Hub consists of a Dispatcher and several Adaptors.

[0126] The dispatch scheduling strategy of the Dispatcher scheduler can be:

[0127] (1) Spending Priority Strategy

[0128] Searching for LLMs has a cost. This strategy selects LLMs with a lower cost.

[0129] If Cost LLM(a) <Cost LLM(b) , then select LLM(a).

[0130] (2) Utility-first strategy

[0131] Each LLM may have different utility for searching in a certain field. This strategy selects LLMs with high utility.

[0132] If Utility LLM(a) >Utility LLM(b) , then select LLM(a).

[0133] (3) Random Strategy

[0134] This strategy selects LLM based on a random number.

[0135] select LLM(random(n))

[0136] (4) Summarizing and generalizing strategies

[0137] A search query will be distributed to several LLMs at the same time, and the returned result sets will be summarized and merged into one result set by the Dispatcher.

[0138] Data flow such as Figure 2 shown.

[0139] (5) Judge’s Decision Strategy

[0140] This strategy performs the following steps:

[0141] A search query will be distributed to several LLMs at the same time, and the returned result set will be simply summarized by the Dispatcher to construct another "selective" or "requires further in-depth summary" search query 2;

[0142] Distribute this Query2 to another LLM (called "Judge" Judger LLM, the Judge LLM is preferably a third-party LLM - that is, the LLM not used in the above step a)), to obtain the final result set Final Result Set.

[0143] For example: Distribute Query1 to LLM(a), LLM(b), and LLM(c) at the same time, and obtain the returned result sets ResultSet(a), Result Set(b), and Result Set(c). These result sets are simply summarized to construct another search Query2; distribute Query2 to LLM(d) to obtain the final result set Final Result Set.

[0144] (6) Diversification strategy for deep processing

[0145] For some path-dependent search queries, the "diversified strategy for deep processing" can be applied.

[0146] The path dependency here refers to the dependency of the current search Query on the previous search Query0.

[0147] Assign these search queries to different LLMs to obtain more diversity in the overall results.

[0148] Example:

[0149] Query0 is: "Decompose task A into subtasks".

[0150] The search Query0 is assigned to LLM(a).

[0151] The result set returned by LLM(a) ​​is "Task A can be decomposed into the following subtasks: subtask a1, subtask a2, subtask a3.".

[0152] Query1 is: "Describe the process method of task a1".

[0153] Query2 is: "Describe the process method of task a2".

[0154] Query3 is: "Describe the process method of task a3".

[0155] At this time, the "diversification strategy of deep processing" can be applied: Dispatcher assigns search Query1 to LLM(b), Dispatcher assigns search Query2 to LLM(c), and Dispatcher assigns search Query3 to LLM(d) to obtain the corresponding result set.

[0156] Relevant data structures:

[0157] The data structure of event memory records includes: Creation Time, Last Access Time, Access Count, Event Description in natural language, and corresponding original data (such as graphic data, sound data, smell data, etc.).

[0158] The data structure of insight memory records includes: Creation Time, Last Access Time, Access Count, natural language insight description InsightDescription, index list of memory records referenced by the insight, and corresponding raw data (such as graphic data, sound data, smell data, etc.).

[0159] The data structure of the plan memory record includes: Creation Time, Last Access Time, Access Count, start time, duration, location of the plan, index list of sub-plan memory records or task description in natural language (such as a specific description of "who does what"), and corresponding raw data (such as graphic data, sound data, smell data, etc.).

[0160] The memory records stored in the Memory Storage are the above three types of event memory record types, insight memory record types, and plan memory record types. Of course, the above three types of memory record types can also be further subdivided into more detailed memory record types, such as the plan memory record type can be subdivided into regular plan memory record types and specific plan memory record types, and so on.

[0161] (III) Related data flows such as Figure 3 , 4 shown.

[0162] (IV) About Memory Storage

[0163] The memory storage capacity of the generative agent is huge. The number of records stored can generally be in the order of billions, tens of billions, or even hundreds of billions. Indexes can be established for key data in the records to facilitate fast retrieval. In this way, there are various indexes. For example, image indexes, sound indexes, smell indexes, etc. are established for the corresponding raw data in the records.

[0164] Example:

[0165] Example 1:

[0166] When the sensor collects image information data of a face, the search engine uses the image index to search the image information data of the face and obtain the corresponding memory record. For example:

[0167] The memory record of "I learned that the girl's name is Liu Liu, and her nickname is Liu Liu" (event memory record) was generated at a certain moment 15 years ago; the memory record of "Listen to the songs Liu Liu recorded on Changba" (event memory data) was generated at a certain moment 10 years ago; the memory record of "Liu Liu is a cheerful, lively girl who can play the piano, sings well, and has good interpersonal relationships" (insight memory record) was generated at a certain moment 10 years ago; the memory record of "Prepare to travel to Sanya with Liu Liu next Sunday" (plan memory record) was generated at a certain moment 15 days ago; and so on.

[0168] Example 2:

[0169] When the sensor collects a piece of sound information data of a song, the search engine uses the sound index to search the sound information data and obtain the corresponding memory record. For example:

[0170] A memory record (event memory record) of "I learned that the name of this song is nine million bicycles." The record was generated at a certain moment 18 years ago.

[0171] Example 3:

[0172] When the sensor collects some odor information data, the retrieval engine uses the odor index to retrieve the odor information data and obtain the corresponding memory record. For example:

[0173] "The school organized us to visit the paper mill, and I smelled an unpleasant odor. It turned out that this was the smell of 'caustic soda'." The memory record (event memory record) was generated at a certain moment 38 years ago.

[0174] (1) The sensor is constantly collecting data from the outside world, and even constantly collecting data. The number of event memory records formed will also be very large. Therefore, the amount of data in the insight memory records derived from the insight engine and the plan memory records derived from the plan engine may also be very large. Therefore, even if the capacity of the memory storage is huge, it should be regarded as "limited".

[0175] (2) Moreover, the cost of information retrieval in an area with a huge amount of recorded data is high. The larger the amount of recorded data, the greater the cost.

[0176] Based on (1) the capacity of Memory Storage is "limited" and (2) the larger the amount of recorded data in the searched area, the greater the cost. It is necessary to clear / delete a considerable portion of the data in Memory Storage. This will yield the following benefits: (i) Reserving storage space so that a large number of newly generated event memory records, insight memory records, and plan memory records can be stored in memory in large quantities and quickly. (ii) Reducing the amount of recorded data in a region, thereby reducing the cost of retrieval.

[0177] The clearing / deletion of memory records in the Memory Storage is usually done in batch processing, which makes the work efficient. It is usually done when the sensor is asleep, because at this time, there will not be a large amount of new collected data that needs to be stored and responded to in a timely manner.

[0178] The memory record with an older Last Access Time has a higher priority for being deleted.

[0179] Compared with insight memory records and plan memory records, event memory records have a higher priority for deletion.

[0180] The more valid memory records stored in its memory storage, the smarter and more intelligent this agent i is. The size of the number of records in the memory storage can be used to evaluate the intelligence or power of the agent. It can be simplified to the following formula for calculation:

[0181] Intelligence (i)= ɑ*Size ofMemory(i) ;

[0182] Power (i) =Intelligence (i) +......;

[0183] Where ɑ is the weight coefficient of memory size.

[0184] like Figure 5 , memory can be constructed in layers. The weight of each layer is different. The memory of the same layer is further classified, and the weight of each type of memory will be different. Memory layering is conducive to reasoning and faster retrieval, thus reflecting higher intelligence. Classification of memory at the same layer is conducive to data alignment, making record access more efficient and economical.

[0185] The present invention uses three levels to construct Memory. Of course, it is also possible to use more or fewer levels to construct Memory. Here, the three levels constructed by the present invention are:

[0186] i) Layer 1 Primitive Data Memory Layer 1 Primitive Data Memory stores primitive memory records such as graph memory, audio memory, odor memory, and script memory.

[0187] ii) Layer 2 Abstract Data Memory Layer 2 abstract data memory layer stores memory records that have been summarized, inductively reasoned, and abstractly processed, such as insight memory records, plan memory records, and other types of records.

[0188] iii) Layer 3 Advanced Abstract Data Memory: Layer 3 Advanced Abstract Data Memory stores memory records that have been further summarized, inductively reasoned, and processed through further deep abstraction, such as advanced insight memory records.

[0189] Then, the score of the generative agent’s memory can be:

[0190] Score size_of_layer1_memory = graph *Size of_graph_memory

[0191] +ɑ audio *Size of_audio_memory

[0192] +ɑ odour *Size of_odour_memory

[0193] +ɑ script *Size of_Script_memory +......

[0194] Score size_of_layer2_memory =b event *Size of_event_memory

[0195] +b insight *Size of_insight_memory

[0196] +b plan *Size of_plan_memory +......

[0197] Score size_of_layer3_memory =γ advanced_event *Size of_advanced_event_memory

[0198] +γ advanced_insight *Size of_advanced_insight_memory

[0199] +γ advanced_plan *Size of_advanced_plan_memory +......

[0200] Among them, graph is the weight coefficient of the graphics memory size;

[0201] ɑ audio is the weight coefficient of the sound memory size;

[0202] ɑ odour is the weight coefficient of the odor memory size;

[0203] ɑ script is the weight coefficient of the language memory size;

[0204] b event is the weight coefficient of the event memory size;

[0205] b insight The weight coefficient for insight memory size;

[0206] b plan is the weight coefficient of the planned memory size;

[0207] γ advanced_event is the weight coefficient of the high-level event memory size;

[0208] γ advanced_insight The weight coefficient for memory size for advanced insights;

[0209] γ advanced_plan The weight factor for memory size in advanced plans.

[0210] Score size_of_memory(i) =λ layer1 *Score size_of_layer1_memory

[0211] +λ layer2 *Score size_of_layer2_memory

[0212] +λ layer3 *Score size_of_layer3_memory +......

[0213] λ layer1 is the weight coefficient of the level 1 memory layer;

[0214] λ layer2 is the weight coefficient of the level 2 memory layer;

[0215] λ layer3 is the weight coefficient of the level 3 memory layer.

[0216] Or, expressed as:

[0217]

[0218] Among them, Score size_of_memory(i) The evaluation score of the memory built for the hierarchical classification of the generative agent; λ l is the weight of the memory in the first layer; n is the maximum number of memory layers; α k is the weight of the k-th memory; m is the maximum number of categories of the memory in this layer; Size(memory (k) ) is the size of the k-th type of memory;

[0219] Score size_of_memory(i) Equivalent to Size ofMemory(i) Therefore, Intelligence (i) =Score size_of_memory(i) .

[0220] Therefore, the simplest way for a generative agent to enhance its intelligence is to expand its memory size. To become an intelligent agent, it must be "well-informed" and increase its event memory records of "what it has seen and heard". Then, on top of these original information data event memory records of "what it has seen and heard", it further increases these insight memory records by summarizing and generalizing the insight memory records generated by abstraction.

[0221] Therefore, to develop a generative agent, you have to constantly (targeted and planned) let him have more activities (four-week activities), more activities that are different from the past. "Reading" is also a good way to cultivate. Let the agent "read" in a planned way, let him read newspapers and news every day, and even watch TV and movies. Then the agent can generate more memory records more economically, thereby effectively expanding its memory size.

[0222] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. Generative Agent, characterized by: It includes at least the following components: sensor, memory, message bus, search engine, reflection engine, planning engine, action engine and LLM Hub; among which: Perceptrons collect data from the external environment / external world through a variety of sensors and describe them in natural language to form "event" information records. All "event" information records will be recorded in the memory. This record in the memory is called "event memory record"; Memory is a medium used to store "memory records"; A message bus for transmitting command messages for driving the work of functional components, wherein the functional components include a search engine, a reflection engine, a planning engine, an action engine, a sensor, and an LLM Hub; The search engine retrieves the relevant "memory records" from the memory, and the search result set is named "retrieved memory records"; The reflection engine summarizes or infers the "memory records" of a certain area of ​​memory to form summary "insight memory records" and stores these records in memory; The planning engine is used to generate "planning memory records" and store them in the memory; The action engine is used to send messages to the message queue to call the LLM Hub. By applying the currently perceived "event memory record" and the "retrieved memory record" retrieved based on it, it constructs a query for the context to query the LLM, and obtains the appropriate behavior that should be performed and executes it; LLM Hub, which connects to several LLMs and is used to process queries to LLMs from the search engine, reflection engine, planning engine, and action engine; The data structure of the "event memory record" includes: record generation time, most recent access time, access count, event description in natural language, and corresponding original data; the corresponding original data includes graphic data, sound data, and odor data; The data structure of the "insight memory record" includes: record generation time, most recent access time, access count, insight description in natural language, index list of memory records referenced by the insight, and corresponding raw data; the corresponding raw data includes graphic data, sound data, and smell data; The data structure of the "plan memory record" includes: record generation time, most recent access time, access count, planned start time, planned duration, planned location, index list of sub-plan memory records or task description in natural language form, and corresponding raw data; the corresponding raw data includes graphic data, sound data, and odor data; The memory records stored in the memory include the above-mentioned event memory record types, insight memory record types, and plan memory record types; the above three types of memory records can also be further subdivided into more detailed memory record types.

2. The generative agent according to claim 1, characterized in that: The LLM Hub includes a Dispatcher and several Adaptors, each of which is connected to a LLM. The dispatching strategies of the Dispatcher include: (1) Cost-first strategy: Searching for LLMs has a cost. This strategy selects the LLM with the lower cost. LLM(a) <Cost LLM(b) , then select LLM(a); (2) Utility priority strategy: Each LLM may have different utility for a search in a certain field. This strategy selects the LLM with high utility. LLM(a) >Utility LLM(b) , then select LLM(a); (3) Random strategy: This strategy selects LLM based on a random number, select LLM(random(n)); (4) Summarization strategy: A search query will be distributed to several LLMs at the same time, and the returned result sets will be summarized and merged into one result set by the dispatcher; (5) Judge decision strategy, which performs the following steps: a) A search query will be distributed to several LLMs at the same time. For example, the result sets returned by LLM(a), LLM(b), and LLM(c) will be simply summarized by the Dispatcher to construct another "selective" or "requires further in-depth summary" search query 2; b) Distribute Query2 to another LLM, such as LLM (d), to obtain the final result set FinalResult Set; this LLM is called the "Judge" Judger LLM, and the Judge LLM selects a third-party LLM, that is, the LLM not used in step a); (6) Diversified strategy for deep processing: For some search queries with path dependence, the "diversified strategy for deep processing" can be applied; the path dependence refers to the dependency of the current search query on the previous search query 0; the "diversified strategy for deep processing" refers to assigning these search queries to different LLMs respectively, so as to obtain more diversity in the overall result.

3. The generative agent according to claim 1, characterized in that: The intelligence or strength of the generative agent is calculated in the following way: Intelligence (i) =a * Size of Memory(i) ; Power (i) =Intelligence (i) +……; Among them, α is the weight coefficient of memory size.

4. The generative agent according to claim 1, characterized in that: The memory stores various types of records, and the different types of records include at least "event memory records", "insight memory records" and "plan memory records"; The memory can be constructed in layers, and the weight of each layer is different; the memory of the same layer is further classified, and the weight of each type of memory will be different; the principle of memory layering: when the layering is conducive to reasoning and faster retrieval, and thus can be reflected as higher intelligence, then the layering is carried out; Principle of classification for same-layer memory: Classification is performed when it is conducive to data alignment and makes record access more efficient and economical; The evaluation and scoring formula for the memory constructed by hierarchical classification is: Among them, Score size_of_memory(i) The evaluation score of the memory built for the hierarchical classification of the generative agent; λ l is the weight of the memory in the first layer; n is the maximum number of memory layers; α k is the weight of the k-th memory; m is the maximum number of categories of the memory in this layer; Size(memory (k) ) is the size of the k-th memory; Score size_of_memory(i) Equivalent to Size ofMemory(i) Therefore, Intelligence (i) =Score size_of_memory(i) .

5. A method for constructing a generative agent, characterized in that: The method for constructing a generative agent according to any one of claims 1 to 4 comprises the following steps: The sensor collects data from the external environment / external world through a variety of sensors and describes it in natural language to form "event" information records. All "event" information records will be recorded in the memory. This record in the memory is called "event memory record"; The search engine retrieves the relevant "memory records" from the memory, and the search result set is named "retrieved memory records"; The reflection engine summarizes or infers the "memory records" of a certain area of ​​memory to form summary "insight memory records" and stores these records in the memory; The planning engine generates a "planning memory record" and stores it in the memory; The action engine sends a message to the message queue to call the LLM Hub. By applying the currently perceived "event memory record" and the "retrieved memory record" retrieved based on it, it constructs a query for the context to query the LLM, and obtains the appropriate behavior that should be performed and executes it; The LLM Hub connected to several LLMs is used to process the queries of the search engine, reflection engine, planning engine, and action engine to the LLMs; Therefore, the "event memory records" continuously obtained through the sensor are stored in the memory, and then summarized and concluded through the reflection engine to generate "insight memory records". At the same time, the "memory plan records" are generated through the planning engine. These memory records are all stored in the memory, thereby expanding the memory size of the intelligent agent; the action engine uses the corresponding memory records in the memory as the context, calls LLM through the LLM Hub to obtain behavioral guidance, and based on this behavior, obtains the external environment feedback information when and after these behaviors are executed through the sensor, forming a new "event memory record", and finally constructing a generative intelligent agent.