Dialogue process control method and device based on large language model, equipment and medium
By mining historical dialogue data, building a dialogue strategy library and configuring dialogue processes, the problem of insufficient accuracy and reliability of the intelligent customer service dialogue system response is solved, and higher quality user experience and system performance are achieved.
Patent Information
- Application Number
- CN202411494366.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-14
AI Technical Summary
The existing intelligent customer service dialogue system has shortcomings in response accuracy and reliability, especially the content generated by large language models may be out of touch with actual needs and lack consistency and accuracy.
By obtaining historical conversation data within the predefined target business scope, data mining and analysis, extracting multiple conversation strategies and building a policy library. Generate corresponding dialogue process according to each dialogue policy, and configure the response templates for each dialogue node in the dialogue process. When user input is received, the target policy is matched and switched to the target dialogue node, prompt text is generated based on the response template and input it into a large language model, and reply text is generated.
It improves the accuracy and reliability of the reply of the dialogue system, so that the large language model can respond with a unified response template based on the most matching dialogue strategy when generating replies, ensuring that the response is consistent with the actual needs and is consistent and accurate.
Smart Images

Figure CN119441402A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence technology and financial technology, and in particular to a dialogue process control method, device, equipment and medium based on a large language model. Background Art
[0002] With the rapid development of artificial intelligence technology, intelligent customer service dialogue systems have been widely used in various industries. Intelligent customer service dialogue systems in the financial field play an important role in improving user experience and service efficiency. In the development of intelligent customer service and user interaction systems, the design of dialogue processes has always been a key link. Traditional manually designed dialogue processes have the problems of few coverage scenarios and insufficient flexibility.
[0003] In recent years, the emergence of large-scale pre-trained language models (LLMs) has brought new solutions to intelligent question-answering systems. These models learn rich semantic and grammatical knowledge through unsupervised pre-training on large-scale corpora, so that they can handle natural language tasks such as question-answering and dialogue. However, although large language models can generate natural language dialogues, the generated content may often be out of touch with actual needs, and the generated content sometimes lacks consistency and accuracy, making it difficult to ensure the accuracy and reliability of the dialogue system's responses. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, the purpose of the present invention is to provide a dialogue process control method, device, equipment and medium based on a large language model that can be applied to financial technology or other related fields. Its main purpose is to improve the accuracy and reliability of the response of the dialogue system.
[0005] The technical solution of the present invention is as follows:
[0006] A first aspect of the present invention provides a dialog flow control method based on a large language model, comprising:
[0007] Acquire a predefined target business scope, and collect historical conversation data within the target business scope;
[0008] Performing data mining and analysis on the historical dialogue data, extracting multiple dialogue strategies and constructing a strategy library;
[0009] Generate a corresponding dialogue process according to each dialogue strategy, and configure a response template for each dialogue node in the dialogue process;
[0010] When receiving the user's input text, matching the input text in the policy library to obtain a target policy, and executing a corresponding dialogue path switching action according to the dialogue flow of the target policy to switch to a target dialogue node;
[0011] Generate corresponding prompt text based on the response template and input text of the target dialogue node, input the prompt text into the trained large language model, and generate reply text of the target dialogue node.
[0012] A second aspect of the present invention provides a dialog flow control device based on a large language model, comprising:
[0013] A data collection module, used to obtain a predefined target business scope and collect historical conversation data within the target business scope;
[0014] A data mining module is used to perform data mining and analysis on the historical dialogue data, extract multiple dialogue strategies and construct a strategy library;
[0015] A process building module, used to generate a corresponding dialogue process according to each dialogue strategy, and configure a response template for each dialogue node in the dialogue process;
[0016] A strategy matching execution module is used for, when receiving a user's input text, matching the input text in the strategy library to obtain a target strategy, and executing a corresponding dialogue path switching action according to the dialogue flow of the target strategy to switch to a target dialogue node;
[0017] The input dialogue module is used to generate corresponding prompt text based on the response template and input text of the target dialogue node, input the prompt text into the trained large language model, and generate the reply text of the target dialogue node.
[0018] A third aspect of the present invention provides a computer device, comprising at least one processor; and
[0019] a memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned dialogue flow control method based on the large language model.
[0021] A fourth aspect of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned dialogue flow control method based on the large language model.
[0022] Beneficial effects: The present invention discloses a method, device, equipment and medium for controlling a dialogue process based on a large language model. Compared with the prior art, the embodiment of the present invention obtains a predefined target business scope, collects historical dialogue data within the target business scope; performs data mining and analysis on the historical dialogue data, extracts multiple dialogue strategies and constructs a strategy library; generates a corresponding dialogue process according to each dialogue strategy, and configures a response template for each dialogue node in the dialogue process; when receiving the user's input text, matches the input text in the strategy library to obtain the target strategy, and performs a corresponding dialogue path switching action according to the dialogue process of the target strategy to switch to the target dialogue node; generates a corresponding prompt text based on the response template and input text of the target dialogue node, inputs the prompt text into the trained large language model, and generates a reply text of the target dialogue node. By performing data mining on the historical dialogue data to form a strategy library that meets the corresponding business needs, and configuring the dialogue process and response template of each dialogue strategy, the large language model can reply with a unified response template based on the most matching dialogue strategy when generating the reply text, effectively improving the reply accuracy and reliability of the dialogue system. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the scheme in the present invention, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 A schematic diagram of an application environment of a dialog flow control method based on a large language model provided in an embodiment of the present invention;
[0025] Figure 2 A flow chart of a dialog flow control method based on a large language model provided by an embodiment of the present invention;
[0026] Figure 3 A flow chart of step S202 in the dialogue flow control method based on a large language model provided in an embodiment of the present invention;
[0027] Figure 4 A flow chart of step S204 in the dialogue flow control method based on a large language model provided in an embodiment of the present invention;
[0028] Figure 5 A schematic diagram of functional modules of a dialog flow control device based on a large language model provided by an embodiment of the present invention;
[0029] Figure 6 A schematic diagram of the hardware structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The embodiments of the present invention are described below in conjunction with the accompanying drawings.
[0031] The dialogue flow control method based on the large language model provided by the embodiment of the present invention can be applied to Figure 1 In the application environment of FIG. 1 , it includes a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0032] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only as examples).
[0033] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0034] The server 105 may be a server that provides various services, such as a background server that provides support for the content browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (for example only). The background server may analyze and process the received data such as the user request, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device. The server 105 may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server 105 may also be a server for a distributed system, or a server combined with a blockchain.
[0035] It should be noted that the dialogue flow control method based on the large language model provided in the embodiment of the present application can generally be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the dialogue flow control device based on the large language model provided in the embodiment of the present invention can also be set in the first terminal device 101, the second terminal device 102 or the third terminal device 103. Alternatively, the dialogue flow control method based on the large language model provided in the embodiment of the present invention can also generally be executed by the server 105. Accordingly, the dialogue flow control device based on the large language model provided in the embodiment of the present invention can generally be set in the server 105.
[0036] It should be understood that the numbers of the above terminal devices, networks and servers are only illustrative. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0037] like Figure 2 As shown, the dialogue flow control method based on the large language model provided by the embodiment of the present invention specifically includes the following steps:
[0038] S201: Acquire a predefined target business scope, and collect historical conversation data within the target business scope.
[0039] In this embodiment, the application business scope of the dialogue system is first clarified, that is, the specific problems and application scenarios that the dialogue system needs to solve are pre-determined, such as customer service, sales support, information query, etc., so as to define the target business scope that the dialogue system needs to cover. By obtaining the pre-defined target business scope, historical dialogue data within the target business scope is collected as samples for data mining and analysis. For example, when the target business is bank customer service, historical dialogue data can be collected from the bank's customer service records. These data may include text transcriptions of telephone recordings, online chat logs, and customer support work order records. By collecting historical dialogue data within the target business scope, a corpus containing various customer inquiries and problem-solving strategies is constructed, which provides a basis for subsequent dialogue strategy extraction and dialogue process design.
[0040] S202: Perform data mining and analysis on the historical dialogue data, extract multiple dialogue strategies and construct a strategy library.
[0041] In this embodiment, for the collected historical conversation data that is highly related to the target business scope, the historical conversation data is analyzed through data mining techniques such as association rule learning, decision trees, and cluster analysis, so as to extract useful information from a large amount of historical conversation data and identify common problem patterns and effective solutions. For example, it is possible to identify frequently asked questions by customers and their corresponding solution strategies, and to discover common patterns and abnormal situations in historical conversations, etc., to provide a basis for building a conversation process. Through the data mining results, multiple conversation strategies are extracted according to user intentions, conversation patterns, etc. in the historical conversation data and a strategy library is constructed. These conversation strategies can be used to guide the dialogue system to respond in similar conversation scenarios. This can avoid the defects of obtaining conversation strategy confirmation context understanding and application scenarios in a purely data-driven manner, and can improve the availability of subsequent conversation processes.
[0042] S203: Generate a corresponding dialogue flow according to each dialogue strategy, and configure a response template for each dialogue node in the dialogue flow.
[0043] In this embodiment, the dialogue strategy refers to the control of the dialogue process according to the user's input and dialogue history in the dialogue system, and the generation of a structured dialogue process based on multiple dialogue strategies obtained by data mining. Specifically, different dialogue nodes of the dialogue process can be created according to each dialogue strategy, such as "start", "intention confirmation", "information collection", "task execution" and "end", and the nodes can be connected with transfer conditions. For example, after "intention confirmation", if the information is incomplete, it will be transferred to "information collection", etc., so that it can switch between different nodes according to the user's input and dialogue process, and guide the dialogue to move forward. After the dialogue process is generated, a response template for responding to the user is also configured for each dialogue node in the dialogue process, so that the dialogue system can respond under the framework of a unified response template when generating a reply text, ensuring the natural fluency and uniformity of the dialogue, and avoiding the problem of lack of consistency in the reply content of the dialogue system based on the large language model under the same input.
[0044] S204: When receiving the user's input text, obtain a target policy in the policy library according to the input text, and execute a corresponding dialogue path switching action according to the dialogue flow of the target policy to switch to the target dialogue node.
[0045] In this embodiment, the configured dialogue flow and large language model are integrated into the dialogue system. After ensuring the stability and security of the system through internal testing, user testing and other processes, the dialogue system based on the large language model can be deployed to the production environment to conduct interactive dialogues with users. The user can input the corresponding text through the front-end interactive interface, such as "I want to check the balance", etc. At this time, the system can understand the user's intention and determine the topic of the dialogue through natural language processing technology based on the received input text, match the corresponding target strategy in the strategy library based on the processing result, and then perform the corresponding dialogue path switching action to switch to the target dialogue node according to the dialogue flow of the target strategy. For example, for the above-mentioned "I want to check the balance" text, the query dialogue strategy can be matched to guide the dialogue to the information query dialogue node, thereby ensuring that the system responds to user input in a consistent and expected manner, while allowing flexible processing of different queries and tasks, improving user satisfaction and system efficiency.
[0046] S205: Generate corresponding prompt text based on the response template and input text of the target dialogue node, input the prompt text into the trained large language model, and generate a reply text of the target dialogue node.
[0047] In this embodiment, after the target strategy is determined based on the user's input text matching and the corresponding target dialogue node is switched, the response template of the target dialogue node is obtained, and the corresponding prompt text is generated in combination with the user's input text. The prompt text is used to prompt the large language model to perform the task in the corresponding template on the user's input text. Therefore, the prompt text is input into the trained large language model, and a reply text with the response template as the framework can be generated at the target dialogue node for the user's input text. The specific response template and prompt text can be flexibly set according to the needs. For example, after determining that the user wants to query the balance, the dialogue path switching action is executed to switch to the dialogue node of information query. The response template of the dialogue node can be of various types, such as the confirmation type template can be "confirm which account the user wants to query the balance"; the specific guidance template can be "in order to query the balance, please provide the account number of the user"; the security prompt template can be "for security considerations, please prompt the user to complete the identity verification as required", etc. Based on different types of response templates, corresponding prompt texts can be generated, that is, prompts are input into the large language model. For example, the intention confirmation prompt can be "the user said: "I want to check my account balance." ", confirm the user's intention and ask them which account balance they want to check." The generated reply text can be "Do you want to check the balance of your account A or account B?"; the security prompt can be "The user has provided account number XXX, but identity verification has not been completed. For security reasons, please prompt the user to complete identity verification as required", and the generated reply text can be "Thank you for providing your account number. To ensure account security, please complete identity verification as prompted." Taking advantage of the large language model's ability to handle complex language structures and understand contextual context, after matching the target dialogue strategy to the strategy library formed based on data mining, the large language model can respond with a unified response template based on the most matching dialogue strategy when generating a reply text, making the reply text not only natural and humane but also avoiding being out of touch with actual business needs, providing a higher quality user experience, and improving the overall performance of the dialogue system.
[0048] In the above embodiment, the present invention discloses a method for controlling a dialog flow based on a large language model, which acquires a predefined target business scope and collects historical dialog data within the target business scope; performs data mining and analysis on the historical dialog data, extracts multiple dialog strategies and constructs a strategy library; generates a corresponding dialog flow according to each dialog strategy, and configures a response template for each dialog node in the dialog flow; when receiving a user's input text, matches the input text in the strategy library to obtain a target strategy, and performs a corresponding dialog path switching action according to the dialog flow of the target strategy to switch to the target dialog node; generates a corresponding prompt text based on the response template and input text of the target dialog node, inputs the prompt text into the trained large language model, and generates a reply text of the target dialog node. By performing data mining on the historical dialog data to form a strategy library that meets the corresponding business requirements, and configuring the dialog flow and response template of each dialog strategy, the large language model can reply with a unified response template based on the most matching dialog strategy when generating a reply text, effectively improving the reply accuracy and reliability of the dialog system.
[0049] In one embodiment, Figure 3 As shown, step S202 includes:
[0050] S301, performing data mining and analysis on the historical conversation data to obtain topics, intentions, normal conversation flows, and abnormal conversation flows in the historical conversation data;
[0051] S302. Extracting dialogue strategies based on the topic, intention, normal dialogue flow and abnormal dialogue flow through a strategy iteration algorithm to obtain multiple dialogue strategies and construct a strategy library.
[0052] In this embodiment, after the historical conversation data is collected, data cleaning can be performed on it to remove invalid or erroneous conversation records in the historical conversation data and unify the conversation format. The processed data is further mined and analyzed, including topic identification processing, such as classifying conversation records and identifying different topic categories through text classification technology, such as support vector machine (SVM) or deep learning model; intention identification processing, such as using natural language processing technology BERT or LSTM to analyze the intention of user input; conversation process analysis, analyzing normal conversation processes through pattern recognition, such as user consultation, problem solving, etc., and identifying abnormal processes in conversations through anomaly detection technology, such as user complaints or misunderstandings. By analyzing historical conversation data, the effectiveness of different strategies can be evaluated, and conversation strategies can be extracted based on topics, intentions, normal conversation processes and abnormal conversation processes through strategy iteration algorithms. The strategy that is most likely to bring positive results in a specific state is selected in the historical conversation, thereby forming a strategy library containing the optimal conversation strategies in different situations, so that the conversation system can dynamically select the most appropriate strategy according to the current conversation context and user behavior after actual deployment, and better understand and meet user needs.
[0053] In one embodiment, step S301 includes:
[0054] Extracting features from the historical conversation data to obtain a feature vector for each conversation data;
[0055] According to the feature vector of each conversation data, the topic and intent are classified respectively to obtain the topic and intent label of each conversation data;
[0056] The classified topics and intent tags are subjected to pattern recognition through a sequence mining algorithm to identify normal conversation flows and abnormal conversation flows in the historical conversation data.
[0057] In this embodiment, when data mining and analyzing historical conversation data, data cleaning, word segmentation, stop word removal, etc. can be performed first, and feature extraction can be performed on the processed historical conversation data to extract conversation features in the data. For example, TF-IDF, Word2Vec, BERT and other methods are used to convert text into feature vectors that can be quantified and processed, and the feature vectors of each conversation data are obtained. The unstructured text data is converted into numerical features that can be used in machine learning models to better understand the conversation data. After that, topic classification and intent classification are performed for the feature vectors of each conversation data. For example, common topics can be identified by clustering algorithms such as K-means and hierarchical clustering, and the user's intent can be identified by classification algorithms such as naive Bayes and support vector machines, so as to obtain the classification results of each conversation, including topics and intent labels. Based on the classified topics and intent labels, a sequence mining algorithm (such as Apriori and frequent pattern growth) is used to identify frequent item sets or patterns in the data, because in the conversation data, the sequence of topics and intents can show the process of user interaction with the system. By analyzing these sequences, we can find the regularity of user behavior. For example, when users consult after-sales service, they often follow the pattern of "asking about return policy -> providing product information -> confirming return process". Similarly, it can also be used to discover abnormal processes, such as frequent complaints or dissatisfaction of users in normal processes. These may be areas that need improvement in the dialogue process. Therefore, sequence mining based on topics and intent tags can reliably identify standard and abnormal processes in the dialogue, providing reference information for extracting the optimal dialogue strategy.
[0058] In one embodiment, step S302 includes:
[0059] A state set is defined according to the topic and the intention, and an action set is defined according to the dialogue path switching actions in the normal dialogue flow and the abnormal dialogue flow;
[0060] Calculate the state transition probability and reward value of executing different actions in the action set in each state according to the normal dialogue process and the abnormal dialogue process;
[0061] By using a policy iteration algorithm, policy evaluation and policy improvement are alternately performed in each state according to the state transition probability and the reward value, the optimal policy in each state is obtained and the policy library is constructed, and the optimal policy is used to execute the dialogue path switching action with the maximum cumulative value in a given state.
[0062] In this embodiment, when extracting and building a policy library based on data mining results, a state set is first defined based on the mined topics and intentions, that is, in a dialogue system, a state can be a topic or an intention, and a topic usually refers to the subject or field of the dialogue content, such as "travel", "health", "technology", etc., and an intention refers to the purpose of the user initiating a dialogue or asking a question, such as "product purchase", "information query", "complaint service", etc. In the policy iteration algorithm, topics and intentions can be used as the state of each stage in the user dialogue process, and the action set is obtained based on the dialogue path switching actions in the normal dialogue process and the abnormal dialogue process, such as "ask questions", "confirm information", "provide information", "go to other processes", etc. By defining the state and action set, a clear dialogue process framework is provided for building dialogue strategies.
[0063] At the same time, by analyzing historical dialogue data, the probability of transferring to another state after performing a certain action in a specific state is calculated. For example, the probability of transferring from the "user consultation" state to the "waiting for user answer" state after performing the "ask" action, and assigning a reward value to each state transition, which can be determined based on the effectiveness of the dialogue, user satisfaction, or dialogue efficiency. For example, the state transition of successfully solving a problem in a normal dialogue process may have a higher positive reward value, while the state transition of receiving a user complaint in an abnormal dialogue process may have a lower negative reward. The dialogue strategy learning is guided by the reward value, so that the system tends to take actions that can obtain higher rewards, so that when extracting the dialogue strategy, it can predict and select the path that is most likely to advance the dialogue, and obtain the optimal dialogue strategy for different states.
[0064] When extracting the specific dialogue strategy, the strategy iteration algorithm is used to alternately perform strategy evaluation and strategy improvement in each state according to the state transition probability and reward value. During strategy evaluation, the current strategy is used to execute the dialogue, and the state transition and reward data are collected to obtain the optimal strategy in each state and construct the strategy library. The strategy improvement is to update the strategy based on the collected data using the strategy iteration algorithm to maximize the cumulative value reward. Strategy evaluation and strategy improvement are performed alternately until the strategy converges to obtain the dialogue path with the maximum cumulative value in a given state. At this time, the optimal strategy corresponding to the switching action of the dialogue path is executed. Therefore, through the above iterative process, the dialogue strategies under various topics or intentions are continuously optimized to adapt to new dialogue scenarios and needs, thereby obtaining the optimal strategies under different dialogue scenarios, and constructing a strategy library that can adapt to different dialogue needs, thereby improving the flexibility and robustness of the dialogue system.
[0065] In one embodiment, Figure 4 As shown, step S204 includes:
[0066] S401, parsing the input text to obtain the topic and / or intention of the current dialogue node;
[0067] S402: performing strategy matching in the strategy library according to the topic and / or intention of the current dialogue node, and obtaining the optimal strategy under the topic and / or intention of the current dialogue node as the target strategy;
[0068] S403: Execute a corresponding dialogue path switching action at the current dialogue node according to the dialogue flow of the target strategy, and switch from the current dialogue node to the target dialogue node.
[0069] In this embodiment, the topic and / or intention in the user's input text is identified by performing text parsing of natural language processing on the input text provided by the user. For example, if the user says: "I want to know my account balance", the intention of "querying the balance" will be identified at this time. Then, based on the topic and / or intention parsed by the current dialogue node, the policy library is searched for a policy that matches the intention and / or topic input by the user. For example, if the identified intention is "querying the balance", the optimal policy related to this is found in the policy library as the target policy. By accurately matching the policy, it can be ensured that the dialogue system will provide the most appropriate response according to the specific needs of the user. After matching the target policy, the corresponding dialogue path switching action is performed at the current dialogue node according to the dialogue flow of the target policy, and the current dialogue node is switched to the target dialogue node, that is, the dialogue state is updated according to the target policy, for example, the state of "waiting for user instructions" is switched to the state of "providing balance information", so that the dialogue system can naturally switch between different dialogue nodes according to the target policy, and the target dialogue node after the path switching can effectively restore the user's question to maintain the coherence and consistency of the dialogue.
[0070] In one embodiment, before generating corresponding prompt text based on the response template and input text of the target dialogue node, inputting the prompt text into the trained large language model, and generating the reply text of the target dialogue node, the method further includes:
[0071] Collect business knowledge data within the target business scope;
[0072] The large language model is fine-tuned according to the historical conversation data and the business knowledge data to obtain a large language model that is adapted to business scenarios within the target business scope.
[0073] In this embodiment, in order to improve the adaptability between the dialogue system and the target business scenario so that it can better respond to the user's input text, the model can be fine-tuned based on professional data before deployment, so as to help the dialogue system adapt to the specific requirements of different industries and scenarios and enhance its flexibility. Specifically collect business knowledge data within the target business scope, for example, extract business data from the internal system of the enterprise, such as CRM, ERP system, obtain customer information, transaction records, etc.; obtain external data through public data sources or third-party cooperation, such as market research reports, industry statistics; directly collect data through questionnaires, user feedback, etc., to ensure that the dialogue system can access rich business knowledge data. Based on the collected business knowledge data and historical dialogue data, fine-tune the pre-set large language model, adjust the model parameters to adapt to the business scenarios within the target business scope, and fine-tune the model to better adapt to specific business scenarios, understand and generate dialogue content that better meets business needs, and improve the performance and accuracy of the dialogue system.
[0074] In one embodiment, after generating corresponding prompt text based on the response template and input text of the target dialogue node, inputting the prompt text into the trained large language model, and generating the reply text of the target dialogue node, the method further includes:
[0075] Collect conversation performance indicator data and user feedback information;
[0076] The dialogue process of each dialogue strategy is optimized according to the dialogue performance indicator data and feedback information.
[0077] In this embodiment, after the dialogue system is deployed, key dialogue performance indicator data such as response time, error rate, and user satisfaction of the dialogue system can be collected through monitoring tools, and user feedback information can also be collected through channels such as online questionnaires, user forums, and social media. The performance of the dialogue system can be quantitatively evaluated through the collected performance data and user feedback, providing a basis for further optimization. The collected performance indicators and user feedback are analyzed, and the dialogue strategy is adjusted, such as deleting or merging non-essential dialogue nodes in the dialogue strategy to improve dialogue efficiency, or adding necessary nodes to clarify the purpose of the dialogue, or optimizing the response template to enrich the diversity of the dialogue content, etc. By optimizing the dialogue strategy, the overall performance of the dialogue system is improved, errors and delays are reduced, and user needs are better met.
[0078] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.
[0079] Further references Figure 5 , as a response to the above Figure 2 The present invention provides an embodiment of a dialogue flow control device based on a large language model, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0080] like Figure 5 As shown, the dialog flow control device 50 based on the large language model described in this embodiment includes:
[0081] The data collection module 501 is used to obtain a predefined target business scope and collect historical conversation data within the target business scope;
[0082] A data mining module 502 is used to perform data mining and analysis on the historical dialogue data, extract multiple dialogue strategies and construct a strategy library;
[0083] A process construction module 503 is used to generate a corresponding dialogue process according to each dialogue strategy, and configure a response template for each dialogue node in the dialogue process;
[0084] A strategy matching execution module 504 is used for, when receiving a user input text, matching the input text in the strategy library to obtain a target strategy, and executing a corresponding dialogue path switching action according to the dialogue flow of the target strategy to switch to a target dialogue node;
[0085] The input dialogue module 505 is used to generate corresponding prompt text based on the response template and input text of the target dialogue node, input the prompt text into the trained large language model, and generate the reply text of the target dialogue node.
[0086] The module referred to in the present invention refers to a series of computer program instruction segments that can perform specific functions, which is more suitable for describing the execution process of dialogue flow control based on a large language model than a program. For the specific implementation of each module, please refer to the corresponding method embodiment above, which will not be repeated here.
[0087] In one embodiment, the data mining module 502 includes:
[0088] A mining and analysis unit, configured to perform data mining and analysis on the historical conversation data to obtain topics, intentions, normal conversation flows, and abnormal conversation flows in the historical conversation data;
[0089] The strategy extraction unit is used to extract dialogue strategies according to the topic, intention, normal dialogue flow and abnormal dialogue flow through a strategy iteration algorithm, obtain multiple dialogue strategies and construct a strategy library.
[0090] In one embodiment, the mining and analysis unit includes:
[0091] A feature extraction unit, used to extract features from the historical conversation data to obtain a feature vector for each conversation data;
[0092] A classification unit is used to classify topics and intents according to the feature vectors of each conversation data, and obtain topic and intent labels for each conversation data;
[0093] The pattern recognition unit is used to perform pattern recognition on the classified topics and intent tags through a sequence mining algorithm to identify normal conversation flows and abnormal conversation flows in the historical conversation data.
[0094] In one embodiment, the policy extraction unit includes:
[0095] A state action definition unit, used to define a state set according to the topic and the intention, and define an action set according to the dialogue path switching action in the normal dialogue flow and the abnormal dialogue flow;
[0096] A calculation unit, configured to calculate, according to the normal dialogue process and the abnormal dialogue process, the state transition probability and the reward value of executing different actions in the action set in each state;
[0097] A strategy iteration unit is used to alternately perform strategy evaluation and strategy improvement according to the state transition probability and reward value in each state through a strategy iteration algorithm, obtain the optimal strategy in each state and construct the strategy library, wherein the optimal strategy is used to execute the dialogue path switching action with the maximum cumulative value in a given state.
[0098] In one embodiment, the policy matching execution module 504 includes:
[0099] A parsing unit, used to parse the input text to obtain the topic and / or intention of the current dialogue node;
[0100] A strategy matching unit, configured to perform strategy matching in the strategy library according to the topic and / or intention of the current dialogue node, and obtain the optimal strategy under the topic and / or intention of the current dialogue node as the target strategy;
[0101] The action execution unit is used to execute the corresponding dialogue path switching action at the current dialogue node according to the dialogue flow of the target strategy, and switch from the current dialogue node to the target dialogue node.
[0102] In one embodiment, the device 50 further includes:
[0103] A knowledge collection module, used to collect business knowledge data within the target business scope;
[0104] The model fine-tuning module is used to fine-tune the large language model according to the historical dialogue data and the business knowledge data to obtain a large language model that is adapted to the business scenarios within the target business scope.
[0105] In one embodiment, the device 50 further includes:
[0106] Feedback collection module, used to collect dialogue performance indicator data and user feedback information;
[0107] The strategy optimization module is used to optimize the dialogue process of each dialogue strategy according to the dialogue performance indicator data and feedback information.
[0108] In the above embodiment, the present invention discloses a dialogue process control device based on a large language model, which acquires a predefined target business scope and collects historical dialogue data within the target business scope; performs data mining and analysis on the historical dialogue data, extracts multiple dialogue strategies and constructs a strategy library; generates a corresponding dialogue process according to each dialogue strategy, and configures the response template of each dialogue node in the dialogue process; when receiving the user's input text, matches the input text in the strategy library to obtain the target strategy, and performs the corresponding dialogue path switching action according to the dialogue process of the target strategy to switch to the target dialogue node; generates a corresponding prompt text based on the response template and input text of the target dialogue node, inputs the prompt text into the trained large language model, and generates the reply text of the target dialogue node. By performing data mining on the historical dialogue data to form a strategy library that meets the corresponding business needs, and configuring the dialogue process and response template of each dialogue strategy, the large language model can reply with a unified response template based on the most matching dialogue strategy when generating the reply text, effectively improving the reply accuracy and reliability of the dialogue system.
[0109] Another embodiment of the present invention provides a computer device, such as Figure 6 As shown, the computer device 60 includes:
[0110] One or more processors 601 and memory 602, Figure 6 A processor 601 is used as an example for the description. The processor 601 and the memory 602 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0111] Processor 601 is used to complete various control logics of computer device 60, and it can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component or any combination of these components. In addition, processor 601 can also be any traditional processor, microprocessor or state machine. Processor 601 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.
[0112] The memory 602 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the large language model-based dialogue flow control method in the embodiment of the present invention. The processor 601 executes various functional applications and data processing of the computer device 60 by running the non-volatile software programs, instructions and units stored in the memory 602, that is, implementing the large language model-based dialogue flow control method in the above method embodiment.
[0113] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device 60, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 602 may optionally include a memory remotely arranged relative to the processor 601, and these remote memories may be connected to the computer device 60 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. One or more units are stored in the memory 602, and when executed by one or more processors 601, the steps of the dialogue flow control method based on a large language model in any of the above-mentioned method embodiments are executed.
[0114] In the above embodiment, the present invention discloses a computer device, which acquires the predefined target business scope, collects the historical dialogue data within the target business scope; performs data mining and analysis on the historical dialogue data, extracts multiple dialogue strategies and constructs a strategy library; generates a corresponding dialogue flow according to each dialogue strategy, and configures the response template of each dialogue node in the dialogue flow; when receiving the user's input text, matches the input text in the strategy library to obtain the target strategy, and performs the corresponding dialogue path switching action according to the dialogue flow of the target strategy to switch to the target dialogue node; generates the corresponding prompt text based on the response template and input text of the target dialogue node, inputs the prompt text into the trained large language model, and generates the reply text of the target dialogue node. By performing data mining on the historical dialogue data to form a strategy library that meets the corresponding business needs, and configuring the dialogue flow and response template of each dialogue strategy, the large language model can reply with a unified response template based on the most matching dialogue strategy when generating the reply text, effectively improving the reply accuracy and reliability of the dialogue system.
[0115] An embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the steps of the dialogue flow control method based on a large language model in any of the above method embodiments are executed.
[0116] In the above embodiment, the present invention discloses a non-volatile computer-readable storage medium, which acquires a predefined target business scope, collects historical dialogue data within the target business scope; performs data mining and analysis on the historical dialogue data, extracts multiple dialogue strategies and constructs a strategy library; generates a corresponding dialogue flow according to each dialogue strategy, and configures the response template of each dialogue node in the dialogue flow; when receiving the user's input text, matches the input text in the strategy library to obtain the target strategy, and performs the corresponding dialogue path switching action according to the dialogue flow of the target strategy to switch to the target dialogue node; generates a corresponding prompt text based on the response template and input text of the target dialogue node, inputs the prompt text into the trained large language model, and generates the reply text of the target dialogue node. By performing data mining on the historical dialogue data to form a strategy library that meets the corresponding business needs, and configuring the dialogue flow and response template of each dialogue strategy, the large language model can reply with a unified response template based on the most matching dialogue strategy when generating the reply text, effectively improving the reply accuracy and reliability of the dialogue system.
[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0118] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0119] In summary, the method, device, equipment and medium for controlling a dialogue process based on a large language model disclosed in the present invention include: obtaining a predefined target business scope, collecting historical dialogue data within the target business scope; performing data mining and analysis on the historical dialogue data, extracting multiple dialogue strategies and constructing a strategy library; generating a corresponding dialogue process according to each dialogue strategy, and configuring the response template of each dialogue node in the dialogue process; when receiving the user's input text, matching the input text in the strategy library to obtain the target strategy, and executing the corresponding dialogue path switching action according to the dialogue process of the target strategy to switch to the target dialogue node; generating a corresponding prompt text based on the response template and input text of the target dialogue node, inputting the prompt text into the trained large language model, and generating the reply text of the target dialogue node. By performing data mining on the historical dialogue data to form a strategy library that meets the corresponding business needs, and configuring the dialogue process and response template of each dialogue strategy, the large language model can reply with a unified response template based on the most matching dialogue strategy when generating the reply text, effectively improving the reply accuracy and reliability of the dialogue system.
[0120] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium, and the computer program can include the processes of the above-mentioned method embodiments when executed. The storage medium can be a memory, a disk, a floppy disk, a flash memory, an optical storage device, etc.
[0121] It should be noted that if any software tools or components other than those of the Company appear in the embodiments of the present application, they are merely used for illustration and do not represent actual use. It should be understood that the application of the present invention is not limited to the above examples, and that those skilled in the art can make improvements or changes based on the above description, and all such improvements and changes shall fall within the scope of protection of the claims attached to the present invention.
Claims
1. A dialogue flow control method based on a large language model, characterized in that: include: Acquire a predefined target business scope, and collect historical conversation data within the target business scope; Performing data mining and analysis on the historical dialogue data, extracting multiple dialogue strategies and constructing a strategy library; Generate a corresponding dialogue process according to each dialogue strategy, and configure a response template for each dialogue node in the dialogue process; When receiving the user's input text, matching the input text in the policy library to obtain a target policy, and executing a corresponding dialogue path switching action according to the dialogue flow of the target policy to switch to a target dialogue node; Generate corresponding prompt text based on the response template and input text of the target dialogue node, input the prompt text into the trained large language model, and generate reply text of the target dialogue node.
2. The dialog flow control method based on a large language model according to claim 1, characterized in that: The data mining and analysis of the historical dialogue data, extracting multiple dialogue strategies and constructing a strategy library include: Performing data mining and analysis on the historical conversation data to obtain topics, intentions, normal conversation flows, and abnormal conversation flows in the historical conversation data; Through the strategy iteration algorithm, dialogue strategies are extracted according to the topic, intention, normal dialogue flow and abnormal dialogue flow, multiple dialogue strategies are obtained and a strategy library is constructed.
3. The dialog flow control method based on a large language model according to claim 2, characterized in that: The data mining and analysis of the historical conversation data to obtain topics, intentions, normal conversation flows and abnormal conversation flows in the historical conversation data includes: Extracting features from the historical conversation data to obtain a feature vector for each conversation data; According to the feature vector of each conversation data, the topic and intent are classified respectively to obtain the topic and intent label of each conversation data; The classified topics and intent tags are subjected to pattern recognition through a sequence mining algorithm to identify normal conversation flows and abnormal conversation flows in the historical conversation data.
4. The dialog flow control method based on a large language model according to claim 2, characterized in that: The dialogue strategy is extracted according to the topic, intention, normal dialogue flow and abnormal dialogue flow through the strategy iteration algorithm to obtain multiple dialogue strategies and construct a strategy library, including: A state set is defined according to the topic and the intention, and an action set is defined according to the dialogue path switching actions in the normal dialogue flow and the abnormal dialogue flow; Calculate the state transition probability and reward value of executing different actions in the action set in each state according to the normal dialogue process and the abnormal dialogue process; By using a policy iteration algorithm, policy evaluation and policy improvement are alternately performed in each state according to the state transition probability and the reward value, the optimal policy in each state is obtained and the policy library is constructed, and the optimal policy is used to execute the dialogue path switching action with the maximum cumulative value in a given state.
5. The dialog flow control method based on a large language model according to claim 1, characterized in that: When receiving the input text from the user, matching the input text in the policy library to obtain a target policy, and executing a corresponding dialogue path switching action according to the dialogue flow of the target policy to switch to a target dialogue node, including: Parsing the input text to obtain the topic and / or intention of the current dialog node; Performing strategy matching in the strategy library according to the topic and / or intention of the current dialogue node, and obtaining the optimal strategy under the topic and / or intention of the current dialogue node as the target strategy; According to the dialog flow of the target strategy, a corresponding dialog path switching action is performed at the current dialog node to switch from the current dialog node to the target dialog node.
6. The dialog flow control method based on a large language model according to claim 1, characterized in that: Before generating corresponding prompt text based on the response template and input text of the target dialogue node, inputting the prompt text into the trained large language model, and generating the reply text of the target dialogue node, the method further includes: Collect business knowledge data within the target business scope; The large language model is fine-tuned according to the historical conversation data and the business knowledge data to obtain a large language model that is adapted to business scenarios within the target business scope.
7. The dialog flow control method based on a large language model according to claim 1, characterized in that: After generating corresponding prompt text based on the response template and input text of the target dialogue node, inputting the prompt text into the trained large language model, and generating the reply text of the target dialogue node, the method further includes: Collect conversation performance indicator data and user feedback information; The dialogue process of each dialogue strategy is optimized according to the dialogue performance indicator data and feedback information.
8. A dialogue flow control device based on a large language model, characterized in that: include: A data collection module, used to obtain a predefined target business scope and collect historical conversation data within the target business scope; A data mining module is used to perform data mining and analysis on the historical dialogue data, extract multiple dialogue strategies and construct a strategy library; A process building module, used to generate a corresponding dialogue process according to each dialogue strategy, and configure a response template for each dialogue node in the dialogue process; A strategy matching execution module is used for, when receiving a user's input text, matching the input text in the strategy library to obtain a target strategy, and executing a corresponding dialogue path switching action according to the dialogue flow of the target strategy to switch to a target dialogue node; The input dialogue module is used to generate corresponding prompt text based on the response template and input text of the target dialogue node, input the prompt text into the trained large language model, and generate the reply text of the target dialogue node.
9. A computer device, characterized in that: comprising at least one processor; and, 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, and the instructions are executed by the at least one processor so that the at least one processor can execute the dialogue flow control method based on a large language model as described in any one of claims 1-7.
10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the dialog flow control method based on a large language model as described in any one of claims 1-7.
Citation Information
Cited By
Method and device for generating reply text and electronic equipment
CN121092659A
Man-machine conversation method based on large language model, program product, equipment and medium
CN121144473A
Intelligent dialogue method and apparatus, electronic device, and storage medium
WO2026174674A1