A product information recall method, device, equipment and computer storage medium

Through pre-training and fine-tuning training of the double tower model, combined with forged query and real click log data, the problem of insufficient recall capability of medium and long-tail query in the e-commerce search system is solved, and the recall accuracy and accuracy of category attributes are improved.

CN114820134BActive Publication Date: 2025-01-17BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210519134.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-12
Publication Date
2025-01-17
Estimated Expiration
2042-05-12

AI Technical Summary

Technical Problem

The product recall model in the existing e-commerce search system has poor generalization ability for medium and long-tail search keywords, making it difficult to capture the connection between long-distance words, resulting in low recall accuracy.

Method used

The double tower model is used for training, and the query and real product information are forged in the pre-training stage, and various vocabulary composition methods are learned, and the model is optimized using user click log data during the fine-tuning training stage to improve the generalization and representation capabilities of the model.

Benefits of technology

It effectively improves the recall accuracy and relevance of the model for medium and long-tail queries, improves the accuracy of product category attributes, and improves the accuracy of overall search recall.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114820134B_ABST
    Figure CN114820134B_ABST
Patent Text Reader

Abstract

The embodiment of the present application proposes a product information recall method, device, electronic device and computer storage medium, the method comprising: obtaining a user's retrieval request for a current query; obtaining a recall result of the current query based on a trained dual-tower model; wherein the dual-tower model is trained through the following steps: obtaining a first training sample set and a second training sample set; each training sample in the first training sample set includes product information and a forged query; the forged query is obtained by forging a product title included in the product information; each training sample in the second training sample set is obtained from user click log data, and each training sample includes a real query and the corresponding clicked product information; pre-training the pre-constructed dual-tower model according to the first training sample set to obtain an initial dual-tower model; fine-tuning the initial dual-tower model according to the second training sample set to obtain a trained dual-tower model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a product information recall method, device, electronic device and computer storage medium. Background Art

[0002] The product recall module in the e-commerce search system mainly uses the reverse recall method to determine whether the product is recalled based on the literal match between the product and the search keyword. However, the reverse recall cannot recall products that do not literally match but are semantically related. For example, it is difficult to recall products such as "mobile phones for the elderly" if the phrase "mobile phone for grandpa" is used.

[0003] In the related technology, deep learning models are usually used to solve the above problems; its core principle is to calculate the similarity between the products and the user's search keywords (queries) by learning the vector representation (embedding). However, the existing models have poor generalization for medium and long-tail queries. The reason is that the existing models use n-gram to segment queries, and the query sentence vector is obtained by average pooling of word vectors, while n in n-gram is generally less than 3 in the Chinese e-commerce field; therefore, for queries with longer character lengths, the existing models are difficult to capture the connection between distant words, resulting in poor generalization of the model, and thus reducing the accuracy of the model's retrieval recall. Summary of the invention

[0004] The present application provides a product information recall method, device, electronic device and computer storage medium, which can improve the generalization ability of the model and ensure the accuracy of model retrieval and recall.

[0005] The technical solution of this application is implemented as follows:

[0006] The present application provides a product information recall method, the method comprising:

[0007] Obtaining a user's search request for the current query; obtaining a recall result of the current query according to the trained dual-tower model; the recall result includes product information of the top K products with the highest similarity to the current query; K is an integer greater than zero;

[0008] The twin tower model is trained by the following steps:

[0009] Obtain a first training sample set and a second training sample set; each training sample in the first training sample set includes product information and a forged query; the forged query is obtained by forging a product title included in the product information; each training sample in the second training sample set is obtained from user click log data, and each training sample includes a real query and corresponding clicked product information;

[0010] The pre-constructed (Deep Structured Semantic Models, DSSM) model is pre-trained according to the first training sample set to obtain an initial dual-tower model; the initial dual-tower model is fine-tuned according to the second training sample set to obtain a trained dual-tower model.

[0011] In some embodiments, the pre-built dual-tower model includes a query-side encoder and a product-side encoder; pre-training the pre-built dual-tower model according to the first training sample set includes:

[0012] Determine, according to the query-side encoder, a sentence vector of each forged query in the first training sample set; determine, according to the product-side encoder, a sentence vector of each product information in the first training sample set;

[0013] Determine a first similarity between the sentence vector of each forged query and the sentence vector of each product information; determine a first loss function according to the first similarity;

[0014] The pre-built dual-tower model is pre-trained using a target loss function; the target loss function includes the first loss function.

[0015] In some embodiments, each product information further includes at least one product attribute; and the pre-training of the pre-built dual-tower model using the target loss function includes:

[0016] Selecting a set number of target product attributes from the first training sample set; the target product attribute is any one of the at least one product attribute;

[0017] After randomly masking the set number of target product attributes in a preset manner, classifying and predicting the sentence vectors related to the set number of target product attributes according to the multi-layer perceptron in the pre-constructed double-tower model to obtain prediction results;

[0018] Determining a second loss function according to the prediction result and the actual results of the set number of target commodity attributes;

[0019] Accumulating the first loss function and the second loss function to obtain the target loss function;

[0020] The pre-built dual-tower model is pre-trained using the objective loss function.

[0021] In some embodiments, fine-tuning the initial dual-tower model according to the second training sample set to obtain a trained dual-tower model includes:

[0022] Determine the sentence vector of each real query in the second training sample set according to the query-side encoder in the initial dual-tower model; determine the sentence vector of each clicked product information in the second training sample set according to the product-side encoder in the initial dual-tower model;

[0023] Determine a second similarity between the sentence vector of each real query and the sentence vector of each clicked product information; determine a third loss function according to the second similarity;

