Human-computer interaction method, device, equipment and medium

By judging the similarity of the replies of the interactive request and generating new replies, the problem of replies and duplication in the artificial intelligence interactive system is solved, high-quality and unique interactive replies are achieved, and user experience and system credibility are improved.

CN119312910APending Publication Date: 2025-01-14SHANGHAI KAITUO HUANYU TECH DEV CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202311779678.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-21
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

Existing artificial intelligence interactive systems are difficult to generate high-quality and non-repetitive interactive replies, resulting in reduced user experience and suspicion of artificial intelligence capabilities.

Method used

By judging the similarity between the reply statement requested by the user interaction and the statement generated before, if the threshold exceeds, a new reply statement will be generated to avoid duplicate keywords, and methods such as alternative vocabulary lists, downgrade processing and synonyms replacement are used to ensure the reply Diversity and accuracy.

Benefits of technology

It effectively avoids duplicate replies, improves user interaction experience, ensures that the generated replies are of high quality and unique, and enhances the credibility of artificial intelligence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119312910A_ABST
    Figure CN119312910A_ABST
Patent Text Reader

Abstract

The invention discloses a man-machine interaction method, device and equipment and a medium. The method comprises the steps of generating a first reply statement in response to a first interaction request of a user; judging whether the similarity between the first reply statement and the second reply statement is greater than a first threshold value or not; and if the judgment result is greater than the first threshold value, generating a third reply statement having a keyword different from that of the first reply statement. In the scheme, if it is found that the generated first reply statement conforming to the first interaction request is repeated with the previously generated second reply statement, the third reply statement avoiding containing the keyword appearing in the first reply statement is regenerated. The regenerated third reply statement is different from other reply statements in the history, so that the requirements of accuracy and high quality of interactive reply generation are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of Internet technology, and in particular to human-computer interaction methods, devices, equipment and media. Background Art

[0002] With the development of artificial intelligence technology, artificial intelligence is used to interact with people in more and more scenarios.

[0003] In the prior art, AI with interactive functions has not yet achieved flexible and varied responses like humans. For example, in some scenarios, users ask multiple rounds of questions about a certain question, and the answers they get are always repeated, without giving users new or further explanations. The question-and-answer process based on such a generated solution will not only reduce the user experience, but also make users doubt the capabilities of AI. Therefore, in order to make the generated responses diverse and avoid the above problems, a solution for generating high-quality and non-repetitive interactive responses is needed. Summary of the invention

[0004] Embodiments of the present invention provide a human-computer interaction method, apparatus, device and medium for generating high-quality and non-repetitive interactive responses.

[0005] In a first aspect, an embodiment of the present invention provides a human-computer interaction method, the method comprising:

[0006] In response to a first interactive request from a user, generating a first reply statement;

[0007] Determine whether the similarity between the first reply statement and the second reply statement is greater than a first threshold; wherein the second reply statement is any reply statement generated before the first reply statement;

[0008] If the judgment result is greater than the first threshold, a third reply sentence having different keywords from the first reply sentence is generated.

[0009] Optionally, generating a first reply statement in response to the user's first interaction request includes:

[0010] In response to a first interactive request from a user, determining a candidate word list for generating the first reply statement;

[0011] The first reply statement that is highly matched with the first interaction request is generated according to the probabilities corresponding to the candidate words in the candidate word list.

[0012] Optionally, if the judgment result is greater than the first threshold, generating a third reply statement having different keywords from the first reply statement includes:

[0013] If the judgment result is greater than the first threshold, converting the first reply sentence into a first word sequence;

[0014] After removing the stop words in the first word sequence, a second word sequence including the first keyword is generated;

[0015] Based on the first interaction request and the second word sequence, the third reply statement that does not include the first keyword is regenerated.

[0016] Optionally, the regenerating the third reply statement that does not include the first keyword includes:

[0017] De-ranking the first keyword in the candidate word list based on the second word sequence;

[0018] The third reply sentence including the second keyword is generated by using the candidate word list after the downgrading process; wherein the first keyword is different from the second keyword.

[0019] Optionally, the regenerating the third reply statement that does not include the first keyword includes:

[0020] If the similarity between the first interaction request and the second interaction request corresponding to the second reply statement is less than a second threshold, searching for an explanation statement or a synonym of the first keyword;

[0021] Based on the explanation sentence and / or the synonym, the third reply sentence not including the first keyword is generated.

[0022] Optionally, the regenerating the third reply statement that does not include the first keyword includes:

[0023] Processing the second word sequence by word segmentation, and using the first keyword obtained after the word segmentation as a prompt word;

[0024] Based on the received prompt word, a sentence for explaining the first keyword is generated as the third reply sentence.

[0025] Optionally, it also includes:

[0026] If the similarity between the second reply statement and the first reply statement is greater than a second threshold, determining the similarity between the first interaction request and the second interaction request corresponding to the second reply statement;

[0027] If the judgment result is that the similarity is greater than the third threshold, the first reply statement is retained.

[0028] Optionally, generating a third reply statement having different keywords from the first reply statement includes:

[0029] If multiple answer statements to be selected that have different keywords from the first answer statement are obtained, the semantic similarities between the multiple answer statements to be selected and the first answer statement are calculated respectively;

[0030] Determine the to-be-selected reply statement corresponding to the maximum semantic similarity as the third reply statement.

[0031] In a second aspect, an embodiment of the present invention provides a human-computer interaction device, the device comprising:

[0032] A first generating module, configured to generate a first reply statement in response to a first interaction request of a user;

[0033] A judgment module, used to judge whether the similarity between the first reply statement and the second reply statement is greater than a first threshold; wherein the second reply statement is any reply statement generated before the first reply statement;

[0034] The second generating module is used to generate a third reply statement having different keywords from the first reply statement if the judgment result is greater than the first threshold.

[0035] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the human-computer interaction method according to the first aspect.

[0036] In a fourth aspect, an embodiment of the present invention further provides a computer-readable medium on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the human-computer interaction method according to the first aspect.

[0037] In an embodiment of the present invention, in response to a first interactive request from a user, a first reply statement is generated; it is determined whether the similarity between the first reply statement and the second reply statement is greater than a first threshold; wherein the second reply statement is any reply statement that has been generated before the first reply statement; if the determination result is greater than the first threshold, a third reply statement having different keywords from the first reply statement is generated. Through the above scheme, when it is found that the generated first reply statement that meets the first interactive request is repeated with the previously generated second reply statement, a third reply statement is regenerated to avoid including keywords that have appeared in the first reply statement. Since the regenerated third reply statement is different from other reply statements in the history, the accuracy and high quality requirements of interactive reply generation are met. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 A schematic diagram of a flow chart of a human-computer interaction method provided in an embodiment of the present application;

[0040] Figure 2 A flowchart for avoiding duplicate replies is provided as an example for an embodiment of the present application;

[0041] Figure 3 A schematic diagram of the structure of a human-computer interaction device provided in an embodiment of the present application;

[0042] Figure 4 For Figure 3 A schematic diagram of the structure of an electronic device corresponding to the human-computer interaction device provided in the embodiment. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0044] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.

[0045] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0046] Basic concepts:

[0047] Large Language Model (LLM): A language model is a model based on machine learning and artificial intelligence technology that is used to understand and generate natural language text. LLM refers to a large-scale language model, usually built with a deep neural network. These models are trained on large-scale text data to learn rich language knowledge and patterns, and can be used to perform a variety of natural language processing tasks, such as text generation, machine translation, dialogue systems, etc.

[0048] Multi-round human-robot dialogue: refers to a multi-round dialogue between a human and a robot. Usually, there are contextual relationships between the multiple rounds.

[0049] Token: The basic dictionary unit in the training process of a large language model, usually a character or a common word.

[0050] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0051] In scenarios where users interact with machines, users may have multiple rounds of Q&A interactions with robots as needed. However, due to the limitations of large language model training or the limitations of prompt words, large language models are likely to provide repeated response sentences. This will give users a bad interaction experience or cause them to distrust the Q&A robot.

[0052] However, in the prior art, by adjusting the top-P sampling probability, in principle, the cumulative sampling probability of the current token distribution is increased, thereby making the generated replies more diverse. But in fact, it is not possible to completely avoid the generation of repeated replies, and the top-P value is not easy to control. Too large an adjustment will definitely lead to a decrease in the generated quality. Therefore, a human-computer interaction solution that can generate high-quality and non-repetitive reply statements is needed.

