LLM-based intent recognition methods, apparatus, devices, and storage media
By using a large language model (LLM) combined with initial and inherited intent recognition techniques, the problems of high development cost and poor versatility of existing intent recognition models are solved, achieving efficient and accurate intent recognition and multi-turn dialogue processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BAIDU INTELLIGENT CLOUD (CHENGDU) SCIENCE TECHNOLOGY CO LTD
- Filing Date
- 2023-12-13
- Publication Date
- 2026-05-05
AI Technical Summary
Existing domain-specific intent recognition models require specialized training for each domain, resulting in high development costs and poor versatility.
Large Language Model (LLM) is used for intent recognition. By obtaining the current round of query statement and inherited information, prompt information is generated. The target intent is determined by combining the initial intent and inherited intent, thus avoiding specialized training for each domain.
It improves the versatility and accuracy of intent recognition, realizes the intent inheritance function in multi-turn dialogue process, and enhances the efficiency and accuracy of intent recognition.
Smart Images

Figure CN117932013B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, specifically to technologies such as smart office, cloud computing, and large-scale models, and particularly to an intent recognition method, apparatus, device, and storage medium based on LLM. Background Technology
[0002] The intent recognition component is a key component in the government affairs assistant. It can identify the intent of the user's query and then obtain the corresponding query results based on the intent.
[0003] In related technologies, intent recognition can be performed based on intent recognition models specific to a particular domain. Summary of the Invention
[0004] This disclosure provides an intent recognition method, apparatus, device, and medium based on LLM.
[0005] According to one aspect of this disclosure, an intent recognition method based on LLM is provided, comprising: obtaining a current round query statement and inheritance information; the inheritance information including an inheritance intent, which is obtained after intent recognition of a previous round query statement; generating LLM prompt information based on the current round query statement, and using the LLM to determine the initial intent of the current round query statement based on the prompt information; and determining the target intent of the current round query statement based on the initial intent and the inheritance intent.
[0006] According to another aspect of this disclosure, an intent recognition device based on LLM is provided, comprising: an acquisition module, configured to acquire a current round query statement and inheritance information; the inheritance information includes an inheritance intent, which is obtained after intent recognition of a previous round query statement; a first determination module, configured to generate LLM prompt information based on the current round query statement, and use the LLM to determine the initial intent of the current round query statement based on the prompt information; and a second determination module, configured to determine the target intent of the current round query statement based on the initial intent and the inheritance intent.
[0007] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to said at least one processor; wherein the memory stores instructions executable by said at least one processor, said instructions being executed by said at least one processor to enable said at least one processor to perform the method as described in any of the foregoing aspects.
[0008] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method according to any of the preceding aspects.
[0009] According to another aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method according to any of the preceding aspects.
[0010] According to the technical solution disclosed herein, the versatility of intent recognition can be improved.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0013] Figure 1 This is a schematic diagram based on the first embodiment of the present disclosure;
[0014] Figure 2 This is a schematic diagram illustrating the application scenarios used to implement the embodiments of this disclosure;
[0015] Figure 3 This is a schematic diagram of the overall process of intent recognition provided according to embodiments of this disclosure;
[0016] Figure 4 This is a schematic diagram according to the second embodiment of the present disclosure;
[0017] Figure 5 This is a schematic diagram according to the third embodiment of the present disclosure;
[0018] Figure 6 This is a schematic diagram of an electronic device used to implement the LLM-based intent recognition method according to embodiments of the present disclosure. Detailed Implementation
[0019] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0020] In related technologies, when performing intent recognition based on intent recognition models for specific domains, it is necessary to train corresponding intent recognition models specifically for each domain, which results in high development costs and poor versatility.
[0021] To improve the versatility of intent recognition, this disclosure provides the following embodiments.
[0022] Figure 1 Based on the schematic diagram of the first embodiment of this disclosure, this embodiment provides an intent recognition method based on LLM, the method comprising:
[0023] 101. Obtain the current round of query statement and inheritance information; the inheritance information includes the inheritance intent, which is obtained after performing intent recognition on the previous round of query statement.
[0024] 102. Generate LLM prompt information based on the current round query statement, and use the LLM to determine the initial intent of the current round query statement based on the prompt information.
[0025] 103. Based on the initial intent and the inherited intent, determine the target intent of the current round of query statements.
[0026] The query can be entered by the user; for example, the user can enter a query in natural language.
[0027] Users can engage in multiple rounds of dialogue with the query system to obtain the final query results.
[0028] The target intent refers to the intent that is finally determined after intent identification for each round of query statements.
[0029] The initial intent refers to the intent of each round of query statements obtained based on the LLM.
[0030] Inherited intent refers to the target intent of the previous query statement for the current query. Inherited intent can be null or it can be specific content, such as "apply to withdraw housing provident fund for rent".
[0031] For the current round of queries, the target intent of the query can be obtained based on the initial intent and inherited intent of the query.
[0032] Large Language Models (LLMs) have become a hot topic in the field of artificial intelligence in recent years. An LLM is a pre-trained language model that learns rich linguistic and world knowledge through pre-training on massive amounts of text data, enabling it to achieve remarkable results in various Natural Language Processing (NLP) and image generation tasks. Applications like Wenxin Yiyan and ChatGPT are based on LLMs and can generate fluent, logical, and creative text content, even engaging in natural conversations with humans. Specifically, LLMs can be Generative Pre-trained Transformer (GPT) models or Enhanced Representation through Knowledge Integration (ERNIE) models.
[0033] The input to an LLM includes a prompt, and the LLM generates corresponding output information based on the prompt.
[0034] Specifically, in intent recognition scenarios, the prompts in an LLM can be generated based on the current round of query statements, and the output information of an LLM can be the initial intent of the current round of query statements.
[0035] After obtaining the initial intent using LLM, the target intent of the current round of queries can be obtained by combining the initial intent and the inherited intent. Then, the target intent of the current round of queries can serve as the inherited intent for the next round of queries, enabling a multi-round dialogue between the user and the query system.
[0036] In this embodiment, the initial intent of the current query statement is obtained based on LLM, and the target intent of the current query statement is determined based on this initial intent and the inherited intent. This eliminates the need to train specialized intent recognition models for each domain, thereby improving the versatility of intent recognition. Furthermore, determining the target intent by referring to the inherited intent enables intent inheritance, improving the accuracy of intent recognition.
[0037] To better understand the embodiments of this disclosure, the application scenarios of the embodiments of this disclosure are described below.
[0038] like Figure 2As shown, users can interact with the query system through user terminal 201, and the query system can be located on server 202; in the context of government affairs queries, this query system can be called a government affairs assistant. The user terminal can be a personal computer (PC), laptop, mobile device (such as a mobile phone), etc.; the server can be a local server or a cloud server, etc., and the server can be a single server or a server cluster; the user terminal and the server can communicate through wired communication networks and / or wireless communication networks.
[0039] Users can send queries to the query system through their user terminals, and users can have multiple rounds of dialogue with the query system. Therefore, a query can be a query with at least one round.
[0040] For the current round of query statements, the intent recognition module of the query system can perform intent recognition on the current round of query statements to determine the target intent of the current round of query statements. Then, the query system can obtain the query results corresponding to the current round of query statements based on the target intent and feed them back to the user.
[0041] In related technologies, intent recognition models specifically trained for a particular domain can be used for intent recognition, but they suffer from poor versatility.
[0042] To improve versatility, this embodiment can use LLM for intent recognition. Since LLM is applicable to various fields, using LLM for intent recognition can improve versatility.
[0043] In addition, since LLM is applicable to various fields, it may have insufficient accuracy. In order to improve the accuracy of intent recognition, this embodiment can also obtain inherited intent. The intent obtained by LLM can be called the initial intent. For the current round of query statements, the final target intent can be obtained based on the inherited intent and the initial intent.
[0044] like Figure 3 As shown, for the current round of query statements, the query system can generate a prompt message based on the current round of query statements. Using a pre-defined interface with the LLM (Local Management Module), this prompt message is input into the LLM. The LLM obtains the initial intent of the current round of query statements based on this prompt message and feeds it back to the query system through the aforementioned interface. Additionally, the query system can also obtain the inherited intent of the current round of query statements. Specifically, the query system can record the target intent of each round of query statements. For the current round of query statements, the target intent of the previous round of query statements is used as the inherited intent of the current round of query statements. Then, the query system can obtain the target intent of the current round of query statements based on preset rules, the initial intent obtained from the LLM, and the recorded inherited intent.
[0045] In conjunction with the above application scenarios, this disclosure also provides an intent recognition method based on LLM.
[0046] Figure 4 This is a schematic diagram based on the second embodiment of the present disclosure. This embodiment provides an intent recognition method based on LLM, the method comprising:
[0047] 401. Obtain the current round of query statements and inheritance information.
[0048] The inheritance information includes the inheritance intent, which is obtained after identifying the intent of the previous round of query statements. That is, the target intent of the previous round of query statements can be used as the inheritance intent of the current round of query statements.
[0049] In addition, inheritance information may also include: inherited named entities.
[0050] A named entity is an entity identified by its name, such as a person's name, organization's name, place name, or time.
[0051] For a specific scenario, the named entities that need to be recognized in that scenario can be pre-configured. Taking a government affairs scenario as an example, the named entity can be the location name of the handling agency, such as YY District of City X.
[0052] For each round of query statements, named entity recognition can be performed on the query statements to obtain the named entities of the query statements in that round.
[0053] Inherited named entities refer to those obtained after performing named entity recognition on the previous query statement.
[0054] The inheritance intent mentioned above can be empty or not empty, and the inherited named entity can also be empty or not empty.
[0055] Since the inheritance information (including inheritance intent and inherited named entities) is obtained based on the previous query statement of the current query statement, in some cases, such as when the current query statement is the first query statement in the entire dialogue process, there is no previous query statement for the current query statement (i.e., the first query statement). In this case, the inheritance information will be empty. For another example, the inherited named entities are obtained after performing named entity recognition on the previous query statement. If the previous query statement does not contain the named entity to be recognized (e.g., no place name), the inherited named entities will also be empty.
[0056] Whether the inherited information is empty will affect the subsequent process of determining the target intent. For example, the target intent is determined based on the initial intent and the inherited intent. If the inherited intent is empty, the initial intent can be used as the target intent. Alternatively, if the inherited intent is not empty, in some cases the inherited intent can be used as the target intent, or in other cases the initial intent can be used as the target intent. For the specific determination process, please refer to the relevant descriptions later.
[0057] 402. Generate LLM prompt information based on the current round query statement, and use the LLM to determine the initial intent of the current round query statement based on the prompt information.
[0058] Specifically, candidate intents associated with the current round of query statements can be obtained from a preset intent library; based on a preset generation template, the candidate intents, and the current round of query statements, LLM prompt information can be generated.
[0059] In this embodiment, obtaining candidate intents associated with the current round of query statements and generating prompt information based on these candidate intents can improve the relevance of the prompt information to the current round of query statements, thereby improving processing accuracy and efficiency.
[0060] The intent library can pre-establish multiple intents, which can include the name and / or summary text of each intent. After obtaining the current round of query statements, the intents associated with the current round of query statements can be selected as candidate intents based on keyword matching or semantic matching. For example, the semantic similarity between the current round of query statements and the name and / or summary text of each intent can be calculated, and the intents with a semantic similarity greater than a preset value can be selected as candidate intents.
[0061] A preset generation template describes how the prompt message is generated, and the LLM prompt message is generated based on this preset generation template. Different preset generation templates can be configured for different fields or projects.
[0062] Based on preset generation templates, candidate intents, and the current round of query statements, LLM prompts can be dynamically generated.
[0063] Here is an example of a prompt:
[0064] You are an intent classifier that categorizes the intent of a user's input query into policy content.
[0065] The policy intent categories and their corresponding policy contents are as follows:
[0066] 1. Apply for withdrawal of housing provident fund
[0067] 2. Confirm the qualifications for operating chartered or extra buses during specific time periods.
[0068] 3. Annual inspection of road passenger vehicles
[0069] 4. Tourist passenger vehicle traffic permit
[0070] In addition, when a user enters a query that is not related to the specific policy intent mentioned above, the intent may be as follows:
[0071] 5. Other
[0072] 6. Policy Implementation Details
[0073] 7. Casual conversation
[0074] [For example] A user enters the query: Can I withdraw my housing provident fund offline if I rent a house?
[0075] Output: ```json{"intention":"Application for withdrawal of housing provident fund for rent","reason":"The user mentioned renting a house and wants to withdraw their housing provident fund, therefore intention matches the item "application for withdrawal of housing provident fund for rent"; the user asked if it can be done offline, therefore action matches the category "processing method""}```
[0076] [For example] A user enters the query: How do I apply for an ID card?
[0077] Output: ```json{"intention":"Other","reason":"The user asked a non-policy-related question, which was classified as "Other""}```
[0078] [For example] A user enters the query: Where is the processing location?
[0079] Output: ```json{"intention":"Policy Operation Content","reason":"When a user inquires about the processing location, processing conditions, required materials, or the content of the materials but does not mention the name of the relevant matter or has a vague intention, it is determined to be "Policy Operation Content""}```
[0080] [For example] A user enters the query: How do you view the trade war?
[0081] Output: ```json{"intention":"casual chat","reason":"When a user asks for information unrelated to relevant policies or chats about daily life and entertainment, it is judged as "casual chat""}```
[0082] [Current Question] User entered query: Hello, I want to drive a passenger bus, what materials do I need to provide?
[0083] Please classify the intent of the query entered by the current user and output JSON that conforms to the example format above.
[0084] The intents to be identified in the above prompt, such as the intents numbered 1 to 7 above, are candidate intents; "user input query" in the above prompt is the query statement of the current round; the preset generated template is used to indicate the structure and composition of the above prompt, such as using JSON structure (a data structure) for output, and the output content consists of the intents, reasons, etc. identified by LLM.
[0085] After generating the above prompt, it is input into the LLM, which uses this prompt to obtain the initial intent of the current round of queries. For example, if the current round of queries is "Hello, how to withdraw housing provident fund", the initial intent identified by the LLM is "1. Apply to withdraw housing provident fund".
[0086] 403. Determine clarification intentions based on the initial intentions, wherein the number of clarification intentions is less than or equal to a preset number.
[0087] In this embodiment, by acquiring no more than a preset number of clarification intentions, the effectiveness of clarification intentions can be improved, and the efficiency of intention recognition can be increased.
[0088] Specifically, the initial intent can include the current parent intent. The LLM can obtain one or more initial intents. If there is only one initial intent, that initial intent can be used as the current parent intent. Alternatively, if there are multiple initial intents, one of them can be used as the current parent intent, and the remaining initial intents can be used as candidate intents. Specifically, the LLM can also determine the confidence level of each initial intent, using the initial intent with the highest confidence level as the current parent intent, and the rest as candidate intents.
[0089] The query system can pre-record some intents, which can be recorded in a hierarchical manner. Higher-level intents can be called parent intents, and the next level of intents can be called child intents. For example, the parent intent "apply to withdraw housing provident fund" can be followed by child intents such as "apply to withdraw housing provident fund for buying a house" and "apply to withdraw housing provident fund for renting a house".
[0090] The parent intent and child intent recorded in the query system can be referred to as pre-configured parent intent and pre-configured child intent.
[0091] Based on the correspondence between the pre-configured parent intent and the pre-configured child intent, the current child intent corresponding to the current parent intent included in the initial intent can be obtained.
[0092] For example, if the pre-configured parent intent is "apply to withdraw housing provident fund", the corresponding pre-configured sub-intents include "apply to withdraw housing provident fund for buying a house" and "apply to withdraw housing provident fund for renting a house". If the current parent intent is "apply to withdraw housing provident fund", then the current sub-intents include "apply to withdraw housing provident fund for buying a house" and "apply to withdraw housing provident fund for renting a house".
[0093] The preset quantity is usually 1. Since the current sub-intent quantity is 2, which is greater than 1, a clarification operation is required to obtain 1 clarification intent. For example, after the clarification operation, the clarification intent could be "Apply to withdraw housing provident fund for home purchase".
[0094] If the number of current sub-intents does not exceed a preset number, for example, if there is only one current sub-intent, then the current sub-intent can be used as a clarifying intent. Alternatively, if there is no current parent-child graph in the correspondence between pre-configured parent intents and pre-configured sub-intents, then the current parent intent can be used as a clarifying intent.
[0095] In this embodiment, when the number of current sub-intents is greater than a preset number, a clarifying intent can be obtained based on the current sub-intents to achieve intent clarification. Furthermore, when determining the target intent based on the clarified intent, the accuracy of the target intent can be improved.
[0096] In some embodiments, if the current sub-intent does not contain a named entity, an intent clarification operation is performed based on a preset first configuration file to obtain the clarified intent.
[0097] For example, if the named entity is a place name, and the two current sub-intents mentioned above do not contain place names, then the intent clarification operation can be performed using a preset first configuration file. The first configuration file can be configured with an intent clarification script template. Based on this template, an intent clarification script is generated, and a dialogue is conducted with the user based on this script to obtain the clarification intent.
[0098] In some embodiments, if the current sub-intention contains a named entity, the target named entity corresponding to the current round query statement is obtained, and the current sub-intention containing the target named entity is used as the clarification intention.
[0099] For example, if the named entity is a place name, and the current sub-intent includes: "XX policy in area A" and "XX policy in area B", where area A and area B are place names, then the target named entity corresponding to the current round of queries can be obtained. This current sub-intent containing the target named entity is used as the clarifying intent. For example, if the target named entity is area A, then the clarifying intent is "XX policy in area A".
[0100] In this embodiment, different methods are used to obtain the clarification intent based on whether the current sub-intent contains a named entity, which can improve the processing flexibility and accuracy.
[0101] Furthermore, the target named entity can be obtained using at least one of the following:
[0102] Named entity recognition is performed on the current round of query statements to obtain the target named entity;
[0103] The inheritance information also includes: an inherited named entity, which is used as the target named entity;
[0104] A named entity clarification operation is performed based on a preset second configuration file to obtain the target named entity.
[0105] Specifically, regarding obtaining the target named entity through named entity recognition: After obtaining the current round of query statements, named entity recognition can be performed on the current round of query statements to obtain the target named entity. For example, taking a place name as the named entity to be identified, a lexical analysis of Chinese (LAC) model can be used to extract the place name as the target named entity. The LAC model is a lexical analysis model used for tasks such as Chinese word segmentation, part-of-speech tagging, and named entity recognition. Specifically, if the current round of query statements is "XX District YY Policy", then through named entity recognition, the target named entity can be obtained as "XX District". In this way, by performing named entity recognition on the current round of query statements, the target named entity can be obtained.
[0106] Regarding obtaining the target named entity based on inherited information: Specifically, as shown in 401, the inherited information can also contain inherited named entities, which can be obtained from the inherited information as the target named entity. For example, when retrieving the current round of query statements, if inherited naming information (such as "XX area") is also retrieved, then the inherited naming information "XX area" can be used as the target named entity. In this way, the target named entity can be obtained through the inherited named entity.
[0107] To obtain the target named entity through named entity clarification: Specifically, if the named entity analysis result of the current query is empty, and the inherited named entity is also empty, a dialogue can be initiated with the user through a pre-defined second configuration file to clarify the named entity. For example, the user can be asked whether they are querying the policy for area A or area B. The target named entity is obtained through this process. Thus, the target named entity can also be obtained through user interaction.
[0108] In this embodiment, the target named entity can be obtained through named entity recognition, named entity inheritance, or named entity clarification, which can improve processing flexibility and accuracy.
[0109] 404. Based on the clarification intent and the inheritance intent, determine the target intent of the current round of query statements.
[0110] Specifically, the inheritance intent can be used as the target intent if the following conditions are met; otherwise, the clarification intent can be used as the target intent:
[0111] The initial intent further includes: at least one alternative intent; if the clarifying intent differs from the inherited intent, and the inherited intent belongs to the alternative intent, the inherited intent is taken as the target intent; or...
[0112] If the clarification intent does not belong to the preset explicit intent, and the inherited intent is not empty, the inherited intent shall be taken as the target intent.
[0113] Among them, the inherited intent is obtained based on the previous round of query statements. If the inherited intent belongs to the candidate intent corresponding to the current round of query statements, then since the inherited intent is determined based on two rounds of query statements, while the clarified intent is determined only based on the current round of query statements, the inherited intent is more accurate than the clarified intent. In this case, the inherited intent is taken as the target intent.
[0114] In different scenarios, the explicit intent for that scenario can be preset. For example, in the prompt example above, the intents numbered 1 to 4 are explicit intents, while the intents numbered 5 to 7 are not explicit intents. Assuming that the clarifying intent is "other" and the inherited intent is not empty, the inherited intent is more accurate than the clarifying intent, so the inherited intent is taken as the target intent.
[0115] In other cases, the intent to clarify can be taken as the intent to target.
[0116] In this embodiment, determining the target intent through the above method can improve accuracy.
[0117] In addition, this embodiment takes the use of LLM for intent recognition as an example. In some embodiments, after obtaining the current round query statement, it can also determine whether there is a preset intent that matches the keywords in the current round query statement according to the preset matching rules. If there is, the preset intent is taken as the target intent. If there is no matching preset intent, the above-mentioned 402 and subsequent steps are executed.
[0118] Figure 5 This is a schematic diagram according to the third embodiment of the present disclosure. This embodiment provides an intent recognition device based on LLM. The device 500 includes: an acquisition module 501, a first determination module 502, and a second determination module 503.
[0119] The acquisition module 501 is used to acquire the current round query statement and inheritance information; the inheritance information includes inheritance intent, which is obtained after intent recognition of the previous round query statement; the first determination module 502 is used to generate LLM prompt information based on the current round query statement, and use the LLM to determine the initial intent of the current round query statement based on the prompt information; the second determination module 503 is used to determine the target intent of the current round query statement based on the initial intent and the inheritance intent.
[0120] In this embodiment, the initial intent of the current query statement is obtained based on LLM, and the target intent of the current query statement is determined based on this initial intent and the inherited intent. This eliminates the need to train specialized intent recognition models for each domain, thereby improving the versatility of intent recognition. Furthermore, determining the target intent by referring to the inherited intent enables intent inheritance, improving the accuracy of intent recognition.
[0121] In some embodiments, the first determining module 502 is further configured to:
[0122] Within a preset intent library, retrieve candidate intents associated with the current round of query statements;
[0123] Based on the preset generation template, the candidate intent, and the current round query statement, an LLM prompt message is generated.
[0124] In this embodiment, obtaining candidate intents associated with the current round of query statements and generating prompt information based on these candidate intents can improve the relevance of the prompt information to the current round of query statements, thereby improving processing accuracy and efficiency.
[0125] In some embodiments, the second determining module 503 is further configured to:
[0126] Based on the initial intent, a clarification intent is determined, wherein the number of clarification intents is less than or equal to a preset number;
[0127] The target intent is determined based on the clarification intent and the inheritance intent.
[0128] In this embodiment, by acquiring no more than a preset number of clarification intentions, the effectiveness of clarification intentions can be improved, and the efficiency of intention recognition can be increased.
[0129] In some embodiments, the initial intent includes: the current parent intent; the second determining module 503 is further configured to:
[0130] If the current parent intent is not included in the pre-configured parent intent and pre-configured child intent correspondence, then the current parent intent is taken as the clarification intent.
[0131] or,
[0132] If the correspondence between the pre-configured parent intent and the pre-configured child intent includes the current parent intent, then the current child intent corresponding to the current parent intent is obtained based on the correspondence between the pre-configured parent intent and the pre-configured child intent; and if the number of the current child intents is less than or equal to a preset number, then the current child intent is used as the clarification intent.
[0133] or,
[0134] If the current parent intent is included in the correspondence between the pre-configured parent intent and the pre-configured child intent, then the current child intent corresponding to the current parent intent is obtained based on the correspondence between the pre-configured parent intent and the pre-configured child intent; and if the number of current child intents is greater than the preset number, then the current child intents are processed to determine the clarification intent.
[0135] In this embodiment, when the number of current sub-intents is greater than a preset number, a clarifying intent can be obtained based on the current sub-intents to achieve intent clarification. Furthermore, when determining the target intent based on the clarified intent, the accuracy of the target intent can be improved.
[0136] In some embodiments, the second determining module 503 is further configured to:
[0137] If the current sub-intent does not contain a named entity, an intent clarification operation is performed based on a preset first configuration file to determine the clarified intent; or...
[0138] If the current sub-intention contains a named entity, obtain the target named entity corresponding to the current round query statement, and use the current sub-intention containing the target named entity as the clarification intention.
[0139] In this embodiment, different methods are used to obtain the clarification intent based on whether the current sub-intent contains a named entity, which can improve the processing flexibility and accuracy.
[0140] In some embodiments, the second determining module 503 is further configured to:
[0141] Named entity recognition is performed on the current round of query statements to obtain the target named entity;
[0142] The inheritance information also includes: an inherited named entity, which is used as the target named entity;
[0143] A named entity clarification operation is performed based on a preset second configuration file to obtain the target named entity.
[0144] In this embodiment, the target named entity can be obtained through named entity recognition, named entity inheritance, or named entity clarification, which can improve processing flexibility and accuracy.
[0145] In some embodiments, the second determining module 503 is further configured to:
[0146] The inherited intent is taken as the target intent only if the following conditions are met; otherwise, the clarifying intent is taken as the target intent:
[0147] The initial intent further includes: at least one alternative intent; if the clarifying intent differs from the inherited intent, and the inherited intent belongs to the alternative intent, the inherited intent is taken as the target intent; or...
[0148] If the clarification intent does not belong to the preset explicit intent, and the inherited intent is not empty, the inherited intent shall be taken as the target intent.
[0149] In this embodiment, determining the target intent through the above method can improve accuracy.
[0150] It is understood that the same or similar content in different embodiments of this disclosure can be referred to each other.
[0151] It is understood that the terms "first" and "second" in the embodiments of this disclosure are only used for distinction and do not indicate the degree of importance or the order of events.
[0152] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0153] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0154] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. Electronic device 600 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. Electronic device 600 may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0155] like Figure 6As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. The RAM 603 may also store various programs and data required for the operation of the electronic device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0156] Multiple components in electronic device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of displays, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows electronic device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0157] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as the LLM-based intent recognition method. For example, in some embodiments, the LLM-based intent recognition method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the LLM-based intent recognition method described above can be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform an LLM-based intent recognition method by any other suitable means (e.g., by means of firmware).
[0158] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0159] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to the processor or controller of a general-purpose computer, special-purpose computer, or other programmable load balancing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0160] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0161] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0162] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0163] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0164] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0165] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An intent recognition method based on LLM, comprising: Retrieve the current round of query statements and inheritance information; The inherited information includes the inherited intent, which is the target intent obtained after intent recognition of the previous round of query statements, and the target intent is the intent finally determined after intent recognition of each round of query statements. Based on the current round of query statements, generate LLM prompt information, and use the LLM to determine the initial intent of the current round of query statements based on the prompt information; Based on the initial intent and the inherited intent, the target intent of the current round of query statements is determined, including: A clarification intent is determined based on the initial intent, and the number of clarification intents is less than or equal to a preset number; the initial intent includes the current parent intent, and when the number of pre-configured current child intents corresponding to the current parent intent is less than or equal to a preset number, the current child intent is used as the clarification intent; Taking the inheritance intention or the clarification intention as the target intention includes: The inherited intent is taken as the target intent only if the following conditions are met; otherwise, the clarifying intent is taken as the target intent: The initial intent further includes: at least one alternative intent; if the clarifying intent differs from the inherited intent, and the inherited intent belongs to the alternative intent, the inherited intent is taken as the target intent; or... If the clarification intent does not belong to the preset explicit intent, and the inherited intent is not empty, the inherited intent shall be taken as the target intent.
2. The method according to claim 1, wherein, The LLM prompt information generated based on the current round of query statements includes: Within a preset intent library, retrieve candidate intents associated with the current round of query statements; Based on the preset generation template, the candidate intent, and the current round query statement, an LLM prompt message is generated.
3. The method according to claim 1, wherein, The step of determining the clarification intent based on the initial intent includes: If the current parent intent is not included in the pre-configured parent intent and pre-configured child intent correspondence, then the current parent intent is taken as the clarification intent. or, If the correspondence between the pre-configured parent intent and the pre-configured child intent includes the current parent intent, then the current child intent corresponding to the current parent intent is obtained based on the correspondence between the pre-configured parent intent and the pre-configured child intent; and if the number of the current child intents is less than or equal to a preset number, then the current child intent is used as the clarification intent. or, If the current parent intent is included in the correspondence between the pre-configured parent intent and the pre-configured child intent, then the current child intent corresponding to the current parent intent is obtained based on the correspondence between the pre-configured parent intent and the pre-configured child intent; and if the number of current child intents is greater than the preset number, then the current child intents are processed to determine the clarification intent.
4. The method according to claim 3, wherein, The process of processing the current sub-intent to determine the clarifying intent includes: If the current sub-intent does not contain a named entity, an intent clarification operation is performed based on a preset first configuration file to determine the clarified intent; or... If the current sub-intention contains a named entity, obtain the target named entity corresponding to the current round query statement, and use the current sub-intention containing the target named entity as the clarification intention.
5. The method according to claim 4, wherein, The step of obtaining the target named entity corresponding to the current round of query statements includes at least one of the following: Named entity recognition is performed on the current round of query statements to obtain the target named entity; The inheritance information also includes: an inherited named entity, which is used as the target named entity; A named entity clarification operation is performed based on a preset second configuration file to obtain the target named entity.
6. An intent recognition device based on LLM, comprising: The retrieval module is used to retrieve the current round of query statements and inheritance information; The inherited information includes the inherited intent, which is the target intent obtained after intent recognition of the previous round of query statements, and the target intent is the intent finally determined after intent recognition of each round of query statements. The first determining module is used to generate LLM prompt information based on the current round query statement, and use the LLM to determine the initial intent of the current round query statement based on the prompt information; The second determining module is used to determine the target intent of the current round query statement based on the initial intent and the inherited intent; The second determining module is further used for: A clarification intent is determined based on the initial intent, and the number of clarification intents is less than or equal to a preset number; the initial intent includes the current parent intent, and when the number of pre-configured current child intents corresponding to the current parent intent is less than or equal to a preset number, the current child intent is used as the clarification intent; The intention to inherit or the intention to clarify shall be taken as the intention to target.
7. The apparatus according to claim 6, wherein, The first determining module is further configured to: Within a preset intent library, retrieve candidate intents associated with the current round of query statements; Based on the preset generation template, the candidate intent, and the current round query statement, an LLM prompt message is generated.
8. The apparatus according to claim 6, wherein, The second determining module is further used for: If the current parent intent is not included in the pre-configured parent intent and pre-configured child intent correspondence, then the current parent intent is taken as the clarification intent. or, If the current parent intent is included in the correspondence between the pre-configured parent intent and the pre-configured child intent, then the current child intent corresponding to the current parent intent is obtained based on the correspondence between the pre-configured parent intent and the pre-configured child intent. Furthermore, if the number of current sub-intents is less than or equal to a preset number, then the current sub-intent is taken as the clarification intent; or, If the current parent intent is included in the correspondence between the pre-configured parent intent and the pre-configured child intent, then the current child intent corresponding to the current parent intent is obtained based on the correspondence between the pre-configured parent intent and the pre-configured child intent. Furthermore, if the number of current sub-intents is greater than the preset number, the current sub-intents are processed to determine the clarification intent.
9. The apparatus according to claim 8, wherein, The second determining module is further used for: If the current sub-intent does not contain a named entity, an intent clarification operation is performed based on a preset first configuration file to determine the clarified intent; or, If the current sub-intention contains a named entity, obtain the target named entity corresponding to the current round query statement, and use the current sub-intention containing the target named entity as the clarification intention.
10. The apparatus according to claim 9, wherein, The second determining module is further used for: Named entity recognition is performed on the current round of query statements to obtain the target named entity; The inheritance information also includes: an inherited named entity, which is used as the target named entity; A named entity clarification operation is performed based on a preset second configuration file to obtain the target named entity.
11. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-5.
13. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-5.
Citation Information
Patent Citations
Interactive content generation method and device, computer equipment and storage medium
CN109857848A
Intention recognition method and device
CN111401048A
User intention recognition method, reply generation method, and server
CN117034958A