Keyword generation model training method, keyword generation method and device

Through multi-objective joint training and unified modeling methods, the problem of keyword generation models being separated and independent between different matching tasks in the prior art is solved, and the lower cost model maintenance and more efficient generation capabilities are achieved.

CN117473309BActive Publication Date: 2025-04-08BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311337199.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-16
Publication Date
2025-04-08
Estimated Expiration
2043-10-16

AI Technical Summary

Technical Problem

The existing technology is difficult to achieve unified modeling and multi-objective joint training of multiple generation tasks, resulting in the separation and independence of keyword generation models between different matching tasks, increasing maintenance and upgrade costs.

Method used

By obtaining training samples of multiple generation tasks, inputting the initial keyword generation model, and using the difference between predicted keywords and sample keywords for model training, achieving multi-objective joint training and unified modeling.

Benefits of technology

The keyword generation model is realized to generate keywords with different matching relationships with the query text, which reduces the cost of model maintenance and upgrading and improves the unity and efficiency of generation capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117473309B_ABST
    Figure CN117473309B_ABST
Patent Text Reader

Abstract

The present application discloses a training method, a keyword generation method and a device for a keyword generation model, and relates to the field of computer technology, and in particular to the field of artificial intelligence such as deep learning. The specific implementation scheme is: obtaining the first training samples of multiple generation tasks; inputting the first training samples into the initial keyword generation model to obtain the first predicted keyword; training the initial keyword generation model according to the difference between the first predicted keyword and the first sample keyword to obtain the first keyword generation model. Thus, by using the first training samples of multiple generation tasks, multi-objective joint training is achieved, and unified modeling of multiple generation tasks is achieved, so that the keyword generation model has the ability to generate keywords with different matching relationships with the query text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, in particular to the field of artificial intelligence such as deep learning, and specifically to a training method for a keyword generation model, a keyword generation method and a device. Background Art

[0002] Text content generation is the core capability of generative big models. For example, in the search field, generative big models can be used to generate keywords based on search input, and keywords can be used for retrieval. Summary of the invention

[0003] This application provides a keyword generation model training method, keyword generation method and device. The specific scheme is as follows:

[0004] According to one aspect of the present application, a method for training a keyword generation model is provided, comprising:

[0005] Obtaining first training samples of multiple generation tasks; wherein the first training samples include a first query text, a first sample keyword, and a matching relationship between the first query text and the first sample keyword, and the first training samples of different generation tasks include different matching relationships;

[0006] Inputting the first training sample into an initial keyword generation model to obtain a first predicted keyword;

[0007] The initial keyword generation model is trained according to the difference between the first predicted keyword and the first sample keyword to obtain a first keyword generation model.

[0008] According to another aspect of the present application, a keyword generation method is provided, comprising:

[0009] Get the query text;

[0010] Generate prompt text corresponding to each of the multiple generation tasks according to the query text; wherein the prompt texts of different generation tasks contain different matching relationships;

[0011] The prompt text is input into a keyword generation model to obtain keywords corresponding to each generation task, wherein the keyword generation model is trained using the method described in the above-mentioned embodiment.

[0012] According to another aspect of the present application, a training device for a keyword generation model is provided, comprising:

[0013] A first acquisition module is used to acquire first training samples of multiple generation tasks; wherein the first training samples include a first query text, a first sample keyword, and a matching relationship between the first query text and the first sample keyword, and the first training samples of different generation tasks contain different matching relationships;

[0014] A second acquisition module, configured to input the first training sample into an initial keyword generation model to obtain a first predicted keyword;

[0015] The first training module is used to train the initial keyword generation model according to the difference between the first predicted keyword and the first sample keyword to obtain a first keyword generation model.

[0016] According to another aspect of the present application, a keyword generating device is provided, comprising:

[0017] A first acquisition module, used to acquire a query text;

[0018] A generation module, used for generating prompt texts corresponding to each of the multiple generation tasks according to the query text; wherein the prompt texts of different generation tasks contain different matching relationships;

[0019] The second acquisition module is used to input the prompt text into a keyword generation model to obtain keywords corresponding to each generation task, wherein the keyword generation model is trained using the method described in the above-mentioned embodiment.

[0020] According to another aspect of the present application, there is provided an electronic device, including:

[0021] at least one processor; and

[0022] a memory communicatively connected to the at least one processor; wherein,

[0023] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the above one embodiment, or to execute the method described in the above another embodiment.

[0024] According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method according to the above-mentioned one embodiment, or execute the method according to the above-mentioned other embodiment.

[0025] According to another aspect of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps of the method described in the first embodiment or the steps of the method described in the other embodiment.

[0026] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

[0028] Figure 1 A flowchart of a method for training a keyword generation model provided in one embodiment of the present application;

[0029] Figure 2 A flowchart of a method for training a keyword generation model provided in another embodiment of the present application;

[0030] Figure 3 A flowchart of a method for training a keyword generation model provided in another embodiment of the present application;

[0031] Figure 4 A schematic diagram of a process based on manual annotation and confidence click supervised fine-tuning provided in an embodiment of the present application;

[0032] Figure 5 A schematic diagram of a feedback fine-tuning process provided in an embodiment of the present application;

[0033] Figure 6 A flowchart of a keyword generation method provided in this application;

[0034] Figure 7 A flowchart of another keyword generation method provided in this application;

[0035] Figure 8 A schematic diagram of the structure of a training device for a keyword generation model provided in one embodiment of the present application;

[0036] Fig. 9 A schematic diagram of the structure of a keyword generating device provided in one embodiment of the present application;

[0037] Fig.10 It is a block diagram of an electronic device used to implement the training method of the keyword generation model of the embodiment of the present application. DETAILED DESCRIPTION

[0038] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0039] The following describes the keyword generation model training method, keyword generation method, device, electronic device and storage medium of the embodiments of the present application with reference to the accompanying drawings.

[0040] In some search scenarios, there are three roles: users, promoters of promotional content, and search engines. Users enter query text, promoters enter keywords and promotional content creative combinations, and search engines are responsible for matching query text with keywords. At the same time, the corresponding promotional content creatives will be displayed on the user's search results page. The matching problem between query text and keywords is the core point of promotional content targeting.

[0041] Text content generation is the core capability of the generative big model, which can achieve accurate recall of keywords from query text to promotional content, combined with the two-stage targeting strategy expressed by users. Specifically, it can first generate keywords describing the promoter's business based on query text understanding, and then retrieve promotional content based on keywords.

[0042] In actual applications, keyword targeting services can cover a variety of matching methods. In some embodiments, the generative matching model is usually a small-size model with millions of parameters for a single generation task. In addition, a single generation task will cause the generation models of different matching tasks to be separated and independent, increasing maintenance and upgrade costs.

[0043] Based on this, an embodiment of the present application provides a training method for a keyword generation model to achieve unified modeling of multiple generation tasks and realize multi-objective joint training.

