Man-machine conversation method and device based on large language model

By receiving and filtering streaming input data in the large language model, calculating KL divergence and confidence, and determining the generation time, the problem that it is difficult for the large language model to decide the generation time and content at the same time in the streaming generation task is solved, and the accuracy and real-timeness of human-computer dialogue are improved.

CN119831039APending Publication Date: 2025-04-15INST OF COMPUTING TECH CHINESE ACAD OF SCI
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411885787.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In streaming generation tasks, it is difficult for large language models to learn decision generation moments and contents at the same time, resulting in a decline in the quality of generation and affecting the accuracy and real-time nature of human-computer dialogue.

Method used

By receiving the initial streaming input data, filtering the target streaming input data based on the preset baseline strategy, and inputting the initial data and target data into the large language model, calculating the KL divergence and confidence, combining the two to determine the target generation moment, and triggering the model to generate a reply.

Benefits of technology

The generation time is accurately determined, redundant delays and insufficient streaming input are avoided, and the accuracy and real-timeness of human-computer dialogue based on large language models are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119831039A_ABST
    Figure CN119831039A_ABST
Patent Text Reader

Abstract

The invention provides a man-machine conversation method and device based on a large language model, and the method comprises the following steps: screening initial streaming input data of each time step based on a preset baseline strategy, and obtaining corresponding target streaming input data; and inputting the initial streaming input data and the target streaming input data of each time step into the large language model to respectively obtain first distribution and second distribution, and calculating KL divergence and confidence according to the first distribution and the second distribution. And finally, combining the KL divergence and the confidence coefficient to determine a target generation moment. According to the method, the target generation moment of the model is determined in a manner of comparing aggressive strategies, the large language model is guided to generate replies when proper streaming input is read in, the generation moment is accurately determined, redundant delay and insufficient streaming input conditions are avoided, and the requirements for accuracy and real-time performance of man-machine conversation based on the large language model are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of human-computer interaction technology, and in particular to a human-computer dialogue method and device based on a large language model. Background Art

[0002] Real-time interaction between humans and machines is the focus of current artificial intelligence technology research, and its key technology lies in streaming generation tasks. In streaming generation tasks, the model needs to respond to the continuously arriving streaming input, so it is necessary to determine the generation time and content. Usually, streaming input contains voice, text, image data, etc., such as voice data in scenarios such as simultaneous interpretation and streaming speech recognition. These scenarios often have high requirements for the accuracy and real-time performance of the dialogue.

[0003] In the existing technology, a complex dynamic programming method based on Transformer is usually used to let a model learn to decide the time and generate content at the same time. The rise of large language models has promoted the further development of streaming generation, but due to the large-scale parameters and model architecture, it is difficult for large language models to learn to decide the generation time and generate content at the same time like Transformer-based methods, because the input and output in the decoder-only architecture of large language models are strongly coupled together, which is not suitable for dynamic programming training. As a result, large language models often generate content at inappropriate times, resulting in a decrease in generation quality and affecting the accuracy and real-time performance of human-computer dialogue. Summary of the invention

[0004] In view of the deficiencies in the prior art, the present invention proposes a human-computer dialogue method, device, equipment, medium and program product based on a large language model.

[0005] The present invention discloses a method for human-computer interaction, comprising the following steps:

[0006] Receiving initial stream input data, wherein the initial stream input data is one of voice and text data that arrives gradually over time;

[0007] Based on a preset baseline strategy, the initial streaming input data of each time step is screened to obtain corresponding target streaming input data;

[0008] Inputting the initial streaming input data and the target streaming input data at each time step into the large language model to obtain a first distribution and a second distribution respectively;

[0009] Calculate the KL divergence and confidence according to the first distribution and the second distribution;

[0010] When the KL divergence exceeds a preset divergence threshold, or the confidence exceeds a preset hyperparameter value, the corresponding time step is determined to be the target generation moment, and the large language model is triggered to generate a corresponding reply.

