Multi-tenant vector cache replacement policy optimization method based on graph neural network
Patent Information
- Application Number
- CN202610332924.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-18
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2046-03-18
AI Technical Summary
[0005]为此,本发明提供一种基于图神经网络的多租户向量缓存替换策略优化方法,用以克服现有技术中未能有效捕获租户间复杂的关联性与向量数据间的结构特征,在动态多变的负载下难以精准、实时地做出最优驱逐决策,从而影响了整体缓存性能与资源利用效率的问题
[0016] Compared with the prior art, the beneficial effects of the present invention are that the multi-tenant vector cache replacement strategy optimization method based on graph neural network is to accurately model the complex multi-tenant access patterns and the correlation between vector data into a heterogeneous graph, and to dynamically learn the importance of nodes using graph attention mechanism. This effectively overcomes the limitations of traditional strategies that are difficult to adapt to tenant heterogeneity, ignore data correlation, and cannot capture dynamic temporal patterns. It can significantly improve the overall cache hit rate and system throughput performance of vector database while ensuring the service quality of high-priority tenants, and realize intelligent and refined efficient management of cache resources in multi-tenant environment.
Smart Images

Figure CN122262185B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graph neural network technology, and in particular to an optimization method for multi-tenant vector cache replacement strategy based on graph neural networks. Background Technology
[0002] With the rapid development of artificial intelligence and big data technologies, vector databases, as the core infrastructure for processing high-dimensional vector data (such as embedded representations of images, text, and speech), play a crucial role in application scenarios such as multimodal retrieval, recommendation systems, and large model enhancement. In a multi-tenant cloud service environment, multiple tenants (such as different enterprises, applications, or users) share the same vector database instance and its physical resources, including memory caching. Caching, as a key acceleration layer for database performance, directly determines the overall throughput and response latency of the system through its replacement strategy.
[0003] Chinese Patent Application No. CN202310348266.4 discloses a method for detecting tenants using inefficient cache space based on machine learning. The method includes the following steps: collecting tenant cache information, and then performing vectorization and normalization processing on the tenant cache information to obtain multiple feature vectors corresponding to the tenant. The obtained feature vectors are then input into a pre-trained machine learning model to obtain the detection results for the tenant. This invention addresses the technical problems of existing static detection techniques, such as low accuracy after tenant access patterns change and unsuitability for dynamically changing workloads in cloud environments; existing dynamic detection techniques, such as the time-consuming construction of missing rate curves limiting their applicability to real-time detection scenarios in cloud environments; and the high overhead of dynamic detection techniques when the number of tenants is large.
[0004] However, existing technologies still have the following problems: The system failed to effectively capture the complex relationships between tenants and the structural characteristics between vector data, making it difficult to make accurate and real-time optimal eviction decisions under dynamic and varied loads, thus affecting overall cache performance and resource utilization efficiency. Summary of the Invention
[0005] To address this issue, the present invention provides a multi-tenant vector cache replacement strategy optimization method based on graph neural networks. This method overcomes the problem in existing technologies that fail to effectively capture the complex relationships between tenants and the structural features between vector data, making it difficult to make accurate and real-time optimal eviction decisions under dynamic and varied loads, thus affecting overall cache performance and resource utilization efficiency.
[0006] To achieve the above objectives, this invention provides a method for optimizing multi-tenant vector cache replacement strategies based on graph neural networks. It includes: Step S1: Real-time collection of cached access trajectory data and related metadata of the multi-tenant vector database; Step S2: Based on the cache access trajectory data and related metadata, construct a multi-tenant cache access heterogeneous graph; Step S3: Input the multi-tenant cache access heterogeneous graph into the graph neural network model, and determine the importance of each vector data node in the multi-tenant cache access heterogeneous graph through the attention aggregation mechanism; Step S4: Based on the importance of each vector data node in the heterogeneous graph of multi-tenant cache access, and in combination with the current cache occupancy capacity and the preset cache occupancy capacity threshold, determine one or more vector data nodes that need to be evicted. Step S5: Remove the vector data corresponding to the vector data node that needs to be evicted from the physical cache.
[0007] Further, in step S2, constructing a multi-tenant cache access heterogeneous graph based on the cache access trajectory data and related metadata includes: Step S21: Based on the relevant metadata, create a tenant node for each unique tenant, create a vector data node for each accessed vector data object, and create a query request node for each query request record, and extract the feature vectors corresponding to each node; Step S22: Based on the cached access trajectory data, establish an access edge between the query request node and the vector data node it accesses, establish a co-occurrence edge between pairs of vector data nodes that are accessed in the same query, and establish a belonging edge between the vector data node or query request node and its tenant node. Step S23: Based on the cache access trajectory data, assign weights to each edge and construct an initial multi-tenant cache access heterogeneous graph; Step S24: Supplement each vector data node in the initial multi-tenant cache access heterogeneous graph with a time-series access feature vector to generate a multi-tenant cache access heterogeneous graph.
[0008] Further, in step S23, the step of assigning weights to each edge based on the cache access trajectory data and constructing an initial multi-tenant cache access heterogeneous graph includes: For each access edge, extract the frequency and time characteristics of the query request node connected to the edge accessing its corresponding vector data node from the cached access trajectory data, and determine the weight of the access edge based on the frequency and time characteristics. For each co-occurrence edge, the number of times the two vector data nodes connected by the edge are accessed in the same query request and the co-occurrence time feature are statistically analyzed from the cached access trajectory data. The weight of the co-occurrence edge is determined based on the number of times and the co-occurrence time feature. For each belonging edge, the historical access pattern features of the tenant nodes connected to the edge are aggregated from the cached access trajectory data, and the metadata information of the tenant nodes is associated with them. The weight of the belonging edge is determined based on the historical access pattern features and the metadata information.
[0009] Further, in step S24, a time-series access feature vector is added to each vector data node in the initial multi-tenant cache access heterogeneous graph to generate a multi-tenant cache access heterogeneous graph, including: Step S241: For each vector data node in the initial multi-tenant cache access heterogeneous graph, extract the historical access sequence of the vector data node within a preset time window from the cache access trajectory data; Step S242: Encode the historical access sequence to generate a time-series access feature vector; Step S243: The generated time-series access feature vector is fused with the existing feature vector of the vector data node to update the feature vector of the vector data node and generate a multi-tenant cache access heterogeneous graph.
[0010] Further, in step S243, the process of fusing the generated temporal access feature vector with the existing feature vector of the vector data node to update the feature vector of the vector data node and generate a multi-tenant cache access heterogeneous graph includes: Obtain the existing static feature vectors of the vector data nodes; The temporal access feature vector is concatenated with the static feature vector to form an extended feature vector; The extended feature vector is input into a fully connected neural network layer for dimensionality reduction and feature fusion to generate the final fused feature vector of the vector data node. The original feature vector of the vector data node is replaced with the final fused feature vector, which is then used as its node feature vector in the multi-tenant cache access heterogeneous graph. After updating the feature vectors of all vector data nodes, all updated vector data nodes and their feature vectors, as well as all types of edges and their weights, are combined to construct a multi-tenant cache access heterogeneous graph.
[0011] Further, in step S3, the step of inputting the multi-tenant cache access heterogeneous graph into a graph neural network model and determining the importance of each vector data node in the multi-tenant cache access heterogeneous graph through an attention aggregation mechanism includes: The feature vectors of each vector data node in the heterogeneous graph accessed by the multi-tenant cache are input into the first layer of the graph neural network model. For the feature vector of a single vector data node, perform the following steps: In each layer of the graph neural network model, for a single vector data node, the attention coefficient between the vector data node and all its neighboring vector data nodes is determined through an attention mechanism. In each layer, based on the attention coefficient, the feature vectors of all neighboring vector data nodes of the vector data node in the current layer are weighted and summed to obtain the aggregated feature vector of the vector data node. In each layer, the aggregated feature vector of the vector data node is processed by a non-linear activation function and layer normalization to generate the feature vector of the vector data node in the next layer. The feature vector of the vector data node output from the last layer is input into a prediction layer to generate the importance of the vector data node.
[0012] Furthermore, in each layer of the graph neural network model, for a single vector data node, the attention coefficients between the vector data node and all its neighboring vector data nodes are determined through an attention mechanism, including: For each vector data node in the current layer, its feature vector is concatenated with the feature vectors of each of its neighboring vector data nodes to obtain the original association score; The original association scores are transformed nonlinearly to obtain normalized attention coefficients.
[0013] Furthermore, the step of inputting the feature vector of the vector data node output from the last layer into a prediction layer to generate the importance of the vector data node includes: The feature vector of each vector data node output from the last layer is input into the prediction layer, which consists of one or more fully connected neural network layers. In the prediction layer, the input feature vector is subjected to a nonlinear transformation, mapping it to a scalar fraction; The scalar score is used as the significance of the vector data node.
[0014] Further, in step S4, determining one or more vector data nodes that need to be evicted based on the importance of each vector data node in the heterogeneous graph of the multi-tenant cache access, combined with the current cache usage capacity and a preset cache usage capacity threshold, includes: Step S41: Sort the vector data nodes in ascending order according to their importance to generate a candidate expulsion sequence; Step S42: Starting from the beginning position of the candidate eviction sequence, the current cache occupancy capacity of the vector data corresponding to each vector data node is sequentially accumulated; Step S43: When the accumulated current cache usage exceeds the preset cache usage threshold, all currently accumulated vector data nodes are identified as vector data nodes that need to be evicted.
[0015] Further, in step S5, removing the vector data corresponding to the vector data node to be evicted from the physical cache includes: Obtain the unique identifier of each vector data node that needs to be evicted and its storage location information in the physical cache; Based on the unique identifier and the storage location information, the vector data corresponding to each vector data node that needs to be evicted is deleted from its physical cache area, and the storage space it occupies is released.
[0016] Compared with the prior art, the beneficial effects of the present invention are that the multi-tenant vector cache replacement strategy optimization method based on graph neural network is to accurately model the complex multi-tenant access patterns and the correlation between vector data into a heterogeneous graph, and to dynamically learn the importance of nodes using graph attention mechanism. This effectively overcomes the limitations of traditional strategies that are difficult to adapt to tenant heterogeneity, ignore data correlation, and cannot capture dynamic temporal patterns. It can significantly improve the overall cache hit rate and system throughput performance of vector database while ensuring the service quality of high-priority tenants, and realize intelligent and refined efficient management of cache resources in multi-tenant environment.
[0017] Furthermore, this invention models the complex access patterns and data relationships in a multi-tenant vector database as a heterogeneous graph containing tenant nodes, query request nodes, vector data nodes, and various semantic edges (access edges, co-occurrence edges, and belonging edges). It innovatively assigns dynamic weights to each edge in the graph based on frequency, time, and metadata, and integrates temporal access features into the vector data nodes. Then, it uses a graph attention network model to dynamically learn and accurately evaluate the importance of each vector data node in future access, thereby intelligently prioritizing the eviction of low-importance nodes when cache space is insufficient. This achieves intelligent cache replacement that comprehensively considers tenant priority, data correlation, and access dynamics in a multi-tenant environment, significantly improving cache hit rate and overall system performance.
[0018] Furthermore, this invention constructs a heterogeneous graph that accurately characterizes the correlation between multi-tenant access patterns and vector data, and utilizes the multi-layer attention aggregation mechanism of graph attention networks to dynamically fuse the node's own characteristics with the topological and semantic information of its higher-order neighbors. This enables the intelligent and accurate evaluation of the future access value of each vector data node by comprehensively considering multi-dimensional factors such as tenant priority, data co-occurrence relationships, and temporal access patterns. This achieves a cache replacement strategy that can adapt to the complex dynamic load of multi-tenants, significantly improving the cache hit rate and overall service performance of the vector database.
[0019] Furthermore, this invention constructs a heterogeneous graph that integrates multi-tenant metadata, access associations, and temporal features, and utilizes a graph attention network to dynamically aggregate high-order neighbor information to accurately assess node importance. This enables intelligent cache replacement decisions that comprehensively consider tenant priority, data semantic associations, and dynamic access patterns in a multi-tenant vector database environment, thereby significantly improving cache hit rate and overall system performance.
[0020] Furthermore, this invention constructs and utilizes a heterogeneous graph that integrates multi-tenant attributes, data correlation, and dynamic access timing. It applies a graph attention network to learn and rank the global importance of vector data nodes, and intelligently selects the data combination with the least impact on the overall cache value for eviction. This achieves precise optimization that balances cache space efficiency and data access performance in a multi-tenant environment, significantly improving the cache hit rate and system response performance of the vector database in high-concurrency and dynamic load scenarios. Attached Figure Description
[0021] Figure 1 This is a flowchart illustrating the workflow of the multi-tenant vector cache replacement strategy optimization method based on graph neural networks of the present invention. Figure 2 This is a flowchart illustrating the process of constructing a heterogeneous graph for multi-tenant cache access in the multi-tenant vector cache replacement strategy optimization method based on graph neural networks of the present invention. Detailed Implementation
[0022] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.
[0023] It should be noted that the data in this embodiment are all derived from a comprehensive analysis and evaluation of historical data from the six months prior to this determination and the corresponding historical determination results by the system described in this invention. Those skilled in the art will understand that the system described in this invention can determine the above-mentioned parameters for a single item by selecting the value with the highest proportion based on the data distribution as the preset standard parameter, using weighted summation to obtain the value as the preset standard parameter, substituting each historical data point into a specific formula and using the value obtained by that formula as the preset standard parameter, or other selection methods, as long as the system described in this invention can clearly define different specific situations in the single-item determination process through the obtained values.
[0024] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0025] Furthermore, it should be noted that, in the description of this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0026] Please see Figures 1-2 As shown, Figure 1 This is a flowchart illustrating the workflow of the multi-tenant vector cache replacement strategy optimization method based on graph neural networks of the present invention. Figure 2 This is a flowchart illustrating the process of constructing a heterogeneous graph for multi-tenant cache access in the multi-tenant vector cache replacement strategy optimization method based on graph neural networks of the present invention.
[0027] The multi-tenant vector cache replacement strategy optimization method based on graph neural networks provided in this embodiment includes: Step S1: Real-time collection of cached access trajectory data and related metadata of the multi-tenant vector database; Step S2: Based on the cache access trajectory data and related metadata, construct a multi-tenant cache access heterogeneous graph; Step S3: Input the multi-tenant cache access heterogeneous graph into the graph neural network model, and determine the importance of each vector data node in the multi-tenant cache access heterogeneous graph through the attention aggregation mechanism; Step S4: Based on the importance of each vector data node in the heterogeneous graph of multi-tenant cache access, and in combination with the current cache occupancy capacity and the preset cache occupancy capacity threshold, determine one or more vector data nodes that need to be evicted. Step S5: Remove the vector data corresponding to the vector data node that needs to be evicted from the physical cache.
[0028] In this embodiment of the invention, the cache access trajectory data includes, but is not limited to, the unique identifier of the query request, the tenant identifier that initiated the query, the timestamp of the query request, and the list of identifiers of the vector data objects accessed by the query request; the relevant metadata includes, but is not limited to, tenant metadata: tenant identifier, tenant service level agreement (SLA) level (e.g., basic version, advanced version), tenant priority, historical average access frequency, billing information; vector data object metadata: unique identifier of the vector data object, the collection or namespace to which it belongs; vector dimension, vector data size, creation time, last modification time, associated tags or metadata; system metadata: current total cache capacity, used capacity, cache shard information, system load indicators (e.g., CPU, memory usage).
[0029] Specifically, in step S2, constructing a multi-tenant cache access heterogeneous graph based on the cache access trajectory data and related metadata includes: Step S21: Based on the relevant metadata, create a tenant node for each unique tenant, create a vector data node for each accessed vector data object, and create a query request node for each query request record, and extract the feature vectors corresponding to each node; Step S22: Based on the cached access trajectory data, establish an access edge between the query request node and the vector data node it accesses, establish a co-occurrence edge between pairs of vector data nodes that are accessed in the same query, and establish a belonging edge between the vector data node or query request node and its tenant node. Step S23: Based on the cache access trajectory data, assign weights to each edge and construct an initial multi-tenant cache access heterogeneous graph; Step S24: Supplement each vector data node in the initial multi-tenant cache access heterogeneous graph with a time-series access feature vector to generate a multi-tenant cache access heterogeneous graph.
[0030] In this embodiment of the invention, two tenant nodes are created for "Tenant A" and "Tenant B" respectively, based on the tenant metadata. The feature vectors of the tenant nodes can be extracted from their metadata. For example, for Tenant A, its features may include high priority, enterprise customer category, and high average monthly access frequency; for Tenant B, they may include standard priority, individual category, and lower average monthly access frequency. Assuming that in a certain query request, vector data objects "Vector 1", "Vector 2", and "Vector 3" are accessed, three vector data nodes are created for these three vector data objects respectively. The feature vector of each node can be extracted from its metadata, such as data size, set to which it belongs, creation time, etc. A query request node is created for this specific query request record. The feature vector of this node may include the timestamp of the query initiation, query type (such as approximate nearest neighbor search), number of requested vectors, etc.
[0031] In this embodiment of the invention, edge weights are assigned as follows: For each access edge, the weight is determined based on the frequency and recentity of access to the vector by its corresponding query; the more frequent and recent the access, the higher the weight. For each co-occurrence edge, the weight is determined based on the number of times the two connected vectors are accessed together and the most recent co-occurrence time; the more frequent and recent the co-occurrence, the higher the weight. For each belonging edge, the weight is determined based on metadata such as the historical access activity and priority of the connected tenant; the more active and higher the priority of the tenant, the higher the weight of its belonging edge. This constructs a weighted initial multi-tenant cache access heterogeneous graph. Temporal features are supplemented: For each vector data node in the initial graph, a recent access sequence is extracted from its access history, and a temporal access feature vector is generated through encoding. This temporal access feature vector is then fused with the node's static feature vector to update the node features, thereby ultimately generating a multi-tenant cache access heterogeneous graph that integrates static attributes and dynamic behavior patterns.
[0032] This invention presents a multi-tenant vector cache replacement strategy optimization method based on graph neural networks. By accurately modeling the complex multi-tenant access patterns and the relationships between vector data into a heterogeneous graph, and using graph attention mechanisms to dynamically learn node importance, it effectively overcomes the limitations of traditional strategies that are difficult to adapt to tenant heterogeneity, ignore data relationships, and fail to capture dynamic temporal patterns. While ensuring the service quality of high-priority tenants, it can significantly improve the overall cache hit rate and system throughput performance of the vector database, realizing intelligent, refined, and efficient management of cache resources in a multi-tenant environment.
[0033] Specifically, in step S23, the step of assigning weights to each edge based on the cache access trajectory data and constructing an initial multi-tenant cache access heterogeneous graph includes: For each access edge, extract the frequency and time characteristics of the query request node connected to the edge accessing its corresponding vector data node from the cached access trajectory data, and determine the weight of the access edge based on the frequency and time characteristics. For each co-occurrence edge, the number of times the two vector data nodes connected by the edge are accessed in the same query request and the co-occurrence time feature are statistically analyzed from the cached access trajectory data. The weight of the co-occurrence edge is determined based on the number of times and the co-occurrence time feature. For each belonging edge, the historical access pattern features of the tenant nodes connected to the edge are aggregated from the cached access trajectory data, and the metadata information of the tenant nodes is associated with them. The weight of the belonging edge is determined based on the historical access pattern features and the metadata information.
[0034] In this embodiment of the invention, the determination of the weight of the access edge can be specifically reflected as follows: if the query request node "Search Request 1" frequently accesses the vector data node "Vector 1" recently, and the most recent access occurred just a few minutes ago, then the weight of the access edge between "Search Request 1" and "Vector 1" will be calculated to be higher; conversely, if the access is sparse or the last access occurred a long time ago, the weight will be lower; the weight of the access edge can be specifically calculated by multiplying the access frequency by a time decay factor, for example: weight = number of accesses × e^(-Δt / T), where Δt is the interval between the current time and the most recent access time, and T is the decay constant.
[0035] In this embodiment of the invention, the determination of the weight of co-occurrence edges can be specifically reflected as follows: if vector data nodes "vector one" and "vector two" are retrieved together a very large number of times in historical queries, and their most recent co-occurrence occurred in the previous batch of queries, then the weight of the co-occurrence edge between them will be set to be high, reflecting their strong correlation; if they are rarely or never jointly requested in the same query, then the weight will be extremely low or zero; the weight of the co-occurrence edge can be similarly determined by multiplying the number of co-occurrences by a time decay factor based on the most recent co-occurrence time. The determination of the weight of the belonging edge can be specifically reflected as follows: For the belonging edge connecting to the high-priority tenant "Tenant A", since this tenant has a high historical access activity, a large number of requests, and a high Service Level Agreement (SLA) priority, its belonging edge weight will be assigned a higher base value or calculated to reflect the importance of its data in caching decisions; while for the belonging edge connecting to the low-activity, low-priority tenant "Tenant B", its weight will be correspondingly lower; the weight of the belonging edge can be generated based on the tenant node's feature vector (such as priority, total historical access) through a learnable linear transformation or a predefined mapping function (such as the higher the priority, the higher the base weight).
[0036] Specifically, in step S24, a time-series access feature vector is added to each vector data node in the initial multi-tenant cache access heterogeneous graph to generate a multi-tenant cache access heterogeneous graph, including: Step S241: For each vector data node in the initial multi-tenant cache access heterogeneous graph, extract the historical access sequence of the vector data node within a preset time window from the cache access trajectory data; Step S242: Encode the historical access sequence to generate a time-series access feature vector; Step S243: The generated time-series access feature vector is fused with the existing feature vector of the vector data node to update the feature vector of the vector data node and generate a multi-tenant cache access heterogeneous graph.
[0037] In this embodiment of the invention, the preset time window can be dynamically configured according to system load and business characteristics, for example, set to the most recent hour. For the vector data node "Vector 1", the timestamp sequence of its access within the time window is extracted from its cache access trajectory, for example [10:05, 10:20, 10:55]. A recurrent neural network (e.g., a long short-term memory network) or a self-attention mechanism is used to encode this time sequence. The network learns the access interval, frequency change, and other patterns in the sequence, and outputs a dense vector of fixed dimension as the time sequence access feature vector of "Vector 1", which represents its dynamic access pattern within the recent window. This time sequence access feature vector is concatenated with the existing feature vector of the "Vector 1" node (such as static features such as size and creation time), and then nonlinearly fused and dimensionality reduced through a fully connected layer to generate the updated final feature vector of "Vector 1". This process is executed in parallel for all vector data nodes, thereby generating a multi-tenant cache access heterogeneous graph that integrates static attributes and dynamic time sequence behavior.
[0038] Specifically, in step S243, fusing the generated temporal access feature vector with the existing feature vector of the vector data node to update the feature vector of the vector data node and generate a multi-tenant cache access heterogeneous graph includes: Obtain the existing static feature vectors of the vector data nodes; The temporal access feature vector is concatenated with the static feature vector to form an extended feature vector; The extended feature vector is input into a fully connected neural network layer for dimensionality reduction and feature fusion to generate the final fused feature vector of the vector data node. The original feature vector of the vector data node is replaced with the final fused feature vector, which is then used as its node feature vector in the multi-tenant cache access heterogeneous graph. After updating the feature vectors of all vector data nodes, all updated vector data nodes and their feature vectors, as well as all types of edges and their weights, are combined to construct a multi-tenant cache access heterogeneous graph.
[0039] In this embodiment of the invention, for the vector data node "Vector 1", its static feature vector already contains attributes such as its data size and the set it belongs to. Assume its temporal access feature vector is obtained by encoding a recent access sequence, for example, a 16-dimensional vector. These two vectors are directly concatenated to form a higher-dimensional extended feature vector. This extended feature vector is input into a pre-defined fully connected neural network layer (e.g., a layer with 32 neurons and a ReLU activation function). This layer automatically learns how to effectively fuse static attributes with dynamic temporal patterns and outputs a final 32-dimensional fused feature vector. Subsequently, this final fused feature vector replaces the original feature vector of the "Vector 1" node in the graph. After processing all vector data nodes in the graph in this way, a graph structure with updated node features is obtained. Combined with weighted edges (access edges, co-occurrence edges, and belonging edges), a multi-tenant cache access heterogeneous graph is finally constructed for input to subsequent graph neural network models.
[0040] This invention models the complex access patterns and data relationships in a multi-tenant vector database as a heterogeneous graph containing tenant nodes, query request nodes, vector data nodes, and various semantic edges (access edges, co-occurrence edges, and belonging edges). It innovatively assigns dynamic weights to each edge in the graph based on frequency, time, and metadata, and integrates temporal access features into the vector data nodes. Then, it uses a graph attention network model to dynamically learn and accurately evaluate the importance of each vector data node in future access, so as to intelligently prioritize the eviction of low-importance nodes when cache space is insufficient. This achieves intelligent cache replacement that comprehensively considers tenant priority, data correlation, and access dynamics in a multi-tenant environment, significantly improving cache hit rate and overall system performance.
[0041] Specifically, in step S3, the step of inputting the multi-tenant cache access heterogeneous graph into a graph neural network model and determining the importance of each vector data node in the multi-tenant cache access heterogeneous graph through an attention aggregation mechanism includes: The feature vectors of each vector data node in the heterogeneous graph accessed by the multi-tenant cache are input into the first layer of the graph neural network model. For the feature vector of a single vector data node, perform the following steps: In each layer of the graph neural network model, for a single vector data node, the attention coefficient between the vector data node and all its neighboring vector data nodes is determined through an attention mechanism. In each layer, based on the attention coefficient, the feature vectors of all neighboring vector data nodes of the vector data node in the current layer are weighted and summed to obtain the aggregated feature vector of the vector data node. In each layer, the aggregated feature vector of the vector data node is processed by a non-linear activation function and layer normalization to generate the feature vector of the vector data node in the next layer. The feature vector of the vector data node output from the last layer is input into a prediction layer to generate the importance of the vector data node.
[0042] In this embodiment of the invention, it is assumed that the graph neural network model comprises two layers. For a vector data node "vector one", in the first layer, the model calculates the attention coefficient between "vector one" and each of its neighboring vector data nodes (e.g., "vector two" and "vector three" connected by co-occurrence edges). This attention coefficient reflects the relative importance of the features of each neighboring node when calculating new features of "vector one". Subsequently, the feature vectors of each neighboring node in the first layer are weighted and summed according to the calculated attention coefficients to obtain the aggregated feature vector of "vector one" in the first layer. This aggregated feature vector, after being processed by the ReLU activation function and layer normalization, serves as the input feature vector of "vector one" in the second layer. In the second layer, the above attention aggregation process is repeated, but at this time, the features of the neighboring nodes of "vector one" have been updated by the first layer and contain first-order neighbor information. Finally, the feature vector of "vector one" output from the second layer is input to a prediction layer (e.g., a fully connected layer), which maps it to a scalar score, which is then used to determine the importance of "vector one" in the current graph context. All vector data nodes are processed in parallel according to this process to obtain a global importance assessment.
[0043] This invention constructs a heterogeneous graph that accurately characterizes the correlation between multi-tenant access patterns and vector data. By utilizing the multi-layer attention aggregation mechanism of graph attention networks, it dynamically fuses the topological and semantic information of nodes with their own characteristics and higher-order neighbors. This allows for a comprehensive consideration of multi-dimensional factors such as tenant priority, data co-occurrence relationships, and temporal access patterns, and intelligently and accurately evaluates the future access value of each vector data node. This results in a cache replacement strategy that can adapt to the complex dynamic load of multi-tenants, significantly improving the cache hit rate and overall service performance of the vector database.
[0044] Specifically, in each layer of the graph neural network model, for a single vector data node, the attention coefficients between the vector data node and all its neighboring vector data nodes are determined through an attention mechanism, including: For each vector data node in the current layer, its feature vector is concatenated with the feature vectors of each of its neighboring vector data nodes to obtain the original association score; The original association scores are transformed nonlinearly to obtain normalized attention coefficients.
[0045] Specifically, the step of inputting the feature vector of the vector data node output from the last layer into a prediction layer to generate the importance of the vector data node includes: The feature vector of each vector data node output from the last layer is input into the prediction layer, which consists of one or more fully connected neural network layers. In the prediction layer, the input feature vector is subjected to a nonlinear transformation, mapping it to a scalar fraction; The scalar score is used as the significance of the vector data node.
[0046] In this embodiment of the invention, when calculating the attention coefficient between vector data nodes "Vector 1" and "Vector 2" in the first layer, the current feature vector of "Vector 1" is concatenated with the current feature vector of "Vector 2" to obtain a combined vector. This combined vector is input into a shared fully connected layer (and possibly through a LeakyReLU activation function) to generate a raw association score. Similarly, the raw association scores between "Vector 1" and all its neighbors (such as "Vector 2" and "Vector 3") are calculated. Subsequently, these raw association scores are normalized using the Softmax function so that the sum of the attention coefficients of all neighbors is 1, thus obtaining the final normalized attention coefficients. These coefficients quantify the contribution of each neighbor to "Vector 1" when aggregating neighbor information. In the prediction layer, the feature vector of "Vector 1" output from the second layer is input into a prediction network consisting of two fully connected layers. The first fully connected layer performs a nonlinear transformation to extract deep features, and the second fully connected layer (usually a single neuron output) maps the features to a specific scalar score. This score represents the importance of "vector one" predicted by the model. The higher the score, the greater the likelihood that the vector data node will be accessed in the future, and therefore the higher its value in the cache.
[0047] This invention constructs a heterogeneous graph that integrates multi-tenant metadata, access associations, and temporal features, and uses graph attention networks to dynamically aggregate high-order neighbor information to accurately assess node importance. This enables intelligent cache replacement decisions in a multi-tenant vector database environment that comprehensively consider tenant priority, data semantic associations, and dynamic access patterns, thereby significantly improving cache hit rate and overall system performance.
[0048] Specifically, in step S4, determining one or more vector data nodes that need to be evicted based on the importance of each vector data node in the multi-tenant cache access heterogeneous graph, combined with the current cache usage capacity and a preset cache usage capacity threshold, includes: Step S41: Sort the vector data nodes in ascending order according to their importance to generate a candidate expulsion sequence; Step S42: Starting from the beginning position of the candidate eviction sequence, the current cache occupancy capacity of the vector data corresponding to each vector data node is sequentially accumulated; Step S43: When the accumulated current cache usage exceeds the preset cache usage threshold, all currently accumulated vector data nodes are identified as vector data nodes that need to be evicted.
[0049] In this embodiment of the invention, it is assumed that the current cache is nearly full, and the preset cache occupancy threshold is 100MB of space that needs to be freed. First, the system sorts all vector data nodes in the cache according to the importance scores calculated by the graph neural network model, generating a candidate eviction sequence arranged from low to high importance. For example, the sequence is: [vector C (score 0.1, size 30MB), vector B (score 0.3, size 40MB), vector A (score 0.8, size 50MB), ...]. Then, starting from the beginning of the sequence (i.e., the node with the lowest importance), its occupied space is accumulated: first, 30MB of vector C is accumulated, which does not reach the 100MB threshold; then 40MB of vector B is accumulated, totaling 70MB, which still does not reach the threshold; continuing to accumulate 50MB of vector A, the total reaches 120MB, which exceeds the preset 100MB threshold. Therefore, the system determines the currently accumulated vectors C, B, and A as the vector data nodes that need to be evicted this time. In this way, the system can prioritize evicting the least important data while ensuring sufficient cache space is freed, thereby maximizing the overall value of the remaining data in the cache under space constraints.
[0050] This invention constructs and utilizes a heterogeneous graph that integrates multi-tenant attributes, data correlation, and dynamic access timing. It applies a graph attention network to learn and rank the global importance of vector data nodes, and intelligently selects the data combination with the least impact on the overall cache value for eviction. This achieves precise optimization that balances cache space efficiency and data access performance in a multi-tenant environment, significantly improving the cache hit rate and system response performance of the vector database in high-concurrency and dynamic load scenarios.
[0051] Specifically, in step S5, removing the vector data corresponding to the vector data node to be evicted from the physical cache includes: Obtain the unique identifier of each vector data node that needs to be evicted and its storage location information in the physical cache; Based on the unique identifier and the storage location information, the vector data corresponding to each vector data node that needs to be evicted is deleted from its physical cache area, and the storage space it occupies is released.
[0052] In this embodiment of the invention, after identifying the vector data nodes to be evicted (e.g., vector C, vector B, and vector A), the system first obtains the unique identifiers (e.g., "vec_C_id", "vec_B_id", "vec_A_id") and their specific storage addresses or locations in physical memory or cache devices based on the cache metadata index. Then, based on the identifiers and location information, the system accurately locates the storage block of each vector data in the physical cache and performs a deletion operation. For example, the data for vector C stored in memory address block "block_001" is cleared, and this memory area is marked as free and available; similarly, the data for vectors B and A stored in "block_005" and "block_009" are cleared. This process simultaneously releases the storage space occupied by these vector data (a total of 120MB), reducing the cache occupancy rate to a safe level. Finally, the system updates the cache metadata index, removes the entries for the deleted vectors, ensuring that subsequent queries will not mistakenly point to expired cache data, thereby completing this cache replacement operation and freeing up space for new data.
[0053] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.
[0054] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for optimizing multi-tenant vector cache replacement strategies based on graph neural networks, characterized in that, include: Step S1: Real-time collection of cached access trajectory data and related metadata of the multi-tenant vector database; Step S2: Based on the cache access trajectory data and related metadata, construct a multi-tenant cache access heterogeneous graph; Step S3: Input the multi-tenant cache access heterogeneous graph into the graph neural network model, and determine the importance of each vector data node in the multi-tenant cache access heterogeneous graph through the attention aggregation mechanism; Step S4: Based on the importance of each vector data node in the heterogeneous graph of multi-tenant cache access, and in combination with the current cache occupancy capacity and the preset cache occupancy capacity threshold, determine one or more vector data nodes that need to be evicted. Step S5: Remove the vector data corresponding to the vector data node that needs to be evicted from the physical cache; In step S2, constructing a multi-tenant cache access heterogeneous graph based on the cache access trajectory data and related metadata includes: Step S21: Based on the relevant metadata, create a tenant node for each unique tenant, create a vector data node for each accessed vector data object, and create a query request node for each query request record, and extract the feature vectors corresponding to each node; Step S22: Based on the cached access trajectory data, establish an access edge between the query request node and the vector data node it accesses, establish a co-occurrence edge between pairs of vector data nodes that are accessed in the same query, and establish a belonging edge between the vector data node or query request node and its tenant node. Step S23: Based on the cache access trajectory data, assign weights to each edge and construct an initial multi-tenant cache access heterogeneous graph; Step S24: Supplement each vector data node in the initial multi-tenant cache access heterogeneous graph with a time-series access feature vector to generate a multi-tenant cache access heterogeneous graph; In step S23, the step of assigning weights to each edge based on the cache access trajectory data and constructing an initial multi-tenant cache access heterogeneous graph includes: For each access edge, extract the frequency and time characteristics of the query request node connected to the edge accessing its corresponding vector data node from the cached access trajectory data, and determine the weight of the access edge based on the frequency and time characteristics. For each co-occurrence edge, the number of times the two vector data nodes connected by the edge are accessed in the same query request and the co-occurrence time feature are statistically analyzed from the cached access trajectory data. The weight of the co-occurrence edge is determined based on the number of times and the co-occurrence time feature. For each belonging edge, the historical access pattern features of the tenant nodes connected to the edge are aggregated from the cached access trajectory data, and the metadata information of the tenant nodes is associated with them. The weight of the belonging edge is determined based on the historical access pattern features and the metadata information.
2. The method for optimizing multi-tenant vector cache replacement strategy based on graph neural networks according to claim 1, characterized in that, In step S24, a time-series access feature vector is added to each vector data node in the initial multi-tenant cache access heterogeneous graph to generate a multi-tenant cache access heterogeneous graph, including: Step S241: For each vector data node in the initial multi-tenant cache access heterogeneous graph, extract the historical access sequence of the vector data node within a preset time window from the cache access trajectory data; Step S242: Encode the historical access sequence to generate a time-series access feature vector; Step S243: The generated time-series access feature vector is fused with the existing feature vector of the vector data node to update the feature vector of the vector data node and generate a multi-tenant cache access heterogeneous graph.
3. The method for optimizing multi-tenant vector cache replacement strategy based on graph neural networks according to claim 2, characterized in that, In step S243, fusing the generated time-series access feature vector with the existing feature vector of the vector data node to update the feature vector of the vector data node and generate a multi-tenant cache access heterogeneous graph includes: Obtain the existing static feature vectors of the vector data nodes; The temporal access feature vector is concatenated with the static feature vector to form an extended feature vector; The extended feature vector is input into a fully connected neural network layer for dimensionality reduction and feature fusion to generate the final fused feature vector of the vector data node. The original feature vector of the vector data node is replaced with the final fused feature vector, which is then used as its node feature vector in the multi-tenant cache access heterogeneous graph. After updating the feature vectors of all vector data nodes, all updated vector data nodes and their feature vectors, as well as all types of edges and their weights, are combined to construct a multi-tenant cache access heterogeneous graph.
4. The method for optimizing multi-tenant vector cache replacement strategy based on graph neural networks according to claim 1, characterized in that, In step S3, the step of inputting the multi-tenant cache access heterogeneous graph into a graph neural network model and determining the importance of each vector data node in the multi-tenant cache access heterogeneous graph through an attention aggregation mechanism includes: The feature vectors of each vector data node in the heterogeneous graph accessed by the multi-tenant cache are input into the first layer of the graph neural network model. For the feature vector of a single vector data node, perform the following steps: In each layer of the graph neural network model, for a single vector data node, the attention coefficient between the vector data node and all its neighboring vector data nodes is determined through an attention mechanism. In each layer, based on the attention coefficient, the feature vectors of all neighboring vector data nodes of the vector data node in the current layer are weighted and summed to obtain the aggregated feature vector of the vector data node. In each layer, the aggregated feature vector of the vector data node is processed by a non-linear activation function and layer normalization to generate the feature vector of the vector data node in the next layer. The feature vector of the vector data node output from the last layer is input into a prediction layer to generate the importance of the vector data node.
5. The method for optimizing multi-tenant vector cache replacement strategy based on graph neural networks according to claim 4, characterized in that, In each layer of the graph neural network model, for a single vector data node, the attention coefficients between that vector data node and all its neighboring vector data nodes are determined through an attention mechanism, including: For each vector data node in the current layer, its feature vector is concatenated with the feature vectors of each of its neighboring vector data nodes to obtain the original association score; The original association scores are transformed nonlinearly to obtain normalized attention coefficients.
6. The method for optimizing multi-tenant vector cache replacement strategy based on graph neural networks according to claim 4, characterized in that, The step of inputting the feature vector of the vector data node output from the last layer into a prediction layer to generate the importance of the vector data node includes: The feature vector of each vector data node output from the last layer is input into the prediction layer, which consists of one or more fully connected neural network layers. In the prediction layer, the input feature vector is subjected to a nonlinear transformation, mapping it to a scalar fraction; The scalar score is used as the significance of the vector data node.
7. The method for optimizing multi-tenant vector cache replacement strategy based on graph neural networks according to claim 1, characterized in that, In step S4, based on the importance of each vector data node in the multi-tenant cache access heterogeneous graph, and combined with the current cache usage capacity and a preset cache usage capacity threshold, one or more vector data nodes that need to be evicted are determined, including: Step S41: Sort the vector data nodes in ascending order according to their importance to generate a candidate expulsion sequence; Step S42: Starting from the beginning position of the candidate eviction sequence, the current cache occupancy capacity of the vector data corresponding to each vector data node is sequentially accumulated; Step S43: When the accumulated current cache usage exceeds the preset cache usage threshold, all currently accumulated vector data nodes are identified as vector data nodes that need to be evicted.
8. The method for optimizing multi-tenant vector cache replacement strategy based on graph neural networks according to claim 1, characterized in that, In step S5, removing the vector data corresponding to the vector data node to be evicted from the physical cache includes: Obtain the unique identifier of each vector data node that needs to be evicted and its storage location information in the physical cache; Based on the unique identifier and the storage location information, the vector data corresponding to each vector data node that needs to be evicted is deleted from its physical cache area, and the storage space it occupies is released.
Citation Information
Patent Citations
Method and system for detecting tenants using cache space inefficiently based on machine learning
CN116382908A
5G end-to-end slice deployment method and system
CN116886548A
Distributed cache prefetching and replacing method based on improved space-time diagram attention network
CN121524150A