[0044] Figure 1 A flowchart of a method for training a keyword generation model provided in one embodiment of the present application.

[0045] The training method of the keyword generation model of the embodiment of the present application can be executed by the training device of the keyword generation model of the embodiment of the present application. The device can be configured in an electronic device to realize multi-target joint training, so that the keyword generation model has the ability to generate different targets through different prompt instructions.

[0046] Among them, the electronic device can be any device with computing capabilities, such as a personal computer, a mobile terminal, a server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, and other hardware devices with various operating systems, touch screens and / or display screens.

[0047] like Figure 1 As shown, the training method of the keyword generation model includes:

[0048] Step 101: Obtain first training samples of multiple generation tasks.

[0049] Among them, the various generation tasks may include synonym tasks, phrase tasks, intelligent tasks, etc.

[0050] In the present application, the first training sample of each generation task may include a first query text, a first sample keyword, and a matching relationship between the first query text and the first sample keyword. The first query text may be a text entered by a user in a search engine, and the matching relationship between the query text and the keyword may include synonymy, phrase, intelligence, etc., and intelligence may be understood as relevance.

[0051] For example, the matching relationship between the query text "double eyelid cost" and the keyword "double eyelid price" is synonymous, the matching relationship between the query text "double eyelid surgery" and the keyword "double eyelid" is a phrase, and the matching relationship between the query text "double eyelid surgery" and the keyword "medical beauty" is intelligent.

[0052] For example, if the matching relationship between a query text query and keyword b1 is synonymous, the first training sample can be "query matching relationship is synonymous keyword: b1"; if the matching relationship between the query text query and keyword b2 is a phrase, the first training sample can be "query matching relationship is a phrase keyword: b2"; if the matching relationship between the query text query and keyword b3 is intelligent, the first training sample can be "query matching relationship is intelligent keyword: b3".

[0053] In the present application, the first training samples of different generation tasks contain different matching relationships, and the first training samples of the same generation task contain the same matching relationship.

[0054] In the present application, first training samples for various generation tasks may be obtained based on manually annotated data, wherein the manually annotated data may refer to data obtained by manually annotating the matching relationship between the query text and the keywords.

[0055] Optionally, the feedback score of the promotion content corresponding to the first sample keyword in at least one first training sample in the first training samples of the multiple generated tasks is greater than a preset score. The feedback score of the promotion content corresponding to the first sample keyword can be used to characterize the promotion effect of the promotion content corresponding to the first sample keyword, for example, the feedback score can be a click-through rate.

[0056] As an implementation method, the first training samples of multiple generation tasks can be obtained based on the manually labeled data and the confident click data. In the implementation, the query text with real online distribution can be obtained, and the keywords corresponding to the promotional content with feedback scores greater than the preset scores in the query results of the query text can be obtained, and the keywords are used as the first sample keywords, and the query text is used as the first query text. Then, the first training sample is obtained based on the first query text and the first sample keywords, so as to obtain the first training sample based on the confident click data.

[0057] Therefore, training the model based on confident click data can enable the model to better understand the actual needs and behaviors of users.

[0058] Step 102: input the first training sample into the initial keyword generation model to obtain the first predicted keyword.

[0059] In the present application, the keyword generation model may be a generative large model, and the first training sample may be input into the initial keyword generation model for encoding and decoding to obtain a first predicted keyword.

[0060] Step 103: training the initial keyword generation model according to the difference between the first predicted keyword and the first sample keyword to obtain a first keyword generation model.

[0061] In the present application, the first generation probability loss can be determined based on the difference between the first predicted keyword and the first sample keyword, and the parameters of the initial keyword generation model can be adjusted based on the first generation probability loss, and the model with adjusted parameters can be continuously trained until the training end condition is met to obtain the first keyword generation model. Thus, based on the difference between the predicted keyword generated by the model and the sample keyword, the generation probability loss is determined, and the model is trained based on the generation probability loss, which can achieve supervised fine-tuning of the model and improve the accuracy of the model.

[0062] As an example, the first generation probability loss may be determined according to the difference between each character in the first predicted keyword and the characters at the same position in the first sample keyword.

[0063] In the embodiment of the present application, the first training samples of various generation tasks are obtained, and the initial keyword generation model is trained using the first training samples to obtain the first keyword generation model. Thus, by using the first training samples of various generation tasks, multi-objective joint training is achieved, and unified modeling of various generation tasks is achieved, so that the keyword generation model has the ability to generate keywords with different matching relationships with the query text, which can save model maintenance costs and upgrade costs.

[0064] Figure 2 A flowchart of a method for training a keyword generation model provided in another embodiment of the present application.

[0065] like Figure 2 As shown, the training method of the keyword generation model also includes:

[0066] Step 201: Obtain second training samples of multiple generation tasks.

[0067] In the present application, the second training sample of each generation task may include a second query text, a first keyword sequence, and a matching relationship between the second query text and the first keyword sequence. The second training samples of different generation tasks may include different matching relationships.

[0068] The matching relationships between the second sample keywords in the first keyword sequence and the second query text are all the same.

[0069] For example, the second query text is query1, the keyword sequence that matches query1 as a synonym is a11, a12, a13, the keyword sequence that matches query1 as a phrase is b11, b12, b13, b14, and the keyword sequence that matches query1 as an intelligent one is c11, c12, c13, c14. Then the second training sample of the query1 synonym task can be "query1 matching relationship as synonymous keywords: a11, a12, a13", the second training sample of the query1 phrase task can be "query1 matching relationship as phrase keywords: b11, b12, b13, b14", and the second training sample of the query1 intelligent task can be "query1 matching relationship as intelligent keywords: c11, c12, c13, c14".

[0070] For another example, the second query text is query2, and the keyword sequences matching query2 as synonyms are a21 and a22, then the second training sample of the query2 synonym task may be "query2 matching synonymous keywords: a21, a22".

[0071] In the present application, each second sample keyword in the first keyword sequence may be sorted from high to low according to the feedback score, and the feedback score of the second sample keyword may be used to characterize the promotion effect of the promotion content corresponding to the second sample keyword. The higher the feedback score, the better the promotion effect of the promotion content. For example, the feedback score of the second sample keyword may be represented by the click-through rate of the promotion content corresponding to the second sample keyword. The promotion content may be, for example, an advertisement.

[0072] Step 202: Input the second training sample into the first keyword generation model to obtain a second keyword sequence.

[0073] In the present application, the second training sample is input into the first keyword generation model, and the first keyword generation model encodes and decodes the second training sample to obtain a second keyword sequence, wherein the second keyword sequence may include at least one second predicted keyword.

[0074] Step 203: training the first keyword generation model according to the difference between the second keyword sequence and the first keyword sequence to obtain a second keyword generation model.

