Intelligent dialogue method, system, storage medium and electronic device
By obtaining user target attribute information in real time and using the attribute recall model to obtain controlled role attributes, the problem that human-computer dialogue system in the existing technology cannot remember role attributes and user attributes is solved, and the dialogue experience is improved.
Patent Information
- Application Number
- CN202311426869.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-30
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2043-10-30
AI Technical Summary
The existing general human-computer dialogue system cannot remember the role attribute information and the user's basic attributes set by itself, resulting in poor user experience.
By obtaining user target attribute information in real time, using the attribute recall model to obtain controlled role attributes, and querying attribute value dictionary with historical role attributes, using the dialogue generation model to construct inference request text fields to generate dialogue reply.
It realizes long-term memory of character attributes during human-computer dialogue, solves the problem that inconsistent character attributes affect the dialogue experience, and improves the user's user experience in human-computer dialogue.
Smart Images

Figure CN117421408B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of robotics technology, and in particular to an intelligent dialogue method, system, storage medium and electronic device. Background Art
[0002] The human-computer dialogue system is built based on the natural language processing technology (NLP) in the field of artificial intelligence. It realizes natural text or voice communication with users through deep learning, semantic understanding, entity recognition and other technologies. A large amount of dialogue data is used to train the neural network model, so that the robot can master rich knowledge and understand various contexts. However, the current general human-computer dialogue system has the problem of inconsistent attributes leading to poor user experience. Since the robot cannot remember the role attribute information it has set, it cannot remember the basic attributes of the user, which seriously affects the actual experience of the user in the human-computer dialogue. Summary of the invention
[0003] The purpose of this application is to provide an intelligent dialogue method, system, storage medium and electronic device that can enhance the user experience in human-computer communication.
[0004] In order to solve the above technical problems, this application provides an intelligent dialogue method, and the specific technical solution is as follows:
[0005] During the conversation with the user, the user's target attribute information is obtained in real time;
[0006] Acquiring the controlled role attribute corresponding to the user target attribute information through an attribute recall model;
[0007] According to the role attributes and historical role attributes recalled in this round, query the user attribute value dictionary to obtain an attribute value set;
[0008] A dialog generation model is used to construct an inference request text field based on the attribute value set in a preset format; the inference request text field is used to generate a dialog reply in response to the user.
[0009] Optionally, real-time acquisition of user target attribute information includes:
[0010] Obtain user target attribute information in real time through user conversation content.
[0011] Optionally, the real-time acquisition of user target attribute information through user conversation content includes:
[0012] The user target attribute information is extracted from the real-time user conversation content using a classification model and an entity recognition model respectively; wherein the classification model is used to extract objects whose value domain is enumerable attributes; and the entity recognition model is used to extract objects whose value domain is non-enumerable attributes.
[0013] Optionally, before extracting the user target attribute information from the real-time user conversation content using a classification model and an entity recognition model respectively, the method further includes:
[0014] The classification model and the entity recognition model are trained offline, and the attribute recall model and the dialog generation model with attribute control are trained.
[0015] Optionally, obtaining the controlled role attribute corresponding to the user target attribute information through the attribute recall model includes:
[0016] The attribute recall model is used to obtain first recall information obtained by performing attribute recall ending with the last round of robot-side replies, and second recall information obtained by performing attribute recall ending with the last round of user-side replies.
[0017] Optionally, according to the role attributes and historical role attributes recalled in this round, the user attribute value dictionary is queried to obtain an attribute value set including:
[0018] Determine whether it is necessary to update the recall attribute based on the comparison result of the first recall information and the second recall information with the third recall information obtained by performing attribute recall ending with the answer result generated by the model method;
[0019] If so, the result and the third recall information are combined to generate a dictionary of controlled attributes and corresponding attribute values.
[0020] Optionally, after obtaining the currently controlled role attributes through the attribute recall model, it also includes:
[0021] Set a maximum value for the previous window rotation, and slide the conversation window in real time according to the development of the conversation;
[0022] The recalled role attributes contained in the real-time sliding dialogue window are selected and transferred to the dialogue generation model as the attributes to be controlled.
[0023] The present application also provides an intelligent dialogue system, including:
[0024] The attribute acquisition module is used to obtain the user's target attribute information in real time during the conversation with the user;
[0025] An attribute recall module, used for obtaining the controlled role attribute corresponding to the user target attribute information through an attribute recall model;
[0026] An attribute updating module, used to query the user attribute value dictionary according to the role attributes recalled in this round and the historical role attributes, and obtain an attribute value set;
[0027] The dialog generation module is used to construct an inference request text field according to a preset format based on the attribute value set using a dialog generation model; the inference request text field is used to generate a dialog reply in response to the user.
[0028] The present application also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the intelligent dialogue method described above are implemented.
[0029] The present application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the intelligent dialogue method described above when calling the computer program in the memory.
[0030] The present application provides an intelligent dialogue method, including: obtaining user target attribute information in real time during a dialogue with a user; obtaining controlled role attributes corresponding to the user target attribute information through an attribute recall model; querying a user attribute value dictionary based on the role attributes and historical role attributes recalled in this round to obtain an attribute value set; using a dialogue generation model to construct an inference request text field in a preset format based on the attribute value set; the inference request text field is used to generate a dialogue reply in response to the user.
[0031] During the human-computer dialogue process, the present application extracts the user target attribute information obtained during the dialogue with the user in real time, and recalls the controlled role attributes, thereby realizing the long-term memory capability of the role attributes during the human-computer dialogue process, solving the problem of inconsistent contextual character attributes affecting the dialogue experience, making the dialogue more intelligent, and improving the user experience in the human-computer dialogue.
[0032] The present application also provides an intelligent dialogue system, a storage medium and an electronic device, which have the above-mentioned beneficial effects and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0034] Figure 1 A flowchart of an intelligent dialogue method provided in an embodiment of the present application;
[0035] Figure 2 A schematic diagram of the structure of an intelligent dialogue system provided in an embodiment of the present application;
[0036] Figure 3A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0038] Please refer to Figure 1 , Figure 1 A flowchart of an intelligent dialogue method provided in an embodiment of the present application, the method comprising:
[0039] S101: acquiring user target attribute information in real time during the conversation with the user;
[0040] S102: Acquire the controlled role attribute corresponding to the user target attribute information through an attribute recall model;
[0041] S103: According to the role attributes recalled in this round and the historical role attributes, query the user attribute value dictionary to obtain an attribute value set;
[0042] S104: constructing an inference request text field according to a preset format based on the attribute value set using a dialog generation model; the inference request text field is used to generate a dialog reply in response to the user.
[0043] When the user conducts a human-computer dialogue, the user's target attribute information is obtained in real time. When obtaining the user's target attribute information, the user's target attribute information is mainly obtained in real time through the user's dialogue content. The user's target attribute information includes relevant information about the user himself, including but not limited to name, gender, zodiac sign, emotional status, place of origin, place of residence, hobbies, etc. When obtaining the user's target attribute information, different acquisition methods can be used according to whether the attribute is enumerable.
[0044] Specifically, the user target attribute information can be extracted from the real-time user conversation content using a classification model and an entity recognition model. The classification model is used to extract objects whose value domain is an enumerable attribute, such as "zodiac sign", "emotional status", etc., while the entity recognition model is used to extract objects whose value domain is a non-enumerable attribute, such as "hometown", "name", etc. After obtaining the user target attribute information, the user target attribute information can be updated to a cache queue such as redis.
[0045] The controlled role attribute refers to determining the controlled object according to the acquired target attribute information. For example, if the user's occupation is determined during the conversation with the user, the occupation is used as the user's target attribute information, and the controlled object is the user's company. It can be seen that the controlled attribute is a more specific content of the attribute value.
[0046] After that, according to the current dialogue content, the attribute recall model is used to obtain the current role attributes that should be controlled. Specifically, a list of attributes related to the content can be recalled for subsequent controlled generation. The attribute recall model can use the BERT classification model.
[0047] In a specific recall process, the attribute recall model can be used to obtain first recall information obtained by performing attribute recall ending with the last round of robot-side responses, and second recall information can be obtained by performing attribute recall ending with the last round of user-side responses.
[0048] Thereafter, the result of processing the first recall information and the second recall information is compared with the result of the third recall information obtained by performing attribute recall ending with the answer result generated by the model method to determine whether the recalled attribute needs to be updated; if updating is required, the result and the third recall information are merged to generate a dictionary of controlled attributes and corresponding attribute values.
[0049] After obtaining the currently controlled character attributes through the attribute recall model, a maximum context window round value can be set, and the dialogue window can be slid in real time according to the development of the dialogue; the recalled character attributes contained in the real-time sliding dialogue window are selected and passed to the dialogue generation model as the attributes to be controlled.
[0050] Finally, after the controlled attributes to be executed according to this round of recall are generated, the corresponding attribute value set is obtained by querying the attribute-attribute value dictionary in redis. The inference request text field is generated through the set prompt attribute controlled format, and finally the response of this dialogue is generated.
[0051] It can be seen that the intelligent dialogue process performed by this application includes two processes: offline training and online dialogue generation. For the offline training process, it mainly includes the training of three models. The first is the extraction model of user target attribute information for execution, which can include a classification model and an entity recognition model. Secondly, the attribute recall model and the dialogue generation model need to be trained. The attribute recall model is used to recall a list of attributes related to the content based on the current dialogue content for subsequent controlled generation, while the dialogue generation model is used to label the role attributes of the open source dialogue data. The open source bloom base model can be used as the basis for fine-tuning to train a generation model that can support attribute control and obtain the final dialogue response.
[0052] In other embodiments, the attributes of historical rounds can also be managed, first updating the controlled attributes recalled in the current round and maintaining the controlled attributes within the fixed round window. Thereafter, when generating a dialogue reply, the round in which the controlled attributes are added can be calculated to obtain the controlled attribute value, thereby concatenating the attribute controlled prompt field to obtain the current dialogue reply.
[0053] During the human-computer dialogue process, the embodiment of the present application extracts the user target attribute information obtained during the dialogue with the user in real time, and recalls the controlled role attributes, thereby achieving the long-term memory capability of the role attributes during the human-computer dialogue process, solving the problem of inconsistent context character attributes affecting the dialogue experience, making the dialogue more intelligent, and improving the user experience in the human-computer dialogue.
[0054] The following is an introduction to the intelligent dialogue system provided in an embodiment of the present application. The intelligent dialogue system described below and the intelligent dialogue method described above can be referenced to each other.
[0055] See also Figure 2 , Figure 2 This is a structural diagram of an intelligent dialogue system provided in an embodiment of the present application. The present application also provides an intelligent dialogue system, including:
[0056] The attribute acquisition module is used to obtain the user's target attribute information in real time during the conversation with the user;
[0057] An attribute recall module, used for obtaining the controlled role attribute corresponding to the user target attribute information through an attribute recall model;
[0058] An attribute updating module, used to query the user attribute value dictionary according to the role attributes recalled in this round and the historical role attributes, and obtain an attribute value set;
[0059] The dialog generation module is used to construct an inference request text field according to a preset format based on the attribute value set using a dialog generation model; the inference request text field is used to generate a dialog reply in response to the user.
[0060] Based on the above embodiments, as a preferred embodiment, the attribute acquisition module is a module for acquiring user target attribute information in real time through user conversation content.
[0061] Based on the above embodiment, as a preferred embodiment, the attribute acquisition module includes:
[0062] The model extraction unit is used to extract the user target attribute information from the real-time user conversation content using a classification model and an entity recognition model respectively; wherein the classification model is used to extract objects whose value domain is enumerable attributes; and the entity recognition model is used to extract objects whose value domain is non-enumerable attributes.
[0063] Based on the above embodiments, as a preferred embodiment, it also includes:
[0064] An offline training module is used to offline train the classification model and the entity recognition model, and to train the attribute recall model and the dialog generation model with attribute control.
[0065] Based on the above embodiments, as a preferred embodiment, the attribute recall module is a module for obtaining the first recall information obtained by performing attribute recall ending with the last round of robot-side replies through an attribute recall model, and obtaining the second recall information by performing attribute recall ending with the last round of user-side replies.
[0066] Based on the above embodiment, as a preferred embodiment, the attribute updating module includes:
[0067] A comparison unit, configured to determine whether it is necessary to update the recalled attribute according to a comparison result of the first recalled information and the second recalled information with a third recalled information obtained by performing attribute recall ending with the answer result generated by the model method;
[0068] The attribute value generating unit is used to combine the result and the third recall information to generate a controlled attribute and a corresponding attribute value dictionary when the judgment result of the comparing unit is yes.
[0069] Based on the above embodiments, as a preferred embodiment, it also includes:
[0070] The dialog window module is used to set a maximum context window rotation value and slide the dialog window in real time according to the development of the dialog;
[0071] The recalled role attributes contained in the real-time sliding dialogue window are selected and transferred to the dialogue generation model as the attributes to be controlled.
[0072] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0073] The present application also provides an electronic device, see Figure 3 , a structural diagram of an electronic device provided in an embodiment of the present application, such as Figure 3 As shown, a processor 1410 and a memory 1420 may be included.
[0074] Among them, the processor 1410 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1410 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1410 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1410 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1410 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0075] The memory 1420 may include one or more computer-readable storage media, which may be non-transitory. The memory 1420 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 1420 is at least used to store the following computer program 1421, wherein, after the computer program is loaded and executed by the processor 1410, it can implement the relevant steps in the method performed by the electronic device side disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 1420 may also include an operating system 1422 and data 1423, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 1422 may include Windows, Linux, Android, etc.
[0076] In some embodiments, the electronic device may further include a display screen 1430 , an input / output interface 1440 , a communication interface 1450 , a sensor 1460 , a power source 1470 , and a communication bus 1480 .
[0077] certainly, Figure 3 The structure of the electronic device shown does not constitute a limitation on the electronic device in the embodiments of the present application. In actual applications, the electronic device may include Figure 3 More or fewer components than shown, or combinations of certain components.
[0078] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the system provided in the embodiment, since it corresponds to the method provided in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0079] Specific examples are used herein to illustrate the principles and implementation methods of the present application, and the description of the above embodiments is only used to help understand the method and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0080] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. An intelligent dialogue method, characterized in that: include: During the conversation with the user, the user's target attribute information is obtained in real time; Acquiring the controlled role attribute corresponding to the user target attribute information through an attribute recall model; According to the role attributes and historical role attributes recalled in this round, query the user attribute value dictionary to obtain an attribute value set; Using the dialogue generation model to construct an inference request text field according to a preset format based on the attribute value set; The inference request text field is used to generate a dialogue reply in response to the user; Wherein, obtaining the controlled role attributes corresponding to the user target attribute information through the attribute recall model includes: The attribute recall model is used to obtain first recall information obtained by performing attribute recall ending with the last round of robot-side responses, and second recall information obtained by performing attribute recall ending with the last round of user-side responses; According to the role attributes and historical role attributes of this round of recall, the user attribute value dictionary is queried to obtain the attribute value set including: Determine whether it is necessary to update the recall attribute based on the comparison result of the first recall information and the second recall information with the third recall information obtained by performing attribute recall ending with the answer result generated by the model method; If so, the result and the third recall information are combined to generate a dictionary of controlled attributes and corresponding attribute values.
2. The intelligent dialogue method according to claim 1, characterized in that: Real-time acquisition of user target attribute information includes: Obtain user target attribute information in real time through user conversation content.
3. The intelligent dialogue method according to claim 2, characterized in that: The real-time acquisition of user target attribute information through user conversation content includes: The user target attribute information is extracted from the real-time user conversation content using a classification model and an entity recognition model respectively; wherein the classification model is used to extract objects whose value domain is enumerable attributes; and the entity recognition model is used to extract objects whose value domain is non-enumerable attributes.
4. The intelligent dialogue method according to claim 3, characterized in that: Before extracting the user target attribute information from the real-time user conversation content using the classification model and the entity recognition model respectively, the method further includes: The classification model and the entity recognition model are trained offline, and the attribute recall model and the dialog generation model with attribute control are trained.
5. The intelligent dialogue method according to claim 1, characterized in that: After obtaining the currently controlled role attributes through the attribute recall model, it also includes: Set a maximum value for the previous window rotation, and slide the conversation window in real time according to the development of the conversation; The recalled role attributes contained in the real-time sliding dialogue window are selected and transferred to the dialogue generation model as the attributes to be controlled.
6. An intelligent dialogue system, characterized in that: include: The attribute acquisition module is used to obtain the user's target attribute information in real time during the conversation with the user; An attribute recall module, used for obtaining the controlled role attribute corresponding to the user target attribute information through an attribute recall model; An attribute updating module, used to query the user attribute value dictionary according to the role attributes recalled in this round and the historical role attributes, and obtain an attribute value set; A dialogue generation module, configured to construct an inference request text field according to a preset format based on the attribute value set using a dialogue generation model; the inference request text field is used to generate a dialogue reply in response to the user; The attribute recall module is a module for obtaining first recall information obtained by performing attribute recall ending with the last round of robot-side replies through an attribute recall model, and obtaining second recall information by performing attribute recall ending with the last round of user-side replies; The attribute update module includes: A comparison unit, configured to determine whether it is necessary to update the recalled attribute according to a comparison result of the first recalled information and the second recalled information with a third recalled information obtained by performing attribute recall ending with the answer result generated by the model method; The attribute value generating unit is used to combine the result and the third recall information to generate a controlled attribute and a corresponding attribute value dictionary when the judgment result of the comparing unit is yes.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the intelligent dialogue method according to any one of claims 1 to 5 are implemented.
8. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the intelligent dialogue method as described in any one of claims 1 to 5 when calling the computer program in the memory.
Citation Information
Patent Citations
Attribute recall model training method and device, electronic equipment and storage medium
CN111159377A
Conversation generation method, conversation generation device and storage medium
CN116226344A