Intention question generation method and device, electronic equipment and readable storage medium
Generating intention problems through large language models, the problem of insufficient generation of intention problems in the prior art is solved, and efficient and accurate user intention understanding and response are achieved.
Patent Information
- Application Number
- CN202411864659.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-05-13
AI Technical Summary
When generating intention problems for determining the true intention of the user, the prior art have problems such as serious cold start problems and poor scalability.
By obtaining the query content, determining the target task category, and using a large language model to generate multiple candidate texts, calculating the target fuzzy value based on the semantic vector of the candidate text, dynamically obtaining the second prompt text, and finally generating the intent problem.
It solves the cold start problem in the generation of intention problems, reduces the generation cost, simplifies the generation steps, improves the generation efficiency and accuracy, and enhances the understanding and response to the user's true intentions.
Smart Images

Figure CN119990304A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to the field of artificial intelligence technology such as natural language processing, deep learning, and large language models. A method, device, electronic device, and readable storage medium for generating an intention question are provided. Background Art
[0002] With the rapid development of artificial intelligence, human-computer interaction technology has brought great convenience to people's daily lives. How to accurately understand the user's true intention during human-computer interaction is crucial for task planning and interactive experience.
[0003] However, in actual application scenarios, the query content entered by the user may contain missing information or semantic ambiguity. In this case, corresponding questions need to be generated to further understand the user's true intention and complete the corresponding task planning. Summary of the invention
[0004] According to a first aspect of the present disclosure, a method for generating an intention question is provided, including: obtaining a query content, and obtaining a target task category according to the query content; obtaining a target first prompt text corresponding to the target task category, and using a target large language model to generate a plurality of candidate texts according to the target first prompt text and the query content; obtaining a target fuzzy value corresponding to the query content according to semantic vectors of the plurality of candidate texts; obtaining a target second prompt text corresponding to the target task category based on the target fuzzy value; and using the target large language model to generate an intention question corresponding to the query content according to the target second prompt text and the query content.
[0005] According to a second aspect of the present disclosure, a device for generating an intention question is provided, comprising: a first processing unit, configured to obtain a query content, and obtain a target task category according to the query content; a first generating unit, configured to obtain a target first prompt text corresponding to the target task category, and generate a plurality of candidate texts according to the target first prompt text and the query content using a target large language model; a determining unit, configured to obtain a target fuzzy value corresponding to the query content according to semantic vectors of the plurality of candidate texts; a second processing unit, configured to obtain a target second prompt text corresponding to the target task category based on the target fuzzy value; and a second generating unit, configured to generate an intention question corresponding to the query content according to the target second prompt text and the query content using the target large language model.
[0006] According to a third aspect of the present disclosure, 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 as described above.
[0007] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method as described above.
[0008] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the method as described above 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 according to a first embodiment of the present disclosure;
[0012] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;
[0013] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;
[0014] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure;
[0015] Figure 5 The present invention is a block diagram of an electronic device for implementing the method for generating an intended question according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0016] 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, the description of well-known functions and mechanisms is omitted in the following description.
[0017] When generating intent questions for determining the true intent of a user, the prior art usually adopts a method of training a relevant question generation model through supervised fine-tuning, and then using the question generation model to obtain the corresponding intent questions. Therefore, the prior art has problems such as severe cold start problems and poor scalability when generating intent questions. In order to solve the above technical problems, the present disclosure provides the following embodiments.
[0018] Figure 1 Schematic diagram of the first embodiment of the present disclosure. Figure 1 As shown, the method for generating the intention question of this embodiment specifically includes the following steps:
[0019] S101, obtaining query content, and obtaining a target task category according to the query content;
[0020] S102, obtaining a target first prompt text corresponding to the target task category, and using a target large language model to generate a plurality of candidate texts according to the target first prompt text and the query content;
[0021] S103, obtaining a target fuzzy value corresponding to the query content according to the semantic vectors of the multiple candidate texts;
[0022] S104, based on the target fuzzy value, obtaining a target second prompt text corresponding to the target task category;
[0023] S105: Using the target large language model, generate an intention question corresponding to the query content according to the target second prompt text and the query content.
[0024] The method for generating intention questions in this embodiment, on the one hand, makes use of the text generation capability of the target large language model to generate intention questions according to the target first prompt text and the target second prompt text corresponding to the target task category, without the need to specially train a model for generating intention questions, thereby solving the cold start problem when generating intention questions, thereby reducing the generation cost of intention questions, simplifying the generation steps of intention questions, and improving the generation efficiency of intention questions. On the other hand, according to the semantic vectors of multiple candidate texts generated by the target large language model, to obtain the target fuzzy value corresponding to the query content, it is possible to improve the accuracy of the obtained target fuzzy value, thereby achieving the purpose of dynamically determining whether it is necessary to generate an intention question according to the target fuzzy value, thereby improving the generation flexibility and generation accuracy of intention questions.
[0025] In this embodiment, the intent questions corresponding to the query content are questions used to determine the user's true intentions, such as questions used to determine the points of interest actually queried by the user, questions used to determine the user's actual navigation destination, questions used to determine the items actually queried by the user, etc.; by using the generated intent questions to interact with the user, it is possible to better understand uncertain, incomplete or ambiguous query content, obtain more comprehensive information, and thereby ensure an accurate response to the user's true intentions.
[0026] When executing S101 in this embodiment, the text input by the user through the input terminal may be obtained as the query content.
[0027] For example, if the execution subject of the method for generating intention questions in this embodiment can be a map APP (Application) in a mobile terminal, when executing S101, this embodiment can obtain the text entered by the user in the query box in the map APP as the query content.
[0028] In addition, when executing S101 to obtain query content, this embodiment can also adopt the following implementation method: obtain voice data input by the user, such as obtaining voice data input by the user after triggering the voice interaction function in the APP; convert the obtained voice data into text, and use the converted text as the query content.
[0029] With the rapid development of mobile terminal technology, more and more APPs have the function of voice interaction. Users can improve the convenience of using APPs by performing voice interaction with APPs; therefore, when executing S101, this embodiment can obtain query content based on the voice data input by the user when performing voice interaction with the APP.
[0030] In this embodiment, after executing S101 to obtain the query content, the target task category can be obtained according to the obtained query content.
[0031] In this embodiment, different application fields may include different task categories; for example, for the map application field, it may include POI (Point of Interest) query task category, navigation task category, taxi task category, bus query task category, etc.; for the e-commerce application field, it may include item query task category, order placement task category, order query task category, etc.
[0032] When executing S101 to obtain the target task category according to the query content, the implementation method that can be adopted in this embodiment is: obtaining the task classification prompt text (the prompt text is prompt); using the large language model to generate the target task category according to the task classification prompt text and the query content.
[0033] The task classification prompt text obtained by executing S101 in this embodiment may be "perform task classification on the input text and output the corresponding task category"; wherein, the task classification prompt text in this embodiment is a zero-sample prompt text, that is, the task classification prompt text does not include any examples.
[0034] In this embodiment, a large language model (LLM) refers to a type of deep learning model with a large number of parameters, which is mainly used for natural language processing tasks. The large language model is based on an advanced neural network architecture and learns rich knowledge through unsupervised or weakly supervised pre-training on a large-scale text corpus. After appropriate fine-tuning, the large language model can perform well in a variety of downstream tasks, including but not limited to text generation tasks, machine translation tasks, question-answering tasks, dialogue tasks, etc.
[0035] The target large language model in this embodiment can be a large language model with a large number of parameters (i.e., a large model) or a large language model with a small number of parameters (i.e., a small model); wherein the large model can be used to process natural language processing tasks in different application fields, while the small model can only process natural language processing tasks in specific application fields.
[0036] For example, if the application field in this embodiment is a map application field, then when executing S101, this embodiment can obtain a small model corresponding to the map application field as the target large language model; that is, different target large language models in this embodiment correspond to different application fields.
[0037] After executing S101 to obtain the target task category, this embodiment executes S102 to obtain a target first prompt text corresponding to the target task category, and uses a target large language model to generate multiple candidate texts according to the target first prompt text and the query content.
[0038] In this embodiment, the target first prompt text is a few-sample prompt text; that is, the target first prompt text includes a plurality of first examples corresponding to the target task category.
[0039] When executing S102 to obtain the target first prompt text corresponding to the target task category, this embodiment can obtain the first prompt text corresponding to the target task category according to the corresponding relationship between the preset task category and the first prompt text as the target first prompt text.
[0040] In this embodiment, the target first prompt text obtained by executing S102 may be "Please combine the following examples to generate text of a specific task category according to the input text, first example 1, first example 2, first example 3...".
[0041] For example, if the target task category is a navigation task category, the examples in the target first prompt text corresponding to the "navigation task category" in this embodiment may include the first example 1 "Input: self-driving route to city A, output: query navigation route (current location, city A, transportation method "driving")", the first example 2 "Input: navigate to the zoo in city B, output: query navigation route (current location, zoo in city B, transportation method "driving")", the first example 3 "Input: pass through location B and location C when going to location A, output: query navigation route (current location, location A, transportation method "driving", passing points (location B, location C))", etc.
[0042] For example, if the target task category is a POI query task category, the examples in the target first prompt text corresponding to the "POI query task category" in this embodiment may include the first example 4 "Input: Query the flow of visitors to City C Museum on Wednesdays, Output: Query location-related information (City C Museum, flow of visitors on Wednesdays)", the first example 5 "Input: Find nearby restaurant A, Output: Search for places of a specific category (near the current location, category "restaurant A", quantity "n"), the first example 6 "Input: Find nearby free parking lots, Output: Search for places of a specific category or feature (near the current location, category "parking lot", feature "free", quantity "n"), etc.
[0043] When executing S102, the present embodiment uses the target large language model to generate multiple candidate texts according to the target first prompt text and the query content. The target first prompt text and the query content can also be input into the target large language model multiple times to obtain multiple candidate texts according to the output result of each time of the target large language model. Among them, the present embodiment can input the target first prompt text and the query content into the target large language model multiple times according to a preset number of times.
[0044] That is to say, this embodiment can utilize the randomness of the target large language model itself when generating content, and obtain multiple candidate texts by inputting the same content (ie, the target first prompt text and the query content) into the target large language model multiple times.
[0045] After executing S102 to generate multiple candidate texts, this embodiment executes S103 to obtain a target fuzzy value corresponding to the query content according to the semantic vectors of the generated multiple candidate texts.
[0046] In this embodiment, when the query content itself is complete, definite or clear, the semantic differences between different candidate texts generated by the target large language model based on the query content and different example sampling results are usually small, that is, the target large language model will use similar interpretation methods to generate different candidate texts with relatively fixed semantics based on different examples in the prompt text and complete, definite or clear query content.
[0047] When the query content itself is incomplete, uncertain or ambiguous, the target large language model usually generates large semantic differences between different candidate texts based on the query content and different example sampling results. That is, the target large language model uses different interpretation methods to generate different candidate texts with relatively floating semantics based on different examples in the prompt text and incomplete, uncertain or ambiguous query content.
[0048] Therefore, this embodiment uses the above idea to obtain the target fuzzy value corresponding to the query content according to the semantic vectors of different candidate texts generated by the target large language model from the same query content and different example sampling results.
[0049] When executing S103 and obtaining the target fuzzy value corresponding to the query content according to the semantic vectors of multiple candidate texts, this embodiment can first perform embedding processing on the multiple candidate texts respectively, and obtain the semantic vector of each candidate text according to the processing result; then, based on the semantic vector, obtain the semantic similarity between different candidate texts; finally, based on the multiple semantic similarities obtained, obtain the target fuzzy value corresponding to the query content.
[0050] When executing S103 to obtain the target fuzzy value corresponding to the query content based on the multiple semantic similarities obtained, this embodiment can first calculate the average similarity of the multiple semantic similarities, and then use the fuzzy value corresponding to the average similarity as the target fuzzy value corresponding to the query content; or first calculate the sum of the similarities between the multiple semantic similarities, and then use the fuzzy value corresponding to the sum of the similarities as the target fuzzy value corresponding to the query content.
[0051] It can be understood that, the larger the average similarity value or the sum of similarities in this embodiment is, the smaller the target fuzzy value corresponding to the query content will be. The smaller the target fuzzy value is, the more complete, certain or clear the query content is. Conversely, the smaller the target fuzzy value is, the more incomplete, uncertain or vague the query content is.
[0052] After executing S103 to obtain the target fuzzy value corresponding to the query content, this embodiment executes S104 to obtain the target second prompt text corresponding to the target task category based on the obtained target fuzzy value.
[0053] In some actual usage scenarios, for example, when the environment is noisy when the user is interacting with the APP by voice, the environmental noise will greatly affect the data collection process of the terminal device, resulting in incomplete voice data collected by the terminal device, which in turn affects the completeness of the query content in text format obtained through text conversion. For example, the actual text corresponding to the voice data input by the user is "Help me navigate to location A", but the terminal device is interfered by noise, and some information is missing in the actual collected voice data, resulting in the converted query content being "Help me navigate", and the navigation destination information is missing.
[0054] When the query content is incomplete, the APP will not be able to obtain the user's true intention smoothly, resulting in the APP being unable to respond to the voice data input by the user or errors occurring when responding. For example, the APP cannot respond to "Help me navigate", thereby affecting the user's experience when using the APP.
[0055] Specifically, when executing S104, this embodiment obtains the target second prompt text corresponding to the target task category based on the target fuzzy value, and the implementation method that can be adopted is: in response to determining that the target fuzzy value is greater than or equal to the preset fuzzy threshold, obtain the target second prompt text corresponding to the target task category.
[0056] That is to say, when it is determined that the target fuzzy value is greater than or equal to the preset fuzzy threshold, this embodiment can determine that the acquired query content is incomplete, uncertain or vague, and therefore it is necessary to generate an intent question to determine the user's true intent.
[0057] When executing S104, this embodiment can obtain the second prompt text corresponding to the target task category according to the preset correspondence between the task category and the second prompt text as the target second prompt text.
[0058] In this embodiment, the target second prompt text is a few-sample prompt text; that is, the target second prompt text includes a plurality of second examples corresponding to the target task category.
[0059] The target second prompt text obtained by executing S104 in this embodiment may be "Please combine the following examples to generate an intent question that matches the input, second example 1, second example 2, second example 3...".
[0060] For example, if the target task category is a navigation task category, the examples in the target second prompt text corresponding to the "navigation task category" in this embodiment may include the second example 1 "Input: route to city A, output: what mode of transportation do you expect to use?", the first example 2 "Input: please navigate, output: where is the destination of your navigation?", etc.
[0061] In this embodiment, the second examples included in the second prompt texts corresponding to different task categories are different.
[0062] In addition, when executing S104, this embodiment may also include the following contents: in response to determining that the target fuzzy value is less than a preset fuzzy threshold, obtaining the user's true intention according to the query content, and responding to the obtained true intention.
[0063] That is to say, when this embodiment determines that the target fuzzy value is less than the preset fuzzy threshold, it can be determined that the obtained query content is complete, definite or clear. Based on the obtained query content, the user's true intention can be accurately obtained, and then the obtained true intention can be responded to without the need to generate intention questions.
[0064] After executing S104 to obtain the target second prompt text corresponding to the target task category, this embodiment executes S105 to use the target large language model to generate an intention question corresponding to the query content based on the target second prompt text and the query content.
[0065] When executing S105, this embodiment can input the target second prompt text and the query content into the target large language model, and then obtain the intention questions corresponding to the query content based on the output results of the target large language model; wherein, the number of intention questions obtained by executing S105 in this embodiment can be one or more.
[0066] After executing S105 to generate an intent question corresponding to the query content, this embodiment may also include the following contents: using the generated intent question to interact with the user to obtain the reply content input by the user to the intent question; obtaining the user's true intention based on the obtained reply content and the query content, and responding to the obtained true intention.
[0067] For example, if the query content is "Help me navigate", if the intent question generated by executing S105 in this embodiment is "Where is the destination of your navigation this time?", if the reply content entered by the user for the intent question is "Place A", then the user's true intention obtained by this embodiment is "Help me navigate to Place A", and then respond to this true intention, for example, generate a navigation route from the current location to Place A to display it to the user.
[0068] In addition, after obtaining the reply content entered by the user to the intent question, this embodiment can also use the target large language model to further generate more specific intent questions. For example, after obtaining the user input "Place A", it generates the intent question "Are you driving from your current location to Place A by yourself?" to interact with the user, thereby gradually obtaining the user's true intention more accurately according to the progressive intent question generation method.
[0069] Figure 2 is a schematic diagram according to the second embodiment of the present disclosure. Figure 2 As shown in , in this embodiment, when executing S102 "using the target large language model to generate multiple candidate texts according to the target first prompt text and the query content", the following implementation method can be adopted:
[0070] S201, sampling a first example included in the target first prompt text a preset number of times to obtain multiple example sampling results;
[0071] S202: Using the target large language model, generate the plurality of candidate texts according to the query content and different example sampling results.
[0072] That is to say, this embodiment uses the target large language model to generate multiple candidate texts according to the input query content and different example sampling results. Since different candidate texts correspond to different example sampling results, the multiple candidate texts generated by this embodiment can reflect the different interpretation methods of the target large language model when processing the query content, thereby achieving the purpose of obtaining the degree of fuzziness (or uncertainty) of the query content through the generated multiple candidate texts.
[0073] In this embodiment, the number of candidate texts generated by executing S202 is the same as the value of the preset number of times.
[0074] When executing S202, this embodiment can input the query content and different example sampling results into the target large language model respectively, and then obtain multiple candidate texts according to the results output by the target large language model each time; wherein different candidate texts correspond to different example sampling results.
[0075] For example, if the target first prompt text includes the first example 1, the first example 2, the first example 3, the first example 4 and the first example 5, if the preset number of times is 3, this embodiment will sample the examples in the target first prompt text three times when executing S201, and obtain example sampling result 1 (for example, including the first example 1), example sampling result 2 (for example, including the first example 2, the first example 4) and example sampling result 3 (for example, including the first example 1, the first example 3, the first example 5), and then when executing S202, the example sampling result 1 and the query content, the example sampling result 2 and the query content, and the example sampling result 3 and the query content are respectively input into the target large language model, so as to obtain candidate text 1 corresponding to the example sampling result 1, candidate text 2 corresponding to the example sampling result 2 and candidate text 3 corresponding to the example sampling result 3 generated by the target large language model.
[0076] Figure 3 is a schematic diagram according to the third embodiment of the present disclosure. Figure 3 As shown in , when executing S103 "obtaining a target fuzzy value corresponding to the query content according to the semantic vectors of the multiple candidate texts", this embodiment can adopt the following implementation method:
[0077] S301, obtaining a preset number of times;
[0078] S302, obtaining semantic vector differences between different candidate texts according to the semantic vectors of the plurality of candidate texts;
[0079] S303: Obtain a target fuzzy value corresponding to the query content according to the preset number of times and the semantic vector difference.
[0080] That is to say, this embodiment combines the preset number of times when generating candidate texts and the semantic vector difference between different candidate texts to obtain the target fuzzy value of the corresponding query content. By quantifying the degree of confusion of the target large language model when generating candidate texts, the fuzziness of the input query content is evaluated, which can improve the accuracy of the obtained target fuzzy value, and then improve the accuracy when generating intent questions based on the target fuzzy value.
[0081] The preset number of times obtained by executing S301 in this embodiment is the sampling number when sampling the target first prompt text.
[0082] When executing S302, this embodiment may first perform embedding processing on multiple candidate texts, obtain semantic vectors of different candidate texts based on the processing results, and then obtain semantic vector differences between different candidate texts based on the semantic vectors of each candidate text.
[0083] Specifically, when executing S303, according to the preset number of times and the semantic vector difference, the target fuzzy value corresponding to the query content can be obtained by using the following calculation formula:
[0084]
[0085] In the above calculation formula: U represents the target fuzzy value; k represents the preset number; s i represents the i-th candidate text, s j represents the jth candidate text; g(s i ) represents the semantic vector of the i-th candidate text, g(s j ) represents the semantic vector of the jth candidate text.
[0086] Figure 4 is a schematic diagram according to the fourth embodiment of the present disclosure. Figure 4 As shown, the device 400 for generating the intention question of this embodiment includes:
[0087] The first processing unit 401 is used to obtain query content and obtain a target task category according to the query content;
[0088] A first generating unit 402 is used to obtain a target first prompt text corresponding to the target task category, and generate a plurality of candidate texts according to the target first prompt text and the query content using a target large language model;
[0089] A determination unit 403 is configured to obtain a target fuzzy value corresponding to the query content according to the semantic vectors of the plurality of candidate texts;
[0090] The second processing unit 404 is used to obtain a target second prompt text corresponding to the target task category based on the target fuzzy value;
[0091] The second generating unit 405 is configured to use the target large language model to generate an intention question corresponding to the query content according to the target second prompt text and the query content.
[0092] In this embodiment, the first processing unit 401 may obtain text input by the user through the input terminal as query content.
[0093] In addition, when acquiring the query content, the first processing unit 401 may also adopt the following implementation method: acquiring the voice data input by the user; performing text conversion on the acquired voice data, and using the converted text as the query content.
[0094] After obtaining the query content, the first processing unit 401 may obtain the target task category according to the obtained query content.
[0095] In this embodiment, different application fields may include different task categories; for example, for the map application field, it may include POI (Point of Interest) query task category, navigation task category, taxi task category, bus query task category, etc.; for the e-commerce application field, it may include item query task category, order placement task category, order query task category, etc.
[0096] When the first processing unit 401 obtains the target task category according to the query content, the implementation method that can be adopted is: obtaining the task classification prompt text (the prompt text is prompt); using the large language model, generating the target task category according to the task classification prompt text and the query content.
[0097] In this embodiment, after the first processing unit 401 obtains the target task category, the first generating unit 402 obtains the target first prompt text corresponding to the target task category, and generates multiple candidate texts based on the target first prompt text and the query content using the target large language model.
[0098] In this embodiment, the target first prompt text is a few-sample prompt text; that is, the target first prompt text includes a plurality of first examples corresponding to the target task category.
[0099] When acquiring the target first prompt text corresponding to the target task category, the first generating unit 402 may acquire the first prompt text corresponding to the target task category as the target first prompt text according to a preset correspondence between the task category and the first prompt text.
[0100] When the first generation unit 402 uses the target large language model to generate multiple candidate texts according to the target first prompt text and the query content, the target first prompt text and the query content can also be input into the target large language model multiple times to obtain multiple candidate texts according to the output result of each time of the target large language model; wherein, in this embodiment, the target first prompt text and the query content can be input into the target large language model multiple times according to a preset number of times.
[0101] That is to say, the first generation unit 402 can utilize the randomness of the target large language model itself when generating content, and obtain multiple candidate texts by inputting the same content (ie, the target first prompt text and the query content) into the target large language model multiple times.
[0102] When the first generation unit 402 uses the target large language model to generate multiple candidate texts according to the target first prompt text and the query content, the following implementation method can also be adopted: sampling the first example included in the target first prompt text a preset number of times to obtain multiple example sampling results; using the target large language model to generate multiple candidate texts according to the query content and different example sampling results.
[0103] That is to say, the first generation unit 402 uses the target large language model to generate multiple candidate texts according to the input query content and different example sampling results. Since different candidate texts correspond to different example sampling results, the multiple candidate texts generated by the first generation unit 402 can reflect the different interpretation methods of the target large language model when processing the query content, thereby achieving the purpose of obtaining the degree of fuzziness (or uncertainty) of the query content through the generated multiple candidate texts.
[0104] In this embodiment, after the first generating unit 402 generates multiple candidate texts, the determining unit 403 obtains a target fuzzy value corresponding to the query content according to the semantic vectors of the generated multiple candidate texts.
[0105] When the determination unit 403 obtains the target fuzzy value corresponding to the query content based on the semantic vectors of multiple candidate texts, it can first perform embedding processing on the multiple candidate texts respectively, and obtain the semantic vector of each candidate text according to the processing result; then, based on the semantic vector, obtain the semantic similarity between different candidate texts; finally, based on the multiple semantic similarities obtained, obtain the target fuzzy value corresponding to the query content.
[0106] When determining the target fuzzy value corresponding to the query content based on the multiple semantic similarities obtained, the determination unit 403 can first calculate the average similarity of the multiple semantic similarities, and then use the fuzzy value corresponding to the average similarity as the target fuzzy value corresponding to the query content; or first calculate the sum of the similarities between the multiple semantic similarities, and then use the fuzzy value corresponding to the sum of the similarities as the target fuzzy value corresponding to the query content.
[0107] In addition, when the determination unit 403 obtains the target fuzzy value corresponding to the query content based on the semantic vectors of multiple candidate texts, it can also adopt the following implementation method: obtain a preset number of times; obtain the semantic vector difference between different candidate texts based on the semantic vectors of multiple candidate texts; obtain the target fuzzy value corresponding to the query content based on the preset number of times and the semantic vector difference.
[0108] That is to say, the determination unit 403 combines the preset number of times when generating candidate texts and the semantic vector difference between different candidate texts to obtain the target fuzzy value of the corresponding query content, and quantifies the degree of confusion of the target large language model when generating candidate texts, thereby evaluating the fuzziness of the input query content, which can improve the accuracy of the obtained target fuzzy value, and further improve the accuracy when generating intention questions based on the target fuzzy value.
[0109] In this embodiment, after the determination unit 403 obtains the target fuzzy value corresponding to the query content, the second processing unit 404 obtains the target second prompt text corresponding to the target task category based on the obtained target fuzzy value.
[0110] When the second processing unit 404 obtains the target second prompt text corresponding to the target task category based on the target fuzzy value, the implementation method that can be adopted is: in response to determining that the target fuzzy value is greater than or equal to a preset fuzzy threshold, obtain the target second prompt text corresponding to the target task category.
[0111] That is to say, when the second processing unit 404 determines that the target fuzzy value is greater than or equal to the preset fuzzy threshold, it can be determined that the acquired query content is incomplete, uncertain or vague, and therefore it is necessary to generate an intention question to determine the user's true intention.
[0112] The second processing unit 404 may obtain the second prompt text corresponding to the target task category as the target second prompt text according to the preset correspondence between the task category and the second prompt text.
[0113] In this embodiment, the target second prompt text is a few-sample prompt text; that is, the target second prompt text includes a plurality of second examples corresponding to the target task category.
[0114] In addition, the second processing unit 404 can also be used to execute the following: in response to determining that the target fuzzy value is less than a preset fuzzy threshold, obtain the user's true intention according to the query content, and respond to the obtained true intention.
[0115] That is to say, when the second processing unit 404 determines that the target fuzzy value is less than the preset fuzzy threshold, it can determine that the obtained query content is complete, definite or clear, and can accurately obtain the user's true intention based on the obtained query content, and then respond to the obtained true intention without generating intention questions.
[0116] In this embodiment, after the second processing unit 404 obtains the target second prompt text corresponding to the target task category, the second generation unit 405 uses the target large language model to generate an intention question corresponding to the query content based on the target second prompt text and the query content.
[0117] The second generation unit 405 can input the target second prompt text and the query content into the target large language model, and then obtain the intention question corresponding to the query content according to the output result of the target large language model; wherein the number of intention questions obtained by the second generation unit 405 can be one or more.
[0118] The device 400 for generating intention questions of this embodiment may further include a response unit 406 for executing the following contents: after the second generation unit 405 generates an intention question corresponding to the query content, use the generated intention question to interact with the user to obtain the reply content input by the user for the intention question; obtain the user's true intention based on the obtained reply content and the query content, and respond to the obtained true intention.
[0119] That is, this embodiment uses the generated intention questions to interact with the user through the response unit 406, so as to obtain the user's real intention based on the user's reply, thereby improving the accuracy of the intention response.
[0120] In the technical solution disclosed herein, the acquisition, storage and application 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.
[0121] 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.
[0122] like Figure 5 , is a block diagram of an electronic device according to a method for generating an intended question according to an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may 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.
[0123] like Figure 5As shown, the device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0124] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0125] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 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 501 performs the various methods and processes described above, such as the method for generating intent questions. For example, in some embodiments, the method for generating intent questions may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508.
[0126] In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the method for generating the intention question described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the method for generating the intention question in any other appropriate manner (e.g., by means of firmware).
[0127] Various implementations of the systems and techniques described 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.
[0128] 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 intention problem generating 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.
[0129] 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 equipment, 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.
[0130] 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 a 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).
[0131] 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.
[0132] 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", or "VPS" for short). The server may also be a server for a distributed system, or a server combined with a blockchain.
[0133] 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.
[0134] 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 method for generating an intention question, comprising: Obtaining query content, and obtaining a target task category according to the query content; Acquire a target first prompt text corresponding to the target task category, and generate a plurality of candidate texts according to the target first prompt text and the query content using a target large language model; Obtaining a target fuzzy value corresponding to the query content according to the semantic vectors of the multiple candidate texts; Based on the target fuzzy value, obtaining a target second prompt text corresponding to the target task category; The target large language model is used to generate an intention question corresponding to the query content according to the target second prompt text and the query content.
2. The method according to claim 1, wherein: The using the target large language model to generate a plurality of candidate texts according to the target first prompt text and the query content includes: Sampling the first example included in the target first prompt text a preset number of times to obtain multiple example sampling results; The target large language model is used to generate the plurality of candidate texts according to the query content and different example sampling results.
3. The method according to claim 1, wherein: The step of obtaining a target fuzzy value corresponding to the query content according to the semantic vectors of the plurality of candidate texts comprises: Get the preset number of times; Obtaining semantic vector differences between different candidate texts according to the semantic vectors of the multiple candidate texts; According to the preset number of times and the semantic vector difference, a target fuzzy value corresponding to the query content is obtained.
4. The method according to claim 1, wherein: The acquisition query content includes: Get the voice data input by the user; The voice data is converted into text, and the converted text is used as the query content.
5. The method according to claim 1, wherein: The acquiring, based on the target fuzzy value, a target second prompt text corresponding to the target task category comprises: In response to determining that the target fuzzy value is greater than or equal to a preset fuzzy threshold, a target second prompt text corresponding to the target task category is obtained.
6. The method according to claim 1, further comprising: After generating an intention question corresponding to the query content, using the intention question to interact with the user to obtain a reply content input by the user for the intention question; The real intention of the user is obtained according to the reply content and the query content, and the real intention is responded to.
7. The method according to claim 1, wherein: The target task category obtained according to the query content includes: Get the task classification prompt text; The target large language model is used to generate the target task category according to the task classification text and the query content.
8. The method according to claim 1, further comprising: In response to determining that the target fuzzy value is less than a preset fuzzy threshold, the user's true intention is obtained according to the query content, and a response is made to the true intention.
9. A device for generating an intention question, comprising: A first processing unit is used to obtain query content and obtain a target task category according to the query content; A first generating unit is used to obtain a target first prompt text corresponding to the target task category, and generate a plurality of candidate texts according to the target first prompt text and the query content using a target large language model; A determination unit, configured to obtain a target fuzzy value corresponding to the query content according to the semantic vectors of the plurality of candidate texts; A second processing unit, configured to obtain a target second prompt text corresponding to the target task category based on the target fuzzy value; The second generating unit is used to use the target large language model to generate an intention question corresponding to the query content according to the target second prompt text and the query content.
10. The device according to claim 9, wherein: When the first generating unit generates a plurality of candidate texts according to the target first prompt text and the query content using the target large language model, specifically: Sampling the first example included in the target first prompt text a preset number of times to obtain multiple example sampling results; The target large language model is used to generate the plurality of candidate texts according to the query content and different example sampling results.
11. The device according to claim 9, wherein: When the determination unit obtains the target fuzzy value corresponding to the query content according to the semantic vectors of the plurality of candidate texts, the determination unit specifically performs: Get the preset number of times; Obtaining semantic vector differences between different candidate texts according to the semantic vectors of the multiple candidate texts; According to the preset number of times and the semantic vector difference, a target fuzzy value corresponding to the query content is obtained.
12. The device according to claim 9, wherein: When acquiring the query content, the first processing unit specifically performs: Get the voice data input by the user; The voice data is converted into text, and the converted text is used as the query content.
13. The device according to claim 9, wherein: When the second processing unit obtains the target second prompt text corresponding to the target task category based on the target fuzzy value, specifically performs: In response to determining that the target fuzzy value is greater than or equal to a preset fuzzy threshold, a target second prompt text corresponding to the target task category is obtained.
14. The apparatus according to claim 9, further comprising a response unit, configured to execute: After the second generation unit generates an intention question corresponding to the query content, the intention question is used to interact with the user to obtain a reply content input by the user for the intention question; The real intention of the user is obtained according to the reply content and the query content, and the real intention is responded to.
15. The device according to claim 9, wherein: When the first processing unit obtains the target task category according to the query content, the first processing unit specifically performs: Get the task classification prompt text; The target large language model is used to generate the target task category according to the task classification text and the query content.
16. The apparatus according to claim 9, wherein the second processing unit is further configured to execute: In response to determining that the target fuzzy value is less than a preset fuzzy threshold, the user's true intention is obtained according to the query content, and a response is made to the true intention.
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, which, when executed by a processor, implements the method according to any one of claims 1 to 8.