Dialogue generation method and related device

By encoding user input information and attribute information, retrieving and mapping speech templates, the problems of slow speed and low accuracy of traditional dialogue generation are solved, and efficient and accurate dialogue generation is achieved.

CN120687550APending Publication Date: 2025-09-23MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510259452.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-05
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

Traditional dialogue generation technology generates responses slowly and cannot meet the needs of real-time interaction. In addition, the generated responses are uncertain, which reduces the accuracy and efficiency of dialogue generation.

Method used

By encoding user input information, dialogue information, and user attribute information, retrieving speech templates from the knowledge base, and predicting and mapping based on interactive behaviors, reply information is generated, avoiding the performance consumption of large models and ensuring that the reply information matches the preset information.

Benefits of technology

It improves the accuracy and efficiency of dialogue generation, saves computing resources, ensures that the generated reply information matches the preset information, and avoids mismatched replies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120687550A_ABST
    Figure CN120687550A_ABST
Patent Text Reader

Abstract

The invention provides a dialogue generation method and a related device. The method comprises the steps of encoding first input information of a first user, first dialogue information and attribute information of the first user to obtain a first feature, and based on the first feature, retrieving a first verbal skill template from a knowledge base; predicting an interaction behavior between the first user and the first verbal skill template to obtain a first probability, and screening out a second verbal skill template from the first verbal skill template based on the first probability; under the condition that the second verbal skill template is not matched with the preset information, determining a third verbal skill template having a mapping relationship with the second verbal skill template from the first mapping table; and generating reply information of the first input information based on the third verbal skill template and the attribute information of the first user. According to the invention, the dialogue generation accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to artificial intelligence technology, and in particular to a dialogue generation method and related devices. Background Art

[0002] Natural language processing (NLP) is an important branch of artificial intelligence, aiming to enable computers to understand, generate, and process human language. Dialogue generation is a key branch of NLP, focusing on how to enable computers to generate natural, coherent, and contextual dialogues. However, traditional dialogue generation technology uses complex network models to output words for responses one by one. This results in a slow response speed that cannot meet the needs of real-time interaction. Furthermore, the generated responses are uncertain, reducing the accuracy and efficiency of dialogue generation. Summary of the Invention

[0003] The embodiments of the present application provide a conversation generation method and related devices, which can improve the accuracy of conversation generation.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] This embodiment of the present application provides a method for generating a dialogue, the method comprising:

[0006] Encoding first input information of a first user, first conversation information, and attribute information of the first user to obtain a first feature, and retrieving a first speech template from a knowledge base based on the first feature;

[0007] Predicting the interaction behavior between the first user and the first speech template to obtain a first probability, and filtering out a second speech template from the first speech template based on the first probability;

[0008] If the second speech template does not match the preset information, determining a third speech template having a mapping relationship with the second speech template from a first mapping table, wherein the first mapping table includes mapping relationships between different speech templates;

[0009] Based on the third speech template and the attribute information of the first user, reply information for the first input information is generated.

[0010] The present embodiment provides a conversation generation device, including:

[0011] a template retrieval module, configured to encode the first input information of the first user, the first dialogue information, and the attribute information of the first user to obtain a first feature, and retrieve a first speech template from a knowledge base based on the first feature;

[0012] a template screening module, configured to predict the interaction behavior between the first user and the first speech template, obtain a first probability, and screen a second speech template from the first speech template based on the first probability;

[0013] a template mapping module, configured to determine, from a first mapping table, a third speech template having a mapping relationship with the second speech template when the second speech template does not match preset information, wherein the first mapping table includes mapping relationships between different speech templates;

[0014] A reply generation module is used to generate reply information for the first input information based on the third speech template and the attribute information of the first user.

[0015] An embodiment of the present application provides an electronic device, including:

[0016] a memory for storing computer-executable instructions;

[0017] The processor is used to implement the dialogue generation method provided in the embodiment of the present application when executing the computer-executable instructions stored in the memory.

[0018] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the dialogue generation method provided in an embodiment of the present application when executed by a processor.

[0019] An embodiment of the present application provides a computer program product, including a computer program or computer-executable instructions. When the computer program or computer-executable instructions are executed by a processor, the dialogue generation method provided in the embodiment of the present application is implemented.

[0020] The embodiments of the present application have the following beneficial effects:

[0021] The first input information of the first user, the first dialogue information and the attribute information of the first user are encoded to obtain a first feature, and based on the first feature, a first speech template is retrieved from the knowledge base, the interaction behavior of the first user with the first speech template is predicted to obtain a first probability, and a second speech template is screened out from the first speech template based on the first probability. In this way, the first speech template is retrieved and the interaction behavior of the first user with the first speech template is predicted through the first feature, and the speech template in the knowledge base that is semantically closest to the first input information is determined, thereby avoiding the performance consumption of generating speech through a large model, saving computing resources, and improving the efficiency and accuracy of dialogue generation. When the second speech template does not match the preset information, a third speech template having a mapping relationship with the second speech template is determined from the first mapping table, wherein the first mapping table includes mapping relationships between different speech templates. Based on the third speech template and the attribute information of the first user, reply information of the first input information is generated, thereby ensuring that the generated reply information of the first input information matches the preset information, avoiding the generation of reply information that does not match the preset information, and improving the accuracy of dialogue generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 This is a schematic diagram of the architecture of the dialogue generation system provided in an embodiment of the present application;

[0023] Figure 2 is a structural diagram of an electronic device provided in an embodiment of the present application;

[0024] Figure 3A This is a first flow chart of the method for generating a conversation provided in an embodiment of the present application;

[0025] Figure 3B This is a second flow chart of the conversation generation method provided in an embodiment of the present application;

[0026] Figure 3C This is a third flow chart of the conversation generation method provided in an embodiment of the present application;

[0027] Figure 3D This is a fourth flow chart of the conversation generation method provided in an embodiment of the present application;

[0028] Figure 3E This is a fifth flow chart of the conversation generation method provided in an embodiment of the present application;

[0029] Figure 3F This is a sixth flow chart of the conversation generation method provided in an embodiment of the present application;

[0030] Figure 4 This is a first principle diagram of dialogue generation provided by an embodiment of the present application;

[0031] Figure 5 This is a schematic diagram of the management page for the corpus extraction task provided in an embodiment of the present application;

[0032] Figure 6 This is a schematic diagram of a new page for a corpus extraction task provided in an embodiment of the present application;

[0033] Figure 7 This is a schematic diagram of the intention diffusion provided by the embodiment of the present application;

[0034] Figure 8 This is a diagram of the corpus processing principle provided by the embodiment of the present application;

[0035] Figure 9 This is a first principle diagram of intent classification provided by an embodiment of the present application;

[0036] Figure 10 This is a schematic diagram of the speech review page provided in an embodiment of the present application;

[0037] Figure 11 This is a schematic diagram of a model page provided in an embodiment of the present application;

[0038] Figure 12 Schematic diagram of the training of the text embedding model provided in the embodiment of the present application;

[0039] Figure 13 Schematic diagram of the training of the intent classification model provided in the embodiment of the present application;

[0040] Figure 14 This is a schematic diagram of the probability of repayment prediction of the effect ranking model provided in the embodiment of the present application;

[0041] Figure 15 1 is a schematic diagram of the training of the effect refinement model provided in the embodiment of the present application;

[0042] Figure 16 This is a schematic diagram of the business speech library page provided in an embodiment of the present application;

[0043] Figure 17 This is the second principle diagram of the dialogue generation provided in the embodiment of the present application.

[0044] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of distinction between the advantages and disadvantages of the solutions or the priority in the implementation process. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0046] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0047] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0048] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0049] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.

[0050] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0051] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0052] 1) The first input information of the first user refers to the text, voice or other forms of data input provided by the first user when currently interacting with the system. The embodiment of the present application does not limit the first input information. The first input information can be the first user's query statement, instruction, feedback content on the first dialogue information, etc., where the query statement is used to query the content of interest to the first user, and the instruction is used to control the system to perform a specific task.

[0053] 2) The first conversation information of the first user refers to all conversation records generated during the previous interaction between the first user and the system. The embodiment of the present application does not limit the first conversation information. The first conversation information can be the conversation context, historical query records, and historical interaction behaviors of the first user.

[0054] 3) The attribute information of the first user refers to the identity characteristics, behavioral habits, preference settings and other data of the first user. The embodiment of the present application does not limit the attribute information of the first user. The attribute information of the first user can be the age, gender, geographic location, historical preferences, etc. of the first user.

[0055] 4) The knowledge base is a database that stores preset speech templates. The embodiment of the present application does not limit the specific form of the knowledge base. The knowledge base can be a relational database, a graph database, a vector database, etc.

[0056] 5) The first speech template refers to the most matching speech template retrieved from the knowledge base based on the first feature. The embodiment of the present application does not limit the specific form of the first speech template. The first speech template can be a text template, a voice template, an image template, etc.

[0057] In the related art, the retrieval based on the customer's question text or intention has limited semantic understanding and cannot fully understand complex or vague questions. In addition, the generation of speech through large models takes up a lot of computing resources, which reduces resource utilization. At the same time, the generated speech cannot ensure compliance, which reduces the accuracy of the speech. To address the above problems, the embodiments of the present application provide a dialogue generation method, device, electronic device, computer-readable storage medium and computer program product to improve the accuracy of dialogue generation.

[0058] The dialogue generation method described in the embodiment of the present application can be applied to various fields, such as information recommendation, voice dialogue and other fields. That is, the dialogue generation method in the embodiment of the present application is not limited to a certain field.

[0059] The following describes an exemplary application of the electronic device provided in the embodiment of the present application. The device provided in the embodiment of the present application can be implemented as a terminal or a server. The following describes an exemplary application when the device is implemented as a server.

[0060] See also Figure 1 , Figure 1 This is an architectural diagram of a conversation generation system 100 provided in an embodiment of the present application. To support a conversation generation application, a terminal (terminal 400 is shown as an example) is connected to a server 200 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.

[0061] The terminal 400 is used to send the first input information, first conversation information and attribute information of the first user to the server 200 through the network 300. The server 200 is used to encode the first input information, first conversation information and attribute information of the first user to obtain a first feature, and based on the first feature, retrieve a first speech template from the knowledge base; predict the interaction behavior between the first user and the first speech template to obtain a first probability, and filter out a second speech template from the first speech template based on the first probability; when the second speech template does not match the preset information, determine a third speech template that has a mapping relationship with the second speech template from the first mapping table; based on the third speech template and the attribute information of the first user, generate reply information for the first input information, return the reply information for the first input information to the terminal 400, and the terminal 400 displays the reply information for the first input information through the graphical interface 410.

[0062] Next, an example of a session generation performed by terminal 400 will be described.

[0063] In some embodiments, the terminal 400 can independently complete the dialogue generation task. For example, the terminal 400 is used to encode the first input information of the first user, the first dialogue information and the attribute information of the first user to obtain a first feature, and based on the first feature, retrieve a first speech template from the knowledge base; predict the interaction behavior between the first user and the first speech template to obtain a first probability, and filter out a second speech template from the first speech template based on the first probability; when the second speech template does not match the preset information, determine a third speech template that has a mapping relationship with the second speech template from the first mapping table; based on the third speech template and the attribute information of the first user, generate reply information for the first input information, and display the reply information for the first input information through the graphical interface 410.

[0064] In one implementation scenario, the server or terminal can recommend information to the user, encode the user's query information, historical query information and user attribute information to obtain a first feature, and based on the first feature, retrieve a first recommended speech template from the recommended speech library; predict the user's interaction behavior with the first recommended speech template to obtain a first probability, and filter out a second recommended speech template from the first recommended speech template based on the first probability; when the second recommended speech template does not match the preset recommendation information, determine a third recommended speech template that has a mapping relationship with the second recommended speech template from the first mapping table; generate a first recommended speech based on the third recommended speech template and the user's attribute information to guide the user to interact with the first recommended speech.

[0065] In one implementation scenario, a server or terminal can conduct a voice conversation with a user. The user's voice information, historical voice information, and user attribute information are encoded to obtain a first feature, and based on the first feature, a first reply speech template is retrieved from a reply speech library; the user's interaction behavior with the first reply speech template is predicted to obtain a first probability, and a second reply speech template is screened from the first reply speech template based on the first probability; if the second reply speech template does not match the preset reply information, a third reply speech template having a mapping relationship with the second reply speech template is voiced out from a first mapping table; based on the third reply speech template and the user's attribute information, a first reply speech is generated, speech is generated for the first reply speech, and the generated speech is sent to the user.

[0066] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0067] The terminal 400 may be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, intelligent voice interaction device, smart home appliance, vehicle-mounted terminal, aircraft, etc., but is not limited thereto. The terminal and the server may be connected directly or indirectly via wired or wireless communication, which is not limited in the embodiments of the present application.

[0068] See also Figure 2 , Figure 2 is a structural diagram of an electronic device provided in an embodiment of the present application, Figure 2 The electronic device 500 shown may be Figure 1 In the terminal 400 or server 200, the electronic device 500 includes: at least one processor 510, a memory 550, and at least one network interface 520. The various components in the server 200 are coupled together through a bus system 540. It can be understood that the bus system 540 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 2 Various buses are labeled as bus system 540 .

[0069] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0070] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls;

[0071] In some embodiments, when the terminal 400 independently completes the dialogue generation task, the server 200 provided by the embodiment of the present application does not include the user interface 530.

[0072] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, a hard drive, an optical drive, etc. The memory 550 may optionally include one or more storage devices physically located away from the processor 510.

[0073] The memory 550 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.

[0074] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.

[0075] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0076] A network communication module 552 for reaching other computing devices via one or more (wired or wireless) network interfaces 520 , exemplary network interfaces 520 including Bluetooth, WiFi, and USB;

[0077] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., a display screen, a speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripheral devices and displaying content and information);

[0078] In some embodiments, when the terminal 400 independently completes the dialogue generation task, the server 200 provided by the embodiment of the present application may not include the presentation module 553.

[0079] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions; in some embodiments, when the embodiment independently completes the dialogue generation task by the terminal 400, the server 200 provided in the embodiment of the present application may not include the presentation module 553.

[0080] In some embodiments, the apparatus provided in the embodiments of the present application may be implemented in software. Figure 2 Dialogue generation device 555 stored in memory 550 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: template retrieval module 5551, template screening module 5552, template mapping module 5553, reply generation module 5554, and template construction module 5555. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.

[0081] It should be noted that in the following example of dialogue generation, those skilled in the art can apply the dialogue generation method provided in the embodiment of the present application to generate dialogues based on their understanding of the following.

[0082] See also Figure 3A , Figure 3A This is a first flow chart of the dialogue generation method provided in the embodiment of the present application, which will be combined with Figure 3A The steps shown are used for illustration. The dialogue generation method provided in the embodiment of the present application can be implemented by the server or the terminal alone, or by the server and the terminal in collaboration. The following will be described using the collaborative implementation by the server and the terminal as an example.

[0083] In step 101, the first input information of the first user, the first dialogue information and the attribute information of the first user are encoded to obtain a first feature, and based on the first feature, a first speech template is retrieved from a knowledge base.