[0075] In the present application, the second generation probability loss can be determined according to the difference between each second predicted keyword in the second keyword sequence and each second sample keyword in the first keyword sequence, and the sorting loss can be determined according to the difference between the ranking of each second predicted keyword in the second keyword sequence and the ranking of each second sample keyword in the first keyword sequence. The sum of the second generation probability loss and the sorting loss is then determined as the model loss. According to the model loss, the parameters of the first keyword generation model are adjusted, and the first keyword generation model with adjusted parameters is continuously trained until the training end condition is met to obtain the second keyword generation model.

[0076] Optionally, the ranking loss may be determined according to the number of second predicted keywords in the second keyword sequence that have different ranking positions from the second sample keywords in the first keyword sequence, wherein the greater the number of second predicted keywords with different ranking positions, the greater the ranking loss.

[0077] Optionally, the feedback score of the promotional content corresponding to each second predicted keyword in the second keyword sequence can be obtained, and the second predicted keywords with feedback scores greater than the preset score can be used to calculate the second generation probability loss, and the ranking loss is determined according to the feedback scores corresponding to each second predicted keyword in the second keyword sequence and the generation probability corresponding to each second predicted keyword, and the sum of the second generation probability loss and the ranking loss is determined as the model loss. For details, please refer to the following formulas (1) to (3):

[0078] L=L ft +Lrank (1)

[0079]

[0080]

[0081] Among them, L represents the model loss; L ft represents the second generation probability loss; L rank represents the sorting loss of the list sample after feedback optimization; t represents the tth character; y i,t represents the t-th character estimated based on the second query text x and the first t-1 characters generated; y i,<t represents the first t-1 characters; i represents the sample coordinate, the i-th sample; r i represents the feedback score corresponding to the i-th second prediction keyword, thr represents the preset score, rh represents the feedback score corresponding to the h-th second prediction keyword, rj represents the feedback score corresponding to the j-th second prediction keyword, and p h represents the generation probability of the hth second predicted keyword, p j represents the generation probability of the j-th second predicted keyword.

[0082] It can be seen that the learning goal of formula (3) is that when rh is less than rj, we hope that p h As much smaller than p as possible j , that is, p h -p j Keep it as small as possible to ensure that the order of ranking and feedback scores are consistent.

[0083] In this application, the second training sample may also be referred to as a list sample. For example, if the first keyword sequence in a second training sample includes multiple second sample keywords, then the first sample in the list sample may refer to a sample containing the second query text and the first second sample keyword and a match between the two.

[0084] Therefore, based on further training the first keyword generation model according to the second generation probability loss and the ranking loss, the generation capability of the model can be further improved.

[0085] In the embodiment of the present application, by using the second training samples of various generation tasks to continue training the first keyword generation model, the generation capability of the keyword generation model can be improved.

[0086] Figure 3 A flowchart of a method for training a keyword generation model provided in another embodiment of the present application.

[0087] like Figure 3 As shown, the training method of the keyword generation model also includes:

[0088] Step 301: Obtain a second query text.

[0089] In the present application, the second query text that is actually distributed online can be obtained.

[0090] Step 302: Generate a prompt text corresponding to each generation task according to the second query text and the prompt template corresponding to each matching relationship.

[0091] The prompt template includes the location information and matching relationship of the query text, and each matching relationship corresponds to a different prompt template.

[0092] In the present application, the second query text may be added to the prompt template corresponding to each matching relationship to generate a prompt text corresponding to each generation task.

[0093] Taking the matching relationship of synonym as an example, the second query text is query1, and the prompt template corresponding to the synonym matching relationship is "query text matching relationship is synonymous keywords:". For query1, the prompt text of the synonym task is "query1 matching relationship is synonymous keywords:".

[0094] Step 303: input the prompt text into the first keyword generation model to obtain a plurality of candidate keywords.

[0095] In the present application, the prompt text corresponding to each generation task is input into the first keyword generation model to obtain the candidate keywords corresponding to each generation task, thereby obtaining multiple candidate keywords.

[0096] Step 304: Determine the score of each matching relationship between the second query text and each candidate keyword using the relevance discrimination model.

[0097] Since the candidate keywords obtained by the first keyword generation model may not match the actual generation task, the second query text and each candidate keyword can be input into a pre-trained relevance discrimination model to obtain a score for each matching relationship between the second query text and each candidate keyword.

[0098] Step 305 , sorting the plurality of candidate keywords according to the score of each matching relationship between the second query text and each candidate keyword and the matching levels of the plurality of matching relationships to obtain a sorting result.

[0099] In the present application, the second query text and each candidate keyword can be compared with the preset score corresponding to the matching relationship with the highest score among the scores of each matching relationship. If the highest score is greater than the preset score corresponding to the matching relationship with the highest score, the candidate keyword is determined as the second sample keyword corresponding to the matching relationship. In this way, the second sample keyword corresponding to each matching relationship can be determined, and relevance grading can be performed, which can improve the accuracy of the relevance grading.

[0100] Among them, the preset scores corresponding to each of the above matching relationships can be the same or different, and this application does not limit this.

[0101] For example, for query1, the prompt text of the synonymous task is "query1 matches synonymous keywords:", and the prompt text is input into the first keyword generation model to obtain candidate keywords a11, a12, a13, and a14. Query1 and candidate keyword a11 can be input into the relevance discrimination model to obtain the score of query1 and candidate keyword a11 matching as a synonym, the score of the matching as a phrase, and the score of the matching as an intelligent relationship. A similar method is used for candidate keywords a12, a13, and a14, which will not be repeated here.

[0102] Among them, candidate keywords a11, a12, a13, and a14 have the highest scores in the synonymous matching relationship, and the scores of candidate keywords a11, a12, and a13 are all greater than the preset threshold corresponding to the synonymous matching relationship. Therefore, for query1, the second sample keywords corresponding to the synonymous matching relationship are a11, a12, and a13.

[0103] After determining the second sample keywords corresponding to each matching relationship, the second sample keywords corresponding to the multiple matching relationships can be sorted in descending order of the matching levels of the multiple matching relationships, and then the second sample keywords corresponding to the same matching relationship are sorted to obtain the final sorting result. The higher the matching level, the higher the matching degree between the second query text and the second sample keyword.

[0104] In the present application, the feedback score of the promotional content corresponding to each second sample keyword can be obtained. For the second sample keywords corresponding to the same matching relationship, the second sample keywords can be sorted in descending order according to the feedback scores corresponding to the second sample keywords.

[0105] For example, there are three matching relationships: synonymy, phrase, and intelligence. The matching levels of the three matching relationships are in the order of synonymy, phrase, and intelligence from high to low. For the same second query text, after determining the second sample keywords corresponding to each matching relationship, the second sample keywords can be sorted in the order of synonymy, phrase, and intelligence, and then the second sample keywords corresponding to the same matching relationship can be sorted.

