A model training sample generation method, device, medium, equipment and product

By employing a dual strategy based on user interaction behavior and sample scores to generate training samples in mobile internet applications, the problems of scarce exposure resources and divergent user intent are solved, thereby improving the overall performance of the recommendation system and the prediction accuracy of long-tail products.

CN122153455APending Publication Date: 2026-06-05ALIPAY (HANGZHOU) INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
Filing Date
2026-03-18
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In the homepage recommendation scenario of mobile internet applications, the scarcity of exposure resources and the highly diversified user intent cause traditional recommendation systems to treat unclicked products as negative samples, introducing sample noise and impairing the accuracy of the recommendation model in predicting user interests, especially weakening the accuracy of predicting long-tail products.

Method used

Training samples are generated using a dual strategy based on user interaction behavior and sample scores. The first strategy filters out non-click behavior, and the second strategy selects high-scoring samples to avoid the introduction of false negative samples and improve the purity of training samples.

Benefits of technology

It enhances the overall recommendation effect and fairness of the recommendation system, improves the accuracy of prediction for long-tail products, and protects the recommendation effect of long-tail products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122153455A_ABST
    Figure CN122153455A_ABST
Patent Text Reader

Abstract

The embodiment of the specification provides a model training sample generation method and device, a computer readable storage medium, an electronic equipment and a computer program product, the method comprises: in the case of triggering a sample generation task, determining a target strategy from a first sample generation strategy and a second sample generation strategy, wherein the first sample generation strategy comprises obtaining a training sample from samples generated by user interaction with a system interface within a preset time window based on user interaction behavior with the system interface, the system interface is a homepage interface containing commodity recommendation content, the second sample generation strategy comprises obtaining a training sample from samples recalled by the system based on sample scores, the samples recalled by the system include samples generated after a recommended commodity displayed by the system interface in the past is clicked, and samples generated after a recommended commodity displayed by the system interface in the past is not clicked; generating a training sample set for commodity recommendation model training based on the target strategy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of data processing technology, and in particular to a method, apparatus, computer-readable storage medium, electronic device, and computer program product for generating model training samples. Background Technology

[0002] In the homepage recommendation scenarios of mobile internet applications (such as payment applications), two significant characteristics exist: extremely scarce exposure resources and highly diversified user intent. On the one hand, limited by interface space and product positioning, each homepage refresh can only display a very small number of recommended products (e.g., 1 or 2 products), resulting in the vast majority of candidate products failing to gain exposure. On the other hand, users primarily enter the homepage to perform utility operations (such as payment, scanning QR codes, searching, etc.), paying very little attention to recommended products, which often become byproducts and are difficult to effectively notice.

[0003] In this context, traditional recommendation systems often simply treat "viewed but not clicked" items as negative samples. However, this behavior does not truly reflect a user's dislike for the recommended items. The lack of clicks is more likely due to the user not noticing the item's content or their current intent not being focused on it. Using unclicked recommended items as negative samples during recommendation model training introduces significant sample noise (e.g., spurious negative samples), leading to misjudgments of user interests by the recommendation model. This is particularly detrimental to the accuracy of the model's predictions of long-tail items, ultimately weakening the overall recommendation performance and fairness of the system.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this specification, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] This specification provides a method, apparatus, computer-readable storage medium, electronic device, and computer program product for generating model training samples, which can improve the purity of training samples used for training product recommendation models. This not only enhances the overall recommendation effect and fairness of the recommendation system, but also improves the system's prediction accuracy for long-tail products, thus helping to protect long-tail products.

[0006] According to one aspect of this specification, a method for generating model training samples is provided. The method includes: upon triggering a sample generation task, determining a target strategy from a first sample generation strategy and a second sample generation strategy, wherein the first sample generation strategy includes obtaining training samples from samples generated by user interaction with the system interface within a preset time window based on user interaction behavior with the system interface, the system interface being a homepage containing product recommendation content; the second sample generation strategy includes obtaining training samples from samples recalled by the system based on sample scores, the recalled samples including samples generated after previously displayed recommended products on the system interface were clicked, and samples generated when previously displayed recommended products on the system interface were not clicked; and generating a training sample set for training a product recommendation model based on the target strategy.

[0007] Based on the above technical solutions, training sample sets for product recommendation model training are generated using two different sample generation strategies. On one hand, the first sample generation strategy obtains training samples from user interactions with the system interface within a preset time window. When the samples generated by user interactions within the preset time window include samples generated by clicking recommended products on the system interface, as well as samples generated by user interactions that trigger non-clicked recommended products (e.g., clicking the search bar or swiping the page), the user's interaction behavior can filter out samples generated by non-clicked recommended products, thus retaining samples generated by clicked recommended products. This avoids treating unclicked recommended products as negative samples and introducing pseudo-negative samples into the training samples, improving the purity of the training samples. On the other hand, the second sample generation strategy obtains training samples based on sample scores from samples generated after previously displayed recommended products on the system interface were clicked, and samples generated when previously displayed recommended products on the system interface were not clicked. By implementing a second sample generation strategy, samples with lower scores can be filtered out from the system's recalled samples, while samples with higher scores are retained to generate training samples. This avoids introducing low-scoring samples into the training samples, thus improving the purity of the training samples. Therefore, by generating a training sample set for the product recommendation model using the first and / or second sample generation strategies when the sample generation task is triggered, the purity of the training samples used for product recommendation model training can be improved. This not only enhances the overall recommendation effect and fairness of the recommendation system but also improves the system's prediction accuracy for long-tail products, which is beneficial for protecting long-tail products.