[0084] Here, encoding refers to the process of mapping the first input information of the first user, the first conversation information, and the attribute information of the first user into a high-dimensional space and converting them into a computer-processable numerical value or vector form. This is used to convert visible text data into an imperceptible feature vector. The embodiments of this application do not limit the encoding method, and the encoding may be word embedding, feature extraction, vectorization, etc. The first feature refers to the numerical value or vector representation obtained by the encoding process. The embodiments of this application do not limit the specific form of the first feature, and the first feature may be a numerical vector, a feature matrix, an embedded vector, etc.

[0085] It should be noted that when the data type of the first input information and the first conversation information of the first user is voice, voice recognition is performed on the first input information and the first conversation information of the first user to obtain the first input information of the first user in text type and the first conversation information of the first user in text type.

[0086] In some embodiments, see Figure 3B , Figure 3B This is a second flow chart of the dialogue generation method provided in the embodiment of the present application, for Figure 3A In step 101 shown, the first input information of the first user, the first dialogue information and the attribute information of the first user are encoded to obtain the first feature, which can be obtained by Figure 3B Steps 1011A to 1013A are implemented as described below.

[0087] In step 1011A, the first input information is merged with the first dialogue information to obtain third input information.

[0088] In some embodiments, step 1011A may be implemented by concatenating the first conversation information and the first input information to obtain third input information.

[0089] For example, the first conversation message (e.g., ["What's the weather like today?", "It's sunny today, the temperature is 25°C."]) and the first input message (e.g., "What about tomorrow?") are concatenated to obtain the third input message (e.g., "What's the weather like today? It's sunny today, the temperature is 25°C. What about tomorrow?").

[0090] In step 1012A, the third input information is encoded to obtain a fifth feature.

[0091] Here, the third input information is the new input information obtained by concatenating the first conversation information and the first input information. In this embodiment of the present application, this information contains the context of the user interaction, which helps to accurately understand the user's intention. Encoding refers to performing a series of encoding steps on the third input information to capture the deep structure and semantics of the third input information.

[0092] In some embodiments, encoding is achieved through multiple encoding layers, see Figure 3C , Figure 3C This is a third flow chart of the dialogue generation method provided in the embodiment of the present application, which is directed to Figure 3B Step 1012A shown can be performed by Figure 3C Steps 10121A to 10124A are implemented as described below.

[0093] In step 10121A, information extraction is performed on the third input information to obtain multiple information segments.

[0094] Here, information extraction refers to dividing the third input information into multiple independent information segments according to certain rules or methods. This embodiment of the present application does not limit the information extraction method, and information extraction can be based on sentences, paragraphs, keywords, punctuation marks, etc. Information segments refer to independent text units obtained through information extraction. This embodiment of the present application does not limit the specific form of information segments, and information segments can be sentences, phrases, keyword groups, etc.

[0095] In some embodiments, step 10121A can be implemented by performing information extraction on the third input information according to preset extraction rules to obtain information fragments. The extraction rules can be at least one of the following rules: extraction based on punctuation marks, extraction based on keywords, extraction based on the number of characters, etc.

[0096] For example, when the extraction rule is based on punctuation marks, the punctuation mark is a period. Given the third input information as "The weather is nice today. Let's go for a walk in the park," the extracted information segments are: "The weather is nice today" and "Let's go for a walk in the park."

[0097] In step 10122A, each information segment is input into the first coding layer, and each information segment is encoded by the first coding layer to obtain a first coding feature output by the first coding layer.

[0098] The number of first coding features output by the first coding layer is the same as the number of information segments.

[0099] Here, the first encoding layer is an encoding module in the neural network, which is used to convert the input information fragments into feature representations. The embodiments of the present application do not limit the specific structure of the first encoding layer, and the first encoding layer can be a recurrent neural network, a convolutional neural network, etc. The encoding module in the neural network includes multiple encoding layers, which are used to implement the step of encoding the third input information to obtain the fifth feature.

[0100] In some embodiments, the coding layer includes a convolution layer, a pooling layer, and a mapping layer. The above-mentioned "encoding each information segment through the first coding layer to obtain the first coding feature output by the first coding layer" can be achieved in the following way: for each information segment, the information segment is convolved through the convolution layer to obtain the convolution feature; the convolution feature is pooled through the pooling layer to obtain the pooling feature; the pooling feature is mapped through the mapping layer to obtain the first coding feature output by the first coding layer.

[0101] For example, the information fragment is convolved to obtain the convolution feature (such as [0.14, 0.13, -0.06, 0.15, 0.03, 0.06]), the convolution feature is pooled to obtain the pooled feature (such as [0.14, 0.13, -0.06]), and the pooled feature is mapped to obtain the first encoding feature output by the first encoding layer (such as [0.52, 0.13, -0.06, 0.15]).

[0102] In step 10123A, the first coding feature output by the n-1th coding layer is input to the nth coding layer, and the following processing is performed through the nth coding layer: the first coding feature output by the n-1th coding layer is fused to obtain the second coding feature, and the second coding feature is encoded to obtain the first coding feature output by the nth coding layer.

[0103] Wherein, n is a positive integer that increases successively, and 1<n≤N.

[0104] Here, the first coding feature output by the n-1th coding layer refers to the feature representation generated during the coding process of the previous layer (n-1th layer), which is used to be passed to the next layer for further processing. The embodiment of the present application does not limit the specific form of the first coding feature, and the first coding feature can be a vector, matrix or other form of data structure. Fusion refers to combining two or more first coding features into a new feature representation (i.e., the second coding feature) through specific operations (such as weighted summation, splicing, attention mechanism, etc.). The embodiment of the present application does not limit the specific method of fusion, and the fusion can be a splicing operation, a weighted summation operation, etc.

[0105] In some embodiments, the fusion of the first coding features output by the n-1th coding layer in step 10123A to obtain the second coding feature can be achieved in the following manner: when the number of first coding features output by the n-1th coding layer is greater than a quantity threshold, the two first coding features output by the n-1th coding layer are fused to obtain the second coding feature; when the number of first coding features output by the n-1th coding layer is less than or equal to the quantity threshold, the first coding feature output by the n-1th coding layer is determined as the third coding feature, and the first coding feature and the third coding feature output by the n-1th coding layer are spliced ​​to obtain the second coding feature.

[0106] Here, the quantity threshold is used to determine whether the number of the first coding feature meets a specific condition. The embodiment of the present application does not limit the quantity threshold. The quantity threshold can be a set fixed value or a value dynamically adjusted according to the data distribution. The third coding feature is a feature representation generated by directly copying or converting the first coding feature when the number of the first coding feature is less than or equal to the quantity threshold. The embodiment of the present application does not limit the specific form of the third coding feature. The third coding feature can be the same form as the first coding feature or a form after a simple transformation. Splicing refers to connecting two or more features in a specific dimension to form a new feature representation.

[0107] In some embodiments, the above-mentioned "fusing the two first coding features output by the n-1th coding layer to obtain the second coding feature" can be implemented in the following way: In some embodiments, step 10123A can be implemented in the following way: splicing the two first coding features output by the n-1th coding layer to obtain the second coding feature; or, performing weighted summation on the two first coding features output by the n-1th coding layer to obtain the second coding feature.

[0108] For example, the first coding feature A (such as [0.14, 0.13, -0.06]) output by the n-1th coding layer and the first coding feature B (such as [0.15, 0.03, 0.06]) output by the n-1th coding layer are spliced ​​to obtain the second coding feature (such as [0.14, 0.13, -0.06, 0.15, 0.03, 0.06]); or, the first coding feature A output by the n-1th coding layer and the first coding feature B output by the n-1th coding layer are weighted and summed to obtain the second coding feature (taking the weights of the two first coding features A output by the n-1th coding layer as an example, the second molecular coding feature such as [0.28, 0.16, 0] is obtained).

[0109] Continuing with the above example, when the number (e.g., 4) of the first coding features output by the n-1th coding layer (e.g., [[0.14, 0.13, -0.06, 0.15, 0.03, 0.06], [0.14, 0.13, -0.06], [0.52, 0.13, -0.06, 0.15], [0.15, 0.12, 0.06]]) is greater than the quantity threshold (e.g., 1), the two first coding features output by the n-1th coding layer are fused (e.g., [0.14, 0.13, -0.06, 0.15, 0.03, 0.06] and [0.14, 0.13, -0.06] are fused, and [0.52, 0.13, -0.06, 0.15] and [0.15, 0.12, 0.06] are fused) to obtain the second coding feature. code features (such as [0.14, 0.13, -0.06, 0.15, 0.03, 0.06, 0.14, 0.13, -0.06] and [0.52, 0.13, -0.06, 0.15, 0.15, 0.12, 0.06]); when the number (such as 1) of the first coding features (such as [0.52, 0.13, -0.06, 0.15]) output by the n-1th coding layer is less than or equal to the quantity threshold (such as 1), the first coding feature output by the n-1th coding layer is determined as the third coding feature, and the first coding feature and the third coding feature output by the n-1th coding layer are concatenated to obtain the second coding feature (such as [0.52, 0.13, -0.06, 0.15, 0.52, 0.13, -0.06, 0.15]).

[0110] In step 10124A, the first coding feature output by the Nth coding layer is determined as the fifth feature.

[0111] Continue to see Figure 3B In step 1013A, the attribute information of the first user is encoded to obtain the sixth feature, and the sixth feature and the fifth feature are fused to obtain the first feature.

[0112] In some embodiments, the above-mentioned "encoding the attribute information of the first user to obtain the sixth feature" can be achieved by: convolving the attribute information of the first user to obtain a convolution feature, pooling the convolution feature to obtain a pooled feature, and mapping the pooled feature to obtain the first feature.

[0113] For example, the attribute information of the first user (such as "the first user's name: XX") is convolved to obtain convolution features (such as [0.14, 0.13, -0.06, 0.15, 0.03, 0.06]), the convolution features are pooled to obtain pooled features (such as [0.14, 0.13, -0.06]), and the pooled features are mapped to obtain the first feature (such as [0.52, 0.13, -0.06, 0.15]).

[0114] Following the above embodiment, the above step of "fusing the sixth feature and the fifth feature to obtain the first feature" is similar to the above step of "fusing the two first coding features output by the n-1th coding layer to obtain the second coding feature", and will not be repeated here.

[0115] Through the embodiments of the present application, by encoding text fragments through coding layers (such as convolutional neural networks, recurrent neural networks, etc.), it is possible to effectively extract the semantic features of the text and generate high-quality feature representations. For subsequent tasks, through the design of multi-layer coding layers, the feature representations are gradually integrated and optimized to generate deeper features, thereby improving the model's ability to understand complex texts. Through the quantity threshold and feature fusion mechanism, the processing strategy can be flexibly adjusted according to the dynamic changes in the number of features, avoiding information loss or redundancy and improving the accuracy and robustness of feature representation.

[0116] In some embodiments, the first conversation message includes the second input message of the first user and the first reply message for replying the second input message, see Figure 3D , Figure 3D This is a fourth flow chart of the method for generating a dialogue according to an embodiment of the present application. Figure 3A Before retrieving the first speech template from the knowledge base based on the first feature in step 101, execute Figure 3D Steps 201 to 204 are described in detail below.

[0117] In step 201, first reply information is extracted from first conversation information.

[0118] Here, step 201 may be implemented in the following manner: determining the dialogue information other than the second input information of the first user in the first dialogue information as the first reply information replying to the second input information.

[0119] For example, the dialogue information (such as "How is the weather today?", "It's sunny today, and the temperature is 25 degrees Celsius") other than the second input information (such as "How is the weather today?") of the first user in the first dialogue information (such as "How is the weather today?", "It's sunny today, and the temperature is 25 degrees Celsius") is determined as the first reply information in reply to the second input information.

[0120] In step 202, a speech template is constructed based on the first reply information to obtain a fifth speech template.

[0121] In some embodiments, step 202 can be implemented in the following manner: extracting the first keyword from the first reply information; querying the first text corresponding to the first keyword from the fourth mapping table, wherein the fourth mapping table includes the correspondence between different keywords and different texts; replacing the first keyword in the first reply information with the first text to obtain the fifth speech template.

[0122] It should be noted that the fourth mapping table is a data structure for storing the correspondence between keywords and texts. The embodiment of the present application does not limit the fourth mapping table. The fourth mapping table can be a data structure implemented as a hash table, a data structure implemented as an array, etc., for quickly performing lookup, insertion and deletion operations on the correspondence between the composition structure and the category, wherein the hash table uses a hash function to calculate the index value, and maps the composition structure of the input first keyword in the keyword to the position in the hash table to access the text. Continuing with the above example, extract the first keyword (such as sunny, 25℃) from the first reply message; query the first text (such as {weather}) corresponding to the first keyword (such as sunny) from the fourth mapping table; replace the first keyword in the first reply message with the first text to obtain the fifth speech template (such as today {weather}, temperature {temperature}℃).

[0123] In step 203, the intent of the first reply message is identified to obtain the intent of the first reply message, and the intent of the first reply message is determined as the fifth intent of the fifth speech template.

[0124] Here, intent recognition refers to the process of determining the specific purpose or need expressed in the user conversation by analyzing the content of the conversation. The embodiment of the present application does not limit the method of intent recognition, and the method of intent recognition can be a rule-based method, a statistics-based method, or a deep learning-based method, etc. The fifth intent refers to one of the specific purposes or needs of the user conversation determined by intent recognition, which usually corresponds to the fifth speech template. The embodiment of the present application does not limit the specific content of the fifth intent, and the fifth intent can be an intention to query information, request services, or other types of intentions.

[0125] In some embodiments, the above-mentioned step of "performing intent recognition on the first reply message to obtain the intention of the first reply message" is similar to the step of performing intent recognition on the first input message to obtain the first intention of the first user. For details, see the step "performing intent recognition on the first input message to obtain the first intention of the first user".

[0126] In some embodiments, after determining the intention of the first reply information as the fifth intention of the fifth speech template in step 203, steps 2031 to 2034 are executed (not shown in the figure), which are described in detail below.

[0127] In step 2031, the second user's conversation information is clustered to obtain clusters. Here, the second user is the user interacting with the agent. This embodiment of the application does not restrict the second user. The second user can be a user interacting with the agent including the first user, or a user other than the first user among the users interacting with the agent. Clustering is a method of grouping data (such as the third conversation information) into groups with similar characteristics. This embodiment of the application does not restrict the clustering method, and the clustering method can be K-means clustering, hierarchical clustering, etc.

[0128] In some embodiments, step 2031 can be implemented by: performing text splitting on the second user's conversation information to obtain second conversation information; determining the first reply information and the second conversation information as third conversation information, and clustering the third conversation information to obtain clusters.

[0129] Continuing with the above embodiment, the above-mentioned "text splitting of the second user's conversation information to obtain the second conversation information" can be achieved in the following way: by sliding a window on the second user's conversation information, the conversation information of the second user in the window is determined as the second conversation information.

[0130] For example, given a window with three rounds of dialogue, the window is slid on the dialogue information of the second user (such as A1B1A2B2A3B3A4B4), and the dialogue information of the second user in the window (such as A1B1A2B2A3B3A4 and A2B2A3B3A4B4) is determined as the second dialogue information, where A is used to represent the content input by the second user, and B is used to represent the language provided by the system for the content input by the second user.

