Interaction methods, electronic devices, storage media and program products

By combining small-scale and large-scale language models in electronic devices and selecting the appropriate model for intent recognition based on the type of user instruction, the problem of balancing speed and accuracy in intent recognition in existing technologies is solved, thus improving interaction efficiency.

CN120429591BActive Publication Date: 2026-04-03HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies cannot simultaneously guarantee the accuracy and speed of intent recognition during user interaction with electronic devices, thus affecting user experience.

Method used

A combination of small-scale and large-scale language models is used. After detecting user commands, the small model is first used for preliminary intent recognition. If it matches a simple intent set, it is executed directly; otherwise, the large model is used for further recognition, ensuring the accuracy and speed of intent recognition.

Benefits of technology

While ensuring the accuracy of intent recognition results, the speed of intent recognition has been improved, thus increasing interaction efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429591B_ABST
    Figure CN120429591B_ABST
Patent Text Reader

Abstract

This application relates to the field of computer technology, and in particular to an interaction method, electronic device, storage medium, and program product. In this method, the electronic device can pre-store a set of simple intents, where each simple intent corresponds to a simple instruction. During interaction between the electronic device and the user, after detecting a user instruction, the electronic device can first perform intent recognition on the user instruction based on a small model to obtain a first intent. Then, it determines whether a second intent matches the first intent in the set of simple intents. If a second intent exists, it indicates that the user instruction is a simple instruction, and the electronic device can execute the user instruction based on the first intent. If a second intent does not exist, it indicates that the user instruction is not a simple instruction, and the electronic device then recognizes the user instruction based on a larger model to obtain a third intent, and finally executes the user instruction based on the third intent. This method ensures both the accuracy and speed of intent recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to an interaction method, electronic device, storage medium, and program product. Background Technology

[0002] Currently, mobile phones and other electronic devices typically include smart assistant applications (APPs). Users can interact with electronic devices through these APPs, instructing them to perform functions such as information retrieval and device control. During the interaction, the electronic device can perform intent understanding and recognition (hereinafter referred to as intent recognition) on user commands (such as text commands, voice commands, etc.) based on relevant models to obtain the intent represented by the user command, and then execute the corresponding action according to the obtained intent to complete the user command.

[0003] For example, if a user's instruction is "Please turn on Bluetooth for me," the electronic device can understand that the intention represented by this instruction is: turn on Bluetooth. Then, based on this intention, the electronic device performs the corresponding action (turns on / starts Bluetooth) and displays feedback information, such as "OK, Bluetooth has been turned on for you" on the screen.

[0004] Based on the foregoing, electronic devices can perform intent recognition of user commands based on relevant models, such as large-scale language models (hereinafter referred to as large models) or small-scale language models (hereinafter referred to as small models). It can be understood that a single interaction between a user and an electronic device can include multiple rounds of dialogue (i.e., the user issues multiple rounds of user commands in a single interaction), and electronic devices typically use one model (i.e., large model or small model) to perform intent recognition of each round of user commands.

[0005] Using only a large model, due to its larger number of parameters, results in higher accuracy for both simple and complex user commands. However, it requires more processing resources (such as computing and storage), potentially slowing down the intent recognition process. Using only a small model, with fewer parameters, results in faster intent recognition for both simple and complex commands. However, it suffers from lower accuracy when recognizing complex user commands. Therefore, neither approach can guarantee both accuracy and speed in intent recognition within a single interaction, potentially degrading the user experience. Summary of the Invention

[0006] This application provides an interaction method, an electronic device, a storage medium, and a program product. This method ensures both the accuracy and speed of intent recognition results.

[0007] In a first aspect, this application provides an interaction method applied to an electronic device, the electronic device including a human-computer interaction system, the human-computer interaction system including a first algorithm model and a second algorithm model, and the method including: detecting a user instruction; performing intent recognition on the user instruction based on the first algorithm model to obtain a first intent; determining whether a second intent matching the first intent exists in a target intent set, wherein the intents in the target intent set correspond to a first type of instruction; corresponding to the existence of a second intent in the target intent set, executing the user instruction based on the first intent; corresponding to the absence of a 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 intent obtained by the second algorithm model in recognizing the second type of instruction is higher than the accuracy of the intent obtained by the first algorithm model in recognizing the second type of instruction; and the processing resources required for the operation of the second algorithm model are greater than the processing resources required for the operation of the first algorithm model.

[0008] In this 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 instruction can be a simple instruction, and the target intent set can be a simple intent set.

[0009] It is understandable 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. In this case, the accuracy of the first intent corresponding to the user instruction obtained by the first algorithm model is relatively high. Therefore, the electronic device can directly execute the user instruction based on the first intent. This method of executing user instructions based on the first intent when there is a second intent in the target intent set can improve the accuracy and efficiency of user instruction execution.

[0010] If the electronic device determines that there is no 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 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 the third intent. In this case, the accuracy of the third intent obtained by the second algorithm model is high, thus making the execution accuracy of the user instruction higher.

[0011] In one possible implementation of the first aspect, the first algorithm model recognizes the first type of instructions faster than the second algorithm model recognizes the first type of instructions.

[0012] It is understandable that since the first algorithm model recognizes simple instructions faster than the second algorithm model, when a second intention exists in the target intention set, executing user instructions based on the first intention can improve the execution speed of user instructions and thus improve the execution efficiency of user instructions.

[0013] The interaction method provided in this application can identify different user commands based on different models in a single interaction between a user and an electronic device (e.g., including multiple rounds of user commands), and then execute the user commands based on the intent obtained from the user commands identified by different models. This can improve the speed of intent recognition and the efficiency of user command execution while ensuring the accuracy of intent recognition results, thereby improving the interaction efficiency.

[0014] In one possible implementation of the first aspect, the target intent set is determined as follows: Multiple data pairs are acquired from a human-computer interaction system, consisting of multiple historical user instructions and multiple historical user intents corresponding to those instructions; features are extracted from the multiple data pairs to obtain a data pair feature vector for each data pair, wherein the data pair feature vector is 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 intents in each data pair; multiple data pairs are clustered based on the data pair feature vectors corresponding to each data pair to obtain a data pair clustering result; and the target intent set is obtained by clustering the data pairs that satisfy the first condition in the data pair clustering result.

[0015] It is understandable that, since there may be the same historical user intent among multiple historical user intents, the proportion of historical user intents in each data pair can be expressed as the proportion of the number of historical user intents in a certain data pair to the total number of historical user intents.

[0016] For example, if the number of historical user intents in a certain data pair is 3 (meaning there are two other data pairs with the same historical user intents as the one in the data pair), and the total number of historical user intents is 100, then the proportion of historical user intents in the data pair can be determined to be 3 / 100.

[0017] Furthermore, in this application, the feature vector corresponding to each data pair is determined based on the length and complexity of historical user instructions and the proportion of historical user intents in each data pair. Therefore, the data pair clustering results obtained based on the data pair feature vectors can more accurately distinguish between simple and non-simple instructions among multiple historical user instructions, as well as simple and non-simple intents among multiple historical user intents, thereby making the target intent set more accurate.

[0018] In one possible implementation of the first aspect, the data pair feature vectors correspond to a first feature value, a second feature value, and a third feature value, wherein the longer the historical user instruction in each data pair is, the larger the first feature value is; the higher the complexity of the historical user instruction in each data pair is, the larger the second feature value is; the larger the proportion of historical user intent in each data pair is, the smaller the third feature value is.