[0008] In one possible implementation, when the target strategy includes a first sample generation strategy, generating a training sample set for training the product recommendation model based on the target strategy includes: upon receiving exposure logs about the system interface, acquiring all user interaction behaviors with the system interface within a preset time window; and determining the training sample set from a first original sample based on all interaction behaviors, wherein the first original sample includes samples generated by the user's interaction with the system interface within the preset time window.

[0009] In one possible implementation, determining the training sample set from the first original sample based on all interactive behaviors includes: determining whether a first type of interactive behavior exists among all interactive behaviors, the first type of interactive behavior including user interaction behaviors with the system interface within a first preset time after receiving the exposure log; if the first type of interactive behavior exists among all interactive behaviors, filtering the samples generated based on the first type of interactive behavior in the first original sample to obtain a first candidate sample; determining the training sample set based on the first candidate sample; if the first type of interactive behavior does not exist among all interactive behaviors, using the first original sample as the first candidate sample, and performing the step of determining the training sample set based on the first candidate sample.

[0010] In one possible implementation, determining the training sample set based on the first candidate sample includes: acquiring the second type of interactive behavior and the third type of interactive behavior in the interactive behavior corresponding to the first candidate sample, wherein the second type of interactive behavior includes the interactive behavior generated by the user in other areas of the system interface except for the recommended product area, and the third type of interactive behavior includes the user's interactive behavior on the system interface within a second preset time period after receiving the exposure log, wherein the second preset time period is longer than the first preset time period; filtering the samples generated based on the second type of interactive behavior and the third type of interactive behavior in the first candidate sample to obtain the training sample set.

[0011] In one possible implementation, when the target strategy includes a second sample generation strategy, generating a training sample set for training the product recommendation model based on the target strategy includes: sorting each sample in the second original sample in descending order based on the sample score to obtain a sorting result, wherein the second original sample includes samples recalled by the system; obtaining a first preset number of samples ranked first in the sorting result to obtain second candidate samples; dividing the first type of samples in the second candidate samples into high-scoring difficult samples and medium-scoring samples based on a preset score, wherein the sample score of the high-scoring difficult samples is greater than or equal to the preset score, and the sample score of the medium-scoring samples is less than the preset score, wherein the first type of samples includes samples generated from previously displayed recommended products on the system interface that have not been clicked; generating a training sample set based on the high-scoring difficult samples, and / or generating a training sample set based on the medium-scoring samples.

[0012] In one possible implementation, generating a training sample set based on high-scoring, difficult samples includes: if a first target sample exists among the high-scoring, difficult samples, generating a training sample set based on the first target sample. The first target sample includes samples in the high-scoring, difficult samples whose difference between the sample score and the sample score of the second type of samples is less than a preset difference. The second type of samples includes samples generated after recommended products previously displayed on the system interface are clicked.

[0013] In one possible implementation, generating a training sample set based on high-scoring, difficult samples includes: if there is a second target sample among the high-scoring, difficult samples, generating a training sample set based on the second target sample, wherein the ranking of the second target sample in the ranking result is higher than the ranking of each sample in the second type of samples in the ranking result, and the second type of samples includes samples generated after the recommended products previously displayed on the system interface are clicked.

[0014] In one possible implementation, generating a training sample set based on the median sample includes: marking the median sample as a negative sample, dividing the samples in the median sample into a first sample group and a second sample group according to a preset ratio, wherein the number of samples in the first sample group is less than the number of samples in the second sample group, and adding the first sample group to the training sample set.

[0015] According to another aspect of this specification, a model training sample generation apparatus is provided, the apparatus comprising:

[0016] The strategy determination module is used to determine the target strategy from the first sample generation strategy and the second sample generation strategy when the sample generation task is triggered. The first sample generation strategy includes obtaining training samples from the samples generated by the user's interaction with the system interface within a preset time window based on the user's interaction behavior with the system interface. The system interface is a homepage interface containing product recommendation content. The second sample generation strategy includes obtaining training samples from the samples recalled by the system based on the sample scores. The samples recalled by the system include samples generated after the recommended products previously displayed on the system interface were clicked, and samples generated when the recommended products previously displayed on the system interface were not clicked. The sample generation module is used to generate a training sample set for training the product recommendation model based on the target strategy.

[0017] According to another aspect of this specification, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the model training sample generation method as described in the above embodiments.

[0018] According to one aspect of this specification, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computer or processor, cause the computer or processor to perform the model training sample generation method as described in the above embodiments.

[0019] According to another aspect of this specification, a computer program product containing instructions is provided that, when the computer program product is run on a computer or processor, causes the computer or processor to perform the model training sample generation method as described in the above embodiments.

