Cache content sorting method and device, computer device and storage medium

By optimizing the sorting of cached content through a self-attention mechanism and a similarity distance algorithm, the problem of limited resources on edge cache nodes is solved, thereby improving caching efficiency and the timeliness of user requests.

CN116881297BActive Publication Date: 2026-02-13INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310844528.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-11
Publication Date
2026-02-13
Estimated Expiration
2043-07-11

AI Technical Summary

Technical Problem

Edge cache nodes have limited storage space and computing resources, making it impossible to cache all user-requested content information simultaneously, resulting in low caching efficiency.

Method used

The self-attention mechanism is used to characterize the information of the content to be cached, calculate the self-attention score, and combine it with the similarity distance algorithm to determine the final score value, thereby optimizing the cache sequence to improve caching efficiency.

Benefits of technology

It improves the caching efficiency and timeliness of user-requested content information and optimizes the target cache sequence preferred by users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116881297B_ABST
    Figure CN116881297B_ABST
Patent Text Reader

Abstract

The application relates to a cache content sorting method and device, computer equipment and a storage medium. The application relates to information communication and artificial intelligence technology. The method comprises the following steps: acquiring a sequence of to-be-cached contents requested by a plurality of users at different time points, a user sequence and a plurality of to-be-cached content information; performing feature processing on each to-be-cached content information to obtain a to-be-cached feature vector, and performing attention evaluation processing to obtain a self-attention score of each to-be-cached feature vector; based on the self-attention score of each to-be-cached feature vector and the user sequence corresponding to each user, the similarity distance between adjacent to-be-cached feature vectors in the sequence of to-be-cached contents is calculated to obtain a final score value corresponding to each to-be-cached content information; and the final score value is arranged to obtain a target cache sequence corresponding to all to-be-cached content information. The method can improve the cache efficiency of content information requested by users.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of information communication and artificial intelligence, and particularly relates to a cache content sorting method and device, computer equipment and a storage medium. BACKGROUND

[0002] With the development of 5G communication technology, the user flow of financial software is increasing, and a large amount of cache data generated by each user needs to be stored in the server at any time, and edge caching has become a new solution for network high-load transmission. However, although the amount of content requested by users is increasing, the storage space and computing resources of edge nodes are usually very limited, and all content information cannot be cached at the same time. Therefore, how to sort the cache content is the current research focus.

[0003] The traditional edge caching method is to cache all cache content data requested by users at the same time, so that the cache efficiency of each cache content information is slow, resulting in low cache efficiency of the content information requested by users. SUMMARY

[0004] Therefore, it is necessary to provide a cache content sorting method, device, computer equipment, computer readable storage medium and computer program product to solve the above technical problems.

[0005] In a first aspect, the present application provides a cache content sorting method. The method comprises:

[0006] obtaining a plurality of user-requested cache content sequences at different time points, a user sequence corresponding to each user, and a plurality of cache content information corresponding to the cache content sequence; the user sequence is a sequence obtained by arranging each user according to the time point of requesting cache;

[0007] based on the user sequence and the cache content sequence, performing feature processing on each cache content information to obtain a cache feature vector corresponding to each cache content information, and performing attention evaluation processing on each cache feature vector through a self-attention mechanism to obtain a self-attention score of each cache feature vector;

[0008] based on the self-attention score of each cache feature vector and the user sequence corresponding to each user, calculating the similarity distance between the cache feature vectors corresponding to two adjacent cache content information in the cache content sequence through a similarity distance algorithm, and determining a final score value corresponding to each cache content information based on the similarity distance between each cache content information;

[0009] arranging the to-be-cached content information in descending order of the final score values to obtain a target caching sequence corresponding to all the to-be-cached content information; the target caching sequence is used for caching each to-be-cached content information in the edge cache according to the target caching sequence.

[0010] Optionally, the feature processing of each to-be-cached content information based on the user sequence and the to-be-cached content sequence to obtain a to-be-cached feature vector corresponding to each to-be-cached content information comprises:

[0011] For each to-be-cached content information, the rank of the user corresponding to the to-be-cached content information in the user sequence is vectorized to obtain a first vector corresponding to the to-be-cached content information, and the rank of the to-be-cached content sequence corresponding to the to-be-cached content information is vectorized to obtain a second vector corresponding to the to-be-cached content information.

[0012] The feature information in the to-be-cached content information is extracted and vectorized to obtain a third vector corresponding to the to-be-cached content information.

[0013] Based on the first vector corresponding to the to-be-cached content information, the second vector corresponding to the to-be-cached content information, and the third vector corresponding to the to-be-cached content information, a to-be-cached feature vector corresponding to the to-be-cached content information is determined.

[0014] Optionally, the attention evaluation processing of each to-be-cached feature vector through the self-attention mechanism to obtain a self-attention score of each to-be-cached feature vector comprises:

[0015] For each to-be-cached content information, the first vector corresponding to the to-be-cached content information and the third vector corresponding to the to-be-cached content information are mapped to the same spatial layer to obtain the first vector and the third vector of the same spatial layer, and the attention weight matrix corresponding to the to-be-cached content information is calculated based on the first vector and the third vector of the same spatial layer through a dot attention mechanism algorithm.

[0016] Based on each to-be-cached content information, a self-attention mechanism loss value corresponding to all to-be-cached content information is calculated, and based on the attention weight matrix corresponding to the to-be-cached content information and the second vector corresponding to the to-be-cached content information, a self-attention score of the to-be-cached feature vector is calculated through a diagonal algorithm of the self-attention mechanism.

[0017] Optionally, the self-attention score of each to-be-cached feature vector and the user sequence corresponding to each user are used to calculate the similarity distance between two adjacent to-be-cached content information in the to-be-cached content sequence by a similarity distance algorithm, and the final score value corresponding to each to-be-cached content information is determined based on the similarity distance between the to-be-cached content information.

[0018] For each to-be-cached content information, the Euclidean distance between the to-be-cached content information and the next to-be-cached content information adjacent to the to-be-cached content information in the to-be-cached content sequence is calculated based on the to-be-cached content information and the next to-be-cached content information, and the short-term user dependence value between the to-be-cached content information and the next to-be-cached content information is calculated based on the self-attention score of the to-be-cached content information and the next to-be-cached content information.