[0024] The initial dual-tower model is fine-tuned using the third loss function to obtain a trained dual-tower model.

[0025] In some embodiments, the method of forging the product title included in the product information to obtain the forged query includes:

[0026] A character string whose length meets a first set length is randomly intercepted from the product title as the forged query; or two character strings whose length meets a second set length are randomly intercepted from the product title, and the two intercepted character strings are concatenated to obtain the forged query.

[0027] In some embodiments, the method further comprises:

[0028] After obtaining the trained dual-tower model, using the product-side encoder in the trained dual-tower model, offline predicting the corresponding sentence vector for the product information of each product in the pre-acquired popular product set;

[0029] An index is created for the sentence vector corresponding to the product information of each product in the set of popular products to obtain an index set; each index in the index set is used to determine a recall result of the current query.

[0030] In some embodiments, obtaining the recall result of the current query according to the trained dual-tower model includes:

[0031] After the query-side encoder in the trained dual-tower model and each index in the index set are loaded online, the sentence vector of the current query is predicted according to the query-side encoder in the trained dual-tower model;

[0032] According to the sentence vector of the current query, each index in the index set is searched to obtain a recall result of the current query.

[0033] The embodiment of the present application also proposes a commodity information recall device, which includes an acquisition module and a training module, wherein:

[0034] A module is provided for obtaining a user's search request for a current query; obtaining a recall result of the current query according to the trained dual-tower model; the recall result includes product information of the first K products with the highest similarity to the current query; K is an integer greater than zero;

[0035] A training module is used to obtain a first training sample set and a second training sample set; each training sample in the first training sample set includes product information and a forged query; the forged query is obtained by forging a product title included in the product information; each training sample in the second training sample set is obtained from user click log data, and each training sample includes a real query and corresponding clicked product information; the pre-constructed twin-tower model is pre-trained according to the first training sample set to obtain an initial twin-tower model; the initial twin-tower model is fine-tuned according to the second training sample set to obtain a trained twin-tower model.

[0036] An embodiment of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the product information recall method provided by one or more of the aforementioned technical solutions when executing the program.

[0037] An embodiment of the present application provides a computer storage medium, which stores a computer program; after the computer program is executed, it can implement the product information recall method provided by one or more of the above-mentioned technical solutions.

[0038] The embodiment of the present application proposes a product information recall method, device, electronic device and computer storage medium, the method comprising: obtaining a user's retrieval request for a current query; obtaining a recall result of the current query based on a trained dual-tower model; the recall result includes product information of the top K products with the highest similarity to the current query; K is an integer greater than zero; wherein the dual-tower model is trained by the following steps: obtaining a first training sample set and a second training sample set; each training sample in the first training sample set includes product information and a forged query; the forged query is obtained by forging the product title included in the product information; each training sample in the second training sample set is obtained from user click log data, and each training sample includes a real query and the corresponding clicked product information; pre-training the pre-constructed dual-tower model based on the first training sample set to obtain an initial dual-tower model; fine-tuning the initial dual-tower model based on the second training sample set to obtain a trained dual-tower model.

[0039] It can be seen that the model training process of the embodiment of the present application is divided into a pre-training stage and a fine-tuning training stage. In the pre-training stage, by forging the product title of each training sample in the first training sample set, a forged query is obtained, so that the model can fully learn more query possibilities, that is, learn various vocabulary composition methods, including queries with longer character lengths, so that the model can capture the connection between distant words; in this way, the problem that medium and long-tail queries are not easy to learn is solved, and the generalization ability of the model is effectively improved. In addition, the optimization goal of the model in the pre-training stage is consistent with the optimization goal of the fine-tuning training stage. By fine-tuning the model with real query and product information obtained from user click log data, the effect of model learning can be further improved, and the model representation ability and the overall accuracy of the model can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1A It is a flowchart of a product information recall method in an embodiment of the present application;

[0041] Figure 1B This is a schematic diagram of obtaining a forged query based on a product title in an embodiment of the present application;

[0042] Figure 1C is a schematic diagram of a network structure for pre-training in an embodiment of the present application;

[0043] Figure 1D is a schematic diagram of a network structure for fine-tuning training in an embodiment of the present application;

[0044] Figure 1E This is a schematic diagram of implementing offline export and online service in an embodiment of the present application;

[0045] Figure 2 A schematic diagram of a process for training a double-tower model according to an embodiment of the present application;

[0046] Figure 3 It is a schematic diagram of the composition structure of the product information recall device of the embodiment of the present application;

[0047] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The present application will be further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the embodiments provided herein are only used to explain the present application and are not intended to limit the present application. In addition, the embodiments provided below are partial embodiments for implementing the present application, rather than providing all embodiments for implementing the present application. In the absence of conflict, the technical solutions recorded in the embodiments of the present application can be implemented in any combination.

[0049] It should be noted that, in the embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or apparatus including a series of elements includes not only the elements explicitly recorded, but also includes other elements not explicitly listed, or also includes elements inherent to the implementation of the method or apparatus. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other related elements (such as steps in a method or units in a device, for example, a unit may be a portion of a circuit, a portion of a processor, a portion of a program or software, etc.) in the method or apparatus including the element.

[0050] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, I and / or J may indicate the existence of I alone, I and J at the same time, and J alone. In addition, the term "at least one" herein indicates any one of a plurality of or any combination of at least two of a plurality of. For example, at least one of I, J, and R may indicate any one or more elements selected from the set consisting of I, J, and R.

