Interaction method, electronic equipment, storage medium and program product
By using a small-scale language model to identify simple instructions in electronic devices and switching to a large-scale language model to identify complex instructions when necessary, the problem of insufficient speed and accuracy of intention recognition in the prior art is solved, and the efficiency of user interaction is improved.
Patent Information
- Application Number
- CN202411509915.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2044-10-25
AI Technical Summary
The prior art cannot ensure the accuracy and speed of intention recognition during the interaction between the user and the electronic device, affecting the user experience.
A small-scale language model is used to identify the first intention of a simple instruction and directly execute it when there is a match in the target intention set; if there is no match, a large-scale language model is used to identify the third intention of a complex instruction to ensure the accuracy and speed of intention recognition.
While ensuring the accuracy of intention recognition results, the speed of intention recognition is improved, and the execution efficiency and interaction efficiency of user instructions are improved.
Smart Images

Figure CN120429591A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an interaction method, electronic device, storage medium, and program product. Background Art
[0002] Currently, electronic devices such as mobile phones often include smart assistant applications (APPs). Users can interact with electronic devices through smart assistant APPs, instructing them to perform functions such as information query and device control. During the interaction process, the electronic device can understand and recognize the intention of user instructions (such as text instructions, voice instructions, etc.) based on relevant models (hereinafter referred to as intent recognition), obtain the intention represented by the user instruction, and then perform corresponding actions based on the obtained intention to complete the user instruction.
[0003] For example, if a user asks "Please turn on Bluetooth for me," the electronic device can interpret the intent represented by the command as "turn on Bluetooth." Based on this intent, the electronic device then performs the corresponding action (turning on / activating Bluetooth) and displays feedback, such as "OK, I've turned on Bluetooth for you."
[0004] Based on the foregoing, the electronic device can perform intent recognition on user instructions based on relevant models, such as a large-scale language model (hereinafter referred to as the large model) or a small-scale language model (hereinafter referred to as the small model). It is understood that an interaction between a user and an electronic device may include multiple rounds of dialogue (i.e., the user issues multiple rounds of user instructions in one interaction), and the electronic device usually uses a model (i.e., the large model or the small model) to recognize the intent of each round of user instructions.
[0005] If only a large model is used, since the large model has more parameters, the accuracy of the intent recognition result is higher regardless of whether it is based on the large model to recognize relatively simple or complex user instructions. However, the required processing resources (such as computing resources, storage resources, etc.) are more, which may reduce the speed of intent recognition. If only a small model is used, since the small model has fewer parameters, the speed of intent recognition is faster regardless of whether it is based on the small model to recognize relatively simple or complex user instructions. However, the small model has lower accuracy when recognizing more complex user instructions. Therefore, the above method cannot guarantee both the accuracy and speed of intent recognition in one interaction, which may reduce the user experience. Summary of the Invention
[0006] The embodiments of the present application provide an interaction method, electronic device, storage medium, and program product. The method can ensure both the accuracy and speed of intent recognition results.
[0007] In a first aspect, the present application provides an interaction method, which is applied to an electronic device, which includes a human-computer interaction system, the human-computer interaction system includes a first algorithm model and a second algorithm model, and the method includes: detecting a user instruction, identifying the intent of the user instruction based on the first algorithm model, and obtaining a first intention; determining whether there is a second intention matching the first intention in the target intention set, wherein the intention in the target intention set corresponds to the first type of instruction; corresponding to the existence of the second intention in the target intention set, executing the user instruction based on the first intention; corresponding to the absence of the second intention in the target intention set, identifying the intent of the user instruction based on the second algorithm model, and obtaining a third intention, and executing the user instruction based on the third intention; wherein the accuracy of the intent obtained by the second algorithm model in identifying the second type of instruction is higher than the accuracy of the intent obtained by the first algorithm model in identifying the second type of instruction; and the processing resources required for the operation of the second algorithm model are more than the processing resources required for the operation of the first algorithm model.
[0008] In the present application, the first algorithm model can be a small-scale language model, the second algorithm model can be a large-scale language model, the first type of instructions can be simple instructions, and the target intent set can be a simple intent set.
[0009] It can be understood that since the intents in the target intent set correspond to simple instructions, if the electronic device determines that there is a second intent in the target intent set that matches the first intent, it can further determine that the user instruction issued by the user is a simple instruction. At this time, the accuracy of the first intent corresponding to the user instruction obtained by the first algorithm model is higher. Therefore, the electronic device can directly execute the user instruction based on the first intent. This method of executing the user instruction based on the first intent when there is a second intent in the target intent set can improve the execution accuracy and efficiency of the user instruction.
[0010] If the electronic device determines that there is no second intent matching the first intent in the target intent set, it can further determine that the user instruction issued by the user is not a simple instruction. In this case, the accuracy of the first intent corresponding to the user instruction obtained by the first algorithm model is low. Therefore, the electronic device can again perform intent recognition on the user instruction based on the second algorithm model to obtain a third intent. In this case, the accuracy of the third intent obtained by the second algorithm model is higher, which in turn makes the execution accuracy of the user instruction higher.
[0011] In a possible implementation of the first aspect, the speed at which the first algorithm model recognizes the first type of instructions is faster than the speed at which the second algorithm model recognizes the first type of instructions.
[0012] It can be understood that since the first algorithm model recognizes simple instructions faster than the second algorithm model, when there is a second intent in the target intent set, executing user instructions based on the first intention can increase the execution speed of user instructions, thereby improving the execution efficiency of user instructions.
[0013] The interaction method provided in the present application can identify different user instructions based on different models in one interaction between a user and an electronic device (for example, including multiple rounds of user instructions), and then execute the user instructions based on the intentions obtained by identifying the user instructions based on different models. While ensuring the accuracy of the intention recognition results, it can improve the speed of intent recognition, improve the execution efficiency of user instructions, and thus improve the interaction efficiency.
[0014] In a possible implementation of the first aspect, the target intent set is determined based on the following method: based on the human-computer interaction system, multiple data pairs consisting of multiple historical user instructions and multiple historical user intentions corresponding to the multiple historical user instructions are obtained; feature extraction is performed on the multiple data pairs to obtain data pair feature vectors corresponding to each data pair, wherein the data pair feature vectors are used to characterize the length of the historical user instructions in each data pair, the complexity of the historical user instructions in each data pair, and the proportion of historical user intentions in each data pair; multiple data pairs are clustered based on the data pair feature vectors corresponding to each data pair to obtain data pair clustering results; based on the data pairs that meet the first condition in the data pair clustering results, the target intent set is obtained.
[0015] It can be understood that since the same historical user intention may exist in multiple historical user intentions, the proportion of historical user intentions in each data pair can represent, for a certain data pair, the proportion of the number of historical user intentions in the data pair to the number of multiple historical user intentions.
[0016] For example, if the number of historical user intentions in a certain data pair among multiple historical user intentions is 3 (that is, the historical user intentions in two other data pairs are the same as the historical user intentions in this data pair), and the total number of multiple historical user intentions is 100, then it can be determined that the proportion of historical user intentions in this data pair is 3 / 100.
[0017] In addition, in the present application, the data pair feature vector corresponding to each data pair is determined based on the length and complexity of the historical user instructions and the proportion of historical user intentions in each data pair. Therefore, the data pair clustering results obtained based on the data pair feature vector can more accurately distinguish between simple instructions and non-simple instructions in multiple historical user instructions, as well as simple intentions and non-simple intentions in multiple historical user intentions, thereby making the target intention set more accurate.
[0018] In a possible implementation of the first aspect, the data pair eigenvalue corresponds to a first eigenvalue, a second eigenvalue, and a third eigenvalue, wherein the longer the length of the historical user instructions in each data pair is, the larger the first eigenvalue is, the higher the complexity of the historical user instructions in each data pair is, the larger the second eigenvalue is, the greater the proportion of historical user intentions in each data pair is, and the smaller the third eigenvalue is.
[0019] In a possible implementation of the first aspect, the first condition includes: a vector average value of multiple first data pairs corresponding to the first data pair cluster in the data pair clustering result is less than a vector threshold.
[0020] It can be understood that if the vector average of multiple first data pairs corresponding to the first data pair cluster is less than the vector threshold, it means that the historical user instructions in the multiple first data pairs are shorter and less complex, the historical user instructions in the first data pairs are simpler, and the historical user intentions in the first data pairs are also simpler. Therefore, the target intent set obtained by the electronic device based on the data pair cluster that meets the first condition is more accurate.
[0021] In a possible implementation of the first aspect, a target intent set is obtained based on the data pair clustering that meets the first condition in the data pair clustering results, including: selecting the first historical user intent of the data pairs included in the data pair clustering that meets the first condition in the data pair clustering results; and determining the target intent set based on the selected first historical user intent.
[0022] In a possible implementation of the first aspect, the method also includes: selecting a second historical user intent of a data pair included in the data pair clustering results that does not meet the first condition; determining a non-target intent set based on the selected second historical user intent; corresponding to the existence of repeated historical user intent in the target intent set and the non-target intent set, determining a first proportion of the number of repeated historical user intents in the target intent set to the total number of repeated historical user intents in multiple historical user intentions; corresponding to the first proportion being greater than or equal to a proportion threshold, retaining the repeated historical user intent in the target intent set and deleting the repeated historical user intent in the non-target intent set; corresponding to the first proportion being less than the proportion threshold, deleting the repeated historical user intent in the target intent set and retaining the repeated historical user intent in the non-target intent set.
[0023] It is understandable that the same simple intent may exist in multiple simple intents in the target intent set, and the same non-simple intent may also exist in the non-target intent set. Therefore, if the electronic device determines that there are repeated historical user intents in the target intent set and the non-target intent set, it can determine a first number of repeated historical user intents in the target intent set and a second number of repeated historical user intents in the non-target intent set. Then, the electronic device determines a first ratio of the first number to the sum of the first number and the second number, and then determines whether the repeated historical user intent belongs to the target intent set or the non-target intent set based on the relationship between the first ratio and the ratio threshold.
[0024] This method can determine whether the repeated historical user intentions belong to the target intent set or the non-target intent set based on the first ratio when there are repeated historical user intentions in the target intent set or the non-target intent set, which can further improve the accuracy of simple intentions in the target intent set and the accuracy of non-simple intentions in the non-target intent set.
[0025] In a possible implementation of the first aspect, the loss function of the first algorithm model during the training process includes a first weight and / or a second weight, and the loss value obtained based on the loss function is positively correlated with the first weight and / or the second weight; wherein, the first weight is determined based on the text length of the historical user instructions used for training, and the first weight is negatively correlated with the text length; the second weight is determined based on whether the historical user intent corresponding to the historical user instructions used for training belongs to the target intent set, and the second weight is a first numerical value or a second numerical value, wherein the first numerical value corresponding to the historical user instructions whose corresponding historical user intent belongs to the target intent set is greater than the second numerical value corresponding to the historical user instructions whose corresponding historical user intent does not belong to the target intent set.
[0026] It can be understood that the shorter the text length of the historical user instructions used for training, the greater the possibility that the historical user instructions are simple instructions. Therefore, in this application, when the historical user instructions used for training are simple instructions, the value of the first weight is larger. In addition, if the historical user intent corresponding to the historical user instructions used for training belongs to the target intent set, it means that the historical user instructions are simple instructions. Therefore, in this application, when the historical user instructions used for training are simple instructions, the value of the second weight is also larger (for example, the first value is greater than the second value).
[0027] That is, during the training of the first algorithm model, if the historical user instructions used for training are simple instructions, then the loss value obtained based on the loss function will be larger. During the training process, in order to gradually reduce the larger loss value until the training end condition is met, the first algorithm model may be trained more times, thereby making the trained first algorithm model more accurate. Therefore, this setting of the loss function can enable the first algorithm model to obtain the intention corresponding to simple instructions with higher accuracy.
[0028] In a second aspect, the present application provides an electronic device comprising: one or more processors; one or more memories; one or more memories storing one or more programs, which, when one or more programs are executed by one or more processors, enables the electronic device to execute the interaction method of the first aspect and any possible implementation of the first aspect.
[0029] In a third aspect, the present application provides a readable storage medium having instructions stored thereon. When the instructions are executed on an electronic device, the electronic device executes the interactive method of the first aspect and any possible implementation of the first aspect.
[0030] In a fourth aspect, the present application provides a computer program product, which includes: a computer program or instructions, which, when the computer program or instructions are run on an electronic device, enables the electronic device to execute the interaction method of the first aspect and any possible implementation of the first aspect.
[0031] Among them, the beneficial effects of the second to fourth aspects can refer to the beneficial effects of the first aspect and any possible implementation of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 According to some embodiments of the present application, a schematic diagram of an interactive interface of the mobile phone 100 during an interaction process is shown;
[0033] Figure 2 According to some embodiments of the present application, a schematic diagram of an interactive interface of the mobile phone 100 during another interaction process is shown;
[0034] Figure 3 According to some embodiments of the present application, a flowchart of an interaction method is shown;
[0035] Figure 4 According to some embodiments of the present application, a flowchart of a method for determining a simple intent set is shown;
[0036] Figure 5 According to some embodiments of the present application, a flowchart of another method for determining a simple intent set is shown;
[0037] Figure 6 According to some embodiments of the present application, a schematic flow chart of a training process of a small model is shown;
[0038] Figure 7 According to some embodiments of the present application, a schematic diagram of the software structure of a mobile phone 100 is shown;
[0039] Figure 8 According to some embodiments of the present application, a schematic diagram of the hardware structure of an electronic device is shown. DETAILED DESCRIPTION
[0040] The illustrative embodiments of the present application include, but are not limited to, an interaction method, an electronic device, a storage medium, and a program product.
[0041] It is understood that the method provided in the embodiments of the present application can be applied to any electronic device that can interact with a user, including but not limited to a mobile station (MS), a mobile terminal (MT), etc. For example, the electronic device can be a mobile phone, a smart TV, a wearable device, a tablet computer (Pad), a desktop computer, a laptop computer, a virtual reality (VR) device, an augmented reality (AR) device, a terminal in industrial control, a terminal in self-driving, a terminal in remote medical surgery, a terminal in a smart grid, a terminal in transportation safety, a terminal in a smart city, a terminal in a smart home, etc. The embodiments of the present application do not limit the specific form of the electronic device.
[0042] In order to more clearly understand the solution of this application, the relevant terms involved in this application are first explained.
[0043] Simple commands are short, direct, and clear user commands. For example, the user command "What's the weather like today?" simply requires checking the weather. The user command "Please turn on Bluetooth for me" simply requires turning on Bluetooth. As can be seen in both examples, the user commands are relatively direct and clear, and therefore, both are simple commands.
[0044] Complex instructions: In this application, it refers to instructions other than simple instructions, that is, user instructions that include indirect (such as those that require reasoning) requirements, or have many requirements and longer content. For example, if the user instruction is "Help me set an alarm for 9 a.m. on every odd day of the next month", the specific month represented by "next month" needs to be inferred. For example, if the current month is August, it is necessary to infer that the month of the next month is September. In addition, the meaning of "odd day" also needs to be understood and inferred before it can be determined as "1, 3, 5... and other odd dates". Therefore, the user instruction includes indirect (i.e., requires reasoning) requirements and is a complex instruction. For another example, if the user instruction is "Help me set an alarm for 9 a.m. on Friday, and then help me set up a business trip schedule for 5 p.m. on Friday", the user instruction includes two requirements, namely, setting an alarm for 9 a.m. on Friday, and setting up a business trip schedule for 5 p.m. on Friday. There are many requirements, and the content of the user instruction is longer. Therefore, the user instruction is also a complex instruction.
[0045] Small-scale language model (i.e. small model): refers to a machine learning or deep learning model with a small scale and relatively simple structure. This model is usually pre-trained through a small-scale corpus and has the ability to understand simple instructions, that is, when the small model recognizes simple instructions, the accuracy of the intent recognition results obtained is higher. In addition, since the small model has a relatively small number of parameters, it usually requires fewer processing resources when performing intent recognition, which makes the recognition speed faster. However, since the small model has a relatively small number of parameters, when the model performs intent recognition on complex instructions, the accuracy of the intent recognition results obtained is lower.
[0046] For example, if the user command is simple, such as "Please turn on Bluetooth for me," the mini-model may recognize the intent represented by the user command as: Turn on Bluetooth. If the user command is complex, such as "Set an alarm for 9:00 AM on every single day of the next month," the mini-model may not be able to accurately identify the specific month represented by "next month" or the specific meaning represented by "every single day," resulting in lower accuracy in the mini-model's recognition of this user command.
[0047] For example, if the user's instruction is "Please set an alarm for me at 9 o'clock on Friday, and then help me create a business trip schedule for 5 o'clock on Friday afternoon", since the small model has fewer parameters and less computational effort, it may only recognize the "set an alarm for 9 o'clock on Friday" part of the intent, but fail to recognize the "create a business trip schedule for 5 o'clock on Friday afternoon" part of the intent, resulting in lower accuracy of the intent recognition result.
[0048] Large-scale language models (i.e., large models) refer to larger, more complex machine learning or deep learning models. These models are typically pre-trained using a large corpus, enabling them to understand both simple and complex commands. This means that these large models produce highly accurate intent recognition results. However, due to their large number of parameters, these models require more processing resources, resulting in slower recognition speeds.
[0049] For example, if the user instruction is simple, such as "Please turn on Bluetooth for me," the large model can identify the intent represented by the user instruction as turning on Bluetooth. If the user instruction is complex, such as "Set an alarm for 9:00 AM on every single day of the next month," the large model can infer the specific month represented by "next month" based on the current month, and can also accurately identify the specific meaning of "every single day," resulting in a high degree of accuracy in intent recognition.
[0050] For example, if the user's instruction is "Please set an alarm for me at 9 o'clock on Friday, and then schedule me for a business trip at 5 o'clock on Friday afternoon", the large model can recognize that the intention represented by the user's instruction is: set an alarm for 9 o'clock on Friday, and schedule me for a business trip at 5 o'clock on Friday afternoon. The accuracy of the intent recognition result is relatively high.
[0051] Based on the foregoing, during a user's interaction with an electronic device (e.g., a terminal device), intent recognition is typically performed for each round of user commands based on only one model (i.e., a large model or a small model). The following describes the existing intent recognition process in detail, using a mobile phone 100 as an example, in conjunction with the accompanying drawings.
[0052] Figure 1 A schematic diagram of the interactive interface of a smart assistant APP is shown. Figure 1 As shown, when the mobile phone 100 starts the smart assistant APP, the interactive interface 101 can be displayed. The user can send user commands (text commands, voice commands, picture commands) to interact with the mobile phone 100. Take the mobile phone 100 as an example to perform intention recognition on multiple rounds of user commands in one interaction based on the large model, as shown in FIG. Figure 1 As shown, when the mobile phone 100 detects the user instruction corresponding to the display box 102 (for example, "Please help me turn on Bluetooth"), it can recognize the intention represented by the user instruction corresponding to the display box 102 as: turn on Bluetooth, and then turn on Bluetooth and display the feedback information corresponding to the display box 103, such as "Bluetooth has been turned on for you."
[0053] When mobile phone 100 detects the user instruction corresponding to display box 104 (for example, "Help me set an alarm for 9:00 AM on every single day next month"), if the current month is August, the large model may recognize the intention represented by the user instruction corresponding to display box 104 as: set an alarm for 9:00 AM on the 1st, 3rd, 5th, ..., 29th of September. Then, mobile phone 100 sets the alarm according to the intention and displays the feedback information corresponding to display box 105, for example, "Help you set an alarm for 9:00 AM on the 1st, 3rd, 5th, ..., 29th of September."
[0054] When mobile phone 100 detects the user instruction corresponding to display box 106 (for example, "Help me set an alarm for 9:00 on Friday, and help me schedule a business trip for 5:00 PM on Friday"), the large model can identify the intent represented by the user instruction corresponding to display box 106 as: set an alarm for 9:00 on Friday, and schedule a business trip for 5:00 PM on Friday. Then, mobile phone 100 sets the alarm and creates the schedule according to the intent, and displays the feedback information corresponding to display box 107, for example, "I have helped you set the alarm for 9:00 on Friday, and created a schedule for 5:00 PM on Friday."
[0055] It is understood that when mobile phone 100 performs intent recognition based on the large model for the user instructions corresponding to display box 102 (simple instructions), the user instructions corresponding to display box 104 (complex instructions), and the user instructions corresponding to display box 106 (complex instructions), the accuracy of the intent recognition results is relatively high. However, due to the large number of parameters in the large model, unnecessary processing resources may be required when recognizing simple instructions (such as the user instructions corresponding to display box 102), which in turn slows down intent recognition, increases the interval between the execution time of the user instruction and the time when the user instruction is issued, and affects the user experience.
[0056] Take the mobile phone 100 as an example to perform intention recognition on multiple rounds of user instructions in one interaction based on a small model, such as Figure 2 As shown, when the mobile phone 100 detects the user instruction corresponding to the display box 102 (for example, "Please help me turn on Bluetooth"), it can recognize the intention represented by the user instruction corresponding to the display box 102 as: turn on Bluetooth, and then turn on Bluetooth and display the feedback information corresponding to the display box 103, such as "Bluetooth has been turned on for you."
[0057] When the mobile phone 100 detects the user instruction corresponding to the display box 104 (for example, "Help me set an alarm for 9 a.m. on every single day of the next month"), for example, the small model may not be able to accurately identify the specific month represented by "next month" (for example, if "next month" refers to September, the small model may not be able to determine the meaning of "next month" and then set an alarm in the current month (August)), and may not be able to accurately identify the specific meaning represented by "every single day". Based on the above description, the small model may, for example, recognize the intention represented by the user instruction corresponding to the display box 104 as: set an alarm at 9 a.m. on the 1st, 2nd, 3rd...9th of August. Then, the mobile phone 100 sets the alarm according to the intention and displays the feedback information corresponding to the display box 201, such as "Have helped you set an alarm at 9 a.m. on the 1st, 2nd, 3rd...9th of this month."
[0058] When mobile phone 100 detects the user instruction corresponding to display frame 106 (for example, "Set an alarm for Friday at 9:00, and then schedule a business trip for Friday at 5:00 PM"), the small model may only recognize the portion of the intent "Set an alarm for Friday at 9:00," and further recognize the intent represented by the user instruction corresponding to display frame 106 as "Set an alarm for Friday at 9:00." Mobile phone 100 then sets the alarm according to the intent and displays the feedback information corresponding to display frame 202, such as "The alarm for Friday at 9:00 has been set."
[0059] It can be understood that the user instruction corresponding to display box 102 is a simple instruction. When mobile phone 100 performs intent recognition on the user instruction corresponding to display box 102 based on the small model, the accuracy of the intent recognition result is relatively high. However, due to the small number of parameters in the small model, when performing intent recognition on complex instructions (such as the user instruction corresponding to display box 104 and the user instruction corresponding to display box 106), it may not be possible to accurately understand the intent corresponding to the complex instruction, thereby resulting in a lower accuracy of the intent recognition result.
[0060] In summary, during the interaction between the user and the mobile phone 100, if the user instructions issued by the user include both simple instructions and complex instructions, the existing interaction method cannot guarantee the accuracy and speed of intent recognition at the same time, affecting the interaction quality.
[0061] Therefore, in order to solve the above problems, an embodiment of the present application provides an interaction method. In this method, a simple intent set (as an example of a target intent set) is pre-stored in the terminal device. The simple intent set may include simple intents previously used by the user of the terminal device, simple intents uploaded by other terminal devices sent by the server, and the like. It can be understood that the user instruction corresponding to the simple intent in the simple intent set is a simple instruction (as an example of the first type of instruction). In this way, in the subsequent interaction process with the user, the terminal device can first identify the intent represented by the user instruction based on the small model (as an example of the first algorithm model) after receiving the user instruction issued by the user, and obtain the first intent corresponding to the user instruction. Then, it is determined whether there is a second intent matching the first intent in the pre-stored simple intent set. If the second intent exists, it means that the user instruction belongs to a simple instruction, and the terminal device can directly execute the user instruction according to the first intention. If the second intention does not exist, it means that the user instruction does not belong to a simple instruction, and the user instruction is again identified based on the large model (as an example of the second algorithm model) to obtain a third intent, and the user instruction is executed according to the third intention.
[0062] In some embodiments, the terminal device may define an intent that does not belong to the simple intent set as a complex intent, and the user instruction corresponding to the complex intent is a complex instruction (as an example of the second type of instruction). It can be understood that the accuracy of the intent obtained by the large model in recognizing the complex instruction is higher than the accuracy of the intent obtained by the small model in recognizing the complex instruction. Therefore, when the second intent does not exist in the simple intent set (that is, the user instruction does not belong to a simple instruction, for example, it belongs to a complex instruction), the terminal device can identify the user instruction based on the large model, obtain the third intent, and complete the user instruction based on the third intent.
[0063] In this way, whether the user instruction corresponding to the first intention is a simple instruction is determined by judging whether the first intention matches the intention in the simple intention set. If the user instruction is a simple instruction, the user instruction is executed directly based on the first intention. If it is not a simple instruction (for example, the user instruction is a complex instruction), the intent is recognized based on the large model to obtain the third intention, and then the user instruction is executed based on the third intention. This method can identify different user instructions based on different models in one interaction between the user and the terminal device (for example, including multiple rounds of user instructions), and then execute the user instruction based on the intention obtained by recognizing the user instructions based on different models. This can improve the speed of intent recognition while ensuring the accuracy of the intent recognition result.
[0064] In some embodiments, if a user sends a command such as "Please turn on Bluetooth for me," the small model identifies the intent represented by the user command and may determine that the first intent corresponding to the user command is "Turn on Bluetooth." Then, if a second intent matching the first intent exists in the simple intent set, such as the intent "Turn on Bluetooth," the first intent can be determined to be a simple intent, and the user command "Please turn on Bluetooth for me" can be determined to be a simple command. The user command is then executed directly based on the first intent.
[0065] In some other embodiments, if the user instruction issued by the user is "Help me set an alarm for 9 a.m. on every single day of the next month", the small model identifies the intent represented by the user instruction, and may obtain the first intention corresponding to the user instruction as: set an alarm for 9 a.m. on the 1st, 2nd, 3rd...9th of August. Then, if there is no second intention matching the first intention in the simple intent set, for example, there is no intention of "set an alarm for 9 a.m. on the 1st, 2nd, 3rd...9th of August", it can be determined that the first intention is not a simple intention, and then it is determined that the user instruction "Help me set an alarm for 9 a.m. on every single day of the next month" is not a simple instruction, and the terminal device then identifies the user instruction based on the large model. For example, the third intention obtained by the large model is: set an alarm for 9 a.m. on the 1st, 3rd, 5th...29th of September, and then the terminal device executes the user instruction based on the third intention.
[0066] In some embodiments, the terminal device can determine whether there is a second intent in the simple intent set that matches the first intent by judging the similarity between the first intent and each simple intent in the simple intent set. For example, the terminal device can use the simple intent in the simple intent set whose similarity with the first intent meets the similarity threshold as the second intent that matches the first intent. If there are multiple simple intents whose similarity meets the similarity threshold, the simple intent with the maximum similarity among the multiple simple intents in the simple intent set whose similarity with the first intent meets the similarity threshold can be used as the second intent that matches the first intent.
[0067] In some embodiments, the simple intent set may include simple intents previously used by the user of the terminal device, simple intents uploaded by other terminal devices and sent by the server, and may also include simple intents preset by the user or the system. In the case where the simple intent set includes simple intents previously used by the user of the terminal device, a method for determining the simple intent may include: obtaining historical user instructions issued by the user of the terminal device, and historical user intents corresponding to the historical user instructions; clustering multiple data pairs consisting of historical user instructions and historical user intents to obtain simple intents and non-simple intents.
[0068] Among them, clustering multiple data pairs consisting of historical user instructions and historical user intentions to obtain simple intention sets and non-simple intention sets can include: the terminal device can perform feature extraction on each data pair separately to obtain a data pair feature vector corresponding to each data pair (wherein, the data pair feature vector can be used to characterize the length, complexity, etc. of the historical user instructions), and then cluster multiple data pairs based on the data pair feature vector to obtain data pair clustering results, and obtain a simple intention set based on the historical user intentions of multiple data pairs corresponding to the data pair clusters that meet the relevant preset conditions (as an example of the first condition), such as forming a simple intention set based on the above-mentioned historical user intentions. Among them, the data pair clustering that meets the first condition can, for example, be a data pair clustering where the vector average value of the corresponding multiple first data pairs is less than the vector threshold.
[0069] In some embodiments, the terminal device may further form a non-simple intent set based on historical user intentions of multiple data pairs corresponding to the data pairs cluster that do not meet the first condition.
[0070] In some other embodiments, after determining the simple intent set and the non-simple intent set, the terminal device may further determine whether there are repeated historical user intents in the simple intent set and the non-simple intent set. If there are repeated historical user intents in the simple intent set and the non-simple intent set, and most of the repeated historical user intents are simple intents, then the repeated historical user intent can be determined to be a simple intent. Conversely, if most of the repeated historical user intents are non-simple intents, then the repeated historical user intent can be determined to be a non-simple intent.
[0071] Specifically, if there are repeated historical user intentions in the simple intent set and the non-simple intent set, the first number of the repeated historical user intentions in the simple intent set and the second number of the repeated historical user intentions in the non-simple intent set are determined. In some embodiments, if a first ratio of the first number to the sum of the first number and the second number is greater than or equal to a ratio threshold, it can be determined that the repeated historical user intention belongs to a simple intent, and then the repeated historical user intention continues to be stored in the simple intent set, and the repeated historical user intention in the non-simple intent set is deleted. If the first ratio is less than the ratio threshold, it can be determined that the repeated historical user intention does not belong to a simple intent, and then the repeated historical user intention in the simple intent set is deleted, and the repeated historical user intention continues to be stored in the non-simple intent set.
[0072] The interactive method provided by this application is described in detail below with reference to the accompanying drawings. Figure 3 A flow chart of an interactive method provided by the present application is shown. Figure 3 The execution subjects of each step of the process shown are all electronic devices (such as terminal devices). For the convenience of description, the following Figure 3 The execution entities of each step will not be described repeatedly in the steps of the process shown, and the following description of this application will be based on the example of the terminal device being the mobile phone 100. Figure 3 As shown, the method includes but is not limited to the following schemes:
[0073] 301: Detect a user instruction, identify the intent of the user instruction based on the small model, and obtain a first intent.
[0074] The embodiment of the present application does not limit the form of the user instruction. For example, the user instruction can be a text instruction, or a voice instruction, an air gesture, etc. For example, if the user instruction is a voice instruction, Figure 1 As described above, if the mobile phone 100 receives a voice command “Please help me turn on Bluetooth” issued by the user, the voice command can be converted into text and displayed in the interactive interface 101 , as shown in the display box 102 in the interactive interface 101 .
[0075] After the mobile phone 100 detects the user command, it can first use the small model to identify the user command's intent and obtain the first intent corresponding to the user command. It is understood that the user command may be a simple command or a complex command. Regardless of the user command, in this application, after receiving the user command, the mobile phone 100 can first use the small model to identify the intent.
[0076] Take the detected user instruction as a simple instruction as an example, such as Figure 2 As shown, the user instruction may be the user instruction "Please help me turn on Bluetooth" corresponding to display box 102. It can be understood that the small model has a high accuracy in identifying the first intent obtained by performing intent recognition on this simple instruction corresponding to display box 102. Therefore, the obtained first intent is, for example, "turn on Bluetooth."
[0077] Take the detected user instruction as a complex instruction as an example, Figure 2 As shown, the user instruction may be the user instruction corresponding to display box 104, "Help me set an alarm for 9:00 AM on every single day of the next month." It is understandable that the small model's accuracy in identifying the first intent for this complex instruction corresponding to display box 104 is low, i.e., the first intent may be inaccurate. For example, the first intent may be "Set an alarm for 9:00 AM on the 1st, 2nd, 3rd, ..., and 9th of August."
[0078] Take the detected user instruction as a complex instruction as an example, Figure 2As shown, the user instruction may be the user instruction corresponding to display box 106, "Set an alarm for Friday at 9:00, and schedule a business trip for Friday at 5:00 PM." The small model performs intent recognition on this complex instruction corresponding to display box 106 and obtains a first intent with low accuracy, i.e., the obtained first intent may be inaccurate. For example, the first intent may be "Set an alarm for Friday at 9:00."
[0079] 302: Determine whether there is a second intent matching the first intent in the simple intent set.
[0080] It is understood that after the mobile phone 100 determines the first intent, it can determine whether the user instruction is a simple instruction based on the first intent. In some embodiments, the mobile phone 100 can determine whether the user instruction corresponding to the first intent is a simple instruction by determining whether there is a second intent matching the first intent in the simple intent set.
[0081] Among them, the simple intent set may include simple intents previously used by the user of the terminal device, simple intents uploaded by other terminal devices sent by the server, or simple intents preset by the user or the system, and the simple intents in the simple intent set correspond to simple instructions. In other words, the instructions corresponding to the simple intents in the simple intent set are simple instructions. Among them, the method for determining the simple intents in the simple intent set will be described in detail later and will not be repeated here.
[0082] Since the instructions corresponding to the simple intents in the simple intent set are simple instructions, if the mobile phone 100 determines that there is a second intent in the simple intent set that matches the first intent, it can further determine that the first intent belongs to a simple intent, and then it can be determined that the user instruction corresponding to the first intent belongs to a simple instruction corresponding to the simple intent.
[0083] After the mobile phone 100 determines that the user instruction is a simple instruction, since the small model has a high accuracy in identifying the first intent of the simple instruction, 303 can be executed, and the mobile phone 100 executes the user instruction based on the first intent obtained by the small model.
[0084] If the mobile phone 100 determines that there is no second intent matching the first intent in the simple intent set, it can be determined that the user instruction is not a simple instruction, that is, a complex instruction. The first intent obtained by the small model performing intent recognition on the complex instruction may be inaccurate. Therefore, 304 can be executed, and the user instruction can be recognized based on the large model to obtain the third intent, and the user instruction can be executed based on the third intention.
[0085] The embodiment of the present application does not limit the manner in which the mobile phone 100 determines whether there is a second intent matching the first intent in the simple intent set. For example, the mobile phone 100 can calculate the similarity between each simple intent in the simple intent set and the first intent, and then use the simple intent in the simple intent set whose similarity with the first intent meets the similarity threshold as the second intent matching the first intent. If there are multiple simple intents whose similarity meets the similarity threshold, the simple intent with the maximum similarity among the multiple simple intents in the simple intent set whose similarity with the first intent meets the similarity threshold can be used as the second intent matching the first intent.
[0086] In some embodiments, as Figure 2 As shown, based on the small model, mobile phone 100 determines that the first intent corresponding to the user instruction "Please help me turn on Bluetooth" corresponding to display box 102 is: After turning on Bluetooth, it can further determine whether there is a second intent matching the first intent in the simple intent set. If the second intent exists in the simple intent set, for example, the intent "Turn on Bluetooth" exists in the simple intent set, mobile phone 100 can determine that the user instruction corresponding to display box 102 is a simple instruction, and then execute the user instruction based on the first intent.
[0087] In other embodiments, the mobile phone 100 determines based on the small model that the first intent corresponding to the user instruction "Help me set an alarm for 9 a.m. on every single day of the next month" corresponding to the display frame 104 is: set an alarm for 9 a.m. on the 1st, 2nd, 3rd...9th of August. After that, it can further determine whether there is a second intent matching the first intent in the simple intent set. If the second intent does not exist in the simple intent set, for example, the intent "set an alarm for 9 a.m. on the 1st, 2nd, 3rd...9th of August" does not exist in the simple intent set, the mobile phone 100 can determine that the user instruction corresponding to the display frame 104 is not a simple instruction, but a complex instruction. Then, the mobile phone 100 can perform intent recognition on the user instruction again based on the large model to obtain a third intent, and execute the user instruction based on the third intent.
[0088] 303: Execute the user instruction based on the first intention.
[0089] As can be understood, if the first intention is to turn on Bluetooth, the phone 100 can turn on Bluetooth to execute the user command "Please turn on Bluetooth for me." As can be understood, in this case, the phone 100 determines that the user command is simple, so the phone 100 performs intent recognition on the user command based on the small model, resulting in a higher accuracy of the first intent. This method of executing user commands directly based on the first intent recognized by the small model can improve the accuracy and efficiency of executing user commands.
[0090] In addition, since the small model recognizes simple instructions faster than the large model, when there is a second intent in the simple intent set, executing user instructions based on the first intent can also increase the execution speed of user instructions, thereby improving the execution efficiency of user instructions.
[0091] 304: Perform intent recognition on the user instruction based on the large model to obtain a third intent, and execute the user instruction based on the third intent.
[0092] It can be understood that the processing resources required for the operation of the large model are more than the processing resources required for the operation of the small model. Therefore, the accuracy of the intent obtained by the large model in identifying complex instructions is higher than the accuracy of the intent obtained by the small model in identifying complex instructions. Therefore, when the mobile phone 100 determines that there is no second intention matching the first intention in the simple intent set, that is, when it determines that the user instruction is not a simple instruction but a complex instruction, the accuracy of the first intention obtained by identifying the user instruction based on the small model may be low. Therefore, the user instruction can be identified again based on the large model to obtain the third intention. In this case, the accuracy of the third intention is higher than the accuracy of the first intention. When the user instruction is executed based on the third intention, the efficiency of the execution process of the user instruction can be made higher.
[0093] It can be understood that the interaction method provided by the present application first identifies the user instruction through a small model to obtain a first intention, and then determines whether the first intention matches the intention in the simple intention set to determine whether the user instruction corresponding to the first intention is a simple instruction. If the user instruction is a simple instruction, the user instruction is executed directly based on the first intention, which can improve the execution speed and efficiency of the user instruction. If it is not a simple instruction (for example, the user instruction is a complex instruction), the intent is identified based on the large model to obtain a third intention, and then the user instruction is executed based on the third intention, which can improve the accuracy of the third intention and thus improve the execution accuracy of the user intention.
[0094] This method can identify different user instructions based on different models in one interaction between a user and a terminal device (for example, including multiple rounds of user instructions), and then execute the user instructions based on the intentions obtained by identifying the user instructions based on different models. While ensuring the accuracy of the intent recognition results, it can improve the speed of intent recognition, improve the execution efficiency of user instructions, and thus improve the interaction efficiency.
[0095] The following describes a method for determining the simple intents in the simple intent set involved in 302. It is understood that the simple intent set may include simple intents previously used by the user of the mobile phone 100, simple intents uploaded by other terminal devices sent by the server, or simple intents preset by the user or the system. The embodiments of the present application do not limit the devices corresponding to the simple intents in the simple intent set.
[0096] For the case where the simple intent set includes simple intents sent by the server and uploaded by other terminal devices, or includes simple intents preset by the user or the system, after the mobile phone 100 obtains the simple intent, it can directly determine whether the simple intent set includes a second intent that matches the first intent.
[0097] For the case where the simple intent set includes simple intents that have been used by the user of the mobile phone 100 before, such as Figure 4 As shown, the simple intent set is determined by:
[0098] 401: Obtain historical user instructions issued by the user of the mobile phone 100 and historical user intentions corresponding to the historical user instructions.
[0099] Among them, historical user instructions are user instructions issued by the user of mobile phone 100 during the historical interaction process with mobile phone 100. It is understandable that mobile phone 100 can obtain user instructions issued by users within a reference time period. The embodiment of the present application does not limit the value of the reference time period, and it can be set based on experience or flexibly adjusted according to actual application scenarios. For example, the reference time period can be one week, one month, six months, etc. Taking the reference time period of six months as an example, mobile phone 100 can obtain historical user instructions issued by users in the past six months.
[0100] It is understood that historical user intent is the accurate intent represented by historical user instructions. The embodiments of this application do not limit the method of determining historical user intent. For example, historical user intent can be determined manually. For another example, historical user intent can be obtained by performing intent recognition on historical user instructions using a relevant intent recognition model (such as the large model mentioned above).
[0101] 402: Cluster multiple data pairs consisting of historical user instructions and historical user intentions to obtain simple intention sets and non-simple intention sets.
[0102] In some embodiments, as Figure 5 As shown, multiple data pairs consisting of historical user instructions and historical user intents are clustered to obtain simple intent sets and non-simple intent sets. The following methods are used:
[0103] 4021: Perform feature extraction on each data pair to obtain multiple features corresponding to each data pair.
[0104] It is understood that multiple data pairs consisting of historical user instructions and historical user intentions can constitute a data set. In some embodiments, the data set D = {(x i ,y i )}, and i=1, 2,...,N.
[0105] Among them, xi Indicates historical user commands; y i represents the historical user intention corresponding to the historical user instruction; i represents the sequence number of the data pair consisting of the historical user instruction and the historical user intention.
[0106] The embodiment of the present application does not require the mobile phone 100 to process each data pair (x i ,y i ) The categories of features extracted can be limited, which can be set based on experience or flexibly adjusted according to actual application scenarios.
[0107] In the embodiment of the present application, the mobile phone 100 can i ,y i ) extract three features, namely f i =(f i,1 ,f i,2 ,f i,3 ).
[0108] in, Represents historical user intention y i The ratio of the number of historical user intentions to the total number of data N (expressed in the form of a vector). i The ratio of the number of y to the total number of data N can be used as an example of the third feature value. It can be understood that the historical user intention y i The larger the ratio of the number of to the total data number N, the smaller the third eigenvalue.
[0109] Among them, f i,2 =len(x i ), indicating historical user instructions x i The length of (in the form of a vector). Among them, the historical user instruction x i The length of the value can be used as an example of the first characteristic value. It can be understood that the historical user instruction x i The larger the length of , the larger the first characteristic value. i For example, the mobile phone 100 can determine the historical user instruction x i The number of characters.
[0110] Among them, f i,3 =complexity(x i ), indicating historical user instructions x i The complexity of (expressed in the form of vector). Among them, the historical user instruction x i The complexity value of can be used as an example of the second characteristic value. It can be understood that the historical user instruction x iThe greater the complexity, the greater the second characteristic value. i For example, the mobile phone 100 can determine the historical user instruction x based on a large-scale language model (ie, a large model). i complexity.
[0111] 4022: Perform normalization processing on multiple features of each data pair to obtain normalized features corresponding to each data pair (as an example of a data pair feature vector).
[0112] In the embodiment of the present application, the mean value u of each type of feature can be obtained first. j and standard deviation σ j .
[0113] Based on the above, each data pair corresponds to three features f i =(f i,1 ,f i,2 ,f i,3 ), so the mean u j =mean(f j ), represents the average value of N features corresponding to each type of feature. Wherein, j represents the sequence number of each type of feature, and j = 1, 2, 3.
[0114] Taking j=1 as an example, f1=(f 1,1 ,f 2,1 ,…,f N,1 ), and u1=(f 1,1 +f 2,1 +…+f N,1 ) / N.
[0115] Taking j=2 as an example, f2=(f 1,2 ,f 2,2 ,…,f N,2 ), and u2=(f 1,2 +f 2,2 +…+f N,2 ) / N.
[0116] Taking j=3 as an example, f3=(f 1,3 ,f 2,3 ,…,f N,3 ), and u3=(f 1,3 +f 2,3 +…+f N,3 ) / N.
[0117] In addition, the standard deviation σ j =std(f j), represents the standard deviation of N features corresponding to each type of feature. Among them, the meanings of f1, f2 and f3 are the same as those above, the only difference is that the calculation method of the average value and standard deviation based on f1, f2 and f3 is different. Therefore, this application does not require the standard deviation σ j The detailed calculation method of is described in detail.
[0118] In some embodiments, the mobile phone 100 determines the mean value u corresponding to each type of feature (f1, f2 and f3) j and standard deviation σ j Afterwards, the features of each data pair can be standardized to obtain the standardized features
[0119] 4023: Cluster the data pairs based on the standardized features corresponding to each data pair to obtain a simple intent set and a non-simple intent set.
[0120] In some embodiments, the mobile phone 100 may first set the number of clusters K and initialize K cluster centers μ k . Where k = 1, 2, ..., K. Then, calculate the standardized feature z corresponding to each data pair i With each cluster center μ k The distance d ik .
[0121] The embodiments of this application do not include standardized features. i With each cluster center μ k The distance d ik The calculation method is limited, for example, the distance d ik It can be Euclidean distance, etc. ik Taking Euclidean distance as an example, d ik =||z i -μ k ||^2.
[0122] Then, the normalized feature z i Assign to the nearest cluster center μ k The corresponding cluster C k , that is, C k =argmin(d ik ). Further, update the cluster center μ k , get the updated cluster center μ k1 , for example, the cluster center μ k Update to cluster C k All normalized features z in i The mean value, μ k1 =mean(z i ), where z i ∈C k .
[0123] The mobile phone 100 can repeat the above process until the clustering end condition is met, such as when the cluster center no longer changes or the upper limit of the number of iterations is reached. It can be understood that when the clustering end condition is met, the mobile phone 100 can obtain the data pair clustering results, such as multiple data pair clusters. The mobile phone 100 can obtain a simple intent set based on the data pair clusters that meet the first condition in the multiple data pair clusters, and obtain a non-simple intent set (as an example of a non-target intent set) based on the data pair clusters that do not meet the first condition in the multiple data pair clusters.
[0124] The present embodiment does not limit the content of the first condition. For example, the first condition may include that the vector average of the plurality of first data pairs corresponding to the first data pair cluster in the data pair clustering result is less than the vector threshold. In other words, the mobile phone 100 may obtain a simple intent set based on the first data pair cluster in the data pair clustering result for which the vector average of the plurality of first data pairs corresponding to the first data pair cluster is less than the vector threshold.
[0125] In some other embodiments, the mobile phone 100 obtains a simple intent set based on a data pair cluster that meets a first condition in multiple data pair clusters, which may include: the mobile phone 100 selects the first historical user intent of the data pairs included in the data pair cluster that meets the first condition, and constructs a simple intent set based on the selected first historical user intent.
[0126] In some other embodiments, the mobile phone 100 obtains a non-simple intent set based on a data pair cluster that does not meet the first condition in multiple data pair clusters, which may include: the mobile phone 100 selects the second historical user intent of the data pairs included in the data pair cluster that does not meet the first condition, and constructs a non-simple intent set based on the selected second historical user intent.
[0127] It can be understood that the second historical user intention is the intention of the historical user intention in the above 401 except the first historical user intention.
[0128] In this way, the simple intents in the simple intent set are determined based on the user's historical user instructions and historical user intentions. The simple intents in the simple intent set obtained can reflect the user's preferences. Therefore, in this application, the method of determining whether a user instruction is a simple instruction based on whether a second intent exists in the simple intent set has higher accuracy, thereby making the execution process of the user instruction more efficient.
[0129] It can be understood that in the embodiment of the present application, the simple intent set can be updated periodically, that is, the simple intent set is updated once every fixed time interval. This method of periodically updating the simple intent set allows the simple intents in the simple intent set to reflect the user's recent preferences, thereby making the method of determining whether a user instruction is a simple instruction based on whether a second intent exists in the simple intent set more accurate, thereby making the execution process of the user instruction more efficient.
[0130] It can be understood that the same intent may exist in the simple intent set and the non-simple intent set, which are referred to as repeated historical user intents below. For example, the user instruction I1 is "Help me set a schedule for 9 o'clock every day in September", and the intent corresponding to the user instruction I1 is: set a schedule for 9 o'clock every day in September. For another example, the user instruction I2 is "Help me set an alarm for 9 o'clock every day next month", where "next month" means September, and the intent corresponding to the user instruction I2 is also: set a schedule for 9 o'clock every day in September. When clustering the data pairs including user instructions I1 and I2, the intent corresponding to the user instruction I1 may be identified as a simple intent, and the intent corresponding to the user instruction I2 may be identified as a non-simple intent, that is, the simple intent set and the non-simple intent set have repeated historical user intents (for example, setting a schedule for 9 o'clock every day in September).
[0131] Therefore, in some other embodiments, after determining the simple intent set and the non-simple intent set, the mobile phone 100 may further determine whether there are repeated historical user intentions in the simple intent set and the non-simple intent set. If so, the first number of repeated historical user intentions in the simple intent set and the second number of repeated historical user intentions in the non-simple intent set are determined. In some embodiments, if the first ratio of the first number to the sum of the first number and the second number is greater than or equal to the ratio threshold, it can be determined that the repeated historical user intention belongs to a simple intent, and the intent is further stored in the simple intent set, and the repeated historical user intention in the non-simple intent set is deleted.
[0132] If the first ratio is less than the ratio threshold, it can be determined that the repeated historical user intent does not belong to a simple intent, and then the repeated historical user intent in the simple intent set is deleted, and the repeated historical user intent continues to be stored in the non-simple intent set.
[0133] It is understandable that the embodiment of the present application does not limit the value of the ratio threshold, which can be set based on experience or flexibly adjusted according to actual application scenarios.
[0134] This method determines whether a repeated historical user intention is a simple intention or a non-simple intention based on the first ratio of the number of repeated historical user intentions in the simple intention set to the total number of repeated historical user intentions in the simple intention set and the non-simple intention set. It can ensure that one intention only exists in one intention set, improve the accuracy of the judgment result of whether the first intention belongs to a simple intention, and thus improve the execution efficiency of user instructions.
[0135] In other embodiments, whether the repeated historical user intent is a simple intent or a non-simple intent can be determined by determining whether the number of simple intents in the repeated historical user intent is greater than a quantity threshold. For example, if the number of simple intents is greater than or equal to the quantity threshold, the repeated historical user intent can be determined to be a simple intent. Conversely, if the number of simple intents is less than the quantity threshold, the repeated historical user intent can be determined to be a non-simple intent.
[0136] In some other embodiments, the present application also adjusts the loss function of the small model during the training process, so that the small model can obtain a higher accuracy of the intent obtained by the simple instruction intent recognition. Figure 6 The training process of the small model is described in detail. Figure 6 As shown in Figure 2, the training process of the small model includes:
[0137] 601: Obtain a training set, where the training set includes user instructions for training and reference intents corresponding to the user instructions.
[0138] The training set includes user instructions for training and reference intentions corresponding to the user instructions. In some embodiments, the user instructions included in the training set may be the historical user instructions x mentioned above. i (i=1, 2, ..., N), the reference intent included in the training set can be based on the historical user intent y mentioned above i Determine C types of historical user intentions.
[0139] It is understandable that there may be multiple historical user instructions x i The corresponding historical user intention y i are the same, for example, historical user intent y1 and historical user intent y2 are the same. Therefore, in this application, by classifying and integrating N historical user intents, C historical user intents can be obtained, where C is an integer greater than or equal to 1, and N and C are the same or different. It can be understood that any two historical user intents among the C historical user intents are different.
[0140] Taking N as 3 as an example, if the historical user intention corresponding to the historical user instruction x1 is y1, the historical user intention corresponding to the historical user instruction x2 is y2, and the historical user intention corresponding to the historical user instruction x3 is y3, and if the historical user intention y1 is the same as the historical user intention y2, then by classifying and integrating the three historical user intentions y1, y2, and y3, two historical user intentions can be obtained, that is, C is 2.
[0141] It can be understood that the historical user intents obtained in the above manner correspond to the historical user intent type numbers. Still using the above example, there are two historical user intents. Therefore, the first historical user intent can correspond to historical user intent y1 (or y2), and the second historical user intent can correspond to historical user intent y3.
[0142] 602: Input the user instruction into the small model, and obtain the predicted probability of each reference intention as the intention corresponding to the user instruction predicted by the small model.
[0143] To enter historical user commands x i For example, the probability that the user instruction predicted by the small model corresponds to the cth historical user intention can be expressed as (p i ,c), where c=1, 2,…, C.
[0144] 603: Get the loss of the small model based on the difference between the predicted probability and the reference probability.
[0145] Specifically, in this application, the loss of the small model (ie, Loss) can be obtained based on the loss function shown in the following formula (1) as well as the predicted probability and the reference probability.
[0146]
[0147] Wherein, Loss represents loss; i represents the sequence number of the user instruction used for training, and i = 1, 2, ..., N; w i (As an example of the first weight) represents a text weight set based on the text length of the user instruction; w c (As an example of the second weight) represents a category weight set based on whether the reference intention belongs to a simple intention; (P i ,c) represents the user instruction x i The reference probability that the corresponding reference intention belongs to the cth historical user intention; (p i ,c) represents the user instruction x i The corresponding predicted intent belongs to the predicted probability of the cth historical user intention.
[0148] In some embodiments, w i It can be determined based on the following formula (2).
[0149]
[0150] Where L represents the text length threshold, which can be set based on experience; Len represents the current input user instruction x i The length of the text; α is the proportional coefficient, which is a fixed value and can be set based on experience.
[0151] Based on the above formula (2), we can know that the user instruction x i The smaller the text length Len is, the i The larger the w is, the larger the Loss obtained based on formula (1). During the training of the small model, in order to gradually reduce the larger Loss to the Loss that meets the training end condition, the small model may be trained more times, thereby making the trained small model more accurate. Therefore, this w i This setting allows the small model to more accurately predict the intent of short text user instructions. As can be understood, since short text user instructions are usually simple, this approach can improve the accuracy of the small model's intent recognition for simple instructions.
[0152] In some other embodiments, w c It can be determined based on the following formula (3).
[0153]
[0154] Wherein, β1 (as an example of the second value) and β2 (as an example of the first value) are fixed values set based on experience, etc., and β2>β1; C target Indicates the category number corresponding to the historical user intent in the simple intent set.
[0155] Based on formula (3), it can be understood that if the current c-th historical user intention belongs to the historical user intention in the simple intention set, then w c =β2. If the current c-th historical user intention does not belong to the historical user intention in the simple intention set, then w c =β1, and β2>β1. It is understandable because based on the previous Figure 4 The corresponding method has determined the historical user intentions that belong to simple intents. Therefore, when training the small model based on historical user intentions, it can be known whether the cth historical user intention belongs to a simple intent, that is, whether the cth historical user intention belongs to the simple intent set.
[0156] In the case where the cth historical user intention belongs to the simple intention set, the set w c Larger; in the case where the cth historical user intention does not belong to the simple intention set, the set wc Smaller. Based on and w i The same setting principle, w c The larger the w is, the larger the Loss obtained based on formula (1). During the training of the small model, in order to gradually reduce the larger Loss to the Loss that meets the training end condition, the small model may be trained more times, thereby making the trained small model more accurate. Therefore, this w c The setting method can make the small model more accurate in predicting the intention corresponding to a simple instruction, that is, it can improve the accuracy of the small model in identifying the intention of a simple instruction.
[0157] 604: Train the small model based on the loss to obtain a trained small model.
[0158] It is understood that after the mobile phone 100 determines the loss, it can train the small model based on the loss until the training end condition is reached, end the training, and obtain the trained small model. Among them, the trained small model can be used in the previous Figure 3 In the interaction method shown, the user's instructions are recognized for their intent.
[0159] This application does not limit the training end conditions. For example, the training end condition can be loss convergence obtained based on the loss function.
[0160] The method provided in this application improves the accuracy of the intent recognition results obtained by the small model when recognizing simple instructions by changing the loss function in the small model training process, thereby improving the execution efficiency of user instructions.
[0161] Figure 7 FIG. 1 shows a software structure diagram of a mobile phone 100 in an embodiment of the present application. Figure 7 As shown, the mobile phone 100 includes a human-computer interaction system 200 and a central control system 210 , and the human-computer interaction system 200 includes a judgment module 2001 , a first intention recognition module 2002 , and a second intention recognition module 2003 .
[0162] The human-computer interaction system 200 is used to interact with the user. It can recognize the user's intention for the user's command through the small model or the large model, and send the intention recognition result to the central control system 210. In addition, the human-computer interaction system 200 can also convert the feedback information returned by the central control system 210 into a form that the user can understand (such as text, voice, image, etc.) to interact with the user, for example, displaying it in the interactive interface, or playing the feedback information in the form of voice to the user.
[0163] The judgment module 2001 is used to judge whether there is a second intent matching the first intent in the simple intent set, that is, the judgment module 2001 is used to execute the content involved in the above 302.
[0164] The first intention recognition module 2002 includes a small model, which is used to perform intent recognition on the input user instruction based on the small model to obtain an intent recognition result (such as the first intention).
[0165] The second intention recognition module 2003 includes a large model, which is used to perform intent recognition on the input user instructions (complex instructions) based on the large model when there is no second intention in the simple intention set, and obtain an intent recognition result (such as the third intention).
[0166] The central control system 210 is used to obtain the intent recognition result output by the human-computer interaction subsystem 200, and execute user instructions based on the intent recognition result (for example, executing user instructions based on the first intent and executing user instructions based on the third intent as described above). For example, if the intent recognition result obtained is: turn on Bluetooth, the central control system 210 can perform the operation of turning on Bluetooth to execute the user instruction "Please help me turn on Bluetooth". In addition, the central control system 210 can also generate feedback information and return the feedback information to the human-computer interaction subsystem 200, thereby realizing interaction with the user.
[0167] In some embodiments, the embodiments of the present application further provide a readable storage medium, on which instructions are stored. When the instructions are executed on an electronic device, the electronic device executes the interaction method described in the above embodiments.
[0168] In some embodiments, the embodiments of the present application further provide a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on an electronic device, the electronic device executes the interaction method described in the above embodiments.
[0169] In some embodiments, the present application also provides an electronic device, which includes one or more processors; one or more memories; one or more memories storing one or more programs, and when the one or more programs are executed by one or more processors, the electronic device executes the interaction method described in the above embodiment. Figure 8 , introduces the hardware structure of the electronic device provided in the embodiments of the present application.
[0170] Figure 8 FIG1 shows a schematic diagram of the hardware structure of an electronic device, wherein the electronic device may be, for example, a mobile phone 100. Taking the mobile phone 100 as an example, Figure 8As shown, the mobile phone 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a touch sensor 180K, etc.
[0171] It should be understood that the illustrated structure of the embodiment of the present invention does not constitute a specific limitation on the mobile phone 100. In other embodiments of the present application, the mobile phone 100 may include more or fewer components than shown, or some components may be combined or separated, or arranged differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0172] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices or integrated into one or more processors. In an embodiment of the present application, when the processor 110 detects that the intelligent assistant application is opened, it can execute the interaction method provided in the embodiment of the present application.
[0173] The charging management module 140 is configured to receive charging input from a charger, which may be a wireless charger or a wired charger.
[0174] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to provide power to the processor 110, the internal memory 121, the display 194, the camera 193, and the wireless communication module 160.
[0175] The wireless communication function of the mobile phone 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0176] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
[0177] The mobile communication module 150 can provide solutions for wireless communications, including 2G / 3G / 4G / 5G, applied to the mobile phone 100. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0178] The modem processor can include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium- or high-frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
[0179] The wireless communication module 160 can provide wireless communication solutions for application on the mobile phone 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0180] Mobile phone 100 implements display functionality through a GPU, display screen 194, and an application processor. The GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0181] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. In some embodiments, mobile phone 100 may include one or N display screens 194, where N is a positive integer greater than 1. In the embodiments of the present application, mobile phone 100 can interact with the user through display screen 194.
[0182] The mobile phone 100 can realize the shooting function through the ISP, camera 193, video codec, GPU, display 194 and application processor.
[0183] The ISP processes data fed back by the camera 193. For example, when taking a photo, the shutter is opened, light passes through the lens and is transmitted to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then transmitted to the ISP for processing. In some embodiments, the ISP can be provided within the camera 193.
[0184] The camera 193 is used to capture still images or videos. In some embodiments, the mobile phone 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0185] Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. Video codecs are used to compress or decompress digital videos.
[0186] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU enables intelligent cognitive applications in the phone 100, such as image recognition, face recognition, speech recognition, and text comprehension.
[0187] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0188] The internal memory 121 may be used to store computer-executable program codes, where the executable program codes include instructions.
[0189] The mobile phone 100 can implement audio functions such as music playback and recording through the audio module 170 and the application processor. The audio module 170 is used to convert digital audio information into analog audio signal output and also to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals.
[0190] The touch sensor 180K is also called a "touch device." The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the mobile phone 100, in a location different from that of the display screen 194.
[0191] Buttons 190 include a power button and volume buttons. Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or touch vibration feedback. Indicator 192 can be an indicator light that can be used to indicate charging status. SIM card interface 195 is used to connect a SIM card.
[0192] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0193] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0194] Program code can be implemented with a high-level programming language or an object-oriented programming language to communicate with the processing system. Where necessary, program code can also be implemented in assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0195] In some cases, the disclosed embodiments can be implemented in hardware, firmware, software or any combination thereof. The disclosed embodiments can also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which can be read and executed by one or more processors. For example, instructions can be distributed over a network or through other computer-readable media. Therefore, machine-readable media can include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including but not limited to, floppy disks, optical disks, optical discs, read-only memories (CD-read-only memories, CD-ROMs), magneto-optical disks, read-only memories (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic or other forms of propagation signals. Accordingly, machine-readable media includes any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (eg, a computer).
[0196] In the accompanying drawings, some structural or method features may be shown in a particular arrangement and / or order. However, it should be understood that such a particular arrangement and / or order may not be required. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of a structural or method feature in a particular figure does not imply that such feature is required in all embodiments, and in some embodiments, such features may not be included or may be combined with other features.
[0197] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems raised by this application. In addition, in order to highlight the innovative part of this application, the above-mentioned device embodiments of this application do not introduce units / modules that are not closely related to solving the technical problems raised by this application. This does not mean that other units / modules do not exist in the above-mentioned device embodiments.
[0198] It should be noted that in the examples and description of the present application, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a" does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0199] While the present application has been shown and described with reference to certain embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the present application.
Claims
1. An interactive method, characterized in that: Applied to electronic equipment, the electronic equipment includes a human-computer interaction system, the human-computer interaction system includes a first algorithm model and a second algorithm model, and The method comprises: Detecting a user instruction, and performing intent recognition on the user instruction based on a first algorithm model to obtain a first intent; Determining whether there is a second intent in a target intent set that matches the first intent, wherein the intent in the target intent set corresponds to a first type of instruction; Corresponding to the presence of the second intent in the target intent set, executing the user instruction based on the first intent; Corresponding to the absence of the second intent in the target intent set, performing intent recognition on the user instruction based on the second algorithm model to obtain a third intent, and executing the user instruction based on the third intent; wherein the accuracy of the second algorithm model in identifying the intention of the second type of instruction is higher than the accuracy of the first algorithm model in identifying the intention of the second type of instruction; and The processing resources required for the second algorithm model to run are greater than the processing resources required for the first algorithm model to run.
2. The method according to claim 1, characterized in that The speed at which the first algorithm model recognizes the first type of instructions is faster than the speed at which the second algorithm model recognizes the first type of instructions.
3. The method according to claim 1, characterized in that The target intent set is determined based on the following method: Acquiring, based on the human-computer interaction system, a plurality of data pairs consisting of a plurality of historical user instructions and a plurality of historical user intentions corresponding to the plurality of historical user instructions; Performing feature extraction on the multiple data pairs to obtain a data pair feature vector corresponding to each data pair, wherein the data pair feature vector is used to represent the length of historical user instructions in each data pair, the complexity of the historical user instructions in each data pair, and the proportion of historical user intentions in each data pair; Clustering the plurality of data pairs based on the data pair feature vectors corresponding to the data pairs to obtain a data pair clustering result; The target intent set is obtained based on the data pair clustering that meets the first condition in the data pair clustering results.
4. The method according to claim 3, characterized in that The data pair eigenvalue corresponds to a first eigenvalue, a second eigenvalue and a third eigenvalue, wherein the longer the length of the historical user instructions in each data pair is, the larger the first eigenvalue is, the higher the complexity of the historical user instructions in each data pair is, the larger the second eigenvalue is, the greater the proportion of historical user intentions in each data pair is, and the smaller the third eigenvalue is.
5. The method according to claim 3, characterized in that The first condition includes: A vector average value of a plurality of first data pairs corresponding to a first data pair cluster in the data pair clustering result is smaller than a vector threshold.
6. The method according to claim 3, characterized in that The step of clustering the data pairs that meet the first condition based on the data pair clustering results to obtain the target intent set includes: Selecting, from the data pair clustering results, the first historical user intention of the data pairs included in the data pair cluster that meets the first condition; Based on the selected first historical user intent, the target intent set is determined.
7. The method according to claim 6, characterized in that The method further comprises: Selecting, from the data pair clustering results, the second historical user intentions of the data pairs included in the data pair clusters that do not meet the first condition; Determining a non-target intent set based on the selected second historical user intent; corresponding to the presence of repeated historical user intents in the target intent set and the non-target intent set, determining a first proportion of the number of repeated historical user intents in the target intent set to the total number of repeated historical user intents in the multiple historical user intents; Corresponding to the first ratio being greater than or equal to a ratio threshold, retaining the repeated historical user intent in the target intent set, and deleting the repeated historical user intent in the non-target intent set; Corresponding to the first ratio being less than the ratio threshold, the repeated historical user intent in the target intent set is deleted, and the repeated historical user intent is retained in the non-target intent set.
8. The method according to claim 1, characterized in that The loss function of the first algorithm model during training includes a first weight and / or a second weight, and a loss value obtained based on the loss function is positively correlated with the first weight and / or the second weight; The first weight is determined based on the text length of the historical user instructions used for training, and the first weight is negatively correlated with the text length; The second weight is determined based on whether the historical user intent corresponding to the historical user instruction used for training belongs to the target intent set, and The second weight is a first value or a second value, wherein the first value corresponding to the historical user instruction whose corresponding historical user intention belongs to the target intention set is greater than the second value corresponding to the historical user instruction whose corresponding historical user intention does not belong to the target intention set.
9. An electronic device, characterized in that: include: one or more processors; One or more memories; the one or more memories store one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device executes the interaction method according to any one of claims 1 to 8.
10. A readable storage medium, characterized in that: The readable storage medium stores instructions, which, when executed on an electronic device, enable the electronic device to execute the interaction method according to any one of claims 1 to 8.
11. A computer program product, characterized in that include: A computer program or instruction, which, when executed on an electronic device, causes the electronic device to execute the interaction method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Intention recognition method and question and answer method of query statement and computing equipment
CN113449089A
Intention recognition method and device, electronic equipment and storage medium
CN114706945A
Intention recognition method and device, electronic equipment and storage medium
CN117708266A
Man-machine interaction method, device and equipment based on large model, medium and product
CN118656476A
Voice interaction method and apparatus, and terminal device
WO2021196981A1
Cited By
Training method and device of intention recognition model, equipment and medium
CN121302040A