[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this specification. Attached Figure Description

[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this specification and, together with the description, serve to explain the principles of this specification. It is obvious that the drawings described below are merely some embodiments of this specification, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0022] Figure 1 A schematic flowchart of a model training sample generation method provided in an embodiment of this specification is shown; Figure 2 Another schematic flowchart of a model training sample generation method provided in the embodiments of this specification is shown; Figure 3 This specification shows a schematic diagram of the structure of a model training sample generation device provided in an embodiment. Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification is shown. Detailed Implementation

[0023] The technical solutions in this specification will now be described clearly and in detail with reference to the accompanying drawings. In the description of the embodiments in this specification, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B. "And / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments in this specification, "multiple" refers to two or more than two.

[0024] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0025] In the homepage recommendation scenarios of mobile internet applications (such as payment applications), two significant characteristics exist: extremely scarce exposure resources and highly diversified user intent. On the one hand, limited by interface space and product positioning, each homepage refresh can only display a very small number of recommended products (e.g., 1 or 2 products), resulting in the vast majority of candidate products failing to gain exposure. On the other hand, users primarily enter the homepage to perform utility operations (such as payment, scanning QR codes, searching, etc.), paying very little attention to recommended products, which often become byproducts and are difficult to effectively notice.

[0026] In this context, traditional recommendation systems often simply treat "viewed but not clicked" items as negative samples. However, this behavior does not truly reflect a user's dislike for the recommended items. The lack of clicks is more likely due to the user not noticing the item's content or their current intent not being focused on it. Using unclicked items as negative samples in recommendation model training introduces significant sample noise (e.g., spurious negative samples), leading to misjudgments of user interests and ultimately weakening the overall recommendation effectiveness and fairness.

[0027] To address the aforementioned issues, this specification provides a method, apparatus, electronic device, and computer-readable storage medium for generating model training samples. This specification can improve the purity of training samples used for training product recommendation models, thereby enhancing not only the overall recommendation effect and fairness of the recommendation system but also improving the system's accuracy in predicting long-tail products, which is beneficial for protecting long-tail products.

[0028] The following is an embodiment of a model training sample generation method provided in this specification.

[0029] Figure 1 A schematic flowchart of a model training sample generation method provided in an embodiment of this specification is shown, such as... Figure 1 As shown, the model training sample generation method provided in this specification is applied to electronic devices with computing power, such as servers. This model training sample generation method includes the following schemes: S110: When a sample generation task is triggered, a target strategy is determined from the first sample generation strategy and the second sample generation strategy. The first sample generation strategy includes obtaining training samples from the samples generated by the user's interaction with the system interface within a preset time window based on the user's interaction behavior with the system interface. The system interface is a homepage interface containing product recommendation content. The second sample generation strategy includes obtaining training samples from the samples recalled by the system based on the sample scores. The samples recalled by the system include samples generated after the recommended products previously displayed on the system interface were clicked, and samples generated after the recommended products previously displayed on the system interface were not clicked. S120: Generate a training sample set for training the product recommendation model based on the target policy.

[0030] In one exemplary embodiment, the sample generation task can be understood as the task of generating a training sample set for training a product recommendation model. Users can manually trigger the sample generation task, for example, by switching the on / off button of the sample generation task from off to on. The system can also automatically trigger the sample generation task, that is, the system triggers the sample generation task once at regular intervals.

[0031] Two sample generation strategies were pre-defined: a first sample generation strategy and a second sample generation strategy. The first sample generation strategy involves acquiring training samples from user interactions with the system interface within a preset time window. The system interface is a homepage display containing product recommendations, such as the main interface displayed when a user opens a payment application. User interactions with the system interface include actions such as clicking, swiping, and dragging. Assuming a preset time window of 10 minutes, samples are generated 10 minutes after a user enters and interacts with the system interface. These samples are formed by user interactions triggered within the system interface. For example, samples generated within these 10 minutes include: samples generated when a user clicks on a recommended product on the system interface, samples generated when a user clicks the search bar on the system interface, etc.

[0032] The second sample generation strategy involves obtaining training samples from the samples recalled by the system based on sample scores. The recalled samples include those generated from previously displayed recommended products that were not clicked (referred to as the first type of samples), and those generated from previously displayed recommended products that were clicked (referred to as the second type of samples). The sample score represents the probability of a user interacting with a recommended product, such as the probability of a user clicking on a recommended product. The sample score is positively correlated with the probability of a user interacting with a recommended product.

[0033] When a sample generation task is triggered, a target strategy is determined from a first sample generation strategy and a second sample generation strategy. The target strategy can be either the first sample generation strategy, the second sample generation strategy, or both. Then, a training sample set for training the product recommendation model is generated based on the target strategy. Specifically, if the target strategy is the first sample generation strategy, the training sample set includes only training samples obtained based on the first sample generation strategy; if the target strategy is the second sample generation strategy, the training sample set includes only training samples obtained based on the second sample generation strategy; if the target strategy includes both the first and second sample generation strategies, the training sample set includes both training samples obtained based on the first and second sample generation strategies.

[0034] After obtaining the training sample set, the product recommendation model can be trained directly using the obtained training sample set to achieve real-time updates of the product recommendation model. Alternatively, the training sample set can be stored in local space first to update the sample data in the local space. After updating the sample data in the local space a set number of times, the product recommendation model can be trained based on the sample data in the local space to achieve a full update of the product recommendation model.

