Single-intention and multi-intention classification method and device based on natural language reasoning

Through a single multi-intention classification method based on natural language reasoning, the semantic similarity is calculated using the DeBERTa model and example sentence groups, which solves the problems of poor expansion of intention classification and multi-intention scenario processing in the prior art, and achieves efficient and accurate intention recognition and real-time support for new intentions.

CN119691187APending Publication Date: 2025-03-25HANGZHOU YULE INTELLIGENT COMMUNICATIONS CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411633077.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

The existing intent classification methods are poorly scalable, require a large amount of labeled data, cannot handle multi-intention scenarios, and cannot add intent at low cost.

Method used

The single-multi-intention classification method based on natural language reasoning is adopted to convert the speech data into text data through automatic speech recognition, and the semantic similarity between text data and example sentences is calculated using the preset example sentence group and DeBERTa model, obtain the intention score, and output the intention list.

Benefits of technology

It reduces the system's extended labeling data requirements, can accurately identify multiple intents in a piece of text, and supports the addition of new intents in real time, improving the accuracy and efficiency of intent recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691187A_ABST
    Figure CN119691187A_ABST
Patent Text Reader

Abstract

The invention provides a single-multiple intention classification method and device based on natural language reasoning, and the method comprises the steps: receiving voice data, and converting the voice data into text data through an automatic voice recognition ASR system; the text data serve as first input, a preset example sentence group serves as second input, the first input and the second input are input into a natural language reasoning NLI model, the example sentence group comprises a plurality of intentions, each intention corresponds to at least one example sentence, and each example sentence is used for representing semantic features of the corresponding intention; calculating the semantic similarity between the text data and each example sentence in the example sentence group through the NLI model to obtain a corresponding score, and selecting the highest score in the corresponding example sentence of each intention as the score of the intention; and sorting the intentions of which the scores are greater than a preset score threshold value from high to low according to the scores, and outputting an intention list of the text data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing, and in particular to a single- and multi-intent classification method and device based on natural language reasoning. Background Art

[0002] Existing intent classification methods usually adopt a classification model-based approach, which requires training a corresponding classifier for each intent, resulting in poor system scalability and inability to flexibly add new intents. At the same time, since the classifier requires a large amount of labeled data to train each intent, it consumes a lot of resources when expanding new intents. In addition, most existing classification methods can only identify a single intent and cannot handle complex scenarios where a text contains multiple intents.

[0003] For example, the existing technology cannot classify multiple intents in the same sentence: natural language expressions usually, or even most of the time, contain multiple meanings. For example, "I'm driving" means both "I'm on the way" and "It's not convenient to answer the phone now". For another example, when a user says "I want to go to Hangzhou", the intention of the user facing the hotel type AI customer service should be "book a hotel", while the intention of the user facing the airline type AI customer service should be "book a flight ticket".

[0004] In addition, existing technologies also make it impossible to add new intents at low cost: for example, if an AI assistant needs to add a new intent "go out for fun during the National Day holiday", it will need a large number of sentences expressing the intent of "go out for fun during the National Day holiday" and will consume a lot of computing power and time to train or fine-tune the NLU model. It may even take until after the National Day holiday to train an NLU model that can recognize the intent of "go out for fun during the National Day holiday". Summary of the invention

[0005] In view of this, the present application provides a single- and multi-intent classification method based on natural language reasoning, which solves the problems in the prior art that the intent classification system has poor scalability, requires a large amount of labeled data, and cannot handle multi-intent scenarios.

[0006] This application provides a single- and multi-intent classification method based on natural language reasoning, including:

[0007] Receiving voice data and converting the voice data into text data through an automatic speech recognition (ASR) system;

[0008] Input the text data as a first input and a preset example sentence group as a second input to a natural language inference (NLI) model, wherein the example sentence group includes multiple intents, each intent corresponds to at least one example sentence, and each example sentence is used to characterize the semantic features of the corresponding intent;

[0009] Calculating the semantic similarity between the text data and each example sentence in the example sentence group through the NLI model to obtain a corresponding score, and selecting the highest score in the corresponding example sentence for each intent as the score of the intent;

[0010] The intentions with scores greater than a preset score threshold are sorted from high to low according to the scores, and the intent list of the text data is output.

[0011] Optionally, receiving voice data and converting the voice data into text data through an ASR system includes:

[0012] receiving a voice signal of the voice data;

[0013] Identify and analyze the acoustic features and language features of the speech signal;

[0014] Converting the speech signal into corresponding text data according to the acoustic features and language features;

[0015] Wherein, the ASR system supports multi-language and dialect recognition.

[0016] Optionally, calculating the semantic similarity between the text data and each example sentence in the example sentence group by the NLI model to obtain a corresponding score includes:

[0017] Use the DeBERTa model to build the NLI model;

[0018] Input the text data and example sentences into the DeBERTa model for feature extraction;