[0106] It should be noted that, for the same second query text, when sorting the second sample keywords, you can first sort according to the matching level of the matching relationship, and then sort the second sample keywords corresponding to the same matching relationship, or you can first sort the second sample keywords corresponding to the same matching relationship, and then sort according to the matching level of the matching relationship. This application does not limit this.

[0107] Therefore, relevance classification is performed based on the relevance discrimination model, and then the second sample keywords corresponding to the same matching relationship are sorted based on the feedback scores to obtain the final sorting result, so as to continue to train the first keyword generation model based on the scores and feedback scores, which can further improve the model's generation capabilities in various generation task scenarios.

[0108] Step 306: Generate second training samples corresponding to each generation task according to the second query text and the ranking result.

[0109] In the present application, the second training sample corresponding to each generation task can be constructed according to the ranking of the second sample keywords corresponding to each matching relationship in the ranking result and the second query text.

[0110] For example, the second query text is query1, and the ranking results of the second sample keywords corresponding to the second query text are {a11, a12, a13}, {b11, b12, b13, b14}, {c11, c12, c13, c14}. Among them, the matching relationship between query1 and {a11, a12, a13} is synonymous, so the second training sample of the synonymous task constructed is "query1 matching relationship is synonymous keywords: a11, a12, a13"; the matching relationship between query1 and {b11, b12, b13, b14} is a phrase, so the second training sample of the phrase task constructed is "query1 matching relationship is phrase keywords: b11, b12, b13, b14"; the matching relationship between query1 and {c11, c12, c13, c14} is intelligent, so the second training sample of the intelligent task constructed is "query1 matching relationship is intelligent keywords: c11, c12, c13, c14".

[0111] Step 307: input the second training sample into the first keyword generation model to obtain a second keyword sequence.

[0112] Step 308: training the first keyword generation model according to the difference between the second keyword sequence and the first keyword sequence to obtain a second keyword generation model.

[0113] In the present application, steps 307 to 308 may be implemented in any of the embodiments of the present application, and are not limited thereto and will not be described in detail.

[0114] In an embodiment of the present application, the score of each matching relationship between the second query text and each candidate keyword is determined based on the relevance discrimination model, the candidate keywords are sorted based on the scores and the matching levels of the multiple matching relationships, and a second training sample is constructed based on the sorting result, so as to continue to train the first keyword generation model based on the score feedback, which can improve the generation ability of the model in various generation task scenarios.

[0115] In one embodiment of the present application, a third training sample may be obtained, and the second keyword generation model may be trained using the third training sample to obtain a third keyword generation model.

[0116] The third training sample may include a third query text, a third keyword sequence, and a matching relationship between the third query text and the third keyword sequence, and the last character of each third sample keyword in the third keyword sequence is a preset character.

[0117] The preset character may be used to indicate that the generated result after the preset character does not meet the requirement. For example, the preset character may be stop_token or stop, or other characters, which are not limited in this application.

[0118] Therefore, by fine-tuning the second keyword generation model based on the training samples containing preset characters, the model can be equipped with the ability to generate preset characters, so that the online reasoning process only retains the results before the preset characters to ensure that the accuracy of the generated results meets the requirements.

[0119] In order to facilitate understanding of the above embodiments, Figure 4 and Figure 5 Provide explanation. Figure 4 A schematic diagram of a process based on manual annotation and confidence click supervised fine-tuning provided in an embodiment of the present application, Figure 5 A schematic diagram of a feedback fine-tuning process provided in an embodiment of the present application.

[0120] like Figure 4As shown, the manually annotated data and the confident click data can be used to perform two-stage supervised fine-tuning on the initial keyword generation model to obtain the first keyword generation model. In implementation, the manually annotated data can be used to perform supervised fine-tuning on the initial keyword generation model. Supervised fine-tuning through manual annotation can allow the model to better understand the true meaning and internal connections of the data, laying a solid foundation for subsequent model training. After that, supervised fine-tuning can be performed in combination with the confident click data. Specifically, supervised fine-tuning can be performed using high-confidence click data. Among them, high-confidence click data can refer to the training samples constructed by using the keywords corresponding to the promotional content with a click-through rate higher than a preset click-through rate threshold in the query results and the query text used by the user.

[0121] Figure 4 In the example, the original sample can be converted into templated training data according to the prompt template corresponding to each matching relationship.<query,b1> Sample, converted to prompt text prompt1: query matching relationship is synonymous with the keyword: b1; phrase relationship<query,b2> Sample, converted to prompt text prompt2: query matching relationship is a phrase keyword: b2; smart relationship<query,b3> The sample is converted into a prompt text prompt3: query matching relationship is an intelligent keyword: b3. Therefore, the training samples of various generation tasks can be used to perform unified modeling of various generation tasks to obtain a first keyword generation model.

[0122] After obtaining the first keyword generation model, feedback data joint tuning can be performed, such as Figure 5 shown. Figure 5 In step 1, the multi-task results are generated based on the first keyword generation model inference. In implementation, for the query texts that are actually distributed online, the generation results of different tasks can be generated according to the synonymous task instructions, the short-term task instructions, and the intelligent task instructions as the data source for feedback learning.

[0123] Step 2: Sort the generated results uniformly based on multiple feedback signals. In implementation, the generated results of multiple generation tasks under the same query text dimension can be uniformly sorted according to the relevance discrimination model, promotion content click feedback, etc. to obtain the sorting results. Among them, the sorting method can be to classify the relevance according to the relevance discrimination model (synonymous>phrase>intelligent), and sort within the file according to user click feedback. The file here refers to the keywords in the same matching relationship.

[0124] Step 3: Fine-tune the model with multiple instructions based on the unified sorting results. In the implementation, based on the unified sorting results, the samples are reorganized according to three different generation tasks to obtain training samples for three generation tasks. Based on the training samples of multiple generation tasks, the first keyword generation model is jointly trained to obtain the second keyword generation model. As a result, after feedback fine-tuning of the first keyword generation model, the model generation capability is further effectively improved.

[0125] Figure 6 A flowchart of a keyword generation method provided in this application.

[0126] like Figure 6 As shown, the keyword generation method includes:

[0127] Step 601, obtaining query text.

[0128] In the present application, a search request may be obtained, wherein the search request may include a query text.

[0129] Step 602: Generate prompt text corresponding to each of the multiple generation tasks according to the query text.

[0130] In the present application, different generation tasks correspond to different matching relationships, wherein the matching relationships may include synonyms, phrases, intelligence, etc., and each matching relationship corresponds to a different prompt template.

[0131] In the present application, the method for generating the prompt text corresponding to each generation task according to the query text and the prompt template corresponding to each matching relationship is similar to the method for generating the prompt text in the above embodiment, so it will not be repeated here.

[0132] Step 603: input the prompt text into the keyword generation model to obtain keywords corresponding to each generation task.

