Transform model-based customer service dialogue method and device
By introducing a customer service dialogue method based on the Transformer model into the customer service system of financial institutions, the problems of slow customer service response speed and reduced service quality are solved, fast, professional and humanized consumer services are achieved, and satisfaction and operational efficiency are improved.
Patent Information
- Application Number
- CN202411717644.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-04-15
AI Technical Summary
The customer service of financial institutions is slow to respond and the service quality is declining, which cannot effectively meet the needs of large-scale consumers during peak hours.
The customer service dialogue method based on the Transformer model is adopted. By inputting the problem text into the Transformer model for machine learning, it simulates the language habits and dialogue strategies of the customer service, generates predicted reply text, and enriches the processing through the natural language processing model to obtain the target reply text.
It has achieved rapid, professional and humane solution to consumer problems and needs, improved consumer satisfaction, reduced operating costs, and improved service quality and efficiency of online customer service.
Smart Images

Figure CN119829701A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence or other related technical fields, and specifically, to a customer service dialogue method and device based on a Transformer model. Background Art
[0002] Driven by the wave of digitalization, online services have become an indispensable part of modern business, especially in the financial and retail industries. Since offline services are restricted by geographical location and business hours, consumers tend to use online services. The popularity of online platforms has brought great convenience to countless consumers. However, with the surge in the number of online consumers, maintaining service quality is a severe challenge.
[0003] In related technologies, customer service relies on limited human resources and often cannot meet the needs of large-scale consumers during peak hours. When consumers face many online operations, such as account management, product inquiries, and payment issues, they expect to receive quick responses and professional answers. However, in existing technologies, customer service during peak hours cannot respond to consumer needs in a timely manner, the response time is extended, and the service quality of customer service is reduced, which in turn leads to a loss of consumer experience.
[0004] Currently, no effective solution has been proposed to address the problems of slow customer service response and degraded service quality of financial institutions in related technologies. Summary of the invention
[0005] The main purpose of this application is to provide a customer service dialogue method and device based on the Transformer model to solve the problems of slow customer service response and reduced service quality of financial institutions in related technologies.
[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a customer service dialogue method based on a Transformer model is provided, and the method is applied to a customer service dialogue system based on a Transformer model, and the customer service dialogue system includes: a Transformer model and a natural language processing model, and the method includes: inputting a question text into the Transformer model, using the Transformer model for machine learning, simulating the customer service's language habits and dialogue strategies, and obtaining a predicted reply text, wherein the Transformer model is trained using a target historical dialogue text, and the question text refers to a text integrated with consumer questions received during a dialogue between the consumer and the customer service of a financial institution; inputting the predicted reply text into the natural language processing model, and the natural language processing model enriches the predicted reply text to obtain a target reply text, wherein the natural language processing model is a pre-built deep learning model for adjusting the reply text, and the enrichment processing at least includes: correcting grammatical errors and replacing sensitive words; outputting the target reply text, and ending the customer service dialogue when the target business needs are met.
[0007] Optionally, a strategy for acquiring target historical conversation texts includes: acquiring multiple groups of historical conversation texts and corresponding scores from a data lake, and taking historical conversation texts with scores greater than a target threshold as target historical conversation texts, wherein the data lake is a pre-built data platform for storing conversation texts and scores, and the historical conversation texts include: question texts and reply texts.
[0008] Optionally, the step of training the Transformer model using the target historical conversation text includes: performing word segmentation processing on the target historical conversation text, converting each sentence of the target historical conversation text into a word sequence, wherein the word segmentation processing refers to splitting a single sentence into multiple words; representing each word in the word sequence as a word vector, assigning a position encoding vector to each word vector, adding the position encoding vector to the corresponding word vector to obtain a word sequence matrix; initializing the Transformer model, wherein the Transformer model includes: an encoder and a decoder; and training the initialized Transformer model using the word sequence matrix.
[0009] Optionally, the step of using a word sequence matrix to train the initialized Transformer model includes: inputting the word sequence matrix into an encoder and outputting a coding information matrix, wherein the encoder includes multiple encoder blocks, each encoder block includes: a self-attention mechanism layer and a feedforward network layer; inputting the coding information matrix into a decoder and outputting a prediction sequence matrix, wherein the decoder includes multiple decoder blocks, each decoder block includes: a masked self-attention mechanism layer, an encoder-decoder attention layer and a feedforward network layer, the masked self-attention mechanism layer is used to ensure that the data information after the current position of the sequence data cannot be accessed when the decoder processes the sequence data, and the encoder-decoder attention layer is used to capture the dependency between the output sequence of the encoder and the output sequence of the masked self-attention mechanism layer; calculating the loss function value based on the prediction sequence matrix, updating the model parameters of the Transformer model based on the loss function value, and ending the training of the Transformer model when the preset target conditions are met.
[0010] Optionally, the step of enriching the predicted reply text by the natural language processing model includes: obtaining access rights to the natural language processing model interface; generating a text processing request, and sending the text processing request to the natural language processing model interface based on the access rights, wherein the text processing request includes: predicting the reply text, responding to the text processing request through the natural language processing model, enriching the predicted reply text to obtain the target reply text; and receiving the target reply text returned by the natural language processing model.
[0011] Optionally, before ending the customer service conversation, the process includes: obtaining a score of a target reply text, and if the score is greater than a target threshold, storing the target reply text and the score in a data lake.
[0012] Optionally, after the customer service conversation ends, the method includes: obtaining the business demand completion rate, and when the business demand completion rate is not greater than a preset threshold, using a gradient descent strategy to update the Transformer model, wherein the gradient descent strategy includes: calculating the gradient value of the loss function based on the output sequence of the Transformer model, and updating the model parameters of the Transformer model based on a preset learning rate and the gradient value of the loss function; iteratively updating the model parameters of the Transformer model, and stopping the update of the Transformer model when convergence conditions are met; after the Transformer model is updated, using the new Transformer model in the next round of customer service conversation.
[0013] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a customer service dialogue device based on a Transformer model is provided, and the device includes: a prediction unit, which is used to input a question text into a Transformer model, use the Transformer model for machine learning, simulate the customer service's language habits and dialogue strategies, and obtain a predicted reply text, wherein the Transformer model is trained using a target historical dialogue text, and the question text refers to a text integrated with consumer questions received during a dialogue between the consumer and the customer service of a financial institution; an enrichment unit, which is used to input the predicted reply text into a natural language processing model, and the natural language processing model enriches the predicted reply text to obtain a target reply text, wherein the natural language processing model is a pre-built deep learning model for adjusting the reply text, and the enrichment processing at least includes: correcting grammatical errors and replacing sensitive words; an output unit, which is used to output the target reply text and end the customer service dialogue when the target business needs are met.
[0014] Optionally, the prediction unit includes: a screening module, used to obtain multiple groups of historical conversation texts and corresponding scores from a data lake, and use historical conversation texts with scores greater than a target threshold as target historical conversation texts, wherein the data lake is a pre-built data platform for storing conversation texts and scores, and the historical conversation texts include: question texts and reply texts.
[0015] Optionally, the prediction unit also includes: a word segmentation module, which is used to perform word segmentation processing on the target historical dialogue text, and convert each sentence of the target historical dialogue text into a word sequence, wherein the word segmentation processing refers to splitting a single sentence into multiple words; an allocation module, which is used to represent each word in the word sequence as a word vector, assign a position encoding vector to each word vector, and add the position encoding vector to the corresponding word vector to obtain a word sequence matrix; an initialization module, which is used to initialize the Transformer model, wherein the Transformer model includes: an encoder and a decoder; a training module, which is used to train the initialized Transformer model using the word sequence matrix.
[0016] Optionally, the prediction unit also includes: a first output module, used to input the word sequence matrix into the encoder and output the encoding information matrix, wherein the encoder includes multiple encoder blocks, each encoder block includes: a self-attention mechanism layer and a feedforward network layer; a second output module, used to input the encoding information matrix into the decoder and output the prediction sequence matrix, wherein the decoder includes multiple decoder blocks, each decoder block includes: a masked self-attention mechanism layer, an encoder-decoder attention layer and a feedforward network layer, the masked self-attention mechanism layer is used to ensure that the data information after the current position of the sequence data cannot be accessed when the decoder processes the sequence data, and the encoder-decoder attention layer is used to capture the dependency between the output sequence of the encoder and the output sequence of the masked self-attention mechanism layer; a calculation module, which calculates the loss function value based on the prediction sequence matrix, updates the model parameters of the Transformer model based on the loss function value, and ends the training of the Transformer model when the preset target conditions are met.
[0017] Optionally, the enrichment unit includes: an acquisition module for obtaining access rights to a natural language processing model interface; a generation module for generating a text processing request and sending the text processing request to the natural language processing model interface based on the access rights, wherein the text processing request includes: predicting a reply text, responding to the text processing request through a natural language processing model, enriching the predicted reply text, and obtaining a target reply text; and a receiving module for receiving the target reply text returned by the natural language processing model.
[0018] Optionally, the output unit includes: a first judgment module, used to obtain a score of the target reply text, and when the score is greater than a target threshold, store the target reply text and the score in the data lake.
[0019] Optionally, the output unit also includes: a second judgment module, used to obtain the business demand completion rate, and when the business demand completion rate is not greater than a preset threshold, using a gradient descent strategy to update the Transformer model, wherein the gradient descent strategy includes: calculating the gradient value of the loss function based on the output sequence of the Transformer model, and updating the model parameters of the Transformer model based on a preset learning rate and the gradient value of the loss function; a first update module, used to iteratively update the model parameters of the Transformer model, and stop updating the Transformer model when convergence conditions are met; a second update module, used to use the new Transformer model in the next round of customer service conversation after the Transformer model is updated.
[0020] In an embodiment of the present application, the question text is input into a Transformer model, machine learning is performed using the Transformer model, the language habits and dialogue strategies of the customer service are simulated, and a predicted reply text is obtained. The predicted reply text is then input into a natural language processing model, and the natural language processing model enriches the predicted reply text to obtain a target reply text. Finally, the target reply text is output, and the customer service conversation is ended while meeting the target business needs, thereby achieving the purpose of accurately, professionally and humanely solving consumer problems and needs, thereby achieving the technical effect of providing consumers with expected responses and solutions and improving consumer satisfaction, thereby solving the technical problems of slow customer service response and reduced service quality of financial institutions in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0022] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a customer service dialogue method based on a Transformer model is shown;
[0023] Figure 2 is a flowchart of a customer service dialogue method based on a Transformer model provided according to an embodiment of the present application;
[0024] Figure 3 It is a structural diagram of a word sequence matrix provided according to an embodiment of the present application;
[0025] Figure 4 It is a flow chart of a customer service dialogue method based on a Transformer model provided in an embodiment of the present application;
[0026] Figure 5 is a schematic diagram of a customer service dialogue device based on a Transformer model provided according to an embodiment of the present application;
[0027] Figure 6 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] It should be noted that the relevant information (including but not limited to consumer device information, consumer personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are all information and data authorized by consumers or fully authorized by all parties. For example, an interface is set up between this system and relevant consumers or institutions. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned consumer or institution through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned consumer or institution.
[0031] Example 1
[0032] According to an embodiment of the present application, a method embodiment of a customer service dialogue based on a Transformer model is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0033] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a customer service dialogue method based on a Transformer model. Figure 1As shown, the computer terminal 10 (or mobile device) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor (Microcontroller Unit, MCU) or a programmable logic device (Field-Programmable Gate Array, FPGA)), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (Input / Output Interface, I / O interface), a Universal Serial Bus (Universal Serial Bus, USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0034] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0035] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the customer service dialogue method based on the Transformer model in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the customer service dialogue method based on the Transformer model is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 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 combinations thereof.
[0036] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0037] The display may be, for example, a touch screen type liquid crystal display (LCD) that enables a consumer to interact with a consumer interface of the computer terminal 10 (or mobile device).
[0038] Under the above operating environment, this application provides Figure 2 The customer service dialogue method based on the Transformer model shown in Figure 2 It is a flowchart of a customer service dialogue method based on a Transformer model provided according to an embodiment of the present application.
[0039] It should be noted that the method is applied to a customer service dialogue system based on a Transformer model, and the customer service dialogue system includes: a Transformer model and a natural language processing model.
[0040] The Transformer model is a deep learning model. The embodiment of the present invention uses a deep learning strategy to construct a Transformer model, trains the Transformer model, and uses the trained Transformer model to capture the language habits, speaking styles, and language logic of customer service and consumers. The natural language processing model uses a pre-built large-scale advanced processing model, and uses an advanced natural language processing model to further process the output results of the Transformer model by calling the existing model interface. The embodiment of the present invention combines the Transformer model and the natural language processing model to construct a customer service dialogue system based on the Transformer model. The customer service dialogue system based on the Transformer model can be regarded as an AI customer service avatar. The AI customer service avatar conducts uninterrupted deep learning based on the usual language habits and dialogue skills of excellent customer service, improves the work efficiency of customer service, reduces the response time of customer service, and can help consumers solve problems in a timely manner, thereby improving consumers' consumption experience.
[0041] In an embodiment of the present invention, the purpose of the customer service dialogue system based on the Transformer model is to provide more efficient and personalized customer service. By integrating the self-built Transformer model and the pre-built advanced natural language processing model, the dialogue between customer service and consumers is simulated and the needs of consumers are understood, which significantly improves the service quality and efficiency of online customer service, and can provide consumers with all-weather, personalized and high-quality services, solve the problem of consumers waiting for a long time for customer service, and at the same time, by reducing the demand for human customer service, it greatly reduces operating costs. In addition, based on the continuous learning and optimization mechanism of the Transformer model, the customer service dialogue system can continuously improve and optimize services, further enhance consumer satisfaction, and improve overall service quality.
[0042] like Figure 2 As shown in the figure, the customer service dialogue method based on the Transformer model includes the following steps:
[0043] Step S201, input the question text into the Transformer model, use the Transformer model for machine learning, simulate the customer service's language habits and dialogue strategies, and obtain the predicted reply text, wherein the Transformer model is trained using the target historical dialogue text, and the question text refers to the text integrated from the consumer's questions received during the conversation between the consumer and the customer service of the financial institution.
[0044] When implementing customer service dialogue, the embodiment of the present invention needs to determine how to accurately simulate the language habits and dialogue strategies of excellent customer service through the Transformer model, so as to provide consumers with an excellent online service experience. In this process, the question text needs to be input into the Transformer model first. In the process of interaction between consumers and customer service of financial institutions, the questions or demands raised by consumers are converted into question texts, which are the basis for the customer service dialogue system to understand and respond. It should be noted that the embodiment of the present invention can pre-process the question text, including word segmentation and position encoding of the question text.
[0045] After the question text is input into the Transformer model, the Transformer model simulates the language habits and dialogue strategies of excellent customer service based on machine learning / deep learning strategies to obtain the predicted reply text. In this process, the Transformer model deeply understands the question text and generates the reply text based on this understanding. The generated predicted reply text can not only accurately answer the questions or needs raised in the question text, but also is similar to the words of excellent customer service in terms of grammar, logic and emotional expression.
[0046] It should be noted that the Transformer model uses target historical conversation texts for training. Target historical conversation texts refer to historical conversation texts with high scores. These conversation texts not only contain the rich language habits and conversation strategies of excellent customer service, but also reflect the conversation skills of how to solve consumer problems efficiently, accurately and humanely in various scenarios. By inputting the target historical conversation text into the Transformer model, the Transformer model can learn the contextual relationship of the conversation, understand the logic before and after the conversation, and then learn how to deal with different types of consumer problems. Training the Transformer model with target historical conversation texts can improve the generalization ability of the Transformer model and ensure that the customer service dialogue system can simulate the conversation style of excellent customer service.
[0047] Step S202: input the predicted reply text into a natural language processing model, and the natural language processing model enriches the predicted reply text to obtain a target reply text, wherein the natural language processing model is a pre-built deep learning model for adjusting the reply text, and the enrichment processing at least includes: correcting grammatical errors and replacing sensitive words.
[0048] In the embodiment of the invention, after the predicted reply text is generated, in order to further improve the quality of the reply, the customer service dialogue system inputs the predicted reply text into the pre-built advanced natural language processing model for enrichment processing to obtain the target reply text. The embodiment of the present invention uses an advanced natural language processing model to further process the predicted reply text by calling the existing model interface. It should be noted that the natural language processing model can be a large language model developed by domestic and foreign companies. The natural language processing model can adjust the predicted reply text, including identifying and correcting grammatical errors and spelling errors in the predicted reply text, adjusting the structure of the text sentence, and ensuring that the reply text is grammatically correct, logically clear, and fluent in expression. At the same time, the natural language processing model can also replace sensitive words in the predicted reply text. For example, in the field of financial technology, some words are sensitive, and improper use may cause discomfort or misunderstanding to consumers. The natural language processing model can identify and replace these sensitive words to ensure the appropriateness and safety of the reply text. In addition, the natural language processing model can also adjust the emotion of the reply text to ensure that even in the scenario of automated reply, AI customer service can convey appropriate empathy and friendly attitude, and enhance the humanized experience of consumers.
[0049] Step S203: Output the target reply text, and end the customer service dialogue if the target business requirement is met.
[0050] The embodiment of the present invention obtains the predicted reply text by inputting the question text into the Transformer model, and then uses the natural language processing model to enrich the predicted reply text to obtain the target reply text. This process not only utilizes the powerful generation ability of the Transformer model, but also gives full play to the professionalism of the natural language processing model in text optimization. This two-pronged approach ensures that the customer service dialogue system can provide professional and humanized services.
[0051] After the target reply text is output, the target reply text is fed back to the consumer. When the consumer is responding, the page they see will display both the "solved" and "unsolved" buttons. If the consumer does not click "solved", the customer service dialogue system will continue to operate and answer the consumer's questions. If the consumer clicks "solved", the customer service dialogue system ends the customer service dialogue. If the consumer clicks "unsolved", the customer service dialogue system will promptly switch to manual customer service and record the customer service information.
[0052] Optionally, a strategy for acquiring target historical conversation texts includes: acquiring multiple groups of historical conversation texts and corresponding scores from a data lake, and taking historical conversation texts with scores greater than a target threshold as target historical conversation texts, wherein the data lake is a pre-built data platform for storing conversation texts and scores, and the historical conversation texts include: question texts and reply texts.
[0053] In an embodiment of the present invention, the Transformer model is trained using the target historical conversation text, and the target historical conversation text needs to be obtained from the data lake.
[0054] The data lake is a pre-built data platform for storing conversation texts and ratings. It collects historical conversation texts between financial institution customer service and consumers, including consumer question texts and customer service response texts. These conversation texts cover a variety of business scenarios, from account inquiries, loan consultations to complaint handling, as well as rating feedback given by consumers after each conversation. The establishment of the database provides a rich and comprehensive learning resource for the customer service dialogue system, and is the basis for high-quality training of the customer service dialogue system.
[0055] To obtain the target historical conversation text from the data lake, we first need to filter out the historical conversation texts with scores higher than the target threshold from the massive historical conversation texts, and use the filtered historical conversation texts as the target historical conversation texts. The target threshold can be set to 4.5 points (out of 5 points), which means that only those conversation texts that are considered excellent by consumers and can highly meet consumer needs can be selected as learning samples for the Transformer model. Through this screening mechanism, it can be ensured that the conversation patterns and strategies learned by the Transformer model are verified in practice and are high-quality content that can effectively improve consumer satisfaction.
[0056] Optionally, the step of training the Transformer model using the target historical conversation text includes: performing word segmentation processing on the target historical conversation text, converting each sentence of the target historical conversation text into a word sequence, wherein the word segmentation processing refers to splitting a single sentence into multiple words; representing each word in the word sequence as a word vector, assigning a position encoding vector to each word vector, adding the position encoding vector to the corresponding word vector to obtain a word sequence matrix; initializing the Transformer model, wherein the Transformer model includes: an encoder and a decoder; and training the initialized Transformer model using the word sequence matrix.
[0057] When using the target historical conversation text to train the Transformer model, the target historical conversation text obtained from the data lake is first segmented. Segmentation refers to splitting a single sentence into multiple words and building a vocabulary. Each word in the vocabulary is used as a basic unit for subsequent processing. Through the segmentation process, each sentence of the target historical conversation text is converted into a word sequence, preparing for the training of the Transformer model.
[0058] Each word in the word sequence is then represented as a word vector, which is a high-dimensional vector and a common representation method in deep learning models. In order to enable the Transformer model to understand the order of words in a sentence, each word vector is assigned a position encoding vector. The position encoding vector provides a quantitative representation of the position of a word in a sentence, which helps the Transformer model understand the position and context information of the word in the sentence. By adding the position encoding vector to the corresponding word vector, a word sequence matrix containing the semantic information and position information of the word is formed, and the word sequence matrix is used to train the Transformer model.
[0059] Figure 3 is a structural diagram of a word sequence matrix provided according to an embodiment of the present application, such as Figure 3As shown, "I", "want", "modify" and "address" are four words, "word embedding" represents the word vector, "position embedding" represents the position encoding vector, and "Transformer's x" represents each row of the word sequence matrix. Each row of the word sequence matrix can be obtained by adding the word vector of each word to the position encoding vector, and each row can be combined in the order of the words to get the word sequence matrix.
[0060] The Transformer model needs to be initialized when it is built. The Transformer model consists of two parts: the encoder and the decoder. The encoder is responsible for encoding the word sequence matrix into the encoding information matrix, and the decoder is responsible for generating the prediction sequence matrix based on the encoding information matrix. Both the encoder and the decoder use the self-attention mechanism, which can process input and output sequences in parallel, and can process multiple words at the same time. The training efficiency and actual use efficiency are very high. After initializing the Transformer model, the word sequence matrix is used to train the initialized Transformer model, and finally the trained Transformer model is used in actual scenarios to answer consumers' questions and provide timely, accurate and humanized responses.
[0061] Optionally, the step of using a word sequence matrix to train the initialized Transformer model includes: inputting the word sequence matrix into an encoder and outputting a coding information matrix, wherein the encoder includes multiple encoder blocks, each encoder block includes: a self-attention mechanism layer and a feedforward network layer; inputting the coding information matrix into a decoder and outputting a prediction sequence matrix, wherein the decoder includes multiple decoder blocks, each decoder block includes: a masked self-attention mechanism layer, an encoder-decoder attention layer and a feedforward network layer, the masked self-attention mechanism layer is used to ensure that the data information after the current position of the sequence data cannot be accessed when the decoder processes the sequence data, and the encoder-decoder attention layer is used to capture the dependency between the output sequence of the encoder and the output sequence of the masked self-attention mechanism layer; calculating the loss function value based on the prediction sequence matrix, updating the model parameters of the Transformer model based on the loss function value, and ending the training of the Transformer model when the preset target conditions are met.
[0062] In an embodiment of the present invention, when the initialized Transformer model is trained using a word sequence matrix, the word sequence matrix is first input to an encoder, and the encoder outputs a coded information matrix. The encoder is composed of a plurality of encoder blocks, and each encoder block includes a self-attention mechanism layer and a forward feedback network layer. Wherein, the self-attention mechanism layer is used to step the dependencies between different words in the word sequence, so that the Transformer model can pay attention to other words related to the current word, and then understand the semantic structure of the entire sentence. The forward feedback network layer is used to further process the output information of the self-attention mechanism layer, and extracts the coded information matrix through the processing of linear transformation and activation function. It should be noted that the number of encoder blocks can be 6, and the dimension of each encoder block output matrix is consistent with the input.
[0063] The encoded information matrix is then passed to the decoder, which is also composed of multiple decoder blocks, each of which includes a masked self-attention mechanism layer, an encoder-decoder attention layer, and a feedforward network layer. Among them, the masked self-attention mechanism layer can ensure that when generating a word at a certain position, any information after that position in the sequence will not be accessed when processing sequence data, thereby avoiding future information leakage. The encoder-decoder attention layer helps the Transformer model consider the complete semantics of the question text when generating the prediction sequence matrix by capturing the dependency between the output sequence of the encoder and the output sequence of the masked self-attention mechanism layer, thereby improving the accuracy of the prediction sequence matrix.
[0064] After the decoder generates the prediction sequence matrix, it compares the prediction sequence matrix with the actual historical reply text and calculates the loss function value. The loss function value measures the difference between the predicted reply and the actual reply, and is a key evaluation indicator of the Transformer model training process. Based on the calculated loss function value, the Transformer model uses the gradient descent optimization algorithm to update the parameters of the Transformer model. This process is iterated repeatedly until the Transformer model meets the preset target conditions, and then the training of the Transformer model is terminated. The preset target condition can be that the reply accuracy rate exceeds 80%, that is, 80% of the output prediction sequence matrix matches the actual historical reply text. Finally, the trained Transformer model is used in actual scenarios.
[0065] Optionally, the step of enriching the predicted reply text by the natural language processing model includes: obtaining access rights to the natural language processing model interface; generating a text processing request, and sending the text processing request to the natural language processing model interface based on the access rights, wherein the text processing request includes: predicting the reply text, responding to the text processing request through the natural language processing model, enriching the predicted reply text to obtain the target reply text; and receiving the target reply text returned by the natural language processing model.
[0066] In an embodiment of the present invention, the natural language processing model enriches the predicted reply text, which is the key to improving the quality of customer service replies. In this process, the customer service dialogue system first obtains the access rights of the natural language processing model interface to ensure the legal call of the natural language processing model. Next, the customer service dialogue system generates a text processing request based on the obtained access rights. This request contains the predicted reply text. The text processing request can be an HTTP request, and the text processing request is sent to the natural language processing model interface based on the HTTP communication protocol. After the natural language processing model interface receives the request, the natural language processing model enriches the predicted reply text, including correcting grammatical errors, replacing sensitive words, etc., and finally obtains the target reply text. After the processing is completed, the natural language processing model interface returns the target reply text. The target reply text is the final version after enrichment, and it has been significantly improved in grammar, expression, emotion and security.
[0067] Optionally, before ending the customer service conversation, the process includes: obtaining a score of a target reply text, and if the score is greater than a target threshold, storing the target reply text and the score in a data lake.
[0068] In an embodiment of the present invention, in order to ensure that the customer service dialogue system can be sustainably optimized, after the customer service dialogue system sends the target reply text and solves the consumer's problem, it will invite the consumer to evaluate the satisfaction of the dialogue. This evaluation process is usually carried out in the form of online scoring, and consumers give a comprehensive score based on the service experience, including the efficiency of problem solving, the accuracy of the response, the fluency of communication, and the friendliness of the customer service attitude. The customer service dialogue system obtains these scores and dialogue records, and sets a target threshold, usually 4.5 points (out of 5 points), and saves the dialogue records with scores greater than the target threshold to the data lake. Through this series of operations, a feedback loop is constructed, and high-quality dialogue records are collected and saved, which are called the input information for the new training of the customer service dialogue system. The customer service dialogue system can continuously improve the naturalness, professionalism and consumer satisfaction of the customer service dialogue by continuously learning these dialogue records.
[0069] Optionally, after the customer service conversation ends, the method includes: obtaining the business demand completion rate, and when the business demand completion rate is not greater than a preset threshold, using a gradient descent strategy to update the Transformer model, wherein the gradient descent strategy includes: calculating the gradient value of the loss function based on the output sequence of the Transformer model, and updating the model parameters of the Transformer model based on a preset learning rate and the gradient value of the loss function; iteratively updating the model parameters of the Transformer model, and stopping the update of the Transformer model when convergence conditions are met; after the Transformer model is updated, using the new Transformer model in the next round of customer service conversation.
[0070] In an embodiment of the present invention, after the customer service dialogue ends, in order to ensure that the customer service dialogue system can continue to learn and improve, the embodiment of the present invention not only evaluates the business demand completion rate, but also uses a gradient descent strategy to update the Transformer model.
[0071] At the end of the customer service conversation, the customer service conversation system will calculate the business demand completion rate based on whether the consumer has clearly stated that their business needs have been met and whether all the questions raised by the consumer have been successfully resolved during the conversation. The business demand completion rate reflects the success rate of the customer service conversation system in handling consumer problems and needs. In an embodiment of the present invention, a threshold for the business demand completion rate is set, such as setting the threshold to 80%, as a condition for triggering the customer service conversation system. When the business demand completion rate is not greater than the preset threshold, a gradient descent strategy is used to update the Transformer model.
[0072] In the gradient descent strategy, the gradient value of the loss function is first calculated based on the output sequence of the Transformer model, and then the model parameters of the Transformer model are updated based on the preset learning rate and the gradient value of the loss function. The loss function can adopt the cross entropy loss function, and the preset learning rate is a hyperparameter used to control the step size of the model parameter adjustment of the Transformer model. By iteratively updating the model parameters of the Transformer model, the performance of the Transformer model is continuously optimized. After reaching the convergence condition, the update of the Transformer model is stopped, and the new Transformer model is used in the next round of customer service dialogue. When the business demand completion rate is greater than the preset threshold, the customer service dialogue system will be frequently used in actual scenarios.
[0073] Figure 4 is a flow chart of a customer service dialogue method based on a Transformer model provided in an embodiment of the present application, such as Figure 4As shown, the customer service dialogue system first collects data, screens out the target historical dialogue text through the data lake, and uses the target historical dialogue text to train the Transformer model. After the Transformer model meets the preset target conditions (which can be a response accuracy greater than 80%), the trained Transformer model is embedded in the customer service dialogue system. If the training of the Transformer model does not meet the preset target conditions, the optimization training continues. The consumer's question text in the actual scenario is input into the Transformer model to obtain the predicted reply text, and then the natural language processing model is used to enrich the predicted reply text by calling the API interface of the natural language processing model to obtain the target reply text, and the target reply text is used as the output of the customer service dialogue system. The consumer determines whether the problem has been solved based on the target reply text, and ends the customer service dialogue if the problem has been solved. If the problem has not been solved, the customer service dialogue system promptly transfers it to manual processing. At the same time, if the problem has been solved and the customer service dialogue has been ended, the customer service dialogue system determines whether the business demand completion rate in the actual use process is greater than the preset threshold (which can be 80%). If the business demand completion rate is greater than the preset threshold, the customer service dialogue system continues to be used, and if the business demand completion rate is not greater than the preset threshold, the Transformer model continues to be trained.
[0074] The customer service dialogue method based on the Transformer model provided in the embodiment of the present application is a customer service dialogue system based on the Transformer model trained by the historical dialogue records of excellent customer service staff. The system has dialogue capabilities similar to those of excellent customer service staff and can be regarded as an avatar of excellent customer service staff. The customer service avatar has many advantages, including:
[0075] First, the customer service avatar has a significant effect. By using a large number of historical conversation records of excellent customer service to train the customer service avatar, the customer service avatar can imitate and learn the communication skills and problem-solving methods of excellent customer service, making the customer service avatar more natural and smooth when communicating with consumers. The customer service avatar can accurately understand the needs and problems of consumers, and can give expected responses and solutions, which improves consumer satisfaction and loyalty.
[0076] Secondly, the advantages of customer service clones include efficiency, reliability and consistency. Customer service clones can provide consultation and services to consumers 24 hours a day, without rest, fatigue or mood swings, ensuring the efficiency of customer service. At the same time, because customer service clones use the same training data for dialogue training, their responses and services are consistent and reliable, which also means that the same quality of service level can be maintained at different times or in different scenarios. Since the training set is limited to the dialogue records of excellent customer service, customer service clones will only simulate the responses of excellent customer service at work, and will not respond to any other questions that are not related to their job, thereby avoiding adverse effects.
[0077] In addition, customer service clones can also improve the scalability and diversity of services. By learning and training from excellent customer service conversation records, customer service clones can continuously accumulate knowledge, learn new industry fields, product information, etc., so that services can be continuously updated and iterated. At the same time, customer service clones can handle multiple conversations at the same time, realize the scalability of services, and can respond flexibly to the needs of different consumers.
[0078] In addition, customer service clones can also help reduce corporate costs and improve operational efficiency. Customer service clones can reduce the labor costs of enterprises. An excellent customer service representative can create multiple customer service clones to improve response speed and make it easier for enterprises to cope with peak trading periods. By handling most common problems in an automated way, the repetitive work of customer service personnel is reduced, so that customer service personnel can better focus on highly complex problems and improve customer service operational efficiency.
[0079] The customer service dialogue method based on the Transformer model provided in the embodiment of the present application inputs the question text into the Transformer model, uses the Transformer model for machine learning, simulates the customer service's language habits and dialogue strategies, obtains the predicted reply text, and then inputs the predicted reply text into the natural language processing model, and the natural language processing model enriches the predicted reply text to obtain the target reply text, and finally outputs the target reply text. When the target business needs are met, the customer service dialogue is ended, thereby achieving the purpose of accurately, professionally and humanely solving consumer problems and needs, thereby achieving the technical effect of providing consumers with expected replies and solutions and improving consumer satisfaction, thereby solving the technical problems of slow customer service response speed and reduced service quality in related technologies.
[0080] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0081] Example 2
[0082] The embodiment of the present application also provides a customer service dialogue device based on the Transformer model. It should be noted that the customer service dialogue device based on the Transformer model in the embodiment of the present application can be used to execute the customer service dialogue method based on the Transformer model provided in the embodiment of the present application. The following introduces the customer service dialogue device based on the Transformer model provided in the embodiment of the present application.
[0083] According to an embodiment of the present application, a device for implementing the above-mentioned customer service dialogue method based on the Transformer model is also provided. Figure 5 is a schematic diagram of a customer service dialogue device based on a Transformer model provided according to an embodiment of the present application, such as Figure 5 As shown, the device comprises:
[0084] The prediction unit 51 is used to input the question text into the Transformer model, use the Transformer model to perform machine learning, simulate the customer service's language habits and dialogue strategies, and obtain the predicted reply text, wherein the Transformer model is trained using the target historical dialogue text, and the question text refers to the text integrated from the consumer's questions received during the conversation between the consumer and the customer service of the financial institution.
[0085] The enrichment unit 52 is used to input the predicted reply text into the natural language processing model, and the natural language processing model enriches the predicted reply text to obtain the target reply text, wherein the natural language processing model is a pre-built deep learning model for adjusting the reply text, and the enrichment processing at least includes: correcting grammatical errors and replacing sensitive words.
[0086] The output unit 53 is used to output the target reply text and end the customer service dialogue when the target business requirements are met.
[0087] Optionally, the prediction unit 51 includes: a screening module, used to obtain multiple groups of historical conversation texts and corresponding scores from the data lake, and use the historical conversation texts with scores greater than a target threshold as target historical conversation texts, wherein the data lake is a pre-built data platform for storing conversation texts and scores, and the historical conversation texts include: question texts and reply texts.
[0088] The customer service dialogue device based on the Transformer model provided in the embodiment of the present application inputs the question text into the Transformer model through the prediction unit 51, uses the Transformer model for machine learning, simulates the customer service's language habits and dialogue strategies, and obtains a predicted reply text, and then inputs the predicted reply text into the natural language processing model through the enrichment unit 52, and the natural language processing model enriches the predicted reply text to obtain a target reply text, and finally outputs the target reply text through the output unit 53. When the target business needs are met, the customer service dialogue is ended, thereby achieving the purpose of accurately, professionally and humanely solving consumer problems and needs, thereby achieving the technical effect of providing consumers with expected replies and solutions and improving consumer satisfaction, thereby solving the technical problems of slow customer service response and reduced service quality of financial institutions in related technologies.
[0089] Optionally, the prediction unit 51 also includes: a word segmentation module, which is used to perform word segmentation processing on the target historical conversation text, and convert each sentence of the target historical conversation text into a word sequence, wherein the word segmentation processing refers to splitting a single sentence into multiple words; an allocation module, which is used to represent each word in the word sequence as a word vector, assign a position encoding vector to each word vector, and add the position encoding vector to the corresponding word vector to obtain a word sequence matrix; an initialization module, which is used to initialize the Transformer model, wherein the Transformer model includes: an encoder and a decoder; a training module, which is used to train the initialized Transformer model using the word sequence matrix.
[0090] Optionally, the prediction unit 51 also includes: a first output module, used to input the word sequence matrix into the encoder and output the encoding information matrix, wherein the encoder includes multiple encoder blocks, each encoder block includes: a self-attention mechanism layer and a forward feedback network layer; a second output module, used to input the encoding information matrix into the decoder and output the prediction sequence matrix, wherein the decoder includes multiple decoder blocks, each decoder block includes: a masked self-attention mechanism layer, an encoder-decoder attention layer and a forward feedback network layer, the masked self-attention mechanism layer is used to ensure that the data information after the current position of the sequence data cannot be accessed when the decoder processes the sequence data, and the encoder-decoder attention layer is used to capture the dependency between the output sequence of the encoder and the output sequence of the masked self-attention mechanism layer; a calculation module, which calculates the loss function value based on the prediction sequence matrix, updates the model parameters of the Transformer model based on the loss function value, and ends the training of the Transformer model when the preset target conditions are met.
[0091] Optionally, the enrichment unit 52 includes: an acquisition module for obtaining access rights to the natural language processing model interface; a generation module for generating a text processing request and sending the text processing request to the natural language processing model interface based on the access rights, wherein the text processing request includes: predicting a reply text, responding to the text processing request through a natural language processing model, enriching the predicted reply text, and obtaining a target reply text; and a receiving module for receiving the target reply text returned by the natural language processing model.
[0092] Optionally, the output unit 53 includes: a first judgment module, used to obtain a score of the target reply text, and when the score is greater than a target threshold, store the target reply text and the score in the data lake.
[0093] Optionally, the output unit 53 also includes: a second judgment module, used to obtain the business demand completion rate, and when the business demand completion rate is not greater than a preset threshold, using a gradient descent strategy to update the Transformer model, wherein the gradient descent strategy includes: calculating the gradient value of the loss function based on the output sequence of the Transformer model, and updating the model parameters of the Transformer model based on a preset learning rate and the gradient value of the loss function; a first update module, used to iteratively update the model parameters of the Transformer model, and stop updating the Transformer model when convergence conditions are met; a second update module, used to use the new Transformer model in the next round of customer service conversation after the Transformer model is updated.
[0094] It should be noted that the prediction unit 51, enrichment unit 52 and output unit 53 correspond to steps S201 to S203 in Example 1, and the examples and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above-mentioned modules can also be run in the computer terminal 10 provided in Example 1 as part of the device.
[0095] Example 3
[0096] An embodiment of the present application may provide an electronic device, Figure 6 is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 6 As shown, the electronic device may include: one or more ( Figure 6(only one is shown) processor 602, memory 604, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0097] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal 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 combinations thereof.
[0098] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: input the question text into the Transformer model, use the Transformer model for machine learning, simulate the customer service's language habits and dialogue strategies, and obtain the predicted reply text, wherein the Transformer model is trained with the target historical dialogue text, and the question text refers to the text integrated with the consumer's questions received during the conversation between the consumer and the customer service of the financial institution; input the predicted reply text into the natural language processing model, and the natural language processing model enriches the predicted reply text to obtain the target reply text, wherein the natural language processing model is a pre-built deep learning model for adjusting the reply text, and the enrichment processing at least includes: correcting grammatical errors and replacing sensitive words; outputting the target reply text, and ending the customer service conversation when the target business needs are met.
[0099] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: obtain multiple groups of historical conversation texts and corresponding scores from the data lake, and use the historical conversation texts with scores greater than the target threshold as the target historical conversation texts, wherein the data lake is a pre-built data platform for storing conversation texts and scores, and the historical conversation texts include: question texts and reply texts.
[0100] The processor can call the information and application programs stored in the memory through the transmission device to execute the following steps: perform word segmentation processing on the target historical conversation text, convert each sentence of the target historical conversation text into a word sequence, wherein the word segmentation processing refers to splitting a single sentence into multiple words; represent each word in the word sequence as a word vector, assign a position encoding vector to each word vector, add the position encoding vector to the corresponding word vector, and obtain a word sequence matrix; initialize the Transformer model, wherein the Transformer model includes: an encoder and a decoder; and use the word sequence matrix to train the initialized Transformer model.
[0101] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: input the word sequence matrix into the encoder and output the encoding information matrix, wherein the encoder includes multiple encoder blocks, each encoder block includes: a self-attention mechanism layer and a forward feedback network layer; input the encoding information matrix into the decoder and output the predicted sequence matrix, wherein the decoder includes multiple decoder blocks, each decoder block includes: a masked self-attention mechanism layer, an encoder-decoder attention layer and a forward feedback network layer, the masked self-attention mechanism layer is used to ensure that the data information after the current position of the sequence data cannot be accessed when the decoder processes the sequence data, and the encoder-decoder attention layer is used to capture the dependency between the output sequence of the encoder and the output sequence of the masked self-attention mechanism layer; calculate the loss function value based on the predicted sequence matrix, update the model parameters of the Transformer model based on the loss function value, and end the training of the Transformer model when the preset target conditions are met.
[0102] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: obtain access rights to the natural language processing model interface; generate a text processing request, and send the text processing request to the natural language processing model interface based on the access rights, wherein the text processing request includes: predicting reply text, responding to the text processing request through the natural language processing model, enriching the predicted reply text, and obtaining the target reply text; and receiving the target reply text returned by the natural language processing model.
[0103] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: obtain the score of the target reply text, and when the score is greater than the target threshold, store the target reply text and the score in the data lake.
[0104] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: obtain the business demand completion rate, and when the business demand completion rate is not greater than a preset threshold, use the gradient descent strategy to update the Transformer model, wherein the gradient descent strategy includes: calculating the gradient value of the loss function based on the output sequence of the Transformer model, and updating the model parameters of the Transformer model based on the preset learning rate and the gradient value of the loss function; iteratively updating the model parameters of the Transformer model, and stopping the update of the Transformer model when the convergence conditions are met; after the Transformer model is updated, use the new Transformer model in the next round of customer service conversation.
[0105] It can be understood by those skilled in the art that Figure 6 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 6 The structure of the electronic device is not limited. Figure 6 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 6 Different configurations shown.
[0106] A person of ordinary skill in the art can understand that all or part of the steps in the various customer service dialogue methods based on the Transformer model in the above-mentioned embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0107] Example 4
[0108] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the customer service dialogue method based on the Transformer model provided in the first embodiment.
[0109] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0110] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: inputting the question text into a Transformer model, performing machine learning using the Transformer model, simulating the customer service's language habits and dialogue strategies, and obtaining a predicted reply text, wherein the Transformer model is trained using a target historical dialogue text, and the question text refers to a text integrated with consumer questions received during a conversation between the consumer and the customer service of a financial institution; inputting the predicted reply text into a natural language processing model, and having the natural language processing model enrich the predicted reply text to obtain a target reply text, wherein the natural language processing model is a pre-built deep learning model for adjusting the reply text, and the enrichment processing includes at least: correcting grammatical errors and replacing sensitive words; outputting the target reply text, and ending the customer service conversation when the target business needs are met.
[0111] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the program steps of the customer service dialogue method based on the Transformer model.
[0112] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0113] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0114] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0115] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0116] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0117] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0118] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A customer service dialogue method based on the Transformer model, characterized in that: Applied to a customer service dialogue system based on a Transformer model, the customer service dialogue system includes: a Transformer model and a natural language processing model, and the customer service dialogue method includes: Input the question text into the Transformer model, use the Transformer model to perform machine learning, simulate the customer service's language habits and dialogue strategies, and obtain the predicted reply text, wherein the Transformer model is trained using the target historical dialogue text, and the question text refers to the text integrated from the consumer's questions received during the conversation between the consumer and the customer service of the financial institution; Inputting the predicted reply text into the natural language processing model, and enriching the predicted reply text by the natural language processing model to obtain a target reply text, wherein the natural language processing model is a pre-built deep learning model for adjusting the reply text, and the enrichment processing at least includes: correcting grammatical errors and replacing sensitive words; The target reply text is output, and when the target business requirement is met, the customer service conversation is ended.
2. The customer service dialogue method according to claim 1, characterized in that: The target historical conversation text acquisition strategy includes: acquiring multiple groups of historical conversation texts and corresponding scores from a data lake, and taking the historical conversation texts with scores greater than a target threshold as the target historical conversation texts, wherein the data lake is a pre-built data platform for storing conversation texts and scores, and the historical conversation texts include: question texts and reply texts.
3. The customer service dialogue method according to claim 1, characterized in that: The steps of training the Transformer model using the target historical dialogue text include: Performing word segmentation processing on the target historical conversation text to convert each sentence of the target historical conversation text into a word sequence, wherein the word segmentation processing refers to splitting a single sentence into multiple words; Representing each word in the word sequence as a word vector, assigning a position encoding vector to each word vector, and adding the position encoding vector to the corresponding word vector to obtain a word sequence matrix; Initializing the Transformer model, wherein the Transformer model includes: an encoder and a decoder; The word sequence matrix is used to train the initialized Transformer model.
4. The customer service dialogue method according to claim 3, characterized in that: The step of training the initialized Transformer model using the word sequence matrix comprises: Input the word sequence matrix into the encoder and output the encoding information matrix, wherein the encoder includes a plurality of encoder blocks, each of which includes: a self-attention mechanism layer and a forward feedback network layer; Input the encoding information matrix into the decoder, and output a prediction sequence matrix, wherein the decoder includes a plurality of decoder blocks, each of which includes: a masked self-attention mechanism layer, an encoder-decoder attention layer, and a forward feedback network layer, wherein the masked self-attention mechanism layer is used to ensure that the data information after the current position of the sequence data cannot be accessed when the decoder processes the sequence data, and the encoder-decoder attention layer is used to capture the dependency relationship between the output sequence of the encoder and the output sequence of the masked self-attention mechanism layer; The loss function value is calculated based on the prediction sequence matrix, the model parameters of the Transformer model are updated based on the loss function value, and the training of the Transformer model is terminated when the preset target conditions are met.
5. The customer service dialogue method according to claim 1, characterized in that: The step of enriching the predicted reply text with the natural language processing model comprises: Get access to the natural language processing model interface; Generate a text processing request, and send the text processing request to the natural language processing model interface based on the access permission, wherein the text processing request includes: the predicted reply text, respond to the text processing request through the natural language processing model, enrich the predicted reply text, and obtain the target reply text; Receive the target reply text returned by the natural language processing model.
6. The customer service dialogue method according to claim 1, characterized in that: Before you end a customer service conversation, include: The score of the target reply text is obtained, and when the score is greater than a target threshold, the target reply text and the score are stored in the data lake.
7. The customer service dialogue method according to claim 1, characterized in that: After you finish a customer service conversation, include: Obtaining a business demand completion rate, and when the business demand completion rate is not greater than a preset threshold, updating the Transformer model using a gradient descent strategy, The gradient descent strategy includes: calculating the gradient value of the loss function based on the output sequence of the Transformer model, and updating the model parameters of the Transformer model based on a preset learning rate and the gradient value of the loss function; iteratively updating the model parameters of the Transformer model, and stopping the update of the Transformer model when the convergence condition is reached; After the Transformer model is updated, the new Transformer model is used in the next round of customer service dialogue.
8. A customer service dialogue device based on a Transformer model, characterized in that: Applied to a customer service dialogue system based on a Transformer model, the customer service dialogue system includes: a Transformer model and a natural language processing model, including: A prediction unit, used to input the question text into a Transformer model, use the Transformer model to perform machine learning, simulate the customer service's language habits and dialogue strategies, and obtain a predicted reply text, wherein the Transformer model is trained using the target historical dialogue text, and the question text refers to the text integrated from the consumer's questions received during the conversation between the consumer and the customer service of the financial institution; an enrichment unit, configured to input the predicted reply text into the natural language processing model, and the natural language processing model performs enrichment processing on the predicted reply text to obtain a target reply text, wherein the natural language processing model is a pre-built deep learning model for adjusting the reply text, and the enrichment processing at least includes: correcting grammatical errors and replacing sensitive words; The output unit is used to output the target reply text and end the customer service dialogue when the target business requirements are met.
9. An electronic device, characterized in that: include: A memory storing an executable program; A processor is used to run the program, wherein the program, when running, executes the customer service dialogue method based on the Transformer model described in any one of claims 1 to 7.
10. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by the processor, the steps of the customer service dialogue method based on the Transformer model described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Session control method, system and equipment based on thread-level authorization lease and medium
CN122160355A