Dialogue generation method, model training method, device, equipment and medium
By generating search information, extracting search objects and determining knowledge information, the problems of semantic understanding and feedback in human-computer interaction are solved, and the quality and intelligence of the conversation are improved.
Patent Information
- Application Number
- CN202210477954.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-04-29
AI Technical Summary
The prior art is difficult to achieve accurate semantic understanding and rapid feedback in human-computer interaction, which affects the smoothness of the conversation.
By generating search information, extracting search objects, determining knowledge information from matching data sources, and generating knowledge reply content matching the dialogue information based on this information.
It improves the conversation quality and intelligence in human-computer interaction, ensuring the accuracy of semantic understanding and the speed of feedback.
Smart Images

Figure CN114840671B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to the technical fields of deep learning, intelligent search, voice technology, etc. Specifically, it relates to a dialogue generation method, a training method, a device, an electronic device, a storage medium, and a program product for a model used for dialogue generation. Background Art
[0002] Human-computer interaction is a way for humans to interact with machines using natural language. With the continuous development of artificial intelligence technology, it has become possible for machines to understand the information output by humans, understand the inherent meaning of the information, and give corresponding feedback. In these operations, accurate understanding of semantics, rapid feedback, and giving corresponding opinions or suggestions have become factors that affect the smoothness of human-computer interaction. Summary of the invention
[0003] The present disclosure provides a dialogue generation method, a training method, a device, an electronic device, a storage medium, and a program product for a model for dialogue generation.
[0004] According to one aspect of the present disclosure, a conversation generation method is provided, comprising: generating retrieval information based on conversation information; extracting a retrieval object from the retrieval information; determining knowledge information matching the retrieval information from a data source matching the retrieval object; and generating knowledge reply content matching the conversation information based on the knowledge information.
[0005] According to another aspect of the present disclosure, a training method for a model for dialogue generation is provided, comprising: generating sample retrieval information based on sample dialogue information of a training sample, wherein the training sample also includes sample reference reply content matching the sample dialogue information; extracting a retrieval object from the sample retrieval information; determining sample knowledge information matching the sample retrieval information from a data source matching the retrieval object; generating sample knowledge reply content based on the sample knowledge information; and training the deep learning model using the sample knowledge reply content and the sample reference reply content to obtain a language processing model.
[0006] According to another aspect of the present disclosure, a dialogue generation method is provided, comprising: inputting dialogue information into a language processing model to obtain knowledge response content matching the dialogue information, wherein the language processing model is trained using the method described in the present disclosure.
[0007] According to another aspect of the present disclosure, a dialogue generation device is provided, including: a first generation module for generating retrieval information based on dialogue information; an extraction module for extracting a retrieval object in the retrieval information; a retrieval module for determining knowledge information matching the retrieval information from a data source matching the retrieval object; and a second generation module for generating knowledge reply content matching the dialogue information based on the knowledge information.
[0008] According to another aspect of the present disclosure, a training device for a model for dialogue generation is provided, comprising: a first sample generation module, used to generate sample retrieval information based on sample dialogue information of a training sample, wherein the training sample also includes sample reference reply content matching the sample dialogue information; a sample extraction module, used to extract a retrieval object in the sample retrieval information; a sample retrieval module, used to determine sample knowledge information matching the sample retrieval information from a data source matching the retrieval object; a second sample generation module, used to generate sample knowledge reply content based on the sample knowledge information; and a training module, used to train the deep learning model using the sample knowledge reply content and the sample reference reply content to obtain a language processing model.
[0009] According to another aspect of the present disclosure, a dialogue generation device is provided, including: a dialogue generation module, used to input dialogue information into a language processing model to obtain knowledge response content matching the dialogue information, wherein the language processing model is trained using the device described in the present disclosure.
[0010] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a method as disclosed in the present disclosure.
[0011] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method of the present disclosure.
[0012] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the method of the present disclosure when executed by a processor.
[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0015] Figure 1 An exemplary system architecture to which the method and device for generating a dialogue according to an embodiment of the present disclosure can be applied is schematically shown;
[0016] Figure 2 A flowchart of a method for generating a dialogue according to an embodiment of the present disclosure is schematically shown;
[0017] Figure 3A The flowchart of the method for generating a dialogue according to an embodiment of the present disclosure is schematically shown;
[0018] Figure 3B A schematic diagram schematically shows a flow chart of a method for generating a dialogue according to another embodiment of the present disclosure;
[0019] Figure 4 A flowchart of a method for training a model for dialogue generation according to an embodiment of the present disclosure is schematically shown;
[0020] Figure 5A A schematic diagram of a process for adjusting parameters of a deep learning model according to an embodiment of the present disclosure is schematically shown;
[0021] Figure 5B A schematic diagram of a process for adjusting parameters of a deep learning model according to another embodiment of the present disclosure is schematically shown;
[0022] Figure 6 A flowchart of a method for generating a dialogue according to another embodiment of the present disclosure is schematically shown;
[0023] Figure 7 A block diagram of a dialog generation device according to an embodiment of the present disclosure is schematically shown;
[0024] Figure 8 A block diagram schematically shows a training device for a model for dialogue generation according to an embodiment of the present disclosure;
[0025] Fig. 9 A block diagram schematically shows a conversation generating device according to another embodiment of the present disclosure; and
[0026] Fig.10 A block diagram of an electronic device suitable for implementing a conversation generation method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0027] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0028] The present disclosure provides a dialogue generation method, a training method, a device, an electronic device, a storage medium, and a program product for a model for dialogue generation.
[0029] According to an embodiment of the present disclosure, a conversation generation method is provided, including: generating retrieval information based on conversation information; extracting a retrieval object in the retrieval information; determining knowledge information matching the retrieval information from a data source matching the retrieval object; and generating knowledge reply content matching the conversation information based on the knowledge information.
[0030] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, disclosure and application of user personal information involved comply with the provisions of relevant laws and regulations, take necessary confidentiality measures, and do not violate public order and good morals.
[0031] In the technical solution of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0032] Figure 1 An exemplary system architecture to which the retrieval method and device according to an embodiment of the present disclosure can be applied is schematically shown.
[0033] It should be noted that Figure 1 The examples shown are only examples of system architectures to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but do not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios. For example, in another embodiment, the exemplary system architecture to which the method and apparatus for generating a conversation can be applied may include a terminal device, but the terminal device may implement the method and apparatus for generating a conversation provided by the embodiments of the present disclosure without interacting with the server.
[0034] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0035] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software, etc. (only as examples).
[0036] The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting receiving conversation statements in the form of text or voice, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, smart speakers, smart wearable devices, or robots, etc.
[0037] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for dialogue statements input by users using the terminal devices 101, 102, and 103. The background management server may analyze and process dialogue information such as received dialogue statements and output dialogue statements, and feed back knowledge reply content to the terminal device.
[0038] It should be noted that the dialog generation method provided in the embodiment of the present disclosure can generally be executed by the terminal device 101, 102, or 103. Accordingly, the dialog generation device provided in the embodiment of the present disclosure can also be set in the terminal device 101, 102, or 103.
[0039] Alternatively, the conversation generation method provided in the embodiment of the present disclosure may also be generally executed by the server 105. Accordingly, the conversation generation device provided in the embodiment of the present disclosure may generally be arranged in the server 105. The conversation generation method provided in the embodiment of the present disclosure may also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the conversation generation device provided in the embodiment of the present disclosure may also be arranged in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.
[0040] For example, when a user sends a dialogue message in the form of voice, the terminal devices 101, 102, and 103 can obtain the dialogue message input by the user, and then send the obtained dialogue message to the server 105, and the server 105 generates search information based on the dialogue information, extracts the search object in the search information, determines the knowledge information matching the search information from the data source matching the search object, and generates knowledge reply content matching the dialogue message based on the knowledge information. The knowledge reply content is sent to the terminal devices 101, 102, and 103 as the feedback result of the human-computer interaction. Alternatively, a server or server cluster that can communicate with the terminal devices 101, 102, 103 and / or the server 105 analyzes the dialogue message and finally obtains the knowledge reply content.
[0041] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0042] It should be noted that the sequence numbers of the operations in the following method are only used as representations of the operations for the purpose of description, and should not be regarded as representing the execution order of the operations. Unless explicitly stated, the method does not need to be executed completely in the order shown.
[0043] Figure 2 The flowchart of the dialogue generation method according to the embodiment of the present disclosure is schematically shown.
[0044] like Figure 2 As shown, the method includes operations S210 to S240.
[0045] In operation S210, retrieval information is generated based on the conversation information.
[0046] In operation S220, a search object in the search information is extracted.
[0047] In operation S230, knowledge information matching the search information is determined from data sources matching the search object.
[0048] In operation S240, knowledge reply content matching the dialogue information is generated based on the knowledge information.
[0049] According to the embodiments of the present disclosure, dialogue information can be divided into voice information or text information based on information type; can be divided into information output by the user based on source, or can be a combination of information output by the user and information output by the terminal device during the human-computer interaction process; can be divided into dialogue information of one round of dialogue based on data volume, or can be dialogue information of multiple rounds of dialogue.
[0050] According to the embodiments of the present disclosure, the search information may include a portion of information in the conversation information, such as keywords and phrases, but is not limited thereto, and may also be information related to the conversation information, as long as it is search information that can promote and guide the conversation to proceed in depth.
[0051] According to an embodiment of the present disclosure, knowledge information may be domain knowledge information related to the dialogue information, for example, information that can only be obtained by retrieving information, querying a knowledge graph or searching a database.
[0052] According to the embodiments of the present disclosure, data sources can be used to store data and query data. Data sources may include internal knowledge bases and external knowledge bases, etc. An internal knowledge base may refer to a self-constructed database or knowledge graph. An external knowledge base may refer to a database, knowledge graph, or search engine, etc. provided by an external channel such as a third party. Internal knowledge bases and data sources of the types of databases, knowledge graphs, etc. in external knowledge bases can support the retrieval and acquisition of knowledge information with relatively low timeliness requirements, and the information in data sources of the types of databases, knowledge graphs, etc. in internal knowledge bases and external knowledge bases can be updated periodically. The search engine in the external knowledge base can support the retrieval and acquisition of knowledge information with relatively high timeliness requirements, and the relevant information in the search engine can be updated in real time.
[0053] According to an embodiment of the present disclosure, a search object can be extracted from the search information, and a data source can be matched based on the search object. The search object can refer to an object involved in the search information, specifically, it can be a search object contained in the search information, or it can be a search object inferred from the search information. The search object can include objects related to effectiveness, such as dynamic objects with high effectiveness and static objects with low effectiveness. According to the type of the search object, a data source that matches the type of the search object can be determined.
[0054] For example, if the search object is a static object, such as a search object related to laws, calculation formulas, and common sense, you can use ANN (Approximate Nearest Neighbor) or ES (ElasticSearch) algorithms to query the database based on the search information to obtain knowledge information with relatively low timeliness requirements.
[0055] For example, if the search object is a dynamic object, such as a search object related to weather, news, current affairs, etc., a query can be performed from a search engine based on the search information to obtain knowledge information with relatively high timeliness requirements.
[0056] According to the embodiments of the present disclosure, using multiple data sources of different types to provide knowledge information can make the knowledge information in various forms; in addition, using data sources that match the search object to search and obtain knowledge information can make the generation of knowledge information flexible and intelligent.
[0057] According to the embodiments of the present disclosure, knowledge information can be directly used as knowledge reply content to reply to the dialogue information. For example, the knowledge information and the knowledge reply content can both be "the most popular song of singer AA is BB". It can also be based on the knowledge information, and the knowledge reply content is generated by reprocessing. For example, the knowledge information is "the most popular song of singer AA is BB", and the knowledge reply content is "singer AA has sung many songs, among which song BB is the most popular".
[0058] The dialogue generation method provided by the embodiment of the present disclosure can be applied to the field of knowledge dialogue, and retrieval information can be obtained from the dialogue information. Based on the retrieval information, knowledge information with a strong correlation with the dialogue information is generated, so that the knowledge reply content is consistent with the knowledge, while improving the dialogue quality and intelligence of human-computer interaction.
[0059] Figure 3A The flowchart of the dialogue generation method according to the embodiment of the present disclosure is schematically shown.
[0060] like Figure 3A As shown, the language processing model is used to process the dialogue information 310 to generate the search information 320. The data source 330 matching the search object is used to determine the knowledge information 340 matching the search information 320. The language processing model is used to generate the knowledge reply content 350 matching the dialogue information 310 based on the knowledge information 340.
[0061] Figure 3B The flowchart of the dialog generation method according to another embodiment of the present disclosure is schematically shown.
[0062] like Figure 3B As shown, the language processing model is used to process the dialogue information 310 to generate the search information 320. The data source 330 matching the search object is used to determine the knowledge information 340 matching the search information 320. The language processing model is used to generate the knowledge reply content 350 matching the dialogue information 310 based on the knowledge information 340. The language processing model is also used to process the dialogue information 310 to generate the general reply content 360. Based on the knowledge reply content 350 and the general reply content 360, the target reply content 370 is determined.
[0063] According to an embodiment of the present disclosure, based on the knowledge reply content and the general reply content, determining the target reply content may include: based on the confidence of each of the knowledge reply content and the general reply content, the one with higher confidence may be used as the target reply content. However, it is not limited to this. The knowledge reply content and the general reply content may also be fused to generate the target reply content. For example, the knowledge reply content includes "the most popular song of singer AA is BB". The general reply content may include "it's a pity that singer AA hasn't released a new album for a long time". The target reply content generated by fusion processing of the knowledge reply content and the general reply content may include "the singer AA hasn't released a new album for a long time, and the most popular song is BB".
[0064] According to other embodiments of the present disclosure, a language processing model can also be used to automatically learn the characteristics of target reply content that matches the dialogue information through a training process, and automatically generate knowledge reply content as the target reply content for the dialogue information, or automatically generate general reply content as the target reply content.
[0065] By using the language processing model provided by the embodiment of the present disclosure to automatically generate target reply content based on dialogue information, flexible switching between the two methods of generating target reply content can be achieved, so that the use of general reply content is fast while the use of knowledge reply content is of high quality.
[0066] According to an embodiment of the present disclosure, the language processing model may include the open dialogue model PLATO or a derivative model of the open dialogue model PLATO, such as PLATO-XL, PLATO-2, etc., but is not limited thereto and may also be other neural network models with encoding and decoding functions.
[0067] According to the embodiments of the present disclosure, the language processing model uses PLATO-XL to simultaneously perform joint modeling of dialogue understanding based on dialogue information to generate retrieval information and reply generation based on knowledge information to generate knowledge reply content. It can also simultaneously perform joint modeling of dialogue understanding based on dialogue information to generate retrieval information, first reply generation based on knowledge information to generate knowledge reply content, and second reply generation based on dialogue information to generate general reply content, so that the model parameters are cost-effective. In addition, by adopting a flexible attention mechanism in the language processing model, dialogue information can be bidirectionally encoded to fully utilize and understand dialogue information. The knowledge information used to generate knowledge reply content or the dialogue information used to generate general reply content is unidirectionally decoded to adapt to the autoregressive characteristics of reply generation.
[0068] According to an embodiment of the present disclosure, with respect to operation S220, determining knowledge information matching the search information may include the following operations.
[0069] For example, when a search engine is used as a data source to determine knowledge information based on search information, multiple candidate knowledge information can be obtained at the same time. In this case, multiple candidate knowledge information matching the search information can be determined. Based on the click-through rates of each of the multiple candidate knowledge information, the knowledge information is determined from the multiple candidate knowledge information. The candidate knowledge information with the highest click-through rate can be determined as the knowledge information.
[0070] According to an embodiment of the present disclosure, the click rate may be data of click rates obtained in combination with multiple users within a predetermined time period.
[0071] According to other embodiments of the present disclosure, knowledge information can be determined from multiple candidate knowledge information, and the target user's attention to the multiple candidate knowledge information can also be determined to obtain multiple attention results. The multiple attention results can correspond one-to-one to the multiple candidate knowledge information. The target user can be a user who participates in the generation of dialogue information. Based on the multiple attention results, the knowledge information is determined from the multiple candidate knowledge information. The candidate knowledge information with the highest attention result can be determined as the knowledge information. However, it is not limited to this. In the case where multiple candidate knowledge information is displayed in the form of a list, the candidate knowledge information ranked first can be used as the knowledge information.
[0072] According to an embodiment of the present disclosure, knowledge information is determined from multiple candidate knowledge information based on click-through rate or based on the attention of the target user, so that the knowledge reply content can be more in line with the interests of the target user and the human-computer interaction can meet personalized needs.
[0073] Figure 4 The flowchart of the training method of the model for dialogue generation according to the embodiment of the present disclosure is schematically shown.
[0074] like Figure 4 As shown, the method includes operations S410 to S450.
[0075] In operation S410, sample search information is generated based on sample conversation information of a training sample. The training sample also includes sample reference reply content that matches the sample conversation information.
[0076] In operation S420, a search object in the sample search information is extracted.
[0077] In operation S430, sample knowledge information matching the sample search information is determined from data sources matching the search object.
[0078] In operation S440, sample knowledge reply content is generated based on the sample knowledge information.
[0079] In operation S450, the deep learning model is trained using the sample knowledge reply content and the sample reference reply content to obtain a language processing model.
[0080] According to an embodiment of the present disclosure, a training sample may be obtained from an open source corpus, and any content including a conversation may be used as a training sample. A training sample may include sample conversation information and sample reference reply content connected with the sample conversation information. Taking the topic of discussing the weather as a training sample, the sample conversation information may include "Xiao M said: The weather is nice today. Xiao N said: The weather is nice now, but the weather forecast reports that it will rain today. Xiao M said: Really? Then what time will it start to rain?". The sample reference reply content that matches the sample conversation information may be "The forecast is around 3 to 5 pm, with moderate to light rain."
[0081] According to the embodiments of the present disclosure, the sample reference reply content can be used as a label, and the sample knowledge reply content can be used as the dialogue context output by the model. The sample reference reply content is used as a standard to train the deep learning model, so that the dialogue context output by the trained deep learning model is close to the standard sample reference reply content, thereby obtaining a language processing model.
[0082] According to other embodiments of the present disclosure, the deep learning model may also rely on manual annotation for supervised training. For example, training samples with strong correlation with the knowledge dialogue type are generated by manual annotation.
[0083] According to the embodiments of the present disclosure, compared with the supervised training method relying on manual annotation, the training method of the model for dialogue generation provided by the embodiments of the present disclosure can use non-manually annotated training samples, thereby saving costs. Furthermore, the training samples are not restricted by the annotated data, so that the data volume of the training samples is sufficient and diverse, thereby improving the generalization ability of the model.
[0084] Figure 5A A flowchart of adjusting parameters of a deep learning model according to an embodiment of the present disclosure is schematically shown.
[0085] like Figure 5A As shown, the sample dialogue information 510 can be input into the deep learning model 520 to obtain the sample knowledge reply content 530. For example, using the deep learning model, sample retrieval information is generated based on the sample dialogue information, sample knowledge information is determined, and sample knowledge reply content is generated based on the sample knowledge information. A first target matching degree 550 between the sample knowledge reply content 530 and the sample reference reply content 540 is determined. The parameters of the deep learning model 520 are adjusted based on the first target matching degree 550 to obtain a language processing model.
[0086] According to an embodiment of the present disclosure, a reinforcement learning training method can be used to determine a reward value based on the first target matching degree, and adjust the parameters of the deep learning model based on the reward value until the reward value meets a predetermined condition. For example, the reward value meets a predetermined reward threshold, or the number of parameter adjustment rounds reaches a predetermined parameter adjustment round threshold.
[0087] Figure 5B A flowchart of adjusting parameters of a deep learning model according to another embodiment of the present disclosure is schematically shown.
[0088] like Figure 5B As shown, the sample conversation information 510 can be input into the deep learning model 520 to obtain the sample knowledge reply content 530 and the sample general reply content 560. The deep learning model is trained using the sample knowledge reply content 530, the sample general reply content 560 and the sample reference reply content 540 to obtain a language processing model.
[0089] like Figure 5B As shown, using sample knowledge reply content, sample general reply content and sample reference reply content, training a deep learning model to obtain a language processing model includes: determining a first matching degree 550 between sample knowledge reply content 530 and sample reference reply content 540. Determining a second matching degree 570 between sample general reply content 560 and sample reference reply content 540. Determining a second target matching degree 580 from the first matching degree 550 and the second matching degree 570. Adjusting the parameters of the deep learning model 520 based on the second target matching degree 580 to obtain a language processing model.
[0090] According to an embodiment of the present disclosure, the content type of the sample knowledge reply content includes at least one of the following: link, image, text. The content type of the sample knowledge reply content is determined. A first matching degree or a first target matching degree between the sample knowledge reply content and the sample reference reply content is determined using a correlation determination method that matches the content type.
[0091] For example, when it is determined that the content type of the sample knowledge reply content is an image, the image feature extraction method can be used to process the sample knowledge reply content and the sample reference reply content respectively, and obtain two image feature vectors corresponding to the sample knowledge reply content and the sample reference reply content. The feature similarity between the two image feature vectors is calculated as the first target matching degree.
[0092] For example, when it is determined that the content type of the sample knowledge reply content is text, a cross-encoder can be used to process the sample knowledge reply content and the sample reference reply content to obtain the semantic similarity between the sample knowledge reply content and the sample reference reply content. However, it is not limited to this. When it is determined that the content type of the sample knowledge reply content is text, Unigram-F1 (unary word segmentation), BLEU (Bilingual Evaluation Understudy) and other word overlap-based calculation methods can also be used to determine the co-occurrence word frequency between the sample knowledge reply content and the sample reference reply content.
[0093] For example, when it is determined that the content type of the sample knowledge reply content is a link, content related to the link, such as text or an image, can be obtained based on the link, and the first target matching degree can be determined according to the above-mentioned semantic similarity, feature similarity, and co-occurrence word frequency determination method.
[0094] According to an embodiment of the present disclosure, the first matching degree and the second matching degree are determined in the same manner as the first target matching degree. The first target matching degree, the first matching degree, and the second matching degree may each include at least one of the following: semantic similarity, feature similarity, and co-occurrence word frequency.
[0095] According to an embodiment of the present disclosure, determining the second target matching degree from the first matching degree and the second matching degree may include: taking the larger value of the first matching degree and the second matching degree as the second target matching degree.
[0096] According to an embodiment of the present disclosure, a reinforcement learning training method can be used to determine a reward value based on the second target matching degree, and adjust the parameters of the deep learning model based on the reward value until the reward value meets a predetermined condition. For example, the reward value meets a predetermined reward threshold, or the number of parameter adjustment rounds reaches a predetermined parameter adjustment round threshold.
[0097] According to an embodiment of the present disclosure, with respect to operation S420, determining sample knowledge information matching the sample retrieval information may include the following operations.
[0098] For example, multiple sample candidate knowledge information matching the sample search information is determined. Based on the click-through rates of the multiple sample candidate knowledge information, the sample knowledge information is determined from the multiple sample candidate knowledge information. The sample candidate knowledge information with the highest click-through rate can be determined as the sample knowledge information. The click-through rate can be data of click-through rates obtained by combining multiple users within a predetermined time period.
[0099] For another example, multiple sample candidate knowledge information matching the sample retrieval information is determined. Sample target users' sample attention to multiple sample candidate knowledge information is determined to obtain multiple sample attention results. Sample target users are users who participate in the generation of sample conversation information. Based on multiple sample attention results, sample knowledge information is determined from multiple sample candidate knowledge information. The sample candidate knowledge information with the highest sample attention result can be determined as the sample knowledge information. However, this is not limited to this. When multiple sample candidate knowledge information is displayed in the form of a list, the sample candidate knowledge information ranked first can be used as the sample knowledge information.
[0100] According to an embodiment of the present disclosure, sample knowledge information is determined from multiple sample candidate knowledge information based on click-through rate or based on the attention of the target user, so that the knowledge reply content output by the language processing model can be more in line with the interests of the target user, so that human-computer interaction meets personalized needs.
[0101] Figure 6 The flowchart of a dialog generation method according to another embodiment of the present disclosure is schematically shown.
[0102] like Figure 6 As shown, the method includes operation S610.
[0103] In operation S610, the dialogue information is input into a language processing model to obtain knowledge reply content matching the dialogue information.
[0104] According to an embodiment of the present disclosure, the language processing model is trained using a training method for a model for dialogue generation.
[0105] The dialogue generation method provided by the embodiment of the present disclosure can be applied to the field of knowledge dialogue to generate knowledge information that is highly correlated with the dialogue information as knowledge reply content. In addition, the knowledge reply content is generated based on the dialogue information using a language processing model, and the training samples used to train the language processing model do not need to be manually labeled, which increases the application scope of the language processing model and improves its generalization ability, thereby expanding the subject scope of human-computer interaction and making human-computer interaction more intelligent and smooth.
[0106] Figure 7 A block diagram of a dialog generation device according to an embodiment of the present disclosure is schematically shown.
[0107] like Figure 7 As shown, the dialogue generating device 700 may include: a first generating module 710 , an extracting module 720 , a retrieving module 730 , and a second generating module 740 .
[0108] The first generating module 710 is used to generate search information based on the dialogue information.
[0109] The extraction module 720 is used to extract the search object in the search information.
[0110] The retrieval module 730 is used to determine knowledge information matching the retrieval information from data sources matching the retrieval object.
[0111] The second generating module 740 is used to generate knowledge reply content matching the dialogue information based on the knowledge information.
[0112] According to an embodiment of the present disclosure, the dialogue generating device further includes: a third generating module, and a determining module.
[0113] The third generation module is used to generate general reply content based on the dialogue information.
[0114] The determination module is used to determine the target response content based on the knowledge response content and the general response content.
[0115] According to an embodiment of the present disclosure, the retrieval module includes: a first determining unit and a second determining unit.
[0116] The first determining unit is used to determine a plurality of candidate knowledge information matching the search information.
[0117] The second determining unit is used to determine the knowledge information from the plurality of candidate knowledge information based on the click rates of the plurality of candidate knowledge information.
[0118] Figure 8 A block diagram of a training device for a model for dialogue generation according to an embodiment of the present disclosure is schematically shown.
[0119] like Figure 8 As shown, the training device 800 for the model of dialogue generation may include: a first sample generation module 810, a sample extraction module 820, a sample retrieval module 830, a second sample generation module 840, and a training module 850.
[0120] The first sample generating module 810 is used to generate sample retrieval information based on sample conversation information of a training sample, wherein the training sample also includes sample reference reply content matching the sample conversation information.
[0121] The sample extraction module 820 is used to extract the search object in the sample search information.
[0122] The sample retrieval module 830 is used to determine sample knowledge information that matches the sample retrieval information.
[0123] The second sample generation module 840 is used to generate sample knowledge reply content based on sample knowledge information from a data source matching the search object.
[0124] The training module 850 is used to train the deep learning model using the sample knowledge reply content and the sample reference reply content to obtain the language processing model.
[0125] According to an embodiment of the present disclosure, the training module includes: a matching degree determination unit and a parameter adjustment unit.
[0126] The matching degree determination unit is used to determine a first target matching degree between the sample knowledge reply content and the sample reference reply content.
[0127] A parameter adjustment unit is used to adjust the parameters of the deep learning model based on the first target matching degree to obtain a language processing model.
[0128] According to an embodiment of the present disclosure, the matching degree determination unit includes: a type determination subunit and a correlation determination subunit.
[0129] The type determination subunit is used to determine the content type of the sample knowledge reply content.
[0130] The relevance determination subunit is used to determine a first target matching degree between the sample knowledge reply content and the sample reference reply content by adopting a relevance determination method that matches the content type.
[0131] According to an embodiment of the present disclosure, the deep learning model may further include: a third sample generation module.
[0132] The third sample generation module is used to obtain sample general reply content based on the sample conversation information.
[0133] According to an embodiment of the present disclosure, the training module includes: a training unit.
[0134] The training unit is used to train the deep learning model using the sample knowledge response content, the sample general response content and the sample reference response content to obtain the language processing model.
[0135] According to an embodiment of the present disclosure, the training unit includes: a first determination subunit, a second determination subunit, a third determination subunit, and a parameter adjustment subunit.
[0136] The first determination subunit is used to determine a first matching degree between the sample knowledge reply content and the sample reference reply content.
[0137] The second determination subunit is used to determine a second matching degree between the sample general reply content and the sample reference reply content.
[0138] The third determining subunit is configured to determine a second target matching degree from the first matching degree and the second matching degree.
[0139] The parameter adjustment subunit is used to adjust the parameters of the deep learning model based on the second target matching degree to obtain a language processing model.
[0140] According to an embodiment of the present disclosure, the first target matching degree includes at least one of the following: semantic similarity, feature similarity, and co-occurrence word frequency.
[0141] According to an embodiment of the present disclosure, the content type includes at least one of the following: a link, an image, and a text.
[0142] According to an embodiment of the present disclosure, the sample retrieval module includes: a first sample determination unit and a second sample determination unit.
[0143] The first sample determination unit is used to determine a plurality of sample candidate knowledge information matching the sample retrieval information.
[0144] The second sample determination unit is used to determine the sample knowledge information from the plurality of sample candidate knowledge information based on the click-through rates of the plurality of sample candidate knowledge information.
[0145] Fig. 9 A block diagram of a dialog generating device according to another embodiment of the present disclosure is schematically shown.
[0146] like Fig. 9 As shown, the dialogue generation device 900 includes: a dialogue generation module 910.
[0147] The dialogue generation module 910 is used to input the dialogue information into the language processing model to obtain knowledge response content that matches the dialogue information.
[0148] According to an embodiment of the present disclosure, the language processing model is trained using a training device for a model for dialogue generation.
[0149] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0150] According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a method as in the embodiment of the present disclosure.
[0151] According to an embodiment of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute a method as described in an embodiment of the present disclosure.
[0152] According to an embodiment of the present disclosure, a computer program product includes a computer program, and when the computer program is executed by a processor, the method according to the embodiment of the present disclosure is implemented.
[0153] Fig.10 A schematic block diagram of an example electronic device 1000 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0154] like Fig.10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0155] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0156] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above, such as a dialog generation method, or a training method for a model for dialog generation. For example, in some embodiments, the dialog generation method, or the training method for a model for dialog generation may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the dialog generation method or the training method for a model for dialog generation described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute the dialog generation method, or the training method of the model for dialog generation, in any other appropriate manner (eg, by means of firmware).
[0157] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0158] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0159] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0160] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0161] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0162] A computer system may include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises through computer programs running on respective computers and having a client-server relationship to each other. The server may be a cloud server, a server in a distributed system, or a server combined with a blockchain.
[0163] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0164] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating a dialogue, comprising: Input the dialogue information into the dialogue understanding branch of the language processing model to generate retrieval information; Extracting a search object from the search information; Determining knowledge information matching the search information from data sources matching the search object; Inputting the knowledge information into the first response generation branch of the language processing model to generate knowledge response content matching the dialogue information; Inputting the dialogue information into the second reply generation branch of the language processing model to generate general reply content; as well as Based on the knowledge reply content and the general reply content, target reply content is determined.
2. The method according to claim 1, wherein: The determining of the knowledge information matching the search information comprises: determining a plurality of candidate knowledge information matching the search information; and The knowledge information is determined from the plurality of candidate knowledge information based on the click rates of the respective plurality of candidate knowledge information.
3. A method for training a model for dialogue generation, comprising: Inputting sample conversation information of the training sample into the conversation understanding branch of the language processing model to generate sample retrieval information, wherein the training sample also includes sample reference reply content matching the sample conversation information; Extracting the search object in the sample search information; Determining sample knowledge information matching the sample search information from data sources matching the search object; Inputting the sample knowledge information into the first response generation branch of the language processing model to generate sample knowledge response content; Inputting the sample dialogue information into the second reply generation branch of the language processing model to obtain sample general reply content; and The sample knowledge response content, the sample general response content and the sample reference response content are used to train a deep learning model to obtain a language processing model.
4. The method according to claim 3, wherein: The using the sample knowledge reply content, the sample general reply content and the sample reference reply content to train the deep learning model to obtain the language processing model comprises: Determining a first degree of match between the sample knowledge response content and the sample reference response content; Determining a second degree of match between the sample universal reply content and the sample reference reply content; Determining a second target matching degree from the first matching degree and the second matching degree; and The parameters of the deep learning model are adjusted based on the second target matching degree to obtain the language processing model.
5. The method according to claim 4, wherein: Determining a first matching degree between the sample knowledge reply content and the sample reference reply content includes: Determining the content type of the sample knowledge response content; and The first matching degree between the sample knowledge reply content and the sample reference reply content is determined by adopting a correlation determination method that matches the content type.
6. The method according to claim 5, in, The first matching degree includes at least one of the following: semantic similarity, feature similarity, and co-occurrence frequency; The content type includes at least one of the following: link, image, and text.
7. The method according to any one of claims 3 to 6, wherein: The determining of the sample knowledge information matching the sample search information includes: Determining a plurality of sample candidate knowledge information matching the sample search information; and The sample knowledge information is determined from the plurality of sample candidate knowledge information based on the click rates of the respective plurality of sample candidate knowledge information.
8. A method for generating a dialogue, comprising: Input the dialogue information into the language processing model to obtain knowledge response content matching the dialogue information. Wherein, the language processing model is trained using the method according to any one of claims 3 to 7.
9. A dialogue generation device, comprising: A first generation module, used to input the dialogue information into the dialogue understanding branch of the language processing model to generate retrieval information; An extraction module, used for extracting the search object in the search information; A retrieval module, used to determine knowledge information matching the retrieval information from data sources matching the retrieval object; A second generation module is used to input the knowledge information into the first response generation branch of the language processing model to generate knowledge response content matching the dialogue information; A third generation module, used for inputting the dialogue information into the second reply generation branch of the language processing model to generate a general reply content; as well as A determination module is used to determine target reply content based on the knowledge reply content and the general reply content.
10. The device according to claim 9, wherein: The retrieval module comprises: A first determining unit, configured to determine a plurality of candidate knowledge information matching the search information; and The second determining unit is used to determine the knowledge information from the plurality of candidate knowledge information based on the click rates of the plurality of candidate knowledge information.
11. A training device for a model for dialogue generation, comprising: A first sample generation module, configured to input sample dialogue information of a training sample into a dialogue understanding branch of a language processing model to generate sample retrieval information, wherein the training sample also includes sample reference reply content matching the sample dialogue information; A sample extraction module, used to extract the search object in the sample search information; A sample retrieval module, used to determine sample knowledge information matching the sample retrieval information from a data source matching the retrieval object; A second sample generation module, used for inputting the sample knowledge information into the first reply generation branch of the language processing model to generate sample knowledge reply content; A third sample generation module is used to input the sample dialogue information into the second reply generation branch of the language processing model to obtain a sample general reply content; and The training module is used to train a deep learning model using the sample knowledge response content, the sample general response content and the sample reference response content to obtain a language processing model.
12. The device according to claim 11, wherein The training module includes: A first determination subunit, configured to determine a first matching degree between the sample knowledge reply content and the sample reference reply content; A second determination subunit, configured to determine a second matching degree between the sample universal reply content and the sample reference reply content; A third determining subunit is configured to determine a second target matching degree from the first matching degree and the second matching degree; and A parameter adjustment subunit is used to adjust the parameters of the deep learning model based on the second target matching degree to obtain the language processing model.
13. The device according to claim 12, wherein: The first determining subunit is further configured to: Determining the content type of the sample knowledge response content; and The first matching degree between the sample knowledge reply content and the sample reference reply content is determined by adopting a correlation determination method that matches the content type.
14. The device according to claim 13, in, The first matching degree includes at least one of the following: semantic similarity, feature similarity, and co-occurrence frequency; The content type includes at least one of the following: link, image, and text.
15. The device according to any one of claims 11 to 14, wherein: The sample retrieval module comprises: A first sample determination unit, configured to determine a plurality of sample candidate knowledge information matching the sample search information; and The second sample determination unit is configured to determine the sample knowledge information from the plurality of sample candidate knowledge information based on the click-through rates of the plurality of sample candidate knowledge information.
16. A dialogue generating device, comprising: The dialogue generation module is used to input the dialogue information into the language processing model to obtain the knowledge response content matching the dialogue information. Wherein, the language processing model is trained using the device according to any one of claims 11 to 15.
17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 8.
19. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Deep question-and-answer service providing method and device based on artificial intelligence
CN105159996A
Voice recognition method and device, computer device and storage medium
CN110265013A
Reply text prediction method and device, equipment and storage medium
CN112905755A
Multi-robot dialogue management method, device, equipment and medium
CN113868404A