[0131] Continuing with the above embodiment, the above-mentioned "clustering the third conversation information to obtain clusters" can be achieved by: performing intent recognition on the third conversation information to obtain the intent of the third conversation information, and encoding the third conversation information and the intent of the third conversation information to obtain the sixth feature; determining the distance between each sixth feature, and when the distance is less than a distance threshold, grouping the third conversation information corresponding to each sixth feature into the same cluster.

[0132] It should be noted that the distance is the spatial interval between two points (such as the sixth feature). The embodiment of the present application does not limit the distance. The distance can be the Euclidean distance, Jaccard distance, etc. of the two sixth features.

[0133] Continuing from the above embodiment, the step of "performing intent recognition on the third conversation information to obtain the intent of the third conversation information" is similar to the step of performing intent recognition on the first input information to obtain the first intention of the first user. For details, see the step "performing intent recognition on the first input information to obtain the first intention of the first user".

[0134] Continuing from the above embodiment, the step of "encoding the third conversation information and the intention of the third conversation information to obtain the sixth feature" is similar to the step of "encoding the attribute information of the first user to obtain the sixth feature", and will not be repeated here.

[0135] For example, the distance (e.g., 0.01) between each pair of sixth features (e.g., [0.14, 0.13, -0.06] and [0.14, 0.13, -0.05]) is determined, and when the distance is less than a distance threshold (e.g., 0.1), the third conversation information corresponding to each pair of sixth features is divided into the same cluster.

[0136] In step 2032 , a first cluster corresponding to the fifth intent is determined from the clusters.

[0137] In some embodiments, step 2032 may be implemented by sorting multiple clusters according to the number of conversation information in the clusters that meets the fifth intent to obtain a sorting result, and determining some clusters in the sorting result as the first cluster.

[0138] It should be noted that sorting is the process of arranging clusters in a specific order (usually ascending or descending order). The embodiment of the present application does not limit the sorting process, and the sorting can be ascending sorting, descending sorting, etc.

[0139] For example, the number of conversation information of cluster A that meets the fifth intent is 25, and the number of conversation information of cluster B that meets the fifth intent is 20. Based on the number of conversation information that meets the fifth intent (such as 25 and 20), the clusters are sorted in ascending order to obtain an ascending sorting result (such as [B, A]), and the front part of the clusters in the ascending sorting result (such as cluster B) is determined as the first cluster. Based on the number of conversation information that meets the fifth intent (such as 25 and 20), the clusters are sorted in descending order to obtain a descending sorting result (such as [A, B]), and the back part of the object vectors in the descending sorting result (such as cluster B) is determined as the first cluster.

[0140] In step 2033 , when the number of conversation messages included in the first cluster is greater than the number threshold, intent diffusion is performed on the fifth intent to obtain a sixth intent.

[0141] It should be noted that the quantity threshold refers to a preset value used to determine whether the number of conversation messages in a cluster reaches a certain standard. The embodiment of the present application does not limit the specific numerical value of the quantity threshold, and the quantity threshold may be a fixed value, a dynamically adjusted value, or other forms of thresholds. Intent diffusion refers to expanding or refining the intent in the cluster to generate a new intent when the number of conversation messages in the cluster exceeds the quantity threshold. The embodiment of the present application does not limit the specific method of intent diffusion, and intent diffusion may be based on semantic expansion, context analysis, or other technical means. The sixth intent refers to a new intent generated through intent diffusion, which is usually a further refinement or expansion of the fifth intent. The embodiment of the present application does not limit the specific content of the sixth intent, and the sixth intent may be a more specific query, a more complex service request, or other types of intent.

[0142] In some embodiments, the diffusion of the fifth intent in step 2033 to obtain the sixth intent can be achieved in the following way: when the first reply message contains a preset keyword, the eighth intent corresponding to the preset keyword is queried from the third mapping table, and the eighth intent is determined as the sixth intent, and the third mapping table contains the correspondence between different keywords and different intentions; when the first reply message does not contain the preset keyword, the preset intent is determined as the sixth intention.

[0143] Here, the preset keywords refer to a predefined set of specific words or phrases used to quickly identify key content in conversation information. The embodiments of the present application do not limit the specific content of the preset keywords. The preset keywords can be field-related terms, user-common vocabulary, or other specific vocabulary. The preset intent refers to the default intent used when the preset keywords are not detected in the conversation information. The embodiments of the present application do not limit the specific content of the preset intent. The preset intent can be a general intent, a default service request, or other types of intent.

[0144] It should be noted that the embodiment of the present application does not limit the third mapping table. The data structure of the third mapping table is similar to the data structure of the fourth mapping table and will not be described in detail here.

[0145] For example, when the first reply message contains preset keywords (such as later, a while, etc.), the eighth intention corresponding to the preset keywords (that is, the fifth intention with additional conditions) is queried from the third mapping table, and the eighth intention is determined as the sixth intention; when the first reply message does not contain the preset keywords, the preset intention (that is, the ordinary fifth intention) is determined as the sixth intention.

[0146] In step 2034 , the seventh intent is selected from the fifth intent and the sixth intent, and the seventh intent is replaced with the fifth intent.

[0147] In some embodiments, the above-mentioned "filtering out the seventh intention from the fifth intention and the sixth intention" can be achieved in the following ways: classify the fifth intention and the sixth intention to obtain the category of intention; filter out the first category from multiple categories according to a preset priority; and determine the intention belonging to the first category in the fifth intention and the sixth intention as the seventh intention.

[0148] Here, classification refers to dividing intents into different categories according to certain rules or standards in order to better manage intents. The embodiment of the present application does not limit the specific method of classification, and classification can be based on a machine learning model, a rule engine, or other classification technologies. The category of intent refers to the specific group into which the intent is divided through classification. The embodiment of the present application does not limit the specific content of the category of intent, and the category of intent can be a business category, a chat category, etc. The preset priority refers to the pre-defined order of importance of each category in the processing order. The embodiment of the present application does not limit the specific rules of the preset priority, and the preset priority can be that the intent of the business category takes precedence over the intent of the chat category. The first category refers to the highest priority category screened out from multiple categories according to the preset priority.

[0149] For example, the fifth intention (such as repayment intention) and the sixth intention (such as chatting about the weather intention) are classified to obtain intent categories (such as business category and chat category); according to the preset priority, the first category (such as business category) is filtered out from multiple categories; the intention belonging to the first category in the fifth intention and the sixth intention (such as repayment intention) is determined as the seventh intention.

[0150] In step 204, a knowledge base is constructed based on the fifth speech template and the corresponding fifth intent.

[0151] In some embodiments, step 204 can be implemented by combining the fifth speech template and the corresponding fifth intent to obtain combined information, and dividing the combined information into the same knowledge base.

[0152] For example, the fifth speech template (such as today {weather}, temperature {temperature}℃) and the corresponding fifth intention (such as temperature query) are combined to obtain combined information (such as ["Today {weather}, temperature {temperature}℃", "Temperature query"]), and the combined information is divided into the same knowledge base.

[0153] Through the embodiments of the present application, by splitting and grouping conversation information through sliding window and clustering technology, it is possible to effectively identify conversation information with similar intents and generate high-quality clusters. When the number of conversation information in a cluster exceeds a threshold, new intents (such as the sixth intent) are generated through intent diffusion, which can expand or refine the original intent and improve the flexibility and adaptability of the conversation system. Through classification and priority screening, the highest priority intent (such as the seventh intent) is screened out from multiple intents, ensuring that the system prioritizes important intents and improving the efficiency and accuracy of conversation generation.

[0154] In some embodiments, see Figure 3E , Figure 3E This is a fifth flow chart of the dialogue generation method provided in the embodiment of the present application, which is directed to Figure 3A In step 101, based on the first feature, the first speech template is retrieved from the knowledge base, which can be obtained by Figure 3E Steps 1011B to 1014B are implemented as described below.

[0155] In step 1011B, the second feature corresponding to each speech template in the knowledge base is retrieved from the second mapping table.

[0156] Among them, the second mapping table includes the correspondence between different speech templates and different features.

[0157] It should be noted that the second mapping table is a data structure used to store the correspondence between speech templates and features. The embodiment of the present application does not limit the correspondence between different speech templates and different features. The correspondence can be that each speech template corresponds to its own feature. The embodiment of the present application does not limit the second mapping table. The data structure of the second mapping table is similar to that of the fourth mapping table and will not be repeated here.

[0158] In step 1012B, based on the first similarity between the first feature and the second feature, a fourth speech template is selected from the knowledge base.

[0159] It should be noted that similarity is a measure of similarity between two data (such as the first feature and the second feature). The embodiment of the present application does not limit the similarity. The similarity can be cosine similarity, Jaccard similarity, etc. The decoding process is used to convert the encoded first feature and second feature into readable or usable objects.

[0160] Continuing from the above embodiment, step 1012B can be implemented in the following manner: when the first similarity between the first feature and the second feature is greater than the similarity threshold, the speech template corresponding to the first feature in the knowledge base is determined as the fourth speech template.

[0161] For example, when the first similarity (such as 0.85) between the first feature (such as [0.14, 0.13, -0.06, 0.15, 0.03, 0.06]) and the second feature (such as [0.14, 0.13, -0.06]) is greater than the similarity threshold (such as 0.8), the speech template corresponding to the first feature in the knowledge base (such as today {weather}, temperature {temperature}℃) is determined as the fourth speech template.

[0162] In step 1013B, based on the first input information, the first intention of the first user is identified.

[0163] In some embodiments, step 1013B may be implemented by performing intent recognition on the first input information to obtain the first intention of the first user.

[0164] Continuing from the above embodiment, the above-mentioned "performing intent recognition on the first input information to obtain the first intention of the first user" can be achieved in the following manner: fusing the first input information and the first dialogue information to obtain the second input information, and performing attention processing on the second input information to obtain the third feature; performing first gating processing on the third feature to obtain the fourth feature, and decoding the fourth feature to obtain the second intention; activating the fourth feature, and decoding the activated fourth feature to obtain the third intention; and screening out the first intention of the first user from the second intention and the third intention.

[0165] Here, attention processing refers to weighted processing of input information through an attention mechanism to highlight important information and suppress irrelevant information. The embodiment of the present application does not limit the specific method of attention processing. Attention processing can be based on a self-attention mechanism, a multi-head attention mechanism, or other attention technologies. The third feature refers to the feature representation of the input information obtained through attention processing. The embodiment of the present application does not limit the specific form of the third feature. The third feature can be a vector, a matrix, or other forms of feature representation. The first gating processing refers to screening and adjusting features through a gating mechanism to enhance the effectiveness of the features. The embodiment of the present application does not limit the specific method of the first gating processing. The first gating processing can be based on a gated recurrent unit, a long short-term memory network, or other gating technologies. Decoding is the process of converting the processed fourth feature into a specific intent representation. Through a specific decoding algorithm or model, the information in the fourth feature is converted into a second intent that can be understood by humans. Activation processing is a further nonlinear transformation of the fourth feature to enhance its expression ability and feature extraction ability. The activation process introduces nonlinearity through the activation function to solve the nonlinear problem. The embodiment of the present application does not limit the activation process. The activation function can be a linear mapping unit (Rectified Linear Unit, ReLU), a leaky linear mapping unit (Leaky Rectified Linear Unit, Leaky-ReLU), etc., wherein the linear mapping unit is used to represent that when the input is greater than 0, the input value is output, otherwise 0 is output. The linear mapping unit is simple to calculate and has a fast training speed.

[0166] In some embodiments, the above “merging the first input information and the first dialogue information to obtain the second input information” may be achieved by concatenating the first dialogue information and the first input information to obtain the second input information.

[0167] Continuing from the above embodiment, the step of “performing attention processing on the second input information to obtain the third feature” is similar to the step of “performing attention processing on the fifth feature”, see the step of “performing attention processing on the fifth feature” for details.

[0168] Continuing from the above embodiment, the above-mentioned "performing a first gating process on the third feature to obtain the fourth feature" can be achieved in the following manner: performing gating process on the third feature through a gating mechanism, the gating mechanism includes a forget gate, an input gate, and an output gate, weighting the third feature through the forget gate, adjusting the weight of the third feature, filtering the weighted third feature through the input gate, and performing weighted summation on the filtered features through the input gate to obtain the fourth feature.

[0169] Continuing from the above embodiment, the above “decoding the fourth feature to obtain the second intention” can be achieved in the following manner: mapping the fourth feature to obtain a mapping feature, upsampling the mapping feature to obtain an upsampled feature, and deconvolving the upsampled feature to obtain the second intention.

[0170] For example, the fourth feature (such as [0.52, 0.13, -0.06, 0.15]) is mapped to obtain a mapped feature (such as [0.14, 0.13, -0.06]), the mapped feature is upsampled to obtain an upsampled feature (such as [0.14, 0.13, -0.06, 0.15, 0.03, 0.06]), and the upsampled feature is deconvolved to obtain the second intention (such as "repay").

[0171] In step 1014B, based on the first intention, the first speech template is filtered out from the fourth speech template.

[0172] In some embodiments, step 1014B can be implemented by determining the intention of each fifth speech template in the fourth speech template, and filtering out the first speech template from the fourth speech template based on the similarity between the first intention and the intention of each fifth speech template.

[0173] Continuing from the above embodiment, the above “determining the intention of each fifth speech template in the fourth speech template” can be achieved in the following way: for each fifth speech template, the intention of the fifth speech template is identified to obtain the intention of the fifth speech template.

[0174] It should be noted that the above step of "performing intent recognition on the fifth speech template to obtain the intent of the fifth speech template" is similar to step 1013B and will not be repeated here. The above step of "selecting the first speech template from the fourth speech template based on the similarity between the first intent and the intent of each fifth speech template" is similar to step 1012B and will not be repeated here.

[0175] Through the embodiment of the present application, the features corresponding to the speech templates are queried through the second mapping table, and matching speech templates (such as the fourth speech template) are screened out based on feature similarity, which can quickly locate the speech related to the user input information and improve the response efficiency of the dialogue system. Through attention processing, gating mechanism and decoding technology, the user input information is deeply analyzed, and the user intention (such as the first intention) is accurately identified to provide a reliable basis for speech template screening. Based on the similarity between the user intention and the speech template intention, the best matching first speech template is further screened out from the fourth speech template. By integrating the first dialogue information of the first user, the ability to understand the user's current input is enhanced, and the accuracy of intent recognition and context coherence are improved.

[0176] Continue to see Figure 3A In step 102, the interaction behavior between the first user and the first speech template is predicted to obtain a first probability, and the second speech template is filtered out from the first speech template based on the first probability.

[0177] Here, predicting the interactive behavior between the first user and the first speech template means inferring the way the first user may respond to a specific speech template by analyzing the first user's historical behavior, current context or other relevant data. The embodiment of the present application does not limit the response method. The response method can be the user performing the action contained in the speech template (such as repayment), the user replying to the question in the speech template, etc. The embodiment of the present application does not limit the prediction method. The predicted interactive behavior can be based on prediction technologies such as machine learning models and rule engines. The embodiment of the present application does not limit the specific form of the first probability. The first probability can be an output in the form of probability distribution, classification label, etc.

[0178] In some embodiments, see Figure 3F , Figure 3F This is a sixth flow chart of the dialogue generation method provided in the embodiment of the present application, for Figure 3A In step 102, the interaction behavior between the first user and the first speech template is predicted to obtain a first probability, which can be obtained by Figure 3F Steps 1021 to 1023 are implemented as described below.

