Intention recognition method, device, equipment, storage medium and program product
Patent Information
- Application Number
- CN202611007221.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-07
- Publication Date
- 2026-10-30
AI Technical Summary
然而,当面对较大规模的意图池时,这一过程不仅会导致候选意图的收敛效率低下,还会使计算消耗与成本随着已存储意图数量的增加而持续增长,对意图识别的整体性能造成影响
[0026]本申请实施例的意图识别方法、装置、设备、存储介质及程序产品,通过从多个意图向量集合中查询与所述查询向量匹配的候选意图向量集合;从所述候选意图向量集合中查询与所述查询向量匹配的候选意图向量,可以实现意图向量集合、候选意图向量集合、候选意图向量分层筛选,无需遍历全部意图,快速聚焦高相关候选意图,减少无效匹配计算,从而提升了识别效率;仅提取多轮对话中的历史关键意图信息,而非全量对话,再通过对齐筛选出区分候选意图信息的候选意图要点,避免冗余信息占用计算资源,降低处理成本。
Smart Images

Figure CN123012099A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data processing technology, and in particular relates to an intent recognition method, apparatus, device, storage medium and program product. Background Technology
[0002] With the development of dialogue interaction technology, the requirements for intent recognition are becoming increasingly higher.
[0003] In the implementation of intent recognition, processing efficiency and cost control are crucial. The intent recognition process requires locating and identifying intents that match user needs from a massive pool of intent descriptions. However, when faced with a large pool of intents, this process not only leads to low convergence efficiency of candidate intents, but also causes computational consumption and costs to continuously increase with the number of stored intents, impacting the overall performance of intent recognition.
[0004] Therefore, a method is needed to improve the efficiency of intent recognition and optimize computational costs. Summary of the Invention
[0005] This application provides an intent recognition method, apparatus, device, storage medium, and program product, which can improve intent recognition efficiency and optimize computational costs.
[0006] In a first aspect, embodiments of this application provide an intent recognition method, the method comprising: Obtain the query vector corresponding to the user's query information; From multiple sets of intent vectors, query a set of candidate intent vectors that match the query vector; Query the set of candidate intent vectors to find the candidate intent vector that matches the query vector; Extract key historical intent information from multiple rounds of historical user dialogues; Align the historical key intent information with the candidate intent information corresponding to the candidate intent vector to obtain candidate intent points used to distinguish different candidate intent information; Based on the user query information, the historical key intent information, and the candidate intent points, the target intent is determined from the candidate intent information.
[0007] In one feasible implementation, the candidate intent vector set is at least one of an intent vector set, which is obtained by: Feature mapping is performed on multiple pre-stored intents to obtain intent vectors corresponding to the multiple intents; Calculate the intent similarity between every two intent vectors; Based on the intent similarity, the intent vector is divided into multiple intent vector sets.
[0008] In one feasible implementation, querying the candidate intent vector from the set of candidate intent vectors that matches the query vector includes: Based on preset normalization parameters, each center similarity is normalized to obtain the retrieval weight corresponding to each set of intent vectors. The center similarity is the vector similarity between the query vector and the center vector corresponding to each set of candidate intent vectors. Based on the retrieval weight, an intermediate intent vector is selected from the set of candidate intent vectors; Calculate the candidate similarity between the query vector and the intermediate intent vector; The candidate intent vector is determined from the intermediate intent vector based on the candidate similarity.
[0009] In one feasible implementation, the center vector corresponding to the intent vector set is obtained in the following way: Based on the hit frequency, most recent update time, and preset weight parameters of each intent vector in the intent vector set within a preset time window, calculate the first intent weight corresponding to each intent vector; The first intent weight is normalized to obtain the second intent weight; The intent vectors are weighted according to the second intent weight to obtain the center vector corresponding to the intent vector set.
[0010] In one feasible implementation, in response to updating the intent vector, the method further includes: Obtain the updated intent vector set corresponding to the intent vector set, wherein the updated intent vector set includes one or more updated intent vectors that have been updated; The center vector corresponding to the set of intent vectors is updated based on the set of updated intent vectors and the preset update coefficients.
[0011] In one feasible implementation, updating the center vector corresponding to the set of updated intent vectors according to the set of updated intent vectors and preset update coefficients includes: The update magnitude corresponding to the set of update intent vectors is determined based on the number of update intent vectors in the set of update intent vectors. Calculate the current center vector corresponding to each intent vector set based on the current intent vector in the intent vector set; If the update magnitude is less than or equal to a preset update magnitude threshold, a moving average is calculated on the current center vector and the historical center vector of the intent vector set before the update, according to a preset first update weight, to obtain the updated center vector of the intent vector set. If the update magnitude is greater than a preset update magnitude threshold, the current center vector and the historical center vector of the intent vector set before the update are weighted and averaged according to the preset second update weight, the intent vector set before the update, and the number of updated intent vectors in the updated intent vector set to obtain the updated center vector of the intent vector set.
[0012] In one feasible implementation, when the update magnitude is greater than a preset update magnitude threshold, the updated center vector of the intent vector set is calculated using the following formula:
[0013] in, This represents the updated center vector of the intent vector set. This represents the historical center vector of the intent vector set before the update. This indicates the second updated weight. This represents the set of update intent vectors. This indicates the number of update intention vectors within the set of update intention vectors. The set of update intent vectors represents the first... An update intent vector, It is a positive integer. The number of update intention vectors within the set of update intention vectors that is greater than or equal to 1 and less than or equal to the number of update intention vectors. This represents the sum of all update intent vectors within the set of update intent vectors. This indicates the number of intent vectors in the intent vector set before the update.
[0014] In one feasible implementation, the method further includes: Calculate the intra-cluster similarity between different intent vectors in each intent vector set, and calculate the average intra-cluster similarity for each intent vector set based on the intra-cluster similarity. Calculate the cross-cluster similarity between the first intent vector and the second intent vector, which belong to any two different sets of intent vectors; Based on the cross-cluster similarity, determine the maximum cross-cluster similarity corresponding to each intent vector; If the average intra-cluster similarity is less than a preset intra-cluster threshold, and / or the maximum cross-cluster similarity is greater than a preset inter-cluster threshold, the intent vector set is re-divided into at least one intent vector set based on the average intra-cluster similarity and the maximum cross-cluster similarity, such that the average intra-cluster similarity is greater than or equal to the intra-cluster threshold, and the maximum cross-cluster similarity is less than or equal to the inter-cluster threshold.
[0015] In one feasible implementation, historical key intent information is extracted from multi-turn historical user dialogues, including: Extract key information related to user intent from the multi-round historical user dialogues. The key information includes at least one of user needs, user confirmation information, user denial information, preference information, and constraints. Based on the dialogue time corresponding to the key information, a time decay weight is assigned to the key information. Based on the time decay weight and whether the key information is stated directly by the user, conflicting information in the key information is merged to obtain the historical key intent information.
[0016] In one feasible implementation, determining the target intent from the candidate intent information based on the user query information, the historical key intent information, and the candidate intent points includes: Based on the user query information, the historical key intent information, and the candidate intent points, contextual prompt information is generated; The contextual cue information is input into the intent recognition model so that the intent recognition model performs intent matching based on the contextual cue information and outputs at least one set of candidate intent information. The candidate intent information includes the candidate intent, the intent confidence level corresponding to the candidate intent, and the generation basis information of the candidate intent. The generation basis information of the candidate intent is at least one of the historical key intent information and the user query information. The confidence level of the intent is compared with a preset confidence threshold; If the confidence level of the intent is greater than the preset confidence threshold, the candidate intent corresponding to the confidence level of the intent is determined as the target intent.
[0017] In one feasible implementation, when the intent confidence level is less than or equal to the preset confidence threshold, or when a user error message is received, the method further includes: Record the query vector, the set of true candidate intent vectors corresponding to the query vector, and the set of erroneous candidate intent vectors corresponding to the target intent to obtain the center vector update sample; Calculate the first similarity between the query vector and the true center vector corresponding to the set of true candidate intent vectors; Calculate the second similarity between the query vector and at least one error center vector, wherein the error center vector is the center vector corresponding to the set of error candidate intent vectors corresponding to the target intent; Determine the similarity difference between the first similarity and the second similarity; Based on the largest similarity difference, determine the confusion margin corresponding to the center vector update sample; The confusion margin is normalized to obtain the sample weights corresponding to the center vector update samples; Based on the sample weights, the query vectors in each of the center vector update samples are weighted and averaged to obtain the update vector corresponding to the true center vector. The real center vector and the updated vector are weighted and fused according to the preset center vector update weight to obtain the updated real center vector.
[0018] In one feasible implementation, the confusion margin is calculated using the following formula:
[0019] in, Update the samples for the center vector. This represents the set of erroneous candidate intent vectors. Represents the set of true candidate intent vectors. This represents the query vector. Represents the maximum value function. Used to calculate the similarity between two vectors. Represents the error center vector. Represents the true center vector; The sample weights are calculated using the following formula:
[0020] in, This indicates that the center vector updates the sample weights corresponding to the samples. This represents the preset minimum sample weight. This represents the preset maximum value of the sample weights. This represents the mean of the sample weights within a preset time range. This represents the variance of the sample weights within a preset time range. This represents a numerical constraint magnitude function, used to limit the value between the minimum and maximum values of the sample weights. This represents the preset normalized weights. Represents a nonlinear mapping function; The updated true center vector is calculated using the following formula:
[0021] in, This represents the updated true center vector. This indicates that the preset center vector is updated with weights. Greater than zero and less than or equal to 1, Represents the true center vector. This indicates that the center vector updates the query vector in the sample. This represents the sum of the sample weights of all the center vector update samples.
[0022] Secondly, embodiments of this application provide an intent recognition device, the device comprising: The acquisition module is used to obtain the query vector corresponding to the user's query information; The first query module is used to query a set of candidate intent vectors that match the query vector from multiple intent vector sets; The second query module is used to query candidate intent vectors that match the query vector from the candidate intent vector set; The intent extraction module is used to extract key historical intent information from multiple rounds of historical user dialogue. The alignment module is used to align the historical key intent information with the candidate intent information corresponding to the candidate intent vector to obtain candidate intent points used to distinguish different candidate intent information. The intent determination module is used to determine the target intent from the candidate intent information based on the user query information, the historical key intent information, and the candidate intent points.
[0023] Thirdly, embodiments of this application provide an intent recognition device, the device including: a processor, and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the method as described in the first aspect.
[0024] Fourthly, embodiments of this application provide a computer storage medium storing computer program instructions, which, when executed by a processor, implement the method described in the first aspect.
[0025] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.
[0026] The intent recognition method, apparatus, device, storage medium, and program product of this application embodiment, by querying a set of candidate intent vectors that match the query vector from multiple intent vector sets, and querying candidate intent vectors that match the query vector from the candidate intent vector set, can achieve hierarchical filtering of intent vector sets, candidate intent vector sets, and candidate intent vectors. This eliminates the need to traverse all intents, quickly focuses on highly relevant candidate intents, reduces invalid matching calculations, and thus improves recognition efficiency. It only extracts historical key intent information from multi-turn dialogues, rather than the entire dialogue, and then filters out candidate intent points that distinguish candidate intent information through alignment, avoiding redundant information occupying computing resources and reducing processing costs. Attached Figure Description
[0027] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 A flowchart illustrating an intent recognition method provided in one embodiment of this application is shown; Figure 2 A flowchart illustrating an intent recognition method provided in another embodiment of this application is shown; Figure 3 A flowchart illustrating an intent recognition method provided in another embodiment of this application is shown; Figure 4 A flowchart illustrating an intent recognition method provided in yet another embodiment of this application is shown; Figure 5 A flowchart illustrating an intent recognition method provided in yet another embodiment of this application is shown; Figure 6 A flowchart illustrating an intent recognition method provided in yet another embodiment of this application is shown; Figure 7 A flowchart illustrating an intent recognition method provided in yet another embodiment of this application is shown; Figure 8 A flowchart illustrating an intent recognition method provided in yet another embodiment of this application is shown; Figure 9 A flowchart illustrating an intent recognition method provided in yet another embodiment of this application is shown; Figure 10 This paper shows a schematic diagram of the structure of an intent recognition device provided in an embodiment of this application. Figure 11 A schematic diagram of the hardware structure of the intent recognition device provided in an embodiment of this application is shown. Detailed Implementation
[0029] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are intended only to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0030] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0031] Intent recognition is a core technology in conversational artificial intelligence and information retrieval. It refers to the process of accurately determining the core purpose or need category of a user's request by analyzing user input through algorithms. Large-scale intent recognition refers to finding intents that match user input from hundreds to thousands of predefined intents.
[0032] In existing intent recognition, the classifier path of multi-model cascade (such as single intent classification first, then multi-label classification or multi-level classification) is adopted. The inference stage needs to process a massive number of intent descriptions at the same time, which leads to low convergence efficiency of candidate intents. Moreover, the computational cost increases almost linearly with the number of arbitrary graphs consumed by the token, making it difficult to adapt to large-scale intent recognition scenarios of hundreds to thousands.
[0033] Furthermore, existing intent recognition methods employ rule tables for routing and conflict resolution at the terminal or application layer, but fail to combine vector retrieval to accurately narrow down candidate intents, nor utilize generative models to determine high-confidence intents. When the scale of intents expands or business requirements change frequently, the maintenance cost of the rule tables increases significantly, and the solution's generalization and scenario migration capabilities are weak.
[0034] In existing intent recognition, general retrieval augmented generation (RAG) technology focuses on knowledge question answering and fact completion scenarios, with a core focus on the accuracy and knowledge coverage of recall, splicing and generation. However, it lacks sparsity processing and context compression mechanisms for multi-intent routing, making it difficult to simultaneously achieve cost advantages and real-time response performance in scenarios with explosive growth in intent scale.
[0035] To address the problems of the prior art, embodiments of this application provide an intent recognition method, apparatus, device, storage medium, and program product.
[0036] The intent recognition method provided in the embodiments of this application will be introduced first below.
[0037] Before performing intent recognition, it is necessary to rebuild the data structure of intents in the intent library or intent pool in the offline stage to ensure that intent determination can still be completed with a constant number of candidates when the size of the intent pool is expanded from tens to thousands.
[0038] Figure 1 A flowchart illustrating an intent recognition method according to an embodiment of this application is shown. As shown, the method may include the following steps: S101 to S106.
[0039] S101. Obtain the query vector corresponding to the user's query information.
[0040] In this embodiment, user query information refers to the original input from the user initiating a dialogue or request, including but not limited to text queries for the current round, speech-to-text content, and command phrases. User query information can be obtained through user input. The query vector refers to the semantic vector obtained after the user query information is vectorized through an embedding model.
[0041] In some embodiments, user-inputted query information can be encoded into a query vector q.
[0042] S102. Query the set of candidate intent vectors that match the query vector from multiple intent vector sets.
[0043] In this embodiment, an intent vector is a semantic vector formed by vectorizing intents from an intent library or intent pool. The intent vector set is a set obtained by partitioning all intent vectors through hierarchical clustering. The basis for dividing multiple intent vectors into intent vector sets is the similarity or business relevance between them. Multiple intent vectors within the same intent vector set are highly similar semantically and / or business-wise. A candidate intent vector set refers to one or more intent vector sets that match the query vector. Here, matching refers to determining, through numerical calculation in the vector space, whether the semantic relevance between the query vector and the intent vector set meets preset retrieval requirements, and selecting intent vector sets highly relevant to the user's query semantics as candidate intent vector sets.
[0044] In this embodiment, the vector similarity between the query vector and the retrieval center vector of each intent vector set can be calculated, and the vector similarity can be compared with a preset similarity threshold. If the vector similarity exceeds the preset similarity threshold, the intent vector set is determined to be a candidate intent vector set that matches the query vector.
[0045] S103. Query the candidate intent vector that matches the query vector from the candidate intent vector set.
[0046] In this embodiment, among all the candidate intent vector sets selected in the previous step, the specific intent vectors in each candidate intent vector set are matched with the query vector one by one for semantic similarity. Then, the highly semantically related intent vectors are selected according to preset rules. These selected intent vectors are the candidate intent vectors.
[0047] In this embodiment, the vector similarity between all intent vectors in the candidate intent vector set and the query vector can be calculated. Then, the vector similarity between the intent vectors in the candidate intent vector set and the query vector can be compared with another preset similarity threshold. If the vector similarity between the intent vectors in the candidate intent vector set and the query vector exceeds the other preset similarity threshold, then the intent vector is determined to be a candidate intent vector that matches the query vector.
[0048] S104. Extract key historical intent information from multiple rounds of historical user dialogue.
[0049] In this embodiment, historical key intent information refers to key information about the user's past core needs, extracted from multiple rounds of historical dialogue between the user and the system, and relevant to the current query. This historical key intent information can characterize the user's previous intent tendencies and core demands, and can be used to supplement the contextual basis for determining the current intent.
[0050] In this embodiment, S104 can filter and simplify information from multiple rounds of historical dialogue, filtering out meaningless and redundant content, and retaining only the key information that reflects the user's previous intentions and core demands, thus forming structured historical key intent information.
[0051] S105. Align the historical key intent information with the candidate intent information corresponding to the candidate intent vector to obtain the candidate intent points used to distinguish different candidate intent information.
[0052] In this embodiment, candidate intent information refers to the complete set of core structured information of the intent behind each candidate intent vector, without vectorization processing. This is also the original basis for generating the intent vector. The candidate intent information may include, but is not limited to, intent definition, usage boundaries, common expressions, function titles, example phrases, expected slots, and constraints. The function title of an intent refers to a summary of the core function of the intent, used to characterize the service goal or function of the intent. The example phrases of an intent refer to the natural language expressions that a user might use when triggering the intent, representing an example of the intent's actual application scenario. The expected slots of an intent refer to the key information items required to complete the intent. The constraints of an intent refer to the restrictive rules or boundary conditions on the slots or the intent's usage scenario. For example, the expected slots for an intent to book a flight ticket could be departure point, destination, and travel date, and the constraints of the intent could be: the travel date is a future date after the current time, and the departure point is not equal to the destination.
[0053] In this embodiment, alignment in S105 refers to matching the previously extracted historical key intent information with the candidate intent information corresponding to each candidate intent vector one by one to find the correlation between the two; then, based on the results of the association matching or alignment, key features that can clearly distinguish different candidate intent vectors or information are extracted from the candidate intent information. These key features are the candidate intent points. Specifically, the intent definition, usage boundaries, and common expressions of each candidate intent information can be aligned with the historical key intent information of the previous step one by one. Only phrases or sentences that can help distinguish these candidate intent vectors or information are selected. For the repeated content in the phrases or sentences, the SimHash-Locality Sensitive Hashing (SimHash-LSH) algorithm is first used to remove duplicate words, and then the Maximum Marginal Relevance (MMR) algorithm is used to select sentence segments with high information gain and no repetition between them. The goal is to retain only 1 to 2 key points that can identify the candidate intent vector for each candidate intent information, i.e., candidate intent points.
[0054] It should be noted that S105 includes the extraction of candidate intent information, which involves text compression of intent. Conventional text compression aims to optimize the overall fluency of sentences, while the embodiments of this application are guided by intent determination. The final product is a set of comparable evidence points (candidate intent points) corresponding to each candidate intent, which facilitates subsequent model to carry out intent classification reasoning based on evidence points, rather than intent generation based on long text content.
[0055] S106. Based on user query information, historical key intent information and candidate intent points, determine the target intent from the candidate intent information.
[0056] In this embodiment, all candidate intent information can be comprehensively judged based on user query information, historical key intent information, and candidate intent points. During the judgment process, the core needs of the user's current query (user query information) will be matched, combined with the contextual needs of historical dialogues (historical key intent information), and at the same time, the candidate intent points will be used to distinguish easily confused candidate intents. Finally, the unique target intent that best matches the user's true intent will be determined from the candidate intent information.
[0057] The intent recognition method of this application query a set of candidate intent vectors that match the query vector from multiple intent vector sets, and then queries a set of candidate intent vectors that match the query vector from the set of candidate intent vectors. This allows for hierarchical filtering of intent vector sets, candidate intent vector sets, and candidate intent vectors. It eliminates the need to traverse all intents, quickly focuses on highly relevant candidate intents, reduces invalid matching calculations, and thus improves recognition efficiency. It extracts only historical key intent information from multi-turn dialogues, rather than the entire dialogue, and then filters out candidate intent points that distinguish candidate intent information through alignment. This avoids redundant information occupying computing resources and can significantly reduce processing costs.
[0058] In some embodiments, a hierarchical vector index can be built for intents, along with an incrementally maintainable data structure. Specifically, all intents in the intent library or intent pool can be divided into multiple sets of intent vectors.
[0059] Figure 2 A flowchart illustrating an intent recognition method according to another embodiment of this application is shown. As shown, in some embodiments, the intent vector set can be obtained through the following steps: S201 to S203.
[0060] S201. Perform feature mapping on multiple pre-stored intents to obtain intent vectors corresponding to the multiple intents.
[0061] In this embodiment, an intent is an intent pre-stored in an intent library or intent pool. The intent may include, but is not limited to, a function title, example dialogue, and desired slots and constraints.
[0062] In this embodiment, the intent vector is a semantic vector formed by vectorizing intents in the intent library or intent pool.
[0063] In some embodiments, feature mapping is performed on multiple pre-stored intents to obtain intent vectors corresponding to the multiple intents. This may include: inputting the function title, example dialogue, expected slot, and constraints of each intent into an embedding model to obtain an intent vector; and simultaneously associating and recording the business domain to which the intent belongs and its most recent update timestamp through a unique identifier. Here, the unique identifier refers to the intent identifier corresponding to the intent. The embedding model can be configured using Enc ( This means that each intent vector is a vector composed of d real numbers, that is, the i-th intent vector v i ∈R d R represents the set of real numbers, i is an integer, and d represents the dimension of the intent vector, where d is a positive integer.
[0064] In this embodiment, S101 involves performing the vectorization and metadata storage steps. Vectorization and metadata storage refer to the basic preliminary steps for offline construction of a hierarchical vector index, which transform the structured information of the intent into a computable vector and retain key management data. This step provides a unified semantic space and primary key information for subsequent clustering, center vector calculation, and adjacency graph construction, while also providing data support for hot updates of the intent structure in the online phase.
[0065] S202. Calculate the intent similarity between every two intent vectors.
[0066] In this embodiment, intent similarity refers to the vector similarity between any two different intent vectors. The method of calculating intent similarity is not limited. For example, intent similarity can be obtained by calculating the cosine similarity or Euclidean distance between any two different intent vectors.
[0067] S203. Based on intent similarity, divide the intent vector into multiple intent vector sets.
[0068] In this embodiment, based on intent similarity, two intent vectors whose intent similarity exceeds a preset maximum similarity threshold can be merged into one intent vector set; and an intent vector set whose average intent similarity is less than the average similarity threshold can be split into two or more new intent vector sets.
[0069] In some embodiments, the concept of Hierarchical Agglomerative Clustering (HAC) can be used to divide intent vectors into multiple intent vector sets based on intent similarity. Specifically, intent vector sets with high intent similarity are gradually merged, or intent vector sets with uneven density or overlapping boundaries (where the average intent similarity is less than the average similarity threshold) are split. The resulting intent vector sets can also be referred to as clusters or parent clusters.
[0070] In this embodiment, a retrieval-oriented constraint clustering improvement can be implemented based on the general HAC approach. Specifically, during the gradual merging and splitting (splitting) of the aforementioned intent vector sets, the size of the intent vectors (child nodes within the parent cluster) within each intent vector set (cluster or parent cluster) is continuously maintained at [K_min, K_max]. K_min is a preset minimum number of intent vectors allowed in a single intent vector set, and K_max is a preset maximum number of intent vectors allowed in a single intent vector set. This continues until the intent similarity between any two intent vectors within each intent vector set is greater than the maximum similarity threshold, or the average intent similarity within each intent vector set is greater than the average similarity threshold.
[0071] In this way, the number of intent vectors in each intent vector set is kept within a certain range, ensuring that the number of candidate intents remains constant during subsequent online sub-layer fine-tuning, thus avoiding the expansion of the total number of arbitrary graphs (hundreds to thousands).
[0072] In some embodiments, for each intent vector in the intent vector set, the k-nearest neighbor distance quantile of each intent vector is calculated, and the local density within the intent vector set is evaluated based on the k-nearest neighbor distance quantile. Then, a single intent vector set is bisected only when there is significant unevenness in local density; two or more intent vector sets are merged only when there is significant overlap across cluster boundaries, until the clusters are compact, the inter-cluster boundaries are clear, and the size meets the aforementioned range. This process forms a parent cluster, i.e., an intent vector set. The sub-layer of this intent vector set consists of several or more intent nodes, each corresponding to an intent vector.
[0073] By constructing a hierarchical parent cluster and child nodes in this embodiment, a boundary can be provided for the parent layer coarse recall → child layer fine inspection process in the online intent recognition stage, and the low intent recognition efficiency and high computational cost caused by the expansion of the candidate intent size can be avoided.
[0074] In this embodiment, for each intent vector in the intent vector set, its k nearest neighbors are first found, where k is a positive integer, and the k nearest neighbors refer to the k intent vectors with the highest similarity to the intent vector. The vector distances between the intent vector and its k nearest neighbors are calculated, and then a certain quantile (such as the median) of these vector distances is taken to obtain the k-nearest neighbor distance quantile. If the k-nearest neighbor distance quantile is larger, it indicates that the local intent vectors in the intent vector set are loose, sparse, or have low density; conversely, if the k-nearest neighbor distance quantile is smaller, it indicates that the local intent vectors in the intent vector set are dense, compact, or have high density. Therefore, the local density within the intent vector set can be evaluated based on the k-nearest neighbor distance quantile.
[0075] In this embodiment, the cross-cluster boundary refers to the intention vector within the boundary region between two different parent clusters (sets of intention vectors), that is, an intention vector that is similar to the center vectors of both parent clusters. The cross-cluster boundary can be determined as follows: For each intention vector, determine the original parent cluster it belongs to after clustering or partitioning, i.e., the parent cluster it belongs to; then determine the nearest parent cluster of the intention vector other than its parent cluster. The nearest parent cluster can be determined by calculating the similarity between the intention vector and the centers of all parent clusters other than its parent cluster, and taking the parent cluster corresponding to the highest similarity; calculate the similarity between the intention vector and the center of its parent cluster to obtain the parent cluster similarity; calculate the similarity between the intention vector and the center of the nearest parent cluster to obtain the nearest center similarity; calculate the difference between the parent cluster similarity and the nearest center similarity. If the difference is less than a preset boundary threshold, then the intention vector is determined to be a cross-cluster boundary.
[0076] In this embodiment, the center of each parent cluster or set of intent vectors can be represented by the average of all intent vectors within it.
[0077] In this embodiment, the degree of cross-cluster boundary overlap can be determined in the following way: For each pair of adjacent parent clusters, the number of cross-cluster boundaries that simultaneously belong to the two parent clusters is counted to obtain the total number of cross-cluster boundaries; the total number of cross-cluster boundaries is divided by the total number of all intention vectors in the two parent clusters to obtain the cross-cluster boundary overlap rate; the cross-cluster boundary overlap rate is compared with a preset overlap threshold. If the cross-cluster boundary overlap rate exceeds the preset overlap threshold, it is determined that the cross-cluster boundary overlap is high, and vice versa.
[0078] In some embodiments, S203 may further include: using the Kmeans clustering algorithm to divide the intent vector into a preset number of intent vector sets based on intent similarity.
[0079] Through S201 to S202, intents were vectorized, similarity measures were quantified, and set-based partitioning was achieved. Hierarchical clustering was implemented, parent-child clusters were obtained, and an incrementally maintainable offline data structure was constructed to adapt to the expansion of intent pools from tens to thousands. Structured convergence of intents was performed at the data level, providing underlying support for constant-level candidate determination in the online stage and avoiding retrieval bloat under large-scale intent pools.
[0080] In some embodiments, based on the partitioned intent vector set, a parent-child relationship table between the intent vector set and the intent vectors can be directly constructed: ParentID→[ChildIDs], where ParentID represents the identifier (ID) corresponding to the parent cluster (intent vector set), and [ChildIDs] represents an array, list, or set of identifiers (IDs) corresponding to all child nodes (intent vectors) within the intent vector set.
[0081] In some embodiments, within the same parent cluster (set of intent vectors), a similarity nearest neighbor table is constructed for each intent vector: ChildID → [NeighborIDs]. Specifically, based on the vector similarity between each intent vector, the k-nearest neighbor algorithm (kNN) is used to select the k intent vectors with the highest similarity from other intent vectors within the same parent cluster (set of intent vectors), where k is a preset constant, such as 5 or 10. ChildID represents the identifier (ID) corresponding to a single intent vector, and [NeighborIDs] represents an array, list, or set of IDs corresponding to the intent vector with the current ChildID, selected by cosine similarity and kNN, and composed of the k most similar other intent vectors within the same parent cluster. In addition, from the k most similar other intent vectors corresponding to this intent vector, vectors with vector similarity lower than a preset similarity threshold need to be removed. The intent vector is used to filter weak edges, thereby obtaining a similar nearest neighbor table for each intent vector.
[0082] The parent-child relationship table and similar nearest neighbor relationship table constructed in this embodiment allow for the following when a new intent is added to the intent pool: First, the parent cluster to which the new intent vector belongs is determined. Only a local update is performed within this parent cluster, such as adding the new intent's ID to the parent-child relationship table and recalculating the similar nearest neighbor relationship table within that parent cluster. The cluster structure of all other parent clusters (the sets of intent vectors and the relationships between intent vectors, the parent-child relationship table, and the similar nearest neighbor relationship table) remains unchanged without any adjustments. Furthermore, when an intent is deleted from the intent pool (deleted intent), only the relevant information of the intent to be deleted is removed from the intent vector set to which it belongs. For example, the ID of the intent vector to be deleted is removed from the parent-child relationship table of that parent cluster, and the similar nearest neighbor relationship table of the affected intent vector is updated again within that parent cluster. The overall structure, internal sub-intents, and relationships of other parent clusters remain unaffected and do not require reconstruction. Therefore, this embodiment achieves the construction and version-based maintenance of the adjacency table.
[0083] In some embodiments, for each set of intent vectors, in order to construct a stable entry point for the parent coarse retrieval (S102), a corresponding center vector can be calculated for each set of intent vectors, and the center vector can be used as the representative vector of that set of intent vectors. The center vector corresponding to the set of intent vectors can also be called the parent cluster center vector.
[0084] In some embodiments, the average value of all intent vectors in the intent vector set can be used as the center vector corresponding to the intent vector set.
[0085] Figure 3 A flowchart illustrating an intent recognition method provided in another embodiment of this application is shown. As shown, in some embodiments, the center vector corresponding to each intent vector set can be obtained through the following steps: S301 to S303.
[0086] S301. Calculate the first intent weight corresponding to each intent vector based on the hit frequency, most recent update time, and preset weight parameters of each intent vector in the intent vector set.
[0087] In this embodiment, the preset time window is a pre-defined time range. The hit frequency refers to the number or frequency with which the intent corresponding to the intent vector is successfully matched during the retrieval or distribution process within the preset time window, or it can be the relative proportion of the intent's hit frequency within its respective intent vector set. This can be a proportional indicator derived by combining the hit rates of other intents within the same intent vector set. The hit frequency can be calculated using statistical data from online logs. The most recent update time refers to the specific time when the intent information corresponding to the intent vector was last modified, improved, or maintained. This most recent update time is recorded and stored by the system in the form of a timestamp (update timestamp). Therefore, the most recent update time can be obtained through the update timestamp. The preset weight parameters are coefficients or values pre-set for the time indicators corresponding to the hit frequency and most recent update time, used to adjust the influence ratio of different factors in the weight calculation.
[0088] In this embodiment, S301 can combine the hit frequency and most recent update time of each intent vector in the intent vector set within a preset time window with preset weight parameters to calculate the initial weight corresponding to each intent vector, i.e., the first intent weight, thereby defining the initial importance of a single intent vector in the set.
[0089] In some embodiments, the preset weight parameters may include a frequency exponentiation coefficient, a smoothing constant, and a time decay coefficient, and the first intention weight can be expressed by the following formula:
[0090] In this embodiment, The first one in the set of intent vectors The first intent weight corresponding to each intent vector. An integer greater than or equal to 0 and less than or equal to the total number of intent vectors in the intent vector set. The first one in the set of intent vectors The hit frequency of an intent vector within a preset time window. Represents a smoothing constant, used to avoid... The value is zero. For any small positive number, that is The preset time window can be [T-Δ, T], where T represents the current time and Δ represents the duration of the preset time window. Represents the natural constant. , This represents the time decay coefficient, used to reinforce the weight of the most recently updated intent vector. In other words, the closer the most recent update time is to the current time, the greater the weight of that intent vector. The larger, Indicates the last update time. This represents the frequency exponentiation coefficient, used to suppress high-frequency intentions within the same intent vector set that have a significantly higher hit frequency than other intentions. .
[0091] S302. Normalize the first intent weight to obtain the second intent weight.
[0092] In this embodiment, the first intent weight corresponding to each intent vector in the intent vector set is mapped to a fixed, comparable numerical range of 0 to 1, thereby obtaining the second intent weight.
[0093] In some embodiments, the second intent weight can be represented by the following formula:
[0094] In this embodiment, The first one in the set of intent vectors The second intent weights corresponding to each intent vector An integer greater than or equal to 0 and less than or equal to the total number of intent vectors in the intent vector set. The first one in the set of intent vectors The first intent weight corresponding to each intent vector. This represents the set of intent vectors. The first in the set of intent vectors The index corresponding to each intent vector The first one in the set of intent vectors The first intent weight corresponding to each intent vector. It is an integer greater than or equal to 0 and less than or equal to the total number of intent vectors in the intent vector set.
[0095] S303. The intention vectors are weighted according to the second intention weight to obtain the center vector corresponding to the intention vector set.
[0096] In this embodiment, each intent vector can be multiplied by the second intent weight corresponding to that intent vector, and then all the results after multiplication can be summed to finally obtain the center vector corresponding to the set of intent vectors.
[0097] In some embodiments, the center vector corresponding to the intent vector set can be represented by the following formula:
[0098] In this embodiment, This represents the center vector corresponding to the set of intent vectors. This represents the set of intent vectors. The first in the set of intent vectors The index corresponding to each intent vector An integer greater than or equal to 0 and less than or equal to the total number of intent vectors in the intent vector set. The first one in the set of intent vectors The second intent weights corresponding to each intent vector The first one in the set of intent vectors A number of intent vectors.
[0099] In some embodiments, during the real-time operation phase (online phase) of providing intent recognition services, the system can use an exponential moving average algorithm to incrementally update the center vector of the intent vector set. Specifically, the center vector of the current intent vector set and the center vector of the original intent vector set can be weighted by the weights of the exponential moving average algorithm.
[0100] In some embodiments, the center vector of the intent vector set can be updated using the following formula:
[0101] In this embodiment, the arrow points to... This represents the center vector of the updated intent vector set. In This represents the center vector of the original or previous set of intent vectors before the update. This represents the new center vector obtained by calculating the latest set of intent vectors using the above embodiments. This represents the weights in the exponential moving average algorithm. It can be adjusted according to the speed of changes in the business scenario (the speed of intent updates in the intent pool). The value of is chosen so that the update speed of the center vector matches the actual pace of business changes, i.e. The value is set according to the business drift rate.
[0102] By updating the center vector of the intent vector set in this embodiment, the center vector can reflect high-frequency and fresh intent features, while avoiding the computational overhead and result jitter caused by full recalculation. This ensures the stability of the parent layer coarse retrieval and more accurately adapts to business needs in a massive intent recognition system.
[0103] S301 to S303 can be used to weight and normalize the child node vectors (intent vectors) within the parent cluster according to the multiplicative weights of usage frequency and freshness, that is, to realize the dynamic weighting of the parent cluster center vector, and obtain the center vector corresponding to each parent cluster or intent vector set.
[0104] In some embodiments, after constructing the parent-child relationship table and the similar nearest neighbor relationship table, the center vector corresponding to the intent vector set is updated.
[0105] In some embodiments, in response to updating the intent vector, the method may further include: obtaining an updated intent vector set corresponding to the intent vector set, the updated intent vector set including one or more updated intent vectors that have been updated; and updating the center vector corresponding to the intent vector set according to the updated intent vector set and a preset update coefficient.
[0106] In this embodiment, when an intent vector in the system or intent pool changes (e.g., a new intent is added, an existing intent is modified, or an intent is deleted), the central vector update process is triggered in response to updating the intent vector. An updated intent vector refers to an intent vector that has been updated or changed. The updated intent vector set corresponding to the intent vector set refers to the intent vectors in the intent vector set that have been updated or changed. The updated intent vector set corresponding to the intent vector set refers to the set composed of updated intent vectors. The updated intent vector set includes one or more updated intent vectors. Based on the updated intent vector set and a preset update coefficient, a lightweight, local incremental update is performed on the central vector corresponding to each intent vector set.
[0107] Figure 4 A flowchart illustrating an intent recognition method according to another embodiment of this application is shown. As shown, in some embodiments, updating the center vector corresponding to the intent vector set according to the updated intent vector set and a preset update coefficient may include the following steps: S401 to S404.
[0108] S401. Determine the update magnitude corresponding to the set of intent vectors based on the number of update intent vectors in the set of intent vectors.
[0109] In this embodiment, the update magnitude corresponding to the intent vector set refers to the magnitude of the update or change of the intent vector set. Specifically, it can be characterized by the number of updated intent vectors in the updated intent vector set. In particular, the larger the number of updated intent vectors in the updated intent vector set, the larger the update magnitude corresponding to the intent vector set, and vice versa.
[0110] S402. Based on the current intent vector in the intent vector set, calculate the current center vector corresponding to each intent vector set.
[0111] In this embodiment, the current intent vector refers to all the latest and updated intent vectors in the intent vector set. The current center vector corresponding to the intent vector set can be calculated based on the latest intent vector (current intent vector). It should be noted that the current center vector can be obtained by calculating the average value of each current intent vector within the intent vector set, or by calculating the current center vector corresponding to each intent vector set using the method described in the above embodiment.
[0112] S403. When the update magnitude is less than or equal to the preset update magnitude threshold, the current center vector and the historical center vector of the intent vector set before the update are calculated by moving average according to the preset first update weight to obtain the updated center vector of the intent vector set.
[0113] In this embodiment, the update magnitude threshold is a pre-set quantitative threshold used to determine the magnitude of the update. The historical center vector refers to the center vector corresponding to the intent vector set before the update, and the current center vector refers to the center vector calculated based on the current intent vectors within the intent vector set using the method described in the above embodiment. If the update magnitude is less than or equal to the preset update magnitude threshold, it means that the update magnitude is small. In this case, a preset first update weight can be used to perform a moving average calculation on the current center vector and the historical center vector of the intent vector set before the update to obtain the updated center vector of the intent vector set. Specifically, 1 minus the preset first update weight multiplied by the historical center vector before the update, plus the current center vector, yields the updated center vector.
[0114] S404. When the update magnitude is greater than the preset update magnitude threshold, the current center vector and the historical center vector of the intent vector set before the update are weighted and averaged according to the preset second update weight, the set of intent vectors before the update and the number of updated intent vectors in the updated intent vector set, to obtain the updated center vector of the intent vector set.
[0115] In this embodiment, if the update magnitude is greater than a preset update magnitude threshold, it means that the update magnitude is large. At this time, the second update weight, the set of intent vectors before the update, and the number of updated intent vectors in the updated intent vector set can be combined to perform a weighted average calculation on the historical center vector and the current center vector. Finally, an updated center vector that is both consistent with the latest semantics and retains historical coherence can be obtained, which can balance accuracy and efficiency.
[0116] In some embodiments, when the update magnitude is greater than a preset update magnitude threshold, the updated center vector of the intent vector set can be calculated using the following formula:
[0117] In this embodiment, This represents the center vector of the updated intent vector set. This represents the historical center vector of the intent vector set before the update. Indicates the second update weight. This indicates updating the set of intent vectors. This indicates the number of update intent vectors in the update intent vector set. Indicates the first element in the set of update intent vectors. An update intent vector, It is a positive integer. The number of update intent vectors within the update intent vector set that is greater than or equal to 1 and less than or equal to the number of update intent vectors. This represents the sum of all update intent vectors within the update intent vector set. This indicates the number of intent vectors in the intent vector set before the update.
[0118] In this embodiment, The second update weight can be a historical sample reduction factor. If the update range is larger, then The smaller the value of , the greater the influence of new samples (updating the intent vector set) on the center vector. When there are only a few changes in intent, i.e., minor modifications, the current weighted calculation will automatically simplify or degenerate into the exponential moving average (EMA) in S403, thereby making the update of the center vector smoother and reducing jitter.
[0119] In this embodiment, the incremental update of the center vector and the intent addition / deletion, and the update and maintenance processes of the parent-child relationship table and the similar nearest neighbor relationship table in the previous embodiments are a coherent set of actions, seamlessly connected. The incremental update of the parent cluster center vector is naturally aligned with the update and maintenance processes of the parent-child relationship table and the similar nearest neighbor relationship table. This means that if an intent is updated and the intent vector needs to be updated, it will trigger the update of the parent-child relationship table, the similar nearest neighbor table, and the center vector. After the intent is updated and stored in the database, the new vector center immediately becomes the online coarse detection entry point, ensuring the rapid effectiveness of cluster structural changes and reducing system maintenance costs. The online coarse detection entry point refers to the fact that as soon as the center vector is updated, it immediately serves as the entry point for querying or retrieving the intent vector set in online intent recognition.
[0120] In some embodiments, to avoid the gradual degradation of the parent cluster structure, which could lead to online retrieval candidate inflation or recall result fluctuations, intra-cluster similarity and cross-cluster similarity can be evaluated periodically, and the size of the intent vectors within the intent vector set can be checked to see if it is still within [K_min, K_max]. Gradual degradation of the parent cluster structure refers to the situation where, due to continuous additions, deletions, and modifications to intents over a long period, the parent cluster structure becomes unclear, and the partitioning of the intent vector set becomes ineffective.
[0121] Figure 5 A flowchart illustrating an intent recognition method according to another embodiment of this application is shown. As shown, in some embodiments, the method further includes steps S501 to S504.
[0122] S501. Calculate the intra-cluster similarity between different intent vectors in each intent vector set, and calculate the average intra-cluster similarity for each intent vector set based on the intra-cluster similarity.
[0123] In this embodiment, intra-cluster similarity refers to the degree of similarity between different intent vectors within the same parent cluster (intent vector set). Specifically, it can be the cosine similarity or Euclidean distance between different intent vectors. After calculating the intra-cluster similarity between different intent vectors in each intent vector set, the average intra-cluster similarity of each intent vector set is also calculated to obtain the average intra-cluster similarity for each intent vector set.
[0124] S502. Calculate the cross-cluster similarity between the first intent vector and the second intent vector, which belong to any two different sets of intent vectors.
[0125] In this embodiment, one intention vector can be taken from each of any two different sets of intention vectors, namely the first intention vector and the second intention vector, and the similarity between the two intention vectors can be calculated to obtain the cross-cluster similarity.
[0126] S503. Determine the maximum cross-cluster similarity for each intent vector based on cross-cluster similarity.
[0127] In this embodiment, for each intent vector in the intent vector set, each intent vector in all other parent clusters (intent vector sets) has a cross-cluster similarity. Therefore, each intent vector has at least one cross-cluster similarity. For each intent vector, the maximum value of the cross-cluster similarity can be determined as the maximum cross-cluster similarity corresponding to that intent vector. This maximum cross-cluster similarity can also be called the closest cross-cluster similarity.
[0128] S504. If the average intra-cluster similarity is less than a preset intra-cluster threshold, and / or the maximum cross-cluster similarity is greater than a preset inter-cluster threshold, the intent vector set is re-divided into at least one intent vector set based on the average intra-cluster similarity and the minimum cross-cluster similarity, such that the average intra-cluster similarity is greater than or equal to the intra-cluster threshold, and the maximum cross-cluster similarity is less than or equal to the inter-cluster threshold.
[0129] In this embodiment, if the average intra-cluster similarity is less than a preset intra-cluster threshold τ intra This means that intent vectors within the same parent cluster have low similarity. If the maximum cross-cluster similarity exceeds a preset inter-cluster threshold τ... interThis indicates that the similarity between the intent vectors of one intent vector set and the intent vectors of another intent vector set is too high, and the two parent clusters have a high degree of overlap. Therefore, if the average intra-cluster similarity is less than a preset intra-cluster threshold, and / or the maximum cross-cluster similarity is greater than a preset inter-cluster threshold, the intent vector sets need to be re-divided. Based on the average intra-cluster similarity and the minimum cross-cluster similarity, the intent vector sets can be re-divided into at least one intent vector set, such that the average intra-cluster similarity is greater than or equal to the intra-cluster threshold, and the maximum cross-cluster similarity is less than or equal to the inter-cluster threshold. Specifically, intent vector sets with an average intra-cluster similarity less than the preset intra-cluster threshold can be split into at least two intent vector sets, and two intent vector sets with a maximum cross-cluster similarity greater than the preset inter-cluster threshold can be merged.
[0130] In this embodiment, if any of the following triggering conditions are met: the average intra-cluster similarity is less than a preset intra-cluster threshold and the maximum cross-cluster similarity is greater than a preset inter-cluster threshold, then local reorganization of the parent cluster or intent vector set is performed.
[0131] In some embodiments, the local reorganization of the intent vector set may further include: re-clustering or redistributing the intent vectors (within the parent cluster) in the intent vector set according to the density adaptation principle among intent vectors within the intent vector set; updating the parent-child relationship table and the similar nearest neighbor relationship table according to the above embodiments; and finally updating the center vector or cluster center using the exponential moving average (EMA) algorithm or the merging algorithm according to the above embodiments. The merging algorithm or the exponential moving average (EMA) algorithm may correspond to the specific implementations of S404 and S403 above, respectively.
[0132] The method provided in this embodiment ensures that the complexity of online retrieval intents is not excessive, thus guaranteeing that the complexity will not become too high as the number of intents in the system or intent pool increases. Specifically, in the parent layer retrieval, an Approximate Nearest Neighbor (ANN) algorithm is used for fast coarse searching based on the center vectors of all parent clusters, with an average query complexity of approximately O(log P), where P is the total number of parent clusters. The sub-layer performs fine searching only on a small number of child nodes (intent vectors) contained in the selected parent clusters, with a retrieval complexity of approximately O(k), where k is a preset constant-level upper limit for the number of candidates. The closed-loop mechanism of clustering, updating, and reorganizing provided in this embodiment can maintain a stable number of retrieval candidates and clear recall result boundaries even when the scale of intents continues to expand and the semantic distribution drifts. At the same time, token consumption and response latency will not increase significantly with the increase of the total number of intents, thus ensuring that the scale of candidate intents remains constant, the recall boundaries remain clear, and the token and latency costs are insensitive to the total number of intents.
[0133] In some embodiments, after constructing the intent structure or dividing it into multiple intent vector sets in the offline phase, a two-stage retrieval and candidate sparsification process can be performed in the online phase. Here, two-stage retrieval refers to first querying the set of candidate intent vectors that match the query vector from the multiple intent vector sets, and then querying the set of candidate intent vectors that match the query vector.
[0134] In this embodiment, the nearest neighbor search algorithm (ANN) can be executed on each center vector of the parent layer to obtain the top-N sets of intent vectors (parent clusters) with similarity to the query vector. The similarity between each of the top-N sets of intent vectors and the query vector can also be obtained, and this is called the parent cluster similarity S. p The Top-N intent vector set here refers to the set of the N intent vectors with the highest similarity to the query vector q, selected from all intent vector sets, where N is an integer greater than 1. It should be noted that, unlike conventional retrieval, the coarse search in this embodiment is performed only on cluster centers or center vectors, rather than on all or all intents. This structurally narrows or constrains the search space, laying the foundation for subsequent constant-order candidate sparsity. Candidate sparsity here refers to sparsifying or limiting the number of candidate intent vectors.
[0135] In some embodiments, S103 may include the following steps: normalizing each center similarity based on a preset normalization parameter to obtain the retrieval weight corresponding to each intent vector set; selecting an intermediate intent vector from the candidate intent vector set according to the retrieval weight; calculating the candidate similarity between the query vector and the intermediate intent vector; and determining the candidate intent vector from the intermediate intent vector according to the candidate similarity.
[0136] In this embodiment, the center similarity is the vector similarity between the query vector and the center vector corresponding to each candidate intent vector set. The normalization parameter is a pre-set parameter used to normalize each center similarity. The normalization parameter can be a temperature parameter or a coefficient, used to control the distribution or sharpness of the retrieval weights corresponding to the candidate intent vector sets. The lower the temperature coefficient, the more concentrated the retrieval weights are in the parent cluster most similar to the query vector; the higher the temperature coefficient, the more balanced the retrieval weights are in the parent clusters similar to the query vector. The center similarity can be smoothly normalized by the preset normalization parameter, and the normalized center similarity is called the retrieval weight.
[0137] In this embodiment, the retrieval weight can be used as the sampling probability, and a preset number of intent vectors are sampled from each candidate intent vector set based on the sampling probability. The sampling probability refers to the probability or likelihood of extracting an intent vector from the current candidate intent vector set. The higher the sampling probability of a candidate intent vector set, the more likely it is to extract an intent vector from that set. Therefore, an intermediate intent vector can be selected from the candidate intent vector set based on the retrieval weight. This intermediate intent vector refers to the intent vector selected from the candidate intent vector set based on the retrieval weight.
[0138] For example, suppose there are three candidate intent vector sets, namely candidate intent vector set A, candidate intent vector set B, and candidate intent vector set C. The retrieval weight corresponding to candidate intent vector set A is 0.7, the retrieval weight corresponding to candidate intent vector set B is 0.2, and the retrieval weight corresponding to candidate intent vector set C is 0.1. Then there is a 70% probability of selecting an intent vector from candidate intent vector set A, a 20% probability of selecting an intent vector from candidate intent vector set B, and a 10% probability of selecting an intent vector from candidate intent vector set C.
[0139] In this embodiment, candidate similarity refers to the vector similarity between the query vector and the intermediate intent vector. Determining a candidate intent vector from the intermediate intent vectors based on the candidate similarity means identifying one or more intermediate intent vectors with the highest candidate similarity as the candidate intent vector.
[0140] In some embodiments, the retrieval weight can be determined using the following formula:
[0141] In this embodiment, Indicates retrieval weight. Indicates center similarity, Represents the normalization function. This represents the normalization parameter.
[0142] To avoid directly selecting Top The hard slicing method of the N-parent cluster causes retrieval errors. This application's embodiment performs temperature normalization on the parent layer similarity score (center similarity). Only the Top cluster is directly retained. The N-cluster selection method is prone to result instability when handling semantic boundary samples, and it cannot differentiate between clusters with similarity. Specifically, it cannot finely distinguish between clusters with similarity to the query or those prone to instability on boundary samples, resulting in a rigid, indiscriminate selection that affects retrieval stability and accuracy. This rigid selection method refers to a one-size-fits-all approach when choosing the top N most similar intent vectors. This leads to two problems: first, for queries with ambiguous semantics or those on multiple intent boundaries, the retrieval results become inconsistent and unstable; second, clusters with very close similarity are directly excluded without considering their importance, resulting in an overly inflexible approach. However, by using temperature normalization to smooth the center similarity of clusters, the errors caused by this crude selection method can be avoided.
[0143] In some embodiments, a sub-layer fine search is performed after a coarse search of the parent layer. Here, the sub-layer fine search refers to querying candidate intent vectors that match the query vector from the set of candidate intent vectors.
[0144] In this embodiment, sub-layer fine retrieval may include: First, calculating the cosine similarity between each intent vector and the query vector, only for intent vectors (child nodes) included or covered in the candidate intent vector set. The cosine similarity can be expressed by the following formula: . This represents the cosine similarity between the intent vectors included in the candidate intent vector set and the query vector. Represents the query vector. This indicates the intent vectors included or covered in the candidate intent vector set. This represents the magnitude of the query vector. express The second step is to sort the candidate intent vectors in the set according to their cosine similarity, and only retain those with a cosine similarity greater than or equal to a preset cosine similarity threshold. The intent vector is determined, and the retained intent vector is identified as the candidate intent vector.
[0145] In some embodiments, only Greater than or equal to the cosine similarity threshold The intent vectors are obtained, and the retained intent vectors are sorted in descending order. The top k intent vectors are selected as candidate intent vectors, where k is an integer greater than 1.
[0146] Compared to traditional sparsification, this embodiment employs a two-level constraint mechanism: temperature coefficient-based normalization fusion in the parent layer, followed by threshold filtering and Top-k constraints in the child layer. This stabilizes the size or number of search candidates at a constant k, effectively avoiding the problem of arbitrary linear growth in the total graph size. The complexity of the parent layer coarse search is O(log|C). p |), here |C p The complexity of sub-layer fine retrieval is O(k) for the number of intent vector sets. Meanwhile, the token concatenation length of the model remains almost unchanged regardless of the expansion of the graph pool size.
[0147] In some embodiments, based on the obtained candidate intent vectors, the information from multi-turn dialogues can be organized and compressed to construct a constrained context that meets the model input constraints and can be used for intent determination, so that the intent recognition model can output a structured determination result based on the context.
[0148] Figure 6 A flowchart illustrating an intent recognition method according to another embodiment of this application is shown. As shown, in some embodiments, extracting historical key intent information from multi-turn historical user dialogues may include the following steps: S601 to S603.
[0149] S601. Extract key information related to user intent from multiple rounds of historical user dialogue.
[0150] In this embodiment, key information refers to intent information related to user intent, including at least one of user needs, user confirmation information, user denial information, preference information, and constraints. User needs can be requests explicitly made by the user in past conversations. User confirmation information refers to information in which the user explicitly affirms, agrees with, or approves of content, options, intents, etc., mentioned in the system or previous conversations. User denial information refers to information in which the user explicitly denies, disagrees with, or corrects content, options, intents, etc., mentioned in the system or previous conversations. Preference information refers to descriptions of the user's expressed personal preferences, tendencies, or selection biases. Constraints, also known as limiting conditions, refer to restrictions, conditions, or requirements proposed by the user to define the scope or boundaries of the intent's execution.
[0151] In some embodiments, multi-turn historical user dialogues can be broken down into individual words, the meaning of each word can be identified, meaningless words (such as interjections) can be deleted, and through referential resolution and text normalization (synonym unification, unit unification), referential ambiguity such as "it", "this", and "the one before" can be eliminated, retaining only the key information related to the user's intent.
[0152] S602. Assign time decay weights to key information based on the dialogue time corresponding to the key information.
[0153] In this embodiment, a weight is assigned to key information based on the changes in dialogue time, i.e., a time decay weight. The closer the dialogue time is to the current moment, the greater the time decay weight corresponding to the key information; conversely, the further the dialogue time is from the current moment, the smaller the time decay weight corresponding to the key information.
[0154] S603. Based on the time decay weight and whether the key information is directly stated by the user, merge conflicting information in the key information to obtain historical key intent information.
[0155] In this embodiment, when contradictory content appears in the extracted key information (e.g., the user first says they are going to Guangzhou, then says they are going to Shanghai), i.e., conflicting information occurs, the criteria for determining which key information to retain and which to discard are based on two factors: the conversation time of the key information is more recent than the current moment, and which key information was directly stated by the user. Ultimately, the conflicting information is merged into a unified, uncontradictory historical key intent information. Specifically, by prioritizing the most recent information and prioritizing the user's direct statements, conflicts are merged to obtain the brief goals and constraints of the current round, thereby determining the historical key intent information. Specifically, multiple conflicting pieces of information are first identified within the key information; conflicting information with higher time decay weights is retained, while conflicting information with lower time decay weights is overwritten or discarded during the merging process. Furthermore, it is determined whether the conflicting information was directly stated by the user; information directly stated by the user is retained.
[0156] It should be noted that the method provided in this embodiment does not provide a general summary of the multi-turn dialogue history, but only retains key information points that are directly related to the current intent determination, thereby filtering out irrelevant chatter.
[0157] In some embodiments, S105 may include: based on the candidate intent vectors obtained in S101 to S104, determining the candidate intent information corresponding to each candidate intent vector; matching the definition, usage boundaries, and common expressions of each candidate intent information with the key information extracted in the previous step one by one; and filtering out only phrases or sentences that can effectively distinguish different candidate intent information, i.e., candidate intent points. Specifically, the SimHash-LSH algorithm can be used to remove duplicate words first, and then the MMR algorithm can be used to select sentences with high information gain and no repetition between them, retaining only 1 to 2 key points that can identify the candidate intent vector for each candidate intent information, i.e., candidate intent points.
[0158] In this embodiment, unlike general text compression that aims for fluency, this embodiment is intent-driven and ultimately outputs the key evidence points that can be compared for each group of candidate intents. It is more suitable for model classification decisions than for long text generation.
[0159] A token is the smallest unit of text that the model processes. In some embodiments, the total length of the historical key intent information and / or candidate intent points converted into tokens exceeds the expected length L. budget In the case of [the specific situation], the token is compressed in the order of recent priority, similar content merging, and topic sentence extraction. The token budget is concentrated on the intent determination stage that needs to be distinguished, which not only strictly controls the length of the input token, but also reduces the interference of irrelevant dialogue history on the intent recognition model.
[0160] Figure 7 A flowchart illustrating an intent recognition method according to another embodiment of this application is shown. As shown, in some embodiments, S106 may include the following steps: S701 to S704.
[0161] S701. Generate contextual prompts based on user query information, historical key intent information, and candidate intent points.
[0162] In this embodiment, user query information, historical key intent information, and candidate intent points can be combined to generate contextual prompts. These contextual prompts provide the intent recognition model with the basis for intent recognition and offer corresponding suggestions.
[0163] S702. Input the contextual prompt information into the intent recognition model so that the intent recognition model performs intent matching based on the contextual prompt information and outputs at least one set of candidate intent information.
[0164] In this embodiment, the candidate intent information includes the candidate intent, the intent confidence level corresponding to the candidate intent, and the information on the basis for generating the candidate intent. The candidate intent refers to the candidate intent vector that the intent recognition model guesses as the best match for the intent corresponding to the query vector among the candidate intent information corresponding to the candidate intent vector. This candidate intent can be represented by the identifier ID corresponding to the candidate intent information. The intent confidence level corresponding to the candidate intent is a score of how certain and confident the intent recognition model is in its judgment that the candidate intent is the best matching candidate intent vector. The intent confidence level can be represented by confidence, confidence∈[0,1]. The closer the confidence is to 1, the more certain it is that the candidate intent is the best matching candidate intent vector with the query vector.
[0165] In this embodiment, the information used to generate the candidate intent is at least one of historical key intent information and user query information. The intent recognition model is used to determine user intent based on contextual prompts. It can be implemented using a large language model; it can also be implemented using a text classification model based on architectures such as BERT or RoBERTa, or a lightweight model such as a traditional deep learning classification model or a rule matching model. After inputting the contextual prompts into the intent recognition model, the model can perform intent matching based on the contextual prompts to determine the candidate intent vector that best matches the intent corresponding to the query vector, and output at least one set of structured candidate intent information. Specifically, this structured candidate intent information can be {intent_id, confidence, rationale}, where intent_id represents the identifier of the candidate intent, confidence represents the intent confidence level corresponding to the candidate intent, and rationale represents the information used to generate the candidate intent. Specifically, it can refer to the identifier corresponding to historical key intent information or user query information, or it can be a key point label or a historical dialogue turn. The information used to generate the candidate intent should reference the key information extracted earlier or the round of the dialogue, so that the basis is traceable and verifiable.
[0166] S703. Compare the intent confidence level with the preset confidence threshold.
[0167] S704. If the confidence level of the intent is greater than the preset confidence threshold, the candidate intent corresponding to the confidence level of the intent is determined as the target intent.
[0168] In this embodiment, if the confidence level of the intent is greater than a preset confidence threshold... If so, the candidate intent is determined to be the target intent. This preset reliability threshold... The value can be set by the user, for example, a preset confidence threshold. It can be between 0.65 and 0.75.
[0169] In some embodiments, if the intent confidence level is less than or equal to a preset confidence threshold, a clarification questioning process is initiated. The clarification questioning process refers to an interactive process where the user initiates targeted questions to clarify ambiguous information and supplement missing conditions. After obtaining a clear response from the user through this clarification questioning process, the response is used as new key information to re-participate in the intent determination of the aforementioned embodiments, forming a feedback loop and achieving online feedback and continuous learning.
[0170] In some embodiments, specific data when the intent confidence is low or when the user reports an error can be converted into adjustment samples. Based on the adjustment samples, small amplitude or small step increments are set for each center vector to update each center vector, gradually correcting those easily confused center vectors without making major changes to the entire library. This can optimize the accuracy of intent recognition, improve recognition efficiency, and stabilize costs and latency.
[0171] Figure 8 A flowchart illustrating an intent recognition method according to another embodiment of this application is shown. As shown, in some embodiments, when the intent confidence level is less than or equal to a preset confidence threshold, or when a user error message is received, the method may further include the following steps: S801 to S808.
[0172] S801. Record the query vector, the set of true candidate intent vectors corresponding to the query vector, and the set of erroneous candidate intent vectors corresponding to the target intent, and obtain the center vector update sample.
[0173] In this embodiment, user error reporting refers to the user's proactive feedback of error correction or prompts regarding the intent recognition result, i.e., the target intent. If the intent confidence is less than a preset confidence threshold, follow-up questioning is triggered. When the intent confidence is less than or equal to the preset confidence threshold, or when user error reporting is received, the query vector, the set of true candidate intent vectors corresponding to the query vector, and the set of erroneous candidate intent vectors corresponding to the target intent are recorded. The recorded information is used as a center vector update sample for updating the center vector. Here, the set of true candidate intent vectors corresponding to the query vector refers to the set of intent vectors containing the true intent vector of the correct intent corresponding to the query vector. The set of erroneous candidate intent vectors corresponding to the target intent refers to the set of intent vectors containing the erroneous intent vector corresponding to the misjudged target intent (i.e., the erroneous intent).
[0174] In some embodiments, the center vector update sample may further include a user identifier and a timestamp indicating that the center vector update sample was generated. Specifically, the center vector update sample... , This represents user information, specifically a user identifier. Represents the query vector. This represents the set of erroneous candidate intent vectors corresponding to the target intent. This represents the set of true candidate intent vectors corresponding to the query vector. This represents the timestamp of the center vector update sample. This center vector update sample can be stored in the hard instance buffer (HCB).
[0175] In some embodiments, the center vector update samples are cleaned to retain only the center vector update samples within the most recent preset time period. For example, after cleaning, only the center vector update samples within the most recent 7-14 day window are retained. Based on the cleaned center vector update samples, a list to be updated is established, that is, the list to be updated includes the cleaned center vector update samples.
[0176] In some embodiments, the list to be updated only includes the set of real candidate intent vectors and the set of erroneous candidate intent vectors involved in updating the center vector sample. Only this small part of the data is updated locally to avoid changes to the entire database. This is both efficient and does not affect other normal intents, thus realizing feedback triggering and sample accumulation.
[0177] S802. Calculate the first similarity between the query vector and the true center vector corresponding to the set of true candidate intent vectors.
[0178] In this embodiment, the true center vector refers to the center vector corresponding to the set of true candidate intent vectors, and the first similarity refers to the similarity between the query vector and the true center vector. The similarity between the query vector and the true center vector, i.e., the first similarity, can be calculated using methods including but not limited to cosine similarity or Euclidean distance. This first similarity is used to measure the degree to which the user query aligns with the core of the correct intent.
[0179] S803. Calculate the second similarity between the query vector and at least one error center vector.
[0180] In this embodiment, the error center vector is the center vector corresponding to the set of error candidate intent vectors corresponding to the target intent, and the second similarity refers to the second similarity between the query vector and the error center vector. This second similarity is used to measure the degree of relevance between the user query and the core of the error intent.
[0181] S804. Determine the similarity difference between the first similarity and the second similarity.
[0182] In this embodiment, the similarity difference refers to the difference between the first similarity and the second similarity, which is used to characterize the distinguishing effect between correct and incorrect intents. It is easy to understand that since the query vector matches the true candidate intent vector set better than the set of incorrect candidate intent vectors, the second similarity is greater than the first similarity. Specifically, the similarity difference can be obtained by subtracting the first similarity from the second similarity.
[0183] S805. Based on the largest similarity difference, determine the center vector and update the confusion margin corresponding to the sample.
[0184] In this embodiment, since there are multiple erroneous candidate intent vectors, the center vector update sample can correspond to multiple similarity differences. The largest similarity difference is used as the confusion margin corresponding to the center vector update sample. Here, the confusion margin is used to characterize the degree of confusion between the true candidate intent vector set and the erroneous candidate intent vectors. The larger the confusion margin, the easier it is to confuse the true candidate intent vector set with the erroneous candidate intent vectors.
[0185] In some embodiments, the confusion margin can be calculated using the following formula:
[0186] In this embodiment, Update the samples for the center vector. This represents the set of erroneous candidate intent vectors. Represents the set of true candidate intent vectors. Represents the query vector. Represents the maximum value function. Used to calculate the similarity between two vectors. Represents the error center vector. Represents the true center vector; S806. Normalize the confusion margin to obtain the sample weights corresponding to the center vector update sample.
[0187] In this embodiment, each confusion margin is normalized to a value between 0 and 1. The normalized result is the sample weight corresponding to the center vector update sample. This sample weight is used to characterize the importance of the center vector update sample; the higher the confusion level of the center vector update sample, the larger the sample weight.
[0188] In some embodiments, the confusion margin can also be normalized using the following formula to obtain the sample weights corresponding to the center vector update samples:
[0189] In this embodiment, This indicates that the center vector updates the sample weights corresponding to the sample. This indicates that the center vector is used to update the sample. This represents the preset minimum sample weight. This represents the preset maximum value of the sample weights. This represents the average of the sample weights corresponding to the updated samples of each center vector within a preset time range, or the average of the sample weights corresponding to the updated samples of the center vector within the most recent preset time window. This represents the variance of the sample weights corresponding to the updated samples of each center vector within a preset time range. This represents the magnitude function for limiting numerical values, used to restrict the values between the minimum and maximum values of the sample weights. This represents the preset normalization weights, used to adjust the degree to which the confusion margin amplifies or enhances the sample weights. This represents a nonlinear mapping function.
[0190] S807. Calculate the weighted average of the query vectors in each center vector update sample according to the sample weights to obtain the update vector corresponding to the true center vector.
[0191] In this embodiment, the sample weights in each center vector update sample can be used to calculate a weighted average of the query vectors in each center vector update sample, thus obtaining the update vector corresponding to the true center vector. This update vector represents the change in the true center vector and is used to characterize the direction and magnitude of the change in the true center vector.
[0192] S808. Update the weights according to the preset center vector, and perform weighted fusion of the real center vector and the updated vector to obtain the updated real center vector.
[0193] In this embodiment, the real center vector and the updated vector can be weighted and fused using a preset center vector update weight to obtain the updated real center vector, thereby realizing the update of the real center vector.
[0194] In some embodiments, the updated true center vector can be calculated using the following formula:
[0195] In this embodiment, This represents the updated true center vector. This indicates that the preset center vector is updated with weights. Greater than zero and less than or equal to 1, Represents the true center vector. This indicates that the center vector updates the query vector in the sample. This represents the sum of sample weights for all center vector update samples.
[0196] In this embodiment, the larger the sample weight corresponding to the center vector update sample, the greater the confusion level of the center vector update sample. This center vector update sample is closer to the easily confused class, which refers to samples that are both close to the true center vector and the incorrect center vector, i.e., difficult to distinguish. The larger the sample weight of an easily confused center vector update sample, the greater its contribution to the weighted average, causing the true center vector to move faster away from the easily confused center vector (incorrect center vector), thereby improving the distinguishability between the two types of center vectors and reducing confusion. In other words, center vector update samples with larger sample weights can more quickly separate the true class from the easily confused class. Simultaneously, the preset center vector update weights are used... (Small step size) and the numerical constraint amplitude function used to limit the value between the minimum and maximum sample weights. This can avoid restricting ω(x) to... to Within the specified interval, the model avoids assigning excessive weights to a few extremely difficult-to-distinguish samples, preventing the model from being biased by a few outliers. This prevents the model from drastically changing due to a few batches of difficult samples, thus suppressing overfitting and making updates more stable. When the center vector updates the samples and they are no longer difficult to distinguish, the confusion margin is minimized. At this point, the sample weights either fall back or approach 1, i.e. This embodiment enables weighted incremental updates prioritizing difficult-to-dispose-of-intention samples. Specifically, it selects difficult-to-dispose-of-intention samples that are easily confused with the true intent as the core optimization targets, assigning them higher sample weights based on the confusion margin to strengthen their guiding role in center vector updates. Furthermore, it employs an incremental update method, performing only local, small-amplitude center vector iterations on relevant intent categories and parent clusters, eliminating the need for full database reconstruction and achieving efficient and stable intent discrimination optimization.
[0197] In some embodiments, a pre-set confidence threshold can be automatically fine-tuned based on actual operational data via a sliding window. Temperature coefficient, upper limit on the number of candidate intent vectors, and splicing budget (expected length L) budget This enables adaptive parameter adjustment.
[0198] In some embodiments, the center vector is updated whenever the intent confidence is less than or equal to a preset confidence threshold, or when a user error message is received. Specifically, only the list to be updated is updated with insertion, deletion, and modification operations; the similar nearest neighbor table and the center vector of the parent cluster are locally refreshed within the corresponding intent vector set or parent cluster (using the incremental update or exponential moving average EMA method described above), without needing to rebuild the entire intent library. Simultaneously, key metrics are continuously monitored, including but not limited to follow-up question rate, top obfuscation pairs, token consumption and latency, and parent layer hit rate; if any key metric exceeds a preset rollback threshold, all parameters are immediately rolled back to the previous stable version. These parameters include, but are not limited to, the center vector and the preset confidence threshold. Temperature coefficient, upper limit of the number of candidate intent vectors, and expected length L budge The sample that triggers the rollback is marked as high priority, added to the sample to be updated, and then re-updated to achieve minimal write-back of the sample to be updated and monitoring of key indicators.
[0199] In this embodiment, the follow-up question rate refers to the proportion of all conversations in which users raise errors or ask follow-up questions when they find the target intent is not accurate enough. Top obfuscation pairs refer to the data composed of different query vectors that are most easily confused. Token consumption and latency refer to the number of tokens consumed by the intent recognition model when performing intent matching or recognition, and the response time taken for a user to initiate a query and obtain the target intent. Parent layer hit rate refers to the success rate of retrieving a set of candidate intent vectors that match the query vector in the parent layer coarse retrieval stage.
[0200] In some embodiments, the method of this embodiment can be deployed in the intent control module of an AI mobile phone to coordinate intelligent agent question answering and mobile phone control requests (such as dialing, sending text messages, system settings and on / off control, camera / navigation / payment function activation, app deep linking, etc.). In scenarios where multiple applications (Apps) and various tools are actually accessed, the hierarchical retrieval mechanism first locates the core topic at the parent cluster level, and then completes intent determination at the child layer with a constant number of candidates. Combined with the key point compression and structured output function of multi-turn dialogue, the average token consumption and latency do not increase with the increase of the number of arbitrary graphs. Even if the number of intents expands from dozens to thousands, a stable interactive experience can still be maintained. The online feedback mechanism performs weighted small-step incremental correction for easily confused intents, effectively reducing misrouting and repeated clarification. New intents can take effect through incremental index updates without retraining the model or rebuilding the entire library, greatly reducing the cost of rule maintenance. Key point compression and minimum necessary upload strategies can avoid transmitting long dialogue history and irrelevant content, saving uplink traffic and terminal device power consumption. Overall, this embodiment achieves low-latency, low-cost, evolvable, and auditable intent-based central control scheduling on the mobile phone side, and can adapt to multi-agent collaboration and complex application ecosystem scenarios.
[0201] This embodiment provides an intent recognition method, specifically an intent distribution method that integrates hierarchical retrieval and context compression. The method constructs a hierarchical vector index offline, performs coarse retrieval based on dynamically weighted parent cluster centers, and performs fine retrieval of a constant-level candidate set in the sub-layer, effectively solving the technical problem of linear expansion of the candidate set size and the number of arbitrary graphs. In the online intent recognition stage, key points of multi-turn dialogue content and candidate intents are compressed to generate a simplified context for intent determination. This context is input into a large model for constraint-based generation, ultimately outputting a structured result containing intent, confidence level, and determination criteria. This method significantly reduces computational overhead and token consumption, improves the accuracy, interpretability, and overall system evolution capability of intent determination, and is suitable for mobile terminal central control scheduling in scenarios with massive intents.
[0202] The method provided in this embodiment also includes hierarchical vector retrieval and candidate sparsification. Specifically, by performing a coarse search only at the parent cluster center level, a small number of target parent clusters are selected. Subsequently, intent vector similarity is calculated only within the child nodes of the selected parent clusters, and a combination strategy of threshold filtering and Top-k sorting is adopted to output a candidate intent set of constant size. This method effectively solves the technical problems of excessive latency and uncontrollable token costs caused by the linear growth of the candidate set size to the total graph size in traditional retrieval, thus ensuring system operating efficiency.
[0203] The method provided in this embodiment also includes a dialogue key point compression and structured generation method for intent determination. Specifically, it performs referential resolution and time decay processing on multi-turn historical dialogue content to accurately extract key information points related to the current intent determination; it aligns the extracted key information points with each candidate intent, and through near-duplicate and redundant processing, selects 1-2 distinguishable key points for each candidate intent; within a fixed token budget, the above key points are organized into a constrained context and input into a large model, requiring it to output a structured result containing intent ID, confidence level, and explanation of the determination criteria. This method effectively solves the problem that traditional general summarization methods easily introduce irrelevant noise, resulting in high token costs and low intent determination accuracy, achieving accurate and interpretable intent determination, while significantly reducing unnecessary interactive clarification operations.
[0204] In some embodiments, a unified process for hierarchical vector retrieval and candidate sparsity is implemented. The data objects in this process are a set of parent cluster centers, a user query representation, and child intent nodes corresponding to each parent cluster. The set of parent cluster centers refers to the set of center vectors corresponding to each intent vector set. The user query representation can be the query vector corresponding to the user query information. The child intent nodes corresponding to each parent cluster refer to the intent vectors within each intent vector set. The technical means to implement the unified process for hierarchical vector retrieval and candidate sparsity include: performing a coarse search only at the parent cluster center level to select a small number of target parent clusters; subsequently, calculating and scoring intent similarity only within the child nodes of the selected parent clusters, and using threshold filtering + Top-k sorting to output a candidate intent set of constant size. The problem solved by the unified process for hierarchical vector retrieval and candidate sparsity is that in traditional retrieval methods, the size of the candidate set grows linearly with the total amount of the graph, leading to excessively high system latency and uncontrollable token costs. The technical benefits of the unified process of hierarchical vector retrieval and candidate sparsification are: the size of the candidate set and the length of the context splicing are insensitive to the total amount of intent, the retrieval path is stable, the boundary sample judgment has little jitter, and it can be accurately adapted to mobile central control scenarios with massive amounts of intent.
[0205] In some embodiments, key point compression and structured judgment for multi-turn dialogues are implemented. The data and objects involved in key point compression and structured judgment for multi-turn dialogues can be: the content of recent multi-turn dialogues, the definition of each candidate intent, its usage boundaries, and common expressions. The technical means to implement key point compression and structured judgment for multi-turn dialogues can be: performing referential resolution and time decay processing on multi-turn historical dialogues to accurately extract key information points related to the current intent judgment; aligning the extracted key information points with each candidate intent one by one, and through near-duplicate and redundant processing, selecting 1-2 distinguishable key points for each candidate intent; within a fixed token budget, organizing the above key points into a constrained context and inputting it into a large model, requiring it to output a structured result containing intent ID, confidence level, and explanation of the judgment criteria. The problem solved by key point compression and structured judgment for multi-turn dialogues is that traditional general summarization or direct dialogue splicing methods easily introduce a large amount of irrelevant content, leading to off-topic intent judgment and high token costs. The technical effects of key point compression and structured judgment for multi-turn dialogues can be that the context is focused on distinguishable key points, the intent judgment process is traceable and auditable, and the accuracy and stability of intent judgment are maintained within a fixed token budget, effectively reducing repeated clarification operations and misrouting.
[0206] It should be noted that the advantages of the solution provided in this embodiment compared to the prior art include at least the following: integrated link rather than single-point optimization, decoupling of cost and scale, interpretable and operable judgment results, and easy maintenance and rapid evolution.
[0207] In this embodiment, hierarchical retrieval, candidate sparsification, multi-round key point compression, structured judgment, follow-up questions, and feedback are integrated and completed synchronously within the same inference chain. Compared to existing solutions that separate and process retrieval, key point compression, intent judgment, and classification into independent steps, the solution provided in this embodiment can collaboratively constrain the context scale within a single inference chain, significantly reducing the cost of manual rule maintenance and improving the overall process's synergy and operational efficiency, thus achieving integrated chain optimization rather than single-point optimization.
[0208] In this embodiment, a two-layer strategy of parent-layer coarse detection + child-layer threshold filtering or Top-k sorting is used to stably control the size of candidate intents to a constant level of k, thereby keeping the token budget for context splicing within a fixed range (e.g., 600–800 tokens). Compared to traditional solutions where the number of candidates grows linearly with the size of the graph, even if the number of intents expands from hundreds to thousands, the solution provided in this embodiment can still stably maintain low latency and predictable resource consumption, ensuring system performance stability and achieving cost and scale decoupling.
[0209] In this embodiment, the output is a structured result containing intent identifiers, confidence levels, and explanations of the judgment criteria, while retaining the source markers of candidate key points to achieve traceability of the judgment process. Compared to a black-box output that only provides classification and scoring, this structured result not only facilitates quality audits, compliance audits, and A / B testing, but also supports the refined operation of online judgment thresholds and token budgets, improving system manageability and achieving interpretable and operable judgment results.
[0210] In this embodiment, when adding or adjusting intents, only the sub-layer intent nodes and their corresponding adjacency relationships need to be written / updated. Combined with a small-step online write-back mechanism, the intent boundaries are continuously calibrated without large-scale system modifications. Compared to traditional solutions that require retraining the classifier or rebuilding the entire index, the solution provided in this embodiment can achieve rapid activation of new intents while ensuring service continuity, and stabilize the long-term performance of the system. This significantly reduces system maintenance costs and evolution difficulty, achieving easy maintenance and rapid evolution.
[0211] Figure 9 A flowchart illustrating an intent recognition method according to another embodiment of this application is shown. As shown, in some embodiments, the method may include an offline phase and an online phase. The offline phase is a stage of static construction and preparation work completed in advance before the formal intent recognition service is performed. The online phase is a dynamic reasoning and optimization process executed in real time when the system is running and the user actually initiates a query.
[0212] As shown in the figure, in the offline phase, the method may include: inputting candidate intent-related descriptions into the embedding model Enc, which outputs multiple intent vectors; performing hierarchical clustering on the multiple intent vectors, i.e., executing B11, to divide the multiple intent vectors into multiple parent clusters and obtain an adjacency list; and dynamically weighting the parent cluster centers, i.e., executing B12, to obtain the parent cluster centers corresponding to each parent cluster. Furthermore, cluster evaluation and update B13 can be periodically triggered to dynamically adjust the weighting of the parent cluster centers and update the adjacency list.
[0213] In the offline phase of this embodiment, multiple intent vectors can include i intent vectors, where i is an integer greater than 2, and the multiple intent vectors can be intent vector v1, intent vector v2, ..., intent vector vi. Hierarchical clustering of the multiple intent vectors yields multiple parent clusters, which can include p parent clusters, where p is an integer greater than 2, and the multiple parent clusters can be parent cluster 1, ..., parent cluster p. The number of parent cluster centers corresponding to the multiple parent clusters is also p, and the multiple parent cluster centers can be parent cluster C1, ..., parent cluster Cp. The descriptions related to candidate intents can be descriptions corresponding to each intent in the intent pool or intent library. A parent cluster can be the aforementioned set of intent vectors, and the parent cluster center can be the aforementioned center vector. The adjacency list can be the aforementioned parent-child relationship table and similar nearest neighbor relationship table. This parent-child relationship table is ParentID→[ChildIDs], where ParentID represents the identifier (ID) corresponding to the parent cluster (set of intent vectors), and [ChildIDs] represents an array, list, or set of identifiers (IDs) corresponding to all child nodes (intent vectors) within the intent vector set. The similar nearest neighbor table is ChildID→[NeighborIDs]. ChildID represents the identifier (ID) corresponding to a single intent vector, and [NeighborIDs] represents the array, list, or set of IDs corresponding to the intent vector of the current ChildID, selected by cosine similarity and kNN, which are the k most similar other intent vectors in the same parent cluster.
[0214] In this embodiment, the weights involved in the dynamic weighting of the parent cluster center can be obtained through the aforementioned S301 to S302, and the dynamic weighting of the parent cluster center can be implemented through S303.
[0215] In the online phase of this embodiment, the method may include: embedding user input information into model Enc to obtain user input vector q; performing coarse parent cluster retrieval B21, i.e., performing coarse parent cluster retrieval based on user input vector q and parent cluster center to obtain parent cluster center matching user input vector q, and determining the candidate intent vector set corresponding to the parent cluster center; next, performing B22, i.e., performing sub-layer fine retrieval, specifically, retrieving candidate intent Pk matching user input vector q from the candidate intent vector set. Then, performing B23, i.e., performing context compression, specifically, performing referential resolution and time decay on historical dialogues to extract key information points related to the intent; aligning the key information points with the candidate intent Pk, and performing deduplication and redundancy removal to generate a focused and concise context. Then, the main model generates the confidence score of each intent based on the context. Finally, performing B24, i.e., determining whether the confidence score is greater than a threshold; if so, outputting the intent; if not, storing the sample of the intent in a hard example buffer to generate a list to be updated. In addition, based on the list of cases to be updated, weighted incremental updates can be performed with priority given to cases with high burden, and cluster evaluation and updates can be triggered.
[0216] In this embodiment, the user input vector q can be the query vector mentioned above, and the context can include dialogue key points, candidate key points, and the current round's original statement. Dialogue key points refer to the key information points accurately extracted from multi-round historical dialogue content through referential resolution and time decay processing, which are relevant to the current intent determination. Candidate key points refer to aligning the intent definition, usage boundaries, common expressions, and key information points of candidate intents Pk one by one, selecting only phrases or sentences that can help distinguish these candidate intents. The current round's original statement refers to the user's current input information. The intent confidence is the aforementioned intent confidence, and the threshold here refers to a pre-set confidence threshold. The weighted incremental update prioritizing difficult-to-handle examples can include the aforementioned S801 to S808. The main model refers to a main model of the intent recognition model.
[0217] Figure 10 A schematic diagram of an intent recognition device provided in an embodiment of this application is shown. As shown, the intent recognition device 900 may include an acquisition module 910, a first query module 920, a second query module 930, an intent extraction module 940, an alignment module 950, and an intent determination module 960.
[0218] The acquisition module 910 is used to acquire the query vector corresponding to the user's query information.
[0219] The first query module 920 is used to query a set of candidate intent vectors that match the query vector from multiple sets of intent vectors.
[0220] The second query module 930 is used to query candidate intent vectors that match the query vector from the candidate intent vector set.
[0221] The intent extraction module 940 is used to extract historical key intent information from multiple rounds of historical user dialogue.
[0222] Alignment module 950 is used to align the historical key intent information with the candidate intent information corresponding to the candidate intent vector to obtain candidate intent points used to distinguish different candidate intent information.
[0223] The intent determination module 960 is used to determine the target intent from the candidate intent information based on the user query information, the historical key intent information and the candidate intent points.
[0224] In some embodiments, the candidate intent vector set is at least one of the intent vector sets, which are obtained by the intent recognition device 900 in the following manner: Feature mapping is performed on multiple pre-stored intents to obtain intent vectors corresponding to the multiple intents; Calculate the intent similarity between every two intent vectors; Based on the intent similarity, the intent vector is divided into multiple intent vector sets.
[0225] In some embodiments, when the second query module 930 queries the candidate intent vector matching the query vector from the candidate intent vector set, it is specifically used for: Based on preset normalization parameters, each center similarity is normalized to obtain the retrieval weight corresponding to each set of intent vectors. The center similarity is the vector similarity between the query vector and the center vector corresponding to each set of candidate intent vectors. Based on the retrieval weight, an intermediate intent vector is selected from the set of candidate intent vectors; Calculate the candidate similarity between the query vector and the intermediate intent vector; The candidate intent vector is determined from the intermediate intent vector based on the candidate similarity.
[0226] In some embodiments, the center vector corresponding to the intent vector set is obtained by the intent recognition device 900 in the following manner: Based on the hit frequency, most recent update time, and preset weight parameters of each intent vector in the intent vector set within a preset time window, calculate the first intent weight corresponding to each intent vector; The first intent weight is normalized to obtain the second intent weight; The intent vectors are weighted according to the second intent weight to obtain the center vector corresponding to the intent vector set.
[0227] In some embodiments, in response to updating the intent vector, the intent recognition device 900 is further configured to: Obtain the updated intent vector set corresponding to the intent vector set, wherein the updated intent vector set includes one or more updated intent vectors that have been updated; The center vector corresponding to the set of intent vectors is updated based on the set of updated intent vectors and the preset update coefficients.
[0228] In some embodiments, when the intent recognition device 900 updates the center vector corresponding to the intent vector set according to the updated intent vector set and a preset update coefficient, it is specifically used for: The update magnitude corresponding to the set of update intent vectors is determined based on the number of update intent vectors in the set of update intent vectors. Calculate the current center vector corresponding to each intent vector set based on the current intent vector in the intent vector set; If the update magnitude is less than or equal to a preset update magnitude threshold, a moving average is calculated on the current center vector and the historical center vector of the intent vector set before the update, according to a preset first update weight, to obtain the updated center vector of the intent vector set. If the update magnitude is greater than a preset update magnitude threshold, the current center vector and the historical center vector of the intent vector set before the update are weighted and averaged according to the preset second update weight, the intent vector set before the update, and the number of updated intent vectors in the updated intent vector set to obtain the updated center vector of the intent vector set.
[0229] In some embodiments, when the update magnitude is greater than a preset update magnitude threshold, the updated center vector of the intent vector set is calculated using the following formula:
[0230] in, This represents the updated center vector of the intent vector set. This represents the historical center vector of the intent vector set before the update. This indicates the second updated weight. This represents the set of update intent vectors. This indicates the number of update intention vectors within the set of update intention vectors. The set of update intent vectors represents the first... An update intent vector, It is a positive integer. The number of update intention vectors within the set of update intention vectors that is greater than or equal to 1 and less than or equal to the number of update intention vectors. This represents the sum of all update intent vectors within the set of update intent vectors. This indicates the number of intent vectors in the intent vector set before the update.
[0231] In some embodiments, the intent recognition device 900 is further configured to: Calculate the intra-cluster similarity between different intent vectors in each intent vector set, and calculate the average intra-cluster similarity for each intent vector set based on the intra-cluster similarity. Calculate the cross-cluster similarity between the first intent vector and the second intent vector, which belong to any two different sets of intent vectors; Based on the cross-cluster similarity, determine the maximum cross-cluster similarity corresponding to each intent vector; If the average intra-cluster similarity is less than a preset intra-cluster threshold, and / or the maximum cross-cluster similarity is greater than a preset inter-cluster threshold, the intent vector set is re-divided into at least one intent vector set based on the average intra-cluster similarity and the maximum cross-cluster similarity, such that the average intra-cluster similarity is greater than or equal to the intra-cluster threshold, and the maximum cross-cluster similarity is less than or equal to the inter-cluster threshold.
[0232] In some embodiments, when the intent extraction module 940 is used to extract historical key intent information from multi-turn historical user dialogues, it is specifically used for: Extract key information related to user intent from the multi-round historical user dialogues. The key information includes at least one of user needs, user confirmation information, user denial information, preference information, and constraints. Based on the dialogue time corresponding to the key information, a time decay weight is assigned to the key information. Based on the time decay weight and whether the key information is stated directly by the user, conflicting information in the key information is merged to obtain the historical key intent information.
[0233] In some embodiments, when the intent determination module 960 determines the target intent from the candidate intent information based on the user query information, the historical key intent information, and the candidate intent points, it is specifically used for: Based on the user query information, the historical key intent information, and the candidate intent points, contextual prompt information is generated; The contextual cue information is input into the intent recognition model so that the intent recognition model performs intent matching based on the contextual cue information and outputs at least one set of candidate intent information. The candidate intent information includes the candidate intent, the intent confidence level corresponding to the candidate intent, and the generation basis information of the candidate intent. The generation basis information of the candidate intent is at least one of the historical key intent information and the user query information. The confidence level of the intent is compared with a preset confidence threshold; If the confidence level of the intent is greater than the preset confidence threshold, the candidate intent corresponding to the confidence level of the intent is determined as the target intent.
[0234] In some embodiments, when the intent confidence level is less than or equal to the preset confidence threshold, or when a user error message is received, the intent recognition device 900 is further configured to: Record the query vector, the set of true candidate intent vectors corresponding to the query vector, and the set of erroneous candidate intent vectors corresponding to the target intent to obtain the center vector update sample; Calculate the first similarity between the query vector and the true center vector corresponding to the set of true candidate intent vectors; Calculate the second similarity between the query vector and at least one error center vector, wherein the error center vector is the center vector corresponding to the set of error candidate intent vectors corresponding to the target intent; Determine the similarity difference between the first similarity and the second similarity; Based on the largest similarity difference, determine the confusion margin corresponding to the center vector update sample; The confusion margin is normalized to obtain the sample weights corresponding to the center vector update samples; Based on the sample weights, the query vectors in each of the center vector update samples are weighted and averaged to obtain the update vector corresponding to the true center vector. The real center vector and the updated vector are weighted and fused according to the preset center vector update weight to obtain the updated real center vector.
[0235] In some embodiments, the confusion margin is calculated using the following formula:
[0236] in, Update the samples for the center vector. This represents the set of erroneous candidate intent vectors. Represents the set of true candidate intent vectors. This represents the query vector. Represents the maximum value function. Used to calculate the similarity between two vectors. Represents the error center vector. Represents the true center vector; The sample weights are calculated using the following formula:
[0237] in, This indicates that the center vector updates the sample weights corresponding to the samples. This represents the preset minimum sample weight. This represents the preset maximum value of the sample weights. This represents the mean of the sample weights within a preset time range. This represents the variance of the sample weights within a preset time range. This represents a numerical constraint magnitude function, used to limit the value between the minimum and maximum values of the sample weights. This represents the preset normalized weights. Represents a nonlinear mapping function; The updated true center vector is calculated using the following formula:
[0238] in, This represents the updated true center vector. This indicates that the preset center vector is updated with weights. Greater than zero and less than or equal to 1, Represents the true center vector. This indicates that the center vector updates the query vector in the sample. This represents the sum of the sample weights of all the center vector update samples.
[0239] Figure 11 A schematic diagram of the hardware structure of the intent recognition device provided in an embodiment of this application is shown.
[0240] The intent recognition device may include a processor 301 and a memory 302 storing computer program instructions.
[0241] Specifically, the processor 301 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0242] Memory 302 may include mass storage for data or instructions. For example, and not limitingly, memory 302 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 302 may include removable or non-removable (or fixed) media, or memory 302 may be non-volatile solid-state memory. Memory 302 may be internal or external to the integrated gateway disaster recovery device.
[0243] In one instance, memory 302 may be read-only memory (ROM). In one instance, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0244] Memory 302 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Therefore, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure.
[0245] The processor 301 reads and executes computer program instructions stored in the memory 302 to achieve... Figure 1 The intent recognition method in the illustrated embodiment.
[0246] In one example, the intent recognition device may also include a communication interface 303 and a bus 304. As shown in the figure, the processor 301, memory 302, and communication interface 303 are connected via the bus 304 and communicate with each other.
[0247] The communication interface 303 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0248] Bus 304 includes hardware, software, or both, that couples components of an online data traffic metering device together. For example, and not as a limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 304 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.
[0249] This intent recognition device can execute the online data traffic billing method described in this application embodiment based on currently blocked spam SMS messages and SMS messages reported by users, thereby achieving a combination of... Figure 1 The described intent recognition method.
[0250] Furthermore, in conjunction with the intent recognition methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the intent recognition methods in the above embodiments.
[0251] This application also provides a computer program product, including a computer program that, when executed by a processor, implements any of the intent recognition methods described in the above embodiments.
[0252] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0253] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0254] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0255] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowchart illustrations, and combinations of blocks in the block diagrams and / or flowchart illustrations, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.
[0256] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. An intent recognition method, characterized in that, include: Obtain the query vector corresponding to the user's query information; From multiple sets of intent vectors, query a set of candidate intent vectors that match the query vector; Query the candidate intent vectors from the set of candidate intent vectors that match the query vector; Extract key historical intent information from multiple rounds of historical user dialogues; Align the historical key intent information with the candidate intent information corresponding to the candidate intent vector to obtain candidate intent points used to distinguish different candidate intent information; Based on the user query information, the historical key intent information, and the candidate intent points, the target intent is determined from the candidate intent information.
2. The method according to claim 1, characterized in that, The candidate intent vector set is at least one of the intent vector sets, which are obtained through the following method: Feature mapping is performed on multiple pre-stored intents to obtain intent vectors corresponding to the multiple intents; Calculate the intent similarity between every two intent vectors; Based on the intent similarity, the intent vector is divided into multiple intent vector sets.
3. The method according to claim 2, characterized in that, Querying the candidate intent vector from the set of candidate intent vectors that matches the query vector includes: Based on preset normalization parameters, each center similarity is normalized to obtain the retrieval weight corresponding to each set of intent vectors. The center similarity is the vector similarity between the query vector and the center vector corresponding to each set of candidate intent vectors. Based on the retrieval weight, an intermediate intent vector is selected from the set of candidate intent vectors; Calculate the candidate similarity between the query vector and the intermediate intent vector; The candidate intent vector is determined from the intermediate intent vector based on the candidate similarity.
4. The method according to claim 3, characterized in that, The center vector corresponding to the intent vector set is obtained in the following way: Based on the hit frequency, most recent update time, and preset weight parameters of each intent vector in the intent vector set within a preset time window, calculate the first intent weight corresponding to each intent vector; The first intent weight is normalized to obtain the second intent weight; The intent vectors are weighted according to the second intent weight to obtain the center vector corresponding to the intent vector set.
5. The method according to claim 3, characterized in that, In response to updating the intent vector, the method further includes: Obtain the updated intent vector set corresponding to the intent vector set, wherein the updated intent vector set includes one or more updated intent vectors that have been updated; The center vector corresponding to the set of intent vectors is updated based on the set of updated intent vectors and the preset update coefficients.
6. The method according to claim 5, characterized in that, Based on the set of updated intent vectors and preset update coefficients, update the center vector corresponding to the set of intent vectors, including: The update magnitude corresponding to the set of update intent vectors is determined based on the number of update intent vectors in the set of update intent vectors. Calculate the current center vector corresponding to each intent vector set based on the current intent vector in the intent vector set; If the update magnitude is less than or equal to a preset update magnitude threshold, a moving average is calculated on the current center vector and the historical center vector of the intent vector set before the update, according to a preset first update weight, to obtain the updated center vector of the intent vector set. If the update magnitude is greater than a preset update magnitude threshold, the current center vector and the historical center vector of the intent vector set before the update are weighted and averaged according to the preset second update weight, the intent vector set before the update, and the number of updated intent vectors in the updated intent vector set to obtain the updated center vector of the intent vector set.
7. The method according to claim 6, characterized in that, If the update magnitude is greater than a preset update magnitude threshold, the updated center vector of the intent vector set is calculated using the following formula: , in, This represents the updated center vector of the intent vector set. This represents the historical center vector of the intent vector set before the update. This indicates the second updated weight. This represents the set of update intent vectors. This indicates the number of update intention vectors within the set of update intention vectors. The set of update intent vectors represents the first... An update intent vector, It is a positive integer. The number of update intention vectors within the set of update intention vectors that is greater than or equal to 1 and less than or equal to the number of update intention vectors. This represents the sum of all update intent vectors within the set of update intent vectors. This indicates the number of intent vectors in the intent vector set before the update.
8. The method according to claim 3, characterized in that, The method further includes: Calculate the intra-cluster similarity between different intent vectors in each intent vector set, and calculate the average intra-cluster similarity for each intent vector set based on the intra-cluster similarity. Calculate the cross-cluster similarity between the first intent vector and the second intent vector, which belong to any two different sets of intent vectors; Based on the cross-cluster similarity, determine the maximum cross-cluster similarity corresponding to each intent vector; If the average intra-cluster similarity is less than a preset intra-cluster threshold, and / or the maximum cross-cluster similarity is greater than a preset inter-cluster threshold, the intent vector set is re-divided into at least one intent vector set based on the average intra-cluster similarity and the maximum cross-cluster similarity, such that the average intra-cluster similarity is greater than or equal to the intra-cluster threshold, and the maximum cross-cluster similarity is less than or equal to the inter-cluster threshold.
9. The method according to claim 1, characterized in that, Extract key historical intent information from multiple rounds of user dialogue, including: Extract key information related to user intent from the multi-round historical user dialogues. The key information includes at least one of user needs, user confirmation information, user denial information, preference information, and constraints. Based on the dialogue time corresponding to the key information, a time decay weight is assigned to the key information. Based on the time decay weight and whether the key information is stated directly by the user, conflicting information in the key information is merged to obtain the historical key intent information.
10. The method according to claim 9, characterized in that, Based on the user query information, the historical key intent information, and the candidate intent points, the target intent is determined from the candidate intent information, including: Based on the user query information, the historical key intent information, and the candidate intent points, contextual prompt information is generated; The contextual cue information is input into the intent recognition model so that the intent recognition model performs intent matching based on the contextual cue information and outputs at least one set of candidate intent information. The candidate intent information includes the candidate intent, the intent confidence level corresponding to the candidate intent, and the generation basis information of the candidate intent. The generation basis information of the candidate intent is at least one of the historical key intent information and the user query information. The confidence level of the intent is compared with a preset confidence threshold; If the confidence level of the intent is greater than the preset confidence threshold, the candidate intent corresponding to the confidence level of the intent is determined as the target intent.
11. The method according to claim 10, characterized in that, If the intent confidence level is less than or equal to the preset confidence threshold, or if a user error message is received, the method further includes: Record the query vector, the set of true candidate intent vectors corresponding to the query vector, and the set of erroneous candidate intent vectors corresponding to the target intent to obtain the center vector update sample; Calculate the first similarity between the query vector and the true center vector corresponding to the set of true candidate intent vectors; Calculate the second similarity between the query vector and at least one error center vector, wherein the error center vector is the center vector corresponding to the set of error candidate intent vectors corresponding to the target intent; Determine the similarity difference between the first similarity and the second similarity; Based on the largest similarity difference, determine the confusion margin corresponding to the center vector update sample; The confusion margin is normalized to obtain the sample weights corresponding to the center vector update samples; Based on the sample weights, the query vectors in each of the center vector update samples are weighted and averaged to obtain the update vector corresponding to the true center vector. The real center vector and the updated vector are weighted and fused according to the preset center vector update weight to obtain the updated real center vector.
12. The method according to claim 11, characterized in that, The confusion margin is calculated using the following formula: , in, Update the samples for the center vector. This represents the set of erroneous candidate intent vectors. Represents the set of true candidate intent vectors. This represents the query vector. Represents the maximum value function. Used to calculate the similarity between two vectors. Represents the error center vector. Represents the true center vector; The sample weights are calculated using the following formula: , in, This indicates that the center vector updates the sample weights corresponding to the samples. This represents the preset minimum sample weight. This represents the preset maximum value of the sample weights. This represents the mean of the sample weights within a preset time range. This represents the variance of the sample weights within a preset time range. This represents a numerical constraint magnitude function, used to limit the value between the minimum and maximum values of the sample weights. This represents the preset normalized weights. Represents a nonlinear mapping function; The updated true center vector is calculated using the following formula: , in, This represents the updated true center vector. This indicates that the preset center vector is updated with weights. Greater than zero and less than or equal to 1, Represents the true center vector. This indicates that the center vector updates the query vector in the sample. This represents the sum of the sample weights of all the center vector update samples.
13. An intent recognition device, characterized in that, The device includes: The acquisition module is used to obtain the query vector corresponding to the user's query information; The first query module is used to query a set of candidate intent vectors that match the query vector from multiple intent vector sets; The second query module is used to query candidate intent vectors that match the query vector from the candidate intent vector set; The intent extraction module is used to extract key historical intent information from multiple rounds of historical user dialogue. The alignment module is used to align the historical key intent information with the candidate intent information corresponding to the candidate intent vector to obtain candidate intent points used to distinguish different candidate intent information. The intent determination module is used to determine the target intent from the candidate intent information based on the user query information, the historical key intent information, and the candidate intent points.
14. An intent recognition device, characterized in that, The device includes: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the method as described in any one of claims 1-12.
15. A computer storage medium, characterized in that, The computer storage medium stores computer program instructions, which, when executed by a processor, implement the method as described in any one of claims 1-12.
16. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1-12.