[0019] In one possible implementation of the first aspect, the first condition includes: the average vector 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 is understandable that if the average vector of multiple first data pairs corresponding to the first data pair cluster is less than the vector threshold, it indicates 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 intents in the first data pairs are also simpler. Therefore, the accuracy of the target intent set obtained by the electronic device based on the clustering of data pairs that meet the first condition is also higher.

[0021] In one possible implementation of the first aspect, a target intent set is obtained by clustering data pairs that satisfy 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 results that satisfy the first condition; and determining the target intent set based on the selected first historical user intent.

[0022] In one possible implementation of the first aspect, the method further includes: selecting second historical user intents from the data pair clustering results that do not satisfy the first condition; determining a non-target intent set based on the selected second historical user intents; determining a first proportion of the number of duplicate historical user intents in the target intent set relative to the total number of duplicate historical user intents among multiple historical user intents, corresponding to the existence of duplicate historical user intents in the target intent set and the non-target intent set; retaining duplicate historical user intents in the target intent set and deleting duplicate historical user intents in the non-target intent set, corresponding to the first proportion being greater than or equal to a proportion threshold; deleting duplicate historical user intents in the target intent set and retaining duplicate historical user intents in the non-target intent set, corresponding to the first proportion being less than a proportion threshold.

[0023] It is understandable that multiple simple intents within the target intent set may contain the same simple intent, and the same non-simple intents may also exist within the non-target intent set. Therefore, if the electronic device determines that duplicate historical user intents exist in both the target and non-target intent sets, it can determine a first number of duplicate historical user intents in the target intent set and a second number of duplicate historical user intents in the non-target intent set. Then, the electronic device determines a first proportion of the first number to the sum of the first and second numbers, and further determines whether the duplicate historical user intent belongs to the target intent set or the non-target intent set based on the relationship between the first proportion and a proportion threshold.

[0024] This method can determine whether a repeated historical user intent belongs to the target intent set or the non-target intent set based on a first proportion, when repeated historical user intents exist in both the target intent set and the non-target intent set. This can further improve the accuracy of simple intents in the target intent set and the accuracy of non-simple intents in the non-target intent set.

[0025] In one possible implementation of the first aspect, the loss function of the first algorithm model during training 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 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 intent belongs to the target intent set is greater than the second value corresponding to the historical user instruction whose corresponding historical user intent does not belong to the target intent set.

[0026] It is understood that the shorter the text length of the historical user instructions used for training, the greater the likelihood 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. Furthermore, if the historical user intent corresponding to the historical user instruction used for training belongs to the target intent set, it indicates that the historical user instruction is a simple instruction. Therefore, in this application, when the historical user instruction used for training is a simple instruction, the value of the second weight is also larger (e.g., the first value is greater than the second value).

[0027] In other words, during the training of the first algorithm model, if the historical user commands used for training are simple commands, then the loss value obtained based on the loss function will be larger. During training, in order to gradually reduce the large loss value until the training termination condition is met, the first algorithm model may be trained multiple times, thus resulting in higher accuracy for the trained first algorithm model. Therefore, this method of setting the loss function allows the first algorithm model to obtain higher accuracy in predicting the intent corresponding to simple commands.

[0028] In a second aspect, this application provides an electronic device comprising: one or more processors; one or more memories; the one or more memories storing one or more programs, which, when executed by one or more processors, cause the electronic device to perform the interaction method of the first aspect and any possible implementation thereof.

[0029] Thirdly, this application provides a readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the interaction method of the first aspect and any possible implementation of the first aspect.

[0030] Fourthly, this application provides a computer program product comprising: a computer program or instructions that, when executed on an electronic device, cause the electronic device to perform the first aspect and any possible implementation of the interaction method of the first aspect.

[0031] The beneficial effects of the second to fourth aspects can be found in the first aspect and the beneficial effects of any possible implementation of the first aspect, and will not be repeated here. Attached Figure Description

[0032] Figure 1 According to some embodiments of this application, a schematic diagram of the interactive interface of a mobile phone 100 during an interaction process is shown.

[0033] Figure 2 According to some embodiments of this application, a schematic diagram of the interactive interface of mobile phone 100 during another interaction process is shown;

[0034] Figure 3 According to some embodiments of this application, a flowchart of an interaction method is shown;

[0035] Figure 4 According to some embodiments of this application, a flowchart illustrating a simple method for determining a set of intents is shown;

[0036] Figure 5 According to some embodiments of this application, a flowchart illustrating another simple method for determining a set of intents is shown;

[0037] Figure 6 According to some embodiments of this application, a flowchart illustrating the training process of a small model is shown;

[0038] Figure 7 According to some embodiments of this application, a schematic diagram of the software structure of a mobile phone 100 is shown;

[0039] Figure 8 According to some embodiments of this application, a schematic diagram of the hardware structure of an electronic device is shown. Detailed Implementation

[0040] The illustrative embodiments of this 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 methods provided in this application can be applied to any electronic device capable of interacting with a user, including but not limited to mobile stations (MS) and mobile terminals (MT). For example, electronic devices can be mobile phones, smart TVs, wearable devices, tablets, desktop computers, laptops, virtual reality (VR) devices, augmented reality (AR) devices, terminals in industrial control, self-driving, remote medical surgery, smart grids, transportation safety, smart cities, smart homes, and so on. This application does not limit the specific form of the electronic device.

[0042] To better understand the solution of this application, the relevant terms involved in this application will be explained first.

[0043] Simple instructions: These are user instructions that include a direct and clear need and are relatively short. For example, a user instruction like "What's the weather like today?" indicates a need to check today's weather. A user instruction like "Please turn on Bluetooth for me" indicates a need to turn on Bluetooth. As can be understood, in both examples above, the needs in the user instructions are relatively direct and clear; therefore, both of these user instructions are simple instructions.

[0044] Complex instructions: In this application, "complex instructions" refers to instructions other than simple instructions, including user instructions that do not directly address needs (such as those requiring reasoning) or have multiple or lengthy requirements. For example, if a user instruction is "Set an alarm for 9 AM on every odd-numbered day next month," the specific month represented by "next month" requires reasoning. For instance, if the current month is August, it needs to be deduced that the next month is September. Furthermore, the meaning of "odd-numbered day" needs to be understood and reasoned to determine it as "1, 3, 5, etc." Therefore, this user instruction includes non-direct needs (i.e., requires reasoning) and is thus a complex instruction. Another example is a user instruction "Set an alarm for 9 AM on Friday and create a business trip schedule for 5 PM on Friday." This user instruction includes two needs: setting an alarm for 9 AM on Friday and creating a business trip schedule for 5 PM on Friday. These are multiple needs, and the user instruction is lengthy; therefore, this user instruction is also a complex instruction.

[0045] Small-scale language models (i.e., small models) refer to machine learning or deep learning models that are relatively small in scale and simple in structure. These models are typically pre-trained on small corpora and have the ability to understand simple instructions; that is, they achieve high accuracy in intent recognition when dealing with simple instructions. Furthermore, because these small models have fewer parameters, they typically require fewer processing resources for intent recognition, resulting in faster recognition speeds. However, due to their limited parameter count, these small models achieve lower accuracy in intent recognition when dealing with complex instructions.

