WO2018223992A1 - 一种对话生成方法、装置以及电子设备 - Google Patents

一种对话生成方法、装置以及电子设备 Download PDF

Info

Publication number
WO2018223992A1
WO2018223992A1 PCT/CN2018/090138 CN2018090138W WO2018223992A1 WO 2018223992 A1 WO2018223992 A1 WO 2018223992A1 CN 2018090138 W CN2018090138 W CN 2018090138W WO 2018223992 A1 WO2018223992 A1 WO 2018223992A1
Authority
WO
WIPO (PCT)
Prior art keywords
topic
sequence
model
vector corresponding
training
Prior art date
Application number
PCT/CN2018/090138
Other languages
English (en)
French (fr)
Inventor
常晓夫
巢林林
徐鹏
李小龙
Original Assignee
阿里巴巴集团控股有限公司
常晓夫
巢林林
徐鹏
李小龙
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司, 常晓夫, 巢林林, 徐鹏, 李小龙 filed Critical 阿里巴巴集团控股有限公司
Priority to EP18814267.3A priority Critical patent/EP3620940A4/en
Priority to SG11201911535SA priority patent/SG11201911535SA/en
Publication of WO2018223992A1 publication Critical patent/WO2018223992A1/zh
Priority to US16/704,358 priority patent/US11354512B2/en
Priority to US16/778,995 priority patent/US10747959B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/088Non-supervised learning, e.g. competitive learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N7/00Computing arrangements based on specific mathematical models
    • G06N7/01Probabilistic graphical models, e.g. probabilistic networks