[0053] To facilitate understanding, specific embodiments will be used as examples below.

[0054] like Figure 1 A flow chart of a human-computer interaction method provided in an embodiment of the present application. Figure 1 As you can see, the specific steps include the following:

[0055] Step 101: In response to a first interaction request from a user, generate a first reply statement.

[0056] Step 102: Determine whether the similarity between the first reply statement and the second reply statement is greater than a first threshold; wherein the second reply statement is any reply statement generated before the first reply statement.

[0057] Step 103: If the judgment result is greater than the first threshold, a third reply statement having different keywords from the first reply statement is generated.

[0058] In actual applications, users can have multiple rounds of conversations with a machine that can provide artificial intelligence questions and answers (which can be various forms of robotic devices, such as mobile phones, computers, robots, etc.). The first interaction request sent by the user to the machine can be in voice form, text form, sign language, gestures, etc. The machine parses the received first interaction request and generates a corresponding first reply statement using a large language model (LLM). It should be noted that the first reply statement can be in text form, voice form, etc. The specific form needs to be determined according to the user's choice. Generally speaking, the same form as the first interaction request will be adopted. For example, if the first interaction request is in voice form, the corresponding first reply statement is also in voice form.

[0059] A round of dialogue can be multiple questions and answers. For example, 20 questions and answers can be limited to one round. Of course, it can also be divided according to the topic of the question and answer, and the questions and answers on the same topic are one round. In a round of question and answer, the context is related.

[0060] When judging the similarity between the first answer and the second answer, it is necessary to make a selective judgment based on the actual situation. If the first answer is the answer generated by the first question and answer, it is obvious that there is no second answer that is earlier than the first answer, so there is no need to calculate the similarity. Only when there is a statement that has been answered before the first answer will the similarity be calculated.

[0061] Specifically, the process of calculating the similarity between the first reply statement and the second reply statement is as follows: First, preprocess the two reply statements, including removing punctuation marks, converting to lowercase letters, etc. This can eliminate some irrelevant noise and make the comparison more accurate. Convert the two reply statements into vector representations that can be processed by computers. Common methods include bag-of-words model, TF-IDF, Word2Vec, BERT, etc. These methods can map words or subwords in a sentence into a vector space, retaining certain semantic information. Use a similarity measurement method to calculate the similarity between two vectors. Common similarity measurement methods include cosine similarity, Euclidean distance, edit distance, etc. These methods can evaluate the similarity based on the angle, distance, or difference between vectors.

[0062] For example: Suppose, the user's first interaction request is to ask "Talent is just one thing, what are the three most important things?", and the first reply sentence is "The most important is talent, talent, and talent." Before that, the user asked "What are the three most important things in managing a company?", and the second reply sentence was "The most important is talent, talent, and talent." Word2Vec will be used to represent these two reply sentences and calculate the similarity between them.

[0063] Use the pre-trained Word2Vec model to convert each word into a vector representation. Assume that "most", "important", and "talent"; the vectors corresponding to "most", "important", and "talent" are represented as v1 and v2 respectively.

[0064] Use cosine similarity to calculate the similarity between two sentences. The formula for calculating cosine similarity is:

[0065] similarity=cos(θ)=(v1·v2) / (||v1||*||v2||)

[0066] Here, · represents the inner product of the vector, and ||v|| represents the modulus (length) of the vector.

[0067] Calculate the similarity between "The most important thing is talent, talent, and talent" and "The most important thing is talent, talent, and talent":

[0068] similarity=(v1·v2) / (||v1||*||v2||)

[0069] The similarity result is obtained. Since the two reply sentences are exactly the same, the similarity is 100%.

[0070] In practical applications, the first threshold may be 90%, which can better avoid the occurrence of similar reply statements.

[0071] When the judgment result is greater than the first threshold, it is necessary to regenerate a third reply sentence with different keywords from the first reply sentence. The keywords mentioned here refer to words in the sentence other than personal pronouns, modal particles, function words, etc. that do not have actual meanings. Keywords are used to represent the actual semantics of the reply sentence.

[0072] For example, based on the first reply statement "The most important thing is talent, talent, and talent", the third reply statement containing different keywords can be "find managers, use managers to manage technical personnel, and specify reasonable company management rules." It can be seen that the first reply statement and the third reply statement have different keywords, and the third reply statement is also different from the second reply statement. It should be noted that the first reply statement and the third reply statement mentioned here have different keywords, which can be completely different keywords or partially different keywords. The specific selection can be determined according to needs.

[0073] Through the above scheme, the first reply statement obtained without any constraints and restrictions often meets the actual reply content to be obtained for the first interactive request. If intervention is made in advance in the token probability calculation stage, the obtained result may be inaccurate and the quality of the reply statement may be poor. Therefore, when the calculated similarity is not greater than the first threshold, the first reply statement is retained first. When the calculated similarity is greater than the first threshold, the third reply statement with different keywords is generated by removing keywords from the previously obtained answer (the alternative word list containing keywords) or downgrading the keywords. This can avoid duplicate answers.

[0074] In one or more embodiments of the present application, generating a first reply statement in response to a first interaction request from a user includes: determining a list of alternative words for generating the first reply statement in response to the first interaction request from the user; and generating the first reply statement that highly matches the first interaction request based on the probabilities corresponding to the alternative words in the list of alternative words.

[0075] In actual applications, after the first interaction request is input into the large language model, an alternative word list is generated, and then the corresponding words are selected according to the probability of each alternative word to generate the first reply sentence. When the first reply sentence is generated, it is generated without any intervention, and it can be considered that this reply sentence is the most accurate reply that the current large language model can provide. The words contained in the obtained alternative word list are also the most accurate words that the current large language model can provide. If it is necessary to generate a third reply sentence to replace the first reply sentence in the future, since it is based on the same alternative word list, the third reply sentence obtained is also a relatively accurate and high-quality reply sentence.

[0076] In one or more embodiments of the present application, if the judgment result is greater than the first threshold, a third reply statement having different keywords from the first reply statement is generated, including: if the judgment result is greater than the first threshold, the first reply statement is converted into a first word sequence; after removing stop words in the first word sequence, a second word sequence containing the first keyword is generated; based on the first interaction request and the second word sequence, the third reply statement that does not contain the first keyword is regenerated.

[0077] It should be noted that the stop words mentioned here refer to commonly used personal pronouns, modal particles, function words, etc. These words often have no actual meaning, or will not change the semantics, or have a high probability of repetition. Therefore, these stop words cannot be used as keywords. In order to avoid affecting the generation of the third reply sentence, the stop words in the first word sequence corresponding to the first reply sentence need to be removed. At the same time, it means that these stop words are allowed to appear in the third reply sentence.

[0078] After removing the stop words in the first word sequence, a second word sequence is obtained. It can be considered that the words included in the second word sequence are all keywords.

[0079] After providing the first interaction request to the large language model, a candidate word list provided by the last layer of the large language model is obtained, and the candidate word list is processed by the second word sequence to generate a third reply sentence, and the third reply sentence does not contain some or all of the keywords that appeared in the first reply sentence. The third reply sentence obtained in the above manner will not be repeated with the historical reply sentence, so that the user can obtain a better interactive experience.

[0080] As an optional solution, when calculating the similarity between the first reply statement and the second reply statement, if the similarity is greater than the first threshold, it is necessary to further determine which keywords in the first reply statement are the same as those in the second reply statement. For keywords that exist in the first reply statement but not in the second reply statement, the third reply statement can be allowed to appear and be used. Keywords that appear in both the first reply statement and the second reply statement are not allowed to appear in the third reply statement. Since the similarity between the first reply statement and the second reply statement is relatively high, even if a small number of words that exist in the second reply statement but not in the first reply statement appear in the third reply statement, it will not cause the similarity between the third reply statement and the second reply statement to exceed the first threshold.

[0081] In one or more embodiments of the present application, the regenerating the third reply statement that does not contain the first keyword includes: downgrading the first keyword in the alternative word list based on the second word sequence; using the downgraded alternative word list to generate the third reply statement containing the second keyword; wherein the first keyword is different from the second keyword.

[0082] In the candidate word list, each word token has a corresponding probability value. The first keyword appearing in the candidate word list is downgraded. The downgrading here can be to adjust the probability to only one-fifth or one-tenth of the original probability. Of course, the probability can also be directly adjusted to zero to directly eliminate the keyword.

[0083] The third reply sentence is obtained by selecting the second keyword combination from the candidate word list after the weight reduction process. Generally speaking, the second keyword in the third reply sentence is different from the first keyword in the first reply sentence. Of course, it is also possible that some words contained in the third reply sentence also exist in the first reply sentence. By using the same large language model and candidate word list for weight reduction processing, the third reply sentence obtained will not significantly reduce the quality of the reply (that is, the accuracy of the reply) and avoid the problem of repeated answers.

[0084] In one or more embodiments of the present application, the regenerating the third reply statement that does not include the first keyword includes:

[0085] If the similarity between the first interaction request and the second interaction request corresponding to the second reply statement is less than a second threshold, searching for an explanation statement or a synonym of the first keyword;

[0086] Based on the explanation sentence and / or the synonym, the third reply sentence not including the first keyword is generated.

[0087] In addition to using the method of downgrading, you can also use synonyms or equivalent sentence replacement methods. For example, you can replace the word "good" in the first reply sentence with synonyms such as "good" and "excellent". For example, you can replace "basic data summary" in the first reply sentence with "basic data includes XX data and XX data, and these data are summed up." The third reply sentence obtained by the above processing method will not contain the same keywords as in the first reply sentence. It can meet the requirement of non-repetitive reply sentences.

[0088] In one or more embodiments of the present application, the regenerating the third reply statement that does not include the first keyword includes:

[0089] Processing the second word sequence by word segmentation, and using the first keyword obtained after the word segmentation as a prompt word;

[0090] Based on the received prompt word, a sentence for explaining the first keyword is generated as the third reply sentence.

[0091] Since the words included in the second word sequence are keywords, these words are not allowed to appear in the third reply sentence. Therefore, the second word sequence is further interpreted using the large language model. Specifically, each first keyword in the second word sequence can be input as a prompt word into the large language model, and the large language model can interpret the meaning of the prompt word, and then the third reply sentence is obtained by combining the interpretations. The second word sequence can also be organized into a prompt sentence or question, and input into the large language model, so that the large language model can interpret this sentence, and the interpretation result is used as the third reply sentence.

[0092] In practical applications, the method of using the keywords of the previous reply sentence as prompt words and inputting them into the large language model can be executed multiple times in a loop so as to obtain a third reply sentence that meets the reply requirements.

[0093] Through the above method, the problem of repeated responses can be avoided and the accuracy of the third response statement can be ensured.

[0094] In one or more embodiments of the present application, it also includes: if the similarity between the second reply statement and the first reply statement is greater than a second threshold, then determining the similarity between the first interaction request and the second interaction request corresponding to the second reply statement; if the determination result is that the similarity is greater than a third threshold, then retaining the first reply statement.

[0095] In actual applications, users sometimes ask repeated questions. In this case, the answer statements can be the same. Specifically,

[0096] If the similarity between the first reply statement and the second reply statement obtained previously is greater than the second threshold, where the second threshold is greater than the first threshold, then it can be considered that the similarity between the two reply statements is very high. Therefore, the similarity between the first interaction request and the second interaction request is further calculated. If the similarity between the first interaction request and the second interaction request exceeds the third threshold, it can be considered that the questions asked twice are also the same, and the answers obtained can be allowed to be the same. Even if the first reply statement and the second reply statement are completely or partially repeated, there is no need to modify the first reply statement, so as to avoid different answers or contradictory answers to the same question. Through the above scheme, it is possible to provide reply statements in a reasonable manner according to actual conditions, so that users can obtain a more realistic interactive experience.

[0097] In one or more embodiments of the present application, a third reply statement having different keywords from the first reply statement is generated, including: if multiple reply statements to be selected having different keywords from the first reply statement are obtained, then the semantic similarities between the multiple reply statements to be selected and the first reply statement are calculated respectively; and the reply statement to be selected corresponding to the maximum semantic similarity is determined as the third reply statement.

[0098] In practical applications, in order to ensure the quality of the regenerated third reply statement and make the third reply statement as consistent as possible with the first interaction request, multiple reply statements to be selected can be generated when generating the third reply statement. Then, the similarity between the multiple reply statements to be selected and the first reply statement is calculated. The reply statement to be selected with the greatest semantic similarity is selected as the third reply statement. The third reply statement obtained in this way can not only avoid repeated keywords, but also improve the quality of the third reply statement.

[0099] For ease of understanding, the following will illustrate a solution for avoiding repeated reply statements through specific embodiments. Figure 2 The following is a flow chart of avoiding duplicate replies for the present application embodiment. Assume that the user is User and the robot is Bot. The following is a round of dialogue:

[0100] ①User: You are so young, and you have become the vice president of the company?

[0101] ②Bot: Age is not a problem. The key is to be able to identify the trend and seize the opportunity.

[0102] ③User: Really? Then let me ask you, what are the three most important things in managing a company?

[0103] ④Bot: The most important thing is talent, talent, and talent.

[0104] ⑤User: No, talent is just one thing. What are the three most important things?

[0105] ⑥Bot: The most important thing is talent, talent, and talent.

[0106] It can be seen that the contents of replies ④ and ⑥ are repeated, and the result of reply ⑥ is obviously not what the User wants.

[0107] The solutions to solve the above problems are as follows:

[0108] Step 1. Calculate the sentence vector of each Bot reply in the input above.

[0109] Extract the Bot reply part from the above conversation of the sentence passed into the large speech model LLM, and then calculate the sentence vector of each reply sentence through the dual tower model (usually BERT dual tower). In order to calculate the similarity between the sentence vectors later, it is judged whether the sentence vector of the reply sentence generated later is semantically repeated with the sentence vector of a reply sentence generated earlier. The reason why it is necessary to judge repetition by semantics is due to the diversity of language expression. There may be cases where the semantics are exactly the same, but the text is different (for example, "bye-bye" and "goodbye" both mean goodbye, but the text is completely different). Through mature semantic vector technology, the similarity between the two can be judged, so it is not possible to simply use text comparison to judge whether there is repetition.

[0110] In this step, the sentence vectors of each bot reply sentence in the above text are calculated, namely bot_vec_1, bot_vec_2..., bot_vec_n.

[0111] Step 2. Use the matching model to determine whether the latest LLM reply sentence has the same semantics as a reply in the previous text.

[0112] After LLM generates the first reply sentence, the sentence vector of the current first reply sentence is calculated through the twin tower model used in the first step, marked as bot_vec_reply. Then the similarity between the sentence vector bot_vec_replay of the generated first reply sentence and each sentence vector of bot_vec_1, bot_vec_2, ... bot_vec_n in the above text is calculated, similar_1, similar_2, ... similar_n. If there is a similarity result similar_x that is greater than the configured first threshold, usually the first threshold is configured to 0.9 (the similarity value range is 0-1, the smaller the value, the less similar, and 1 means exactly the same), it is considered that the generated first reply sentence has semantic duplication with a sentence x in the above text.

[0113] Step 3. When there are duplications, remove keywords from the generated replies.

[0114] 3.1 If there is duplication in step 2, remove keywords from the generated reply, which can be achieved by using the built-in function of the language model. Usually, a sentence is converted into a dictionary list used in the training of the big model. For example, "I went home" is usually converted into a list of three tokens, [I, went home, ], and this token list is recorded as token_list1 (that is, the first word sequence).

[0115] 3.2 After removing the stop words from the token list obtained in 3.1, retain the list of key tokens. Stop words are usually common personal pronouns, modal particles, function words, etc. For example, "I" and "le" in the above text usually belong to stop words. Therefore, after removing the stop words from the token list in step 3.1, the remaining token list is [go home], and this list is denoted as token_list2 (i.e., the second token sequence).

[0116] Step 4. Downweight the list of keyword token_list2, and then let the LLM regenerate the third reply statement based on the probabilities of the tokens after downweighting.

[0117] Downweight the token list token_list2 in step 3. This step is a crucial step. Specifically, under normal circumstances, when the LLM performs inference, each token is generated by sampling according to the probability of each token in the dictionary given by the last layer of the LLM. When this step is executed, during the LLM inference, the probability of each token in token_list2 will be automatically set to 0. Therefore, at this time, the LLM will perform probability sampling from the dictionary vocabulary outside the token_list2 list, thus avoiding the generated reply containing the key tokens in token_list2, that is, avoiding generating a sentence that repeats a certain sentence in the above text.

[0118] This is a problem that often occurs in multi-turn conversations. The situation usually occurs because the user continuously challenges the security of the LLM, or delves deeper into a certain topic, resulting in the LLM having fewer and fewer available responses. The LLM tends to use a sentence that already exists in the above text for reply. At this time, it will give the user a very bad experience. The solution provided by the technical solution of this application can systematically solve this problem, optimize the dialogue effect, and improve the user experience.

[0119] Based on the same idea, the embodiments of this application also provide a human-computer interaction device. As Figure 3 is a schematic structural diagram of a human-computer interaction device provided by an embodiment of this application. As can be seen from Figure 3 it, the device includes:

[0120] A first generation module 31, configured to generate a first reply statement in response to a first interaction request from a user.

[0121] A judgment module 32, configured to judge whether the similarity between the first reply statement and a second reply statement is greater than a first threshold; wherein, the second reply statement is any reply statement generated before the first reply statement.

[0122] The second generating module 33 is configured to generate a third reply statement having different keywords from the first reply statement if the judgment result is greater than the first threshold.

[0123] A first generating module 31, configured to determine, in response to a first interactive request from a user, a candidate word list for generating the first reply sentence;

[0124] The first reply statement that is highly matched with the first interaction request is generated according to the probabilities corresponding to the candidate words in the candidate word list.

[0125] A second generating module 33, configured to convert the first reply sentence into a first word sequence if the judgment result is greater than the first threshold;

[0126] After removing the stop words in the first word sequence, a second word sequence including the first keyword is generated;

[0127] Based on the first interaction request and the second word sequence, the third reply statement that does not include the first keyword is regenerated.

[0128] A second generating module 33, configured to perform a weight reduction process on the first keyword in the candidate word list based on the second word sequence;

[0129] The third reply sentence including the second keyword is generated by using the candidate word list after the downgrading process; wherein the first keyword is different from the second keyword.

[0130] A second generating module 33, configured to search for an explanation statement or a synonym of the first keyword if the similarity between the first interaction request and the second interaction request corresponding to the second reply statement is less than a second threshold;

[0131] Based on the explanation sentence and / or the synonym, the third reply sentence not including the first keyword is generated.

[0132] A second generating module 33 is used to process the second word sequence into segments, and use the first keyword obtained after the segmentation process as a prompt word;

[0133] Based on the received prompt word, a sentence for explaining the first keyword is generated as the third reply sentence.

[0134] The judgment module 32 is further configured to judge the similarity between the first interaction request and the second interaction request corresponding to the second response statement if the similarity between the second response statement and the first response statement is greater than a second threshold;

[0135] If the judgment result is that the similarity is greater than the third threshold, the first reply statement is retained.

[0136] The second generating module 33 is further used to calculate the semantic similarity between the plurality of to-be-selected reply statements and the first reply statement respectively if a plurality of to-be-selected reply statements having different keywords from the first reply statement are obtained;

[0137] Determine the to-be-selected reply statement corresponding to the maximum semantic similarity as the third reply statement.

[0138] Based on the above embodiment, in response to the user's first interactive request, a first reply statement is generated; it is determined whether the similarity between the first reply statement and the second reply statement is greater than a first threshold; wherein the second reply statement is any reply statement that has been generated before the first reply statement; if the judgment result is greater than the first threshold, a third reply statement having different keywords from the first reply statement is generated. Through the above scheme, when a first reply statement that meets the first interactive request is generated, if it is found that the first reply statement is repeated with the second reply statement generated previously, a third reply statement needs to be regenerated. When generating the third reply statement, avoid including keywords that have appeared in the first reply statement. Thereby, the regenerated third reply statement is different from other reply statements in the history. At the same time, since the third reply statement is obtained with reference to the semantics of the first reply statement, it meets the accuracy and high quality requirements of the reply.

[0139] In one possible design, the above Figure 3 The structure of the human-computer interaction device shown can be implemented as an electronic device. Figure 4 As shown, the electronic device may include: a processor 41 and a memory 42. The memory 42 stores executable code, and when the executable code is executed by the processor 41, the processor 41 can at least implement the visual effect enhancement method provided in the above embodiment. The structure of the electronic device may also include a communication interface 43 for communicating with other devices or communication networks.

[0140] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor in a server or a computer, the processor executes the operations provided in the above embodiments. Figure 1 Corresponding human-computer interaction method.

[0141] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.

[0142] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution can essentially or contribute to the part in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A human-computer interaction method, characterized in that: The method comprises: In response to a first interactive request from a user, generating a first reply statement; Determine whether the similarity between the first reply statement and the second reply statement is greater than a first threshold; wherein the second reply statement is any reply statement generated before the first reply statement; If the judgment result is greater than the first threshold, a third reply sentence having different keywords from the first reply sentence is generated.

2. The method according to claim 1, characterized in that: The step of generating a first reply statement in response to the first interaction request of the user includes: In response to a first interactive request from a user, determining a candidate word list for generating the first reply statement; The first reply statement that is highly matched with the first interaction request is generated according to the probabilities corresponding to the candidate words in the candidate word list.

3. The method according to claim 1, characterized in that If the judgment result is greater than the first threshold, generating a third reply statement having different keywords from the first reply statement, including: If the judgment result is greater than the first threshold, converting the first reply sentence into a first word sequence; After removing the stop words in the first word sequence, a second word sequence including the first keyword is generated; Based on the first interaction request and the second word sequence, the third reply statement that does not include the first keyword is regenerated.

4. The method according to claim 3, characterized in that The regenerating the third reply statement that does not contain the first keyword includes: De-ranking the first keyword in the candidate word list based on the second word sequence; The third reply sentence including the second keyword is generated by using the candidate word list after the downgrading process; wherein the first keyword is different from the second keyword.

5. The method according to claim 3, characterized in that: The regenerating the third reply statement that does not contain the first keyword includes: If the similarity between the first interaction request and the second interaction request corresponding to the second reply statement is less than a second threshold, searching for an explanation statement or a synonym of the first keyword; Based on the explanation sentence and / or the synonym, the third reply sentence not including the first keyword is generated.

6. The method according to claim 3, characterized in that The regenerating the third reply statement that does not contain the first keyword includes: Processing the second word sequence by word segmentation, and using the first keyword obtained after the word segmentation as a prompt word; Based on the received prompt word, a sentence for explaining the first keyword is generated as the third reply sentence.

7. The method according to claim 1, characterized in that Also includes: If the similarity between the second reply statement and the first reply statement is greater than a second threshold, determining the similarity between the first interaction request and the second interaction request corresponding to the second reply statement; If the judgment result is that the similarity is greater than the third threshold, the first reply statement is retained.

8. The method according to claim 1, characterized in that: Generating a third reply statement having different keywords from the first reply statement, comprising: If multiple answer statements to be selected that have different keywords from the first answer statement are obtained, the semantic similarities between the multiple answer statements to be selected and the first answer statement are calculated respectively; Determine the to-be-selected reply statement corresponding to the maximum semantic similarity as the third reply statement.

9. A human-computer interaction device, characterized in that: The device comprises: A first generating module, configured to generate a first reply statement in response to a first interaction request of a user; A judgment module, used to judge whether the similarity between the first reply statement and the second reply statement is greater than a first threshold; wherein the second reply statement is any reply statement generated before the first reply statement; The second generating module is used to generate a third reply statement having different keywords from the first reply statement if the judgment result is greater than the first threshold.

10. An electronic device comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the method according to any one of claims 1 to 8.

11. A computer-readable medium having stored thereon at least one instruction, at least one program, code set or instruction set, wherein the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the method according to any one of claims 1 to 8.

Citation Information

Cited By

  • System and method for generating thoughts with large language models using codewords

    US12541488B2

  • System and method for generating thoughts with large language models using codewords

    US12724752B2

  • System and Method for Generating Thoughts with Large Language Models Using Codewords

    US20250363078A1

  • System and Method for Generating Thoughts with Large Language Models Using Codewords

    US20260079897A1