[0019] The Euclidean distance of the to-be-cached content and the long-term user preference value of the to-be-cached content information are calculated based on the position of the user corresponding to the to-be-cached content information in the user sequence and the position of the to-be-cached content sequence corresponding to the to-be-cached content information.

[0020] The final score value corresponding to the to-be-cached content information is calculated based on the Euclidean distance corresponding to the to-be-cached content information, the short-term user dependence value, the Euclidean distance corresponding to the to-be-cached content information, and the long-term user preference value.

[0021] Optionally, the final score value corresponding to the to-be-cached content information is calculated based on the Euclidean distance corresponding to the to-be-cached content information, the short-term user dependence value, the Euclidean distance corresponding to the to-be-cached content information, and the long-term user preference value.

[0022] The Euclidean distance corresponding to the to-be-cached content information is normalized to obtain the short-term user dependence value weight, the Euclidean distance corresponding to the to-be-cached content information is normalized to obtain the long-term user preference value weight, and the short-term user dependence value and the long-term user preference value are weighted and summed based on the short-term user dependence value weight and the long-term user preference value weight to obtain the final score value corresponding to the to-be-cached content information. Optionally, the self-attention mechanism loss value corresponding to all to-be-cached content information is calculated based on each to-be-cached content information.

[0023] Each to-be-cached content information and the interaction information of the user corresponding to the to-be-cached content information are identified, and the category of each interaction information is analyzed.

[0024] The self-attention mechanism loss value corresponding to all the to-be-cached content information is calculated based on the category of each interaction information and each to-be-cached content information corresponding to the category of each interaction information through a loss function of the self-attention mechanism.

[0025] Optionally, the self-attention mechanism loss value corresponding to all the to-be-cached content information is calculated based on the category of each interaction information and each to-be-cached content information corresponding to the category of each interaction information through a loss function of the self-attention mechanism, including:

[0026] The sub-self-attention loss value corresponding to each category of interaction information is calculated through a loss function algorithm of the self-attention mechanism corresponding to each category of interaction information, and the sub-self-attention loss values corresponding to the to-be-cached content information of all categories of interaction information are summarized to obtain the self-attention mechanism loss value corresponding to all the to-be-cached content information.

[0027] In a second aspect, the present application further provides a device for sorting cached content. The device comprises:

[0028] The acquisition module is configured to acquire a sequence of to-be-cached content requested by a plurality of users at different time points, a user sequence corresponding to each of the users, and a plurality of to-be-cached content information corresponding to the sequence of to-be-cached content; the user sequence is obtained by arranging each of the users in the order of the time points at which the to-be-cached content is requested;

[0029] The evaluation module is configured to perform feature processing on each of the to-be-cached content information based on the user sequence and the sequence of to-be-cached content, to obtain a to-be-cached feature vector corresponding to each of the to-be-cached content information, and to perform attention evaluation processing on each of the to-be-cached feature vectors through a self-attention mechanism to obtain a self-attention score of each to-be-cached feature vector;

[0030] The scoring module is configured to calculate a similarity distance between to-be-cached feature vectors corresponding to two adjacent to-be-cached content information in the sequence of to-be-cached content through a similarity distance algorithm based on the self-attention score of each to-be-cached feature vector and the user sequence corresponding to each of the users, and to determine a final score value corresponding to each of the to-be-cached content information based on the similarity distance between each of the to-be-cached content information.

[0031] The sorting module is configured to arrange the to-be-cached content information in descending order of the final score value to obtain a target cache sequence corresponding to all the to-be-cached content information; the target cache sequence is used for cache processing of each of the to-be-cached content information in the edge cache according to the target cache sequence.

[0032] Optionally, the evaluation module is specifically configured to:

[0033] vectorize a position of the user corresponding to the to-be-cached content information in the user sequence to obtain a first vector corresponding to the to-be-cached content information, and vectorize a position of the to-be-cached content sequence corresponding to the to-be-cached content information to obtain a second vector corresponding to the to-be-cached content information;

[0034] extract feature information in the to-be-cached content information, and vectorize the feature information to obtain a third vector corresponding to the to-be-cached content information;

[0035] determine a to-be-cached feature vector corresponding to the to-be-cached content information based on the first vector corresponding to the to-be-cached content information, the second vector corresponding to the to-be-cached content information, and the third vector corresponding to the to-be-cached content information.

[0036] Optionally, the evaluation module is specifically configured to:

[0037] for each to-be-cached content information, map the first vector corresponding to the to-be-cached content information and the third vector corresponding to the to-be-cached content information to a same spatial layer to obtain the first vector and the third vector of the same spatial layer, and calculate an attention weight matrix corresponding to the to-be-cached content information based on the first vector and the third vector of the same spatial layer through a point attention mechanism algorithm.

[0038] based on each to-be-cached content information, calculate a self-attention mechanism loss value corresponding to all to-be-cached content information, and based on the attention weight matrix corresponding to the to-be-cached content information and the second vector corresponding to the to-be-cached content information, calculate a self-attention score of the to-be-cached feature vector through a diagonal line algorithm of the self-attention mechanism.

[0039] Optionally, the scoring module is specifically configured to:

[0040] for each to-be-cached content information, based on the to-be-cached content information and a next to-be-cached content information adjacent to the to-be-cached content information in the to-be-cached content sequence, calculate an Euclidean distance between the to-be-cached content information and the next to-be-cached content information, and based on the self-attention score of the to-be-cached content information and the next to-be-cached content information, calculate a short-term user dependency value between the to-be-cached content information and the next to-be-cached content information.

[0041] based on the position of the user corresponding to the to-be-cached content information in the user sequence and the position of the to-be-cached content sequence corresponding to the to-be-cached content information, calculate an Euclidean distance of the to-be-cached content and a long-term user preference value of the to-be-cached content information;

[0042] The final score value corresponding to the to-be-cached content information is calculated based on the Euclidean distance corresponding to the to-be-cached content information, the short-term user dependence value, the Euclidean distance corresponding to the to-be-cached content information, and the long-term user preference value.

[0043] Optionally, the scoring module is specifically configured to:

[0044] The Euclidean distance corresponding to the to-be-cached content information is normalized to obtain a short-term user dependence value weight, the Euclidean distance corresponding to the to-be-cached content information is normalized to obtain a long-term user preference value weight, and the short-term user dependence value and the long-term user preference value are weighted and summed based on the short-term user dependence value weight and the long-term user preference value weight to obtain the final score value corresponding to the to-be-cached content information.