Definitions

  • the present application relates to the field of computer software technologies, and in particular, to a dialog generation method, apparatus, and electronic device.
  • the dialogue assistant can talk to the user based on voice or text, to answer questions raised by the user, or simply chat with the user.
  • the question and answer of the dialogue process is regarded as the mapping of the problem language symbol sequence to the answer language symbol sequence, using the maximum likelihood estimation as the loss function, and using a large number of artificial dialogue data pairs based on sequence to sequence (sequence)
  • the dialog model of to sequence, seq2seq) is trained so that the dialog model learns the mapping relationship between the problem language symbol sequence and the answer language symbol sequence, and the dialogue can be automatically generated by the trained dialog model, thereby implementing the dialog assistant.
  • the embodiment of the present application provides a dialog generation method, an apparatus, and an electronic device, which are used to solve the following technical problem: the prior art is susceptible to high-frequency reply sentences without topic information in the dialog model training, resulting in training in actual use. Models also tend to produce these low-quality, meaningless responses.
  • a dialogue is generated using the trained dialog model.
  • the training module trains the sequence-to-sequence-based dialog model by using a loss function including topic range constraint information
  • a generation module is utilized to generate a conversation using the trained conversation model.
  • At least one processor and,
  • the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
  • a dialogue is generated using the trained dialog model.
  • the embodiment of the present application can achieve the following beneficial effects: by using a loss function including topic range constraint information, the topic range constraint information is introduced in the dialog model training process, thereby facilitating avoidance of the trained model output. Low quality meaningless replies, therefore, the problems in the prior art can be partially or completely solved.
  • FIG. 1 is a schematic flowchart of a dialog generating method according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of a sequence-to-sequence-based dialog model
  • FIG. 3 is a schematic diagram of a specific implementation manner of a dialog model training in the method of FIG. 1 according to an embodiment of the present application;
  • FIG. 4 is a schematic flowchart diagram of the principle in FIG. 3 according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a dialog generating apparatus corresponding to FIG. 1 according to an embodiment of the present application.
  • the embodiment of the present application provides a dialog generation method, device, and electronic device.
  • the present application trains a sequence-to-sequence-based dialog model to avoid training based on the viewpoint of topic reply consistency, using a loss function including topic range constraint information.
  • the model generates a low-quality meaningless dialogue; wherein the topic range constraint information may specifically be at least part of a formula included in the loss function, and the at least part of the formula is hereinafter referred to as a topic range constraint function.
  • topic reply mainly refers to: in real human conversations, the conversations of chat participants are often the same or related, and the scope of the topic of the reply is also limited.
  • A refers to weather-related discourse
  • B is more reasonable to reply to weather-related topics, and generally does not respond to content that has nothing to do with the weather topic, such as "How is this mobile phone?"
  • the dialogue model is generally used to simulate real humans to talk to the user, if the conversation model can follow the topic reply consistency to generate a dialogue, it will be a better experience for the user. .
  • FIG. 1 is a schematic flowchart diagram of a dialog generating method according to an embodiment of the present application.
  • the execution body of the process can be a program on the server or on the terminal, such as a model training program, a dialog assistant application, an instant messaging application, and the like.
  • the execution subject of the process includes, but is not limited to, at least one of the following devices that can serve as a server or a terminal: a mobile phone, a tablet, a smart wearable device, a vehicle, a personal computer, a medium computer, a computer cluster, and the like.
  • the process in Figure 1 can include the following steps:
  • the topic range constraint information may be one or more parameters related to the conversation topic in the loss function, or may be at least part of the formula related to the topic in the loss function.
  • the topic range constraint information included in the loss function also has corresponding parameters for the parameter adjustment of the dialog model.
  • the effect is such that the content of the output sequence of the trained dialog model is also constrained accordingly.
  • This constraint may have two effects: the first layer, such that the output sequence contains topic information, rather than a low-quality meaningless dialogue; the second layer, such that the output sequence has a topic reply with the input sequence of the corresponding dialog model consistency.
  • the step S102 may be an action in the process of the dialogue model training, or may be an action in actual use after the session model is completed.
  • the dialog model receives the statement input by the user and outputs a reply statement; or the dialog model may output a reply statement based on the preset or automatically generated input statement; or the dialog model may directly output the preset statement without depending on the input statement. ;and many more.
  • the execution subject of the actions involved in FIG. 1 may be the same device or the same program, or may be different devices or different programs.
  • the execution bodies of steps S101 to S102 are all dialog assistant applications;
  • the execution subject of step S101 is a model training program, and the execution subject of step S102 is a dialog assistant application;
  • the topic range constraint information is introduced in the dialog model training process, thereby facilitating the avoidance of the trained model to produce a low-quality meaningless reply, and thus, it is possible to partially Or solve the problems in the prior art in whole or in part.
  • the embodiment of the present application further provides some specific implementation manners of the method, and an extended solution, which will be described below.
  • Figure 2 is a schematic diagram of the principle of a sequence-to-sequence based conversation model.
  • the dialog model in Figure 2 contains two Long Short-Term Memory (LSTM) recurrent neural networks, the first as the encoder, which is responsible for processing the input conversation word sequence X, and the second as the decoder, responsible for generating the reply.
  • the word sequence Y in practical applications, the loss function of the sequence-to-sequence dialogue model (ie, the objective function) usually adopts Maximum Likelihood Estimate (MLE), as shown in the following formula 1:
  • the topic range constraint function may be added on the basis of the formula 1, and then used to train the dialog model in FIG. 2.
  • the formula 1 may be replaced accordingly. .
  • the maximum likelihood estimation is still taken as an example and will be described with reference to FIG. 3.
  • FIG. 3 is a schematic diagram of a specific implementation of a dialog model training in the method of FIG. 1 according to an embodiment of the present disclosure. It can be seen that compared to FIG. 2, the topic range constraint function and the corresponding loss calculation action are added in FIG. 3, and the principle in FIG. 3 is explained below.
  • FIG. 4 is a schematic flowchart diagram of the principle in FIG. 3 according to an embodiment of the present application.
  • the generalization process is mainly divided into five parts:
  • the first topic vector corresponding to the reply word sequence Y is determined (represented as: );
  • the first similarity and the second similarity are substituted into a loss function including a topic range constraint function, the loss is calculated, and the dialog model is adjusted according to the loss.
  • the topic model is trained unsupervised using the dialogue training corpus.
  • the topic model can be, for example, an LDA (Latent Dirichlet Allocation) model or a Kmeans model.
  • LDA Topic Dirichlet Allocation
  • Kmeans Kmeans model.
  • a plurality of topics can be extracted from the dialog training corpus, and a plurality of topic vectors are correspondingly generated, which are called first topic vectors, and each first topic vector represents a topic, and the topic ID can be used.
  • a topic vector is identified.
  • the first topic vector may be a dense vector similar to word embedding, wherein the word embedding refers to converting a word into a word vector.
  • the first topic vector corresponding to the reply word sequence Y can be obtained. Assuming that there is only one central meaning in one sentence, Y only corresponds to one topic ID, and correspondingly only one first topic vector.
  • Y is subjected to the pooling process of the implicit state output data of each step of the LSTM modeling, and then transformed by the Multi-layer Perceptron (MLP).
  • MLP Multi-layer Perceptron
  • Another topic vector of Y represents a second topic vector called Y.
  • the multi-layer perceptron may specifically be a multi-layer neural network, such as a fully connected deep neural network (DNN).
  • the second topic vector corresponding to Y should be similar in the semantic space to the first topic vector corresponding to Y, compared to the first topic vector corresponding to the second topic vector corresponding to Y and other unrelated topic IDs. Based on such considerations, the present application defines a loss function including topic range constraint information, as an example, as shown in the following formula 2:
  • is a weight coefficient
  • S t represents a similarity between a second topic vector corresponding to Y and a first topic vector corresponding to Y
  • S t represents a similarity between a second topic vector corresponding to Y and a first topic vector corresponding to Y
  • the unrelated topic vector is a vector other than the first topic vector corresponding to Y in each first topic vector
  • the topic corresponding to the irrelevant topic vector The topic corresponding to Y is irrelevant.
  • the similarity may be, for example, a cosine similarity, or may be a distance between vectors, which can measure the similarity between vectors.
  • Equation 2 the corresponding loss can be calculated and the dialogue model adjusted.
  • multiple training samples can be used to repeatedly train the dialogue model until the training converges.
  • FIG. 3 is only an example. Based on the example of FIG. 3, some key steps involved in the training are further explained.
  • the method before the training of the sequence-to-sequence-based conversation model, the method further includes: training the topic model by using the dialog training corpus to obtain a plurality of first topic vectors, each of the A topic vector represents a topic.
  • the topic model is trained in an unsupervised manner, and the advantage is that the training can be efficiently performed with a large amount of dialog training corpus, and the topic label can be manually added without prior to the dialog training corpus, which can save costs and is not easy to miss. Topics; Of course, it is okay to train topic models in a supervised way.
  • the training of the sequence-to-sequence-based conversation model is performed by using the loss function including the topic range constraint information, which may specifically include:
  • the training sequence described above is X
  • the output sequence described above is Y.
  • the generating the second topic vector corresponding to the output sequence according to the implicit state output data may be implemented in various specific embodiments.
  • the method in the example of FIG. 3 is: performing a pooling process on the implicit state output data; and generating the output by inputting the data obtained by the Pooling process into a multi-layer perceptron for processing.
  • the Pooling process is specifically handled by Average Pooling. It does not rule out the possibility of using other pooling methods other than Average Pooling.
  • mapping method of the setting other than the multi-layer perceptron may be used to map the implicit state output data to the second topic vector corresponding to the output sequence.
  • the calculating the loss according to the first topic vector and the second topic vector corresponding to the output sequence, and using the loss function including the topic range constraint information may specifically include:
  • the unrelated topic vector is a vector of the plurality of first topic vectors other than the first topic vector corresponding to the output sequence; and the first similarity and the second similarity are substituted
  • the loss function including the topic range constraint information is calculated, wherein the topic range constraint information is a formula including parameters corresponding to the first similarity and the second similarity.
  • the parameter corresponding to the first similarity is S t
  • the parameter corresponding to the second similarity is
  • the above loss function including the topic range constraint information is the formula 2, and the above topic range constraint information is
  • Formula 2 is exemplary and based on the parameters S t and/or It is also possible to construct a loss function other than the formula 2 that contains the topic range constraint information. Generally, for the inclusion of the parameter S t and Topic range constraint information, the larger the S t Then, in the calculated loss, the loss portion corresponding to the topic range constraint information is smaller.
  • the embodiment of the present application further provides a corresponding device, as shown in FIG. 5 .
  • FIG. 5 is a schematic structural diagram of a dialog generating apparatus corresponding to FIG. 1 according to an embodiment of the present disclosure.
  • the apparatus may be located on an execution body of the process in FIG. 1, and includes:
  • the training module 501 trains the sequence-to-sequence-based conversation model by using a loss function including the topic range constraint information
  • a generating module 502 is utilized to generate a dialog using the trained dialog model.
  • the training module 501 trains the topic model by using the dialog training corpus before training the session-to-sequence-based conversation model to obtain a plurality of first topic vectors, each of the first topic vectors respectively representing a topic. .
  • the training module 501 uses a loss function including the topic range constraint information to train the sequence-to-sequence-based conversation model, and specifically includes:
  • the training module 501 processes the training sequence input into the sequence-to-sequence dialog model, and obtains the hidden state output data outputted during the processing, and the output sequence obtained after the processing;
  • the dialog model is adjusted based on the loss.
  • the training module 501 generates, according to the implicit state output data, a second topic vector corresponding to the output sequence, which specifically includes:
  • the training module 501 performs pooling pooling processing on the hidden state output data
  • the second topic vector corresponding to the output sequence is generated by inputting the data obtained by the processing of the pooling into a multi-layer perceptron for processing.
  • the training module 501 calculates the loss according to the first topic vector and the second topic vector corresponding to the output sequence, and uses a loss function including the topic range constraint information, and specifically includes:
  • the training module 501 calculates a first similarity between a second topic vector corresponding to the output sequence and a first topic vector corresponding to the output sequence;
  • the embodiment of the present application further provides a corresponding electronic device, including:
  • At least one processor and,
  • the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
  • a dialogue is generated using the trained dialog model.
  • the embodiment of the present application further provides a corresponding non-volatile computer storage medium, where computer executable instructions are stored, and the computer executable instructions are set as:
  • a dialogue is generated using the trained dialog model.
  • the device, the electronic device, the non-volatile computer storage medium and the method provided by the embodiments of the present application are corresponding, and therefore, the device, the electronic device, and the non-volatile computer storage medium also have beneficial technical effects similar to the corresponding methods,
  • the beneficial technical effects of the method have been described in detail above, and therefore, the beneficial technical effects of the corresponding device, the electronic device, and the non-volatile computer storage medium will not be described herein.
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • HDL Hardware Description Language
  • the controller can be implemented in any suitable manner, for example, the controller can take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor.
  • computer readable program code eg, software or firmware
  • examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, The Microchip PIC18F26K20 and the Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic.
  • the controller can be logically programmed by means of logic gates, switches, ASICs, programmable logic controllers, and embedding.
  • Such a controller can therefore be considered a hardware component, and the means for implementing various functions included therein can also be considered as a structure within the hardware component.
  • a device for implementing various functions can be considered as a software module that can be both a method of implementation and a structure within a hardware component.
  • the system, device, module or unit illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product having a certain function.
  • a typical implementation device is a computer.
  • the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or A combination of any of these devices.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media includes both permanent and non-persistent, removable and non-removable media.
  • Information storage can be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
  • computer readable media does not include temporary storage of computer readable media, such as modulated data signals and carrier waves.
  • the application can be described in the general context of computer-executable instructions executed by a computer, such as a program module.
  • program modules include routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types.
  • the present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network.
  • program modules can be located in both local and remote computer storage media including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Machine Translation (AREA)

