User intention recognition method, system and equipment and storage medium
By using semantic vector matching and structured prompts, the problem of real-time response and dynamic updating of intent recognition in existing technologies is solved, achieving efficient intent recognition in resource-constrained or high-frequency iteration scenarios, and improving the accuracy and timeliness of recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHENGDU BOSS INNOVATION TECH CO LTD
- Filing Date
- 2026-01-06
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies struggle to balance real-time response and dynamic knowledge updates in intent recognition, especially in resource-constrained or high-frequency iteration scenarios where applications are limited. Rule engines have poor generalization capabilities, and deep learning models rely on large-scale labeled data and are prone to domain drift and illusions.
By quickly retrieving a pre-defined vector database through semantic vector similarity matching, structured prompt words are generated and then parsed by a large language model, avoiding model retraining and achieving dynamic knowledge updates and efficient recognition.
It achieves efficient intent recognition in resource-constrained or high-frequency iteration scenarios without retraining the model, while taking into account real-time response and dynamic knowledge updates, thus improving the accuracy and timeliness of recognition.
Smart Images

Figure CN121920387A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large language model technology, and more specifically, to a user intent recognition method, system, device, and storage medium. Background Technology
[0002] With the rapid development of artificial intelligence technology, human-computer interaction systems have been widely used in smart homes, smart appliances, voice assistants, and other scenarios. As one of the core tasks of Natural Language Understanding (NLU), Intent Classification and Slot Filling aim to identify the user's operational intent from their natural language input and extract key semantic parameters (i.e., slot values) to provide structured instructions for subsequent action execution or dialogue management.
[0003] Existing technologies mainly rely on rule engines, deep learning models, or large language models to achieve the above-mentioned intent recognition functions, but they still face multiple challenges. For example, relying on rule engines results in poor generalization ability of rule methods and requires a lot of manual maintenance; deep learning models rely on large-scale labeled data, resulting in high cold start costs; while large language models, although capable of zero-shot processing, suffer from unstructured output, are prone to domain drift and illusion, making it difficult to balance real-time response and dynamic knowledge updates in the process of implementing intent recognition functions, thus limiting the application of intent recognition functions in resource-constrained or high-frequency iteration scenarios. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a user intent recognition method, system, device and storage medium, which can quickly retrieve intent and related information in the database through semantic vector similarity matching, generate structured prompt words and pass them to a large language model for parsing, avoid the delay and risk brought by the large language model facing open input, achieve dynamic knowledge update and efficient recognition without retraining the model, take into account real-time response and dynamic knowledge update, and be beneficial for application in resource-constrained or high-frequency iteration scenarios.
[0005] To achieve the above objectives, in a first aspect, embodiments of the present invention provide a user intent recognition method, the method comprising: acquiring a user's question and encoding it to generate a semantic vector; finding multiple preset intent tags corresponding to the semantic vector in a preset vector database; the preset vector database recording the correspondence between preset vectors and preset intent tags; finding corresponding intent information, slot information, and multi-turn dialogue records in a preset relational database based on the multiple preset intent tags; generating intent prompt words based on the intent information, slot information, and multi-turn dialogue records corresponding to the multiple preset intent tags; inputting the intent prompt words into a pre-trained large language model, determining the intent information, slot information, and multi-turn dialogue records corresponding to a target intent tag from the intent information, slot information, and multi-turn dialogue records corresponding to the multiple preset intent tags through the large language model, and analyzing the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag to obtain the intent corresponding to the user's question.
[0006] In this embodiment, user questions are encoded to generate semantic vectors. These semantic vectors are then used to find multiple corresponding preset vectors and preset intent tags in a preset vector database. Based on the found preset intent tags, the corresponding intent information, slot information, and multi-turn dialogue records under the current preset intent tag are retrieved in a preset relational database. This generates prompt words that are then fed to the large language model. The large language model then uses these prompt words to generate the final target intent tag and corresponding intent information and slot information. This method of quickly retrieving intents and slots from the database through semantic vector similarity matching, generating prompt words, and then having the large language model parse them avoids the latency and risks associated with direct exposure to open input. It achieves dynamic updating and efficient recognition of question intent without requiring model retraining, balancing real-time response and dynamic knowledge updates, making it suitable for applications in resource-constrained or high-frequency iteration scenarios.
[0007] In some embodiments, the preset vector database contains user history questions that correspond one-to-one with the preset vectors. Finding multiple preset intent tags corresponding to the semantic vectors in the preset vector database includes: calculating the similarity between the semantic vectors and the preset vectors in the preset vector database; sorting the preset vectors with similarity greater than a preset threshold to the semantic vectors in descending order of similarity, and determining a first preset number of preset vectors that rank first; and determining multiple preset intent tags corresponding to the semantic vectors based on the preset intent tags corresponding to the first preset number of preset vectors that rank first.
[0008] With this setup, each preset vector is mapped to a preset intent tag. Therefore, all intent tags corresponding to the first preset number of records can be quickly extracted by looking up a table. This enables the efficient location of semantic neighbors from massive amounts of historical data, making it easier to find preset intent tags corresponding to semantic vectors that are similar to the user's question.
[0009] In some embodiments, determining the multiple preset intent tags corresponding to the semantic vector based on the preset intent tags corresponding to the first preset number of preset vectors with the highest sorting order includes: taking the preset intent tags corresponding to the first preset number of preset vectors with the highest sorting order as initial preset intent tags, calculating the correlation between the user's historical questions corresponding to the initial preset intent tags and the current user question, sorting the initial preset intent tags in descending order of correlation, and determining the second preset number of initial preset intent tags with the highest sorting order; the second preset number is less than the first preset number; and determining the second preset number of initial preset intent tags with the highest sorting order as the multiple preset intent tags corresponding to the semantic vector.
[0010] This setup rearranges the initial preset intent labels based on relevance, retaining a second preset number of high-confidence candidate preset intent labels. This simplifies the intent labels passed to the large language model, reducing noise interference and lowering the cognitive burden on the large language model to process redundant information, thereby improving the accuracy and timeliness of intent discrimination.
[0011] In some embodiments, the intent information includes an intent name and an intent description, and the slot information includes a slot name, a slot description, and whether the slot is required. Generating intent prompts based on the intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags includes: generating an intent list based on the intent name, intent description, slot name, slot description, and whether the slot is required for each preset intent tag; generating dialogue response examples from the multi-turn dialogue records; and generating intent prompts based on the intent list, the dialogue response examples, and a preset task description, wherein the preset task description instructs the large language model to request additional slot information from the user when it determines that slot information corresponding to a preset intent tag in the intent list is missing.
[0012] This setup enables explicit injection of rules and examples through prompts composed of intent information, slot information, and multi-turn dialogue records. It significantly enhances the consistency of behavior of large language models under complex logical judgments and effectively prevents illegal output or skipping of necessary interaction processes.
[0013] In some embodiments, determining the intent information, slot information, and multi-turn dialogue records corresponding to a target intent tag from the intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags using the large language model includes: analyzing the intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags and the user's question statement to determine whether there is a preset intent tag among the multiple preset intent tags that the user's question statement matches; if there is a preset intent tag that the user's question statement matches, determining the currently matched preset intent tag as the target intent tag and obtaining the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag; if there is no preset intent tag that the user's question statement matches, answering the user's question statement using the large language model.
[0014] With this setup, even without precise keywords, accurate categorization can still be achieved through contextual reasoning. Conversely, if none of the candidate preset intent tags can reasonably explain the current question, such as asking about the weather or telling a joke, it is determined to be a no-hit situation. In this case, the large language model is allowed to deviate from the preset framework and respond freely in a general dialogue mode, ensuring the integrity of the user experience.
[0015] In some embodiments, obtaining the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag includes: determining whether the slot information corresponding to the target intent tag is missing; if the slot information is missing, determining whether the slot information exists in the multi-turn dialogue records corresponding to the target intent tag; if the slot information exists in the multi-turn dialogue records corresponding to the target intent tag, obtaining the slot information corresponding to the target intent tag from the multi-turn dialogue records; if the slot information does not exist in the multi-turn dialogue records corresponding to the target intent tag, asking the user for slot information through the large language model until the user-inputted slot information is obtained, and using the user-inputted slot information as the slot information corresponding to the target intent tag.
[0016] This setup, by determining whether slot information is missing and asking follow-up questions, significantly improves the fault tolerance and smoothness of interaction in scenarios where users express themselves incompletely, ensuring that complex tasks can be completed smoothly.
[0017] In some embodiments, the method further includes: analyzing the intent information, slot information and multi-turn dialogue records corresponding to the target intent tag through the large language model to obtain intent instructions; controlling the device to perform operations and / or broadcasting the intent according to the intent instructions.
[0018] This setup allows a single large language model call to simultaneously generate user communication content and device control commands, greatly simplifying the architecture, reducing latency and resource consumption, and achieving efficient and integrated human-machine collaborative control.
[0019] Secondly, embodiments of the present invention provide a user intent recognition system, the system comprising: an acquisition module, configured to acquire a user's question and encode it to generate a semantic vector; a query module, configured to find multiple corresponding preset intent tags in a preset vector database based on the semantic vector; the preset vector database records the correspondence between preset vectors and preset intent tags; and to find corresponding intent information, slot information, and multi-turn dialogue records in a preset relational database based on the multiple preset intent tags; an analysis module, configured to generate intent prompt words based on the intent information, slot information, and multi-turn dialogue records corresponding to the multiple preset intent tags; input the intent prompt words into a pre-trained large language model, and through the large language model determine the intent information, slot information, and multi-turn dialogue records corresponding to a target intent tag from the intent information, slot information, and multi-turn dialogue records corresponding to the multiple preset intent tags, and analyze the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag to obtain the intent corresponding to the user's question.
[0020] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the user intent recognition method as described in the first aspect.
[0021] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the user intent recognition method as described in the first aspect.
[0022] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0023] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 A flowchart of a user intent recognition method provided in an embodiment of the present invention; Figure 2Offline and online flowcharts for intent recognition provided in embodiments of the present invention; Figure 3 This is a schematic diagram of the functional modules of the user intent recognition system provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the module architecture of an electronic device provided in an embodiment of the present invention.
[0025] Icons: 1000 - User Intent Recognition System; 1100 - Acquisition Module; 1200 - Query Module; 1300 - Analysis Module; 1400 - Output Module; 2000 - Electronic Device; 2100 - Processor; 2200 - Memory; 2300 - Bus; 2400 - Communication Interface. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0027] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0028] It should be noted that 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 one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0029] As described in the background section, the aforementioned intent recognition function currently relies mainly on rule engines, deep learning models, or large language models. However, it still faces multiple challenges. For example, rule engines suffer from poor generalization ability and require extensive manual maintenance; deep learning models rely on large-scale labeled data, resulting in high cold-start costs; while large language models, although capable of zero-shot processing, suffer from unstructured output, domain drift, and illusions. These issues make it difficult to balance real-time response and dynamic knowledge updates during the intent recognition process, limiting the application of intent recognition in resource-constrained or high-frequency iteration scenarios.
[0030] To address this, this invention provides a user intent recognition method that rapidly retrieves intent and related information from a database through semantic vector similarity matching, generates structured prompts, and feeds them into a large language model for parsing. This avoids the latency and risks associated with large language models directly facing open input, achieving dynamic knowledge updates and efficient recognition without requiring model retraining. It balances real-time response and dynamic knowledge updates, making it suitable for applications in resource-constrained or high-frequency iteration scenarios. (See also...) Figure 1 , Figure 1 This is a flowchart of a user intent recognition method provided in an embodiment of the present invention. The user intent recognition method includes steps S100 to S500: S100. Obtain the user's question and encode it to generate a semantic vector.
[0031] In this embodiment, the system first receives natural language input from the user, i.e., the actual question or instruction raised by the user during interaction with the smart device, such as "Help me turn on the range hood and adjust it to the high-heat setting." This raw text serves as the starting point for subsequent processing, carrying all the semantic information of the user's intent. To enable the computer to understand and process this text, an embedding model is used to mathematically transform it, mapping the unstructured language expression into numerical vectors in a high-dimensional space, i.e., semantic vectors. This process differs from simple keyword extraction; instead, it uses a deep learning model to capture the overall contextual semantic features of the sentence, allowing statements with similar meanings but different expressions to exhibit high similarity in the vector space. For example, "Help me turn on the range hood and adjust it to the high-heat setting" and "Increase the fan speed" may have significant literal differences, but semantically they may point to the same operational intent, and their corresponding semantic vectors will be relatively close in distance in the vector space. Another example is when a user asks, "I want to eat a 15-minute chilled egg." Traditional keyword matching would break the sentence down into three keywords: "15 minutes," "chilled," and "egg," and perform a literal matching in the database. The keyword "15-minute sous-vide steamed egg" perfectly matched the search terms. However, it missed "sous-vide 58℃ slow-cooked onsen tamago" because the database's keywords for "slow-cooked onsen tamago" didn't include either "15 minutes" or "slow-vide," only synonyms like "58℃" and "slowcook." As a result, the smart kitchen appliance couldn't find this dish and therefore couldn't automatically activate the corresponding mode. Therefore, this semantic-based rather than literal matching conversion mechanism in this embodiment lays the foundation for subsequent accurate retrieval and intent recognition.
[0032] S200: Find multiple corresponding preset intent tags in the preset vector database based on the semantic vector.
[0033] In this embodiment, a preset vector database records the correspondence between preset vectors and preset intent tags. The generated semantic vectors are then used as query vectors, and an approximate nearest neighbor search operation is performed in a pre-built vector database. This database stores a large number of preset vectors obtained by processing historical user queries using the same embedding model. Each preset vector is associated with a preset intent tag, and multiple preset vectors may be associated with the same preset intent tag, such as `gear_switch` for gear shifting and `door_switch` for door control. By calculating the cosine similarity between the current semantic vector and each preset vector in the preset vector database, a batch of historical samples that are semantically closest are selected—that is, preset vectors. The preset intent tags bound to these preset vectors are then extracted to form a preliminary candidate intent set. This process is equivalent to recalling whether someone has asked a similar question in the past and identifying which specific functional intents it was categorized under, thereby narrowing the judgment range, avoiding reasoning from scratch, and significantly improving response efficiency and accuracy.
[0034] S300: Based on multiple preset intent tags, find the corresponding intent information, slot information, and multi-turn dialogue records in the preset relational database.
[0035] In this embodiment, once the candidate preset intent tags are determined, a preset relational database is accessed to obtain the complete logical definitions and interaction rules behind these tags. The preset relational database organizes data in a structured form, with each record containing a specific description of an intent, allowed slot names and their value constraints, required field descriptions, and typical multi-turn dialogue examples. For example, for the intent `light_switch`, its function is to control the lighting switch, the supported slot is the `switch` state, the enumerated values are limited to "on" or "off", and there are no other additional conditions. For complex intents requiring multiple confirmation steps, such as recipe initiation, a complete question-and-answer process example is provided. In this way, we not only know what a tag is called, but also how to use it, which parameters it depends on, and in what dialogue context it is applicable, providing detailed content support for the next step of constructing guiding prompts.
[0036] It is understood that in this embodiment, by accessing a pre-defined relational database, a metadata filtering process for the recall intent is implemented to prevent domain drift in the general language model. For example, when a user asks "steam the pot," vector retrieval may simultaneously recall "steam mode" and "steam sterilization," which are semantically similar but functionally completely different. In this case, by querying the intent description field in the relational database: "steam mode" is associated with slots such as "cooking and heating" and "time / temperature control," while "steam sterilization" is associated with function definitions such as "cleaning and sterilization" and "high temperature for 15 minutes," thus achieving accurate identification based on the differences in contextual semantics and parameter structure. This secondary verification mechanism based on structured metadata effectively compensates for the risk of misjudgment that may arise from pure semantic retrieval, enabling correct decisions that conform to the logic of the vertical domain among highly similar professional terms, and significantly enhancing domain adaptability in scenarios such as kitchen appliance control.
[0037] For example, when a new functional intent (such as "start fermentation mode") is added, only the metadata such as the intent's definition, example question, and slot constraints need to be entered into a relational database, and its example statement needs to be encoded and stored in a vector database. This allows for automatic recognition and invocation in subsequent processes. Since the entire process does not involve fine-tuning or updating large language models, but rather knowledge injection is achieved through collaboration between two databases, capability expansion can be achieved without interrupting service. For instance, when adding a "steam cleaning" function after a smart home device firmware upgrade, only a few possible user expressions (such as "get a deep cleaning") and their corresponding metadata need to be uploaded during development. This allows for accurate recognition and response in the next request. This lightweight update mechanism, where data is code, completely eliminates the heavy burden of traditional NLU systems relying on large-scale annotation and large language model retraining, enabling support for high-frequency functional iterations and thus achieving dynamic knowledge updates.
[0038] S400: Generate intent prompts based on intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags.
[0039] In this embodiment, the intent prompts are not fixed templates, but rather information packets assembled in real-time from the most likely candidate intents. These packets include an intent list, slot specifications, and multi-turn dialogue records. The aim is to provide the large language model with sufficient contextual clues, enabling it to make accurate decisions among limited options while adhering to a predetermined output format. For example, if the current preset intent labels include "gear_switch" and "light_switch," the prompts will display the definitions and examples of these two functions side-by-side, helping the model distinguish between different scenarios of airflow adjustment and lighting control. Furthermore, the prompts also embed task descriptions, explicitly requiring the model to actively inquire when missing slot information is detected. This customized input design effectively constrains the model's creative freedom, ensuring that its output is both logically sound and parsable.
[0040] S500: Input the intent prompt words into the pre-trained large language model. The large language model determines the intent information, slot information, and multi-turn dialogue records corresponding to the target intent label from the intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent labels. The intent information, slot information, and multi-turn dialogue records corresponding to the target intent label are analyzed to obtain the intent corresponding to the user's question.
[0041] In this embodiment, once the intent prompt is ready, it is fed into a pre-trained large language model for comprehensive understanding and reasoning. At this point, the large language model's task is no longer to answer open-ended questions, but to perform intent discrimination and information extraction within a given scope. The large language model combines the content of the user's current question, the detailed definitions of multiple preset intent tags, and historical dialogue patterns to evaluate which preset intent tag best fits the current context, and accordingly locks onto the target intent tag. The final output is a structured natural language response, which includes both user-facing voice prompts and implicit standardized command fragments for device control. The entire process achieves a closed-loop transformation from fuzzy input to precise output, balancing user-friendliness in human-computer interaction with the reliability of execution.
[0042] In some embodiments, before obtaining the user's query, it is necessary to pre-supplement the data in the preset semantic vector database and relational database; this is collectively referred to as the offline process. Figure 2 As shown, Figure 2 This is a flowchart illustrating offline and online processes for intent recognition provided in embodiments of the present invention. It can be understood that the aforementioned steps S100-S500 belong to... Figure 2The online process is as follows. The core objective of the offline process is to provide reliable data support and a structured knowledge base for subsequent intent recognition, ensuring a quick and accurate response when faced with user inquiries. The entire offline phase revolves around the construction of two key databases: a pre-defined semantic vector database for semantic retrieval and a pre-defined relational database for storing intent logic rules.
[0043] In this embodiment, the first step is data collection and cleaning. During this stage, researchers collect a large number of natural language questions that real users might ask in actual usage scenarios through various channels, such as "Turn on the range hood," "Turn the range hood fan to maximum," and "Close the door of the all-in-one machine." These raw statements often contain redundant expressions, grammatical errors, or irrelevant information. Therefore, they need to undergo manual review and standardization to remove invalid content and unify the expression, forming a high-quality cleaned set of user questions. This process is similar to reviewing key knowledge points before writing a textbook; only by laying a solid foundation can the system's comprehension be guaranteed.
[0044] The next step is to vectorize and encode the cleaned user queries. A pre-trained embedding model is used to convert each text into a numerical vector in a high-dimensional space, i.e., a preset vector. This transformation is not a simple keyword mapping, but a process of capturing the deep semantic features of the sentences. For example, although "I want to steam a bun" and "heat up some frozen pasta" are different words, their corresponding preset vectors will be very close in mathematical space, reflecting semantic similarity. This step realizes the leap from natural language to computable mathematical representation, providing possibilities for subsequent semantic-based retrieval.
[0045] Subsequently, these generated preset vectors are associated with their respective preset intent tags and stored in a preset vector database. Each preset vector carries metadata information, the most crucial of which is the preset intent tag, such as `gear_switch` for gear shifting and `light_switch` for lighting control. This preset vector database acts as a memory, recording which statements correspond to which functions in the past. When a new user question arises in the future, semantic vectors can be compared to quickly retrieve semantically similar historical samples from the preset vector database, thereby inferring the user's possible intent.
[0046] For example, a single data entry stored in a pre-defined vector database: "query":"Range hood fan speed is set to maximum"; "embedding":[0.12,-0.34,...,0.56], #768-dimensional vector; "metadata":{"intent":"gear_level"}.
[0047] Meanwhile, another parallel workflow involves building structured intent definitions in a pre-defined relational database. For each functional intent pre-planned during the product design phase, complete logical description information must be entered. Taking `gear_switch` as an example, its record in the pre-defined relational database includes: the intent name is "gear level adjustment," the function definition is "adjusting the range hood's operating fan speed," several typical user question examples are provided, and the slot information is clearly defined, such as `gear_level` supporting four enumerated values: "weak, medium, strong, and stir-fry," with the slot marked as a required field. In addition, it includes multi-turn dialogue examples demonstrating the complete interaction flow; for example, if a user says "switch to stir-fry mode," the response is "You have been set to the stir-fry mode \ngear_switch#gear_level:stir-fry." This type of data is stored in structured table format for easy and accurate querying and verification.
[0048] For example, a sample of a single data entry stored in a predefined relational database: {"IntentLabel":"gear_switch","IntentDefinition":"Adjust the range hood speed"; "UserQuestionExamples": "The range hood is set to the high-power stir-fry setting"; "SlotsAndDescription":{"gear_level":{"description":"The range hood only supports the above four airflow levels, from low to high","enum":["weak","med","strong","stir-fry"]}},"Required; Slots":"gear_level","DialogExamples":[{"role":"user","content":"Set the range hood to high speed"}; {"role":"assistant","content":"Okay, I've set it to the highest setting for you\n$gear_switch#gear_level:high setting$"}]}.
[0049] The two databases mentioned above together constitute the system's dual knowledge engine: the vector database is responsible for efficiently recalling potential intent candidates, while the relational database provides rigorous logical verification. Working together, they can flexibly adapt to language diversity while strictly adhering to device control specifications. The entire offline process does not require frequent repetition; data entries are only updated when adding new features or optimizing existing intents, greatly reducing maintenance costs. It is precisely this solid knowledge accumulation at this stage that enables the online stage to complete complex human-machine semantic understanding tasks within milliseconds, achieving a high-precision, low-latency intelligent interactive experience. By constructing a multi-dimensional vector knowledge base—namely, the vector database and the relational database—containing original user questions, intent descriptions, slot constraints, and multi-turn dialogue examples, small-sample or even zero-sample intent recognition can be achieved, avoiding the dependence of traditional methods on large-scale labeled data.
[0050] In some embodiments, for step S200, one possible implementation of the present invention is that the preset vector database contains user history questions that correspond one-to-one with preset vectors, and step S200 includes sub-steps S210~S230, which include: S210. Calculate the similarity between the semantic vector and the preset vector in the preset vector database.
[0051] In this embodiment, during vector retrieval, the currently generated semantic vector needs to be compared pairwise with each preset vector stored in the vector database to quantify their semantic similarity. This is typically achieved using a cosine similarity algorithm, which measures directional consistency by calculating the cosine of the angle between two vectors in a high-dimensional space; the closer the value is to 1, the more semantically similar they are. Since vector dimensions in practical applications are often hundreds or even thousands, directly traversing all entries would incur significant overhead. Therefore, approximate retrieval techniques such as Faiss or Annoy are often used to accelerate the matching process, controlling response latency while ensuring recall quality.
[0052] S220. Sort the preset vectors whose similarity to the semantic vector is greater than a preset threshold according to their similarity from largest to smallest, and determine the first preset number of preset vectors that are ranked first.
[0053] In this embodiment, after the initial similarity calculation, a dual filtering mechanism is introduced to improve the quality of the candidate set. First, a minimum similarity threshold is set to exclude interference items with significant semantic deviations, such as mismatching "turn on the lights" with "start steaming / cooking". Then, among the remaining valid results, they are sorted in descending order of score, and the top-ranked subset is selected, with the number determined by configuration, such as the Top-100 (a first preset number of 100). This approach retains a sufficiently diverse range of candidate intents for subsequent analysis while preventing information overload due to too many irrelevant results. Especially when facing ambiguous expressions or polysemous contexts, retaining multiple high-scoring options helps the large language model make a more reasonable final judgment based on the context.
[0054] S230. Determine multiple preset intent tags corresponding to semantic vectors based on the preset intent tags corresponding to the first preset number of preset vectors in the sorting order.
[0055] In this embodiment, the current goal is to extract the associated preset intent tags from the Top-100 preset vectors selected in the previous step, forming an initial intent candidate list. Since multiple historical queries may point to the same intent, the results are deduplicated to ensure each intent appears only once, avoiding redundant information loading. For example, if 20 of the top 100 most similar queries belong to the `gear_switch` intent, the tag only needs to be retained once. This generated candidate set reflects both high-frequency semantic possibilities and logical simplicity, providing a clear index for accurate retrieval of the complete definition in the relational database later.
[0056] In some embodiments, for step S230, one possible implementation of the present invention is that step S230 includes sub-steps S231~S232, and steps S231~S232 include: S231. Take the preset intent tags corresponding to the first preset number of preset vectors that are ranked first as the initial preset intent tags, calculate the correlation between the user's historical questions and the current user's questions corresponding to the initial preset intent tags, sort the initial preset intent tags in descending order of correlation, and determine the second preset number of initial preset intent tags that are ranked first; the second preset number is less than the first preset number.
[0057] In this embodiment, although the initial screening based on vector similarity has achieved certain results, ambiguity may still occur in some complex dialogue scenarios. Therefore, a secondary fine-grained ranking mechanism, called "Rerank," is introduced. This process no longer relies solely on vector distance but utilizes a stronger cross-encoder model to re-evaluate the fine-grained relevance between the historical question samples of each candidate intent and the current user's statement. For example, if the user previously said "turn on the fan," and the current question is "turn it up a bit," vector matching alone might recall multiple possibilities such as "turn up the volume" or "turn up the temperature." However, by concatenating the context into a new query and comparing and scoring it with each candidate, it can be found that "turn up the fan speed" fits the preceding and following context better. Therefore, intent tags with strong contextual coherence are prioritized for retention, and the total number is further compressed to a smaller range, such as reducing it from 100 to 10. This second preset number of 10 can be understood as improving the focus and stability of subsequent decisions.
[0058] S232. The first two preset intent tags in the sorted order are determined as multiple preset intent tags corresponding to the semantic vector.
[0059] In this embodiment, after the above-mentioned rearrangement process, a set of optimal candidate preset intent labels is finally locked, and the top ten initial preset intent labels are used as the preset intent labels for this recognition task. These labels are not only highly similar to the current question semantically, but also have stronger rationality in dialogue logic, forming a high-quality path to the target intent. Compared with simple vector retrieval, this two-stage strategy—breadth recall followed by depth filtering—effectively balances the contradiction between coverage and precision, and is particularly suitable for application scenarios such as smart homes where there are a large number of similar commands and context awareness is emphasized.
[0060] It is understandable that on resource-constrained embedded devices, excessively long contexts can directly lead to increased inference time, impacting user experience. Therefore, this embodiment employs a two-stage retrieval strategy. The first stage uses Approximate Nearest Neighbor (ANN) technology to quickly recall a first preset number of Top-K (e.g., 100) candidate intent tags from the vector database, ensuring a high recall rate. The second stage utilizes a cross-encoder to perform fine-grained relevance scoring on these candidates and re-ranks them, compressing them into a smaller set using a second preset number (e.g., Top-10). This division of labor between coarse detection and fine ranking avoids the latency issues caused by directly performing high-cost semantic matching on massive amounts of data, while retaining key candidates to maintain accuracy. The entire process can be completed within milliseconds, making it particularly suitable for deployment on edge devices with limited computing power (such as smart ovens and steamers). It can complete semantic retrieval and intent focusing within a time window of ≤500ms, thereby meeting the real-time requirements of human-computer interaction.
[0061] In some embodiments, the intent information includes an intent name and an intent description, and the slot information includes a slot name, a slot description, and whether the slot is required. For step S400, one possible implementation of this embodiment is that step S400 includes sub-steps S401~S403, and steps S401~S403 include: S401. Generate an intent list based on the intent name, intent description, slot name, slot description, and whether the slot is required for each preset intent tag.
[0062] In this embodiment, when entering the prompt word construction stage, the metadata corresponding to each selected preset intent tag is first organized into a structured table format, called the intent list. This list lists the intent name, intent description, slot name, slot description, whether the slot is required, and multi-turn dialogue examples for each candidate preset intent tag, such as whether a certain intent requires the user to provide time parameters and what the possible values are. This presentation method facilitates the large language model to quickly browse and compare the differences between different intents, especially when facing instructions with similar functions but different uses, such as "air fry" and "regular grilling," which can be distinguished by the differences in slot enumeration values. The intent list, as the core of the prompt words, plays a crucial role in providing a clear overview.
[0063] For example, the list of intents is shown in the table below:
[0064] It's important to note that the intent list is generated based on the intent information and slot information corresponding to each preset intent tag. Here, "slot information" refers to the input field definition that the intent logically depends on. Taking `gear_switch` as an example, its associated slot information includes: the slot name is `gear_level`, the description is "range hood fan speed level", the enumerated values are limited to "low, medium, high, stir-fry", and it is marked as a required field. This content is organized into a table format with embedded prompts, the purpose of which is to let the large language model know that "if this intent is hit, it must be confirmed whether the user has provided a compliant `gear_level` value". At this point, it has not yet determined whether the information exists, nor is it assumed that it is known; it only informs the model of the existence and legality boundaries of the slot, playing a role in guiding recognition and subsequent verification. Thus, the "slot information" in the intent list is a static knowledge declaration used to construct the decision context, rather than a dynamic state record. It does not mean that a specific slot value has been obtained in the current dialogue, nor does it mean that the model can directly extract execution instructions from it.
[0065] S402. Generate a dialogue response example from the responding user based on the multi-turn dialogue record.
[0066] In this embodiment, in addition to the static functional definitions, the multi-turn dialogue records associated with each candidate intent are transformed into interactive examples for reference, enhancing the model's understanding of real-world dialogue flows. These multi-turn dialogue records simulate the process of users gradually providing information, demonstrating how to transition from vague questions to complete instructions. For example, when starting an automatic cooking program, a user might first say "make sweet and sour pork," then add "for two" and "a little sweeter." The large language model responds sequentially and accumulates parameters until all required slots are filled. These complete question-and-answer sequences are embedded as is in the prompts, enabling the large language model not only to recognize intents but also to mimic the correct interaction rhythm, choosing to ask follow-up questions rather than skip when information is incomplete. This instance-based learning approach greatly improves the model's robustness and adaptability in real-world operation.
[0067] In this embodiment, by extracting multi-turn dialogue examples bound to candidate intents from a relational database and embedding them as context templates into the final prompt, the large language model can reason based on historical interaction patterns. For example, when a user previously asks "Steam some meat buns for me," the intent is identified as `steam_time_query`. If the user then asks "What about vegetarian buns?", although the current statement lacks a clear action verb, the preceding dialogue has been incorporated into the contextual memory, and since both "vegetarian buns" and "meat buns" belong to the same category of pastry, the model can infer that the intent still belongs to "querying steaming time" based on the logic of the loaded multi-turn examples, thus correctly continuing the conversation state. This design of dynamically injecting structured historical dialogue instances into prompt words gives the general-purpose large language model strong context awareness, enabling it to understand omissions, references, and continuations without additional training. This truly achieves cross-turn semantic coherence reasoning and effectively solves the problem that traditional single-turn intent classifiers cannot handle contextual dependencies.
[0068] S403. Generate intent prompts based on the intent list, dialogue response examples, and preset task descriptions. The preset task descriptions are used to instruct the large language model to ask the user for slot information when it determines that the slot information corresponding to the preset intent label in the intent list is missing.
[0069] In this embodiment, after integrating all materials, the intent list, dialogue response examples, and a standardized pre-defined task description are merged into the final intent prompt. The task description explicitly defines the model's behavioral guidelines, such as strictly adhering to the specified format for outputting intent#slot:value, prohibiting the fabrication of unmentioned parameters, and initiating follow-up questions if missing slot information is detected. These instructions act like an operation manual, guiding the large language model to maintain consistent behavior in complex environments. The design of the entire prompt embodies the idea of releasing capabilities within constraints, neither limiting the model's language understanding advantages nor strictly confining its output within a controllable range, ensuring seamless downstream control for every response.
[0070] It is understandable that in this embodiment, by integrating the intent list (structured table) generated by S401, the multi-turn dialogue examples provided by S402, and the explicit task instructions, a highly guided dynamic prompt is constructed, ensuring that the large language model remains under control throughout the inference process. In particular, the task description explicitly specifies the output format (e.g., "$intent#slot1:value1$"), the usage of delimiters, and the example template, effectively providing the model with clear "grammatical specifications." This forces the model to transform from generating free text such as "Okay, I've switched to stir-fry mode" to outputting structured instructions like "$gear_switch#gear_level:stir-fry$", which can be precisely extracted using regular expressions. This in-context learning-based format anchoring mechanism achieves high-precision structured output without model fine-tuning, solving the problem of downstream systems being unable to parse the data due to the free generation of traditional large language models. It is a core technical means to improve the accuracy of structured output.
[0071] For example, the prompt words can be as follows: (1) Please answer the user's latest question based on the dialogue history, paying attention to the context of the entire dialogue. If the latest question matches a preset intent tag, please display the intent and corresponding slot information on a new line after the answer. If the matched preset intent tag has a required slot, please determine whether all required fields are satisfied based on the dialogue history. If not, follow-up questions are required. Do not output the intent and slot during the follow-up questioning process; only output the intent and slot after all required fields are satisfied. (2) Intents begin with the symbol "$", are separated from slots by "#", are separated from slot names by ":", are separated from multiple slots by ";", and end with "$". Format: "$intent#slot1:value1;slot2:value2$". Example: $gear_switch#gear_level:strong$. (3) For real-time issues, such as queries about weather, time, exchange rates, stocks, car restrictions, news, etc., do not fabricate answers. Please inform the user that a query is being made and output the corresponding intent slot information.
[0072] (4) When generating intents and slots, please ensure that the intent tags and slot tags are within the defined range, and ensure consistency among the intent, slot, and voice broadcast response. Below are the intent tags, tag definitions, user question examples, corresponding slot information, and required slot fields: |IntentLabel|IntentDefinition|UserQuestionExamples|SlotsAndDescription|RequiredSlots|; |door_switch|Controls the opening, closing, or emergency stop of the all-in-one machine door|Help me open the all-in-one machine door|; doorSwitch: Controls the action of the all-in-one machine door, enumeration values: ["emergency stop", "close door", "open door"]|-|; |light_switch|Controls the on / off state of the all-in-one machine's lights|Turns the all-in-one machine's lights on|switch: Controls the on / off state of the all-in-one machine's lights, enumeration values: ["Off", "On"]|-|.
[0073] (5) Example format of a multi-turn dialogue under any intent label: [{"role","user","content":"All-in-one machine light on"}, {"role","assistant","content":"The all-in-one lighting has been turned on for you (final output text that needs to be read aloud).\n$light_switch#switch:Turn on$"}, (final output text command that needs to be used to control the device) {"role","user","content":"Stop"}, {"role","assistant","content":"It has stopped.\n$door_switch#doorSwitch:Emergency Stop$"}).
[0074] The text {"role","assistant","content":"The all-in-one machine lighting has been turned on for you. This is the final output text that needs to be read aloud.\n$light_switch#switch:Turn on$"} is the final output text command that needs to be executed by the device.
[0075] (6) User’s current question: Turn on the lights of the all-in-one machine.
[0076] Now begin performing the dialogue task as required. Remember, it is forbidden to fabricate answers that do not conform to the facts, to output intent tags or slot tags that are not defined, or to output slots that do not appear in the dialogue history.
[0077] It is understandable that in this embodiment, organizing the intent information and slot information corresponding to the top-K user questions into an intent list table, and injecting it along with corresponding multi-turn dialogue examples into the prompt template, is the core design for achieving high-precision, low-latency intent recognition. The construction of this mechanism is not a simple information stacking, but rather based on a deep understanding and effective guidance of the reasoning characteristics of large language models. Traditional methods typically rely on full classification heads or fixed rule engines for intent judgment, which not only requires a large amount of labeled data to train model parameters but also struggles to adapt to the rapid iteration of functions in vertical domains. This embodiment, however, uses retrieval enhancement to dynamically generate contextual prompts at runtime, enabling the large language model to accurately respond to new intents without fine-tuning, thereby breaking through the cost and efficiency bottlenecks of traditional supervised learning paradigms.
[0078] The key to this embodiment lies in using semantic similarity to filter out the most likely related candidate intents, avoiding loading all known intents into the context, which would significantly increase the computational load and even cause the model's attention to become scattered, affecting the accuracy of judgment. For example, in the smart kitchen appliance scenario, when a user asks "Steam some buns for me," the system first uses vector retrieval to find the top-K semantically similar samples from a massive database of historical queries, such as "Heat a steamed bun," "Steam some frozen dumplings," and "Heat a meat bun." These all belong to the same operation category, namely, steam heating mode. Subsequently, the system extracts the true intent labels corresponding to these K samples, along with their corresponding intent information and slot information, including intent name, intent description, slot name, slot description (slot value), and logical constraints such as whether the slot is required. This information is integrated into a compact intent list table to clearly list the functional boundaries of each candidate intent. For example, "Steaming mode" requires input of food type and time, while "Disinfection mode" focuses on temperature and duration. Although both involve high-temperature processing, their application purposes are different. This structured presentation allows the large language model to quickly compare differences and make choices that conform to the equipment control specifications.
[0079] Building upon this foundation, multi-turn dialogue examples bound to each candidate intent are further introduced as reference templates for the actual interaction process. This approach is essentially a contextual learning mechanism; by reproducing typical question-and-answer sequences, it teaches the large language model how to make decisions based on the current dialogue state. For example, when a user first says "I want to make sweet and sour pork," and then asks "Any vegetarian recommendations?", although the second question doesn't explicitly mention the action intent, the previous "recipe initiation" context has already been triggered, and this type of intent is included in the Top-K results during the reordering phase. Its corresponding multi-turn examples (such as "User: I want something light; Large Language Model: I recommend stir-fried broccoli") also enter the prompt word Prompt. At this point, the large language model can infer from the learning path of this example that the user is still in the task flow of "seeking cooking advice," thus maintaining contextual coherence and providing a reasonable response. Without such historical example injection, relying solely on general language capabilities, the large language model might misjudge it as casual conversation or information retrieval, leading to service interruption.
[0080] More importantly, the entire process decouples knowledge updates from behavior adjustments. Adding a new feature doesn't require retraining the model; instead, several representative expressions are written into the vector database offline, along with complete metadata descriptions and interaction examples. Once deployed, any similar new question will be automatically matched to that intent and assembled into a prompt in subsequent steps. For example, after the "slow cook" feature is launched, if a user says "cook an egg slowly at 58 degrees" for the first time, even if they've never seen this phrase before, as long as its semantic vector is close to the existing preset vector, the relevant intent information can be successfully recalled. At this point, the item will be added to the Top-K list, constructing an intent list and sample dialogue including "sous-vide_time_query," which will then guide the large language model to output standardized instructions. This plug-and-play capability greatly shortens the product feature deployment cycle, making it particularly suitable for frequently evolving application environments such as smart homes.
[0081] Furthermore, by limiting the participation of only the top-K optimal candidates in constructing the prompt, it ensures that key intents are not overlooked while effectively controlling the input length to meet the real-time requirements of edge devices. This ensures that the content ultimately entering the prompt has both breadth and depth. This hierarchical filtering design not only addresses the challenges posed by ambiguous or polysemous expressions but also maintains millisecond-level response times, truly achieving high availability standards. Overall, the process of transforming Top-K intent information into structured knowledge and integrating it into the prompt is not only an innovation in technical means but also a reconstruction of the essence of human-computer interaction, no longer requiring machines to memorize everything but enabling them to learn how to find, identify, and use knowledge. In some embodiments, for step S500, the present invention provides a possible implementation method in which step S500 includes sub-steps S510~S530, and steps S510~S530 include: S510. Analyze the intent information, slot information, multi-turn dialogue records and user questions corresponding to multiple preset intent tags to determine whether there are any preset intent tags that match the user questions among the multiple preset intent tags.
[0082] In this embodiment, once the large language model receives complete prompt information, it begins executing the core reasoning task. The large language model comprehensively considers the content of the current user's question, the attributes of multiple preset intent tags, and historical dialogue patterns to determine if a preset intent tag can reasonably explain the current input. This process involves not only keyword matching but also a deep understanding of omissions, pronoun references, and contextual inheritance. For example, if the user says "turn it off," the model needs to determine whether "it" refers to the range hood or the lights based on the preceding context; similarly, if the user says "give me another one of that," it needs to retrieve previous order records. Only when the model is certain that an intent highly matches the current context will it be considered a hit; otherwise, it is treated as a miss.
[0083] S520. If a user's question matches a preset intent tag, determine the currently matched preset intent tag as the target intent tag, and obtain the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag.
[0084] In this embodiment, once a candidate preset intent tag is successfully triggered, it is formally established as the target intent tag, and all its associated information is loaded for subsequent processing. This step marks the completion of the intent recognition phase and provides a definitive basis for generating the final response. At this point, the large language model has mastered all the rule details of the intent, including which parameters need to be collected, how to organize the response language, and which device interface should be called, thus possessing the ability to generate complete instructions. The entire determination process relies on the powerful context modeling capabilities of the large language model, enabling it to make robust choices among multiple options.
[0085] S530. In the absence of a preset intent label that matches the user's question, the user's question is answered using a large language model.
[0086] In this embodiment, if, after comprehensive analysis, the large language model determines that the current question does not correspond to any predefined intent—for example, if the user asks about the weather, tells a joke, or requests an operation that cannot be performed—it switches to a general question-and-answer mode. In this case, the large language model is no longer limited to a structured output format but responds in a natural, conversational manner, such as "I cannot control the curtains for the time being" or "Today in Beijing, it's sunny, and the temperature is 18 degrees Celsius." While such responses do not trigger device actions, they still maintain the fluency of the conversation and improve the user experience. This flexible switching mechanism ensures that it can respond appropriately to unknown inputs, rather than rigidly displaying errors.
[0087] In some embodiments, for step S520, one possible implementation of the present invention is that step S520 includes sub-steps S521 to S524, and steps S521 to S524 include: S521. Determine whether the slot information corresponding to the target intent tag is missing.
[0088] In this embodiment, after confirming the target intent label, it immediately checks whether the information currently provided by the user is sufficient to meet the execution conditions of that intent. Each intent label is designed with several required slots explicitly defined, such as knowing the dish name, portion size, and taste preferences when starting a cooking program. If these key parameters cannot be obtained from the current question or multiple rounds of memory, it is determined that the slots are missing. This judgment directly affects subsequent behavior: if complete, the execution command can be generated directly; if missing, a completion process needs to be initiated. This mechanism prevents erroneous operations due to insufficient information, ensuring that every control command is complete and secure.
[0089] S522. In the case of missing slot information, determine whether slot information exists in the multi-turn dialogue records corresponding to the target intent tag.
[0090] In this embodiment, even if the current question does not provide all the necessary parameters, it will not immediately ask follow-up questions. Instead, it will first check whether the relevant information is already contained in the history of the current dialogue. For example, if a user previously said "I want to make sweet and sour pork," and now says "for two," even though the second question does not mention the dish name, the context allows us to infer that the dish name is still "sweet and sour pork." This ability to inherit information across rounds greatly reduces the frequency of repeated questions, making the dialogue more natural and efficient. By parsing the semantic relationships in the multi-round dialogue records, it attempts to automatically fill in missing slots, only actively asking questions when it is truly impossible to recover the information.
[0091] S523. If slot information exists in the multi-turn dialogue record corresponding to the target intent tag, obtain the slot information corresponding to the target intent tag from the multi-turn dialogue record.
[0092] In this embodiment, when a parameter has been explicitly mentioned in the historical dialogue, it is directly extracted and reused without further confirmation. For example, if a user says "I want to boil an egg at a low temperature" in the first round and asks "How long?" in the second round, the system should remember the request for "low-temperature egg" and return a corresponding time suggestion based on the knowledge base. This context-aware capability relies on the large language model's continuous tracking of the dialogue state, enabling it to maintain semantic coherence in discontinuous expressions and truly achieve a human-like interactive experience.
[0093] S524. If there is no slot information in the multi-turn dialogue record corresponding to the target intent tag, use the large language model to ask the user for slot information until the user inputs the slot information, and use the user input slot information as the slot information corresponding to the target intent tag.
[0094] In this embodiment, when it is confirmed that certain required fields are neither in the current question nor in the history, a targeted follow-up question is generated. For example, for an automatic cooking machine that requires three elements (dish name, quantity, and flavor) to start, if the user only says "make sweet and sour pork" and "for three people" but does not specify their sweet and sour preference, the model will respond: "Would you prefer it sweeter, standard, or more sour?" until all the necessary information is available. Each follow-up question updates the dialogue state, accumulating context for the next round of judgment. This gradual information collection method ensures operational safety while avoiding the pressure of requesting too much information at once.
[0095] It's important to note that the intent recognition process is decoupled into two stages: knowledge presentation and state judgment. The former exposes all possible slot categories to the large language model through an intent list, preventing misjudgments due to unknown intent structures. The latter involves the model dynamically evaluating and completing information based on the complete context. Therefore, listing slot information during cue word construction helps the large language model understand what to focus on; subsequent analysis requires judgment and follow-up questions to ensure truly effective input. These two stages, each with different functions, work together to guarantee the accuracy and controllability of the output. Thus, in this scheme, slot information always refers to the defined set of parameter types, not the instantiated numerical filling results. It's not meant to replace the subsequent information completion process, but rather to support its effective operation, enabling the large language model to reason and interact within a clear rule framework, thereby achieving both flexible and reliable intent understanding capabilities.
[0096] In some embodiments, after obtaining the intent information and slot information of the target intent label, a possible implementation provided by the embodiments of the present invention, the user intent recognition method includes steps S600 to S700, and steps S600 to S700 include: S600. Analyze the intent information, slot information, and multi-round conversation records corresponding to the target intent label through a large language model to obtain an intent instruction.
[0097] In this embodiment, when all necessary information is available, the large language model will generate a standardized structured instruction, that is, an intent instruction. This instruction is strictly written in the format of "intent#slot1:value1;slot2:value2", for example, "gear_switch#gear_level:stir-fry gear", where each field comes from a predefined legal value range to ensure that there will be no syntax errors or illegal parameters. At the same time, the model will also generate a natural language response, such as "It has been set to the stir-fry gear for you", for subsequent voice broadcast. This process realizes one inference and dual outputs, greatly simplifies the architecture, and avoids the complex processes of separately calling a classification model and a generation model in traditional solutions.
[0098] S700. Control the device to perform operations and / or perform voice broadcast of the intent according to the intent instruction.
[0099] In this embodiment, the last step is to deliver the intent instruction generated in the previous stage to the device control for parsing and execution. For example, convert "light_switch#switch:on" into a GPIO signal to light the lamp, or write "steam_mode#time:10min" into the operation parameter table of the heating module. At the same time, the accompanying natural language text is sent to the speech synthesis engine and converted into speech to be played for the user to listen to. The entire process至此完成闭环,从用户一句话开始,经历语义理解、意图判别、信息补全、指令生成,最终落实为物理世界的动作反馈,真正实现了智能人机协同的操作体验。
[0100] Based on the above method, the embodiments of the present invention also provide a system corresponding to the above method, as Figure 3 shown, Figure 3 is a schematic diagram of the functional modules of the user intent recognition system provided by the embodiments of the present invention. It should be noted that the basic principle and the technical effects generated by the user intent recognition system 1000 provided in this embodiment are the same as those in the above method embodiment. For the sake of brief description, for the parts not mentioned in this embodiment, reference can be made to the corresponding content in the method embodiment.
[0101] It should be noted that there seems to be an incomplete sentence in the original text at the position of "整个流程至此完成闭环,从用户一句话开始,经历语义理解、意图判别、信息补全、指令生成,最终落实为物理世界的动作反馈,真正实现了智能人机协同的操作体验。" which may need to be further checked and corrected in the original content. The translated text retains this unclear part as it is in the original.In this embodiment, the user intent recognition system 1000 includes an acquisition module 1100, a query module 1200, an analysis module 1300, and an output module 1400. The acquisition module 1100 is used to acquire the user's query and encode it to generate a semantic vector. It can be understood that the acquisition module 1100 is used to perform the above-described step S100.
[0102] The query module 1200 is used to find multiple corresponding preset intent tags in a preset vector database based on semantic vectors; the preset vector database records the correspondence between preset vectors and preset intent tags; and finds the corresponding intent information, slot information, and multi-turn dialogue records in a preset relational database based on multiple preset intent tags. It can be understood that the query module 1200 is used to perform the above steps S200~S300.
[0103] The analysis module 1300 is used to generate intent prompt words based on the intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags; input the intent prompt words into a pre-trained large language model, and use the large language model to determine the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag from the intent information, slot information, and multi-turn dialogue records corresponding to the multiple preset intent tags; and analyze the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag to obtain the intent corresponding to the user's question. It can be understood that the analysis module 1300 is used to perform the above steps S400~S500.
[0104] In some embodiments, the preset vector database contains user historical questions that correspond one-to-one with preset vectors. The query module 1200 is used to calculate the similarity between the semantic vector and the preset vector in the preset vector database; sort the preset vectors with a similarity greater than a preset threshold according to their similarity from largest to smallest, and determine the first preset number of preset vectors at the top of the sort; and determine multiple preset intent tags corresponding to the semantic vector based on the preset intent tags corresponding to the first preset number of preset vectors at the top of the sort. It can be understood that the query module 1200 is used to perform the above steps S210~S230.
[0105] In some embodiments, the query module 1200 is used to take the preset intent tags corresponding to the first preset number of preset vectors that are ranked first as initial preset intent tags, calculate the relevance between the user's historical questions and the current user's questions corresponding to the initial preset intent tags, sort the initial preset intent tags in descending order of relevance, and determine the second preset number of initial preset intent tags that are ranked first; the second preset number is less than the first preset number; and determine the second preset number of initial preset intent tags that are ranked first as multiple preset intent tags corresponding to semantic vectors. It can be understood that the query module 1200 is used to perform the above steps S231~S232.
[0106] In some embodiments, intent information includes intent name and intent description, and slot information includes slot name, slot description, and whether the slot is required. Analysis module 1300 is used to generate an intent list based on the intent name, intent description, slot name, slot description, and whether the slot is required for each preset intent tag; generate dialogue response examples from the multi-turn dialogue records; and generate intent prompts based on the intent list, dialogue response examples, and preset task descriptions. The preset task descriptions instruct the large language model to ask the user for slot information when it determines that the slot information corresponding to the preset intent tag in the intent list is missing. It can be understood that analysis module 1300 is used to perform the above steps S401~S403.
[0107] In some embodiments, the analysis module 1300 is used to analyze the intent information, slot information, multi-turn dialogue records, and user-asked questions corresponding to multiple preset intent tags, and to determine whether there is a preset intent tag that the user-asked question matches among the multiple preset intent tags; if there is a preset intent tag that the user-asked question matches, the currently matched preset intent tag is determined as the target intent tag, and the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag are obtained; if there is no preset intent tag that the user-asked question matches, the user-asked question is answered using a large language model. It can be understood that the analysis module 1300 is used to perform the above steps S510~S530.
[0108] In some embodiments, the analysis module 1300 is used to determine whether the slot information corresponding to the target intent tag is missing; if the slot information is missing, it determines whether the slot information exists in the multi-turn dialogue record corresponding to the target intent tag; if the slot information exists in the multi-turn dialogue record corresponding to the target intent tag, it obtains the slot information corresponding to the target intent tag from the multi-turn dialogue record; if the slot information does not exist in the multi-turn dialogue record corresponding to the target intent tag, it uses a large language model to ask the user for the slot information until the user-inputted slot information is obtained, and uses the user-inputted slot information as the slot information corresponding to the target intent tag. It can be understood that the analysis module 1300 is used to perform the above steps S521~S524.
[0109] In some embodiments, the output module 1400 is used to analyze the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag using a large language model to obtain intent instructions; and to control the device to perform operations and / or to broadcast the intent via voice according to the intent instructions. It can be understood that the output module 1400 is used to execute steps S600 to S700.
[0110] Based on the same inventive concept disclosed above, the present invention also provides a block diagram of an electronic device 2000 performing the above method. Please refer to... Figure 4 , Figure 4 This is a block diagram of an electronic device provided in an embodiment of the present invention. The electronic device 2000 includes a processor 2100, a memory 2200, a bus 2300, and a communication interface 2400. The processor 2100 and the memory 2200 are connected via the bus 2300, and the processor 2100 communicates with external devices via the communication interface 2400.
[0111] Processor 2100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed through integrated logic circuits in the hardware of processor 2100 or through software instructions. The processor 2100 may be a general-purpose processor 2100, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0112] The memory 2200 is used to store computer programs. For example, the user intent recognition system 1000 in this embodiment of the invention includes at least one software function module that can be stored in the memory 2200 in the form of software or firmware. After receiving an execution instruction, the processor 2100 executes the program to implement the user intent recognition method in this embodiment of the invention.
[0113] The memory 2200 may include high-speed random access memory (RAM) or non-volatile memory. Optionally, the memory 2200 may be a storage device built into the processor 2100 or a storage device independent of the processor 2100.
[0114] Bus 2300 can be ISA bus 2300, PCI bus 2300 or EISA bus 2300, etc. Figure 4 It is indicated by only one double-headed arrow, but does not mean that there is only one bus 2300 or one type of bus 2300.
[0115] Electronic devices 2000 can be mobile phones, tablets, laptops, desktop computers, and other computer devices.
[0116] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium storing a computer program thereon, which, when executed by processor 2100, implements the user intent recognition method as described above. This computer-readable storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0117] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for recognizing user intent, characterized in that, The method includes: Obtain the user's question and encode it to generate a semantic vector; Based on the semantic vector, multiple corresponding preset intent tags are found in the preset vector database; the preset vector database records the correspondence between preset vectors and preset intent tags; Based on the multiple preset intent tags, the corresponding intent information, slot information, and multi-turn dialogue records are found in the preset relational database; Generate intent prompts based on intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags; The intent prompt words are input into a pre-trained large language model. The large language model determines the intent information, slot information, and multi-turn dialogue records corresponding to the target intent label from the intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent labels. The intent information, slot information, and multi-turn dialogue records corresponding to the target intent label are analyzed to obtain the intent corresponding to the user's question.
2. The method according to claim 1, characterized in that, The preset vector database contains user history questions that correspond one-to-one with the preset vectors. Finding multiple preset intent tags corresponding to the semantic vectors in the preset vector database includes: Calculate the similarity between the semantic vector and a preset vector in the preset vector database; Preset vectors whose similarity to the semantic vector is greater than a preset threshold are sorted in descending order of similarity, and the first preset number of preset vectors at the top of the sort are determined. Multiple preset intent tags corresponding to the semantic vector are determined based on the preset intent tags corresponding to the first preset number of preset vectors that are ranked first.
3. The method according to claim 2, characterized in that, The step of determining multiple preset intent tags corresponding to the semantic vector based on the preset intent tags corresponding to the first preset number of preset vectors with the highest sorting order includes: The preset intent tags corresponding to the first preset number of preset vectors that are ranked first are used as the initial preset intent tags. The correlation between the user's historical questions and the current user question corresponding to the initial preset intent tags is calculated. The initial preset intent tags are sorted in descending order of correlation, and the second preset number of initial preset intent tags that are ranked first are determined. The second preset number is less than the first preset number. The first two preset intent tags that are ranked first are determined as the multiple preset intent tags corresponding to the semantic vector.
4. The method according to claim 1, characterized in that, The intent information includes an intent name and intent description; the slot information includes a slot name, slot description, and whether the slot is required; generating intent prompts based on the intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags includes: An intent list is generated based on the intent name, intent description, slot name, slot description, and whether the slot is required for each preset intent tag. Generate a dialogue response example from the user based on the multi-turn dialogue record; Intent prompts are generated based on the intent list, the dialogue response examples, and the preset task description. The preset task description is used to instruct the large language model to ask the user for slot information when it determines that the slot information corresponding to the preset intent tag in the intent list is missing.
5. The method according to claim 1, characterized in that, The step of determining the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag from the intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags using the large language model includes: Based on the analysis of intent information, slot information, multi-turn dialogue records and user question statements corresponding to multiple preset intent tags, it is determined whether there is a preset intent tag among the multiple preset intent tags that matches the user question statement; If the user's question matches a preset intent tag, the currently matched preset intent tag is determined as the target intent tag, and the intent information, slot information and multi-turn dialogue records corresponding to the target intent tag are obtained. If no preset intent tag is matched by the user's question, the large language model is used to answer the user's question.
6. The method according to claim 5, characterized in that, The step of obtaining the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag includes: Determine whether the slot information corresponding to the target intent tag is missing; In the case of missing slot information, determine whether slot information exists in the multi-turn dialogue record corresponding to the target intent tag; If slot information exists in the multi-turn dialogue record corresponding to the target intent tag, the slot information corresponding to the target intent tag is obtained from the multi-turn dialogue record. If no slot information is found in the multi-turn dialogue record corresponding to the target intent tag, the user is prompted for slot information through the large language model until the user inputs the slot information, and the user input slot information is used as the slot information corresponding to the target intent tag.
7. The method according to claim 1, characterized in that, The method further includes: The intent instruction is obtained by analyzing the intent information, slot information and multi-turn dialogue records corresponding to the target intent tag through the large language model. Control the device to perform operations and / or broadcast the intent according to the stated intent.
8. A user intent recognition system, characterized in that, The system includes: The acquisition module is used to acquire the user's question and encode it to generate a semantic vector; The query module is used to find multiple corresponding preset intent tags in a preset vector database based on the semantic vector; the preset vector database records the correspondence between preset vectors and preset intent tags; and to find the corresponding intent information, slot information and multi-turn dialogue records in a preset relational database based on the multiple preset intent tags. The analysis module is used to generate intent prompt words based on intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags; input the intent prompt words into a pre-trained large language model, and use the large language model to determine the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag from the intent information, slot information, and multi-turn dialogue records corresponding to multiple preset intent tags; and analyze the intent information, slot information, and multi-turn dialogue records corresponding to the target intent tag to obtain the intent corresponding to the user's question.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a computer program that can be executed by the processor to implement the user intent recognition method according to any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the user intent recognition method as described in any one of claims 1-7.