[0045] Optionally, the evaluation module is specifically configured to:

[0046] Each to-be-cached content information and the interaction information of the user corresponding to the to-be-cached content information are identified, and the category of each interaction information is analyzed.

[0047] Based on the category of each interaction information and each to-be-cached content information corresponding to the category of each interaction information, a self-attention mechanism loss value corresponding to all to-be-cached content information is calculated through a loss function of the self-attention mechanism.

[0048] Optionally, the evaluation module is specifically configured to:

[0049] The sub-self-attention loss value corresponding to each category of interaction information is calculated through a loss function algorithm of the self-attention mechanism corresponding to each category of interaction information, and the sub-self-attention loss values of the to-be-cached content information corresponding to all categories of interaction information are summarized to obtain the self-attention mechanism loss value corresponding to all to-be-cached content information.

[0050] In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method of any one of the first aspect when executing the computer program.

[0051] In a fourth aspect, the present application also provides a computer readable storage medium. The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the method of any one of the first aspect.

[0052] In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of the method of any one of the first aspect.

[0053] The cache content sorting method, device, computer device, storage medium and computer program product described above, by obtaining a plurality of user sequences of requested cache content at different time points, a user sequence corresponding to each user, and a plurality of cache content information corresponding to the cache content sequence; based on the user sequence and the cache content sequence, performing feature processing on each cache content information to obtain a cache feature vector corresponding to each cache content information, and performing attention evaluation processing on each cache content feature vector through a self-attention mechanism to obtain a self-attention score of each cache feature vector; based on the self-attention score of each cache feature vector and the user sequence corresponding to each user, calculating the similarity distance between the cache feature vectors corresponding to two adjacent cache content information in the cache content sequence through a similarity distance algorithm, and determining a final score value corresponding to each cache content information based on the similarity distance between each cache content information; arranging the cache content information in descending order of the final score value to obtain a target cache sequence corresponding to all cache content information. This scheme is based on the time sequence (i.e. cache content sequence) of each cache content information at different time points and the user sequence of the user corresponding to each cache content information, calculates the attention score value of each cache content through a self-attention mechanism, and then analyzes the similarity distance of the cache content information in each adjacent time sequence through a similarity distance algorithm combined with the adjacent time sequence (i.e. cache content sequence) of the cache content information and the user sequence corresponding to the cache content information, thereby optimizing the self-attention score value and obtaining a target cache sequence preferred by different users, which not only improves the timeliness requirement of users for cache content, but also improves the cache efficiency of content information requested by users based on the target cache sequence. BRIEF DESCRIPTION OF DRAWINGS

[0054] Figure 1 A flowchart of a cache content sorting method in an embodiment;

[0055] Figure 2 A flowchart of a cache content sorting example in an embodiment;

[0056] Figure 3 A block diagram of the structure of a cache content sorting device in an embodiment;

[0057] Figure 4 An internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION

[0058] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.

[0059] The cache content sorting method provided by the embodiments of the present application can be applied to a terminal, a server, a system comprising a terminal and a server, and is realized through the interaction of the terminal and the server. The terminal can be, but is not limited to, various personal computers, notebook computers, smart phones and tablet computers, etc. The server can be realized by an independent server or a server cluster composed of multiple servers. The terminal calculates the attention score value of each to-be-cached content based on the time sequence (i.e., the to-be-cached content sequence) of each to-be-cached content information at different time points and the user sequence of the user corresponding to each to-be-cached content information through the self-attention mechanism, and then analyzes the similarity distance of the to-be-cached content information of each adjacent time sequence through the similarity distance algorithm combined with the adjacent time sequence corresponding to the to-be-cached content information and the user sequence corresponding to the to-be-cached content information, so as to optimize the self-attention score value and obtain the target cache sequence preferred by different users. This not only improves the timeliness requirement of the user for the cached content, but also improves the cache efficiency of the content information requested by the user based on the target cache sequence.

[0060] In one embodiment, as shown in FIG. 1, a cache content sorting method is provided. Taking the case that the method is applied to a terminal for example, the method comprises the following steps: Figure 1

[0061] In step S101, a to-be-cached content sequence requested by multiple users at different time points, a user sequence corresponding to each user, and multiple to-be-cached content information corresponding to the to-be-cached content sequence are obtained.

[0062] The user sequence is a sequence obtained by arranging each user in the order of the time point of requesting cache.

[0063] ​In this embodiment, the terminal obtains the to-be-cached content information of different users at different time points in response to the operation of the user requesting to cache. Then, the terminal sorts each to-be-cached content information in time sequence of the time point of the user requesting to cache, obtains a to-be-cached content sequence, and sorts each user in time sequence of the time point of the user requesting to cache, to obtain a user sequence corresponding to each user. The to-be-cached content information can be, but is not limited to, video content information, file content information, financial product query content information, and audio content information, etc. The users corresponding to the different user sequences can be the same user, the to-be-cached content information corresponding to different to-be-cached content sequences is not the same, and there is similarity between the to-be-cached content information. For example, the to-be-cached content information is news video content information, entertainment video content information, and conference audio content information, etc.

[0064] In step S102, based on the user sequence and the to-be-cached content sequence, each to-be-cached content information is processed to obtain a to-be-cached feature vector corresponding to each to-be-cached content information, and each to-be-cached feature vector is processed by a self-attention mechanism to obtain a self-attention score of each to-be-cached feature vector.

[0065] In this embodiment, the terminal extracts the feature information of each to-be-cached content information, and processes each to-be-cached content information to obtain a to-be-cached feature vector corresponding to each to-be-cached content information based on the position of the user corresponding to each to-be-cached content information in the user sequence and the position of each to-be-cached content information in the to-be-cached content sequence. The specific vectorization process will be described in detail later. The terminal processes each to-be-cached feature vector corresponding to each to-be-cached content information by a self-attention mechanism to obtain a self-attention score of each to-be-cached feature vector. The specific evaluation process will be described in detail later.

[0066] In step S103, based on the self-attention score of each to-be-cached feature vector and the user sequence corresponding to each user, the similarity distance between the to-be-cached feature vectors corresponding to two adjacent to-be-cached content information in the to-be-cached content sequence is calculated by a similarity distance algorithm, and based on the similarity distance between each to-be-cached content information, a final score value corresponding to each to-be-cached content information is determined.