[0051] For example, the product information recall method provided in the embodiment of the present application includes a series of steps, but the product information recall method provided in the embodiment of the present application is not limited to the recorded steps. Similarly, the product information recall device provided in the embodiment of the present application includes a series of modules, but the product information recall device provided in the embodiment of the present application is not limited to including the modules explicitly recorded, and may also include modules required to obtain relevant task data or perform processing based on task data.

[0052] The embodiments of the present application can be applied to a computer system composed of terminal devices and / or servers, and can operate with many other general or special computing system environments or configurations. Here, the terminal device can be a thin client, a thick client, a handheld or laptop device, a microprocessor-based system, a set-top box, a programmable consumer electronic product, a network personal computer, a small computer system, etc., and the server can be a small computer system, a large computer system, and a distributed cloud computing technology environment including any of the above systems, etc.

[0053] Electronic devices such as terminal devices and servers can implement corresponding functions through the execution of program modules. Generally, program modules can include routines, programs, target programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in a distributed cloud computing environment, in which tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.

[0054] In the related art, in the field of e-commerce search, the mainstream vector recall model uses n-gram to segment search keywords and products. The model framework is based on DSSM, also known as the twin-tower semantic model for training; the model itself uses simple mean-pooling because search keywords are usually short and n-gram segmentation is sufficient to capture the relationship between short-distance words. The word list obtained by n-gram segmentation is in the millions. Using a large amount of click data, these word vectors can be fully learned to obtain high-quality sentence vectors. At present, the Transformer model is widely used in the field of natural language processing. The advantage of this model is that it can capture the main body of the text through the self-attention mechanism. At the same time, due to the huge number of parameters, the model itself can learn more text knowledge on the word vector, but the word segmentation method of the Transformer model is usually unigram, that is, a single character, with a word list of about 2w. In the model experiment of the Chinese search recall scenario, the training effect of unigram segmentation plus Transformer model is not as good as that of n-gram segmentation plus mean-pooling, so how to get a better model is a major exploration direction.

[0055] For e-commerce search scenarios, the existing vector recall models have the following main shortcomings:

[0056] 1) Poor generalization ability: The existing vector recall model has poor generalization ability for medium and long-tail queries. The reason is that the existing model uses n-gram to segment the query, and the query sentence vector is obtained by average pooling of word vectors. The n in n-gram is generally less than 3 in the Chinese e-commerce field. Therefore, for queries with longer character lengths, the model cannot capture the connection between distant words.

[0057] 2) Insufficient recall relevance: The structure of the existing vector recall model is relatively simple, and the number of parameters is insufficient to learn enough knowledge. The main learning target of the existing model is the word vectors of millions, but it does not focus on the interaction between word vectors, and cannot learn deep semantic relationships. The products recalled by the model are more likely to stay at the semantic similarity of word granularity, while ignoring the semantic recall of the query body; for example, when searching for a long-tail query "jeans embroidery pattern red", embroidery-related products may be recalled, which leads to insufficient relevance of the recalled products.

[0058] 3) Inaccurate product category attributes: The product category attribute has a positive effect on model training, but this attribute has certain errors, part of which comes from the deviation in merchant filling and the other part from the deviation in category system construction, which will affect the accuracy of the recall model.

[0059] In view of the above technical problems, the following embodiments are proposed.

[0060] In some embodiments of the present application, the product information recall method can be implemented using a processor in a product information recall device, and the above-mentioned processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, and a microprocessor.

[0061] Figure 1A is a flowchart of a product information recall method in an embodiment of the present application, such as Figure 1A As shown, the method comprises the following steps:

[0062] Step 100: Obtain the user's search request for the current query;

[0063] Step 101: Obtain the recall result of the current query according to the trained dual-tower model; the recall result includes the product information of the first K products with the highest similarity to the current query; K is an integer greater than zero.

[0064] In the embodiment of the present application, the twin-tower model is trained by the following steps: obtaining a first training sample set and a second training sample set; each training sample in the first training sample set includes product information and a forged query; the forged query is obtained by forging the product title included in the product information; each training sample in the second training sample set includes product information and a real query. Pre-train the pre-built twin-tower model according to the first training sample set to obtain an initial twin-tower model; fine-tune the initial twin-tower model according to the second training sample set to obtain a trained twin-tower model.

[0065] Exemplarily, the product information included in each training sample in the first training sample set and the second training sample set may be the same; wherein the product information may include a product title and at least one product attribute; here, the product attribute may be a numerical product attribute or an identity identification (IDentity, ID) product attribute, for example, a category, a store, a brand, etc.; in the subsequent pre-training process, the embodiment of the present application takes the category attribute as an example for illustration.

[0066] Exemplarily, each training sample in the first training sample set includes, in addition to product information, a query forged according to the product title.

[0067] In some embodiments, the method of forging a product title to obtain a forged query may include the following two methods: one is to randomly intercept a character string whose character length meets a first set length from the product title as a forged query; the other is to randomly intercept two character strings whose character length meets a second set length from the product title, and concatenate the two intercepted character strings to obtain a forged query.

[0068] For example, when the two intercepted character strings are concatenated in the second manner, the order of the two character strings is not limited.

[0069] Exemplarily, the value range of the first set length and the second set length can be set according to actual conditions, and the embodiments of the present application do not limit this; for example, the value range of the first set length can be a character string of 5 to 15 lengths, and the value range of the second set length can be a character string of 3 to 8 lengths.

[0070] Figure 1B FIG. 1 is a schematic diagram of obtaining a forged query according to a product title in an embodiment of the present application, such as Figure 1B As shown in the figure, a string "public superbook Huawei multi-screen collaboration" is randomly intercepted from the product title "Honor laptop MagicBook x15 thin and light notebook handheld business office superbook Huawei multi-screen collaboration silver i5-40210U8GB 512GB official standard configuration". At this time, the string is the forged query obtained according to the first method above; in addition, two strings are randomly intercepted from the above product title, namely "notebook computer" and "GB512GB official". By splicing these two strings, the forged query obtained according to the second method above can be obtained.