[0035] Based on the technical solutions formed in S110 to S120 above, this specification implements training sample sets for product recommendation model training based on two different sample generation strategies. On one hand, the first sample generation strategy obtains training samples from samples generated by user interaction with the system interface within a preset time window. When the samples generated by user interaction with the system interface within the preset time window include samples generated by the user clicking on recommended products in the system interface, as well as samples generated by the user triggering non-clicked recommended products interaction behaviors (such as clicking the search bar or swiping the page), the user's interaction behavior can filter out the samples generated by non-clicked recommended products interaction behaviors, thus retaining the samples generated by clicked recommended products. This avoids treating unclicked recommended products as negative samples and introducing pseudo-negative samples into the training samples, which helps improve the purity of the training samples. On the other hand, the second sample generation strategy obtains training samples based on sample scores from samples generated after previously displayed recommended products were clicked on the system interface, and samples generated after previously displayed recommended products were not clicked. By implementing a second sample generation strategy, samples with lower scores can be filtered out from the system's recalled samples, while samples with higher scores are retained to generate training samples. This avoids introducing low-scoring samples into the training samples, thus improving the purity of the training samples. Therefore, by generating a training sample set for the product recommendation model using the first and / or second sample generation strategies when the sample generation task is triggered, the purity of the training samples used for product recommendation model training can be improved. This not only enhances the overall recommendation effect and fairness of the recommendation system but also improves the system's prediction accuracy for long-tail products, which is beneficial for protecting long-tail products.

[0036] In one possible implementation, when the target strategy includes a first sample generation strategy, generating a training sample set for training the product recommendation model based on the target strategy includes the following steps: Upon receiving exposure logs about the system interface, obtain all user interactions with the system interface within a preset time window; The training sample set is determined from the first original sample based on all interactive behaviors. The first original sample includes samples generated by the user interacting with the system interface within a preset time window.

[0037] Receiving an exposure log from the system interface indicates that the system has recorded and acquired event data showing that a user has seen a recommended piece of content (such as a product, advertisement, or recommendation card) on the system interface. Taking payment applications as an example, when a user opens the system interface of a payment application, and the recommended content on the system interface enters the visible area of ​​the screen (usually meeting a certain dwell time or visible proportion), the application will trigger an exposure log and report the exposure log to the server. After the server receives the exposure log, it means that it has confirmed that the recommended content has been actually exposed by the user. Subsequently, it can use this exposure log to associate with the user's clicks, conversions, and other behaviors, thereby obtaining data for model training.

[0038] For cases where the target strategy is the first sample generation strategy, upon receiving exposure logs about the system interface, the training instructions for the product recommendation model are not immediately issued. Instead, a preset time window (e.g., 10 minutes) is opened, and all user interactions with the system interface (referred to as post-link behaviors) are acquired within this window. These acquired interactions include not only clicks on recommended products within the system interface but also non-click interactions, such as clicks on the search box, page scrolling, clicks on navigation controls (tabs) in the navigation bar, habitual or accidental touches after entering the system interface, and clicks on specific areas of the system interface (e.g., clicking the scan button or the page navigation button), etc.

[0039] After obtaining all user interactions with the system interface within a preset time window, a training sample set is determined from the first original sample (samples generated by user interactions with the system interface within the preset time window) based on all the obtained interactions. Since each interaction is known, samples generated from non-clicking recommended products in the first original sample can be filtered out, thus retaining samples generated from user clicks on recommended products in the system interface, thereby improving the purity of the training sample.

[0040] In one possible implementation, determining the training sample set from the first original sample based on all interaction behaviors includes the following steps: Determine whether a type I interactive behavior exists among all interactive behaviors; If a first type of interactive behavior exists among all interactive behaviors, the samples generated based on the first type of interactive behavior in the first original sample are filtered to obtain the first candidate sample. The training sample set is determined based on the first candidate sample; If no first type of interaction behavior exists among all interaction behaviors, the first original sample is used as the first candidate sample, and the step of determining the training sample set based on the first candidate sample is executed.

[0041] The first type of interactive behavior includes user interactions with the system interface within a first preset time period (e.g., 1 second) after receiving the exposure log, such as clicking the "Tap" button, clicking the "Scan" button, clicking the "Page Jump" button, etc. After acquiring all user interactions with the system interface within the preset time window, it is determined whether any of the first type of interactive behavior exists. If the first type of interactive behavior exists, the samples generated based on the first type of interactive behavior in the first original sample are considered invalid exposure samples. Therefore, the samples generated based on the first type of interactive behavior in the first original sample are filtered to obtain the first candidate sample. That is, the first candidate sample does not include samples generated based on the first type of interactive behavior, thus achieving the removal of false exposure samples.

[0042] If no type 1 interaction behavior exists among all interactions, meaning the first original sample does not include samples generated based on type 1 interaction behavior, then the first original sample is used as the first candidate sample, and the training sample set is determined based on the first candidate sample. Since the first candidate sample does not include samples generated based on type 1 interaction behavior, but does include samples generated by other interactions in the non-click recommended product interaction behavior, further filtering of the first candidate sample is needed to obtain the training sample set.

[0043] In one possible implementation, determining the training sample set from the first original sample based on all interaction behaviors includes the following steps: Obtain the second and third types of interactive behaviors from the interactive behaviors corresponding to the first candidate sample; The samples generated based on the second and third types of interaction behaviors in the first candidate sample are filtered to obtain the training sample set.

[0044] Non-click product recommendation interactions include two categories: Category 2 and Category 3. Category 2 interactions include user actions outside the recommended product area of ​​the system interface, such as clicking the search box, swiping the page, or clicking navigation controls in the navigation bar. Category 3 interactions include user actions within a second preset time (e.g., 3 seconds) after receiving the exposure log, where the second preset time is longer than the first preset time. Examples include habitual or accidental touches performed by the user after entering the system interface.

