Conversation method and system of conversation robot and computer equipment
Through the combination of word embedding model and classification model, the problem of low intent recognition accuracy when the text data is short is solved, and the effect of improving the accuracy and system efficiency of intention recognition is achieved.
Patent Information
- Application Number
- CN202411377790.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-07
AI Technical Summary
When the text data is short, the prior art leads to a low accuracy of intention recognition in the conversation robot during the Q&A process, and the modular search enhancement technology increases the search time, resulting in a slower system operation speed.
The method of combining word embedding model and classification model is adopted to convert the to-processed text into word embedding vectors, and the target problem is determined through the vector database, and the target answer is output in combination with the preset text generation mode, which improves the accuracy and efficiency of intention recognition.
It improves the accuracy of intent recognition of dialogue robots when text data is shorter, reduces the time for determining target problems in vector database, and improves the system's operating speed and efficiency.
Smart Images

Figure CN119271783A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a conversation method, system and computer device for a conversation robot. Background Art
[0002] In the field of artificial intelligence, conversational robots have a wide range of application scenarios, such as customer service and after-sales, which provide convenience for life. However, there is also the problem that conversational robots cannot accurately understand the user's expression and intention when the text data is short.
[0003] However, when the text data is short, the current method to help the conversational robot understand the user's expression intention is to perform deep retrieval of the text data through modular retrieval enhancement technology, that is, to add a sentiment recognition model or a rearrangement model in the retrieval stage to enhance the retrieval of text data, but at the same time, it will cause a significant increase in the time consumption of the retrieval stage, causing the corresponding system of the conversational robot to run slower. Therefore, there is currently a problem that when the text data is short, the conversational robot has a low accuracy rate in intent recognition during the question-and-answer process. Summary of the invention
[0004] Based on this, it is necessary to provide a conversation method, system, computer device, computer-readable storage medium and computer program product for a conversation robot to address the technical problem that the conversation robot has low accuracy in the question-and-answer process when the text data is short.
[0005] In a first aspect, the present application provides a conversational robot training method, comprising:
[0006] Receive a text to be processed, and convert the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training a word embedding model based on first training text data;
[0007] Obtaining intent recognition classification features of the first word embedding vector based on a classification model; wherein the classification model is established based on second training text data;
[0008] Based on the second word embedding model and in combination with the classification label corresponding to the intent recognition classification feature of the first word embedding vector, a second word embedding vector is obtained; wherein the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model;
[0009] The second word embedding vector is stored in a vector database, and a target question corresponding to the second word embedding vector is determined in the vector database based on a preset question-answering mode; wherein the vector database includes an association relationship between the second word embedding vector and the target question;
[0010] Combining the target question with a preset text generation mode, a target answer for the text to be processed is output.
[0011] In one embodiment, the method further includes: inputting the first training text data into the word embedding model, and segmenting the first training text data through word segmentation technology, screening non-keywords in the segmented words as stop words, and forming a stop word library; updating the first training text data based on the stop words to obtain first updated training data, and inputting the first updated training data into the word embedding model to obtain the first word embedding model.
[0012] In one embodiment, the method further includes: acquiring business domain data, non-business domain data and business scenario data, and generating similar data of the business domain data, the non-business domain data and the business scenario data respectively through prompt engineering technology; updating the second training text data based on the similar data to obtain second updated training data, and inputting the second updated training data into the classification model to complete the establishment of the classification model.
[0013] In one embodiment, the method further includes: inputting third training text data into the first word embedding model combined with preset core hyperparameters to complete the training of the first word embedding model and obtain the second word embedding model; wherein the core hyperparameters include calculation accuracy, learning rate, optimizer, temperature, pooling method and number of training times.
[0014] In one embodiment, the third training text data is input into the first word embedding model combined with preset core hyperparameters to complete the training of the first word embedding model and obtain the second word embedding model, including: matching a preset initial learning rate and a preset temperature to the first word embedding model; training the first word embedding model based on a preselected optimizer and in combination with a half-precision floating point quantization method and a classification label pooling method; inputting the third training text data into the first word embedding model for training, and completing the training of the first word embedding model when the number of training times is greater than or equal to a preset target training time and the loss value is within a preset target loss value range to obtain the second word embedding model.
[0015] In one of the embodiments, determining the target question corresponding to the second word embedding vector in the vector database based on a preset question-answering model includes: obtaining the similarity between the second word embedding vector and the vector in the vector database; determining multiple related questions of the second word embedding vector and a single identifier of the multiple related questions based on the similarity; and according to the single identifier, taking the single target question corresponding to the multiple related questions as the target question corresponding to the second word embedding vector.
[0016] In one embodiment, the preset text generation mode includes: a frequently asked question mode and a scenario mode; the generation of a target answer to the text to be processed by combining the target question and the preset text generation mode includes: in the frequently asked question mode and / or the scenario mode, when a preset target number of related questions retrieved from the vector database correspond to the same target question, the answer corresponding to the target question is used as the target answer to the text to be processed.
[0017] In a second aspect, the present application also provides a dialogue system of a dialogue robot, including:
[0018] A text processing module, configured to receive a text to be processed and convert the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training a word embedding model based on first training text data;
[0019] A feature acquisition module, used to obtain the intent recognition classification feature of the first word embedding vector based on a classification model; wherein the classification model is established based on second training text data;
[0020] A word embedding vector conversion module, used to obtain a second word embedding vector based on a second word embedding model and a classification label corresponding to the intent recognition classification feature of the first word embedding vector; wherein the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model;
[0021] A target question confirmation module, used to store the second word embedding vector into a vector database, and determine the target question corresponding to the second word embedding vector in the vector database based on a preset question-answering mode; wherein the vector database includes an association relationship between the second word embedding vector and the target question;
[0022] The target answer output module is used to output the target answer of the text to be processed in combination with the target question and a preset text generation mode.
[0023] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:
[0024] Receive a text to be processed, and convert the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training a word embedding model based on first training text data;
[0025] Obtaining intent recognition classification features of the first word embedding vector based on a classification model; wherein the classification model is established based on second training text data;
[0026] Based on the second word embedding model and in combination with the classification label corresponding to the intent recognition classification feature of the first word embedding vector, the first word embedding vector is converted into a second word embedding vector; wherein the second word embedding model is obtained by training the first word embedding model based on the third training text data;
[0027] The second word embedding vector is stored in a vector database, and a target question corresponding to the second word embedding vector is determined in the vector database based on a preset question-answering mode; wherein the vector database includes an association relationship between the second word embedding vector and the target question;
[0028] Combining the target question with a preset text generation mode, a target answer for the text to be processed is output.
[0029] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0030] Receive a text to be processed, and convert the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training a word embedding model based on first training text data;
[0031] Obtaining intent recognition classification features of the first word embedding vector based on a classification model; wherein the classification model is established based on second training text data;
[0032] Based on the second word embedding model and in combination with the classification label corresponding to the intent recognition classification feature of the first word embedding vector, a second word embedding vector is obtained; wherein the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model;
[0033] The second word embedding vector is stored in a vector database, and a target question corresponding to the second word embedding vector is determined in the vector database based on a preset question-answering mode; wherein the vector database includes an association relationship between the second word embedding vector and the target question;
[0034] Combining the target question with a preset text generation mode, a target answer for the text to be processed is output.
[0035] In a fifth aspect, the present application further provides a computer program product, the computer program product comprising a computer program, which implements the following steps when executed by a processor:
[0036] Receive a text to be processed, and convert the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training a word embedding model based on first training text data;
[0037] Obtaining intent recognition classification features of the first word embedding vector based on a classification model; wherein the classification model is established based on second training text data;
[0038] Based on the second word embedding model and in combination with the classification label corresponding to the intent recognition classification feature of the first word embedding vector, a second word embedding vector is obtained; wherein the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model;
[0039] The second word embedding vector is stored in a vector database, and a target question corresponding to the second word embedding vector is determined in the vector database based on a preset question-answering mode; wherein the vector database includes an association relationship between the second word embedding vector and the target question;
[0040] Combining the target question with a preset text generation mode, a target answer for the text to be processed is output.
[0041] The above-mentioned dialogue method, system, computer device, storage medium and computer program product of the dialogue robot, in the dialogue method of the dialogue robot, first receive the text to be processed, and convert the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training the word embedding model based on the first training text data; then obtain the intention recognition classification feature of the first word embedding vector based on the classification model; wherein the classification model is established based on the second training text data; then obtain the second word embedding vector based on the second word embedding model and the classification label corresponding to the intention recognition classification feature of the first word embedding vector; wherein the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model; then store the second word embedding vector in a vector database, and determine the target question corresponding to the second word embedding vector in the vector database based on a preset question-answering mode; wherein the vector database includes the association relationship between the second word embedding vector and the target question; finally, combine the target question and the preset text generation mode to output the target answer to the text to be processed. In the above process, the text to be processed is converted into a first word embedding vector through the first word embedding model, and then the intention recognition classification feature of the first word embedding vector is obtained through the classification model. Then, the classification label corresponding to the above intention recognition classification feature is combined and the second word embedding vector is obtained through the second embedding model. This can improve the quality of the word embedding vector and improve the efficiency of determining the target question in the vector database in subsequent steps. Then, through the combination of the target question and the preset text pattern, the target answer is further output, which effectively improves the accuracy of the conversational robot's intention recognition when the text data is short. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 A schematic diagram of a flow chart of a conversation method of a conversation robot in one embodiment;
[0044] Figure 2 A flowchart of a conversation method of a conversation robot in another embodiment;
[0045] Figure 3 A timing diagram of a dialogue system of a dialogue robot in one embodiment;
[0046] Figure 4 A schematic diagram of the structure of a dialogue system of a dialogue robot in one embodiment;
[0047] Figure 5 A schematic diagram of the structure of a dialogue system of a dialogue robot in another embodiment;
[0048] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] In the field of conversational robots, a conversational robot needs to meet the user's questioning needs, so that it can be applied in a wide range of scenarios, such as customer service and after-sales. However, understanding the user's needs for relatively short corpus data has become a major challenge for conversational robots in the field of natural language understanding. Most of the existing technologies can be divided into two technical routes: modular retrieval enhancement and text segmentation. Among them, modular retrieval enhancement technology mainly adds sentiment recognition models, rearrangement models, etc. in the retrieval stage. This architecture greatly increases the processing time of the retrieval stage, resulting in system slowdown; while the text segmentation technology route is more suitable for long text retrieval and processing, because this technical architecture mainly improves the global accuracy by changing the retrieval block size, and is more suitable for retrieval enhancement question and answer under long text from a practical application perspective. Therefore, there is currently a problem that when the text data is short, the conversational robot has a low accuracy rate in the question and answer process. In the field of RAGRetrieval-Augmented Generation (RAGRetrieval-Augmented Generation) dialogue systems with intent recognition modules, there are technologies such as knowledge graphs, case search, rule matching, and Colbert (Contextualized Late Interaction over BERT) rearrangement to complete it. In the knowledge graph technology route, the project operator needs to establish and maintain a complete knowledge graph. The knowledge graph must cover all knowledge content in a certain field in order to find the corresponding knowledge association when the user asks a question, so as to identify the intention and provide an answer; case search requires relatively less development and maintenance than graphs, but it still requires annotation of typical examples, and rule matching uses some specific expressions and keywords to determine user intentions, which lacks intelligence and scalability. In contrast, the text classification deep neural network model technology has matured and can solve many problems encountered in intent recognition in an end-to-end one-stop manner. Using text classification intent recognition only requires applying a classification model in the intent recognition module, which can handle intent recognition problems in a low-cost and high-quality manner.
[0051] In an exemplary embodiment, Figure 1 As shown, a conversation method of a conversation robot is provided, comprising the following steps S102 to S106. Among them:
[0052] Step S102, receiving the text to be processed, and converting the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training the word embedding model based on first training text data.
[0053] Among them, the text to be processed is the original text data that needs to be converted; word embedding is a technology that converts words in a text into vectors, and the word embedding model is a model used to generate word embedding vectors; the first training text is text data used to train the word embedding model to obtain the first word embedding model.
[0054] Specifically, word embedding technology can map the words in the text to be processed into a high-dimensional space, so that similar words are closer in the vector.
[0055] Step S104, obtaining the intent recognition classification feature of the first word embedding vector based on the classification model; wherein the classification model is established based on the second training text data.
[0056] Among them, the intent recognition classification feature refers to the feature used to identify the user's intention during the question-and-answer dialogue process. It can be the purpose or need expressed by the user when sending a message, such as asking a question or requesting help, etc., which can help the classification model understand the user's true intention in order to better respond; the second training text data is different question-and-answer data and their corresponding categories collected in various scenarios. The second training text data can be used to establish a classification model to obtain the question-and-answer data to be processed: for example, the intent recognition classification feature of the first word embedding vector.
[0057] Step S106, obtaining a second word embedding vector based on the second word embedding model and the classification label corresponding to the intention recognition classification feature of the first word embedding vector; wherein the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model.
[0058] The classification label is a label used to identify and distinguish different intentions or needs of the user input during the process of performing intent recognition on the first word embedding vector. For example, the intent of asking for information can correspond to the first label, and the intent of requesting help can correspond to the second label.
[0059] The second word embedding model is another word embedding model used to obtain a second word embedding vector.
[0060] Step S108, storing the second word embedding vector in a vector database, and determining a target question corresponding to the second word embedding vector in the vector database based on a preset question-answering model; wherein the vector database includes an association relationship between the second word embedding vector and the target question.
[0061] Among them, the vector database is a database that stores the second word embedding vector and its corresponding target question; the preset question-answering mode can be to query the target question in the vector database; the target question is the main question associated with the second word embedding vector stored in the vector database, usually a question that needs to be answered by the user.
[0062] Specifically, the association relationship between the second word embedding vector and the target question can be a similarity relationship, a label relationship, or a time relationship, etc. When the association relationship is a similarity relationship, the target question that is most similar to the current second word embedding vector can be determined by calculating the similarity between the second word embedding vector and other vectors in the vector database, such as cosine similarity, Euclidean distance, etc.; when the association relationship is a label relationship, each target question can be labeled as a specific category or topic, and the label can be associated with the second word embedding vector; when the association relationship is a time relationship, the creation time or last update time of the target question can be associated with the second word embedding vector.
[0063] Step S110, combining the target question and the preset text generation mode, outputting the target answer of the text to be processed.
[0064] Among them, the preset text generation modes may include FAQ mode (FAQ, Frequently Asked Questions), scenario mode and large model mode; the target answer is the final generated answer, which combines the target question and the preset text generation mode to provide the required information or answer for the text to be processed.
[0065] In an exemplary embodiment, when obtaining the first word embedding vector based on the classification model, the intent recognition module used can be a deep learning model independent of any other module, obtained by fine-tuning the second training text data using LoRA; the text preprocessing module used in the process of receiving the text to be processed and converting the text to be processed into the first word embedding vector based on the first word embedding model is the first engine of the conversational robot system in processing the first training text data, and can perform text preprocessing before training the first word embedding model and establishing the classification model based on the second training text data. In addition, the classification model and the first word embedding model need to go through the first stage of training, that is, based on the processing of the first training text data and the second training text data, before they can be used; the second word embedding model can be used directly after training based on the third training text data.
[0066] In the above dialogue method of the dialogue robot, first, the text to be processed is received, and the text to be processed is converted into a first word embedding vector based on the first word embedding model; wherein, the first word embedding model is obtained by training the word embedding model based on the first training text data; then, the intention recognition classification feature of the first word embedding vector is obtained based on the classification model; wherein, the classification model is established based on the second training text data; then, based on the second word embedding model and in combination with the classification label corresponding to the intention recognition classification feature of the first word embedding vector, a second word embedding vector is obtained; wherein, the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model; then, the second word embedding vector is stored in the vector database, and the target question corresponding to the second word embedding vector is determined in the vector database based on the preset question-and-answer mode; wherein, the vector database includes the association relationship between the second word embedding vector and the target question; finally, in combination with the target question and the preset text generation mode, the target answer of the text to be processed is output. In the above process, the text to be processed is converted into a first word embedding vector through the first word embedding model, and then the intention recognition classification feature of the first word embedding vector is obtained through the classification model. Then, in combination with the classification label corresponding to the above intention recognition classification feature, the second word embedding vector is obtained through the second word embedding model, which can improve the quality of the word embedding vector and the efficiency of determining the target question in the vector database in the subsequent steps. Further, by combining the target question and the preset text mode, the target answer is output, effectively improving the accuracy of intention recognition of the dialogue robot when the text data is short.
[0067] In an exemplary embodiment, the above method further includes: inputting the first training text data into the word embedding model, segmenting the first training text data through the word segmentation technology, screening the non-keyword words in the word segmentation as stop words to form a stop word library; updating the first training text data based on the stop words to obtain the first updated training data, and inputting the first updated training data into the word embedding model to obtain the first word embedding model.
[0068] Wherein, the word segmentation technology is a technology for splitting a continuous text into independent words or phrases; stop words are common words that are ignored during the text processing, such as "de", "le", "shi", etc. These words usually contribute less to the theme and meaning of the text; the stop word library refers to the database storing the stop words; the first updated training data is the text data remaining after removing the stop words in the first training text data.
[0069] Specifically, Jieba (结巴) word segmentation and word frequency statistics technology can be used to segment the first training text.
[0070] In this embodiment, by deleting stop words, the first training data focuses more on important content, helping the word embedding model to learn more accurate semantic relationships, thereby improving the effectiveness of the first word embedding model; enabling the final first embedding model to enhance the quality of information retrieval and analysis.
[0071] In one embodiment, the above method also includes: acquiring business domain data, non-business domain data and business scenario data, and generating similar data of the business domain data, non-business domain data and business scenario data respectively through prompt engineering technology; updating the second training text data based on the similar data to obtain second updated training data, and inputting the second updated training data into the classification model to complete the establishment of the classification model.
[0072] Among them, business domain data can be chat data, that is, chat data that is not related to business scenarios; non-business domain data can be data corresponding to FAQ (Frequently Asked Questions), that is, question and answer data within a specific field; business scenario data can be scenario data, that is, specific business scenarios and corresponding conversation data.
[0073] Specifically, given a case through prompt engineering, a maximum of 3 business domain data can be generated using a model with parameters less than 14B.
[0074] In the above embodiment, by using the classification model and the corresponding training text data, the system can more accurately identify the user's intention, thereby reducing the possibility of misunderstanding and incorrect response; by collecting corresponding training data in a variety of scenarios, the system can adapt to different user inputs and intentions, enhancing the versatility and flexibility of the classification model.
[0075] In one embodiment, the above method also includes: inputting the third training text data into the first word embedding model combined with preset core hyperparameters to complete the training of the first word embedding model and obtain a second word embedding model; wherein the core hyperparameters include calculation accuracy, learning rate, optimizer, temperature, pooling method and number of training times.
[0076] Among them, the third training text is the text data used to train the first word embedding model to obtain the second word embedding model; the calculation accuracy is the accuracy parameter of floating-point operations, which will affect the training effect of the model; the learning rate is the parameter that controls the update of the model weights; the optimizer is an algorithm used to update the model weights; the temperature is used to adjust the output distribution of the model; the pooling method may include average pooling and maximum pooling, etc.; the number of training times is the number of rounds of iterative training.
[0077] Specifically, the optimizer may adopt Adam (Adaptive Moment Estimation) or SGD (Stochastic Gradient Descent). AdamW (Adam with Weight Decay) is adopted in this application.
[0078] In this embodiment, by setting the core hyperparameters, the training process is made more flexible, so that the first word embedding model can perform more effective parameter adjustment on specific tasks, thereby obtaining better performance.
[0079] Furthermore, in one embodiment, the third training text data is input into the first word embedding model combined with preset core hyperparameters to complete the training of the first word embedding model and obtain the second word embedding model, including: matching the preset initial learning rate and the preset temperature to the first word embedding model; training the first word embedding model based on a preselected optimizer and in combination with a half-precision floating point quantization method and a classification label pooling method; inputting the third training text data into the first word embedding model for training, and completing the training of the first word embedding model when the number of training training is greater than or equal to the preset target training number and the loss value is within the preset target loss value range to obtain the second word embedding model.
[0080] Among them, the initial learning rate is the learning rate used by the first word embedding model at the beginning of training, which controls the pace of weight updating; half-precision floating-point quantization is a method to reduce model storage space and computational load, using 16 bits (half-precision) to represent floating-point numbers, which reduces memory usage and improves computational efficiency compared to 32 bits (single precision); the classification label pooling method is a method for aggregating information when processing embedded vectors; the loss value is an indicator for evaluating model performance during training, reflecting the gap between the model's predicted value and the true value. If it is within the preset target loss value range, it means that the model performance is within an acceptable range.
[0081] In this embodiment, by using reasonable settings of the initial learning rate and temperature, combined with the selection of the optimizer, the first word embedding model can be trained more effectively; the use of a half-precision floating-point quantization method reduces memory usage and computational load, making the training process more efficient; the classification label pooling method can better aggregate information and extract more representative features, allowing hyperparameters to be adjusted according to specific task requirements, making model training more flexible and adaptable to different application scenarios.
[0082] In an exemplary embodiment, a target question corresponding to a second word embedding vector is determined in a vector database based on a preset question-answering model, including: obtaining the similarity between the second word embedding vector and the vector in the vector database; determining multiple related questions of the second word embedding vector and a single identifier of the multiple related questions based on the similarity; and according to the single identifier, taking the single target question corresponding to the multiple related questions as the target question corresponding to the second word embedding vector.
[0083] Among them, the second word embedding vector is a vector converted by the second word embedding model, which is used for subsequent similarity calculation and matching of similar questions; similarity is an indicator to measure the degree of similarity between two vectors. Commonly used calculation methods include cosine similarity, Euclidean distance, etc. The higher the similarity, the closer the two vectors are semantically; related questions are a set of questions that are semantically similar or related to the second word embedding vector, which are usually retrieved from a vector database; a single identifier is an identifier used to uniquely identify each related question, usually a string or a number, which is convenient for retrieval and management in a vector database.
[0084] Specifically, by calculating the similarity between the second word embedding vector and the vector stored in the vector database, the content related to the word embedding vector can be identified, and then multiple related questions can be screened out according to the set threshold, and the most representative or relevant one of the multiple related questions can be selected as the target question based on a single identifier.
[0085] In this embodiment, by calculating the similarity between the second word embedding vector and the vector in the vector database, relevant questions can be quickly identified, significantly improving the speed and efficiency of information retrieval; by utilizing similarity calculation and identifier management, the high relevance of the target question to the user query can be ensured, reducing the interference of irrelevant information and improving the accuracy of the answer; the matching of related questions can be dynamically adjusted according to the new word embedding vector and the updated vector database, which is suitable for a variety of scenarios.
[0086] Furthermore, in one embodiment, the preset text generation modes include: FAQ mode and scenario mode; combining the target question and the preset text generation mode, generating a target answer for the text to be processed, including: in the FAQ mode and / or scenario mode, when a preset target number of related questions retrieved from the vector database correspond to the same target question, the answer corresponding to the target question is used as the target answer for the text to be processed.
[0087] Among them, the preset text generation modes also include the large model mode; the FAQ mode is a text generation mode, which is usually used to answer users' common questions and provide information in a structured manner to facilitate users to quickly obtain answers; the scenario mode is a mode that generates answers based on specific scenarios or contexts, usually considering the user's specific needs and background to provide more targeted answers.
[0088] For example, when three similar questions are retrieved from the vector database, and the three related questions all belong to the same target question, the answer to the target question is directly output; in other cases, the results of the target question are deduplicated after the retrieval is completed, and the number of target questions after deduplication is less than or equal to three, and then they are returned to the user; it also includes a mixed mode, which means that a user asks a question that may match the FAQ mode category or the scene mode category, and the system needs to finally decide which one to go for; the mixed mode has two decision algorithms: score rearrangement and ratio rearrangement. After the score rearrangement searches the results from the FAQ mode and scene mode vector databases respectively, it performs a mixed ranking based on the similarity score and returns the top three items with higher scores; the ratio ranking is because in some cases the difference in the scores between the FAQ mode and the scene mode is large, resulting in the possibility that the top three items may all belong to the FAQ mode or the scene mode if the top three items are returned based on the similarity score. In this case, the ratio method is flexibly adopted. If the ranking shows that the top three most similar results are all in the same category, the third item is replaced with another category.
[0089] In this embodiment, by combining the target question and the preset text generation mode, it is ensured that the generated answer directly responds to the user's core question, thereby improving the accuracy of the target answer; when multiple related questions correspond to the same target question, a unified answer is used as the target answer for the text to be processed to ensure the consistency and reliability of the information and reduce user confusion; by setting a preset target number, unnecessary calculation and processing time is reduced, thereby reducing the cost of generating answers.
[0090] This application provides a conversation method for a conversation robot. In order to better understand the process of the conversation method of the conversation robot, combined with Figure 2 As shown, the specific process of the conversation method of the conversation robot of the present application is described in detail below, including the following steps:
[0091] Step S202: Use the stop word technology to process the first training data to form a stop word library, and based on the stop word library, delete the stop words in the first training data to obtain first updated training data.
[0092] Step S204, obtain a first word embedding model, and use the first word embedding model to convert the first training text data into a first word embedding vector and store it.
[0093] Step S206, establishing a classification model based on the second training text data, and obtaining the intent recognition classification features of the first word embedding vector.
[0094] Step S208: Input the third training text data into the first word embedding model, train to obtain a second word embedding model, and convert the first word embedding vector into a second word embedding vector in combination with the classification label corresponding to the intent recognition classification feature.
[0095] Step S210, comparing the second word embedding vector stored in the vector library with the vector in the vector library to obtain multiple results with high similarity.
[0096] Step S212, based on the multiple results, obtain a standard question corresponding to the multiple similar questions, and output a standard answer to the standard question.
[0097] In the above embodiment, by using the stop word technology to process the first training data, common words that do not contribute to semantic analysis are removed, making the training data cleaner and more effective, thereby improving the quality of subsequent model training, and by comparing the word embedding vectors stored in the vector library, multiple results with high similarity are quickly obtained, thereby improving the efficiency of information retrieval and matching.
[0098] Furthermore, in one embodiment, the training process and use method of the conversational robot of the present application may include five modules, namely: a text preprocessing module, an intent recognition module, a word embedding large model module, an information retrieval module, and a text generation module. The specific use process is as follows:
[0099] Each processing stage of the system will perform natural language processing on the Chinese text (first training text data). Using stop word technology, a large amount of first training text data is used in the word embedding model training stage to enable the word embedding model to understand the conversation content of relevant scenarios. Jieba word segmentation and word frequency statistics technology are used to segment all first training text data. After manual review, the words with high frequency of occurrence and no effect on the semantics of any text are saved in a unified stop word library. The stop word library will continue to accumulate as the first training text data increases. All first training text data are deleted according to the stop words contained in the stop word library, and then the word embedding model is trained and optimized based on the cleaned data.
[0100] The intent recognition module uses a relatively small model to handle the text classification problem. LoRA is used for fine-tuning during the training process, and the classification model is flexibly configured to adapt to different scenarios and data. First, this module uses small and medium-sized models with a parameter range of 20 million to 300 million. The specific application can be flexibly configured according to the actual data volume and the difficulty of question and answer. Then, the LoRA technology is used to adaptively adjust the weight of the model by adding a low-rank matrix, so as to achieve efficient and parameter-efficient fine-tuning. This method only updates a small number of newly added parameters while keeping the original model parameters unchanged. Therefore, compared with the traditional fine-tuning method, LoRA can significantly reduce the required storage space and computing resources. LoRA decomposes a large matrix into the form of multiplication of two smaller matrices. Assuming that the weight matrix in the original model is WW, it can be approximately expressed as W+UVW+UV, where UU and VV are newly introduced low-rank matrices. After the training is completed, a LoRA file will be generated, which contains the fine-tuned parameter values and related configurations. The LoRA configuration file corresponds to the batch of data.
[0101] In the word embedding storage stage, the trained and optimized model (first word embedding model) needs to convert the real scene data (text to be processed) into the first word embedding vector and then store it. Before the conversion, the system will also use the stop word technology to delete all irrelevant words in the data to be stored. The system uses the text after deleting the stop words (the first updated training data) as the input of the first word embedding model, generates a word embedding vector, and then saves it.
[0102] During the user retrieval stage, the system needs to use a vector retrieval algorithm to find similar questions (related questions) based on the user's questions. Before performing the retrieval, the system will perform stop word processing on the user input text (text to be processed).
[0103] The second text preprocessing technology is data enhancement technology. First, the client company's operations personnel import chat, FAQ, and scenario data into this system. Among them, chat refers to some chat data that is not related to the company's business scenarios, FAQ refers to question and answer data in a specific field, and scenario refers to certain specific business scenarios of certain client companies and corresponding conversation data.
[0104] Specifically, the form of business domain data (chat) can be as follows:
[0105]
[0106] Non-business domain data (FAQ) can be in the form of:
[0107]
[0108] The form of business scenario data (scenario data) can be as follows:
[0109]
[0110]
[0111] After importing the above data into the robot dialogue system, the system can generate similar data based on the existing data to supplement the problem of insufficient data, so as to achieve a more accurate purpose in the intention recognition stage. In addition, this system uses a large model with a parameter size of 7 billion to use prompt engineering technology to enable the model to generate data that is similar and different from the existing data. The prompt words are roughly as follows: "Now you are a customer of {{Company Name}}, please use your reasoning ability to generate {{number}} similar questions based on the problem case, and do not repeat known information. Existing questions: 1. {{Problem Case 1}}\n2. {{Problem Case 1}}\n3. {{Problem Case 1}}". Using this prompt method, 3-10 similar questions with excellent quality can be stably output based on the 7 billion large model. On this basis, the enhanced data generally does not exceed 30% of the original data. If it is higher than 30%, the data quality will decrease.
[0112] The system uses a large word embedding model with about 300M parameters as the word embedding model. The model's embedding (embedding vector) length is 762-1024, which means that a query text will become a vector of length 762-1024 after being processed by the word embedding model. Compared with other types of data, at this model parameter level and embedding length, the model can accurately capture and understand the expected contextual meaning of the conversation.
[0113] In order to make the second word embedding model understand the text content related to the scene requirements and produce high-quality second word embedding vectors for retrieval, the system needs to fine-tune the second word embedding model based on relevant scene data. The core hyperparameters in the training process are calculation accuracy, learning rate, optimizer, temperature, pooling method, and Epoch (number of training times). The model uses half-precision floating point calculation FP16 during the training process. Compared with other model accuracy quantization methods, this system uses relatively large accuracy to be able to train stably in more variable dialogue scene data. The initial learning rate of training is 1e-5, and this learning rate will be adjusted during the training process with random optimization in the training warm-up phase. The optimizer uses AdamW, which uses its excellent performance and appropriate weight attenuation to make the weight regularization reach a suitable level. The temperature is set to 0.02 to ensure the stable output of the model. In terms of pooling, the second word embedding vector with contextual semantics finally output by the second word embedding model is determined by the CLS (Classification Token Pooling) method, which means that the second word embedding vector output by the second word embedding model is the vector of the CLS word unit. After the model is trained for 5-10 epochs, the training will be stopped when the loss reaches 1-2.
[0114] The loss calculation in the training process of the second word embedding model is composed of "positive documents" and "negative documents". For a piece of training data (the third training text data), the second word embedding model first obtains the second word embedding vectors of the positive document and the negative document of the data through forward reasoning, and then calculates the gap between the positive document and the negative document through the loss function to complete the loss calculation. The goal of the loss function is the goal of the second word embedding model, which is to make the distance between positive pairs (positive pairs) in the embedding space as small as possible, and to make the distance between negative pairs (negative pairs) in the embedding space as large as possible.
[0115] Suppose we have a query q and a corresponding positive document d + , and a series of negative example documents {d1 +- , d2 - ,...d n -}, we calculate the embedding vector: the embedding of the query is denoted as f(q); the embedding of each document d is denoted as f(d).
[0116] Calculate similarity score: Use cosine similarity to measure the similarity between two embedding vectors. Cosine similarity between query q and document d:
[0117] sim(q,d + / t)=f(q)·f(d)
[0118] in:
[0119] where d j Included + and all negative examples And τ is a temperature parameter used to control the smoothness of the distribution. Accordingly, Represents the loss value.
[0120] The training data includes all similar questions Q in a specific scenario and the standard question S to which each similar question belongs, for example, Q = {'How to check the electricity fee? ', 'Calculation method of tiered electricity price'}.
[0121] Split the data Q into N subsets according to batch B, and then extract a piece of data from the subset as the query text query, and the remaining text as the positive text pos of the current query. Take the same number of pos belonging to other standard questions S as the negative text neg of the current query.
[0122] The training data is
[0123]
[0124] Then, query, random(pos), and random(neg) in the training data are used as the input of the model, and the model outputs three word embedding vectors, query, positive, and negative respectively. The loss function is used to calculate the loss, and the cosine similarity is used to calculate the similarity distance between the vectors. Finally, the model weights are updated to complete a model training.
[0125] This system uses the faiss (Facebook AI Similarity Search) vector database to store the text vectorized data generated by the word embedding model. First, the system uses the IndexFlatL2 algorithm to create an index, that is, it directly stores the original vector without making any changes. When performing a query, the Euclidean distance L2 is used to compare the query vectorized query text with the vector in the library, and the top k results with the highest similarity are returned.
[0126] The returned score is Where q is the query vector and d is the database document vector. The closer the result value is to 0, the smaller the difference between the two vectors is, that is, the similarity between the two texts is high.
[0127] In this system, the retrieval logic of the two answer modes FAQ and scenario is the same, but two different vector libraries are used to store data. Compared with other quantized storage methods, direct storage and brute force search are conducive to matching all information in the text. Because the system mainly serves user questions and answers in various scenarios, and the text has been streamlined in the data processing stage, this query algorithm fully matches the system design requirements and data processing methods.
[0128] After the user submits the question, the system uses the word embedding model to encode the question, and uses the encoded word embedding vector to query similar questions in the vector database using cosine similarity, that is, questions with similar meanings to the question submitted. These similar questions have been pre-associated with standard questions, and the system can find the corresponding standard answers by finding the corresponding standard questions from the database. The same is true for scenario questions and answers. After the user submits the question, the vector library is searched for similar questions, and then the corresponding standard questions (scenario standard questions) are found, and then the next system answer is determined. This system has three text generation modes: FAQ, scenario, and big model. FAQ and scenario are answered based on the retrieval technology mentioned above. If the user's question cannot find the corresponding content in the stored FAQ and scenario similar questions, it means that the user's question deviates too much from the predetermined scenario, and the big model is used to answer the user's question.
[0129] In FAQ and scenario Q&A, the system uses direct output and top3 (the highest three) methods. After the system searches, if three similar questions are found in the vector library and all three similar questions belong to the same standard question, the answer to the standard question will be directly output. In other cases, the standard question results will be deduplicated after the search is completed. If the number of standard questions after deduplication is less than or equal to three, they will be returned to the user for further clarification.
[0130] The hybrid mode means that when a user asks a question, it may match a FAQ-similar question or a scene-similar question, and the system needs to make the final decision on which one to go with. The hybrid mode has two decision algorithms, score rearrangement and ratio rearrangement. After searching the results from the FAQ and scene vector libraries respectively, score rearrangement performs a mixed ranking based on the similarity score and returns the top three items with higher scores. Ratio ranking is because in some cases the FAQ and scene scores differ greatly. If the top three items are returned based on score similarity, the top three items may all belong to FAQ or scene. In this case, the ratio method is used flexibly. If the ranking shows that the top three most similar results are all in the same category, the third item is replaced with another category.
[0131] And, if Figure 3As shown in the figure, the main users of the system are system administrators. The system administrator is the developer of this system and has the management authority of the system. He can assign usage authority to all other users. The operator refers to the operator of the client company of this system, and his authority is assigned by the system administrator. The operator can use functions such as data upload, data training, and dialogue robot creation, and ultimately serve the dialogue robot to the end customers of their company. The end customer refers to the end user of the dialogue robot system, who performs question-and-answer applications based on the scenarios developed by the corresponding company.
[0132] This system has two stages of use. The first is that the operator prepares FAQ, scenario standard questions and similar questions data for the specific scenarios of their company and imports them into this system. This system trains and stores the data. If necessary, the manager needs to modify the data and some parameters according to the end customer's usage effect to achieve the best effect. The second stage is the end user's use stage. After the manager completes the data training and robot construction, the end customer can have a conversation with the robot in this system. During the stage of end users' dialogue use of the robot based on specific scenarios, the system matches the FAQ associated during the operation period according to the user's questions, retrieves relevant data from the scenario database, and returns the structured reply content stored in the relational database to the end user.
[0133] like Figure 4 As shown in the figure, this system has designed a 5-layer supporting technology architecture to meet the above business function requirements. Among them, the front-end layer refers to the specific interactive software used by the end user, not limited to HTML (HyperTextMarkup Language) pages that can be used for dialogue, dialogue interactions in the outbound call system, etc. The control layer refers to the summary of all available functions for system administrators, operators, and end users. The search engine layer refers to the summary of all natural language processing technology modules in this system, which consists of natural language processing modules, word embedding large model modules and vector database modules. All content in the system that requires natural language processing, word embedding processing, and vector similarity processing passes through this layer. The business engine layer refers to the three core functions supported by this system: FAQ, scenario Q&A, and large model Q&A. All functions in the system are built on these three core functions. The database layer refers to the storage of all business data in this system. All training data, user permission data, user usage data, etc. of this system are stored in a relational database. This system uses Python FastAPI (Fast Application Programming Interface) as a service middleware to provide related services to the outside.
[0134] Furthermore, in one embodiment, the system can also divide the use phase into three phases: system model building phase, B-side personnel fine-tuning training phase, and service phase. Therefore, there are three different types of data: first training text, B-side personnel fine-tuning training data, and end-user reasoning data, and these three types of data are no longer separated and defined.
[0135] During the first phase of training, the first training text data of the intent recognition model and the word embedding model are unified and complete, with the aim of achieving better performance for the intent recognition and word embedding models; during the second phase of training, the second training text data of each B-side operator is different and independent of each other. Therefore, each B-side operation account will be assigned one or more LoRA fine-tuning profiles to separately record the account's training content. The word embedding model also uses the second training text data of the B-side operator to generate word vectors and store them in independent vector databases; during the third phase of training, the training results of each B-side operation organization serve their respective end customers. The specific process of the three stages is as follows:
[0136] Phase 1: Use the text preprocessing module to process the first training text data; use the preprocessed first training text data for intent recognition training; use the preprocessed first training text data for word embedding model training. Phase 2: Use the text preprocessing module to process the second training text data; use the preprocessed second training text data for LoRA-based intent recognition training; use the preprocessed second training text data for word embedding model training to obtain word embedding vectors; store the word embedding vectors in the vector database, and perform relational mapping in the relational database so that the data in the vector database can find its original detailed information in the relational database. The third stage: perform text preprocessing on the terminal user's reasoning data; use the preprocessed reasoning data to enter the intent recognition model for classification; obtain three results after classification: FAQ, scenario, and chat, which correspond to using vectors to retrieve FAQ data, using vectors to retrieve scenario data, and calling the dialogue model; if the FAQ data is retrieved using vectors or the scenario data is retrieved using vectors, find its original detailed information in the relational database according to the pre-stored mapping ID, determine in the original detailed information whether to directly query and return the answer content or call the multi-round dialogue system, and if the dialogue model is called, directly return the reply of the dialogue model.
[0137] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0138] Based on the same inventive concept, the embodiment of the present application also provides a conversation system of a conversation robot for implementing the conversation method of the conversation robot involved above. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the conversation system of one or more conversation robots provided below can refer to the limitations of the conversation method of the conversation robot above, and will not be repeated here.
[0139] In an exemplary embodiment, Figure 5 As shown, a dialogue system of a dialogue robot is provided, including: a text processing module 501, a feature acquisition module 502, a word embedding vector conversion module 503, a target question confirmation module 504 and a target answer output module 505, wherein:
[0140] The text processing module 501 is used to receive the text to be processed and convert the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training the word embedding model based on the first training text data;
[0141] A feature acquisition module 502 is used to obtain the intent recognition classification feature of the first word embedding vector based on a classification model; wherein the classification model is established based on the second training text data;
[0142] A word embedding vector conversion module 503 is used to obtain a second word embedding vector based on a second word embedding model; wherein the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model;
[0143] A target question confirmation module 504 is used to store the second word embedding vector in a vector database, and determine the target question corresponding to the second word embedding vector in the vector database based on a preset question-answering mode; wherein the vector database includes an association relationship between the second word embedding vector and the target question;
[0144] The target answer output module 505 is used to output the target answer of the text to be processed in combination with the target question and the preset text generation mode.
[0145] Furthermore, in one embodiment, the text processing module 501 is also used to input the first training text data into the word embedding model, and segment the first training text data through word segmentation technology, filter non-keywords in the segmented words as stop words, and form a stop word library; update the first training text data based on the stop words to obtain first updated training data, and input the first updated training data into the word embedding model to obtain a first word embedding model.
[0146] Furthermore, in one embodiment, the feature acquisition module 502 is also used to acquire business domain data, non-business domain data and business scenario data, and generate similar data of the business domain data, non-business domain data and business scenario data respectively through prompt engineering technology; based on the similar data, the second training text data is updated to obtain second updated training data, and the second updated training data is input into the classification model to complete the establishment of the classification model.
[0147] Furthermore, in one embodiment, the word embedding vector conversion module 503 is also used to input the third training text data into the first word embedding model combined with preset core hyperparameters to complete the training of the first word embedding model and obtain a second word embedding model; wherein the core hyperparameters include calculation accuracy, learning rate, optimizer, temperature, pooling method and number of training times.
[0148] Furthermore, in one embodiment, the word embedding vector conversion module 503 is also used to match a preset initial learning rate and a preset temperature to the first word embedding model; based on a preselected optimizer, and in combination with a half-precision floating-point quantization method and a classification label pooling method, the first word embedding model is trained; the third training text data is input into the first word embedding model for training, and when the number of training training times is greater than or equal to the preset target training times and the loss value is within the preset target loss value range, the training of the first word embedding model is completed to obtain a second word embedding model.
[0149] Furthermore, in one embodiment, the target question confirmation module 504 is also used to obtain the similarity between the second word embedding vector and the vector in the vector database; determine multiple related questions of the second word embedding vector and a single identifier of the multiple related questions based on the similarity; and according to the single identifier, use the single target question corresponding to the multiple related questions as the target question corresponding to the second word embedding vector.
[0150] Furthermore, in one embodiment, the target answer output module 505 is also used to use the answer corresponding to the target question as the target answer for the text to be processed when a preset target number of related questions retrieved from the vector database correspond to the same target question in the FAQ mode and / or scenario mode.
[0151] Each module in the above-mentioned dialogue robot's dialogue system can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0152] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the conversation data of the dialogue robot. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a conversation method of a dialogue robot is implemented.
[0153] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0154] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0155] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0156] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0157] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0158] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processors involved in each embodiment provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, data processing logic devices based on quantum computing, etc., but are not limited thereto.
[0159] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0160] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A conversation method of a conversation robot, characterized in that: The method comprises: Receive a text to be processed, and convert the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training a word embedding model based on first training text data; Obtaining intent recognition classification features of the first word embedding vector based on a classification model; wherein the classification model is established based on second training text data; Based on the second word embedding model and in combination with the classification label corresponding to the intent recognition classification feature of the first word embedding vector, a second word embedding vector is obtained; wherein the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model; The second word embedding vector is stored in a vector database, and a target question corresponding to the second word embedding vector is determined in the vector database based on a preset question-answering mode; wherein the vector database includes an association relationship between the second word embedding vector and the target question; Combining the target question with a preset text generation mode, a target answer for the text to be processed is output.
2. The method according to claim 1, characterized in that Also includes: Inputting the first training text data into the word embedding model, segmenting the first training text data using a word segmentation technique, and filtering non-keywords in the segmented words as stop words to form a stop word library; The first training text data is updated based on the stop words to obtain first updated training data, and the first updated training data is input into the word embedding model to obtain the first word embedding model.
3. The method according to claim 1, characterized in that Also includes: Acquire business domain data, non-business domain data and business scenario data, and respectively generate similar data of the business domain data, the non-business domain data and the business scenario data through prompt engineering technology; The second training text data is updated based on the similar data to obtain second updated training data, and the second updated training data is input into the classification model to complete the establishment of the classification model.
4. The method according to claim 1, characterized in that: Also includes: The third training text data is input into the first word embedding model combined with preset core hyperparameters to complete the training of the first word embedding model and obtain the second word embedding model; wherein the core hyperparameters include calculation accuracy, learning rate, optimizer, temperature, pooling method and number of training times.
5. The method according to claim 4, characterized in that The step of inputting the third training text data into the first word embedding model combined with preset core hyperparameters to complete the training of the first word embedding model to obtain the second word embedding model includes: Matching a preset initial learning rate and a preset temperature to the first word embedding model; Based on the pre-selected optimizer, the first word embedding model is trained in combination with a half-precision floating point quantization method and a classification label pooling method; The third training text data is input into the first word embedding model for training. When the number of training times is greater than or equal to the preset target training times and the loss value is within the preset target loss value range, the training of the first word embedding model is completed to obtain the second word embedding model.
6. The method according to claim 1, characterized in that The determining, in the vector database, a target question corresponding to the second word embedding vector based on a preset question-answering mode includes: Obtaining the similarity between the second word embedding vector and the vector in the vector database; Determine a plurality of related questions of the second word embedding vector based on the similarity and a single identifier of the plurality of related questions; According to the single identifier, a single target question corresponding to the multiple related questions is used as the target question corresponding to the second word embedding vector.
7. The method according to claim 6, characterized in that The preset text generation modes include: FAQ mode and scenario mode; The step of combining the target question with a preset text generation mode to generate a target answer to the text to be processed includes: In the FAQ mode and / or the scenario mode, when a preset target number of related questions retrieved from the vector database correspond to the same target question, the answer corresponding to the target question is used as the target answer for the text to be processed.
8. A dialogue system of a dialogue robot, characterized in that: The system comprises: A text processing module, configured to receive a text to be processed and convert the text to be processed into a first word embedding vector based on a first word embedding model; wherein the first word embedding model is obtained by training a word embedding model based on first training text data; A feature acquisition module, used to obtain the intent recognition classification feature of the first word embedding vector based on a classification model; wherein the classification model is established based on second training text data; A word embedding vector conversion module, used to obtain a second word embedding vector based on a second word embedding model and a classification label corresponding to the intent recognition classification feature of the first word embedding vector; wherein the second word embedding model is obtained by training the first word embedding vector of the first training text data based on the first word embedding model; A target question confirmation module, used to store the second word embedding vector into a vector database, and determine the target question corresponding to the second word embedding vector in the vector database based on a preset question-answering mode; wherein the vector database includes an association relationship between the second word embedding vector and the target question; The target answer output module is used to output the target answer of the text to be processed in combination with the target question and a preset text generation mode.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.