[0046] For example, if the user command is a simple command, such as "Please turn on Bluetooth for me", the small model can recognize the intent represented by the user command as: turn on Bluetooth. If the user command is a complex command, such as "Please set an alarm for 9:00 AM on every odd-numbered day next month", the small model may not be able to accurately identify the specific month represented by "next month", or it may not be able to accurately identify the specific meaning represented by "every odd-numbered day", thus resulting in lower accuracy of the small model in recognizing the user command.

[0047] For example, if the user's instruction is "Set an alarm for 9 a.m. on Friday and create a business trip schedule for 5 p.m. on Friday", because the small model has fewer parameters and less computation, it may only recognize the intention of "set an alarm for 9 a.m. on Friday" and not the intention of "create a business trip schedule for 5 p.m. on Friday", resulting in lower accuracy of the intention recognition results.

[0048] Large-scale language models (i.e., large models) refer to machine learning or deep learning models that are larger in scale and more complex in structure. These models are typically pre-trained on large corpora, enabling them to understand both simple and complex instructions, meaning that the accuracy of intent recognition results obtained by such large models is relatively high. However, due to the large number of parameters required, these large models demand significant processing resources, resulting in slower recognition speeds.

[0049] For example, if the user command is a simple command, such as "Please turn on Bluetooth for me", the large model can recognize the intent represented by the user command as turning on Bluetooth. If the user command is a complex command, such as "Please set an alarm for 9 AM on every odd-numbered day 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 represented by "every odd-numbered day", with high accuracy in intent recognition results.

[0050] For example, if the user instruction is "Set an alarm for 9 a.m. on Friday and create a business trip schedule for 5 p.m. on Friday", the large model can identify the intent represented by the user instruction as: set an alarm for 9 a.m. on Friday and create a business trip schedule for 5 p.m. on Friday. The accuracy of the intent recognition result is relatively high.

[0051] Based on the foregoing, in a single interaction between a user and an electronic device (such as a terminal device), intent recognition for each round of user commands is typically based on only one model (i.e., a large model or a small model). The following description, in conjunction with the accompanying drawings and using a mobile phone 100 as an example, details the current state of intent recognition.

[0052] Figure 1 A schematic diagram of the interactive interface of a smart assistant app is shown. For example... Figure 1 As shown, when the smart assistant app is launched on mobile phone 100, the interactive interface 101 can be displayed. Users can issue user commands (text commands, voice commands, image commands) to interact with mobile phone 100. Taking mobile phone 100's intent recognition of multiple rounds of user commands in a single interaction based on a large model as an example, such as... Figure 1 As shown, when the mobile phone 100 detects the user command corresponding to the display box 102 (e.g., "Please help me turn on Bluetooth"), it can recognize the intent represented by the user command 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 a user instruction corresponding to display box 104 (e.g., "Set an alarm for 9 AM on every odd-numbered day next month"), if the current month is August, the big data model can recognize the intent represented by the user instruction corresponding to display box 104 as: setting an alarm for 9 AM on the 1st, 3rd, 5th...29th of September. Then, mobile phone 100 sets the alarm according to this intent and displays the feedback information corresponding to display box 105, such as "I have set an alarm for 9 AM on the 1st, 3rd, 5th...29th of September."

[0054] When the mobile phone 100 detects the user instruction corresponding to the display box 106 (e.g., "Set an alarm for 9 AM on Friday and create a business trip schedule for 5 PM on Friday"), the big data model can recognize the intent represented by the user instruction corresponding to the display box 106 as: set an alarm for 9 AM on Friday and create a business trip schedule for 5 PM on Friday. Then, the mobile phone 100 sets the alarm and creates the schedule according to the intent, and displays the feedback information corresponding to the display box 107, such as "I have set an alarm for 9 AM on Friday and created a schedule for 5 PM on Friday."

[0055] It's understandable that when the phone 100 performs intent recognition based on the large model for user commands (simple commands) corresponding to display frame 102, user commands (complex commands) corresponding to display frame 104, and user commands (complex commands) corresponding to display frame 106, the accuracy of the intent recognition results is relatively high. However, due to the large number of parameters in the large model, some unnecessary processing resources may be needed when recognizing simple commands (such as the user command corresponding to display frame 102), resulting in slower intent recognition speed, increasing the interval between the execution time and the issuance time of the user command, and affecting the user experience.

[0056] Taking the example of a mobile phone 100 performing intent recognition on multiple rounds of user commands in a single interaction based on a small model, such as... Figure 2 As shown, when the mobile phone 100 detects the user command corresponding to the display box 102 (e.g., "Please help me turn on Bluetooth"), it can recognize the intent represented by the user command 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 a user instruction corresponding to display box 104 (e.g., "Set an alarm for 9 AM on every odd-numbered day of next month"), for example, the small model may not accurately identify the specific month represented by "next month" (e.g., if "next month" refers to September, the small model may not be able to determine the meaning of "next month" and thus set an alarm in the current month (August), or it may not accurately identify the specific meaning of "every odd-numbered day". Based on the above description, the small model may, for example, identify the intent represented by the user instruction corresponding to display box 104 as: set an alarm for 9 AM on the 1st, 2nd, 3rd...9th of August. Then, the mobile phone 100 sets the alarm according to this intent and displays the feedback information corresponding to display box 201, such as "I have set an alarm for 9 AM on the 1st, 2nd, 3rd...9th of this month".

[0058] When the mobile phone 100 detects the user command corresponding to the display box 106 (e.g., "Set an alarm for 9 AM on Friday, and create a business trip schedule for me at 5 PM on Friday"), the small model may only recognize the intent of "Set an alarm for 9 AM on Friday," and thus identify the intent represented by the user command corresponding to the display box 106 as: Set an alarm for 9 AM on Friday. Then, the mobile phone 100 sets the alarm according to this intent and displays the feedback information corresponding to the display box 202, such as "Your alarm for 9 AM on Friday has been set."

[0059] It is understandable that the user command corresponding to display box 102 is a simple command. When mobile phone 100 performs intent recognition on the user command corresponding to display box 102 based on a small model, the accuracy of the intent recognition result is relatively high. However, because the small model has a small number of parameters, when performing intent recognition on complex commands (such as the user commands corresponding to display box 104 and display box 106), it may not be able to accurately understand the intent corresponding to the complex commands, thus resulting in lower accuracy of the intent recognition result.

[0060] In summary, during the interaction between the user and the mobile phone 100, if the user commands issued by the user include both simple and complex commands, the existing interaction methods cannot simultaneously guarantee the accuracy and speed of intent recognition, thus affecting the quality of the interaction.

[0061] Therefore, to solve the above problems, this application provides an interaction method. In this method, a set of simple intents (as an example of a target intent set) is pre-stored in the terminal device. The set of simple intents 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, etc. It can be understood that the user instruction corresponding to the simple intent in the set of simple intents is a simple instruction (as an example of a first type of instruction). Thus, in subsequent interactions with the user, after receiving a user instruction, the terminal device can first identify the intent represented by the user instruction based on a small model (as an example of a first algorithm model) to obtain the first intent corresponding to the user instruction. Then, it determines whether there is a second intent matching the first intent in the pre-stored set of simple intents. If a second intent exists, it means the user instruction is a simple instruction, and the terminal device can directly execute the user instruction according to the first intent. If no second intent exists, it means the user instruction is not a simple instruction, and the user instruction is again identified based on a large model (as an example of a second algorithm model) to obtain a third intent, and the user instruction is executed according to the third intent.

[0062] In some embodiments, the terminal device can 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 a second type of instruction). It is understood that the accuracy of the intent obtained by the large model in recognizing complex instructions is higher than that of the intent obtained by the small model in recognizing complex instructions. Therefore, even when there is no second intent in the simple intent set (i.e., the user instruction does not belong to a simple instruction, but rather to a complex instruction), the terminal device can recognize the user instruction based on the large model to obtain a third intent, and complete the user instruction based on the third intent.