[0019] Based on the attention mechanism of the DeBERTa model, the semantic similarity between the text data and each example sentence is calculated to obtain the corresponding score.

[0020] Optionally, the method further comprises:

[0021] When obtaining the corresponding score of each intent through the NLI model, an adaptively optimized continuous time analysis method is adopted, including:

[0022] Obtain historical corpus data and historical scoring data;

[0023] Establishing a scoring time series model, and training the scoring time series model based on the historical corpus data and the historical scoring data;

[0024] Adopting the scoring time series model to adaptively optimize and normalize the current scoring;

[0025] The adaptive optimization adopts a dynamic learning rate, and the normalization process adopts a piecewise linear normalization method.

[0026] Optionally, the method further comprises:

[0027] When obtaining the corresponding score of each intent through the NLI model, a topology-aware method based on graph data is adopted, including:

[0028] Construct an intent relationship graph and represent the semantic associations between different intents as edges in the graph;

[0029] Based on the intention relationship graph, each intention is encoded by a graph neural network to obtain a reinforced feature representation;

[0030] The score is adjusted and optimized in combination with the reinforcement feature representation.

[0031] Optionally, based on the intention relationship graph, performing graph neural network encoding on each intention to obtain a reinforced feature representation includes:

[0032] A graph attention network is used to extract local structural features of intent nodes;

[0033] A graph convolutional network is used to extract the global topological features of the intent nodes;

[0034] The local structural features and global topological features are integrated to obtain a reinforced feature representation of the intent node.

[0035] Optionally, determining the preset scoring threshold includes:

[0036] Performing parameter fine-tuning training on the NLI model;

[0037] Perform forward and backward validation on the validation dataset;

[0038] Calculate the forward accuracy and reverse accuracy under different scoring thresholds;

[0039] The score with the smallest difference between the forward accuracy rate and the reverse accuracy rate is selected as the preset score threshold.

[0040] Optionally, the method further comprises:

[0041] Obtain historical corpus data;

[0042] Cleaning and labeling the historical corpus data;

[0043] The cleaned and annotated historical corpus data is input into the NLI model for incremental learning optimization.

[0044] Optionally, each intent in the example sentence group includes at least one example sentence, examples of different intents are independent of each other, and the example sentences can be increased, decreased, and updated in real time.

[0045] This application has the following beneficial effects:

[0046] By introducing the natural language inference (NLI) model for intent classification, only a small number of examples are needed to complete intent recognition, greatly reducing the demand for annotation data for system expansion. At the same time, based on the scoring mechanism of the NLI model, the present invention can accurately identify multiple intents in a text.

[0047] By adaptively optimizing the continuous time analysis method, we can make full use of historical corpus to improve model performance, and normalization processing makes the scoring more stable.

[0048] The topology-aware method based on graph data makes full use of the semantic association information between different intents and improves the accuracy of intent recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0050] Figure 1 It is a flowchart of the single-multiple intent classification method based on natural language reasoning provided by the present invention;

[0051] Figure 2 It is a flowchart of ASR speech recognition in the single-multiple intent classification method based on natural language reasoning provided by the present invention;

[0052] Figure 3 It is a structural schematic diagram of the NLI model provided by the present invention;

[0053] Figure 4 It is a structural schematic diagram of a topology perception module based on graph data provided by the present invention;

[0054] Figure 5 It is a structural schematic diagram of the adaptive optimization continuous time analysis module provided by the present invention;

[0055] Figure 6 It is a structural schematic diagram of the intention classification device provided by the present invention. DETAILED DESCRIPTION

[0056] In order to enable those skilled in the art to better understand the inventive concept, working principle and advantages of the embodiments of this specification, the schemes in the embodiments of this specification are described in detail below.

[0057] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are 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.

[0058] The single- and multi-intent classification method based on natural language reasoning provided by the present invention is mainly used in scenarios where intent recognition of user voice is required, such as intelligent customer service, voice assistants, etc.

[0059] Natural Language Inference (NLI)

[0060] Explanation: It is mainly used to judge the semantic relationship between two sentences, which can generally be divided into: Entailment, Contradiction, and Neutral.

[0061] Natural Language Understanding (NLU)

[0062] Explanation: Natural language understanding is a general term for all methods, models or tasks that support machines to understand text content, that is, it can perform common tasks such as text classification, sequence labeling, information extraction, and intent classification.

[0063] Regular Expression (RE)

[0064] Explanation: Regular expressions are a language used to describe search patterns for character sequences. They are widely used in string search, replacement, and complex text operations. In the field of intent classification, regular expressions are used to match specific statement templates to identify the intent of a statement.

[0065] Automatic Speech Recognition (ASR)

[0066] Explanation: Automatic speech recognition technology refers to the use of algorithms by computers to convert human voice into readable text through audio data. In this field, ASR is usually used to transcribe user audio information.

[0067] Intent

[0068] Explanation: Refers to the purpose or goal that the user wants to express through their input. In this solution, an intent contains an intent name and several example sentences.