[0071] Here, there is no limit on the probability of obtaining a forged query by intercepting one or two segments of characters; it can be understood that in order to ensure the training effect of the model, the probability of intercepting one or two segments of characters can be 50% respectively; in this way, according to any of the above methods, the intercepted character string in the product title has a 50% probability of being retained and a 50% probability of being deleted.

[0072] In an embodiment of the present application, for each training sample in the second training sample set, in addition to the product information, it also includes a real query; wherein the real query is the user's real search keyword in the e-commerce search system, and the product information included in each training sample represents the product information corresponding to the real query.

[0073] In the embodiment of the present application, there is no limitation on the method of obtaining the first training sample set and the second training sample set; illustratively, the product information in the first training sample set may come from all products or some popular products displayed on the e-commerce platform. The training samples in the second training sample set may come from user click log data, specifically log data of user clicks on products, and one training sample is one click behavior; it can be understood that in order to ensure the model training effect, the training sample may be a "real query-clicked product information" pair that the user clicks more than a set number of times within a set time period; here, the reason for setting more than the set number of times is that the click log data that does not exceed the set number of times is likely to be caused by the user's mistaken click or the merchant's cheating, and the data is likely to be noise, which will have an adverse effect on the model training effect. Exemplarily, there is no limitation on the value of the above-mentioned set time period, and it can also be the past 60 days, 30 days, etc.

[0074] Exemplarily, after obtaining the first training sample set according to the above steps, the pre-constructed dual-tower model is pre-trained according to each sample in the first training sample set; here, before pre-training, the first training sample set can be divided into one or more batches of data (Batch), and Batch represents the number of samples used for a single training of the model; that is, the pre-constructed dual-tower model is pre-trained according to each Batch; in the embodiment of the present application, the first training sample set is taken as an example of a Batch for illustration.

[0075] In some embodiments, a pre-built dual-tower model includes a query-side encoder and a product-side encoder; pre-training the pre-built dual-tower model according to a first training sample set may include: determining a sentence vector for each forged query in the first training sample set according to the query-side encoder; determining a sentence vector for each product information in the first training sample set according to the product-side encoder; determining a first similarity between the sentence vector of each forged query and the sentence vector of each product information; determining a first loss function according to the first similarity; and pre-training the pre-built dual-tower model using a target loss function; the target loss function includes a first loss function.

[0076] In an embodiment of the present application, the twin-tower model can be a twin-tower model based on a Deep Structured Semantic Models (DSSM); here, there is no limitation on the network structures of the query-side encoder and the product-side encoder, for example, it can be a transformer encoder, a convolutional neural network (CNN), and other network structures; wherein, the network structures of the query-side encoder and the product-side encoder can be the same or different.

[0077] For example, when at least one of the query-side encoder and the product-side encoder is a transformer encoder, the number of layers of the transformer encoder is 4, the dimension of the vector is 768, and the number of multi-head attention is 12. In this case, there is no need to load pre-trained parameters to the transformer, and the model parameters can be randomly initialized using a truncated normal distribution.

[0078] Exemplarily, the implementation method for determining the sentence vector of each forged query in the first training sample set according to the query-side encoder can be: first, each forged query in the first training sample set is converted into a sequence vector (sequence embedding), and then the sequence vector is input into the query-side encoder to encode it, so as to obtain the sentence vector of each forged query.

[0079] Exemplarily, the implementation method for determining the sentence vector of each product information in the first training sample set according to the product-side encoder can be: first, the product title in each product information in the first training sample set is segmented and then converted into a sequence vector; then, each product attribute in each product information is converted into a vector, and a sequence vector of each product information is formed by splicing the vector converted from each product attribute to the sequence vector converted from the product title, and then the sequence vector of each product information is input into the product-side encoder for encoding to obtain the sentence vector of each product information.

[0080] Here, taking one of the product information as an example, the method for determining the sequence vector of the product information is explained; illustratively, the BERT (Bidirectional Encoder Representations from Transformers) Chinese word segmentation method provided by the open source deep learning framework (tensorflow) can be used to segment the Chinese contained in the product title in the product information, where Chinese is unigram words, English and numbers are byte pair encoding (Byte Pair Encoder, BPE) to obtain common strings, and the dictionary size is 21128, and finally the string corresponding to each product title is converted into a sequence vector; then, a vector table (embedding table) is established separately for each product attribute in the product information, and these product attributes are converted into vectors through the vector table and spliced ​​in front of the sequence vector converted from the product title, and finally a whole sequence vector is formed, that is, the sequence vector of the product information is obtained.

[0081] Exemplarily, after obtaining the sentence vector of each forged query and the sentence vector of each product information in the first training sample set according to the above processing method, the first similarity between the sentence vector of each forged query and the sentence vector of each product information is calculated; here, the first similarity can be cosine similarity, or Euclidean distance similarity, etc., which is not limited to this embodiment of the present application.

[0082] Furthermore, after obtaining the first similarity, the softmax function is used to convert the first similarity into a posterior probability P(D + |Q), and then use the cross entropy loss function to determine the first loss function L1, as shown in formula (1):

[0083]

[0084] Here, D represents the product, D + represents a positive example, Q represents a forged query, P(D + |Q) represents the probability of a positive example under each forged query. The goal of this loss function is to maximize the probability of positive example prediction. Among them, the positive example represents the forged query and corresponding product title of each training sample in a batch, and the negative example represents the forged query of each training sample and other product titles in the batch.

