Human-computer dialogue method, server, storage medium and program product

By introducing a search decision model into the large language model and combining historical queries to determine whether retrieval enhancement is needed, the problem of wasted computing resources in multi-turn dialogue scenarios is solved, achieving more efficient response accuracy and resource utilization.

WO2026056764A1PCT designated stage Publication Date: 2026-03-19ALIBABA (CHINA) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-09-05
Publication Date
2026-03-19

AI Technical Summary

Technical Problem

Existing large language models suffer from wasted computational resources in multi-turn dialogue scenarios due to unnecessary retrieval enhancements.

Method used

By combining the results of the current query with the historical queries from previous rounds as the query context, a search judgment model is used to determine whether retrieval enhancement is needed, and retrieval enhancement is performed when necessary to generate response information.

Benefits of technology

It reduces the "content illusion" phenomenon, improves response accuracy, reduces unnecessary search enhancement, and reduces the waste of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025119255_19032026_PF_FP_ABST
    Figure CN2025119255_19032026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present disclosure are a human-computer dialogue method, a server, a storage medium and a program product. The method in the present disclosure comprises: acquiring an input query from a current turn, and using, as a query context, a concatenating result of the query from the current turn and historical queries from previous turns; inputting the query context into a search determination model for search determination, and determining whether the query from the current turn requires retrieval augmentation; when a search determination result indicates that the query from the current turn requires retrieval augmentation, performing retrieval augmentation on the basis of the query from the current turn, so as to obtain a retrieval augmentation result; and on the basis of the retrieval augmentation result, generating response information for the query from the current turn. By means of introducing a search determination model, whether a current turn requires retrieval augmentation is accurately determined on the basis of historical queries from the previous turns and a query from the current turn, and as such, retrieval augmentation is performed only when retrieval augmentation is required. Therefore, not only can the phenomenon of "content hallucination" be reduced, thereby improving the response accuracy, but unnecessary retrieval augmentation is also reduced, thereby reducing the waste of computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Human-computer dialogue method, server, storage medium and program product

[0001] The present disclosure claims priority to Chinese Patent Application No. 202411281318.1, filed on September 12, 2024 with the Chinese Patent Office, entitled "Human-computer dialogue method, server, storage medium and program product", the entire contents of which are incorporated herein by reference. TECHNICAL FIELD

[0002] The present disclosure relates to the technical field of computers, and particularly relates to a human-computer dialogue method, a server, a storage medium and a program product. BACKGROUND

[0003] With the rapid development of natural language processing (NLP) technology, large language models (LLM) have shown superior performance in text generation, automatic summarization, machine translation and question answering systems, etc. applications. Large language models have become the core of various intelligent applications due to their powerful language understanding and generation capabilities. However, when answering real-time queries, current large language models often rely on outdated or inaccurate training information, resulting in "content hallucination" problems, i.e. the generated answers are grammatically correct but the actual content is incorrect or misleading.

[0004] Retrieval-augmented Generation (RAG) based methods search external knowledge based on current queries in real time to supplement and enhance the response capability of the model, in order to solve the "content hallucination" problem of the model. However, for some simple queries (such as common sense, casual chat, etc.), large language models do not need to obtain external knowledge to generate accurate answers, and unnecessary retrieval enhancement will result in waste of computing resources. Especially in multi-turn dialogue scenarios, repeated multi-turn unnecessary retrieval enhancement will seriously waste computing resources. SUMMARY

[0005] The present disclosure provides a human-computer dialogue method, a server, a storage medium and a program product to solve the problem of waste of computing resources caused by unnecessary retrieval enhancement in current RAG solutions.

[0006] In a first aspect, the present disclosure provides a human-computer dialogue method, comprising:

[0007] obtaining an input current query;

[0008] concatenating the current query with historical queries of previous turns as a query context;

[0009] input the query context into a search decision model to perform search decision, to determine whether the current query needs retrieval enhancement, and obtain a search decision result;

[0010] in a case where the search decision result indicates that the current query needs retrieval enhancement, performing retrieval enhancement according to the current query, and obtaining a retrieval enhancement result;

[0011] generating response information of the current query according to the retrieval enhancement result.

[0012] In a second aspect, the present disclosure provides a human-computer dialogue method, comprising:

[0013] in response to a calling request of a search decision model, obtaining a current query and historical queries of previous rounds;

[0014] concatenating the historical queries of the previous rounds and the current query to obtain a query context;

[0015] inputting the query context into a search decision model to perform search decision, and obtaining a search decision result, the search decision result indicating whether the current query needs retrieval enhancement;

[0016] returning the search decision result.

[0017] In a third aspect, the present disclosure provides a server, comprising at least one processor, and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the server to perform the method provided in any one of the preceding aspects.

[0018] In a fourth aspect, the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method provided in any one of the preceding aspects is implemented.

[0019] In a fifth aspect, the present disclosure provides a computer program product, comprising a computer program, and when a processor executes the computer program, the method provided in any one of the preceding aspects is implemented.

[0020] The human-computer conversation method, server, storage medium and program product provided by the present disclosure, the method obtains the current query, takes the splicing result of the current query and the historical query of each previous round as the query context; inputs the query context into a search determination model to determine whether the current query needs to be retrieved and enhanced, and obtains a search determination result; in the case that the search determination result is that the current query needs to be retrieved and enhanced, retrieves and enhances the current query to obtain a retrieval and enhancement result, and generates response information of the current query according to the retrieval and enhancement result; by introducing the search determination model, whether the current round needs to be retrieved and enhanced is accurately determined based on the historical query of each round and the current query, and retrieval and enhancement is only performed in the case that retrieval and enhancement is needed, which not only can reduce the phenomenon of “content illusion” and improve the response accuracy, but also reduces unnecessary retrieval and enhancement and waste of computing resources. BRIEF DESCRIPTION OF DRAWINGS

[0021] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, further serve to explain the principles of the present disclosure.

[0022] FIG. 1 is a schematic diagram of an example system architecture to which the present disclosure is applicable;

[0023] FIG. 2 is a flowchart of a human-computer conversation method provided by an example embodiment of the present disclosure;

[0024] FIG. 3 is a flowchart of a method for training a search determination model provided by an example embodiment of the present disclosure;

[0025] FIG. 4 is a flowchart of constructing training data provided by an example embodiment of the present disclosure;

[0026] FIG. 5 is an architecture diagram of retrieval and enhancement based on search determination provided by an example embodiment of the present disclosure;

[0027] FIG. 6 is a human-computer conversation method provided by another example embodiment of the present disclosure;

[0028] FIG. 7 is an interaction flowchart of a multi-round conversation provided by another example embodiment of the present disclosure;

[0029] FIG. 8 is a structural schematic diagram of a server provided by an embodiment of the present disclosure.

[0030] Through the above-described drawings, the explicit embodiments of the present disclosure have been shown, and more detailed descriptions will be given hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present disclosure by any means, but to illustrate the concept of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0031] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, the same numbers refer to the same or similar elements throughout the drawings. The implementations described in the following exemplary embodiments are not meant to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0032] It should be noted that the user information (including but not limited to user device information, user attribute information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present disclosure are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards, and provide corresponding operation portal for user to choose authorization or refusal.

[0033] First, the terms involved in the present disclosure are explained:

[0034] Large language model: an artificial intelligence system trained on large-scale text data and deep learning techniques, good at generating natural language text.

[0035] Content hallucination: refers to the output of inaccurate or fictional information by the model when generating content.

[0036] Question and answer system: a system that automatically answers questions raised by users.

[0037] Search determination: determining whether retrieval enhancement is needed based on user query.

[0038] Retrieval enhancement: supplement and improve the answering ability of the model by retrieving external resources.

[0039] Loss function: measures the difference between the model's prediction and the true value.

[0040] Fine-tuning: further training on a pre-trained model using data from a specific domain or task to improve the model's performance in that specific application area.

[0041] Open-domain search: usually refers to the technology or system in the field of natural language processing (NLP) that can retrieve and answer various types of questions from large and diverse knowledge corpus. This search is not limited to a specific field or database, but can span multiple fields and topics, providing extensive knowledge and information.

[0042] BERT (Bidirectional Encoder Representations from Transformers): a deep bidirectional language representation model based on the Transformer architecture.

[0043] GTE (Generic Text Embedding) model: a general text embedding model. The GTE model is built based on the BERT framework and fully utilizes the powerful capabilities of BERT in natural language processing.

[0044] Token: also known as discrete token or discrete token, refers to the discrete representation of speech or text. In order to distinguish the discrete representation of text and speech, the discrete representation of speech is called speech token, and the discrete representation of text is called text token. The vocabulary used by the model contains speech tokens and text tokens that may appear in the prediction results. Each speech token in the vocabulary corresponds to a speech unit, such as a phoneme, a syllable, a speech segment, etc. Each text token in the vocabulary corresponds to a text unit, such as a word, a word, etc.

[0045] Multi-modal task: refers to a downstream task involving image and text and other multi-modal data in input and output data, such as visual question answering task, image description task, visual implication task, pointing representation and understanding task, image generation task, etc.

[0046] Multi-modal pre-training model: refers to a pre-training model whose input and output data involve image and text and other multi-modal data. After fine-tuning, it can be applied to multi-modal task processing.

[0047] Pre-training language model: a pre-training model obtained by pre-training a large-scale language model.

[0048] Large model refers to a deep learning model with large-scale model parameters, usually containing hundreds of millions, billions, or even tens of billions of model parameters. Large model can also be called foundation model (Foundation Model, FM). Through large-scale unlabeled corpus pre-training, a pre-training model with hundreds of millions of parameters is produced. This model can adapt to a wide range of downstream tasks and has good generalization ability. For example, large-scale language model, multi-modal pre-training model (Multi-modal Pre-training Model), etc.

[0049] In practical applications, a large model can be applied to different tasks by fine-tuning a pre-trained model with a small amount of samples. The large model can be widely applied in natural language processing and computer vision, and can be applied to computer vision tasks such as visual question answering (VQA), image captioning (IC), image generation, and natural language processing tasks such as text-based sentiment classification, text summarization generation, and machine translation. The main application scenarios of the large model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, and the like.

[0050] In view of the problem that in a multi-turn dialogue scene based on the RAG method, unnecessary retrieval enhancement leads to serious waste of computing resources, the present disclosure provides a human-computer dialogue method. The method obtains a current query, splices the current query and historical queries of previous turns as a query context; inputs the query context into a search determination model to determine whether the current query needs retrieval enhancement, and obtains a search determination result; in the case that the search determination result is that the current query needs retrieval enhancement, performs retrieval enhancement according to the current query, and generates response information of the current query according to a retrieval enhancement result. By introducing a search determination model, based on the historical queries of each turn and the current query, it is accurately determined whether the current turn needs retrieval enhancement, and retrieval enhancement is performed in the case that retrieval enhancement is needed. This not only can reduce the phenomenon of "content hallucination" and improve response accuracy, but also reduces unnecessary retrieval enhancement and reduces waste of computing resources.

[0051] The search determination model is a classification model trained using training data. The encoder of the classification model can use a machine learning model with a small parameter size, such as a BERT model, a GTE model, or other pre-trained models. An initial classification model can be obtained by adding a classifier, such as a linear classifier or a multi-layer perceptron, to the encoder. The search determination model can be obtained by training the initial classification model using training data.

[0052] FIG. 1 is a schematic diagram of an example system architecture to which the present disclosure is applicable. As shown in FIG. 1, the system architecture includes a server and an end-side device. The server and the end-side device have a communicable communication link therebetween, and can achieve communication connection between the server and the end-side device.

[0053] The end-side device can be an electronic device used for multi-turn dialogue with the dialogue system, and can be specifically a hardware device with network communication function, operation function, and information display function, including but not limited to a smart phone, a tablet computer, a desktop computer, a local server, a cloud server, etc. The downstream application running on the end-side device can be a dialogue / question-answering system, content creation, machine translation, code generation, copywriting (such as product description, chart explanation, text summary, etc.), etc. In the process of running the downstream application, the end-side device generates an input data sequence based on input data in response to a text generation requirement, and provides the input data sequence to the server.

[0054] The server is a device with computing capability deployed in the cloud or locally, such as a cloud cluster, etc. The server runs a human-computer dialogue system / application, and provides human-computer dialogue service externally. The server stores a search determination model and a human-computer interaction model. In the multi-turn dialogue process, the server determines whether retrieval enhancement is needed for the current query based on the current query and the historical queries of previous turns through the search determination model. In the case that the search determination result is that retrieval enhancement is needed for the current query, retrieval enhancement is performed to obtain a retrieval enhancement result. The response information of the current query is generated based on the retrieval enhancement result through the human-computer interaction model. In the case that the search determination result is that retrieval enhancement is not needed for the current query, retrieval enhancement is not performed, and the response information of the current query is directly generated through the human-computer interaction model.

[0055] Further, the server returns the response information of the current query to the end-side device. The end-side device shows the response information of the current query to the user to realize multi-turn human-computer dialogue.

[0056] It should be noted that in actual application, the human-computer interaction model can be deployed alone, and the server deploying the human-computer interaction model is called a dialogue engine. The search determination model can also be deployed alone, and the server deploying the search determination model is called a search determination server. The server where the human-computer dialogue system / application is located is called a human-computer dialogue server. In an example scenario, the search determination model and the human-computer dialogue system / application are deployed on the same server, and the human-computer interaction model is deployed on another server alone. In another example scenario, the human-computer dialogue system / application, the human-computer interaction model, and the search determination model are deployed on three different servers respectively.

[0057] The technical solutions of the present disclosure and how the technical solutions of the present disclosure solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in detail in some embodiments. The embodiments of the present disclosure will be described below with reference to the drawings.

[0058] FIG. 2 is a flowchart of a method of human-computer conversation provided by an example embodiment of the present disclosure. As shown in FIG. 2, the method includes the following specific steps:

[0059] In step S201, the current query is obtained, and a splicing result of the current query and historical queries in previous rounds is taken as a query context.

[0060] The present embodiment is applied to a multi-round conversation scenario. For a query (referred to as a current query) input by a user in a current round, a search determination model is introduced, and search determination is performed based on the current query and historical queries in previous rounds to determine whether retrieval enhancement is needed for the current query.

[0061] For any query in a multi-round conversation process, if there is at least one historical query before the current round, in this step, a splicing result of the current query and historical queries in previous rounds is taken as a query context. The query context contains context relationships of queries in the multi-round conversation, which can help the model better understand the context relationships between queries and better perform search determination, so as to accurately determine whether retrieval enhancement is needed for the current query.

[0062] For example, when the current query and historical queries in previous rounds are spliced to obtain a query context, the historical queries in previous rounds and the current query can be spliced in chronological order, and a separator is used to connect adjacent queries to obtain the query context. The separator is a special token used to separate adjacent queries, such as “[SEP]”. The specific token used for the separator can be configured and adjusted according to actual application requirements and experience, which is not specifically limited here.

[0063] Optionally, a start token (such as “[CLS]”) can also be spliced at the beginning of the query context, which indicates the starting position of the input query context. The specific token used for the start token can be configured and adjusted according to actual application requirements and experience, which is not specifically limited here.

[0064] For example, for the historical queries “hello” and “weather in A city tomorrow” in the previous two rounds and the current query “B city”, the historical queries and the current query can be spliced into the following query context: “[CLS]hello[SEP]weather in A city tomorrow[SEP]B city”.

[0065] By splicing the historical queries in previous rounds and the current query in chronological order and using a separator to separate adjacent queries, the context relationships between queries can be well preserved, which helps the model better understand the context relationships between queries and more accurately perform search determination. In the present embodiment, queries in the multi-round conversation process are stored.

[0066] It should be noted that if the current query is the first query of the user, there is no historical query of the previous round, and the first query is taken as the query context.

[0067] In step S202, the query context is input into a search determination model to determine whether retrieval enhancement is needed for the current query, and a search determination result is obtained.

[0068] After obtaining the query context, the query context is input into a search determination model to determine whether retrieval enhancement is needed for the current query, and a search determination result is obtained. The search determination result can be that retrieval enhancement is needed for the current query, or that retrieval enhancement is not needed for the current query.

[0069] The search determination model is a classification model trained using training data. The encoder of the classification model can use a machine learning model with a small parameter size, such as a BERT model, a GTE model, or other pre-trained models. By adding a classifier such as a linear classifier or a multi-layer perceptron to the encoder, an initial classification model can be obtained. The initial classification model is trained using training data to obtain the search determination model.

[0070] In the case where the search determination result is that retrieval enhancement is not needed for the current query, the current query is directly input into the human-computer interaction model to generate response information for the current query. Only in the case where retrieval enhancement is needed, retrieval enhancement is performed, which can reduce unnecessary retrieval enhancement, thereby reducing the waste of computing resources and reducing the operating cost of the human-computer dialogue system.

[0071] In the case where the search determination result is that retrieval enhancement is needed for the current query, step S203 is performed to perform retrieval enhancement to search / retrieve knowledge / information matching the current query, and a retrieval enhancement result is obtained.

[0072] In step S203, in the case where the search determination result is that retrieval enhancement is needed for the current query, retrieval enhancement is performed according to the current query, and a retrieval enhancement result is obtained.

[0073] In the case where the search determination result is that retrieval enhancement is needed for the current query, retrieval enhancement is performed according to the current query to search / retrieve knowledge / information matching the current query, and a retrieval enhancement result is obtained.

[0074] Specifically, retrieval enhancement is performed according to the current query to obtain a retrieval enhancement result, including:

[0075] In the pre-constructed knowledge base, knowledge matching the current query is searched; and / or, open domain search is performed according to the current query to obtain knowledge matching the current query.

[0076] According to the current round of query, open domain search is performed to obtain knowledge matched with the current round of query, which can be implemented in the following manner:

[0077] The current round of query is taken as an input parameter to call a search API (Application Programming Interface), so that the platform providing the open domain search service performs open domain search according to the current round of query to obtain knowledge matched with the current round of query. The search API is a server interface provided by the platform providing the open domain search service to the outside.

[0078] In this embodiment, the knowledge base for retrieval augmented generation (RAG) is constructed, and the method for augmented retrieval based on the knowledge base can use any kind of retrieval augmented generation RAG scheme based on the knowledge base, which is not specifically limited herein. In addition, when the retrieval augmentation is performed according to the current round of query to obtain the retrieval augmentation result in this step, any implementation scheme of retrieval augmentation in the existing retrieval augmented generation RAG scheme can also be used, which is not specifically limited herein.

[0079] In step S204, response information of the current round of query is generated according to the retrieval augmentation result.

[0080] After the retrieval augmentation result is obtained, the current round of query and the retrieval augmentation result are input into the human-computer interaction model, and the response information of the current round of query is generated according to the retrieval augmentation result by the human-computer interaction model.

[0081] Further, the server outputs the response information of the current round of query to the user to realize the multi-round dialogue between the user and the human-computer dialogue system / application on the server.

[0082] Exemplarily, the server returns the response information of the current round of query to the end-side device. The end-side device displays the response information of the current round of query to the user to realize the multi-round dialogue between the user and the human-computer.

[0083] The scheme of this embodiment takes the splicing result of the current round of query and the historical queries of each round as the query context in the multi-round dialogue process, inputs the query context into the search determination model to determine whether retrieval augmentation is needed for the current round of query, performs retrieval augmentation according to the current round of query in the case that the search determination result is that retrieval augmentation is needed for the current round of query, and generates the response information of the current round of query according to the retrieval augmentation result. By introducing the search determination model, whether retrieval augmentation is needed for the current round of query is accurately determined based on the historical queries of each round and the current round of query, retrieval augmentation is performed in the case that retrieval augmentation is needed, which not only reduces the phenomenon of "content hallucination" and improves the response accuracy, but also reduces unnecessary retrieval augmentation, reduces the waste of computing resources, and reduces the operation cost of the human-computer dialogue system.

[0084] The search determination model used in the above embodiments is a trained classification model including an encoder and a classifier. The search determination model can be obtained by training an initial classification model using training data. The following embodiments will describe the training process of the search determination model in detail.

[0085] FIG. 3 is a flowchart of a method for training a search determination model according to an example embodiment of the present disclosure. As shown in FIG. 3, the training process of the search determination model is as follows:

[0086] In step S301, training data is obtained, which includes input samples and search determination labels. The input samples include the concatenation result of the current query and the historical queries in the previous rounds. The search determination labels are used to indicate whether the response to the current query needs to be enhanced.

[0087] In this embodiment, in order to train the search determination model, training data including input samples and search determination labels is constructed to obtain a training data set. The input samples include the concatenation result of the current query and the historical queries in the previous rounds. The specific concatenation scheme is consistent with the concatenation scheme for obtaining the query context in the multi-round dialogue process in step S201.

[0088] In this step, a large amount of multi-round dialogue data is first collected. Based on the collected multi-round dialogue data, input samples and search determination labels of the input samples are constructed.

[0089] For example, when collecting multi-round dialogue data, real multi-round dialogue data of a human-computer dialogue system / application can be collected, or real multi-round dialogue data can be obtained from other human-computer dialogue platforms (such as artificial intelligence assistants, etc.).

[0090] In addition, the multi-round dialogue data can also be constructed by a large model. It should be noted that the real multi-round dialogue data often includes multi-round queries and responses. For the multi-round dialogue data constructed by a large model, it can include multi-round queries and responses, or only include multi-round queries without responses to the queries in each round.

[0091] Optionally, the pre-configured dialogue topic (such as weather, etc.), output requirement and dialogue template are input into the large model, and the generation capability of the large model is used to generate dialogue data around the given dialogue topic and in accordance with the output requirement. The output requirement can limit the number of words of the output dialogue data; require the generated dialogue data to maintain diversity and naturalness, and avoid generating too mechanical or repetitive dialogue content, etc. The dialogue template specifies the format of a large amount of dialogue data, such as “[XX] What will the weather be like tomorrow?” and “[XX]” is filled with a regional name. A plurality of different dialogue topics (such as weather, etc.), output requirements and dialogue templates can be pre-configured, and when generating multi-turn dialogue data, a dialogue topic, an output requirement and a dialogue template can be randomly selected to input the large model to generate multi-turn dialogue data, so as to obtain rich and diverse multi-turn dialogue data.

[0092] Optionally, a plurality of first-turn queries are pre-configured, the first-turn query is input into the large model, and the subsequent multi-turn query is generated based on the first-turn query by the large model to obtain multi-turn query data. Optionally, the first-turn query is input into a first large model, and a response to the first-turn query is generated by the first large model. The first-turn query and the response are input into a second large model, and a second-turn query is generated by the second large model; the second-turn query is input into the first large model, and a second-turn response is generated by the first large model. In this way, the large model can be used to generate multi-turn queries and responses.

[0093] For the obtained multi-turn dialogue data, at least one query can be extracted therefrom, the query is taken as a current query, and the current query is spliced with a historical query of a previous turn to construct an input sample.

[0094] Optionally, for the constructed input sample, the response capability of the human-computer interaction model to the input sample can be evaluated by the large model. If the human-computer interaction model has the response capability of the input sample, it means that even without retrieval enhancement, the human-computer interaction model can respond to the input sample well, and the search determination label of the input sample is set to a first label indicating that retrieval enhancement is not needed. If the human-computer interaction model does not have the response capability of the input sample, it means that if retrieval enhancement is not performed, the human-computer interaction model cannot respond to the input sample well, and the search determination label of the input sample is set to a second label indicating that retrieval enhancement is needed. Through automatic labeling, manual intervention can be reduced, and the training data set can be quickly generated and updated, thereby improving the scalability and iteration speed of the search determination model, and quickly adapting to the needs of different fields and scenarios.

[0095] The first label and the second label are different, the first label indicates that retrieval enhancement is needed, and the second label indicates that retrieval enhancement is not needed. The specific values of the first label and the second label can be configured and adjusted according to actual needs, which are not limited here. For example, the first label is 1, and the second label is 0; or the first label is “true”, and the second label is “false”.

[0096] Optionally, for the constructed input sample, the input sample can be classified to determine the category of the input sample. The search judgment label of each category is labeled according to human will, and the search judgment label of the input sample is determined as the search judgment label corresponding to the category of the input sample. In this way, the search judgment label of each category is labeled in combination with human will, only the search judgment label corresponding to different categories needs to be labeled, and each input sample does not need to be labeled separately, which can reduce manual intervention, quickly generate and update the training data set, thereby improving the scalability and iteration speed of the search judgment model, and quickly adapting to the needs of different fields and scenarios.

[0097] Optionally, for the constructed input sample, a strategy of combining human-computer interaction model response capability evaluation and human will can be adopted to label the search judgment label of the input sample, so as to improve the accuracy and rationality of data labeling. The strategy of combining human-computer interaction model response capability evaluation and human will will be described in detail in subsequent embodiments.

[0098] Step S302, inputting the input sample into the classification model for classification prediction to obtain a prediction result of whether retrieval enhancement is needed.

[0099] When the classification model is trained based on the training data, the input sample is input into the classification model, and the classification model is used to classify and predict whether the input sample needs retrieval enhancement, that is, whether the current query in the input sample needs retrieval enhancement, to obtain a prediction result of the input sample.

[0100] Step S303, adjusting parameters of the classification model according to the prediction result and the search judgment label of the input sample to obtain a search judgment model.

[0101] In this step, the loss function value is calculated according to the prediction result of the input sample and the search judgment label of the input sample. According to the loss function value, the parameters of the classification model are adjusted through back propagation to realize the training of the classification model. The trained classification model is used as the search judgment model.

[0102] It should be noted that the strategy used for training the classification model in this embodiment includes but is not limited to using which optimization algorithm, learning rate, batch size, etc. The strategy can be configured and adjusted according to the needs of actual application scenarios, which are not limited here.

[0103] Exemplarily, taking the number of training data as 100,000 or several hundred thousand as an example, the learning rate can be set to a value between 1e-5 and 2e-5, and this smaller learning rate ensures that the model can fine-tune the parameters during the training process, thereby improving the convergence and accuracy of the model. The maximum length of the input data can be set to 512 tokens to support multi-turn conversations. This length limit is mainly to ensure that the model can receive sufficient context information when processing complex multi-turn conversations, thereby improving the accuracy of search determination. The query context of the conversation is very important, not only containing the current query, but also containing the information and clues provided by the previous rounds of historical queries. These information helps the model better understand the intent of the current query. Therefore, setting the maximum length to 512 tokens can ensure that it is suitable for most query scenarios. The batch size can be set to 32. In addition, in order to prevent the model from overfitting, some regularization techniques such as dropout, weight decay, etc. can be used. These regularization techniques can effectively prevent the model from overfitting to the training data, thereby improving its generalization ability on the test set. In addition, in order to further improve the performance of the model, an adaptive learning rate optimization algorithm can be used to improve the training speed while maintaining stability.

[0104] In actual application, the constructed training data can be divided into a training set and a test set, and the classification model is iterated and optimized through the training set and the test set, so that the classification model can effectively learn and distinguish which queries need to be enhanced and which queries do not need to be enhanced. The search determination can be directly answered by the human-computer interaction model, thereby realizing accurate search determination of the input sample.

[0105] The scheme of the embodiment, by constructing training data including input samples and search determination labels, inputting the input samples into the classification model for classification prediction to obtain a prediction result of whether to need to perform retrieval enhancement; according to the prediction result and the search determination label of the input sample, adjusting the parameters of the classification model to obtain a search determination model, which can improve the accuracy of search determination. In the process of multi-turn conversation, through the search determination model, whether to enhance the search is determined according to the current query and the historical query, which not only can enhance the search when needed, improve the accuracy of the response of the human-computer conversation system, but also significantly reduce unnecessary search enhancement, thereby reducing the operation cost and resource consumption of the human-computer conversation system. Through the search determination model, the real-time information acquisition ability of the human-computer conversation model is improved, the context processing ability and the solving ability of open questions in the multi-turn conversation of the human-computer conversation model are enhanced, so that the human-computer conversation model can not only flexibly cope with complex and changing user demands, but also maintain efficient and accurate response.

[0106] FIG. 4 is a flowchart of constructing training data according to an example embodiment of the present disclosure. In an optional embodiment, the specific implementation steps of constructing training data in the foregoing step S301 are as follows:

[0107] Step S401, constructing an input sample containing a current query and historical queries of previous turns according to the collected multi-turn dialogue data.

[0108] In the present embodiment, after a large amount of multi-turn dialogue data is collected, for any multi-turn dialogue data, at least one query can be extracted therefrom as a current query, the current query is concatenated with historical queries of previous turns to construct an input sample. In this way, a large number of input samples can be obtained.

[0109] After the input sample is constructed, the search decision label of the input sample is labeled through subsequent steps.

[0110] Step S402, dividing the input sample into a first sample with a standard reply and a second sample without a standard reply.

[0111] In the present embodiment, the input sample is divided into two categories according to whether it has a standard reply, the input sample with a standard reply is taken as a first sample, and the input sample without a standard reply is taken as a second sample.

[0112] In an optional implementation of the step, the input sample can be divided into a first sample with a standard reply and a second sample without a standard reply according to whether there is a standard reply to the current query in the input sample in the multi-turn dialogue data. The standard reply refers to the labeled correct reply information. In actual application, there is a labeled multi-turn dialogue data set, which includes multi-turn queries and standard replies of each turn query.

[0113] In another optional implementation of the step, the input sample is classified by domain to determine the domain category corresponding to each input sample. The input sample of the knowledge category usually has a standard answer. The input sample of the domain category of the knowledge category is taken as the first sample with a standard reply. The input sample of the domain category other than the knowledge category is taken as the second sample without a standard reply.

[0114] In a multi-round dialogue scenario, domain classification mainly refers to classifying dialogues according to the knowledge field or application scenario to which the dialogue content belongs. Such classification helps the human-computer interaction model to more accurately understand the user's intent and needs and provide more accurate and useful responses. Exemplarily, the domain categories can include but are not limited to: real-time category, knowledge category, casual category, text processing category, mathematics category, code category, literature category, and science and technology category. The set of domain categories can be configured according to actual application requirements and experience, and a commonly used set of domain categories can be used, which is not specifically limited herein. The domain categories can be further subdivided into multiple subcategories. For example, the real-time category can include subcategories such as weather, travel, and news; the text processing category can include subcategories such as translation, creation, and rewriting.

[0115] In implementing domain classification on input samples and determining the domain categories corresponding to the input samples, a pre-trained large language model is used to classify the input samples. Optionally, a domain classification prompt template (prompt) is pre-configured, which includes a task description for instructing the large language model to implement domain classification on the input samples and determine the domain categories corresponding to the input samples. The domain classification prompt template also includes a set of configured domain categories and a filling position of the input sample.

[0116] In classifying the input samples, the input samples are filled into the corresponding filling position in the domain classification prompt template to obtain domain classification prompt information; and the domain classification prompt information is input into the large language model to determine the domain category of the input sample based on the prompt of the large language model to the domain classification prompt information.

[0117] Optionally, the domain classification prompt template (prompt) not only includes the task description, the set of configured domain categories, and the filling position of the input sample, but also includes the description and examples of one or more subcategories under the domain category. The task description requires the large language model to determine the domain category of the input sample and give the specific subcategory to which the input sample belongs under the domain category.

[0118] In an optional embodiment, in order to enhance the diversity of data under different domain categories, a rule-based and large language model generated manner can be used to construct part of the input samples. For domain categories with a small number of input samples, generation rules for input samples in the domain category can be configured, including but not limited to dialogue topics, output requirements, and sample templates. In this way, the number of input samples of various domain categories can meet the data ratio requirements of different domain categories. The data ratio requirements of different domain categories specify the proportion range of samples in each domain category. By setting the generation rules and using a large language model to generate sample data, the diversity of various samples can be quickly increased, which helps to improve the performance of the model in a specific knowledge field. For example, for some specific knowledge fields (such as law, medicine, etc.), by sorting out a large number of related knowledge points, detailed generation rules are formulated, and then combined with a large language model to generate more rich and diverse sample data, thereby rapidly expanding the training data set. This strategy is particularly important for rapidly improving the accuracy and performance of the model in some specific fields.

[0119] The output requirement can limit the number of words of the output dialogue data, require the generated dialogue data to maintain diversity and naturalness, and avoid generating too mechanical or repetitive dialogue content, etc. The sample template specifies the format of a large number of dialogue data, such as “[XX] What will the weather be like tomorrow?” and “[XX]” is filled with a regional name.

[0120] For example, a plurality of different dialogue topics (such as weather, travel, etc.), output requirements, and sample templates under each domain category are pre-configured. When generating an input sample of any domain category, a dialogue topic, an output requirement, and a sample template under the domain category can be randomly selected and input into a large model to generate an input sample containing multiple rounds of queries, so as to obtain rich and diverse input samples. Specifically, the dialogue topic, the output requirement, and the sample template under the domain category are input into the large model, and the large model is used to generate multiple rounds of queries around the given dialogue topic and in accordance with the output requirement.

[0121] In order to quickly respond to the needs of different fields and scenarios, the present embodiment provides a rule-based and LLM generated data enhancement mechanism, which can generate a large number of diversified sample data in a short time and cover multiple domains. In the training process of the search determination model, the data enhancement mechanism can be used to obtain rich and diverse new training data in each model iteration, and the training based on the rich and diverse new training data can greatly shorten the iteration period, so that the model can quickly adapt to dynamic changes in demand.

[0122] In step S403, for the first sample with a standard reply in the input sample, a search determination label of the first sample is determined according to whether the man-machine interaction model can correctly respond to the first sample.

[0123] In the labeling of the search determination label of the input sample, for the first sample with a standard answer, whether the first sample needs to be retrieved for enhancement is determined by judging whether the human-computer interaction model can correctly respond to the first sample, that is, whether the human-computer interaction model has the ability to correctly respond to the current query in the first sample.

[0124] For the first sample that the human-computer interaction model can correctly respond to, the human-computer interaction model itself has the ability to correctly respond to the current query in the first sample, that is, the human-computer interaction model can generate a correct response to the first sample based on the learned knowledge even without retrieval enhancement. It can be confirmed that these first samples do not need retrieval enhancement, and the search determination label of these first samples is set to a first label. The first label indicates that retrieval enhancement is not needed.

[0125] For the first sample that the human-computer interaction model cannot correctly respond to, the human-computer interaction model itself does not have the ability to correctly respond to the current query in the first sample, and retrieval enhancement is needed. The human-computer interaction model can generate a correct response to the first sample based on the retrieval enhancement result. It can be confirmed that these first samples need retrieval enhancement, and the search determination label of these first samples is set to a second label. The second label indicates that retrieval enhancement is needed.

[0126] Optionally, whether the human-computer interaction model can correctly respond to the first sample can be implemented in the following manner:

[0127] The first sample is input into the human-computer interaction model to generate a predicted response of the first sample. The first sample, the predicted response of the first sample, and the standard answer are input into a response evaluation model to judge whether the predicted response correctly responds to the first sample. If the predicted response correctly responds to the first sample, it is determined that the human-computer interaction model can correctly respond to the first sample. If the predicted response does not correctly respond to the first sample, it is determined that the human-computer interaction model cannot correctly respond to the first sample.

[0128] The response evaluation model can be a fine-tuned large language model or a trained binary classification model. The response evaluation model is obtained by fine-tuning the large language model or training the binary classification model. The response evaluation model has the ability to judge whether the predicted response of the input query correctly answers the input query according to the input query and the standard answer of the input query.

[0129] Optionally, whether the human-computer interaction model can correctly respond to the first sample can be implemented in the following manner:

[0130] The first sample is input into the human-computer interaction model, and a predicted response of the first sample is generated by the human-computer interaction model. The first sample, the predicted response of the first sample, and the standard reply are input into the response quality evaluation model, and a quality evaluation value of the predicted response is generated by the response quality evaluation model. If the quality evaluation value of the predicted response is greater than or equal to a quality evaluation threshold, it is determined that the human-computer interaction model can correctly respond to the first sample. If the quality evaluation value of the predicted response is less than the quality evaluation threshold, it is determined that the human-computer interaction model cannot correctly respond to the first sample.

[0131] The response quality evaluation model can be obtained by training a large language model or a machine learning model, or an existing model for evaluating the response quality of a human-computer interaction model. The response quality evaluation model is obtained by fine-tuning a large language model or a machine learning model. The response quality evaluation model has the ability to evaluate the response quality of the predicted response of the input query according to the input query and the standard reply of the input query.

[0132] In this embodiment, for the first sample with a standard reply in the input sample, it is determined whether the human-computer interaction model can correctly respond to the first sample. For the first sample that can be correctly responded to by the human-computer interaction model, the search judgment label is set to the first label. For the first sample that cannot be correctly responded to by the human-computer interaction model, the search judgment label is set to the second label. Through automatic labeling, manual intervention can be reduced, and the training data set can be quickly generated and updated, thereby improving the expansibility and iteration speed of the search judgment model, and quickly adapting to the needs of different fields and scenarios.

[0133] In step S404, for the second sample without a standard reply in the input sample, the search judgment label of the second sample is determined according to the category of the second sample and the search judgment label corresponding to each category configured.

[0134] When labeling the search judgment label of the input sample, for the second sample without a standard reply, the search judgment label of the second sample is set to the search judgment label corresponding to the category of the second sample by configuring the search judgment label corresponding to each category, so that the second sample is labeled in batches according to the category, and each input sample does not need to be labeled separately. Manual intervention can be reduced, and the training data set can be quickly generated and updated, thereby improving the expansibility and iteration speed of the search judgment model, and quickly adapting to the needs of different fields and scenarios.

[0135] Exemplarily, the server outputs a front-end configuration interface, and outputs the category set of the second samples through the front-end configuration interface. The front-end configuration interface is used to configure the search determination labels corresponding to each category in the category set. In addition, the front-end configuration interface can also output examples of the second samples of each category, so that the relevant annotators can configure (i.e., annotate) the search determination labels corresponding to each category according to the examples of the second samples under each category. After the search determination labels corresponding to each category are configured, the configured search determination labels corresponding to each category are submitted to the server through a configuration submission operation on the front-end configuration interface. In response to the configuration submission operation on the front-end configuration interface, the server obtains the search determination labels corresponding to each category configured in the front-end configuration interface. The configuration submission operation on the front-end configuration interface can be an operation of clicking a "submit" or "save" control or the like on the front-end configuration interface.

[0136] In an optional implementation of this step, the domain category and the subcategory of the second sample can be determined. By configuring the search determination labels corresponding to each subcategory, the search determination label of the second sample is set as the search determination label corresponding to the subcategory of the second sample, so as to realize the batch annotation of the second sample according to the subcategory. Compared with the annotation according to the domain category, the annotation according to the more refined subcategory can improve the accuracy of the search determination label of the second sample, and without the need to annotate each input sample respectively, the manual intervention can be reduced, the training data set can be quickly generated and updated, so as to improve the expansibility and iteration speed of the search determination model, and the demand of different domains and scenes can be quickly adapted.

[0137] Exemplarily, the server outputs a front-end configuration interface, and outputs the domain category and the subcategory contained in each domain category through the front-end configuration interface. The front-end configuration interface is used to configure the search determination labels corresponding to each subcategory under each domain category. In addition, the front-end configuration interface can also output examples of the second samples of each subcategory, so that the relevant annotators can configure (i.e., annotate) the search determination labels corresponding to each subcategory according to the examples of the second samples under each subcategory. After the search determination labels corresponding to each subcategory are configured, the configured search determination labels corresponding to each subcategory are submitted to the server through a configuration submission operation on the front-end configuration interface. In response to the configuration submission operation on the front-end configuration interface, the server obtains the search determination labels corresponding to each subcategory configured in the front-end configuration interface. The configuration submission operation on the front-end configuration interface can be an operation of clicking a "submit" or "save" control or the like on the front-end configuration interface.

[0138] In this step, for the second sample without a standard reply in the input sample, the search determination label corresponding to the subcategory of the second sample is taken as the search determination label of the second sample according to the configured search determination labels corresponding to each subcategory.

[0139] According to the collected multi-turn dialogue data, an input sample containing a current query and a historical query of a previous turn is constructed; for a first sample in the input sample having a standard reply, a search determination label of the first sample is determined according to whether the human-computer interaction model can correctly respond to the first sample; for a second sample in the input sample not having a standard reply, a search determination label of the second sample is determined according to a category of the second sample and a search determination label corresponding to the category of the second sample configured. In this way of data labeling, the search determination label of the input sample is labeled by combining the response capability evaluation of the human-computer interaction model and the human intention, which can reduce the artificial participation and cost, quickly adapt to the capability of the model and the actual demand of the human, make the data labeling more in line with the purpose of model training, and improve the accuracy and rationality of data labeling.

[0140] In an optional embodiment, the specific implementation steps of constructing the training data in the foregoing step S301 are as follows:

[0141] According to the collected multi-turn dialogue data, an input sample containing a current query and a historical query of a previous turn is constructed; for a first sample in the input sample having a standard reply, a search determination label of the first sample is determined according to whether the human-computer interaction model can correctly respond to the first sample; for a second sample in the input sample not having a standard reply, a search determination label of the second sample is determined according to a category of the second sample and a search determination label corresponding to the category of the second sample configured. In this way of data labeling, the search determination label of the input sample is labeled by combining the response capability evaluation of the human-computer interaction model and the human intention, which can reduce the artificial participation and cost, quickly adapt to the capability of the model and the actual demand of the human, make the data labeling more in line with the purpose of model training, and improve the accuracy and rationality of data labeling.

[0142] The input sample with the domain category of knowledge is taken as a first sample, and a standard reply of the first sample is obtained. Whether the human-computer interaction model can correctly respond to the first sample is judged according to the first sample and the labeled reply. The search determination label of the first sample that the human-computer interaction model cannot correctly respond to is set as a first label. The search determination label of the first sample that the human-computer interaction model can correctly respond to is set as a second label. The first label indicates that retrieval enhancement is needed, and the second label indicates that retrieval enhancement is not needed. For details, refer to the related content of the foregoing step S403, which will not be described here.

[0143] Optionally, the input sample with the domain category that is not knowledge, such as a real-time category, a casual category and the like, is taken as a second sample. According to the search determination label corresponding to each domain category configured, the search determination label corresponding to the domain category of the second sample is taken as the search determination label of the second sample. For example, the first label can be configured to correspond to the real-time category, and the second label can be configured to correspond to the casual category; the search determination label of the input sample of the real-time category is labeled as the first label, and the search determination label of the input sample of the casual category is labeled as the second label.

[0144] Optionally, for input samples of domain categories that are not knowledge categories, such as real-time categories, casual categories, and the like, the input samples are taken as second samples. According to the search determination labels corresponding to the configured sub-categories, the search determination label corresponding to the sub-category of the second sample is taken as the search determination label of the second sample. Compared with the labeling according to the domain categories, labeling according to the more refined sub-categories can improve the accuracy of the search determination label of the second sample. For specific implementation principles, refer to the related content of the foregoing step S404, which will not be described here again.

[0145] The method of the embodiment divides the domain categories and sub-categories of the input samples in multiple levels, takes the input samples of the knowledge categories as first samples and the input samples of the non-knowledge categories as second samples according to the domain categories. For the first samples of the knowledge categories, the search determination label of the first sample is determined according to whether the human-computer interaction model can correctly respond to the first sample. For the second samples of the non-knowledge categories, the search determination label of the second sample is taken as the search determination label of the second sample according to the search determination label corresponding to the sub-category of the second sample. This way of data labeling adopts the strategy of combining the response ability evaluation of the human-computer interaction model and the human will to label the search determination label of the input sample, which can not only reduce the artificial participation and cost, but also quickly adapt to the ability of the model and the actual needs of the human, so that the data labeling is more in line with the purpose of model training, and the accuracy and rationality of data labeling can be improved.

[0146] In actual application, online user queries involve multiple domains, and the range is extremely extensive and complex. The cost of traditional manual data labeling is extremely high. The present scheme combines a large language model to automatically classify the input samples, and further labels whether the input samples under each domain category need to be retrieved and enhanced (i.e., search determination) through model capability testing and human will. This hierarchical classification labeling method ensures that each input sample can be accurately determined for search, and the most suitable processing scheme is obtained, thereby improving the ability and efficiency of the human-computer dialogue system to process complex user requests.

[0147] FIG. 5 is an architecture diagram of retrieval enhancement based on search determination according to an example embodiment of the present disclosure. As shown in FIG. 5, in the training process of the search determination model, in the process of constructing training data, input samples are constructed based on the searched multi-turn dialogue data. The input samples are subjected to multi-level domain classification by means of a large language model to determine the domain category of the input samples. For domain categories with a small number of samples, data augmentation of the domain category can be performed in a manner based on rules and a large language model to obtain more abundant and diverse input samples under the domain category, so that the input samples of each domain category meet the requirements of data matching. For the input samples, a strategy combining human-machine interaction model response capability evaluation (i.e., model capability evaluation) and human intent is adopted to label the search determination label of the input samples to improve the accuracy and rationality of data labeling. Using a large model to classify the domain of the input samples, combined with human intent and a data generation scheme based on rules and LLM, a comprehensive and detailed training data set can be quickly and efficiently constructed. This not only provides data support for the accuracy of search determination of the search determination model in different scenarios, but also improves the adaptability and generalization ability of the search determination model in various query scenarios.

[0148] Further, the search determination model (including the encoder and the classifier) is fine-tuned and trained based on the constructed training data to obtain a trained search determination model. In the multi-turn dialogue process, the concatenation result of the current query and the historical queries of each round is taken as the query context and input into the trained search determination model for search determination to determine whether retrieval enhancement is needed for the current query. If the search determination result is that retrieval enhancement is needed, the retrieval enhancement generation (RAG) processing is performed to perform retrieval enhancement, and the human-machine interaction model generates response information of the current query according to the retrieval enhancement result. If the search determination result is that retrieval enhancement is not needed, retrieval enhancement is not performed, and the current query is directly input into the human-machine interaction model to generate response information of the current query.

[0149] Exemplarily, the following multi-round dialogue in FIG. 5 is taken as an example: the historical queries of the previous two rounds are "Hello", "Weather in A city tomorrow", and the current round query is "What about B city". The historical queries and the current round query are spliced into the following query context: "[CLS] Hello [SEP] Weather in A city tomorrow [SEP] What about B city". The query context is input into the search determination model for search determination. Taking the multi-round dialogue as an example, if the search determination result is to retrieve enhancement, the retrieval enhancement generation (RAG) process is performed, and the response information of the current round query is generated according to the retrieval enhancement result, as shown in FIG. 5, "According to the latest information, the weather in B city on xx month xx day in 2024 is as follows: current weather: light rain; humidity: 63%…", which can better answer the current round query. If the search determination result is not to retrieve enhancement, no retrieval enhancement is performed, and the current round query is directly input into the human-computer interaction model, and the response information of the current round query is generated by the human-computer interaction model (using its multi-round dialogue capability), as shown in FIG. 5, "I'm sorry, I can't access the Internet in real time and provide the current weather information. You can use the weather forecast application…", obviously the response information cannot answer the current round query, which is not a satisfactory response.

[0150] The present scheme enriches sample data of various domain categories by combining rule-based and LLM generation capabilities, realizes data annotation by combining human intent and model capability evaluation, significantly reduces maintenance and development costs, and improves the performance of the model in open domain question answering; through automatic annotation and category batch annotation mechanism, human intervention is reduced, and training data set can be quickly generated and updated, thereby improving the scalability and iteration speed of the model. At the same time, by using the powerful language understanding and generation capability of the search determination model, the context processing capability of the human-computer interaction model in the multi-round dialogue and the solving capability of the open question are enhanced. The combination of these multiple technical means makes the human-computer dialogue system not only flexible to respond to complex and changing user needs, but also efficient and accurate in response.

[0151] In the present scheme, compared with using a large language model to determine whether to perform retrieval enhancement, a smaller-scale search determination model is used for search determination, which reduces the computational complexity of search determination and can meet the requirements of high real-time applications; significantly reduces the cost of computing resources, especially when handling high-concurrency requests. At the same time, through automatic annotation and category batch annotation mechanism, the quality of the training data is ensured, and the stability and reliability of the model are enhanced. Through the data enhancement mechanism based on rules and large language model generation and automatic annotation technology, rapid iteration and update are realized, which can quickly adapt to the needs of different fields and scenarios. Overall, the present scheme achieves technical effects such as low cost, high scalability, strong context processing capability, and high real-time performance, and shows better flexibility and intelligence in practical applications.

[0152] FIG. 6 is a method of human-computer conversation provided by another exemplary embodiment of the present disclosure. The execution subject of the present embodiment is a server running a search determination model, i.e., a search determination server. As shown in FIG. 6, the method specifically comprises the following steps:

[0153] In step S601, in response to a calling request for the search determination model, the current query and the historical queries of previous rounds are obtained.

[0154] In the present embodiment, the search determination server provides a search determination service interface, such as an API of the search determination model, to the human-computer conversation system. The human-computer conversation system calls the search determination model through the search determination service interface to realize search determination.

[0155] In the process of multi-round conversation between the user and the human-computer conversation system, when the human-computer conversation system receives the current query (i.e., the current round query) input by the user, the human-computer conversation system obtains the historical queries of previous rounds, and sends a calling request for the search determination model to the search determination server, the calling request containing the current query and the historical queries of previous rounds.

[0156] In response to receiving the calling request for the search determination model, the search determination server obtains the current query and the historical queries of previous rounds in the multi-round conversation.

[0157] In step S602, the splicing result of the historical queries of previous rounds and the current query is taken as the query context.

[0158] In this step, the search determination server obtains the query context by splicing the current query and the historical queries of previous rounds. For example, the historical queries of previous rounds and the current query are spliced in chronological order, and a separator is used to connect the adjacent two queries to obtain the query context. The separator is a special token used to separate adjacent queries, such as “[SEP]”, which can be configured and adjusted according to actual application requirements and experience, and is not specifically limited here.

[0159] Optionally, a start token (such as “[CLS]”) can also be spliced at the beginning of the query context, which indicates the starting position of the input query context. The specific token used for the start token can be configured and adjusted according to actual application requirements and experience, and is not specifically limited here.

[0160] For example, for the historical queries “hello” and “weather in A city tomorrow” of the previous two rounds and the current query “B city”, the historical queries and the current query can be spliced into the following query context: “[CLS]hello[SEP]weather in A city tomorrow[SEP]B city”.

[0161] By splicing the historical queries of each round and the current round query in chronological order and separating adjacent queries using a separator, the context relationship between queries can be well preserved, helping the model better understand the context relationship between queries and more accurately make search decisions. In this embodiment, during the multi-round dialogue process, the queries in the multi-round dialogue process are stored.

[0162] It should be noted that if the current query is the first query of the user, there is no historical query of the previous round, and the first query is taken as the query context.

[0163] Step S603, input the query context into the search decision model for search decision, and obtain a search decision result, which indicates whether the current query needs to be retrieved and enhanced.

[0164] After obtaining the query context, the search decision server inputs the query context into the search decision model to determine whether the current query needs to be retrieved and enhanced through the search decision model, and obtains a search decision result.

[0165] In this embodiment, the training process of the search decision model includes: obtaining training data, the training data including: input samples and search decision labels, the input samples including the spliced results of the current query and the historical queries of the previous rounds, and the search decision labels being used to indicate whether the response generated for the current query needs to be retrieved and enhanced; inputting the input samples into the classification model for classification prediction to obtain a prediction result of whether retrieval and enhancement is needed; and adjusting the parameters of the classification model according to the prediction result and the search decision labels of the input samples to obtain the search decision model. The training process and technical effects of the search decision model in this embodiment are specifically described in the foregoing embodiment related to the training of the search decision model, and will not be described here.

[0166] Step S604, return the search decision result.

[0167] After obtaining the search decision result, the search decision server returns the search decision result to the human-computer dialogue system.

[0168] In the case that the search decision result is that the current query needs to be retrieved and enhanced, the human-computer dialogue system performs retrieval and enhancement according to the current query to obtain a retrieval and enhancement result. Further, the human-computer dialogue system calls the human-computer interaction model by taking the retrieval and enhancement result and the current query as input parameters, generates response information of the current query through the human-computer interaction model according to the retrieval and enhancement result, and returns the response information of the current query to the human-computer dialogue system. The human-computer dialogue system outputs the response information of the current query to the user.

[0169] In a case that the search determination result is that the current query does not need to be retrieved for enhancement, the human-computer conversation system takes the current query as an input parameter, calls the human-computer interaction model, generates response information of the current query through the human-computer interaction model, and returns the response information of the current query to the human-computer conversation system. The human-computer conversation system outputs the response information of the current query to the user.

[0170] In the scheme of the embodiment, in the multi-turn conversation process, a splicing result of the current query and historical queries of previous turns is taken as a query context, and the query context is input into a search determination model to determine whether the current query needs to be retrieved for enhancement. In a case that the search determination result is that the current query needs to be retrieved for enhancement, the human-computer conversation system retrieves the current query for enhancement, and generates response information of the current query according to a retrieval enhancement result. By introducing the search determination model, whether the current query needs to be retrieved for enhancement is accurately determined based on the historical queries of the previous turns and the current query, and retrieval enhancement is performed in a case that retrieval enhancement is needed. This can not only reduce the phenomenon of "content hallucination", improve the accuracy of human-computer conversation response, but also reduce unnecessary retrieval enhancement, reduce waste of computing resources, and reduce the operation cost of the human-computer conversation system.

[0171] FIG. 7 is an interaction flowchart of a multi-turn conversation provided by another example embodiment of the present disclosure. As shown in FIG. 7, the method includes the following specific steps:

[0172] In step S701, the human-computer conversation system receives a current query.

[0173] In step S702, the human-computer conversation system acquires historical queries of previous turns.

[0174] In step S703, the human-computer conversation system sends a calling request for a search determination model to a search determination server, and the calling request contains the current query and the historical queries of the previous turns.

[0175] In step S704, in response to the calling request for the search determination model, the search determination server acquires the current query and the historical queries of the previous turns in the multi-turn conversation.

[0176] In step S705, the search determination server takes a splicing result of the historical queries of the previous turns and the current query as a query context.

[0177] In step S706, the search determination server inputs the query context into the search determination model to perform search determination, and obtains a search determination result, which indicates whether the current query needs to be retrieved for enhancement.

[0178] In step S707, the search determination server returns the search determination result to the human-computer conversation system.

[0179] Step S708, the man-machine conversation system determines whether the current query needs to be enhanced according to the search determination result.

[0180] Step S709, in the case that the search determination result is that the current query needs to be enhanced, the man-machine conversation system performs the enhancement according to the current query, and obtains an enhancement result.

[0181] Step S710, the man-machine conversation system inputs the enhancement result and the current query into the man-machine interaction model, and generates response information of the current query according to the enhancement result through the man-machine interaction model.

[0182] Step S711, in the case that the search determination result is that the current query does not need to be enhanced, the man-machine conversation system inputs the current query into the man-machine interaction model, and generates response information of the current query through the man-machine interaction model.

[0183] Step S712, the man-machine conversation system outputs the response information of the current query.

[0184] The specific implementation principles and technical effects of each step in the embodiment are referred to the related contents of the foregoing embodiments, and will not be repeated here.

[0185] FIG. 8 is a structural schematic diagram of a server provided by an embodiment of the present disclosure. As shown in FIG. 8, the server includes a memory 801 and a processor 802. The memory 801 is configured to store computer execution instructions, and can be configured to store other various data to support operations on the server. The processor 802 is in communication connection with the memory 801, and is configured to execute the computer execution instructions stored in the memory 801, so as to realize the technical solutions provided by any of the method embodiments, and the specific functions and technical effects that can be achieved are similar, and will not be repeated here.

[0186] Optionally, as shown in FIG. 8, the server further includes a firewall 803, a load balancer 804, a communication component 805, a power supply component 806, and other components. Only part of the components are shown in FIG. 8, and it does not mean that the server only includes the components shown in FIG. 8. In FIG. 8, only the server is taken as an example of a cloud server deployed in the cloud, and the server can also be deployed locally, which is not limited here.

[0187] The embodiment of the present disclosure further provides a computer readable storage medium, and the computer readable storage medium stores computer execution instructions. When the processor executes the computer execution instructions, the method of any of the foregoing embodiments is realized, and the specific functions and technical effects that can be achieved will not be repeated here.

[0188] The embodiments of the present disclosure further provide a computer program product comprising a computer program which, when executed by a processor, implements the method of any of the foregoing embodiments. The computer program is stored in a readable storage medium, and at least one processor of a server can read the computer program from the readable storage medium, and the at least one processor executes the computer program to enable the server to perform the technical solutions provided by any of the method embodiments, and the specific functions and technical effects that can be achieved are not repeated here.

[0189] The embodiments of the present disclosure provide a chip comprising a processing module and a communication interface, the processing module being capable of executing the technical solutions of the server in the foregoing method embodiments. Optionally, the chip further comprises a storage module (such as a memory), the storage module being configured to store instructions, and the processing module being configured to execute the instructions stored in the storage module, and the execution of the instructions stored in the storage module enables the processing module to execute the technical solutions provided by any of the method embodiments.

[0190] The integrated modules in the form of software function modules described above can be stored in a computer readable storage medium. The software function modules described above are stored in a storage medium, and include a plurality of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute part of the steps of the method of various embodiments of the present disclosure.

[0191] It should be understood that the processor described above can be a central processing unit (CPU), a graphics processing unit (GPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the application can be directly embodied as execution completed by a hardware processor, or executed by a combination of hardware and software modules in at least one processor.

[0192] The memory can include a high-speed random access memory (RAM), and can also include a non-volatile storage, for example, at least one disk memory, and can also be a U disk, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0193] The memory described above can be object storage (OSS).

[0194] The aforementioned memory can be implemented by any type of volatile or nonvolatile memory devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0195] The aforementioned communication component is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access wireless networks based on communication standards, such as mobile hotspots (WiFi), second generation (2G), third generation (3G), fourth generation (4G) / long term evolution (LTE), fifth generation (5G) mobile communication networks, or a combination thereof. In an example embodiment, the communication component receives broadcast signals or broadcast related information from an external broadcast managing system via a broadcast channel. In an example embodiment, the communication component further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared technology, ultra wideband (UWB) technology, Bluetooth technology, and other technologies.

[0196] The aforementioned power component provides power to various components of the device where the power component is located. The power component can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device where the power component is located.

[0197] The storage medium can be implemented by any type of volatile or non-volatile storage devices or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read only memory (EEPROM), an erasable programmable read only memory (EPROM), a programmable read only memory (PROM), a read only memory (ROM), a magnetic storage, a flash memory, a magnetic disk or a compact disk.

[0198] An exemplary storage medium is coupled to the processor such that the processor can read information from, and write information to, the storage medium. Of course, the storage medium can be a part of the processor. Consistent with the teachings provided herein, the processor and storage medium can be located in a single component or distributed across multiple components. The storage medium can be embodied in a computer-readable medium.

[0199] It is important to note that the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0200] The sequence of the above-mentioned embodiments of the present disclosure is only for description, and does not represent the advantages and disadvantages of the embodiments. In addition, in some of the processes described in the above embodiments and drawings, a plurality of operations appear in a specific order, but it should be clearly understood that these operations can be executed in the order they appear in this text or in parallel, only to distinguish different operations. The sequence itself does not represent any execution order. In addition, these processes can include more or fewer operations, and the operations can be executed in sequence or in parallel. It should be noted that the "first", "second", etc. in this text are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence. "First" and "second" are different types. The meaning of "multiple" is more than two, unless otherwise explicitly specified.

[0201] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and the necessary general hardware platform, of course, can also be through hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the methods of various embodiments of the present disclosure.

[0202] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure following the general principles thereof and including such modifications and equivalents as come within the scope of the present disclosure.

[0203] The above is only the preferred embodiment of the present disclosure, and does not limit the patent scope of the present disclosure, and any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present disclosure, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present disclosure.

Claims

1. A human-to-computer dialog method, wherein, The method comprises: obtaining an input current round query; concatenating the current round query with historical queries of previous rounds to obtain a query context; inputting the query context into a search judgment model to determine whether the current round query needs retrieval enhancement, and obtaining a search judgment result; in a case where the search judgment result indicates that the current round query needs retrieval enhancement, performing retrieval enhancement on the current round query to obtain a retrieval enhancement result; generating response information of the current round query according to the retrieval enhancement result.

2. The method of claim 1, wherein, The method further comprises: in a case where the search judgment result indicates that the current round query does not need retrieval enhancement, inputting the current round query into a human-computer interaction model to generate response information of the current round query through the human-computer interaction model.

3. The method of claim 1, wherein, The method further comprises: concatenating the historical queries of previous rounds and the current round query in chronological order, and connecting adjacent two round queries by using a separator to obtain the query context.

4. The method of claim 3, wherein, The method further comprises: concatenating a start marker at the beginning of the query context, wherein the start marker is used to indicate a start position of inputting the query context.

5. The method of claim 1, wherein, The method further comprises: retrieving knowledge matching the current round query in a pre-constructed knowledge base; and / or performing open domain search according to the current round query to obtain knowledge matching the current round query. The method further comprises:

6. The method of claim 1, wherein, inputting the current round query and the retrieval enhancement result into a human-computer interaction model to generate response information of the current round query according to the retrieval enhancement result through the human-computer interaction model. The method further comprises:

7. The method of any one of claims 1-6, wherein, obtaining training data, wherein the training data comprises input samples and search judgment labels, the input samples comprise concatenation results of a current query and historical queries of previous rounds, and the search judgment labels are used to indicate whether retrieval enhancement is needed for generating response information of the current query; inputting the input samples into a classification model to perform classification prediction and obtain a prediction result of whether retrieval enhancement is needed; adjusting parameters of the classification model according to the prediction result and the search judgment labels of the input samples to obtain the search judgment model. The method further comprises:

8. The method of claim 7, wherein, constructing input samples comprising a current query and historical queries of previous rounds according to collected multi-round dialogue data; for a first sample with a standard reply in the input samples, determining a search judgment label of the first sample according to whether a human-computer interaction model can correctly respond to the first sample; for a second sample without a standard reply in the input samples, determining a search judgment label of the second sample according to a category of the second sample and a search judgment label corresponding to each category in configuration. The method further comprises:

9. The method of claim 8, wherein, performing domain classification on the input samples to determine domain categories and subcategories corresponding to the input samples, wherein at least one of the domain categories comprises one or more subcategories. ​ The input sample of the domain category as the knowledge category is taken as a first sample with a standard reply; The input sample of the domain category not as the knowledge category is taken as a second sample without the standard reply.

10. The method of claim 8, wherein, The method for determining whether the human-computer interaction model can correctly respond to the first sample comprises: inputting the first sample into the human-computer interaction model to generate a predicted response of the first sample through the human-computer interaction model; inputting the first sample, the predicted response and the standard reply into a response evaluation model to determine whether the human-computer interaction model can correctly respond to the first sample through the response evaluation model.

11. The method of claim 8, wherein, The method for determining whether the human-computer interaction model can correctly respond to the first sample comprises: inputting the first sample into the human-computer interaction model to generate a predicted response of the first sample through the human-computer interaction model; inputting the first sample, the predicted response and the standard reply into a response quality evaluation model to generate a quality evaluation value of the predicted response through the response quality evaluation model; determining whether the human-computer interaction model can correctly respond to the first sample according to the quality evaluation value.

12. The method of claim 9, wherein, The method for determining the search determination label of the second sample according to the category of the second sample and the search determination label corresponding to each category configured comprises: taking the search determination label corresponding to the subcategory of the second sample as the search determination label of the second sample according to the search determination label corresponding to each subcategory configured.

13. The method of claim 9, wherein, The method further comprises: outputting each domain category and each subcategory contained in each domain category through a front-end configuration interface, the front-end configuration interface being used for configuring the search determination label corresponding to each subcategory; in response to a configuration submission operation on the front-end configuration interface, acquiring the search determination label corresponding to each subcategory configured in the front-end configuration interface.

14. The method of claim 8, wherein, The method for determining the search determination label of the first sample according to whether the human-computer interaction model can correctly respond to the first sample comprises: determining whether the human-computer interaction model can correctly respond to the first sample; for the first sample correctly responded to by the human-computer interaction model, the search determination label is set as a first label, the first label indicating that retrieval enhancement is not needed; for the first sample not correctly responded to by the human-computer interaction model, the search determination label is set as a second label, the second label indicating that retrieval enhancement is needed.

15. The method of claim 14, wherein, The method for determining whether the human-computer interaction model can correctly respond to the first sample comprises: inputting the first sample into the human-computer interaction model to generate a predicted response of the first sample through the human-computer interaction model; inputting the first sample, the predicted response of the first sample and the standard reply into a response evaluation model to determine whether the predicted response correctly responds to the first sample through the response evaluation model; if the predicted response correctly responds to the first sample, it is determined that the human-computer interaction model can correctly respond to the first sample; if the predicted response does not correctly respond to the first sample, it is determined that the human-computer interaction model cannot correctly respond to the first sample.

16. A human-to-computer dialog method, wherein, The method further comprises: In response to a calling request for the search decision model, a current query and historical queries of previous rounds are obtained; The historical queries of the previous rounds and the spliced result of the current query are taken as a query context; The query context is input into the search decision model to perform search decision, and a search decision result is obtained, which indicates whether search enhancement is needed for the current query; The search decision result is returned.

17. The method of claim 16, wherein, The training process of the search decision model includes: Obtaining training data, the training data including input samples and search decision labels, the input samples including spliced results of current queries and historical queries of previous rounds, and the search decision labels being used to indicate whether search enhancement is needed for responses generated by the current queries; The input samples are input into a classification model to perform classification prediction, and a prediction result of whether search enhancement is needed is obtained; According to the prediction result and the search decision labels of the input samples, parameters of the classification model are adjusted to obtain the search decision model.

18. A server, wherein, comprise: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to cause the server to perform the method of any one of claims 1-17.

19. A computer readable storage medium, wherein, The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method of any one of claims 1-17 is implemented.

20. A computer program product comprising a computer program, wherein, The computer program is executed by the processor to implement the method of any one of claims 1-17.

Citation Information

Patent Citations

  • Multi-round dialogue interaction processing method and device, equipment and storage medium

    CN116910220A

  • Query search method, query information processing method, equipment and storage medium

    CN117520477A

  • Knowledge retrieval enhancement-based large language model question and answer method and device

    CN118113836A

  • Text generation enhancement method and device applied to retrieval enhancement generation

    CN118377844A

  • Systems and methods for machine learning-based query context generation and query response handling

    US20230244678A1