[0067] In this embodiment, the terminal calculates the similarity distance between the to-be-cached feature vectors corresponding to the two adjacent to-be-cached content information in the to-be-cached content sequence based on the self-attention score of each to-be-cached feature vector and the user sequence corresponding to each user by using a similarity distance algorithm, and then obtains the final score value corresponding to each to-be-cached content information by weighting and summing the similarity distance between each to-be-cached content information. The specific calculation process will be described in detail later. The similarity distance algorithm includes the Euclidean distance algorithm and the Euclidean distance algorithm.

[0068] In step S104, the to-be-cached content information is arranged in descending order of the final score value to obtain a target caching sequence corresponding to all to-be-cached content information.

[0069] The target caching sequence is used to cache each to-be-cached content information according to the target caching sequence when edge caching.

[0070] In this embodiment, the terminal arranges each to-be-cached content information in descending order of the final score value to obtain a target caching sequence corresponding to all to-be-cached content information.

[0071] Based on the above scheme, based on the time sequence (i.e., the to-be-cached content sequence) of each to-be-cached content information at different time points and the user sequence of the user corresponding to each to-be-cached content information, the attention score value of each to-be-cached content is calculated by using the self-attention mechanism. Then, by using the similarity distance algorithm, the similarity distance of the to-be-cached content information in each adjacent time sequence is analyzed by combining the adjacent time sequence (i.e., the to-be-cached content sequence) corresponding to the to-be-cached content information and the user sequence corresponding to the to-be-cached content information, thereby optimizing the self-attention score value, thereby obtaining a target caching sequence preferred by different users. Not only does it improve the timeliness requirement of the user for the cached content, but also improves the caching efficiency of the content information requested by the user based on the target caching sequence.

[0072] Optionally, based on the user sequence and the sequence of the to-be-cached content, the to-be-cached content information is characterized to obtain a to-be-cached feature vector corresponding to the to-be-cached content information, including: for each to-be-cached content information, vectorizing the position of the user corresponding to the to-be-cached content information in the user sequence to obtain a first vector corresponding to the to-be-cached content information, and vectorizing the position of the to-be-cached content sequence corresponding to the to-be-cached content information to obtain a second vector corresponding to the to-be-cached content information; extracting feature information in the to-be-cached content information and vectorizing the feature information to obtain a third vector corresponding to the to-be-cached content information; determining the to-be-cached feature vector corresponding to the to-be-cached content information based on the first vector corresponding to the to-be-cached content information, the second vector corresponding to the to-be-cached content information, and the third vector corresponding to the to-be-cached content information.

[0073] In this embodiment, the terminal vectorizes the position of the user corresponding to each to-be-cached content information in the user sequence to obtain a first vector corresponding to the to-be-cached content information, and vectorizes the position of the to-be-cached content sequence corresponding to the to-be-cached content information to obtain a second vector corresponding to the to-be-cached content information. Then, the terminal extracts feature information in the to-be-cached content information and vectorizes the feature information to obtain a third vector corresponding to the to-be-cached content information. The feature information represents the content characteristics of the to-be-cached content information. Finally, the terminal splices the first vector corresponding to the to-be-cached content information, the second vector corresponding to the to-be-cached content information, and the third vector corresponding to the to-be-cached content information to obtain a to-be-cached feature vector corresponding to the to-be-cached content information. The formula of the to-be-cached feature vector is:

[0074]

[0075] In the above formula, Q is a query Q vector of a self-attention mechanism for representing the first vector of the to-be-cached content information, K is a key K vector of the self-attention mechanism for representing the second vector of the to-be-cached content information, and V is a value V vector of the self-attention mechanism for representing the third vector of the to-be-cached content information.

[0076] Based on the above scheme, the user sequence, the to-be-cached content sequence, and the to-be-cached content information are vectorized to improve the accuracy of subsequent calculation of the self-attention score.

[0077] Optionally, the self-attention mechanism is used to evaluate each to-be-cached feature vector to obtain a self-attention score of each to-be-cached feature vector, including: for each to-be-cached content information, the first vector corresponding to the to-be-cached content information and the third vector corresponding to the to-be-cached content information are mapped to the same space layer to obtain the first vector and the third vector of the same space layer, and the dot attention mechanism algorithm is used to calculate the attention weight matrix corresponding to the to-be-cached content information based on the first vector and the third vector of the same space layer; based on each to-be-cached content information, the self-attention mechanism loss value corresponding to all to-be-cached content information is calculated, and the diagonal algorithm of the self-attention mechanism is used to calculate the self-attention score of the to-be-cached feature vector based on the attention weight matrix corresponding to the to-be-cached content information and the second vector corresponding to the to-be-cached content information.

[0078] In this embodiment, the terminal maps the first vector corresponding to the to-be-cached content information and the third vector corresponding to the to-be-cached content information to the same space layer to obtain the first vector and the third vector of the same space layer for each to-be-cached content information. Then, the terminal calculates the attention weight matrix corresponding to the to-be-cached content information based on the first vector and the third vector of the same space layer through the dot attention mechanism algorithm. Finally, the terminal calculates the self-attention score of the to-be-cached feature vector based on the attention weight matrix corresponding to the to-be-cached content information and the second vector corresponding to the to-be-cached content information through the diagonal algorithm of the self-attention mechanism.

[0079] Specifically, the second vector corresponding to the to-be-cached content information is The terminal uses the ReLU function of the self-attention mechanism as the excitation function. The Q and K are mapped to the same hidden layer space to obtain the first vector and the third vector of the same space layer, where the formula of the first vector and the third vector of the same space layer is as follows:

[0080]

[0081]

[0082] where W Q is the weight of the first vector in the same space layer, and W K is the weight of the third vector in the same space layer. The weight value of the first vector is a value obtained by normalizing the reciprocal of the ratio of the position of the user corresponding to the to-be-cached content information in the user sequence to the number of all users in the user sequence, and the weight value of the third vector is a value obtained by normalizing the reciprocal of the ratio of the position of the to-be-cached content sequence corresponding to the to-be-cached content information to the number of all to-be-cached content information in the to-be-cached content sequence.

[0083] Then the terminal calculates the attention weight matrix corresponding to the to-be-cached content information based on the first vector and the third vector of the same spatial layer through the point attention mechanism algorithm of the self-attention mechanism. The point attention mechanism algorithm is as follows: the scale factor is d, and the attention weight matrix is obtained as follows:

[0084]

[0085] In the above formula, d is a scale factor, is the attention weight matrix, Q' is the first vector of the same spatial layer, and K' is the third vector of the same spatial layer.

[0086] The terminal multiplies the above weight matrix by the second vector corresponding to the to-be-cached content information, that is, the to-be-cached content information to obtain the weighted to-be-cached content information:

[0087]

[0088] Then, the terminal performs operation processing on the above weighted to-be-cached feature vector through the focusing algorithm containing the time sequence feature to obtain the self-attention score value corresponding to the to-be-cached feature vector. The time sequence feature TE is composed of the following sine and cosine signals:

[0089] TF(t, 2i) = sin(t / 10000 2i / d )

[0090] TE(t, 2i+1) = cos(t / 10000 2i / d )

[0091] Where t is the time step, and i is the vector dimension.

[0092] Based on the above scheme, the self-attention evaluation processing is performed on each to-be-cached feature vector through the self-attention mechanism with added time sequence feature, and the self-attention score value corresponding to each to-be-cached feature vector is obtained, which improves the attention degree to the time sequence feature in the obtained self-attention score value.

[0093] Optionally, based on the self-attention score of each feature vector to be cached and the user sequence corresponding to each user, the similarity distance algorithm is used to calculate the similarity distance between the feature vectors corresponding to two adjacent pieces of content to be cached in the content sequence to be cached. Based on the similarity distance between each piece of content to be cached, the final score corresponding to each piece of content to be cached is determined, including: for each piece of content to be cached, based on the content to be cached and the next adjacent piece of content to be cached in the content sequence to be cached, calculating the Euclidean distance between the content to be cached and the next adjacent piece of content to be cached, and based on the similarity distance between the feature vectors to be cached and the next adjacent piece of content to be cached in the content sequence to be cached. The self-attention score of the cached content information and the next content information to be cached are used to calculate the short-term user dependency value between the content information to be cached and the next content information to be cached. Based on the position of the user corresponding to the content information to be cached in the user sequence and the position of the content information to be cached in the sequence, the Euclidean distance of the content to be cached and the long-term user preference value of the content information to be cached are calculated. Based on the Euclidean distance, the short-term user dependency value, the Euclidean distance, and the long-term user preference value of the content information to be cached, the final score value corresponding to the content information to be cached is calculated.

[0094] In this embodiment, for each piece of content to be cached, the terminal calculates the Euclidean distance between the content to be cached and the next adjacent content to be cached in the sequence. Then, based on the self-attention score of the content to be cached and the next adjacent content to be cached, the terminal calculates the short-term user dependency value between the two content pieces.

[0095] The terminal calculates the Euclidean distance to the content to be cached and the long-term user preference value based on the user's position in the user sequence and the position of the content to be cached within the content sequence. Finally, the terminal performs a weighted summation of the Euclidean distance, short-term user dependency value, and long-term user preference value to obtain the final score for the content to be cached. The specific weighted summation process will be explained in detail later.

[0096] Specifically, in obtaining information about each piece of content to be cached Self-attention score Then, the terminal calculates the cached content information and the cached content information of the next time step of the cached content sequence. The Euclidean distance between them. Then, the terminal calculates the short-term user dependency value between the two pieces of content to be cached using a short-term dependency algorithm. The short-term dependency algorithm is as follows:

[0097] Secondly, the terminal calculates the Euclidean distance between the first vector and the third vector corresponding to each to-be-cached content information. Then, the terminal calculates the long-term user preference value between the first vector and the third vector corresponding to each to-be-cached content information by using a long-term preference algorithm. The long-term preference algorithm is

[0098] Based on the above scheme, by calculating the short-term user dependence value of each to-be-cached content information and the long-term user preference value of each to-be-cached content information, the attention degree of the self-attention score to the association information between two adjacent to-be-cached content information is adjusted, and the accuracy of the final score value obtained is improved.

[0099] Optionally, the Euclidean distance corresponding to the to-be-cached content information is normalized to obtain a short-term user dependence value weight, the Euclidean distance corresponding to the to-be-cached content information is normalized to obtain a long-term user preference value weight, and the short-term user dependence value and the long-term user preference value are weighted and summed based on the short-term user dependence value weight and the long-term user preference value weight to obtain the final score value corresponding to the to-be-cached content information.

[0100] In this embodiment, the terminal normalizes the Euclidean distance corresponding to the to-be-cached content information to obtain a short-term user dependence value weight, and normalizes the Euclidean distance corresponding to the to-be-cached content information to obtain a long-term user preference value weight. Then, the terminal weights and sums the short-term user dependence value and the long-term user preference value based on the short-term user dependence value weight and the long-term user preference value weight to obtain the final score value corresponding to the to-be-cached content information.

[0101] Specifically, the terminal normalizes the Euclidean distance corresponding to the to-be-cached content information to obtain a short-term user dependence value weight, and normalizes the Euclidean distance corresponding to the to-be-cached content information to obtain a long-term user preference value weight. Then, the terminal weights and sums the short-term user dependence value and the long-term user preference value based on the short-term user dependence value weight and the long-term user preference value weight to obtain the final score value corresponding to the to-be-cached content information. Based on the above scheme, the short-term user dependence value and the long-term user preference value of the to-be-cached content information are fused by weighted summation, and the accuracy of the final score value obtained is improved.

[0102] Based on the above scheme, the short-term user dependence value and the long-term user preference value of the to-be-cached content information are fused by weighted summation, and the accuracy of the final score value obtained is improved.

[0103] ​Optionally, based on each to-be-cached content information, a self-attention mechanism loss value corresponding to all to-be-cached content information is calculated, including: identifying each to-be-cached content information and interaction information of a user corresponding to the to-be-cached content information, and analyzing a category of each interaction information; based on the category of each interaction information and each to-be-cached content information corresponding to the category of each interaction information, a self-attention mechanism loss value corresponding to all to-be-cached content information is calculated through a loss function of the self-attention mechanism.

[0104] In this embodiment, the terminal identifies each to-be-cached content information and interaction information of a user corresponding to the to-be-cached content information, and analyzes a category of each interaction information. The category of the interaction information includes that the to-be-cached content information has interaction with the user and that the to-be-cached content information has no interaction with the user. Then, based on the category of each interaction information and each to-be-cached content information corresponding to the category of each interaction information, a self-attention mechanism loss value corresponding to all to-be-cached content information is calculated through a loss function of the self-attention mechanism. The specific loss value calculation process will be described in detail later.