[0045] After obtaining the second and third types of interactive behaviors from the interactive behaviors corresponding to the first candidate samples, the samples generated based on the second and third types of interactive behaviors in the first candidate samples are filtered to obtain the training sample set. Specifically, this specification further performs weight reduction processing on the samples generated based on the second type of interactive behaviors in the first candidate samples, resulting in weighted samples, which are then marked as pseudo-negative samples. Similarly, samples generated based on the third type of interactive behaviors in the first candidate samples are marked as pseudo-positive samples. Therefore, by filtering the samples generated based on the second and third types of interactive behaviors in the first candidate samples, pseudo-negative samples in the training sample set can be removed, improving not only the purity of negative samples in the training sample set but also the overall purity of the training samples.

[0046] This specification employs a first sample generation strategy to generate a training sample set for training the product recommendation model. On one hand, by introducing post-link behavior as a supervisory signal, it can accurately identify the interface content that the user is interested in and the interface content that the user is not interested in after interaction with the system interface. This avoids incorrectly labeling recommended products that are displayed but not clicked by the user as pseudo-negative samples that the user dislikes, significantly improving the purity of negative samples and protecting long-tail products. On the other hand, by introducing a judgment based on the duration of user interaction with the system interface after exposure, it can accurately identify habitual or accidental touches performed by the user on the system interface, as well as actions performed by the user clicking on specific areas of the system interface. This avoids the problem of interaction behavior confusion. It not only effectively prevents samples generated by habitual or accidental touches performed by the user on the system interface, as well as samples generated by actions performed by the user clicking on specific areas of the system interface, from being incorrectly added to the training sample set, but also prevents the product recommendation model from incorrectly attributing clicks from different locations on the system interface to the display position of recommended products, thereby mitigating the interference of click position bias on model training.

[0047] In one possible implementation, when the target strategy includes a second sample generation strategy, the above-mentioned generation of a training sample set for training the product recommendation model based on the target strategy includes the following steps: The samples in the second original sample are sorted in descending order based on the sample scores to obtain the sorting result. Obtain the first preset number of samples that rank highest in the sorting results to obtain the second candidate samples; Based on the preset scores, the first type of samples in the second candidate samples are divided into high-scoring difficult samples and medium-scoring samples. A training sample set is generated based on high-scoring, difficult samples, and / or a training sample set is generated based on medium-scoring samples.

[0048] The second original sample is the sample recalled by the system mentioned above, which includes the first type of sample and the second type of sample. The samples in the second original sample carry sample scores.

[0049] For cases where the target strategy is the second sample generation strategy, the samples in the second original sample are sorted in descending order (i.e., from largest to smallest) according to their sample scores, resulting in the sorting result. For example, if the second original sample includes 10 samples, the sorting result would be: Sample 1, Sample 3, Sample 2, Sample 4, Sample 5, Sample 6, Sample 7, Sample 9, Sample 8, Sample 10. After obtaining the sorting result, the first preset number of samples ranked first in the sorting result are selected as the second candidate samples. The first preset number is set according to actual needs and must be less than the total number of samples in the second original sample. For example, the first preset number is greater than half the total number of samples in the second original sample but less than the total number of samples in the second original sample. Assuming the sorting result is: Sample 1, Sample 3, Sample 2, Sample 4, Sample 5, Sample 6, Sample 7, Sample 9, Sample 8, Sample 10, and the first preset number is 6, the second candidate samples would include Sample 1, Sample 3, Sample 2, Sample 4, Sample 5, and Sample 6. The number of samples in the second candidate sample is less than the number of samples in the second original sample, but the second candidate sample includes both the first and second class samples.

[0050] After obtaining the second candidate samples, the first category of samples is selected from the second candidate samples. Then, the first category of samples is divided into high-scoring difficult samples and medium-scoring samples using a preset score. Specifically, samples in the first category with a score greater than or equal to the preset score are classified as high-scoring difficult samples, and samples in the first category with a score less than the preset score are classified as medium-scoring samples. That is, high-scoring difficult samples are products with high scores that have not been penalized, and medium-scoring samples are all samples in the first category other than the high-scoring difficult samples.

[0051] After obtaining the high-scoring difficult samples and the medium-scoring samples, a training sample set is generated based on the high-scoring difficult samples, and / or, a training sample set is generated based on the medium-scoring samples.

[0052] In one possible implementation, generating the training sample set from high-scoring, difficult samples includes the following steps: If a first target sample exists among the high-scoring, difficult samples, a training sample set is generated based on the first target sample.

[0053] The first method for generating the training sample set based on high-scoring, difficult samples is as follows: Determine if a first target sample exists within the high-scoring, difficult samples. The first target sample includes samples whose absolute difference between the sample score in the high-scoring, difficult samples and the sample score in the second category is less than a preset difference (e.g., 0.05). If a first target sample exists within the high-scoring, difficult samples, it is marked as a difficult negative sample. Then, a certain number of samples are selected from the first target sample, considered as negative samples, and added to the training sample set. This forces the retention of unclicked recommended products with high scores but small differences from the clicked recommended products, allowing the model to learn "why users choose product A and not product B," thereby improving the model's recommendation accuracy. The number of samples selected from the first target sample is less than or equal to the number of samples in the first target sample.

