Dialogue processing method and device based on large model and intelligent agent
Through the large-model-based dialogue processing method, sample data is generated and updated, and the problem of insufficient quality response of smart assistants in complex scenarios is solved, achieving more efficient user needs satisfaction and experience optimization.
Patent Information
- Application Number
- CN202411277040.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-17
AI Technical Summary
Existing smart assistants are difficult to meet the needs of diverse users in complex and changeable corporate office scenarios, resulting in insufficient quality and efficiency of their reply, and they cannot effectively improve conversation processing capabilities through existing sample data training models.
A large model-based dialogue processing method is proposed. By obtaining target service information, generating input statement sets, using multiple models to generate candidate answers, and filtering sample data based on scoring thresholds, which is used to train and update the model to improve the reply of the smart assistant quality.
By building high-quality sample data and model updates, smart assistants can better meet user needs in different scenarios, improve the quality and efficiency of reply, and optimize user experience.
Smart Images

Figure CN119150992A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to the field of artificial intelligence technology such as natural language processing, big models, and deep learning, and specifically to a big model-based dialogue processing method, device, and intelligent agent. Background Art
[0002] In corporate office scenarios, intelligent assistants can provide users with a variety of answers to questions and decision-making support to assist users in their work and improve efficiency. However, as the environment becomes increasingly complex and changeable, users' functional requirements for intelligent assistants are becoming more diverse. Therefore, it is necessary to build corresponding sample data to improve the intelligent assistant's ability to respond to different needs and improve the user experience. Summary of the invention
[0003] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.
[0004] To this end, the purpose of the present invention is to propose a dialogue processing method, device and intelligent agent based on a large model, so as to build sample data corresponding to different services to train and update the existing model, so that during dialogue processing, the corresponding model can be called to generate reply statements for the user's query statements, thereby improving the reply quality of the intelligent assistant.
[0005] According to a first aspect of the present disclosure, a method for generating sample data based on a large model is provided, comprising:
[0006] Obtaining a sample data generation request, wherein the generation request includes information of a target service corresponding to the sample data to be generated;
[0007] Generate an input statement set according to the information of the target service, wherein the input statement set includes a first input statement group associated with the target service and a second input statement group unrelated to the target service;
[0008] Generate, using the first model, at least two candidate answers corresponding to each input sentence in the input sentence set;
[0009] determining a score for each of the candidate answers based on at least two second models;
[0010] Sample data is obtained, wherein the sample data includes: the candidate answers whose scores satisfy the scoring threshold, the input sentences corresponding to the candidate answers whose scores satisfy the scoring threshold, and the target service information.
[0011] According to a second aspect of the present disclosure, a model updating method is provided, comprising:
[0012] Based on the target service information, training data is obtained from a sample database, wherein the data in the sample database is obtained by using the method for generating sample data based on a large model as in the first aspect of the embodiment;
[0013] Determine the training data including the input sentences belonging to the first input sentence group as positive sample data;
[0014] Determine the training data including the input sentences belonging to the second input sentence group as negative sample data;
[0015] The target model corresponding to the model target service information is updated using the positive sample data and the negative sample data.
[0016] According to a third aspect of the present disclosure, a dialog processing method is provided, including:
[0017] Receive query statements;
[0018] Based on a second prompt template associated with a third model, the query statement is input into the third model to obtain a first output result, wherein the third model is used to determine a target model that responds to the query statement from candidate models, and the candidate models include a model trained using sample data generated by an embodiment of the first aspect;
[0019] When the first result includes a candidate model and the execution condition is met, the query statement is input into the candidate model based on the third prompt template associated with the candidate model to obtain a reply statement corresponding to the query statement.
[0020] According to a fourth aspect of the present disclosure, a dialogue processing agent system is provided, comprising:
[0021] Input module, used to obtain query statements;
[0022] A processing module, used to determine a target task based on the query statement, and based on the target task, determine a target agent from a first agent library, and trigger a second agent to call the target agent; when the second agent determines that the calling condition of the target agent is met, the second agent calls the target agent to obtain a reply statement corresponding to the query statement generated by the target agent, wherein at least one of the target agent and the second agent is configured to call the model generated by the method according to the second aspect to complete the corresponding function;
[0023] An output module is used to output the reply statement.
[0024] According to a fifth aspect of the present disclosure, there is provided a device for generating sample data based on a large model, comprising:
[0025] A first acquisition module, configured to acquire a sample data generation request, wherein the generation request includes information of a target service corresponding to the sample data to be generated;
[0026] A first generating module, configured to generate an input statement set according to information of the target service, wherein the input statement set includes a first input statement group associated with the target service and a second input statement group unrelated to the target service;
[0027] A second generating module, configured to generate at least two candidate answers corresponding to each input sentence in the input sentence set by using the first model;
[0028] A first determination module, configured to determine a score of each candidate answer based on at least two second models;
[0029] The second determination module is used to obtain sample data, wherein the sample data includes: the candidate answers whose scores meet the scoring threshold, the input sentences corresponding to the candidate answers whose scores meet the scoring threshold, and the target service information.
[0030] According to a sixth aspect of the present disclosure, a model updating device is provided, comprising:
[0031] A second acquisition module is used to acquire training data from a sample database based on target service information, wherein the data in the sample database is obtained by using the method for generating sample data based on a large model as in the embodiment of the first aspect;
[0032] A third determination module, configured to determine the training data including input sentences belonging to the first input sentence group as positive sample data;
[0033] A fourth determination module, configured to determine the training data including input sentences belonging to the second input sentence group as negative sample data;
[0034] An updating module is used to update the target model corresponding to the model target service information by using the positive sample data and the negative sample data.
[0035] According to a seventh aspect of the present disclosure, a dialog processing device is provided, including:
[0036] A receiving module, used for receiving a query statement;
[0037] a fifth determination module, configured to input the query statement into the third model based on a second prompt template associated with the third model, and obtain an output first result, wherein the third model is used to determine a target model that responds to the query statement from candidate models, wherein the candidate models include a model trained using sample data generated as in the first aspect embodiment;
[0038] A third acquisition module is used to input the query statement into the candidate model based on a third prompt template associated with the candidate model when the first result includes a candidate model and the execution condition is met, so as to obtain a reply statement corresponding to the output query statement.
[0039] According to an eighth aspect of the present disclosure, there is provided an electronic device, including:
[0040] at least one processor; and
[0041] a memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for generating sample data based on a large model as described in the first aspect, the model updating method as described in the second aspect, or the dialogue processing method as described in the third aspect.
[0043] According to the ninth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method for generating sample data based on a large model as described in the first aspect, the model updating method as described in the second aspect, or the dialogue processing method as described in the third aspect.
[0044] According to the tenth aspect of the present disclosure, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the method for generating sample data based on a large model as described in the first aspect, the model updating method as described in the second aspect, or the dialogue processing method as described in the third aspect.
[0045] The large model-based dialogue processing method, device, and intelligent agent provided by the present disclosure have the following beneficial effects:
[0046] By generating information about the service corresponding to the sample data based on the target, using the model to generate the corresponding input sentence and the candidate answer corresponding to the input sentence, and then scoring the candidate answers, the sample data is constructed according to the scoring results. This can improve the quality and content richness of the sample data, so that the generated sample data can better reflect the service needs in different scenarios, providing conditions for improving the quality of model training.
[0047] Furthermore, by utilizing the positive and negative sample data corresponding to the target service information, the target model corresponding to the target service information is trained, so that the updated target model can generate responses with better quality under the target service and better meet the needs of users.
[0048] In addition, by classifying the intent of user query statements, we determine the model that can respond to and fully answer the query statement, and then call the model to generate the reply statement corresponding to the query statement. This can improve the quality of the reply statement while ensuring the efficiency of reply statement generation, thereby optimizing the user experience.
[0049] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, which are used to better understand the present solution and do not constitute a limitation of the present disclosure, wherein:
[0051] Figure 1 It is a flowchart of a method for generating sample data based on a large model proposed according to an embodiment of the present disclosure;
[0052] Figure 2 is a flowchart of a method for generating sample data based on a large model according to another embodiment of the present disclosure;
[0053] Figure 3 is a flowchart of a model updating method proposed according to an embodiment of the present disclosure;
[0054] Figure 4 is a flowchart of a conversation processing method proposed according to an embodiment of the present disclosure;
[0055] Figure 5 is a flowchart of a conversation processing method proposed according to another embodiment of the present disclosure;
[0056] Figure 6 is a structural diagram of a dialogue processing agent system proposed according to an embodiment of the present disclosure;
[0057] Figure 7 is a schematic diagram of the structure of a device for generating sample data based on a large model according to an embodiment of the present disclosure;
[0058] Figure 8 is a structural schematic diagram of a model updating device proposed according to an embodiment of the present disclosure;
[0059] Fig. 9 is a structural diagram of a conversation processing device proposed according to an embodiment of the present disclosure;
[0060] Fig.10 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0061] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0062] The embodiments of the present disclosure relate to artificial intelligence technology fields such as natural language processing, large models, and deep learning.
[0063] Artificial Intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence.
[0064] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between humans and computers using natural language. It is a discipline that uses computer technology to analyze, understand and process natural language, that is, it uses computers as a powerful tool for language research, conducts quantitative research on language information with the support of computers, and provides language descriptions that can be used by humans and computers.
[0065] Large Model (also called Foundation Model) refers to a machine learning model with a large number of parameters and complex structure, which can process massive data and complete various complex tasks, such as natural language processing, computer vision, speech recognition, etc. Among them, the large language model is a natural language processing model with large-scale parameters and computing power, which can be trained with a large amount of data and parameters to generate human-like text or answer natural language questions.
[0066] Deep learning is the process of learning the inherent laws and representation levels of sample data. The information obtained in the learning process is of great help in interpreting data such as text, images, and sounds. The ultimate goal of deep learning is to enable machines to have analytical learning capabilities like humans and to be able to recognize data such as text, images, and sounds.
[0067] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0068] The following describes the large model-based dialogue processing method, device and intelligent agent of the embodiments of the present disclosure with reference to the accompanying drawings.
[0069] It should be noted that the executor of the big model-based dialogue processing method of this embodiment is a big model-based dialogue processing device, which can be implemented by software and / or hardware and can be configured in an electronic device, which may include but is not limited to a terminal, a server, etc.
[0070] Figure 1 It is a flowchart of a method for generating sample data based on a large model proposed according to an embodiment of the present disclosure.
[0071] like Figure 1 As shown, the method for generating sample data based on a large model includes:
[0072] S101: Obtain a sample data generation request.
[0073] The generation request includes information of a target service corresponding to the sample data to be generated.
[0074] In addition, the target service is a service provided to customers in order to achieve a certain purpose or meet specific needs. In the present disclosure, the target service can be a service in which an intelligent assistant assists customers in their work by playing a specific role (such as a table Excel master, a career planning master, etc.). The information of the target service is text information used to describe and summarize what functions the service can achieve or what characteristics it has, etc., and may include the name of the target service, function description, etc.
[0075] In the embodiment of the present disclosure, the target services that the intelligent assistant needs to provide to customers can be determined according to the needs of different enterprise scenarios, and then the sample data corresponding to the services that need to be generated can be obtained.
[0076] It is understandable that since the general large language model (LLM) has weak command-following ability and cannot meet the needs of users to let the intelligent assistant play a certain role, it is necessary to generate a large amount of sample data to train the general large language model to enhance the model's command-following ability, so that the intelligent assistant can use the trained model to better play the role, assist customers in their work, and improve efficiency.
[0077] S102: Generate an input statement set according to the information of the target service.
[0078] The input sentence set may include a first input sentence group associated with the target service and a second input sentence group unrelated to the target service.
[0079] In addition, the first input statement group refers to a set of first input statements (queries) within the scope of questions that the target service can answer, and the sample data generated by the first input statements are positive samples. The second input statement group refers to a set of second input statements (queries) that are not within the scope of questions that the target service can answer, and the sample data generated by the second input statements are negative samples. In the present disclosure, the number of statements contained in each input statement group or input statement set can be determined based on the size of available resources or the requirements for training accuracy, for example, it can be 100.
[0080] In the disclosed embodiment, the big model can be used to construct some questions related to the target service (i.e., first input statements) and some questions unrelated to the target service (i.e., second input statements) according to the information of the target service, thereby obtaining an input statement set of the target service. Alternatively, after obtaining the first input statement associated with the target service, the first input statements associated with different target services can be exchanged, thereby obtaining a second input statement unrelated to the target service.
[0081] S103: Generate at least two candidate answers corresponding to each input sentence in the input sentence set by using the first model.
[0082] Among them, the first model can be any model that can understand natural language and generate corresponding answers, for example, it can be a strong model such as GPT-4o.
[0083] In the embodiment of the present disclosure, each input sentence in the input sentence set can be input into the first model respectively, and the first model generates the answer corresponding to the input sentence. In the present disclosure, in order to increase the number of generated samples to ensure that the data used to train the model is sufficient, the first model can generate multiple answers for each input sentence to obtain at least two candidate answers corresponding to each input sentence.
[0084] It is understandable that when the input statement is the first input statement, the first model can generate a detailed answer to the question requested by the first input statement. When the input statement is the second input statement, the first model can generate a prompt message for indicating that the requested question cannot be answered. For example, when the target service is Excel Master, the input statement set includes the first input statement "How to use the VLOOKUP function" and the second input statement "How to express your needs in the workplace." The first model can generate a detailed answer to the question "How to use the VLOOKUP function", such as "The VLOOKUP function is a very practical function in Excel. It can find and return the corresponding value in the data table according to the given search value...", etc. The first model can also output prompt information for the question "How to express your needs in the workplace", such as "I'm sorry, I can only answer questions related to Excel", etc.
[0085] S104: Determine a score for each candidate answer based on at least two second models.
[0086] The second model refers to any model that can score question and answer pairs, such as GPT4o, ChatGLM4, etc. The second model cannot be the same model as the first model.
[0087] In the embodiment of the present disclosure, each input sentence and each candidate answer corresponding to it can be constituted into a question-answer pair, that is, one input sentence can correspond to multiple question-answer pairs. Then, each question-answer pair can be input into at least two second models, and each second model can score the matching degree of the question-answer pair to obtain multiple scores for each candidate answer. In the present disclosure, the full score can be 10 points, and the higher the score, the better the candidate answer is in response to the input sentence.
[0088] S105: Acquire sample data, where the sample data includes: candidate answers whose scores meet the scoring threshold, input sentences corresponding to the candidate answers whose scores meet the scoring threshold, and target service information.
[0089] The scoring threshold may be determined according to the need for answer accuracy in actual applications, for example, 8 points, 9 points, etc. The higher the scoring threshold, the higher the requirement for answer accuracy. In the disclosed embodiment, the scores of the candidate answers and the scoring threshold may be compared in a variety of ways to determine whether the scores of each candidate answer meet the scoring threshold. For example, when all the scores of the candidate answers are greater than the scoring threshold, it is determined that the scoring threshold is met, or when the average score of the candidate answers is greater than the scoring threshold, it is determined that the scoring threshold is met, etc. The disclosed embodiment does not limit this.
[0090] In the disclosed embodiment, after determining that the score of a candidate answer meets the score threshold, the candidate answer, the input sentence corresponding to the candidate answer, and the corresponding target service information may be associated as a sample data.
[0091] The following takes the generation of corresponding text sample data for a target service as an example to briefly outline the sample data generation process.
[0092] First, a sample data generation request is received, and an input statement set is determined according to the information of the target service x contained in the generation request. The input statement set includes a first input statement a, a first input statement b, a second input statement c, and a second input statement d. Then, each input statement is input into the first model to obtain two candidate answers, such as the candidate answers corresponding to the first input statement a are answer 1 and answer 2. After that, each candidate answer is scored using the second model A and the second model B. For example, the second model A scores candidate answer 1 as 8, and the second model B scores candidate answer 1 as 7. The scoring threshold is 6, and the condition for the score to meet the scoring threshold is that each score is greater than the scoring threshold. Since 8>7, 6>7, it can be determined that candidate answer 1 is a candidate answer whose score meets the scoring threshold, so a sample data can be obtained, which includes candidate answer 1, the first input statement a, and the information of the target service x.
[0093] It should be noted that the number of input sentences, the number of candidate answers and the number of second models in the above generation process are only for illustrative purposes and cannot be used as a limitation to the present disclosure.
[0094] In this embodiment, a sample data generation request is first obtained, and then an input statement set is generated according to the information of the target service in the generation request, and then at least two candidate answers corresponding to each input statement in the input statement set are generated using the first model, and then the score of each candidate answer is determined based on at least two second models. Finally, the candidate answer whose corresponding score meets the scoring threshold, the input statement corresponding to the candidate answer whose score meets the scoring threshold, and the target service information are determined as a sample data. Thus, by generating the information of the service corresponding to the sample data based on the target, the corresponding input statement and the candidate answer corresponding to the input statement are generated using the model, and then the candidate answers are scored, and the sample data is constructed according to the scoring results. The quality and content richness of the sample data can be improved, so that the generated sample data can better reflect the service needs in different scenarios, providing conditions for improving the quality of model training.
[0095] Figure 2 It is a flowchart of a method for generating sample data based on a large model proposed in another embodiment of the present disclosure.
[0096] like Figure 2As shown, the method for generating sample data based on a large model includes:
[0097] S201: Obtain a sample data generation request.
[0098] The generation request includes information of a target service corresponding to the sample data to be generated.
[0099] It should be noted that the target service information may include at least one of the following: the name of the target service, the introduction of the target service, and the functional description information of the target service.
[0100] The name of the target service refers to the specific role played by the service. The introduction of the target service is a summary of the scenarios in which the service can be used. The functional description information of the target service is used to specifically describe all the functions that the service can provide and the scope of data that can be processed.
[0101] For example, the target service name is "Excel Master", the introduction can be "You are an Excel expert who can provide answers and guidance on various Excel questions", and the functional description information can be "You can explain formulas and functions in Excel, and guide how to manage worksheets and custom functions, and provide the best time, skills and suggestions for Excel, etc." Alternatively, the target service name can also be "Workplace Communication Mentor", the introduction can be "You are a workplace communication guidance assistant who interacts with an anthropomorphic role, provides emotional support and specific guidance", and the functional description information can be "You have the above experience and understand common communication problems and solutions in the workplace, etc."
[0102] In the disclosed embodiments, information such as an introduction to the target service and a functional description can provide a richer and more detailed data basis for the generation of sample data, thereby helping to improve the quality and accuracy of the sample data.
[0103] In the disclosed embodiment, the target service name of the sample data to be generated can be determined according to the scenario requirements. For example, in daily office scenarios, office software services such as Excel are usually required, so the name of the target service can be determined based on the office software, such as Excel Master, etc. Then, the big model is used to construct the introduction and functional description information of each target service.
[0104] S202: Generate an input statement set according to the information of the target service.
[0105] The detailed description of S202 can refer to the above embodiments of the present disclosure, which will not be repeated here.
[0106] S203: Based on a first prompt template corresponding to the first model, information of a target service and a target input sentence are input into the first model to obtain a first candidate answer corresponding to the target input sentence.
[0107] The first prompt template is a prompt text for indicating what information the model generates what content. After the first model to be used is determined, the corresponding first prompt template can be directly obtained.
[0108] The target input sentence may be any input sentence in the input sentence set.
[0109] In the disclosed embodiment, the target service information and a target input sentence can be filled into the corresponding position in the first prompt template and then input into the first model to obtain the first candidate answer output by the first model for the target input sentence.
[0110] S204: In response to determining that the number of second candidate answers output by the first model is less than N, based on the first prompt template, information of the target service, the target input sentence and the first candidate answers are input into the first model to obtain a second candidate answer corresponding to the output target input sentence.
[0111] The second candidate answer refers to the answer regenerated by the first model based on the same input sentence, and the second candidate answer is different from the first candidate answer.
[0112] Wherein, N is a preset maximum number of times for regenerating candidate answers for each input sentence, which can be an integer greater than or equal to 2, such as 2, 3 or 5, etc. When the first model executes the operation of regenerating a candidate answer for a certain input sentence the maximum number of times, the operation of continuing to generate the second candidate answer can be stopped.
[0113] It can be understood that adding a first candidate answer to the first prompt template and inputting it into the first model can instruct the first model that when regenerating a candidate answer for the input statement, the candidate answer cannot be the same as the first candidate answer generated previously, thereby obtaining a second candidate answer different from the first candidate answer.
[0114] In the disclosed embodiment, before the first model outputs an answer based on input information each time, the number of second candidate answers outputted historically can be determined first. When the number of second candidate answers is less than N, the information of the target service, the target input sentence and the first candidate answer can be input into the first model to obtain the second candidate answer corresponding to the output target input sentence.
[0115] It should be noted that in the present disclosure, when the first model has output at least one second candidate answer and the number of second candidate answers is less than N, in order to ensure that the next candidate answer output by the first model is different from the previously output candidate answers, the second candidate answer output historically can also be input into the first model.
[0116] S205: Determine a score for each candidate answer based on at least two second models.
[0117] The detailed description of S205 can refer to the above embodiments of the present disclosure, which will not be repeated here.
[0118] S206: Acquire sample data, where the sample data includes: candidate answers whose scores meet the scoring threshold, input sentences corresponding to the candidate answers whose scores meet the scoring threshold, and target service information.
[0119] Optionally, the scores satisfying the score threshold may mean that: each score is greater than the score threshold, or the average of the scores is greater than the score threshold.
[0120] Therefore, by comparing whether each score corresponding to the candidate answer is greater than the score threshold, or whether the average of all scores is greater than the score threshold, it is determined whether the candidate answer meets the score threshold, and the candidate answers are screened, which can improve the reliability of the answer data used to generate sample data, thereby improving the quality of the sample data.
[0121] In this embodiment, first, based on the first prompt template corresponding to the first model, the information of the target service and a target input sentence are input into the first model to obtain the first candidate answer corresponding to the target input sentence. Then, in response to determining that the number of second candidate answers output by the first model is less than N, based on the first prompt template, the information of the target service, the target input sentence and the first candidate answer are input into the first model to obtain the output second candidate answer corresponding to the target input sentence. Thus, by iteratively generating multiple different candidate answers corresponding to an input sentence, a richer data basis can be further provided for the generation of sample data, thereby increasing the data volume of sample data. Figure 3 It is a flowchart of a model updating method proposed in an embodiment of the present disclosure.
[0122] like Figure 3 As shown, the model updating method includes:
[0123] S301: Acquire training data from a sample database based on target service information.
[0124] The data in the sample database are obtained by using Figure 1 The method for generating sample data is shown.
[0125] In the disclosed embodiment, based on the target service information required by the application scenario to which the intelligent assistant belongs, multiple sample data corresponding to the target service information can be obtained from the sample database as training data for model updating.
[0126] S302: Determine the training data including input sentences belonging to the first input sentence group as positive sample data.
[0127] In the disclosed embodiment, since the input statements in the first input statement group are all associated with the target service, the training data corresponding to the input statements in the first input statement group can enable the model to better learn which input statements fall within the processing capability range of the target service and how to process the input statements to obtain more accurate reply statements, etc. Therefore, the training data containing the input statements belonging to the first input statement group can be determined as positive sample data.
[0128] S303: Determine the training data including the input sentences belonging to the second input sentence group as negative sample data.
[0129] In the disclosed embodiment, since the input statements in the second input statement group are all irrelevant to the target service, the training data corresponding to the input statements in the second input statement group can be compared with the positive sample data to help the model distinguish which input statements are not within the processing capability of the target service. Therefore, the training data containing the input statements belonging to the second input statement group can be determined as negative sample data.
[0130] S304: Using the positive sample data and the negative sample data, update the target model corresponding to the target service information.
[0131] In this embodiment, the target model corresponding to the target service information is trained by using positive and negative sample data, so that the updated target model can generate better quality responses under the target service and better meet the needs of users.
[0132] Figure 4 It is a flowchart of a conversation processing method proposed in an embodiment of the present disclosure.
[0133] like Figure 4 As shown, the dialogue processing method includes:
[0134] S401: receiving a query statement.
[0135] In the disclosed embodiment, the user can send a query statement (query) to the intelligent assistant in the form of a dialogue according to the current task requirements, so that the intelligent assistant can receive the query statement and process the query statement to generate a reply statement to solve the problem or instruction sent by the user in the query statement.
[0136] S402: Based on the second prompt template associated with the third model, a query statement is input into the third model to obtain a first output result.
[0137] The third model is used to determine a target model that responds to the query statement from the candidate models. The candidate models include models generated by training using the sample data provided by the above embodiment.
[0138] The second prompt template is used to instruct the third model to classify the query statement and determine the target model that meets the intent classification result and can respond to the query statement. For example, the second prompt information can be a text like "For the user's query (query statement), you can choose the following agents (candidate models) to solve the user's problem: candidate model 1, candidate model 2, .... Output format requirements: Select candidate model X, select the reason (no more than 38 words), ... ".
[0139] It should be noted that in the present disclosure, the third model can be a large model based on a Mixture of Experts (MOE) architecture, or a small model that can be used for user intent classification after training, such as Bert, ERNIE, etc. The third model can classify the intent of the user's query statement, and then determine at least one model that can solve the problem raised by the query statement from multiple candidate models based on the result of the intent classification.
[0140] It should be noted that the model parameter scales and corresponding prompt templates of multiple candidate models are different.
[0141] In the disclosed embodiment, the intent of query statements can be divided into three categories, including instruction following, simple questions and answers, and complex questions and answers. The answers to simple questions and answers are relatively easy, and a candidate model with a smaller parameter scale can be used to generate reply statements to increase the speed of dialogue processing. The answers to complex questions may require model reasoning to obtain, so a candidate model with a larger parameter scale can be used to generate reply statements to ensure the quality of the reply statements. For query statements of the instruction sequence type, it is necessary to use the model generated by training the sample data provided in the above embodiment to generate reply statements, so as to ensure that the generated reply statements can better meet the diverse needs of users and enhance the instruction following ability of the intelligent assistant.
[0142] Therefore, the query statement can be first filled into the second prompt template and input into the third model, and then the third model can classify the query statement by intent and output a first result containing an identifier of a target model that can respond to the query statement.
[0143] S403: When the first result includes a candidate model and the execution condition is met, based on the third prompt template associated with the candidate model, the query statement is input into the candidate model to obtain a reply statement corresponding to the query statement.
[0144] It should be noted that the execution condition may include at least one of the following: the result output by the third model includes a preset execution statement, and the result output by the third model includes a preset identifier.
[0145] The preset execution statement is used to indicate that the result is sufficient to answer the user's query statement, and its content may be similar to "I have selected the model, and it is sufficient to answer the user's question", etc. The preset identifier may be a summarizer identifier, etc.
[0146] In the embodiment of the present disclosure, by determining whether the output result of the model meets the execution conditions when the model output result includes a preset statement or identifier, it is verified whether the result output by the third model is reliable, so as to ensure that the candidate model selected by the third model can generate a more accurate and complete answer.
[0147] In an embodiment of the present disclosure, if at least one candidate model is included in the first result and the execution conditions are met, it can be determined that the at least one candidate model is sufficient to answer the user's question. In this way, a query statement can be input into the at least one candidate model using a third prompt template associated with the at least one candidate model to obtain a reply statement corresponding to the query statement.
[0148] The third prompt template is used to instruct the candidate model to generate the answer content corresponding to the query sentence. The third prompt templates corresponding to different candidate models may be different.
[0149] For example, for a candidate model used to respond to a simple question-and-answer query statement, the format of the corresponding third prompt template may be similar to "Please answer the question as follows: Final answer: (Please answer the user's question based on the search results); Search results: (The search tool returns the results)".
[0150] The format of the third prompt template corresponding to the candidate model for responding to complex question-and-answer query statements may be similar to "Please answer the question according to the following requirements: Thought: (Please infer the answer step by step based on the search results. Please note that the answer may come from multiple search fragments. You need to first find multiple search-related fragments, and then finally infer the answer based on the related fragments); Final answer: (Please answer the question based on the search results, and do not derive or fabricate based on your own knowledge; when you cannot answer based on the search results, please reply 'Sorry, I don't know.'); Search results: (The search tool returns the results)".
[0151] A candidate model for responding to a command-following query statement, the format of the corresponding third prompt template may be similar to "Information of the role you play: (specific role information); you need to answer the following questions based on the role information you play. If it exceeds the role information, you can refuse to answer. Historical dialogue information:...; Current task information: (query statement)..."
[0152] It should be noted that after obtaining the first result output by the third model, it is possible that the first result does not meet the execution conditions. In this case, the third model can be allowed to repeatedly generate results to update the candidate models contained in the results until the output result meets the execution conditions.
[0153] Optionally, when the first result includes a candidate model and the execution condition is not met, the query statement and the first result can be input into a third model based on the second prompt template to obtain an output second result.
[0154] Then, if the second result does not meet the execution condition, the operation of obtaining the second result is continued based on the query statement, the first result and the second result are returned and executed until the result output by the third model meets the execution condition.
[0155] It can be understood that by inputting the results generated by the history of the third model as input content into the third model, the third model can output different results.
[0156] In the disclosed embodiment, by allowing the model to repeatedly determine candidate models that respond to the query statement until the output result can meet the execution conditions, it can be ensured that the model selected by the third model can fully answer the user's questions, avoid generating invalid reply statements, and improve the quality and efficiency of dialogue processing.
[0157] It should be noted that since the consumable computing resources in the intelligent assistant platform are limited, if the number of times the third model repeats the calculation is not limited, it may affect the efficiency of generating the reply statement, take a longer time, and affect the user experience.
[0158] Optionally, when the number of times the operation to obtain the second result is performed is greater than a number threshold and all results output by the third model do not meet the execution condition, the query statement is first input into the candidate model to obtain a reply statement.
[0159] The number threshold may represent the maximum number of repetitions of the output result of a query statement by the third model, for example, it may be 2, 5, etc., and may be determined according to actual needs.
[0160] It should be noted that the candidate model inputted by the query statement may be the model corresponding to all the results in the intelligent assistant platform, or any candidate model among all the results, or a specific candidate model, etc. This disclosure does not limit this.
[0161] Then, based on the reply statement, determine the target reply statement corresponding to the query statement.
[0162] In the disclosed embodiment, after obtaining the candidate model and the reply statement outputted by the query statement, the reply statement can be fused to obtain the target reply statement corresponding to the query statement and reply to the user's query statement. Therefore, by directly using the candidate model to generate the reply statement when the number of repeated operations of the target model that can respond to the query statement is determined by the third model to be greater than the number threshold and all the results do not meet the execution condition, it is possible to avoid excessive consumption of resources and ensure the efficiency of generating the reply statement.
[0163] In this embodiment, a query statement is first received, and then based on the second prompt template associated with the third model, the query statement is input into the third model to obtain the first result output by the third model. Afterwards, if the first result includes a candidate model and the execution condition is met, the query statement is input into the candidate model based on the third prompt template associated with the candidate model to obtain a reply statement corresponding to the query statement. Thus, by classifying the intent of the user's query statement, a model that can respond to and fully answer the query statement is determined, and then the model is called to generate a reply statement corresponding to the query statement, which can improve the quality of the reply statement while ensuring the efficiency of generating the reply statement and optimize the user's experience.
[0164] Figure 5 It is a flowchart of a conversation processing method proposed in another embodiment of the present disclosure.
[0165] like Figure 5 As shown, the dialogue processing method includes:
[0166] S501: receiving a query statement.
[0167] S502: Based on the second prompt template associated with the third model, a query statement is input into the third model to obtain an output first result.
[0168] The description of S501 and S502 can be specifically referred to the above embodiment, which will not be repeated here.
[0169] S503: When the first result includes a candidate model and the execution condition is met, based on the third prompt template associated with each candidate model, a query statement is input into the candidate model to obtain a reply statement corresponding to the output query statement.
[0170] In the embodiment of the present disclosure, when there are multiple candidate models, it can be determined that multiple candidate models in the first result can be used to obtain the complete answer content corresponding to the query sentence. Then, the query sentence can be input into each candidate model at the same time to obtain a reply sentence output by each candidate model to the query sentence.
[0171] S504: Fuse at least two reply statements corresponding to the query statement to obtain a target reply statement corresponding to the query statement.
[0172] In the disclosed embodiment, after obtaining a reply statement output by each candidate model to a query statement, multiple reply statements corresponding to the query statement may be fused to construct a complete target reply statement.
[0173] It should be noted that there are many ways to merge multiple reply sentences into a target reply sentence. For example, multiple reply sentences can be spliced according to their corresponding candidate model identifiers, or multiple reply sentences can be input into the model, and the model can output a target reply sentence containing the contents of the multiple reply sentences, and so on.
[0174] Optionally, the identifier of the target service associated with the candidate model corresponding to each reply statement may be determined first, and then the identifiers of the target services associated with each of at least two reply statements may be concatenated in sequence to obtain the target reply statement corresponding to the query statement.
[0175] The identifier of the target service associated with the candidate model may be a model name or an application name.
[0176] For example, by concatenating multiple reply statements and the identifiers of the target services associated with each reply statement in sequence, the content of the obtained target reply statement can be similar to “…the reply provided by the assistant is…, the reply provided by the model is…, the above content is for your reference”, etc.
[0177] In the disclosed embodiment, a target reply statement is obtained by sequentially concatenating multiple reply statements and the identifiers of the target services associated with each reply statement, so that the user can intuitively confirm the specific reply content in different services, thereby improving the readability of the reply statement and enhancing the user experience.
[0178] Optionally, based on a fourth prompt template associated with the fourth model, the query statement and at least two reply statements may be respectively input into the fourth model to obtain an output target reply statement.
[0179] The fourth model may be any model that can fuse multiple texts. The fourth prompt template is used to indicate which formats or requirements the fourth model uses to fuse the data input into the model.
[0180] In the disclosed embodiment, by utilizing a model to organize and fuse a query statement and multiple reply statements to obtain a target reply statement, the efficiency of reply statement generation can be further improved.
[0181] In this embodiment, when there are multiple candidate models, the third prompt template associated with each candidate model is used to obtain a reply statement output by each candidate model to the query statement, and then at least two reply statements corresponding to the query statement are merged to obtain the target reply statement corresponding to the query statement. This can ensure the content integrity of the reply statement that is ultimately used to answer the user's query statement, improve the quality of the reply statement, and further improve the performance of the intelligent assistant dialogue processing.
[0182] Figure 6 It is a structural diagram of a dialogue processing intelligent agent system proposed in one embodiment of the present disclosure.
[0183] like Figure 6 As shown, the dialogue processing agent system 60 includes:
[0184] Input module 601, used to obtain query statements;
[0185] Processing module 602 is used to determine the target task based on the query statement, and determine the target agent from the first agent library based on the target task, and trigger the second agent to call the target agent; when the second agent determines that the calling condition of the target agent is met, the second agent calls the target agent to obtain the reply statement corresponding to the query statement generated by the target agent, wherein at least one of the target agent and the second agent is configured to call the target agent. Figure 3 The model generated by the method shown is used to complete the corresponding function;
[0186] The output module 603 is used to output the reply statement.
[0187] It should be noted that an agent is a computer system or entity that can act autonomously, perceive the environment, make decisions, and interact with the environment. It usually uses a large language model as the core decision-making and processing unit, and has the ability to think independently and call tools to gradually complete a given goal. The dialogue processing agent system proposed in the present disclosure can complete the content of generating a reply statement for a query statement through collaboration between multiple agents.
[0188] It should be noted that the dialogue processing agent system can play different roles as an intelligent assistant to provide services to users and assist them in their work. The dialogue processing system can include multiple first agents, each of which can be used to provide different services and can call the model to generate a reply statement corresponding to the query statement. The model used to generate the reply statement in the first agent can be Figure 3 The model update method shown is the trained model.
[0189] In the embodiment of the present disclosure, the dialogue processing agent system can first use the input module 601 to obtain the query statement input by the user, and then use the processing module 602 to execute the dialogue processing method described in the above embodiment of the present disclosure, and use the model and its associated prompt information to determine the target task that can reflect the user's intention in the query statement, and the first agent that can respond to the target task, so that the first agent can be determined as the target agent that needs to be called currently. Then, the call request containing the target agent identifier can be sent to the second agent, and the second agent determines whether the first agent in the call request meets the call condition. When the target agent meets the call condition, the second agent can trigger the operation of calling the target agent, and the target agent can use the model to generate a reply statement corresponding to the query statement. Afterwards, the reply statement generated by the target agent is output to the user who sent the query statement by the output module 603.
[0190] It should be noted that the method of determining whether the target intelligent agent meets the calling conditions may include that the calling request containing the target intelligent agent is legal, the parameters required to call the target intelligent agent are complete, or the user sending the query statement has the calling authority of the target intelligent agent, etc., and the present disclosure does not limit this.
[0191] In this embodiment, the dialogue processing agent system generates corresponding reply statements by calling the agent that meets the task requirements in the user's query statement through collaboration between agents of different roles. This can ensure a high degree of match between the reply content and the user's query, improve the efficiency and accuracy of dialogue processing, and through the collaboration mechanism between agents, the dialogue processing agent system can expand its application scope and handle more complex and diverse query requirements.
[0192] Figure 7 It is a structural diagram of an apparatus for generating sample data based on a large model proposed in one embodiment of the present disclosure.
[0193] like Figure 7 As shown, the device 70 for generating sample data based on a large model includes:
[0194] The first acquisition module 701 is used to acquire a sample data generation request, wherein the generation request includes information of a target service corresponding to the sample data to be generated;
[0195] A first generating module 702 is used to generate an input statement set according to information of a target service, wherein the input statement set includes a first input statement group associated with the target service and a second input statement group unrelated to the target service;
[0196] A second generating module 703 is used to generate at least two candidate answers corresponding to each input sentence in the input sentence set by using the first model;
[0197] A first determination module 704, configured to determine a score for each candidate answer based on at least two second models;
[0198] The second determination module 705 is used to obtain sample data, where the sample data includes: candidate answers whose scores meet the scoring threshold, input sentences corresponding to the candidate answers whose scores meet the scoring threshold, and target service information.
[0199] Optionally, the second generating module 703 may be specifically used for:
[0200] Based on a first prompt template corresponding to the first model, information of a target service and a target input sentence are input into the first model to obtain a first candidate answer corresponding to the target input sentence;
[0201] In response to determining that the number of second candidate answers output by the first model is less than N, based on the first prompt template, inputting information of the target service, the target input sentence, and the first candidate answer into the first model to obtain a second candidate answer corresponding to the output target input sentence, wherein the second candidate answer is different from the first candidate answer;
[0202] Wherein, N is an integer greater than or equal to 2.
[0203] Optionally, satisfying the scoring threshold means that each score is greater than the scoring threshold, or the average of the scores is greater than the scoring threshold. Optionally, the target service information includes at least one of the following: the name of the target service, the introduction of the target service, and the functional description information of the target service.
[0204] It should be noted that the aforementioned explanation of the method for generating sample data based on a large model is also applicable to the device for generating sample data based on a large model in this embodiment, and will not be repeated here.
[0205] In this embodiment, by generating information of the service corresponding to the sample data based on the target, using the model to generate the corresponding input sentence and the candidate answer corresponding to the input sentence, and then scoring the candidate answer, the sample data is constructed according to the scoring result. The quality and content richness of the sample data can be improved, so that the generated sample data can better reflect the service needs in different scenarios, providing conditions for improving the quality of model training.
[0206] Figure 8 It is a structural diagram of a model updating device proposed in an embodiment of the present disclosure.
[0207] like Figure 8 As shown, the model updating device 80 comprises:
[0208] A second acquisition module 801 is used to acquire training data from a sample database based on target service information, wherein the data in the sample database is obtained by using the method for generating sample data according to any one of claims 1 to 4;
[0209] A third determination module 802 is used to determine the training data including the input sentences belonging to the first input sentence group as positive sample data;
[0210] A fourth determination module 803 is used to determine the training data including the input sentences belonging to the second input sentence group as negative sample data;
[0211] The updating module 804 is used to update the target model corresponding to the model target service information using the positive sample data and the negative sample data.
[0212] In this embodiment, the target model corresponding to the target service information is trained by using positive and negative sample data, so that the updated target model can generate better quality responses under the target service and better meet the needs of users.
[0213] Fig. 9 It is a structural diagram of a dialogue processing device proposed in an embodiment of the present disclosure.
[0214] like Fig. 9 As shown, the dialogue processing device 90 includes:
[0215] Receiving module 901, used for receiving a query statement;
[0216] The fifth determining module 902 is used to input the query statement into the third model based on the second prompt template associated with the third model to obtain the first output result, wherein the third model is used to determine the target model that responds to the query statement from the candidate models, and the candidate models include the following: Figure 7 A model trained with sample data generated by the device shown;
[0217] The third acquisition module 903 is used to input the query statement into the candidate model based on the third prompt template associated with the candidate model when the candidate model is included in the first result and the execution condition is met, so as to obtain a reply statement corresponding to the output query statement.
[0218] Optionally, the fifth determining module 902 may also be used to:
[0219] When the first result includes a candidate model and the execution condition is not met, based on the second prompt template, the query statement and the first result are input into the third model to obtain the output second result;
[0220] In the case that the second result does not meet the execution condition, based on the query statement, the first result and the second result return to execute the operation to obtain the second result until the result output by the third model meets the execution condition.
[0221] Optionally, the third acquisition module 903 may also be used to:
[0222] When the number of times the operation to obtain the second result is performed is greater than the number threshold, and all results output by the third model do not meet the execution condition, input the query statement into the candidate model to obtain an output reply statement;
[0223] Based on the reply sentence, determine the target reply sentence corresponding to the query sentence.
[0224] Optionally, the execution condition includes at least one of the following: the result output by the third model includes a preset execution statement, and the result output by the third model includes a preset identifier.
[0225] Optionally, the third acquisition module 903 may be specifically used for:
[0226] Based on the third prompt template associated with each candidate model, input the query statement into the candidate model to obtain a reply statement corresponding to the query statement;
[0227] At least two reply statements corresponding to the query statement are merged to obtain a target reply statement corresponding to the query statement.
[0228] Optionally, the third acquisition module 903 may be specifically used for:
[0229] Determine the identifier of the target service associated with the candidate model corresponding to each reply sentence;
[0230] At least two reply statements and the identifiers of the target services associated with each reply statement are sequentially concatenated to obtain a target reply statement corresponding to the query statement.
[0231] Optionally, the third acquisition module 903 may be specifically used for:
[0232] Based on the fourth prompt template associated with the fourth model, the query statement and multiple reply statements are respectively input into the fourth model to obtain the output target reply statement.
[0233] It should be noted that the above explanation of the dialogue processing method is also applicable to the dialogue processing device of this embodiment and will not be repeated here.
[0234] In this embodiment, the intent of the user's query statement is classified to determine the model that can respond to and fully answer the query statement, and then the model is called to generate a reply statement corresponding to the query statement. This can improve the quality of the reply statement while ensuring the efficiency of generating the reply statement, thereby optimizing the user experience.
[0235] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0236] Fig.10 A schematic block diagram of an example electronic device 1000 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0237] like Fig.10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0238] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0239] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above, such as a method for generating sample data or a method for processing a dialogue. For example, in some embodiments, the method for generating sample data or the method for processing a dialogue may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the method for generating sample data or the method for processing a dialogue described above may be executed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute the sample data generation method or the dialog processing method in any other appropriate manner (eg, by means of firmware).
[0240] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0241] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0242] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0243] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0244] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0245] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0246] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0247] In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In the description of the present disclosure, the words "if" and "if" used can be interpreted as "at the time of" or "when" or "in response to determination" or "under the circumstances of".
[0248] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating sample data based on a large model, comprising: Obtaining a sample data generation request, wherein the generation request includes information of a target service corresponding to the sample data to be generated; Generate an input statement set according to the information of the target service, wherein the input statement set includes a first input statement group associated with the target service and a second input statement group unrelated to the target service; Generate, using the first model, at least two candidate answers corresponding to each input sentence in the input sentence set; determining a score for each of the candidate answers based on at least two second models; Sample data is obtained, wherein the sample data includes: the candidate answers whose scores satisfy the scoring threshold, the input sentences corresponding to the candidate answers whose scores satisfy the scoring threshold, and the target service information.
2. The method of claim 1, wherein: The step of using the first model to generate at least two candidate answers corresponding to each input sentence in the input sentence set includes: Based on a first prompt template corresponding to the first model, inputting information of the target service and a target input sentence into the first model to obtain a first candidate answer corresponding to the target input sentence; In response to determining that the number of second candidate answers output by the first model is less than N, based on the first prompt template, inputting the information of the target service, the target input sentence, and the first candidate answer into the first model to obtain an output second candidate answer corresponding to the target input sentence, wherein the second candidate answer is different from the first candidate answer; Wherein, N is an integer greater than or equal to 2.
3. The method according to claim 1 or 2, wherein: The satisfying of the score threshold means that each of the scores is greater than the score threshold, or the average of the scores is greater than the score threshold.
4. The method according to claim 1 or 2, wherein: The information of the target service includes at least one of the following: the name of the target service, the introduction of the target service, and the functional description information of the target service.
5. A model updating method, comprising: Based on the target service information, training data is obtained from a sample database, wherein the data in the sample database is obtained by using the method for generating sample data according to any one of claims 1 to 4; Determine the training data including the input sentences belonging to the first input sentence group as positive sample data; Determine the training data including the input sentences belonging to the second input sentence group as negative sample data; The target model corresponding to the model target service information is updated using the positive sample data and the negative sample data.
6. A method for processing a conversation, comprising: Receive query statements; Based on the second prompt template associated with the third model, the query statement is input into the third model to obtain a first output result, wherein the third model is used to determine a target model that responds to the query statement from candidate models, and the candidate models include a model generated by training using the sample data according to any one of claims 1 to 4; When the first result includes a candidate model and the execution condition is met, the query statement is input into the candidate model based on the third prompt template associated with the candidate model to obtain a reply statement corresponding to the query statement.
7. The method of claim 6, wherein: After inputting the query statement into the third model to obtain the first output result, the method further includes: When the first result includes a candidate model and the execution condition is not met, based on the second prompt template, the query statement and the first result are input into the third model to obtain an output second result; In the case that the second result does not satisfy the execution condition, based on the query statement, the first result and the second result return to execute the operation for obtaining the second result until the result output by the third model satisfies the execution condition.
8. The method of claim 7, wherein: After returning the operation of executing the second result, the method further includes: When the number of times the operation of executing the second result is performed is greater than the number threshold, and all the results output by the third model do not meet the execution condition, inputting the query statement into the candidate model to obtain an output reply statement; Based on the reply statement, a target reply statement corresponding to the query statement is determined.
9. The method according to any one of claims 6 to 8, wherein: The execution condition includes at least one of the following: the result output by the third model includes a preset execution statement, and the result output by the third model includes a preset identifier.
10. The method according to any one of claims 6 to 8, wherein: There are multiple candidate models, and the step of inputting the query statement into the candidate model to obtain an output reply statement corresponding to the query statement includes: Based on the third prompt template associated with each candidate model, the query statement is input into the candidate model to obtain an output reply statement corresponding to the query statement; At least two reply statements corresponding to the query statement are merged to obtain a target reply statement corresponding to the query statement.
11. The method of claim 10, wherein: The step of fusing at least two reply statements corresponding to the query statement to obtain a target reply statement corresponding to the query statement includes: Determine an identifier of a target service associated with the candidate model corresponding to each of the reply statements; At least two of the reply statements and the identifiers of the target services associated with each of the reply statements are sequentially concatenated to obtain a target reply statement corresponding to the query statement.
12. The method of claim 10, wherein: The step of fusing at least two reply statements corresponding to the query statement to obtain a target reply statement corresponding to the query statement includes: Based on the fourth prompt template associated with the fourth model, the query statement and the at least two reply statements are respectively input into the fourth model to obtain the output target reply statement.
13. A dialogue processing agent system, comprising: Input module, used to obtain query statements; A processing module, for determining a target task based on the query statement, and determining a target agent from a first agent library based on the target task, and triggering a second agent to call the target agent; the second agent, when determining that a calling condition of the target agent is satisfied, calls the target agent to obtain a reply statement corresponding to the query statement generated by the target agent, wherein at least one of the target agent and the second agent is configured to call a model generated by the method according to claim 5 to complete a corresponding function; An output module is used to output the reply statement.
14. A device for generating sample data based on a large model, comprising: A first acquisition module, configured to acquire a sample data generation request, wherein the generation request includes information of a target service corresponding to the sample data to be generated; A first generating module, configured to generate an input statement set according to information of the target service, wherein the input statement set includes a first input statement group associated with the target service and a second input statement group unrelated to the target service; A second generating module, configured to generate at least two candidate answers corresponding to each input sentence in the input sentence set by using the first model; A first determination module, configured to determine a score of each candidate answer based on at least two second models; The second determination module is used to obtain sample data, wherein the sample data includes: the candidate answers whose scores meet the scoring threshold, the input sentences corresponding to the candidate answers whose scores meet the scoring threshold, and the target service information.
15. The device of claim 14, wherein: The second generating module is specifically used for: Based on a first prompt template corresponding to the first model, inputting information of the target service and a target input sentence into the first model to obtain a first candidate answer corresponding to the target input sentence; In response to determining that the number of second candidate answers output by the first model is less than N, based on the first prompt template, inputting the information of the target service, the target input sentence, and the first candidate answer into the first model to obtain an output second candidate answer corresponding to the target input sentence, wherein the second candidate answer is different from the first candidate answer; Wherein, N is an integer greater than or equal to 2.
16. The device according to claim 14 or 15, wherein: The satisfying of the score threshold means that each of the scores is greater than the score threshold, or the average of the scores is greater than the score threshold.
17. The device according to claim 14 or 15, wherein: The information of the target service includes at least one of the following: the name of the target service, the introduction of the target service, and the functional description information of the target service.
18. A model updating device, comprising: A second acquisition module, configured to acquire training data from a sample database based on the target service information, wherein the data in the sample database is obtained by using the method for generating sample data according to any one of claims 1 to 4; A third determination module, configured to determine the training data including input sentences belonging to the first input sentence group as positive sample data; A fourth determination module, configured to determine the training data including input sentences belonging to the second input sentence group as negative sample data; An updating module is used to update the target model corresponding to the model target service information by using the positive sample data and the negative sample data.
19. A dialogue processing device, comprising: A receiving module, used for receiving a query statement; a fifth determination module, configured to input the query statement into the third model based on a second prompt template associated with the third model, and obtain a first output result, wherein the third model is used to determine a target model that responds to the query statement from candidate models, wherein the candidate models include a model generated by training using the sample data according to any one of claims 1 to 4; A third acquisition module is used to input the query statement into the candidate model based on a third prompt template associated with the candidate model when the first result includes a candidate model and the execution condition is met, so as to obtain a reply statement corresponding to the output query statement.
20. The device of claim 19, wherein: The third determining module is further used for: When the first result includes a candidate model and the execution condition is not met, based on the second prompt template, the query statement and the first result are input into the third model to obtain an output second result; In the case that the second result does not satisfy the execution condition, based on the query statement, the first result and the second result return to execute the operation for obtaining the second result until the result output by the third model satisfies the execution condition.
21. The device of claim 20, wherein: The second acquisition module is further used for: When the number of times the operation of executing the second result is performed is greater than the number threshold, and all the results output by the third model do not meet the execution condition, inputting the query statement into the candidate model to obtain an output reply statement; Based on the reply statement, a target reply statement corresponding to the query statement is determined.
22. The device according to any one of claims 19 to 21, wherein: The execution condition includes at least one of the following: the result output by the third model includes a preset execution statement, and the result output by the third model includes a preset identifier.
23. The device according to any one of claims 19 to 21, wherein: There are multiple candidate models, and the second acquisition module is specifically used to: Based on the third prompt template associated with each candidate model, the query statement is input into the candidate model to obtain an output reply statement corresponding to the query statement; At least two reply statements corresponding to the query statement are merged to obtain a target reply statement corresponding to the query statement.
24. The device of claim 23, wherein: The second acquisition module is specifically used for: Determine an identifier of a target service associated with the candidate model corresponding to each of the reply statements; At least two of the reply statements and the identifiers of the target services associated with each of the reply statements are sequentially concatenated to obtain a target reply statement corresponding to the query statement.
25. The apparatus of claim 23, wherein: The second acquisition module is specifically used for: Based on the fourth prompt template associated with the fourth model, the query statement and the at least two reply statements are respectively input into the fourth model to obtain the output target reply statement.
26. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for generating sample data based on a large model described in any one of claims 1-4, the model updating method described in claim 5, or the dialogue processing method described in any one of claims 6-12.
27. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: in, The computer instructions are used to enable the computer to execute the method for generating sample data based on a large model as described in any one of claims 1-4, the model updating method as described in claim 5, or the dialogue processing method as described in any one of claims 6-12.
28. A computer program product, characterized in that It includes a computer program, which, when executed by a processor, implements the method for generating sample data based on a large model as described in any one of claims 1-4, the model updating method as described in claim 5, or the dialogue processing method as described in any one of claims 6-12.
Citation Information
Patent Citations
Data processing method, server and electronic device
CN109344240A
Medicine answering method and device based on large language model, equipment and medium
CN118013021A
Retrieval type question and answer model selection method based on large language model prompting and embedding
CN118446250A
Method and device for determining training data set of large reward model and electronic equipment
CN118520090A