[0105] Based on the above scheme, by analyzing whether the to-be-cached content information has interaction with the user, the loss value of the self-attention mechanism is calculated, and the accuracy of evaluating the self-attention score corresponding to each to-be-cached content information is improved.

[0106] Optionally, based on each to-be-cached content information, a self-attention mechanism loss value corresponding to all to-be-cached content information is calculated, including:

[0107] Through the loss function algorithm of the self-attention mechanism corresponding to each category of interaction information, a sub-self-attention loss value corresponding to each category of interaction information is calculated, and all sub-self-attention loss values of the to-be-cached content information corresponding to the interaction information of all categories are summarized to obtain a self-attention mechanism loss value corresponding to all to-be-cached content information.

[0108] In this embodiment, the terminal calculates a sub-self-attention loss value corresponding to each category of interaction information through the loss function algorithm of the self-attention mechanism corresponding to each category of interaction information. Then, the terminal adds the sub-self-attention loss values of the to-be-cached content information corresponding to the interaction information of all categories to obtain a self-attention mechanism loss value corresponding to all to-be-cached content information.

[0109] In the case that the category of the interaction information is that the to-be-cached content information has interaction with the user, the loss function algorithm of the self-attention mechanism corresponding to the category is as follows:

[0110]

[0111] In the formula, σ is a sigmoid function, is the to-be-cached content information belonging to the category of the to-be-cached content information interacting with the user, i is the position in the to-be-cached content sequence corresponding to the to-be-cached content information belonging to the category, and n is the number of to-be-cached content information belonging to the category of the to-be-cached content information interacting with the user.

[0112] In the case where the category of the interaction information is the to-be-cached content information not interacting with the user, the loss function algorithm of the self-attention mechanism corresponding to the category is as follows:

[0113]

[0114] In the formula, j≠i, σ is a sigmoid function, is the to-be-cached content information belonging to the category of the to-be-cached content information not interacting with the user, i is the position in the to-be-cached content sequence corresponding to the to-be-cached content information belonging to the category, and p is the number of to-be-cached content information belonging to the category of the to-be-cached content information not interacting with the user.

[0115] The loss value of the self-attention mechanism corresponding to all to-be-cached content information is obtained by adding the two expressions:

[0116]

[0117] Based on the above scheme, by analyzing whether the to-be-cached content information interacts with the user, the loss value of the self-attention mechanism is calculated, and the accuracy of evaluating the self-attention score corresponding to each to-be-cached content information is improved.

[0118] In one embodiment, as shown in Figure 2 a cache content ranking example is provided, which includes the following steps:

[0119] Step S201, obtaining a plurality of to-be-cached content sequences requested by a plurality of users at different time points, a user sequence corresponding to each user, and a plurality of to-be-cached content information corresponding to the to-be-cached content sequence.

[0120] Step S202, for each to-be-cached content information, vectorizing the position of the user corresponding to the to-be-cached content information in the user sequence to obtain a first vector corresponding to the to-be-cached content information, and vectorizing the position of the to-be-cached content sequence corresponding to the to-be-cached content information to obtain a second vector corresponding to the to-be-cached content information.

[0121] Step S203, extracting feature information in the to-be-cached content information, and vectorizing the feature information to obtain a third vector corresponding to the to-be-cached content information.

[0122] Step S204, determining the to-be-cached feature vector corresponding to the to-be-cached content information based on the first vector corresponding to the to-be-cached content information, the second vector corresponding to the to-be-cached content information, and the third vector corresponding to the to-be-cached content information.

[0123] Step S205, for each to-be-cached content information, mapping the first vector corresponding to the to-be-cached content information and the third vector corresponding to the to-be-cached content information to the same spatial layer to obtain the first vector and the third vector of the same spatial layer, and calculating the attention weight matrix corresponding to the to-be-cached content information based on the first vector and the third vector of the same spatial layer through the point attention mechanism algorithm.

[0124] Step S206, identifying the interaction information of each to-be-cached content information and the user corresponding to the to-be-cached content information, and analyzing the category of each interaction information.

[0125] Step S207, calculating the sub-self-attention loss value corresponding to each category of interaction information through the loss function algorithm of the self-attention mechanism corresponding to the category of each interaction information, and summarizing the sub-self-attention loss values of the to-be-cached content information corresponding to all categories of interaction information to obtain the self-attention mechanism loss value corresponding to all to-be-cached content information.

[0126] Step S208, calculating the self-attention score of the to-be-cached feature vector through the diagonal line algorithm of the self-attention mechanism based on the attention weight matrix corresponding to the to-be-cached content information and the second vector corresponding to the to-be-cached content information.

[0127] Step S209, for each to-be-cached content information, calculating the Euclidean distance between the to-be-cached content information and the next to-be-cached content information adjacent to the to-be-cached content information in the to-be-cached content sequence based on the to-be-cached content information and the next to-be-cached content information, and calculating the short-term user dependency value between the to-be-cached content information and the next to-be-cached content information based on the self-attention score of the to-be-cached content information and the next to-be-cached content information.

[0128] Step S210, calculating the Euclidean distance of the to-be-cached content and the long-term user preference value of the to-be-cached content information based on the position of the user corresponding to the to-be-cached content information in the user sequence and the position of the to-be-cached content sequence corresponding to the to-be-cached content information.

[0129] In step S211, the Euclidean distance corresponding to the to-be-cached content information is normalized to obtain a short-term user dependence value weight, the Euclidean distance corresponding to the to-be-cached content information is normalized to obtain a long-term user preference value weight, and the short-term user dependence value and the long-term user preference value are weighted and summed based on the short-term user dependence value weight and the long-term user preference value weight to obtain a final score value corresponding to the to-be-cached content information.

[0130] It should be understood that, although each step in the flowchart involved in each embodiment as described above is shown in sequence according to the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise specified herein, there is no strict order limitation for the execution of these steps, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart involved in each embodiment as described above can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately executed with at least part of other steps or stages or steps or stages in other steps.