[0063] In this approach, the user instruction corresponding to the first intent is determined to be a simple instruction by judging whether it matches an intent in the set of simple intents. If the user instruction is a simple instruction, it is executed directly based on the first intent. If it is not a simple instruction (e.g., the user instruction is a complex instruction), intent recognition is performed based on a larger model to obtain a third intent, and then the user instruction is executed based on the third intent. This method can identify different user instructions based on different models in a single interaction between the user and the terminal device (e.g., including multiple rounds of user instructions), and then execute the user instruction based on the intents obtained from the user instructions identified by different models. This can improve the speed of intent recognition while ensuring the accuracy of the intent recognition results.

[0064] In some embodiments, if the user's instruction is "Please turn on Bluetooth for me", the small model identifies the intent represented by the user instruction and may determine that the first intent corresponding to the user instruction is: turn on Bluetooth. Then, if there is a second intent in the set of simple intents that matches the first intent, such as the intent "turn on Bluetooth", it can be determined that the first intent belongs to a simple intent, and thus the user instruction "Please turn on Bluetooth for me" is determined to be a simple instruction. Then, the user instruction is executed directly based on the first intent.

[0065] In other embodiments, if the user's instruction is "Set an alarm for me at 9 AM on every odd-numbered day next month," the small model identifies the intent represented by the user instruction and may obtain a first intent corresponding to the user instruction as: "Set an alarm for 9 AM on the 1st, 2nd, 3rd...9th of August." Then, if there is no second intent in the set of simple intents that matches the first intent, for example, if there is no intent like "Set an alarm for 9 AM on the 1st, 2nd, 3rd...9th of August," it can be determined that the first intent does not belong to simple intents, and thus the user instruction "Set an alarm for me at 9 AM on every odd-numbered day next month" is not a simple instruction. The terminal device then identifies the user instruction based on the large model. For example, the large model obtains a third intent as: "Set an alarm for 9 AM on the 1st, 3rd, 5th...29th of September," and then the terminal device executes the user instruction based on this third intent.

[0066] In some embodiments, the terminal device can determine whether there exists 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 take a simple intent in the simple intent set whose similarity to the first intent meets a similarity threshold as the second intent that matches the first intent. If there are multiple simple intents in the simple intent set whose similarity to the first intent meets the similarity threshold, then the simple intent with the highest similarity among the multiple simple intents in the simple intent set whose similarity to the first intent meets the similarity threshold can be taken 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 simple intents preset by the user or the system. When the simple intent set includes simple intents previously used by the user of the terminal device, the method for determining the simple intents may include: obtaining historical user commands issued by the user of the terminal device, and historical user intents corresponding to the historical user commands; clustering multiple data pairs consisting of historical user commands and historical user intents to obtain simple intents and non-simple intents.

[0068] The method of clustering multiple data pairs consisting of historical user commands and historical user intentions to obtain simple intention sets and non-simple intention sets can include the following: the terminal device can extract features from each data pair to obtain a data pair feature vector (wherein the data pair feature vector can be used to characterize the length, complexity, etc. of historical user commands), and then cluster multiple data pairs based on the data pair feature vectors to obtain data pair clustering results. Based on the historical user intentions of multiple data pairs corresponding to the data pair clustering that meet relevant preset conditions (as an example of the first condition), a simple intention set is obtained, such as forming a simple intention set based on the aforementioned historical user intentions. For example, the data pair clustering that meets the first condition can be data pair clustering where the average vector of the corresponding multiple first data pairs is less than a vector threshold.

[0069] In some embodiments, the terminal device may also form a non-simple intent set based on the historical user intents of multiple data pairs corresponding to data pairs that do not meet the first condition clustering.

[0070] In some other embodiments, after determining the simple intent set and the non-simple intent set, the terminal device can further determine whether there are duplicate historical user intents in the simple intent set and the non-simple intent set. If duplicate historical user intents exist in the simple intent set and the non-simple intent set, and most of the intents in the duplicate historical user intents are simple intents, then the duplicate historical user intents can be determined to be simple intents. Conversely, if most of the intents in the duplicate historical user intents are non-simple intents, then the duplicate historical user intents can be determined to be non-simple intents.

[0071] Specifically, if duplicate historical user intents exist in both the simple intent set and the non-simple intent set, a first number of these duplicate historical user intents in the simple intent set and a second number in the non-simple intent set are determined. In some embodiments, if the first number accounts for a first proportion greater than or equal to a proportion threshold, it can be determined that the duplicate historical user intent belongs to a simple intent, and thus the duplicate historical user intent continues to be stored in the simple intent set, while the duplicate historical user intent in the non-simple intent set is deleted. If the first proportion is less than the proportion threshold, it can be determined that the duplicate historical user intent does not belong to a simple intent, and thus the duplicate historical user intent is deleted from the simple intent set, while the duplicate historical user intent continues to be stored in the non-simple intent set.

[0072] The interaction method provided in this application will be described in detail below with reference to the accompanying drawings. Figure 3 A flowchart illustrating an interaction method provided in this application is shown. Figure 3 The execution entities for each step in the illustrated process are electronic devices (such as terminal devices). For ease of description, the following will describe them in more detail. Figure 3 The executing entity for each step in the process described will not be repeated, and the following descriptions in this application will use mobile phone 100 as the terminal device. Figure 3 As shown, this method includes, but is not limited to, the following schemes:

[0073] 301: User command detected. Based on the small model, the user command is used to identify intent and obtain the first intent.

[0074] This application does not limit the form of user instructions. For example, user instructions can be text instructions, voice instructions, air gestures, etc. Taking voice instructions as an example, such as... Figure 1 If the mobile phone 100 receives the voice command "Please turn on Bluetooth for me" from the user, it can convert the voice command into text and display it in the interactive interface 101, as shown in the display box 102 in the interactive interface 101.

[0075] After detecting a user command, the mobile phone 100 can first use a small model to perform intent recognition on the user command, thereby obtaining 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 type of user command, in this application, after receiving the user command, the mobile phone 100 can first use a small model to perform intent recognition.

[0076] Taking the detected user command as a simple command as an example, such as Figure 2 As shown, the user command can be the user command "Please turn on Bluetooth" corresponding to display box 102. It can be understood that the small model has a high accuracy in obtaining the first intent by performing intent recognition on this simple command corresponding to display box 102. Therefore, the obtained first intent is, for example, "Turn on Bluetooth".