[0133] The keyword generation model may be obtained by training using the training method described in the above embodiment.

[0134] In this application, the prompt text corresponding to each generated task can be input into the keyword generation model to obtain the keywords corresponding to each generated task. Thus, the promotional content can be retrieved according to the generated keywords. If the generated keywords match the keywords corresponding to one or more promotional contents, these promotional contents can be used as search results.

[0135] In actual applications, the corresponding generation task can be completed through the keyword generation model according to the given matching task type. For example, if the given matching task type is a synonymous matching method, the prompt text corresponding to the synonymous task can be generated according to the prompt template corresponding to the query text and the synonymous matching relationship, and the prompt text can be input into the keyword generation model to obtain the keyword corresponding to the synonymous task, and the obtained keyword can be matched with the keyword provided by the promoter to obtain the corresponding promotion content, and the promotion content can be displayed.

[0136] In the embodiment of the present application, by generating a prompt text corresponding to each generation task according to the query text, the prompt text is input into the keyword generation model to obtain the keyword corresponding to each generation task. Thus, the keyword generation model can be used to complete different generation tasks and meet different matching requirements.

[0137] Figure 7 A flowchart of another keyword generation method provided in this application.

[0138] like Figure 7 As shown, the keyword generation method includes:

[0139] Step 701, obtaining query text.

[0140] In the present application, step 701 may be implemented in any of the embodiments of the present application, which is not limited and will not be described in detail.

[0141] Step 702, determining a first candidate character set based on the currently generated characters of the prompt text according to the dictionary tree and the keyword generation model.

[0142] In the present application, the dictionary tree can be generated based on a given keyword set. For example, the dictionary tree is generated based on a keyword set provided by an advertiser. The keywords in the keyword set can be segmented to obtain a character sequence, and a dictionary tree can be constructed based on the character sequence.

[0143] In actual applications, the number of keywords in a keyword set may be relatively large. If a dictionary tree is constructed directly based on the keyword set, the memory consumption may be relatively large, resulting in a single machine being unable to support it, and the dictionary tree loading process will also take a long time.

[0144] Based on this, in the present application, the keywords in the keyword set can be divided according to the first character of each keyword in the keyword set. For example, the keywords with the same first character of each keyword can be divided into the same sub-keyword set to obtain multiple sub-keyword sets. Then, a sub-dictionary tree can be constructed based on the keywords in each sub-keyword set, so that multiple sub-dictionary trees can be constructed.

[0145] When the dictionary tree is needed, multiple sub-dictionary trees are loaded in parallel, and the multiple sub-dictionary trees are merged to obtain a complete dictionary tree.

[0146] Therefore, constructing a dictionary tree based on a sub-keyword set significantly reduces the memory usage of the construction process. At the same time, multiple sub-dictionary trees are loaded in parallel during the loading process, which can significantly reduce the loading time.

[0147] In the related art, the generative big model generates keywords in an unconstrained and open manner, so a large number of generated results cannot hit the keywords provided by the promoter of the promotional content, which leads to a relatively low efficiency in triggering the promotional content using the big model.

[0148] Since the keyword generation model of the present application generates characters one by one from the front to the back, the generation space of the next character of the generated prefix can be constrained so that its generation result is always in the given keyword space.

[0149] In the present application, a first candidate character set for the next character of the currently generated character can be determined from the dictionary tree based on the currently generated character of the prompt text according to the keyword generation model.

[0150] Step 703: The keyword generation model generates the next character according to the first candidate character set, and repeats the above operations of determining the first candidate character set and generating the next character until the last character is generated.

[0151] In the present application, the dictionary probability can be masked according to the first candidate character set, for example, the generation probability of characters in the dictionary that are not in the first candidate character set can be set to zero, and a small offset can be added to the generation probability of the characters in the first candidate character set, and the next character can be determined from the first candidate character set according to the generation probability obtained by adding the small offset to the generation probability of the characters in the first candidate character set. After that, the above operations of determining the first candidate character set and generating the next character can be repeated until the last character is generated.

[0152] Among them, adding a small bias to the generation probability of characters in the first candidate character set can ensure that the model will not choose to generate characters outside the first candidate character set due to numerical precision issues, ensuring that the generation results are always in the dictionary tree. The masking effect can ensure that the generation probability or score (decode-score) of the generation result is comparable after the dictionary probability is normalized.

[0153] In practical applications, the length of the generated keywords may be too short or too long. In order to solve this problem, in the present application, the first generation probability of each candidate character in the first candidate character set can be obtained according to the keyword generation model, and the generation length of the current result to be generated by the model can be determined according to the position of the next character to be generated, and then the generation probability of the current result to be generated by the model can be normalized according to the generation length and the first generation probability of each candidate character to obtain the second generation probability corresponding to each candidate character, and the next character can be generated according to the second generation probability corresponding to each candidate character.

[0154] For example, the following formula (4) can be used for normalization:

[0155]

[0156] Among them, S0=p0, the initial value of S0 is p0, f represents the generated length, S f represents the normalized probability of the generation of the first f characters, that is, the second generation probability, S f-1 represents the normalized probability of generating the first f-1 characters, p f represents the first generation probability that any character in the first candidate character set is the f-th character.

[0157] For example, if the character to be generated is the second character, the generation length is 2, and there are 3 characters in the first candidate character set. The second generation probability corresponding to each candidate character can be calculated using formula (4) based on the generation length and the first generation probability of each character in the first candidate character set. The candidate character corresponding to the largest second generation probability can be determined as the second character.

[0158] Therefore, the generation probability of the model's current result to be generated can be normalized according to the generation length, so that when the probability transfer of each generation result is accumulated, the influence of the generation length is gradually introduced, which can avoid the error tendency problem of being too short or too long.

[0159] Since the generation space of the keyword generation model is limited, there may be a problem of poor generation result accuracy due to insufficient candidate results that meet the matching requirements. Based on this, a preset character can be introduced in this application, and the preset character can be used to indicate that the generation result after the preset character does not meet the requirements.

[0160] The preset character may be stop_token or stop, or other forms of characters, which is not limited in this application.

[0161] In the present application, a preset character can be added to the first candidate character set to obtain a second candidate character set, and the keyword generation model generates a next character based on the second candidate character set, wherein the next character is a character in the second candidate character set. In other words, when the keyword generation model generates the next character, it determines the next character from the second candidate character set. Thus, the accuracy of the generated result can be improved.

[0162] Optionally, feedback scores can be introduced for multiple results generated by the keyword generation model based on the first candidate character set (for example, using a pre-trained scoring model for accuracy scoring), and preset characters can be inserted at appropriate positions based on the feedback scores, indicating that the generated results after this position do not meet the accuracy requirements and should be truncated.