Abstract

本申请公开了一种对话生成方法、装置以及电子设备。所述方法包括:利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练;利用所述训练过的对话模型,生成对话。利用本申请实施例,通过包含话题范围约束信息的损失函数,可以在对话模型训练过程中引入话题范围约束信息,从而有利于避免训练过的模型产出低质量无意义的回复。

Description

一种对话生成方法、装置以及电子设备 技术领域
本申请涉及计算机软件技术领域,尤其涉及一种对话生成方法、装置以及电子设备。
背景技术
随着移动设备的快速发展,智能辅助相关的应用也变得越来越普遍。比如,越来越流行的对话助手,对话助手可以基于语音或者文字等形式,与用户进行对话,以回答用户提出的问题,或者单纯地陪用户聊天等。
在现有技术中,将对话过程的问和答看作是问题语言符号序列到答案语言符号序列的映射,以最大似然估计作为损失函数,采用大量的人工对话数据对基于序列到序列(sequence to sequence,seq2seq)的对话模型进行训练,使得该对话模型学习到问题语言符号序列到答案语言符号序列的映射关系,可以用训练过的对话模型自动生成对话,从而实现对话助手。
但是,上述现有技术在模型训练中容易受诸如“好的”、“是的”、“知道了”等无话题信息的高频回复语句影响,导致在实际使用训练过的模型时,也倾向与产出这些低质量无意义的回复。
发明内容
本申请实施例提供一种对话生成方法、装置以及电子设备,用以解决如下技术问题:现有技术在对话模型训练中容易受无话题信息的高频回复语句影响,导致在实际使用训练过的模型时,也倾向与产出这些低质量无意义的回复。
为解决上述技术问题,本申请实施例是这样实现的:
本申请实施例提供的一种对话生成方法,包括:
利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进 行训练;
利用所述训练过的对话模型,生成对话。
本申请实施例提供的一种对话生成装置,包括:
训练模块,利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练;
生成模块,利用所述训练过的对话模型,生成对话。
本申请实施例提供的一种电子设备,包括:
至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:
利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练;
利用所述训练过的对话模型,生成对话。
本申请实施例采用的上述至少一个技术方案能够达到以下有益效果:通过利用包含话题范围约束信息的损失函数,在对话模型训练过程中引入话题范围约束信息,从而有利于避免训练过的模型产出低质量无意义的回复,因此,可以部分或全部地解决现有技术中的问题。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的一种对话生成方法的流程示意图;
图2为一种基于序列到序列的对话模型的原理示意图;
图3为本申请实施例提供的图1的方法中对话模型训练的一种具体实施方案原理示意图;
图4为本申请实施例提供的对图3中的原理的概括流程示意图;
图5为本申请实施例提供的对应于图1的一种对话生成装置的结构示意图。
具体实施方式
本申请实施例提供一种对话生成方法、装置以及电子设备。
为了使本技术领域的人员更好地理解本申请中的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
为了便于理解,对本申请的方案的核心思想进行说明:本申请基于话题回复一致性的观点,利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练,以避免训练过的模型生成低质量无意义的对话;其中,所述话题范围约束信息具体可以是该损失函数中包含的至少部分公式,以下将该至少部分公式称为话题范围约束函数。
话题回复一致性主要指:真实人类对话聊天中,聊天参与人对话的话题往往相同或者相关,以及回复的语句话题范围也有相应的限制。比如,A提及天气相关话语,B回复天气相关话题的语句是比较合理的,一般不会回复与天气话题毫无关系的内容,如“这个手机怎么样”等。
由于对话模型一般用于模拟真实人类与用户进行对话,因此,若对话模型能够遵循话题回复一致性生成对话,对于用户而言将是更好的体验。。
基于上述的核心思想,下面对本申请的方案进行详细说明。
图1为本申请实施例提供的一种对话生成方法的流程示意图。从程序角度 而言,该流程的执行主体可以是服务器上或者终端上的程序,比如,模型训练程序、对话助手应用、即时通讯应用等。从设备角度而言,该流程的执行主体包括但不限于可作为服务器或者终端的以下至少一种设备:手机、平板电脑、智能可穿戴设备、车机、个人计算机、中型计算机、计算机集群等。
图1中的流程可以包括以下步骤:
S101:利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练。
在本申请实施例中,所述话题范围约束信息可以是该损失函数中的一个或者多个与对话话题相关的参数,也可以是该损失函数中的与话题相关的至少部分公式。
在对话模型的训练过程中,是根据该损失函数计算出的损失,对对话模型的参数进行调整的,则该损失函数中包含的话题范围约束信息,也会对对话模型的参数调整产生相应的影响,从而使得训练过的对话模型的输出序列的内容也受到相应的约束。
这种约束可能带来两层效果:第一层,使得该输出序列包含话题信息,而非低质量无意义的对话;第二层,使得该输出序列与对应的对话模型的输入序列具有话题回复一致性。
S102:利用所述训练过的对话模型,生成对话。
在本申请实施例中,步骤S102可以是对话模型训练过程中的动作,也可以是对话模型训练完毕后的实际使用时的动作。
以将训练过的对话模型应用于对话助手应用为例。对话模型接收用户输入的语句,输出回复语句;或者,对话模型也可以基于预设或自动生成的输入语句,输出回复语句;或者,对话模型也可以不依赖于输入语句,直接输出预设的语句;等等。
图1所涉及的动作的执行主体可以是同一设备或同一程序,也可以是不同设备或不同程序。比如,步骤S101~S102的执行主体均为对话助手应用;又比 如,步骤S101的执行主体为模型训练程序,而步骤S102的执行主体为对话助手应用;等等。
通过图1的方法,通过利用包含话题范围约束信息的损失函数,在对话模型训练过程中引入话题范围约束信息,从而有利于避免训练过的模型产出低质量无意义的回复,因此,可以部分或全部地解决现有技术中的问题。
基于图1的方法,本申请实施例还提供了该方法的一些具体实施方案,以及扩展方案,下面进行说明。
图2为一种基于序列到序列的对话模型的原理示意图。
图2中的对话模型包含两个长短期记忆(Long Short-Term Memory,LSTM)递归神经网络,第一个作为编码器,负责处理输入对话单词序列X,第二个作为解码器,负责生成回复单词序列Y,在实际应用中,基于序列到序列的对话模型的损失函数(即为目标函数)通常采用最大似然估计(Maximum Likelihood Estimate,MLE),如下公式一所示:
Cost=logp(Y|X);公式一
在本申请实施例中,可以在公式一的基础上加入话题范围约束函数,再用于训练图2中的对话模型,当然,若不是采用最大似然估计,相应地对公式一进行替换即可。仍以采用最大似然估计为例,结合图3进行说明。
图3为本申请实施例提供的图1的方法中对话模型训练的一种具体实施方案原理示意图。可以看到,相比于图2,图3中增加了话题范围约束函数以及相应的损失计算动作,下面对图3中的原理进行说明。
图4为本申请实施例提供的对图3中的原理的概括流程示意图。该概括流程主要分为五部分:
训练话题模型,得到多个第一话题向量;
根据训练后的话题模型,确定回复单词序列Y对应的第一话题向量(表示为:
Figure PCTCN2018090138-appb-000001
);
将Y对应的对话模型中处理过程中的各隐状态输出数据进行池化处理以及 MLP变换操作,得到Y对应的第二话题向量(表示为:T v);
计算Y对应的第二话题向量与Y对应第一话题向量间的第一相似度(表示为:
Figure PCTCN2018090138-appb-000002
),以及Y对应的第二话题向量与不相关话题向量(表示为:
Figure PCTCN2018090138-appb-000003
)间的第二相似度(表示为:
Figure PCTCN2018090138-appb-000004
);其中,Relevance()表示相似度计算函数,比如,余弦相似度函数Cosine()等;
将第一相似度和第二相似度代入包含话题范围约束函数的损失函数,计算损失,以及根据损失对对话模型进行调整。
进一步地说明如下:
首先,无监督地利用对话训练语料训练话题模型,话题模型比如可以是LDA(Latent Dirichlet Allocation)模型或者Kmeans模型等。通过训练话题模型,可以从对话训练语料中提取出多个话题,并对应地生成多个话题向量,称为第一话题向量,每个第一话题向量分别表示一个话题,可以用话题ID对第一话题向量进行标识。优选地,第一话题向量可以是类似词嵌入的稠密向量,其中,所述词嵌入指将词转换为词向量。
然后,根据训练的话题模型,可以得到回复单词序列Y对应的第一话题向量,假定一句话只有一个中心意思,则Y只对应一个话题ID,相应地也只对应一个第一话题向量。
再然后,将Y在经过LSTM建模的每一步的隐状态输出数据输入平均池化(Average Pooling)进行池化处理,再通过多层感知器(Multi-layer Perceptron,MLP)进行变换操作,得到Y的另一种话题向量表示,称为Y对应的第二话题向量。其中,多层感知器具体可以是多层神经网络,比如全连接的深度神经网络(Deep Neural Networks,DNN)等。
可以认为,Y对应的第二话题向量在语义空间与Y对应的第一话题向量应该是相近的,相比于Y对应的第二话题向量与其他不相关话题ID对应的第一话题向量。基于这样的考虑,本申请定义了一种包含话题范围约束信息的损失函数,作为示例,如下公式二所示:
Figure PCTCN2018090138-appb-000005
其中,λ为权重系数,S t表示Y对应的第二话题向量与Y对应的第一话题向量间的相似度,
Figure PCTCN2018090138-appb-000006
表示Y对应的第二话题向量与不相关话题向量间的相似度,所述不相关话题向量是各第一话题向量中除Y对应的第一话题向量以外的向量,不相关话题向量对应的话题与Y对应的话题不相关。
相似度比如可以是余弦相似度,或者也可以是向量间距离等可以度量向量间相似性的数据。
最后,基于公式二,可以计算相应的损失,以及对对话模型进行调整,如此可以采用多个训练样本对对话模型反复训练,直到训练收敛。
需要说明的是,图3中的具体实施方案只是一种示例,下面基于图3的例子,对训练涉及的一些关键步骤进一步地展开说明。
在本申请实施例中,对于步骤S102,所述对基于序列到序列的对话模型进行训练前,还可以执行:利用对话训练语料训练话题模型,得到多个第一话题向量,每个所述第一话题向量分别表示一个话题。
在图3的例子中,是采用无监督的方式训练话题模型,优点在于,可以高效地用大量对话训练语料进行训练,无需事先给对话训练语料人工添加话题标签,可以节省成本,也不容易遗漏话题;当然,采用有监督的方式训练话题模型也是可以的。
在本申请实施例中,对于步骤S102,所述利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练,具体可以包括:
将训练序列输入基于序列到序列的对话模型进行处理,得到所述处理过程中输出的各隐状态输出数据,以及所述处理后得到的输出序列;根据所述各隐状态输出数据,生成所述输出序列对应的第二话题向量;以及,将所述输出序列输入所述训练过的话题模型进行处理,得到在所述多个第一话题向量中,所述输出序列对应的第一话题向量;根据所述输出序列对应的第一话题向量和第二话题向量,以及利用包含话题范围约束信息的损失函数,计算损失;根据所 述损失,对所述对话模型进行调整。
在图3的例子中,上述的训练序列即为X,上述的输出序列即为Y。
进一步地,所述根据所述各隐状态输出数据,生成所述输出序列对应的第二话题向量,可以有多种具体实施方式。
例如,在图3的例子中的方式是:对所述各隐状态输出数据进行池化(Pooling)处理;通过将所述Pooling处理后得到的数据输入多层感知器进行处理,生成所述输出序列对应的第二话题向量。Pooling处理具体是示例性地采用了Average Pooling进行处理,不排除也可以采用Average Pooling以外的其他池化处理方式的可能性。
另外,也可以采用多层感知器以外的其他设定的映射方式,将各隐状态输出数据映射得到输出序列对应的第二话题向量。
进一步地,所述根据所述输出序列对应的第一话题向量和第二话题向量,以及利用包含话题范围约束信息的损失函数,计算损失,具体可以包括:
计算所述输出序列对应的第二话题向量与所述输出序列对应的第一话题向量间的第一相似度;以及,计算所述输出序列对应的第二话题向量与不相关话题向量间的第二相似度,所述不相关话题向量是所述多个第一话题向量中除所述输出序列对应的第一话题向量以外的向量;将所述第一相似度和所述第二相似度代入包含话题范围约束信息的损失函数,计算损失,其中,所述话题范围约束信息为包含所述第一相似度和第二相似度对应的参数的公式。
在图3的例子中,上述的第一相似度对应的参数即为S t,上述的第二相似度对应的参数即为
Figure PCTCN2018090138-appb-000007
,上述的包含话题范围约束信息的损失函数即为公式二,上述的话题范围约束信息即为
Figure PCTCN2018090138-appb-000008
需要说明的是,公式二是示例性的,基于参数S t和/或
Figure PCTCN2018090138-appb-000009
,也可以构造出公式二以外其他包含话题范围约束信息的损失函数。一般地,对于包含参数S t
Figure PCTCN2018090138-appb-000010
的话题范围约束信息,S t越大于
Figure PCTCN2018090138-appb-000011
,则在计算出的损失中,对应于该话题范 围约束信息的损失部分越小。
上面为本申请实施例提供的一种对话生成方法,基于同样的发明思路,本申请实施例还提供了对应的装置,如图5所示。
图5为本申请实施例提供的对应于图1的一种对话生成装置的结构示意图,该装置可以位于图1中流程的执行主体上,包括:
训练模块501,利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练;
生成模块502,利用所述训练过的对话模型,生成对话。
可选地,所述训练模块501对基于序列到序列的对话模型进行训练前,还利用对话训练语料训练话题模型,得到多个第一话题向量,每个所述第一话题向量分别表示一个话题。
可选地,所述训练模块501利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练,具体包括:
所述训练模块501将训练序列输入基于序列到序列的对话模型进行处理,得到所述处理过程中输出的各隐状态输出数据,以及所述处理后得到的输出序列;
根据所述各隐状态输出数据,生成所述输出序列对应的第二话题向量;以及,
将所述输出序列输入所述训练过的话题模型进行处理,得到在所述多个第一话题向量中,所述输出序列对应的第一话题向量;
根据所述输出序列对应的第一话题向量和第二话题向量,以及利用包含话题范围约束信息的损失函数,计算损失;
根据所述损失,对所述对话模型进行调整。
可选地,所述训练模块501根据所述各隐状态输出数据,生成所述输出序列对应的第二话题向量,具体包括:
所述训练模块501对所述各隐状态输出数据进行池化Pooling处理;
通过将所述Pooling处理后得到的数据输入多层感知器进行处理,生成所述输出序列对应的第二话题向量。
可选地,所述训练模块501根据所述输出序列对应的第一话题向量和第二话题向量,以及利用包含话题范围约束信息的损失函数,计算损失,具体包括:
所述训练模块501计算所述输出序列对应的第二话题向量与所述输出序列对应的第一话题向量间的第一相似度;以及,
计算所述输出序列对应的第二话题向量与不相关话题向量间的第二相似度,所述不相关话题向量是所述多个第一话题向量中除所述输出序列对应的第一话题向量以外的向量;
将所述第一相似度和所述第二相似度代入包含话题范围约束信息的损失函数,计算损失,其中,所述话题范围约束信息为包含所述第一相似度和第二相似度对应的参数的公式。
基于同样的发明思路,本申请实施例还提供了对应的一种电子设备,包括:
至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:
利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练;
利用所述训练过的对话模型,生成对话。
基于同样的发明思路,本申请实施例还提供了对应的一种非易失性计算机存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为:
利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练;
利用所述训练过的对话模型,生成对话。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相 似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置、电子设备、非易失性计算机存储介质实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本申请实施例提供的装置、电子设备、非易失性计算机存储介质与方法是对应的,因此,装置、电子设备、非易失性计算机存储介质也具有与对应方法类似的有益技术效果,由于上面已经对方法的有益技术效果进行了详细说明,因此,这里不再赘述对应装置、电子设备、非易失性计算机存储介质的有益技术效果。
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL (Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本申请时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计 算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序 的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所 作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。

Claims (11)

  1. 一种对话生成方法,包括:
    利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练;
    利用所述训练过的对话模型,生成对话。
  2. 如权利要求1所述的方法,所述对基于序列到序列的对话模型进行训练前,所述方法还包括:
    利用对话训练语料训练话题模型,得到多个第一话题向量,每个所述第一话题向量分别表示一个话题。
  3. 如权利要求2所述的方法,所述利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练,具体包括:
    将训练序列输入基于序列到序列的对话模型进行处理,得到所述处理过程中输出的各隐状态输出数据,以及所述处理后得到的输出序列;
    根据所述各隐状态输出数据,生成所述输出序列对应的第二话题向量;以及,
    将所述输出序列输入所述训练过的话题模型进行处理,得到在所述多个第一话题向量中,所述输出序列对应的第一话题向量;
    根据所述输出序列对应的第一话题向量和第二话题向量,以及利用包含话题范围约束信息的损失函数,计算损失;
    根据所述损失,对所述对话模型进行调整。
  4. 如权利要求3所述的方法,所述根据所述各隐状态输出数据,生成所述输出序列对应的第二话题向量,具体包括:
    对所述各隐状态输出数据进行池化Pooling处理;
    通过将所述Pooling处理后得到的数据输入多层感知器进行处理,生成所述输出序列对应的第二话题向量。
  5. 如权利要求3所述的方法,所述根据所述输出序列对应的第一话题向 量和第二话题向量,以及利用包含话题范围约束信息的损失函数,计算损失,具体包括:
    计算所述输出序列对应的第二话题向量与所述输出序列对应的第一话题向量间的第一相似度;以及,
    计算所述输出序列对应的第二话题向量与不相关话题向量间的第二相似度,所述不相关话题向量是所述多个第一话题向量中除所述输出序列对应的第一话题向量以外的向量;
    将所述第一相似度和所述第二相似度代入包含话题范围约束信息的损失函数,计算损失,其中,所述话题范围约束信息为包含所述第一相似度和第二相似度对应的参数的公式。
  6. 一种对话生成装置,包括:
    训练模块,利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练;
    生成模块,利用所述训练过的对话模型,生成对话。
  7. 如权利要求6所述的装置,所述训练模块对基于序列到序列的对话模型进行训练前,还利用对话训练语料训练话题模型,得到多个第一话题向量,每个所述第一话题向量分别表示一个话题。
  8. 如权利要求7所述的装置,所述训练模块利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练,具体包括:
    所述训练模块将训练序列输入基于序列到序列的对话模型进行处理,得到所述处理过程中输出的各隐状态输出数据,以及所述处理后得到的输出序列;
    根据所述各隐状态输出数据,生成所述输出序列对应的第二话题向量;以及,
    将所述输出序列输入所述训练过的话题模型进行处理,得到在所述多个第一话题向量中,所述输出序列对应的第一话题向量;
    根据所述输出序列对应的第一话题向量和第二话题向量,以及利用包含话 题范围约束信息的损失函数,计算损失;
    根据所述损失,对所述对话模型进行调整。
  9. 如权利要求8所述的装置,所述训练模块根据所述各隐状态输出数据,生成所述输出序列对应的第二话题向量,具体包括:
    所述训练模块对所述各隐状态输出数据进行池化Pooling处理;
    通过将所述Pooling处理后得到的数据输入多层感知器进行处理,生成所述输出序列对应的第二话题向量。
  10. 如权利要求8所述的装置,所述训练模块根据所述输出序列对应的第一话题向量和第二话题向量,以及利用包含话题范围约束信息的损失函数,计算损失,具体包括:
    所述训练模块计算所述输出序列对应的第二话题向量与所述输出序列对应的第一话题向量间的第一相似度;以及,
    计算所述输出序列对应的第二话题向量与不相关话题向量间的第二相似度,所述不相关话题向量是所述多个第一话题向量中除所述输出序列对应的第一话题向量以外的向量;
    将所述第一相似度和所述第二相似度代入包含话题范围约束信息的损失函数,计算损失,其中,所述话题范围约束信息为包含所述第一相似度和第二相似度对应的参数的公式。
  11. 一种电子设备,包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够:
    利用包含话题范围约束信息的损失函数,对基于序列到序列的对话模型进行训练;
    利用所述训练过的对话模型,生成对话。
PCT/CN2018/090138 2017-06-07 2018-06-06 一种对话生成方法、装置以及电子设备 WO2018223992A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
EP18814267.3A EP3620940A4 (en) 2017-06-07 2018-06-06 DIALOG GENERATING METHOD AND DEVICE AND ELECTRONIC DEVICE
SG11201911535SA SG11201911535SA (en) 2017-06-07 2018-06-06 Dialog generation method, apparatus, and electronic device
US16/704,358 US11354512B2 (en) 2017-06-07 2019-12-05 Method and device for generating dialog using trained dialog model
US16/778,995 US10747959B2 (en) 2017-06-07 2020-01-31 Dialog generation method, apparatus, and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710423859.7 2017-06-07
CN201710423859.7A CN107368524B (zh) 2017-06-07 2017-06-07 一种对话生成方法、装置以及电子设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/704,358 Continuation US11354512B2 (en) 2017-06-07 2019-12-05 Method and device for generating dialog using trained dialog model

Publications (1)

Publication Number Publication Date
WO2018223992A1 true WO2018223992A1 (zh) 2018-12-13

Family

ID=60304805

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/090138 WO2018223992A1 (zh) 2017-06-07 2018-06-06 一种对话生成方法、装置以及电子设备

Country Status (6)

Country Link
US (2) US11354512B2 (zh)
EP (1) EP3620940A4 (zh)
CN (1) CN107368524B (zh)
SG (1) SG11201911535SA (zh)
TW (1) TW201903635A (zh)
WO (1) WO2018223992A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131368A (zh) * 2020-09-27 2020-12-25 平安国际智慧城市科技股份有限公司 对话生成方法、装置、电子设备及存储介质
CN112988948A (zh) * 2021-02-05 2021-06-18 支付宝(杭州)信息技术有限公司 业务处理方法以及装置

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107368524B (zh) * 2017-06-07 2020-06-02 创新先进技术有限公司 一种对话生成方法、装置以及电子设备
US10971142B2 (en) * 2017-10-27 2021-04-06 Baidu Usa Llc Systems and methods for robust speech recognition using generative adversarial networks
CN107832310A (zh) * 2017-11-27 2018-03-23 首都师范大学 基于seq2seq模型的结构化论点生成方法及系统
CN108090509B (zh) * 2017-12-13 2021-10-08 四川大学 一种数据长度自适应的心电图分类方法
CN110309275B (zh) * 2018-03-15 2024-06-14 北京京东尚科信息技术有限公司 一种对话生成的方法和装置
CN108509539B (zh) * 2018-03-16 2021-08-17 联想(北京)有限公司 信息处理方法电子设备
CN109284361A (zh) * 2018-09-29 2019-01-29 深圳追科技有限公司 一种基于深度学习的实体抽取方法及系统
CN110008332B (zh) * 2019-02-13 2020-11-10 创新先进技术有限公司 通过强化学习提取主干词的方法及装置
CN110297894B (zh) * 2019-05-22 2021-03-26 同济大学 一种基于辅助网络的智能对话生成方法
CN113761136B (zh) * 2020-06-02 2024-07-19 阿里巴巴集团控股有限公司 对话处理、信息处理、模型训练方法、设备及存储介质
CN111985934B (zh) * 2020-07-30 2024-07-12 浙江百世技术有限公司 智能客服对话模型构建方法及应用
CN111930916B (zh) * 2020-09-18 2021-02-05 北京百度网讯科技有限公司 对话生成方法、装置、电子设备和存储介质
CN115470329A (zh) * 2022-08-22 2022-12-13 北京字跳网络技术有限公司 一种对话生成方法、装置、计算机设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7664644B1 (en) * 2006-06-09 2010-02-16 At&T Intellectual Property Ii, L.P. Multitask learning for spoken language understanding
CN103544337A (zh) * 2012-05-29 2014-01-29 通用汽车环球科技运作有限责任公司 汽车乘员的对话模型
CN106682734A (zh) * 2016-12-30 2017-05-17 中国科学院深圳先进技术研究院 一种提升卷积神经网络泛化能力的方法及装置
CN107368524A (zh) * 2017-06-07 2017-11-21 阿里巴巴集团控股有限公司 一种对话生成方法、装置以及电子设备

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8645298B2 (en) * 2010-10-26 2014-02-04 Microsoft Corporation Topic models
US9575952B2 (en) * 2014-10-21 2017-02-21 At&T Intellectual Property I, L.P. Unsupervised topic modeling for short texts
CN105094315B (zh) * 2015-06-25 2018-03-06 百度在线网络技术(北京)有限公司 基于人工智能的人机智能聊天的方法和装置
JP6544131B2 (ja) * 2015-08-14 2019-07-17 富士ゼロックス株式会社 情報処理装置及び情報処理プログラム
US10431205B2 (en) * 2016-04-27 2019-10-01 Conduent Business Services, Llc Dialog device with dialog support generated using a mixture of language models combined using a recurrent neural network
CN109219812B (zh) * 2016-06-03 2023-12-12 微软技术许可有限责任公司 口语对话系统中的自然语言生成
US10546066B2 (en) * 2016-08-31 2020-01-28 Microsoft Technology Licensing, Llc End-to-end learning of dialogue agents for information access
CN106383815B (zh) * 2016-09-20 2019-03-01 清华大学 结合用户和产品信息的神经网络情感分析方法
US10540967B2 (en) * 2016-11-14 2020-01-21 Xerox Corporation Machine reading method for dialog state tracking
US10268679B2 (en) * 2016-12-02 2019-04-23 Microsoft Technology Licensing, Llc Joint language understanding and dialogue management using binary classification based on forward and backward recurrent neural network
US10394954B2 (en) * 2017-02-27 2019-08-27 Intel Corporation Natural language intent and location determination method and apparatus
CN106997375B (zh) * 2017-02-28 2020-08-18 浙江大学 基于深度学习的客服回复推荐方法
US10503834B2 (en) * 2017-11-17 2019-12-10 Digital Genius Limited Template generation for a conversational agent

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7664644B1 (en) * 2006-06-09 2010-02-16 At&T Intellectual Property Ii, L.P. Multitask learning for spoken language understanding
CN103544337A (zh) * 2012-05-29 2014-01-29 通用汽车环球科技运作有限责任公司 汽车乘员的对话模型
CN106682734A (zh) * 2016-12-30 2017-05-17 中国科学院深圳先进技术研究院 一种提升卷积神经网络泛化能力的方法及装置
CN107368524A (zh) * 2017-06-07 2017-11-21 阿里巴巴集团控股有限公司 一种对话生成方法、装置以及电子设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3620940A4 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131368A (zh) * 2020-09-27 2020-12-25 平安国际智慧城市科技股份有限公司 对话生成方法、装置、电子设备及存储介质
CN112131368B (zh) * 2020-09-27 2024-02-09 深圳平安智慧医健科技有限公司 对话生成方法、装置、电子设备及存储介质
CN112988948A (zh) * 2021-02-05 2021-06-18 支付宝(杭州)信息技术有限公司 业务处理方法以及装置
CN112988948B (zh) * 2021-02-05 2023-09-19 蚂蚁胜信(上海)信息技术有限公司 业务处理方法以及装置

Also Published As

Publication number Publication date
US11354512B2 (en) 2022-06-07
US20200167528A1 (en) 2020-05-28
CN107368524B (zh) 2020-06-02
CN107368524A (zh) 2017-11-21
US20200110916A1 (en) 2020-04-09
US10747959B2 (en) 2020-08-18
EP3620940A1 (en) 2020-03-11
SG11201911535SA (en) 2020-01-30
EP3620940A4 (en) 2020-04-08
TW201903635A (zh) 2019-01-16

Similar Documents

Publication Publication Date Title
WO2018223992A1 (zh) 一种对话生成方法、装置以及电子设备
US12073334B2 (en) Human-computer dialogue method and apparatus
JP6877558B2 (ja) 音声ウェイクアップ方法、装置及び電子デバイス
WO2019105134A1 (zh) 词向量处理方法、装置以及设备
CN110288985B (zh) 语音数据处理方法、装置、电子设备及存储介质
CN109710915B (zh) 复述语句生成方法及装置
JP7300435B2 (ja) 音声インタラクションするための方法、装置、電子機器、およびコンピュータ読み取り可能な記憶媒体
US10984793B2 (en) Voice interaction method and device
CN109219812A (zh) 口语对话系统中的自然语言生成
CN107480196B (zh) 一种基于动态融合机制的多模态词汇表示方法
WO2019149135A1 (zh) 词向量生成方法、装置以及设备
CN110457449B (zh) 在线训练模型的方法、装置、设备及存储介质
WO2020073700A1 (zh) 图像描述模型的训练方法、装置及存储介质
CN113569017B (zh) 一种模型处理方法、装置、电子设备及存储介质
CN109543165A (zh) 基于循环卷积注意力模型的文本生成方法及装置
CN109284502A (zh) 一种文本相似度计算方法、装置、电子设备及存储介质
JP2021081713A (ja) 音声信号を処理するための方法、装置、機器、および媒体
CN116028613A (zh) 常识问答方法、系统、计算机设备和存储介质
CN112560447B (zh) 回复信息获取方法、装置及计算机设备
Borders et al. An Introduction to Word Embeddings and Language Models
CN115640392B (zh) 一种对话系统优化的方法、装置、存储介质及电子设备
JP7551970B2 (ja) 人工知能モデル更新方法、装置、電子デバイス及び記憶媒体
CN116775838A (zh) 对话生成方法、装置、电子设备及介质
CN115062122A (zh) 对话应答方法、装置、电子设备及计算机可读存储介质
CN115358288A (zh) 基于标签约束的多模态分类模型训练方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18814267

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2018814267

Country of ref document: EP

Effective date: 20191202