[0085] In one embodiment, the pre-training process of the pre-constructed dual-tower model may include the task of determining the first loss function L1, that is, the pre-constructed dual-tower model may be pre-trained according to the first loss function L1 determined by formula (1) and optimized until the model loss and top1 accuracy converge.

[0086] In some embodiments, the above method may also include: selecting a set number of target product attributes from the first training sample set; after randomly masking the set number of target product attributes in a preset manner, classifying and predicting sentence vectors related to the set number of target product attributes according to the multi-layer perceptron in the pre-constructed double-tower model to obtain prediction results; determining a second loss function based on the prediction results and the actual results of the set number of target product attributes.

[0087] Here, the target product attribute may be any one of the at least one product attribute included in the product information; for example, it may be any one of a category, a store, and a brand.

[0088] Exemplarily, the value of the set number is determined based on the probability of randomly masking a certain product attribute. The following embodiment is explained using category as an example; for example, the first training sample set includes 100 training samples. If the product attribute of category is randomly masked with a probability of 15%, it is necessary to randomly mask the attribute of category in 15 training samples; in this case, the value of the set number is 15.

[0089] Furthermore, after obtaining the set number of categories, the specific implementation of masking these categories according to the set method can be: 80% probability of replacing <mask>Category, 10% probability to replace with other categories, 10% probability to keep the original category. Figure 1C , after randomly masking these categories, the corresponding product information is input into the Transformer encoder on the product side, which outputs the sentence vectors related to these categories; after the sentence vectors related to these categories are passed through the multi-layer perceptron, these sentence vectors are classified and predicted to obtain the prediction results; wherein the prediction results represent the predicted categories of the masked categories, and then the cross entropy loss function is used to determine the second loss function L2, as shown in formula (2):

[0090]

[0091] here, The table shows the output probability of the softmax function, and Y is the onehot correct category; the goal of this loss function is to maximize the probability of the correct category.

[0092] In another embodiment, the pre-training process of the pre-built dual-tower model may also include two tasks of determining the first loss function L1 and the second loss function L2; that is, the model is pre-trained using the first loss function L1 and the second loss function L2 at the same time; exemplarily, the first loss function L1 and the second loss function L2 may be accumulated to obtain the target loss function; then, the pre-built dual-tower model is pre-trained using the target loss function, and optimized together until the model loss and top1 accuracy converge.

[0093] It can be seen that in the embodiment of the present application, by adding a new prediction task of commodity category during the model pre-training process, the model representation ability of the commodity side encoder in the twin tower model is effectively improved. At the same time, the robustness of the model to the incorrect use of the commodity category attribute is also improved, and the accuracy of the model is improved.

[0094] In the embodiment of the present application, after pre-training of the pre-constructed twin-tower model is completed, an initial twin-tower model is obtained; then, the initial twin-tower model is fine-tuned using the second training sample set to obtain a trained twin-tower model.

[0095] In some embodiments, fine-tuning the initial twin-tower model according to the second training sample set to obtain a trained twin-tower model may include: determining the sentence vector of each real query in the second training sample set according to the query-side encoder in the initial twin-tower model; determining the sentence vector of each clicked product information in the second training sample set according to the product-side encoder in the initial twin-tower model; determining the second similarity between the sentence vector of each clicked real query and the sentence vector of each product information; determining a third loss function based on the second similarity; and using the third loss function to fine-tune the initial twin-tower model to obtain a trained twin-tower model.

[0096] Exemplarily, when the second training sample set is regarded as a Batch, the positive examples in the fine-tuning training process represent the true query of each training sample in the Batch and the corresponding clicked product title, and the negative examples represent the true query of each training sample and other product titles in the Batch.

[0097] For example, in combination Figure 1C and Figure 1D It can be seen that the implementation method of determining the third loss function to fine-tune the initial dual-tower model is similar to the implementation method of determining the first loss function L1 to pre-train the model, except that each fake query in the first training sample set is replaced by each real query in the second training sample set; that is, the user's real search keywords; each product information is replaced by the clicked product information corresponding to each real query; it will not be repeated here.

[0098] It can be understood that in the embodiment of the present application, dssm loss can be selected to be used during the training process of the dual-tower model, or hinge loss can be selected according to actual conditions to achieve a similar effect.

[0099] It can be seen that the goal of the pre-trained model in the embodiment of the present application is consistent with the goal of the subsequent fine-tuning training model, which is conducive to improving the accuracy of the model. In addition, the embodiment of the present application is based on model-level optimization, does not involve changes to the entire model system architecture, and the Transformer encoder used in the model has a high degree of parallelism, and the online service can directly replace the model without significantly increasing the cost of optimization at the system architecture level.

[0100] In the embodiment of the present application, after the trained dual-tower model is obtained according to the above steps, it is necessary to prepare the index of the product and the query side encoder offline, referring to Figure 1E Before preparing the index of the products offline, first obtain the hot product set. Here, there is no limit on the number of products in the hot product set, which can be determined according to the actual situation. It can be understood that for the sake of retrieval efficiency, the vector retrieval service can retrieve 10 million hot products, that is, the number of products in the hot product set can be 10 million.

[0101] In some embodiments, after obtaining a set of popular products, the product-side encoder in the trained dual-tower model is used to offline predict the corresponding sentence vector for the product information of each product in the set of popular products; the sentence vector corresponding to the product information of each product in the set of popular products is indexed to obtain an index set; at the same time, the query-side encoder in the trained dual-tower model is exported; here, the open source tool faiss can be used to index the sentence vector corresponding to each product.