[0163] Optionally, the generated results containing preset characters can be sorted and fed back to the keyword generation model training to enable the model to have the ability to generate preset characters. During the online reasoning process, only the results before the preset characters are retained to ensure that the accuracy of the generated results meets the requirements.

[0164] It should be noted that the scheme of generating the next character using the second candidate character set can be combined with the scheme of normalizing the probability of the above-mentioned generation result to generate the next character.

[0165] In an embodiment of the present application, by determining the first candidate character set for the next character based on the dictionary tree, the next character is determined from the first candidate character set. As a result, the keyword generation model is generated based on the dictionary tree with limited constraints, which can improve the accuracy of the generated keywords, thereby improving the efficiency of triggering promotional content using a large model.

[0166] The keyword generation model of the present application can be applied in search engines to perform keyword matching tasks.

[0167] In order to implement the above embodiment, the embodiment of the present application also proposes a training device for a keyword generation model. Figure 8 A schematic diagram of the structure of a training device for a keyword generation model provided in one embodiment of the present application.

[0168] like Figure 8 As shown, the training device 800 of the keyword generation model includes:

[0169] A first acquisition module 810 is used to acquire first training samples of multiple generation tasks; wherein the first training samples include a first query text, a first sample keyword, and a matching relationship between the first query text and the first sample keyword, and the first training samples of different generation tasks contain different matching relationships;

[0170] A second acquisition module 820 is used to input the first training sample into the initial keyword generation model to obtain a first predicted keyword;

[0171] The first training module 830 is used to train the initial keyword generation model according to the difference between the first predicted keyword and the first sample keyword to obtain a first keyword generation model.

[0172] Optionally, the first training module 830 is used to:

[0173] Determining a first generation probability loss according to a difference between the first predicted keyword and the first sample keyword;

[0174] The initial keyword generation model is trained according to the first generation probability loss to obtain a first keyword generation model.

[0175] Optionally, the device may further include:

[0176] A third acquisition module is used to acquire second training samples of multiple generation tasks; wherein the second training samples include a second query text, a first keyword sequence, and a matching relationship between the second query text and the first keyword sequence, and the second training samples of different generation tasks contain different matching relationships;

[0177] A fourth acquisition module, used for inputting the second training sample into the first keyword generation model to obtain a second keyword sequence;

[0178] The second training module is used to train the first keyword generation model according to the difference between the second keyword sequence and the first keyword sequence to obtain the second keyword generation model.

[0179] Optionally, the second training module is used to:

[0180] determining a second generation probability loss according to a difference between each second predicted keyword in the second keyword sequence and each second sample keyword in the first keyword sequence;

[0181] determining a ranking loss according to a difference between a ranking of each second predicted keyword in the second keyword sequence and a ranking of each second sample keyword in the first keyword sequence;

[0182] The first keyword generation model is trained according to the second generation probability loss and the ranking loss to obtain a second keyword generation model.

[0183] Optionally, the third acquisition module is used to:

[0184] Get the second query text;

[0185] Generate a prompt text corresponding to each generation task according to the second query text and the prompt template corresponding to each matching relationship;

[0186] Inputting the prompt text into a first keyword generation model to obtain a plurality of candidate keywords;

[0187] Determine the score of each matching relationship between the second query text and each candidate keyword using a relevance discrimination model;

[0188] sorting the plurality of candidate keywords according to the score of each matching relationship between the second query text and each candidate keyword and the matching levels of the plurality of matching relationships to obtain a sorting result;

[0189] According to the second query text and the ranking result, a second training sample corresponding to each generation task is constructed.

[0190] Optionally, the third acquisition module is used to:

[0191] Determine the second sample keyword corresponding to each matching relationship according to the score of each matching relationship between the second query text and each candidate keyword and the preset score corresponding to each matching relationship;

[0192] sorting the second sample keywords respectively corresponding to the multiple matching relationships according to the matching levels of the multiple matching relationships;

[0193] Obtaining feedback scores of promotional content corresponding to each second sample keyword;

[0194] The second sample keywords corresponding to the same matching relationship are sorted according to the feedback scores corresponding to the second sample keywords corresponding to the same matching relationship to obtain a sorting result.

[0195] Optionally, the device further comprises:

[0196] A fifth acquisition module is used to acquire a third training sample; wherein the third training sample includes a third query text, a third keyword sequence, and a matching relationship between the third query text and the third keyword sequence, and the last character of each third sample keyword in the third keyword sequence is a preset character;

[0197] The third training module is used to train the second keyword generation model using the third training sample to obtain a third keyword generation model.

[0198] Optionally, a feedback score of the promotion content corresponding to the first sample keyword in at least one first training sample is greater than a preset score.

[0199] It should be noted that the explanation of the aforementioned embodiment of the training method for the keyword generation model is also applicable to the training device for the keyword generation model of this embodiment, so it will not be repeated here.

[0200] In the embodiment of the present application, the first training samples of various generation tasks are obtained, and the initial keyword generation model is trained using the first training samples to obtain the first keyword generation model. Thus, by using the first training samples of various generation tasks, multi-objective joint training is achieved, and unified modeling of various generation tasks is achieved, so that the keyword generation model has the ability to generate keywords with different matching relationships with the query text, which can save model maintenance costs and upgrade costs.

[0201] In order to implement the above embodiment, the embodiment of the present application also proposes a keyword generating device. Fig. 9 A schematic diagram of the structure of a keyword generating device provided in one embodiment of the present application.

[0202] like Fig. 9 As shown, the keyword generating device 900 includes:

[0203] A first acquisition module 910, used to acquire a query text;

[0204] A generating module 920 is used to generate a prompt text corresponding to each of the multiple generating tasks according to the query text; wherein the prompt texts of different generating tasks contain different matching relationships;

[0205] The second acquisition module 930 is used to input the prompt text into a keyword generation model to obtain keywords corresponding to each generation task, wherein the keyword generation model is trained using the method of the above embodiment.

[0206] Optionally, the second acquisition module 930 is used to:

[0207] Determine a first candidate character set based on the currently generated characters of the prompt text according to the dictionary tree and the keyword generation model;

[0208] According to the first candidate character set, the keyword generation model generates the next character, and repeats the above operations of determining the first candidate character set and generating the next character until the last character is generated; wherein the next character is a character in the first candidate character set.

[0209] Optionally, the second acquisition module 930 is used to:

[0210] Adding a preset character to the first candidate character set to obtain a second candidate character set; the preset character is used to indicate that the generated result after the preset character does not meet the requirement;

[0211] According to the second candidate character set, the keyword generation model generates a next character; wherein the next character is a character in the second candidate character set.

[0212] Optionally, the second acquisition module 930 is used to:

[0213] Obtaining a first generation probability of each candidate character in the first candidate character set according to the keyword generation model;

[0214] According to the position of the next character to be generated, the generation length of the result to be generated by the model is determined;