[0179] In step 1021, based on the first input information, the first dialogue information and the attribute information of the first user, a first prediction is made on the interaction behavior between the user and the first speech template to obtain a second probability.

[0180] Among them, the first prediction is a probability prediction of the probability that the first user will perform an interactive behavior with respect to the first speech template. Here, probability prediction refers to predicting the probability of an event occurring based on data. The embodiment of the present application does not limit the specific method of probability prediction, and the probability prediction can be based on logistic regression, Bayesian model, neural network or other probability prediction technology. The second probability refers to the probability of the first user performing an interactive behavior with respect to the first speech template obtained by probability prediction. The embodiment of the present application does not limit the specific form of the second probability, and the second probability can be a scalar value, a probability distribution or other form of probability representation.

[0181] In some embodiments, step 1021 can be implemented by: extracting a fifth feature from the first input information, the first conversation information, and the attribute information of the first user; performing attention processing on the fifth feature; and decoding the fifth feature after attention processing to obtain a second probability.

[0182] It should be noted that the above-mentioned step of "extracting the fifth feature from the first input information, the first conversation information and the attribute information of the first user" is similar to the step of "encoding the first input information, the first conversation information and the attribute information of the first user to obtain the first feature" in step 101, and will not be repeated here.

[0183] Continuing from the above embodiment, the above-mentioned "performing attention processing on the fifth feature" can be achieved in the following ways: normalizing the fifth feature, and performing multi-head attention processing on the obtained normalized feature to obtain a multi-head attention feature; fusing the fifth feature and the multi-head attention feature to obtain a fused feature; mapping the fused feature to obtain a mapping feature; fusing the mapping feature and the fused feature to obtain an attention feature.

[0184] Here, normalization is used to adjust the data to a unified scale to avoid deviations caused by different features having different measurement units and numerical ranges. The embodiments of the present application do not limit the normalization method, and normalization can be batch normalization, layer normalization, etc.; multi-head attention processing is used to learn important information in molecular sequences from different perspectives through the model at the same time; mapping is used to map the fused features to a new feature space to obtain mapping features for characterizing the potential structure of the molecular sequence. The embodiments of the present application do not limit the mapping method, and the mapping method can be linear mapping, nonlinear mapping, etc.

[0185] Following the above embodiment, the multi-head self-attention model is used to perform attention processing on the fifth feature as an example to illustrate that the obtained normalized feature is subjected to multi-head attention processing. The step of obtaining the multi-head attention feature can be achieved in the following manner: encoding the normalized feature to obtain the query feature, key feature and value feature of the normalized feature, determining the similarity matrix of the normalized feature based on the query feature and key feature of the normalized feature, and determining the product of the similarity matrix and the value feature as the multi-head attention feature; fusing the fifth feature and the multi-head attention feature to obtain the fused feature can be achieved in the following manner: splicing the fifth feature and the multi-head attention feature to obtain the fused feature, or performing weighted summation on the fifth feature and the multi-head attention feature to obtain the fused feature.

[0186] Following the above embodiment, the step of fusing the mapping features and the fusion features to obtain the attention features is similar to the step of fusing the fifth feature and the multi-head attention features to obtain the fusion features, and will not be repeated here.

[0187] For example, given the fifth feature (such as [2, 3, -1]), the fifth feature is normalized to obtain the normalized feature (such as [0.2, 0.3, -0.1]), and the normalized feature is weighted and interacted through the attention mechanism, where the attention weight of the normalized feature, that is, the similarity matrix of the normalized feature is [0.2, 0.3, 0.5]. The normalized feature and the similarity matrix of the normalized feature are weighted and summed to obtain the multi-head attention feature (such as [0.14, 0.13, -0.06]).

[0188] Continuing from the above embodiment, the above “decoding the fifth feature after attention processing to obtain the second probability” is similar to the above “decoding the fourth feature to obtain the second intention”, and will not be repeated here.

[0189] In step 1022, based on the attribute information of the first user, a second prediction is made on the interaction behavior of the first user with the first speech template to obtain a third probability.

[0190] In some embodiments, step 1022 may be implemented by: extracting a sixth feature from the attribute information of the first user; and decoding the sixth feature to obtain a third probability.

[0191] Continuing from the above embodiment, the above “decoding the sixth feature to obtain the third probability” is similar to the above “decoding the fourth feature to obtain the second intention”, and will not be repeated here.

[0192] In step 1023, a first probability is obtained according to the third probability and the second probability.

[0193] In some embodiments, step 1023 may be implemented by multiplying the second probability by the third probability to determine the first probability.

[0194] For example, the product of the second probability (eg, 0.8) and the third probability (eg, 0.5) is determined as the first probability (eg, 0.4).

[0195] In some embodiments, the above-mentioned "filtering out the second speech template from the first speech template based on the first probability" can be achieved in the following way: when the first probability is greater than the probability threshold, the speech template corresponding to the first probability in the first speech template is determined as the second speech template, or, based on the first probability, the speech templates corresponding to the first probability in the first speech template are sorted to obtain the sorting result, and the speech templates corresponding to the first probability in some of the first speech templates in the sorting result are determined as the second speech template.

[0196] For example, when the first probability (such as 0.85) is greater than the probability threshold (such as 0.8), the speech template corresponding to the first probability in the first speech template is determined as the second speech template, or the first probability (such as 0.85) corresponding to the speech template A in the first speech template and the first probability (such as 0.8) corresponding to the speech template B in the first speech template are sorted in ascending order based on the first probability (such as 0.85 and 0.8) to obtain an ascending sorting result (such as [B, A]), and the speech templates at the back of the ascending sorting result (such as A) are determined as the second speech template, and the speech templates in the first speech template are sorted in descending order based on the first probability (such as 0.85 and 0.8) to obtain a descending sorting result (such as [A, B]), and the speech templates at the front of the descending sorting result (such as A) are determined as the second speech template.

[0197] In step 103, when the second speech template does not match the preset information, a third speech template having a mapping relationship with the second speech template is determined from the first mapping table.

[0198] Among them, the first mapping table includes the mapping relationship between different speech templates.

[0199] It should be noted that the embodiment of the present application does not limit the first mapping table. The data structure of the first mapping table is similar to the data structure of the fourth mapping table and will not be described in detail here.

[0200] In some embodiments, before step 103, it is determined whether the second speech template matches the preset information.

[0201] Continuing from the above embodiment, the above judgment of whether the second speech template matches the preset information can be achieved in the following way: perform compliance verification on the second speech template based on the preset information to obtain a verification result. When the verification result indicates that the second speech template is non-compliant, the second speech template does not match the preset information.

[0202] Here, compliance verification is to check the content of the dialogue template through preset information to ensure that it complies with the requirements of relevant laws and regulations, industry standards or internal policies contained in the preset information. The embodiment of the present application does not limit the specific method of compliance verification. Compliance verification can be based on rule matching, natural language processing technology or other verification means. The verification result refers to the conclusion obtained through compliance verification, which usually includes information such as whether it is compliant and the specific reasons for non-compliance. The embodiment of the present application does not limit the specific form of the verification result. The verification result can be a Boolean value, a text description or other forms of output.

[0203] In some embodiments, the preset information may be a speech template in the first mapping table. The above-mentioned "compliance verification of the second speech template based on the preset information to obtain a verification result" can be achieved in the following manner: query the first mapping table based on the second speech template; when a speech template having a mapping relationship with the second speech template is queried from the first mapping table, the verification result is determined to be that the second speech template is non-compliant.

[0204] Continuing from the above embodiment, the above-mentioned "querying from the first mapping table a speech template having a mapping relationship with the second speech template" can be achieved in the following way: when the similarity between any speech template in the first mapping table and the second speech template is greater than the similarity threshold, any speech template in the first mapping table is determined as a speech template having a mapping relationship with the second speech template.

[0205] For example, when a speech template (such as you must repay the loan) having a mapping relationship with the second speech template (such as you must repay the loan) is queried from the first mapping table, the verification result is determined to be that the second speech template is non-compliant.

[0206] In some embodiments, the preset information may be preset candidate keywords. The above-mentioned "performing compliance verification on the second speech template based on the preset information to obtain verification results" can be achieved in the following way: extracting keywords from the second speech template to obtain keywords, and querying the preset information based on the keywords, wherein the preset information includes multiple candidate keywords; when the candidate keywords corresponding to the keywords are queried from the preset information, the verification result is determined as the second speech template being non-compliant.

[0207] Continuing from the above embodiment, the above “searching for candidate keywords corresponding to the keywords from the preset information” can be achieved in the following way: when the similarity between any candidate keyword in the preset information and the keyword is greater than the similarity threshold, any candidate keyword in the preset information is determined as a candidate keyword corresponding to the keyword.

[0208] For example, keyword extraction is performed on the second speech template (such as you must repay the loan) to obtain keywords (such as must), and preset information is queried based on the keywords, where the preset information includes multiple candidate keywords; when a candidate keyword corresponding to the keyword (such as must) is queried from the preset information, the verification result is determined to be that the second speech template is non-compliant.

[0209] Continuing from the above embodiment, the above “determining whether the second speech template matches the preset information” can also be implemented in the following way: when the similarity between the second speech template and the preset information is less than the similarity threshold, the second speech template does not match the preset information.

[0210] In step 104, reply information to the first input information is generated based on the third speech template and the attribute information of the first user.

[0211] In some embodiments, step 104 can be implemented by determining the second keyword associated with the attribute information of the first user in the third speech template, replacing the second keyword in the third speech template with the attribute information of the first user, and obtaining reply information for the first input information.

[0212] For example, determine the second keyword (such as weather and temperature) associated with the first user's attribute information (such as weather: sunny; temperature: 26) in the third speech template (such as today {weather}, temperature {temperature}℃), replace the second keyword in the third speech template with the first user's attribute information, and obtain reply information for the first input information (such as today is sunny, the temperature is 26℃).

[0213] Through the embodiment of the present application, the first conversation information and attribute information of the first user are integrated, which can more accurately understand the current input and intention of the first user and improve the context awareness of the dialogue system. The text fragments are encoded and feature fused through multiple coding layers to generate high-quality feature representations, and matching speech templates are screened out based on feature similarity to improve the response efficiency of the dialogue system. Based on the first user's intention and the predicted interactive behavior, the most matching template is screened out from the speech templates, and the reply content is optimized through compliance verification and mapping relationships to ensure that the conversation content complies with the specifications and meets the needs of the first user. Below, an exemplary application of the dialogue generation method provided by the embodiment of the present application in an actual application scenario will be described.

[0214] Related technologies, such as retrieval based on customer question text or intent, have limited semantic understanding. While vectorization can capture a certain degree of semantic information, it is limited to a single sentence or single intent and cannot fully understand complex or ambiguous questions. Furthermore, generating dialogue using large models consumes significant computing resources, reducing resource utilization.

[0215] In order to solve the above problems, the embodiment of the present application proposes a method for generating dialogues, which vectorizes the context dialogues and accurately represents the text semantics and features, so that similar texts are closer in the vector space, while dissimilar texts are farther apart. By calculating the correlation between vectors, the semantically closest texts are found. This avoids the performance consumption of generating dialogues through large models, saves a lot of computing resources, outputs dialogue texts faster, and meets the timeliness requirements of intelligent voice. At the same time, it provides basic dialogue data based on the vector dialogue library, greatly simplifying the complexity of maintaining dialogues. By continuously collecting different types of compliant dialogue expression texts and maintaining the mapping relationship of dialogues, it ensures that the dialogues are 100% compliant and can be immediately fed back to the dialogue results.

[0216] Taking dialogue generation as an example, see Figure 4 , Figure 4 This is the first principle diagram of the dialogue generation provided by the embodiment of the present application. The principle of generating the dialogue provided by the embodiment of the present application is explained below.

[0217] First, in each round, the customer's voice is received and translated into text to obtain the current round of customer conversation questions (i.e., the first input information of the first user). The customer's historical conversation (i.e., the first conversation information), the customer's basic information (i.e., the attribute information of the first user) and the current round of customer conversation questions are combined to obtain prompts. The obtained prompts are vectorized by the vector matching model to obtain fused information vector data (i.e., the first feature). The fused information vector data contains rich semantic information such as user background and conversation context information. At the same time, the fused information vector data is classified by the intent classification model to obtain the customer's intent. Based on the fused information vector data and customer intent, the words used to reply to the customer (i.e., the word template) are recalled from the vector word library. Specifically: the obtained fused information vector data is subjected to similarity search from the pre-vectorized vector word library, and the retrieved words are sorted and filtered based on the intent to obtain the 1-3 most similar words (i.e., the first word template).

[0218] Then, the 1-3 retrieved scripts are put through the effect ranking model and combined with the basic customer information to predict and rearrange the 1-3 retrieved scripts to obtain the script with the best business effect (i.e., the second script template). Based on the obtained script with the best business effect, it is queried whether there is a mapping script. If there is a mapping script (i.e., the third script template), the mapping script is obtained and the mapping script is determined as the final script. If not, the script with the best business effect is determined as the final script. The entity variables in the final script are replaced with the basic customer information to obtain the final reply script text (i.e., the reply information of the first input information), and the final reply script text is subjected to synthesized speech to obtain the reply voice, and the reply voice is sent to the customer.

[0219] Before generating a conversation, the corpus is processed to obtain selected corpus, and the model is trained based on the selected corpus. After creating the task of obtaining the corpus, the sharding window size, conversation data files, accompanying variable data of the conversation data, filtering rules, the basic intent system relied on by intent prediction, and the larger parameter intent classification model and diffusion prompts are obtained. Figure 5 , Figure 5 This is a schematic diagram of the management page for the corpus extraction task provided in the embodiment of the present application. Figure 5 As shown, Figure 5 The corpus extraction task management page 501 is included. Clicking the sidebar selection module redirects to the corpus extraction task management page 501. The corpus extraction task management page 501 displays the task name, the number of original conversations corresponding to the task name, the shard window, the task status, and operations. The task status can be at least one of the following: pending review, training, and completed; and the operations can be review, edit, and delete. The corpus extraction task management page 501 displays a sidebar 502 for redirecting pages. The sidebar 502 includes page redirect buttons for performing different functions. Clicking a page redirect button in the sidebar 502 redirects to the corresponding page. The corpus extraction task management page 501 displays a search bar 503 for searching. The search bar 503 is used to filter out the corresponding task from multiple tasks based on the entered task name. The management page 501 of the corpus extraction task displays a new task button 504 for creating a new task. The new task button 504 is used to jump to the new page of the corpus extraction task to create a new corpus extraction task.