[0011] In some embodiments, it further includes: adding constraints to the target generation time, where the constraints are determined based on a preset number of read-in words, a total length of initial streaming input data, and a degree of freedom of the large language model to autonomously determine the generation time.

[0012] In some embodiments, the constraint is expressed as:

[0013] [min{L+i-1,J},min{L+i-1+U}]

[0014] Among them, L represents the number of words pre-read before generation, J represents the total length of the initial streaming input, U represents the freedom of the large language model to independently determine the generation time, and i is the number of generated words.

[0015] In some embodiments, the confidence level is the maximum value of the first distribution corresponding to all time steps.

[0016] In some embodiments, the baseline strategy employs a contrasting aggressive strategy.

[0017] Another aspect of the present invention also discloses a human-computer dialogue device based on a large language model, comprising:

[0018] An acquisition module, configured to receive initial stream input data, wherein the initial stream input data is one of voice and text data that arrives gradually over time;

[0019] A comparison module, for screening the initial streaming input data at each time step based on a preset baseline strategy to obtain corresponding target streaming input data;

[0020] An indicator setting module, used for inputting the initial streaming input data and the target streaming input data of each time step into the large language model to obtain a first distribution and a second distribution respectively; and calculating the KL divergence and the confidence according to the first distribution and the second distribution;

[0021] The reply determination module is used to determine the corresponding time step as the target generation moment when the KL divergence exceeds a preset divergence threshold, or the confidence exceeds a preset hyperparameter value, and trigger the large language model to generate a corresponding reply.

[0022] In some embodiments, a constraint setting module is used to add constraints to the target generation time, where the constraints are determined based on a preset number of read words, a total length of the initial streaming input data, and a degree of freedom of the large language model to autonomously determine the generation time.

[0023] On the other hand, the present invention also discloses an electronic device, comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the above-mentioned human-computer interaction method.

[0024] Another aspect of the present invention discloses a computer-readable storage medium, characterized in that computer instructions are stored thereon, and when the instructions are executed by a processor, the human-computer dialogue method as described above is implemented.

[0025] Another aspect of the present invention further discloses a computer program product, comprising a computer program, which implements the steps of the above-mentioned human-computer dialogue method when executed by a processor.

[0026] It can be seen from the above scheme that the advantages of the present invention are:

[0027] The human-computer dialogue method based on a large language model disclosed by the present invention screens the initial streaming input data of each time step based on a preset baseline strategy to obtain the corresponding target streaming input data; and inputs the initial streaming input data and the target streaming input data of each time step into the large language model to obtain the first distribution and the second distribution respectively, and then calculates the KL divergence and the confidence according to the first distribution and the second distribution. Finally, the target generation time is determined in combination with the KL divergence and the confidence. The method determines the target generation time of the model by comparing the radical strategy, guides the large language model to generate a reply when reading the appropriate streaming input, accurately determines the generation time, avoids redundant delays and insufficient streaming input, and meets the accuracy and real-time requirements of human-computer dialogue based on the large language model. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 The difference in generation distribution between the subsequent generation moment and the Wait-1 strategy;

[0029] Figure 2 A schematic diagram of the overall flow of a human-computer dialogue method disclosed in an embodiment of the present invention;

[0030] Figure 3 A comparison between the method of the present invention and the prior art method;

[0031] Figure 4 This is a schematic diagram of the overall structure of a human-machine dialogue device disclosed in another embodiment of the present invention.

[0032] Reference numerals:

[0033] 100: human-machine dialogue device;

[0034] 110: Get module;

[0035] 120: comparison module;

[0036] 130: indicator setting module;

[0037] 140: reply determination module;

[0038] 150: Constraint setting module. DETAILED DESCRIPTION

