Man-machine conversation method, server, storage medium and program product
By introducing a search decision model into the large language model and combining the query context to determine whether retrieval enhancement is needed, the problems of wasted computational resources and content illusion in multi-turn dialogue scenarios are solved, achieving more efficient response accuracy and resource conservation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2026-03-13
AI Technical Summary
Large language models waste computational resources in multi-turn dialogue scenarios due to unnecessary retrieval enhancements and suffer from content illusion.
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.
It reduces content illusion, improves response accuracy, reduces unnecessary search enhancements, and lowers computational resource waste and operating costs.
Smart Images

Figure CN121658581A_ABST
Abstract
Description
Technical Field
[0001] This application relates to computer technology, and more particularly to a human-computer interaction method, server, storage medium, and program product. Background Technology
[0002] With the rapid development of Natural Language Processing (NLP) technology, Large Language Models (LLMs) have demonstrated superior performance in applications such as text generation, automatic summarization, machine translation, and question answering systems. Due to their powerful language understanding and generation capabilities, LLMs have become the core of various intelligent applications. However, when answering queries with high real-time requirements, current LLMs often suffer from the problem of "content illusion"—that is, the generated answers are grammatically correct but actually contain errors or misleading information, due to their reliance on outdated or inaccurate training information.
[0003] Retrieval-augmented generation (RAG) methods supplement and enhance the model's responsiveness by searching external knowledge in real time based on the current query, thus addressing the "content illusion" problem. However, for some simple queries (such as common sense or casual conversation queries), large language models can generate accurate answers without acquiring external knowledge, and unnecessary retrieval augmentation leads to a waste of computational resources. Especially in multi-turn dialogue scenarios, repeated unnecessary retrieval augmentation in multiple rounds can severely waste computational resources. Summary of the Invention
[0004] This application provides a human-computer dialogue method, server, storage medium, and program product to solve the problem of wasted computing resources caused by unnecessary search enhancements in current RAG schemes.
[0005] Firstly, this application provides a human-computer dialogue method, including:
[0006] Get the input query for this round;
[0007] The concatenation result of the current query and the historical queries from previous rounds is used as the query context;
[0008] The query context is input into the search decision model for search decision, to determine whether the current query needs retrieval enhancement, and to obtain the search decision result.
[0009] If the search result indicates that the current query requires retrieval enhancement, retrieval enhancement is performed based on the current query to obtain enhanced retrieval results.
[0010] Based on the enhanced search results, the response information for this round of queries is generated.
[0011] Secondly, this application provides a human-computer dialogue method, including:
[0012] In response to a request to invoke the search decision model, retrieve the current query and historical queries from previous rounds;
[0013] The concatenation result of previous rounds of historical queries and the current round of queries is used as the query context;
[0014] The query context is input into the search decision model for search decision, and the search decision result is obtained. The search decision result indicates whether the current query needs retrieval enhancement.
[0015] Return the search result.
[0016] Thirdly, this application provides a server, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the server to perform the methods provided in any of the foregoing aspects.
[0017] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the method provided in any of the foregoing aspects.
[0018] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the methods provided in any of the foregoing aspects.
[0019] The human-computer dialogue method, server, storage medium, and program product provided in this application involve obtaining the current query, concatenating the current query with historical queries from previous rounds as the query context, inputting the query context into a search determination model to determine whether the current query requires retrieval enhancement, and obtaining a search determination result. If the search determination result indicates that the current query requires retrieval enhancement, retrieval enhancement is performed based on the current query to obtain an enhanced retrieval result, and response information for the current query is generated based on the enhanced retrieval result. By introducing a search determination model, based on historical queries from each round and the current query, it accurately determines whether retrieval enhancement is needed in the current round, and performs retrieval enhancement only when needed. This not only reduces the phenomenon of "content illusion" and improves response accuracy, but also reduces unnecessary retrieval enhancement and wastes computational resources. Attached Figure Description
[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0021] Figure 1 This is a schematic diagram of an example system architecture to which this application applies;
[0022] Figure 2 A flowchart of a human-computer dialogue method provided for an exemplary embodiment of this application;
[0023] Figure 3 This is a flowchart illustrating a method for training a search decision model according to an example embodiment of this application.
[0024] Figure 4 A flowchart for constructing training data provided as an exemplary embodiment of this application;
[0025] Figure 5 An architecture diagram of search-determination-based retrieval enhancement provided for an exemplary embodiment of this application;
[0026] Figure 6 A human-computer dialogue method provided as another exemplary embodiment of this application;
[0027] Figure 7 A flowchart illustrating the interaction of a multi-turn dialogue as another exemplary embodiment of this application;
[0028] Figure 8 This is a schematic diagram of the structure of a server provided in an embodiment of this application.
[0029] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0030] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0031] 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 used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0032] First, let me explain the terms used in this application:
[0033] Large Language Model: An artificial intelligence system trained on large-scale text data and deep learning techniques, which excels at generating natural language text.
[0034] Content illusion: refers to a model outputting inaccurate or fictitious information when generating content.
[0035] Question-and-answer system: A system that automatically answers questions posed by users.
[0036] Search Decision: Determine whether search enhancement is needed based on user queries.
[0037] Retrieval Enhancement: Supplementing and improving the model's response capabilities by retrieving external resources.
[0038] Loss function: measures the difference between the model's prediction and the actual value.
[0039] Fine-tuning: Based on the pre-trained model, further training is performed using data from a specific domain or task to improve the model's performance in a specific application domain.
[0040] Open-domain search generally refers to the techniques or systems used in Natural Language Processing (NLP) that can retrieve and answer various types of questions from large, diverse knowledge corpora. This type of search is not limited to a specific domain or database but can span multiple domains and topics, providing a broad range of knowledge and information.
[0041] BERT (Bidirectional Encoder Representations from Transformers) is a deep bidirectional language representation model based on the Transformer architecture.
[0042] GTE (Generic Text Embedding) model: This is a relatively general text embedding model. The GTE model is built on the BERT framework and makes full use of BERT's powerful capabilities in the field of natural language processing.
[0043] A token, also known as a discrete token or discrete representation, is a discrete representation of speech or text. To distinguish between discrete representations of text and speech, the discrete representation of speech is called a speech token, and the discrete representation of text is called a text token. The vocabulary used by the model contains both speech 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, syllable, or speech segment. Each text token in the vocabulary corresponds to a text unit, such as a character or word.
[0044] Multimodal tasks refer to downstream tasks that involve multiple modalities of data, such as images and text, in their input and output. Examples include visual question answering, image description, visual entailment, representation and understanding, and image generation.
[0045] Multimodal pre-trained models refer to pre-trained models whose input and output data involve multiple modalities such as images and text. After fine-tuning and training, they can be applied to multimodal task processing.
[0046] Pre-trained language model: A pre-trained model obtained by pre-training a large-scale language model.
[0047] Large-scale models refer to deep learning models with a massive number of parameters, typically containing hundreds of millions, tens of billions, or even trillions of parameters. Large-scale models are also known as foundation models (FM). They are pre-trained on large-scale unlabeled corpora, producing pre-trained models with hundreds of millions of parameters. These models can adapt to a wide range of downstream tasks and have good generalization ability. Examples include large-scale language models and multi-modal pre-training models.
[0048] In practical applications, large models only require a small number of samples to fine-tune the pre-trained model before they can be applied to different tasks. Large models can be widely used in fields such as natural language processing and computer vision. Specifically, they can be applied to computer vision tasks such as visual question answering (VQA), image captioning (IC), and image generation, as well as natural language processing tasks such as text-based sentiment classification, text summarization, and machine translation. The main application scenarios of large models include digital assistants, intelligent robots, search, online education, office software, e-commerce, and intelligent design.
[0049] To address the problem of significant computational resource waste caused by unnecessary retrieval enhancement in multi-turn dialogue scenarios based on the RAG method, this application provides a human-computer dialogue method. This method obtains the current query and concatenates it with historical queries from previous turns as the query context. The query context is then input into a search decision model to determine whether retrieval enhancement is needed, yielding a search decision result. If the search decision indicates that retrieval enhancement is required, it is performed based on the current query, and the response information for the current query is generated from the enhanced result. By introducing a search decision model, based on historical queries from each turn and the current query, the method accurately determines whether retrieval enhancement is needed in the current turn. When enhancement is required, it is performed, which not only reduces the "content illusion" phenomenon and improves response accuracy but also reduces unnecessary retrieval enhancement and minimizes computational resource waste.
[0050] The search decision model is a classification model trained using training data. The encoder of this classification model can be a machine learning model with a small parameter size, such as a BERT-based model, a GTE-based model, or other pre-trained models. Adding a classifier, such as a linear classifier or a multilayer perceptron, to the encoder yields the initial classification model. Training this initial classification model with training data results in the search decision model.
[0051] Figure 1 This is a schematic diagram of an example system architecture to which this application applies. Figure 1 As shown, the system architecture includes a server and endpoint devices. The server and endpoint devices have a communication link, enabling communication between them.
[0052] The endpoint device can be an electronic device used to conduct multi-turn dialogues with the dialogue system. Specifically, it can be a hardware device with network communication, computing, and information display functions, including but not limited to smartphones, tablets, desktop computers, local servers, and cloud servers. Downstream applications running on the endpoint device can be dialogue / question-answering systems, content creation, machine translation, code generation, and text generation (such as product descriptions, charts, and text summaries). During the execution of downstream applications, the endpoint device responds to text generation needs, generates an input data sequence based on the input data, and provides the input data sequence to the server.
[0053] A server is a computing device deployed in the cloud or locally, such as a cloud cluster. The server runs a human-computer dialogue system / application, providing human-computer dialogue services. The server stores a search decision model and a human-computer interaction model. During multi-turn dialogues, the server uses the search decision model to determine whether the current query requires retrieval enhancement based on the current query and historical queries from previous turns. If the search decision indicates that retrieval enhancement is needed, it is performed, resulting in enhanced retrieval results. The human-computer interaction model then generates the response information for the current query based on the enhanced retrieval results. If the search decision indicates that retrieval enhancement is not needed, no further retrieval enhancement is performed, and the response information for the current query is directly generated using the human-computer interaction model.
[0054] Furthermore, the server returns the response information for this round of queries to the endpoint device. The endpoint device then displays the response information for this round of queries to the user, thereby enabling multi-turn human-computer dialogue.
[0055] It's important to note that in practical applications, the human-computer interaction model can be deployed independently, and the server where it's deployed is called the dialogue engine. The search and decision model can also be deployed independently, and the server where it's deployed is called the search and decision server. The server hosting the human-computer dialogue system / application is called the human-computer dialogue server. In one example scenario, the search and decision model and the human-computer dialogue system / application are deployed on the same server, while the human-computer interaction model is deployed on a separate server. In another example scenario, the human-computer dialogue system / application, the human-computer interaction model, and the search and decision model are deployed on three different servers.
[0056] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0057] Figure 2A flowchart illustrating a human-computer dialogue method provided for an exemplary embodiment of this application. Figure 2 As shown, the specific steps of this method are as follows:
[0058] Step S201: Obtain the query for this round and combine the results of this round of query with the historical queries from previous rounds as the query context.
[0059] This embodiment is applied to a multi-turn dialogue scenario. For the query entered by the user in the current turn (referred to as the current turn query), a search determination model is introduced. Based on the current turn query and the historical queries of previous turns, a search determination is made to determine whether the current turn query needs retrieval enhancement.
[0060] For any query in a multi-turn dialogue, if there is at least one previous query history, then in this step, the concatenation result of the current query and the previous queries is used as the query context. This query context includes the contextual relationships between queries in each turn of the dialogue, helping the model better understand the contextual relationships between queries, make better search decisions, and thus accurately determine whether the current query needs retrieval enhancement.
[0061] For example, when concatenating the current query with historical queries from previous rounds to obtain the query context, the historical queries from previous rounds can be concatenated with the current query in chronological order, and adjacent queries can be connected using a separator to obtain the query context. The separator is a special token used to separate adjacent queries, such as "[SEP]", and its specific configuration and adjustment can be made according to actual application needs and experience; no specific limitations are made here.
[0062] Optionally, a start marker (such as "[CLS]") can be appended to the beginning of the query context. This start marker indicates the starting position of the input query context. The specific start marker used can be configured and adjusted according to actual application needs and experience, and no specific restrictions are imposed here.
[0063] For example, for the previous two rounds of historical queries "Hello" and "Tomorrow's weather in city A", and the current round of query "What about city B?", the historical queries and the current round of query can be concatenated into the following query context: "[CLS]Hello[SEP]Tomorrow's weather in city A[SEP]What about city B?"
[0064] By concatenating historical queries from each round and the current round query in chronological order, and using a delimiter to separate adjacent queries, the contextual relationships between queries can be well preserved. This helps the model better understand the contextual relationships between queries and make more accurate search decisions. In this embodiment, during the multi-round dialogue process, the queries from each round are stored.
[0065] It should be noted that if this round of query is the user's first round of query, there are no previous rounds of historical queries, and the first round of query will be used as the query context.
[0066] Step S202: Input the query context into the search decision model to perform search decision, determine whether the current query needs retrieval enhancement, and obtain the search decision result.
[0067] After obtaining the query context, it is input into the search decision model. The model then determines whether the current query requires search enhancement and obtains the search decision result. This result can be either "the current query requires search enhancement" or "the current query does not require search enhancement."
[0068] The search decision model is a classification model trained using training data. The encoder of this classification model can be a machine learning model with a small parameter size, such as a BERT-based model, a GTE-based model, or other pre-trained models. Adding a classifier, such as a linear classifier or a multilayer perceptron, to the encoder yields the initial classification model. Training this initial classification model with training data results in the search decision model.
[0069] If the search result indicates that the current query does not require retrieval enhancement, then no retrieval enhancement is needed. Instead, the current query is directly input into the human-computer interaction model, which generates the response information for the current query. Retrieval enhancement is only performed when it is required, which reduces unnecessary retrieval enhancement, thereby reducing the waste of computing resources and lowering the operating cost of the human-computer dialogue system.
[0070] If the search result indicates that the current query requires retrieval enhancement, step S203 is executed to perform retrieval enhancement in order to search / retrieve knowledge / information that matches the current query and obtain enhanced retrieval results.
[0071] Step S203: If the search result indicates that the current query needs retrieval enhancement, perform retrieval enhancement based on the current query to obtain the enhanced retrieval result.
[0072] In this embodiment, if the search result indicates that the current query requires retrieval enhancement, retrieval enhancement is performed based on the current query to search / retrieve knowledge / information that matches the current query, thereby obtaining enhanced retrieval results.
[0073] Specifically, based on this round of queries, retrieval enhancement is performed to obtain enhanced retrieval results, including:
[0074] Retrieve knowledge matching the current query from a pre-built knowledge base; and / or perform an open-domain search based on the current query to obtain knowledge matching the current query.
[0075] Specifically, performing an open-domain search based on the current query to obtain knowledge matching the current query can be achieved in the following way:
[0076] The current query is used as input to call the search API (Application Programming Interface), enabling the platform providing open domain search services to perform an open domain search based on the current query and obtain knowledge matching the query. The search API is the server interface provided by the platform offering open domain search services.
[0077] In this embodiment, the method for constructing a knowledge base for retrieval enhancement generation (RAG) and performing enhanced retrieval based on the knowledge base can use any knowledge base-based retrieval enhancement generation RAG scheme; no specific limitation is made here. Furthermore, when enhancing the retrieval based on the current query in this step and obtaining the enhanced retrieval results, any existing retrieval enhancement generation RAG scheme can also be used; no specific limitation is made here.
[0078] Step S204: Generate response information for this round of queries based on the enhanced search results.
[0079] After obtaining the enhanced search results, the current query and the enhanced search results are input into the human-computer interaction model, which then generates the response information for the current query based on the enhanced search results.
[0080] Furthermore, the server outputs the response information of this round of queries to the user, realizing multi-round dialogue between the user and the human-computer dialogue system / application on the server.
[0081] For example, the server returns the response information for this round of queries to the endpoint device. The endpoint device then displays the response information for this round of queries to the user, thereby enabling multi-turn human-computer dialogue.
[0082] In this embodiment, during multi-turn dialogue, the concatenation result of the current query and historical queries from previous turns is used as the query context. This query context is input into a search determination model to determine whether the current query requires retrieval enhancement. If the search determination indicates that retrieval enhancement is needed, retrieval enhancement is performed based on the current query, and the response information for the current query is generated based on the enhanced retrieval results. By introducing a search determination model, based on historical queries from each turn and the current query, it accurately determines whether retrieval enhancement is needed in the current turn. When enhancement is required, it is performed, which not only reduces the phenomenon of "content illusion" and improves response accuracy but also reduces unnecessary retrieval enhancement, minimizes the waste of computational resources, and lowers the operating cost of the human-computer dialogue system.
[0083] The search decision model used in the above embodiments is a trained classification model, including an encoder and a classifier. The search decision model can be obtained by training the initial classification model using a training algorithm. The following embodiments provide a detailed explanation of the training process of the search decision model.
[0084] Figure 3 This is a flowchart illustrating a method for training a search decision model, as provided in an example embodiment of this application. Figure 3 As shown, the training process of the search decision model is as follows:
[0085] Step S301: Obtain training data. The training data includes input samples and search decision labels. The input samples include the concatenation results of the current query and the historical queries from previous rounds. The search decision labels are used to indicate whether retrieval enhancement is needed to generate the response to the current query.
[0086] In this embodiment, to train the search decision model, training data including input samples and search decision labels is constructed to obtain a training dataset. The input samples include the concatenated result of the current query and historical queries from previous rounds, with the specific concatenation scheme consistent with the concatenation scheme used to obtain the query context during multi-round dialogue in step S201.
[0087] In this step, a large amount of multi-turn dialogue data is first collected, and based on the collected multi-turn dialogue data, input samples and search judgment labels for the input samples are constructed.
[0088] For example, when collecting multi-turn dialogue data, one can collect real multi-turn dialogue data from human-computer dialogue systems / applications, or obtain real multi-turn dialogue data from other human-computer dialogue platforms (such as AI assistants).
[0089] Additionally, large-scale models can be used to construct multi-turn dialogue data. It's important to note that real-world multi-turn dialogue data typically includes multiple rounds of queries and responses. Multi-turn dialogue data constructed using large-scale models can include multiple rounds of queries and responses, or it can include only multiple rounds of queries without specifying the responses to each round.
[0090] Optionally, pre-configured dialogue topics (such as weather), output requirements, and dialogue templates are input into a large model. The large model's generation capabilities are then used to generate dialogue data around the given dialogue topic that meets the output requirements. The output requirements can limit the number of words in the output dialogue data; they can also require the generated dialogue data to maintain diversity and naturalness, avoiding overly mechanical or repetitive dialogue content. Dialogue templates define the format for a large amount of dialogue data, such as "[XX] What's the weather like tomorrow?", with the "[XX]" space filled with a location name. Multiple different dialogue topics (such as weather), output requirements, and dialogue templates can be pre-configured. When generating multi-turn dialogue data, dialogue topics, output requirements, and dialogue templates can be randomly selected and input into the large model to generate multi-turn dialogue data, resulting in a rich variety of multi-turn dialogue data.
[0091] Optionally, multiple initial queries can be pre-configured. These initial queries are input into a large model, which then generates subsequent multi-round queries based on them, obtaining multi-round query data. Alternatively, the initial queries can be input into a first large model, which generates the response based on the initial queries. The initial queries and responses can then be input into a second large model, which generates the second round of queries; the second round of queries can be input into the first large model, which generates the second round of responses. This process can continue, allowing multiple rounds of queries and responses to be generated from the large model.
[0092] For the acquired multi-turn dialogue data, at least one query can be extracted and used as the current query. The current query is then concatenated with the historical queries from previous turns to construct the input sample.
[0093] Optionally, for the constructed input samples, a large model can be used to evaluate whether the human-computer interaction model has the responsiveness to the input samples. If the human-computer interaction model has the responsiveness to the input samples, it means that even without retrieval augmentation, the human-computer interaction model can respond well to the input samples, and the search decision label of the input samples is set to the first label indicating that retrieval augmentation is not needed. If the human-computer interaction model does not have the responsiveness to the input samples, it means that without retrieval augmentation, the human-computer interaction model cannot respond well to the input samples, and the search decision label of the input samples is set to the second label indicating that retrieval augmentation is needed. Through automated annotation, manual intervention can be reduced, training datasets can be quickly generated and updated, thereby improving the scalability and iteration speed of the search decision model, enabling it to quickly adapt to the needs of different domains and scenarios.
[0094] The first and second tags differ; the first tag indicates that search enhancement is needed, while the second tag indicates that search enhancement is not needed. The specific values of the first and second tags can be configured and adjusted according to actual needs, and are not specifically limited here. For example, the first tag can be 1, and the second tag 0; or the first tag can be "true", and the second tag "false".
[0095] Optionally, the constructed input samples can be classified to determine their categories. Search decision labels corresponding to each category are then labeled according to human intent, and the search decision labels for the input samples are determined as the search decision labels corresponding to their respective categories. In this way, by combining human intent with the labeling of search decision labels for each category, only the search decision labels corresponding to different categories need to be labeled, eliminating the need to label each input sample individually. This reduces manual intervention, allows for rapid generation and updating of the training dataset, thereby improving the scalability and iteration speed of the search decision model, enabling it to quickly adapt to the needs of different domains and scenarios.
[0096] Optionally, for the constructed input samples, a strategy combining human-computer interaction model response capability assessment and human intention can be adopted to label the search judgment tags of the input samples, thereby improving the accuracy and rationality of data labeling. Subsequent embodiments will provide a detailed explanation of the strategy combining human-computer interaction model response capability assessment and human intention.
[0097] Step S302: Input the input sample into the classification model for classification prediction, and obtain the prediction result of whether retrieval enhancement is needed.
[0098] When training a classification model based on training data, the input sample is fed into the classification model. The classification model then predicts whether the input sample needs retrieval enhancement, that is, whether the current query in the input sample needs retrieval enhancement, and obtains the prediction result of the input sample.
[0099] Step S303: Based on the prediction results and the search decision labels of the input samples, adjust the parameters of the classification model to obtain the search decision model.
[0100] In this step, a loss function value is calculated based on the prediction result and the search decision label of the input sample. Based on the loss function value, the parameters of the classification model are adjusted through backpropagation to train the classification model. The trained classification model is then used as the search decision model.
[0101] It should be noted that the strategies used for training the classification model in this embodiment, including but not limited to the optimization algorithm, learning rate, batch size, etc., can be configured and adjusted according to the needs of the actual application scenario, and are not specifically limited here.
[0102] For example, with a training dataset of 100,000 or hundreds of thousands of data points, the learning rate can be set between 1e-5 and 2e-5. This smaller learning rate ensures that the model can fine-tune its parameters during training, thereby improving convergence and accuracy. The maximum length of the input data can be set to 512 tokens to support multi-turn dialogues. This length limit is primarily to ensure that the model receives sufficient contextual information when handling complex multi-turn dialogues, thus improving the accuracy of search decisions. The query context of the dialogue is crucial, encompassing not only the current query but also information and clues provided by previous queries. This information helps the model better understand the intent of the current query. Therefore, setting the maximum length to 512 tokens ensures applicability to most query scenarios. The batch size can be set to 32. Furthermore, to prevent overfitting, regularization techniques such as dropout and weight decay can be used. These regularization techniques effectively prevent the model from overfitting the training data, thereby improving its generalization ability on the test set. In addition, to further improve the model's performance, an adaptive learning rate optimization algorithm can be used, which can improve training speed while maintaining stability.
[0103] In practical applications, the constructed training data can be divided into training sets and test sets. The classification model can be continuously iterated and optimized through the training and test sets, so that the classification model can effectively learn and distinguish which queries need retrieval enhancement and which do not. The human-computer interaction model can answer directly, thereby achieving accurate search judgment for input samples.
[0104] This embodiment constructs training data including input samples and search decision labels. The input samples are then fed into a classification model for classification prediction, yielding a prediction result indicating whether retrieval enhancement is needed. Based on the prediction result and the search decision labels of the input samples, the parameters of the classification model are adjusted to obtain a search decision model, which improves the accuracy of search decision. During multi-turn dialogues, the search decision model determines whether enhanced retrieval is needed based on the current query and historical queries. This not only enables enhanced retrieval when necessary, improving the accuracy of the human-computer dialogue system's response, but also significantly reduces unnecessary retrieval enhancement, thereby lowering the operating costs and resource consumption of the human-computer dialogue system. The search decision model not only enhances the real-time information acquisition capability of the human-computer dialogue model, but also strengthens its context processing capability and open-ended problem-solving ability in multi-turn dialogues, enabling the human-computer dialogue model to flexibly respond to complex and changing user needs while maintaining efficient and accurate responses.
[0105] Figure 4A flowchart for constructing training data is provided for an exemplary embodiment of this application. In an optional embodiment, the specific implementation steps for constructing training data in step S301 are as follows:
[0106] Step S401: Based on the collected multi-turn dialogue data, construct an input sample containing the current query and historical queries from previous turns.
[0107] In this embodiment, after collecting a large amount of multi-turn dialogue data, for any given multi-turn dialogue data, at least one query can be extracted and used as the current query. The current query is then concatenated with historical queries from previous turns to construct an input sample. This process yields a large number of input samples.
[0108] After constructing the input samples, subsequent steps are used to label the input samples with search decision tags.
[0109] Step S402: Divide the input samples into a first sample with standard responses and a second sample without standard responses.
[0110] In this embodiment, the input samples are divided into two categories based on whether they have a standard response. Input samples with a standard response are designated as the first sample, and input samples without a standard response are designated as the second sample.
[0111] In one optional implementation of this step, the input samples can be divided into a first sample with a standard response and a second sample without a standard response, based on whether a standard response to the current query exists in the multi-turn dialogue data. Here, a standard response refers to a correctly labeled reply. For example, in practical applications, there exists a labeled multi-turn dialogue dataset, which includes multiple rounds of queries and the standard responses to each round.
[0112] In another optional implementation of this step, the input samples are classified into domains to determine the domain category corresponding to each input sample. Input samples belonging to the knowledge category typically have a standard answer. Input samples belonging to the knowledge category are considered the first samples with a standard answer. Input samples belonging to a different domain category are considered the second samples without a standard answer.
[0113] In multi-turn dialogue scenarios, domain classification primarily refers to categorizing dialogues based on the knowledge domain or application scenario to which the dialogue content belongs. This classification helps human-computer interaction models more accurately understand user intentions and needs, and provide more precise and useful responses. For example, domain categories may include, but are not limited to: real-time, knowledge-based, casual conversation, text processing, mathematics, code, literature, and technology. The set of domain categories can be configured according to actual application needs and experience; commonly used sets of domain categories can be used, and this embodiment does not impose specific limitations. Furthermore, domain categories can be further subdivided into multiple subcategories. For example, the real-time category may include subcategories such as weather, travel, and news; the text processing category may include translation, creation, and rewriting.
[0114] When performing domain classification on input samples and determining the domain category corresponding to each input sample, a pre-trained large language model is used to perform domain classification on the input samples. Optionally, a domain classification prompt template is pre-configured. This prompt template includes a task description that instructs the large language model to perform domain classification on the input samples and determine the corresponding domain category. The prompt template also includes a configured set of domain categories and the padding positions for the input samples.
[0115] When classifying the input sample into a domain, the input sample is filled into the corresponding filling position in the domain classification prompt template to obtain domain classification prompt information. The domain classification prompt information is then input into the large language model, which determines the domain category of the input sample based on the prompt information.
[0116] Optionally, the domain classification prompt template includes not only the task description, the set of configured domain categories, and the padding positions for the input samples, but also descriptions and examples of one or more subcategories under each domain category. The task description requires the large language model to determine the domain category of the input sample and to specify the subcategory to which the input sample belongs within that domain category.
[0117] In one optional embodiment, to enhance the diversity of data across different domain categories, a rule-based approach combined with large language models can be used to construct some input samples. For domain categories with a small number of input samples, generation rules for input samples within that domain category can be configured, including but not limited to dialogue topics, output requirements, and sample templates. This ensures that the number of input samples across various domain categories meets the data ratio requirements for different domain categories. The data ratio requirements for different domain categories specify the proportion range of samples within each domain category. By setting generation rules and utilizing large language models to generate sample data, the diversity of various samples can be rapidly increased, helping to improve the model's performance in specific knowledge domains. For example, for certain specific knowledge domains (such as law and medicine), by sorting out a large number of related knowledge points, formulating detailed generation rules, and then combining them with large language models to generate richer and more diverse sample data, the training dataset can be rapidly expanded. This strategy is particularly important for rapidly improving the model's accuracy and performance in certain specific domains.
[0118] The output requirements can limit the number of words in the output dialogue data, require the generated dialogue data to maintain diversity and naturalness, and avoid generating overly mechanical or repetitive dialogue content. The sample template specifies the format for a large amount of dialogue data, such as "[XX] How's the weather tomorrow?", with the "[XX]" space filled with the region name.
[0119] For example, various dialogue topics (such as weather, travel, etc.), output requirements, and sample templates under each domain category are pre-configured. When generating input samples for any domain category, dialogue topics, output requirements, and sample templates under that domain category can be randomly selected and input into the large model to generate input samples containing multi-turn queries, thus obtaining a rich variety of input samples. Specifically, the dialogue topics, output requirements, and sample templates under that domain category are input into the large model, and the large model's generation capabilities are used to generate multi-turn queries around a given dialogue subject that meet the output requirements.
[0120] To quickly respond to the needs of different domains and scenarios, this embodiment provides a data augmentation mechanism based on rules and LLM generation, which can generate a large amount of diverse sample data in a short time, covering multiple domains. During the training process of the search decision model, this data augmentation mechanism can be used in each model iteration to obtain rich and diverse new training data. Training based on rich and diverse new training data can significantly shorten the iteration cycle, enabling the model to quickly adapt to dynamic changes in needs.
[0121] Step S403: For the first sample in the input samples that has a standard response, determine the search judgment label of the first sample based on whether the human-computer interaction model can respond correctly to the first sample.
[0122] When labeling the search judgment tags of the input samples, for the first sample with a standard response, it is determined whether the first sample needs search enhancement by judging whether the human-computer interaction model can respond correctly to the first sample, that is, by evaluating whether the human-computer interaction model has the ability to respond correctly to the current query in the first sample.
[0123] For the first sample that the human-computer interaction model can respond correctly, the model itself has the ability to respond correctly to the current query in the first sample. Even without retrieval enhancement, the model can generate the correct response for the first sample based on its learned knowledge. Therefore, these first samples do not require retrieval enhancement, and their search decision labels are set to the first label. Here, the first label indicates that retrieval enhancement is not required.
[0124] For the first sample that the human-computer interaction model cannot respond correctly, the model itself lacks the ability to correctly respond to the current query in the first sample and requires retrieval enhancement. The human-computer interaction model can only generate a correct response to the first sample based on the retrieval enhancement results. Therefore, these first samples can be confirmed to require retrieval enhancement, and their search judgment labels are set to the second label. Here, the second label indicates that retrieval enhancement is needed.
[0125] Optionally, determining whether the human-computer interaction model can correctly respond to the first sample can be achieved in the following way:
[0126] The first sample is input into the human-computer interaction model, which generates a predicted response for that sample. The first sample, its predicted response, and the standard response are then input into a response evaluation model. This model determines whether the predicted response correctly addresses the first sample. If the predicted response correctly addresses the first sample, the human-computer interaction model is deemed to respond correctly. If the predicted response does not correctly address the first sample, the human-computer interaction model is deemed to fail to respond correctly.
[0127] 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. This model can determine whether the predicted response to the input query correctly answers the input query based on the input query and its standard response.
[0128] Optionally, determining whether the human-computer interaction model can correctly respond to the first sample can be achieved in the following way:
[0129] The first sample is input into the human-computer interaction model, which generates a predicted response for the first sample. The first sample, its predicted response, and the standard response are then input into a response quality assessment model, which generates a quality assessment value for the predicted response. If the quality assessment value of the predicted response is greater than or equal to the quality assessment threshold, the human-computer interaction model is determined to have correctly responded to the first sample. If the quality assessment value of the predicted response is less than the quality threshold, the human-computer interaction model is determined to have not correctly responded to the first sample.
[0130] The response quality assessment model can be obtained by training a large language model or a machine learning model, or by using an existing model for assessing the response quality of human-computer interaction models. The response quality assessment model is obtained by fine-tuning the large language model or machine learning model. This model has the ability to evaluate the response quality of the predicted response to an input query based on the input query and its standard response.
[0131] In this embodiment, for the first sample in the input samples that has a standard response, the human-computer interaction model is evaluated to determine whether it can correctly respond to the first sample. For the first sample that the human-computer interaction model can respond correctly, the search decision label is set as the first label; for the first sample that the human-computer interaction model cannot respond correctly, the search decision label is set as the second label. Through automated annotation, manual intervention can be reduced, and the training dataset can be quickly generated and updated, thereby improving the scalability and iteration speed of the search decision model and enabling it to quickly adapt to the needs of different fields and scenarios.
[0132] Step S404: For the second sample in the input samples that does not have a standard answer, determine the search decision label of the second sample according to the category of the second sample and the search decision labels corresponding to each category.
[0133] When labeling the search decision labels of input samples, for second samples that do not have standard answers, the search decision labels of the second samples are set to the search decision labels corresponding to the categories of the second samples by configuring the search decision labels corresponding to each category. This enables batch labeling of second samples by category without labeling each input sample separately, which can reduce manual intervention, quickly generate and update training datasets, thereby improving the scalability and iteration speed of the search decision model and enabling it to quickly adapt to the needs of different fields and scenarios.
[0134] For example, the server outputs a front-end configuration interface, and through this interface, it outputs a set of categories for the second sample. The front-end configuration interface is used to configure the search decision tags corresponding to each category in the category set. Additionally, the front-end configuration interface can also output examples of the second sample for each category, allowing relevant annotators to configure (i.e., annotate) the search decision tags corresponding to each category based on these examples. After configuring the search decision tags for each category, the configured search decision tags for 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 retrieves the search decision tags for each category configured within the front-end configuration interface. The configuration submission operation on the front-end configuration interface can be an operation such as clicking the "Submit" or "Save" controls on the front-end configuration interface.
[0135] In one optional implementation of this step, the domain category and subcategory of the second sample can be determined. By configuring the search decision label corresponding to each subcategory, the search decision label of the second sample is set to the search decision label corresponding to the subcategory of the second sample, realizing batch labeling of the second sample by subcategory. Compared with labeling by domain category, labeling by more refined subcategory can improve the accuracy of the search decision label of the second sample. Moreover, it eliminates the need to label each input sample separately, reducing manual intervention, and quickly generating and updating the training dataset, thereby improving the scalability and iteration speed of the search decision model, enabling it to quickly adapt to the needs of different domains and scenarios.
[0136] For example, the server outputs a front-end configuration interface, which displays domain categories and their subcategories. The front-end configuration interface is used to configure the search decision tags corresponding to each subcategory under each domain category. Additionally, the front-end configuration interface can also output examples of second samples for each subcategory, allowing relevant annotators to configure (i.e., annotate) the search decision tags corresponding to each subcategory based on these examples. After configuring the search decision tags for each subcategory, the configured search decision tags are submitted to the server via 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 retrieves the search decision tags for each subcategory configured within the front-end configuration interface. The configuration submission operation on the front-end configuration interface can be an action such as clicking the "Submit" or "Save" controls on the interface.
[0137] In this step, for the second sample in the input samples that does not have a standard answer, the search decision label corresponding to the sub-category of the second sample is used as the search decision label of the second sample according to the search decision label corresponding to each sub-category configured.
[0138] This embodiment constructs input samples containing the current query and historical queries from previous rounds based on collected multi-turn dialogue data. For the first sample with a standard response, the search decision label is determined based on whether the human-computer interaction model can respond correctly to the first sample. For the second sample without a standard response, the search decision label is determined based on the category of the second sample and the configured search decision labels corresponding to each category. This data annotation method combines human-computer interaction model response capability evaluation with human intention to annotate the search decision labels of input samples. This reduces manual intervention and costs, and can quickly adapt to the model's capabilities and actual human needs, making the data annotation more consistent with the model training objectives and improving the accuracy and rationality of data annotation.
[0139] In an optional embodiment, the specific implementation steps for constructing training data in step S301 are as follows:
[0140] Based on the collected multi-turn dialogue data, an input sample containing the current query and historical queries from previous turns is constructed; the input samples are classified by domain to determine the domain category and subcategory corresponding to each input sample.
[0141] The input sample categorized as knowledge is used as the first sample, and a standard response is obtained for the first sample. Based on the first sample and the labeled response, it is determined whether the human-computer interaction model can correctly respond to the first sample. The search decision label for the first sample that the human-computer interaction model cannot respond to correctly is set as the first label. The search decision label for the first sample that the human-computer interaction model can respond to correctly is set as the second label. Here, the first label indicates that search enhancement is needed, and the second label indicates that search enhancement is not needed. For the specific implementation principle, please refer to the relevant content of step S403 above, which will not be repeated here.
[0142] Optionally, input samples whose domain category is not knowledge-based, such as real-time or casual chat, are used as second samples. Based on the configured search decision tags for each domain category, the search decision tags corresponding to the domain category of the second sample are used as the search decision tags for the second sample. For example, real-time can be configured to correspond to the first tag, and casual chat to the second tag; the search decision tags for real-time input samples are labeled as the first tag, and the search decision tags for casual chat input samples are labeled as the second tag.
[0143] Optionally, input samples whose domain category is not knowledge-based, such as real-time or casual chat, are used as second samples. Based on the configured search decision tags for each subcategory, the search decision tags corresponding to the subcategories of the second sample are used as the search decision tags for the second sample. Compared to labeling by domain category, labeling by more refined subcategories can improve the accuracy of the search decision tags for the second sample. For the specific implementation principle, please refer to the relevant content in step S404 above, which will not be repeated here.
[0144] The method in this embodiment divides the input samples into domain categories and subcategories at multiple levels. Based on the domain category, knowledge-based input samples are designated as first samples, and non-knowledge-based input samples as second samples. For the knowledge-based first sample, the search decision label is determined based on whether the human-computer interaction model can respond correctly. For the non-knowledge-based second sample, the search decision label corresponding to the subcategories of the second sample is used as the search decision label for the second sample, based on the configured search decision labels for each subcategory. This data annotation method combines human-computer interaction model response capability assessment with human intention to annotate the search decision labels of input samples. This reduces manual intervention and costs, and quickly adapts to the model's capabilities and actual human needs, making the data annotation more aligned with the model training objectives and improving the accuracy and rationality of the data annotation.
[0145] In practical applications, online user queries involve multiple domains, ranging from extremely broad to complex. Traditional manual data annotation is extremely costly. This solution automatically classifies input samples into domains using a large language model, and then further annotates whether input samples in each domain category require retrieval enhancement (i.e., search determination) through model capability testing and human opinion assessment. This hierarchical classification and annotation method ensures that each input sample can be accurately determined for search, obtaining the most suitable processing solution, thereby improving the ability and efficiency of the human-computer dialogue system in handling complex user requests.
[0146] Figure 5 This is a diagram illustrating a search-determination-based retrieval enhancement architecture provided for an exemplary embodiment of this application. (See diagram for details.) Figure 5As shown, during the training process of the search decision model, input samples are constructed based on the multi-turn dialogue data obtained from the search. A large language model is used to perform multi-level domain classification on the input samples to determine their domain categories. For domain categories with a small number of samples, data augmentation can be performed using rule-based and large language model generation methods to obtain richer and more diverse input samples within that domain category, ensuring that the input samples for each domain category meet the data matching requirements. For the input samples, a strategy combining human-computer interaction model response capability evaluation (i.e., model capability evaluation) and human intent is adopted to label the search decision tags of the input samples, improving the accuracy and rationality of data labeling. Utilizing a large model to classify the input samples by domain, combined with human intent and a data generation scheme based on rules and LLM, a comprehensive and finely divided training dataset can be constructed quickly and efficiently. This not only provides data support for the accuracy of the search decision model in different scenarios but also improves the adaptability and generalization ability of the search decision model in various query scenarios.
[0147] Furthermore, the search decision model (including the encoder and classifier) is fine-tuned based on the constructed training data to obtain a fully trained search decision model. During multi-turn dialogues, the concatenation result of the current query and the historical queries from previous turns is used as the query context and input into the trained search decision model for search decision to determine whether the current query requires retrieval enhancement. If the search decision indicates that retrieval enhancement is required, Retrieval Enhancement Generation (RAG) is performed to enhance the retrieval, and the response information for the current query is generated by the human-computer interaction model based on the retrieval enhancement result. If the search decision indicates that retrieval enhancement is not required, no retrieval enhancement is performed, and the current query is directly input into the human-computer interaction model to generate the response information for the current query.
[0148] For example, Figure 5 Taking the following multi-turn dialogue as an example: the previous two rounds' historical queries were "Hello" and "Tomorrow's weather in city A," and the current round's query is "What about city B?". The historical queries and the current round's query are concatenated into the following query context: "[CLS]Hello [SEP]Tomorrow's weather in city A [SEP]What about city B?". This query context is then input into the search decision model for search determination. Using this multi-turn dialogue as an example, if the search decision result indicates that retrieval enhancement is needed, then Retrieval Enhancement Generation (RAG) is performed, and the response information for this round's query is generated based on the retrieval enhancement result, such as... Figure 5The response information shown, "Based on recent information, the weather in City B on [date] is as follows: Current weather: light rain; humidity: 63%...", adequately answers the current query. If the search result indicates that retrieval enhancement is not needed, then no retrieval enhancement is performed, and the current query is directly input into the human-computer interaction model. The human-computer interaction model (utilizing its multi-turn dialogue capabilities) generates the response information for this round of query, such as... Figure 5 The message, "Sorry, I cannot access the internet in real time and provide current weather information. You can use a weather forecast app...", clearly fails to answer this query and is not a satisfactory response.
[0149] This solution enriches sample data across various domains by combining rule-based and LLM generation capabilities. It employs a method that integrates human intent and model capability evaluation for data annotation, significantly reducing maintenance and development costs and improving model performance in open-domain question answering. Automated annotation and batch category annotation mechanisms reduce manual intervention, enabling rapid generation and updating of training datasets, thereby enhancing model scalability and iteration speed. Simultaneously, leveraging the powerful language understanding and generation capabilities of the search-decision model enhances the human-computer interaction model's ability to handle contextual issues in multi-turn dialogues and solve open-ended questions. This combination of multiple technologies enables the human-computer dialogue system to not only flexibly respond to complex and changing user needs but also maintain efficient and accurate responses.
[0150] Compared to using a large language model to determine whether retrieval augmentation should be performed, this solution uses a smaller-scale search decision model, reducing the computational complexity of search decision-making and meeting the needs of applications with high real-time requirements. It also significantly reduces the cost of computing resources, especially demonstrating a clear advantage when handling high-concurrency requests. Simultaneously, automated annotation and batch category annotation mechanisms ensure high-quality training data, enhancing the model's stability and reliability. Through rule-based and large language model-generated data augmentation mechanisms and automated annotation technology, rapid iteration and updates are achieved, enabling quick adaptation to the needs of different domains and scenarios. Overall, this solution achieves low cost, high scalability, strong context processing capabilities, and high real-time performance, demonstrating superior flexibility and intelligence in practical applications.
[0151] Figure 6 This application provides another exemplary embodiment of a human-computer dialogue method. The executing entity in this embodiment is a server running a search decision model, i.e., a search decision server. For example... Figure 6 As shown, the specific steps of this method are as follows:
[0152] Step S601: In response to the call request to the search decision model, obtain the current query and the historical queries of previous rounds.
[0153] In this embodiment, the search decision server provides a search decision service interface, such as the API of the search decision model, to the human-computer dialogue system. The human-computer dialogue system uses this search decision service interface to call the search decision model to perform search decisions.
[0154] During the multi-round dialogue between the user and the human-computer dialogue system, when the human-computer dialogue system receives the current query input by the user (i.e. the query of this round), the human-computer dialogue system obtains the historical queries of previous rounds and sends a call request to the search decision server for the search decision model. This call request includes the query of this round and the historical queries of previous rounds.
[0155] In response to receiving a call request for the search decision model, the search decision server retrieves the current query and historical queries from previous rounds of the multi-round dialogue.
[0156] Step S602: Use the concatenation result of the historical queries from previous rounds and the current query as the query context.
[0157] In this step, the search decision server concatenates the current query with historical queries from previous rounds to obtain the query context. For example, historical queries from previous rounds are concatenated with the current query in chronological order, and adjacent queries are connected using a separator to obtain the query context. The separator is a special token used to separate adjacent queries, such as "[SEP]", and its specific configuration and adjustment can be made according to actual application needs and experience; no specific limitations are made here.
[0158] Optionally, a start marker (such as "[CLS]") can be appended to the beginning of the query context. This start marker indicates the starting position of the input query context. The specific start marker used can be configured and adjusted according to actual application needs and experience, and no specific restrictions are imposed here.
[0159] For example, for the previous two rounds of historical queries "Hello" and "Tomorrow's weather in city A", and the current round of query "What about city B?", the historical queries and the current round of query can be concatenated into the following query context: "[CLS]Hello[SEP]Tomorrow's weather in city A[SEP]What about city B?"
[0160] By concatenating historical queries from each round and the current round query in chronological order, and using a delimiter to separate adjacent queries, the contextual relationships between queries can be well preserved. This helps the model better understand the contextual relationships between queries and make more accurate search decisions. In this embodiment, during the multi-round dialogue process, the queries from each round are stored.
[0161] It should be noted that if this round of query is the user's first round of query, there are no previous rounds of historical queries, and the first round of query will be used as the query context.
[0162] Step S603: Input the query context into the search decision model to perform search decision and obtain the search decision result. The search decision result indicates whether the current query needs retrieval enhancement.
[0163] After obtaining the query context, the search decision server inputs the query context into the search decision model, which then determines whether the query needs retrieval enhancement and obtains the search decision result.
[0164] In this embodiment, the training process of the search decision model includes: acquiring training data, which includes input samples and search decision labels. The input samples include the concatenation result of the current query and historical queries from previous rounds. The search decision labels are used to indicate whether retrieval enhancement is needed to generate the response to the current query; inputting the input samples into a classification model for classification prediction to obtain a prediction result indicating whether retrieval enhancement is needed; and adjusting the parameters of the classification model based on the prediction result and the search decision labels of the input samples to obtain the search decision model. For details on the training process and technical effects of the search decision model in this embodiment, please refer to the relevant content on the training of the search decision model in the foregoing embodiments, which will not be repeated here.
[0165] Step S604: Return the search result.
[0166] After obtaining the search results, the search decision server returns the search results to the human-computer dialogue system.
[0167] If the search results indicate that the current query requires enhancement, the human-computer dialogue system enhances the query based on the current query, obtaining enhanced search results. Further, the system uses the enhanced search results and the current query as input parameters, calls the human-computer interaction model, and the model generates response information for the current query based on the enhanced search results, returning this response information to the system. The system then outputs the response information for the current query to the user.
[0168] If the search results indicate that no retrieval enhancement is needed for this round of query, the human-computer dialogue system uses this round of query as input parameter, calls the human-computer interaction model, generates response information for this round of query through the human-computer interaction model, and returns the response information for this round of query to the human-computer dialogue system. The human-computer dialogue system then outputs the response information for this round of query to the user.
[0169] In this embodiment, during multi-turn dialogue, the concatenated result of the current query and historical queries from previous turns is used as the query context. This query context is then input into a search determination model to determine whether the current query requires retrieval enhancement. If the search determination indicates that retrieval enhancement is needed, the human-computer dialogue system performs retrieval enhancement based on the current query and generates response information for that round based on the enhanced results. By introducing a search determination model, which accurately determines whether retrieval enhancement is needed based on historical queries from previous turns and the current query, and performs enhancement when necessary, this not only reduces the phenomenon of "content illusion" and improves the accuracy of human-computer dialogue responses, but also reduces unnecessary retrieval enhancement, minimizes the waste of computational resources, and lowers the operating cost of the human-computer dialogue system.
[0170] Figure 7 A flowchart illustrating the interaction of a multi-turn dialogue, provided as another exemplary embodiment of this application. (See attached flowchart.) Figure 7 As shown, the specific steps of this method are as follows:
[0171] Step S701: The human-computer dialogue system receives the query in this round.
[0172] Step S702: The human-computer dialogue system obtains the historical queries from previous rounds.
[0173] Step S703: The human-computer dialogue system sends a request to the search decision server to invoke the search decision model. The request includes the current query and the historical queries from previous rounds.
[0174] Step S704: In response to the call request to the search decision model, the search decision server obtains the current query and the historical queries from previous rounds of the multi-round dialogue.
[0175] Step S705: The search decision server uses the concatenation result of the historical queries from previous rounds and the current query as the query context.
[0176] Step S706: The search decision server inputs the query context into the search decision model to make a search decision and obtains the search decision result. The search decision result indicates whether the current query needs retrieval enhancement.
[0177] Step S707: The search judgment server returns the search judgment result to the human-computer dialogue system.
[0178] Step S708: The human-computer dialogue system determines whether retrieval enhancement is needed for this round of query based on the search results.
[0179] Step S709: If the search result indicates that the current query requires retrieval enhancement, the human-computer dialogue system performs retrieval enhancement based on the current query and obtains the enhanced retrieval result.
[0180] Step S710: The human-computer dialogue system inputs the enhanced search results and the current query into the human-computer interaction model, and generates the response information for the current query based on the enhanced search results through the human-computer interaction model.
[0181] Step S711: If the search result indicates that the current query does not require retrieval enhancement, the human-computer dialogue system inputs the current query into the human-computer interaction model, and generates the response information for the current query through the human-computer interaction model.
[0182] Step S712: The human-computer dialogue system outputs the response information for this round of queries.
[0183] The specific implementation principles and technical effects of each step in this embodiment are described in the relevant content of the foregoing embodiments, and will not be repeated here.
[0184] Figure 8 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Figure 8 As shown, the server includes a memory 801 and a processor 802. The memory 801 stores computer-executable instructions and can be configured to store various other data to support operations on the server. The processor 802 is communicatively connected to the memory 801 and executes the computer-executable instructions stored in the memory 801 to implement the technical solutions provided in any of the above method embodiments. Their specific functions and the technical effects they achieve are similar and will not be repeated here.
[0185] Optional, such as Figure 8 As shown, the server also includes other components such as a firewall 803, a load balancer 804, a communication component 805, and a power supply component 806. Figure 8 The diagram only shows a portion of the components and does not imply that the server only includes... Figure 8 The components shown. Figure 8 This example uses a cloud server deployed in the cloud as an example, but the server can also be deployed locally. This embodiment does not make any specific limitations here.
[0186] This application also provides a computer-readable storage medium storing computer-executable instructions. When a processor executes the computer-executable instructions, it implements the method of any of the foregoing embodiments. The specific functions and technical effects to be achieved are not described here.
[0187] This application also provides a computer program product, including a computer program that, 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 the server can read the computer program from the readable storage medium. The execution of the computer program by the at least one processor causes the server to perform the technical solution provided in any of the above method embodiments. The specific functions and the technical effects that can be achieved are not described here.
[0188] This application provides a chip, including a processing module and a communication interface. The processing module is capable of executing the technical solution of the server in the aforementioned method embodiments. Optionally, the chip further includes a storage module (e.g., a memory), which stores instructions. The processing module executes the instructions stored in the storage module, and the execution of the instructions stored in the storage module causes the processing module to execute the technical solution provided in any of the aforementioned method embodiments.
[0189] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application.
[0190] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), or other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules from at least one processor.
[0191] The memory may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.
[0192] The aforementioned storage device can be object storage service (OSS).
[0193] The aforementioned memory can be implemented by any type of volatile or non-volatile storage device 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 storage, flash memory, magnetic disk, or optical disk.
[0194] The aforementioned communication components are configured to facilitate wired or wireless communication between the device containing the communication components and other devices. The device containing the communication components 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), or combinations thereof. In one exemplary embodiment, the communication components receive broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication components also include a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be based on Radio Frequency Identification (RFID), infrared, Ultra Wide Band (UWB), Bluetooth, and other technologies.
[0195] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.
[0196] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device 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 storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.
[0197] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. The processor and storage medium can reside within an application-specific integrated circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components within an electronic device or host device.
[0198] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0199] The order of the embodiments described above is merely for illustrative purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, some processes described in the above embodiments and accompanying drawings include multiple operations appearing in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or may be executed in parallel. The sequence numbers are merely used to distinguish different operations, and the sequence numbers themselves do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the descriptions such as "first," "second," etc., in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types. "Multiple" means two or more, unless otherwise explicitly specified.
[0200] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of the various embodiments of this application.
[0201] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0202] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A human-computer dialogue method, characterized in that, include: Get the input query for this round; The concatenation result of the current query and the historical queries from previous rounds is used as the query context; The query context is input into the search decision model for search decision, to determine whether the current query needs retrieval enhancement, and to obtain the search decision result. If the search result indicates that the current query requires retrieval enhancement, retrieval enhancement is performed based on the current query to obtain enhanced retrieval results. Based on the enhanced search results, the response information for this round of queries is generated.
2. The method according to claim 1, characterized in that, Also includes: If the search result indicates that the current query does not require retrieval enhancement, the current query is input into the human-computer interaction model, and the response information for the current query is generated through the human-computer interaction model.
3. The method according to claim 1, characterized in that, The step of concatenating the current query with historical queries from previous rounds as the query context includes: By concatenating the historical queries from previous rounds with the current query in chronological order, and using a separator to connect adjacent rounds of queries, the query context is obtained.
4. The method according to claim 1, characterized in that, The step of generating response information for this round of queries based on the enhanced search results includes: The current query and the enhanced retrieval results are input into the human-computer interaction model, which then generates response information for the current query based on the enhanced retrieval results.
5. The method according to any one of claims 1-4, characterized in that, The training process of the search decision model includes: Acquire training data, which includes: input samples and search decision labels. The input samples include the concatenation result of the current query and the historical queries of previous rounds. The search decision labels are used to indicate whether retrieval enhancement is needed to generate the response to the current query. The input sample is fed into the classification model for classification prediction to obtain a prediction result on whether retrieval enhancement is needed; Based on the prediction results and the search decision labels of the input samples, the parameters of the classification model are adjusted to obtain the search decision model.
6. The method according to claim 5, characterized in that, The acquisition of training data includes: Based on the collected multi-turn dialogue data, an input sample containing the current query and historical queries from previous turns is constructed; For the first sample among the input samples that has a standard response, the search judgment tag of the first sample is determined based on whether the human-computer interaction model can respond correctly to the first sample; For a second sample in the input samples that does not have a standard response, the search decision label of the second sample is determined according to the category of the second sample and the search decision labels corresponding to each category.
7. The method according to claim 6, characterized in that, Also includes: The input sample is classified into domains to determine the domain category and subcategory corresponding to the input sample, wherein at least one domain category includes one or more subcategories; Input samples categorized as knowledge-based are used as the first samples with standard responses. Input samples whose domain category is not a knowledge category are treated as second samples that do not have a standard response.
8. The method according to claim 7, characterized in that, The step of determining the search determination label of the second sample based on its category and the configured search determination labels corresponding to each category includes: Based on the search decision tags corresponding to each configured sub-category, the search decision tags corresponding to the sub-category of the second sample are used as the search decision tags of the second sample.
9. The method according to claim 7, characterized in that, Also includes: The front-end configuration interface outputs each domain category and the subcategories contained in each domain category. The front-end configuration interface is used to configure the search judgment tags corresponding to each subcategory. In response to the configuration submission operation of the front-end configuration interface, the search judgment tags corresponding to each sub-category configured in the front-end configuration interface are obtained.
10. The method according to claim 6, characterized in that, The step of determining the search judgment label of the first sample based on whether the human-computer interaction model can correctly respond to the first sample includes: Determine whether the human-computer interaction model can respond correctly to the first sample; For the first sample that the human-computer interaction model can respond correctly, the search judgment label is set to the first label, which indicates that no search enhancement is needed; For the first sample that the human-computer interaction model cannot respond correctly, the search judgment label is set to the second label, which indicates that retrieval enhancement is required.
11. The method according to claim 10, characterized in that, The determination of whether the human-computer interaction model can correctly respond to the first sample includes: The first sample is input into the human-computer interaction model, and the predicted response of the first sample is generated through the human-computer interaction model; The first sample, the predicted response of the first sample, and the standard response are input into the response evaluation model, and the response evaluation model is used to determine whether the predicted response correctly responds to the first sample. If the predicted response correctly responds to the first sample, then 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, then it is determined that the human-computer interaction model cannot correctly respond to the first sample.
12. A human-computer dialogue method, characterized in that, include: In response to a request to invoke the search decision model, retrieve the current query and historical queries from previous rounds; The concatenation result of previous rounds of historical queries and the current round of queries is used as the query context; The query context is input into the search decision model for search decision, and the search decision result is obtained. The search decision result indicates whether the current query needs retrieval enhancement. Return the search result.
13. The method according to claim 12, characterized in that, The training process of the search decision model includes: Acquire training data, which includes: input samples and search decision labels. The input samples include the concatenation result of the current query and the historical queries of previous rounds. The search decision labels are used to indicate whether retrieval enhancement is needed to generate the response to the current query. The input sample is fed into the classification model for classification prediction to obtain a prediction result on whether retrieval enhancement is needed; Based on the prediction results and the search decision labels of the input samples, the parameters of the classification model are adjusted to obtain the search decision model.
14. A server, characterized in that, include: At least one processor; as well as A memory that is communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, cause the server to perform the method according to any one of claims 1-13.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1-13.
16. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-13.