[0220] See also Figure 6 , Figure 6 This is a schematic diagram of a new page for the corpus extraction task provided in the embodiment of the present application. Figure 6 As shown, Figure 6The new page 601 of the corpus extraction task shown includes a task name 602 (such as selected extraction 1601) for indicating the need to enter, a slicing window 603, a file location 604, a filtering rule 605 and a prediction setting 606, wherein the slicing window 603 indicates the maximum number of conversation rounds (such as 4) when processing conversation slices; the file location 604 can be a cloud storage or a local storage, which is used to extract the corresponding corpus according to the specified path 6041 (such as path 1), and filter the corpus through the filtering rule 605 to screen out the corpus that meets the filtering rule, and display file information 6042, which includes the number of recordings contained in the corpus, the number of accompanying variables and the number of filtering results; the filtering rule 605 includes a data column 6051, which is used to represent the addition and data Column 6051 has an expansion button 6052 of a data column with an AND relationship, and an expansion button 6053 for indicating the addition of a data column with an OR relationship with data column 6051. Data column 6051 is used to restrict the accompanying variables, thereby filtering the corpus. In response to the click of the expansion button 6052, the new page 601 of the corpus extraction task displays a new first data column. When filtering, the filtering rules in data column 6051 and the filtering rules in the new first data column need to be met at the same time. In response to the click of the expansion button 6053, the new page 601 of the corpus extraction task displays a new second data column. When filtering, the filtering rules in data column 6051 or the filtering rules in the new second data column need to be met at the same time. The prediction settings 606 include a basic intent system (such as "intent"). Figure 2 .1”), the selected model (such as Model 1), and the diffusion prompt. The basic intent system is the current intent system, which contains multiple intents and definitions of each intent; the diffusion prompt allows the large model to diffuse sibling intents or sub-intents based on the basic intent system through the prompt.

[0221] See also Figure 7 , Figure 7 This is a schematic diagram of intent diffusion provided by an embodiment of the present application. The specific process of intent diffusion is described in detail below. The intent in the original intent system is diffused to obtain intent-sub-intent and intent-sub-sibling intent. The sub-intent is diffused again to obtain the grandchild intent corresponding to the sub-intent. Among them, intent-sub-intent is an intent to make a fine-grained division of the conversation corresponding to the intent, and sub-intention-grandchild intent is an intent to make a fine-grained division of the conversation corresponding to the sub-intention. Taking the intention of repayment as an example, the intent-sub-intent is the customer's promise to repay but with a simple time delay condition, and the intent-sub-sibling intent is the customer's promise to repay but with specific conditions that need to be met first.

[0222] The initial intention system only had "willingness to repay - commitment to repay". In the vast number of conversations in the selected anticipation tasks, if there are many细分scenarios of commitment to repay, it can be细分into commitment to repay - repay immediately, commitment to repay - repay in a while, commitment to repay - repay after work, etc. Combine "intention" and "intention - sub - intention" to get [willingness to repay - commitment to repay, commitment to repay - repay immediately, commitment to repay - repay in a while, commitment to repay - repay after work]. When the intention classification model predicts the intention, it predicts for the sub - intention and the parent intention of the sub - intention, and takes the intention with the highest probability as the intention of the text. Figure 1 Make predictions starting from this, and take the intention with the highest probability as the intention of the text.

[0223] Continue to refer to Figure 6 , Figure 6 As shown in the new page 601 of the corpus extraction task, it also includes a save button 607 for representing that the newly created corpus extraction task can be used to extract the corpus and a cancel button 608 for canceling the newly created corpus extraction task. Among them, the save button 607 is used to save the newly created corpus extraction task, so as to facilitate the execution of the corpus extraction task and manage the extracted corpus.

[0224] Refer to Figure 8 , Figure 8 is the schematic diagram of corpus processing provided by the embodiment of the present application. As Figure 8 shown, the specific process of corpus processing will be described in detail below.

[0225] In step 801, create a corpus extraction task.

[0226] Here, the corpus extraction task is used to extract the corpus from historical conversations and provide basic data for the generation of compliant conversations.

[0227] In step 802, set the filtering rules.

[0228] Here, the filtering rules are used to filter the extracted corpus. The filtering rules can be to remove stop words. Stop words refer to words that have a high frequency of use in the language but little contribution to semantics, such as "de", "he", "shi", etc.

[0229] In step 803, set the sharding window.

[0230] Here, the sharding window represents the maximum number of dialogue turns when processing dialogue slices. The window size can be fixed or dynamic.

[0231] In step 804, perform data cleaning and aggregation on the corpus.

[0232] Here, after creating the task of selecting the corpus, we first clean and integrate the conversation data, merge multiple consecutive conversations of the same character in the manual conversation into one, and filter out data that does not meet the filtering conditions.

[0233] In step 805, the cleaned corpus is automatically sliced.

[0234] Here, after cleaning and integrating the conversation data, the conversation is divided into multiple conversation segments according to the slicing settings, and the maximum number of conversation rounds set for each conversation segment is N rounds (such as 3 rounds).

[0235] In step 806, intent recognition is performed on the sliced ​​conversation segments.

[0236] Here, we use the selected, large-parameter pre-trained model for the sliced ​​conversation segments, combining the selected intent and intent diffusion prompts to automatically classify the customer's core intent. Intent recognition based on conversation segments can more accurately identify customer intent by combining contextual semantics.

[0237] See also Figure 9 , Figure 9 This is the first principle diagram of intent classification provided in an embodiment of the present application. The principle of intent classification is described in detail below.

[0238] In step 901, the sub-segments are split according to the last two sentences of the dialogue segment (ie, the above-mentioned information extraction).

[0239] Here, each conversation text is split into two conversation sub-segments (i.e., the above-mentioned information segments) according to the last two sentences of the customer conversation. For example, the conversation text of A1C1A2C2A3C3A4C4 is split into two conversation sub-segments A1C1A2C2A3C3 and A2C2A3C3A4C4 according to the last two sentences A4C4 of the customer conversation. Customer conversations with less than two rounds are not split.

[0240] In step 902, text embedding is generated for all the dialogue sub-segments.

[0241] Here, text embedding is generated for all dialogue sub-segments to obtain text embedding features represented by high-dimensional vectors.

[0242] In step 903, intent prediction is performed on all conversation sub-segments, and text embedding features are updated based on the predicted intent.

[0243] Here, the selected intent classification model is used to predict the intent of all dialogue sub-segments. The intent classification model carries the current intent system, and the predicted intent is added as an additional feature to the text embedding feature to obtain a new text embedding feature.

[0244] In step 904, clustering is performed on the obtained new text embedding features.

[0245] Here, based on the obtained new text embedding features, the K-means algorithm is used to perform clustering to obtain the corresponding clusters.

[0246] In step 905 , candidate intents are generated for each cluster.

[0247] Here, we perform automated intent diffusion based on clusters to obtain candidate intents. The key steps of intent diffusion are described in detail below.

[0248] 1) For each cluster, obtain the basic intent and the number of corresponding fragments in the cluster.

[0249] 2) For the largest number of intents in each cluster, the corresponding number is counted. When the number is greater than the set threshold, the diffusion prompt of the intent is integrated, and the context is combined to automatically try to diffuse the sub-intent.

[0250] 3) For the other intents in each cluster except the one with the largest number of intents and the corresponding fragments with lower predicted probability values, the diffusion prompts of the intent are integrated and the context is combined to try to diffuse the sibling intents.

[0251] 4) No diffusion processing is performed on the fragments of other intentions in each cluster whose predicted probability values ​​are higher than the threshold.

[0252] Each intent can have a corresponding diffusion prompt set when managing intents or creating selected tasks. An example of a diffusion prompt for the intent of promising repayment is as follows:

[0253] #Spreading [Promise to Repay] Intention

[0254] ##Task Overview

[0255] Given a conversation segment, identify and diffuse the customer's expressed intent of "committing to repay." Based on the customer's statement, distinguish whether it is a standard intent of "committing to repay" (i.e., the default intent) or a sub-intent or sibling intent with additional conditions, and provide corresponding classifications and descriptions.

[0256] ###Intent type definition

[0257] Ordinary commitment to repay: The customer explicitly states that he or she will repay the loan by a certain time point, with no other conditions attached.

[0258] Sub-intention (i.e., the eighth intention): The customer promises to repay the loan but attaches simple time delay conditions (for example, "later", "after a while", "after get off work", etc.) (i.e., preset keywords), which do not involve modifications to the original repayment agreement.

[0259] Brother intention: The customer promises to repay the loan but puts forward specific conditions that need to be met first (for example, requesting an extension, reduction, installment payment, etc.), which involves adjustments to the original repayment agreement.

[0260] ##Analysis and diffusion steps

[0261] Understand the context: First, understand the overall background and situation of the conversation segment, and pay attention to the customer's position and expression in the conversation.

[0262] Identify core intent: Determine whether the customer has an explicit or implicit intent to [commit to repayment].

[0263] Detection of additional conditions: If there is a time delay condition, it is classified as a sub-intention. If there is a request for modification of the repayment agreement, it is classified as a sibling intention.

[0264] Output diffusion results: Based on the above analysis, provide a clear classification result to explain the type of customer's commitment repayment intention and briefly describe the specific conditions.

[0265] ##Example

[0266] Example 1

[0267] #### Input dialogue snippet

[0268] Agent: Can you repay the loan now?

[0269] Customer: It’s not convenient for me now. I will deal with this issue after I get off work.

[0270] ####Output

[0271] Type: Sub-intent

[0272] Description: The customer promised to process the repayment after hours and did not propose any changes to the existing repayment agreement.

[0273] Please analyze the following conversation fragment according to the above guidelines and output the diffusion results, including the specific type and description of the commitment repayment intention.

[0274] ###Notes

[0275] Ensure your analysis takes the conversation context into account to accurately capture your customers’ true intent.

[0276] For ambiguous or unclear situations, try to provide the most likely explanation and point out any uncertainty.

[0277] If necessary, additional information can be added to assist in the judgment, such as the customer's past behavior or history.

[0278] Continuing with step 905 , the diffused sub-intent or sibling intent is determined as a candidate intent.

[0279] In step 906, the candidate intent is named.

[0280] Here, for the diffused sub-intent or sibling intent, keywords are extracted according to the description content of the diffused intent for automatic naming, and replaced into the diffused intent to obtain the name of the candidate intent.

[0281] In step 907 , the final intent is filtered out from the intents of the two sub-segments of each segment.

[0282] Here, because the size of the sliding window used for text splitting is adjustable, the customer's speech may contain multiple different intents or multiple levels of intent. Therefore, the semantics of the two sub-segments of each segment are used for intent recognition, and the intent sources are classified into three categories. The priority is selected according to the priority of the three types of intent. The order of priority is: this basic intent, diffusion intent, basic intent, and chat connection intent. Among them, chat connection intent is a special type of basic intent and can be set during intent management. If the intents of the two sub-segments are the same, this intent is selected.

[0283] In step 807, the slots of the agent's speech in the sliced ​​conversation segment are automatically replaced.

[0284] Here, after completing the intention prediction of the conversation segment, combined with the customer accompanying data, the selected pre-trained large model and slot prompts are used to perform slot recognition on the agent's speech (i.e., the first conversation information), mark the text involving customer information entities in the agent's speech, and replace them with corresponding variables. Customer accompanying data includes customer basic information, business data, and business result data. Customer basic information is the customer's attributes, business data is product name, product principal, overdue amount, etc., and business result data is whether the customer repays. For example, the agent's speech is "You currently owe 3,000 yuan." After slot recognition and replacing the entity with the variable corresponding to the entity at the recognition point, the speech (i.e., the fifth speech template) is "You currently owe &{3,000}${ovd_amt} yuan", where & represents the original text to be recognized and $ represents the slot variable. Examples of slot prompts are as follows:

[0285] 【#Customer information entity identification and replacement

[0286] ##Task Description

[0287] Based on the provided customer information text and specific basic customer information data, automatically identify and replace specific entities with corresponding variables. This task aims to protect customer privacy while ensuring that key information in the text is correctly parsed and processed by the system. When encountering multiple similar variables (such as multiple amounts), use specific data to clarify.

[0288] ##Role Definition

[0289] User: Need to process text containing customer personal information and provide specific customer basic information.

[0290] System: Pre-trained large models to understand context, identify specific entities, and automatically clarify similar variables based on the specific data provided.

[0291] ##Contextual Information

[0292] The system understands natural language and identifies specific entity types (such as names and genders) based on context. Furthermore, when multiple similar variables (such as multiple amounts or dates) appear in text, the system should leverage the provided customer-specific baseline data to determine which value corresponds to which variable. The goal is to leverage the model's inherent contextual understanding and data analysis capabilities to accomplish the task without relying on external interfaces.

[0293] Mission Objectives

[0294] Identify and replace the following customer information:

[0295] -Name(`${name}`)

[0296] -Gender(`${gender}`)

[0297] -Age(`${age}`)

[0298] -Contact information (`${contact}`)

[0299] -Address(`${address}`)

[0300] - Overdue amount (${overdue_amount})

[0301] - Overdue days (${overdue_days})

[0302] -Account status (`${account_status}`)

[0303] -Last payment date (${last_payment_date})

[0304] - Credit score (${credit_score})

[0305] Each recognized entity should be enclosed in `&{}`, followed by the corresponding `${}` variable name. If there are multiple similar variables in the text (such as multiple amounts), these variables are automatically clarified based on the specific customer information data provided.

[0306] ##Input format requirements

[0307] Text Input

[0308] text: A raw string containing the customer's personal information. Required.

[0309] ###Customer Basic Information

[0310] Provide a JSON object containing all variables that may need clarification and their corresponding values. The fields are as follows:

[0311] name: Customer name

[0312] gender: gender

[0313] age: age

[0314] contact:Contact information

[0315] address: address

[0316] overdue_amount: overdue amount

[0317] overdue_days: number of days overdue

[0318] account_status: account status

[0319] last_payment_date: the date of the most recent payment

[0320] credit_score: credit score

[0321] Any other information that would help clarify similar variables in the text

[0322] Output requirements

[0323] The output should be a JSON string with the key "new_text" and the value being the processed text. No additional output other than "new_text" is allowed.

[0324] Please replace the basic information variable field with the text of the following information and output it.

[0325] text: [insert the entered text]

[0326] customer_infos: [insert customer basic information json object]]

[0327] In step 808, the agent's speech after the slot replacement is manually reviewed.

[0328] Here, after completing the above data processing tasks, the agent's script will be changed to the pending review status, waiting for manual data review. The following is a detailed explanation of the process of reviewing the selected agent's script.

[0329] See also Figure 10 , Figure 10 This is a schematic diagram of the speech review page provided in the embodiment of the present application. Figure 10 The intention classification part on the right side of the speech review page 1001 shown in the figure includes an acceptance button 1002 for indicating the intention predicted by the receiving system, a delete button 1003 for indicating that the intention predicted by the system is not accepted and the conversation segment is invalid and needs to be deleted, and a reselect intention button 1004 for indicating that the basic intention and diffuse intention after this prediction are automatically obtained in the middle, and a new intention is selected as the intention of the conversation segment, so as to confirm and correct the intention of the conversation segment.

[0330] exist Figure 10 In the middle part of the corpus segment in the speech review page 1001 shown, the speech review page 1001 prompts the text 1005 that is automatically marked in the slot by the system. These marks can be deleted manually, or the text can be reselected to set variable marks.

[0331] exist Figure 10 In the speech mining part on the right side of the speech review page 1001 shown, the system automatically extracts a list of agent dialogue texts (including variable tags) in the selected dialogue segment. During the manual review process, if the agent speech is relatively typical, you can directly check the selection box 1006, and automatically check the agent speech selected according to the selection box 1006 for duplication, and add the checked agent speech to the business speech library.