[0039] It should be noted that, in this application, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0040] Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0041] The present invention allows the large language model to determine the generation time while not destroying its generation capability, thereby autonomously completing the streaming generation task to achieve high-precision and real-time human-computer dialogue based on the large language model. Taking the simultaneous interpretation scenario as an example, the characteristics of the streaming generation task are explored. Figure 1 As shown, a case of De-En (German-English) generation is analyzed. It can be seen that compared with the more radical generation strategy (generating replies based on less input), namely the Wait-1 strategy, the generation distribution of the model will be greatly different after sufficient source information is input. Otherwise, the generation distribution of the model is slightly different from the Wait-1 strategy. In this regard, if a predefined radical strategy is given, the large language model can determine the time of generation by comparing the difference between the distribution at that time and the generation distribution between the radical strategy. In this case, the large language model can simultaneously complete the decision of the generation time and the generation content without any training. In addition, the radical strategy can also generate replies with a higher confidence at certain generation times, so the present invention also uses the generation confidence of the large language model to supplement it.

[0042] The human-computer dialogue method based on a large language model of the present invention will be described in detail below. Figure 2 As shown in Figure 2The overall flow chart of the human-computer dialogue method disclosed in one embodiment of the present invention is shown. The human-computer dialogue method based on the large language model specifically comprises the following steps:

[0043] Step S1: receiving initial stream input data, wherein the initial stream input data is one of voice and text data that arrives gradually over time.

[0044] In human-computer interaction, streaming data can be used to provide real-time feedback. Streaming data allows real-time analysis of user interaction behaviors, thereby providing a personalized user experience. Streaming data arrives in real time, which means that the system needs to process the data immediately when it arrives, rather than waiting for all the data to arrive before batch processing. Streaming data arrives continuously, either at fixed or irregular time intervals. This continuity requires the system to be able to continuously process newly arrived data. The content, format, and arrival rate of streaming data may change over time. The system needs to be able to adapt to such dynamic changes. Streaming input data is widely used in many fields, such as speech recognition, real-time text analysis, etc. These applications require the system to be able to process and analyze streaming data in real time to make timely and accurate decisions.

[0045] Step S2: Based on a preset baseline strategy, the initial streaming input data of each time step is screened to obtain corresponding target streaming input data.