[0069] Intent Classification

[0070] Interpretation: It is a task in natural language processing (NLP) that is mainly used to identify and classify the intent of user input.

[0071] Intent Group

[0072] Explanation: A sentence group can contain multiple sentences (these sentences can belong to one or more intentions)

[0073] The embodiment of the present invention relates to the field of natural language understanding (NLU) tasks, and proposes a method for intent classification based on natural language inference (NLI). Compared with the prior art, the present invention can effectively improve the accuracy of intent classification, realize the ability to classify multiple intents in a single sentence, and support the addition of new intents in real time. By enhancing the generalization ability and accumulating recognition results in real time, the NLI model will be continuously evolved to form a closed loop of generalization and evolution, promote the continuous optimization of the recognition effect, and achieve a spiral increase in the effect.

[0074] 1. Basic method flow

[0075] like Figure 1 As shown, the single-multiple intent classification method based on natural language reasoning provided by the present invention comprises the following steps:

[0076] S101: receiving voice data and converting the voice data into text data through an automatic speech recognition ASR system. In this case, when a user speaks, the system receives the user's voice data and performs speech recognition through the ASR system to obtain corresponding text data.

[0077] S102: Input the text data as a first input and a preset example sentence group as a second input to a natural language inference (NLI) model, wherein the example sentence group includes multiple intents, each intent corresponds to at least one example sentence, and each example sentence is used to characterize the semantic features of the corresponding intent.

[0078] Each intent only needs one example sentence. However, due to the imperfection of the NLI model, several examples are usually required. For example, for the intent "I am a student", if the user says "I am still in school" or "I am still in high school", NLI will usually give a high score, but if the user says "I am a high school student", it may not give a high score. In this case, only

[0079] "I am a high school student" is added to the example sentence, and related similar sentences ("I am a high school student", "I am a junior high school student", etc.) will all get high scores.

[0080] In addition, there is no hierarchical relationship between intents in the system. For example, "busy" and "driving" have a hierarchical relationship in semantics (that is, "busy" includes "driving"), but in this solution, there is no hierarchical relationship. That is, when the user says "I am driving", both of the above intents will get high scores and multiple intents will be output. The specific intent to be used will be determined by the user (for example, the priority of multiple intents will be determined according to business needs, etc.).

[0081] S103: Calculate the semantic similarity between the text data and each example sentence in the example sentence group through the NLI model to obtain a corresponding score, and for each intent, select the highest score in its corresponding example sentence as the score of the intent.

[0082] S104: sorting the intentions with scores greater than a preset score threshold from high to low according to the scores, and outputting the sorted intentions as a list of the text data.

[0083] For example, when an AI customer service is connected to this system, the user says "I want to go to Hangzhou" and is recognized by ASR into text.

[0084] Through the NLI model scoring, three intents are obtained: "I want to book a hotel", "I want to buy a plane ticket", and "I want to buy a train ticket".

[0085] For example, during the National Day holiday, there are promotional offers for going to Hangzhou and you need to add a temporary intent of "I want a hotel discount coupon". You only need to add an example sentence of this intent to the example sentence group. There is no need to retrain or fine-tune the model with a large amount of data, and it will take effect immediately.

[0086] 2: Specific implementation of ASR speech recognition module

[0087] like Figure 2 As shown, the step of receiving voice data and converting the voice data into text data through the ASR system specifically includes:

[0088] S201: receiving a voice signal of the voice data;

[0089] In this step, the system obtains the user's voice data through a voice acquisition device (such as a microphone) and converts it into a digitized voice signal. The voice signal contains acoustic characteristic information such as the amplitude, frequency, and phase of the sound.

[0090] S202: Identify and analyze the acoustic features and language features of the speech signal;

[0091] First, the speech signal is preprocessed, including:

[0092] Signal noise reduction processing to remove interference information such as environmental noise;

[0093] Voice endpoint detection, determining the start and end positions of valid voice segments;

[0094] Frame length division divides the continuous speech signal into frames of fixed length.

[0095] Then, extracting the acoustic features of the speech signal includes:

[0096] Extract the Mel-frequency cepstral coefficient (MFCC) features of each frame;

[0097] Extract rhythmic features such as pitch period and energy;

[0098] Extract vocal tract features, etc.

[0099] Finally, language features are extracted based on deep neural networks, including:

[0100] Acoustic modeling at the phoneme level;

[0101] Word-level language modeling;

[0102] Sentence-level semantic modeling.

[0103] S203: Convert the speech signal into corresponding text data according to the acoustic features and language features.

[0104] First, based on the acoustic features, an acoustic model is used to convert the speech frame sequence into a phoneme sequence, including:

[0105] Use a deep neural network to calculate the phoneme probability distribution corresponding to each frame;

[0106] The Viterbi decoding algorithm is used to obtain the optimal phoneme sequence.

[0107] Then, based on the language features, a language model is used to convert the phoneme sequence into a word sequence, including:

[0108] Mapping the phoneme sequence to a candidate word sequence using a pronunciation dictionary;

[0109] Use the N-gram language model to calculate the language probability of word sequences;

[0110] Combine acoustic probability and language probability to select the optimal word sequence.

[0111] Finally, the word sequence is post-processed to obtain normalized text data, including:

[0112] Automatic addition of punctuation marks;

[0113] identification and correction of proper nouns;

[0114] Normalization of special characters such as numbers and units.

[0115] The ASR system supports multi-language and dialect recognition, which is specifically achieved in the following ways:

[0116] 1. Multi-language recognition capability:

[0117] Establish independent acoustic models and language models for different languages;

[0118] Automatically detect languages ​​using language recognition module;

[0119] According to the detection results, the model of the corresponding language is selected for recognition.

[0120] 2. Dialect recognition ability:

[0121] Collect speech data from various dialects for model training;

[0122] Establish dialect-Mandarin mapping rules;

[0123] Perform feature adaptation and model transfer for dialect speech.

[0124] 3. Enhanced robustness:

[0125] Use data enhancement to improve the model's ability to resist noise;

[0126] Use transfer learning to improve recognition of minority languages;

[0127] Improve recognition accuracy through model integration.

[0128] Through the above technical implementation, the ASR system of the present invention can accurately recognize speech signals in multiple languages ​​and dialects and convert them into corresponding text data with high quality, which provides reliable input for subsequent intention recognition.

[0129] 3: Specific implementation of NLI model

[0130] like Figure 3 As shown, the step of calculating the semantic similarity between the text data and each example sentence in the example sentence group by the NLI model to obtain the corresponding score includes:

[0131] S301: Use the DeBERTa model to build the NLI model. Specifically including:

[0132] 1.DeBERTa model architecture:

[0133] Use the decoupled attention mechanism to encode the content vector and the relative position vector separately;

[0134] It uses a bidirectional Transformer encoder, which contains 12 layers of transformer blocks.

[0135] Each transformer block contains a multi-head self-attention layer and a feed-forward neural network layer;

[0136] The word embedding dimension is set to 768 and the number of attention heads is set to 12.

[0137] 2. Model pre-training:

[0138] Pre-training of masked language modeling on large-scale text corpora;

[0139] Use relative position coding instead of traditional absolute position coding;

[0140] Introducing an enhanced mask decoder to improve the model representation capability;

[0141] A gradient accumulation strategy is adopted and large batches are used for training.

[0142] 3. Downstream task adaptation:

[0143] Fine-tuning on the NLI task dataset;

[0144] Add a classification head to calculate the semantic similarity score;

[0145] Use cross entropy loss function for optimization;

[0146] The training strategy of learning rate warmup and linear decay is adopted.

[0147] S302: Input the text data and example sentences into the DeBERTa model for feature extraction.

[0148] Specifically include:

[0149] 1. Input text preprocessing:

[0150] Use WordPiece word segmenter to segment the text into subwords;

[0151] Add special tags [CLS] and [SEP] to mark sentence boundaries;

[0152] Convert the token sequence into the id sequence corresponding to the model vocabulary;

[0153] Generate an attention mask to identify valid token positions.

[0154] 2. Text representation calculation:

[0155] Get the content embedding vector of the token;

[0156] Calculate the relative position encoding between tokens;

[0157] Fusion of content and location information via decoupled attention mechanism;

[0158] The context representation is obtained through multiple layers of transformer encoding.

[0159] 3. Feature vector extraction:

[0160] Extract the output of the [CLS] position as the sentence-level representation;

[0161] Pool all token outputs to get sentence representation;

[0162] Concatenate multiple layers of transformer output to enhance representation capabilities;

[0163] Use a feature projection layer to adjust feature dimensions.

[0164] S303: Calculate the semantic similarity between the text data and each example sentence based on the attention mechanism of the DeBERTa model to obtain a corresponding score. Specifically including:

[0165] 1. Attention calculation mechanism:

[0166] Calculate the query vector Q, key vector K and value vector V;

[0167] Dot product of Q and K to get the attention weight matrix;

[0168] Perform softmax normalization on the attention weights;

[0169] The weighted aggregate value vector V is used to obtain the attention output.

[0170] 2. Semantic similarity calculation:

[0171] Interact the representation vectors of text and example sentences;

[0172] Calculate the cosine similarity between vectors;

[0173] Modeling complex semantic relationships using bilinear transformations;

[0174] The final similarity score is output through a multi-layer perceptron.

[0175] 3. Rating normalization:

[0176] Use the sigmoid function to map the similarity to the [0,1] interval;

[0177] Apply the temperature parameter to adjust the score distribution;

[0178] Set the minimum score threshold to filter out noisy samples;

[0179] Perform max pooling on the scores of multiple example sentences.