[0131] Based on the same inventive concept, the embodiments of the present application also provide a cache content sorting device for implementing the above-mentioned cache content sorting method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more cache content sorting device embodiments provided below can refer to the limitations of the cache content sorting method described above, which will not be repeated here.

[0132] In one embodiment, as shown in FIG. 3, Figure 3 a cache content sorting device is provided, which includes an acquisition module 310, an evaluation module 320, a scoring module 330, and a sorting module 340.

[0133] The acquisition module 310 is configured to acquire a to-be-cached content sequence requested by a plurality of users at different time points, a user sequence corresponding to each of the users, and a plurality of to-be-cached content information corresponding to the to-be-cached content sequence; the user sequence is a sequence obtained by arranging each of the users in the order of the time points at which the to-be-cached content is requested;

[0134] The evaluation module 320 is configured to perform feature processing on each of the to-be-cached content information based on the user sequence and the to-be-cached content sequence to obtain a to-be-cached feature vector corresponding to each of the to-be-cached content information, and perform attention evaluation processing on each of the to-be-cached feature vectors through a self-attention mechanism to obtain a self-attention score of each to-be-cached feature vector;

[0135] The scoring module 330 is configured to calculate similarity distances between the to-be-cached feature vectors corresponding to two adjacent to-be-cached content information in the to-be-cached content sequence by using a similarity distance algorithm based on the self-attention scores of the to-be-cached feature vectors and the user sequences corresponding to the users, and determine a final score value corresponding to each to-be-cached content information based on the similarity distances between the to-be-cached content information.

[0136] The sorting module 340 is configured to arrange the to-be-cached content information in a descending order of the final score values, to obtain a target caching sequence corresponding to all the to-be-cached content information; and the target caching sequence is used for caching the to-be-cached content information in the edge cache in the target caching sequence.

[0137] Optionally, the evaluation module 320 is specifically configured to:

[0138] vectorize the positions of the users corresponding to the to-be-cached content information in the user sequence to obtain a first vector corresponding to the to-be-cached content information, and vectorize the positions of the to-be-cached content sequence corresponding to the to-be-cached content information to obtain a second vector corresponding to the to-be-cached content information;

[0139] extract feature information from the to-be-cached content information, and vectorize the feature information to obtain a third vector corresponding to the to-be-cached content information;

[0140] determine a to-be-cached feature vector corresponding to the to-be-cached content information based on the first vector corresponding to the to-be-cached content information, the second vector corresponding to the to-be-cached content information, and the third vector corresponding to the to-be-cached content information.

[0141] Optionally, the evaluation module 320 is specifically configured to:

[0142] map the first vector corresponding to the to-be-cached content information and the third vector corresponding to the to-be-cached content information to a same spatial layer to obtain the first vector and the third vector of the same spatial layer, and calculate an attention weight matrix corresponding to the to-be-cached content information based on the first vector and the third vector of the same spatial layer by using a point attention mechanism algorithm;

[0143] calculate self-attention mechanism loss values corresponding to all the to-be-cached content information based on the to-be-cached content information, and calculate the self-attention scores of the to-be-cached feature vectors by using a diagonal line algorithm of the self-attention mechanism based on the attention weight matrix corresponding to the to-be-cached content information and the second vector corresponding to the to-be-cached content information.

[0144] Optionally, the scoring module 330 is specifically configured to:

[0145] For each to-be-cached content information, based on the to-be-cached content information and a next to-be-cached content information adjacent to the to-be-cached content information in the to-be-cached content sequence, a Euclidean distance between the to-be-cached content information and the next to-be-cached content information is calculated, and based on a self-attention score of the to-be-cached content information and the next to-be-cached content information, a short-term user dependence value between the to-be-cached content information and the next to-be-cached content information is calculated.

[0146] Based on a position of the user corresponding to the to-be-cached content information in the user sequence and a position of the to-be-cached content sequence corresponding to the to-be-cached content information, a Euclidean distance of the to-be-cached content and a long-term user preference value of the to-be-cached content information are calculated.

[0147] Based on the Euclidean distance corresponding to the to-be-cached content information, the short-term user dependence value, the Euclidean distance corresponding to the to-be-cached content information, and the long-term user preference value, a final score value corresponding to the to-be-cached content information is calculated.

[0148] Optionally, the scoring module 330 is specifically configured to:

[0149] The Euclidean distance corresponding to the to-be-cached content information is normalized to obtain a short-term user dependence value weight, the Euclidean distance corresponding to the to-be-cached content information is normalized to obtain a long-term user preference value weight, and the short-term user dependence value and the long-term user preference value are weighted and summed based on the short-term user dependence value weight and the long-term user preference value weight to obtain the final score value corresponding to the to-be-cached content information.

[0150] Optionally, the evaluation module 320 is specifically configured to:

[0151] Each to-be-cached content information and the interaction information of the user corresponding to the to-be-cached content information are identified, and the category of each interaction information is analyzed.

[0152] Based on the category of each interaction information and each to-be-cached content information corresponding to the category of each interaction information, a self-attention mechanism loss value corresponding to all to-be-cached content information is calculated through a loss function of the self-attention mechanism.

[0153] Optionally, the evaluation module 320 is specifically configured to:

[0154] By using the loss function algorithm of the self-attention mechanism corresponding to each category of interaction information, the sub-self-attention loss value corresponding to each category of interaction information is calculated, and the sub-self-attention loss values ​​corresponding to the content information to be cached for all categories of interaction information are summarized to obtain the self-attention mechanism loss value corresponding to all content information to be cached.

[0155] Each module in the aforementioned cache content sorting device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0156] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a cache content sorting method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0157] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0158] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in any one of the first aspects.

[0159] In an embodiment, a computer readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, implements the steps of the method of any of the first aspect.

[0160] In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method of any of the first aspect.

[0161] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties.

[0162] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to memory, database or other medium used in the embodiments provided by the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The database involved in the embodiments provided by the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided by the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0163] The technical features of the above embodiments can be combined in any manner. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described, however, as long as the combinations of the technical features do not contradict each other, they should be considered to be within the scope of the present specification.