[0046] In this embodiment, the initial streaming input data consists of input data of several time steps. Based on the preset baseline strategy, for each time step of the initial streaming input data x ≤j , filter out the streaming input corresponding to the baseline strategy (with the new input x ≤i (i is the number of words generated at this time), that is, the target streaming input data.

[0047] In one embodiment, the baseline policy adopts a comparatively aggressive policy, such as the Wait-1 policy.

[0048] Step S3: input the initial streaming input data and the target streaming input data of each time step into the large language model to obtain a first distribution and a second distribution respectively; and calculate the KL divergence and the confidence according to the first distribution and the second distribution.

[0049] Then, the initial streaming input data of each time step and the target streaming input data of each time step are fed into the large language model to obtain the first distribution p(y i |x ≤j ,y <i ), the second distribution p(y i |x ≤i ,y <i), wherein the first distribution is determined based on initial streaming input data and the second distribution is determined based on target streaming input data.

[0050] Based on the first distribution and the second distribution, the KL divergence is calculated. The KL divergence is used to measure the similarity of distribution and is expressed as:

[0051] D KL [p(y i |x ≤j ,y <i )||p(y i |x ≤i ,y <i )]

[0052] The confidence level is the maximum value of the first distribution corresponding to all time steps, that is, max p(y i |x ≤j ,y <i ).

[0053] Step S4: When the KL divergence exceeds a preset divergence threshold, or the confidence exceeds a preset hyperparameter value, the corresponding time step is determined to be the target generation moment, and the large language model is triggered to generate a corresponding reply.

[0054] In this embodiment, on the one hand, by judging whether the KL divergence corresponding to each time step exceeds the preset divergence threshold δ, if it exceeds that, the large language model believes that the corresponding time step has read enough source information, and the corresponding time step is determined as the target generation time. At this time, the corresponding reply is generated based on the target generation time and the initial streaming input data of the previous time step. Otherwise, the large language model will not make any response at this time, but wait for the streaming input of the future time step.

[0055] In addition, in the current reasoning process, if the baseline strategy has expressed sufficient streaming input information, then the KL divergence value will still be small, causing the large language model to over-read the source information and cause false negatives. In this regard, in this embodiment, a confidence condition is introduced to determine whether the confidence corresponding to each time step exceeds the preset hyperparameter value α. If it exceeds, that is, p(y i |x ≤j ,y <i )>α, the corresponding time step is determined as the target generation moment, and the large language model will still generate a response.

[0056] In this embodiment, based on the combination of KL divergence and confidence, the decision generation moment of the large language model, that is, the target generation moment, is determined, and at the target generation moment, the large language model is triggered to generate a corresponding response based on the target generation moment and the initial streaming input data of the previous time step.

[0057] In addition, the streaming generation of human-computer dialogue has high requirements for the delay of model responses. In order to prevent the model from generating responses too early or too slowly, and to facilitate delay control, in one embodiment, a delay range constraint is also introduced. The range constraint can ensure that the large language model generates reasonable responses within an acceptable delay range. Specifically, a constraint is added to the target generation time, which is determined based on the preset number of read-in words, the total length of the initial streaming input data, and the freedom of the large language model to autonomously determine the generation time. The constraint is expressed as:

[0058] [min{L+i-1,J},min{L+i-1+U}]

[0059] Among them, L represents the number of words pre-read before generation, J represents the total length of the initial streaming input, U represents the freedom of the large language model to independently determine the generation time, and i is the number of generated words.

[0060] The following is a comparison of the flow generation performance between the method of the present invention (abbreviated as LSG) and different methods of the prior art. Figure 3 As shown, Figure 3 The figure shows the comparison effect between the method of the present invention and the prior art. Figure 3 It can be seen that the method of the present invention achieves a 2BLEU to 5BLEU performance improvement at the same delay in the simultaneous interpretation task WMT15De-En (German-English) without training, and obtains the same generation quality with 3AL saved. The method of the present invention achieves a 6WER reduction on the streaming automatic speech recognition task CoVoST 2Fr-En (French-English) with a delay of 2000 milliseconds. The method of the present invention achieves an average performance improvement of 0.5-1BLEU on the WMT15 De-En dataset without training and avoiding complex control logic.

[0061] In summary, the human-computer dialogue method based on the large language model disclosed in the present invention, based on a preset baseline strategy, screens the initial streaming input data of each time step to obtain the corresponding target streaming input data; and inputs the initial streaming input data and the target streaming input data of each time step into the large language model, respectively obtaining the first distribution and the second distribution, and then calculating the KL divergence and the confidence according to the first distribution and the second distribution, and finally determining the target generation time by combining the KL divergence and the confidence, and then triggering the large language model to generate the corresponding reply. The method is based on comparing aggressive strategies to judge the generation time, and without additional training, the large language model has achieved significant performance improvement in multiple streaming generation tasks, and improves the accuracy and real-time performance of human-computer dialogue based on the large language model. Specifically, the generation time of the model is determined by comparing aggressive strategies, which is used to guide the large language model to generate a reply when reading the appropriate streaming input, accurately determining the generation time, and avoiding redundant delays and insufficient streaming input. In addition, a range constraint is added to the generation time to ensure that the model generates a suitable reply within an acceptable delay range, and to ensure that the model generates a reply within an effective delay time.

[0062] Correspondingly, corresponding to the above-mentioned human-computer dialogue method, the present invention also provides a human-computer dialogue device based on a large language model, please refer to Figure 4 As shown, Figure 4 The human-machine dialogue device 100 based on the large language model specifically comprises:

[0063] The acquisition module 110 is used to receive initial stream input data, wherein the initial stream input data is one of voice and text data that arrives gradually over time.

[0064] The comparison module 120 is used to screen the initial streaming input data at each time step based on a preset baseline strategy to obtain corresponding target streaming input data.

[0065] The indicator setting module 130 is used to input the initial streaming input data and the target streaming input data of each time step into the large language model to obtain a first distribution and a second distribution respectively; and calculate the KL divergence and the confidence according to the first distribution and the second distribution.

[0066] The reply determination module 140 is used to determine that the corresponding time step is the target generation moment when the KL divergence exceeds a preset divergence threshold, or the confidence exceeds a preset hyperparameter value, and trigger the large language model to generate a corresponding reply.

[0067] The constraint setting module 150 is used to add constraints to the target generation time, and the constraints are determined based on a preset number of read-in words, a total length of the initial streaming input data, and a degree of freedom of the large language model to autonomously determine the generation time.

[0068] In addition, those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of each module of the described device can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0069] In addition, the present invention also proposes an electronic device in another embodiment, comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the above-mentioned human-computer dialogue method based on the large language model.