[0180] Through the above-mentioned fine-grained technical implementation, the NLI model of the present invention can accurately calculate the semantic similarity between the text and the example sentence, providing a reliable scoring basis for subsequent intent recognition. The model has the following advantages:

[0181] 1. The decoupled attention mechanism improves position perception;

[0182] 2. Bidirectional Transformer provides powerful semantic modeling capabilities;

[0183] 3. Relative position encoding overcomes the limitations of long sequence modeling;

[0184] 4. Multi-layer feature fusion enhances the robustness of representation.

[0185] The ASR-transcribed text and example sentences are passed to the NLI model, which calculates and outputs the scores of all intents.

[0186] For example, there are three intentions: "I am a student", "I am driving", and "Wait a moment".

[0187] There are two example sentences under the intention of "is a student": "I'm still in school" and "I'm studying in the evening".

[0188] There are two example sentences under the intention of "driving": "I reversed the car" and "I'll check again at the service area".

[0189] There are three example sentences with the "wait a moment" intention: "Wait a moment", "Wait a moment", "I'll take off my headphones".

[0190] The seven examples of the above intent and the ASR-transcribed text "I am still in high school" are input into the NLI model to obtain scores, and the output is 0.9921, 0.3332, 0.2482, 0.2881, 0.2531, 0.1531, 0.3531. The highest-scoring examples of the intent are 0.9921, 0.3332, and 0.3531, respectively. That is, the intent should be "is a student".

[0191] 4: Implementation of Adaptive Optimization

[0192] like Figure 4 As shown, the present invention also provides an adaptively optimized continuous time analysis method, which specifically includes:

[0193] S401: Acquire historical corpus data and historical scoring data;

[0194] S402: Establishing a scoring time series model, and training the scoring time series model based on the historical corpus data and the historical scoring data;

[0195] S403: Adopting the scoring time series model to perform adaptive optimization and normalization processing on the current score;

[0196] In the step of obtaining historical corpus data and historical scoring data, first extract the historical user input voice text data and its corresponding intent recognition results from the system log, and verify the recognition results through manual annotation to ensure the accuracy of the data. At the same time, record the timestamp information of each data for subsequent time series analysis. In addition, it is necessary to collect the original scoring data output by the NLI model in each intent recognition process. These scoring data reflect the scoring tendency of the model in different periods.

[0197] In the stage of establishing the rating time series model, the present invention adopts a Transformer-based time series prediction architecture. The model first performs time series encoding on the input historical rating sequence and introduces position encoding to capture the temporal dependency of the ratings. Then, a multi-head self-attention mechanism is used to model the correlation between ratings at different time points, and each attention head is responsible for capturing temporal patterns of different scales. Next, the time series features are nonlinearly transformed through a feedforward neural network to enhance the expressive power of the model. Finally, an adaptive gating mechanism is used in the output layer of the model to dynamically adjust the prediction weights according to the rating distribution characteristics of different time windows.

[0198] In the adaptive optimization and normalization processing stage, the present invention designs a two-stage scoring optimization mechanism. In the first stage, based on the statistical characteristics of historical scores, the mean and variance of the scores are dynamically calculated, and the original scores are normalized using a piecewise linear function to make their distribution more uniform. The segmentation points here are dynamically determined based on the quantiles of historical scores, rather than using a fixed threshold. In the second stage, a dynamic learning rate mechanism is introduced to adaptively adjust the optimization step size. Specifically, when a significant change in the score distribution is detected, the system will automatically increase the learning rate to speed up model adaptation; when the score distribution is relatively stable, the learning rate is reduced to ensure the stability of the optimization. This adaptive mechanism enables the model to better balance the convergence speed and stability of the algorithm.

[0199] In addition, in order to further improve the optimization effect, the present invention also incorporates the semantic information of historical corpus into the scoring optimization process. The system analyzes the semantic similarity between the current input text and the historical corpus, and weights the historical scoring data according to the similarity weight, so that the optimization process can better utilize the scoring experience of similar historical scenarios. This semantically aware optimization strategy significantly improves the accuracy of the system's scoring in similar contexts.

[0200] In practical applications, this adaptive optimization and normalization method shows good generalization performance. Experiments show that compared with the traditional method of fixed thresholds, this method can maintain stable performance when processing scoring data in different scenarios and different periods, improve the scoring accuracy by about 15%, and significantly enhance the ability to correct scoring deviations. In particular, this method shows stronger adaptability when dealing with scenarios where new intents are added or intent definitions have changed.

[0201] The adaptive optimization adopts a dynamic learning rate, and the normalization process adopts a piecewise linear normalization method.

[0202] 5. Topology-aware methods based on graph data

[0203] like Figure 5 As shown, the present invention also provides a topology perception method based on graph data, comprising:

[0204] S501: construct an intent relationship graph, and represent the semantic association relationships between different intents as edges in the graph;

[0205] S502: Based on the intention relationship graph, perform graph neural network encoding on each intention to obtain a reinforced feature representation;