[0332] Continue to participate Figure 8 , in step 809, the selected corpus is determined.

[0333] Here, after completing the review of the agent's speech, the system will use the final conversation fragment as the selected corpus data, automatically forming a data set and pushing it to the model for iterative updates. The selected corpus is used to input into the text embedding model, intent classification model, and effect ranking model for model training. Among them, the text embedding model, intent classification model, and effect ranking model are the three basic models that rely on the generation of compliant speech. Figure 11 , Figure 11 This is a schematic diagram of the model page provided by the embodiment of the present application. Figure 11 In the example, the model page 1101 contains information about the text embedding model, intent classification model, and effect ranking model. The information includes related information such as the basic model, resource configuration, training method, number of rounds, batch size, optimizer, and data set. By adjusting the information, the model can be trained based on the information. In addition, the model page 1101 also includes a start training button 1102 for model training and a test result button 1103 for displaying the current test results. In response to a click on the historical test result 1104, the historical test results are displayed. When there is new selected corpus data to be trained, iterative training of the model is automatically carried out.

[0334] In step 810, a text embedding model is trained based on the selected corpus. The training process of the text embedding model is described in detail below.

[0335] The text embedding model is a model that performs comparative learning from conversation fragments and is trained by maximizing the similarity between similar conversation fragments and minimizing the similarity between dissimilar conversation fragments. It is used to perform text embedding processing on conversation database dialogues and input conversation content. The text embedding model is the core model for generating compliant dialogues. Unlike the traditional vector similarity between sentences (using sentence A to find similar sentence A'), the text embedding model provided in the embodiment of the present application is not only used to process embedding tasks for multiple rounds of conversation fragments, but also for processing embedding tasks for single-sentence text in the conversation database, and subsequently implements similarity calculation between the two (using the conversation fragment "A1C1A2C2" and integrating the basic information of the customer to find similar dialogue A3'). Therefore, the text embedding model can adapt to conversation content of different scales and can express the correlation between them when vectorized.

[0336] join Figure 12 , Figure 12 This is a training diagram of the text embedding model provided in the embodiment of the present application. Figure 12 middle, Figure 12 It includes multiple modules for training text embedding models in the embodiment of the present application, such as the encoding module 1201 and the output module 1202 and other modules. The multiple modules for training text embedding models provided in the embodiment of the present application are explained below.

[0337] The encoding module 1201 includes multiple sub-modules for encoding text through a text embedding model in an embodiment of the present application, such as a multi-layer encoder module 1203, a pooling layer 1204, a multimodal fusion layer 1205, and a knowledge encoding module 1206. The multiple sub-modules for encoding text through a text embedding model provided in an embodiment of the present application are explained below.

[0338] The multi-layer encoder module 1203 is used to perform multi-scale feature extraction on the input dialogue segment (ie, text segment).

[0339] Here, in order to capture the semantic information of conversation segments of different lengths, the embodiment of the present application designs a multi-layer encoder module. The multi-layer encoder module 1203 includes multiple continuous encoders, each encoder is responsible for processing conversation segments of a specific length range (for example: the first layer encoder processes a single sentence / single round of conversation, and the second layer encoder processes two rounds of conversation). The multi-layer encoder module 1203 includes a single sentence encoder, a single round encoder, and a multi-round encoder, wherein the single sentence encoder is used to encode each sentence in the conversation segment, the single round encoder is used to encode the combined features obtained by combining the features output by the single sentence encoder, and the multi-round encoder is used to encode the combined features obtained by combining the features output by the single round encoder. This helps the model learn patterns at different scales. Each layer of encoder can focus on capturing semantic information at different levels. As the number of layers increases, the encoder can gradually accumulate and integrate information from the previous layer, thereby better modeling long-distance dependencies. Each layer of encoder can be regarded as a step-by-step refinement process, in which the original text is converted into an abstract vector representation, making the final generated text embedding more representative and interpretable. The encoder can be an attention mechanism. Through multi-level attention mechanisms, the model can automatically focus on features at different levels according to different task requirements. For example, when calculating the similarity between two conversation segments, the model can pay more attention to the content of the most recent rounds of conversation.

[0340] In the pooling layer 1204, the user performs pooling processing on the features output by the multi-layer encoder module 1203 to obtain pooled conversation features.

[0341] The multimodal fusion layer 1205 is used to process information from different sources.

[0342] Here, information from different sources can be conversation snippets, domain knowledge, and basic customer information, ensuring that all information can be effectively transmitted in the text embedding model, further improving expressiveness and accuracy.

[0343] The knowledge encoding module 1206 is used to encode the basic customer information and the domain knowledge dictionary.

[0344] The following is a detailed explanation of the training process of the text embedding model.

[0345] 1) Build a domain knowledge dictionary.

[0346] Here, a vocabulary is created through a dictionary, which includes professional terms, jargon, and abbreviations, and each word in the vocabulary is given a clear definition and explanation, such as the names of different products.

[0347] 2) Preprocess the original conversation data.

[0348] Here, the raw conversation data is processed through operations such as word segmentation, denoising, and annotation. Then, based on the set slice size, the processed raw conversation data is sliced ​​according to the sliding window principle to obtain the conversation segments required for training. A sliding window method is used to extract multiple overlapping conversation segments from the original conversation (for example, A1C1A2C2A3C3, A2C2A3C3A4C4, etc., where A refers to the agent's text and C refers to the customer's text). Each segment contains a certain number of consecutive conversation turns to preserve contextual information.

[0349] 3) Text embedding of domain knowledge.

[0350] Here, the domain knowledge is embedded in text through the knowledge encoding module 1206, the knowledge dictionary is represented by vectors, and is input into the text embedding model together with the conversation data.

[0351] 4) Convert each dialogue segment into a sentence vector.

[0352] Here, each dialogue segment is converted into a sentence vector using the pre-trained language model in the multi-layer encoder module 1203 as a basis.

[0353] 5) Pool the sentence vectors and fuse the pooled sentence vectors with the vectors obtained by text embedding of domain knowledge.

[0354] Here, the sentence vector is pooled by the pooling layer 1204 to obtain a pooled sentence vector, and the pooled sentence vector is fused with the vector obtained by text embedding of the domain knowledge by the multimodal fusion layer 1205 to obtain the final encoding vector.

[0355] 6) Conduct comparative learning.

[0356] Here, construct positive samples, for each dialogue segment generated by the sliding window (such as A1C1A2C2A3C3A4C4 and A2C2A3C3A4C4A5C5) or core meaning Figure 1For similar conversation segments, consider their (A1C1A2C2A3C3+A4) as a pair of positive samples. Because the content of these segments has contextual semantic relevance, they should theoretically have similar representations in the vector space. To select negative samples, randomly extract segments A from other conversations with different core intents as negative samples. These segments differ significantly from the current conversation segment's (A1C1A2C2A3C3), so their distance in the vector space should be as far as possible.

[0357] 7) Calculate contrastive learning loss.

[0358] Here, we use the contrastive learning loss function to maximize the similarity between positive sample pairs while minimizing their similarity to negative samples. The contrastive learning loss function is described in detail below.

[0359] First, calculate the similarity. For each pair of positive samples, calculate the similarity between them (for example, using cosine similarity or dot product). Similarly, calculate the similarity between each positive sample and all its negative samples.

[0360] Secondly, we maximize the similarity of positive samples by adjusting the model parameters to maximize the similarity between positive sample pairs. This can be achieved by increasing the similarity score between positive sample pairs.

[0361] Then, minimize the negative sample similarity, ensuring that the similarity between each positive sample and all its negative samples is minimized. This can be achieved by reducing the similarity score between the positive sample and the negative sample.

[0362] Finally, the comprehensive contrast loss function is minimized, which measures the difference between the similarity between positive sample pairs and the similarity between negative sample pairs. The contrast loss function is shown in Formula 1.

[0363]

[0364] Among them, f(x i ) is the dialogue fragment x i , sim is the similarity function (such as cosine similarity), and τ is the temperature parameter used to control the sharpness of the distribution.

[0365] 8) Calculate the consistency loss.

[0366] Here, a consistency loss term is introduced to further strengthen the consistency constraint across fragments. The consistency loss is described in detail below.

[0367] First, the local consistency loss is calculated. For each pair of dialogue segments generated by the sliding window (such as A1C1A2C2A3C3+A4, A2C2A3C3A4C4+A5), the Euclidean distance or squared difference between them is calculated and used as part of the loss to ensure that even adjacent and partially overlapping segments remain consistent in the vector space.

[0368] Then, a global consistency loss is calculated to ensure that all segments in the entire dialogue sequence, even non-directly adjacent segments (such as A1C1A2C2A3C3+A4 and A2C2A3C3A4C4+A5), maintain reasonable similarity in the vector space, which helps capture contextual dependencies over a longer range.

[0369] Finally, the local consistency loss and the global consistency loss are combined to obtain the consistency loss.

[0370] 9) Calculate the total loss.

[0371] Here, in each training iteration, the contrast loss and consistency loss are calculated and combined to form the total loss function. According to the total loss function, the model parameters are backpropagated and updated, so that the model gradually learns how to maintain consistency across fragments in the vector space.

[0372] 10) When the loss gradually converges, freeze all parameters of the pre-trained model.

[0373] The output module 1202 includes a pooling layer 1207 for decoding the encoded features in an embodiment of the present application. The pooling layer 1207 performs pooling processing on the final encoding vector output by the encoding module 1201 to obtain a final output vector.

[0374] Continue to see Figure 8 In step 811, the intent classification model is trained based on the selected corpus.

[0375] Here, we use the reviewed conversation fragments and annotated intents to train an intent classification model that combines contextual semantic understanding to predict the core intent of the customer in the input conversation.

[0376] Multiple levels of intent prediction are performed simultaneously within the intent classification model. The tasks at each level are interrelated yet independent, allowing the model to gradually refine predictions from higher levels to lower levels. At the same time, an adaptive weighting mechanism is introduced to dynamically adjust the weights between prediction tasks at each level based on their importance, ensuring that the model pays more attention to those levels that have a greater impact on the final output. When the prediction confidence at a certain level falls below a preset threshold, the model automatically falls back to a higher-level intent category. This helps avoid overfitting to inaccurate specific sub-intents in the absence of sufficient evidence.

[0377] See also Figure 13 , Figure 13 This is a training diagram of the intent classification model provided in the embodiment of the present application. Figure 13 middle, Figure 13 It includes multiple modules for training the intent classification model in the embodiment of the present application, such as the root intent classifier 1301, the sub-intent classifier 1302, and the grandchild intent classifier 1303. The training process of the intent classification model is described in detail below.

[0378] 1) Conduct data collection.

[0379] Here, we collected the corpus obtained from the selected extraction task, which mainly consists of dialogue slices (A1C1A2C2A3C3A4C4, A2C2A3C3A4C4A5C5) and annotated core intents. We then normalized these annotated intents into multi-level annotated intents based on prefixes. For example, [Willingness to Repay - Commitment to Repay] has the top level - willingness to repay, the second level - commitment to repay; [Commitment to Repay - Immediate Repay] has the top level - willingness to repay, the second level - commitment to repay, and the third level - immediate repayment. We set unlimited levels for different intents, for example, a three-level intent structure.

[0380] 2) Clean the collected data.

[0381] Here, we remove noise, duplicates, and irrelevant conversation content from the collected data to obtain cleaned data and ensure data quality. For samples with only high-level annotations, we supplement possible sub-intent labels based on contextual information or set a default value (empty) to maintain a consistent hierarchical structure across all samples.

[0382] 3) Encode the cleaned data.

[0383] The cleaned data is encoded through a multi-layer model architecture, which is described in detail below.

[0384] The multi-layer model architecture includes a shared representation layer and a task feature output layer. The shared representation layer is based on a pre-trained attention model. Pre-trained model 1024 serves as the shared representation layer for all tasks and is responsible for extracting common features from the input text fragment. The task-specific output layer is used to add multiple task-specific output layers on top of the shared representation layer, with each output layer corresponding to a level of intent classification task. These output layers use fully connected layers or more complex structures (such as small neural networks) to capture the complexity of specific tasks.

[0385] Here, the pre-trained model 1304 is used as the basis of the shared representation layer, and its powerful text encoding capability is used to capture rich semantic features. The pre-trained model is used to extract common features of the input text segment.

[0386] Multiple task-specific output layers are added to the pre-trained model. Each output layer corresponds to a level of intent classification to meet the needs of tasks at different levels. The output layers of multiple task features include a root intent classifier 1301, a sub-intent classifier 1302, and a grandchild intent classifier 1303. The specific structures of the root intent classifier 1301, the sub-intent classifier 1302, and the grandchild intent classifier 1303 are described in detail below.

[0387] The root intent classifier 1301 includes a fully connected layer A, an activation function A, and a hard gating unit A, wherein the features extracted by the pre-trained model 1304 are mapped by the fully connected layer A to obtain a first mapping feature, and the first mapping feature is activated by the activation function A to obtain a first activation feature. The first activation feature obtained by the activation function A is determined as the input of the fully connected layer B in the sub-intent classifier 1302, the first activation feature is feature extracted by the hard gating unit A to obtain a first gating feature, and the first gating feature is mapped to obtain the root intent category of the feature. When the accuracy of the root intent category is greater than the threshold, the first gating feature is determined as the input of the activation function B in the sub-intent classifier 1302.

[0388] The sub-intent classifier 1302 includes a fully connected layer B, an activation function B and a hard gating unit B, wherein the features extracted by the pre-trained model 1304 and the first activation features obtained by processing the activation function A in the root intent classifier 1301 are spliced, and the spliced ​​first spliced ​​features are mapped by the fully connected layer B to obtain a second mapping feature, the second mapping feature is spliced ​​with the first gating feature extracted by the hard gating unit A in the root intent classifier 1301 to obtain a second spliced ​​feature, and the second splicing feature is activated by the activation function B to obtain a second activation feature, the second activation feature obtained by processing the activation function B is determined as the input of the fully connected layer C in the grandchild intent classifier 1303, the second activation feature is feature extracted by the hard gating unit B to obtain a second gating feature, and the second gating feature is mapped to obtain the category of the sub-intent, and when the category accuracy of the sub-intent is greater than the threshold, the second gating feature is determined as the input of the activation function C in the grandchild intent classifier 1303.

[0389] The grandchild intent classifier 1303 includes a fully connected layer C and an activation function C, wherein the features extracted by the pre-trained model 1304 and the second activation features obtained by processing the activation function B in the sub-intent classifier 1302 are spliced, and the spliced ​​second spliced ​​features are mapped by the fully connected layer C to obtain a third mapping feature, and the third mapping feature is spliced ​​with the second gated feature extracted by the hard gated unit B in the sub-intent classifier 1302 to obtain a third spliced ​​feature, and the third spliced ​​feature is activated by the activation function C to obtain a third activation feature, and the third activation feature is mapped to obtain the category of the grandchild intent.

[0390] 4) Train the intent classification model.

[0391] Here, the root intent classifier 1301, the child intent classifier 1302, and the grandchild intent classifier 1303 are gradually unfrozen and layered. When the loss function of the first layer gradually converges, the parameters of the root intent classifier 1301 are determined, and the second and first layers are trained together. Cross-entropy loss is used to measure the difference between the predicted results and the true labels.