[0102] In some embodiments, obtaining a recall result of the current query based on a trained dual-tower model may include: after loading the query-side encoder in the trained dual-tower model and each index in the index set online, predicting the sentence vector of the current query based on the query-side encoder in the trained dual-tower model; and retrieving each index in the index set based on the sentence vector of the current query to obtain the recall result of the current query.

[0103] For example, the query-side encoder in the trained dual-tower model and each index in the index set can be loaded online using a retrieval service (tensorflow serving); Figure 1E As shown in the online service, when the retrieval system receives a retrieval request for the current query from the user, it first predicts the sentence vector of the current query online through the query-side encoder, and then uses the sentence vector to retrieve the product information of the top K products with the highest similarity ranking in the index set to obtain the recall result of the current query; thus, a retrieval recall is completed.

[0104] The embodiment of the present application proposes a product information recall method, device, electronic device and computer storage medium, the method comprising: obtaining a user's retrieval request for a current query; obtaining a recall result of the current query based on a trained dual-tower model; the recall result includes product information of the top K products with the highest similarity to the current query; K is an integer greater than zero; wherein the dual-tower model is trained by the following steps: obtaining a first training sample set and a second training sample set; each training sample in the first training sample set includes product information and a forged query; the forged query is obtained by forging the product title included in the product information; each training sample in the second training sample set is obtained from user click log data, and each training sample includes a real query and the corresponding clicked product information; pre-training the pre-constructed dual-tower model based on the first training sample set to obtain an initial dual-tower model; fine-tuning the initial dual-tower model based on the second training sample set to obtain a trained dual-tower model.

[0105] It can be seen that the model training process of the embodiment of the present application is divided into a pre-training stage and a fine-tuning training stage. In the pre-training stage, by forging the product title of each training sample in the first training sample set, a forged query is obtained, so that the model can fully learn more query possibilities, that is, learn various vocabulary composition methods, including queries with longer character lengths, so that the model can capture the connection between distant words; in this way, the problem that medium and long-tail queries are not easy to learn is solved, and the generalization ability of the model is effectively improved. In addition, the optimization goal of the model in the pre-training stage is consistent with the optimization goal of the fine-tuning training stage. By fine-tuning the model with real query and product information obtained from user click log data, the effect of model learning can be further improved, and the model representation ability and the overall accuracy of the model can be effectively improved.

[0106] In order to better reflect the purpose of the present application, further explanation is given based on the above embodiments of the present application.

[0107] The embodiment of the present application first applies the Transformer encoder structure to the twin tower model, encodes the word vector into a sentence vector, and trains the model by calculating the similarity between the sentence vectors of the query and the product information. The training method is to first perform pre-training and then fine-tune training. The network structure of the model is as follows Figure 1C and Figure 1D shown.

[0108] Exemplarily, two pre-training tasks are designed in the pre-training stage. Task 1 is to train the twin-tower model by using forged query and real product information as training data (corresponding to the first training sample mentioned above). The training method is positive and negative example method, where the positive example is each forged query and the corresponding real product title in a batch, and the negative example is each forged query and other product titles in the batch. Figure 1C As shown in the figure, first randomly mask the product attribute of the category, and then use the sentence vector output by the product side encoder to predict the masked category after passing through the multi-layer perceptron. The first loss of pre-training task one and the second loss of task two are added together to optimize the dual-tower model. Fine-tune the training after the pre-training is close to convergence. Use real query and real product information as training data (corresponding to the second training sample mentioned above). The training method is the same as pre-training task one, and the model is trained using positive and negative examples. After the fine-tuning training converges, the query side encoder in the dual-tower model is exported and loaded into the online search system for real-time query sentence vector prediction. The product side encoder selects 10 million popular products to predict the product sentence vector offline, and uses the open source tool Faiss to build an inverted index of the product vector. After the index is loaded online, the sentence vector of the query predicted online is used to retrieve and obtain the recalled product set.

[0109] Figure 2 A schematic diagram of a process for training a dual-tower model according to an embodiment of the present application is shown in FIG. Figure 2 As shown, the method comprises the following steps:

[0110] Step S1, building a twin tower model.

[0111] For example, Figure 1C and Figure 1D The network structure shown is used to build a double-tower model; Figure 3 The network structure of the fine-tuning training shown is a subset of the pre-trained network structure, without any additional network modules.

[0112] Step S2, pre-training the dual-tower model.

[0113] Exemplarily, two pre-training tasks are designed in the pre-training stage. Pre-training task 1 is to train the twin-tower model by using forged query and real product information as training data (corresponding to the first training sample mentioned above). The training method is positive and negative example method, where the positive example is each forged query and the corresponding real product title in a batch, and the negative example is each forged query and other product titles in the batch. Figure 1C As shown in the figure, first randomly mask the product attribute of category, and then use the sentence vector output by the product side encoder to predict the masked category after passing through the multi-layer perceptron. The first loss of pre-training task one and the second loss of task two are added together and the dual-tower model is trained together until convergence.

[0114] Step S3, fine-tune the dual-tower model.

[0115] Exemplarily, fine-tuning training is performed after the model pre-training converges; real query and real product information are used as training data (corresponding to the second training sample mentioned above), and the training method is the same as the above pre-training task one. The model is trained using positive and negative examples, which will not be repeated here.

[0116] Step S4: export the model and create an index offline.

[0117] Exemplarily, after the fine-tuning training of the model converges, the query-side encoder in the dual-tower model is exported; at the same time, the product-side encoder in the dual-tower model is used to offline estimate the sentence vector corresponding to each product in the popular product set, and the sentence vectors of these products are indexed using the open source tool faiss to obtain an index set.