[0077] Taking the detected user command as a complex command as an example, such as Figure 2 As shown, the user instruction can be the user instruction corresponding to display box 104, "Set an alarm for me at 9:00 AM on every odd-numbered day next month." It is understandable that the accuracy of the first intent obtained by the small model from this complex instruction corresponding to display box 104 is low, that is, the obtained first intent may be inaccurate. For example, the first intent could be: Set an alarm for 9:00 AM on the 1st, 2nd, 3rd...9th of August.

[0078] Taking the detected user command as a complex command as an example, such as Figure 2As shown, the user instruction can be the user instruction corresponding to display box 106, "Set an alarm for 9 AM on Friday, and create a business trip schedule for 5 PM on Friday." The accuracy of the first intent obtained by the small model from this complex instruction corresponding to display box 106 is low, that is, the obtained first intent may be inaccurate. For example, the first intent could be: Set an alarm for 9 AM on Friday.

[0079] 302: Determine if there exists a second intent in the set of simple intents that matches the first intent.

[0080] It is understandable that after determining the first intent, the mobile phone 100 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 judging whether there is a second intent in the set of simple intents that matches the first intent.

[0081] The simple intent set can include simple intents previously used by the user on the terminal device, simple intents uploaded by other terminal devices and sent by the server, or simple intents preset by the user or the system. Each simple intent in the simple intent set corresponds to a simple instruction. In other words, the instructions corresponding to the simple intents in the simple intent set are simple instructions. 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 thus it can determine that the user instruction corresponding to the first intent belongs to the simple instruction corresponding to the simple intent.

[0083] After determining that the user command is a simple command, the mobile phone 100 can execute command 303 because the accuracy of the first intent obtained by the small model in the intent recognition of simple commands is relatively high. The mobile phone 100 executes the user command based on the first intent obtained by the small model.

[0084] If the mobile phone 100 determines that there is no second intent in the set of simple intents that matches the first intent, it can determine that the user instruction is not a simple instruction, that is, a complex instruction. The first intent obtained by the small model for intent recognition of complex instructions may be inaccurate. Therefore, a 304 error can be executed. Then, the user instruction can be identified based on the large model to obtain the third intent, and the user instruction can be executed based on the third intent.

[0085] This application does not limit the method by which the mobile phone 100 determines whether a second intent matching the first intent exists in the set of simple intents. For example, the mobile phone 100 can calculate the similarity between each simple intent in the set and the first intent, and then take the simple intent in the set whose similarity to the first intent meets a similarity threshold as the second intent matching the first intent. If there are multiple simple intents whose similarity meets the similarity threshold, then the simple intent with the highest similarity among the multiple simple intents in the set whose similarity to the first intent meets the similarity threshold can be taken as the second intent matching the first intent.

[0086] In some embodiments, such as Figure 2 As shown, based on the small model, the mobile phone 100 determines the first intent corresponding to the user instruction "Please help me turn on Bluetooth" corresponding to the display box 102 as follows: After turning on Bluetooth, it can further determine whether there is a second intent in the set of simple intents that matches the first intent. If there is a second intent in the set of simple intents, such as the intent "turn on Bluetooth" in the set of simple intents, then the mobile phone 100 can determine that the user instruction corresponding to the 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 a small model, that the first intent corresponding to the user instruction "Set an alarm for 9 AM on every odd-numbered day next month" corresponding to the display box 104 is: after setting an alarm for 9 AM on the 1st, 2nd, 3rd...9th of August, it can further determine whether there is a second intent in the set of simple intents that matches the first intent. If there is no second intent in the set of simple intents, for example, if the intent "Set an alarm for 9 AM on the 1st, 2nd, 3rd...9th of August" does not exist in the set of simple intents, then the mobile phone 100 can determine that the user instruction corresponding to the display box 104 is not a simple instruction but a complex instruction. It can then perform intent recognition on the user instruction again based on a large model to obtain a third intent, and execute the user instruction based on the third intent.

[0088] 303: User instructions are executed based on the first intent.

[0089] It's understandable that if the primary intent is to turn on Bluetooth, phone 100 can turn on Bluetooth to execute the user command "Please turn on Bluetooth for me." It's also understandable that in this case, phone 100 determines the user command is a simple command; therefore, phone 100 performs intent recognition based on a small model, resulting in a high accuracy of the primary intent. This method of directly executing user commands based on the primary intent recognized by the small model can improve the accuracy and efficiency of user command execution.

[0090] Furthermore, since smaller models recognize simple instructions faster than larger models, executing user instructions based on the first intention can also improve the execution speed of user instructions, thereby increasing the execution efficiency of user instructions, especially when there is a second intention in the set of simple intentions.

[0091] 304: Based on the large model, the user's instructions are identified to obtain the third intent, and the user's instructions are executed based on the third intent.

[0092] It's understandable that a large model requires more processing resources than a small model. Therefore, the accuracy of the intent obtained by the large model in recognizing complex instructions is higher than that obtained by the small model. Thus, when the phone determines that there is no second intent matching the first intent in the set of simple intents—that is, when the user instruction is not a simple instruction but a complex one—the accuracy of the first intent obtained based on the small model may be low. Therefore, the user instruction can be re-identified based on the large model to obtain a third intent. In this case, the accuracy of the third intent is higher than that of the first intent. Executing the user instruction based on the third intent can thus make the execution process of the user instruction more efficient.

[0093] It is understood that the interaction method provided in this application first identifies user commands through a small model to obtain a first intent, and then determines whether the first intent matches the intents in the simple intent set to determine whether the user command corresponding to the first intent is a simple instruction. If the user command is a simple instruction, the user command is executed directly based on the first intent, which can improve the execution speed and efficiency of the user command. If it is not a simple instruction (for example, the user command is a complex instruction), then intent recognition is performed based on a large model to obtain a third intent, and then the user command is executed based on the third intent, which can improve the accuracy of the third intent and thus improve the execution accuracy of the user intent.

[0094] This method can identify different user commands based on different models in a single interaction between the user and the terminal device (e.g., including multiple rounds of user commands), and then execute the user commands based on the intent obtained from the user commands identified by different models. This can improve the speed of intent recognition and the efficiency of user command execution while ensuring the accuracy of intent recognition results, thereby improving the efficiency of interaction.

[0095] The following describes the method for determining the simple intents in the simple intent set mentioned in section 302 above. It can be understood that the simple intent set may include simple intents previously used by the user of mobile phone 100, simple intents uploaded by other terminal devices sent by the server, or simple intents preset by the user or system. This application embodiment does not limit the devices corresponding to the simple intents in the simple intent set.

[0096] If the simple intent set includes simple intents sent by the server and uploaded by other terminal devices, or simple intents preset by the user or system, after obtaining the simple intent, the mobile phone 100 can directly determine whether the simple intent set includes a second intent that matches the first intent.

[0097] For cases where the simple intent set includes simple intents previously used by the user of mobile phone 100, such as... Figure 4 As shown, the methods for determining a simple intent set include:

[0098] 401: Obtain historical user commands issued by the user of mobile phone 100, and the historical user intents corresponding to the historical user commands.

[0099] The historical user commands refer to the user commands issued by the user of mobile phone 100 during their historical interactions with mobile phone 100. It can be understood that mobile phone 100 can obtain user commands issued by the user within a reference time period. This application embodiment does not limit the value of the reference time period; it can be set based on experience or flexibly adjusted according to the actual application scenario. For example, the reference time period can be one week, one month, or six months. Taking a reference time period of six months as an example, mobile phone 100 can obtain historical user commands issued by the user within the past six months.