[0392] In the embodiment of the present application, a separate loss function is defined for each level of task, and the loss function is shown in Formula 2.

[0393]

[0394] Among them, N represents the number of classification tasks, L i is the loss of the i-th classification task, and w i is the weight of the corresponding classification task.

[0395] A dynamic weight adjustment mechanism is introduced to automatically adjust the relative weights of each classification task based on the importance of different levels or data distribution, ensuring that the model pays more attention to those classification tasks that have a greater impact on the final output. The dynamic weight adjustment mechanism is explained in detail below.

[0396] First, determine the initial weights. Set the initial weights based on the importance of the classification task or the data distribution. For example, if a layer has a small amount of data but high importance, a large initial weight can be assigned.

[0397] Secondly, identify the gradient change of the loss of each classification task relative to the total loss and dynamically adjust the weights. Alternatively, evaluate the learning progress of each classification task and pay more attention to those classification tasks that have not been fully learned. Alternatively, when the prediction confidence of a certain level is lower than the preset threshold, increase the weight of the classification task at that level to encourage the model to focus more on improving the accuracy of this level.

[0398] The weights are then periodically evaluated, re-evaluating the performance of all classification tasks every certain number of iterations and adjusting the weights accordingly. This helps the model maintain its focus on the key classification tasks throughout the training process.

[0399] During the training process, select an appropriate optimization algorithm (such as Adam) and set hyperparameters such as the initial learning rate and batch size to ensure that the training process is stable and efficient.

[0400] The following further explains the process of gradually unfreezing hierarchical training. Initially, the model is trained using a dataset containing only high-level annotations, allowing it to first understand basic intent categories. As training progresses, data with detailed hierarchical annotations is gradually added to allow the model to learn more specific intent differences. This helps the model gradually master the ability to classify intents from broad to specific.

[0401] During training, a hierarchically weighted F1 score is determined to ensure not only high-level model performance but also accurate recognition of specific sub-intents. A portion of data is periodically extracted as a validation set during training to evaluate the model's current performance and adjust training parameters or strategies accordingly. Prediction post-processing is used to obtain the final intent and convert it into a "parent intent prefix - current intent" format. After the model prediction is complete, intent confirmation and adjustment are performed based on predefined threshold rules.

[0402] Continue to see Figure 8 In step 812, the model is refined based on the training effect of the selected corpus.

[0403] See also Figure 14 , Figure 14 This is a schematic diagram of the probability of repayment prediction of the effect ranking model provided in the embodiment of this application. The effect ranking model is a prediction model that ranks by business achievement as the goal, such as Figure 14 As shown, the customer's basic information, conversation fragments (such as agent speech A1, customer answer B1, agent speech A2, and customer answer B2) and business results (such as whether the customer repays the loan) are used to predict the repayment probability of the customer's repayment behavior in turn, and the customer's repayment probability is obtained. By learning the business completion probability (such as repayment probability) of different customer basic information and different rounds of conversation texts, the business effect of the alternative speech can be predicted and ranked.

[0404] Traditional business outcome prediction methods rely on static features or statistical models to derive the probability of business results across different rounds. This is extremely difficult to perform statistically and struggles to capture the impact of information changes during a conversation on the results. The results ranking model provided in the present application continuously updates its estimate of the business outcome probability as the conversation progresses. By introducing time dependency and a correction mechanism, it improves the accuracy of business outcome predictions, thereby achieving optimal ranking results.

[0405] See also Figure 15 , Figure 15 This is a training diagram of the effect sorting model provided in the embodiment of the present application. Figure 15 middle, Figure 15 It includes multiple modules for training the effect ranking model in the embodiment of the present application, such as the basic model 1501, the pre-training model 1502, the Bayesian update framework 1503, the probability prediction output layer 1504 and the self-attention mechanism 1505. The multiple modules of the effect ranking model are described in detail below.

[0406] The basic model 1501 is used to perform probability prediction based on basic customer information and business information to obtain the predicted probability. The basic model 1501 includes a pre-trained model 15011 and a probability prediction output layer 15012. The pre-trained model 15011 is used to extract features from the encoded features to obtain extracted features, and the probability prediction output layer 15012 is used to decode the extracted features to obtain the predicted probability.

[0407] The pre-trained model 1502 is used to encode the split conversation segments, basic customer information, and business information of each round to obtain encoded features.

[0408] The Bayesian update framework 1503 is used to update the probability predicted based on the basic customer information and business information, and obtain new probabilities based on the predicted probabilities of each split round of conversation segments, basic customer information, and business information.

[0409] The probability prediction output layer 1504 uses an activation function to output a real value between 0 and 1, representing the probability of repayment after the current round. Each conversation round corresponds to an independent output node, which is used to predict the repayment probability after that round.

[0410] The self-attention mechanism 1505 enables the model to automatically weight the importance of past rounds of dialogue based on the current dialogue content.

[0411] The following is a detailed description of the training process of the effect refinement model.

[0412] 1) Conduct data collection.

[0413] Here, the query includes conversation snippets, basic customer information, transaction information, and repayment tags. The repayment tags are used to calculate losses with the predicted probabilities, enabling gradient backpropagation based on the gradients of the loss calculation to update the model parameters. The original conversations (cleaned but unsliced ​​complete conversations) from the selected tasks are organized to ensure that each sample contains basic customer information, all conversations up to the current round, and the final transaction results.

[0414] 2) Probabilistic prediction based on basic customer information and business information (i.e. the second prediction mentioned above).

[0415] First, basic customer information and business information are identified as input information A. Basic model 1501 performs feature and position encoding on input information A, converting it into a numerical or embedded feature vector. The input information includes basic customer information (such as age, gender, and credit score) and business information. For features with time attributes or other sequential information (for example, number of days overdue), appropriate position encoding is added to enhance the model's understanding of time series.

[0416] Secondly, the pre-trained model 15011 in the basic model 1501 performs attention processing on the features obtained after encoding to obtain attention features.

[0417] Finally, the attention features are mapped through the probability prediction output layer 15012 in the basic model 1501 to obtain the predicted second probability (i.e., the third probability mentioned above).

[0418] 3) Train the basic model 1501.

[0419] Here, a basic model 1501 is trained using a dataset containing only basic customer information to obtain a preliminary repayment probability distribution. This model serves as the basis for all further training. For each customer who has completed N rounds of conversation, N training samples are generated. Each sample includes the customer's basic information, all conversation history up to the current round, and the final transaction outcome (e.g., success or failure). During training, the model gradually learns how to adjust its previous probability estimates based on new conversation information. Specifically, for a customer who has completed N rounds of conversation, N training samples can be generated, each corresponding to a repayment probability prediction after the i-th round of conversation (i = 0, 1, ..., N). This means that even a customer who has completed five rounds of conversation will provide training data for the first four rounds. In this way, the model can be effectively trained at different stages of the conversation, thereby better understanding and predicting the changing trends in repayment probability. Binary cross-entropy loss is calculated, and when the loss gradually converges, the parameters of the basic model are retained.

[0420] 4) Split the dialogue segments into rounds.

[0421] Here, the conversation segment is split into conversation segments for each round, and the conversation segments, basic customer information, and business information signatures for each round after the split are determined as input information B.

[0422] 5) Based on the split conversation segments of each round (i.e., the user's first input information), the customer's basic information, and the business information, a probability prediction (i.e., the above-mentioned first prediction) is made, i.e., the prior probability P(repayment).

[0423] First, the input information B is feature and position encoded using the pre-trained model 1502 to obtain encoded features. This means that the pre-trained model 1502 is used to generate sentence-level embedding representations for each round of dialogue. These embeddings not only contain lexical meaning but also reflect contextual semantics.

[0424] Next, the encoded features are cumulatively concatenated. Specifically, all conversation embeddings up to the current turn are concatenated chronologically into a single long vector, which serves as the input for that moment. This ensures that predictions at each moment are based on the complete conversation history. Before concatenating, the previous features are updated based on their weights to obtain updated conversation embeddings. All updated conversation embeddings up to the current turn are concatenated chronologically into a single long vector.

[0425] Then, the connected features are attended to through the self-attention mechanism 1505, so that the model can automatically weight the importance of past rounds of conversation based on the current conversation content, thereby better understanding the key points in the conversation.

[0426] 6) Determine the weights of the features and adjust the features based on the weights.

[0427] Here, the attention weight matrix (i.e., weight) is calculated by the self-attention mechanism 1505, and the product of the weight and the connected features is determined as the adjusted features. Each time a new dialogue round is added, the model will dynamically update the estimate of the repayment probability based on the existing knowledge, encode the historical input dialogue through the pre-trained model 1502 to obtain the historical dialogue features, calculate the first product of the weight and the historical dialogue features, encode the current input new dialogue through the pre-trained model 1502 to obtain the current dialogue features, splice the first product with the current features, and make a probability prediction on the spliced ​​features, thereby updating the estimate of the repayment probability (i.e., the second probability mentioned above), i.e., the likelihood function P (dialogue i |Repayment). This way, even at the beginning of a conversation, the model already has preliminary judgment capabilities, and as the conversation deepens, this judgment will become more accurate.

[0428] 7) Predict probabilities through the Bayesian updating framework 1503.

[0429] Here, each time a new conversation message is received, the latest conversation is used to update the previous probability estimate, reflecting the changing trend of the repayment probability during the conversation. The Yes Update Framework 1503 includes calculating the prior probability P(repayment), calculating the likelihood function P(conversation i |repayment) and calculate the posterior probability P(repayment|dialogue i), where the prior probability P(repayment) is the initial repayment probability (i.e., the third probability) estimated based on the customer's basic information, and the likelihood function P(dialogue i |Repayment) is the probability of observing the i-th round of dialogue under the given repayment condition, and it is parameterized as a differentiable function so that these parameters can be learned and optimized through the training process. i ) is the probability of the i-th round of dialogue, which can usually be regarded as a constant or ignored. i ) is the updated repayment probability calculated using Bayesian theorem. The Bayesian theorem formula is shown in Formula 3.

[0430]

[0431] Assuming P(session i) is a constant, the simplified formula is shown in Formula 4.

[0432] P i =a i *P i-1 (4)

[0433] in, A function used to represent the repayment probability of the i-th round of dialogue under the conditional probability learned by the model.

[0434] The probability prediction output layer 1504 predicts the posterior probability P(repayment|dialogue i ) is activated to obtain the probability of each round of dialogue prediction.

[0435] 8) Conduct training on the effect refinement model.

[0436] Here, we determine a comprehensive loss function that includes both a cross-entropy loss and a penalty term for changes in prediction probabilities between two consecutive rounds. Specifically, we calculate the difference between the prediction probabilities of two consecutive rounds and incorporate it into the overall loss, encouraging the model to focus on and learn from these changes. This helps capture dynamic adjustments during the conversation, allowing the model to more accurately reflect the impact of each round of conversation on the repayment probability. The following details the cross-entropy loss and the probability change penalty term.

[0437] Cross entropy loss L CE Used to measure the gap between the predicted probability Pi and the actual repayment result label. Probability change penalty term L diff This is used to encourage the model to learn the change in probability from one round to the next, that is, the difference between the predicted probabilities of two consecutive rounds. The comprehensive loss function is shown in Formula 5.

[0438] L=L CE +λ Ldiff (5)

[0439] Among them, λ is a hyperparameter used to balance the importance of the two. diff As shown in Formula 6.

[0440]

[0441] Among them, P i is the probability of this round of dialogue generation, and is the probability of the previous round of dialogue generation.

[0442] Through dynamic learning, the model updates its estimate of the repayment probability after each round of conversation based on the formula above. As more conversation information is incorporated, the model continuously refines its view of the likelihood of repayment. If a particular round of conversation reduces a customer's willingness to repay, the model will adjust its subsequent probability predictions accordingly, and vice versa.

[0443] 9) Evaluate the effect refinement model.

[0444] After each stage, the model performance is evaluated and hyperparameters are adjusted or the model is improved as needed. In addition, the embodiment of the present application is evaluated on the validation set, and the configuration that minimizes the logarithmic loss on the validation set is selected by adjusting the model parameters. Since the labels of the evaluation set and the test set are real business results 0 and 1, and the model predicts that the output is a probability between 0 and 1, a probabilistic evaluation indicator (such as logarithmic loss) is used, and the logarithmic loss is shown in Formula 7.

[0445]

[0446] Among them, y i is the true label of the i-th sample (0 or 1), p i is the model's predicted probability that the i-th sample belongs to the positive class (i.e., the probability of repayment), and N is the number of samples. When the logarithmic loss on the validation set no longer decreases significantly, training stops and the current model parameters are saved. To ensure the model's generalization ability on unseen data, calculate the logarithmic loss on the test set, record, and analyze this data. Logarithmic loss is used to characterize the model's discriminative power and accuracy, and can also be combined with other evaluation metrics to understand model performance.

[0447] Continue to see Figure 8 ,After the review of the selected tasks is completed, the appropriate ,pretrained model is selected, the resources and initial training parameters are set, ,and multiple existing selected data sets are selected to complete the ,training of the text embedding model.

[0448] In step 813, the selected corpus is adopted into the speech library to obtain the business speech library. The business speech library is a single-level speech management module that accepts business speech selected from the selected corpus. It can also be manually added and stored after review. When managing speech, there is no need to worry about the speech process, the scenario for which the speech is suitable, etc., which greatly simplifies the maintenance mode of the speech. Figure 16 , Figure 16 This is a schematic diagram of the business speech library page provided by the embodiment of this application. Figure 16 As shown, the business speech library page 1601 includes speech text, mapped speech, embedded status, review status, suitable intent, vector index, and operations. Speech text is the speech used to respond to customer input. Mapped speech is used to represent the speech index of the speech text in the event of non-compliance. Embedded status includes completed and uncompleted states. When the speech text is in the completed state, the corresponding vector index of the speech text is recorded. Review status includes passed and pending review. When the review is passed, the approved speech text is used to respond to the customer. Suitable intent is used to represent the intent of the speech text. Select an intent that the speech text is most suitable for as the label of the most suitable intent scenario for the speech text, which is only used as a weight for subsequent intervention model matching. You can also choose not to select. Operations include edit, review, and delete, which are used to process the speech text in the business speech library page 1601. When reviewing the selected corpus, the selected speech text is directly added to the speech library without review. Other speech texts require review and addition to the speech library.

[0449] In step 814, mapping phrases are added to non-compliant phrases. One or more mapping phrases can be set, typically used during editing, to facilitate rapid upgrades of response phrases. For example, if a phrase is initially selected, but later changes due to policy make it non-compliant, the current text embedding model primarily processes the original phrase. In this case, a mapping phrase is set. When a match is found with the original phrase, the mapped phrase is called for output. This allows for rapid, 100% compliant phrase replacement without compromising model matching accuracy.

[0450] In step 815, the dialogue is vectorized.

[0451] Here, after the training is completed, the text embedding model is used to automatically perform a vectorized update operation on the entire amount of reviewed business speech database.

[0452] In step 816, the vector speech library is updated.

[0453] Here, the vector speech library is updated to ensure that the speech library and the input dialogue use the same, latest text embedding model. When new speech is added or modified, the system prompts the number of such speech that have not been vectorized. In response to the updated vector, the latest text embedding model is called to update the vector speech library.

