Resource recall method, device, equipment and storage medium
By obtaining multiple meaning feature vectors of the target resources through pre-trained feature extraction models, the problem that representation learning in existing technologies cannot recall diverse resources is solved, and the richness of the search system or recommendation system and the user experience are improved.
Patent Information
- Application Number
- CN202111556222.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2041-12-17
AI Technical Summary
The representation learning methods in existing technologies fail to effectively express the diverse characteristics of media resources, resulting in the inability of search systems or recommendation systems to recall diverse resources, resulting in a poor user experience.
The target feature vector of the target resource is obtained through the pre-trained feature extraction model, and the feature values in the target feature vector that match the positive sample are used for training. The feature values of different categories are retained, and the recalled resources are determined based on the feature vector matching degree of the candidate resources to achieve recall of multiple categories.
It improves the category diversity of recalled resources, enhances the richness of search systems or recommendation systems, and improves user experience.
Smart Images

Figure CN114298182B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a resource recall method, apparatus, device, and storage medium. Background Art
[0002] In the field of machine learning, representation learning is increasingly being used to improve learning outcomes. Specifically, representation learning is the process of converting raw data into data that is more easily applicable to machine learning. For example, representation learning can map the raw data of a media resource into a vector space, compressing the media resource features into a lower-dimensional feature vector within that vector space. This lower-dimensional feature vector can then be applied to subsequent models.
[0003] However, representation learning in related technologies often neglects the diverse expressive power of feature vectors, resulting in lower-dimensional feature vectors that can only express a single meaning of a media resource. For example, when learning a representation for the word "apple," the resulting feature vector can only express the single meaning of "Apple phone." Consequently, when this feature vector is subsequently used in the recall phase of a search or recommendation system, it is unable to retrieve diverse resources. For example, it cannot retrieve resources beyond the meaning expressed by the feature vector, such as resources related to "edible apples." This severely limits the richness of the search or recommendation system and results in a poor user experience. Summary of the Invention
[0004] The present disclosure provides a resource recall method, apparatus, device, and storage medium to at least address the problem in related technologies of being unable to provide diverse recall resources for search systems or recommendation systems, which severely limits the richness of the system. The technical solutions of the present disclosure are as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a resource recall method is provided, comprising: obtaining a target feature vector of a target resource based on a first sub-model of a pre-trained feature extraction model; wherein the target feature vector is used to indicate a first meaning and a second meaning of the target resource, and the first meaning is different from the second meaning; the pre-trained feature extraction model is pre-trained using feature values in the feature vector of the target resource that match positive samples; obtaining a candidate feature vector of a candidate resource based on a second sub-model of the pre-trained feature extraction model; determining at least two categories of recalled resources corresponding to the target resource based on the degree of matching between the target feature vector and the candidate feature vector; wherein one category of recalled resources matches the first meaning, and another category of recalled resources matches the second meaning.
[0006] In a possible embodiment, the method also includes: based on the second sub-model, performing a first preset processing on the feature vector of the recalled resource to obtain a recalled feature vector; the first preset processing is to set the eigenvalues of some dimensions in the feature vector to 1 and the eigenvalues of other dimensions to 0, and the eigenvalues of some dimensions are greater than the eigenvalues of other dimensions; based on some dimensions in the recalled feature vector whose eigenvalues are 1, determining the category identifier of the recalled resource, and the category identifier is used to determine the display order of the recalled resources.
[0007] In another possible embodiment, the training process of the feature extraction model includes: obtaining training samples of the target resource, the training samples including a first positive sample and a negative sample; training the feature extraction model for a first training task based on the target resource, the first positive sample and the negative sample; the first training task is used to enable the eigenvalues in the feature vector of the target resource that match the eigenvector of the first positive sample to participate in the training of the first training task; updating the parameters of the feature extraction model based on the first loss function of the first training task; iteratively performing the above steps, and determining that the feature extraction model has converged when the first loss function of the first training task converges.
[0008] In another possible embodiment, the training sample also includes a second positive sample, and the first positive sample and the second positive sample belong to different categories; the training process of the feature extraction model also includes: training the feature extraction model for a second training task based on the target resource, the first positive sample and the second positive sample; the second training task is used to make the difference in matching degree between the target resource and positive samples of different categories less than a first preset threshold; based on the first loss function of the first training task, updating the parameters of the feature extraction model, including: based on the first loss function of the first training task and the second loss function of the second training task, updating the parameters of the feature extraction model; when the first loss function of the first training task converges, determining that the feature extraction model converges, including: when the first loss function of the first training task and the second loss function of the second training task converge, determining that the feature extraction model converges.
[0009] In another possible embodiment, the feature extraction model is trained for a first training task based on the target resource, the first positive sample and the negative sample, including: determining the first feature vector of the target resource based on the first sub-model, and determining the second feature vector of the first positive sample and the third feature vector of the negative sample based on the second sub-model; performing a second preset processing on the first feature vector, the second feature vector and the third feature vector, respectively, to obtain the first target feature vector, the second target feature vector and the third feature vector accordingly; the second preset processing is to set the eigenvalue of the first part dimension in the feature vector to 0; determine the first similarity vector between the first target feature vector and the second target feature vector, and the second similarity vector between the first target feature vector and the third target feature vector; perform a third preset processing on the first similarity vector and the second feature similarity vector, respectively, to obtain the first target similarity vector and the second target similarity vector accordingly; the third preset processing is to set the eigenvalue of the second part dimension in the vector to 0, and the eigenvalue of the second part dimension is less than the eigenvalue of other dimensions; based on the difference between the first target similarity vector and the second target similarity vector, determine the first loss function of the first training task.
[0010] In another possible implementation, a first loss function is determined based on the difference between the first target similarity vector and the second target similarity vector, including: when the difference between the first target similarity vector and the second target similarity vector is greater than a second preset threshold, determining the difference as the first loss function; when the difference is less than or equal to the second preset threshold, determining the first loss function to be 0.
[0011] In another possible implementation, the feature extraction model is trained for a second training task based on the target resource, the first positive sample, and the second positive sample, including: determining the fourth eigenvector of the second positive sample based on the second sub-model; determining the third similarity vector between the first eigenvector and the second eigenvector, and the fourth similarity vector between the first eigenvector and the fourth eigenvector; and determining the second loss function of the second training task based on the difference between the third similarity vector and the fourth similarity vector.
[0012] In another possible embodiment, the information for determining the first feature vector includes at least one of the image information, text information, and voice information of the target resource; and / or the information for determining the second feature vector includes at least one of the image information, text information, and voice information of the first positive sample; and / or the information for determining the third feature vector includes at least one of the image information, text information, and voice information of the second positive sample; and / or the information for determining the fourth feature vector includes at least one of the image information, text information, and voice information of the negative sample.
[0013] In another possible implementation, the information for determining the candidate feature vector includes at least one of the image information, text information, and voice information of the candidate resource; and / or the information for determining the target feature vector includes at least one of the image information, text information, and voice information of the target resource.
[0014] According to a second aspect of an embodiment of the present disclosure, a resource recall device is provided, comprising: a first feature module, configured to obtain a target feature vector of a target resource based on a first sub-model of a pre-trained feature extraction model; wherein the target feature vector is used to indicate a first meaning and a second meaning of the target resource, and the first meaning is different from the second meaning; the pre-trained feature extraction model is pre-trained using feature values in the feature vector of the target resource that match positive samples; a second feature module, configured to obtain a candidate feature vector of a candidate resource based on a second sub-model of the pre-trained feature extraction model; a resource determination module, configured to determine at least two categories of recalled resources corresponding to the target resource based on the degree of matching between the target feature vector and the candidate feature vector; wherein one category of recalled resources matches the first meaning, and another category of recalled resources matches the second meaning.
[0015] In one possible embodiment, the second feature module is further configured to execute: based on the second sub-model, performing a first preset processing on the feature vector of the recalled resource to obtain a recalled feature vector; the first preset processing is to set the eigenvalues of some dimensions in the feature vector to 1 and the eigenvalues of other dimensions to 0, and the eigenvalues of some dimensions are greater than the eigenvalues of other dimensions; based on some dimensions in the recalled feature vector whose eigenvalues are 1, determining the category identifier of the recalled resource, and the category identifier is used to determine the display order of the recalled resource.
[0016] In another possible embodiment, the device also includes a training module, which is configured to perform: obtaining training samples of the target resource, the training samples including a first positive sample and a negative sample; training the feature extraction model for a first training task based on the target resource, the first positive sample and the negative sample; the first training task is used to enable the eigenvalues in the feature vector of the target resource that match the eigenvector of the first positive sample to participate in the training of the first training task; updating the parameters of the feature extraction model based on the first loss function of the first training task; iteratively performing the above steps, and determining that the feature extraction model has converged when the first loss function of the first training task has converged.
[0017] In another possible embodiment, the training sample also includes a second positive sample, and the first positive sample and the second positive sample belong to different categories; the training module is also configured to execute: training the feature extraction model for a second training task based on the target resource, the first positive sample and the second positive sample; the second training task is used to make the difference in matching degree between the target resource and positive samples of different categories less than a first preset threshold; the training module is specifically configured to execute: updating the parameters of the feature extraction model based on the first loss function of the first training task and the second loss function of the second training task; the training module is specifically configured to execute: determining that the feature extraction model converges when the first loss function of the first training task and the second loss function of the second training task converge.
[0018] In another possible embodiment, the training module is specifically configured to execute: determining the first feature vector of the target resource based on the first sub-model, and determining the second feature vector of the first positive sample and the third feature vector of the negative sample based on the second sub-model; performing a second preset processing on the first feature vector, the second feature vector and the third feature vector, respectively, to obtain the first target feature vector, the second target feature vector and the third feature vector accordingly; the second preset processing is to set the eigenvalue of the first part dimension in the feature vector to 0; determining the first similarity vector between the first target feature vector and the second target feature vector, and the second similarity vector between the first target feature vector and the third target feature vector; performing a third preset processing on the first similarity vector and the second feature similarity vector, respectively, to obtain the first target similarity vector and the second target similarity vector accordingly; the third preset processing is to set the eigenvalue of the second part dimension in the vector to 0, and the eigenvalue of the second part dimension is smaller than the eigenvalue of other dimensions; based on the difference between the first target similarity vector and the second target similarity vector, determine the first loss function of the first training task.
[0019] In another possible implementation, the training module is specifically configured to execute: when the difference between the first target similarity vector and the second target similarity vector is greater than a second preset threshold, determining the difference to be a first loss function; when the difference is less than or equal to the second preset threshold, determining the first loss function to be 0.
[0020] In another possible implementation, the training module is specifically configured to perform: determining the fourth eigenvector of the second positive sample based on the second sub-model; determining the third similarity vector between the first eigenvector and the second eigenvector, and the fourth similarity vector between the first eigenvector and the fourth eigenvector; and determining the second loss function of the second training task based on the difference between the third similarity vector and the fourth similarity vector.
[0021] In another possible embodiment, the information for determining the first feature vector includes at least one of the image information, text information, and voice information of the target resource; and / or the information for determining the second feature vector includes at least one of the image information, text information, and voice information of the first positive sample; and / or the information for determining the third feature vector includes at least one of the image information, text information, and voice information of the second positive sample; and / or the information for determining the fourth feature vector includes at least one of the image information, text information, and voice information of the negative sample.
[0022] In another possible implementation, the information for determining the candidate feature vector includes at least one of the image information, text information, and voice information of the candidate resource; and / or the information for determining the target feature vector includes at least one of the image information, text information, and voice information of the target resource.
[0023] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement the method of the above-mentioned first aspect and any possible implementation method thereof.
[0024] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method in the above-mentioned first aspect and any possible implementation method thereof.
[0025] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method of the above-mentioned first aspect and any possible implementation method thereof.
[0026] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects: the target feature vector of the target resource is extracted through the pre-trained first sub-model, thereby obtaining a feature vector that can represent multiple meanings of the target resource, improving the diversity expression ability of the target feature vector, and then when determining the recall resource through the matching degree between the target feature vector and the candidate resource, multiple categories of candidate resources are determined as the recall resource by matching the feature vectors expressing multiple meanings, thereby achieving the purpose of improving the category diversity of the recall resource, improving the richness of the search system or recommendation system using the recall resource, and improving the user experience of the object account.
[0027] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.
[0029] Figure 1 is a schematic diagram of resources recalled in the prior art according to an exemplary embodiment;
[0030] Figure 2 is a schematic diagram of a feature vector in the prior art according to an exemplary embodiment;
[0031] Figure 3 is a flow chart showing a resource recall method according to an exemplary embodiment;
[0032] Figure 4 is a schematic diagram showing a recalled resource according to an exemplary embodiment;
[0033] Figure 5 is a schematic diagram showing another type of recalled resources according to an exemplary embodiment;
[0034] Figure 6 is a flow chart showing another resource recall method according to an exemplary embodiment;
[0035] Figure 7 is a flow chart showing another resource recall method according to an exemplary embodiment;
[0036] Figure 8 is a diagram showing a training principle of a feature extraction model according to an exemplary embodiment;
[0037] Figure 9 is a block diagram of a resource recall device according to an exemplary embodiment;
[0038] Figure 10 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0039] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0040] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.
[0041] Before introducing the information processing method provided by the present disclosure in detail, a brief introduction to the application scenarios and implementation environment involved in the present disclosure is first given.
[0042] First, a brief introduction to the application scenarios involved in this disclosure is given.
[0043] With the growing popularity of short video apps, tens of millions of new videos are being filmed and uploaded daily by these accounts. This massive data volume inevitably leads to significant data sparsity. Therefore, effectively representing videos requires exceptionally sophisticated feature engineering. Consequently, representation learning is increasingly being used in feature engineering.
[0044] Representation learning maps content (i.e., media resources) to a vector space, so that the feature vector of the content is compressed into a lower-dimensional feature vector in the vector space, which can be applied by subsequent models. The most common application is in the recall phase of recommendation systems and search systems. Through nearest neighbor retrieval, this lower-dimensional feature vector is used to retrieve thousands of relevant results from a pool of hundreds of millions of materials. The party that triggers the retrieval is called the "query", and the party being retrieved is called the "content (doc)". The content is used to represent any media resource in a collection of media resources.
[0045] However, representation learning in related technologies often neglects the diverse expressive power of feature vectors, resulting in lower-dimensional feature vectors that can only express a single meaning of a media resource. For example, when learning the representation of "apple," the resulting feature vector can only express the single meaning of "apple (mobile phone)." This results in the feature vector being unable to recall diverse resources (i.e., multiple categories of resources) for the search or recommendation system when it is subsequently used in the recall phase. For example, it cannot recall resources other than those represented by the feature vector, such as resources related to "apple (plant)." This severely limits the richness of the search or recommendation system and results in a poor user experience.
[0046] Specifically, if Figure 1 As shown, the horizontal axis represents the dimension of the feature vector, the vertical axis represents the eigenvalue of the feature vector, and each rectangle represents a dimension of the feature vector. Figure 1 As shown in (A) in the figure, the feature vector of apple can originally include the dimension representing the first meaning (for example, the first meaning is apple (plant)) and the dimension representing the second meaning (for example, the second meaning is apple (mobile phone)). However, after representation learning, the eigenvalues corresponding to the dimension representing the first meaning in the low-dimensional feature vector output by the neural network model are compressed, which makes it impossible for the low-dimensional feature vector to express the meaning of apple (plant). If the low-dimensional feature is used in the recall stage of the search system or recommendation system, it can only recall the following: Figure 2 As shown in the figure, resources related to apple (mobile phone) cannot be used to recall resources related to apple (plant) for the search system or recommendation system. Figure 1 As shown in (B) in the figure, the eigenvector of Apple (mobile phone) originally represented some dimensions of its meaning. After representation learning, the eigenvalues corresponding to these dimensions in the low-dimensional eigenvector output by the neural network model are not compressed and can still express the meaning of Apple (mobile phone).
[0047] In one example, the Embedding Based Retrieval (EBR) recall model is one of the current benchmarks of content feature vector (Embedding) technology. During the training process, this recall model uses object behavior (retrieval object-content combination, query-doc pair) in the search log to construct training samples. Among them, the content operated by the object within a preset time period is used as a positive sample, and the negative sample is randomly selected from the entire content. The initial feature extraction model is a two-tower model. One side is the retrieval object tower (i.e., the query tower), which maps the retrieval object to an n-dimensional space vector (for example, the n-dimensional space vector is embedding1), and the other side is the content tower (i.e., the doc tower), which also maps the content to an n-dimensional space vector (for example, the n-dimensional space vector is embedding2). The correlation between the two embeddings (i.e., embedding1 and embedding2) is calculated using the cosine similarity algorithm. If it is a positive sample, the correlation of the combination should be as high as possible, and if it is a negative sample, the correlation of the combination should be as low as possible. The output of the query tower is the representation of the query, and the output of the doc tower is the representation of the content. They can be directly applied to large-scale vector retrieval frameworks such as AI Similarity Search (FAISS).
[0048] During model training, this approach prioritizes the handling of negative samples. For example, various semi-hard negative mining methods are used to identify difficult-to-distinguish negative samples for enhanced training. For example, when an apple (mobile phone) is a positive sample, other apple-related content, such as apple (plant), is defined as a difficult negative sample. Furthermore, because the cross-entropy (info-nce) loss function is often used during training, a single positive sample is paired with all other negative samples across multiple training samples (i.e., within a batch) to calculate the loss, this leads to further intensive training for difficult-to-distinguish negative samples.
[0049] However, positive examples in training samples are often imbalanced. For example, during a recent Apple event, the majority of positive examples for "apple" in the object behavior category were likely related to "apple (mobile phone)," while only a minority were related to "apple (plant)." Therefore, when mining difficult examples, "search object: apple - content: apple (plant)" will likely become a negative example for "search object: apple - content: apple (mobile phone)," thus being heavily intensively trained. This results in the distance between "search object: apple" and "content: apple (plant)" being much greater than the distance between "search object: apple" and "content: apple (mobile phone)." In a nearest neighbor search, the results will all be "search object: Apple mobile phone." The info-nce loss function, which increases the proportion of negative examples, increases the probability of matching the false negative example "search object: apple (plant)," exacerbating this imbalance.
[0050] In response to the above problems, the present disclosure provides a resource recall method, which extracts the target feature vector of the target resource through a pre-trained first sub-model, thereby obtaining a feature vector that can represent multiple meanings of the target resource, improving the diversity expression capability of the target feature vector, and then when determining the recalled resource through the matching degree between the target feature vector and the candidate resource, multiple categories of candidate resources are determined as recalled resources by matching the feature vectors expressing multiple meanings, thereby achieving the purpose of increasing the category diversity of the recalled resources, improving the richness of the search system or recommendation system using the recalled resource, and improving the user experience of the object account.
[0051] Next, the implementation environment (implementation architecture) involved in this disclosure is briefly introduced below.
[0052] The resource recall method provided in the embodiments of the present disclosure can be applied to electronic devices. The electronic device can be a terminal device or a server. The terminal device can be a smartphone, tablet computer, PDA, vehicle-mounted terminal, desktop computer, laptop computer, etc. The server can be any server or server cluster, which is not limited in this disclosure.
[0053] For ease of understanding, the resource recall method provided by the present disclosure is described in detail below with reference to the accompanying drawings.
[0054] Figure 3 FIG. 1 is a flow chart of a resource recall method according to an exemplary embodiment, which is used in an electronic device. Figure 3 As shown, the resource recall method includes the following steps:
[0055] S301: Based on the first sub-model of the pre-trained feature extraction model, a target feature vector of the target resource is obtained; the target feature vector is used to indicate a first meaning and a second meaning of the target resource, where the first meaning is different from the second meaning.
[0056] The pre-trained feature extraction model is trained using the eigenvalues in the target resource's feature vector that match the positive samples. This allows all eigenvalues in the target resource's feature vector that match positive samples from different categories to participate in the training. This allows the eigenvalues in the target resource's feature vector that express different meanings to be retained, allowing the target resource's feature vector to express different meanings.
[0057] Optionally, the target resource may be any one of a text resource, a video resource or an image resource.
[0058] In one embodiment, the pre-trained feature extraction model is a two-tower model. The first sub-model and the second sub-model each correspond to a tower of the two-tower model. For example, the first sub-model corresponds to the search object tower of the two-tower model and is used to output a feature vector of the party that triggers the search, such as the feature vector of the search term. The second sub-model is the content tower of the two-tower model and is used to output a feature vector of the party being searched, such as the feature vector of the content.
[0059] Optionally, the information used to determine the target feature vector includes at least one of image information, text information, and voice information of the target resource.
[0060] In one embodiment, when the target resource is a video resource, the information for determining the target feature vector includes image information, text information, and voice information of the target resource.
[0061] In the above embodiment, determining the feature vector of the target resource through multimodal information (ie, image information, text information, and voice information) can improve the expressiveness of the feature vector, thereby enabling the target feature vector to more accurately express the meaning of the target resource.
[0062] In one embodiment, Figure 4As shown in the figure, the target resource is "apple", that is, the party triggering the search needs to retrieve content related to apples. The horizontal axis represents the dimension of the feature vector, the vertical axis represents the eigenvalue of the feature vector, and each rectangle represents a dimension of the feature vector. At this time, the first sub-model outputs the feature vector of apple. Figure 4 As shown in (A) in the figure, the feature vector of apple can originally include a dimension representing the first meaning (for example, the first meaning is apple (plant)) and a dimension representing the second meaning (for example, the second meaning is apple (mobile phone)). After representation, in the low-dimensional target feature vector output by the first sub-model, the eigenvalues corresponding to the dimension representing the first meaning are not compressed, so that the dimension representing the first meaning and the dimension representing the second meaning of the target feature vector are both retained, thereby enabling the target feature vector to be used to indicate the first meaning and the second meaning of the target resource, that is, to indicate both the meanings of apple (mobile phone) and apple (plant).
[0063] S302: Based on the second sub-model of the pre-trained feature extraction model, obtain candidate feature vectors of the candidate resources.
[0064] In one embodiment, when the target resource is "Apple", the candidate resources at least include "Apple (mobile phone)". Figure 4 As shown in (B), the feature vector of "Apple (mobile phone)" originally represents some dimensions of its meaning. After representation learning, the feature values corresponding to these dimensions in the low-dimensional candidate feature vector output by the second sub-model are not compressed and can still express the meaning of Apple (mobile phone).
[0065] It should be noted that the candidate resources may be obtained from a collection of multiple media resources, for example, from an application's content pool, which includes resources uploaded by the application's target account.
[0066] Optionally, the candidate resource may be any one of a text resource, a video resource or an image resource.
[0067] Optionally, the information used to determine the candidate feature vector includes at least one of image information, text information, and voice information of the candidate resource.
[0068] In one embodiment, when the candidate resource is a video resource, the information for determining the candidate feature vector includes image information, text information, and voice information of the candidate resource.
[0069] In the above embodiment, determining the feature vector of the candidate resource through multimodal information (ie, image information, text information, and voice information) can improve the expressiveness of the feature vector, thereby enabling the candidate feature vector to more accurately express the meaning of the candidate resource.
[0070] S303: Determine at least two categories of recalled resources corresponding to the target resource based on the matching degree between the target feature vector and the candidate feature vector.
[0071] Among them, the recalled resources of one category match the first meaning, and the recalled resources of the other category match the second meaning.
[0072] In one embodiment, for example, the target resource is "apple", and the target feature vector expresses two meanings: "apple (mobile phone)" and "apple (plant)". Then, when the target feature vector is matched with the candidate feature vector expressing "apple (mobile phone)", a better matching result will be obtained, and when the target feature vector is matched with the candidate feature vector expressing "apple (plant)", a better matching result will also be obtained. Therefore, based on the matching degree between the target feature vector and the candidate feature vector, when determining the recall resource corresponding to the target resource, two categories of recall resources will be obtained, for example, Figure 5 As shown in the recall results, one is “apple (mobile phone)” and the other is “apple (plant)”. The two categories of recalled resources correspond to the two meanings indicated by the target feature vector respectively.
[0073] In the above embodiment, the target feature vector of the target resource is extracted through the pre-trained first sub-model, thereby obtaining a feature vector that can represent multiple meanings of the target resource, thereby improving the diversity expression ability of the target feature vector. Furthermore, when determining the recall resource through the matching degree between the target feature vector and the candidate resource, multiple categories of candidate resources are determined as recall resources through matching of feature vectors expressing multiple meanings, thereby achieving the purpose of improving the category diversity of the recall resource, improving the richness of the search system or recommendation system using the recall resource, and improving the user experience of the object account.
[0074] In a possible implementation, the resource recall method further includes:
[0075] Step 1: Based on the second sub-model, perform a first preset processing on the feature vector of the recalled resource to obtain the recalled feature vector. The first preset processing is to set the eigenvalues of some dimensions in the feature vector to 1 and the eigenvalues of other dimensions to 0, with the eigenvalues of some dimensions being greater than the eigenvalues of other dimensions.
[0076] It should be noted that the other dimensions are the dimensions in the feature vector of the recalled resource excluding some dimensions. In addition, the first preset process is equivalent to hashing the feature vector of the recalled resource.
[0077] Optionally, the partial dimensions may be 6 dimensions, 7 dimensions, or 8 dimensions, which are regarded as different hash functions.
[0078] In one embodiment, Figure 4As shown in (B), the eigenvalues of the candidate feature vector representing the meaning of the candidate resource are concentrated in a few dimensions, and the eigenvalues of the few dimensions are greater than the eigenvalues of other dimensions. After the candidate resource corresponding to the candidate feature vector is determined to be a recalled resource, the feature vector of the recalled resource is subjected to a first preset processing, that is, the eigenvalues of the few dimensions are set to 1, and the eigenvalues of other dimensions are set to 0. For example, the dimension of the candidate feature vector is 128 dimensions, so a 128-bit binary number is obtained. It can be understood that the dimension of the eigenvalues (i.e., the effective value of the eigenvector) representing the meaning of the candidate resource for the feature vectors of the same category is usually the same. For example, the eigenvector representing "Apple (mobile phone)" is usually represented by the eigenvalues of the 57-64 dimensions of the feature vector, and the eigenvector representing "Apple (plant)" is usually represented by the eigenvalues of the 1-8 dimensions of the feature vector. Therefore, after the feature vectors of the recalled resources are hashed, the recalled resources of the same category usually have the same recall feature vector.
[0079] Step 2: Based on some dimensions of the recalled feature vector whose eigenvalues are 1, determine the category identifiers of the recalled resources. The category identifiers are used to determine the display order of the recalled resources.
[0080] In one embodiment, Figure 5 As shown, ID is used to represent the category identifier. For example, the category identifier for Apple (mobile phone) is 57, and the category identifier for Apple (plant) is 8568. When the order of recalled resources is determined by the category identifier for the electronic device of the target account, the recalled resources of the two categories are displayed alternately to increase the diversity of the displayed recalled resources.
[0081] In the above embodiment, since the effective values of the feature vectors of the recalled resources of the same category are usually concentrated in the same dimension, after the feature vectors of the recalled resources are hashed, the recalled resources of the same category will have the same recall feature vector, so that when the category identifier of the recalled resource is determined based on the recall feature vector, the recalled resources of the same category will have the same category identifier, thereby better explaining the category of the recalled resource. Furthermore, when the search system or recommendation system determines the display order of the recalled resources based on the category identifier, it can ensure that recalled resources of different categories can be displayed, thereby improving the richness of the search system or recommendation system.
[0082] In one possible implementation, Figure 6 As shown in Figure 2, the training process of the feature extraction model includes:
[0083] S601: Acquire training samples of target resources, where the training samples include a first positive sample and a negative sample.
[0084] In one embodiment, the content operated by the subject account within a recent preset time period (e.g., the past month) (e.g., the content clicked by the subject account among multiple contents obtained by the subject account through searching for the target resource) is obtained, multiple categories of positive samples are obtained from the operated content, and the first positive sample is obtained from the multiple categories of positive samples. For example, if the target resource is "apple", the content clicked by the subject account in the past month includes two categories: apple (mobile phone) and apple (plant).
[0085] In one embodiment, negative samples are selected from a candidate resource library. For example, the negative sample can be any candidate resource in the candidate resource library.
[0086] S602: Perform a first training task on the feature extraction model based on the target resource, the first positive sample, and the negative sample; the first training task is used to enable the feature values in the feature vector of the target resource that match the feature vector of the first positive sample to participate in the training of the first training task.
[0087] In one embodiment, the first sub-model outputs a feature vector of the target resource, for example, the feature vector of the target resource is a 128-dimensional feature vector (Embedding). The second sub-model outputs a feature vector of the first positive sample and a feature vector of the negative sample, for example, the feature vector of the first positive sample and the feature vector of the negative sample are each a 128-dimensional feature vector (Embedding).
[0088] In one embodiment, when the target resource is a text resource, the first sub-model extracts a feature vector of the target resource through a BERT feature extractor.
[0089] In another embodiment, when the target resource is an image resource, the first sub-model extracts a feature vector of the target resource through a Resnet feature extractor.
[0090] In another embodiment, when the target resource is a video resource, the first sub-model extracts image information, text information, and voice information of the target resource through a Resnet feature extractor and a BERT feature extractor, respectively.
[0091] It should be noted that when the second sub-model extracts feature vectors for the first positive samples and negative samples, it can refer to the method of extracting feature vectors for the target resource by the first sub-model. To avoid repetition, it will not be repeated here.
[0092] S603: Based on the first loss function of the first training task, update the parameters of the feature extraction model.
[0093] In one embodiment, parameters of the first sub-model and the second sub-model of the feature extraction model are updated based on the first loss function.
[0094] It should be noted that the parameters of the feature extraction model can be updated using the gradient descent method or other publicly available methods, and this disclosure does not impose any restrictions on this.
[0095] S604: Iteratively execute the above S601, S602 and S603, and determine that the feature extraction model converges when the first loss function of the first training task converges.
[0096] In one embodiment, S601 and S602 are iteratively performed until the first loss function of the first training task converges, thereby determining that the feature extraction model has converged. This converged feature extraction model serves as the pre-trained feature extraction model in S301. For example, convergence of the first loss function can be determined when the difference between the first loss functions obtained in two consecutive iterations is less than a preset threshold A.
[0097] Optionally, during multiple rounds of iterations, the training samples of the target resource acquired in S601 are different, wherein the different training samples include different first positive samples or different negative samples in the training samples.
[0098] In another embodiment, the above steps S601, S602 and S603 are iterated for a preset number of times to determine whether the first loss function has converged and whether the feature extraction model has converged. The converged feature extraction model is used as the pre-trained feature extraction model in S301.
[0099] In the above embodiment, in each training, since the first training task can enable the eigenvalues in the feature vector of the target resource that match the eigenvector of the first positive sample to participate in the training of the first training task, the eigenvalues in the feature vector of the target resource that match the positive samples of different categories all participate in the training, thereby enabling the eigenvalues expressing different meanings in the feature vector of the target resource to be retained, thereby achieving that the feature vector of the target resource can express different meanings of the target resource.
[0100] In a possible implementation, the training sample further includes a second positive sample, and the first positive sample and the second positive sample belong to different categories. Figure 5 ,like Figure 7 As shown, the training process of the feature extraction model also includes:
[0101] S605: Performing training on the feature extraction model for a second training task based on the target resource, the first positive sample, and the second positive sample.
[0102] The second training task is used to ensure that the difference in matching degree between the target resource and positive samples of different categories is less than a first preset threshold.
[0103] Optionally, the first training task and the second training task are trained simultaneously. That is, in one training session, the feature extraction model is trained on the first training task and the second training task simultaneously.
[0104] S603 includes: S603A.
[0105] S603A: Update parameters of the feature extraction model based on the first loss function of the first training task and the second loss function of the second training task.
[0106] In one embodiment, parameters of the first sub-model and the second sub-model of the feature extraction model are updated based on the first loss function and the second loss function.
[0107] It should be noted that the parameters of the feature extraction model can be updated using the gradient descent method or other publicly available methods, and this disclosure does not impose any restrictions on this.
[0108] S604 includes: S604A.
[0109] S604A: Iteratively execute the above S601, S602, S605 and S603A, and determine that the feature extraction model converges when the first loss function of the first training task and the second loss function of the second training task converge.
[0110] Optionally, a sum of the first loss function and the second loss function is determined as a target loss function.
[0111] In one embodiment, the above steps S601, S602, S605, and S603A are iteratively performed until the target loss function converges, thereby determining that the feature extraction model has converged. The converged feature extraction model serves as the pre-trained feature extraction model in S301. For example, convergence of the target loss function can be determined when the difference between the target loss functions obtained in two consecutive iterations is less than a preset threshold B.
[0112] Optionally, during multiple rounds of iterations, the training samples of the target resource acquired in S601 are different, wherein the different training samples include different first positive samples, different second positive samples, or different negative samples in the training samples.
[0113] In another embodiment, the above steps S601 and S602 are iterated for a preset number of times to determine whether the target loss function has converged and whether the feature extraction model has converged. The converged feature extraction model is used as the pre-trained feature extraction model in S301.
[0114] It should be noted that in the present disclosure, the target loss function is the sum of the first loss function and the second loss function. When the target loss function converges, it is determined that the first loss function and the second loss function converge separately.
[0115] In the above embodiment, the first training task is used to train the target resource to have a matching degree difference with positive samples of different categories that is less than a first preset threshold value, so that the matching degree between the target resource and positive samples of different categories is as close as possible, so that when the target resource is triggered for retrieval, the recalled resources of different categories that match the target resource are likely to be sorted in a front position, thereby avoiding the situation where only one category of recalled resources is sorted in a front position, while the recalled resources of another category are sorted in a relatively back position, so that multiple categories of recalled resources cannot be displayed for the object account.
[0116] In a possible implementation, S602 includes:
[0117] Step 1: Determine a first feature vector of the target resource based on the first sub-model, and determine a second feature vector of the first positive sample and a third feature vector of the negative sample based on the second sub-model.
[0118] In one embodiment, Figure 8 As shown, the first sub-model extracts features from the target resource to obtain a first feature vector. For example, the text feature extractor BERT or the text feature extractor Roberta is used to extract features from "apple" to obtain a 128-dimensional first feature vector (embedding).
[0119] In one embodiment, the second sub-model performs feature extraction on the first positive sample and the negative sample, respectively, to obtain a second feature vector and a third feature vector. For example, the image feature extractor Resnet or the image feature extractor ViT is used to extract image features of "Apple (mobile phone)", and the text feature extractor BERT or the text feature extractor Roberta is used to extract features of text information and voice information of "Apple (mobile phone)", thereby obtaining a multimodal feature vector of the first positive sample, and then obtaining a 128-dimensional second feature vector (embedding) based on the multimodal feature vector.
[0120] It should be noted that when the second sub-model extracts features from negative samples, the process of feature extraction from the first positive sample by the second sub-model can be referred to. The principles of the two are the same, and to avoid repetition, they will not be described here.
[0121] Optionally, the information used to determine the first feature vector includes at least one of image information, text information, and voice information of the target resource.
[0122] In one embodiment, when the target resource is a video resource, the information for determining the first feature vector includes image information, text information, and voice information of the target resource.
[0123] In the above embodiment, determining the first feature vector of the target resource through multimodal information (i.e., image information, text information, and voice information) can improve the expressive power of the first feature vector, thereby enabling the first feature vector to more accurately express the meaning of the target resource.
[0124] Optionally, the information used to determine the second feature vector includes at least one of image information, text information, and voice information of the first positive sample.
[0125] In one embodiment, when the first positive sample is a video resource, information used to determine the second feature vector includes image information, text information, and voice information of the target resource.
[0126] In the above embodiment, determining the second eigenvector of the first positive sample through multimodal information (i.e., image information, text information, and voice information) can improve the expressive power of the second eigenvector, thereby enabling the second eigenvector to more accurately express the meaning of the first positive sample.
[0127] Optionally, the information used to determine the third eigenvector includes at least one of image information, text information, and voice information of the negative sample.
[0128] In one embodiment, when the negative sample is a video resource, the information for determining the third feature vector includes image information, text information, and voice information of the negative sample.
[0129] In the above embodiment, the third eigenvector of the negative sample is determined by multimodal information (i.e., image information, text information, and voice information), which can improve the expressive power of the third eigenvector, thereby enabling the third eigenvector to more accurately express the meaning of the negative sample. Step 2: Perform a second preset processing on the first eigenvector, the second eigenvector, and the third eigenvector, respectively, to obtain a first target eigenvector, a second target eigenvector, and a third eigenvector. The second preset processing is to set the eigenvalue of the first part of the dimension in the eigenvector to 0.
[0130] In one embodiment, the first eigenvector is subjected to a second preset processing to obtain a first target eigenvector. For example, the eigenvalues of the first part of the dimensions in the first eigenvector are randomly set to 0.
[0131] Optionally, the first portion of dimensions accounts for 70% of the total dimensions of the first eigenvector, that is, the eigenvalues of 70% of the dimensions of the first eigenvector are set to 0. For example, the total dimension of the first eigenvector is 10, and the eigenvalues of 7 of the dimensions are randomly set to 0.
[0132] By randomly setting the first part of the dimension of the first eigenvector to 0, some neurons of the first eigenvector are randomly shielded and sparsed, so that the eigenvalues of other dimensions of the first eigenvector except the first part of the dimension participate in the training of the first training task, while the eigenvalues of the first part of the dimension do not participate in the training of the first training task.
[0133] By randomly setting the first part of the dimension of the first feature vector to 0 and then determining the similarity vectors with the positive and negative samples respectively, the expressive power of the similarity vector can be improved, thereby more accurately determining the dimensions in the feature vector of the target resource that have a relatively high similarity with the positive and negative samples.
[0134] It should be noted that the principle of the second preset processing of the second eigenvector and the third eigenvector is the same as the principle of the second preset processing of the first eigenvector. Therefore, the process of the second preset processing of the second eigenvector and the third eigenvector can refer to the process of the second preset processing of the first eigenvector. To avoid repetition, it will not be repeated here.
[0135] Step 3: Determine a first similarity vector between the first target feature vector and the second target feature vector, and a second similarity vector between the first target feature vector and the third target feature vector.
[0136] In one embodiment, based on a cosine similarity algorithm, a first similarity vector between the first target feature vector and the second target feature vector, and a second similarity vector between the first target feature vector and the third target feature vector are determined respectively.
[0137] Step 4: Perform a third preset process on the first similarity vector and the second characteristic similarity vector respectively, and obtain a first target similarity vector and a second target similarity vector respectively. The third preset process is to set the eigenvalue of the second dimension in the vector to 0, and the eigenvalue of the second dimension is smaller than the eigenvalues of other dimensions;
[0138] In one embodiment, the first similarity vector is subjected to a third preset processing to obtain a first target similarity vector. For example, the eigenvalues of the second partial dimension in the first similarity vector are set to 0, thereby retaining the third partial dimension in the first similarity vector having a relatively large eigenvalue.
[0139] It can be understood that the dimensions with relatively large eigenvalues in the first similarity vector represent dimensions with relatively high similarity between the target resource and the first positive sample. By retaining the third portion of dimensions with relatively large eigenvalues in the first similarity vector, the eigenvalues in the feature vector of the target resource that match the first positive sample can be included in the training of the first training task.
[0140] Optionally, the third partial dimension may be 8 dimensions.
[0141] By performing a third preset processing on the first similarity vector and the second feature similarity vector during each iterative training process, the eigenvalues in the target resource's feature vector that match the eigenvalues of the first positive sample participate in the training of the first training task. This prevents the eigenvalues between the target resource and the positive sample from converging to a few dimensions due to an imbalance in the positive sample ratio. Consequently, even in the case of an imbalance in the positive sample ratio, the eigenvalues in the target resource's feature vector that represent the meaning of each positive sample can be retained. For example, in the feature vector of "apple," dimensions 1-8 are related to "content: apple (plant)" and dimensions 57-64 are related to "content: apple (mobile phone)." When the positive sample is "content: apple (mobile phone)," the eigenvalues in dimensions 57-64 are retained to participate in the training of the first training task, while the eigenvalues in dimensions 1-8 are blocked and do not participate in the training of the first training task. When the positive sample is "content: apple (plant)," the eigenvalues in dimensions 1-8 are retained to participate in the training of the first training task, while the eigenvalues in dimensions 57-64 are blocked and do not participate in the training of the first training task.
[0142] Step 5: Determine a first loss function for the first training task based on the difference between the first target similarity vector and the second target similarity vector.
[0143] In one embodiment, the difference between the first target similarity vector and the second target similarity vector is determined as a first loss function, so that when the first loss function converges, the difference between the first target similarity vector and the second target similarity vector can be minimized.
[0144] In the above embodiment, by setting the eigenvalues of the first part of the dimensions in the first eigenvector, the second eigenvector, and the third eigenvector to 0, and then determining the first similarity vector and the second similarity vector, and setting the eigenvalues of the second part of the dimensions in the first similarity vector and the second similarity vector to 0, the dimensions with relatively large eigenvalues in the similarity vector are retained, so that the eigenvalues in the eigenvector of the target resource that match the positive sample participate in the training of the first training task, and then the meaning of the positive sample category expressed in the eigenvector of the target resource is retained. Furthermore, by retaining the meaning of the positive sample of the category in the eigenvector of the target resource in each training, after multiple trainings, the eigenvalues expressing the meaning of positive samples of different categories in the eigenvector of the target resource are retained, thereby achieving the goal that the eigenvector of the target resource can express multiple meanings of the target resource.
[0145] In a possible implementation, the above step five includes the first case and the second case as shown below.
[0146] Case 1: When a difference between the first target similarity vector and the second target similarity vector is greater than a second preset threshold, the difference is determined to be a first loss function.
[0147] Optionally, the difference is an absolute value of a difference between the first target similarity vector and the second target similarity vector.
[0148] In one embodiment, the first loss function satisfies the following formula: loss1=max(0,|cos1'-cos2'|-α), where loss1 represents the first loss function, cos1' represents the first target similarity vector, cos2' represents the second target similarity vector, and α represents the second preset threshold.
[0149] In one embodiment, when the difference between the first target similarity vector and the second target similarity vector is greater than a second preset threshold, it indicates that the two target similarity vectors are significantly different, that is, the similarity distance between the positive and negative samples and the target resource is large, and the negative sample is typically a true negative sample of the target resource. Therefore, the difference is determined as the first loss function, so that the negative sample participates in the training of the first training task, thereby increasing the distance between the target resource and the negative sample, and thus, when the target resource is triggered for retrieval, the match degree with the negative sample is poor.
[0150] Second case: when the difference is less than or equal to the second preset threshold, the first loss function is determined to be 0.
[0151] In one embodiment, when the difference between the first target similarity vector and the second target similarity vector is less than or equal to the second preset threshold, it means that the two target similarity vectors are approaching, that is, the similarity between the positive and negative samples and the target resource is approaching. At this time, the negative sample is usually a positive sample of other categories of the target resource (false negative sample), that is, a positive sample of a different category from the first positive sample. Therefore, the first loss function is determined to be 0 to avoid false negative samples (that is, positive samples of a different category from the first positive sample) from being trained as negative samples, resulting in a larger distance between the target resource and the positive sample of the category, so that when the target resource is triggered for retrieval, the matching degree with the positive sample of the category is poor.
[0152] In the above embodiment, by setting a second preset threshold, when the first difference between the two similarity vectors is greater than the second preset threshold, the first difference is determined as the first loss function, and when the first difference is less than or equal to the second preset threshold, 0 is determined as the first loss function, so that only negative samples with a larger similarity vector difference with the positive sample will participate in the training of the second training task, and negative samples with a smaller similarity vector difference with the positive sample (usually positive samples of other categories) will not participate in the training of the second training task, thereby avoiding suppressing positive samples of other categories during the training process, and thus enabling the feature extraction model to recall candidate resources of multiple categories when used in the recall stage of the search system or recommendation system.
[0153] In a possible implementation, S604 includes:
[0154] Step 1: Determine the fourth eigenvector of the second positive sample based on the second sub-model.
[0155] In one embodiment, Figure 8 As shown, the fourth eigenvector of the second positive sample is outputted by the second sub-model. For example, the fourth eigenvector is a 128-dimensional eigenvector (Embedding).
[0156] Optionally, the information used to determine the fourth eigenvector includes at least one of image information, text information, and voice information of the second positive sample.
[0157] In one embodiment, when the second positive sample is a video resource, information for determining the fourth feature vector includes image information, text information, and voice information of the second positive sample.
[0158] In the above implementation, determining the fourth eigenvector of the second positive sample through multimodal information (i.e., image information, text information, and voice information) can improve the expressive power of the fourth eigenvector, thereby enabling the fourth eigenvector to more accurately express the meaning of the second positive sample.
[0159] Step 2: Determine a third similarity vector between the first eigenvector and the second eigenvector, and a fourth similarity vector between the first eigenvector and the fourth eigenvector.
[0160] In one embodiment, the third similarity vector and the fourth similarity vector are determined based on a cosine similarity algorithm.
[0161] Step 3: Determine a second loss function for the second training task based on the difference between the third similarity vector and the fourth similarity vector.
[0162] In one embodiment, a difference between the third similarity vector and the fourth similarity vector is determined as the second loss function.
[0163] In the above embodiment, the first loss function is determined by the difference between the third similarity vector and the fourth similarity vector, so that when the second loss function converges, the difference between the third similarity vector and the fourth similarity vector is minimized, so that the difference between the third similarity vector and the fourth similarity vector is less than the preset threshold, thereby achieving the difference in matching degree between the target resource and positive samples of different categories is less than the preset threshold.
[0164] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of method. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0165] The disclosed embodiment also provides a resource recall device.
[0166] Figure 9 FIG. 1 is a block diagram of a resource recall device according to an exemplary embodiment. Figure 9 The resource recall device 900 includes a first feature module 901 , a second feature model 902 and a resource determination module 903 .
[0167] The first feature module 901 is configured to obtain a target feature vector of a target resource based on a first sub-model of a pre-trained feature extraction model; wherein the target feature vector is used to indicate a first meaning and a second meaning of the target resource, and the first meaning is different from the second meaning; the pre-trained feature extraction model is pre-trained using the feature values in the feature vector of the target resource that match the positive sample. For example, combined with Figure 3 , the first feature module 901 can be used to execute S301.
[0168] The second feature module 902 is configured to obtain a candidate feature vector of a candidate resource based on a second sub-model of a pre-trained feature extraction model. Figure 3 , the second feature model 902 can be used to execute S302.
[0169] The resource determination module 903 is configured to determine at least two categories of recalled resources corresponding to the target resource based on the matching degree between the target feature vector and the candidate feature vector; wherein one category of recalled resources matches the first meaning and the other category of recalled resources matches the second meaning. Figure 3 , the resource determination module 903 can be used to execute S303.
[0170] In one possible embodiment, the second feature module 902 is further configured to execute: based on the second sub-model, performing a first preset processing on the feature vector of the recalled resource to obtain a recalled feature vector; the first preset processing is to set the eigenvalues of some dimensions in the feature vector to 1 and the eigenvalues of other dimensions to 0, and the eigenvalues of some dimensions are greater than the eigenvalues of other dimensions; based on some dimensions in the recalled feature vector whose eigenvalues are 1, determining the category identifier of the recalled resource, and the category identifier is used to determine the display order of the recalled resource.
[0171] In one possible embodiment, the device also includes a training module 904, which is configured to perform: obtaining training samples of the target resource, the training samples including a first positive sample and a negative sample; training the feature extraction model for a first training task based on the target resource, the first positive sample and the negative sample; the first training task is used to enable the eigenvalues in the feature vector of the target resource that match the eigenvector of the first positive sample to participate in the training of the first training task; updating the parameters of the feature extraction model based on the first loss function of the first training task; iteratively performing the above steps, and determining that the feature extraction model has converged when the first loss function of the first training task has converged.
[0172] In one possible embodiment, the training sample also includes a second positive sample, and the first positive sample and the second positive sample belong to different categories; the training module 904 is also configured to execute: training the feature extraction model for a second training task based on the target resource, the first positive sample and the second positive sample; the second training task is used to make the difference in matching degree between the target resource and the positive samples of different categories less than a first preset threshold; the training module is specifically configured to execute: updating the parameters of the feature extraction model based on the first loss function of the first training task and the second loss function of the second training task; the training module is specifically configured to execute: determining that the feature extraction model converges when the first loss function of the first training task and the second loss function of the second training task converge.
[0173] In one possible embodiment, the training module 904 is specifically configured to execute: determining the first feature vector of the target resource based on the first sub-model, and determining the second feature vector of the first positive sample and the third feature vector of the negative sample based on the second sub-model; performing a second preset processing on the first feature vector, the second feature vector and the third feature vector, respectively, to obtain the first target feature vector, the second target feature vector and the third feature vector accordingly; the second preset processing is to set the eigenvalue of the first part dimension in the feature vector to 0; determining the first similarity vector between the first target feature vector and the second target feature vector, and the second similarity vector between the first target feature vector and the third target feature vector; performing a third preset processing on the first similarity vector and the second feature similarity vector, respectively, to obtain the first target similarity vector and the second target similarity vector accordingly; the third preset processing is to set the eigenvalue of the second part dimension in the vector to 0, and the eigenvalue of the second part dimension is smaller than the eigenvalue of other dimensions; based on the difference between the first target similarity vector and the second target similarity vector, determine the first loss function of the first training task.
[0174] In one possible embodiment, the training module 904 is specifically configured to perform: when the difference between the first target similarity vector and the second target similarity vector is greater than a second preset threshold, determining the difference as a first loss function; when the difference is less than or equal to the second preset threshold, determining the first loss function as a value of 0.
[0175] In one possible embodiment, the training module 904 is specifically configured to perform: determining a fourth eigenvector of the second positive sample based on the second sub-model; determining a third similarity vector between the first eigenvector and the second eigenvector, and a fourth similarity vector between the first eigenvector and the fourth eigenvector; and determining a second loss function for the second training task based on the difference between the third similarity vector and the fourth similarity vector.
[0176] In one possible embodiment, the information for determining the first feature vector includes at least one of the image information, text information, and voice information of the target resource; and / or the information for determining the second feature vector includes at least one of the image information, text information, and voice information of the first positive sample; and / or the information for determining the third feature vector includes at least one of the image information, text information, and voice information of the second positive sample; and / or the information for determining the fourth feature vector includes at least one of the image information, text information, and voice information of the negative sample.
[0177] In one possible implementation, the information for determining the candidate feature vector includes at least one of the image information, text information, and voice information of the candidate resource; and / or the information for determining the target feature vector includes at least one of the image information, text information, and voice information of the target resource.
[0178] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0179] Figure 10 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Figure 10 As shown, the electronic device 1000 includes but is not limited to: a processor 1001 and a memory 1002 .
[0180] The memory 1002 is configured to store executable instructions of the processor 1001. It is understood that the processor 1001 is configured to execute instructions to implement the resource recall method shown in any one of the above embodiments.
[0181] It should be noted that those skilled in the art can understand that Figure 10 The electronic device structure shown in the figure does not limit the electronic device, and the electronic device may include Figure 10 More or fewer components may be shown, or certain components may be combined, or the components may be arranged differently.
[0182] Processor 1001 is the control center of the electronic device. It connects all parts of the electronic device using various interfaces and circuits. By running or executing software programs and / or modules stored in memory 1002 and accessing data stored in memory 1002, it performs various functions of the electronic device and processes data, thereby providing overall monitoring of the electronic device. Processor 1001 may include one or more processing units; optionally, processor 1001 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 1001.
[0183] The memory 1002 can be used to store software programs and various data. The memory 1002 may primarily include a program storage area and a data storage area. The program storage area may store an operating system, application programs required by at least one functional module (such as a first feature module, a second feature module, or a resource determination module), and the like. Furthermore, the memory 1002 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0184] In an exemplary embodiment, the present disclosure further provides a computer-readable storage medium including instructions, such as a memory 1002 including instructions. The above instructions can be executed by the processor 1001 of the electronic device 1000 to complete the resource recall method in the above embodiment.
[0185] In actual implementation, the processing functions of the first feature module 901, the second feature model 902 and the resource determination module 903 can be Figure 10 The processor 1001 is shown to implement the process by calling the program code in the memory 1002. The specific execution process can be referred to the description of the resource recall method in the above embodiment, which will not be repeated here.
[0186] Optionally, the computer-readable storage medium may be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0187] In an exemplary embodiment, the present disclosure further provides a computer program product comprising one or more instructions, which can be executed by the processor 1001 of the electronic device 1000 to implement the resource recall method in the above embodiment.
[0188] It should be noted that when the instructions in the above-mentioned computer-readable storage medium or one or more instructions in the computer program product are executed by the processor 1001 of the electronic device 1000, the various processes of the embodiment of the above-mentioned resource recall method are implemented, and the same technical effect as the above-mentioned resource recall method can be achieved. To avoid repetition, they will not be repeated here.
[0189] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
[0190] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A resource recall method, characterized in that: include: Based on the first sub-model of the pre-trained feature extraction model, a target feature vector of the target resource is obtained; wherein the target feature vector is used to indicate a first meaning and a second meaning of the target resource, and the first meaning is different from the second meaning; the pre-trained feature extraction model is pre-trained using feature values in the feature vector of the target resource that match positive samples; the pre-trained feature extraction model is trained based on training samples of the target resource, and the training samples include a first positive sample and a second positive sample, and the first positive sample and the second positive sample belong to different categories; the target resource is any one of a text resource, a video resource, or an image resource; Obtaining a candidate feature vector of the candidate resource based on the second sub-model of the pre-trained feature extraction model; Determining at least two categories of recalled resources corresponding to the target resource based on the degree of matching between the target feature vector and the candidate feature vector; wherein the recalled resources of one category match the first meaning, and the recalled resources of the other category match the second meaning; Based on the second sub-model, performing a first preset processing on the feature vector of the recalled resource to obtain a recall feature vector; the first preset processing is to set the feature values of some dimensions in the feature vector to 1 and the feature values of other dimensions to 0, and the feature values of the some dimensions are greater than the feature values of the other dimensions; Based on some dimensions of the recalled feature vector whose eigenvalues are 1, a category identifier of the recalled resource is determined, and the category identifier is used to determine a display order of the recalled resource.
2. The method according to claim 1, characterized in that The training process of the feature extraction model includes: Acquire a training sample of the target resource, where the training sample includes a first positive sample and a negative sample; Performing a first training task on a feature extraction model based on the target resource, the first positive sample, and the negative sample; the first training task is used to enable feature values in the feature vector of the target resource that match the feature vector of the first positive sample to participate in the training of the first training task; Updating parameters of the feature extraction model based on a first loss function of the first training task; The above steps are iteratively performed, and when the first loss function of the first training task converges, it is determined that the feature extraction model converges.
3. The method according to claim 2, characterized in that The training sample further includes a second positive sample, and the first positive sample and the second positive sample belong to different categories; The training process of the feature extraction model also includes: Performing a second training task on the feature extraction model based on the target resource, the first positive sample, and the second positive sample; the second training task is used to ensure that the difference in the matching degree between the target resource and the positive samples of different categories is less than a first preset threshold; The updating of the parameters of the feature extraction model based on the first loss function of the first training task includes: updating parameters of the feature extraction model based on a first loss function of the first training task and a second loss function of the second training task; When the first loss function of the first training task converges, determining that the feature extraction model converges includes: When the first loss function of the first training task and the second loss function of the second training task converge, it is determined that the feature extraction model converges.
4. The method according to claim 2 or 3, characterized in that Training a feature extraction model for a first training task based on the target resource, the first positive sample, and the negative sample includes: Determine a first feature vector of the target resource based on the first sub-model, and determine a second feature vector of the first positive sample and a third feature vector of the negative sample based on the second sub-model; Performing a second preset processing on the first eigenvector, the second eigenvector, and the third eigenvector respectively to obtain a first target eigenvector, a second target eigenvector, and a third eigenvector respectively; the second preset processing is to set the eigenvalue of the first part of the dimension in the eigenvector to 0; determining a first similarity vector between the first target feature vector and the second target feature vector, and a second similarity vector between the first target feature vector and the third target feature vector; Performing a third preset processing on the first similarity vector and the second characteristic similarity vector respectively to obtain a first target similarity vector and a second target similarity vector respectively; the third preset processing is to set the eigenvalues of the second part of the dimension in the vector to 0, and the eigenvalues of the second part of the dimension are smaller than the eigenvalues of other dimensions; A first loss function for a first training task is determined based on a difference between the first target similarity vector and the second target similarity vector.
5. The method according to claim 4, characterized in that Determining the first loss function based on a difference between the first target similarity vector and the second target similarity vector includes: When a difference between the first target similarity vector and the second target similarity vector is greater than a second preset threshold, determining the difference as the first loss function; When the difference is less than or equal to the second preset threshold, the first loss function is determined to be 0.
6. The method according to claim 4, characterized in that Training a feature extraction model for a second training task based on the target resource, the first positive sample, and the second positive sample includes: Determine a fourth eigenvector of the second positive sample based on the second sub-model; determining a third similarity vector between the first eigenvector and the second eigenvector, and a fourth similarity vector between the first eigenvector and the fourth eigenvector; A second loss function for the second training task is determined based on a difference between the third similarity vector and the fourth similarity vector.
7. The method according to claim 6, wherein Determine that the information of the first feature vector includes at least one of image information, text information, and voice information of the target resource; and / or The information for determining the second feature vector includes at least one of image information, text information, and voice information of the first positive sample; and / or The information for determining the third feature vector includes at least one of image information, text information, and voice information of the second positive sample; and / or The information used to determine the fourth eigenvector includes at least one of image information, text information, and voice information of the negative sample.
8. The method according to claim 1, wherein Determine that the information of the candidate feature vector includes at least one of image information, text information, and voice information of the candidate resource; and / or The information used to determine the target feature vector includes at least one of image information, text information, and voice information of the target resource.
9. A resource recall device, characterized in that: include: The first feature module is configured to obtain a target feature vector of a target resource based on a first sub-model of a pre-trained feature extraction model; wherein the target feature vector is used to indicate a first meaning and a second meaning of the target resource, and the first meaning is different from the second meaning; the pre-trained feature extraction model is pre-trained using feature values in the feature vector of the target resource that match positive samples; the pre-trained feature extraction model is trained based on training samples of the target resource, the training samples include a first positive sample and a second positive sample, and the first positive sample and the second positive sample belong to different categories; the target resource is any one of a text resource, a video resource, or an image resource; a second feature module configured to obtain a candidate feature vector of the candidate resource based on a second sub-model of the pre-trained feature extraction model; a resource determination module configured to determine at least two categories of recalled resources corresponding to the target resource based on a degree of matching between the target feature vector and the candidate feature vector; wherein the recalled resources of one category match the first meaning and the recalled resources of another category match the second meaning; The second feature module is further configured to execute: Based on the second sub-model, the feature vector of the recalled resource is subjected to a first preset processing to obtain a recalled feature vector; the first preset processing is to set the eigenvalues of some dimensions in the feature vector to 1 and the eigenvalues of other dimensions to 0, and the eigenvalues of some dimensions are greater than the eigenvalues of other dimensions; based on some dimensions in the recalled feature vector whose eigenvalues are 1, the category identifier of the recalled resource is determined, and the category identifier is used to determine the display order of the recalled resources.
10. The device according to claim 9, characterized in that The apparatus further comprises a training module configured to execute: Acquire a training sample of the target resource, where the training sample includes a first positive sample and a negative sample; Performing a first training task on a feature extraction model based on the target resource, the first positive sample, and the negative sample; the first training task is used to enable feature values in the feature vector of the target resource that match the feature vector of the first positive sample to participate in the training of the first training task; Updating parameters of the feature extraction model based on a first loss function of the first training task; The above steps are iteratively performed, and when the first loss function of the first training task converges, it is determined that the feature extraction model converges.
11. The device according to claim 10, characterized in that The training sample further includes a second positive sample, and the first positive sample and the second positive sample belong to different categories; the training module is further configured to execute: Performing a second training task on the feature extraction model based on the target resource, the first positive sample, and the second positive sample; the second training task is used to ensure that the difference in the matching degree between the target resource and the positive samples of different categories is less than a first preset threshold; The training module is specifically configured to perform: updating parameters of the feature extraction model based on a first loss function of the first training task and a second loss function of the second training task; The training module is specifically configured to execute: when the first loss function of the first training task and the second loss function of the second training task converge, determining that the feature extraction model converges.
12. The device according to claim 10 or 11, characterized in that The training module is specifically configured to perform: Determine a first feature vector of the target resource based on the first sub-model, and determine a second feature vector of the first positive sample and a third feature vector of the negative sample based on the second sub-model; Performing a second preset processing on the first eigenvector, the second eigenvector, and the third eigenvector respectively to obtain a first target eigenvector, a second target eigenvector, and a third eigenvector respectively; the second preset processing is to set the eigenvalue of the first part of the dimension in the eigenvector to 0; determining a first similarity vector between the first target feature vector and the second target feature vector, and a second similarity vector between the first target feature vector and the third target feature vector; Performing a third preset processing on the first similarity vector and the second characteristic similarity vector respectively to obtain a first target similarity vector and a second target similarity vector respectively; the third preset processing is to set the eigenvalues of the second part of the dimension in the vector to 0, and the eigenvalues of the second part of the dimension are smaller than the eigenvalues of other dimensions; A first loss function for a first training task is determined based on a difference between the first target similarity vector and the second target similarity vector.
13. The device according to claim 12, characterized in that The training module is specifically configured to perform: When a difference between the first target similarity vector and the second target similarity vector is greater than a second preset threshold, determining the difference as the first loss function; When the difference is less than or equal to the second preset threshold, the first loss function is determined to be 0.
14. The device according to claim 12, characterized in that The training module is specifically configured to perform: Determine a fourth eigenvector of the second positive sample based on the second sub-model; determining a third similarity vector between the first eigenvector and the second eigenvector, and a fourth similarity vector between the first eigenvector and the fourth eigenvector; A second loss function for the second training task is determined based on a difference between the third similarity vector and the fourth similarity vector.
15. The device according to claim 14, wherein Determine that the information of the first feature vector includes at least one of image information, text information, and voice information of the target resource; and / or The information for determining the second feature vector includes at least one of image information, text information, and voice information of the first positive sample; and / or The information for determining the third feature vector includes at least one of image information, text information, and voice information of the second positive sample; and / or The information used to determine the fourth eigenvector includes at least one of image information, text information, and voice information of the negative sample.
16. The device according to claim 9, wherein Determine that the information of the candidate feature vector includes at least one of image information, text information, and voice information of the candidate resource; and / or The information used to determine the target feature vector includes at least one of image information, text information, and voice information of the target resource.
17. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method according to any one of claims 1 to 8.
19. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are run on an electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Text data processing method and device, equipment and medium
CN113761105A
Matching method and device based on text processing, computer equipment and storage medium
CN113761887A
Live broadcast room searching method and device, electronic equipment, storage medium and product
CN114385853A
Method and apparatus of processing information, method and apparatus of recommending information, electronic device, and storage medium
US20220058222A1
Content recommendation method and apparatus, device, storage medium, and program product
WO2023087933A1