[0100] It is understood that historical user intent refers to the accurate intent represented by historical user instructions. This application does not limit the method of determining historical user intent. For example, historical user intent can be determined manually, or it can be obtained by using a relevant intent recognition model (such as the large model mentioned above) to identify the intent of historical user instructions.

[0101] 402: Clustering multiple data pairs consisting of historical user commands and historical user intents yields a simple intent set and a non-simple intent set.

[0102] In some embodiments, such as Figure 5 As shown, the methods for clustering multiple data pairs consisting of historical user commands and historical user intents to obtain simple intent sets and non-simple intent sets include:

[0103] 4021: Perform feature extraction on each data pair to obtain multiple features corresponding to each data pair.

[0104] It is understandable that multiple data pairs consisting of historical user commands and historical user intentions can constitute a dataset. In some embodiments, dataset D = {(x i ,y i )}, and i=1, 2,...,N.

[0105] Where, xi Indicates historical user commands; y i This indicates the historical user intent 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 intent.

[0106] This application embodiment does not specify the mobile phone 100 for each data pair (x) i ,y i The categories of extracted features can be limited, which can be set based on experience or flexibly adjusted according to the actual application scenario.

[0107] In this embodiment of the application, the mobile phone 100 can process each data pair (x i ,y i Extract three features, namely f i =(f i,1 ,f i,2 ,f i,3 ).

[0108] in, Indicates historical user intent y i The proportion of the quantity to the total number of data points N (represented as a vector). Among these, historical user intent y... i The ratio of the quantity of data to the total number of data points N can be used as an example of a third feature. It can be understood that historical user intent y... i The larger the proportion of the third feature to the total number of data N, the smaller the third feature value.

[0109] Among them, f i,2 =len(x i ), representing the historical user instruction x i The length of (represented as a vector). Among them, historical user commands x i The length of this 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, the larger the first feature value. This application's embodiments do not apply to historical user commands x. i The length is limited by a metric, for example, mobile phone 100 can determine historical user commands x. i The number of characters.

[0110] Among them, f i,3 =complexity(x i ), representing the historical user instruction x i The complexity (represented as a vector). Wherein, historical user commands x i The complexity value can be used as an example of a second feature value. It can be understood that historical user commands x... iThe greater the complexity, the larger the second eigenvalue. This application's embodiments also do not apply to historical user commands x. i The method for determining the complexity is limited; for example, mobile phone 100 can determine historical user commands x based on a large-scale language model (i.e., a large model). i The complexity.

[0111] 4022: Standardize multiple features for each data pair to obtain the standardized features corresponding to each data pair (as an example of a feature vector for a data pair).

[0112] In this embodiment of the application, the mean value u of each type of feature can be calculated first. j and standard deviation σ j .

[0113] Based on the preceding text, each data pair corresponds to three features f i =(f i,1 ,f i,2 ,f i,3 Therefore, the mean u j =mean(f j ), representing the average of N features corresponding to each feature class. Here, j represents the index of each feature class, 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), representing the standard deviation of the N features corresponding to each category. The meanings of f1, f2, and f3 are the same as described above, the only difference being the calculation method for the mean and standard deviation derived from f1, f2, and f3. Therefore, this application will not further specify the standard deviation σ. j The detailed calculation method will not be elaborated here.

[0118] In some embodiments, the mobile phone 100 determines the mean u corresponding to each type of feature (f1, f2, and f3). j and standard deviation σ j Next, the features of each data pair can be standardized to obtain 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 can 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 distance d ik .

[0121] This application's embodiments do not address the standardized feature z. i With each cluster center μ k distance d ik The calculation method is limited, for example, distance d ik This can be Euclidean distance, etc. Let the distance d be... ik Taking Euclidean distance as an example, d ik =||z i -μ k ||^2.

[0122] Then, the standardized feature z i Assign to the nearest cluster center μ k Corresponding cluster C k C k =argmin(d ik Furthermore, update the cluster centers μ. k The updated cluster centers μ are obtained. k1 For example, cluster centers μ k Updated to clustering C k All standardized features z i The mean, i.e., μ k1 =mean(z) i ), where z i ∈C k .

[0123] Mobile phone 100 can repeat the above process until the clustering termination condition is met, such as the cluster centers no longer changing or the maximum number of iterations being reached. It can be understood that when the clustering termination condition is met, mobile phone 100 can obtain the data pair clustering results, such as obtaining multiple data pair clusters. Mobile phone 100 can obtain a simple intent set based on the data pairs that satisfy the first condition from 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 pairs that do not satisfy the first condition from the multiple data pair clusters.

[0124] This application does not limit the content of the first condition. For example, the first condition includes that the average vector of multiple first data pairs corresponding to the first data pair cluster in the data pair clustering result is less than a vector threshold. That is to say, the mobile phone 100 can obtain a simple intent set based on the first data pairs in the data pair clustering result where the average vector of multiple first data pairs is less than a vector threshold.

[0125] In other embodiments, the mobile phone 100 obtains a simple intent set based on data pairs that satisfy a first condition from multiple data pair clusters. This may include: the mobile phone 100 selecting the first historical user intent of the data pairs included in the data pair clusters that satisfy the first condition, and constructing 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 the clustering of data pairs that do not meet the first condition among multiple data pair clusters. This may include: the mobile phone 100 selecting the second historical user intent of the data pairs included in the data pair clusters that do not meet the first condition, and constructing a non-simple intent set based on the selected second historical user intent.

[0127] It can be understood that the second historical user intent is the intent other than the first historical user intent among the historical user intents mentioned in section 401 above.

[0128] In this approach, simple intents within a set of simple intents are determined based on the user's historical user commands and intentions. These simple intents reflect the user's preferences. Therefore, the method in this application that determines whether a user command is a simple command based on the existence of a second intent within the set of simple intents is more accurate, thereby increasing the efficiency of the user command execution process.

[0129] It is understood that in this embodiment, the simple intent set can be updated periodically, that is, updated once at fixed time intervals. This periodic updating of the simple intent set allows the simple intents in the set to reflect the user's recent preferences, thereby increasing the accuracy of the method for determining whether a user instruction is a simple instruction based on the existence of a second intent in the set, and thus making the execution process of the user instruction more efficient.

[0130] It is understandable that the same intent may exist in both the simple intent set and the non-simple intent set; these are referred to as repeated historical user intents. For example, user instruction I1 is "Set a schedule for me at 9 AM every day in September," and the intent corresponding to user instruction I1 is: Set a schedule for me at 9 AM every day in September. As another example, user instruction I2 is "Set an alarm for me at 9 AM every day next month," where "next month" refers to September, and the intent corresponding to user instruction I2 is also: Set a schedule for me at 9 AM every day in September. When clustering data pairs including user instructions I1 and I2, the intent corresponding to user instruction I1 may be identified as a simple intent, and the intent corresponding to user instruction I2 may be identified as a non-simple intent. That is, the simple intent set and the non-simple intent set contain repeated historical user intents (e.g., setting a schedule for me at 9 AM 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 can further determine whether there are duplicate historical user intents in the simple intent set and the non-simple intent set. If so, a first number of the duplicate historical user intents in the simple intent set and a second number of the duplicate historical user intents in the non-simple intent set are determined. In some embodiments, if the first number accounts for a first proportion greater than or equal to a proportion threshold of the sum of the first number and the second number, it can be determined that the duplicate historical user intent belongs to a simple intent, and then the intent is continued to be stored in the simple intent set, while the duplicate historical user intent 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 the 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 understood that the embodiments of this application do not limit the value of the proportional threshold. It can be set based on experience or flexibly adjusted according to the actual application scenario.

[0134] This method determines whether a repeated historical user intent is a simple intent or a non-simple intent based on the first proportion of the number of repeated historical user intents in the simple intent set to the total number of repeated historical user intents in both the simple and non-simple intent sets. This ensures that an intent exists in only one intent set, improves the accuracy of the judgment result on whether the first intent belongs to a simple intent, and thus improves the execution efficiency of user commands.

[0135] In other embodiments, the type of repeated historical user intent can be determined by whether the number of simple intents in the repeated historical user intents exceeds a threshold. For example, if the number of simple intents is greater than or equal to the 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 threshold, the repeated historical user intent can be determined to be a non-simple intent.

[0136] In other embodiments, this application also adjusts the loss function of the small model during training to achieve higher accuracy in identifying the intent of simple commands. The following is in conjunction with... Figure 6 The training process of the small model is described in detail. For example... Figure 6 As shown, the training process for the small model includes:

[0137] 601: Obtain the training set, which includes user instructions for training and the reference intents corresponding to the user instructions.

[0138] The training set includes user instructions used for training and corresponding reference intentions for those 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 intents included in the training set can be based on the historical user intents y mentioned above. i C types of historical user intent that have been identified.

[0139] This is understandable, given that there may be multiple historical user commands x. i Corresponding historical user intent y i The historical user intents are identical; 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, we can obtain C types of historical user intents, where C is an integer greater than or equal to 1, and N and C are either the same or different. It can be understood that any two historical user intents among the C types are different.

[0140] Taking N=3 as an example, if the historical user intent corresponding to historical user instruction x1 is y1, the historical user intent corresponding to historical user instruction x2 is y2, and the historical user intent corresponding to historical user instruction x3 is y3, and if the historical user intent y1 and the historical user intent y2 are the same, then by classifying and integrating the three historical user intents y1, y2, and y3, we can obtain two types of historical user intents, i.e., C=2.

[0141] It is understandable that the historical user intents obtained based on the above method and the category numbers of historical user intents are in one-to-one correspondence. Taking the above example again, there are two types of historical user intents. Therefore, the first type of historical user intent can be represented by historical user intent y1 (or y2), and the second type of historical user intent can be represented by historical user intent y3.

[0142] 602: Input the user command into the small model to obtain the predicted probability of the user command corresponding to each reference intent.

[0143] To input historical user commands x i For example, the probability that the user instruction predicted by the small model corresponds to the c-th historical user intent can be expressed as (p i ,c), where c=1,2,……,C.

[0144] 603: The loss of the small model is obtained based on the difference between the predicted probability and the reference probability.

[0145] Specifically, in this application, the loss of the small model can be obtained based on the loss function shown in the following formula (1) and the predicted probability and reference probability.

[0146]

[0147] Where Loss represents the loss; i represents the index of the user instruction used for training, and i = 1, 2, ..., N; w i (As an example of the first weight) represents the text weight set based on the text length specified by the user instruction; w c (As an example of a second weight) represents a category weight set based on whether the reference intent belongs to a simple intent; (P i c) represents the user instruction x i The corresponding reference intent belongs to the c-th type of historical user intent; (p i c) represents the user instruction x i The predicted probability that the corresponding predicted intent belongs to the c-th type of historical user intent.

[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 currently input user command x. i The text length; α is the proportional coefficient, a fixed value that can be set based on experience.

[0151] Based on the above formula (2), it can be seen that the user instruction x i The smaller the text length Len, the better. i The larger the value of w, the larger the loss obtained based on formula (1). During the training of a small model, in order to gradually reduce the larger loss to a loss that satisfies the training termination condition, the small model may undergo more training iterations, thus resulting in higher accuracy for the trained small model. Therefore, this type of w... i This configuration allows the small model to achieve higher accuracy in predicting the intent of user commands in short texts. This is understandable, as short text user commands are typically simple, and this method improves the accuracy of the small model in recognizing the intent of simple commands.

[0152] In other embodiments, w c It can be determined based on the following formula (3).

[0153]

[0154] Where β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 This represents 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 type of historical user intent belongs to the historical user intent set of simple intents, then w c =β2. If the current c-th historical user intent does not belong to the historical user intents in the simple intent set, then w c =β1, and β2>β1. This is understandable, because based on the preceding text... Figure 4 The corresponding method has already determined the historical user intents that belong to simple intents. Therefore, when training the small model based on historical user intents, it is possible to know whether the c-th historical user intent belongs to a simple intent, that is, whether the c-th historical user intent belongs to the set of simple intents.

[0156] In the case that the c-th type of historical user intent belongs to the simple intent set, the w setting is... c Larger; when the c-th type of historical user intent does not belong to the simple intent set, the w setting is larger.c Smaller. Based on w i The same setting principle, w c The larger the value of w, the larger the loss obtained based on formula (1). During the training of a small model, in order to gradually reduce the larger loss to a loss that satisfies the training termination condition, the small model may undergo more training iterations, thus resulting in higher accuracy for the trained small model. Therefore, this type of w... c This setting method can make the small model more accurate in predicting the intent corresponding to simple instructions, that is, it can improve the accuracy of the small model in recognizing the intent of simple instructions.

[0157] 604: A small model is trained based on loss, resulting in a fully trained small model.

[0158] It's understandable that after determining the loss in the mobile phone model, a small model can be trained based on that loss until the training termination condition is met, at which point training ends, and the trained small model is obtained. This trained small model can then be used as described earlier. Figure 3 The interaction method shown performs intent recognition on user commands.

[0159] This application does not impose any restrictions on the training termination condition. For example, the training termination condition could be based on the convergence of the loss function.

[0160] The method provided in this application improves the accuracy of intent recognition results obtained by the small model when recognizing simple instructions by changing the loss function during the training process of the small model, thereby improving the execution efficiency of user instructions.

[0161] Figure 7 A schematic diagram of the software structure of a mobile phone 100 according to an embodiment of this application is shown. For example... 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 intent recognition module 2002, and a second intent recognition module 2003.

[0162] The human-computer interaction system 200 is used to interact with the user. It can recognize the user's intent through a small or large model and send the 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, images, etc.) to interact with the user, for example, by displaying it on the interactive interface, or by playing voice feedback information to the user.

[0163] The judgment module 2001 is used to determine whether there is a second intent in the simple intent set that matches the first intent, that is, the judgment module 2001 is used to execute the content involved in 302 above.

[0164] The first intent recognition module 2002 includes a small model for performing intent recognition on the input user command based on the small model, and obtaining the intent recognition result (such as the first intent).

[0165] The second intent recognition module 2003 includes a large model, which is used to perform intent recognition on the input user command (complex command) based on the large model when there is no second intent in the simple intent set, and obtain the intent recognition result (such as a third intent).

[0166] The central control system 210 is used to acquire the intent recognition results output by the human-computer interaction subsystem 200 and execute user commands based on the intent recognition results (such as executing user commands based on a first intent and a third intent, as mentioned above). For example, if the acquired intent recognition result is "Turn on Bluetooth," the central control system 210 can execute the operation of turning on Bluetooth to fulfill the user command "Please turn on Bluetooth for me." 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, this application also provides a readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the interaction method described in the above embodiments.

[0168] In some embodiments, this application also provides a computer program product, which includes a computer program or instructions that, when run on an electronic device, cause the electronic device to perform the interactive methods described in the above embodiments.

[0169] In some embodiments, this application also provides an electronic device, which includes one or more processors; one or more memories; and one or more memories storing one or more programs, which, when executed by one or more processors, cause the electronic device to perform the interactive method described in the above embodiments. The following is in conjunction with... Figure 8 This paper introduces the hardware structure of the electronic device provided in the embodiments of this application.

[0170] Figure 8 A schematic diagram of the hardware structure of an electronic device is shown, wherein the electronic device may be, for example, a mobile phone 100. Taking a mobile phone 100 as an example, as... 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, antenna 1, 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, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a touch sensor 180K, etc.

[0171] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the mobile phone 100. In other embodiments of this application, the mobile phone 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. 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, such as 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). These different processing units may be independent devices or integrated into one or more processors. In this embodiment, when the processor 110 detects that a smart assistant application is open, it can execute the interaction method provided in this embodiment.

[0173] The charging management module 140 is used to receive charging input from the charger. The charger can 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 power the processor 110, internal memory 121, display 194, camera 193, and wireless communication module 160, etc.

[0175] The wireless communication function of mobile phone 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and 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 wireless communication solutions, including 2G / 3G / 4G / 5G, for use on the mobile phone 100. In some embodiments, at least some functional modules of the mobile communication module 150 can be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 can be housed in the same device.

[0178] A modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates 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 solutions for wireless communication applications 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 (NFC), infrared (IR) technology, etc.

[0180] The mobile phone 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0181] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the mobile phone 100 may include one or N displays 194, where N is a positive integer greater than 1. In this embodiment, the mobile phone 100 can interact with the user through the display screens 194.

[0182] The mobile phone 100 can achieve shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0183] The ISP is used to process data fed back by the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing. In some embodiments, the ISP may be located in the camera 193.

