Intention recognition method and device, electronic equipment and storage medium
By combining a pre-trained classification model and cosine similarity calculation with the ES database for intent recognition, this method solves the problems of high cost and low efficiency of manual annotation in traditional intent recognition methods, and achieves efficient and accurate intent recognition under complex intent systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE ONLINE SERVICES CO LTD
- Filing Date
- 2025-11-27
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional intent recognition methods rely heavily on manually labeled data, which is costly and difficult to accurately distinguish complex intent systems, resulting in low recognition efficiency.
By acquiring text data from multiple user interactions, a pre-trained classification model is used for multi-level intent recognition. Cosine similarity calculation is combined to determine the intent, reducing reliance on manual annotation. A teacher model guides the student model for intent recognition, and the ES database is used to store and match similar question vectors.
It improves the efficiency and accuracy of intent recognition in complex intent systems, reduces reliance on manually labeled data, and enhances the precision of intent recognition.
Smart Images

Figure CN121901423A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to an intent recognition method, apparatus, electronic device, and storage medium. Background Technology
[0002] In practical applications of intelligent customer service, intent recognition is a key step in understanding user input, directly affecting the accuracy and personalization of the responses and services provided by the system.
[0003] In related technologies, traditional intent recognition methods rely heavily on manually labeled data, which is costly. At the same time, due to semantic overlap and fine-grained differences between intent categories, methods based on preset rules or traditional machine learning are difficult to achieve accurate differentiation, resulting in low efficiency in intent recognition under complex intent systems. Summary of the Invention
[0004] The purpose of this application is to provide an intent recognition method, apparatus, electronic device, and storage medium to solve the problem of low accuracy in intent recognition under complex intent systems.
[0005] To solve the above-mentioned technical problems, the embodiments of this application are implemented as follows: In a first aspect, embodiments of this application provide an intent recognition method, the method comprising: acquiring text data from multiple rounds of user interaction, and performing intent recognition on the text data to obtain one or more intents of the text data; classifying the intents using a pre-trained classification model to obtain a target first-level intent corresponding to the intent; wherein the target first-level intent is a first-level intent in an intent classification directory, the intent classification directory including a pre-constructed hierarchical relationship between the first-level intents and second-level intents, the first-level intent being a parent intent and the second-level intents being child intents; acquiring a text vector for each intent under the same target first-level intent, and acquiring a preset plurality of similarity vectors corresponding to the second-level intents; calculating the cosine similarity value between the text vectors and each of the similarity vectors, and determining the target second-level intent corresponding to the text vectors based on the cosine similarity value; and determining the target intent of the text data based on the target first-level intent and the target second-level intent.
[0006] Secondly, embodiments of this application provide an intent recognition device, which includes: an acquisition module, configured to acquire text data from multiple rounds of user interaction, and perform intent recognition on the text data to obtain one or more intents of the text data; The classification module is used to classify the intent using a pre-trained classification model to obtain the target first-level intent corresponding to the intent; wherein, the target first-level intent is a first-level intent in the intent classification directory, and the intent classification directory includes the first-level intent and second-level intents with a hierarchical relationship, the first-level intent is the parent intent, and the second-level intent is the child intent; The construction module is used to obtain the text vector of each intent under the same target first-level intent, and to obtain multiple similar question vectors corresponding to the preset second-level intent; The matching module is used to calculate the cosine similarity value between the text vector and each of the similar text vectors, and to determine the target secondary intent corresponding to the text vector based on the cosine similarity value. The determination module is used to determine the target intent of the text data based on the target primary intent and the target secondary intent.
[0007] Thirdly, embodiments of this application provide an electronic device, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement an intent recognition method as described above.
[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, and when the program or instructions are executed by a processor, an intent recognition method as described above is provided.
[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement an intent recognition method as described above.
[0010] Sixthly, embodiments of this application provide a computer program product, the computer program product including a computer program, which, when executed by a processor, implements the intent recognition method described above.
[0011] The technical solution of this application involves acquiring text data from multiple user interactions and performing intent recognition on the text data to obtain one or more intents. A pre-trained classification model is used to classify the intents to obtain the target primary intents corresponding to the primary intents. The target primary intent is a primary intent in an intent classification directory, which includes pre-constructed hierarchical primary and secondary intents, with the primary intent being the parent intent and the secondary intent being the child intent. The text vector of each intent under the same target primary intent is acquired, along with multiple preset similarity vectors corresponding to the secondary intents. The cosine similarity value between the text vector and each similarity vector is calculated, and the target secondary intent corresponding to the text vector is determined based on the cosine similarity value. Finally, the target intent of the text data is determined based on the target primary intent and the target secondary intent. This method involves identifying intents from multi-turn user interactions in complex scenarios, yielding one or more intents. Each intent is further categorized using a pre-trained classification model to determine its target primary intent within the intent classification directory. Multiple similarity vectors corresponding to secondary intents are pre-defined. By calculating the cosine similarity between the text vector and the similarity vectors of each primary intent, the target secondary intent corresponding to the text vector is determined. Based on the hierarchical relationship between the primary and secondary intents, the classification of each intent in the text data is determined, resulting in the target intent. This approach reduces reliance on manually labeled data and, through multi-level intent identification of text data, enables more accurate analysis and clarification of user intents, improving the efficiency of intent identification in complex intent systems. Attached Figure Description
[0012] Figure 1 This is a flowchart illustrating an intent recognition method provided according to an embodiment of this application; Figure 2 This is a schematic diagram of a scenario for an intent recognition method provided according to an embodiment of this application; Figure 3 This is a flowchart illustrating another intent recognition method provided according to an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an intent recognition device according to an embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application. Detailed Implementation
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0014] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0015] The intent recognition method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0016] Figure 1 This illustration shows an embodiment of an intent recognition method provided by the present invention. The method can be executed by an electronic device, which may include a server and / or a terminal device, wherein the terminal device may be, for example, an in-vehicle terminal or a mobile phone terminal. In other words, the method can be executed by software or hardware installed in the intent recognition device, and the method includes the following steps: S102, acquire text data from multiple rounds of user interaction, and perform intent recognition on the text data to obtain one or more intents from the text data.
[0017] In many scenarios, user needs often cannot be fully resolved through a single interaction. Multi-turn interactions become a necessary means to achieve precise service. This can be achieved by preprocessing the content data of multi-turn interactions, using the preprocessed data as text data. This text data is used to represent the content of the user's multi-turn interactions.
[0018] Intent recognition includes: identifying the intent of text data using an intent recognition model. It should be understood that text data carries one or more intents.
[0019] S104. The intent is classified using a pre-trained classification model to obtain the target first-level intent corresponding to the intent. The target first-level intent is the first-level intent in the intent classification directory. The intent classification directory includes pre-constructed first-level intents and second-level intents with hierarchical relationships. The first-level intent is the parent intent, and the second-level intent is the child intent.
[0020] The pre-trained classification model includes a model trained based on the Chinese pre-trained model ERNIE2, which is used to classify the intents identified by S102.
[0021] The intent classification directory includes: first-level intents and second-level intents that are pre-constructed manually and have a hierarchical relationship. There can be multiple first-level intents and multiple second-level intents, where the first-level intent is the parent intent and the second-level intent is the child intent, and each first-level intent can correspond to multiple second-level intents.
[0022] For example, the major categories included in the intent category directory are used as first-level intents, such as package change, fee inquiry, and fault reporting. The subcategories under the first-level intents in the intent category directory are used as second-level intents. For example, the first-level intent is package change, and package change corresponds to multiple second-level intents, such as "5G package upgrade" and "5G package tariff consultation".
[0023] The intents are classified using a pre-trained classification model to obtain the corresponding first-level intents in the intent classification directory, which serve as the target first-level intents. Since an intent may include one or more, each intent can be mapped to a first-level intent in the intent classification directory and serve as the target first-level intent for that intent.
[0024] S106, obtain the text vector of each intent under the same target first-level intent, and obtain multiple similar question vectors corresponding to the preset second-level intent.
[0025] The intent category directory includes multiple first-level intents. Each intent's corresponding first-level intent serves as its target first-level intent. Multiple intents under the same target first-level intent are retrieved, and the text vector for each intent under the same target first-level intent is calculated. The same target first-level intents can belong to the same major category in the intent category directory.
[0026] Similarity vectors are vectors of similar questions that are pre-annotated manually. Similar questions can serve as third-level intents. One second-level intent corresponds to multiple similar question vectors. That is, the content of the second-level intent and the similar questions are different but have the same meaning. When the similarity between the intent and the similar question is high, it belongs to the second-level intent corresponding to the similar question.
[0027] S108, calculate the cosine similarity value between the text vector and each similar text vector, and determine the target secondary intent corresponding to the text vector based on the cosine similarity value.
[0028] According to S106, determine the text vector of each intent under the same primary intent (i.e., the same major category), calculate the cosine similarity value between the text vector and each similarity vector, determine the similarity vector corresponding to the text vector based on the cosine similarity value, determine the corresponding secondary intent based on the similarity vector, and determine the secondary intent as the target secondary intent of the text vector.
[0029] S110, Determine the target intent of the text data based on the target first-level intent and the target second-level intent.
[0030] The target primary intent is determined based on the classification model, and the target secondary intent is determined based on S108. The target primary intent and the target secondary intent are used as the target intent of the intent. Since the text data includes multiple intents, the target intent of the text data is determined according to the target intent of each intent.
[0031] The technical solution of this application involves acquiring text data from multiple user interactions and performing intent recognition on the text data to obtain one or more intents. A pre-trained classification model is used to classify the intents to obtain the target primary intents corresponding to the primary intents. The target primary intent is a primary intent in an intent classification directory, which includes pre-constructed hierarchical primary and secondary intents, with the primary intent being the parent intent and the secondary intent being the child intent. The text vector of each intent under the same target primary intent is acquired, along with multiple preset similarity vectors corresponding to the secondary intents. The cosine similarity value between the text vector and each similarity vector is calculated, and the target secondary intent corresponding to the text vector is determined based on the cosine similarity value. Finally, the target intent of the text data is determined based on the target primary intent and the target secondary intent. This method involves identifying intents from multi-turn user interactions in complex scenarios, yielding one or more intents. Each intent is further categorized using a pre-trained classification model to determine its target primary intent within the intent classification directory. Multiple similarity vectors corresponding to secondary intents are pre-defined. By calculating the cosine similarity between the text vector and the similarity vectors of each primary intent, the target secondary intent corresponding to the text vector is determined. Based on the hierarchical relationship between the primary and secondary intents, the classification of each intent in the text data is determined, resulting in the target intent. This approach reduces reliance on manually labeled data and, through multi-level intent identification of text data, enables more accurate analysis and clarification of user intents, improving the efficiency of intent identification in complex intent systems.
[0032] In one embodiment, obtaining text data from multiple user interactions (i.e., S102) can be achieved by performing the following steps A1-A2: Step A1: Obtain content data generated from multiple rounds of user interaction. The content data includes text content data generated based on multimodal information.
[0033] For content data, multi-turn dialogue interaction is adopted to acquire it. Compared with single-turn interaction, multi-turn interaction can gradually clarify ambiguous needs and cover implicit needs that users have not clearly defined through contextual memory, dynamic intent understanding and other methods.
[0034] Multimodal information includes one or more types of data such as text, voice, and images.
[0035] By using front-end embedded auxiliary tools such as real-time voice transcription and image text recognition, multimodal information is converted into text content data, which refers to interactive content displayed in text form.
[0036] Step A2 involves preprocessing the content data to obtain text data, which is long text data. The preprocessing includes one or more of the following: structuring, encoding, denoising, and normalization.
[0037] Structured processing includes: representing the content data of multi-turn interactions in a structured manner. Specifically, a dialogue management mechanism is adopted to structure and record the entire process, including the content data of multi-turn interactions, downstream tool call records generated during the process, and call return results.
[0038] Encoding processing includes performing unified encoding detection on the content data to obtain processed content data. Specifically, since the content data is mostly based on multimodal information, it includes text from digital channels such as web forms and application (APP) chat, as well as multimodal information conversions such as speech transcription and image optical character recognition (OCR), resulting in a mixture of text encoding formats. Furthermore, in practice, special symbols such as emoticons, emojis, and kaomojis are used to express emotions; if these are directly entered into the analysis process without processing, it may lead to decoding errors or semantic deviations in subsequent intent recognition models. Therefore, it is necessary to perform unified encoding detection on the content data, converting all types of input text (content data) into the Unicode Transformation Format - 8-bit (UTF-8) standard encoding, and converting symbols such as emoticons into text descriptions (e.g., "smiley face emoji"), which preserves the original semantic information and ensures the stability and accuracy of subsequent analysis processes.
[0039] Noise reduction processing includes establishing a multi-level filtering mechanism to filter noise and remove redundancy from the content data. Specifically, due to the diverse sources of the content data, it may contain a large amount of non-semantic content. Regular expression matching methods are used to compress or delete long, meaningless interjections (such as "ah ah ah," "that," "hey," etc.); garbled characters (such as ^%$) generated by the input content data or the system are removed; invisible characters (such as \x00 and other control characters) are filtered out; and HyperText Markup Language (HTML) or eXtensible Markup Language (XML) tags from web sources are removed, preserving plain text. By establishing a multi-level filtering mechanism, the purity of the content data is effectively improved, providing high-quality input for intent recognition.
[0040] Standardization processing includes unifying the expression format of content data using regular expressions. Specifically, due to differences in user expression habits, key information often presents multiple expressions: amounts may appear as variations such as "20 yuan", "¥20", or "20 yuan"; dates and times may have multiple formats such as "May 15th", "2025 / 5 / 15", or "05-15"; and units of measurement may have different ways of writing them, such as "MB", "megabytes", or "M". For units, numbers, times, and dates, regular expressions are used to unify and standardize the expression format, resulting in standardized rewriting. For example, amounts, data usage, monthly prices, and dates are uniformly rewritten as 10 yuan, 500MB, 100 yuan / year, 0.5GB / month, 2025-05-15, etc. Standardization improves the accuracy of subsequent business entity extraction and matching, and also supports the comparison and calculation of numerical values within the session.
[0041] In this embodiment, by preprocessing the content data, complete and standardized text data is obtained. The text data can be long text data, which can improve the input quality of the subsequent input intent recognition model, as well as the stability and accuracy of the subsequent analysis process.
[0042] In one embodiment, to perform intent recognition on text data to obtain one or more intents of the text data (i.e., S102), the following step B can be performed: Step B involves inputting the text data into the intent recognition model. The intent recognition model then performs intent recognition on the text data to obtain one or more intents from the text data.
[0043] The intent recognition model is a student model guided by a teacher model. The teacher model is a densely structured large language model, and the student model includes a small-parameter model fine-tuned using a cross-loss function, which is used to recognize intent.
[0044] Since multi-turn dialogues in real-time interactive content often contain excessively long texts and divergent user intentions, the acquired text data can be long text data. It is necessary to use an intent recognition model to identify and summarize the intent of the text data, which can effectively capture the user's intent and is more conducive to feature capture by subsequent classification models.
[0045] The teacher model includes the qwen3-32B model, a densely structured large language model, which is used to transfer powerful semantic understanding capabilities to the student model through knowledge distillation.
[0046] Specifically, the core function of the teacher model is to use a large parameter model to perform intent recognition processing on the text data of structured multi-turn dialogue content, and generate intent s:
[0047] Among them, the Large Language Model (LLM) is the teacher model, Summary represents the intention summary of the text data, and ci represents the text data.
[0048] The teacher model exhibits stronger semantic understanding capabilities. It performs intent summarization and focus extraction on text data generated from complex multi-turn dialogues, achieving cross-turn semantic understanding and resolving common semantic understanding challenges (such as referential and ambiguity issues, as shown in Table 1). It also handles disambiguation in the speech-to-semantic conversion process (distinguishing between homophones or vague expressions). In multi-turn interactions between customers and customer service personnel, the teacher model, by combining context, obtains the current complete and accurate intent, eliminating the influence of vague and ambiguous expressions in long dialogues. Compared to the student model, it produces better generation results, as shown in Table 1 below.
[0049] Table 1: Semantic understanding issues involved in multi-turn dialogues The teacher model can use the prompt word template (prompt_template) to return the generated intent.
[0050] The student model includes a fine-tuned qwen3-0.6B model, which is a small-parameter model. It can be fine-tuned using the feature learning capabilities provided by the teacher model to generate more concise and accurate multi-turn dialogue current intents, and the student model has a smaller resource consumption.
[0051] Specifically, the student model can achieve good performance under limited resources, but its accuracy is lower compared to the larger language model, i.e., the teacher model. Therefore, it is necessary to guide and fine-tune the student model based on the teacher model, which can be achieved in the following two steps: Step 1: Acquire knowledge D and construct a knowledge set using the teacher model:
[0052] in: The input is the concatenation of the instruction prompt and the example s used to construct the intent recognition task. An example representing one or more actual text data; This represents the output of the teacher model, i.e., the intention. This represents the set of knowledge obtained from the teacher model. It should be understood that knowledge refers to the teacher model's interpretation of the input text data and the intent derived from the intent recognition of the text data, which is used to guide the student model in learning intent recognition.
[0053] Step 2: Fine-tuning. Supervised fine-tuning is performed on the smaller model, i.e., the student model, based on the cross-entropy loss function. The cross-entropy loss function is defined as follows:
[0054] Where: C represents the number of categories; This represents the true value of the i-th category; This represents the predicted value for the i-th category; This represents the loss of the student model. The categories refer to the different intentions of the input text data. The true category value refers to the true intentions contained in the text data; the predicted category value refers to the predicted intentions output by the student model.
[0055] The student model is fine-tuned using the cross-entropy loss function to make its output intent more consistent with the true intent in the text data. This fine-tuned student model, which learns from the teacher model's capabilities, is then used as an intent recognition model to identify intents in the text data.
[0056] Through knowledge distillation and the transfer of semantic understanding capabilities, the student model qwen3-0.6B acquires the semantic understanding capabilities of the teacher model qwen3-32B in the field of intelligent customer service, while reducing hardware requirements and greatly improving timeliness.
[0057] In this embodiment, intent summary data generated by the powerful language understanding and generation capabilities of the teacher model qwen3-32B (a large language model) is used to supervise and fine-tune the student model qwen3-0.6B. This allows the semantic understanding and generation capabilities of the large-parameter model to be transferred to the small-parameter model, aligning the accuracy of the small-parameter student model as close as possible to that of the teacher model. The fine-tuned student model then serves as the intent recognition model, enabling it to identify one or more intents from text data.
[0058] In one embodiment, the method further includes training a classification model, which may be performed using the following steps C1-C6: Step C1: Obtain multiple sample intents and their corresponding sample classification results. Input the sample intents into the classification model to be trained. The sample classification results are the first-level intents in the intent classification directory.
[0059] Sample intents include one or more intents obtained by identifying sample text data through an intent recognition model.
[0060] The sample classification result is the first-level intent of the sample intent in the intent classification directory, which is the true sample target first-level intent of the sample intent.
[0061] The classification model to be trained is built based on the ERNIE2 pre-trained language model. Specifically, it involves using a predetermined number of real labeled data points and obtaining a predetermined number of output classification data points from the classification model to be trained, adapting them to the target domain, and then training the classification model.
[0062] Step C2 involves segmenting and vectorizing the sample intent to obtain the segmented and vectorized intent.
[0063] The word segmentation and vectorization process includes: splitting the sample intent into words or sub-word units, and converting the segmented sample intent into a vector representation. Before segmentation, useless information about the sample intent is removed.
[0064] Step C3: Extract the semantic features of the intent after word segmentation and vectorization, and determine the key sentences of the intent after word segmentation and vectorization through an attention mechanism.
[0065] Semantic features refer to the core concepts corresponding to an intent when it is vectorized, such as implicit meanings and characteristics. Semantic features can be extracted using the Transformer neural network architecture.
[0066] Attention weights for semantic features are calculated using an attention mechanism to determine the key sentences of the intent after word segmentation and vectorization.
[0067] Step C4: Based on the key statement, the classification model to be trained outputs the sample intent and the probability vector and confidence of each first-level intent in the intent classification directory. The first-level intent corresponding to the probability vector with a confidence greater than or equal to a preset threshold is taken as the sample target first-level intent of the sample intent.
[0068] The probability vector includes the sample intent and the degree of matching for each primary intent in the intent category directory, and the degree of matching is represented as a probability vector.
[0069] Confidence refers to the maximum value of the probability vector output by the classification model to be trained, and is used to characterize the reliability of the classification model to be trained.
[0070] The preset threshold can be set manually, such as 0.7. When the confidence level of the probability vector output by the classification model to be trained is 0.7, the first-level intent in the intent classification directory pointed to by the probability vector corresponding to the confidence level is taken as the sample target first-level intent of the sample intent.
[0071] Preferably, when the confidence level of the probability vector output by the classification model to be trained is less than a preset threshold, the sample intent is reclassified. For example, when the maximum value of the probability vector, i.e., the confidence level, is lower than 0.7, the system will automatically trigger the reclassification process or transfer it to manual processing to ensure the accuracy of routing.
[0072] Step C5: Obtain the loss function of the classification model to be trained. The loss function includes the class weights of the sample intent.
[0073] By incorporating class weights of sample intent into the loss function of the classification model to be trained, when the classes are imbalanced, the weights can be automatically adjusted based on the number of sample intents of each class in each batch through a dynamic adjustment mechanism, since the loss function includes class weights of sample intents. This allows the classification model to pay more attention to the classes with fewer sample intents during training, thereby effectively alleviating the prediction bias problem caused by uneven data distribution.
[0074] The loss function is defined as follows:
[0075] in: Represents the loss function; This represents the total number of sample intentions in the current training batch; This indicates the total number of training batches in t, and the categories. The weight, category refers to the category to which the sample intent belongs in the intent classification directory; This indicates that the classification model to be trained predicts the true label for the i-th sample. The log-likelihood, the true label refers to the true category to which the sample intent belongs in the intent classification directory.
[0076] Class weights of sample intent The calculation is as follows:
[0077] in: This represents the number of samples of category c in the t-th batch; This represents a hyperparameter that controls the scaling factor for class weights; This represents the category weights of the sample intent after dynamic adjustment.
[0078] Step C6: Based on the sample classification results, the primary intent of the sample target, and the loss function, train the classification model to be trained to obtain the trained classification model.
[0079] Based on the sample classification results in step C1 and the sample target intent output by the classification model to be trained, the parameters of the classification model to be trained are adjusted through the loss function so that the sample target intent output by the classification model to be trained corresponds to the sample classification results, thus obtaining the trained classification model.
[0080] In this embodiment, the parameters of the classification model to be trained are adjusted according to the sample intent and the corresponding sample classification result, as well as the loss function. The training of the classification model enables the sample intent to be classified in the intent classification directory for the first time. When the output confidence is lower than the preset threshold, the reclassification process can be triggered in time to improve the accuracy of intent classification.
[0081] In one embodiment, to obtain the text vector of each intent under the same primary intent and to obtain multiple similar text vectors corresponding to the preset secondary intent (i.e., S106), the following steps D1-D2 can be performed: Step D1: Obtain the intents under the same target first-level intent and input them into the vector representation model. Encode the intents under the same target first-level intent through the vector representation model to obtain the text vector of each intent under the same target first-level intent. The vector representation model is used to match the intents with the second-level intents.
[0082] Vector representation models include: the open-source general vector (bge-large-zh-v1.5, BGE) model, which provides semantic vector representations and can serve as a core semantic encoder.
[0083] The vector representation model receives intents under the same primary objective. This shared primary objective serves as a constraint; when intents are classified as belonging to the same primary objective, the vector representation model encodes these intents—that is, it encodes intents within the same major category in the intent directory. This results in a text vector for each intent under the same primary objective.
[0084] Secondary intents can serve as standard intents, i.e., the user's core intents. The intent category directory can include multiple primary intents, and one primary intent can correspond to multiple secondary intents. Primary intents and secondary intents have a hierarchical relationship, with primary intents serving as major categories and secondary intents serving as minor categories within those major categories.
[0085] Vector representation models are used to encode intents to obtain text vectors, which are then used to match secondary intents to the primary intent.
[0086] After obtaining the same target-level intent and inputting it into the vector representation model, the input intent is first standardized and preprocessed, including special symbol filtering, synonym replacement and key entity masking, to ensure the stability of the vector encoding, and then the text vector is obtained.
[0087] Step D2: Pre-construct a standard vector library and obtain multiple similar question vectors corresponding to the secondary intent from the standard vector library; wherein, the standard vector library includes: similar question vectors with multiple intent labels corresponding to the secondary intent, and the similar question vectors are vectors generated by the vector representation model of the preset similar questions.
[0088] A standard vector library for storing similarity vectors to optimize semantic similarity search.
[0089] Similar question vectors are generated after encoding based on a vector representation model, and include intent labels corresponding to user-annotated pre-defined similar questions. The system can pre-build a standard vector library that includes multiple similar question vectors corresponding to secondary intents.
[0090] It should be noted that the primary intent (the category identifier of the primary intent) (e.g., "package change"), the secondary intent (the standard intent) (e.g., "5G package upgrade"), and the tertiary intent (multiple similar questions manually labeled) (e.g., "Can you help me upgrade to a more expensive package?") and the multidimensional semantic vector representations of the secondary and tertiary intents pre-computed using a vector representation model can all be stored in a distributed search and analysis engine (Elasticsearch, ES) database. The ES database has storage and retrieval engine capabilities, enabling efficient storage and rapid matching of intent features.
[0091] As an example: When intents under the same primary target enter the matching process, the vector representation model first encodes them into 768-dimensional semantic vectors, defined as follows:
[0092] in: The intent text represents the input intent. This indicates that the BGE vector model is being processed using vectorized encoding. This represents the encoded 768-dimensional semantic vector. Similarly, for each secondary intent... The pre-constructed set of similar questions is represented as Then the set of its corresponding similarity vectors is represented as .
[0093] In this embodiment, the vector representation model can encode the intents under the same target first-level intent to obtain the corresponding text vectors. A standard vector library is pre-built, which includes similar question vectors with multiple intent labels corresponding to the second-level intents. Similar question vectors can be searched or called at any time, improving the timeliness of semantic matching.
[0094] In one embodiment, the cosine similarity value between the text vector and each similar text vector is calculated. Based on the cosine similarity value, the target secondary intent corresponding to the text vector is determined (i.e., S108). The following steps E1-E2 can be performed: Step E1 involves calculating the cosine similarity value between the text vector and each similar question vector using the scoring mechanism in the distributed search and analysis engine ES database. The ES database is used to store the text vector and the similar question vector.
[0095] The scoring mechanism of the Elasticsearch database includes: calculating the relevance between the stored vector and the query vector, sorting them according to the relevance score, and returning the results.
[0096] The cosine similarity value between a text vector and each similar text vector is calculated using the scoring mechanism of the ES database. Since the same primary intent may include multiple intents, and each intent corresponds to a text vector, the relevance between each text vector and the secondary intent corresponding to each primary intent is calculated using the scoring mechanism of the ES database. The relevance is determined by calculating the cosine similarity value between the text vector and the similar text vector corresponding to the secondary intent.
[0097] The secondary intent includes one or more preset similar questions, corresponding to one or more similar question vectors. The preset similar questions can be used as the tertiary intent. When performing secondary intent matching for intents under the same target primary intent, each intent under the same target primary intent can be matched with the preset similar questions corresponding to the secondary intent.
[0098] Step E2: Obtain the secondary intents corresponding to similarity vectors whose cosine similarity values are greater than a preset threshold, and determine the secondary intents corresponding to similarity vectors with cosine similarity values greater than the preset threshold as the target secondary intents corresponding to the text vectors.
[0099] Based on the text vector and the cosine similarity value of each similar vector obtained in step E1, when the cosine similarity value is greater than a preset threshold, the secondary intent corresponding to the similar vector with the cosine similarity value greater than the preset threshold is taken as the target secondary intent of the intent under the same target primary intent. The preset threshold can be set manually, such as 0.75.
[0100] As an example, in the vector space of the subclasses (secondary intents) of the corresponding major category (target primary intent), the cosine similarity value between the text vector and the similarity vector is calculated:
[0101] Finally, return the name of the subclass intent (secondary intent) with the highest similarity score. and its confidence score:
[0102]
[0103] in, Represents a text vector; This represents the vector space formed by multiple similar question vectors corresponding to multiple pre-defined secondary intentions; This represents the i-th similar vector among multiple similarity vectors; This represents the secondary intent with the highest similarity value among the text vectors, along with its confidence score. It should be understood that when this confidence score is greater than a preset confidence score, the secondary intent corresponding to the confidence score greater than the preset confidence score is taken as the target secondary intent.
[0104] It should be noted that when the confidence score falls below the preset confidence score, a manual review process is automatically triggered. Furthermore, the encoded results of frequently accessed queries are cached. For example, if a text vector is queried more times than a preset number of times, or if a similar query vector is queried more times than a preset number of times, the text vector or similar query vector is cached, which reduces system response latency. The system can periodically incrementally update the Elasticsearch database to maintain the timeliness of semantic representations. It also supports a hot-reload mechanism for seamless business upgrades.
[0105] In this embodiment, the cosine similarity value between the text vector and each similarity vector is calculated through the scoring mechanism of the ES database to determine the target secondary intent corresponding to the text vector. This enables further matching of secondary intents for all intents under the target primary intent. The ES database can store text vectors and similarity vectors and can update them periodically. Compared with the traditional matching model that integrates input vector representation, candidate data vector representation, and similarity calculation, calling the vector representation model and the ES database is more flexible and reduces the workload of manual system maintenance.
[0106] Figure 2 This is a schematic diagram of a scenario for an intent recognition method provided in an embodiment of this application, such as... Figure 2As shown, multi-source content data generated from multiple rounds of dialogue is acquired. This content data is preprocessed to obtain text data. Through knowledge distillation, the teacher model guides the student model to learn intent recognition, identifying intents within the text data. Intents can be one or more. The intents are then classified into text categories. First, intents are classified into primary intents, which are the major categories of intents, yielding the corresponding target primary intent. The text vector for each intent under the same target primary intent is obtained. This text vector is then matched with similar question vectors under the same target primary intent in the ES database to obtain the target secondary intent, i.e., the standard intent. The storage of similar question vectors in the ES database includes: obtaining the similar questions corresponding to the secondary intents under each primary intent in the intent classification directory, i.e., the tertiary intents (similar questions). The vector representation model automatically calculates and updates the similar question vectors to generate the stored similar question vectors.
[0107] In summary, guiding student models to learn intent recognition through a teacher model can improve inference speed while reducing resource consumption. Furthermore, cascading and hierarchical intent recognition can improve the accuracy of identifying target intents. If the vector representation model and the Elasticsearch database are used as the matching model, matching each intent under the same primary target intent with the target secondary intent transforms the update of the matching model from a holistic iterative update to a change in a single vector representation, significantly reducing the scope of adjustments during updates. When adding or adjusting business data in the Elasticsearch database, an intelligent mechanism automatically triggers the calculation process of the vector representation model, generating high-dimensional vector representations in real time and persistently storing the calculation results as structured fields for easy subsequent matching and retrieval.
[0108] Figure 3 This is a flowchart illustrating another intent recognition method provided according to an embodiment of this application, such as... Figure 3 As shown, the method includes the following steps: S301, acquire content data generated by multiple rounds of user interaction, including: text content data generated based on multimodal information.
[0109] S302, preprocess the content data to obtain text data.
[0110] The text data is long text data, and the preprocessing includes one or more of the following: structuring, encoding, denoising, and normalization.
[0111] S303, input the text data into the intent recognition model, and use the intent recognition model to perform intent recognition on the text data to obtain one or more intents of the text data.
[0112] S304 uses a pre-trained classification model to classify the intent and obtain the target first-level intent corresponding to the intent.
[0113] S305, obtain the intents under the same target first-level intent and input them into the vector representation model. Encode the intents under the same target first-level intent through the vector representation model to obtain the text vector of each intent under the same target first-level intent.
[0114] S306, a standard vector library is pre-built, and multiple similar question vectors corresponding to the secondary intent are obtained from the standard vector library.
[0115] S307 calculates the cosine similarity value between the text vector and each similar vector using the scoring mechanism in the ES database.
[0116] S308, obtain the secondary intents corresponding to similarity vectors whose cosine similarity values are greater than a preset threshold, and determine the secondary intents corresponding to similarity vectors with similarity values greater than the preset threshold as the target secondary intents corresponding to the text vectors.
[0117] S309, Determine the target intent of the text data based on the primary and secondary target intents.
[0118] The specific processes from S301 to S309 have been described in detail in the above embodiments and will not be repeated here.
[0119] The technical solution of this application involves acquiring text data from multiple user interactions and performing intent recognition on the text data to obtain one or more intents. A pre-trained classification model is used to classify the intents to obtain the target primary intents corresponding to the primary intents. The target primary intent is a primary intent in an intent classification directory, which includes pre-constructed hierarchical primary and secondary intents, with the primary intent being the parent intent and the secondary intent being the child intent. The text vector of each intent under the same target primary intent is acquired, along with multiple preset similarity vectors corresponding to the secondary intents. The cosine similarity value between the text vector and each similarity vector is calculated, and the target secondary intent corresponding to the text vector is determined based on the cosine similarity value. Finally, the target intent of the text data is determined based on the target primary intent and the target secondary intent. This method involves identifying intents from multi-turn user interactions in complex scenarios, yielding one or more intents. Each intent is further categorized using a pre-trained classification model to determine its target primary intent within the intent classification directory. Multiple similarity vectors corresponding to secondary intents are pre-defined. By calculating the cosine similarity between the text vector and the similarity vectors of each primary intent, the target secondary intent corresponding to the text vector is determined. Based on the hierarchical relationship between the primary and secondary intents, the classification of each intent in the text data is determined, resulting in the target intent. This approach reduces reliance on manually labeled data and, through multi-level intent identification of text data, enables more accurate analysis and clarification of user intents, improving the efficiency of intent identification in complex intent systems.
[0120] It should be noted that the intent recognition method provided in this application can be executed by an intent recognition device or a control module within that intent recognition device for executing the intent recognition method. This application uses the execution of the intent recognition method by an intent recognition device as an example to illustrate the intent recognition device provided in this application.
[0121] Figure 4 This is a schematic diagram of an intent recognition device according to an embodiment of the present invention. Figure 4 As shown, the intent recognition device includes: an acquisition module 41, a classification module 42, a construction module 43, a matching module 44, and a determination module 45. The acquisition module 41 is used to acquire text data from multiple rounds of user interaction and perform intent recognition on the text data to obtain one or more intents from the text data; The classification module 42 is used to classify the intent using a pre-trained classification model to obtain the target first-level intent corresponding to the intent; wherein, the target first-level intent is the first-level intent in the intent classification directory, and the intent classification directory includes pre-constructed first-level intents and second-level intents with hierarchical relationships, where the first-level intent is the parent intent and the second-level intent is the child intent; Module 43 is used to obtain the text vector of each intent under the same target first-level intent, and to obtain multiple similar question vectors corresponding to the preset second-level intent; The matching module 44 is used to calculate the cosine similarity value between the text vector and each similar text vector, and to determine the target secondary intent corresponding to the text vector based on the cosine similarity value. Module 45 is used to determine the target intent of text data based on the target first-level intent and the target second-level intent.
[0122] In one embodiment, the acquisition module 41 is used to input text data into the intent recognition model, and through the intent recognition model, to perform intent recognition on the text data to obtain one or more intents of the text data; wherein, the intent recognition model is a student model guided by a teacher model, the teacher model is a dense structure large language model, and the student model includes: a small parameter model after fine-tuning using a cross loss function, used to recognize intents.
[0123] In one embodiment, the device includes a training module, specifically comprising: The acquisition unit is used to acquire multiple sample intents and the corresponding sample classification results, input the sample intents into the classification model to be trained, and the sample classification results are the first-level intents in the intent classification directory; The processing unit is used to perform word segmentation and vectorization processing on the sample intent to obtain the word segmentation and vectorization processed intent; The extraction unit is used to extract the semantic features of the intent after word segmentation and vectorization, and to identify the key sentences of the intent after word segmentation and vectorization through an attention mechanism; The output unit is used to output the sample intent and the probability vector and confidence of each first-level intent in the intent classification directory based on the key sentence and the classification model to be trained. The first-level intent corresponding to the probability vector with a confidence greater than or equal to a preset threshold is used as the sample target first-level intent of the sample intent. The confidence represents the maximum value of the probability vector. The loss unit is used to obtain the loss function of the classification model to be trained. The loss function includes: class weights of sample intent; The training unit is used to train the classification model to be trained based on the sample classification results, the sample target intent, and the loss function, so as to obtain the trained classification model.
[0124] In one embodiment, the construction module 43 is specifically used to obtain the intents under the same target first-level intent and input them into the vector representation model. The vector representation model encodes the intents under the same target first-level intent to obtain the text vector of each intent under the same target first-level intent. The vector representation model is used to match the intents with the second-level intents. A standard vector library is pre-built, and multiple similar question vectors corresponding to the second-level intents are obtained from the standard vector library. The standard vector library includes: similar question vectors with multiple intent labels corresponding to the second-level intents. The similar question vectors are vectors generated by the vector representation model through the preset similar questions.
[0125] In one embodiment, the matching module 44 is specifically used to calculate the cosine similarity value between the text vector and each similar question vector through the scoring mechanism in the ES database, the ES database being used to store the text vector and the similar question vector; to obtain the secondary intent corresponding to the similar question vector whose cosine similarity value is greater than a preset threshold, and to determine the secondary intent corresponding to the similar question vector whose cosine similarity value is greater than the preset threshold as the target secondary intent corresponding to the text vector.
[0126] In one embodiment, the acquisition module 41 is specifically used to acquire content data generated by multiple rounds of user interaction. The content data includes: text content data generated based on multimodal information; and preprocessing the content data to obtain text data, which is long text data. The preprocessing includes one or more of the following: structured processing, encoding processing, noise reduction processing, and normalization processing.
[0127] The technical solution of this application involves acquiring text data from multiple user interactions and performing intent recognition on the text data to obtain one or more intents. A pre-trained classification model is used to classify the intents to obtain the target primary intents corresponding to the primary intents. The target primary intent is a primary intent in an intent classification directory, which includes pre-constructed hierarchical primary and secondary intents, with the primary intent being the parent intent and the secondary intent being the child intent. The text vector of each intent under the same target primary intent is acquired, along with multiple preset similarity vectors corresponding to the secondary intents. The cosine similarity value between the text vector and each similarity vector is calculated, and the target secondary intent corresponding to the text vector is determined based on the cosine similarity value. Finally, the target intent of the text data is determined based on the target primary intent and the target secondary intent. This method involves identifying intents from multi-turn user interactions in complex scenarios, yielding one or more intents. Each intent is further categorized using a pre-trained classification model to determine its target primary intent within the intent classification directory. Multiple similarity vectors corresponding to secondary intents are pre-defined. By calculating the cosine similarity between the text vector and the similarity vectors of each primary intent, the target secondary intent corresponding to the text vector is determined. Based on the hierarchical relationship between the primary and secondary intents, the classification of each intent in the text data is determined, resulting in the target intent. This approach reduces reliance on manually labeled data and, through multi-level intent identification of text data, enables more accurate analysis and clarification of user intents, improving the efficiency of intent identification in complex intent systems.
[0128] The intent recognition device in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0129] The intent recognition device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.
[0130] The intent recognition device provided in this application embodiment can achieve... Figures 1 to 3 The various processes implemented in the method embodiments are not described in detail here to avoid repetition.
[0131] Based on the same technical concept, embodiments of this application also provide an electronic device for performing the above-described intent recognition method. Figure 5 This is a schematic diagram of the structure of an electronic device to implement various embodiments of this application. The electronic device can vary significantly due to differences in configuration or performance, and may include a processor 510, a communications interface 520, a memory 530, and a communication bus 540. The processor 510, communications interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 can call a computer program stored in the memory 530 and executable on the processor 510 to perform the following steps: Acquire text data from multiple user interactions, perform intent recognition on the text data, and obtain one or more intents from the text data; The intent is classified using a pre-trained classification model to obtain the target first-level intent corresponding to the intent. The target first-level intent is the first-level intent in the intent classification directory, which includes pre-constructed first-level intents and second-level intents with hierarchical relationships. The first-level intent is the parent intent, and the second-level intent is the child intent. Obtain the text vector of each intent under the same primary intent, and obtain multiple similar text vectors corresponding to the preset secondary intents; Calculate the cosine similarity value between the text vector and each similar text vector, and determine the target secondary intent corresponding to the text vector based on the cosine similarity value; Based on the primary and secondary objectives, the target intent of the text data is determined.
[0132] The technical solution of this application involves acquiring text data from multiple user interactions and performing intent recognition on the text data to obtain one or more intents. A pre-trained classification model is used to classify the intents to obtain the target primary intents corresponding to the primary intents. The target primary intent is a primary intent in an intent classification directory, which includes pre-constructed hierarchical primary and secondary intents, with the primary intent being the parent intent and the secondary intent being the child intent. The text vector of each intent under the same target primary intent is acquired, along with multiple preset similarity vectors corresponding to the secondary intents. The cosine similarity value between the text vector and each similarity vector is calculated, and the target secondary intent corresponding to the text vector is determined based on the cosine similarity value. Finally, the target intent of the text data is determined based on the target primary intent and the target secondary intent. This method involves identifying intents from multi-turn user interactions in complex scenarios, yielding one or more intents. Each intent is further categorized using a pre-trained classification model to determine its target primary intent within the intent classification directory. Multiple similarity vectors corresponding to secondary intents are pre-defined. By calculating the cosine similarity between the text vector and the similarity vectors of each primary intent, the target secondary intent corresponding to the text vector is determined. Based on the hierarchical relationship between the primary and secondary intents, the classification of each intent in the text data is determined, resulting in the target intent. This approach reduces reliance on manually labeled data and, through multi-level intent identification of text data, enables more accurate analysis and clarification of user intents, improving the efficiency of intent identification in complex intent systems.
[0133] The specific execution steps can be found in the various steps of the above-described intent recognition method embodiments, and can achieve the same technical effect. To avoid repetition, they will not be repeated here.
[0134] It should be noted that the electronic devices in the embodiments of this application include: servers, terminals, or other devices besides terminals.
[0135] The above electronic device structure does not constitute a limitation on the electronic device. An electronic device may include more or fewer components than illustrated, or combine certain components, or arrange them differently. For example, an input unit may include a Graphics Processing Unit (GPU) and a microphone, and a display unit may use a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar display panels. User input units include at least one of a touch panel and other input devices. A touch panel is also called a touchscreen. Other input devices may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be elaborated further here.
[0136] Memory can be used to store software programs and various data. Memory can primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area can store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, memory can include volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (Synchlink DRAM, SLDRAM), and direct memory bus RAM (DRRAM).
[0137] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly handles operations related to the operating system, user interface, and applications, while the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor.
[0138] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described intent recognition method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0139] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0140] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described intent recognition method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0141] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0142] This application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the processor is used to run the program or instructions to implement the various processes of the above-mentioned product recommended method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.
[0143] It should be noted that, in this document, 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 that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0144] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0145] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. An intent recognition method, characterized in that, The method includes: Acquire text data from multiple rounds of user interaction, and perform intent recognition on the text data to obtain one or more intents from the text data; The intent is classified using a pre-trained classification model to obtain the target first-level intent corresponding to the intent; wherein, the target first-level intent is a first-level intent in the intent classification directory, and the intent classification directory includes the first-level intent and second-level intents with a hierarchical relationship, the first-level intent is the parent intent, and the second-level intent is the child intent; Obtain the text vector of each intent under the same target first-level intent, and obtain multiple similar question vectors corresponding to the preset second-level intent; Calculate the cosine similarity value between the text vector and each of the similar text vectors, and determine the target secondary intent corresponding to the text vector based on the cosine similarity value; Based on the primary target intent and the secondary target intent, the target intent of the text data is determined.
2. The method according to claim 1, characterized in that, The process of performing intent recognition on the text data to obtain one or more intents of the text data includes: The text data is input into an intent recognition model, and the intent recognition model is used to identify the intent of the text data to obtain one or more intents of the text data; wherein, the intent recognition model is a student model guided by a teacher model, the teacher model is a dense structure large language model, and the student model includes: a small parameter model fine-tuned using a cross loss function, used to identify the intent.
3. The method according to claim 1, characterized in that, The classification model was obtained through the following training: Obtain multiple sample intents and corresponding sample classification results for the sample intents, input the sample intents into the classification model to be trained, and the sample classification results are the first-level intents in the intent classification catalog; The sample intent is segmented and vectorized to obtain the segmented and vectorized intent. Extract the semantic features of the intent after word segmentation and vectorization, and determine the key sentences of the intent after word segmentation and vectorization through an attention mechanism; Based on the key statement, the classification model to be trained outputs the probability vector and confidence level of the sample intent and each first-level intent in the intent classification directory. The first-level intent corresponding to the probability vector with the confidence level greater than or equal to a preset threshold is taken as the sample target first-level intent of the sample intent. The confidence level represents the maximum value of the probability vector. Obtain the loss function of the classification model to be trained, the loss function including: the class weights of the sample intent; Based on the sample classification results, the primary intent of the sample target, and the loss function, the classification model to be trained is trained to obtain the trained classification model.
4. The method according to claim 1, characterized in that, The step of obtaining the text vector of each intent under the same target primary intent, and obtaining multiple similar text vectors corresponding to the preset secondary intent, includes: The intents under the same primary target intent are obtained and input into a vector representation model. The intents under the same primary target intent are encoded through the vector representation model to obtain the text vector of each intent under the same primary target intent. The vector representation model is used to match the intents with the secondary intents. A standard vector library is pre-constructed, and multiple similar question vectors corresponding to the secondary intent are obtained from the standard vector library; wherein, the standard vector library includes: similar question vectors with multiple intent labels corresponding to the secondary intent, and the similar question vectors are vectors generated by the vector representation model through the preset similar questions.
5. The method according to claim 1, characterized in that, The step of calculating the cosine similarity value between the text vector and each of the similar vectors, and determining the target secondary intent corresponding to the text vector based on the cosine similarity value, includes: The cosine similarity value between the text vector and each of the similar question vectors is calculated using the scoring mechanism in the distributed search and analysis engine ES database, and the ES database is used to store the text vector and the similar question vector; Obtain the secondary intent corresponding to the similarity vector whose cosine similarity value is greater than a preset threshold, and determine the secondary intent corresponding to the similarity vector whose cosine similarity value is greater than the preset threshold as the target secondary intent corresponding to the text vector.
6. The method according to claim 1, characterized in that, The acquisition of text data from multiple user interactions includes: The content data generated by the user's multi-round interactions is obtained, and the content data includes: text content data generated based on multimodal information; The content data is preprocessed to obtain the text data, which is long text data. The preprocessing includes one or more of the following: structuring processing, encoding processing, noise reduction processing, and normalization processing.
7. An intent recognition device, characterized in that, include: The acquisition module is used to acquire text data from multiple rounds of user interaction, and to perform intent recognition on the text data to obtain one or more intents of the text data; The classification module is used to classify the intent using a pre-trained classification model to obtain the target first-level intent corresponding to the intent; wherein, the target first-level intent is a first-level intent in the intent classification directory, and the intent classification directory includes the first-level intent and second-level intents with a pre-constructed hierarchical relationship, the first-level intent is the parent intent, and the second-level intent is the child intent; The construction module is used to obtain the text vector of each intent under the same target first-level intent, and to obtain multiple similar question vectors corresponding to the preset second-level intent; The matching module is used to calculate the cosine similarity value between the text vector and each of the similar text vectors, and to determine the target secondary intent corresponding to the text vector based on the cosine similarity value. The determination module is used to determine the target intent of the text data based on the target primary intent and the target secondary intent.
8. An electronic device, characterized in that, The device includes a processor and a memory electrically connected to the processor, the memory storing a computer program, and the processor being configured to call and execute the computer program from the memory to implement an intent recognition method as described in claims 1-6.
9. A computer-readable storage medium, characterized in that, The storage medium is used to store a computer program that can be executed by a processor to implement an intent recognition method as described in claims 1-6.
10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements an intent recognition method as described in claims 1-6.