Text processing method and device, electronic equipment, computer readable storage medium and computer program product
By performing feature extraction and text enhancement processing on the dialogue between agents and customers, and combining it with a vector database to generate recommended text, the problem of poor recommendation accuracy and high maintenance difficulty in the existing technology is solved, and more efficient and professional real-time recommendations are achieved.
Patent Information
- Application Number
- CN202410389659.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-01
- Publication Date
- 2024-10-11
AI Technical Summary
The existing technology is difficult to effectively utilize customer attributes and emotional tendencies in agent-assisted text recommendation, resulting in poor recommendation accuracy, high difficulty in text library maintenance, and poor real-time performance.
By extracting features from the received text recommendation requests, construct text enhancement prompt information, and generate recommended text based on the characteristics of the corpus to be recommended, using the vector database to reduce the 'illusion' of generated content, automatically obtaining excellent corpus from historical conversations, and reducing the difficulty of maintenance. .
It improves the accuracy and efficiency of recommended texts, reduces the difficulty of text library maintenance, and achieves more professional real-time recommendations.
Smart Images

Figure CN118760733A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a text processing method, device, electronic device, computer-readable storage medium, and computer program product. Background Art
[0002] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0003] In the work scenario of human agents, in order to improve the efficiency and professional performance of agents, they often recommend words to agents in real time during the communication process with customers, so as to assist agents in communicating with customers more efficiently. Agent assistance has become one of the key capabilities of each call center. In related technologies, words are usually recommended based on the conversation between customers and agents. Such recommended words often ignore the customer's own attribute characteristics, intentions, emotional tendencies and other information, resulting in poor accuracy of the recommended words. Summary of the invention
[0004] The embodiments of the present application provide a text processing method, device, electronic device, computer-readable storage medium, and computer program product, which can improve the accuracy of generated recommended texts.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application provides a text processing method, the method comprising:
[0007] In response to the received text recommendation request, performing feature extraction processing on the corpus to be recommended to obtain features of the corpus to be recommended;
[0008] Based on the features of the corpus to be recommended, construct text enhancement prompt information corresponding to the corpus to be recommended;
[0009] The text enhancement prompt information is subjected to feature extraction processing to obtain text enhancement prompt features, and based on the text enhancement prompt features and the features of the corpus to be recommended, a recommended text corresponding to the corpus to be recommended is generated.
[0010] The present application provides a text processing device, including:
[0011] A feature extraction module is used to perform feature extraction processing on the corpus to be recommended in response to the received text recommendation request to obtain features of the corpus to be recommended;
[0012] A feature enhancement module, used to construct text enhancement prompt information corresponding to the corpus to be recommended based on the features of the corpus to be recommended;
[0013] The text recommendation module is used to perform feature extraction processing on the text enhancement prompt information to obtain text enhancement prompt features, and generate a recommended text corresponding to the corpus to be recommended based on the text enhancement prompt features and the features of the corpus to be recommended.
[0014] In the above scheme, in response to the received text recommendation request, before performing feature extraction processing on the recommended corpus, the agent text processing device also includes a request acquisition module, which is used to obtain the conversation text between the agent and the customer; perform pause recognition processing on the customer text of the first round in the conversation text to obtain a pause recognition result; when the pause recognition result indicates that the first round of conversation has not ended, perform keyword extraction processing on the conversation text to obtain the first keyword of the conversation text; when the first keyword is different from the second keyword, trigger the text recommendation request, and use the agent text of the second round and the customer text of the first round in the conversation text as the corpus to be recommended.
[0015] In the above scheme, the feature enhancement module is also used to query the customer semantic features of the corpus to be recommended in the text semantic knowledge base based on the features of the corpus to be recommended; obtain the initial text prompt information corresponding to the features of the corpus to be recommended, and the additional text prompt information corresponding to the customer semantic features; perform information fusion processing on the initial text prompt information and the additional text prompt information to obtain the text enhancement prompt information corresponding to the corpus to be recommended.
[0016] In the above scheme, the text recommendation module is also used to perform feature fusion processing on the text enhancement prompt feature and the feature of the corpus to be recommended to obtain a recommended fusion feature; perform feature transformation processing on the recommended fusion feature to obtain a recommended transformation feature; perform mapping processing on the recommended transformation feature to obtain a recommended text corresponding to the corpus to be recommended.
[0017] In the above scheme, if the corpus to be recommended includes the seat text of the second round and the customer text of the first round, after generating the recommended text of the corpus to be recommended, the seat text processing device also includes a corpus generation module, which is used to obtain the actual seat text of the first round and the customer text of the third round; based on the seat text of the second round, the customer text of the first round, the actual seat text of the first round, and the customer text of the third round, the recommended text is scored to obtain the recommendation score corresponding to the recommended text; based on the seat text of the second round, the customer text of the first round, the recommended text and the recommendation score, the corpus to be evaluated is generated.
[0018] In the above scheme, the corpus generation module is also used to perform text similarity matching on the recommended text and the actual agent text of the first round to obtain a first similarity value; perform text similarity matching on the customer text of the first round and the customer text of the third round to obtain a second similarity value; perform sensitivity detection on the recommended text and the customer text of the third round respectively to obtain a first sensitivity and a second sensitivity; and obtain a recommendation score corresponding to the recommended text based on the first similarity value, the second similarity value, the first sensitivity and the second sensitivity.
[0019] In the above scheme, the corpus generation module is also used to extract corpus data of a first structure from the set of corpuses to be evaluated, the corpus data of the first structure including the corpus to be evaluated; clustering the corpus data of the first structure to obtain corpus data of multiple categories, and the number of corpus data of each category is multiple; obtaining the recommendation score of the corpus data of each category, and averaging the recommendation score of the corpus data of each category to obtain the average recommendation score of the corpus data of each category; and obtaining an evaluation corpus sequence based on the average recommendation score and the corpus data of the multiple categories.
[0020] In the above scheme, the agent auxiliary text model also includes a score estimation module, which is used to perform the following processing on each evaluation corpus in the evaluation corpus sequence: perform feature extraction processing on the evaluation corpus to obtain evaluation corpus features, and perform feature extraction on the text enhancement prompt information corresponding to the evaluation corpus to obtain evaluation enhancement prompt features; perform feature fusion processing on the evaluation enhancement prompt features and the evaluation corpus features to obtain evaluation fusion features; perform feature transformation processing on the evaluation fusion features to obtain evaluation transformation features; perform linear transformation processing on the evaluation transformation features to obtain an estimated score corresponding to the evaluation corpus.
[0021] The present application also provides a method for training an agent assistance model, the method comprising:
[0022] Splitting the agent conversation sample into corpus to obtain corpus data of a second structure of the agent conversation sample;
[0023] Performing structural processing on the corpus data of the second structure to obtain corpus data of a third structure;
[0024] Divide the corpus data of the third structure into a data set to obtain a test set and a training set;
[0025] Based on the test set and the training set, the initial agent assistance model is trained to obtain an agent assistance model, wherein the agent assistance model is used to generate a recommended text corresponding to the corpus to be recommended based on the features of the corpus to be recommended and the text enhancement prompt features corresponding to the corpus to be recommended.
[0026] The present application embodiment provides a seat text processing device, including:
[0027] A memory for storing computer executable instructions;
[0028] The processor is used to implement the method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0029] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the agent text processing method provided in the embodiment of the present application when executed by a processor.
[0030] An embodiment of the present application provides a computer program product, including a computer program or a computer executable instruction. When the computer program or the computer executable instruction is executed by a processor, the agent text processing method provided in the embodiment of the present application is implemented.
[0031] The embodiments of the present application have the following beneficial effects:
[0032] By applying the embodiments of the present application, when a text recommendation request is received, in response to the text recommendation request, feature extraction processing is performed on the corpus to be recommended to obtain features of the corpus to be recommended; based on the features of the corpus to be recommended, text enhancement prompt information corresponding to the corpus to be recommended is constructed, feature extraction processing is performed on the text enhancement prompt information to obtain text enhancement prompt features, and combined with the features of the corpus to be recommended, a recommended text corresponding to the corpus to be recommended is generated; since the text enhancement prompt information is used to describe the suggestions corresponding to the recommended text generated for the corpus to be recommended, when the recommended text is generated based on the text enhancement prompt features of the text enhancement prompt information, the generated recommended text can meet the suggestions indicated by the text enhancement prompt information, thereby improving the accuracy of the generated recommended text. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a structural diagram of the text processing system architecture provided by an embodiment of the present application;
[0034] Figure 2 is a schematic diagram of the structure of an electronic device for generating a recommendation text provided in an embodiment of the present application;
[0035] Figure 3A-3D It is a flowchart of a text processing method provided in an embodiment of the present application;
[0036] Figure 4 It is a flowchart of a training method for an agent assistance model provided in an embodiment of the present application;
[0037] Figure 5A It is a schematic diagram of generating the corpus to be evaluated provided in the embodiment of the present application;
[0038] Figure 5B It is a schematic diagram of generating a corpus sequence to be evaluated provided in an embodiment of the present application;
[0039] Figure 6 It is an application flow chart of the agent speech processing method provided in the embodiment of the present application;
[0040] Figure 7 It is an application flow chart of the agent speech processing method provided in the embodiment of the present application;
[0041] Figure 8 It is a schematic diagram of the architecture of the agent speech processing system provided in an embodiment of the present application;
[0042] Fig. 9 It is a supervised training flow chart of the agent-assisted speech model provided in the embodiment of the present application;
[0043] Fig.10 It is an application flow chart of the agent speech processing method provided in the embodiment of the present application;
[0044] Fig.11 It is a flowchart of automatic scoring and RLHF training provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0046] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0047] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0049] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0050] 1) Machine Learning (ML): It is a multi-disciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance.
[0051] 2) Large Language Model (LLM) refers to a computer model that can process and generate natural language; it represents a major advance in the field of artificial intelligence and is expected to change the field through acquired knowledge. LLM can predict the next word or sentence by learning the statistical laws and semantic information of language data. As the input data set and parameter space continue to expand, the ability of LLM will also increase accordingly. It is used in a variety of application fields, such as robotics, machine learning, machine translation, speech recognition, image processing, etc., so it is called a multimodal large language model.
[0052] 3) Scalable Fine-Tuning (SFT) is a technique used in natural language processing that fine-tunes a pre-trained language model to adapt it to a specific task. The main idea is to fine-tune the model for a specific task based on a large pre-trained model. During the fine-tuning process, the model will adjust the parameters and structure of the model according to the characteristics of the task to improve the performance of the model on the task. The advantage is that it can be quickly fine-tuned for different tasks without retraining the entire model.
[0053] 4) Reinforcement Learning with Human Feedback (RLHF) is an extension of reinforcement learning that incorporates human feedback into the training process, providing machines with a natural, humane, interactive learning process. In addition to reward signals, RLHF agents receive feedback from humans to learn with a broader perspective and higher efficiency, similar to the way humans learn from the expertise of another person. By building a bridge between agents and humans, RLHF allows humans to directly guide machines and allows machines to master decision-making elements that are clearly embedded in human experience. As an effective alignment technique, RLHF can help mitigate harmful content generated by large language models (LLMs) and improve information integrity to a certain extent.
[0054] 5) Artificial Intelligence (AI): It is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Artificial intelligence technology is an interdisciplinary subject that covers a wide range of fields, including both hardware-level technology and software-level technology. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies.
[0055] 6) Reward Model (RM) is an important part of RLHF. It is based on the SFT post-model or a smaller base model and is trained using a dataset that collects human preference ratings. The reward model takes prompt+answer as input and gives a reward value that matches human preferences. This reward value is very important for RLHF.
[0056] 7) Prompt Tuning: A type of learning method in machine learning: without significantly changing the structure and parameters of the pre-trained language model, the model's performance can be greatly improved by adding "prompt information" to the input as an information enhancement. It can be seen as an instruction for the task and also as a reuse of the pre-training goal. Its essence can be seen as an enhancement of parameter validity training, by generating prompt templates separately and then fine-tuning and evaluating them on each task.
[0057] 8) CVP technology stack, a technology stack that combines a large model (such as chatGPT) + vector database (vector database) + prompt, provides an additional knowledge base based on a vector database for the large model, helping the large model to generate content with less "illusions" and making the content more professional and up-to-date.
[0058] During the implementation of the embodiments of the present application, the applicant discovered the following problems in the related art: In the related art, to achieve accurate agent-assisted text recommendations, it is necessary to maintain a powerful and excellent text library, rely on the natural language understanding model to semantically identify and classify the customer's spoken text, and then match the corresponding recommended text. Maintaining a text library is a complex task, requiring multiple experienced field professionals to select, write or evaluate texts, and then edit and enter them into the text library. The high difficulty of maintaining the text library also leads to low efficiency in iterative upgrades. In addition, most of the existing technologies start recommending after the customer has finished a complete sentence, so the real-time performance is poor. When the recommended text is displayed, the agent may have already answered the customer.
[0059] To this end, the embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for processing agent text. When a text recommendation request is received, in response to the text recommendation request, feature extraction processing is performed on the corpus to be recommended to obtain features of the corpus to be recommended; based on the features of the corpus to be recommended, text enhancement prompt information corresponding to the corpus to be recommended is constructed, feature extraction processing is performed on the text enhancement prompt information to obtain text enhancement prompt features, and combined with the features of the corpus to be recommended, a recommended text corresponding to the corpus to be recommended is generated; since the text enhancement prompt information is used to describe the suggestions corresponding to the recommended text generated for the corpus to be recommended, when the recommended text is generated based on the text enhancement prompt features of the text enhancement prompt information, the generated recommended text can meet the suggestions indicated by the text enhancement prompt information, and the recommendation accuracy and efficiency of the recommended text can be improved on the basis of reducing the difficulty of text maintenance. The following is an exemplary application of the agent text processing system provided by the embodiments of the present application.
[0060] See also Figure 1 , Figure 1It is a schematic diagram of the architecture of the agent text processing system 100 provided in an embodiment of the present application. The terminal (terminal 400 is shown as an example) is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0061] The terminal 400 is used for the user to use the client 410 to display the recommendation text on the graphical interface 410-1 (graphical interface 410-1 is shown as an example). The terminal 400 and the server 200 are connected to each other via a wired or wireless network.
[0062] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart TV, a smart watch, a car terminal, etc., but is not limited thereto. The electronic device provided in the embodiment of the present application may be implemented as a terminal or as a server. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present application.
[0063] In some embodiments, the server 200 receives a text recommendation request triggered from the terminal 400, obtains the corpus to be recommended, performs feature extraction processing on the corpus to be recommended to obtain features of the corpus to be recommended, and based on the features of the corpus to be recommended, constructs text enhancement prompt information corresponding to the corpus to be recommended, and performs feature extraction processing on the text enhancement prompt information to obtain text enhancement prompt features, and based on the text enhancement prompt features and the features of the corpus to be recommended, generates a recommended text corresponding to the corpus to be recommended, sends the recommended text to the terminal 400, and the terminal 400 displays the recommended text.
[0064] In other embodiments, the terminal 400 receives a text recommendation request and obtains the corpus to be recommended, performs feature extraction processing on the corpus to be recommended to obtain features of the corpus to be recommended, and based on the features of the corpus to be recommended, constructs text enhancement prompt information corresponding to the corpus to be recommended, and performs feature extraction processing on the text enhancement prompt information to obtain text enhancement prompt features, and based on the text enhancement prompt features and the features of the corpus to be recommended, generates a recommended text corresponding to the corpus to be recommended, and the terminal 400 displays the recommended text.
[0065] In other embodiments, the embodiments of the present application can be implemented with the aid of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.
[0066] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources.
[0067] See also Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device 500 for generating a recommendation text provided in an embodiment of the present application, wherein: Figure 2 The electronic device 500 shown may be Figure 1 The server 200 or the terminal 400 in Figure 2 The electronic device 500 shown includes: at least one processor 410, a memory 450, and at least one network interface 420. The various components in the electronic device 500 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 2 Various buses are labeled as bus system 440 .
[0068] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0069] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0070] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0071] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0072] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0073] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0074] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).
[0075] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);
[0076] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.
[0077] In some embodiments, the text processing device provided in the embodiments of the present application can be implemented in software. Figure 2 The text processing device 455 stored in the memory 450 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: a feature extraction module 4551, a feature enhancement module 4552, and a text recommendation module 4553. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.
[0078] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the text processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (Application Specific Integrated Circuit, ASIC), digital signal processors (Digital Signal Processor, DSP), programmable logic devices (Programmable Logic Device, PLD), complex programmable logic devices (Complex Programmable Logic Device, CPLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other electronic components.
[0079] In some embodiments, the terminal or server can implement the text processing method provided in the embodiment of the present application by running a computer program or a computer executable instruction. For example, the computer program can be a native program (e.g., a dedicated text processing program) or a software module in the operating system, for example, a text processing module that can be embedded in any program (such as an instant messaging client, an album program, an electronic map client, a navigation client); for example, it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run. In short, the above-mentioned computer program can be any form of application, module or plug-in.
[0080] The text processing method provided by the embodiment of the present application will be described in conjunction with the exemplary application and implementation of the server 200 provided by the embodiment of the present application. Figure 3A , Figure 3A : is a flowchart of a text processing method provided in an embodiment of the present application, the method comprising:
[0081] In step 101, in response to a received text recommendation request, feature extraction processing is performed on the corpus to be recommended to obtain features of the corpus to be recommended.
[0082] The text recommendation request is used to request agent text recommendation or agent speech recommendation for the recommended corpus. The recommended corpus includes customer text and agent text. In practical applications, in order to ensure that the recommended text (i.e., recommended speech) is more in line with the actual situation, the recommended corpus includes not only customer text but also agent text.
[0083] As an example, the corpus to be recommended may be "Agent text: Hello, is this Ms. Zhang Li? Customer text: Yes". In this example, if the corpus to be recommended only includes the customer text, it is impossible to clearly identify the current scenario for recommending the sales pitch, and thus it is impossible to give the correct recommended sales pitch. However, when the corpus to be recommended includes both the agent text and the customer text, it can be clearly identified that the current conversation between the agent and the customer has just concluded the identity confirmation phase, and when recommending sales pitches, the agent can be recommended to proceed to the next phase.
[0084] In some embodiments, see Figure 3B , Figure 3B is a flowchart of a text processing method provided in an embodiment of the present application. Before step 101, Figure 3B Steps 104 to 107 shown trigger a text recommendation request and determine the corpus to be recommended:
[0085] In step 104, the conversation text between the agent and the customer is obtained.
[0086] In actual applications, the method of obtaining the conversation text between the agent and the customer is different depending on the different conversation methods between the agent and the customer. For example, when the agent has a text conversation with the customer, the conversation text can be directly obtained, and when the agent has a voice conversation with the customer, the conversation text can be obtained by converting the voice conversation message into text. The embodiment of the present application does not limit the method of obtaining the conversation text between the agent and the customer.
[0087] In step 105, pause recognition processing is performed on the first round of customer text in the conversation text to obtain a pause recognition result.
[0088] In actual applications, when an agent has a text conversation with a customer, pause recognition processing can be performed on the customer text of the first round (i.e., the current round) in the conversation text. For example, semantic analysis can be performed on the customer text through a third-party semantic analysis model, and the semantic analysis result can be used as a pause recognition result to determine whether the user has finished a complete sentence. When the semantic analysis result represents that the semantics of the customer text is clear, it can be determined that the customer text has no pauses (i.e., it is a complete sentence); when the semantic analysis result represents that the semantics of the customer text is unclear, it can be determined that there are pauses in the customer text (i.e., it is not a complete sentence).
[0089] When an agent has a voice conversation with a customer, the agent can perform pause recognition on the first round of customer text by determining whether there is silence when the customer is speaking, or insert sentence break markers into the conversation text while converting the voice message to text, and then perform pause recognition on the first round of customer text.
[0090] In step 106, when the pause recognition result indicates that the first round of dialogue has not ended, keyword extraction processing is performed on the dialogue text to obtain the first keyword of the dialogue text.
[0091] Here, if after pause recognition processing is performed on the first round of customer text, it is found that there is no pause in the first round of customer text, that is, it is considered that the pause recognition result indicates that the first round of customer conversation has not ended. At this time, in order to improve the real-time performance of text recommendation, the text recommendation request can be triggered in advance by performing keyword extraction processing on the conversation text when the target customer has not finished speaking.
[0092] In step 107, when the first keyword is different from the second keyword, a text recommendation request is triggered, and the agent text of the second round and the customer text of the first round in the conversation text are used as corpus to be recommended.
[0093] Among them, when the first keyword is extracted from the conversation text and the first keyword is different from the second keyword when the text recommendation request was triggered last time, the text recommendation request is triggered, and the agent text of the second round (i.e., the previous round of the current round) and the customer text of the first round in the conversation text are used as corpus to be recommended.
[0094] Here, when the text recommendation request is triggered by the first keyword, the first keyword is cached so that it can be compared with the keyword when it is extracted next time. In actual applications, when the pause recognition result indicates that the first round of the customer's conversation has not ended, after the first keyword is extracted and the text recommendation request is triggered for the first time, the next keyword matching is performed after a preset time interval (such as 100 milliseconds). If the first keyword hit in this round is different from the second keyword that triggered the text recommendation request last time, the text recommendation request is triggered again, the first keyword is cached, and the agent text of the second round and the customer text of the first round in the conversation text are determined as the corpus to be recommended. It can be understood that the customer text of the first round as the corpus to be recommended is different from the customer text when the text recommendation request was triggered last time.
[0095] As an example, the second round of agent text may be "OK, where are the departure and destination of your trip?", and the first round of customer text is "I am departing from Beijing...", wherein the ellipsis in the customer text indicates that the first round of conversation with the customer has not ended. At this time, the first keyword "departing from Beijing" is extracted from the conversation text, the first keyword is cached, and the second round of agent text and the first round of customer text are used as corpus to be recommended; after a preset time interval, the first round of customer text becomes "I want to book a..." from Beijing, at this time the keyword extracted from the conversation text is still "departing from Beijing", so the text recommendation request will not be triggered; after another preset time interval, the first round of customer text becomes "I want to book a..." from Beijing to Shanghai, at this time the keyword extracted from the conversation text is "to Shanghai", because it is different from the keyword when the text recommendation request was triggered last time, the text recommendation request will be triggered, the keyword this time will be cached, and the second round of agent text in the conversation text and the updated customer text of the first round will be determined as corpus to be recommended.
[0096] In practical applications, unsupervised keyword algorithms such as term frequency-inverse documentfrequency (TF-IDF) and linear discriminant dimensionality reduction algorithm (LDA) can be used to extract high-frequency keywords from historical conversation records and store them in a keyword database. When extracting keywords, the conversation text is segmented and then compared with the keywords in the keyword library, and the matching words are used as keywords.
[0097] After step 106, if the pause recognition result indicates that the first round of conversation has ended, first check whether a text recommendation request has been made within a preset time interval (such as the above 100 milliseconds) in the past of this round. If a text recommendation request has been made within the preset time interval in the past of this round, then the recommended text recommended by the text recommendation request made within the preset time interval in the past of this round is directly presented as the recommended text recommended by the text recommendation request in the present round, and no further recommendation is required. If no text recommendation request has been made within the preset time interval in the past of this round, then the agent text of the second round in the conversation text and the customer text of the first round are obtained as the corpus to be recommended in order to perform text recommendation.
[0098] In practical applications, feature extraction processing of the corpus to be recommended refers to the process of vectorizing the corpus to be recommended to obtain the features of the corpus to be recommended. The features of the corpus to be recommended are the vector form of the corpus to be recommended.
[0099] In step 102, text enhancement prompt information corresponding to the corpus to be recommended is constructed based on the features of the corpus to be recommended.
[0100] The text enhancement prompt information is used to describe the suggestions corresponding to the recommended text generated for the corpus to be recommended.
[0101] In some embodiments, the text enhancement prompt information corresponding to the corpus to be recommended can be obtained in the following manner: based on the features of the corpus to be recommended, the customer semantic features of the corpus to be recommended are queried in the text semantic knowledge base; the initial text prompt information corresponding to the features of the corpus to be recommended and the additional text prompt information corresponding to the customer semantic features are obtained; the initial text prompt information and the additional text prompt information are subjected to information fusion processing to obtain the text enhancement prompt information corresponding to the corpus to be recommended.
[0102] Here, the text semantic knowledge base can be a vector database, which is used to store reference customer semantic features corresponding to excellent dialogue texts and additional text prompt information corresponding to the reference customer semantic features, wherein the excellent dialogue texts are screened from historical dialogue text records based on preset excellent text rules. For example, in a dialogue communication scenario where an agent urges a customer to repay a credit card, dialogue texts that receive positive feedback such as repayments from customers and positive customer reviews after communication are regarded as excellent dialogue texts. After obtaining the excellent dialogue texts, feature extraction processing (i.e., vectorization conversion) is performed on the customer texts in the excellent dialogue texts to obtain corresponding reference customer semantic features, and the obtained reference customer semantic features are stored in the text semantic knowledge base.
[0103] In practical applications, after the corpus to be recommended is vectorized in step 101 to obtain the features of the corpus to be recommended in vector form, a similarity query is performed in the text semantic knowledge base in step 102, such as performing similarity matching between the features of the corpus to be recommended and the reference customer semantic features in the text semantic knowledge base, and the reference customer semantic features that match the features of the corpus to be recommended, such as the reference customer semantic features whose similarity values with the features of the corpus to be recommended exceed the similarity threshold, are used as the customer semantic features corresponding to the corpus to be recommended, wherein the similarity threshold can be set according to actual needs, such as 90%.
[0104] Among them, customer semantic features are used to indicate customer attribute information (such as the customer's name, age, gender, region, account age, credit score, whether the customer is the real person, etc.) and customer conversation intention (used to indicate the customer's attitude or emotional polarity in the conversation, such as in a conversation communication scenario where the agent urges the customer to repay the credit card, whether the customer is willing to repay on time, and if the customer does not repay on time, how long the repayment period will take, etc.).
[0105] After obtaining the features of the corpus to be recommended, the corresponding initial text prompt information can be obtained. The so-called initial text prompt information is a recommended reply recommended based on the meaning of the features of the corpus to be recommended. After determining the semantic features of the reference customer that match the features of the corpus to be recommended, additional text prompt information corresponding to the semantic features of the reference customer can be obtained from the text semantic knowledge base as the additional text prompt information corresponding to the corpus to be recommended. For example, if the customer semantic features represent that the customer in the corpus to be recommended is not the owner of the credit card that the agent is urging to repay, the additional text prompt information may be a text recommendation reply that suggests not involving sensitive information such as the repayment amount and repayment period; if the customer semantic features represent that the customer in the corpus to be recommended is unwilling to repay on time and has a bad attitude, the additional text prompt information may be a text recommendation reply that suggests using the "Regulations on the Administration of Credit Reporting for Dishonest Persons" for the customer.
[0106] After the initial text prompt information and the additional text prompt information are determined, the two can be fused to obtain text enhancement prompt information corresponding to the corpus to be recommended, which helps to improve the accuracy of the recommended text.
[0107] In step 103, feature extraction processing is performed on the text enhancement prompt information to obtain text enhancement prompt features, and based on the text enhancement prompt features and the features of the corpus to be recommended, a recommended text corresponding to the corpus to be recommended is generated.
[0108] The recommended text satisfies the suggestion corresponding to the recommended text for generating the to-be-recommended corpus described in the text enhancement prompt information.
[0109] In some embodiments, see Figure 3C , Figure 3C is a flowchart of a text processing method provided in an embodiment of the present application, Figure 3A Step 103 in Figure 3C Steps 1031 to 1033 are shown to achieve:
[0110] In step 1031, feature fusion processing is performed on the text enhancement prompt feature and the feature of the corpus to be recommended to obtain a recommendation fusion feature.
[0111] Here, after obtaining the text enhancement prompt feature, the text enhancement prompt feature is fused with the feature of the corpus to be recommended, such as concatenating and cascading the feature matrices or fusing the feature matrices. This application does not limit the specific method of feature fusion.
[0112] In step 1032, feature transformation processing is performed on the recommended fusion features to obtain recommended transformed features.
[0113] Here, after obtaining the recommended fusion features, classification is performed based on the recommended fusion features, and feature transformation processing is performed to obtain recommended transformation features.
[0114] In step 1033, mapping processing is performed on the recommended transformation features to obtain the recommended text corresponding to the corpus to be recommended.
[0115] Here, after obtaining the recommended transformation features, the recommended transformation features are mapped to obtain the recommended text corresponding to the corpus to be recommended.
[0116] In practical applications, see Figure 3D , Figure 3D is a flowchart of a text processing method provided in an embodiment of the present application, Figure 3A Step 103 in Figure 3D Steps 1041 to 1044 are shown to achieve:
[0117] Step 1041: Acquire an agent assistance model, wherein the agent assistance model includes a fusion layer, a fully connected layer, and a mapping layer.
[0118] In step 1042, the text enhancement prompt feature and the feature of the corpus to be recommended are fused through a fusion layer to obtain a recommended fusion feature;
[0119] In practical applications, after obtaining the text enhancement prompt features, the text enhancement prompt features are fused with the features of the corpus to be recommended through a fusion layer, such as concatenating feature matrices or fusing feature matrices. This application does not limit the specific method of feature fusion.
[0120] In step 1043, feature transformation processing is performed on the recommended fusion features through the fully connected layer to obtain recommended transformed features.
[0121] In practical applications, after obtaining the recommended fusion features, classification is performed based on the recommended fusion features through the fully connected layer, and feature transformation processing is performed to obtain recommended transformation features.
[0122] In step 1044, the recommended transformation features are mapped through the mapping layer to obtain the recommended text corresponding to the corpus to be recommended.
[0123] In practical applications, after obtaining the recommended transformation features, the recommended transformation features are mapped through a mapping layer to obtain the recommended text corresponding to the corpus to be recommended.
[0124] Next, the training process of the agent assistance model is described. Figure 4 , Figure 4: is a flow chart of the training method of the seat assistance model provided in the embodiment of the present application. The seat assistance model can be obtained in the following manner:
[0125] In step 201, the agent conversation sample is subjected to corpus splitting to obtain corpus data of a second structure of the agent conversation sample.
[0126] In practical applications, the agent conversation samples are first split into corpus data of the first structure according to a certain corpus text structure, such as corpus data in the form of ACA (i.e., corpus data of the second structure), where ACA is the abbreviation of agent text (agent)-customer text (customer)-agent text (agent), and its specific meaning is: agent text of the second round-customer text of the first round-agent text of the first round.
[0127] As an example, a sample of an agent conversation may be "Agent: Hello, is this Ms. Zhang Li? Customer: Yes; Agent: I am your account manager at XX Company, calling to remind you that you need to repay your loan today, don't forget; Customer: OK, but I'm a bit short of money recently; Agent: Oh, then you can ask your friends for help first, after all, if you are overdue, it will affect your credit; Customer: OK, then I'll think of a way. Agent: Okay, I will check your repayment again this afternoon, so that you don't forget, bye". Here, the above agent conversation sample can be split into the following three sentences of ACA-formatted corpus text:
[0128] 1. A: Hello, is this Ms. Zhang Li? C: Yes. A: I am your account manager at XX Company. I am calling to remind you that you need to repay your loan today. Don’t forget it.
[0129] 2. A: I am your account manager at XX Company. I am calling to remind you that you need to repay your loan today. Don’t forget it. C: Okay, but I am a bit short of money recently. A: I see. Then you can ask your friends to help you out. After all, if you are overdue, it will affect your credit.
[0130] 3. A: I see. Then you can ask your friends to help you out. After all, if you are overdue, it will affect your credit. C: OK, I will think of a way. A: OK, I will check your repayment again this afternoon so that you don't forget. Goodbye.
[0131] In actual applications, there may be scenarios where the conversation is initiated by the customer. Therefore, when the agent conversation samples are split to obtain corpus text in ACA format, the agent text of the second round may be empty.
[0132] As an example, the split ACA corpus can be "A: NULL; C: Hello, I want to book a ticket; A: OK, sir. Where is your departure place?"
[0133] In step 202, the corpus data of the second structure is structured to obtain corpus data of a third structure corresponding to the corpus data of the first structure.
[0134] Following the above description, after obtaining the above three sentences of ACA format corpus text, it is necessary to convert it into the third structure corpus data required by the supervision room fine-tuning model, that is, to convert it into the prompt+answer structure corpus data. Here, prompt is A+C and answer is the second A.
[0135] The first sentence of ACA-format text corpus can be structured as "prompt: A: Hello, are you Ms. Zhang Li? C: Yes; answer: I am your account manager at XX company, calling to remind you that you need to repay your loan today, don’t forget."
[0136] In practical applications, after obtaining the corpus data of the third structure, in order to ensure the quality of the data used for training, the data quality can be manually checked. For details, please refer to the following methods: First, cluster prompt and answer, and prompt the user to check the standard sentences and their quantity distribution after clustering. Here, users can be supported to adjust the number of clusters and re-cluster, so as to help users check the coverage of sample data scenarios before training to avoid overfitting and poor model effect; secondly, quantify the length of data text, including the average length, maximum length, minimum length, proportion of data exceeding 4K, total data volume, etc. of prompt+answer, to help users decide whether it is suitable for the current base model to achieve better model effect.
[0137] In step 203, the corpus data of the third structure is divided into a data set to obtain a test set and a training set.
[0138] In actual applications, the server automatically extracts various types of data according to the preset ratio and clusters to obtain the test set used as the data for testing the model, and the remaining data is used as the training set for training the model. It can be seen that the amount of data required for training the model is greater than the amount of data required for the test model. Here, the test set can account for 5% of the total data, and the remaining 95% of the data will be used as the training set.
[0139] In step 204, supervised training is performed on the initial agent assistance model based on the test set and the training set to obtain an agent assistance model.
[0140] Here, the agent assistance model can be obtained based on any type of initial agent assistance model (that is, a pre-trained basic model) and a supervised learning algorithm. In practical applications, there are many optional initial agent assistance models and supervised learning algorithms. The following takes ChatGLM-6B as the initial agent assistance model and the low-rank adaptation of large language models (LoRA) as the supervised learning algorithm as an example to describe in detail a method for obtaining an agent assistance model provided in an embodiment of the present application.
[0141] Before training, users can set some key hyperparameters required for training, or they can directly train according to the default hyperparameters. In practical applications, the default values of hyperparameters can be related to the amount of data in the training set. For example, for the number of training cycles (Epoch), if the amount of data in the training set is lower than a certain threshold, it is considered that the training samples are small. At this time, the default Epoch needs to be set larger to ensure that the model fully converges. During the training process, all parameters of the original ChatGLM-6B are frozen, and an additional network layer is added to it, and the parameters of the network layer are trained with the data of the above training set. After the training is completed, the trained model is tested with the above test set to obtain the training results.
[0142] Next, taking the example that the structure of the initial agent assistance model is the same as that of the trained agent assistance model, that is, the initial agent assistance model includes a fusion layer, a fully connected layer and a mapping layer, the supervised training of the initial agent assistance model is explained. For the training of the initial agent assistance model, the training set is used to train multiple structural layers in the initial agent assistance model layer by layer. In the layer-by-layer training process, the parameters of other structural layers can be fixed first, and the training structural layers can be trained. For example, the parameters of the fusion layer and the fully connected layer in the initial agent assistance model can be fixed, and the mapping layer in the initial agent assistance model can be trained. The initial agent assistance model after the mapping layer training is determined as the final agent assistance model, thereby effectively saving the training cost of the agent assistance model and effectively improving the training efficiency of the agent assistance model. Since the generation speed of the recommended text is improved, after the training is completed, the trained model is tested by the test set to obtain the training result.
[0143] In practical applications, after obtaining the agent assistance model, the training results can also be evaluated and optimized. The evaluation scheme includes observing whether the convergence curves of Training loss and Perplexity converge obviously. If there is no obvious convergence, it means that the training is insufficient, and the epoch can be adjusted to retrain, or incremental training can be performed; or observe evaluation indicators such as Rouge and Bleu. If the evaluation indicator is worse than the training result of the previous training, it is necessary to adjust the training data, hyperparameter configuration, etc. and retrain; or when dividing the data set in step 203, the data set is divided into a test set, a training set, and an evaluation set, and the trained agent assistance model is used to generate a recommendation text based on the prompt of the evaluation set, and the generated recommendation text is compared with the answer of the evaluation set for similarity, and the comparison result is displayed to the user. The user can directly observe the generated result, or manually mark whether it meets expectations to comprehensively evaluate whether it meets expectations. Evaluate the quality of model training; or with the help of a third-party online demonstration or experimental neural network platform (such as playground), the user can observe whether the pre-released new model generates content that meets expectations by inputting prompts on the playground interface. In the playground's supervisor test mode, not only can professional prompts similar to the evaluation set be tested, but also tests can be performed based on the model's general generation capabilities to check its general capability attenuation, etc. This application does not specifically limit the evaluation and optimization methods of the model. It should be noted that the evaluation of training results is an optional step. In actual applications, the user can set a time threshold. If the time without retraining exceeds the threshold time, the evaluation result is recognized by default and the model is automatically released.
[0144] In some embodiments, before performing corpus splitting on the agent conversation sample to obtain corpus data of at least one first structure corresponding to the agent conversation sample, the agent conversation sample can be obtained in the following manner: setting customer group division rules and the definition of excellent texts; and automatically obtaining excellent conversation texts corresponding to multiple customer groups from historical conversation records according to the customer group division rules and the definition of excellent texts.
[0145] In actual applications, the same question requires different recommended answer texts based on customer differences, such as gender, age, and field of study. Therefore, different types of agent assistance models can be used to recommend texts for customers with different attributes. To this end, when obtaining agent conversation samples for training agent assistance models, customers are stratified and grouped by pre-setting customer group division rules, and samples are extracted from each type of customer to train the agent assistance model.
[0146] In some embodiments, when the corpus to be recommended includes the agent texts of the second round and the customer texts of the first round, see Figure 5A , Figure 5A is a schematic diagram of generating the corpus to be evaluated provided in the embodiment of the present application. After step 103, the Figure 5A The steps shown generate the corpus to be evaluated for optimizing the trained agent assistance model: In step 301A, the actual agent text of the first round of agents and the customer text of the third round of customers are obtained.
[0147] Among them, the actual agent text of the first round is the text that the agent actually answered based on the recommended text corresponding to the generated corpus to be recommended, and the customer text of the third round (the next round of the current round) is the text that the customer answered based on the actual agent text of the first round.
[0148] Similarly, depending on the different conversation methods between the agent and the customer, the methods of obtaining the actual agent text of the first round and the customer text of the third round are also different. For example, when the agent has a text conversation with the customer, the conversation text can be directly obtained, and when the agent has a voice conversation with the customer, the conversation text can be obtained by converting the voice conversation message into text. The embodiment of the present application does not limit the method of obtaining the conversation text between the agent and the customer.
[0149] In step 302A, the recommended text is scored based on the second round of agent texts, the first round of customer texts, the first round of actual agent texts, and the third round of customer texts to obtain a recommendation score corresponding to the recommended text.
[0150] In actual applications, when a text request is triggered by identifying keywords in a conversation text, there may be multiple text recommendations for the same sentence. Here, the text recommended by the last text recommendation is used as the recommended text for scoring; if multiple recommended texts are given in one text recommendation, each recommended text will be scored separately as the recommended text.
[0151] In some embodiments, the recommendation score corresponding to the recommended text can be obtained in the following manner: perform text similarity matching on the recommended text and the actual agent text of the first round to obtain a first similarity value; perform text similarity matching on the customer text of the first round and the customer text of the third round to obtain a second similarity value; perform sensitivity detection on the recommended text and the customer text of the third round respectively to obtain a first sensitivity and a second sensitivity; based on the first similarity value, the second similarity value, the first sensitivity and the second sensitivity, obtain the recommendation score corresponding to the recommended text.
[0152] In practical applications, in order to obtain text corpora that are more conducive to obtaining recommendation scores, the conversation records can be split into multiple text corpora in the form of ACA` and AC, where ACA` represents the second round of agent text-first round of customer text-recommended text, and AC represents the first round of actual agent text-third round of customer text.
[0153] As an example, here is a complete conversation record between an agent and a customer:
[0154] Agent: Hello, is this Ms. Zhang Li? Customer: Yes. Recommendation 1: I’m calling to remind you that today is your due date. Please make the repayment before 6pm. Recommendation 2: I’m calling to remind you that your debt is due today. Please make sure to repay it today, okay? Agent: I’m your account manager at XX Company. I’m calling to remind you that you need to repay today. Don’t forget. Customer: Okay, but I’m a bit tight on money recently. Recommendation 3: Okay sir, but since overdue payments will affect your credit, I suggest you ask your friends and family for help. Agent: I see, then you can ask your friends for help first. After all, if you are overdue, it will affect your credit. Customer: Okay, then I’ll think of a way. Recommendation 4: Okay, thank you for your cooperation. I will verify your repayment status in the afternoon. I wish you a happy life. Goodbye. Agent: Okay, I will check your repayment again in the afternoon so that you don’t forget. Goodbye.
[0155] The above conversation record can be split into the following 4 ACA`AC data:
[0156] ①A: Hello, is this Ms. Zhang Li? C: Yes. A`: I am calling to remind you that today is your repayment day. Please make the repayment before 6 pm. A: I am your account manager at XX Company. I am calling to remind you that you need to repay today. Don't forget it. C: OK, but I am a little short of money recently.
[0157] ②A: Hello, is this Ms. Zhang Li? C: Yes. A`: I am calling to remind you that your debt is due today. Please make sure to pay it back today, okay? A: I am your account manager at XX Company. I am calling to remind you that you need to pay it back today. Don't forget it. C: Okay, but I am a little short of money recently.
[0158] ③A: I am your account manager at XX Company. I am calling to remind you that you need to repay today. Don’t forget it. C: OK, but I am a bit short of money recently. A`: OK sir, but since overdue payment will affect your credit, I suggest you ask your friends and family for help. A: So, then you can ask your friends for help first. After all, if you are overdue, it will affect your credit. C: OK, then I will think of a way.
[0159] ④A: I see. Then you can ask your friends to help you first. After all, if you are overdue, it will affect your credit. C: OK, I will think of a way. A`: OK, thank you for your cooperation. I will check your repayment in the afternoon. I wish you a happy life. Goodbye. C: OK, I will check your repayment again in the afternoon so that you don’t forget. Goodbye.
[0160] In actual applications, the first similarity value can be used to determine whether the agent has adopted the recommended text. The higher the first similarity, the closer the agent's actual reply is to the recommended text. When the first similarity reaches the preset threshold, the recommended text is determined to be adopted. The second similarity can be used to determine whether the agent's reply can answer the customer's question. When the third round of customer text repeats the first round of customer text, it is considered that the agent's reply fails to answer the customer's question, so the user needs to ask again. When the second similarity reaches the preset threshold, it is determined that the agent's reply fails to answer the customer's question.
[0161] In addition, by setting up a violation model, sensitive words can be identified for the recommended text and the third round of customer texts. This model is an independent text classification model. After the violation type and violation corpus of the scene are stored and trained, it is judged by violation intention identification. If it is hit, it means "text is sensitive". When the first sensitivity is high, it may mean that the recommended text contains industry sensitive words or violation items that reduce the professionalism of the seat; when the second sensitivity is high, it may mean that the third round of customer text contains negative content such as insults.
[0162] The following is an automatic scoring rule as an example: a 5-point system is used, where 5 points means that the recommended text is adopted by the agent and the customer texts in the third round have no repetitions and no sensitive words; 4 points means that the recommended text is adopted by the agent and the customer texts in the third round have repetitions but no sensitive words; 3 points means that the recommended text is not adopted by the agent and the recommended text itself has no sensitive words; 2 points means that the recommended text is adopted by the agent and the customer texts in the third round have sensitive words but the recommended text itself has no sensitive words; 1 point means that the recommended text is adopted by the agent and the customer texts in the third round have sensitive words and the recommended text itself has sensitive words; 0 points means that the recommended text is not adopted and the recommended text itself has sensitive words.
[0163] In step 303A, a corpus to be evaluated is generated based on the agent texts of the second round, the customer texts of the first round, the recommendation texts and the recommendation scores.
[0164] In practical applications, after obtaining the recommendation score of each recommended text, the ACA`-R` corpus can be obtained based on the above-mentioned ACA` corpus and the recommendation score of the recommended text of the current sentence, which represents the second round of agent text-the first round of customer text-recommended text-recommended text recommendation score.
[0165] The corpus to be evaluated is used to train the reward model, and combined with the trained reward model, the agent-assisted text model is optimized using human feedback reinforcement learning, so that the optimized agent-assisted text model can be used to generate recommended texts.
[0166] In some embodiments, see Figure 5B , Figure 5B is a schematic diagram of generating a corpus sequence to be evaluated provided in an embodiment of the present application, which can be obtained by Figure 5B The steps shown generate the evaluation corpus for training the reward model:
[0167] In step 301B, corpus data of a first structure is extracted from the set of corpus to be evaluated, and the corpus data of the first structure includes the corpus to be evaluated.
[0168] In practical applications, all ACA`-R` corpora are extracted from the ACA`-R` corpus obtained above for subsequent training of the reward model.
[0169] In step 302B, clustering processing is performed on the corpus data of the first structure to obtain corpus data of multiple categories, and the number of corpus data of each category is multiple.
[0170] In practical applications, all ACA`-R` corpus data in the dataset are extracted, and ACs are clustered to classify the same or similar ACs into the same category.
[0171] In step 303B, the recommendation score of each category of corpus data is obtained, and the recommendation score of each category of corpus data is averaged to obtain the average recommendation score of each category of corpus data.
[0172] In practical applications, the scores (R`) of the recommended texts (A`) corresponding to each AC in a category of AC are weighted averaged to obtain the average score.
[0173] In step 304, a corpus sequence to be evaluated is obtained according to the average recommendation score and corpus data of multiple categories.
[0174] For example, based on the average recommendation score of the corpus data of each category, the corpus data of multiple categories are sorted in descending order to obtain an evaluation corpus sequence, so as to train a reward model based on the evaluation corpus sequence.
[0175] In some embodiments, the following processing can be performed on each evaluation corpus in the evaluation corpus sequence in the following manner: perform feature extraction processing on the evaluation corpus to obtain evaluation corpus features, and perform feature extraction on the text enhancement prompt information corresponding to the evaluation corpus to obtain evaluation enhancement prompt features; perform feature fusion processing on the evaluation enhancement prompt features and the evaluation corpus features to obtain evaluation fusion features; perform feature transformation processing on the evaluation fusion features to obtain evaluation transformation features; perform linear transformation processing on the evaluation transformation features to obtain an estimated score corresponding to the evaluation corpus, construct a loss function based on the estimated score and the average recommendation score corresponding to the evaluation corpus, update the agent assistance model based on the loss function, and use the updated agent assistance model as the reward model.
[0176] In practical applications, the average scores are sorted from high to low to obtain the ranking value of A` generated by each type of AC, expressed as ACA`-R; secondly, the corpus with more than 9 A`s corresponding to AC is selected, that is, at least 9 answers with different rankings are collected for each similar question, as the RLHF dataset for training the reward model in this period. Optionally, due to different training algorithms, the RLHF dataset structure selection is also different, and the number of 9 is not necessarily used. For example, if it is a triple {prompt, chosen, rejected}, only the higher and lower 2 data are needed. For example, taking the generation of Jsonl format as an example, the format of a single data in the dataset is as follows: {"prompt":"AC","response":[[1st order A`],[2nd order A`],[3rd order A`],[4th order A`],[5th order A`],[6th order A`],[7th order A`],[8th order A`],[9th order A`]]}.
[0177] After obtaining the evaluation corpus sequence, the latest version of the agent assistance model is used as the base model (that is, the latest version of the agent assistance model obtained through supervised training before), and the reward model is trained using the above data set. An optional training method is: on the agent assistance model, remove the last mapping layer (such as softmax) and add a linear transformation layer with a dimension of (hidden_dim, 1), such as performing the following processing on each evaluation corpus in the evaluation corpus sequence: extract the evaluation corpus features to obtain the evaluation corpus features, and enhance the text prompts corresponding to the evaluation corpus The information is extracted to obtain the evaluation enhancement prompt feature; the evaluation enhancement prompt feature and the evaluation corpus feature are fused through the fusion layer to obtain the evaluation fusion feature; the evaluation fusion feature is transformed through the fully connected layer to obtain the evaluation transformation feature; the evaluation transformation feature is linearly transformed through the linear transformation layer to obtain the estimated score corresponding to the evaluation corpus; the model input is "prompt+answer(A-C+A)", and the output latent variable is mapped to a score. During training, the loss function aims to make the higher-scoring answer as large as possible than the lower-scoring answer.
[0178] After constructing the loss function based on the estimated score and the average recommendation score corresponding to the evaluation corpus, the value of the loss function is judged whether it exceeds the preset threshold value. When the value of the loss function exceeds the preset threshold value, the error signal of the base model (i.e., the model after the adjustment of the latest version of the agent assistance model) is determined based on the loss function, and the error signal is back-propagated in the base model, and the model parameters of each layer are updated during the propagation process. Here, the back propagation is explained, and the feature sequence of the training sample is input into the input layer of the neural network model, through the hidden layer, and finally reaches the output layer and outputs the result. This is the forward propagation process of the neural network model. Since there is an error between the output result of the neural network model and the actual result, the error between the output result and the actual value is calculated, and the error is back-propagated from the output layer to the hidden layer until it is propagated to the input layer. In the back propagation process, the value of the model parameter is adjusted according to the error; the above process is continuously iterated until convergence, wherein the base model belongs to the neural network model.
[0179] Through the above-mentioned method, when a text recommendation request for requesting agent text recommendation for a corpus to be recommended is received, in response to the text recommendation request, feature extraction processing is performed on the corpus to be recommended to obtain features of the corpus to be recommended; based on the features of the corpus to be recommended, text enhancement prompt information corresponding to the corpus to be recommended is constructed, feature extraction processing is performed on the text enhancement prompt information to obtain text enhancement prompt features, and combined with the features of the corpus to be recommended, a recommended text corresponding to the corpus to be recommended is generated; since the text enhancement prompt information is used to describe the suggestions corresponding to the recommended text generated for the corpus to be recommended, when the recommended text is generated based on the text enhancement prompt features of the text enhancement prompt information, the generated recommended text can meet the suggestions indicated by the text enhancement prompt information, thereby improving the accuracy of the generated recommended text.
[0180] The following is an example application of the embodiment of the present application in an actual text processing application scenario. In the manual agent work scenario, in order to improve the agent's work efficiency and professional performance, the agent is often provided with recommended speech (i.e., the above-mentioned recommended text) in real time during the communication between the agent and the customer, to assist the agent in communicating with the customer more efficiently. Agent assistance has become one of the key capabilities of each call center.
[0181] In the traditional way, to achieve accurate agent-assisted script recommendation, it is necessary to manually select, write or evaluate FAQ-style (that is, question+answer format, providing corresponding answers to customer questions) script materials to maintain a powerful and excellent script library. In addition to making the script library difficult to maintain and highly subjective, FAQ-style corpus has process limitations and cannot recommend scripts without the customer asking a question. In addition, most existing technologies recommend scripts only after the customer has finished speaking a complete sentence, so the real-time performance of script recommendation is poor. For example, see Figure 6 , Figure 6 It is an application flow chart of the agent speech processing method provided in the embodiment of the present application. In the related technology, after the agent answers the call, the conversation between the customer and the agent is translated into text in real time, and it is determined whether the customer has finished a complete sentence. When the user has finished a sentence, the recommended speech is obtained. Specifically, the intent is identified and matched through the speech library maintained based on the above method, the recommended speech is obtained and displayed, and then this process is repeated until the call ends.
[0182] In view of the above problems, the embodiment of the present application realizes speech recommendation by adopting the CVP technology stack architecture (i.e., large language model + vector technology stack + prompt-as-code). Figure 7 , Figure 7: is an application flow chart of the agent speech processing method provided in an embodiment of the present application, wherein, when training a large language model (that is, the agent auxiliary model of the present application), the agent text of the second round and the customer text of this round (that is, the first round) are used as prompts of the large language model, and the agent text of this round is used as the answer, so as to provide a sample of adaptive structure for the training of the large language model. The model trained with such samples no longer has process limitations when applied; and, in the process of model training, only the customer group division rules and the definition of excellent speech need to be manually set, and the subsequent model will automatically obtain the excellent speech materials of the corresponding customer group from the historical conversation records, and train the agent auxiliary models corresponding to different customer groups respectively, thereby reducing the maintenance difficulty; and, in judging whether the customer has When a complete sentence is spoken, the customer's sentence text can be matched with keywords. When the keywords are hit, a speech recommendation request (i.e., the text recommendation request mentioned above) is triggered to improve the efficiency of speech recommendation. In addition, before taking the conversation content (the agent text of the second round of the current conversation and the customer text of this round) as the recommended corpus to obtain the recommended speech from the agent-assisted model, the speech enhancement prompt information corresponding to the recommended corpus is constructed based on the trained vector database (i.e., the text enhancement prompt information mentioned above), so as to reduce the "hallucination" phenomenon of content generated by large models and make the generated content more professional. Finally, after the end of this conversation, by comparing the recommended speech with the adoption of the agent, the agent-assisted model is automatically fed back and iterated based on the violation model, which further reduces the difficulty of maintaining the speech library.
[0183] Combine the following Figure 8 The implementation method of the agent speech processing method provided in the embodiment of the present application is specifically described. Figure 8 Schematic diagram of the architecture of the agent speech processing system provided in the embodiment of the present application. Figure 8 As shown, the agent speech processing system includes: a large model self-training platform part, an excellent speech library part and a call center part. The following describes the specific modules included in each part and the function of each module.
[0184] First, for the large model self-training platform part, the customer group model setting module it contains is used for users to create customer groups and set customer group division rules and recording extraction rules corresponding to customer attributes, so that the recording library management module can extract excellent recordings based on this. In addition, after the subsequent agent auxiliary model training is completed, the customer group model setting module is also used to put the trained model online; for the recording library management module, in addition to being used to extract excellent recordings according to the above-mentioned customer group division rules and recording extraction rules, it is also used to translate the obtained excellent recordings into text and split them into ACA form corpus required for model SFT training; for the SFT data set management module, it is used to receive the ACA form corpus split by the recording library management module and store it in the SFT data set, and is also used to save the SFT data set for each SFT training and mark it with a version number. The module is used to perform corpus analysis on the SFT dataset and output the excellent speech obtained from the analysis to the excellent speech library part, so that it can be vectorized and stored in the vector speech library module; the auxiliary model management module is used to train and save the agent auxiliary model based on the SFT dataset, and it is also used to provide corresponding agent recommendation speech (i.e. the recommended text mentioned above) based on the corpus to be recommended when the AI speech agent service module calls the agent auxiliary model; the RLHF dataset management module is used to receive and store the RLHF dataset obtained by the evaluation corpus module of the excellent speech library part, and cluster and sort it to obtain an updated RLHF dataset, and it is also used to perform corpus analysis on the RLHF dataset and output the excellent speech obtained from the analysis to the excellent speech library part, so that it can be vectorized and stored in the vector speech library module; the reward model management module is used to train and iterate the reward model based on the RLHF dataset.
[0185] Secondly, for the excellent speech library part, the relational speech library module it includes is used to vectorize the excellent speech screened by professional speech personnel or input from the large model self-training platform part, and transmit the vectorized data to the vector speech library module; in addition to being used to save the excellent vectorized speech, the vector speech library module is also used to perform similarity queries when called by the AI speech agent service module, and enhance the characteristics of the corpus to be recommended; the violation model module is used to train and save the violation model, and it is also used to score the corpus obtained by splitting after the call before training the agent assistance model RLHF to obtain the RLHF data set; the AI speech agent service module is used to respond to the speech recommendation request, call the vector speech library module and the agent assistance model to obtain the agent recommended speech; the evaluation corpus module is used to obtain the call recording after the call ends, and after translating it into text form, split it into AC-A' and AC form corpus required for subsequent RLHF training, and save it as the RLHF data set; the keyword library module is used to save the keyword library called by the speech assistance SDK backend module.
[0186] Finally, for the call center part, the agent workbench module is used to select the agent assistance model suitable for the customer before the agent talks to the customer, and obtain the call voice during the call; the Media Resource Control Protocol (MRCP) service module and the Automatic Speech Recognition (ASR) service module are used to perform real-time translation of the current call; the speech assistance software development kit (SDK) module is divided into the speech assistance SDK front-end module and the speech assistance SDK back-end module, among which the speech assistance SDK back-end module is used to identify whether the customer pauses when speaking and to recognize keywords in the customer's text; the speech assistance SDK front-end module is used to display the agent's recommended speech.
[0187] Next, combine Figure 8 and Fig. 9 , explain the training method of the agent assistance model, Fig. 9 This is a flowchart of the supervised training of the agent assistance model provided in the embodiment of the present application:
[0188] First, users can set customer group division rules corresponding to customer attributes based on the customer group model setting module of the large model self-training platform to stratify and group customers. Among them, customer attributes can be name, age, gender, region, registration time, credit score, etc. By setting corresponding customer group division rules for customer attributes, each customer group can represent a target customer group or set multiple target customer groups at the same time. Then, users can set recording extraction rules through the customer group model setting module, such as setting recording attributes (such as duration, rounds) and business indicators (such as whether the payment is received after communication, whether the purchase is made after communication, whether there is a complaint, good or bad reviews, etc.) to filter out the target recording range that needs to be extracted. Then, according to the customer group division rules and recording extraction rules, excellent conversation texts are automatically obtained.
[0189] In actual applications, the recording library management module automatically selects the conversation recordings between agents and customers that meet the rules from historical data and translates them into text to obtain excellent conversation texts. When translating the text, the extracted conversation recordings are translated into text by third-party software while distinguishing the voices of the agents and customers to obtain the conversation texts with time series between agents and customers, as shown in the following example:
[0190] Agent: Hello, is this Ms. Zhang Li? Customer: Yes. Agent: I am your account manager at XX Company. I am calling to remind you that you need to repay your loan today. Don’t forget. Customer: OK, but I am a bit short of money recently. Agent: Oh, then you can ask your friends for help. After all, if you are overdue, it will affect your credit. Customer: OK, I will think of a way. Agent: OK, I will check your repayment again this afternoon so that you don’t forget. Goodbye.
[0191] Then, in order to realize the recommendation of knowledge speech and process speech, the corpus splitting module splits the agent conversation samples into corpus text structure data in the form of ACA (that is, the corpus data of the first structure mentioned above), the specific meaning of which is: the agent text of the second round - the customer text of the first round - the agent text of the first round.
[0192] Continuing from the above example, the above agent conversation sample can be split into the following three sentences of ACA text:
[0193] 1. A: Hello, is this Ms. Zhang Li? C: Yes. A: I am your account manager at XX Company. I am calling to remind you that you need to repay your loan today. Don’t forget it.
[0194] 2. A: I am your account manager at XX Company. I am calling to remind you that you need to repay your loan today. Don’t forget it. C: Okay, but I am a bit short of money recently. A: I see. Then you can ask your friends to help you out. After all, if you are overdue, it will affect your credit.
[0195] 3. A: I see. Then you can ask your friends to help you out. After all, if you are overdue, it will affect your credit. C: OK, I will think of a way. A: OK, I will check your repayment again this afternoon so that you don't forget. Goodbye.
[0196] In actual applications, there may be scenarios where the conversation is initiated by the customer. Therefore, when the agent conversation sample is split into ACA format corpus text, the agent text of the second round may be empty. As an example, the split ACA corpus can be "A: NULL; C: Hello, I want to book a ticket; A: OK, sir. Where is your departure place?"
[0197] After the ACA corpus is split by the recording library management module, the SFT dataset management module stores the complete excellent conversation text and the split ACA corpus into the dataset, and marks the version number for the dataset. In actual applications, there may be a need for training rollback. The difficulty of training rollback is reduced by marking the version number of the dataset used for training. After the SFT dataset management module stores the SFT dataset in the form of ACA corpus, the auxiliary model management module divides the ACA dataset corresponding to the customer group according to the customer group, and trains the base model through supervised fine-tuning to obtain the seat auxiliary model suitable for each customer group. Among them, the base model is a pre-trained basic model, such as chatGLM, Du Xiaoman Xuanyuan large model, etc.
[0198] In practical applications, the ACA corpus is first converted into structured data required for training, that is, corpus data of prompt (instruction) + answer structure (that is, the corpus data of the second structure mentioned above), where prompt is A+C and answer is the second A; Optionally, after the training data is structured, the data quality can be checked. The specific method can be: clustering prompt and answer, prompting the user to check the standard sentences and their quantity distribution after clustering, and supporting the adjustment of the number of clusters and re-clustering, so as to help users check the sample before training. This data scenario covers the situation, avoids overfitting and poor model effect, and quantifies the length of the data text, including the average length of prompt+answer, maximum length, minimum length, proportion of data exceeding 4K, total data volume, etc., to help users decide whether it is suitable for the current base model to achieve better model effect; secondly, divide the data set into test sets and training sets, such as automatically extracting 5% of each type of data as a test set according to clustering, and the remaining 95% as a training set; then, train the base model based on the training set, such as using the Low-Rank Adaptation of Large Language Models (LoRA) algorithm for supervised training, which freezes all parameters of the basic model, adds additional network layers to the model, and only trains the parameters of these newly added network layers.It relies on a small amount of sample data and focuses on the general ability training of the base model. Then, the trained model is evaluated and optimized, such as by observing whether the convergence curves of Trainingloss and Perplexity converge obviously. If there is no obvious convergence, it means that the training is insufficient, and the epoch can be adjusted to retrain, or incremental training can be performed. Or observe evaluation indicators such as Rouge and Bleu. If the evaluation indicators are worse than the training results of the previous training, it is necessary to adjust the training data, hyperparameter configuration, etc. and retrain. Or when dividing the data set in step 203, divide the data set into a test set, a training set, and an evaluation set, and use the trained agent auxiliary model to generate agent recommendation words based on the prompt of the evaluation set, and compare the similarity between the generated agent recommendation words and the answer of the evaluation set. The comparison results are displayed to the user. The user can directly observe the generated results or manually mark whether they meet expectations to comprehensively evaluate the quality of model training. Alternatively, the user can use a third-party online demonstration and experimental neural network platform (such as playground) to observe whether the pre-released new model generates content that meets expectations by inputting prompts on the playground interface. In the playground's supervisor test mode, not only can professional prompts similar to the evaluation set be tested, but also the general generation capability of the model can be tested to check the attenuation of its general capability. Finally, the model trained based on the data set is marked with a version number and released online. In actual applications, the current version can be taken offline and a historical version can be selected to be released online as needed.
[0199] Specifically, the SFT model generated by each supervised training is marked as Vx.0, where x represents the version number of the SFT model iteration (the major version number). The SFT model will subsequently be used as a base model for reinforcement learning training, and it will be marked in the form of Vx.yz, where y represents the iterative version of reinforcement learning (the minor version number, i.e., the version number of each iteration after the reinforcement learning updates the training set in the following text), and z represents the revised version number of multiple retrainings when the training set remains unchanged during reinforcement learning iterations.
[0200] In actual applications, users can adjust the time range of customer group recordings, re-extract recordings, conduct new version supervised learning training, and upgrade to version x of Vx.0. This means that each supervised learning training is destructive and will ignore the scored and sorted training data that flowed back on the previous supervised learning training version. The purpose of this is to solve the "timeliness" problem. For example, in the asset management industry, some words were not illegal in the past, but are currently illegal, so the training data from the previous time needs to be discarded.
[0201] In addition, after storing the SFT dataset in the form of ACA corpus, the SFT dataset management module can be used to perform corpus analysis on the dataset. The specific method is to sort the ACA corpus according to its length and the number of clusters, and display it to the user to help the user identify "high-quality" ACA dialogues. The user can choose to have these high-quality corpora vectorized by the vector speech library module and stored in the vector database.
[0202] Next, we will explain the process of applying real-time speech assistance in actual conversations. Fig.10 , Fig.10 It is an application flow chart of the agent speech processing method provided in the embodiment of the present application.
[0203] First, the conversation text between the agent and the customer is periodically obtained.
[0204] In actual applications, when the agent workstation module establishes a call and completes the initialization of each module, the voice stream transmitted through the Real-time Transport Protocol (RTP) is sent to the ASR-related server through a third-party translation software (such as FreeSWITCH), generally interacting once every 10ms, so as to obtain the text corresponding to the voice in real time. At the same time, the back-end module of the speech assistance SDK performs pause recognition processing on the customer's first round of customer text in the conversation text to determine whether the pause recognition result indicates that the customer's first round of conversation has not ended.
[0205] In the process of translating the conversation text, third-party software can be used to determine whether the customer has finished speaking. For example, the silence detection module of FS can make a silence judgment on the customer's voice stream and identify whether the customer has paused in speaking according to the rules. Of course, it is also possible to directly connect to the third-party ASR service that includes the MRCP server to obtain real-time text and sentence segmentation identification. In real-time calls, the implementation architecture is slightly different due to the different third-party components relied on, and this application does not limit this.
[0206] When the pause recognition result indicates that the first round of conversation with the customer has not ended, the back-end module of the speech assistance SDK performs keyword extraction processing on the conversation text to determine whether the target keyword extracted from the conversation text is different from the keyword when the speech recommendation request was triggered last time.
[0207] When the customer has not finished speaking in the first round, in order to ensure the efficiency of the recommended speech, the customer's sentence content is matched with keywords based on the keyword library. When a keyword is hit, the keyword is used as the target keyword and a speech recommendation request is triggered.
[0208] When the speech recommendation request is triggered by the target keyword, the target keyword is cached so that it can be compared with the cached target keyword the next time the keyword is extracted. In actual applications, when the pause recognition result indicates that the first round of the customer's conversation has not ended, after the target keyword is extracted for the first time and the speech recommendation request is triggered, the next keyword matching is performed after a preset time interval (such as 100 milliseconds). If the target keyword hit in this round is different from the keyword that triggered the speech recommendation request last time, the speech recommendation request is triggered again, the target keyword is cached, and the agent text of the second round of the agent in the conversation text and the updated customer text of the first round of the customer are determined as the corpus to be recommended.
[0209] As an example, the second round of agent text may be "OK, where are the departure and destination of your trip?", and the first round of customer text is "I am departing from Beijing...", where the ellipsis in the customer text indicates that the first round of conversation with the customer has not ended. At this time, the target keyword "departing from Beijing" is extracted from the conversation text, the target keyword is cached, and the second round of agent text and the first round of customer text are used as corpus to be recommended; after a preset time interval, the first round of customer text becomes "I want to book a...", at this time, the target keyword extracted from the conversation text is still "departing from Beijing", so the speech recommendation request will not be triggered; after another preset time interval, the first round of customer text becomes "I want to book a to Shanghai from Beijing...", at this time, the target keyword extracted from the conversation text is "to Shanghai", because it is different from the keyword when the speech recommendation request was triggered last time, the speech recommendation request will be triggered, the target keyword this time will be cached, and the agent text of the second round of the agent in the conversation text and the updated customer text of the first round of the customer will be determined as the corpus to be recommended.
[0210] In practical applications, unsupervised keyword algorithms (such as TF-IDF, LDA, etc.) can be used to extract customers' high-frequency keywords from historical conversation records and store them in a keyword database. When extracting keywords, the conversation text is segmented and then compared with the keywords in the keyword database, and the matching words are used as target keywords.
[0211] If the pause recognition result indicates that the first round of conversation with the customer has ended, a text recommendation request is directly triggered, and a check is made as to whether a speech recommendation request has been made within the preset time interval (such as the 100 milliseconds mentioned above) in the past of this round. If a speech recommendation request has been made within the preset time interval in the past of this round, the recommended speech obtained by the speech recommendation request that existed within the preset time interval in the past of this round is directly presented as the recommendation for this sentence, and no further recommendation is required. If no speech recommendation request has been made within the preset time interval in the past of this round, the agent text of the second round in the conversation text and the customer text of the first round in the conversation text are taken as the corpus to be recommended, and speech recommendation is performed.
[0212] In actual applications, the speech recommendation request is called by the AI speech proxy service module to call the speech assistance model module and make speech recommendations. Before calling the model, a similarity query can be first performed based on the corpus to be recommended from the vector database stored in the vector text library module. It can be understood that the corpus to be recommended needs to be vectorized before the query; when a result similar to the corpus to be recommended is found, the corpus to be recommended is regenerated based on the relevant knowledge, principled requirement information, and current customer basic data stored in the vector database to enhance its features. If no similar results are found, the feature enhancement is not performed based on the relevant knowledge when the corpus to be recommended is regenerated. After that, the corpus to be recommended is input into the agent assistance model, the agent recommended speech is obtained, and it is displayed on the page of the current communication agent through the speech assistance SDK front-end module, and after a period of time (such as 3 seconds), the recommendation disappears automatically.
[0213] Next, the automatic feedback scoring module is described. Fig.11 , Fig.11 It is a flowchart of automatic scoring and RLHF training provided in an embodiment of the present application.
[0214] After the call is over, the evaluation corpus module obtains the call recording and translates it into the conversation text, splitting the conversation text into corpora in the form of ACA` and AC, where ACA` represents the second round of agent text-first round of customer text-recommended text, and AC represents the first round of actual agent text-third round of customer text.
[0215] As an example, here is a complete conversation record between an agent and a customer:
[0216] Agent: Hello, is this Ms. Zhang Li? Customer: Yes. Recommendation 1: I’m calling to remind you that today is your due date. Please make the repayment before 6pm. Recommendation 2: I’m calling to remind you that your debt is due today. Please make sure to repay it today, okay? Agent: I’m your account manager at XX Company. I’m calling to remind you that you need to repay today. Don’t forget. Customer: Okay, but I’m a bit tight on money recently. Recommendation 3: Okay sir, but since overdue payments will affect your credit, I suggest you ask your friends and family for help. Agent: I see, then you can ask your friends for help first. After all, if you are overdue, it will affect your credit. Customer: Okay, then I’ll think of a way. Recommendation 4: Okay, thank you for your cooperation. I will verify your repayment status in the afternoon. I wish you a happy life. Goodbye. Agent: Okay, I will check your repayment again in the afternoon so that you don’t forget. Goodbye.
[0217] The above conversation record can be split into the following 4 ACA`AC data:
[0218] ①A: Hello, is this Ms. Zhang Li? C: Yes. A`: I am calling to remind you that today is your repayment day. Please make the repayment before 6 pm. A: I am your account manager at XX Company. I am calling to remind you that you need to repay today. Don't forget it. C: OK, but I am a little short of money recently.
[0219] ②A: Hello, is this Ms. Zhang Li? C: Yes. A`: I am calling to remind you that your debt is due today. Please make sure to pay it back today, okay? A: I am your account manager at XX Company. I am calling to remind you that you need to pay it back today. Don't forget it. C: Okay, but I am a little short of money recently.
[0220] ③A: I am your account manager at XX Company. I am calling to remind you that you need to repay today. Don’t forget it. C: OK, but I am a bit short of money recently. A`: OK sir, but since overdue payment will affect your credit, I suggest you ask your friends and family for help. A: So, then you can ask your friends for help first. After all, if you are overdue, it will affect your credit. C: OK, then I will think of a way.
[0221] ④A: I see. Then you can ask your friends to help you first. After all, if you are overdue, it will affect your credit. C: OK, I will think of a way. A`: OK, thank you for your cooperation. I will check your repayment in the afternoon. I wish you a happy life. Goodbye. C: OK, I will check your repayment again in the afternoon so that you don’t forget. Goodbye.
[0222] Then, the evaluation corpus module scores the recommended words according to the scoring rules, where the scoring rules are set by the user. The following is an optional scoring rule: a 5-point system is adopted, where 5 points means that the agent's recommended words are adopted by the agent, and the customer texts in the third round (i.e., the next round) have no repetitions and no sensitive words; 4 points means that the agent's recommended words are adopted by the agent, and the customer texts in the third round have repetitions but no sensitive words; 3 points means that the agent's recommended words are not adopted by the agent, and the agent's recommended words themselves have no sensitive words; 2 points means that the agent's recommended words are adopted by the agent, and the customer texts in the third round have sensitive words but the agent's recommended words themselves have no sensitive words; 1 point means that the agent's recommended words are adopted by the agent, the customer texts in the third round have sensitive words, and the agent's recommended words themselves have sensitive words; 0 points means that the agent's recommended words are not adopted, and the agent's recommended words themselves have sensitive words.
[0223] Among them, the agent's recommended speech can be judged by matching the text similarity between the agent's recommended speech and the agent's actual text in the first round. When the similarity reaches the preset threshold, the agent's recommended speech is considered to be adopted, otherwise, the agent's recommended speech is considered not to be adopted; the customer text in the first round of the customer and the customer text in the third round can be matched by text similarity to judge whether the customer text in the third round is repeated. When the similarity reaches the preset threshold, the customer text is considered to be repeated, otherwise, it is considered not to be repeated; the violation model can be set to identify sensitive words in the agent's recommended speech and the customer text in the third round. This model is an independent text classification model. After the violation type and violation corpus of the scene are stored and trained, it is judged by violation intention recognition. If it hits, it means "text sensitivity". When the first sensitivity is high, it may mean that the agent's recommended speech contains industry sensitive words or violation items that reduce the professionalism of the agent; when the second sensitivity is high, it may mean that the customer text in the third round of the customer contains negative content such as insults.
[0224] After obtaining the recommendation score of each agent recommendation speech, the ACA`-R` corpus can be obtained based on the above-mentioned ACA` corpus and the recommendation score of the agent recommendation speech of the current sentence, which represents the agent text of the second round - the customer text of the first round - the agent recommendation speech - the recommendation score of the agent recommendation speech, and the corpus in the form of ACA`-R` is stored in the corpus set.
[0225] The reward model management module automatically creates a new version of the reward model and the corresponding training task after the creation conditions are met, so that users can view the ongoing reward model training tasks. The creation conditions are specified by the user, such as automatically creating a reward model training task at a certain interval or automatically creating a reward model training task when the data set increment reaches a certain threshold.
[0226] Before training the reward model, the RLHF dataset management module first extracts all the ACA`-R` corpus data in the dataset, and classifies the same or similar ACs into the same category according to AC clustering. The score (R`) of the recommended words (A`) corresponding to each AC in this category is weighted averaged to get the average score, and the average score is sorted from high to low to get the ranking value of A` generated by each category of AC, expressed as ACA`-R; secondly, the corpus with more than 9 A` corresponding to AC is screened, that is, at least 9 answers with different rankings are collected for each similar question, which is used as the RLHF dataset for this period of reward model training. Optionally, due to different training algorithms, the RLHF dataset structure selection is also different, and the number of 9 is not necessarily used. For example, if it is a triplet {prompt, chosen, rejected}, only the higher and lower 2 data need to be sorted. For example, taking the generation of Jsonl format as an example, the format of a single data in the dataset is as follows: {"prompt":"AC","response":[[1st order A`],[2nd order A`],[3rd order A`],[4th order A`],[5th order A`],[6th order A`],[7th order A`],[8th order A`],[9th order A`]]}.
[0227] Take the latest version of the agent assistance model as the base model (that is, the latest version of the SFT model obtained through supervised training), and use the above data set for training to obtain the reward model. An optional training method is: on the SFT model, remove the last mapping layer (such as softmax) and add a linear transformation layer with a dimension of (hidden_dim, 1), so that the model input is "prompt+answer(A-C+A)", and the output hidden variable is mapped to a score. In the training, the purpose of the loss function is to make the higher-scoring answers as large as possible than the lower-scoring answers.
[0228] Optionally, after obtaining the updated RLHF dataset, the corpora with the highest scores can also be presented through the RLHF dataset management module, and the user can choose to vectorize these corpora and store them in the vector database.
[0229] Finally, combined with the trained reward model, the agent assistance model is optimized using human feedback reinforcement learning.
[0230] In actual applications, after the reward model training is completed, it is combined with the latest agent assistance model and uses the reward model to provide feedback to continuously adjust the model's behavior through the proximal policy optimization (PPO) reinforcement learning (RL) framework, so that the reply text generated by the auxiliary model meets our preferences. Similarly, the automatic feedback scoring module automatically creates tasks for the agent assistance model and automatically iterates and launches it after the model is trained.
[0231] Here, when the reward model training is completed, the reward model management module randomly extracts 20% of the AC data for each type of AC from the data set as the RL training set of the RL model, that is, the RL data set only needs prompt data (each AC is a prompt data); based on the default key hyperparameter configuration, a reinforcement learning training task is created, where the key hyperparameters include iteration rounds, batch size, learning rate, etc., and the user can also manually adjust them. Similarly, the user can view the training status and detailed data of the learning training task in the management interface; after the training task is created, the automatic feedback scoring module automatically starts the training, and the training set generates an answer through the RL model, and then the prompt and answer of the RL model are input into the RM model for scoring to evaluate the quality of the generated text. The goal of training the RL model is to make the generated text get the highest possible score on the RM model; after the training is completed, the corresponding Vx.y.0 version number of the agent assistance model automatically iterates the yz part, and automatically launches the latest version. Through the model evaluation module, users can view the RewardCurve curve graph generated by the system during the training process (showing the trend of the average reward score predicted by the model on the training set), and evaluate the training effect. If the evaluation is not as expected, the default hyperparameters can be adjusted based on the base model and reward model used in this version, and the hyperparameters can be adjusted. The training task can be created again for retraining. After multiple training runs, the z (revision number) in yz can be upgraded.
[0232] The following is a description of an exemplary structure of a text processing device 455 provided in an embodiment of the present application implemented as a software module. In some embodiments, Figure 2As shown, the software modules stored in the text processing device 455 of the memory 450 may include: a feature extraction module 4551, which is used to perform feature extraction processing on the corpus to be recommended in response to the received text recommendation request, so as to obtain the features of the corpus to be recommended; a feature enhancement module 4552, which is used to construct text enhancement prompt information corresponding to the corpus to be recommended based on the features of the corpus to be recommended; and a text recommendation module 4553, which is used to perform feature extraction processing on the text enhancement prompt information, so as to obtain text enhancement prompt features, and generate a recommended text corresponding to the corpus to be recommended based on the text enhancement prompt features and the features of the corpus to be recommended.
[0233] In some embodiments, in response to the received text recommendation request, before performing feature extraction processing on the recommended corpus, the agent text processing device also includes a request acquisition module for obtaining the conversation text between the agent and the customer; performing pause recognition processing on the customer text of the first round in the conversation text to obtain a pause recognition result; when the pause recognition result indicates that the first round of conversation has not ended, performing keyword extraction processing on the conversation text to obtain the first keyword of the conversation text; when the first keyword is different from the second keyword, triggering the text recommendation request, and using the agent text of the second round and the customer text of the first round in the conversation text as the corpus to be recommended.
[0234] In some embodiments, the feature enhancement module is also used to query the customer semantic features of the corpus to be recommended in the text semantic knowledge base based on the features of the corpus to be recommended; obtain the initial text prompt information corresponding to the features of the corpus to be recommended, and the additional text prompt information corresponding to the customer semantic features; perform information fusion processing on the initial text prompt information and the additional text prompt information to obtain text enhancement prompt information corresponding to the corpus to be recommended.
[0235] In some embodiments, the text recommendation module is also used to perform feature fusion processing on the text enhancement prompt feature and the feature of the corpus to be recommended to obtain a recommended fusion feature; perform feature transformation processing on the recommended fusion feature to obtain a recommended transformation feature; perform mapping processing on the recommended transformation feature to obtain a recommended text corresponding to the corpus to be recommended.
[0236] In some embodiments, if the corpus to be recommended includes the agent text of the second round and the customer text of the first round, after generating the recommended text of the corpus to be recommended, the agent text processing device also includes a corpus generation module, which is used to obtain the actual agent text of the first round and the customer text of the third round; based on the agent text of the second round, the customer text of the first round, the actual agent text of the first round, and the customer text of the third round, the recommended text is scored to obtain the recommendation score corresponding to the recommended text; based on the agent text of the second round, the customer text of the first round, the recommended text and the recommendation score, the corpus to be evaluated is generated.
[0237] In some embodiments, the corpus generation module is also used to perform text similarity matching on the recommended text and the actual agent text of the first round to obtain a first similarity value; perform text similarity matching on the customer text of the first round and the customer text of the third round to obtain a second similarity value; perform sensitivity detection on the recommended text and the customer text of the third round respectively to obtain a first sensitivity and a second sensitivity; and obtain a recommendation score corresponding to the recommended text based on the first similarity value, the second similarity value, the first sensitivity and the second sensitivity.
[0238] In some embodiments, the corpus generation module is also used to extract corpus data of a first structure from a set of corpuses to be evaluated, the corpus data of the first structure including the corpus to be evaluated; cluster the corpus data of the first structure to obtain corpus data of multiple categories, with each category having multiple corpus data; obtain recommendation scores for the corpus data of each category, and average the recommendation scores for the corpus data of each category to obtain an average recommendation score for the corpus data of each category; and obtain an evaluation corpus sequence based on the average recommendation score and the corpus data of the multiple categories.
[0239] In some embodiments, the agent-assisted text model also includes a score estimation module, which is used to perform the following processing on each evaluation corpus in the evaluation corpus sequence: perform feature extraction processing on the evaluation corpus to obtain evaluation corpus features, and perform feature extraction on the text enhancement prompt information corresponding to the evaluation corpus to obtain evaluation enhancement prompt features; perform feature fusion processing on the evaluation enhancement prompt features and the evaluation corpus features to obtain evaluation fusion features; perform feature transformation processing on the evaluation fusion features to obtain evaluation transformation features; perform linear transformation processing on the evaluation transformation features to obtain an estimated score corresponding to the evaluation corpus.
[0240] In some embodiments, the present application also provides a training device for a seat assistance model, including:
[0241] A corpus splitting module, used for performing corpus splitting on the agent conversation sample to obtain corpus data of a second structure of the agent conversation sample;
[0242] A structuring module, used for performing structural processing on the corpus data of the second structure to obtain corpus data of a third structure;
[0243] A division module, used for dividing the corpus data of the third structure into a data set to obtain a test set and a training set;
[0244] A training module is used to train the initial agent assistance model based on the test set and the training set to obtain an agent assistance model, wherein the agent assistance model is used to generate a recommended text corresponding to the corpus to be recommended based on the features of the corpus to be recommended and the text enhancement prompt features corresponding to the corpus to be recommended.
[0245] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the text processing method described in the embodiment of the present application.
[0246] The present application embodiment provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will be caused to execute the text processing method provided by the present application embodiment, for example, Figure 3A The text processing method shown.
[0247] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0248] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0249] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0250] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.
[0251] In summary, the embodiments of the present application have the following beneficial effects:
[0252] 1) Since the generated recommended text meets the suggestions given by the text enhancement prompt information, the agent text processing method provided in this application can generate the recommended text for the next process more flexibly and accurately.
[0253] 2) Text recommendation is achieved by adopting the CVP technology stack architecture (i.e., large language model + vector technology stack + prompt-as-code). Before the conversation content (the agent text of the second round of the current conversation and the customer text of this round) is used as the recommended corpus to obtain the recommended text from the agent text auxiliary model, the text enhancement prompt information corresponding to the recommended corpus is constructed based on the trained vector database, so as to reduce the "hallucination" phenomenon of content generated by the large model and make the generated content more professional.
[0254] 3) When training a large language model (that is, the agent-assisted text model of the present application), the agent text of the second round and the customer text of this round are used as prompts of the large language model, and the agent text of this round is used as the answer, so as to provide samples with adaptive structures for the training of the large language model. The model trained with such samples no longer has process limitations when applied; and in the process of model training, it is only necessary to manually set the customer group division rules and the definition of excellent texts. The subsequent model will automatically obtain the excellent text corpus of the corresponding customer group from the historical conversation records, and train the agent-assisted text models corresponding to different customer groups respectively, thereby reducing the difficulty of maintenance.
[0255] 4) After the call, by comparing the recommended text with the agent's adoption, the agent-assisted text model is automatically fed back and iterated based on the violation model, further reducing the difficulty of maintaining the text library.
[0256] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A text processing method, characterized in that: The method comprises: In response to the received text recommendation request, feature extraction is performed on the corpus to be recommended to obtain features of the corpus to be recommended; Based on the features of the corpus to be recommended, construct text enhancement prompt information of the corpus to be recommended; The text enhancement prompt information is subjected to feature extraction processing to obtain text enhancement prompt features, and based on the text enhancement prompt features and the features of the corpus to be recommended, a recommended text of the corpus to be recommended is generated.
2. The method according to claim 1, characterized in that In response to the received text recommendation request, before performing feature extraction processing on the recommended corpus, the method further includes: Get the conversation text between the agent and the customer; Performing pause recognition processing on the first round of customer text in the conversation text to obtain a pause recognition result; When the pause recognition result indicates that the first round of conversation has not ended, extracting keywords from the conversation text to obtain a first keyword of the conversation text; In the case where the first keyword is different from the second keyword, the text recommendation request is triggered, and the agent text of the second round and the customer text of the first round in the conversation text are used as the corpus to be recommended.
3. The method according to claim 1, characterized in that The step of constructing text enhancement prompt information of the corpus to be recommended based on the features of the corpus to be recommended includes: Based on the features of the corpus to be recommended, querying the customer semantic features of the corpus to be recommended in a text semantic knowledge base; Acquire initial text prompt information of the feature of the corpus to be recommended and additional text prompt information of the semantic feature of the customer; The initial text prompt information and the additional text prompt information are subjected to information fusion processing to obtain text enhancement prompt information of the corpus to be recommended.
4. The method according to claim 1, characterized in that The step of generating a recommended text of the corpus to be recommended based on the text enhancement prompt feature and the feature of the corpus to be recommended includes: Performing feature fusion processing on the text enhancement prompt feature and the feature of the corpus to be recommended to obtain a recommendation fusion feature; Performing feature transformation processing on the recommended fusion features to obtain recommended transformation features; Mapping processing is performed on the recommendation transformation features to obtain a recommended text corresponding to the corpus to be recommended.
5. The method according to claim 1, characterized in that If the corpus to be recommended includes the agent texts of the second round and the customer texts of the first round, after generating the recommended text of the corpus to be recommended, the method further includes: Obtaining the actual agent texts of the first round and the customer texts of the third round; Based on the agent texts of the second round, the customer texts of the first round, the actual agent texts of the first round, and the customer texts of the third round, the recommended texts are scored to obtain a recommendation score of the recommended text; Based on the agent texts of the second round, the customer texts of the first round, the recommendation texts and the recommendation scores, a corpus to be evaluated is generated.
6. The method according to claim 5, characterized in that Scoring the recommended text based on the second round of agent texts, the first round of customer texts, the first round of actual agent texts, and the third round of customer texts to obtain a recommendation score for the recommended text includes: Performing text similarity matching on the recommended text and the actual agent text of the first round to obtain a first similarity value; Performing text similarity matching on the first round of customer texts and the third round of customer texts to obtain a second similarity value; Performing sensitivity detection on the recommended text and the third round of customer texts respectively to obtain a first sensitivity and a second sensitivity; A recommendation score of the recommended text is obtained based on the first similarity value, the second similarity value, the first sensitivity, and the second sensitivity.
7. The method according to claim 5, characterized in that The method further comprises: Extracting corpus data of a first structure from a set of corpus to be evaluated, wherein the corpus data of the first structure includes the corpus to be evaluated; Performing clustering processing on the corpus data of the first structure to obtain corpus data of multiple categories, where the number of corpus data of each category is multiple; Obtaining the recommended score of each category of corpus data, and averaging the recommended score of each category of corpus data to obtain an average recommended score of each category of corpus data; An evaluation corpus sequence is obtained according to the average recommendation score and the corpus data of the multiple categories.
8. The method according to claim 7, characterized in that The method further comprises: The following processing is performed on each evaluation corpus in the evaluation corpus sequence: Performing feature extraction processing on the evaluation corpus to obtain evaluation corpus features, and performing feature extraction on text enhancement prompt information of the evaluation corpus to obtain evaluation enhancement prompt features; Performing feature fusion processing on the evaluation enhancement prompt feature and the evaluation corpus feature to obtain an evaluation fusion feature; Performing feature transformation processing on the evaluation fusion feature to obtain an evaluation transformation feature; Performing linear transformation processing on the evaluation transformation features to obtain an estimated score corresponding to the evaluation corpus.
9. A training method for a seat assistance model, characterized in that: The method comprises: Splitting the agent conversation sample into corpus to obtain corpus data of a second structure of the agent conversation sample; Performing structural processing on the corpus data of the second structure to obtain corpus data of a third structure; Divide the corpus data of the third structure into a data set to obtain a test set and a training set; Based on the test set and the training set, the initial agent assistance model is trained to obtain an agent assistance model; The agent assistance model is used to generate a recommended text corresponding to the corpus to be recommended based on the corpus features and text enhancement prompt features corresponding to the corpus to be recommended.
10. A text processing device, characterized in that: The device comprises: A feature extraction module is used to perform feature extraction processing on the corpus to be recommended in response to the received text recommendation request to obtain features of the corpus to be recommended; A feature enhancement module, used to construct text enhancement prompt information corresponding to the corpus to be recommended based on the features of the corpus to be recommended; The text recommendation module is used to perform feature extraction processing on the text enhancement prompt information to obtain text enhancement prompt features, and generate a recommended text for the corpus to be recommended based on the text enhancement prompt features and the features of the corpus to be recommended.
11. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions; A processor, configured to implement the method according to any one of claims 1 to 9 when executing computer executable instructions or computer programs stored in the memory.
12. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer programs are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product comprising a computer program or computer executable instructions, characterized in that: When the computer program or computer executable instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Method, device and system for processing dialogue data and storage medium
CN114911913A
Data retrieval method and system based on large language model
CN116701431A
Data-driven decision enhancement
US20230093988A1
Semantic recognition-based verbal skill recommendation method and apparatus, device, and storage medium
WO2022142006A1
Cited By
Hypergraph knowledge fused service quality dynamic analysis method
CN119151390A