[0206] S503: The score is adjusted and optimized in combination with the reinforcement feature representation.

[0207] Specifically, the graph neural network encoding of each intent based on the intent relationship graph includes:

[0208] S504: Using a graph attention network to extract local structural features of the intent node;

[0209] S505: Using a graph convolutional network to extract global topological features of the intent node;

[0210] S506: The local structural features and the global topological features are integrated to obtain a reinforced feature representation of the intention node.

[0211] The topology perception method based on graph data is an important innovation of this invention. This method builds a relationship graph between intents and uses graph neural networks to capture the semantic association information between intents, thereby improving the accuracy of intent recognition. Figure 5 As shown in the figure, this method mainly includes three core steps: construction of intent relationship graph, graph neural network encoding and scoring optimization.

[0212] In the process of constructing the intent relationship graph, it is first necessary to determine the representation method of the nodes and edges of the graph. Each intent is a node in the graph, and the initial features of the node are composed of the average value of the semantic vectors of all examples corresponding to the intent. For the construction of edges, the present invention adopts a multi-granularity semantic similarity calculation method: first, the semantic vector of the example sentence is extracted using a pre-trained language model, and then the cosine similarity between the examples of different intents is calculated. If the similarity of the examples between two intents exceeds a preset threshold, an edge is established between the two intent nodes, and the weight of the edge is determined by the similarity value. In addition, the present invention also introduces an edge enhancement mechanism based on a knowledge graph to supplement the semantic associations between intents through an external knowledge base.

[0213] In the graph neural network encoding stage, the present invention designs a two-stage feature extraction framework. First, the intent relationship graph is preprocessed, including the normalization of edge weights and the standardization of node features. Then, a multi-layer graph neural network is used for node representation learning, and each layer of the network includes two sub-steps: feature propagation and feature update. During the feature propagation process, each node collects information from its neighboring nodes and performs weighted aggregation according to the weight of the edge. The feature update process uses a multi-layer perceptron to perform nonlinear transformation on the aggregated features to obtain a new representation of the node. Through multi-layer stacking, a node representation containing rich topological information is finally obtained.

[0214] In the score adjustment and optimization phase, the system fuses the node representation encoded by the graph neural network with the original intent score. Specifically, the node representation is first mapped to the same distribution space as the score through a fully connected layer, and then an adaptive gating mechanism is designed to dynamically adjust the weights of the original score and graph enhancement features according to the characteristics of the current input text. This adaptive fusion strategy can effectively utilize the intent association information contained in the graph structure while retaining the original score information.

[0215] In the specific implementation of the graph neural network, the present invention adopts a dual-stream architecture to capture local and global structural information respectively. In the local feature extraction branch, the graph attention network (GAT) is used to process the first-order neighborhood of each node. GAT dynamically determines the importance of different neighbor nodes by calculating the attention score. This attention-based aggregation method can effectively capture the fine-grained semantic associations between intentions. In the specific implementation, a multi-head attention mechanism is used, and each attention head is responsible for capturing local structural features in different aspects. In the global feature extraction branch, a graph convolutional network (GCN) is used to obtain the structural role of the node in the entire graph. GCN defines the convolution operation through the spectral decomposition of the Laplacian matrix, which can efficiently aggregate multi-hop neighborhood information. In order to enhance the expressive power of the model, the present invention introduces residual connections and batch normalization layers in GCN.

[0216] Finally, the local features and global features are integrated through the feature fusion module. This module first aligns the dimensions of the two types of features, then dynamically adjusts their weights using a gating mechanism, and finally obtains the final reinforced feature representation through nonlinear transformation. Experiments show that this two-stream architecture can comprehensively capture various semantic association patterns between intents, significantly improving the accuracy of intent recognition, especially showing obvious advantages when dealing with semantically similar intents.

[0217] VI: Method for determining the scoring threshold

[0218] The determination of the preset scoring threshold includes:

[0219] S601: Perform parameter fine-tuning training on the NLI model;

[0220] S602: Perform forward and reverse validation on the validation data set;

[0221] S603: Calculate the forward accuracy and reverse accuracy under different scoring thresholds;

[0222] S604: Selecting the score with the smallest difference between the forward accuracy rate and the reverse accuracy rate as the preset score threshold.

[0223] The scoring threshold determination method provided in the embodiment of the present invention determines the optimal scoring threshold through a carefully designed verification mechanism. In selecting the scoring threshold, it is necessary to ensure the accuracy of recognition and balance the recall rate of the model, so an adaptive threshold determination method based on forward and reverse verification is adopted.

[0224] Specifically, a three-stage training strategy is adopted when fine-tuning the parameters of the NLI model. In the first stage, general corpus is used for pre-training to enhance the basic semantic understanding ability of the model; in the second stage, fine-tuning is performed on domain-related annotated data to adapt the model to specific task scenarios; in the third stage, fine-tuning is performed on a small amount of high-quality verification data to improve the performance of the model in key scenarios. In each stage, a progressive learning rate strategy is adopted, with a large learning rate used initially to quickly adjust the model parameters, and then the learning rate is gradually reduced to achieve fine optimization.