[0184] Camera 193 is used to capture still images or videos. In some embodiments, mobile phone 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0185] A digital signal processor (DSP) is used to process digital signals; in addition to digital image signals, it can also process other digital signals. A video codec is used to compress or decompress digital video.

[0186] NPU stands for Neural Network (NN) Computing Processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in mobile phones, such as image recognition, facial recognition, speech recognition, and text understanding.

[0187] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the mobile phone 100. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0188] Internal memory 121 can be used to store computer executable program code, which includes instructions.

[0189] Mobile phone 100 can implement audio functions through audio module 170 and application processor, such as music playback and recording. Audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. Audio module 170 can also be used for encoding and decoding audio signals.

[0190] Touch sensor 180K, also known as a "touch device," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touchscreen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of mobile phone 100, in a different position than display screen 194.

[0191] Buttons 190 include a power button, volume buttons, etc. A motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. An indicator 192 can be an indicator light used to indicate charging status. A 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. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including 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 execute the functions described in this application 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, the 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] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to 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 may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0196] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0197] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0198] It should be noted that in the examples and description of this application, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0199] Although this application has been illustrated and described with reference to certain embodiments thereof, those skilled in the art will understand that various changes in form and detail may be made thereto without departing from the scope of this application.

Claims

1. An interaction method, characterized in that, Applied to electronic devices, the electronic devices include a human-computer interaction system, the human-computer interaction system includes a first algorithm model and a second algorithm model, and The method includes: Upon detecting a user instruction, the user instruction is subjected to intent recognition based on a first algorithm model to obtain a first intent; Determine whether there exists a second intent in the target intent set that matches the first intent, wherein the intent in the target intent set corresponds to a first type of instruction; The second intent exists corresponding to the target intent set, and the user instruction is executed based on the first intent; If the second intent does not exist in the target intent set, the user instruction is identified based on the second algorithm model to obtain a third intent, and the user instruction is executed based on the third intent. The second algorithm model achieves higher accuracy in recognizing the intent derived from the second type of instruction than the first algorithm model. The second algorithm model requires more processing resources to run than the first algorithm model. The target intent set is determined based on the following method: Based on the human-computer interaction system, multiple data pairs are obtained, consisting of multiple historical user commands and multiple historical user intentions corresponding to the multiple historical user commands; Feature extraction is performed on the multiple data pairs to obtain the data pair feature vector corresponding to each data pair. The data pair feature vector is 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 intent in each data pair. Based on the feature vectors of the data pairs corresponding to each data pair, the multiple data pairs are clustered to obtain the data pair clustering results; The target intent set is obtained by clustering data pairs that meet the first condition in the clustering results.