[0215] Normalize the generation probability of the current result to be generated by the model according to the generation length and the first generation probability of each candidate character to obtain the second generation probability corresponding to each candidate character;

[0216] Generate the next character according to the second generation probability corresponding to each candidate character.

[0217] Optionally, the device further comprises:

[0218] Loading module, used to load multiple sub-dictionary trees in parallel;

[0219] The merging module is used to merge multiple sub-dictionary trees to obtain a dictionary tree.

[0220] Optionally, the device further comprises:

[0221] The third acquisition module is used to acquire a keyword set;

[0222] A fourth acquisition module, used to obtain multiple sub-keyword sets according to the first character of each keyword in the keyword set;

[0223] The construction module is used to construct a sub-dictionary tree according to the keywords in each sub-keyword set.

[0224] It should be noted that the explanation of the aforementioned keyword generation method embodiment is also applicable to the keyword generation device of this embodiment, so it will not be repeated here.

[0225] In the embodiment of the present application, by generating a prompt text corresponding to each generation task according to the query text, the prompt text is input into the keyword generation model to obtain the keyword corresponding to each generation task. Thus, the keyword generation model can be used to complete different generation tasks and meet different matching requirements.

[0226] According to an embodiment of the present application, the present application also provides an electronic device, a readable storage medium and a computer program product.

[0227] Fig.10A schematic block diagram of an example electronic device 100 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0228] like Fig.10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 1002 or a computer program loaded from a storage unit 1008 to a RAM (Random Access Memory) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An I / O (Input / Output) interface 1005 is also connected to the bus 1004.

[0229] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0230] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, CPU (Central Processing Unit), GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as the training method of the keyword generation model. For example, in some embodiments, the training method of the keyword generation model may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the training method of the keyword generation model described above may be executed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute the training method of the keyword generation model in any other appropriate manner (eg, by means of firmware).

[0231] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a dedicated or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0232] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0233] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0234] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0235] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.

[0236] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services (Virtual Private Server). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0237] It should be noted that the structure of the electronic device used to implement the keyword generation method of the embodiment of the present application is similar to the structure of the electronic device of the above embodiment, so it is not repeated in this step.

[0238] According to an embodiment of the present application, the present application also provides a computer program product. When the instruction processor in the computer program product is executed, it executes the training method of the keyword generation model proposed in the above embodiment of the present application, or executes the keyword generation method proposed in the above embodiment of the present application.

[0239] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0240] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A method for training a keyword generation model, comprising: Acquire first training samples of multiple generation tasks; wherein the first training samples include a first query text, a first sample keyword, and a matching relationship between the first query text and the first sample keyword, and the first training samples of different generation tasks include different matching relationships; Inputting the first training sample into an initial keyword generation model to obtain a first predicted keyword; According to the difference between the first predicted keyword and the first sample keyword, the initial keyword generation model is trained to obtain a first keyword generation model; The method further comprises: Obtaining second training samples of the plurality of generation tasks; wherein the second training samples include a second query text, a first keyword sequence, and a matching relationship between the second query text and the first keyword sequence, and the second training samples of different generation tasks include different matching relationships; Inputting the second training sample into the first keyword generation model to obtain a second keyword sequence; The first keyword generation model is trained according to the difference between the second keyword sequence and the first keyword sequence to obtain a second keyword generation model.

2. The method of claim 1, wherein: The step of training the initial keyword generation model according to the difference between the first predicted keyword and the first sample keyword to obtain a first keyword generation model includes: determining a first generation probability loss according to a difference between the first predicted keyword and the first sample keyword; The initial keyword generation model is trained according to the first generation probability loss to obtain the first keyword generation model.

3. The method according to claim 1, wherein the first keyword generation model is trained according to the difference between the second keyword sequence and the first keyword sequence to obtain the second keyword generation model, comprising: determining a second generation probability loss according to a difference between each second predicted keyword in the second keyword sequence and each second sample keyword in the first keyword sequence; determining a ranking loss according to a difference between a ranking of each second predicted keyword in the second keyword sequence and a ranking of each second sample keyword in the first keyword sequence; The first keyword generation model is trained according to the second generation probability loss and the ranking loss to obtain the second keyword generation model.

4. The method of claim 1, wherein: The obtaining of second training samples for the plurality of generation tasks comprises: Obtaining the second query text; generating a prompt text corresponding to each of the generation tasks according to the second query text and the prompt template corresponding to each of the matching relationships; Inputting the prompt text into the first keyword generation model to obtain a plurality of candidate keywords; Determine the score of each matching relationship between the second query text and each candidate keyword using a relevance discrimination model; sorting the plurality of candidate keywords according to the score of each matching relationship between the second query text and each candidate keyword and the matching levels of the plurality of matching relationships to obtain a sorting result; According to the second query text and the ranking result, a second training sample corresponding to each generation task is constructed.

5. The method of claim 4, wherein: The step of sorting the plurality of candidate keywords according to the score of each matching relationship between the second query text and each candidate keyword and the matching levels of the plurality of matching relationships to obtain a sorting result includes: Determine a second sample keyword corresponding to each matching relationship according to the score of each matching relationship between the second query text and each candidate keyword and a preset score corresponding to each matching relationship; sorting the second sample keywords respectively corresponding to the multiple matching relationships according to the matching levels of the multiple matching relationships; Obtaining a feedback score of the promotion content corresponding to each of the second sample keywords; The second sample keywords corresponding to the same matching relationship are sorted according to the feedback scores corresponding to the second sample keywords corresponding to the same matching relationship to obtain the sorting result.

6. The method of claim 1, further comprising: Acquire a third training sample; wherein the third training sample includes a third query text, a third keyword sequence, and a matching relationship between the third query text and the third keyword sequence, and the last character of each third sample keyword in the third keyword sequence is a preset character; The second keyword generation model is trained using the third training sample to obtain a third keyword generation model.

7. The method according to any one of claims 1 to 6, wherein: The feedback score of the promotion content corresponding to the first sample keyword in at least one of the first training samples is greater than a preset score.

8. A keyword generation method, comprising: Get the query text; Generate prompt text corresponding to each of the multiple generation tasks according to the query text; wherein the prompt texts of different generation tasks contain different matching relationships; The prompt text is input into a keyword generation model to obtain keywords corresponding to each generation task, wherein the keyword generation model is trained using the method described in any one of claims 1 to 7.

9. The method of claim 8, wherein: The step of inputting the prompt text into a keyword generation model to obtain keywords corresponding to each generation task includes: Determine a first candidate character set based on the currently generated characters of the prompt text according to the dictionary tree and the keyword generation model; According to the first candidate character set, the keyword generation model generates the next character, and repeats the above operations of determining the first candidate character set and generating the next character until the last character is generated; wherein the next character is a character in the first candidate character set.