[0118] Step S5, online service.

[0119] Exemplarily, the query-side encoder and index set are loaded online for online service; the query-side encoder in the dual-tower model is loaded into the online search system to perform real-time query sentence vector prediction, and then the online predicted query sentence vector is used to retrieve the product information of the top K products with the highest similarity in the index set, thereby obtaining the search results.

[0120] It can be seen that in the embodiment of the present application, firstly, in the pre-training stage, the supervised pre-training of the dual-tower model is carried out by forging queries in combination with real product information; the feasible principle is that the query and product information in the e-commerce corpus are both piled up with attribute words, and the forged query and the real query are distributed similarly and can simulate more diverse long-tail queries. Secondly, the goal of pre-training is consistent with the goal of subsequent fine-tuning training, which is conducive to improving the accuracy of the model; in this way, the generalization ability and expression ability of the query side encoder of the dual-tower model are improved as a whole through the above-mentioned training method. Furthermore, the embodiment of the present application also defines a product attribute masking prediction task in the pre-training stage, which improves the robustness of the product side encoder and the expression ability of the sentence vector.

[0121] Figure 3 : is a schematic diagram of the composition structure of the product information recall device of the embodiment of the present application. Figure 3 As shown, the device includes: an obtaining module 300 and a training module 301, wherein:

[0122] Obtaining module 300, for obtaining a user's search request for a current query; obtaining a recall result of the current query according to the trained dual-tower model; the recall result includes product information of the first K products with the highest similarity to the current query; K is an integer greater than zero;

[0123] The training module 301 is used to obtain a first training sample set and a second training sample set; each training sample in the first training sample set includes product information and a forged query; the forged query is obtained by forging the product title included in the product information; each training sample in the second training sample set is obtained from user click log data, and each training sample includes a real query and the corresponding clicked product information; the pre-constructed twin-tower model is pre-trained according to the first training sample set to obtain an initial twin-tower model; the initial twin-tower model is fine-tuned according to the second training sample set to obtain a trained twin-tower model.

[0124] In some embodiments, the pre-built dual-tower model includes a query-side encoder and a product-side encoder; the training module 301 is used to pre-train the pre-built dual-tower model according to the first training sample set, including:

[0125] Determine, according to the query-side encoder, a sentence vector of each forged query in the first training sample set; determine, according to the product-side encoder, a sentence vector of each product information in the first training sample set;

[0126] Determine a first similarity between the sentence vector of each forged query and the sentence vector of each product information; determine a first loss function according to the first similarity;

[0127] The pre-built dual-tower model is pre-trained using a target loss function; the target loss function includes the first loss function.

[0128] In some embodiments, each product information further includes at least one product attribute; the training module 301 is further used to:

[0129] Selecting a set number of target product attributes from the first training sample set; the target product attribute is any one of the at least one product attribute;

[0130] After randomly masking the set number of target product attributes in a preset manner, classifying and predicting the sentence vectors related to the set number of target product attributes according to the multi-layer perceptron in the pre-constructed double-tower model to obtain prediction results;

[0131] Determining a second loss function according to the prediction result and the actual results of the set number of target commodity attributes;

[0132] Accumulating the first loss function and the second loss function to obtain the target loss function;

[0133] The pre-built dual-tower model is pre-trained using the objective loss function.

[0134] In some embodiments, the training module 301 is used to fine-tune the initial dual-tower model according to the second training sample set to obtain a trained dual-tower model, including:

[0135] Determine the sentence vector of each real query in the second training sample set according to the query-side encoder in the initial dual-tower model; determine the sentence vector of each clicked product information in the second training sample set according to the product-side encoder in the initial dual-tower model;

[0136] Determine a second similarity between the sentence vector of each real query and the sentence vector of each clicked product information; determine a third loss function according to the second similarity;

[0137] The initial dual-tower model is fine-tuned using the third loss function to obtain a trained dual-tower model.

[0138] In some embodiments, the training module 301 is used to forge the product title included in the product information to obtain a forged query, including:

[0139] A character string whose length meets a first set length is randomly intercepted from the product title as the forged query; or two character strings whose length meets a second set length are randomly intercepted from the product title, and the two intercepted character strings are concatenated to obtain the forged query.

[0140] In some embodiments, the obtaining module 300 is further used to:

[0141] After obtaining the trained dual-tower model, using the product-side encoder in the trained dual-tower model, offline predicting the corresponding sentence vector for the product information of each product in the pre-acquired popular product set;

[0142] An index is created for the sentence vector corresponding to the product information of each product in the set of popular products to obtain an index set; each index in the index set is used to determine a recall result of the current query.

[0143] In some embodiments, the obtaining module 300 is used to obtain the recall result of the current query according to the trained dual-tower model, including:

[0144] After the query-side encoder in the trained dual-tower model and each index in the index set are loaded online, the sentence vector of the current query is predicted according to the query-side encoder in the trained dual-tower model;

[0145] According to the sentence vector of the current query, each index in the index set is searched to obtain a recall result of the current query.

[0146] In practical applications, the obtaining module 300 and the training module 301 can be implemented by a processor located in an electronic device, and the processor can be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.

[0147] In addition, each functional module in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or software functional modules.

[0148] If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or the part that contributes to the relevant technology or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method of this embodiment. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.

[0149] Specifically, the computer program instructions corresponding to a product information recall method in this embodiment can be stored on a storage medium such as a CD, a hard disk, or a USB flash drive. When the computer program instructions corresponding to a product information recall method in the storage medium are read or executed by an electronic device, any product information recall method in the aforementioned embodiments is implemented.