[0225] A complete verification framework was designed for forward and reverse verification on the verification dataset. Forward verification focuses on the model's ability to identify the correct intent, that is, given a piece of text, verify whether the model can correctly identify all the intents it contains. Reverse verification focuses on the model's ability to filter out incorrect intents, that is, verify whether the model will mistakenly judge the text as irrelevant intent. The construction of the verification dataset adopts a stratified sampling method to ensure that various intent scenarios are covered.

[0226] When calculating the forward accuracy and reverse accuracy under different scoring thresholds, the present invention adopts a grid search strategy to uniformly sample multiple candidate threshold points in the interval [0,1]. For each threshold point, its performance indicators on the forward validation set and the reverse validation set are calculated respectively. The forward accuracy reflects the ability of the model to accurately identify the correct intent, while the reverse accuracy reflects the ability of the model to correctly filter out the wrong intent. Through this two-way measurement mechanism, the actual effects of different thresholds can be comprehensively evaluated.

[0227] Finally, by comparing the forward and reverse accuracy rates at different threshold points, the score with the smallest difference is selected as the final preset score threshold. This selection strategy can balance false positive and false negative errors to the greatest extent while ensuring the accuracy of model recognition, making the system more robust in practical applications.

[0228] 7: Model optimization method

[0229] The present invention also provides a model optimization method, comprising:

[0230] S701: Obtain historical corpus data;

[0231] S702: Cleaning and labeling the historical corpus data;

[0232] S703: Input the cleaned and annotated historical corpus data into the NLI model for incremental learning optimization.

[0233] In terms of model optimization, the embodiment of the present invention provides a complete model optimization solution to continuously improve model performance by rationally utilizing historical corpus data. First, the system regularly collects user interaction data from the production environment, including the text entered by the user, the intent recognized by the system, and the user's feedback information. After preliminary screening, these raw data form a potential optimization corpus.

[0234] For the collected historical corpus data, the present invention has designed a multi-level data cleaning process. The first level is basic cleaning, which removes obvious noise data, such as null values, outliers, etc.; the second level is semantic cleaning, which uses heuristic rules and machine learning methods to identify and filter out semantically unreasonable samples; the third level is consistency cleaning, which ensures that the annotation results in similar scenarios remain consistent. The cleaned data also needs to be sampled and reviewed by professionals to ensure data quality.

[0235] In the data annotation process, the present invention adopts a semi-automatic annotation process. First, the corpus is pre-annotated using the existing model, and then the annotators review and revise it. In order to improve the annotation efficiency, the system automatically clusters similar cases and provides annotation suggestions. A quality control mechanism is also introduced in the annotation process, including annotation consistency checks, difficult case discussions, etc., to ensure the accuracy and consistency of the annotation results.

[0236] When using the cleaned and annotated historical corpus to perform incremental learning optimization on the NLI model, a progressive training strategy is adopted. First, the difference between the new corpus and the existing model is evaluated, and the learning rate and training strategy are dynamically adjusted according to the difference. For samples with large performance differences from the existing model, a focused learning mechanism is adopted to increase their sampling weight during the training process. At the same time, in order to prevent the model from forgetting the knowledge it has mastered during the incremental learning process, technologies such as knowledge distillation and experience replay are introduced to maintain the balanced performance of the model on new and old data.

[0237] This continuous optimization mechanism enables the model to continuously learn and improve from actual application scenarios and adapt to dynamic changes in the business. Experimental results show that the model has significantly improved in accuracy, generalization ability, and robustness after multiple rounds of optimization, especially showing stronger adaptability when dealing with new expressions of intent.

[0238] 8. Update management of example sentence groups

[0239] In the present invention, each intent in the example sentence group includes at least one example sentence, examples of different intents are independent of each other, and the example sentences can be increased, decreased, and updated in real time. Such a design makes the system have good scalability and flexibility.

[0240] like Figure 6 As shown, the present invention also provides a single-intention and multi-intention classification device based on natural language reasoning, comprising:

[0241] An ASR module, configured to receive voice data and convert the voice data into text data;

[0242] An NLI module, configured to receive the text data and a preset example sentence group, and obtain a corresponding score between the text data and each example sentence in the example sentence group by calculating semantic similarity, wherein the example sentence group includes a plurality of intents, and each intent corresponds to at least one example sentence for representing a semantic feature of the intent;

[0243] A scoring processing module, used for selecting the highest score in the corresponding example sentence for each intent as the score of the intent;

[0244] The intent output module is used to sort the intents with scores greater than a preset score threshold from high to low according to the scores and output them as an intent list of the text data.

[0245] Optionally, the above modules are connected via a data bus.

