Robot training method, device and equipment, storage medium and program product
By screening the session data between different types of training samples and building diverse training samples, the problem of insufficient diversity of training samples in the existing technology is solved and the conversation performance of the robot is improved.
Patent Information
- Application Number
- CN202411879142.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-12-17
AI Technical Summary
In the prior art, when training agents or client robots, it is difficult to obtain diverse training samples, resulting in poor training results.
By determining the session data of the first robot and the second robot obtained by training of different types of training samples, the similarity of their syntax structure and semantics is calculated, so as to filter out the session data adapted to the first robot and build a diverse training sample.
Improves the diversity of training samples, enhances the adaptability and robustness of the robot, and thus improves conversational performance.
Smart Images

Figure CN119741914A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a robot training method, device, equipment, storage medium and program product. Background Art
[0002] With the popularity of machine learning models, pre-trained agent robots are often used to answer customer questions, or pre-trained customer robots are used to simulate customer conversations. In the process of training agent robots or customer robots, it is inevitable to obtain corresponding training samples. Taking the training of agent robots as an example, it is necessary to first obtain historical conversation data, identify the historical conversation data through natural language processing (NLP) technology, obtain the historical conversation data corresponding to the agent, and use the historical conversation data corresponding to the agent as training samples to train the agent robot. Summary of the invention
[0003] The embodiments of the present application provide a robot training method, device, electronic device, storage medium and program product, which improve the diversity of training samples and thus improve the performance of the trained robot.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] The present application provides a robot training method, the method comprising:
[0006] Determine first conversation data of a first robot and second conversation data of a second robot, wherein the first conversation data and the second conversation data correspond to the same conversation scenario, and the first robot and the second robot are trained using different types of training samples;
[0007] determining a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and determining a second similarity between semantics of the first session data and semantics of the second session data;
[0008] Based on the first similarity and the second similarity, filtering out third conversation data adapted to the first robot from the second conversation data;
[0009] A first training sample is constructed based on the third conversation data, and the first robot is trained based on the first training sample.
[0010] The present application embodiment provides a robot training device, comprising:
[0011] a determination module, configured to determine first session data of a first robot and second session data of a second robot, wherein the first session data and the second session data correspond to the same session scenario, and the first robot and the second robot are trained using different types of training samples;
[0012] The determination module is further configured to determine a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and to determine a second similarity between semantics of the first session data and semantics of the second session data;
[0013] a screening module, configured to screen out third session data adapted to the first robot from the second session data based on the first similarity and the second similarity;
[0014] A training module is used to construct a first training sample based on the third session data, and train the first robot based on the first training sample.
[0015] An embodiment of the present application provides an electronic device, the electronic device comprising:
[0016] A memory for storing computer executable instructions;
[0017] The processor is used to implement the robot training method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.
[0018] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the robot training method provided in the embodiment of the present application when executed by a processor.
[0019] An embodiment of the present application provides a computer program product, including computer executable instructions, which, when executed by a processor, implement the robot training method provided in the embodiment of the present application.
[0020] The embodiments of the present application have the following beneficial effects:
[0021] Determine first conversation data of a first robot and second conversation data of a second robot, the first conversation data and the second conversation data correspond to the same conversation scenario, and the first robot and the second robot are trained using different types of training samples, obtain conversation data between the robots trained using different types of training samples, and improve the diversity of the conversation data obtained, then determine a first similarity between a grammatical structure of the first conversation data and a grammatical structure of the second conversation data, and determine a second similarity between the semantics of the first conversation data and the semantics of the second conversation data, select third conversation data adapted to the first robot from the second conversation data based on the first similarity and the second similarity, construct a first training sample based on the third conversation data, and train the first robot based on the first training sample, because the first training sample is generated by robots trained using different types of training samples through conversation, therefore, the first training sample can reflect the conversation characteristics of different types of conversationalists to a certain extent, and is not limited to the conversation characteristics of conversationalists of the same type, relative to using only the conversation data of a single type of conversationalist as a training sample, using data that can reflect the conversation characteristics of multiple types of conversationalists as a training sample greatly improves the diversity of the training samples, and training the first robot based on the diverse training samples is conducive to improving the adaptability and robustness of the first robot, that is, improving the conversation performance of the first robot as a whole. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 1 is a schematic diagram of the architecture of a robot training system 100 provided in an embodiment of the present application;
[0023] Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application;
[0024] Figure 3A It is a first flow chart of the robot training method provided in the embodiment of the present application;
[0025] Figure 3B is a second flow chart of the robot training method provided in an embodiment of the present application;
[0026] Figure 3C is a third flow chart of the robot training method provided in an embodiment of the present application;
[0027] Figure 4 It is an overall implementation flow chart of the robot training method provided in the embodiment of the present application;
[0028] Figure 5 A schematic diagram of the intent system provided for the embodiments of the present application;
[0029] Figure 6It is a flowchart of obtaining training samples provided in an embodiment of the present application.
[0030] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of superiority or inferiority of the solutions or the priority in the implementation process. DETAILED DESCRIPTION
[0031] 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 this application.
[0032] 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.
[0033] 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 herein can be implemented in an order other than that illustrated or described herein.
[0034] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0035] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0036] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.
[0037] 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.
[0038] 1) Conversational robots: Conversational robots, also known as chatbots or conversational robots, are computer programs that simulate human conversations. Through natural language processing and artificial intelligence technology, conversational robots can interact with users in real time, provide information, answer questions, solve problems, etc. Conversational robots have a wide range of application scenarios and can be used in customer service, sales and marketing, education, medical care and other fields to provide users with personalized services and information.
[0039] 2) Identity conversion: the conversation identity of the conversation robot is converted. For example, the existing conversation robots include agent robots and customer robots, wherein the conversation identity of the agent robot is agent, and the conversation identity of the customer robot is customer. By issuing instructions indicating identity conversion to the robots, the conversation identities of the agent robot and the customer robot are interchanged. For example, when a first instruction indicating that the conversation identity is converted from agent to customer is issued to the agent robot, the agent robot conducts the conversation as the customer based on the first instruction during the conversation. For another example, when a second instruction indicating that the conversation identity is converted from customer to agent is issued to the customer robot, the customer robot conducts the conversation as the agent based on the second instruction during the conversation.
[0040] In the process of obtaining conversation data as training samples, the conversation data recognized by the existing speech recognition technology (Automatic Speech Recognition, ASR) may have the problem of conversation data not matching the conversation identity. For example, in a conversation between an agent and a customer, the customer's speech is recognized as the agent's speech. In this way, when the corresponding agent robot is subsequently trained, the customer's speech data will be used as the agent's speech data for training, which will affect the accuracy of the trained agent robot.
[0041] Embodiments of the present application provide a robot training method, device, electronic device, computer-readable storage medium, and computer program product, which can improve the conversation performance of the trained robot.
[0042] The following describes an exemplary application of the electronic device provided in the embodiments of the present application. The electronic device provided in the embodiments of the present application can be implemented as various types of terminals such as a laptop computer, a tablet computer, a desktop computer, a set-top box, a mobile device, a smart device, and a vehicle-mounted terminal, and can also be implemented as a server. The following describes an exemplary application when the device is implemented as a server.
[0043] See also Figure 1 , Figure 1It is a schematic diagram of the architecture of the robot training system 100 provided in an embodiment of the present application. To realize the training application supporting a robot, the terminal 400 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.
[0044] The terminal 400 is used to deploy the first robot and the second robot, and determine the first session data of the first robot and the second session data of the second robot, the first session data and the second session data correspond to the same session scenario, and the first robot and the second robot are trained using different types of training samples. The terminal 400 transmits the first session data and the second session data to the server 200 through the network 300.
[0045] The server 200 is used to determine a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and to determine a second similarity between the semantics of the first session data and the semantics of the second session data; based on the first similarity and the second similarity, to filter out third session data adapted to the first robot from the second session data; to construct a first training sample based on the third session data, and to train the first robot based on the first training sample.
[0046] The robot training method provided in the embodiment of the present application can be applied to training a first robot, wherein the first robot can be an agent robot or a customer robot. Next, the conversation identity of the first robot is an agent, that is, the first robot is an agent robot. For example, in the scenario of training an agent robot, the agent robot can be first trained through existing agent type training samples, and the customer robot can be trained through existing customer type training samples. After that, the agent robot can have a conversation with a standard customer robot to obtain first conversation data, and the customer robot can be used as an agent to have a conversation with a standard customer robot to obtain second conversation data. Then, a first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data is determined, and a second similarity between the semantics of the first conversation data and the semantics of the second conversation data is determined. Based on the first similarity and the second similarity, third conversation data adapted to the first robot is screened out from the second conversation data. Finally, the third conversation data is used as a training sample to retrain the first robot. In this way, the training samples can be enriched, thereby improving the conversation performance of the trained agent robot.
[0047] See also Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application, Figure 2The electronic device 500 shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .
[0048] The processor 510 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.
[0049] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0050] The memory 550 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 550 may optionally include one or more storage devices that are physically remote from the processor 510.
[0051] The memory 550 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 550 described in the embodiments of the present application is intended to include any suitable type of memory.
[0052] In some embodiments, the memory 550 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.
[0053] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0054] A network communication module 552, used to reach other electronic devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;
[0055] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);
[0056] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.
[0057] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 A training device 555 of a robot stored in a memory 550 is shown, which may be software in the form of a program or a plug-in, and includes the following software modules: a determination module 5551, a screening module 5552, and a training module 5553. These modules are logical, and thus may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.
[0058] 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 robot training 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.
[0059] Next, the robot training method provided by the embodiment of the present application is described. As mentioned above, the electronic device for implementing the robot training method of the embodiment of the present application can be a terminal, a server, or a combination of the two. Therefore, the execution subject of each step will not be repeatedly described below.
[0060] See also Figure 3A , Figure 3A is a first flow chart of the robot training method provided in the embodiment of the present application, which will be combined with Figure 3A Steps 101 to 104 are shown for explanation.
[0061] In step 101, first conversation data of a first robot and second conversation data of a second robot are determined, the first conversation data and the second conversation data correspond to the same conversation scenario, and the first robot and the second robot are trained using different types of training samples.
[0062] As an example, a conversational scenario may be an application scenario of a conversational robot. For example, in a company's customer service center, a conversational robot can handle a large number of customer inquiries, answer common questions, or transfer complex questions to manual service. For another example, in the IT service field, a conversational robot can help users solve technical problems, perform troubleshooting, or provide guidance on software operation. For another example, a conversational robot can be used to collect information about potential customers, provide product information, guide the sales process, and even complete transactions. For another example, in the recruitment process, a conversational robot can be used for preliminary screening of resumes, preliminary communication with job seekers, and arrangement of interviews. For another example, when a customer seeks medical advice, a conversational robot can provide basic medical advice, answer questions about symptoms and drug use, or provide preliminary guidance in emergencies. For another example, in the banking, insurance, and securities industries, a conversational robot can help customers make account inquiries, provide financial advice, and even assist in transactions.
[0063] That is, the first robot and the second robot are conversational robots, which are also called chatbots or dialogue robots, and are computer programs that simulate human conversations. Conversational robots can interact with users in real time through natural language processing and artificial intelligence technology, providing information, answering questions, solving problems, etc.
[0064] In some embodiments, the first session data is data of a conversation between a first robot and a conversation object based on a first identity, and the second session data is data of a conversation between a second robot and a conversation object based on the first identity. The first robot is trained using training samples corresponding to the first identity, and the second robot is trained using training samples corresponding to the second identity. Instructions can be sent to the second robot to instruct the second robot to switch from the second identity to the first identity during the conversation with the conversation object.
[0065] In actual implementation, different types of training samples can be obtained by collecting conversation data of conversation parties with different identities, where conversation parties with different identities can be robots with agent identities or robots with customer identities. Based on this, robots trained with different types of training samples have conversation capabilities corresponding to the types of training samples, that is, the conversation identity of the robot is determined to a certain extent by the training samples used to train the robot. For example, a robot trained with training samples with agent identity can usually output the agent's professional terms during the conversation, and the content of the conversation is closer to the agent's identity, so its conversation identity can be regarded as the agent identity; for another example, a robot trained with training samples with customer identity has conversation data that is closer to the customer identity during the conversation, so its conversation identity can be regarded as the customer identity.
[0066] The first conversation data of the first robot may be conversation data output by the first robot with the first conversation identity extracted from conversation data between two conversation robots with different conversation identities (such as the first robot and the third robot). For example, the first robot is an agent robot, and the third robot that talks to the first robot may be a standard customer robot. The first conversation data is conversation data output by the agent robot extracted from conversation data between the agent robot and the standard customer robot.
[0067] The second conversation data is the conversation data output by the second robot after sending instructions to the second robot to convert the identity of the second robot to the first identity of the first robot. For example, the first robot is an agent robot, the first identity of the first robot is an agent, and the second identity of the second robot is a customer. By sending the instruction "Have the following conversation as an agent" to the second robot, the conversation identity of the second robot is converted from a customer to an agent, and the second robot acts as an agent to have a conversation with a standard customer robot, and the conversation data output by the second robot is used as the second conversation data. It should be noted that the first conversation data and the second conversation data are conversation data for the same conversation scenario, such as conversation data for the same consulting question in the conversation scenario of resource return.
[0068] As an example, since the first robot and the second robot can be trained through a large number of customer conversation data and agent conversation data respectively, they can adapt well to the current conversation scenario after the identity swap. And since the speaking habits of the second robot after the identity conversion are different from the trained identity, conversation data different from the regular conversation data can be obtained.
[0069] In step 102, a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data is determined, and a second similarity between semantics of the first session data and semantics of the second session data is determined.
[0070] In some embodiments, determining the first similarity between the grammatical structure of the first session data and the grammatical structure of the second session data in step 102 may be implemented by steps 1021 to 1024 as shown in 3B:
[0071] In step 1021, the first conversation data is segmented to obtain N first word units, and the second conversation data is segmented to obtain M second word units, where N and M are both positive integers.
[0072] As an example, word segmentation is the process of dividing a continuous text sequence into smaller, more meaningful units (called terms or tokens). This unit can be a word, a phrase, a sentence, etc. Specifically, the first session data and the second session data can be word segmented in the following manner.
[0073] First, before word segmentation, some preprocessing steps may be required, such as unifying upper and lower case, removing punctuation, and converting numbers, to reduce the complexity of word segmentation and improve efficiency; then, use the word segmentation algorithm to identify natural language units in the text. Common word segmentation algorithms include dictionary-based word segmentation, statistical-based word segmentation, deep learning-based word segmentation, etc.; then, for the dictionary-based word segmentation method, it is necessary to build a dictionary containing keywords and phrases. This dictionary usually includes common vocabulary, proper nouns, idioms, etc.; then, according to the selected word segmentation algorithm, the text is split into terms. For example, dictionary-based word segmentation uses vocabulary in the dictionary to segment the text, statistical-based word segmentation uses probability models to determine the best word segmentation method, and deep learning-based word segmentation uses neural networks to predict the next term; finally, after word segmentation is completed, post-processing may be required, such as eliminating ambiguity, merging synonyms, eliminating meaningless terms, etc., to improve the quality of word segmentation.
[0074] As an example, the first conversation data is "I would like to consult you about loan-related matters". The first conversation data can be segmented into first word units such as "I", "want", "consult you", "loan", "related", and "matters".
[0075] In step 1022, based on the first grammatical structure, the N first word units are combined to obtain first combination data having the first grammatical structure, and the M second word units are combined to obtain second combination data having the first grammatical structure.
[0076] Among them, the first grammatical structure is a grammatical structure corresponding to a preset combination pattern or a preset context. The preset combination pattern may be that the same components exist in the combined data obtained by combination. For example, the first word unit is "I" and the second word unit is "Mom". When the same component in the combination pattern is "lender XX", the first combined data obtained is "the lender himself" and the second combined data is "the lender's mother".
[0077] The preset context may be the same as the context corresponding to the combined data obtained by the combination. For example, the preset context is the context for expressing the service that needs to be provided. The first word unit is "I" and "loan", and the second word unit is "I" and "repayment". Then the first combined data is "I need loan services" and the second combined data is "I need repayment services".
[0078] As an example, the first word unit and the second word unit are combined through the first grammatical structure. The first grammatical structure can also refer to the structure of a sentence. For example, the first word unit is "loan", "today", "I", and the second word unit is "tomorrow", "repay", "you". The preset data structure is: adverb, subject, verb, and the first combination data obtained is "I take out a loan today", and the second combination data is "you repay tomorrow".
[0079] In step 1023, feature extraction is performed on the first combination data to obtain a first feature, and feature extraction is performed on the second combination data to obtain a second feature.
[0080] In some embodiments, feature extraction is performed on the first combined data in step 1023 to obtain the first feature, which can be achieved through the following technical solutions: feature extraction is performed on word units in the first combined data to obtain word features of the word units; feature extraction is performed on the position information of the word units in the first combined data to obtain position features of the word units; feature extraction is performed on sentences in the first combined data to obtain sentence features of the sentences; word features, position features and sentence features are integrated to obtain the first feature.
[0081] As an example, a method for obtaining word features may be to extract features from word units in the first combined data, and then obtain word features characterizing each word unit, wherein the word segmentation feature may be the feature corresponding to each word unit after the first conversation data is segmented. For example, a sentence in the first combined data is "I will pay back the money tomorrow", wherein the corresponding three word units may be "I", "tomorrow" and "pay back the money", and the word feature is the feature corresponding to each word unit; a method for obtaining position features may be to extract features characterizing the position of each word unit in the first combined data. Continuing with the above example, the position of the word unit "I" is before the word unit "tomorrow", so the position feature of the word unit "I" may be the feature characterizing that the word unit "I" is before the word unit "tomorrow", and there are no other word units before the word unit "I"; a method for obtaining sentence features may be to input the complete sentence included in the first combined data into a neural network for feature extraction, and the neural network extracts the sentence features corresponding to the sentence.
[0082] In actual implementation, the method of feature fusion of word segmentation features, position features and sentence features can be to concatenate the word segmentation features, position features and sentence features to obtain the first feature, or to perform weighted summation of the word segmentation features, position features and sentence features to obtain the first feature.
[0083] As an example, the feature fusion process can also fuse role distance features obtained through role distance encoding, which is a technique for encoding role relationships in text data to facilitate analysis and mining of these roles. In text data, role relationships can be diverse. For example, in social media texts, users can play different roles, such as publishers, commentators, and likers. In internal corporate communications, employees can play different roles, such as project leaders, team members, managers, etc. These role relationships can reveal character relationships and behavior patterns in the text.
[0084] Similarly, the method for determining the second feature is consistent with the method for determining the first feature. For example, first, feature extraction is performed on the word units in the second combined data to obtain word features representing each word unit. Then, position features representing the position of each word unit in the second combined data are extracted, and the complete sentence included in the second combined data is input into a neural network for feature extraction. The neural network extracts the sentence features corresponding to the sentence. Finally, the word segmentation features, position features and sentence features corresponding to the second combined data are feature concatenated to obtain the second feature. Alternatively, the word segmentation features, position features and sentence features corresponding to the second combined data can be weighted and summed to obtain the second feature.
[0085] Through the above method, the information dimension contained in the first feature can be improved, thereby improving the accuracy of the obtained first feature.
[0086] In step 1024, based on the first feature and the second feature, a first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data is determined.
[0087] In some embodiments, determining the first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data based on the first feature and the second feature in step 1024 can be achieved by the following technical solution: performing feature extraction on the fourth conversation data of the third robot in the conversation scenario to obtain the third feature of the fourth conversation data, where the third robot and the first robot are trained using the same type of training samples; determining the third similarity between the first feature and the third feature, and determining the fourth similarity between the second feature and the third feature; determining the difference between the third similarity and the fourth similarity as the first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data.
[0088] As an example, the fourth session data may be session data of the same type as that of the first robot, that is, the identities of the first robot and the third robot after training are the same, and the third robot may be regarded as a robot with higher performance, serving as a reference standard for measuring the performance of the first robot, and the method for determining the third feature of the fourth session data is consistent with the method for determining the first feature of the first robot described above, for example, the method for determining the third feature is consistent with the method for determining the first feature, for example, firstly, feature extraction is performed on word units in the fourth combined data to obtain word features characterizing each word unit, and then position features characterizing the position of each word unit in the fourth combined data are extracted, and the complete sentence included in the fourth combined data is input into a neural network for feature extraction, and the sentence features corresponding to the sentence are extracted by the neural network, and finally, the word segmentation features, position features and sentence features corresponding to the fourth combined data are feature spliced to obtain the third feature, or the word segmentation features, position features and sentence features corresponding to the fourth combined data may be weighted summed to obtain the fourth feature, and it is necessary to first determine the features of each word segment in the fourth session data and the features characterizing the structure of the fourth session data.
[0089] As an example, the type of the third robot is an agent, the fourth conversation data may be "Excuse me, what service do you need?", and the word unit of the fourth conversation data may be data obtained by segmenting the fourth conversation data. Following the above example, the word unit may be "Excuse me," "You," "Need," "What," "Service"; the data structure of the fourth conversation data may be adverbs, subjects, and verbs. Then the fourth conversation data is "You call tomorrow," and then feature extraction may be performed on the fourth conversation data to obtain the third feature.
[0090] As an example, if the type of the first robot is an agent, the first conversation data corresponding to the first feature is the agent's conversation, and similarly, the second conversation data corresponding to the second feature is also the agent's conversation. At this time, the conversation corresponding to the third feature is also the agent's conversation data, and the first similarity between the first feature and the third feature can represent the similarity between conversations of different agents (the first robot and the third robot) in the same conversation scene. Similarly, the second similarity between the second feature and the third feature can represent the similarity between conversations of different agents (the second robot and the third robot) in the same conversation scene. Then, by determining the difference between the first similarity and the second similarity, the difference between the conversation of the agent in the first conversation data and the conversation of the agent in the second conversation data can be determined.
[0091] As an example, the similarity between the features may be determined by determining the cosine similarity between the two features as the similarity, or by determining the Euclidean distance between the two features as the similarity.
[0092] In some embodiments, determining the second similarity between the semantics of the first session data and the semantics of the second session data in step 102 may be performed as follows: Figure 3C Steps 1025 to 1027 are implemented as shown.
[0093] In step 1025, semantic recognition is performed on the first session data to obtain a first semantic category of the first session data, and semantic recognition is performed on the second session data to obtain a second semantic category of the second session data.
[0094] As an example, the semantic category can characterize the intention of the session data. For example, if session data A is "I want a loan", the semantic category of session data A is "loan", and if session data B is "I have something to do today, I will contact you tomorrow", the semantic category of session data B is "busy".
[0095] As an example, the process of performing semantic recognition on the first session data and the second session data may be inputting the first session data and the second session data into a pre-trained semantic recognition model, and the semantic recognition model outputting semantic categories of the first session data and the second session data.
[0096] As an example, the semantic recognition model may be a model trained based on semantically annotated conversation data. The specific training process of the semantic recognition model may be selected based on actual conditions and is not specifically limited here.
[0097] In step 1026 , when the first semantic category is consistent with the second semantic category, a first semantic feature of the first session data and a second semantic feature of the second session data are determined.
[0098] As an example, feature extraction is performed on the first session data and the second session data of the same semantic category to obtain the first semantic feature and the second semantic feature. For example, the first session data A is "I need a loan today" and the second session data B is "I want a loan", then the semantic categories corresponding to the first session data A and the second session data B are both "loan". Therefore, feature extraction can be performed on the first session data A and the second session data B to obtain the first session feature corresponding to the first session data A and the second session feature corresponding to the second session data B.
[0099] As an example, the process of extracting features from the semantics of the first session data and the second session data may be implemented by a neural network, wherein the neural network may be a convolutional neural network, a recurrent neural network, an autoencoder, a generative adversarial network, or other neural network, and the present application embodiment does not limit the structure of the neural network.
[0100] In step 1027 , based on the first semantic feature and the second semantic feature, a second similarity between the semantics of the first session data and the semantics of the second session data is determined.
[0101] In some embodiments, determining the second similarity between the semantics of the first conversation data and the semantics of the second conversation data based on the first semantic feature and the second semantic feature in step 1027 can be achieved by the following technical solution: performing feature extraction on the fifth conversation data of the fourth robot in the conversation scenario to obtain the third semantic feature of the fifth conversation data, the third semantic category of the fifth conversation data is consistent with the first semantic category, and the fourth robot and the first robot are trained using the same type of training samples; determining the fifth similarity between the first semantic feature and the third semantic feature, and determining the sixth similarity between the second semantic feature and the third semantic feature; determining the difference between the fifth similarity and the sixth similarity as the second similarity between the semantics of the first conversation data and the semantics of the second conversation data.
[0102] As an example, the fifth conversation data may be conversation data of a fourth robot of the same type as the first robot, that is, the identities of the first robot and the fourth robot after training are the same, and the fourth robot may be regarded as a higher-performance robot as a reference standard for measuring the performance of the first robot. For example, the first semantic category is "loan", the type of the first robot is an agent, and the fifth conversation data may be "Do you want to apply for a loan?"
[0103] In actual implementation, the process of extracting features from the fifth session data can be implemented by a neural network, wherein the neural network can be a convolutional neural network, a recurrent neural network, an autoencoder, a generative adversarial network, or other neural networks.
[0104] As an example, if the type of the first robot is an agent, the first conversation data corresponding to the first conversation feature is the conversation of the agent, and similarly, the second conversation data corresponding to the second conversation feature is also the conversation of the agent. At this time, the conversation corresponding to the third semantic feature is also the conversation data of the agent, and the fifth similarity between the first conversation feature and the third semantic feature can represent the similarity between the conversation of the agent in the first conversation data and the conversation of the agent in the fifth conversation data in the same semantic category. Similarly, the sixth similarity between the second conversation feature and the third semantic feature can represent the similarity between the conversation of the agent in the second conversation data and the conversation of the agent in the fifth conversation data in the same semantic category. Then, by determining the difference between the fifth similarity and the sixth similarity, the difference in the semantic dimension between the conversation of the agent in the first conversation data and the conversation of the agent in the second conversation data can be determined.
[0105] As an example, the semantic similarity between features may be determined by determining the cosine similarity between the two features as the semantic similarity, or by determining the Euclidean distance between the two features as the semantic similarity.
[0106] In step 103, based on the first similarity and the second similarity, third conversation data adapted to the first robot is screened out from the second conversation data.
[0107] In some embodiments, the step 103 of selecting the third session data adapted to the first robot from the second session data based on the first similarity and the second similarity can be achieved by the following technical solution: from the second session data, selecting the fifth session data whose first similarity exceeds the first similarity threshold; from the fifth session data, selecting the session data whose second similarity exceeds the second similarity threshold as the third session data adapted to the first robot.
[0108] In actual implementation, when the first similarity is lower than the first similarity threshold, the data structure representing the second session data is not compatible with the type of the first robot, and thus the data in the second session data whose first similarity is lower than the first similarity threshold can be determined as session data that is not compatible with the first robot; when the second similarity is lower than the second similarity threshold, the semantics representing the second session data is not compatible with the type of the first robot, and thus the data in the second session data whose first similarity is lower than the first similarity threshold can be determined as session data that is not compatible with the first robot.
[0109] In some embodiments, the following technical solution can also be executed: for the sixth session data in the second session data that is not compatible with the first robot, the sixth session data is corrected to obtain the seventh session data that is compatible with the first robot; a second training sample is constructed based on the seventh session data, and the first robot is trained based on the second training sample.
[0110] In actual implementation, the session data in the second session data that is adapted to the first robot can be directly used as a training sample for training the first robot or the second robot, while the sixth session data in the second session data that is not adapted to the first robot needs to be corrected to obtain the corrected session data that conforms to the corresponding session identity. Only then can the corrected session data be used as a training sample for training the first robot or the second robot. This enriches the training samples and can improve the session performance of the trained first robot.
[0111] In some embodiments, the above-mentioned correction of the sixth conversation data to obtain the seventh conversation data adapted to the first robot can be achieved through the following technical solution: extracting words that are not suitable for the first robot from the sixth conversation data, and determining the ratio of the number of words to the total number of words in the sixth conversation data; when the ratio is less than a preset threshold, determining the replacement word corresponding to the word, and replacing the word based on the replacement word to obtain the seventh conversation data adapted to the first robot.
[0112] As an example, in actual application, the value of the preset threshold may be 1. If the proportion of words that are not suitable for the first robot is not 1, it indicates that some words in the second conversation data are not suitable for the first robot. At this time, a replacement word of the type of the first robot in the second conversation data is obtained, and the part of the second conversation data that is not suitable for the first robot is replaced with the replacement word.
[0113] As an example, the process of obtaining replacement words can be to extract the conversation data adapted to the first robot from the historical conversation data, perform word segmentation processing on the extracted conversation data, and obtain multiple words. Then, semantic recognition processing is performed on the obtained words to obtain words in each semantic category, and then the words in the second conversation data that are not adapted to the first robot can be replaced with replacement words with the same semantics as the words, thereby obtaining the seventh conversation data adapted to the first robot.
[0114] As an example, the value of the preset threshold value may be 1. If the percentage is 1, it indicates that the second session data is not compatible with the first robot at all. Then, the type of the second session data is changed to the type of the second robot, and the type detection is performed again on the second session data to obtain the type detection result. For the specific type detection process, please refer to the above steps 102 to 103. If the type check result indicates that the second session data is fully compatible with the type of the second robot, the second session data is used as the session data of the type of the second robot. The second session data can then be used as a training sample for training the type of the second robot.
[0115] As an example, the type of the first robot is an agent, and the type of the second robot is a customer. This indicates that the second session data does not conform to the agent type. In this case, the type of the second session data is changed to customer, and the identity check is performed on the second session data again. If the identity check result indicates that the second session data conforms to the customer identity, the second session data is used as the customer's session data. The second session data can then be used as a training sample for a third robot to train the customer identity and train the third robot.
[0116] As an example, if after re-detection, the second session data is still not suitable for the second robot, the second session data is deleted.
[0117] In step 104, a first training sample is constructed based on the third conversation data, and the first robot is trained based on the first training sample.
[0118] First, the conversation samples corresponding to the third conversation data are labeled to obtain the type label of each conversation sample, and then the conversation samples with the type labels are input into the conversation robot to be trained (i.e., the first robot) corresponding to the type labels. The conversation robot to be trained outputs the predicted conversation sentence, and the parameters of the robot to be trained are updated by reverse gradient through a set loss function (such as a cross entropy loss function, etc.) with the goal of minimizing the difference between the predicted conversation sentence and the conversation sample, so as to obtain a trained conversation robot.
[0119] Through the above method, the training samples are enriched. By training the conversational robot with relatively rich training samples, the performance of the trained conversational robot can be improved.
[0120] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.
[0121] In related technologies, natural language processing tasks mainly focus on understanding the basic semantics of language. Taking the Chinese natural language understanding task as an example, the tasks mainly focus on: semantic similarity, short text classification, long text classification, and natural language reasoning.
[0122] Currently, the text recognized by speech recognition technology may contain incorrect roles (i.e., the identities of the two parties in the conversation data mentioned above). At the same time, the roles may be correct, but the content displayed in the text does not match the corresponding roles.
[0123] Based on this, logical linguistics is introduced into the matching process of roles and texts. Through the selection and exclusion of logical models, language fragments that do not match the conversation roles are identified, and language fragment replacement is completed in a possible way to ensure the readability of this part of the data (too many fragments that do not match the role will affect the readability of the sentence and the conversation content) and the quality of the initial text used for subsequent training of various models (the text conversation content is mostly manually annotated in this scenario for the training of models such as intent recognition and named entity recognition. If there are errors in the recognition of words, language blocks, and sentences in the initial text, it will fundamentally affect the text quality of the subsequent model training data.
[0124] See also Figure 4 , Figure 4 It is an overall implementation flow chart of the robot training method provided in the embodiment of the present application.
[0125] In step 401, session data and all roles are obtained.
[0126] Get the session data and all roles; for example: Agent: text1; Customer: text2; Agent: text3;
[0127] There are two roles: agent and customer.
[0128] In step 402, excellent calls are obtained from historical calls.
[0129] Arrange the call text in the format of single sentences by role (agent / customer);
[0130] For example: Agent: Hello, are you Mr. Liu...?
[0131] Customer: Yes, where are you from?
[0132] Agent: I’m from the… department of… company. I’m calling you mainly because…
[0133] The so-called excellent conversation can be considered from multiple aspects such as fluency, coherence, relevance, consistency, etc., which will be explained one by one below.
[0134] 1. Obtain the fluency value of each agent's sentence.
[0135] For example, when obtaining the fluency of a single sentence, the single sentence is input into the pre-trained language model, and the fluency of the sentence is output, wherein the fluency value is calculated as follows:
[0136] First, determine the first fluency and the second fluency, where the first fluency = 1 / perplexity; the second fluency = 5-(the number of consecutive identical words * the number of consecutive times * 0.1). Finally, add the first fluency and the second fluency to obtain the fluency value.
[0137] 2. Get the continuity value of the agent single-role conversation and the customer and agent dual-role conversation.
[0138] The process of determining the coherence of the agent's own conversation can be to select two adjacent sentences with the identity of the agent in the conversation data for similarity calculation, and determine the average of the coherence values of all adjacent sentences as the coherence value of the agent's own conversation. If the coherence value is lower than a certain threshold, it is determined that the agent's own conversation is incoherent;
[0139] The process of determining the coherence of the customer-agent conversation interaction may be to select two adjacent sentences in the conversation data for similarity calculation, and determine the average value of the coherence of all adjacent sentences (the adjacent sentences may be of the same identity or different identities) as the coherence of the customer-agent interaction conversation. If the coherence value is lower than a certain threshold, it is determined that the customer-agent interaction conversation is incoherent.
[0140] 3. Obtain the correlation values of the agent-side conversations respectively.
[0141] The conversation data of the agent in the conversation data is input into the intention recognition model (i.e. the above-mentioned semantic recognition model) to obtain the intention of each sentence in the conversation data (i.e. the above-mentioned semantics); wherein, the training process of the intention recognition model can be as follows:
[0142] 1) Construct an intent system, which includes m intents (the m intents include one "other intent", which means the intent that is not included in the other intents; each intent includes: intent, intent interpretation, intent example). The following takes one intent as an example to illustrate.
[0143] See also Figure 5 , Figure 5 A schematic diagram of the intent system provided in the embodiment of the present application. Figure 5 In , an intention system can include four parts: classification number, classification, classification interpretation and classification case. Among them, the classification number can be a number used to characterize the intention system, such as Figure 5 The classification number of the intent system shown in is 1; the classification can be the name of the intent used to characterize the intent system, such as Figure 5 The classification of the intent system shown in is three-party identity (with a higher priority than not being the person); the classification can be the interpretation content used to characterize the intent system, such as Figure 5 The classification interpretation of the intention system shown in is that the relationship with the customer is friends, colleagues, relatives, and immediate family members; the classification case can be to explain the intention system through examples, such as Figure 5As shown in the above, I am his xxx / I am her friend / I am her father / I am her mother / my mother / I am his sister / I am his brother / you are looking for him / divorce / he is / he works in our company / he is driving, just you say it / he is not here now / he is not here / he is not here / not very familiar / just had dinner together / met once, not very familiar / no contact / relatives / in the same place, in a town / I am his boss / I am his client.
[0144] 2) Loading a pre-trained language model, wherein the pre-trained language model may be a robot model.
[0145] 3) Send the labeled training sample data to the pre-trained language model and set the task type to classification to train the intent recognition model.
[0146] The proportion of texts with "other intents" predicted by the detection intent recognition model can then be used to determine the relevance of the conversation data. Specifically, the difference between 1 and the proportion of texts with "other intents" obtained can be used as the relevance of the conversation data. The lower the relevance, the more expressions that represent irrelevant business of the agent, and the weaker the business objectives of the agent.
[0147] 4. Obtain the consistency value of the agents’ expressions of knowledge answers respectively.
[0148] The conversation data whose identity is the agent in the conversation data is input into the intention recognition model, the intention of each sentence is obtained, and the semantic similarity between the intentions of any two sentences of the agent is detected (specifically, the conversation data can be input into a pre-trained language model, and the pre-trained speech model outputs the sentence vector of the conversation data, and then the cosine value between the sentence vectors is determined as the semantic similarity mentioned above). If the semantic similarity = -1, it indicates that the intentions are opposite; the consistency value of the agent can be 1-(the number of opposite intentions*0.1).
[0149] 5. Obtain the identity loyalty of the agent text (i.e., the loyalty to the agent's identity in accordance with the agent's identity).
[0150] 1) Detect the percentage of words that match the agent's identity and the percentage of words that do not match the agent's identity in the agent's text.
[0151] 2) Determine identity loyalty = the percentage of words that match your identity + (1-the percentage of words that do not match your identity).
[0152] 3) Call content quality evaluation = fluency value + coherence value + relevance value + consistency value + identity loyalty. If the call content quality evaluation is higher than a certain threshold, it is judged as an excellent call; (The threshold can be calculated by finding the highest score and the average score of all call content quality evaluation scores, and the middle value between the highest score and the average score is used as the threshold of an excellent call. If it is higher than the threshold, it is an excellent call).
[0153] In step 403, the text in the historical call is split and segmented according to the role, and the segmentation results of the two are compared to filter out role-specific words; wherein the screening method may be to obtain an existing agent historical vocabulary library and a customer historical vocabulary library, and by determining a first intersection of the agent historical vocabulary library and the customer historical vocabulary library, a set of words in the agent historical vocabulary library that are different from the first intersection may be used as an agent-specific vocabulary set, and a set of words in the customer historical vocabulary library that are different from the first intersection may be used as a customer-specific vocabulary set.
[0154] In step 404, the text to be detected is subjected to language block matching and word segmentation.
[0155] In step 405, semantic vectors of the language chunks and word segmentation results of the current sentence are compared with the character characteristic words.
[0156] The role distance encoding layer adds the meaning of roles to the representation of text by encoding the text in the form of vectors, so that the understanding and processing of text take into account the integration of roles and conversation text. When training the model, the relationship between the text sentence vector of the role distance encoding and the role violation probability in the label will be considered through the hidden layer, which is helpful for model training;
[0157] In step 406, the different role language unit detection model outputs sentences, language chunks, vocabulary lists and role violation probabilities that do not conform to the role;
[0158] The training process of the heterogeneous language detection model:
[0159] 1) Load the pre-trained language model (robot model).
[0160] The structure of the pre-trained speech model may include an input layer (used to pre-process the user's text input, including word segmentation, removal of stop words, part-of-speech tagging, etc.), an embedding layer (used to convert the pre-processed text into a word vector, and a role distance encoding layer may be added at the end of the embedding layer to extract the role distance features of the conversation data), an encoding layer (using structures such as recurrent neural networks and long short-term memory networks to process sequence data and extract deep-level features of the text), a fully connected layer (fully connecting the features extracted by the encoding layer for tasks such as classification, regression or sequence generation), and an output layer (according to specific business needs, the output layer may be a classification label, a sentiment label, an entity recognition label, generated text, etc.), wherein the embedding layer first performs word segmentation on the conversation data to obtain a plurality of word units, and then performs feature extraction on the word units to obtain word features representing each word unit, and then extracts position features representing the position of each word unit in the conversation data, and inputs the complete sentence included in the conversation data into a neural network for feature extraction, and the neural network extracts the sentence features corresponding to the sentence, and finally performs feature splicing on the word segmentation features, position features and sentence features corresponding to the second combined data to obtain the output of the embedding layer.
[0161] 2) Input the labeled data into the pre-trained language model, set the task category to sequence labeling, and start training.
[0162] The format of the labeled data is as follows: the text is "Customer: Our leader asked me to call you"; the label of the text can be [our leader, 0.8, call you, 0.7], where 0.8 represents the role violation probability, that is, the probability that the word "our leader" violates the identity of "customer"; 0.7 represents the role violation probability, that is, the probability that the phrase "call you" violates the identity of "customer"; in the training data, it corresponds to historical calls.
[0163] A loss function is constructed by combining the predicted value of the labeled data predicted by the pre-trained speech model and the labeled value of the labeled data, and the pre-trained speech model is trained based on the loss function to obtain a heterosexual language detection model.
[0164] In step 407, the language unit correction model processes the sentences, language blocks, and vocabulary that do not conform to the role, so that the data conforms to the role and forms a training set with better quality for the subsequent training of various classification models.
[0165] Calculate the length ratio of each language unit in the list in the whole sentence. If one of them has a length ratio of 1 (in this case, there must be only this one in the list), it means that the whole sentence does not match the role identity. It is necessary to further calculate whether the sentence matches another role. If so, the text remains unchanged and the identity tag is changed. If it does not match another role, the whole sentence is deleted.
[0166] If the length of the language units in the list of language units that do not match the role accounts for less than 1, a vocabulary campaign scheme is required to perform a partial replacement in the sentence; wherein, the vocabulary campaign scheme can be as follows: first determine the vocabulary library corresponding to the above language unit, and determine in the vocabulary library the campaign words that have the same number of characters as the above language unit, the same applicable identity, and opposite semantic elements in the applicable role as the replaced language unit. The same in other semantic elements; after determining the campaign words, replace the above language unit with all the campaign words, and evaluate the role matching value of the replaced sentence, and select the campaign word with the highest role matching value as the replacement word.
[0167] The following is a method for obtaining training samples for the model. Figure 6 , Figure 6 It is a flowchart of obtaining training samples provided in an embodiment of the present application.
[0168] In step 601, an agent robot is obtained;
[0169] Obtain the historical conversation translation text data of agents of different levels in specific scenarios; send the above data to the basic large model for fine-tuning training, and the trained large model is the professional agent robot.
[0170] In step 602, a client robot is obtained.
[0171] Obtain the historical conversation translation text data of customers in specific scenarios; send the above data to the basic large model for fine-tuning training, and the trained large model is the professional customer robot.
[0172] In step 603, the agent robot and the customer robot exchange identities, and then conduct a conversation after the identities are exchanged.
[0173] The agent robot plays the role of the customer, and the customer robot plays the role of the customer; the agent robot is a robot trained with massive agent data, and is good at the agents' usual speech and words; the customer robot is a robot trained with massive customer data, and is good at the customers' usual speech and words; the specific role swap is achieved by guiding the robot to reverse the role in the prompt content, or by issuing instructions to guide the robot to reverse the role, so that the robot can conduct the conversation based on the reversed role during the conversation.
[0174] In step 604, the conversation data between the agent robot and the customer robot after the identity exchange is obtained.
[0175] First, a difference analysis is performed between the real robot and the reverse-role robot (i.e., the robot that performs identity swapping as mentioned above); suppose there are 10 regular agent robots and 1 new reverse-role robot; all the texts to be detected of these 11 robots are input into the intent recognition model to obtain the intent of each text to be detected (i.e., the semantics as mentioned above).
[0176] The texts to be detected of the conventional agent robot are input into the diversity detection model according to the categories of intent, and the diversity value under each intent is determined. Specifically, the list of texts to be detected in each intent category can be input into the language model to obtain the word segmentation result list ([I, am, the lender, myself] (i.e. the above-mentioned word unit)) and the word combination list ([lender myself] (i.e. the above-mentioned first combination data)), and then the sentence vectors of all the texts to be detected (i.e. the above-mentioned first feature and third feature) are obtained; by determining the third similarity between the first feature and the third feature.
[0177] Afterwards, the single sentences of the regular agent robot and the cross-dressing robot can be input into the language model to obtain the second feature and the third feature, and then the fourth similarity between the second feature and the third feature is determined. Finally, the difference between the third similarity and the fourth similarity is used as the diversity value under the intention (that is, the first similarity mentioned above).
[0178] Finally, the conversation data whose first similarity exceeds the first similarity threshold may be used as training samples for the agent robot.
[0179] In the embodiments of the present application, the semantic component analysis method is used to provide reliable evidence for the rationality analysis of the intention combination; the rationality analysis of the intention combination is used to assist the conversation role discrimination analysis, so as to better identify the words, language blocks, and sentences that do not conform to the role identity in the conversation; the word election method is used to realize the replacement of words, language blocks, and sentences in the conversation, so as to achieve the purpose of correcting the corpus at the minimum cost, and provide reliable original text data for subsequent various model training; the word election method is used to realize the replacement of words, language blocks, and sentences in the conversation, and to a certain extent, text correction is realized; the large model illusion is used to leave traces of different role vocabulary, and the prompt scheme is used for role reversal, so as to realize a novel different role language unit capture scheme.
[0180] It is understandable that in the embodiments of the present application, related data such as user information is involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards.
[0181] The following is a description of an exemplary structure of a robot training device 555 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 training device 555 of the robot in the memory 550 may include:
[0182] A determination module 5551 is used to determine first session data of a first robot and second session data of a second robot, where the first session data and the second session data correspond to the same session scenario, and the first robot and the second robot are trained using different types of training samples;
[0183] The determination module 5551 is further configured to determine a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and to determine a second similarity between semantics of the first session data and semantics of the second session data;
[0184] A screening module 5552, configured to screen out third session data adapted to the first robot from the second session data based on the first similarity and the second similarity;
[0185] The training module 5553 is used to construct a first training sample based on the third session data, and train the first robot based on the first training sample.
[0186] In some embodiments, the determination module 5551 is further used to perform word segmentation on the first conversation data to obtain N first word units, and to perform word segmentation on the second conversation data to obtain M second word units, where N and M are both positive integers; based on a first grammatical structure, to combine the N first word units to obtain first combined data having the first grammatical structure, and to combine the M second word units to obtain second combined data having the first grammatical structure; to perform feature extraction on the first combined data to obtain a first feature, and to perform feature extraction on the second combined data to obtain a second feature; and to determine a first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data based on the first feature and the second feature.
[0187] In some embodiments, the determination module 5551 is also used to perform feature extraction on word units in the first combined data to obtain word features of the word units; perform feature extraction on position information of the word units in the first combined data to obtain position features of the word units; perform feature extraction on sentences in the first combined data to obtain sentence features of the sentences; and fuse the word features, the position features and the sentence features to obtain the first features.
[0188] In some embodiments, the determination module 5551 is also used to extract features from the fourth conversation data of the third robot in the conversation scenario to obtain a third feature of the fourth conversation data, where the third robot and the first robot are trained using the same type of training samples; determine a third similarity between the first feature and the third feature, and determine a fourth similarity between the second feature and the third feature; and determine the difference between the third similarity and the fourth similarity as the first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data.
[0189] In some embodiments, the determination module 5551 is further used to perform semantic recognition on the first session data to obtain a first semantic category of the first session data, and to perform semantic recognition on the second session data to obtain a second semantic category of the second session data; when the first semantic category is consistent with the second semantic category, determine a first semantic feature of the first session data and a second semantic feature of the second session data; and based on the first semantic feature and the second semantic feature, determine a second similarity between the semantics of the first session data and the semantics of the second session data.
[0190] In some embodiments, the determination module 5551 is also used to extract features from the fifth conversation data of the fourth robot in the conversation scenario to obtain a third semantic feature of the fifth conversation data, the third semantic category of the fifth conversation data is consistent with the first semantic category, and the fourth robot and the first robot are trained using the same type of training samples; determine the fifth similarity between the first semantic feature and the third semantic feature, and determine the sixth similarity between the second semantic feature and the third semantic feature; and determine the difference between the fifth similarity and the sixth similarity as the second similarity between the semantics of the first conversation data and the semantics of the second conversation data.
[0191] In some embodiments, the filtering module 5552 is further used to filter out fifth session data whose first similarity exceeds a first similarity threshold from the second session data; and to filter out session data whose second similarity exceeds a second similarity threshold from the fifth session data as third session data adapted for the first robot.
[0192] In some embodiments, the screening module 5552 is further configured to modify the sixth session data in the second session data that is not compatible with the first robot to obtain seventh session data that is compatible with the first robot; construct a second training sample based on the seventh session data, and train the first robot based on the second training sample.
[0193] In some embodiments, the screening module 5552 is also used to extract words that are not suitable for the first robot from the sixth conversation data, and determine the ratio of the number of the words to the total number of words in the sixth conversation data; when the ratio is less than a preset threshold, determine the replacement words corresponding to the words, and replace the words based on the replacement words to obtain the seventh conversation data that is suitable for the first robot.
[0194] In some embodiments, the determination module 5551 is further used to send an instruction to the second robot, wherein the instruction is used to instruct the second robot to switch from the second identity to the first identity during the conversation with the conversation object.
[0195] 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 robot training method described in the embodiment of the present application.
[0196] The present application embodiment provides a computer-readable storage medium, wherein computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will be caused to execute the robot training method provided by the present application embodiment, for example, Figure 3A The robot training method is shown.
[0197] 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.
[0198] 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.
[0199] 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).
[0200] 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.
[0201] In summary, the following beneficial effects can be achieved through the embodiments of the present application:
[0202] Determine first conversation data of a first robot and second conversation data of a second robot, the first conversation data and the second conversation data correspond to the same conversation scenario, and the first robot and the second robot are trained using different types of training samples, obtain conversation data between the robots trained using different types of training samples, and improve the diversity of the conversation data obtained, then determine a first similarity between a grammatical structure of the first conversation data and a grammatical structure of the second conversation data, and determine a second similarity between the semantics of the first conversation data and the semantics of the second conversation data, select third conversation data adapted to the first robot from the second conversation data based on the first similarity and the second similarity, construct a first training sample based on the third conversation data, and train the first robot based on the first training sample, because the first training sample is generated by robots trained using different types of training samples through conversation, therefore, the first training sample can reflect the conversation characteristics of different types of conversationalists to a certain extent, and is not limited to the conversation characteristics of conversationalists of the same type, relative to using only the conversation data of a single type of conversationalist as a training sample, using data that can reflect the conversation characteristics of multiple types of conversationalists as a training sample greatly improves the diversity of the training samples, and training the first robot based on the diverse training samples is conducive to improving the adaptability and robustness of the first robot, that is, improving the conversation performance of the first robot as a whole.
[0203] 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 robot training method, characterized in that: The method comprises: Determine first conversation data of a first robot and second conversation data of a second robot, wherein the first conversation data and the second conversation data correspond to the same conversation scenario, and the first robot and the second robot are trained using different types of training samples; determining a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and determining a second similarity between semantics of the first session data and semantics of the second session data; Based on the first similarity and the second similarity, filtering out third conversation data adapted to the first robot from the second conversation data; A first training sample is constructed based on the third conversation data, and the first robot is trained based on the first training sample.
2. The method according to claim 1, characterized in that The determining a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data includes: Segmenting the first conversation data to obtain N first word units, and segmenting the second conversation data to obtain M second word units, where N and M are both positive integers; Based on the first grammatical structure, the N first word units are combined to obtain first combination data having the first grammatical structure, and the M second word units are combined to obtain second combination data having the first grammatical structure; Performing feature extraction on the first combined data to obtain a first feature, and performing feature extraction on the second combined data to obtain a second feature; Based on the first feature and the second feature, a first similarity between a grammatical structure of the first conversation data and a grammatical structure of the second conversation data is determined.
3. The method according to claim 2, characterized in that The step of extracting features from the first combined data to obtain a first feature includes: Extracting features from word units in the first combined data to obtain word features of the word units; Extracting features of the position information of the word unit in the first combined data to obtain position features of the word unit; Extracting features of sentences in the first combined data to obtain sentence features of the sentences; The word feature, the position feature and the sentence feature are fused to obtain the first feature.
4. The method according to claim 2, characterized in that: The determining, based on the first feature and the second feature, a first similarity between a grammatical structure of the first conversation data and a grammatical structure of the second conversation data includes: Extracting features of fourth conversation data of a third robot in the conversation scenario to obtain a third feature of the fourth conversation data, wherein the third robot and the first robot are trained using the same type of training samples; determining a third similarity between the first feature and the third feature, and determining a fourth similarity between the second feature and the third feature; A difference between the third similarity and the fourth similarity is determined as a first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data.
5. The method according to claim 1, characterized in that The determining a second similarity between the semantics of the first session data and the semantics of the second session data includes: Performing semantic recognition on the first session data to obtain a first semantic category of the first session data, and performing semantic recognition on the second session data to obtain a second semantic category of the second session data; In a case where the first semantic category is consistent with the second semantic category, determining a first semantic feature of the first session data and a second semantic feature of the second session data; A second similarity between the semantics of the first session data and the semantics of the second session data is determined based on the first semantic feature and the second semantic feature.
6. The method according to claim 5, characterized in that The determining, based on the first semantic feature and the second semantic feature, a second similarity between the semantics of the first session data and the semantics of the second session data includes: performing feature extraction on fifth conversation data of a fourth robot in the conversation scenario to obtain a third semantic feature of the fifth conversation data, wherein the third semantic category of the fifth conversation data is consistent with the first semantic category, and the fourth robot and the first robot are trained using the same type of training samples; determining a fifth similarity between the first semantic feature and the third semantic feature, and determining a sixth similarity between the second semantic feature and the third semantic feature; A difference between the fifth similarity and the sixth similarity is determined as a second similarity between the semantics of the first conversation data and the semantics of the second conversation data.
7. The method according to claim 1, characterized in that The step of selecting third conversation data adapted to the first robot from the second conversation data based on the first similarity and the second similarity includes: Filtering out fifth session data whose first similarity exceeds a first similarity threshold from the second session data; From the fifth conversation data, conversation data whose second similarity exceeds a second similarity threshold is screened out as third conversation data adapted for the first robot.
8. The method according to claim 7, characterized in that The method further comprises: For the sixth session data in the second session data that is not compatible with the first robot, modify the sixth session data to obtain seventh session data that is compatible with the first robot; A second training sample is constructed based on the seventh conversation data, and the first robot is trained based on the second training sample.
9. The method according to claim 8, characterized in that The step of modifying the sixth session data to obtain seventh session data adapted to the first robot includes: Extracting words that are not suitable for the first robot from the sixth conversation data, and determining a ratio of the number of the words to the total number of words in the sixth conversation data; When the ratio is less than a preset threshold, a replacement word corresponding to the word is determined, and the word is replaced based on the replacement word to obtain seventh conversation data adapted for the first robot.
10. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions; A processor, configured to implement the robot training method according to any one of claims 1 to 9 when executing the computer executable instructions stored in the memory.
Citation Information
Patent Citations
Accelerated annotation method and device for human-computer interaction multi-round dialogue corpora
CN111178062A
Question-answering robot training method and system and question-answering robot
CN111400462A
Semantic matching and semantic similarity model training method and device
CN112241626A
Robot dialogue model training method and device, equipment and storage medium
CN113806512A
Method and device for generating training sample for human-vehicle interaction and electronic equipment
CN117150303A