[0454] In step 817, the vector index is updated. After the speech is vectorized and stored in the database, its vector index is obtained and updated back to the business speech database to ensure the accuracy of the business speech database. If the speech is deleted, the corresponding data in the vector speech database is deleted synchronously according to the vector index.

[0455] See also Figure 17 , Figure 17 This is the second principle diagram of the dialogue generation provided by the embodiment of the present application. The principle of generating the dialogue provided by the embodiment of the present application is explained below.

[0456] First, when the customer's current question is received in the conversation, the historical conversation of the current conversation, the customer's current question, and the customer's basic information are input into the intent classification model 1702 to predict the customer's current intention. At the same time, this information and the customer's basic information are input into the text embedding model 1701 to generate the context vector of the current customer conversation.

[0457] Secondly, the context vector is used to perform vector similarity matching with the speech vector in the high-dimensional vector space in the vector speech library 1703 to obtain the top 3-10 speech (i.e., the fourth speech template). If the intention of a speech in the top 3-10 speech is the same as the customer's current intention, its sorting priority is increased, and the top 3 speech (i.e., the first speech template) is selected to obtain the final candidate speech. If the predicted intention is X1, the final candidate speech and intention obtained by vector similarity matching are A-X2, B-X1, and C-X1, then the ranking after intervention is B\C\A. Intent is used for vector similarity matching. When some intentions cannot be matched to suitable speech, the chat and transition backup speech that are farther away can be obtained.

[0458] After obtaining the first three lines of dialogue, cache them. Especially in specific fields, customer expressions and conversation rounds often have a certain degree of repetition. Through the caching mechanism, the matching retrieval efficiency can be further improved.

[0459] After obtaining the first three scripts, the basic information of the customers is integrated to obtain integrated information, and the effect ranking model 1704 is called to predict the business completion probability (such as repayment probability) of the new conversation based on the integrated information, and re-sort them to obtain the first script.

[0460] Then, after obtaining the first speech, check whether the speech has a mapping speech. If so, obtain the mapping speech and randomly select a speech from the mapping speech as the final generated speech. Otherwise, use the first speech as the final generated speech, use the customer's basic information, and fill the speech text of the final generated speech, that is, replace the variables in the generated speech with the customer's basic information to obtain the final speech text.

[0461] Finally, the content of the speech is returned, and the speech text is returned to the dialogue system to synthesize the speech and communicate with the customer by voice.

[0462] In summary, the speech in the embodiment of the present application is 100% compliant and controllable. The speech is derived from the business speech library, and compliance, legal and security-related audits are conducted in advance to ensure the compliance of the speech. Flat speech management reduces the difficulty of speech management, and the customer context semantic vectors are matched and the effects are carefully sorted, which can capture the subtle differences in customer characteristics and select the best reply speech. Using text embedding instead of large models to generate speech reduces dependence on computing resources and increases the speed of speech generation, so that 99% of the speech is generated within 400ms. In addition, when a speech becomes non-compliant due to political changes, the mapping speech is directly set, which has strong controllability and high modification efficiency without sacrificing the accuracy of the reply.

[0463] The following continues to describe the exemplary structure of the dialogue generation device 555 provided in the embodiment of the present application as a software module. In some embodiments, such as Figure 2 As shown, the software modules stored in the dialogue generating means 555 of the memory 550 may include:

[0464] The template retrieval module 5551 is used to encode the first input information of the first user, the first dialogue information and the attribute information of the first user to obtain a first feature, and retrieve a first speech template from the knowledge base based on the first feature.

[0465] The template screening module 5552 is used to predict the interaction behavior between the first user and the first speech template, obtain a first probability, and screen out a second speech template from the first speech template based on the first probability.

[0466] The template mapping module 5553 is used to determine a third speech template having a mapping relationship with the second speech template from the first mapping table when the second speech template does not match the preset information, wherein the first mapping table includes mapping relationships between different speech templates.

[0467] The reply generation module 5554 is used to generate reply information for the first input information based on the third speech template and the attribute information of the first user.

[0468] In some embodiments, the template retrieval module 5551 is also used to query the second feature corresponding to each speech template in the knowledge base from the second mapping table, wherein the second mapping table includes the correspondence between different speech templates and different features; based on the first similarity between the first feature and the second feature, the fourth speech template is filtered out from the knowledge base; based on the first input information, the first intention of the first user is identified; based on the first intention, the first speech template is filtered out from the fourth speech template.

[0469] In some embodiments, the template retrieval module 5551 is also used to fuse the first input information and the first dialogue information to obtain the second input information, and perform attention processing on the second input information to obtain the third feature; perform first gating processing on the third feature to obtain the fourth feature, and decode the fourth feature to obtain the second intention; perform activation processing on the fourth feature, and decode the activated fourth feature to obtain the third intention; and filter out the first intention of the first user from the second intention and the third intention.

[0470] In some embodiments, the template screening module 5552 is also used to make a first prediction of the interaction behavior between the first user and the first speech template based on the first input information, the first conversation information and the attribute information of the first user, and obtain a second probability; based on the attribute information of the first user, make a second prediction of the interaction behavior between the first user and the first speech template, and obtain a third probability; and obtain the first probability based on the second probability and the third probability.

[0471] In some embodiments, the template construction module 5555 is used to extract the first reply information from the first dialogue information; construct the speech based on the first reply information to obtain the fifth speech template; perform intent recognition on the first reply information to obtain the intent of the first reply information, and determine the intent of the first reply information as the fifth intent of the fifth speech template; and construct a knowledge base based on the fifth speech template and the corresponding fifth intent.

[0472] In some embodiments, the template construction module 5555 is also used to cluster the conversation information of the second user to obtain clusters; determine a first cluster corresponding to the fifth intent from the clusters; when the number of conversation information included in the first cluster is greater than a quantity threshold, diffuse the fifth intent to obtain a sixth intent; filter out the seventh intent from the fifth intent and the sixth intent, and replace the seventh intent with the fifth intent.

[0473] In some embodiments, the template construction module 5551 is also used to query the eighth intention corresponding to the preset keyword from the third mapping table when the first reply message contains the preset keyword, and determine the eighth intention as the sixth intention, and the third mapping table contains the correspondence between different keywords and different intentions; when the first reply message does not contain the preset keyword, the preset intention is determined as the sixth intention.

[0474] In some embodiments, the template retrieval module 5551 is also used to fuse the first input information with the first dialogue information in the user's first input information to obtain third input information; encode the third input information to obtain a fifth feature; encode the attribute information of the first user to obtain a sixth feature, and fuse the sixth feature and the fifth feature to obtain the first feature.

[0475] In some embodiments, the template retrieval module 5551 is further used to extract information from the third input information to obtain multiple information fragments; input each information fragment into the first coding layer, encode each information through the first coding layer, and obtain a first coding feature output by the first coding layer, wherein the number of first coding features output by the first coding layer is the same as the number of information fragments; input the first coding feature output by the n-1th coding layer into the nth coding layer, and perform the following processing through the nth coding layer: fuse the first coding feature output by the n-1th coding layer to obtain a second coding feature, and encode the second coding feature to obtain the first coding feature output by the nth coding layer, wherein n is a positive integer that increases successively, 1<n≤N; and determine the first coding feature output by the Nth coding layer as the fifth feature.

[0476] In some embodiments, the template retrieval module 5551 is further used to, when the number of first coding features output by the n-1th coding layer is greater than a quantity threshold, fuse the two first coding features output by the n-1th coding layer to obtain a second coding feature; when the number of first coding features output by the n-1th coding layer is less than or equal to the quantity threshold, determine the first coding feature output by the n-1th coding layer as the third coding feature, and concatenate the first coding feature and the third coding feature output by the n-1th coding layer to obtain a second coding feature.

[0477] An embodiment of the present application provides a computer program product, which includes computer-executable instructions. The computer-executable instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer-executable instructions from the computer-readable storage medium, and the processor executes the computer-executable instructions, so that the electronic device executes the above-mentioned dialogue generation method of the embodiment of the present application.

[0478] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will execute the dialogue generation method provided by the embodiment of the present application, for example, Figures 3A to 3F The dialog generation method shown.

[0479] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0480] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0481] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).

[0482] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.

[0483] To summarize, the first input information of the first user, the first dialogue information and the attribute information of the first user are encoded to obtain a first feature, and based on the first feature, a first speech template is retrieved from the knowledge base, the interaction behavior between the first user and the first speech template is predicted to obtain a first probability, and a second speech template is screened out from the first speech template based on the first probability. In this way, the first speech template is retrieved and the interaction behavior between the first user and the first speech template is predicted through the first feature, and the speech template in the knowledge base that is semantically closest to the first input information is determined, thereby avoiding the performance consumption of generating speech through a large model, saving computing resources, and improving the efficiency and accuracy of dialogue generation. When the second speech template does not match the preset information, a third speech template with a mapping relationship with the second speech template is determined from the first mapping table, wherein the first mapping table includes mapping relationships between different speech templates, and based on the third speech template and the attribute information of the first user, reply information of the first input information is generated. In this way, it is ensured that the generated reply information of the first input information matches the preset information, avoiding the generation of reply information that does not match the preset information, and improving the accuracy of dialogue generation.

[0484] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.

Claims

1. A method for generating a dialogue, characterized in that: The method comprises: Encoding first input information of a first user, first conversation information, and attribute information of the first user to obtain a first feature, and retrieving a first speech template from a knowledge base based on the first feature; Predicting the interaction behavior between the first user and the first speech template to obtain a first probability, and filtering out a second speech template from the first speech template based on the first probability; If the second speech template does not match the preset information, determining a third speech template having a mapping relationship with the second speech template from a first mapping table, wherein the first mapping table includes mapping relationships between different speech templates; Based on the third speech template and the attribute information of the first user, reply information for the first input information is generated.

2. The method according to claim 1, characterized in that The retrieving a first speech template from a knowledge base based on the first feature includes: Querying a second feature corresponding to each speech template in the knowledge base from a second mapping table, wherein the second mapping table includes correspondences between different speech templates and different features; Based on a first similarity between the first feature and the second feature, selecting a fourth speech template from the knowledge base; identifying a first intention of the first user based on the first input information; Based on the first intention, the first speech template is filtered out from the fourth speech template.

3. The method according to claim 2, characterized in that The identifying the first intention of the first user based on the first input information includes: fusing the first input information and the first conversation information to obtain second input information, and performing attention processing on the second input information to obtain a third feature; Performing a first gating process on the third feature to obtain a fourth feature, and decoding the fourth feature to obtain a second intent; activating the fourth feature and decoding the activated fourth feature to obtain a third intent; The first intention of the first user is filtered out from the second intention and the third intention.

4. The method according to claim 1, wherein The predicting the interaction behavior between the first user and the first speech template to obtain a first probability includes: Based on the first input information, the first conversation information, and the attribute information of the first user, a first prediction is made on the interaction behavior of the first user with the first speech template to obtain a second probability; Based on the attribute information of the first user, a second prediction is made on the interaction behavior of the first user with the first speech template to obtain a third probability; The first probability is obtained according to the second probability and the third probability.

5. The method according to any one of claims 1 to 4, characterized in that The first dialogue information includes second input information of the first user and first reply information for replying to the second input information; Before retrieving the first speech template from the knowledge base based on the first feature, the method further includes: extracting the first reply information from the first conversation information; Constructing a speech based on the first reply information to obtain a fifth speech template; performing intent recognition on the first reply message to obtain the intent of the first reply message, and determining the intent of the first reply message as the fifth intent of the fifth speech template; Based on the fifth speech template and the corresponding fifth intention, the knowledge base is constructed.

6. The method according to claim 5, characterized in that After determining the intention of the first reply information as the fifth intention of the fifth speech template, the method further includes: Clustering the conversation information of the second user to obtain clusters; determining a first cluster corresponding to the fifth intent from the clusters; When the number of conversation messages included in the first cluster is greater than a quantity threshold, performing intent diffusion on the fifth intent to obtain a sixth intent; A seventh intention is selected from the fifth intention and the sixth intention, and the seventh intention is replaced with the fifth intention.

7. The method according to claim 6, characterized in that The performing intent diffusion on the fifth intent to obtain the sixth intent includes: When the first reply message includes a preset keyword, querying a third mapping table for an eighth intent corresponding to the preset keyword, and determining the eighth intent as the sixth intent, the third mapping table including correspondences between different keywords and different intents; When the first reply information does not include the preset keyword, the preset intention is determined as the sixth intention.

8. The method according to claim 1, characterized in that Encoding the first input information of the first user, the first conversation information, and the attribute information of the first user to obtain a first feature includes: fusing the first input information with the first dialogue information to obtain third input information; Encoding the third input information to obtain a fifth feature; The attribute information of the first user is encoded to obtain a sixth feature, and the sixth feature and the fifth feature are fused to obtain the first feature.

9. The method according to any one of claim 8, characterized in that The encoding is implemented through multiple encoding layers, and the encoding of the third input information to obtain the fifth feature includes: performing information extraction on the third input information to obtain a plurality of information fragments; Inputting each information segment into a first encoding layer, encoding each information segment through the first encoding layer, and obtaining a first encoding feature output by the first encoding layer, wherein the number of the first encoding features output by the first encoding layer is the same as the number of the information segments; Input the first coding feature output by the n-1th coding layer to the nth coding layer, and perform the following processing through the nth coding layer: fuse the first coding feature output by the n-1th coding layer to obtain a second coding feature, and encode the second coding feature to obtain the first coding feature output by the nth coding layer, where n is a successively increasing positive integer and 1<n≤N; The first coding feature output by the Nth coding layer is determined as the fifth feature.

10. The method according to claim 9, characterized in that The fusing of the first coding features output by the n-1th coding layer to obtain the second coding features includes: When the number of the first coding features output by the n-1th coding layer is greater than a quantity threshold, fusing the two first coding features output by the n-1th coding layer to obtain the second coding feature; When the number of first coding features output by the n-1th coding layer is less than or equal to the quantity threshold, the first coding feature output by the n-1th coding layer is determined as the third coding feature, and the first coding feature output by the n-1th coding layer and the third coding feature are concatenated to obtain the second coding feature.

11. A dialogue generation device, characterized in that: The device comprises: a template retrieval module, configured to encode the first input information of the first user, the first dialogue information, and the attribute information of the first user to obtain a first feature, and retrieve a first speech template from a knowledge base based on the first feature; a template screening module, configured to predict the interaction behavior between the first user and the first speech template, obtain a first probability, and screen a second speech template from the first speech template based on the first probability; a template mapping module, configured to determine, from a first mapping table, a third speech template having a mapping relationship with the second speech template when the second speech template does not match preset information, wherein the first mapping table includes mapping relationships between different speech templates; A reply generation module is used to generate reply information for the first input information based on the third speech template and the attribute information of the first user.

12. An electronic device, characterized in that: The electronic device comprises: a memory for storing computer-executable instructions; A processor is configured to implement the dialogue generation method according to any one of claims 1 to 10 when executing the computer-executable instructions or computer program stored in the memory.

13. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the dialogue generation method according to any one of claims 1 to 10 is implemented.

14. A computer program product comprising computer executable instructions or a computer program, characterized in that When the computer executable instructions or computer program are executed by a processor, the dialogue generation method according to any one of claims 1 to 10 is implemented.