[0054] In one possible implementation, generating the training sample set from high-scoring, difficult samples includes the following steps: If a second target sample exists among the high-scoring, difficult samples, a training sample set is generated based on the second target sample. The ranking of the second target sample in the ranking result is higher than the ranking of each sample in the second type of samples in the ranking result.

[0055] The second method for generating the training sample set based on high-scoring, difficult samples is as follows: Obtain the ranking of each sample in the permutation result among the high-scoring, difficult samples. If a sample in the high-scoring, difficult samples has a higher ranking than any sample in the permutation result among the second type of samples, then that sample is designated as the second target sample. The second target sample is then marked as a difficult negative sample. A certain number of samples are selected from the second target sample, considered as negative samples, and added to the training sample set. The number of samples selected from the second target sample is less than or equal to the number of samples in the second target sample.

[0056] In one possible implementation, generating the training sample set based on the median sample includes the following steps: The middle sample is marked as a negative sample, and the samples in the middle sample are divided into a first sample group and a second sample group according to a preset ratio. The number of samples in the first sample group is less than the number of samples in the second sample group. Add the first sample group to the training sample set.

[0057] After obtaining the median sample, it is assumed that the median sample does not belong to the category of hard negative samples, so it is labeled as a normal negative sample. Then, the samples in the median sample are divided into a first sample group and a second sample group according to a preset ratio. The number of samples in the first sample group is less than the number of samples in the second sample group. The first sample group is added to the training sample set, thus enabling the training of the product recommendation model using a small number of median samples. For example, with a preset ratio of 4:6 and x < y, the number of samples in the first sample group = the number of median sample targets × 0.2, and the number of samples in the second sample group = the number of median sample targets × 0.3.

[0058] A training sample set is generated based on high-scoring difficult samples, and / or a training sample set is generated based on medium-scoring samples. That is, the training sample set may include the first target sample, the second target sample, the first sample group, the first target sample and the second target sample, or the first target sample, the second target sample and the first sample group.

[0059] This manual employs a second sample generation strategy to generate a training sample set for the product recommendation model. Instead of relying on random sampling, it uses the scores of finely ranked samples to generate hard-negative samples, forcing the recall model to face a "high-competition" scenario during the training phase. This achieves alignment between the goals of recall and fine ranking, improves the accuracy of the initial screening of training samples for the product recommendation model, and not only takes into account the real-time updating of training data but also ensures data quality.

[0060] The following is another embodiment of a model training sample generation method provided in this specification.

[0061] Figure 2 Another schematic flowchart of a model training sample generation method provided in the embodiments of this specification is shown, such as... Figure 2 As shown, the model training sample generation method provided in the embodiments of this specification includes the following schemes: S210: When the sample generation task is triggered, the first sample generation strategy is used to generate the first training sample set, and the second sample generation strategy is used to generate the second training sample set, and S220 or S230 is executed. S220: The product recommendation model is updated in real time using the first and second training sample sets; S230: Store the first training sample set and the second training sample set in the local space. After updating the sample data in the local space a set number of times, update the product recommendation model based on the sample data in the local space.

[0062] Based on the technical solution formed in S210 to S230 above, training sample sets for product recommendation model training are generated in parallel using two sample generation strategies. This improves the purity of the training samples used for product recommendation model training, enhancing not only the overall recommendation effect and fairness of the recommendation system but also improving the system's prediction accuracy for long-tail products, thus protecting those products. During model training, on the one hand, the product recommendation model is updated in real time using the first and second training sample sets, enabling the model to quickly capture the latest user interests and behavioral changes, achieving feedback responses at the minute or even second level, and improving the timeliness of model recommendations. On the other hand, by first storing the first and second training sample sets in local space and then updating the product recommendation model based on the sample data in local space, more complete and stable sample data is used to fully train the model, ensuring the overall generalization ability of the model.

[0063] The following are embodiments of the apparatus described in this specification, which can be used to execute the embodiments of the methods described in this specification. For details not disclosed in the apparatus embodiments of this specification, please refer to the embodiments of the methods described in this specification.

[0064] Figure 3 This specification shows a schematic diagram of the structure of a model training sample generation device provided in an embodiment, as shown below. Figure 3 As shown, the model training sample generation device 300 includes: The strategy determination module 310 is used to determine a target strategy from a first sample generation strategy and a second sample generation strategy when a sample generation task is triggered. The first sample generation strategy includes obtaining training samples from samples generated by the user's interaction with the system interface within a preset time window based on the user's interaction behavior with the system interface. The system interface is a homepage interface containing product recommendation content. The second sample generation strategy includes obtaining training samples from samples recalled by the system based on sample scores. The samples recalled by the system include samples generated after the recommended products previously displayed on the system interface were clicked, and samples generated when the recommended products previously displayed on the system interface were not clicked. The sample generation module 320 is used to generate a training sample set for training the product recommendation model based on the target strategy.

[0065] In one possible implementation, the sample generation module 320 includes: The behavior acquisition unit is used to acquire all user interaction behaviors with the system interface within a preset time window if the target strategy includes the first sample generation strategy and exposure logs about the system interface are received. The first determining unit is used to determine the training sample set from the first original sample based on all interactive behaviors. The first original sample includes samples generated by the user interacting with the system interface within a preset time window.