[0150] Based on the same technical concept as the above embodiments, see Figure 4 , which shows an electronic device 400 provided in an embodiment of the present application, which may include: a memory 401 and a processor 402; wherein,

[0151] Memory 401, used for storing computer programs and data;

[0152] The processor 402 is used to execute the computer program stored in the memory to implement any of the commodity information recall methods in the foregoing embodiments.

[0153] In practical applications, the memory 401 may be a volatile memory, such as RAM; or a non-volatile memory, such as ROM, flash memory, hard disk drive (HDD) or solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 402.

[0154] The processor 402 may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor. It is understandable that for different audit management platforms, the electronic device used to implement the processor function may also be other, which is not specifically limited in the embodiments of the present application.

[0155] In some embodiments, the functions or modules included in the device provided in the embodiments of the present application can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.

[0156] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0157] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0158] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0159] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0160] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0161] The present application is described with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box in the flowchart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0162] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0163] The above are only preferred embodiments of the present application and are not intended to limit the protection scope of the present application.< / mask>

Claims

1. A product information recall method, characterized in that: The method comprises: Obtaining a user's search request for the current query; obtaining a recall result of the current query according to the trained dual-tower model; the recall result includes product information of the top K products with the highest similarity to the current query; K is an integer greater than zero; The twin tower model is trained by the following steps: Obtain a first training sample set and a second training sample set; each training sample in the first training sample set includes product information and a forged query; the forged query is obtained by forging a product title included in the product information; each training sample in the second training sample set is obtained from user click log data, and each training sample in the second training sample set includes a real query and corresponding clicked product information; The pre-constructed twin-tower model is pre-trained according to the first training sample set to obtain an initial twin-tower model; and the initial twin-tower model is fine-tuned according to the second training sample set to obtain a trained twin-tower model.

2. The method according to claim 1, characterized in that The pre-built dual-tower model includes a query-side encoder and a product-side encoder; pre-training the pre-built dual-tower model according to the first training sample set includes: Determine, according to the query-side encoder, a sentence vector of each forged query in the first training sample set; determine, according to the product-side encoder, a sentence vector of each product information in the first training sample set; Determine a first similarity between the sentence vector of each forged query and the sentence vector of each product information; determine a first loss function according to the first similarity; The pre-built dual-tower model is pre-trained using a target loss function; the target loss function includes the first loss function.

3. The method according to claim 2, characterized in that Each commodity information further includes at least one commodity attribute; and the pre-training of the pre-built dual-tower model using the target loss function includes: Selecting a set number of target product attributes from the first training sample set; the target product attribute is any one of the at least one product attribute; After randomly masking the set number of target product attributes in a preset manner, classifying and predicting the sentence vectors related to the set number of target product attributes according to the multi-layer perceptron in the pre-constructed double-tower model to obtain prediction results; Determining a second loss function according to the prediction result and the actual results of the set number of target commodity attributes; Accumulating the first loss function and the second loss function to obtain the target loss function; The pre-built dual-tower model is pre-trained using the objective loss function.

4. The method according to claim 2 or 3, characterized in that: The step of fine-tuning the initial dual-tower model according to the second training sample set to obtain a trained dual-tower model includes: Determine the sentence vector of each real query in the second training sample set according to the query-side encoder in the initial dual-tower model; determine the sentence vector of each clicked product information in the second training sample set according to the product-side encoder in the initial dual-tower model; Determine a second similarity between the sentence vector of each real query and the sentence vector of each clicked product information; determine a third loss function according to the second similarity; The initial dual-tower model is fine-tuned using the third loss function to obtain a trained dual-tower model.

5. The method according to claim 1, characterized in that The method of forging the product title included in the product information to obtain a forged query includes: A character string whose length meets a first set length is randomly intercepted from the product title as the forged query; or two character strings whose length meets a second set length are randomly intercepted from the product title, and the two intercepted character strings are concatenated to obtain the forged query.

6. The method according to claim 1, characterized in that The method further comprises: After obtaining the trained dual-tower model, using the product-side encoder in the trained dual-tower model, offline predicting the corresponding sentence vector for the product information of each product in the pre-acquired popular product set; An index is created for the sentence vector corresponding to the product information of each product in the set of popular products to obtain an index set; each index in the index set is used to determine a recall result of the current query.

7. The method according to claim 6, characterized in that The step of obtaining the recall result of the current query according to the trained dual-tower model includes: After the query-side encoder in the trained dual-tower model and each index in the index set are loaded online, the sentence vector of the current query is predicted according to the query-side encoder in the trained dual-tower model; According to the sentence vector of the current query, each index in the index set is searched to obtain a recall result of the current query.

8. A product information recall device, characterized in that: The device comprises: A module is provided for obtaining a user's search request for a current query; obtaining a recall result of the current query according to the trained dual-tower model; the recall result includes product information of the first K products with the highest similarity to the current query; K is an integer greater than zero; A training module is used to obtain a first training sample set and a second training sample set; each training sample in the first training sample set includes product information and a forged query; the forged query is obtained by forging a product title included in the product information; each training sample in the second training sample set is obtained from user click log data, and each training sample in the second training sample set includes a real query and corresponding clicked product information; a pre-constructed twin-tower model is pre-trained according to the first training sample set to obtain an initial twin-tower model; the initial twin-tower model is fine-tuned according to the second training sample set to obtain a trained twin-tower model.

9. An electronic device, characterized in that: The device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the method according to any one of claims 1 to 7 is implemented when the processor executes the program.

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

Citation Information

Patent Citations

  • Information category misplacement identifying method and device

    CN106204053A

  • Search recall method and device

    CN111400577A