10. The method of claim 9, wherein: The keyword generation model generates a next character according to the first candidate character set, including: Adding a preset character to the first candidate character set to obtain a second candidate character set; the preset character is used to indicate that the generated result after the preset character does not meet the requirement; According to the second candidate character set, the keyword generation model generates a next character; wherein the next character is a character in the second candidate character set.

11. The method of claim 9, wherein: The keyword generation model generates a next character according to the first candidate character set, including: According to the keyword generation model, obtaining a first generation probability of each candidate character in the first candidate character set; According to the position of the next character to be generated, the generation length of the result to be generated by the model is determined; Normalizing the generation probability of the current result to be generated by the model according to the generation length and the first generation probability of each candidate character to obtain a second generation probability corresponding to each candidate character; Generate the next character according to the second generation probability corresponding to each candidate character.

12. The method of claim 9, further comprising: Load multiple sub-trite in parallel; The multiple sub-dictionary trees are merged to obtain the dictionary tree.

13. The method of claim 12, further comprising: Get a set of keywords; According to the first character of each keyword in the keyword set, a plurality of sub-keyword sets are obtained; The sub-dictionary tree is constructed according to the keywords in each of the sub-keyword sets.

14. A training device for a keyword generation model, comprising: A first acquisition module is used to acquire first training samples of multiple generation tasks; wherein the first training samples include a first query text, a first sample keyword, and a matching relationship between the first query text and the first sample keyword, and the first training samples of different generation tasks contain different matching relationships; A second acquisition module, configured to input the first training sample into an initial keyword generation model to obtain a first predicted keyword; A first training module, configured to train the initial keyword generation model according to the difference between the first predicted keyword and the first sample keyword to obtain a first keyword generation model; The device further comprises: A third acquisition module is used to acquire second training samples of the plurality of generation tasks; wherein the second training samples include a second query text, a first keyword sequence, and a matching relationship between the second query text and the first keyword sequence, and the second training samples of different generation tasks contain different matching relationships; A fourth acquisition module, configured to input the second training sample into the first keyword generation model to obtain a second keyword sequence; The second training module is used to train the first keyword generation model according to the difference between the second keyword sequence and the first keyword sequence to obtain a second keyword generation model.

15. The device of claim 14, wherein: The first training module is used to: determining a first generation probability loss according to a difference between the first predicted keyword and the first sample keyword; The initial keyword generation model is trained according to the first generation probability loss to obtain the first keyword generation model.

16. The device of claim 14, wherein: The second training module is used to: determining a second generation probability loss according to a difference between each second predicted keyword in the second keyword sequence and each second sample keyword in the first keyword sequence; determining a ranking loss according to a difference between a ranking of each second predicted keyword in the second keyword sequence and a ranking of each second sample keyword in the first keyword sequence; The first keyword generation model is trained according to the second generation probability loss and the ranking loss to obtain the second keyword generation model.

17. The device of claim 14, wherein: The third acquisition module is used to: Obtaining the second query text; generating a prompt text corresponding to each of the generation tasks according to the second query text and the prompt template corresponding to each of the matching relationships; Inputting the prompt text into the first keyword generation model to obtain a plurality of candidate keywords; Determine the score of each matching relationship between the second query text and each candidate keyword using a relevance discrimination model; sorting the plurality of candidate keywords according to the score of each matching relationship between the second query text and each candidate keyword and the matching levels of the plurality of matching relationships to obtain a sorting result; According to the second query text and the ranking result, a second training sample corresponding to each generation task is constructed.

18. The device of claim 17, wherein: The third acquisition module is used to: Determine a second sample keyword corresponding to each matching relationship according to the score of each matching relationship between the second query text and each candidate keyword and a preset score corresponding to each matching relationship; sorting the second sample keywords respectively corresponding to the multiple matching relationships according to the matching levels of the multiple matching relationships; Obtaining a feedback score of the promotion content corresponding to each of the second sample keywords; The second sample keywords corresponding to the same matching relationship are sorted according to the feedback scores corresponding to the second sample keywords corresponding to the same matching relationship to obtain the sorting result.

19. The apparatus of claim 14, further comprising: A fifth acquisition module, configured to acquire a third training sample; wherein the third training sample includes a third query text, a third keyword sequence, and a matching relationship between the third query text and the third keyword sequence, and the last character of each third sample keyword in the third keyword sequence is a preset character; The third training module is used to train the second keyword generation model using the third training sample to obtain a third keyword generation model.

20. The device according to any one of claims 14 to 19, wherein: The feedback score of the promotion content corresponding to the first sample keyword in at least one of the first training samples is greater than a preset score.

21. A keyword generating device, comprising: A first acquisition module, used to acquire a query text; A generation module, used for generating prompt texts corresponding to each of the multiple generation tasks according to the query text; wherein the prompt texts of different generation tasks contain different matching relationships; The second acquisition module is used to input the prompt text into a keyword generation model to obtain keywords corresponding to each generation task, wherein the keyword generation model is trained using the method described in any one of claims 1 to 7.

22. The device of claim 21, wherein: The second acquisition module is used to: Determine a first candidate character set based on the currently generated characters of the prompt text according to the dictionary tree and the keyword generation model; According to the first candidate character set, the keyword generation model generates the next character, and repeats the above operations of determining the first candidate character set and generating the next character until the last character is generated; wherein the next character is a character in the first candidate character set.

23. The device of claim 22, wherein: The second acquisition module is used to: Adding a preset character to the first candidate character set to obtain a second candidate character set; the preset character is used to indicate that the generated result after the preset character does not meet the requirement; According to the second candidate character set, the keyword generation model generates a next character; wherein the next character is a character in the second candidate character set.

24. The device of claim 22, wherein: The second acquisition module is used to: According to the keyword generation model, obtaining a first generation probability of each candidate character in the first candidate character set; According to the position of the next character to be generated, the generation length of the result to be generated by the model is determined; Normalizing the generation probability of the current result to be generated by the model according to the generation length and the first generation probability of each candidate character to obtain a second generation probability corresponding to each candidate character; Generate the next character according to the second generation probability corresponding to each candidate character.

25. The apparatus of claim 22, further comprising: Loading module, used to load multiple sub-dictionary trees in parallel; The merging module is used to merge the multiple sub-dictionary trees to obtain the dictionary tree.

26. The apparatus of claim 25, further comprising: The third acquisition module is used to acquire a keyword set; A fourth acquisition module, configured to obtain a plurality of sub-keyword sets according to the first character of each keyword in the keyword set; A construction module is used to construct the sub-dictionary tree according to the keywords in each sub-keyword set.

27. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1-7, or to execute the method of any one of claims 8-13.

28. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable the computer to execute the method according to any one of claims 1-7, or to execute the method according to any one of claims 8-13.

29. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 7, or implements the steps of the method according to any one of claims 8 to 13.

Citation Information

Patent Citations

  • Method and device used for generating text on the basis of artificial intelligence

    CN107526725A