[0066] In one possible implementation, the first determining unit is configured to include: The judgment subunit is used to determine whether there is a first type of interaction behavior among all interaction behaviors. The first type of interaction behavior includes the user's interaction behavior with the system interface within the first preset time after receiving the exposure log. A subunit is defined to filter the samples generated based on the first type of interaction in the first original sample when the first type of interaction exists in all interaction behaviors, to obtain the first candidate sample; to determine the training sample set based on the first candidate sample; and to use the first original sample as the first candidate sample when the first type of interaction does not exist in all interaction behaviors, and to perform the step of determining the training sample set based on the first candidate sample.

[0067] In one possible implementation, the judgment subunit is specifically used to obtain the second type of interactive behavior and the third type of interactive behavior in the interactive behavior corresponding to the first candidate sample. The second type of interactive behavior includes the interactive behavior generated by the user in other areas of the system interface except for the recommended product area. The third type of interactive behavior includes the user's interactive behavior on the system interface within a second preset time period after receiving the exposure log. The second preset time period is longer than the first preset time period. The samples generated based on the second type of interactive behavior and the third type of interactive behavior in the first candidate sample are filtered to obtain the training sample set.

[0068] In one possible implementation, the sample generation module 320 includes: The sorting unit is used to sort the samples in the second original sample in descending order based on the sample score when the target strategy includes the second sample generation strategy, and to obtain the sorting result. The second original sample includes the samples recalled by the system. Select a unit to obtain the first preset number of samples that rank first in the sorting results, and obtain the second candidate samples; The partitioning unit is used to divide the first type of samples in the second candidate samples into high-scoring difficult samples and medium-scoring samples based on a preset score. The sample score of the high-scoring difficult samples is greater than or equal to the preset score, and the sample score of the medium-scoring samples is less than the preset score. The first type of samples includes samples generated from recommended products that were previously displayed on the system interface but were not clicked. The second determining unit is used to generate a training sample set based on high-scoring difficult samples, and / or, based on medium-scoring samples.

[0069] In one possible implementation, the second determining unit is specifically used to generate a training sample set based on the first target sample if a first target sample exists in the high-scoring and difficult samples. The first target sample includes samples in the high-scoring and difficult samples whose difference between the sample score and the sample score of the second type of samples is less than a preset difference. The second type of samples includes samples generated after recommended products previously displayed on the system interface are clicked.

[0070] In one possible implementation, the second determining unit is specifically used to generate a training sample set based on the second target sample if a second target sample exists in the high-scoring difficult sample set. The ranking of the second target sample in the ranking result is higher than the ranking of each sample in the second type of sample set in the ranking result. The second type of sample set includes samples generated after the recommended products previously displayed on the system interface are clicked.

[0071] In one possible implementation, the second determining unit is specifically used to mark the middle sample as a negative sample, and divide the samples in the middle sample into a first sample group and a second sample group according to a preset ratio, wherein the number of samples in the first sample group is less than the number of samples in the second sample group, and add the first sample group to the training sample set.

[0072] It should be noted that the model training sample generation device provided in the above embodiments is only illustrated by the division of the above functional modules when executing the model training sample generation method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the model training sample generation device and the model training sample generation method embodiments provided in the above embodiments belong to the same concept. Therefore, for details not disclosed in the device embodiments of this specification, please refer to the embodiments of the model training sample generation method described above, which will not be repeated here.

[0073] The example numbers in this specification are for descriptive purposes only and do not represent the superiority or inferiority of the examples.

[0074] Figure 4 This specification shows a schematic diagram of the structure of an electronic device provided in an embodiment, such as... Figure 4 As shown, the electronic device 400 includes a memory 401 and a processor 402. The memory 401 stores executable program code 4011, and the processor 402 is used to call and execute the executable program code 4011 to perform a model training sample generation method.

[0075] This embodiment can divide the electronic device into functional modules according to the above method example. For example, each module can correspond to a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.

[0076] When each functional module is divided according to its corresponding function, the electronic device may include: a strategy determination module, a sample generation module, etc. It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0077] The electronic device provided in this embodiment is used to execute the above-described model training sample generation method, and thus can achieve the same effect as the above-described implementation method.

[0078] When using integrated units, the electronic device may include a processing module and a storage module. The processing module is used to control and manage the operation of the electronic device. The storage module is used to support the execution of relevant program code and data by the electronic device.

[0079] The processing module may be a processor or a controller, which can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure herein. The processor may also be a combination of functions that implement computing capabilities, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc., and the storage module may be a memory.

[0080] This embodiment also provides a computer-readable storage medium storing computer program code. When the computer program code is run on a computer, the computer executes the above-described related method steps to implement a model training sample generation method in the above embodiment.

[0081] This embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned related steps to implement a model training sample generation method described in the above embodiment.

[0082] In addition, the electronic device provided in the embodiments of this specification may specifically be a chip, component or module. The electronic device may include a connected processor and a memory. The memory is used to store instructions. When the electronic device is running, the processor may call and execute the instructions to make the chip execute a model training sample generation method in the above embodiments.

[0083] In this embodiment, the electronic device, computer-readable storage medium, computer program product or chip are all used to execute the corresponding model training sample generation method provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding model training sample generation method provided above, and will not be repeated here.