[0246] This specification embodiment also provides an electronic device suitable for implementing the above method, wherein the electronic device includes a central processing unit (CPU), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage portion to a random access memory (RAM), such as executing the method described in the above embodiment. In RAM, various programs and data required for system operation are also stored. CPU, ROM and RAM are connected to each other via a bus. Input / output (I / O) interface is also connected to the bus.

[0247] The following components are connected to the I / O interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication part performs communication processing via a network such as the Internet. The drive 310 is also connected to the I / O interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.

[0248] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), various functions defined in the system of the present application are executed.

[0249] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0250] In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus, or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0251] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0252] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.

[0253] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.

[0254] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.

[0255] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0256] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0257] Although the embodiments of this specification are disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, so the protection scope of the present invention shall be subject to the scope defined by the claims.

Claims

1. A single- and multiple-intent classification method based on natural language reasoning, characterized in that: include: Receiving voice data and converting the voice data into text data through an automatic speech recognition (ASR) system; Input the text data as a first input and a preset example sentence group as a second input to a natural language inference (NLI) model, wherein the example sentence group includes multiple intents, each intent corresponds to at least one example sentence, and each example sentence is used to characterize the semantic features of the corresponding intent; Calculating the semantic similarity between the text data and each example sentence in the example sentence group through the NLI model to obtain a corresponding score, and selecting the highest score in the corresponding example sentence for each intent as the score of the intent; The intentions with scores greater than a preset score threshold are sorted from high to low according to the scores, and the intent list of the text data is output.

2. The method according to claim 1, characterized in that The receiving of voice data and converting the voice data into text data by the ASR system comprises: Receiving a voice signal of the voice data; Identify and analyze the acoustic features and language features of the speech signal; Converting the speech signal into corresponding text data according to the acoustic features and language features; Wherein, the ASR system supports multi-language and dialect recognition.

3. The method according to claim 1, characterized in that The calculating the semantic similarity between the text data and each example sentence in the example sentence group by the NLI model to obtain a corresponding score includes: Use the DeBERTa model to build the NLI model; Input the text data and example sentences into the DeBERTa model for feature extraction; Based on the attention mechanism of the DeBERTa model, the semantic similarity between the text data and each example sentence is calculated to obtain the corresponding score.

4. The method according to claim 1, characterized in that: The method further comprises: When obtaining the corresponding score of each intent through the NLI model, an adaptively optimized continuous time analysis method is adopted, including: Obtain historical corpus data and historical scoring data; Establishing a scoring time series model, and training the scoring time series model based on the historical corpus data and the historical scoring data; Adopting the scoring time series model to adaptively optimize and normalize the current scoring; The adaptive optimization adopts a dynamic learning rate, and the normalization process adopts a piecewise linear normalization method.

5. The method according to claim 1, characterized in that The method further comprises: When obtaining the corresponding score of each intent through the NLI model, a topology-aware method based on graph data is adopted, including: Construct an intent relationship graph and represent the semantic associations between different intents as edges in the graph; Based on the intention relationship graph, each intention is encoded by a graph neural network to obtain a reinforced feature representation; The score is adjusted and optimized in combination with the reinforcement feature representation.

6. The method according to claim 5, characterized in that Based on the intention relationship graph, each intention is encoded by a graph neural network to obtain a reinforced feature representation, including: A graph attention network is used to extract local structural features of intent nodes; A graph convolutional network is used to extract the global topological features of the intent nodes; The local structural features and global topological features are integrated to obtain a reinforced feature representation of the intent node.

7. The method according to claim 1, characterized in that The determination of the preset scoring threshold includes: Performing parameter fine-tuning training on the NLI model; Perform forward and backward validation on the validation dataset; Calculate the forward accuracy and reverse accuracy under different scoring thresholds; The score with the smallest difference between the forward accuracy rate and the reverse accuracy rate is selected as the preset score threshold.

8. The method according to claim 1, characterized in that The method further comprises: Obtain historical corpus data; Cleaning and labeling the historical corpus data; The cleaned and annotated historical corpus data is input into the NLI model for incremental learning optimization.

9. The method according to claim 1, characterized in that: Each intention in the example sentence group includes at least one example sentence, the example sentences between different intentions are independent of each other, and the example sentences can be increased, decreased or updated in real time.

10. A single-intention and multi-intention classification device based on natural language reasoning, comprising: An ASR module, configured to receive voice data and convert the voice data into text data; An NLI module, configured to receive the text data and a preset example sentence group, and obtain a corresponding score between the text data and each example sentence in the example sentence group by calculating semantic similarity, wherein the example sentence group includes a plurality of intents, and each intent corresponds to at least one example sentence for representing a semantic feature of the intent; A scoring processing module, used for selecting the highest score in the corresponding example sentence for each intent as the score of the intent; The intent output module is used to sort the intents with scores greater than a preset score threshold from high to low according to the scores and output them as an intent list of the text data.

Citation Information

Cited By

  • Multi-dialect speech recognition method based on Transform self-attention mechanism

    CN121506099A