CN113887234B - Model training and recommending method and device - Google Patents

Model training and recommending method and device Download PDF

Info

Publication number
CN113887234B
CN113887234B CN202111082797.0A CN202111082797A CN113887234B CN 113887234 B CN113887234 B CN 113887234B CN 202111082797 A CN202111082797 A CN 202111082797A CN 113887234 B CN113887234 B CN 113887234B
Authority
CN
China
Prior art keywords
search
training sample
content
document
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111082797.0A
Other languages
Chinese (zh)
Other versions
CN113887234A (en
Inventor
虞金花
张文强
李炫毅
华镇
侯培旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202111082797.0A priority Critical patent/CN113887234B/en
Publication of CN113887234A publication Critical patent/CN113887234A/en
Application granted granted Critical
Publication of CN113887234B publication Critical patent/CN113887234B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/247Thesauruses; Synonyms

Abstract

The specification discloses a model training and recommending method and device, which can determine each first training sample pair and labels thereof according to acquired search content and search documents, generate each second training sample pair and labels thereof according to the first training sample pair through a text repeat model capable of outputting texts with similar semantics to input content, and train a semantic correlation model to be trained based on the second training sample pair and labels thereof. According to the scheme, the second training sample pair determined by the text repeat model is a training sample determined on the basis of word co-occurrence, so that when recommendation is performed according to the trained semantic correlation model, the output vector can contain the semantics of the content corresponding to the output vector, and the recommendation efficiency is improved.

Description

Model training and recommending method and device
Technical Field
The specification relates to the technical field of computers, in particular to a model training and recommending method and device.
Background
Currently, with the development of computer technology, content-based search results have become one of people's information sources. And how to recommend to the user based on the search content of the user has become one of the problems that the service provider needs to solve. The recommendation method can determine the search result based on the search content of the user, and display the search result to the user, so that the recommendation method is widely applied to a scene that a service provider recommends content for the user.
In the prior art, a common recommendation method is based on a model determination of a double tower structure. Specifically, the search content and the search document of the user may be obtained, and the search content and the search document may be respectively input into two subnetworks of the two-tower model to obtain a search content vector and a search document vector, respectively. And then carrying out similarity matching on the content vector and each searched document vector, and judging whether the similarity is higher than a preset similarity threshold value. Finally, each search document may be recommended to the user based on the similarity between the search content vector and each search document vector.
However, in the prior art, when the model of the double-tower structure is trained, the labels of the training sample pairs are determined based on whether the search content and the keywords of the search documents co-occur, so that when the model is recommended according to the trained model, only the search content co-occurring with the keywords included in the search content can be recommended to the user, the relation between the search content and the actual semantics of each search document cannot be embodied, and the recommendation effect is poor.
Disclosure of Invention
The present specification provides a model training and recommendation method and apparatus, which partially solve the above problems in the prior art.
The technical scheme adopted by the specification is as follows:
the present specification provides a training method of a semantic correlation model, comprising:
determining each first training sample pair and the label of each first training sample pair according to the obtained search contents and the search documents;
aiming at each first training sample pair, respectively taking the search content and the search document of the first training sample pair as input, and inputting the input into a text repeating model to obtain the repeating content and the repeating document output by the text repeating model, wherein the text repeating model is used for generating a text with a semantic similar to that of the input content;
combining elements in a first set containing the search content and the repeat content with elements in a second set containing the search document and the repeat document to determine second training sample pairs, and taking the label of the first training sample pair as the label of each second training sample pair;
and training the semantic correlation model according to the second training sample pair and the determined labels, wherein the semantic correlation model is used for determining the similarity between the search content and each search document.
Optionally, the text repetition model is trained by:
determining each third training sample according to the acquired text data;
determining keywords contained in each third training sample, performing synonym replacement on the keywords, and taking a replacement result as a label of the third training sample;
inputting the third training sample as an input into a text repeating model to be trained to obtain a repeating result of the third training sample output by the text repeating model;
and determining loss according to the repeat result and the label of each third training sample, and adjusting the model parameters of the text repeat model.
Optionally, a plurality of keywords are included in the third training sample;
determining keywords contained in the third training sample, performing synonym replacement on the keywords, and using a replacement result as a label of the third training sample, which specifically includes:
aiming at a third training sample, determining each keyword contained in the third training sample;
carrying out synonym replacement on other keywords except the identification words in the keywords according to preset identification words, determining a replacement result, and taking the replacement result as the label of the third training sample;
the identifying terms at least include: name of the article.
Optionally, determining the loss according to the repeated result and the label of each third training sample, specifically including:
determining fourth training samples and labels thereof according to the acquired text data, wherein the number of the fourth training samples is greater than that of the third training samples;
inputting each fourth training sample as an input into the text repeating model, and determining a repeating result of each fourth training sample output by the text repeating model;
and determining the loss according to the repeat result and the label of each third training sample and the repeat result and the label of each fourth training sample.
Optionally, determining each first training sample pair and the label of each first training sample pair according to the obtained multiple search contents and multiple search documents specifically includes:
acquiring a plurality of search contents and a plurality of search documents;
for each search content, determining historical search data containing the search content;
determining a search document having an association relation with the search content according to the historical search data, combining the search content and the document, determining a positive sample, and determining that the label of the positive sample indicates that the search content and the search document have the association relation;
randomly determining a plurality of search documents from the search documents, respectively combining the search documents with the search content, determining a negative sample, and determining that the label of the negative sample indicates that the search content and the search documents have no association relation.
The present specification provides a recommendation method including:
acquiring search contents and search documents;
respectively inputting the search content and each search document into a pre-trained semantic correlation model to obtain a search content vector corresponding to the search content output by the semantic correlation model and a search document vector corresponding to each search document;
determining the similarity between the search content vector and each search document vector, and recommending each search document to the user based on each similarity;
the semantic correlation model is obtained by respectively combining and determining sample pairs according to each search content and each search document, each retelling content and each retelling document determined by the text retelling model according to each search content and each search document, and training based on the sample pairs and labels thereof.
This specification provides a training device of a semantic correlation model, including:
the first determining module is used for determining each first training sample pair and the label of each first training sample pair according to the obtained plurality of search contents and the obtained plurality of search documents;
a second determining module, configured to, for each first training sample pair, respectively take search content and search documents of the first training sample pair as inputs, input the inputs into a text repeating model, and obtain repeating content and repeating documents output by the text repeating model, where the text repeating model is used to generate a text with semantics similar to those of the input content;
a third determining module, configured to combine elements in the first set including the search content and the repeat content with elements in the second set including the search document and the repeat document to determine second training sample pairs, and use labels of the first training sample pairs as labels of the second training sample pairs;
and the training module is used for training the semantic correlation model according to the second training sample pair and the determined labels, and the semantic correlation model is used for determining the similarity between the search content and each search document.
The present specification provides a semantic correlation module comprising:
the acquisition module is used for acquiring search contents and each search document;
the semantic determining module is used for inputting the search content and each search document into a pre-trained semantic correlation model respectively to obtain a search content vector corresponding to the search content output by the semantic correlation model and a search document vector corresponding to each search document respectively;
the recommendation module is used for determining the similarity between the search content vector and each search document vector and recommending each search document to the user based on each similarity; the semantic correlation model is obtained by respectively combining and determining sample pairs according to each search content and each search document, each retelling content and each retelling document determined by the text retelling model according to each search content and each search document, and training based on the sample pairs and labels thereof.
The present specification provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the above-described training method of a semantic correlation model or semantic correlation method.
The present specification provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the training method or the semantic correlation method of the semantic correlation model when executing the program.
The technical scheme adopted by the specification can achieve the following beneficial effects:
in the training method of the semantic correlation model provided in this specification, search content and search documents may be acquired, each first training sample pair and its label may be determined, a second training sample pair may be generated according to the first training sample pair by using a text repeat model that may output a text similar to an input semantic, and the label of the first training sample pair may be used as the label of the second training sample pair to train the semantic correlation model to be trained.
According to the method, the second training sample pair determined by the text repetition model is similar to the first training sample pair in semantics but is not a word co-occurrence sample, so that when the recommendation is performed according to the trained semantic correlation model, the output vector can contain the semantics of the corresponding content, and the recommendation efficiency is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification and are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description serve to explain the specification and not to limit the specification in a non-limiting sense. In the drawings:
FIG. 1 is a schematic flow chart of a training method of a semantic correlation model provided in the present specification;
FIG. 2 is a block diagram of a textual reiteration model provided in the present specification;
FIG. 3 is a schematic structural diagram of a semantic correlation model provided in the present specification;
FIG. 4 is a flow chart diagram of a semantic correlation method provided herein;
FIG. 5 is a training apparatus for semantic correlation models provided herein;
FIG. 6 is a semantic correlation apparatus provided herein;
fig. 7 is a schematic diagram of an electronic device corresponding to fig. 1 or fig. 4 provided in this specification.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without making any creative effort belong to the protection scope of the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a method for training a semantic correlation model provided in this specification, which specifically includes the following steps:
s100: and acquiring a plurality of search contents and a plurality of search documents, and determining each first training sample pair and the label of each first training sample pair.
Generally, in the content recommendation field, a search content vector corresponding to search content and a search document vector corresponding to a search document can be determined through a semantic correlation model of a double-tower structure, so that the similarity between the determined search content vector and the search document vector is determined based on the determined search content vector and the determined search document vector, and each search document is recommended to a user according to the similarity.
Generally, the semantic correlation model of the double-tower structure is obtained by a server for training the model and training in advance based on training samples. The present specification provides a training method of a semantic correlation model, and as such, the process of training the semantic correlation model may be performed by a server for training the model.
The training model can be divided into a sample generation stage and a training model stage, and in the sample generation stage, samples for training the model can be determined according to model requirements and training requirements. In this specification, the server may first determine training samples for training the semantic correlation model, and since the semantic correlation model is typically trained based on a sample pair consisting of search content and search documents, the server may first determine the training samples for each search content and each search document.
Based on this, the server can acquire a number of search contents and a number of search documents. The search content is content input by the user during search operation, and the search document is content that can be recommended to the user based on the search content, such as merchants, commodities, user comments, and the like. The specific search content and the type and content of the search document may be set as desired, and this specification does not limit this.
Then, the server may combine each acquired search content and each acquired search document, respectively, to determine each first training sample pair and label. Wherein the annotation may be manually annotated.
Further, the cost of manual labeling is too high, and the required time is too long, so that in order to avoid the situation that the efficiency of training the model is low due to the fact that the labeling time is too long, the server can also obtain historical search data corresponding to each search content, namely, search operations performed by each user in history. And then aiming at each search content, determining historical operation data corresponding to the search content according to the search content, combining the search documents clicked by the users in the historical operation data with the search content to determine a positive sample, and combining the search documents not clicked by the users in the historical operation data with the search content to determine a negative sample. The positive sample is marked as that the relation exists between the search content and the search document, and the negative sample is marked as that the relation does not exist between the search content and the search document.
Of course, the server may determine not only whether the search document is clicked when determining the positive and negative examples, but also whether the product is purchased when each document is a product introduction of each product. When each document is the comment of other users, the similarity between the document and the user image of the user can be determined according to the user image and the like, and the label of each sample pair is determined.
S102: and aiming at each first training sample pair, respectively taking the search content and the search document of the first training sample pair as input, and inputting the input into a text repeating model to obtain repeating content and repeating document output by the text repeating model, wherein the text repeating model is used for generating a text with similar semantics with the input content.
Different from the prior art that the actual semantic relationship between the search content and the search document cannot be embodied by determining the training samples based on whether the keywords of the search content and the search document co-occur or not, the present specification provides a training method of a semantic correlation model, so that the training samples can be enriched based on the text repeat model and each first training sample pair determined in step S100, so as to improve the training efficiency. Based on this, the server may determine second training samples based on the textual restoral model.
Specifically, the server may store a text repeating model trained in advance. Wherein the text repetition model is operable to output text that is semantically related to its input. Therefore, the server can respectively input the search content and the search document of the first training sample pair into the text repeating model to obtain the repeating content which is output by the text repeating model and has similar semanteme with the search content and the repeating document which is output by the text repeating model and has similar semanteme with the search content.
The text repetition model can be obtained by training in the following way:
first, a server for training the text repeating model may first obtain a plurality of text data as each third training sample. The text data may include search content and search documents, among other things.
Secondly, for each third training sample, determining a keyword contained in the third training sample, performing synonym replacement on the keyword, determining a replacement result, and using the replacement result as a label of the third training sample. The synonym replacement includes keyword replacement, sentence pattern template replacement, etc., and if the keyword for "eating on weekend" is "weekend", the replacement result obtained by synonym replacement may be "eating on vacation", and the synonym sentence pattern for "XX is there" may be "XX address".
Then, the server may input the third training sample into the text repeating model to be trained, and obtain a repeating result of the third training sample output by the text repeating model.
And finally, the server can determine loss according to the repeat result and the label of each third training sample, and adjust the model parameters of the text repeat model. As shown in fig. 2.
Fig. 2 is a structural diagram of a text repeating model provided in this specification, and includes an encoder, an intermediate vector, and a decoder, where the server can input a training sample pair including search content and a search document as input texts, respectively, input the input texts into the text repeating model, convert the input texts into intermediate vectors through the encoder, convert the intermediate vectors into output texts through the decoder, and output the output texts as repeating results of the training samples. The server may train the text repeat model based on the gap between the input and the output. Wherein the vector intermediate the encoder and the decoder is an intermediate vector.
In addition, when synonyms are replaced for keywords such as an article name and a merchant name, the semantics of a text containing the keywords are changed, and if "sweet and sour spareribs" in "want to eat sweet and sour spareribs and boiled fish" are replaced with "braised spareribs", the corresponding semantics are changed. Therefore, the server may be preset with identification words, and when parameters of the text repeat model are adjusted, third training samples including the identification words are determined from the third training samples, and each keyword included in each third training sample including the identification word is determined for each third training sample including the identification word. The server may perform synonym replacement on other keywords except the identification word in each keyword, determine a replacement result, and use the replacement result as a label of the third training sample. Wherein the identifying words at least comprise item names.
Further, since the third training sample requires synonym replacement for the keyword, the cost and acquisition time are increased compared to the text itself. The text repeat model is trained only by the text itself, and the text repeat model obtained by training may only learn the feature representation of the same keyword, but ignores the semantics corresponding to the text. Therefore, in order to take training effect and cost into consideration, when the text repeat model is trained, the server can also obtain a plurality of text data as a fourth training sample and takes the fourth training sample as a label. The server may input each fourth training sample into the text repeat model, and determine a repeat result of each fourth training sample output by the text repeat model. Then, the server can determine the loss and adjust the model parameters of the text repeating model based on the repeating result and the label of each third training sample and the repeating result and the label of each fourth training sample. Wherein the number of the fourth training samples is greater than the number of the third training samples.
The server for training the text repeat model and the server for training the semantic correlation model may be the same server or different servers, and may be specifically set as required, which is not limited in this specification.
S104: and combining elements in a first set containing the search content and the repeat content with elements in a second set containing the search document and the repeat document to determine each second training sample pair, and taking the label of the first training sample pair as the label of each second training sample pair.
In one or more embodiments provided in this specification, since the text repeat model in step S102 may output content with a semantic similar to that of the input content, that is, the input and output semantics are similar, the search content and the repeat content of the first training sample pair are similar in semantics, and the search document and the repeat document are similar in semantics, so the server may construct the second training sample pair based on the search content and the repeat content with similar semantics and the search document and the repeat document, so as to ensure the diversification of the training samples and improve the generalization of the model obtained by training.
Specifically, the server may determine, for each first training sample pair, search content and search documents included in the first training sample, and repeat content and repeat documents of the first training sample, and make the search content and the repeat content form a first set, and make the search document and the repeat documents form a second set.
The server may then combine the elements in the first set with the elements in the second set to determine second training sample pairs.
Finally, because the search content and the repeat content have similar semantics and the search document and the repeat document have similar semantics, the relationship between the repeat content and the repeat document is the same as the relationship between the search content and the search document. The server may treat the label of the first training sample pair as the label of the second training sample pair.
S106: and training the semantic correlation model according to the second training sample pair and the determined labels, wherein the semantic correlation model is used for determining search contents and semantic representation of each search document.
In one or more embodiments provided in this specification, since each second training sample pair determined in step S104 is determined by combining an element in the first set and an element in the second set corresponding to the first training sample pair, each second training sample includes a sample pair composed of search content and a search document that constitute each first training sample pair. Thus, after determining the second training sample pair, the server may train the semantic correlation model based on the second training sample pair and the determined labels.
Specifically, the server may input, for each second training sample pair, the second training sample pair as an input into the semantic correlation model to be trained, determine a vector corresponding to an element of the first set in the second training sample pair and a vector of an element of the second set, respectively, further determine a similarity of the second training sample pair, and train the semantic correlation model according to a label of each second training sample pair. Wherein, the structure of the semantic correlation model is a double-tower structure. As shown in fig. 3.
Fig. 3 is a schematic diagram of a training process of a semantic correlation model provided in this specification, the server may first obtain a second training sample, and input content and documents in the second training sample as input into the semantic correlation model 1 and the semantic correlation model 2 to be trained, respectively obtain a content vector output by the semantic correlation model 1 and a document vector output by the semantic correlation model 2, and determine a similarity between the content vector and the document vector, so as to minimize a difference between a label of the second training sample and the similarity, determine a loss, and train the semantic correlation model. The two-way arrow between the semantic relation model 1 and the semantic relation model 2 represents parameter sharing of the semantic relation model 1 and the semantic relation model 2, content comprises at least one of search content and repeat content, document comprises at least one of search document and repeat document, correspondingly, content vector comprises at least one of search content vector and repeat content vector, and document vector comprises at least one of search document vector and repeat document vector.
In addition, the training of the semantic correlation model 1 and the semantic correlation model 2 can be regarded as training of two modules in one model.
The training method based on the semantic correlation model shown in fig. 1 can determine each first training sample pair and the label thereof according to the acquired search content and search document, and generate each second training sample pair and the label thereof according to the first training sample pair through a text repeat model capable of outputting a text with a semantic close to that of the input content, so as to train the semantic correlation model to be trained based on the second training sample pair and the label thereof. According to the scheme, the second training sample pair determined by the text repeat model is not the training sample determined based on word co-occurrence, so that the vector output by the trained semantic correlation model can ensure the semantics of the corresponding content, and the recommendation efficiency based on the semantic correlation model is improved.
Based on the training method of the semantic correlation model shown in fig. 1, the present specification further provides a semantic correlation method, as shown in fig. 4.
Fig. 4 is a schematic flow chart of a semantic correlation method provided in this specification, including:
s200: search content and each search document are acquired.
In one or more embodiments provided in the present specification, the semantic correlation method is applied to a search scenario in which documents are recommended to a user according to search content of the user, and thus, the server may first acquire the search content and each search document.
S202: and inputting the search content and each search document as input into a pre-trained semantic correlation model to obtain a search content vector corresponding to the search content output by the semantic correlation model and a search document vector corresponding to each search document.
In one or more embodiments provided herein, after determining the search content and each search document, the server may determine the search content vector and each search document vector based on a pre-trained semantic relevance model based on the search content and each search document to perform subsequent steps based on the vector.
S204: determining the similarity between the search content vector and each search document vector, and recommending each document to the user based on each similarity; the semantic correlation model is obtained by respectively combining and determining sample pairs according to each search content and each search document, each retelling content and each retelling document determined by the text retelling model according to each search content and each search document, and training based on the sample pairs and labels thereof.
In one or more embodiments provided herein, after determining the vectors, the server may recommend and search for documents to the user based on determining similarities between the search content vector and the search document vectors and based on the determined similarities. Wherein, the semantic correlation model is obtained by training according to the steps S100 to S106.
Based on the same idea, the present specification further provides a training apparatus and a semantic correlation apparatus for a semantic correlation model, as shown in fig. 5 or 6.
Fig. 5 is a training apparatus for a semantic correlation model provided in this specification, including:
the first determining module 300 is configured to determine each first training sample pair and a label of each first training sample pair according to the obtained multiple search contents and multiple search documents.
A second determining module 302, configured to, for each first training sample pair, respectively take the search content and the search document of the first training sample pair as inputs, and input the inputs into a text repeating model to obtain a repeating content and a repeating document output by the text repeating model, where the text repeating model is used to generate a text with a semantic close to that of the input content.
A third determining module 304, configured to combine elements in the first set including the search content and the repeat content with elements in the second set including the search document and the repeat document to determine second training sample pairs, and use labels of the first training sample pairs as labels of the second training sample pairs.
The training module 306 is configured to train the semantic correlation model according to the second training sample pair and the determined label, where the semantic correlation model is used to determine similarity between search content and each search document.
Optionally, the second determining module 302 is further configured to determine each third training sample according to the obtained multiple text data, determine, for each third training sample, a keyword included in the third training sample, perform synonym replacement on the keyword, use a replacement result as a label of the third training sample, use the third training sample as an input, input the third training sample into the text repeating model to be trained, obtain a repeating result of the third training sample output by the text repeating model, determine a loss according to the repeating result and the label of each third training sample, and adjust a model parameter of the text repeating model.
Optionally, the third determining module 304 is further configured to determine, for a third training sample, each keyword included in the third training sample, perform synonym replacement on other keywords except for the identification word in each keyword according to a preset identification word, determine a replacement result, and use the replacement result as a label of the third training sample, where the identification word at least includes: the name of the item.
Optionally, the third determining module 304 is further configured to determine, according to the obtained text data, fourth training samples and labels thereof, where the number of the fourth training samples is greater than the number of the third training samples, input the fourth training samples as input into the text repeating model, determine a repeating result of each fourth training sample output by the text repeating model, and determine the loss according to the repeating result and label of each third training sample and the repeating result and label of each fourth training sample.
Optionally, the first determining module 300 is configured to obtain a plurality of search contents and a plurality of search documents;
the method comprises the steps of determining historical search data containing search content for each search content, determining search documents with association relation with the search content according to the historical search data, combining the search content and the documents, determining a positive sample, determining that the label of the positive sample indicates that the search content and the search documents have association relation, randomly determining a plurality of search documents from the search documents, combining the search documents with the search content respectively, determining a negative sample, and determining that the label of the negative sample indicates that the search content and the search documents do not have association relation.
Fig. 6 is a semantic correlation apparatus provided in this specification, including:
an obtaining module 400, configured to obtain search content and each search document.
A semantic determining module 402, configured to input the search content and each search document as input into a pre-trained semantic correlation model, so as to obtain a search content vector corresponding to the search content output by the semantic correlation model, and a search document vector corresponding to each search document.
A recommending module 404, configured to determine similarity between the search content vector and each search document vector, and recommend each search document to the user based on each similarity; the semantic correlation model is obtained by respectively combining and determining sample pairs according to each search content and each search document, each retelling content and each retelling document determined by the text retelling model according to each search content and each search document, and training based on the sample pairs and labels thereof.
The present specification also provides a computer-readable storage medium storing a computer program, which can be used to execute the training method of the semantic correlation model provided in fig. 1 and the semantic correlation method described in fig. 4.
This specification also provides a schematic block diagram of the electronic device shown in fig. 7. As shown in fig. 7, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, but may also include hardware required for other services. The processor reads a corresponding computer program from the non-volatile memory into the memory and then runs the computer program to implement the training method of the semantic correlation model described in fig. 1 and the semantic correlation method described in fig. 4. Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
In the 90's of the 20 th century, improvements to a technology could clearly distinguish between improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements to process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain a corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD) (e.g., a Field Programmable Gate Array (FPGA)) is an integrated circuit whose Logic functions are determined by a user programming the Device. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as ABEL (Advanced Boolean Expression Language), AHDL (alternate Hardware Description Language), traffic, CUPL (core universal Programming Language), HDCal, jhddl (Java Hardware Description Language), lava, lola, HDL, PALASM, rhyd (Hardware Description Language), and vhigh-Language (Hardware Description Language), which is currently used in most popular applications. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the various elements may be implemented in the same one or more pieces of software and/or hardware in the practice of this description.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus comprising the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the system embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.

Claims (10)

1. A training method of a semantic correlation model is characterized by comprising the following steps:
determining each first training sample pair and the label of each first training sample pair according to the obtained search contents and the search documents;
aiming at each first training sample pair, respectively taking the search content and the search document of the first training sample pair as input, and inputting the input into a text repeating model to obtain the repeating content and the repeating document output by the text repeating model, wherein the text repeating model is used for generating a text with a semantic similar to that of the input content;
combining elements in a first set containing the search content and the repeat content with elements in a second set containing the search document and the repeat document to determine second training sample pairs, and taking the label of the first training sample pair as the label of each second training sample pair;
and training the semantic correlation model according to the second training sample pair and the determined labels, wherein the semantic correlation model is used for determining the similarity between the search content and each search document.
2. The method of claim 1, wherein the textual restoral model is trained by:
determining each third training sample according to the acquired text data;
determining keywords contained in each third training sample, performing synonym replacement on the keywords, and taking a replacement result as a label of the third training sample;
inputting the third training sample as input into a text repeating model to be trained to obtain a repeating result of the third training sample output by the text repeating model;
and determining loss according to the repeat result and the label of each third training sample, and adjusting the model parameters of the text repeat model.
3. The method according to claim 2, wherein there are a plurality of keywords included in the third training sample;
determining keywords contained in the third training sample, performing synonym replacement on the keywords, and using a replacement result as a label of the third training sample, which specifically includes:
determining each keyword contained in a third training sample aiming at the third training sample;
carrying out synonym replacement on other keywords except the identification words in all the keywords according to preset identification words, determining a replacement result, and taking the replacement result as the label of the third training sample;
the identifying terms include at least: name of the article.
4. The method of claim 2, wherein determining the loss based on the restatement results and the label for each of the third training samples comprises:
determining fourth training samples and labels thereof according to the acquired text data, wherein the number of the fourth training samples is greater than that of the third training samples;
inputting each fourth training sample as input into the text repeating model, and determining a repeating result of each fourth training sample output by the text repeating model;
and determining the loss according to the repeat result and the label of each third training sample and the repeat result and the label of each fourth training sample.
5. The method according to claim 1, wherein determining each first training sample pair and the label of each first training sample pair according to the obtained search contents and the search documents specifically comprises:
acquiring a plurality of search contents and a plurality of search documents;
for each search content, determining historical search data containing the search content;
determining a search document having an association relation with the search content according to the historical search data, combining the search content and the document to determine a positive sample, and determining that the label of the positive sample indicates that the search content and the search document have the association relation;
randomly determining a plurality of search documents from the search documents, respectively combining the search documents with the search content, determining a negative sample, and determining that the label of the negative sample indicates that the search content and the search documents do not have an association relation.
6. A recommendation method, comprising:
acquiring search contents and search documents;
respectively inputting the search content and each search document into a pre-trained semantic correlation model to obtain a search content vector corresponding to the search content output by the semantic correlation model and a search document vector corresponding to each search document;
determining the similarity between the search content vector and each search document vector, and recommending each search document to the user based on each similarity;
the semantic correlation model is obtained by respectively combining and determining sample pairs according to each search content and each search document, each retelling content and each retelling document determined by the text retelling model according to each search content and each search document, and training based on the sample pairs and labels thereof.
7. An apparatus for training a semantic correlation model, the apparatus comprising:
the first determining module is used for determining each first training sample pair and the label of each first training sample pair according to the obtained plurality of search contents and the obtained plurality of search documents;
a second determining module, configured to, for each first training sample pair, input search content and a search document of the first training sample pair into a text repeating model respectively as inputs to obtain repeating content and a repeating document output by the text repeating model, where the text repeating model is used to generate a text with a semantic close to that of the input content;
a third determining module, configured to combine elements in the first set including the search content and the repeat content with elements in the second set including the search document and the repeat document to determine second training sample pairs, and use labels of the first training sample pairs as labels of the second training sample pairs;
and the training module is used for training the semantic correlation model according to the second training sample pair and the determined labels, and the semantic correlation model is used for determining the similarity between the search content and each search document.
8. A semantic correlation module, the module comprising:
the acquisition module is used for acquiring search contents and each search document;
the semantic determining module is used for inputting the search content and each search document into a pre-trained semantic correlation model respectively to obtain a search content vector corresponding to the search content output by the semantic correlation model and a search document vector corresponding to each search document respectively;
the recommending module is used for determining the similarity between the search content vector and each search document vector and recommending each search document to the user based on each similarity; the semantic correlation model is obtained by respectively combining and determining sample pairs according to each search content and each search document, each retelling content and each retelling document determined by the text retelling model according to each search content and each search document, and training based on the sample pairs and labels thereof.
9. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1 to 5 or 6.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 5 or 6 when executing the program.
CN202111082797.0A 2021-09-15 2021-09-15 Model training and recommending method and device Active CN113887234B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111082797.0A CN113887234B (en) 2021-09-15 2021-09-15 Model training and recommending method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111082797.0A CN113887234B (en) 2021-09-15 2021-09-15 Model training and recommending method and device

Publications (2)

Publication Number Publication Date
CN113887234A CN113887234A (en) 2022-01-04
CN113887234B true CN113887234B (en) 2023-01-06

Family

ID=79009571

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111082797.0A Active CN113887234B (en) 2021-09-15 2021-09-15 Model training and recommending method and device

Country Status (1)

Country Link
CN (1) CN113887234B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114676227B (en) * 2022-04-06 2023-07-18 北京百度网讯科技有限公司 Sample generation method, model training method and retrieval method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016066114A (en) * 2014-09-22 2016-04-28 株式会社東芝 Feature point detection device, method, and program
CN110895553A (en) * 2018-08-23 2020-03-20 国信优易数据有限公司 Semantic matching model training method, semantic matching method and answer obtaining method
CN111177373A (en) * 2019-12-12 2020-05-19 北京明略软件系统有限公司 Method and device for obtaining training data and method and device for training model
CN111401071A (en) * 2019-01-02 2020-07-10 百度在线网络技术(北京)有限公司 Model training method and device, computer equipment and readable storage medium
CN112560912A (en) * 2020-12-03 2021-03-26 北京百度网讯科技有限公司 Method and device for training classification model, electronic equipment and storage medium
CN113344078A (en) * 2021-06-09 2021-09-03 北京三快在线科技有限公司 Model training method and device
CN113343095A (en) * 2021-06-22 2021-09-03 北京三快在线科技有限公司 Model training and information recommendation method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112861474B (en) * 2021-04-23 2021-07-02 腾讯科技(深圳)有限公司 Information labeling method, device, equipment and computer readable storage medium
CN113205183A (en) * 2021-04-23 2021-08-03 北京达佳互联信息技术有限公司 Article recommendation network training method and device, electronic equipment and storage medium
CN113362139B (en) * 2021-06-17 2023-04-28 震坤行工业超市(上海)有限公司 Data processing method and device based on double-tower structure model

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016066114A (en) * 2014-09-22 2016-04-28 株式会社東芝 Feature point detection device, method, and program
CN110895553A (en) * 2018-08-23 2020-03-20 国信优易数据有限公司 Semantic matching model training method, semantic matching method and answer obtaining method
CN111401071A (en) * 2019-01-02 2020-07-10 百度在线网络技术(北京)有限公司 Model training method and device, computer equipment and readable storage medium
CN111177373A (en) * 2019-12-12 2020-05-19 北京明略软件系统有限公司 Method and device for obtaining training data and method and device for training model
CN112560912A (en) * 2020-12-03 2021-03-26 北京百度网讯科技有限公司 Method and device for training classification model, electronic equipment and storage medium
CN113344078A (en) * 2021-06-09 2021-09-03 北京三快在线科技有限公司 Model training method and device
CN113343095A (en) * 2021-06-22 2021-09-03 北京三快在线科技有限公司 Model training and information recommendation method and device

Also Published As

Publication number Publication date
CN113887234A (en) 2022-01-04

Similar Documents

Publication Publication Date Title
WO2018049960A1 (en) Method and apparatus for matching resource for text information
CN109344406B (en) Part-of-speech tagging method and device and electronic equipment
CN109388801B (en) Method and device for determining similar word set and electronic equipment
CN110457449B (en) Method, device, equipment and storage medium for training model online
CN113221555B (en) Keyword recognition method, device and equipment based on multitasking model
CN111144126A (en) Training method of semantic analysis model, semantic analysis method and device
CN114817538B (en) Training method of text classification model, text classification method and related equipment
CN116227474B (en) Method and device for generating countermeasure text, storage medium and electronic equipment
CN108446266B (en) Statement splitting method, device and equipment
CN108875743B (en) Text recognition method and device
CN113887234B (en) Model training and recommending method and device
CN113887235A (en) Information recommendation method and device
CN113887206B (en) Model training and keyword extraction method and device
CN111222315A (en) Film scenario prediction method
CN112948449A (en) Information recommendation method and device
CN112699307A (en) Information generation method and device
CN116628198A (en) Training method and device of text generation model, medium and electronic equipment
CN116186231A (en) Method and device for generating reply text, storage medium and electronic equipment
CN111787409A (en) Movie and television comment data processing method and device
CN113204637B (en) Text processing method and device, storage medium and electronic equipment
CN114116816A (en) Recommendation method and device
CN113887221A (en) Model training and keyword classification method and device
CN114117028A (en) Information recommendation method and device, storage medium and electronic equipment
CN113344197A (en) Training method of recognition model, service execution method and device
CN111310069A (en) Evaluation method and device for timeliness search

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant