Large language model dialogue intention recognition method and device, equipment and storage medium
By using preset weighting strategies and intention matching sub-models in the intention recognition method of large language model dialogue, the problem of low accuracy of intention recognition in the prior art is solved, and more efficient and accurate intention recognition is achieved.
Patent Information
- Application Number
- CN202411900880.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-29
AI Technical Summary
The existing large language model dialogue intent recognition methods are relatively low in accuracy and it is difficult to effectively identify dialogue intentions.
A method of intent recognition for dialogue in large language model is proposed. By obtaining the current conversation data set, the weight set is calculated using the preset weight strategy, and the intent matching result set is calculated through the preset intent matching sub-model, the score of the intent type is determined, and the intent recognition result is finally determined based on the score and intent recognition strategy.
It improves the accuracy and efficiency of intention recognition, adapts to different business scenarios, enhances the accuracy of weight settings, and thus improves the accuracy of subsequent intention recognition.
Smart Images

Figure CN119903850A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to a method, device, equipment and storage medium for identifying the intent of a large language model conversation. Background Art
[0002] With the widespread use of large language model technology, the recognition of large language model conversation intent is particularly important, and has extensive and profound applications in the fields of intelligent dialogue systems, search engines, recommendation systems, application systems, etc. For example, for service providers, identifying conversation intent is conducive to providing more accurate services, improving satisfaction, increasing customer retention, and increasing more transaction opportunities; for the regulatory side, identifying conversation intent is conducive to more accurate supervision and regulation of the conversation process, and improving the security conversation protection mechanism; for large model upstream and downstream integrators, identifying conversation intent helps to provide better expansion services, increase sales revenue, and improve satisfaction.
[0003] At present, the main technologies used in the intention recognition of large language model dialogues include rule-based methods, machine learning-based methods, deep learning-based methods, etc. However, the existing intention recognition methods for large language model dialogues have the problem of low accuracy. Summary of the invention
[0004] The present application aims to at least solve the technical problems existing in the prior art. To this end, the first aspect of the present application proposes a method for identifying the intention of a large language model dialogue, the method comprising:
[0005] Get the current conversation dataset of the large language model conversation;
[0006] Calculate the weight set corresponding to the current conversation data set through a preset weight strategy; wherein the preset weight strategy includes weight calculation methods corresponding to multiple types of intents;
[0007] The intent matching result set corresponding to the current conversation data set is calculated by using a preset intent matching sub-model; wherein the preset intent matching sub-model is constructed based on historical conversation intent information of various intent types and corresponding historical intent matching results;
[0008] The current conversation intention scores corresponding to various intent types are determined based on the weight set and the intent matching result set, and the intent recognition results of the current conversation data set are determined based on each current conversation intention score and the preset intent recognition strategy.
[0009] In a possible implementation, calculating a weight set corresponding to the current conversation data set by using a preset weight strategy includes:
[0010] Get multiple data packets in the current conversation data set;
[0011] For each data packet, obtain the type importance value and type continuity value corresponding to each intent type in the data packet;
[0012] Calculate the current weight corresponding to each intent type by using the first preset weight, the second preset weight, the type importance value and the type continuity value;
[0013] The current weights corresponding to the same intent type are merged to generate multiple groups of merged weights, and a weight set is obtained based on the multiple groups of merged weights.
[0014] In a possible implementation, obtaining multiple data packets in the current conversation data set includes:
[0015] Obtain multiple preset splitting dimensions and splitting dimension thresholds corresponding to each preset splitting dimension;
[0016] Based on multiple preset splitting dimensions and splitting dimension thresholds corresponding to each preset splitting dimension, obtaining a preset splitting rule;
[0017] The current conversation data set is split according to the preset splitting rules to generate multiple data packets.
[0018] In a possible implementation, the method further includes:
[0019] For each data packet, a semantic summary is calculated for the data packet to obtain a calculation result;
[0020] Performing encoding processing on each calculation result to generate an encoding result;
[0021] For each data packet, each encoding result corresponding to the data packet is clustered to obtain a target clustering result; wherein the target clustering result includes multiple intent types corresponding to the data packet.
[0022] In a possible implementation, the process of generating the type importance value includes:
[0023] Obtaining a preset exclusion set; wherein the preset exclusion set includes data that is not related to the intent recognition process of the large language model dialogue;
[0024] Remove the data in the target clustering result that contains the preset exclusion set to obtain the current clustering result;
[0025] For each data packet in the current clustering result, determine the number of data under each intent type in the data packet;
[0026] Based on the amount of data under each intent type, calculate the proportion of each intent type in the corresponding data packet;
[0027] Based on the quantity ratio and the preset data packet weight corresponding to the data packet, the type importance value is calculated.
[0028] In a possible implementation, the process of generating the type continuity value includes:
[0029] Based on the original order of each data packet in the current conversation data set and the target clustering result, the data packets of each intent type are assigned continuity, and the current continuity value corresponding to the data packets of each intent type is obtained;
[0030] For each intent type, the type continuity value is calculated based on the current continuity value and the amount of data under the intent type.
[0031] In a possible implementation, determining the intent recognition result of the current conversation data set based on each current conversation intent score and a preset intent recognition strategy includes:
[0032] Compare each current conversation intention score with a preset conversation intention type threshold in a preset intention recognition strategy to obtain a target conversation intention score in the current conversation intention score; wherein the target conversation intention score is greater than or equal to the preset conversation intention type threshold;
[0033] Obtain the maximum value of the target conversation intention scores and the sum of the target conversation intention scores;
[0034] Based on the ratio between the maximum value and the sum value, the intent recognition result of the current dialogue dataset is determined.
[0035] The second aspect of the present application provides a device for identifying intentions of a large language model dialogue, the device comprising:
[0036] An acquisition module is used to obtain the current dialogue dataset of the large language model dialogue;
[0037] A first calculation module, configured to calculate a weight set corresponding to the current conversation data set by using a preset weight strategy; wherein the preset weight strategy includes weight calculation methods corresponding to multiple types of intents;
[0038] A second calculation module is used to calculate an intent matching result set corresponding to the current conversation data set through a preset intent matching sub-model; wherein the preset intent matching sub-model is constructed based on historical conversation intent information of various intent types and corresponding historical intent matching results;
[0039] The determination module is used to determine the current conversation intention scores corresponding to various intent types based on the weight set and the intent matching result set, and to determine the intent recognition results of the current conversation data set based on each current conversation intention score and a preset intent recognition strategy.
[0040] In a possible implementation manner, the first calculation module is specifically used to:
[0041] Get multiple data packets in the current conversation data set;
[0042] For each data packet, obtain the type importance value and type continuity value corresponding to each intent type in the data packet;
[0043] Calculate the current weight corresponding to each intent type by using the first preset weight, the second preset weight, the type importance value and the type continuity value;
[0044] The current weights corresponding to the same intent type are merged to generate multiple groups of merged weights, and a weight set is obtained based on the multiple groups of merged weights.
[0045] In a possible implementation manner, the first calculation module is further used to:
[0046] Obtain multiple preset splitting dimensions and splitting dimension thresholds corresponding to each preset splitting dimension;
[0047] Based on multiple preset splitting dimensions and splitting dimension thresholds corresponding to each preset splitting dimension, obtaining a preset splitting rule;
[0048] The current conversation data set is split according to the preset splitting rules to generate multiple data packets.
[0049] In a possible implementation manner, the apparatus for identifying the intention of the large language model dialogue is further used for:
[0050] For each data packet, a semantic summary is calculated for the data packet to obtain a calculation result;
[0051] Performing encoding processing on each calculation result to generate an encoding result;
[0052] For each data packet, each encoding result corresponding to the data packet is clustered to obtain a target clustering result; wherein the target clustering result includes multiple intent types corresponding to the data packet.
[0053] In a possible implementation manner, the apparatus for identifying the intention of the large language model dialogue is further used for:
[0054] Obtaining a preset exclusion set; wherein the preset exclusion set includes data that is not related to the intent recognition process of the large language model dialogue;
[0055] Remove the data in the target clustering result that contains the preset exclusion set to obtain the current clustering result;
[0056] For each data packet in the current clustering result, determine the number of data under each intent type in the data packet;
[0057] Based on the amount of data under each intent type, calculate the proportion of each intent type in the corresponding data packet;
[0058] Based on the quantity ratio and the preset data packet weight corresponding to the data packet, the type importance value is calculated.
[0059] In a possible implementation manner, the apparatus for identifying the intention of the large language model dialogue is further used for:
[0060] Based on the original order of each data packet in the current conversation data set and the target clustering result, the data packets of each intent type are assigned continuity, and the current continuity value corresponding to the data packets of each intent type is obtained;
[0061] For each intent type, the type continuity value is calculated based on the current continuity value and the amount of data under the intent type.
[0062] In a possible implementation manner, the above-mentioned determination module is specifically used to:
[0063] Compare each current conversation intention score with a preset conversation intention type threshold in a preset intention recognition strategy to obtain a target conversation intention score in the current conversation intention score; wherein the target conversation intention score is greater than or equal to the preset conversation intention type threshold;
[0064] Obtain the maximum value of the target conversation intention scores and the sum of the target conversation intention scores;
[0065] Based on the ratio between the maximum value and the sum value, the intent recognition result of the current dialogue dataset is determined.
[0066] The third aspect of the present application proposes an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the intention recognition method for a large language model dialogue as described in the first aspect.
[0067] In a fourth aspect, the present application proposes a computer-readable storage medium, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the intention recognition method for a large language model dialogue as described in the first aspect.
[0068] The embodiments of the present application have the following beneficial effects:
[0069] The embodiment of the present application provides a method for identifying the intention of a large language model conversation, the method comprising: obtaining a current conversation data set of a large language model conversation, calculating a weight set corresponding to the current conversation data set through a preset weight strategy, calculating an intention matching result set corresponding to the current conversation data set through a preset intention matching sub-model, determining the current conversation intention score corresponding to various intention types based on the weight set and the intention matching result set, and determining the intention recognition result of the current conversation data set based on each current conversation intention score and the preset intention recognition strategy. This solution calculates the weight set corresponding to the current conversation data set through a preset weight strategy, takes into account a variety of conversation forms and scenarios to set different weights respectively, can adapt to different business scenarios, and improves the accuracy of setting weights, thereby improving the accuracy of subsequent intention recognition; in addition, the intention matching result set corresponding to the current conversation data set is directly calculated through a preset intention matching sub-model, which improves the accuracy and efficiency of calculating the intention matching result. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 A block diagram of a computer device provided in an embodiment of the present application;
[0071] Figure 2 A flowchart of a method for identifying the intent of a large language model conversation provided in an embodiment of the present application;
[0072] Figure 3 A flowchart of the steps for calculating a weight set corresponding to a current conversation data set provided in an embodiment of the present application;
[0073] Figure 4 A flowchart of the steps of obtaining multiple data packets provided in an embodiment of the present application;
[0074] Figure 5 A flowchart of steps for generating a type importance value provided in an embodiment of the present application;
[0075] Figure 6 A flowchart of the steps for processing each data packet provided in an embodiment of the present application;
[0076] Figure 7 A flow chart of steps for generating a type continuity value provided in an embodiment of the present application;
[0077] Figure 8 A flowchart of the steps for determining the intention recognition result provided in an embodiment of the present application;
[0078] Fig. 9 A structural block diagram of an intention recognition device for a large language model dialogue provided in an embodiment of the present application. DETAILED DESCRIPTION
[0079] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0080] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "multiple" means two or more. In addition, the use of "based on" or "according to" means openness and inclusiveness, because the process, steps, calculations or other actions "based on" or "according to" one or more of the conditions or values may be based on additional conditions or values beyond the described values in practice.
[0081] The intention recognition method for large language model dialogue provided in the present application can be applied to a computer device (electronic device), and the computer device can be a server or a terminal, wherein the server can be a single server or a server cluster composed of multiple servers. The embodiments of the present application do not make specific limitations on this. The terminal can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices.
[0082] Take the computer device as a server as an example. Figure 1 A block diagram of a server is shown, such as Figure 1 As shown, the server may include a processor and a memory connected via a system bus. The processor of the server is used to provide computing and control capabilities. The memory of the server includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the computer program is executed by the processor, a method for recognizing the intention of a large language model dialogue is implemented.
[0083] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied. Optionally, the server may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0084] It should be noted that the execution subject of the embodiments of the present application can be a computer device or an intention recognition device for a large language model dialogue. The following method embodiments will be described using a computer device as the execution subject.
[0085] Figure 2 A flowchart of a method for identifying the intention of a large language model dialogue provided in an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0086] Step 202: Obtain a current dialogue dataset of a large language model dialogue.
[0087] Among them, Large Language Model (LLM) refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. Large language model can handle a variety of natural language tasks, such as text classification, question answering, dialogue, etc., and is an important path to artificial intelligence.
[0088] When performing intent recognition of a large language model conversation, a current conversation data set of the large language model conversation may be first obtained. The current conversation data set includes at least a question information set, that is, may include only a data set containing question information in various scenarios.
[0089] It should be noted that the conversation dataset here can be a conversation dataset between multiple entities in terms of content, for example, a conversation dataset between a person and an LLM, a person and an intelligent agent, a person and an intelligent device, a person and an intelligent object, etc. The conversation dataset can include multiple forms such as text, pictures, and voice in terms of interaction form, or it can be a combination of multiple interaction forms.
[0090] In some optional embodiments, after obtaining the current dialogue data set of the large language model dialogue, data preprocessing can be performed on the current dialogue data set. Optionally, the current dialogue data sets in various forms can be converted into a unified form, for example, all converted into text form, by using some common tools or technologies, such as optical character recognition technology (OCR) for converting images to text, speech recognition technology for converting speech to text, etc.
[0091] Next, the current conversation data set after the format conversion can also be standardized, which may include but is not limited to terminology normalization, symbol normalization, dimension normalization, sentence normalization, etc. In addition, it can also remove erroneous data, remove abnormal data, remove inconsistent data, remove logically contradictory data, etc.
[0092] Step 204: Calculate a weight set corresponding to the current conversation data set using a preset weight strategy.
[0093] The preset weight strategy includes weight calculation methods corresponding to various types of intents. Figure 3 As shown, Figure 3 A flowchart of the steps for calculating a weight set corresponding to a current conversation data set provided in an embodiment of the present application includes:
[0094] Step 302: Acquire multiple data packets in the current conversation data set.
[0095] Among them, Figure 4 As shown, Figure 4 A flowchart of the steps of obtaining multiple data packets provided in an embodiment of the present application includes:
[0096] Step 402: Obtain multiple preset splitting dimensions and splitting dimension thresholds corresponding to each preset splitting dimension.
[0097] Step 404: Obtain a preset splitting rule based on multiple preset splitting dimensions and a splitting dimension threshold corresponding to each preset splitting dimension.
[0098] Step 406: Split the current conversation data set using a preset splitting rule to generate multiple data packets.
[0099] Among them, the preset splitting dimensions may include but are not limited to dimensions such as time series interval, conversation interruption start, topic switching, etc. Different preset splitting dimensions correspond to different splitting meanings. For example, for the preset splitting dimension of time series interval, the current conversation data set can be split at certain time intervals; for the preset splitting dimension of conversation interruption start, different current conversation data sets can be split using different session identifiers.
[0100] Next, you need to set the corresponding split dimension threshold for each preset split dimension in advance, and the split processing will be performed according to the split dimension threshold later. Among them, each split dimension threshold is a hyperparameter, which can be adjusted separately in each intent recognition. If it is not specified, the default threshold can be used.
[0101] Therefore, the preset splitting rules can be obtained based on multiple preset splitting dimensions and the splitting dimension thresholds corresponding to each preset splitting dimension. When a preset splitting dimension reaches the splitting dimension threshold, it is split, and the split data packets are stored separately. The remaining data sets are split again until all current conversation data sets are split through all preset splitting dimensions. For example, for the preset splitting dimension of topic switching, when the corresponding topic switching threshold, the splitting dimension threshold, is met, the data set is split, and the remaining data set is split again if it meets the time interval dimension, and the remaining data sets are split in turn through other preset splitting dimensions.
[0102] Finally, the current conversation data set is split by the preset splitting rule to generate multiple data packets. In addition, the splitting basis and sequence number of each data packet after the data splitting can be recorded, and the splitting basis can include the corresponding preset splitting dimension.
[0103] Step 304: For each data packet, obtain the type importance value and type continuity value corresponding to each intent type in the data packet.
[0104] Among them, Figure 5 As shown, Figure 5 A flowchart of steps for generating a type importance value provided in an embodiment of the present application includes:
[0105] Step 502: Obtain a preset exclusion set.
[0106] Step 504: remove the data in the target clustering result that includes the preset exclusion set to obtain the current clustering result.
[0107] Step 506: For each data packet in the current clustering result, determine the amount of data under each intent type in the data packet.
[0108] Step 508: Based on the amount of data under each intent type, calculate the proportion of each intent type in the corresponding data packet.
[0109] Step 510: Calculate the type importance value based on the quantity ratio and the preset data packet weight corresponding to the data packet.
[0110] When calculating the type importance value, each data packet needs to be processed first, such as Figure 6 As shown, Figure 6 A flowchart of steps for processing each data packet provided in an embodiment of the present application includes:
[0111] Step 602: For each data packet, a semantic summary is calculated to obtain a calculation result.
[0112] Step 604: Encode each calculation result to generate an encoding result.
[0113] Step 606: For each data packet, cluster the encoding results corresponding to the data packet to obtain a target clustering result.
[0114] For each data packet, some semantic summary tools can be used to calculate the semantic summary of the data packet to obtain the calculation result. In addition, the sequence number of each data packet in the original current conversation data set can also be recorded, and optionally, it can be sorted in chronological order.
[0115] Then use the preset encoding method to encode each calculation result to generate an encoding result. Finally, for each data packet, the encoding results corresponding to the data packet can be clustered in the data packet to obtain a target clustering result, which includes multiple intent types corresponding to the data packet. Exemplarily, the encoding results corresponding to the data packet data_split(k) are clustered to form data_package(k,i). Where k represents the kth data packet, and i represents the i-th intent type of the kth data packet. It should be noted that the semantic summary calculation and encoding processing need to be performed on the data in all data packets, while the clustering processing is performed separately and separately in each data packet.
[0116] Next, the type importance value can be calculated. Optionally, some common data sets that are meaningless to the current calculation can be collected as preset exclusion sets. For example, the preset exclusion set can include some commonly used adverbs, prepositions, etc. In other words, the preset exclusion set includes data that is irrelevant to the intent recognition process of the large language model dialogue.
[0117] Then remove the data in the target clustering result that includes the preset exclusion set to obtain the current clustering result. Optionally, direct matching or other methods can be used to remove the data in the target clustering result that includes the preset exclusion set. And for each data packet in the current clustering result, determine the number of data under each intent type in the data packet. For example, the number of data under the i-th intent type data_package(k,i) of data packet k can be recorded as data_cp(k,i). In addition, the central word of multiple data under each intent type in the data packet can also be calculated, recorded as data_cc(k,i). Optionally, there are multiple ways to calculate the central word. For example, the central word can be obtained by random sampling. The central word is also one of the multiple data.
[0118] Based on the amount of data under each intent type, the proportion of each intent type in the corresponding data packet is calculated, recorded as data_cpr(k,i), and the calculation formula is The value of j is 1-n, n represents the number of intent types, and i represents the i-th intent type.
[0119] Finally, the type importance value can be calculated based on the quantity ratio and the preset data packet weight corresponding to the data packet, which is recorded as wi_data(k,i). The calculation method is: wi_data(k,i)=data_cpr(k,i)*wi(k), where k represents the kth data packet, i represents the ith intent type, and wi(k) represents the preset data packet weight corresponding to the kth data packet.
[0120] The calculation rule of the preset data packet weight set wi is: Among them, w_sp(i) is the weight of the intent category to which the ith data packet belongs; w_ti is the weight coefficient of the time dimension; type_start(i) is the timestamp of the start time of the ith data packet; a0 is the time packet harmonic value, which is generally a large prime number; w_ci is the weight coefficient of the dimension of the proportion of the number of conversations; c_total(i) is the total number of conversations in the ith data packet; ∑c_total(j) represents the number of all conversations in the data set. It should be noted that the above parameters can be pre-customized, and the preset data packet weight set takes into account three important dimensions: the intent category to which the data packet belongs, the time parameter of the data packet, and the proportion of the number of conversations in the data packet. Exemplarily, for intent types with different conversation times, a0 can be used to adjust their relative size; the larger the number of conversations in a data packet, the greater the importance.
[0121] like Figure 7 As shown, Figure 7 A flow chart of steps for generating a type continuity value provided in an embodiment of the present application includes:
[0122] Step 702: Based on the original order of each data packet in the current conversation data set and the target clustering result, continuity is assigned to the data packets of each intent type to obtain the current continuity value corresponding to the data packets of each intent type.
[0123] Step 704: For each intent type, based on each current continuity value and the amount of data under the intent type, calculate the type continuity value.
[0124] Among them, the rule for assigning continuity can be that the smallest sequence number is 1, and then the next smallest is obtained. If the next smallest is directly after the smallest sequence number in the original current conversation data set, the continuity value is assigned to it as 2, otherwise it is 1. Similarly, if the continuous data in this intent type is also continuous in the original current conversation data set, the continuity of subsequent data is increased by 1 each time, otherwise it is reassigned to 1 until all data are assigned. Finally, the continuity value of the jth data in the i-th intent type in the k-th data packet is recorded as data_cp_line(k,i,j).
[0125] In other words, for the data numbers s1, s2, s3, ..., sn in the current conversation data set, after clustering, the data adjacent to s1 may not be s2, because the two data may belong to different classes, so after clustering they are no longer in the same category and are no longer continuous; conversely, if s1 and s2 are of the same class, then the data adjacent to s1 is still s2.
[0126] For example, if the continuity value of s1 is 1, it belongs to category type1, the adjacent data behind it is s2, s2 also belongs to category type1, and s1 and s2 are also continuous in the original current conversation data set, then s2 needs to be assigned 2, that is, the continuity value of s2 is 2. If the continuity value of s1 is 1, it belongs to category type1, the adjacent data behind it is s3, s3 also belongs to category type1, and s1 and s3 are not continuous in the original current conversation data set, then s3 needs to be reassigned 1, that is, the continuity value of s3 is 1.
[0127] Finally, for each intent type, the type continuity value can be calculated based on the current continuity value and the number of data under the intent type. Optionally, the type continuity value can be obtained by adding the sum of the current continuity values of all data packets under a certain intent type and dividing it by the number of data under the intent type. The calculation method is: wline_data(k,i) represents the continuity value of the i-th intent type of the k-th data packet.
[0128] Step 306: Calculate the current weight corresponding to each intent type using the first preset weight, the second preset weight, the type importance value, and the type continuity value.
[0129] Among them, after calculating the type importance value and the type continuity value, the current weight corresponding to each intention type can be calculated through the first preset weight, the second preset weight, the type importance value and the type continuity value.
[0130] The first preset weight is the weight pre-set for the dimension of importance, denoted as wp1, and the second preset weight is the weight pre-set for the dimension of continuity, denoted as wp2. Therefore, the current weight corresponding to each intent type can be calculated according to the formula w_data(k,i)=wi_data(k,i)*wp1+wline_data(k,i)*wp2, where w_data(k,i) represents the current weight corresponding to the i-th intent type in the k-th data packet, and k and i represent the k-th data packet and the i-th intent type in the k-th data packet, respectively.
[0131] By designing a weight calculation mechanism corresponding to importance and continuity based on statistical and time series perspectives, both the discrete and continuous characteristics of information are taken into account, thereby improving the accuracy of subsequent calculations of current weights corresponding to each intent type.
[0132] Step 308: merge the current weights corresponding to the same intent type to generate multiple groups of merged weights, and obtain a weight set based on the multiple groups of merged weights.
[0133] Among them, the current weights corresponding to all intent types can be obtained, and after finding the same intent type, the current weights corresponding to the same intent type can be merged to generate multiple groups of merged weights, and a weight set can be obtained based on the multiple groups of merged weights.
[0134] Optionally, each data packet has a corresponding central word. For each data packet, based on the central word data_cc(k,i), the intent type of all data that is the same as the data corresponding to the central word can be found in other data packets in turn. Here, it is no longer limited to a certain data packet, and it is necessary to search in all data packets. Then sum the current weights corresponding to all the intent types found to obtain the weights after multiple groups are merged, denoted as w_data(x), where x represents the reordered sequence number. Here, the reordered sequence number can be obtained by sorting according to the order of the weights after the multiple groups are merged. Finally, the weights after the multiple groups are merged can form a weight set.
[0135] Exemplarily, if there are three data packets, denoted as A, B, and C, first based on the central word data_cc1(k, i) corresponding to data packet A, find the intent types of all data that are the same as the data corresponding to the central word in other data packets B and C in turn, and then sum up the current weights corresponding to all the found intent types to obtain a merged weight, denoted as w_data(x). Then based on the central word data_cc2(k, i) corresponding to data packet B, find the intent types of all data that are the same as the data corresponding to the central word in other data packets A and C in turn, and then sum up the current weights corresponding to all the found intent types to obtain a merged weight, denoted as w_data(x). Finally, based on the central word data_cc3(k, i) corresponding to data packet C, find the intent types of all data that are the same as the data corresponding to the central word in other data packets A and B in turn, and then sum up the current weights corresponding to all the found intent types to obtain a merged weight, denoted as w_data(x). The specific value of x here needs to be determined after sorting the three groups of merged weights in order of size, and x can be any integer from 1 to 3. Finally, the three groups of combined weights can form a weight set.
[0136] Step 206: Calculate the intent matching result set corresponding to the current conversation data set through the preset intent matching sub-model.
[0137] Among them, the preset intent matching sub-model is constructed based on the historical conversation intent information of various intent types and the corresponding historical intent matching results. Optionally, when constructing the preset intent matching sub-model, you can first collect as complete and as many intent types of conversation intent information as possible, which may include but is not limited to historical conversation data sets such as knowledge popularization, tool use, creative creation, translation, content summary, and chat.
[0138] The collected historical conversation dataset is then classified according to the intent type, which may include but is not limited to knowledge popularization, tool use, creative creation, translation, content summary, small talk, etc. Then the historical conversation dataset can be preprocessed. The process of data preprocessing is the same as the process of data preprocessing for the current conversation dataset, which will not be repeated here.
[0139] The historical conversation dataset after data preprocessing is encoded to form a coding library. At the same time, two parameters, the retrieval similarity threshold and topN, need to be set. After the current conversation dataset to be processed is subjected to the same data encoding operation, a similarity search is performed in the coding library. Data that meets the conditions is screened out based on the retrieval similarity threshold and topN. After the above steps are encapsulated and parameterized, a preset intent matching sub-model can be formed.
[0140] Therefore, after obtaining the current conversation data set, the intent matching result set corresponding to the current conversation data set can be calculated through the preset intent matching sub-model. The intent matching result set includes multiple intent matching results, each of which may include but is not limited to the intent type of the conversation, the target conversation intent score of each intent type, the conversation intent accuracy rate and other information.
[0141] Step 208: Determine the current conversation intention scores corresponding to various intention types based on the weight set and the intention matching result set, and determine the intention recognition result of the current conversation data set based on each current conversation intention score and a preset intention recognition strategy.
[0142] Among them, Figure 8 As shown, Figure 8 A flowchart of steps for determining an intent recognition result provided in an embodiment of the present application includes:
[0143] Step 802: Compare each current conversation intention score with a preset conversation intention type threshold in a preset intention recognition strategy to obtain a target conversation intention score in the current conversation intention score.
[0144] Step 804: Obtain the maximum value of the target dialogue intention scores and the sum of the target dialogue intention scores.
[0145] Step 806: Determine the intention recognition result of the current dialogue data set based on the ratio between the maximum value and the sum value.
[0146] Among them, the preset intention recognition strategy includes multiple intention types, and it is necessary to set a preset conversation intention type threshold that is suitable for each intention type, that is, compare each current conversation intention score with the preset conversation intention type threshold in the preset intention recognition strategy. If the current conversation intention score is greater than or equal to the preset conversation intention type threshold, it is identified as a conversation of this intention type, and all current conversation intention scores greater than or equal to the preset conversation intention type threshold are used as target conversation intention scores. In addition, the intention type corresponding to the current conversation intention score less than the preset conversation intention type threshold can also be removed.
[0147] Next, we need to obtain the maximum value of the target dialogue intention score and the sum of the target dialogue intention scores, and determine the intention recognition result of the current dialogue dataset based on the ratio between the maximum value and the sum. The calculation formula for the dialogue intention accuracy r is: Among them, intention_score_c is the maximum value of the target dialogue intention scores, intention_score(i) is the i-th target dialogue intention score, and the dialogue intention accuracy represents the ratio of the highest target dialogue intention score to all target dialogue intention scores. The larger the ratio, the higher the recognition accuracy.
[0148] The present application provides a method for identifying the intent of a large language model conversation, the method comprising: obtaining a current conversation data set of a large language model conversation, calculating a weight set corresponding to the current conversation data set through a preset weight strategy, calculating an intent matching result set corresponding to the current conversation data set through a preset intent matching sub-model, determining the current conversation intent scores corresponding to various intent types based on the weight set and the intent matching result set, and determining the intent recognition result of the current conversation data set based on each current conversation intent score and the preset intent recognition strategy. This solution calculates the weight set corresponding to the current conversation data set through a preset weight strategy, takes into account a variety of conversation forms and scenarios to set different weights respectively, can adapt to different business scenarios, and improves the accuracy of setting weights, thereby improving the accuracy of subsequent intent recognition; in addition, the intent matching result set corresponding to the current conversation data set is directly calculated through a preset intent matching sub-model, which improves the accuracy and efficiency of calculating the intent matching result.
[0149] Fig. 9 A structural block diagram of an intention recognition device for a large language model dialogue provided in an embodiment of the present application.
[0150] like Fig. 9 As shown, the intention recognition device 900 of the large language model dialogue includes:
[0151] The acquisition module 902 is used to acquire the current dialogue data set of the large language model dialogue.
[0152] The first calculation module 904 is used to calculate the weight set corresponding to the current conversation data set through a preset weight strategy; wherein the preset weight strategy includes weight calculation methods corresponding to multiple types of intentions.
[0153] The second calculation module 906 is used to calculate the intent matching result set corresponding to the current conversation data set through a preset intent matching sub-model; wherein the preset intent matching sub-model is constructed based on historical conversation intent information of various intent types and corresponding historical intent matching results.
[0154] The determination module 908 is used to determine the current conversation intention scores corresponding to various intention types based on the weight set and the intention matching result set, and determine the intention recognition result of the current conversation data set based on each current conversation intention score and a preset intention recognition strategy.
[0155] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here. Each module in the above-mentioned large language model dialogue intention recognition device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations of the above modules.
[0156] In one embodiment of the present application, a computer device is provided, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:
[0157] Get the current conversation dataset of the large language model conversation;
[0158] Calculate the weight set corresponding to the current conversation data set through a preset weight strategy; wherein the preset weight strategy includes weight calculation methods corresponding to multiple types of intents;
[0159] The intent matching result set corresponding to the current conversation data set is calculated by using a preset intent matching sub-model; wherein the preset intent matching sub-model is constructed based on historical conversation intent information of various intent types and corresponding historical intent matching results;
[0160] The current conversation intention scores corresponding to various intent types are determined based on the weight set and the intent matching result set, and the intent recognition results of the current conversation data set are determined based on each current conversation intention score and the preset intent recognition strategy.
[0161] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0162] Get multiple data packets in the current conversation data set;
[0163] For each data packet, obtain the type importance value and type continuity value corresponding to each intent type in the data packet;
[0164] Calculate the current weight corresponding to each intent type by using the first preset weight, the second preset weight, the type importance value and the type continuity value;
[0165] The current weights corresponding to the same intent type are merged to generate multiple groups of merged weights, and a weight set is obtained based on the multiple groups of merged weights.
[0166] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0167] Obtain multiple preset splitting dimensions and splitting dimension thresholds corresponding to each preset splitting dimension;
[0168] Based on multiple preset splitting dimensions and splitting dimension thresholds corresponding to each preset splitting dimension, obtaining a preset splitting rule;
[0169] The current conversation data set is split according to the preset splitting rules to generate multiple data packets.
[0170] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0171] For each data packet, a semantic summary is calculated for the data packet to obtain a calculation result;
[0172] Performing encoding processing on each calculation result to generate an encoding result;
[0173] For each data packet, each encoding result corresponding to the data packet is clustered to obtain a target clustering result; wherein the target clustering result includes multiple intent types corresponding to the data packet.
[0174] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0175] Obtaining a preset exclusion set; wherein the preset exclusion set includes data that is not related to the intent recognition process of the large language model dialogue;
[0176] Remove the data in the target clustering result that contains the preset exclusion set to obtain the current clustering result;
[0177] For each data packet in the current clustering result, determine the number of data under each intent type in the data packet;
[0178] Based on the amount of data under each intent type, calculate the proportion of each intent type in the corresponding data packet;
[0179] Based on the quantity ratio and the preset data packet weight corresponding to the data packet, the type importance value is calculated.
[0180] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0181] Based on the original order of each data packet in the current conversation data set and the target clustering result, the data packets of each intent type are assigned continuity, and the current continuity value corresponding to the data packets of each intent type is obtained;
[0182] For each intent type, the type continuity value is calculated based on the current continuity value and the amount of data under the intent type.
[0183] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0184] Compare each current conversation intention score with a preset conversation intention type threshold in a preset intention recognition strategy to obtain a target conversation intention score in the current conversation intention score; wherein the target conversation intention score is greater than or equal to the preset conversation intention type threshold;
[0185] Obtain the maximum value of the target conversation intention scores and the sum of the target conversation intention scores;
[0186] Based on the ratio between the maximum value and the sum value, the intent recognition result of the current dialogue dataset is determined.
[0187] The computer device provided in the embodiment of the present application has similar implementation principles and technical effects to those of the above-mentioned method embodiment, and will not be described in detail here.
[0188] In one embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0189] Get the current conversation dataset of the large language model conversation;
[0190] Calculate the weight set corresponding to the current conversation data set through a preset weight strategy; wherein the preset weight strategy includes weight calculation methods corresponding to multiple types of intents;
[0191] The intent matching result set corresponding to the current conversation data set is calculated by using a preset intent matching sub-model; wherein the preset intent matching sub-model is constructed based on historical conversation intent information of various intent types and corresponding historical intent matching results;
[0192] The current conversation intention scores corresponding to various intent types are determined based on the weight set and the intent matching result set, and the intent recognition results of the current conversation data set are determined based on each current conversation intention score and the preset intent recognition strategy.
[0193] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0194] Get multiple data packets in the current conversation data set;
[0195] For each data packet, obtain the type importance value and type continuity value corresponding to each intent type in the data packet;
[0196] Calculate the current weight corresponding to each intent type by using the first preset weight, the second preset weight, the type importance value and the type continuity value;
[0197] The current weights corresponding to the same intent type are merged to generate multiple groups of merged weights, and a weight set is obtained based on the multiple groups of merged weights.
[0198] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0199] Obtain multiple preset splitting dimensions and splitting dimension thresholds corresponding to each preset splitting dimension;
[0200] Based on multiple preset splitting dimensions and splitting dimension thresholds corresponding to each preset splitting dimension, obtaining a preset splitting rule;
[0201] The current conversation data set is split according to the preset splitting rules to generate multiple data packets.
[0202] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0203] For each data packet, a semantic summary is calculated for the data packet to obtain a calculation result;
[0204] Performing encoding processing on each calculation result to generate an encoding result;
[0205] For each data packet, each encoding result corresponding to the data packet is clustered to obtain a target clustering result; wherein the target clustering result includes multiple intent types corresponding to the data packet.
[0206] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0207] Obtaining a preset exclusion set; wherein the preset exclusion set includes data that is not related to the intent recognition process of the large language model dialogue;
[0208] Remove the data in the target clustering result that contains the preset exclusion set to obtain the current clustering result;
[0209] For each data packet in the current clustering result, determine the number of data under each intent type in the data packet;
[0210] Based on the amount of data under each intent type, calculate the proportion of each intent type in the corresponding data packet;
[0211] Based on the quantity ratio and the preset data packet weight corresponding to the data packet, the type importance value is calculated.
[0212] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0213] Based on the original order of each data packet in the current conversation data set and the target clustering result, the data packets of each intent type are assigned continuity, and the current continuity value corresponding to the data packets of each intent type is obtained;
[0214] For each intent type, the type continuity value is calculated based on the current continuity value and the amount of data under the intent type.
[0215] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0216] Compare each current conversation intention score with a preset conversation intention type threshold in a preset intention recognition strategy to obtain a target conversation intention score in the current conversation intention score; wherein the target conversation intention score is greater than or equal to the preset conversation intention type threshold;
[0217] Obtain the maximum value of the target conversation intention scores and the sum of the target conversation intention scores;
[0218] Based on the ratio between the maximum value and the sum value, the intent recognition result of the current dialogue dataset is determined.
[0219] The computer-readable storage medium provided in this embodiment has similar implementation principles and technical effects to those of the above method embodiments, and will not be described in detail here.
[0220] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0221] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0222] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for identifying intentions in large language model dialogues, characterized in that: The method comprises: Get the current conversation dataset of the large language model conversation; Calculating a weight set corresponding to the current conversation data set through a preset weight strategy; wherein the preset weight strategy includes weight calculation methods corresponding to multiple types of intents; Calculating an intention matching result set corresponding to the current conversation data set through a preset intention matching sub-model; wherein the preset intention matching sub-model is constructed based on historical conversation intention information of various intention types and corresponding historical intention matching results; Based on the weight set and the intention matching result set, current conversation intention scores corresponding to various intention types are determined, and based on each of the current conversation intention scores and a preset intention recognition strategy, an intention recognition result of the current conversation data set is determined.
2. The method according to claim 1, characterized in that The calculating the weight set corresponding to the current conversation data set by using a preset weight strategy includes: Acquire multiple data packets in the current conversation data set; For each of the data packets, obtaining a type importance value and a type continuity value corresponding to each intent type in the data packet; Calculating the current weight corresponding to each of the intent types by using the first preset weight, the second preset weight, the type importance value, and the type continuity value; The current weights corresponding to the same intent type are merged to generate multiple groups of merged weights, and the weight set is obtained based on the multiple groups of merged weights.
3. The method according to claim 2, characterized in that The step of obtaining a plurality of data packets in the current conversation data set includes: Obtain multiple preset splitting dimensions and splitting dimension thresholds corresponding to each of the preset splitting dimensions; Based on the multiple preset splitting dimensions and the splitting dimension thresholds corresponding to the preset splitting dimensions, obtaining a preset splitting rule; The current conversation data set is split according to the preset splitting rule to generate multiple data packets.
4. The method according to claim 2 or 3, characterized in that: The method further comprises: For each of the data packets, performing semantic summary calculation on the data packet to obtain a calculation result; Performing encoding processing on each of the calculation results to generate an encoding result; For each of the data packets, cluster processing is performed on each encoding result corresponding to the data packet to obtain a target clustering result; wherein the target clustering result includes multiple intent types corresponding to the data packet.
5. The method according to claim 4, characterized in that The generation process of the type importance value includes: Acquire a preset exclusion set; wherein the preset exclusion set includes data that is not related to the intent recognition process of the large language model dialogue; Removing the data in the target clustering result that includes the preset exclusion set to obtain a current clustering result; For each data packet in the current clustering result, determine the amount of data under each intent type in the data packet; Based on the amount of data under each intent type, calculate the quantity ratio of each intent type in the corresponding data packet; The type importance value is calculated based on the quantity ratio and the preset data packet weight corresponding to the data packet.
6. The method according to claim 4, characterized in that The generation process of the type continuity value includes: Assigning continuity to the data packets of each intent type based on the original order of each data packet in the current conversation data set and the target clustering result, to obtain the current continuity value corresponding to the data packet of each intent type; For each intent type, the type continuity value is calculated based on each current continuity value and the amount of data under the intent type.
7. The method according to any one of claims 1 to 3, characterized in that: The determining the intent recognition result of the current conversation data set based on each of the current conversation intent scores and a preset intent recognition strategy includes: Compare each of the current conversation intention scores with a preset conversation intention type threshold in the preset intention identification strategy to obtain a target conversation intention score in the current conversation intention score; wherein the target conversation intention score is greater than or equal to the preset conversation intention type threshold; Obtaining a maximum value among the target conversation intention scores and a sum of the target conversation intention scores; Based on the ratio between the maximum value and the sum value, an intent recognition result of the current dialogue data set is determined.
8. A device for recognizing intentions of large language model dialogues, characterized in that: The device comprises: An acquisition module is used to obtain the current dialogue dataset of the large language model dialogue; A first calculation module, configured to calculate a weight set corresponding to the current conversation data set by using a preset weight strategy; wherein the preset weight strategy includes weight calculation methods corresponding to multiple types of intents; A second calculation module, configured to calculate an intent matching result set corresponding to the current conversation data set by using a preset intent matching sub-model; wherein the preset intent matching sub-model is constructed based on historical conversation intent information of various intent types and corresponding historical intent matching results; A determination module is used to determine the current conversation intention scores corresponding to various intention types based on the weight set and the intention matching result set, and to determine the intention recognition result of the current conversation data set based on each of the current conversation intention scores and a preset intention recognition strategy.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the intention recognition method for a large language model dialogue as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the intention recognition method for a large language model dialogue as described in any one of claims 1-7.
Citation Information
Cited By
AI large model agent construction method and system
CN120277512A
An AI large model agent construction method and system
CN120277512B