2. The method according to claim 1, characterized in that, The first algorithm model recognizes the first type of instruction faster than the second algorithm model.

3. The method according to claim 1, characterized in that, The data pair feature vectors correspond to a first feature value, a second feature value, and a third feature value. The longer the historical user instruction in each data pair is, the larger the first feature value is, the higher the complexity of the historical user instruction in each data pair is, the larger the second feature value is, the greater the proportion of historical user intent in each data pair is, and the smaller the third feature value is.

4. The method according to claim 1, characterized in that, The first condition includes: The average vector of multiple first data pairs corresponding to the first data pair cluster in the data pair clustering result is less than the vector threshold.

5. The method according to claim 1, characterized in that, The clustering of data pairs that satisfy the first condition based on the data pair clustering results to obtain the target intent set includes: Select the first historical user intent of the data pairs included in the data pair clustering results that satisfy the first condition; Based on the selected first historical user intent, the target intent set is determined.

6. The method according to claim 5, characterized in that, The method further includes: Select the second historical user intent of the data pairs included in the clustering results that do not meet the first condition; Based on the selected second historical user intent, a set of non-target intents is determined; If there are duplicate historical user intentions in the target intent set and the non-target intent set, determine a first proportion of the number of duplicate historical user intentions in the target intent set relative to the total number of duplicate historical user intentions in the plurality of historical user intentions; If the first ratio is greater than or equal to the ratio threshold, the duplicate historical user intents are retained in the target intent set, and the duplicate historical user intents in the non-target intent set are deleted. If the first ratio is less than the ratio threshold, the duplicate historical user intents in the target intent set are deleted, and the duplicate historical user intents are retained in the non-target intent set.

7. 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 the 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 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 either a first value or a second value, wherein the first value corresponding to the historical user intent belonging to the historical user instruction of the target intent set is greater than the second value corresponding to the historical user intent not belonging to the historical user instruction of the target intent set.

8. An electronic device, characterized in that, include: One or more processors; One or more memories; the one or more memories storing one or more programs that, when executed by the one or more processors, cause the electronic device to perform the interaction method of any one of claims 1 to 7.

9. A readable storage medium, characterized in that, The readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the interaction method of any one of claims 1 to 7.

10. A computer program product, characterized in that, include: A computer program or instruction that, when executed on an electronic device, causes the electronic device to perform the interactive method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Intention recognition method and question and answer method of query statement and computing equipment

    CN113449089A