Sample label generation method, device, computer equipment and storage medium
By automatically generating sample labels and combining user interaction duration and relevance, it solves the problems of high manual labeling costs and limited accuracy of model recommendation, and achieves efficient and accurate content recommendation.
Patent Information
- Application Number
- CN202311224046.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-21
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-09-21
AI Technical Summary
In the existing technology, manual annotation of new data to recommend content by training models involves high labor costs, and it is unable to respond to the emergence of emerging things in a timely manner, resulting in limited model recommendation accuracy.
By obtaining query text samples and query result content, and combining the preset mapping relationship between content volume and interaction duration threshold, sample labels are automatically generated, and training sample pairs are generated based on user interaction duration and relevance, reducing manual labeling costs and improving sample labels. accuracy.
It realizes the automatic generation of sample labels, reduces the cost of manual labeling, improves the accuracy of sample labels, can respond to the emergence of emerging things in a timely manner, and improves the accuracy of the content recommendation model.
Smart Images

Figure CN117725273B
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a sample label generation method, apparatus, computer equipment and storage medium, wherein the storage medium is a computer-readable storage medium. Background Art
[0002] In the search scenario, determining the relevance between content and the query text (query) entered by the user is one of the main tasks. Since content is time-sensitive and new things and products appear over time, new content will appear accordingly. Timely training of the model used to recommend content based on new data can improve the accuracy of the model's recommended content. The current common method is to manually annotate new data and train or fine-tune the model based on the manually annotated new data. However, the emergence of new things is uninterrupted, and new data needs to be collected and annotated manually, which has high labor costs. Summary of the invention
[0003] The embodiments of the present application provide a sample label generation method, apparatus, computer device and storage medium, which can automatically generate sample labels, reduce the labor cost of label annotation, and improve the accuracy of sample labels by combining posterior behavior information and relevance.
[0004] A sample label generation method provided in an embodiment of the present application includes:
[0005] Obtaining a query text sample and query result content of the query text sample;
[0006] Determine the target interaction time threshold corresponding to the content volume of the query result content according to a preset mapping relationship between the content volume and the interaction time threshold;
[0007] Acquire the user interaction duration of the query result content, and determine a first sample label of the query result content according to a magnitude relationship between the user interaction duration and the target interaction duration threshold;
[0008] Determining a second sample label of the query result content according to the relevance between the query text sample and the query result content;
[0009] Based on the first sample label and the second sample label of the query result content, a sample label of a training sample pair consisting of the query result content and the query text sample is generated.
[0010] Accordingly, an embodiment of the present application also provides a sample label generating device, including:
[0011] An acquisition unit, used to acquire a query text sample and a query result content of the query text sample;
[0012] A threshold determination unit, configured to determine a target interaction time threshold corresponding to the content volume of the query result content according to a preset mapping relationship between the content volume and the interaction time threshold;
[0013] A first label determination unit, configured to obtain a user interaction duration of the query result content, and determine a first sample label of the query result content according to a magnitude relationship between the user interaction duration and the target interaction duration threshold;
[0014] A second label determination unit, configured to determine a second sample label of the query result content according to the relevance between the query text sample and the query result content;
[0015] The label generation unit is used to generate a sample label of a training sample pair consisting of the query result content and the query text sample based on the first sample label and the second sample label of the query result content.
[0016] In one embodiment, the threshold determination unit includes:
[0017] A subject determination subunit, used to determine the subject text of the content of the query result;
[0018] An extraction subunit, configured to extract content features from the query result content to obtain content feature information of the query result content;
[0019] A content determination subunit, configured to determine, in the query result content, a target sub-content related to the content subject text according to the content feature information;
[0020] The target threshold determination subunit is used to determine the target interaction time threshold corresponding to the query result content according to the mapping relationship between the preset content volume and the interaction time threshold and the target sub-content.
[0021] In one embodiment, the sample label generating device further includes:
[0022] an interval determination unit, configured to determine a content volume interval, wherein the content volume interval includes at least one content volume;
[0023] An interaction information acquisition unit, configured to acquire, for each content volume interval, a user interaction duration and a user interaction volume of each historical query result content whose content volume belongs to the volume interval within a preset time period;
[0024] A sorting unit, used to sort the historical query result content according to the user interaction duration to obtain sorted historical query result content;
[0025] An interval threshold determination unit, configured to determine an interaction duration threshold for each content volume interval according to the total user interaction volume and the user interaction duration of the historical query result content in the sorting interval corresponding to the preset condition;
[0026] The mapping relationship generating unit is used to obtain the mapping relationship between the content volume and the interaction time threshold according to the interaction time threshold of each content volume interval and the content volume included in the content volume interval.
[0027] In one embodiment, the label generation unit includes:
[0028] a score calculation subunit, configured to calculate a matching score of the query result content according to a tag type of the first sample tag and a tag type of the second sample tag;
[0029] The sample label generation subunit is used to generate a sample label of a training sample pair consisting of the query result content and the query text sample according to the matching score.
[0030] In one embodiment, each tag type corresponds to a tag score, and the score calculation subunit includes:
[0031] A weight determination module, configured to determine a first label weight of the first sample label according to the user interaction duration, and determine a second label weight of the second sample label according to the relevance;
[0032] A first weighted calculation module, configured to perform weighted calculation on the label score of the first sample label according to the first label weight to obtain a first weighted label score;
[0033] A second weighted calculation module, configured to perform weighted calculation on the label score of the second sample label according to the second label weight to obtain a second weighted label score;
[0034] A matching score calculation module is used to calculate the matching score of the query result content based on the first weighted label score and the second weighted label score.
[0035] In one embodiment, the second label determination unit includes:
[0036] A feature extraction subunit, used to extract features from the query text sample and the query result content respectively through a content recommendation model to obtain query text feature information of the query text training sample and content feature information of the query result content;
[0037] A relevance determination subunit, used to obtain the relevance between the query text sample and the query result content according to the feature distance between the query text feature information and the content feature information;
[0038] A second sample label of the query result content is determined according to the relevance.
[0039] In one embodiment, the sample label generating device further includes:
[0040] A training unit, used to train the content recommendation model through the training sample pairs to obtain a trained content recommendation model;
[0041] The recommendation unit is used for recommending query result content based on the query text through the trained content recommendation model when receiving the query text.
[0042] Correspondingly, an embodiment of the present application also provides a computer device, including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any sample label generation method provided in the embodiment of the present application.
[0043] Accordingly, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is loaded by a processor to execute any sample label generation method provided in the embodiment of the present application.
[0044] The embodiment of the present application obtains a query text sample and query result content of the query text sample; determines a target interaction time threshold corresponding to the content volume of the query result content according to a mapping relationship between a preset content volume and an interaction time threshold; obtains a user interaction time of the query result content, and determines a first sample label of the query result content according to a size relationship between the user interaction time and the target interaction time threshold; determines a second sample label of the query result content according to a correlation between the query text sample and the query result content; and generates a sample label of a training sample pair consisting of the query result content and the query text sample based on the first sample label and the second sample label of the query result content.
[0045] The embodiment of the present application obtains a first sample label for the query result content based on the posterior behavior information of the query result content, that is, the user interaction duration, and obtains a second sample label for the query result content based on the correlation between the query result content and the query text sample. The sample label for the query result content is generated by combining the first sample label and the second sample label. This can realize automatic generation of sample labels and reduce the labor cost of sample labeling. In addition, the accuracy of the generated sample labels can be improved by combining the posterior behavior information and the correlation. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0047] Figure 1 is a flow chart of a sample label generation method provided in an embodiment of the present application;
[0048] FIG2 is a diagram of an interaction duration-interaction volume ratio curve provided in an embodiment of the present application; different amounts of information are divided into FIG2(1), FIG2(2), and FIG2(3);
[0049] Figure 3 It is a schematic diagram of a playback ratio-interaction ratio curve provided in an embodiment of the present application;
[0050] Figure 4 is a schematic diagram of a sample label generating device provided in an embodiment of the present application;
[0051] Figure 5 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0053] The present application provides a sample label generation method, device, computer device and computer readable storage medium. The sample label generation device can be integrated in a computer device, which can be a server or a terminal.
[0054] The terminal may include a mobile phone, a wearable smart device, a tablet computer, a laptop computer, a personal computer (PC), and a vehicle-mounted computer.
[0055] Among them, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms.
[0056] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0057] This embodiment will be described from the perspective of a sample label generation device. The sample label generation device may be integrated into a computer device, which may be a server or a terminal.
[0058] The present application provides a method for generating sample labels. Figure 1 As shown, the specific process of the sample label generation method can be as follows:
[0059] 101. Obtain a query text sample and query result content of the query text sample.
[0060] The query text sample may include historical query texts within a preset time period, or may be randomly selected query texts from the historical query texts as the text sample; or may be a query text that has been queried more times from the historical query texts as the query text sample.
[0061] Optionally, keywords can be extracted from each query text in the historical query text to obtain the number of occurrences of each keyword in the historical query text. The more times a keyword appears, the more users search based on the keyword, and more users are interested in keyword-related content. A large number of sample pairs can be generated based on the number of keyword appearances. Therefore, the keywords can be sorted according to the number of appearances, and the keywords with more appearances can be used as target keywords, and the query texts containing the target keywords can be used as query text samples.
[0062] The query result content may be content recommended to the user based on the query text sample input by the user, and the content may include articles, pictures, audio, video, or a combination of at least two of them.
[0063] 102. Determine a target interaction time threshold corresponding to the content volume of the query result content according to a preset mapping relationship between the content volume and the interaction time threshold.
[0064] The content volume may indicate the amount of information contained in the content. For example, for text content, the content volume may be determined based on the number of text units contained in the text content. For video content, the content volume may be determined based on the video length of the video content.
[0065] Among them, the interaction time threshold can be used to determine whether the user is satisfied with the content. The interaction time threshold can be considered as the deep reading time, which means that the user's interaction time with the content exceeds the deep reading time. It is considered that the user has read the content in depth and the content meets the user's expectations. Therefore, the label of the query result content can be determined at the posterior behavior information level based on the user's interaction time with the query result content.
[0066] Optionally, the content volume of the query result content may also be determined based on a portion of the content related to the content theme. That is, in one embodiment, the step of “determining a target interaction time threshold corresponding to the content volume of the query result content based on a preset mapping relationship between the content volume and the interaction time threshold” may specifically include:
[0067] Determine the content subject text of the query result content;
[0068] Extracting content features of the query result content to obtain content feature information of the query result content;
[0069] Determine, according to the content feature information, the target sub-content related to the content subject text in the query result content;
[0070] According to the mapping relationship between the preset content volume and the interaction time threshold and the target sub-content, the target interaction time threshold corresponding to the query result content is determined.
[0071] The content subject text may include tags, topics or titles carried in the query result content. For example, when posting content, a user may add a topic to the content by using "#", and the topic may be determined as the content subject text of the content.
[0072] For example, there are two articles whose subject texts are both "small RED exhibition", one of which is entirely related to "small RED exhibition", and the other is only partially related to "small RED exhibition". The content volume of the query result content can be due to the content.
[0073] In one embodiment, the content subject text and the query result content can be input into a neural network model (such as BERT), and the BERT model can be used to perform feature extraction on the content subject text and the query result content respectively to obtain content feature information of the content subject text and text feature information of the content subject text, and predict target sub-content related to the content subject text in the query result content based on the text feature information and content feature information.
[0074] Optionally, for video content, OCR recognition can be performed on the video content to extract content text from the video content, and the content text and content subject text are input into a neural network model to determine the content volume of the video content through the neural network model.
[0075] Optionally, the video content may be image-recognized to determine a portion of the video content that is identical to the subject text of the content, and the amount of the video content may be determined based on the duration of the portion of the video.
[0076] The content volume of the query structure content may be the content volume related to the content theme, that is, the content volume of the target sub-content.
[0077] Among them, the mapping relationship between the preset content volume and the interaction time threshold can be the corresponding relationship between different pre-set content volumes and interaction time thresholds. According to the content volume of the query result content, the target interaction time threshold of the query result content can be determined, and then the first sample label of the query result content can be determined according to the target interaction time threshold and the interaction time of the query result content.
[0078] In one embodiment, the amount of content can be represented by gears. For example, four gears from 0 to 3 can be set, and each gear can correspond to a text unit quantity interval. For example, 1-50 words correspond to gear 0, 50-150 words correspond to gear 1, 150-300 words correspond to gear 2, and more than 300 words correspond to gear 3.
[0079] For text content, the interaction time threshold corresponding to level 0-1 may be 8 seconds, the interaction time threshold corresponding to level 2 may be 11 seconds, and the interaction time threshold corresponding to level 3 may be 18 seconds.
[0080] For video content, the interaction time threshold can be determined based on a preset playback ratio. For example, the interaction time threshold corresponding to level 0-1 can be 60% of the video length, the interaction time threshold corresponding to level 2 can be 55% of the video length, and the interaction time threshold corresponding to level 3 can be 30% of the video length.
[0081] The mapping relationship between the content volume and the interaction time threshold may be preset based on experience, or may be determined based on the number of collections or likes of the query result content. That is, in one embodiment, before the step of "determining the target interaction time threshold corresponding to the content volume of the query result content based on the preset mapping relationship between the content volume and the interaction time threshold", the sample label generation method provided in the embodiment of the present application further includes:
[0082] determining a content volume interval, the content volume interval including at least one content volume;
[0083] For each content volume interval, obtaining the user interaction duration and user interaction volume of each historical query result content whose content volume belongs to the content volume interval within a preset time period;
[0084] Sort the historical query result content according to the user interaction time to obtain the sorted historical query result content;
[0085] Determine the interaction time threshold for each content volume interval based on the total user interaction volume and the user interaction time of the historical query result content in the sorting interval corresponding to the preset condition;
[0086] According to the interaction time threshold of each content volume interval and the content volume included in the content volume interval, a mapping relationship between the content volume and the interaction time threshold is obtained.
[0087] The historical query result content may include the query result content of the query text sample, and may also include the query result content of different query texts within a preset time period.
[0088] Among them, the content volume interval may include at least one content volume. If the content volume is expressed as the number of text units, then the content volume interval may be a number interval of text units; if the content volume is expressed as gears, then the content volume interval may correspond to at least one gear, for example, gears 0-1 are a content volume interval, and gears 2 and 3 may correspond to a content volume interval respectively.
[0089] The user interaction time may be the interaction time between the user and the query result content, for example, the browsing time or the viewing time.
[0090] The user interaction volume may be the number of users who perform a specified interaction operation on the query result content, for example, the number of users who collect the query result content, that is, the collection volume of the query result content.
[0091] For example, the content volume interval corresponding to the query result content can be determined based on the content volume of the historical query result content. For each content volume interval, the user interaction duration and user interaction volume of the historical query result content whose content volume belongs to the content volume interval are obtained, and the query result content is sorted according to the user interaction duration to obtain the sorted query result content.
[0092] Assuming that the preset condition may be 50% of the total user interaction volume of all query result contents within the content volume range, the sorted historical query result contents are traversed according to the user interaction time from large to small, and the sorting interval that meets the preset condition is determined. The total user interaction volume of the historical query result contents within the sorting interval is equal to or greater than 50% of the total user interaction volume of all query result contents within the capacity interval.
[0093] The longest user interaction time in the historical query result content within the sorting interval is determined as the interaction time threshold of the content volume interval. According to the content volume included in the content volume interval and the corresponding interaction time threshold, the interaction time threshold corresponding to each content volume can be determined.
[0094] In one embodiment, as shown in Figure 2, for text content, the user interaction time can be used as the horizontal axis and the user interaction ratio can be used as the vertical axis to obtain a user interaction time-user interaction ratio curve for different amounts of information (i.e., amount of content), and then the interaction time threshold can be determined based on the curve.
[0095] like Figure 3 As shown, for video content, the video playback ratio can be used as the horizontal axis and the user interaction ratio can be used as the vertical axis to obtain a playback ratio-user interaction ratio curve for videos with different amounts of information (i.e., content volume), and then the interaction time threshold can be determined based on the curve.
[0096] 103. Obtain the user interaction duration of the query result content, and determine a first sample label of the query result content according to a magnitude relationship between the user interaction duration and a target interaction duration threshold.
[0097] The user interaction time of the query result content is compared with the target interaction time threshold. If the user interaction time is greater than or equal to the target interaction time threshold, the query result content is considered to be a positive sample, that is, the first sample label of the query result content is the label that indicates that the query result content is a positive sample; otherwise, the query result content is considered to be a negative sample, that is, the first sample label of the query result content is the label that indicates that the query result content is a negative sample.
[0098] 104. Determine a second sample label of the query result content according to the relevance between the query text sample and the query result content.
[0099] The relevance may indicate the degree of relevance between the query text sample and the query result content. The higher the relevance, the more closely the query result content matches, and the more likely the query result content is what the user needs.
[0100] For example, the query text sample and the query result content may be mapped to the same feature space, and the relevance between the query text and the content query result may be determined based on the distance between the query text and the query result content in the feature space.
[0101] A relevance threshold may be set to determine the second sample label of the query result content according to the relationship between the relevance of the query result content and the relevance threshold.
[0102] Optionally, the relevance between the query text sample and the query result content may also be predicted by a neural network model, such as a BM25 (Okapi BM25) model. That is, in one embodiment, the step of “determining a second sample label of the query result content according to the relevance between the query text sample and the query result content” may specifically include:
[0103] The query text sample and the query result content are respectively subjected to feature extraction by the content recommendation model to obtain query text feature information of the query text training sample and content feature information of the query result content;
[0104] According to the feature distance between the query text feature information and the content feature information, the relevance between the query text sample and the query result content is obtained;
[0105] A second sample label of the query result content is determined according to the relevance.
[0106] Among them, the content recommendation model is used to predict the query result content related to the query text input by the user. The model result of the content recommendation model can be flexibly set according to the needs of the application scenario and is not limited here.
[0107] The content recommendation model is used to extract features of the query text sample and the query result content respectively, to obtain the query text feature information of the query text training sample and the content feature information of the query result content; based on the feature distance between the query text feature information and the content feature information, the correlation between the query text sample and the query result content is obtained, wherein the smaller the feature distance, the stronger the correlation, and the larger the feature distance, the weaker the correlation.
[0108] 105. Generate a sample label of a training sample pair consisting of the query result content and the query text sample based on the first sample label and the second sample label of the query result content.
[0109] The first sample label and the second sample label of the query result content may be the same or different, so the first sample label and the second sample label can be combined to be the sample label of the query text sample.
[0110] For example, when the first sample label and the second sample label of the query result content are both labels indicating that the query content sample is a positive sample, a sample label indicating that the query result content is a positive sample is generated for the query result content; otherwise, a sample label indicating that the query result content is a negative sample is generated for the query result content.
[0111] The embodiment of the present application combines the user's posterior behavior data and relevance to determine the positive and negative sample labels of the query-doc, thereby reducing labor costs, and can greatly expand the data, increase the scale of the data, and ensure good data quality.
[0112] Optionally, the matching score of the query content sample label can also be calculated based on the first sample label and the second sample label of the query result content, and the sample label of the query content sample can be determined based on the matching score. For example, a score threshold can be set, and the sample label of the query result content with a matching score greater than the threshold is set as a label indicating that the query result content is a positive sample. That is, in one embodiment, the first sample label and the second sample label both include one of the label types of a positive sample label and a negative sample label. The step of "generating a sample label of a training sample pair consisting of the query result content and the query text sample based on the first sample label and the second sample label of the query result content" can specifically include:
[0113] Calculate a matching score of the query result content according to the tag type of the first sample tag and the tag type of the second sample tag;
[0114] Generate sample labels for training sample pairs consisting of query result content and query text samples based on the matching scores.
[0115] Among them, the first sample label can be a label indicating that the query result content is a positive sample, that is, a positive sample label, or a label indicating that the query result content is a negative sample, that is, a negative sample label; the second sample label can be a label indicating that the query result content is a positive sample, that is, a positive sample label, or a label indicating that the query result content is a negative sample, that is, a negative sample label.
[0116] The score corresponding to each label type can be set in advance, and then the matching score of the query result content can be calculated according to the label type of the first sample label of the query result content and the label type of the second sample label. For example, the score corresponding to the positive sample label can be set to 1, and the score corresponding to the negative sample label can be set to 0. Assuming that the first sample label of the query result content A is the positive sample label and the second sample label is the positive sample label, the matching score of the query result content A is 2 (1+1=2).
[0117] By determining the sample labels of the query result content through the matching score, the score threshold can be flexibly adjusted as needed to control the type of generated sample labels, making the generated sample labels highly flexible.
[0118] Optionally, the matching score can also be controlled by weight to make the distribution of the matching score wider, so as to more accurately control the generation of sample labels. That is, in one embodiment, each label type corresponds to a label score, and the step of "calculating the matching score of the query result content according to the label type of the first sample label and the label type of the second sample label" can specifically include:
[0119] Determine a first label weight of the first sample label according to the user interaction duration, and determine a second label weight of the second sample label according to the relevance;
[0120] According to the first label weight, weighted calculation is performed on the label score of the first sample label to obtain a first weighted label score;
[0121] According to the second label weight, the label score of the second sample label is weighted to obtain a second weighted label score;
[0122] A matching score of the query result content is calculated based on the first weighted tag score and the second weighted tag score.
[0123] For example, the first label weight of the first sample label can be determined according to the user interaction duration. The greater the difference between the user interaction duration and the interaction duration threshold, the greater the first label weight. Similarly, the greater the difference between the relevance and the relevance threshold, the greater the second label weight.
[0124] The label score corresponding to the positive sample label can be set to 1, and the label score corresponding to the negative sample label can be set to -1. The first weighted label score can be calculated according to the following formula (1), and the second weighted label score can be calculated according to the following formula (2), wherein S1 is the first weighted label score, t is the user interaction time, t0 is the target time threshold, and G1 is the score of the first sample label; S2 is the second weighted label score, Sim is the relevance, t0 is the Sim0 threshold, G1 is the score of the second sample label, and k1 and k2 are coefficients used to adjust the order of magnitude of the label coefficient.
[0125] Formula (1): S1 = |t-t0| × k1 × G1
[0126] Formula (2): S2=|Sim-Sim0|×k2×G2
[0127] The first weighted label score and the second weighted label score are added together to obtain a matching score of the query result content.
[0128] Assume that k1 is 1, k2 is 10; the user interaction time of query result content B is 15s, and the corresponding target time threshold is 11s; the relevance is 0.4, and the relevance threshold is 0.5. Therefore, the first sample label is a positive sample label, and the second sample label is a negative sample label. The first weighted label score can be calculated as 4 according to the following formula (1); the second weighted label score can be calculated as -1 according to the following formula (2); the first weighted label score and the second weighted label score are added together to obtain a matching score of 3 for the query result content. Then, the sample label of the training sample pair consisting of the query text sample and the query result content can be generated according to the relationship between the size of the score threshold.
[0129] After obtaining the sample labels, the content recommendation model can be trained according to the sample pairs carrying the sample labels. That is, in one embodiment, after the step of "generating sample labels of training sample pairs consisting of query result content and query text samples based on the first sample labels and the second sample labels of the query result content", the sample label generation method provided in the embodiment of the present application further includes:
[0130] The content recommendation model is trained through the training sample pairs to obtain a trained content recommendation model;
[0131] When a query text is received, the trained content recommendation model is used to recommend query result content based on the query text.
[0132] For example, the content recommendation model may be trained by using training sample pairs (ie, query-doc) carrying sample labels until a trained content recommendation model is obtained.
[0133] When a query text is received, the trained content recommendation model is used to recommend query result content based on the query text.
[0134] The self-supervised training method adopted in the embodiment of the present application can achieve daily updates, and can train the content recommendation model during the off-peak period of access, thereby improving the content recommendation accuracy of the content recommendation model.
[0135] As can be seen from the above, the embodiments of the present application obtain query text samples and query result content of the query text samples; determine the target interaction time threshold corresponding to the content volume of the query result content according to the mapping relationship between the preset content volume and the interaction time threshold; obtain the user interaction time of the query result content, and determine the first sample label of the query result content according to the size relationship between the user interaction time and the target interaction time threshold; determine the second sample label of the query result content according to the relevance of the query text sample to the query result content; and generate a sample label of a training sample pair consisting of the query result content and the query text sample based on the first sample label and the second sample label of the query result content.
[0136] The embodiment of the present application obtains a first sample label for the query result content based on the posterior behavior information of the query result content, that is, the user interaction duration, and obtains a second sample label for the query result content based on the correlation between the query result content and the query text sample. The sample label for the query result content is generated by combining the first sample label and the second sample label. This can realize automatic generation of sample labels and reduce the labor cost of sample labeling. In addition, the accuracy of the generated sample labels can be improved by combining the posterior behavior information and the correlation.
[0137] In order to facilitate better implementation of the sample label generation method provided in the embodiment of the present application, a sample label generation device is also provided in one embodiment. The meanings of the terms are the same as those in the above sample label generation method, and the specific implementation details can refer to the description in the method embodiment.
[0138] The sample label generating device can be integrated into a computer device, such as Figure 4 As shown, the sample label generation device may include: an acquisition unit 301, a threshold determination unit 302, a first label determination unit 303, a second label determination unit 304 and a label generation unit 305, which are specifically as follows:
[0139] (1) Acquisition unit 301: used to acquire a query text sample and the query result content of the query text sample.
[0140] (2) Threshold determination unit 302: used to determine the target interaction duration threshold corresponding to the content volume of the query result content according to a preset mapping relationship between the content volume and the interaction duration threshold.
[0141] In one embodiment, the threshold determination unit 302 includes:
[0142] Theme determination subunit: used to determine the content theme text of the query result content;
[0143] Extraction subunit: used to extract content features from the query result content to obtain content feature information of the query result content;
[0144] Content determination subunit: used to determine the target sub-content related to the content subject text in the query result content according to the content feature information;
[0145] Target threshold determination subunit: used to determine the target interaction time threshold corresponding to the query result content according to the mapping relationship between the preset content volume and the interaction time threshold and the target sub-content.
[0146] (3) a first label determination unit 303: configured to obtain the user interaction duration of the query result content, and determine a first sample label of the query result content according to a relationship between the user interaction duration and a target interaction duration threshold;
[0147] (4) A second label determination unit 304: configured to determine a second sample label of the query result content according to the relevance between the query text sample and the query result content;
[0148] In one embodiment, the second label determination unit 304 includes:
[0149] Feature extraction subunit: used to extract features from the query text sample and the query result content respectively through the content recommendation model, and obtain the query text feature information of the query text training sample and the content feature information of the query result content;
[0150] A relevance determination subunit: used to obtain the relevance between the query text sample and the query result content according to the feature distance between the query text feature information and the content feature information;
[0151] A second sample label of the query result content is determined according to the relevance.
[0152] (5) Label generation unit 305: used to generate a sample label of a training sample pair consisting of the query result content and the query text sample based on the first sample label and the second sample label of the query result content.
[0153] In one embodiment, the label generation unit 305 includes:
[0154] A score calculation subunit: used to calculate the matching score of the query result content according to the tag type of the first sample tag and the tag type of the second sample tag;
[0155] Sample label generation subunit: used to generate sample labels for training sample pairs consisting of query result content and query text samples according to matching scores.
[0156] In one embodiment, each tag type corresponds to a tag score, and the score calculation subunit includes:
[0157] Weight determination module: used to determine a first label weight of a first sample label according to the user interaction duration, and determine a second label weight of a second sample label according to the relevance;
[0158] A first weighted calculation module: configured to perform weighted calculation on the label score of the first sample label according to the first label weight to obtain a first weighted label score;
[0159] A second weighted calculation module: used to perform weighted calculation on the label score of the second sample label according to the second label weight to obtain a second weighted label score;
[0160] Matching score calculation module: used to calculate the matching score of the query result content based on the first weighted label score and the second weighted label score.
[0161] In one embodiment, the sample label generating device further includes:
[0162] An interval determination unit: used to determine a content volume interval, wherein the content volume interval includes at least one content volume;
[0163] An interaction information acquisition unit: used for acquiring, for each content volume interval, a user interaction duration and a user interaction volume of each historical query result content whose content volume belongs to the volume interval within a preset time period;
[0164] Sorting unit: used to sort the historical query result content according to the user interaction time, and obtain the sorted historical query result content;
[0165] Interval threshold determination unit: used to determine the interaction time threshold of each content volume interval according to the total user interaction volume and the user interaction time of the historical query result content in the sorting interval corresponding to the preset condition;
[0166] A mapping relationship generating unit is used to obtain a mapping relationship between the content volume and the interaction time threshold according to the interaction time threshold of each content volume interval and the content volume contained in the content volume interval.
[0167] In one embodiment, the sample label generating device further includes:
[0168] Training unit: used to train the content recommendation model through training sample pairs to obtain a trained content recommendation model;
[0169] Recommendation unit: used to recommend query result content based on the query text through the trained content recommendation model when receiving the query text.
[0170] As can be seen from the above, the sample label generation device of the embodiment of the present application obtains the query text sample and the query result content of the query text sample through the acquisition unit 301; the threshold determination unit 302 determines the target interaction time threshold corresponding to the content volume of the query result content according to the mapping relationship between the preset content volume and the interaction time threshold; the first label determination unit 303 obtains the user interaction time of the query result content, and determines the first sample label of the query result content according to the size relationship between the user interaction time and the target interaction time threshold; the second label determination unit 304 determines the second sample label of the query result content according to the correlation between the query text sample and the query result content; the label generation unit 305 generates a sample label for the training sample pair consisting of the query result content and the query text sample based on the first sample label and the second sample label of the query result content.
[0171] The embodiment of the present application obtains a first sample label for the query result content based on the posterior behavior information of the query result content, that is, the user interaction duration, and obtains a second sample label for the query result content based on the correlation between the query result content and the query text sample. The sample label for the query result content is generated by combining the first sample label and the second sample label. This can realize automatic generation of sample labels and reduce the labor cost of sample labeling. In addition, the accuracy of the generated sample labels can be improved by combining the posterior behavior information and the correlation.
[0172] The present application also provides a computer device, which may be a terminal or a server. Figure 5 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0173] The computer device may include components such as a processor 1001 with one or more processing cores, a memory 1002 with one or more computer-readable storage media, a power supply 1003, and an input unit 1004. Those skilled in the art will appreciate that Figure 5 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0174] The processor 1001 is the control center of the computer device. It uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 1002 and calling data stored in the memory 1002, it executes various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 1001 may include one or more processing cores; preferably, the processor 1001 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and computer programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1001.
[0175] The memory 1002 can be used to store software programs and modules. The processor 1001 executes various functional applications and data processing by running the software programs and modules stored in the memory 1002. The memory 1002 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 1002 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 1002 may also include a memory controller to provide the processor 1001 with access to the memory 1002.
[0176] The computer device also includes a power supply 1003 for supplying power to various components. Preferably, the power supply 1003 can be logically connected to the processor 1001 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 1003 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0177] The computer device may further include an input unit 1004, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0178] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically, in this embodiment, the processor 1001 in the computer device will load the executable files corresponding to the processes of one or more computer programs into the memory 1002 according to the following instructions, and the processor 1001 will run the computer programs stored in the memory 1002, thereby realizing various functions, as follows:
[0179] Obtaining a query text sample and query result content of the query text sample;
[0180] Determine the target interaction time threshold corresponding to the content volume of the query result content according to the preset mapping relationship between the content volume and the interaction time threshold;
[0181] Obtaining the user interaction duration of the query result content, and determining a first sample label of the query result content according to a magnitude relationship between the user interaction duration and a target interaction duration threshold;
[0182] Determine a second sample label of the query result content according to the relevance between the query text sample and the query result content;
[0183] Based on the first sample label and the second sample label of the query result content, a sample label of a training sample pair consisting of the query result content and the query text sample is generated.
[0184] The specific implementation of the above operations can be found in the previous embodiments and will not be described in detail here.
[0185] As can be seen from the above, the embodiments of the present application obtain query text samples and query result content of the query text samples; determine the target interaction time threshold corresponding to the content volume of the query result content according to the mapping relationship between the preset content volume and the interaction time threshold; obtain the user interaction time of the query result content, and determine the first sample label of the query result content according to the size relationship between the user interaction time and the target interaction time threshold; determine the second sample label of the query result content according to the relevance of the query text sample to the query result content; and generate a sample label of a training sample pair consisting of the query result content and the query text sample based on the first sample label and the second sample label of the query result content.
[0186] The embodiment of the present application obtains a first sample label for the query result content based on the posterior behavior information of the query result content, that is, the user interaction duration, and obtains a second sample label for the query result content based on the correlation between the query result content and the query text sample. The sample label for the query result content is generated by combining the first sample label and the second sample label. This can realize automatic generation of sample labels and reduce the labor cost of sample labeling. In addition, the accuracy of the generated sample labels can be improved by combining the posterior behavior information and the correlation.
[0187] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional implementations in the above-mentioned embodiments.
[0188] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0189] To this end, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be loaded by a processor to execute any sample label generation method provided in the embodiment of the present application.
[0190] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0191] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0192] Since the computer program stored in the computer-readable storage medium can execute any of the sample label generation methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any of the sample label generation methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0193] The above is a detailed introduction to a sample label generation method, device, computer equipment and computer-readable storage medium provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A sample label generation method, characterized in that: include: Obtaining a query text sample and query result content of the query text sample; Determine the target interaction time threshold corresponding to the content volume of the query result content according to a preset mapping relationship between the content volume and the interaction time threshold; Acquire the user interaction duration of the query result content, and determine a first sample label of the query result content according to a magnitude relationship between the user interaction duration and the target interaction duration threshold; Determining a second sample label of the query result content according to the relevance between the query text sample and the query result content; Calculating a matching score of the query result content according to the tag type of the first sample tag and the tag type of the second sample tag; A sample label of a training sample pair consisting of the query result content and the query text sample is generated according to the matching score.
2. The method according to claim 1, characterized in that The determining, according to a preset mapping relationship between the content volume and the interaction time threshold, a target interaction time threshold corresponding to the content volume of the query result content includes: Determine the content subject text of the query result content; Extracting content features of the query result content to obtain content feature information of the query result content; Determine, according to the content feature information, a target sub-content in the query result content that is related to the content subject text; The target interaction time threshold corresponding to the query result content is determined according to a preset mapping relationship between the content volume and the interaction time threshold and the target sub-content.
3. The method according to claim 1, characterized in that Before determining the target interaction time threshold corresponding to the content volume of the query result content according to the preset mapping relationship between the content volume and the interaction time threshold, the method further includes: determining a content volume interval, the content volume interval including at least one content volume; For each content volume interval, obtaining the user interaction duration and user interaction volume of each historical query result content whose content volume belongs to the volume interval within a preset time period; Sorting the historical query result content according to the user interaction duration to obtain sorted historical query result content; Determine the interaction time threshold for each content volume interval based on the total user interaction volume and the user interaction time of the historical query result content in the sorting interval corresponding to the preset condition; According to the interaction time threshold of each content volume interval and the content volume included in the content volume interval, a mapping relationship between the content volume and the interaction time threshold is obtained.
4. The method according to claim 1, characterized in that: Each tag type corresponds to a tag score, and the step of calculating the matching score of the query result content according to the tag type of the first sample tag and the tag type of the second sample tag includes: Determine a first label weight of the first sample label according to the user interaction duration, and determine a second label weight of the second sample label according to the relevance; According to the first label weight, weighted calculation is performed on the label score of the first sample label to obtain a first weighted label score; According to the second label weight, weighted calculation is performed on the label score of the second sample label to obtain a second weighted label score; A matching score of the query result content is calculated based on the first weighted tag score and the second weighted tag score.
5. The method according to any one of claims 1 to 4, characterized in that: The step of determining a second sample label of the query result content according to the relevance between the query text sample and the query result content includes: Extracting features of the query text sample and the query result content respectively through a content recommendation model to obtain query text feature information of the query text training sample and content feature information of the query result content; Obtaining the relevance between the query text sample and the query result content according to the feature distance between the query text feature information and the content feature information; A second sample label of the query result content is determined according to the relevance.
6. The method according to claim 5, characterized in that After generating sample labels of a training sample pair consisting of the query result content and the query text sample based on the first sample label and the second sample label of the query result content, the method further includes: Training the content recommendation model using the training sample pairs to obtain a trained content recommendation model; When a query text is received, the trained content recommendation model recommends query result content based on the query text.
7. A sample label generation device, characterized in that: include: An acquisition unit, used to acquire a query text sample and a query result content of the query text sample; A threshold determination unit, configured to determine a target interaction time threshold corresponding to the content volume of the query result content according to a preset mapping relationship between the content volume and the interaction time threshold; A first label determination unit, configured to obtain a user interaction duration of the query result content, and determine a first sample label of the query result content according to a magnitude relationship between the user interaction duration and the target interaction duration threshold; A second label determination unit, configured to determine a second sample label of the query result content according to the relevance between the query text sample and the query result content; A label generation unit is used to calculate the matching score of the query result content according to the label type of the first sample label and the label type of the second sample label; and generate a sample label of a training sample pair consisting of the query result content and the query text sample according to the matching score.
8. A computer device, characterized in that: The method comprises a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the sample label generation method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is loaded by a processor to execute the sample label generation method according to any one of claims 1 to 6.
