Resource recall method and device, electronic equipment and storage medium
By generating target text, using the generative model and candidate vocabulary list, combined with the rule information in the resource library, the problem of inaccurate resource recall in the existing technology is solved, and efficient and accurate resource recall is achieved, suitable for large-scale resources library.
Patent Information
- Application Number
- CN202411545450.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-11
AI Technical Summary
The prior art is difficult to effectively utilize the rule information in the resource library during the resource recall process, resulting in inaccurate recall results. Especially in large-scale resource libraries, the dictionary tree method has storage space and computing resource limitations.
By generating target text, the generation model uses the generation model to generate keyword prefix text based on query text, and gradually generate target text based on the candidate vocabulary list and rule information in the resource library to ensure that the generated target text semantics conform to the resource rules in the resource library information.
It improves the accuracy of resource recall, avoids the storage and computing resource consumption of building dictionary trees, and is suitable for large-scale resource libraries.
Smart Images

Figure CN119415627A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to the field of deep learning, large language models, generative models, and intelligent recommendation technology. More specifically, the present disclosure provides a resource recall method, device, electronic device, storage medium, and computer program product. Background Art
[0002] Resource recall refers to obtaining a portion of resources from the resource library, which is used for subsequent fine sorting, screening, and recommendation. Generally, resource recall can be performed based on the query text (Query) entered by the user. Summary of the invention
[0003] The present disclosure provides a resource recall method, device, electronic device, storage medium and computer program product.
[0004] According to a first aspect, a resource recall method is provided, the method comprising: generating a target text in response to receiving a query text; and recalling a target resource from a resource library according to the target text, wherein the resources in the resource library are configured with rule information, and the semantics of the target text conforms to the rule information of the target resource; wherein, in response to receiving the query text, generating the target text comprises: generating at least one keyword as a prefix text of the target text; and determining a target candidate word from the candidate word list and adding it to the prefix text according to the rule information of the candidate resource determined from the resource library by the prefix text and the candidate word list to obtain the target text.
[0005] According to a second aspect, a resource recall device is provided, which includes: a generation module for generating a target text in response to receiving a query text; and a recall module for recalling a target resource from a resource library according to the target text, wherein the resources in the resource library are configured with rule information, and the semantics of the target text conforms to the rule information of the target resource; wherein the generation module includes: a first generation submodule for generating at least one keyword as a prefix text of the target text; and a second generation submodule for determining a target candidate word from a candidate word list and adding it to the prefix text according to the rule information of the candidate resource determined from the resource library by the prefix text and the candidate word list, so as to obtain the target text.
[0006] According to a third aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method provided according to the present disclosure.
[0007] According to a fourth aspect, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute the method provided according to the present disclosure.
[0008] According to a fifth aspect, a computer program product is provided, comprising a computer program, wherein the computer program is stored on at least one of a readable storage medium and an electronic device, and wherein the computer program implements the method provided according to the present disclosure when executed by a processor.
[0009] 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 disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0011] Figure 1 is a schematic diagram of an exemplary system architecture to which a resource recall method and apparatus can be applied according to an embodiment of the present disclosure;
[0012] Figure 2 is a flow chart of a resource recall method according to an embodiment of the present disclosure;
[0013] Figure 3 is a flowchart of a method for generating a target text according to an embodiment of the present disclosure;
[0014] Figure 4 is a system schematic diagram of a resource recall method according to an embodiment of the present disclosure;
[0015] Figure 5 is a flowchart of a method for training a deep learning model according to an embodiment of the present disclosure;
[0016] Figure 6 is a block diagram of a resource recall device according to an embodiment of the present disclosure;
[0017] Figure 7 The present invention is a block diagram of an electronic device of a resource recall method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure 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 may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0019] In the recommendation system, according to business needs, the resources in the resource library can be configured to be recommended only to users in a specific area, only to a specified group of people, only to users of a specific terminal, etc. That is, the resources in the resource library are subject to the constraints of rule attributes such as region, group, and device, and are configured with corresponding rule information.
[0020] After receiving the query text input by the user, the resources related to the query text and the resources subject to the rule attributes are recalled from the resource library. This process can be called a directed recall process. One directed recall method is to encode the resources in the resource library into a dictionary tree, and different subtrees can be formed according to different rules. By querying the dictionary tree, resources subject to different rules can be recalled.
[0021] The directional recall method based on the dictionary tree has a storage space that is related to the number of nodes, and the hardware storage space limits the node scale. The structure of the dictionary tree is usually stored in the CPU, and the calculation is also performed on the CPU, which is also limited by computing power. Therefore, this method is difficult to apply to large-scale resource libraries. In addition, as the size of the dictionary tree increases, the query performance will degrade, affecting the overall recall efficiency.
[0022] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0023] In the technical solution of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0024] Figure 1 is a schematic diagram of an exemplary system architecture to which a resource recall method and apparatus can be applied according to an embodiment of the present disclosure. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0025] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0026] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Terminal devices 101, 102, 103 can be various electronic devices, including but not limited to smart phones, tablet computers, laptops, etc.
[0027] The resource recall method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the resource recall device provided in the embodiment of the present disclosure can generally be set in the server 105. The resource recall method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the resource recall device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.
[0028] Figure 2 The figure is a flow chart of a resource recall method according to an embodiment of the present disclosure.
[0029] like Figure 2 As shown, the resource recall method 200 includes operations S210 to S220, and operation S210 includes operations S211 to S212.
[0030] In operation S210, in response to receiving a query text, a target text is generated.
[0031] In operation S220, target resources are recalled from a resource library according to the target text, wherein the resources in the resource library are configured with rule information, and the semantics of the target text conforms to the rule information of the target resource.
[0032] The query text may be a query input by the user. Targeted recall of resources refers to recalling resources related to the query and subject to rule attributes from the resource library. Targeted recall requires that the query text conforms to the rule information of the resources to be recalled, while the query input by the user may only contain simple keywords, making it difficult to recall accurate resources. The embodiments of the present disclosure generate a target text based on the query, and use the target text to recall the target resource.
[0033] The resource library is, for example, an advertisement library, and the advertisement resources in the advertisement library are configured with rule information, such as a certain advertisement is only recommended to users in a specific region, a certain advertisement is only recommended to users of a specific group, a certain advertisement is only recommended to users of a specific terminal, etc.
[0034] In the process of generating the target text in operation S210, the generated target text can be controlled to conform to the rule information of the resources in the resource library, so that the generated target text can be used to recall the target resources constrained by the rules. Specifically, operation S210 includes operations S211 to S212.
[0035] In operation S211, at least one keyword is generated as a prefix text of the target text.
[0036] In operation S212, according to the rule information of the candidate resource determined from the resource library by the prefix text and the candidate word list, a target candidate word is determined from the candidate word list and added to the prefix text to obtain a target text.
[0037] A generative model can be used to generate a target text based on the query text. In the process of generating the target text, keywords can be generated one by one, and finally all the generated keywords constitute the target text. The generative model can be a large language model.
[0038] The limited number of candidate entries in the resource library determines that the keywords generated by the generative model are a limited set, that is, the keywords generated by the generative model can be candidate words selected from a limited set of candidate words. Therefore, the process of generating the target text by the generative model can be to first generate at least one keyword as a prefix based on the query, then select candidate words from the candidate word list one by one and add them to the prefix, and finally form the target text.
[0039] In order to control the generation model to generate target text that conforms to resource rule information, before selecting a candidate word from the candidate word list each time, that is, before generating a new keyword, it can be determined whether the semantics of the text composed of the generated prefix and the candidate word to be selected conform to the rule information of the candidate resource in the resource library. The candidate resource can be determined from the resource library by the text composed of the generated prefix and the candidate word to be selected. If the semantics of the text composed of the generated prefix and the candidate word to be selected conform to the rule information of the candidate resource, it can be determined that the candidate word is valid, otherwise the candidate word is invalid. For invalid candidate words, the probability of generating the candidate word can be set to 0, so that the next keyword generated by the generation model is a valid candidate word.
[0040] Before the generation model selects a candidate word each time, it determines whether the candidate word is valid, so that the text composed of each selected candidate word and prefix conforms to the rule information of the candidate resource. Finally, the generated target text conforms to the rule information of the target resource.
[0041] The embodiments of the present disclosure control the generation of target text that conforms to the rule information of resources in the resource library, and use the target text to recall target resources, so as to recall the resources related to the query text and subject to the rule attributes, thereby improving the accuracy of resource recall.
[0042] Compared with the method of recalling resources by querying a dictionary tree in the related art, the embodiments of the present disclosure do not need to construct a dictionary tree, thus avoiding occupying storage space and computing resources and improving the recall efficiency.
[0043] Figure 3 is a flow chart of a method for generating a target text according to an embodiment of the present disclosure.
[0044] like Figure 3 As shown, this embodiment includes operations S310 to S360, wherein operations S320 to S330 are operations performed on each candidate word in the candidate word list.
[0045] In operation S310, at least one keyword is generated as a prefix text.
[0046] The user inputs a query text Query, and the generation model generates at least one keyword as a prefix text for Query. The at least one keyword can be a candidate word selected from a candidate word list.
[0047] In operation S320, candidate resources, rule information of the candidate resources, and rule text are determined from a resource library according to the prefix text and the candidate words.
[0048] In operation S330, the generation probability of the candidate word is determined according to the query text, the prefix text, the candidate word, and the rule text.
[0049] The generative model continues to generate the next keyword, that is, selects the next candidate word from the candidate word list. Before the generative model calculates the generation probability of each candidate word in the candidate word list, for each candidate word, the prefix text generated by the generative model and the text composed of the candidate word can be used to determine the candidate resource from the resource library. The candidate resource has rule information, and the rule text corresponding to the rule information can be determined.
[0050] Next, for each candidate word, the semantic consistency between the query text, prefix text and candidate word combination text and the rule text can be determined. If the semantics are consistent, it means that the query text, prefix text and candidate word combination text conform to the rule information of the candidate resource, and the candidate word can be used as a valid candidate word. If the semantics are inconsistent, it means that the query text, prefix text and candidate word combination text do not conform to the rule information of the candidate resource, and the candidate word is an invalid candidate word.
[0051] Through the above steps, it can be determined whether each candidate word in the candidate word list is an invalid candidate word. For invalid candidate words, the generation probability of the invalid candidate word can be set to 0, so that the keyword generated by the generation model next is selected from the valid candidate words.
[0052] For example, a feature vector of the combined text is obtained; in response to the semantic inconsistency between the combined text and the regular text, the weight of the candidate word features in the feature vector is adjusted; and based on the adjusted feature vector, the generation probability of the candidate word is determined.
[0053] For example, before the generative model calculates the generation probability of the next candidate word (i.e., each candidate word in the candidate word list), the output of the generative model is the feature vector for the combined text [Query, prefix text, candidate word], which can be recorded as Logits. When there are multiple queries, Logits is a feature matrix with a size of [B, V], where B is the batch size, i.e., the number of queries, and V is the candidate word list size, i.e., the number of candidate words in the candidate word list.
[0054] After determining whether each candidate word in the candidate word list is an invalid candidate word, the weight of the feature of the invalid candidate word in the feature vector can be adjusted, for example, a bias of -10000 is added to the feature of the invalid candidate word, so that when the generation model calculates the probability in the next step, the probability of the invalid candidate word is close to 0. The features of the valid candidate words in the feature vector can remain unchanged, so that the generation model can normally calculate the generation probability of the valid candidate words when calculating the probability in the next step. In this way, the purpose of controlling the generation of candidate words is achieved.
[0055] In operation S340, a target candidate word is determined from the candidate word list and added to the prefix text to obtain a new prefix text.
[0056] After obtaining the generation probability of each candidate word in the candidate word list, the candidate word with the highest generation probability can be determined from the candidate word list as the target candidate word and added to the prefix text to obtain a new prefix text.
[0057] In operation S350, it is determined whether the prefix text meets the preset condition. If yes, operation S360 is executed, otherwise, the process returns to execute operation S320.
[0058] In operation S360, the prefix text meeting the preset condition is determined as the target text.
[0059] The preset condition is, for example, that the number of characters or words in the generated prefix text reaches a threshold value (e.g., 6). If the threshold value is reached, the generated prefix text can be determined as the target text, which can be used to recall the target resource. If the threshold value is not reached, the operation S320 can be returned to, that is, the generation model is continuously controlled to generate the next candidate word until the obtained prefix text meets the preset condition.
[0060] The embodiment of the present disclosure achieves the purpose of controlling the generation model to generate a target text that conforms to the resource rule information in the resource library by controlling each candidate word generated by the generation model to conform to the rule information of the candidate resource, thereby making the resources recalled using the target text more accurate.
[0061] Figure 4 It is a system diagram of a resource recall method according to an embodiment of the present disclosure.
[0062] like Figure 4 As shown, the system of this embodiment includes a generation model 410 , a discrimination model 420 , and a resource library 430 .
[0063] The generation model 410 can be obtained by supervised training based on the resource library 430. The generation model 410 can be a large language model with parameters of up to 10 to 10 billion orders of magnitude. During the training process of the generation model 410, the resources in the resource library 430 are used as samples, the input is the query of the sample resources, and the output is the description text of the sample resources. For example, if the resource is an advertisement, the description text of the resource can be the title or content of the advertisement. With the real description text of the resources in the resource library as supervision, the trained generation model 410 can have the ability to generate resource description text or resource description text keywords. However, the generation model 410 has a strong generalization ability, and the generated resource description text may not conform to the constraint rules of the resources in the resource library 430. For example, the resources in the resource library 430 have regional constraint rules (for example, a resource is only recommended to users in a specific region), and the resource description text generated by the generation model 410 does not have this constraint, and the resources recalled using the generated resource description text may be inaccurate.
[0064] Therefore, the embodiment of the present disclosure uses the discriminant model 420 to control the generation process of the generative model 410, so that the generative model 410 generates a target text that conforms to the rule information of the resources in the resource library 430. The discriminant model 420 is described in detail below.
[0065] According to an embodiment of the present disclosure, the combined text and the regular text are input into a deep learning model to obtain a semantic consistency result between the combined text and the regular text.
[0066] The discriminant model 420 may be a trained lightweight deep learning model, and the model parameters may be in the tens of millions. The input of the model may include a query text, a prefix text, a candidate word, and a rule text, and the output may be the semantic consistency between the combined text composed of the query text, the prefix text, and the candidate word and the rule text of the candidate resource. For example, the output result of the discriminant model 420 may be 0 or 1, 0 indicating that the semantics of the combined text and the rule text are inconsistent, and 1 indicating that the semantics of the combined text and the rule text are consistent.
[0067] The control of the generation result of the generation model 410 by the discriminant model 430 occurs before the generation model 410 calculates the probability of the next candidate word. The keywords (or the candidate words that have been selected) generated by the generation model 410 are used as prefix texts, and each candidate word in the candidate word list is used as the next candidate word. The text composed of the prefix text and the next candidate word is used to determine the candidate resource, and then the rule text of the candidate resource is determined. Therefore, it can be obtained that each of "Query, prefix text, next candidate word, rule text" is known.
[0068] In one example, the number of next candidate words can be the number V of candidate words in the candidate word list, so V phrases of [Query, prefix text, next candidate word, rule text] can be formed, and each phrase is input into the discriminant model 420. The discriminant model 420 determines whether the semantics of "Query, prefix text, next candidate word" in the phrase is consistent with the semantics of the rule text, that is, whether "Query, prefix text, next candidate word" conforms to the rule information. If it conforms, the "next candidate word" in the phrase is a valid candidate word, otherwise it is an invalid candidate word. Before the generation model 410 calculates the probability of the next candidate word, the output of the generation model 410 is a feature vector of "Query, prefix text, next candidate word". After determining whether the next candidate word is invalid, the feature of the invalid candidate word can be added with a bias of -10000 in the feature vector generated by the generation model 410. Then, when the generation model 410 calculates the probability in the next step, the probability of the invalid candidate word is close to 0. In this way, the purpose of controlling the generation of candidate words is achieved. Since the generation of candidate words is controlled each time to make them conform to the rule information of the candidate resources, the target text finally generated conforms to the rule information of the target resources.
[0069] In another example, there are many candidate words in the candidate word list. In order to reduce the scale, the candidate words can be first encoded into vectors by the encoder, and then the vectors are clustered to obtain N candidate IDs. The query text Query, the prefix text, the candidate words in the candidate word list, and the rule text are also encoded into vectors by the encoder, and then N [Query ID, prefix text ID, next candidate ID, rule text ID] phrases can be formed. Each phrase is input into the discriminant model 420. The discriminant model 420 determines whether the semantics of "Query ID, prefix text ID, next candidate ID" in the phrase is consistent with the semantics of the rule text ID. If so, the candidate word corresponding to the "next candidate word ID" in the phrase is a valid candidate word, otherwise it is an invalid candidate word. In the feature vector generated by the generation model 410, the feature of the invalid candidate word is added with a bias of -10000. When the generation model 410 calculates the probability in the next step, the probability of the invalid candidate word is close to 0. In this way, the purpose of controlling the generation of candidate words is achieved. Since the generation of candidate words is controlled each time to make them conform to the rule information of the candidate resources, the target text finally generated conforms to the rule information of the target resources.
[0070] After obtaining the target text, the target text may be used to search the resource library 430 and retrieve the target resource from the resource library 430 .
[0071] The embodiment of the present disclosure uses a discriminant model to control the generation model to generate a target text that conforms to the resource rule information in the resource library, thereby achieving the effect of using a discriminant model to simulate the rule dictionary tree of the resource library. Compared with building a dictionary tree, using a lightweight discriminant model to simulate a dictionary tree can reduce storage space and resource usage, and improve resource recall efficiency.
[0072] The discriminant model is a trained deep learning model. The training method of the deep learning model is described below.
[0073] Figure 5 It is a flowchart of a method for training a deep learning model according to an embodiment of the present disclosure.
[0074] like Figure 5 As shown, the training method 500 of the deep learning model includes operations S510~S540.
[0075] In operation S510, a sample text of a sample resource is obtained, wherein the sample text includes a query text corresponding to the sample resource, a subtext extracted from a description text of the sample resource, and a rule text of the sample resource.
[0076] The deep learning model can be trained based on the resource library. The resources in the resource library are sample resources, and the sample resources have resource description text. For example, if the resource is an advertisement, the resource description text may include the advertisement title or content.
[0077] A portion of subtext may be extracted from the description text of the sample resource, and the subtext represents the prefix text generated by the generation model. In addition, the rule text corresponding to the rule information of the sample resource and the query text corresponding to the sample resource are determined.
[0078] The query text corresponding to the sample resource, the subtext of the sample resource, and the rule text of the sample resource can be composed of sample text to serve as the input of the deep learning model.
[0079] In operation S520, the sample text is input into the deep learning model to obtain an output result, wherein the output result represents the semantic consistency between the combined text of the query text and the subtext in the sample text and the rule text.
[0080] The goal of the deep learning model is to determine whether the combined text of the query text and the subtext in the sample text is consistent with the semantics of the rule text. If they are consistent, it means that the prefix text generated by the generative model represented by the subtext conforms to the rule information of the resources in the resource library. Otherwise, it means that the prefix text generated by the generative model represented by the subtext does not conform to the rule information of the resources in the resource library.
[0081] The output results of the deep learning model can be represented by 0 or 1, where 0 indicates that the combined text of the query text and subtext in the sample text is inconsistent with the semantics of the rule text, and 1 indicates that the combined text of the query text and subtext in the sample text is consistent with the semantics of the rule text.
[0082] In operation S530, a loss of the deep learning model is determined according to the output result.
[0083] For example, the loss of the deep learning model can be calculated using a preset loss function based on the actual semantic consistency between the combined text of the query text and subtext in the sample text and the rule text, and the semantic consistency between the combined text and the rule text output by the deep learning model.
[0084] In operation S540, parameters of the deep learning model are adjusted according to the loss.
[0085] According to the loss, the gradient descent method or back propagation algorithm can be used to adjust the parameters of the deep learning model to complete a round of training. After multiple rounds of training, the trained deep learning model can achieve a high accuracy rate in judging the semantic consistency between the combined text and the regular text, for example, more than 97%.
[0086] The embodiments of the present disclosure train a deep learning model so that the deep learning model has the ability to judge the semantic consistency between the combined text and the rule text, so that it can be used to control the generation model to generate the target text that conforms to the resource rule information in the resource library, making the resource recall more accurate.
[0087] According to an embodiment of the present disclosure, the sample text includes a positive sample and a negative sample, the combined text of the query text and the subtext in the positive sample is consistent with the semantics of the rule text, and the combined text of the query text and the subtext in the negative sample is inconsistent with the semantics of the rule text. Operation S530 includes determining the positive sample loss according to the output result of the positive sample; determining the negative sample loss according to the output result of the negative sample; and determining the overall loss of the deep learning model according to the positive sample loss and the negative sample loss.
[0088] When constructing sample texts for a deep learning model, the labels of the sample texts can be determined. Among them, sample texts in which the semantics of the combined text and the rule text are consistent are positive samples, and the label is 1. Sample texts in which the semantics of the combined text and the rule text are inconsistent are negative samples, and the label is 0. The positive samples and negative samples are input into the deep learning model for training, and the training is performed with the output of the positive sample as 1 and the output of the negative sample as 0 as the target.
[0089] During the training process, the positive sample loss can be determined based on the difference between the output of the positive sample and the label of the positive sample, the negative sample loss can be determined based on the difference between the output of the negative sample and the label of the negative sample, and the overall loss of the deep learning model can be determined based on the sum or weighted sum of the positive sample loss and the negative sample loss. This overall loss is used to adjust the parameters of the deep learning model, so that the deep learning model can recognize semantically consistent combined texts and regular texts, as well as semantically inconsistent combined texts and regular texts, thereby improving the discrimination accuracy of the deep learning model.
[0090] According to an embodiment of the present disclosure, the present disclosure also provides a resource recall device.
[0091] Figure 6 is a block diagram of a resource recall device according to an embodiment of the present disclosure.
[0092] like Figure 6 As shown, the resource recall device 600 includes a generation module 610 and a recall module 620 .
[0093] The generating module 610 is used to generate a target text in response to receiving a query text.
[0094] The recall module 620 is used to recall the target resource from the resource library according to the target text, wherein the resource in the resource library is configured with rule information, and the semantics of the target text conforms to the rule information of the target resource.
[0095] The generation module 610 includes a first generation submodule and a second generation submodule.
[0096] The first generating submodule is used to generate at least one keyword as a prefix text of the target text.
[0097] The second generation submodule is used to determine a target candidate word from the candidate word list and add it to the prefix text to obtain the target text according to the rule information of the candidate resource determined from the resource library by the prefix text and the candidate word list.
[0098] The second generation submodule includes a probability determination unit, a prefix update unit, a return unit, and a target text determination unit.
[0099] The probability determination unit is used to determine the generation probability of each candidate word in the candidate word list according to the rule information of the candidate resource determined from the resource library by the prefix text and the candidate word.
[0100] The prefix updating unit is used to determine the target candidate word from the candidate word list according to the generation probability and add it to the prefix text to obtain a new prefix text.
[0101] The return unit is used to return the step executed by the probability determination unit to determine the generation probability of each candidate word in the candidate word list according to the rule information of the candidate resource determined by the prefix text and the candidate word from the resource library, until the prefix text meets the preset conditions.
[0102] The target text determination unit is used to determine the prefix text that meets the preset conditions as the target text.
[0103] The probability determination unit includes a candidate resource determination subunit, a rule text determination subunit and a probability determination subunit.
[0104] The candidate resource determination subunit is used to determine a candidate resource from a resource library according to a prefix text and the candidate word for each candidate word in the candidate word list.
[0105] The rule text determination subunit is used to determine the rule text of the rule information of the candidate resource.
[0106] The probability determination subunit is used to determine the generation probability of the candidate word according to the query text, the prefix text, the candidate word, and the rule text.
[0107] The probability determination subunit is also used to determine the combined text of the query text, the prefix text and the candidate word; determine the semantic consistency between the combined text and the rule text; and determine the generation probability of the candidate word based on the semantic consistency.
[0108] The probability determination subunit is also used to obtain a feature vector of the combined text; in response to the semantic inconsistency between the combined text and the regular text, adjust the weight of the candidate word features in the feature vector; and determine the generation probability of the candidate word based on the adjusted feature vector.
[0109] The probability determination subunit is also used to input the combined text and the regular text into the deep learning model to obtain the semantic consistency results of the combined text and the regular text.
[0110] According to an embodiment of the present disclosure, the deep learning model is obtained through training, and the resource recall device 600 also includes a sample determination module, a model processing module, a loss determination module and a parameter adjustment module.
[0111] The sample determination module is used to obtain sample text of the sample resource, wherein the sample text includes a query text corresponding to the sample resource, a subtext intercepted from the description text of the sample resource, and a rule text of the sample resource.
[0112] The model processing module is used to input the sample text into the deep learning model to obtain an output result, wherein the output result represents the semantic consistency between the combined text of the query text and the sub-text in the sample text and the rule text.
[0113] The loss determination module is used to determine the loss of the deep learning model based on the output results.
[0114] The parameter adjustment module is used to adjust the parameters of the deep learning model according to the loss.
[0115] The sample text includes positive samples and negative samples. The combination of the query text and the subtext in the positive sample is consistent with the semantics of the rule text, and the combination of the query text and the subtext in the negative sample is inconsistent with the semantics of the rule text. The loss determination module includes a positive sample loss determination submodule, a negative sample loss determination submodule and an overall loss determination submodule.
[0116] The positive sample loss determination submodule is used to determine the positive sample loss according to the output result of the positive sample.
[0117] The negative sample loss determination submodule is used to determine the negative sample loss according to the output results of the negative samples.
[0118] The overall loss determination submodule is used to determine the overall loss of the deep learning model based on the positive sample loss and the negative sample loss.
[0119] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0120] Figure 7A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure 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 disclosure described and / or required herein.
[0121] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0122] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0123] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as the resource recall method. For example, in some embodiments, the resource recall method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the resource recall method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the resource recall method in any other appropriate manner (e.g., by means of firmware).
[0124] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can 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.
[0125] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may 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, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may 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.
[0126] In the context of the present disclosure, 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. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0127] 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).
[0128] The systems and techniques described herein may be implemented in a computing system that includes back-end 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 front-end 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 back-end components, middleware components, or front-end 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: a local area network (LAN), a wide area network (WAN), and the Internet.
[0129] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0130] 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 disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0131] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. 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 modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A resource recall method, comprising: In response to receiving the query text, generating a target text; as well as Recalling a target resource from a resource library according to the target text, wherein the resource in the resource library is configured with rule information, and the semantics of the target text conforms to the rule information of the target resource; Wherein, in response to receiving the query text, generating the target text comprises: generating at least one keyword as a prefix text of the target text; and According to the rule information of the candidate resource determined from the resource library by the prefix text and the candidate word list, a target candidate word is determined from the candidate word list and added to the prefix text to obtain the target text.
2. The method according to claim 1, wherein: The step of determining a target candidate word from the candidate word list and adding it to the prefix text according to the rule information of the candidate resource determined from the resource library by the prefix text and the candidate word list to obtain the target text comprises: For each candidate word in the candidate word list, determining a generation probability of the candidate word according to rule information of a candidate resource determined by the prefix text and the candidate word from the resource library; According to the generation probability, determining a target candidate word from the candidate word list and adding it to the prefix text to obtain a new prefix text; Returning the step of determining the generation probability of each candidate word in the candidate word list according to the rule information of the candidate resource determined by the prefix text and the candidate word from the resource library, until the prefix text meets the preset condition; and The prefix text that meets the preset condition is determined as the target text.
3. The method according to claim 2, wherein: The step of determining the generation probability of each candidate word in the candidate word list according to the rule information of the candidate resource determined from the resource library by the prefix text and the candidate word comprises: for each candidate word in the candidate word list, Determining a candidate resource from the resource library according to the prefix text and the candidate word; Determining a rule text of the rule information of the candidate resource; and The generation probability of the candidate word is determined according to the query text, the prefix text, the candidate word, and the rule text.
4. The method according to claim 3, wherein: The determining the generation probability of the candidate word according to the query text, the prefix text, the candidate word, and the rule text comprises: Determine a combined text of the query text, the prefix text and the candidate word; determining semantic consistency between the combined text and the regular text; and According to the semantic consistency, the generation probability of the candidate word is determined.
5. The method according to claim 4, wherein: Determining the generation probability of the candidate word according to the semantic consistency includes: Obtaining a feature vector of the combined text; In response to the semantic inconsistency between the combined text and the regular text, adjusting the weights of the candidate word features in the feature vector; and The generation probability of the candidate word is determined according to the adjusted feature vector.
6. The method according to claim 4, wherein: Determining the semantic consistency between the combined text and the regular text includes: The combined text and the regular text are input into a deep learning model to obtain a semantic consistency result between the combined text and the regular text.
7. The method according to claim 6, wherein: The deep learning model is trained by the following operations: Acquire a sample text of a sample resource, wherein the sample text includes a query text corresponding to the sample resource, a subtext intercepted from a description text of the sample resource, and a rule text of the sample resource; Inputting the sample text into a deep learning model to obtain an output result, wherein the output result represents the semantic consistency between the combined text of the query text and the subtext in the sample text and the rule text; Determining the loss of the deep learning model according to the output result; and Based on the loss, parameters of the deep learning model are adjusted.
8. The method according to claim 7, wherein: The sample text includes a positive sample and a negative sample, the combined text of the query text and the subtext in the positive sample is consistent with the semantics of the regular text, and the combined text of the query text and the subtext in the negative sample is inconsistent with the semantics of the regular text; Determining the loss of the deep learning model according to the output result includes: Determine the positive sample loss according to the output result of the positive sample; Determine a negative sample loss according to the output result of the negative sample; and An overall loss of the deep learning model is determined according to the positive sample loss and the negative sample loss.
9. A resource recall device, comprising: A generating module, for generating a target text in response to receiving a query text; as well as A recall module, used to recall target resources from a resource library according to the target text, wherein the resources in the resource library are configured with rule information, and the semantics of the target text conforms to the rule information of the target resource; Wherein, the generation module includes: A first generating submodule is used to generate at least one keyword as a prefix text of the target text; and The second generation submodule is used to determine a target candidate word from the candidate word list and add it to the prefix text to obtain the target text according to the rule information of the candidate resource determined from the resource library by the prefix text and the candidate word list.
10. The device according to claim 9, wherein: The second generation submodule includes: A probability determination unit, configured to determine, for each candidate word in the candidate word list, a generation probability of the candidate word according to rule information of a candidate resource determined by the prefix text and the candidate word from the resource library; A prefix updating unit, configured to determine a target candidate word from the candidate word table according to the generation probability and add the target candidate word to the prefix text to obtain a new prefix text; a returning unit, configured to return the step of determining the generation probability of each candidate word in the candidate word list according to the rule information of the candidate resource determined by the prefix text and the candidate word from the resource library, executed by the probability determination unit, until the prefix text meets the preset condition; and The target text determination unit is used to determine the prefix text that meets the preset condition as the target text.
11. The device according to claim 10, wherein: The probability determination unit comprises: A candidate resource determination subunit, configured to determine a candidate resource from the resource library according to the prefix text and the candidate word for each candidate word in the candidate word list; A rule text determination subunit, used to determine the rule text of the rule information of the candidate resource; and The probability determination subunit is used to determine the generation probability of the candidate word according to the query text, the prefix text, the candidate word, and the rule text.
12. The device according to claim 11, wherein The probability determination subunit is further used to determine a combined text of the query text, the prefix text and the candidate word; determine the semantic consistency between the combined text and the rule text; and determine the generation probability of the candidate word based on the semantic consistency.
13. The device according to claim 12, wherein: The probability determination subunit is also used to obtain a feature vector of the combined text; in response to the semantic inconsistency between the combined text and the regular text, adjust the weight of the candidate word features in the feature vector; and determine the generation probability of the candidate word based on the adjusted feature vector.
14. The device according to claim 12, wherein: The probability determination subunit is also used to input the combined text and the regular text into a deep learning model to obtain a semantic consistency result between the combined text and the regular text.
15. The device according to claim 14, wherein: The deep learning model is obtained through training; the device also includes: A sample determination module, configured to obtain a sample text of a sample resource, wherein the sample text includes a query text corresponding to the sample resource, a subtext intercepted from a description text of the sample resource, and a rule text of the sample resource; A model processing module, used for inputting the sample text into a deep learning model to obtain an output result, wherein the output result represents the semantic consistency between the combined text of the query text and the subtext in the sample text and the rule text; a loss determination module, configured to determine the loss of the deep learning model according to the output result; and A parameter adjustment module is used to adjust the parameters of the deep learning model according to the loss.
16. The device according to claim 15, wherein: The sample text includes a positive sample and a negative sample, the combined text of the query text and the subtext in the positive sample is consistent with the semantics of the rule text, and the combined text of the query text and the subtext in the negative sample is inconsistent with the semantics of the rule text; the loss determination module includes: A positive sample loss determination submodule, used to determine the positive sample loss according to the output result of the positive sample; A negative sample loss determination submodule, used to determine the negative sample loss according to the output result of the negative sample; and The overall loss determination submodule is used to determine the overall loss of the deep learning model according to the positive sample loss and the negative sample loss.
17. 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 perform the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 8.
19. A computer program product, comprising a computer program, wherein the computer program is stored on at least one of a readable storage medium and an electronic device, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Advertisement search model construction method and device, electronic equipment and storage medium
CN121168639A