[0070] The present invention also proposes a storage medium in another embodiment for storing a computer program for executing the human-computer dialogue method. It should be understood that the storage medium in the embodiment of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0071] In addition, the present invention also provides a computer program product in one embodiment, which includes a computer program. The computer program can be stored on a readable storage medium. When the computer program is executed by a processor, the computer can execute the human-computer dialogue method provided by the above methods.

[0072] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and the implementation modes, and they can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.

Claims

1. A human-computer dialogue method based on a large language model, characterized in that: include: Receiving initial stream input data, wherein the initial stream input data is one of voice and text data that arrives gradually over time; Based on a preset baseline strategy, the initial streaming input data of each time step is screened to obtain corresponding target streaming input data; Inputting the initial streaming input data and the target streaming input data at each time step into the large language model to obtain a first distribution and a second distribution respectively; Calculate the KL divergence and confidence according to the first distribution and the second distribution; When the KL divergence exceeds a preset divergence threshold, or the confidence exceeds a preset hyperparameter value, the corresponding time step is determined to be the target generation moment, and the large language model is triggered to generate a corresponding reply.

2. The method according to claim 1, characterized in that Also includes: A constraint is added to the target generation time, where the constraint is determined based on a preset number of read-in words, a total length of the initial streaming input data, and a degree of freedom of the large language model to autonomously determine the generation time.

3. The method according to claim 2, characterized in that The constraint is expressed as: [min{L+i-1,J},min{L+i-1+U}] Among them, L represents the number of words pre-read before generation, J represents the total length of the initial streaming input, U represents the freedom of the large language model to independently determine the generation time, and i is the number of generated words.

4. The method according to claim 1, characterized in that: The confidence level is the maximum value of the first distribution corresponding to all time steps.

5. The method according to claim 1, characterized in that The baseline strategy adopts a comparatively aggressive strategy.

6. A human-computer dialogue device based on a large language model, characterized in that: include: An acquisition module, configured to receive initial stream input data, wherein the initial stream input data is one of voice and text data that arrives gradually over time; A comparison module, for screening the initial streaming input data at each time step based on a preset baseline strategy to obtain corresponding target streaming input data; An indicator setting module, used for inputting the initial streaming input data and the target streaming input data of each time step into the large language model to obtain a first distribution and a second distribution respectively; And, calculating KL divergence and confidence according to the first distribution and the second distribution; The reply determination module is used to determine the corresponding time step as the target generation moment when the KL divergence exceeds a preset divergence threshold, or the confidence exceeds a preset hyperparameter value, and trigger the large language model to generate a corresponding reply.

7. The device according to claim 6, characterized in that Also includes: A constraint setting module is used to add constraints to the target generation time, where the constraints are determined based on a preset number of read-in words, a total length of the initial streaming input data, and a degree of freedom of the large language model to autonomously determine the generation time.

8. An electronic device, characterized in that: include: at least one processor; And a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the human-computer dialogue method as described in any one of claims 1-5.

9. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed by a processor, a human-computer dialogue method as described in any one of claims 1-5 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the human-computer dialogue method described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Speech translation method, electronic equipment and computer readable storage medium

    CN112735417A

  • Simultaneous interpretation model training method and device, equipment and storage medium

    CN118395999A

  • Big language model reasoning method and device, electronic equipment and readable storage medium

    CN118609568A

  • Real-time question answering method based on large language model

    CN118966166A