Multi-agent cooperative caching method and device, caching equipment, storage medium and program product
By generating situation vectors and combining agent feature vectors and collaboration task maps, the cache strategy is dynamically adjusted, and the problems of inconsistency in cache and low hit rate in multi-agent collaboration are solved, the collaboration efficiency and response speed are improved, and the utilization rate and intelligence of cache resources are improved.
Patent Information
- Application Number
- CN202510703791.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2045-05-29
AI Technical Summary
In the field of multi-agent collaboration, the existing data caching methods have problems such as cache inconsistency, storage redundancy, and low cache hit rate, resulting in low collaboration efficiency and response speed in complex task environments.
By generating situation vectors, combining the agent's feature vectors and collaborative task maps, dynamically adjusting the cache strategy, priority is given to cache important data with high scores, and intercepting non-important data by setting thresholds, reducing computing and communication overhead.
It improves the collaboration efficiency and response speed of multi-agents in complex task environments, improves the utilization rate of cache resources, and enhances the intelligence level of multi-agents' collaboration.
Smart Images

Figure CN120234167A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular, to a multi-agent collaborative caching method, device, caching device, storage medium, and program product. Background Art
[0002] In the field of multi-agent collaboration, in order to complete complex user tasks, agents need to frequently perform data interaction and data sharing. The transmission data caching technologies include local caching and centralized caching. Among them, local caching caches shared data locally on multiple agents, but it is prone to problems of cache inconsistency and storage redundancy. Centralized caching centrally manages the cache and usually updates the cache data using cache eviction policies such as Least Recently Used (LRU) or Least Frequently Used (LFU), resulting in a low cache hit rate. Summary of the Invention
[0003] In view of this, an object of the present invention is to provide a multi-agent collaborative caching method, device, caching device, storage medium, and program product, which can improve the collaboration efficiency and response speed of multi-agents in a complex task environment.
[0004] To achieve the above object, the technical solutions adopted in the embodiments of the present invention are as follows: In a first aspect, the present invention provides a multi-agent collaborative caching method, which is applied to a caching device. The caching device is communicatively connected to at least one task execution device, and at least one agent is set in each task execution device. The method includes: Generating a context vector according to the input data, inference data, and output data of a subtask sent by the task execution device; the subtask is obtained by the task execution device based on splitting a user task; the inference data represents the inference process of the agent executing the subtask; Determining a cache score corresponding to the context vector according to the context vector, the feature vector of the agent, and the collaborative task graph; When the cache score is higher than a first threshold, caching the input data, inference data, and output data of the subtask.
[0005] In an optional embodiment, the step of caching the input data, inference data, and output data of the subtask when the cache score is higher than a first threshold includes: When the cache score is higher than the first threshold and not higher than a second threshold, obtaining the summary information of the output data, and adding the input data, the inference data, and the summary information to the cache pool.
[0006] In an alternative embodiment, when the cache score is higher than a first threshold, caching the input data, inference data, and output data of the subtask includes: When the cache score is higher than a second threshold, according to the association relationship between multiple subtasks, obtain the association results corresponding to the associated subtasks from the output data, and add the input data, the inference data, and the association results to the cache pool.
[0007] In an alternative embodiment, before generating a context vector based on the input data, inference data, and output data of the subtask sent by the task execution device, the method further includes: When receiving a query instruction sent by the task execution device, generate a query vector according to the step input of the subtask in the query instruction; before the agent executes the subtask, the task execution device determines whether to send a query instruction according to the similarity between the subtask and other subtasks; Generate cache vectors corresponding to each of the data according to the data in the cache pool; Determine a similar vector corresponding to the query vector from the cache vectors according to the similarity between the query vector and each of the cache vectors; Determine the dependent data of the subtask according to the similar vector; Return the dependent data of the subtask to the task execution device, so that the task execution device generates the input data of the subtask according to the step input of the subtask and the dependent data.
[0008] In an alternative embodiment, determining the dependent data of the subtask according to the similar vector includes: When the similar vector is one, convert the similar vector into the dependent data of the subtask; When the similar vectors are multiple, input each of the similar vectors and the collaborative task graph into a graph convolutional network to obtain the similarity scores of each of the similar vectors, and convert the similar vector with the highest similarity score into the dependent data of the subtask.
[0009] In an alternative embodiment, determining the cache score corresponding to the context vector according to the context vector, the feature vector of the agent, and the collaborative task graph includes: Generate the feature vector of the agent according to the description information of the agent; Input the context vector, the feature vector, and the collaborative task graph into a graph convolutional network to obtain the cache score corresponding to the context vector.
[0010] Second aspect, the present invention provides a multi-agent collaborative caching device, which is applied to a caching device. The caching device is communicatively connected to at least one task execution device, and at least one agent is provided for each task execution device. The device includes: A processing module, configured to generate a context vector according to the input data, inference data, and output data of a subtask sent by the task execution device; the subtask is obtained by the task execution device based on splitting a user task; the inference data represents the inference process of the agent executing the subtask; A scoring module, configured to determine a caching score corresponding to the context vector according to the context vector, the feature vector of the agent, and the collaborative task graph; A caching module, configured to cache the input data, inference data, and output data of the subtask when the caching score is higher than a first threshold.
[0011] Third aspect, the present invention provides a caching device, including a processor and a memory. The memory stores a computer program that can be executed by the processor, and the processor can execute the computer program to implement the multi-agent collaborative caching method according to any one of the foregoing embodiments.
[0012] Fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the multi-agent collaborative caching method according to any one of the foregoing embodiments.
[0013] Fifth aspect, the present invention provides a program product, which, when executed by a processor, implements the multi-agent collaborative caching method according to any one of the foregoing embodiments.
[0014] Compared with the prior art, the multi-agent collaborative caching method, device, caching device, storage medium, and program product provided by the embodiments of the present invention generate a context vector through the input data, inference data, and output data of a subtask, and can comprehensively capture the key information of the current context during the execution of the subtask. By combining and analyzing the context vector, the feature vector of the agent, and the collaborative task graph, the caching score is determined, thereby implementing a dynamic and flexible caching mechanism to ensure that important data with a high caching score is preferentially cached. By setting a first threshold to intercept unimportant data with a low caching score, the calculation and communication overhead are effectively reduced, and the collaboration efficiency and response speed of multi-agents in a complex task environment are improved. This not only improves the utilization rate of caching resources but also enhances the intelligent level of multi-agent collaboration.
[0015] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following specifically enumerates preferred embodiments and cooperates with the accompanying drawings for detailed description as follows. Description of the Drawings
[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings required in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and thus should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0017] Figure 1 It shows a schematic diagram of an application scenario provided by an embodiment of the present invention.
[0018] Figure 2 It shows a schematic flowchart of a multi-agent collaborative caching method provided by an embodiment of the present invention.
[0019] Figure 3 It shows a schematic diagram of a system architecture provided by an embodiment of the present invention.
[0020] Figure 4 It shows another schematic flowchart of a multi-agent collaborative caching method provided by an embodiment of the present invention.
[0021] Figure 5 It shows another schematic flowchart of a multi-agent collaborative caching method provided by an embodiment of the present invention.
[0022] Figure 6 It shows another schematic flowchart of a multi-agent collaborative caching method provided by an embodiment of the present invention.
[0023] Figure 7 It shows another schematic flowchart of a multi-agent collaborative caching method provided by an embodiment of the present invention.
[0024] Figure 8 It shows a schematic block diagram of a multi-agent collaborative caching device provided by an embodiment of the present invention.
[0025] Figure 9 It shows a schematic block diagram of a caching device provided by an embodiment of the present invention.
[0026] Icons: 10 - Multi-agent collaborative caching system; 100 - Caching device; 110 - Memory; 120 - Processor; 130 - Communication module; 200 - Task execution device; 300 - Multi-agent collaborative caching device; 301 - Processing module; 302 - Scoring module; 303 - Caching module. Detailed implementation manners
[0027] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Usually, the components of the embodiments of the present invention described and illustrated herein can be arranged and designed in various different configurations.
[0028] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed present invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present invention.
[0029] It should be noted that relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising a..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.
[0030] When traditional multi-agent systems handle large-scale and dynamically changing tasks, they often face problems such as high data access latency and serious waste of computing resources. Through research by the inventor, it is found that in the field of multi-agent cooperation, existing data caching methods are usually relatively simple, mainly including data replication, message-based caching, and centralized caching.
[0031] Among them, data replication is to copy shared data to the local of each agent for local caching, such as CPU caching. However, since multiple copies of the shared data are made, there is a phenomenon of storage redundancy and it is easy to cause cache consistency problems.
[0032] Message-based caching is to cache the communication messages between agents, but it ignores deeper context information such as task status and environmental changes, and there may be problems such as low value of cached data and low cache hit rate.
[0033] A centralized cache uses a centralized cache server. Although it can manage cache data uniformly, due to mainly relying on cache eviction policies such as LRU or LFU to update cache data, these cache eviction policies mainly focus on the frequency and temporal locality of data access, lack the effective utilization of context information in the multi-agent collaboration scenario, have the problem of low cache hit rate, are prone to becoming a bottleneck of the multi-agent system, and are not suitable for multi-agent systems with a high degree of distribution.
[0034] When dealing with complex and dynamic multi-agent collaboration tasks, these traditional methods are inefficient and unable to fully utilize system resources. Especially in scenarios that require quick response and real-time decision-making, data access latency becomes a key factor restricting system performance. Therefore, there is an urgent need for a multi-agent collaboration caching method that can sense the context, dynamically adjust the cache policy, and accurately retrieve cached data to improve the overall efficiency and intelligence level of the system.
[0035] Based on this, the multi-agent collaboration caching method, device, caching device, storage medium, and program product provided by the embodiments of the present invention generate a context vector through the input data, inference data, and output data of subtasks, and can comprehensively capture the key information of the current context during the execution of subtasks. By combining and analyzing the context vector, the feature vector of the agent, and the collaboration task graph, the cache score is determined, thereby realizing a dynamic and flexible caching mechanism to ensure that important data with a high cache score is preferentially cached. By setting a first threshold to intercept unimportant data with a low cache score, the computing and communication overheads are effectively reduced, and the collaboration efficiency and response speed of multi-agents in a complex task environment are improved. This not only improves the utilization rate of cache resources but also enhances the intelligence level of multi-agent collaboration.
[0036] The following will describe each embodiment of the present invention in detail with reference to the accompanying drawings.
[0037] The multi-agent collaboration caching system 10 includes a caching device 100 and at least one task execution device 200. Taking the deployment of multiple task execution devices 200 as an example for illustration. Please refer to Figure 1 , Figure 1 which shows a schematic diagram of an application scenario provided by the embodiments of the present invention. In Figure 1 , the caching device 100 is communicatively connected to multiple task execution devices 200, and at least one agent is provided on each task execution device 200. Among them, the caching device 100 is used to construct cached data corresponding to user tasks and find matching cached data based on query instructions. The task execution device 200 is used to execute subtasks of user tasks by using agents, query dependency data corresponding to the execution of subtasks from the caching device 100, and send shared data to be cached to the caching device 100.
[0038] It should be noted that the caching device 100 and the task execution device 200 can be electronic devices such as a personal computer (PC for short), a laptop, a server, etc. Figure 1 Multiple agents in Figure 1 can be deployed on the same task execution device 200. The caching device 100 is communicatively connected to a task execution device 200 to implement the multi-agent collaborative caching method provided by the embodiments of the present invention. It can be set according to the actual application scenario, and the present invention does not limit this.
[0039] Please refer to Figure 2 , Figure 2 FIG. shows a schematic flowchart of a multi-agent collaborative caching method provided by the embodiments of the present invention. This method is applied to a caching device, and the caching device is communicatively connected to at least one task execution device, and at least one agent is set on each task execution device. The method includes the following steps: Step S100, generating a context vector according to the input data, inference data, and output data of the subtasks sent by the task execution device; the subtasks are obtained by the task execution device based on splitting the user task; the inference data represents the inference process of the agent executing the subtask.
[0040] As a possible implementation manner, an exemplary elaboration is made with the Figure 3 system architecture. The user sends a task request to the multi-agent collaborative caching system, and the multi-agent collaborative caching system assigns the user task to one of the task execution devices. The task execution device uses the task planner to split and plan the user task to obtain multiple subtasks and the association relationship between the subtasks, generates a collaborative task graph corresponding to the user task based on the subtasks and the association relationship, and distributes these subtasks to the corresponding agents through the agent center.
[0041] Among them, the agent center is responsible for the management, scheduling, and task assignment of the agents. The collaborative task graph is used to describe the relationship and collaboration mode between the subtasks. The nodes of the collaborative task graph represent the subtasks, and the edges of the collaborative task graph represent the collaboration relationship between the subtasks. The collaboration relationship includes data dependence, communication relationship, and subtask assignment. The relationship graph between the subtasks is constructed by using the collaborative task graph, such as constructing the edges of the graph based on content similarity, time relationship, task sequence, reference relationship, etc.
[0042] After receiving the assigned subtask, the agent executes the assigned subtask according to its own capabilities and current state. During the execution of the subtask, the agent generates inference data and output data. The situation data corresponding to the subtask is composed of the input data, inference data, and output result of the subtask. Among them, the input data includes step inputs, and the step inputs include sensor data, user instructions, task types, and collaboration stages. The inference data includes the algorithm for executing the subtask, the completed inference steps, and the predicted next action. The output data is the output result of executing the subtask, such as decision instructions, generated data, communication messages, etc.
[0043] After the agent finishes executing the subtask, the task execution device sends the input data, inference data, and output data of the subtask to the cache device. The cache device converts the input data into an input vector, the inference data into an inference vector, and the output data into an output vector through embedding processing, and splices or fuses the input vector, inference vector, and output vector to obtain a situation vector for adjusting the cache.
[0044] As a possible implementation, taking splicing as an example for exemplary illustration. Suppose the input data is , the inference data is , the output data is , and the situation vector generation formula is as follows:
[0045]
[0046]
[0047]
[0048] Among them, is the situation vector; is the input vector; is the inference vector; is the output vector; is the embedding function.
[0049] Step S110, determine the cache score corresponding to the situation vector according to the situation vector, the feature vector of the agent, and the collaborative task graph.
[0050] Step S120, when the cache score is higher than the first threshold, cache the input data, inference data, and output data of the subtask.
[0051] Compared with the prior art that updates the cache based on data access frequency or time, the embodiments of the present invention introduce a "context awareness" mechanism to dynamically adjust the cache policy, that is, to dynamically adjust the cached data in the cache pool according to context data (including input data, inference data, and output data of subtasks), relevant features of the agent, and the collaborative task graph.
[0052] The cache device obtains the relevant features of the agent corresponding to the subtask, that is, the description information of the agent, such as role, business ability, task assignment, etc., and obtains the feature vector of the agent according to the description information of the agent. The task requirements of the subtask are captured through the context vector, the key attributes and dynamic information of the agent executing the subtask in the current task environment are captured through the feature vector of the agent, and the collaboration relationship between subtasks is captured through the collaborative task graph. The cache device performs comprehensive analysis based on the context vector of the subtask, the feature vector of the agent, and the collaborative task graph to obtain the cache score corresponding to the context vector, thereby more accurately predicting which data will be frequently used and increasing the cache score corresponding to the predicted frequently used data.
[0053] When the cache score is not higher than the first threshold, the cache device does not cache the input data, inference data, and output data of the subtask, effectively avoiding redundancy and waste of cache resources. When the cache score is higher than the first threshold, the cache device uses the cache to cache the input data, inference data, and output data of the subtask, thereby increasing the cache hit rate.
[0054] In summary, the multi-agent collaborative caching method provided by the embodiments of the present invention can comprehensively capture the key information of the current context during the execution of the subtask by generating a context vector from the input data, inference data, and output data of the subtask. By combining and analyzing the context vector, the feature vector of the agent, and the collaborative task graph, the cache score is determined, thereby realizing a dynamic and flexible caching mechanism to ensure that important data with a high cache score is preferentially cached. By setting the first threshold to intercept unimportant data with a low cache score, the computing and communication overheads are effectively reduced, and the collaboration efficiency and response speed of multi-agents in a complex task environment are improved. This not only improves the utilization rate of cache resources but also enhances the intelligent level of multi-agent collaboration.
[0055] It should be noted that, continuing with Figure 3 as an example, when all subtasks are completed by the agent, the task execution device uses the aligner to integrate and align the output data corresponding to each subtask to obtain the final output, and feeds the final output back to the user.
[0056] For the convenience of system monitoring, performance analysis, and task optimization, the multi-agent collaborative caching system can store the collaboration process of user tasks as historical records in a database. The historical records can include the output data of subtasks, error information during subtask execution, task iteration status, agent iteration, etc.
[0057] Optionally, a possible implementation method is provided below for how to cache subtasks with a cache score not higher than the second threshold. Please refer to Figure 4 , Figure 2 the sub-steps of step S120 in Step S121, when the cache score is higher than the first threshold and not higher than the second threshold, obtain the summary information of the output data, and add the input data, inference data, and summary information to the cache pool.
[0058] In the embodiments of the present invention, the first threshold is less than the second threshold, and both the first threshold and the second threshold are preset based on the application scenario. Assume that the cache scores are all decimals less than 1 and greater than 0, such as 0.002, 0.18, etc. The first threshold can be set to 0.1, and the second threshold can be set to 0.2. The present invention is not limited thereto.
[0059] When the cache score is higher than the first threshold and not higher than the second threshold, the cache device adopts a "coarse-grained" caching strategy to obtain the summary information from the output data. Among them, the summary information of the output data is a generalization and brief representation of the output data. The cache device stores the input data, inference data, and summary information corresponding to the subtask as cache data in the cache pool.
[0060] It can be seen that the embodiments of the present invention adopt a "coarse-grained" caching strategy to cache data with a cache score higher than the first threshold and not higher than the second threshold. Since the summary information is usually smaller in data volume than the output data, it can save cache space and save more key data under limited storage resources, further improving the cache hit rate.
[0061] Optionally, a possible implementation method is provided below for how to cache subtasks with a cache score higher than the second threshold. Please refer to Figure 4 , Figure 2 the sub-steps of step S120 in Step S122, when the cache score is higher than the second threshold, obtain the associated results corresponding to the associated subtasks from the output data according to the association relationship between multiple subtasks, and add the input data, inference data, and associated results to the cache pool.
[0062] In an embodiment of the present invention, when the cache score is higher than the second threshold, the cache device adopts a "fine-grained" cache policy. Among them, the association relationship includes a dependency relationship and communication records, which are used to support collaborative reasoning and problem diagnosis. The cache device can also cache the association result in the cache pool for subsequent use.
[0063] As a possible implementation, taking the analysis of e-commerce sales situation (user task) as an example, the "fine-grained" cache policy is elaborated. The multiple subtasks obtained by splitting the user task are respectively retrieving data, traffic index analysis, sales form index analysis, operation index analysis, RFM (Recency, Frequency, Monetary: time of last consumption, consumption frequency, consumption amount) user value stratification analysis, and sales trend report.
[0064] Generate an association relationship according to the functions of the subtasks. The association relationship includes the traffic index obtained by the traffic index analysis depending on the data retrieval subtask, the sales form index obtained by the sales form index analysis depending on the data retrieval subtask, the operation index obtained by the operation index analysis depending on the data retrieval subtask, the user value index obtained by the RFM user value stratification analysis depending on the data retrieval subtask, and the analysis results output by the sales trend report depending on the traffic index analysis subtask, the sales form index analysis subtask, the operation index analysis subtask, and the RFM user value stratification analysis subtask.
[0065] Assume that the subtask is retrieving data. Then, when the cache device adopts the "fine-grained" cache policy, according to the association relationship, obtain the traffic index, sales form index, operation index, and user value index from the output data of the data retrieval subtask as the association result, and use the input data, inference data, and association result of the subtask as cache data and store them in the cache pool.
[0066] It can be seen that the embodiment of the present invention adopts a "fine-grained" cache policy to cache the data with a cache score higher than the second threshold. By combining the association relationships between subtasks, capture the association results relied on by other subtasks in the output data, and store the association results together with the input data and inference data, so that the cache data not only contains the information of a single subtask, but also can reflect the overall characteristics of the entire task network. This semantic enhancement makes the cache data closer to the application requirements of the user task and improves the adaptability to diverse task environments. Since this cache structure significantly reduces the occupancy of cache resources, it can save computing resources and time costs when other subtasks query the cache, thereby improving the efficiency and accuracy of retrieval.
[0067] It should be noted that when the space of the cache pool is limited, in addition to caching the input data, inference data, and output data of the subtasks, the cache device also needs to cache the cache scores synchronously so as to update the cache data using the cache scores. After the cache device generates the cache score corresponding to the context vector, it needs to obtain the total capacity and the used capacity of the cache pool. When the ratio of the used capacity to the total capacity exceeds the capacity threshold, the cache data with a low cache score is removed from the cache pool, and the input data, inference data, and output data of the subtasks being processed with a cache score higher than the first threshold are cached. The embodiments of the present invention dynamically specify and adjust the cache policy in combination with the current context of the user task, including determining the data to be cached, the granularity of the cache data, and the cache eviction policy based on the cache score, etc.
[0068] To ensure that the agent can efficiently utilize the cache data, the embodiments of the present invention implement the function of retrieving the cache data through precise matching, overcoming the problems of fuzzy matching or information redundancy that may exist in the existing cache retrieval.
[0069] Optionally, before the cache device receives the input data, inference data, and output data of the subtasks sent by the task execution device to generate the context vector, it further includes the process of the task execution device querying the cache pool. For how to obtain the dependent data corresponding to the subtasks to be executed from the cache pool, a possible implementation manner is provided below. Please refer to Figure 5 , and this method further includes the following steps: Step S200, when receiving the query instruction sent by the task execution device, generate a query vector according to the step input of the subtask in the query instruction; before the agent executes the subtask, the task execution device determines whether to send the query instruction according to the similarity between the subtask and other subtasks (i.e., the first similarity).
[0070] In the embodiments of the present invention, before the agent executes the subtask, the task execution device calculates the first similarity between the subtasks according to the description information of each subtask. If there are no other subtasks with the first similarity exceeding the similarity threshold, there is no need to query the cache data, and the step input of the subtask is directly determined as the input data of the subtask. The agent executes the subtask based on the input data to obtain the inference data and output data of the subtask.
[0071] If there are other subtasks with the first similarity exceeding the similarity threshold and the other subtasks with the first similarity exceeding the similarity threshold have been executed, use natural language processing techniques (such as entity recognition, relation extraction, intent recognition, etc.) to obtain the step input of the subtask. Generate a query instruction according to the step input of the subtask, and send the query instruction carrying the step input to the cache device.
[0072] Continue with Figure 3For example, after the caching device receives a query instruction, it uses a fetcher to parse the step input of the subtask from the query instruction, and converts the step input of the subtask into a query vector through embedding processing. Whether to generate a query instruction is reasonably determined based on the first similarity between tasks, thus avoiding unnecessary communication overhead and resource waste.
[0073] Step S210: Generate cache vectors corresponding to each data according to the data in the cache pool.
[0074] Step S220: Determine the similar vector corresponding to the query vector from the cache vectors according to the similarity between the query vector and each cache vector.
[0075] In the embodiment of the present invention, the caching device uses a fetcher to transfer the query vector to the cache, so that the cache converts each data in the cache pool into a corresponding cache vector through embedding processing, calculates the similarity between the query vector and each cache vector (i.e., the second similarity), and determines the cache vectors with the second similarity exceeding the matching threshold as the similar vectors corresponding to the query vector.
[0076] It should be noted that both the similarity threshold and the matching threshold are pre-configured and can be adjusted according to the actual application scenario. Methods such as cosine similarity and Euclidean distance can be used to determine the similarity between vectors, and the similarity acquisition method can be selected according to the actual application scenario. The present invention does not limit this.
[0077] Step S230: Determine the dependent data of the subtask according to the similar vector.
[0078] Step S240: Return the dependent data of the subtask to the task execution device, so that the task execution device generates the input data of the subtask according to the step input and the dependent data of the subtask.
[0079] In the embodiment of the present invention, the caching device uses a fetcher to obtain the dependent data related to the subtask through the similar vector. This dependent data is determined based on the matching degree between the query vector and the cache vector, which can ensure that the selected dependent data can accurately reflect the requirements of the subtask. The caching device returns the dependent data of the subtask to the task execution device. After receiving the dependent data of the subtask, the task execution device combines the step input and the dependent data of the subtask to obtain the corresponding input data, and uses an agent to execute the subtask based on the input data to obtain the inference data and output data of the subtask.
[0080] It can be seen that the embodiment of the present invention uses the step input of the subtask and the cached data to calculate the similarity, realizes the accurate positioning of the dependent data required by the subtask, can significantly improve the data preparation efficiency and accuracy of the task execution device when processing the subtask, not only can optimize the task execution process, but also can improve the operation efficiency and intelligent level of the multi-intelligent cooperation caching system.
[0081] Since the caching device uses two caching strategies of "coarse-grained" and "fine-grained" to achieve multi-granularity caching. When the task execution device sends a query instruction of the subtask to the caching device before the agent executes the subtask, it supports the retrieval of cached data with different granularities (coarse-grained or fine-grained). For example, a single data item can be retrieved, or a group of related data items or the complete data items of the entire subtask can be retrieved.
[0082] For the coarse-grained cached data, the summary information in the input data, inference data, and output data corresponding to the completed subtask can be retrieved. For the fine-grained cached data, the input data, inference data, and associated results corresponding to the completed subtask can be retrieved.
[0083] Optionally, for how to determine the dependent data of the subtask, a possible implementation manner is provided below. Figure 5 The sub-steps of step S230 may include: When there is one similarity vector, convert the similarity vector into the dependent data of the subtask; when there are multiple similarity vectors, input each similarity vector and the collaborative task graph into the graph convolutional network, obtain the similarity scores of each similarity vector, and convert the similarity vector with the highest similarity score into the dependent data of the subtask.
[0084] In the embodiment of the present invention, when the caching device retrieves the dependent data corresponding to the subtask, if there is one similarity vector, directly convert the similarity vector into the dependent data of the subtask. If there are multiple similarity vectors, input each similarity vector and the collaborative task graph into the graph convolutional network, and learn the similarity vectors on the collaborative task graph through the graph convolutional network, so that when calculating the similarity scores, not only the similarity vectors themselves are considered, but also the context relationship in the graph is considered, obtain the similarity scores of each similarity vector, and convert the similarity vector with the highest similarity score into the dependent data of the subtask, as Figure 6 shown.
[0085] It can be seen that the embodiments of the present invention adopt a differential processing strategy for different numbers of similar vectors. When there is only one similar vector, the similar vector is directly converted into the dependent data of the subtask, which simplifies the processing flow and improves the retrieval efficiency. When there are multiple similar vectors, the graph convolutional network is used to further analyze, sort, and condense each similar vector to obtain the similarity score of each similar vector, so as to screen out the similar vector most relevant to the subtask to generate the dependent data of the subtask. The rationality and accuracy of the dependent data selection are further enhanced through the scoring mechanism, ensuring the quality of the input data of the subtask, and thus ensuring that the user task is executed efficiently and accurately.
[0086] Optionally, a possible implementation manner for obtaining the cache score of the context vector is provided below. Please refer to Figure 4 , Figure 2 The sub-steps of step S110 in can include: Step S111, generating a feature vector of the agent according to the description information of the agent.
[0087] Step S112, inputting the context vector, the feature vector, and the collaborative task graph into the graph convolutional network to obtain the cache score corresponding to the context vector.
[0088] In the embodiments of the present invention, the cache device converts the description information of the agent into a feature vector through embedding processing, and inputs the context vector, the feature vector, and the collaborative task graph into the graph convolutional network. The graph convolutional network is a neural network for processing graph-structured data. The graph convolutional network is used to learn the context vector, the feature vector of the agent, and the collaborative task graph, so as to obtain the cache score corresponding to the context vector.
[0089] As a possible implementation manner, as shown in Figure 7 , the output layer of the graph convolutional network is designed to predict the cache score of each subtask. The graph convolutional network learns the representation of each node on the collaborative task graph by performing message passing and aggregation on the graph structure of the collaborative task graph. When the cache device receives multiple context vectors and feature vectors related to the same collaborative task graph, the multiple context vectors and feature vectors are used as node features, and the collaborative task graph is input into the graph convolutional network as the graph structure.
[0090] Assume that the collaborative task graph is G, and the node feature is , where n is the number of context vectors, is the kth context vector, is the feature vector corresponding to the kth context vector. The processing process of the graph convolutional network is simply represented as:
[0091]
[0092] Wherein, S is a cache scoring set; is the cache score corresponding to the k-th situation vector, which is used to reflect the cache priority or importance of the situation information of the subtask in the current situation. The higher the score, the more the situation information of the subtask should be cached. When the cache score of the situation vector is higher than the first threshold, the input data, inference data, and output data of the subtask are cached; is a graph convolutional network.
[0093] It can be seen that in the embodiment of the present invention, by quantifying the attributes of the agents into feature vectors, a more accurate reference basis is provided for formulating the cache policy. Combining the situation vector, feature vector, and collaborative task graph enables the graph convolutional network to deeply analyze the relevance between agents in the current task situation and its impact on the overall task, and then realizes more intelligent and accurate cache score calculation, which not only improves the scientificity and rationality of the cache policy, ensures that important data is cached first, but also significantly improves the collaboration efficiency and resource utilization level of multiple agents.
[0094] Based on the same inventive concept, the basic principle and the technical effects generated by the multi-agent collaborative caching device provided by the embodiment of the present invention are the same as those of the above embodiment. For the sake of brief description, for the parts not mentioned in this embodiment, reference may be made to the corresponding content in the above embodiment.
[0095] Please refer to Figure 8 , Figure 8 which is a block diagram of a multi-agent collaborative caching device 300 provided by an embodiment of the present invention. The multi-agent collaborative caching device 300 is applied to a caching device, and the caching device is communicatively connected to at least one task execution device, and at least one agent is provided for each task execution device. The multi-agent collaborative caching device 300 includes a processing module 301, a scoring module 302, and a caching module 303.
[0096] The processing module 301 is configured to generate a situation vector according to the input data, inference data, and output data of the subtask sent by the task execution device; the subtask is obtained by splitting the user task by the task execution device; the inference data represents the inference process of the agent executing the subtask; The scoring module 302 is configured to determine the cache score corresponding to the situation vector according to the situation vector, the feature vector of the agent, and the collaborative task graph; The caching module 303 is configured to cache the input data, inference data, and output data of the subtask when the cache score is higher than the first threshold.
[0097] In summary, the multi-agent collaborative caching device provided by the embodiments of the present invention generates a context vector through the input data, inference data, and output data of subtasks, and can comprehensively capture the key information of the current context during the execution of subtasks. By combining and analyzing the context vector, the feature vector of the agent, and the collaborative task graph, the caching score is determined, thereby implementing a dynamic and flexible caching mechanism to ensure that important data with a high caching score is preferentially cached. By setting a first threshold to intercept unimportant data with a low caching score, the computational and communication overheads are effectively reduced, and the collaborative efficiency and response speed of multi-agents in a complex task environment are improved. This not only improves the utilization rate of caching resources but also enhances the intelligent level of multi-agent collaboration.
[0098] Optionally, the caching module 303 is specifically configured to, when the caching score is higher than the first threshold and not higher than the second threshold, obtain the summary information of the output data, and add the input data, inference data, and summary information to the cache pool.
[0099] Optionally, the caching module 303 is specifically configured to, when the caching score is higher than the second threshold, obtain the associated result corresponding to the associated subtask from the output data according to the association relationship between multiple subtasks, and add the input data, inference data, and associated result to the cache pool.
[0100] Optionally, the processing module 301 is further configured to, when receiving a query instruction sent by the task execution device, generate a query vector according to the step input of the subtask in the query instruction; before the agent executes the subtask, the task execution device determines whether to send a query instruction according to the similarity between the subtask and other subtasks; generate a cache vector corresponding to each data according to the data in the cache pool.
[0101] The scoring module 302 is further configured to determine a similar vector corresponding to the query vector from the cache vectors according to the similarity between the query vector and each cache vector.
[0102] The processing module 301 is further configured to determine the dependent data of the subtask according to the similar vector; return the dependent data of the subtask to the task execution device so that the task execution device can generate the input data of the subtask according to the step input and the dependent data of the subtask.
[0103] Optionally, the processing module 301 is specifically configured to, when the similar vector is one, convert the similar vector into the dependent data of the subtask; when the similar vectors are multiple, input each similar vector and the collaborative task graph into a graph convolutional network to obtain the similarity scores of each similar vector, and convert the similar vector with the highest similarity score into the dependent data of the subtask.
[0104] Optionally, the scoring module 302 is specifically configured to generate a feature vector of the agent according to the description information of the agent; input the situation vector, the feature vector, and the collaborative task graph into a graph convolutional network to obtain a cache score corresponding to the situation vector.
[0105] Please refer to Figure 9 , which is a block diagram of a cache device 100 provided by an embodiment of the present invention. The cache device 100 includes a memory 110, a processor 120, and a communication module 130. Each element of the memory 110, the processor 120, and the communication module 130 is electrically connected directly or indirectly to each other to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines.
[0106] Among them, the memory 110 is used to store programs or data. The memory 110 can be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.
[0107] The processor 120 is used to read / write the data or program stored in the memory 110 and execute corresponding functions. For example, when the computer program stored in the memory 110 is executed by the processor 120, the multi-agent collaborative caching method disclosed in the above embodiments can be implemented.
[0108] The communication module 130 is used to establish a communication connection between the cache device 100 and other communication terminals through a network and is used to send and receive data through the network.
[0109] It should be understood that Figure 9 The structure shown is only a schematic diagram of the structure of the cache device 100, and the cache device 100 may further include more or fewer components than those shown in Figure 9 , or have a different configuration from that shown in Figure 9 . Figure 9 Each component shown in can be implemented by hardware, software, or a combination thereof.
[0110] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor 120, the multi-agent collaborative caching method disclosed in the above embodiments is implemented.
[0111] An embodiment of the present invention further provides a program product. When the program product is executed by a processor 120, the multi-agent collaborative caching method disclosed in the above embodiments is implemented.
[0112] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0113] In addition, in each embodiment of the present invention, the functional modules may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
[0114] If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical disks, etc., which can store program codes.
[0115] The foregoing are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A multi-agent collaborative caching method, characterized in that Applied to a cache device, the cache device is communicatively connected to at least one task execution device, and at least one agent is provided for each task execution device. The method includes: Generating a context vector based on the input data, inference data, and output data of a subtask sent by the task execution device; the subtask is obtained by the task execution device by splitting a user task; the inference data represents the inference process of the agent executing the subtask; Determining a cache score corresponding to the context vector according to the context vector, the feature vector of the agent, and the collaborative task graph; When the cache score is higher than a first threshold, caching the input data, inference data, and output data of the subtask.
2. The multi-agent collaborative caching method according to claim 1, wherein The step of caching the input data, inference data, and output data of the subtask when the cache score is higher than the first threshold includes: When the cache score is higher than the first threshold and not higher than a second threshold, obtaining summary information of the output data, and adding the input data, the inference data, and the summary information to a cache pool.
3. The multi-agent collaborative caching method according to claim 1, wherein The step of caching the input data, inference data, and output data of the subtask when the cache score is higher than the first threshold includes: When the cache score is higher than the second threshold, obtaining an associated result corresponding to an associated subtask from the output data according to the association relationship between multiple subtasks, and adding the input data, the inference data, and the associated result to the cache pool.
4. The multi-agent collaborative caching method according to claim 1, wherein Before generating a context vector based on the input data, inference data, and output data of a subtask sent by the task execution device, the method further includes: When receiving a query instruction sent by the task execution device, generating a query vector according to the step input of the subtask in the query instruction; before the agent executes the subtask, the task execution device determines whether to send a query instruction according to the similarity between the subtask and other subtasks; Generating cache vectors corresponding to each of the data according to the data in the cache pool; Determining a similar vector corresponding to the query vector from the cache vectors according to the similarity between the query vector and each of the cache vectors; Determining the dependent data of the subtask according to the similar vector; Returning the dependent data of the subtask to the task execution device so that the task execution device generates the input data of the subtask according to the step input of the subtask and the dependent data.
5. The multi-agent collaborative caching method according to claim 4, wherein The step of determining the dependent data of the subtask according to the similar vector includes: When the similar vector is one, converting the similar vector into the dependent data of the subtask; When the similar vector is multiple, inputting each of the similar vectors and the collaborative task graph into a graph convolutional network to obtain a similarity score for each of the similar vectors, and converting the similar vector with the highest similarity score into the dependent data of the subtask.
6. The multi-agent collaborative caching method according to claim 1, wherein The step of determining a cache score corresponding to the context vector according to the context vector, the feature vector of the agent, and the collaborative task graph includes: Generating a feature vector of the agent according to the description information of the agent; Input the situation vector, the feature vector, and the collaborative task graph into a graph convolutional network to obtain the cache score corresponding to the situation vector.
7. A multi-agent collaborative caching device, characterized in that, Applied to a cache device, the cache device is communicatively connected to at least one task execution device, and at least one agent is set in each task execution device. The apparatus includes: A processing module, configured to generate a situation vector according to the input data, inference data, and output data of a subtask sent by the task execution device; the subtask is obtained by the task execution device based on splitting a user task; the inference data represents the inference process of the agent executing the subtask. A scoring module, configured to determine the cache score corresponding to the situation vector according to the situation vector, the feature vector of the agent, and the collaborative task graph. A caching module, configured to cache the input data, inference data, and output data of the subtask when the cache score is higher than a first threshold.
8. A cache device, characterized in that, Comprising a processor and a memory, the memory stores a computer program that can be executed by the processor, and the processor can execute the computer program to implement the multi-agent collaborative caching method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the multi-agent collaborative caching method according to any one of claims 1-6.
10. A program product, characterized in that, When the program product is executed by the processor, it implements the multi-agent collaborative caching method according to any one of claims 1-6.
Citation Information
Patent Citations
Railway BIM data edge caching method based on multi-agent reinforcement learning
CN117473616A
Resource caching method and system based on multi-agent reinforcement learning
CN119766881A
Collaborative task offloading and service caching method based on graph attention multi-agent reinforcement learning
WO2025050608A1