[0164] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the patent scope of the present application. It should be pointed out that, for ordinary skilled persons in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A method for sorting cached content, characterized in that, The method includes: The system obtains a sequence of cached content requested by multiple users at different times, a user sequence corresponding to each user, and multiple cached content information corresponding to the cached content sequence; the user sequence is a sequence obtained by arranging the users in the order of their cache request times. Based on the user sequence and the content to be cached sequence, the content to be cached information is characterized to obtain the cached feature vector corresponding to each content to be cached information, and the attention evaluation processing of each cached feature vector is performed through a self-attention mechanism to obtain the self-attention score of each cached feature vector. Based on the self-attention score of each feature vector to be cached and the user sequence corresponding to each user, the similarity distance algorithm is used to calculate the similarity distance between the feature vectors corresponding to two adjacent pieces of content to be cached in the sequence of content to be cached, and based on the similarity distance between each piece of content to be cached, the final score value corresponding to each piece of content to be cached is determined. The content information to be cached is arranged in descending order of the final score to obtain the target cache sequence corresponding to all the content information to be cached; when the target cache sequence is used for edge caching, the content information to be cached is cached according to the target cache sequence.

2. The method according to claim 1, characterized in that, The step of performing feature processing on each piece of content to be cached based on the user sequence and the sequence of content to be cached to obtain a cached feature vector corresponding to each piece of content to be cached includes: For each piece of content information to be cached, the position of the user corresponding to the content information to be cached in the user sequence is vectorized to obtain a first vector corresponding to the content information to be cached, and the position of the content sequence to be cached corresponding to the content information to be cached is vectorized to obtain a second vector corresponding to the content information to be cached. Extract the feature information from the content information to be cached, and vectorize the feature information to obtain the third vector corresponding to the content information to be cached; Based on the first vector, the second vector, and the third vector corresponding to the content information to be cached, the feature vector to be cached corresponding to the content information to be cached is determined.

3. The method according to claim 2, characterized in that, The step of performing attention evaluation processing on each of the feature vectors to be cached through a self-attention mechanism to obtain a self-attention score for each feature vector to be cached includes: For each piece of content information to be cached, the first vector and the third vector corresponding to the content information to be cached are mapped to the same spatial layer to obtain the first vector and the third vector of the same spatial layer. Then, the attention weight matrix corresponding to the content information to be cached is calculated based on the first vector and the third vector of the same spatial layer using the point attention mechanism algorithm. Based on the information of each content to be cached, calculate the self-attention mechanism loss value corresponding to all the information of the content to be cached, and based on the attention weight matrix corresponding to the information of the content to be cached and the second vector corresponding to the information of the content to be cached, calculate the self-attention score of the feature vector to be cached through the diagonal algorithm of the self-attention mechanism.

4. The method according to claim 2, characterized in that, Based on the self-attention score of each feature vector to be cached and the user sequence corresponding to each user, the similarity distance algorithm is used to calculate the similarity distance between the feature vectors corresponding to two adjacent pieces of content to be cached in the sequence of content to be cached, and based on the similarity distance between each piece of content to be cached, the final score value corresponding to each piece of content to be cached is determined, including: For each piece of content information to be cached, based on the content information to be cached and the next piece of content information to be cached adjacent to the content information to be cached in the sequence of content information to be cached, calculate the Euclidean distance between the content information to be cached and the next piece of content information to be cached, and based on the self-attention score of the content information to be cached and the next piece of content information to be cached, calculate the short-term user dependency value between the content information to be cached and the next piece of content information to be cached. Based on the first vector corresponding to the content information to be cached and the third vector corresponding to the content information to be cached, calculate the Euclidean distance between the first vector and the third vector corresponding to the content information to be cached, and the long-term user preference value of the content information to be cached; Based on the short-term user dependency value and the long-term user preference value, the final rating value corresponding to the content information to be cached is calculated.

5. The method according to claim 4, characterized in that, The step of calculating the final rating value corresponding to the content information to be cached based on the short-term user dependency value and the long-term user preference value includes: The Euclidean distance between the content to be cached and the next content to be cached is normalized to obtain the short-term user dependency value weight. The Euclidean distance between the first vector and the third vector corresponding to the content to be cached is normalized to obtain the long-term user preference value weight. Based on the short-term user dependency value weight and the long-term user preference value weight, the short-term user dependency value and the long-term user preference value are weighted and summed to obtain the final score value corresponding to the content to be cached.

6. The method according to claim 1, characterized in that, The step of calculating the self-attention mechanism loss value corresponding to all the content to be cached based on the content to be cached includes: Identify the interaction information between each piece of content to be cached and the corresponding user, and analyze the category of each interaction information; Based on the category of each interaction information and the corresponding content information to be cached for each category, the loss value of the self-attention mechanism for all content information to be cached is calculated using the loss function of the self-attention mechanism.

7. The method according to claim 6, characterized in that, Based on the category of each interaction information and the corresponding content information to be cached for each category, the self-attention mechanism loss value is calculated for all content information to be cached using the loss function of the self-attention mechanism, including: By using the loss function algorithm of the self-attention mechanism corresponding to each category of interaction information, the sub-self-attention loss value corresponding to each category of interaction information is calculated separately. The sub-self-attention loss values ​​corresponding to the content information to be cached for all categories of interaction information are then summarized to obtain the self-attention mechanism loss value corresponding to all content information to be cached.

8. A cache content sorting device, characterized in that, The device includes: The acquisition module is used to acquire a sequence of cached content requested by multiple users at different time points, a user sequence corresponding to each user, and multiple cached content information corresponding to the sequence of cached content; the user sequence is a sequence obtained by arranging the users in the order of their request time points. The evaluation module is used to perform feature processing on each piece of content to be cached based on the user sequence and the sequence of content to be cached, to obtain a cached feature vector corresponding to each piece of content to be cached, and to perform attention evaluation processing on each piece of feature vector to be cached through a self-attention mechanism to obtain a self-attention score for each feature vector to be cached. The scoring module is used to calculate the similarity distance between the feature vectors corresponding to two adjacent pieces of content to be cached in the sequence of content to be cached, based on the self-attention score of each feature vector to be cached and the user sequence corresponding to each user, using a similarity distance algorithm, and to determine the final score value corresponding to each piece of content to be cached based on the similarity distance between each piece of content to be cached. The sorting module is used to arrange the content information to be cached in descending order of the final score value to obtain the target cache sequence corresponding to all the content information to be cached; when the target cache sequence is used for edge caching, the content information to be cached is cached according to the target cache sequence.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Active content caching method based on network edge knowledge graph

    CN115129888A

  • Serialized neural collaborative filtering recommendation method based on self-attention mechanism

    CN116151928A