[0084] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0085] In the embodiments provided in this specification, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0086] The above description is merely a specific embodiment of this specification, but the scope of protection of this specification is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this specification should be included within the scope of protection of this specification. Therefore, the scope of protection of this specification should be determined by the scope of the claims.

Claims

1. A method for generating training samples for a model, wherein, The method includes: When a sample generation task is triggered, a target strategy is determined from a first sample generation strategy and a second sample generation strategy. The first sample generation strategy includes obtaining training samples from samples generated by the user interacting with the system interface within a preset time window based on the user's interaction behavior with the system interface. The system interface is a homepage interface containing product recommendation content. The second sample generation strategy includes obtaining the training samples from samples recalled by the system based on sample scores. The samples recalled by the system include samples generated after previously displayed recommended products on the system interface were clicked, and samples generated when previously displayed recommended products on the system interface were not clicked. A training sample set for training the product recommendation model is generated based on the target strategy.

2. The method according to claim 1, wherein, When the target strategy includes the first sample generation strategy, generating a training sample set for training the product recommendation model based on the target strategy includes: Upon receiving exposure logs about the system interface, acquire all user interactions with the system interface within the preset time window; The training sample set is determined from the first original sample based on all the interaction behaviors. The first original sample includes samples generated by the user interacting with the system interface within the preset time window.

3. The method according to claim 2, wherein, The step of determining the training sample set from the first original sample based on all the interaction behaviors includes: Determine whether there is a first type of interactive behavior among all the interactive behaviors. The first type of interactive behavior includes the user's interactive behavior with the system interface within a first preset time after receiving the exposure log. If the first type of interactive behavior exists among all the interactive behaviors, the samples generated based on the first type of interactive behavior in the first original sample are filtered to obtain the first candidate sample. The training sample set is determined based on the first candidate sample; If the first type of interaction does not exist among all the interaction behaviors, the first original sample is used as the first candidate sample, and the step of determining the training sample set based on the first candidate sample is performed.

4. The method according to claim 3, wherein, Determining the training sample set based on the first candidate sample includes: The second type of interactive behavior and the third type of interactive behavior are obtained from the interactive behavior corresponding to the first candidate sample. The second type of interactive behavior includes the interactive behavior generated by the user in other areas of the system interface except for the recommended product area. The third type of interactive behavior includes the user's interactive behavior on the system interface within a second preset time after receiving the exposure log. The second preset time is longer than the first preset time. The training sample set is obtained by filtering the samples generated based on the second type of interaction behavior and the third type of interaction behavior in the first candidate sample.

5. The method according to claim 1, wherein, When the target strategy includes the second sample generation strategy, generating a training sample set for training the product recommendation model based on the target strategy includes: The samples in the second original sample are sorted in descending order based on the sample scores to obtain the sorting result. The second original sample includes the samples recalled by the system. Obtain the first preset number of samples that rank highest in the sorting results to obtain the second candidate samples; Based on a preset score, the first type of samples in the second candidate samples are divided into high-scoring difficult samples and medium-scoring samples. The sample score of the high-scoring difficult samples is greater than or equal to the preset score, and the sample score of the medium-scoring samples is less than the preset score. The first type of samples includes samples generated from recommended products that were previously displayed on the system interface but were not clicked. The training sample set is generated based on the high-scoring, difficult samples, and / or, based on the medium-scoring samples.

6. The method according to claim 5, wherein, The step of generating the training sample set based on the high-scoring, difficult samples includes: If a first target sample exists among the high-scoring and difficult samples, the training sample set is generated based on the first target sample. The first target sample includes samples in the high-scoring and difficult samples whose difference between the sample score and the sample score of the second type of samples is less than a preset difference. The second type of samples includes samples generated after the recommended products previously displayed on the system interface are clicked.

7. The method according to claim 5, wherein, The step of generating the training sample set based on the high-scoring, difficult samples includes: If a second target sample exists among the high-scoring, difficult samples, the training sample set is generated based on the second target sample. The ranking of the second target sample in the ranking result is higher than the ranking of each sample in the second type of samples in the ranking result. The second type of samples includes samples generated after the recommended products previously displayed on the system interface are clicked.

8. The method according to claim 5, wherein, The step of generating the training sample set based on the median sample includes: The median sample is marked as a negative sample, and the samples in the median sample are divided into a first sample group and a second sample group according to a preset ratio. The number of samples in the first sample group is less than the number of samples in the second sample group. Add the first sample group to the training sample set.

9. A model training sample generation device, wherein, The device includes: The strategy determination module is used to determine a target strategy from a first sample generation strategy and a second sample generation strategy when a sample generation task is triggered. The first sample generation strategy includes obtaining training samples from samples generated by the user interacting with the system interface within a preset time window based on the user's interaction behavior with the system interface. The system interface is a homepage interface containing product recommendation content. The second sample generation strategy includes obtaining the training samples from samples recalled by the system based on sample scores. The samples recalled by the system include samples generated after previously displayed recommended products on the system interface were clicked, and samples generated when previously displayed recommended products on the system interface were not clicked. The sample generation module is used to generate a training sample set for training the product recommendation model based on the target strategy.

10. A computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform the model training sample generation method as described in any one of claims 1 to 8.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the computer program, it implements the model training sample generation method as described in any one of claims 1 to 8.

12. A computer program product comprising instructions that, when run on a computer or processor, causes the computer or processor to perform the model training sample generation method as described in any one of claims 1 to 8.