Man-machine interaction method, device and equipment based on large model, medium and product
By retrieving multiple rounds of dialogue information in a vector database and generating sample samples, and combining the big model to generate objective function information, the problem of difficult human-computer interaction in the prior art is solved, and higher accuracy and flexibility are achieved.
Patent Information
- Application Number
- CN202411720275.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-21
AI Technical Summary
When existing human-computer interaction methods process input in the form of instructions, generative methods are difficult to accurately understand user intentions, resulting in unrelated or inappropriate replies.
By searching the similarity of multiple rounds of dialogue information in the vector database, a sample sample is generated, and prompt information, multiple rounds of dialogue information and sample samples are input to the big model, the objective function information corresponding to the round instruction is generated, and the reply information of the round instruction is generated based on the call result of the objective function information.
Improves the accuracy and flexibility of human-computer interaction, ensuring that the big model can accurately understand and respond to user instructions.
Smart Images

Figure CN119669436A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to large-scale model-based human-computer interaction methods, devices, equipment, media and products. Background Art
[0002] At the intersection of Natural Language Processing (NLP) and Artificial Intelligence (AI), human-computer interaction is committed to achieving effective information exchange between users and systems or machines through natural language, thereby greatly improving user experience and the intelligence level of the system. The core of human-computer interaction is to accurately understand the semantics of user questions and respond based on this understanding.
[0003] Current human-computer interaction methods usually use generative methods to generate responses that match user input by training models. However, due to the complexity and diversity of natural language, generative methods often produce irrelevant or inappropriate responses, especially when processing input in the form of instructions, the limitations of generative methods are particularly obvious. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present application provides a human-computer interaction method, device, equipment, medium and product based on a large model.
[0005] According to a first aspect of any embodiment of the present application, a human-computer interaction method based on a large model is provided, the method comprising:
[0006] Performing similarity retrieval on the multi-round dialogue information in the vector database to generate example samples; wherein the multi-round dialogue information includes the current round instructions input by the user, and the example samples include example instructions and example function information of the current round instructions;
[0007] Inputting the prompt information, the multi-round dialogue information and the example samples into the big model, and the big model generates the target function information corresponding to the current round of instructions;
[0008] Based on the calling result of the target function information, the current round reply information of the current round instruction is generated.
[0009] According to a second aspect of any embodiment of the present application, a human-computer interaction device based on a large model is provided, the device comprising:
[0010] A retrieval module, used to perform similarity retrieval on multi-round dialogue information in a vector database to generate example samples; wherein the multi-round dialogue information includes the current round instructions input by the user, and the example samples include example instructions and example function information of the current round instructions;
[0011] A generation module, used for inputting prompt information, the multi-round dialogue information and the example samples into a large model, wherein the large model generates objective function information corresponding to the current round of instructions;
[0012] The reply module is used to generate the current round reply information of the current round instruction based on the calling result of the target function information.
[0013] According to a third aspect of any embodiment of the present application, there is provided an electronic device, including:
[0014] processor;
[0015] a memory for storing processor-executable instructions;
[0016] The processor implements the method described in any embodiment of the present application by running the executable instructions.
[0017] According to a fourth aspect of any embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the method described in any embodiment of the present application is implemented.
[0018] According to a fifth aspect of any embodiment of the present application, a computer program product is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the method described in any embodiment of the present application is implemented.
[0019] The technical solution provided by this application may have the following beneficial effects:
[0020] According to the above embodiments, by performing similarity retrieval on multi-round dialogue information in a vector database to generate example samples, the prompt information, multi-round dialogue information and example samples are input into the big model to generate the target function information corresponding to this round of instructions, and based on the call result of the target function information, the reply information of this round of instructions is generated. By combining the vector database generated by retrieval enhancement with the big model, the big model can accurately understand and respond to the user's instructions based on the example instructions and example function information in the example samples, thereby improving the accuracy and flexibility of human-computer interaction.
[0021] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.
[0023] Figure 1 is a flow chart of a human-computer interaction method based on a large model according to an exemplary embodiment of the present application;
[0024] Figure 2 is a schematic diagram of multiple example samples according to an exemplary embodiment of the present application;
[0025] Figure 3 is a flow chart of another large model-based human-computer interaction method according to an exemplary embodiment of the present application;
[0026] Figure 4 is a structural schematic diagram of an electronic device according to an exemplary embodiment of the present application;
[0027] Figure 5 It is a block diagram of a human-computer interaction device based on a large model according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0028] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0029] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0030] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0031] The information input by users in the form of instructions usually contains clear action requirements, parameter settings, etc. The combination of these elements varies and often depends on specific contexts. Therefore, human-computer interaction not only needs to accurately understand the literal meaning of the instructions, but also needs to capture the implicit intentions behind the instructions.
[0032] Current human-computer interaction methods often find it difficult to achieve satisfactory accuracy when relying on generative methods to process user input commands. They are prone to hallucination problems, cannot accurately understand and respond to commands, and generate irrelevant, inappropriate or even erroneous responses.
[0033] In order to solve the above problems, the present application proposes a human-computer interaction method based on a large model. To further illustrate the present application, the following embodiments are provided:
[0034] See also Figure 1 , Figure 1 This is a flowchart of a human-computer interaction method based on a large model according to an exemplary embodiment of the present application. The human-computer interaction method can be executed by a dialogue system with human-computer interaction function, and the dialogue system can be a virtual assistant, an intelligent question-answering system, a home control system, a car system, etc. The dialogue system can be applied to electronic devices such as learning machines, robots, mobile phones, computers, digital broadcast terminals, tablet devices, personal digital assistants, and smart home appliances.
[0035] like Figure 1 As shown, the human-computer interaction method may include the following steps:
[0036] Step 102: Perform similarity search on multiple rounds of dialogue information in a vector database to generate example samples; wherein the multiple rounds of dialogue information include the current round of instructions input by the user, and the example samples include example instructions and example function information of the current round of instructions, as well as reference dialogue information before the example instructions.
[0037] In this step, the dialogue system uses the multiple natural language data sets collected in advance as multiple groups of reference data, uses the vectorization model built into the vector database to vectorize the multiple groups of reference data, and stores the vectorized multiple groups of reference data in the vector database.
[0038] When the dialogue system receives the current round of instructions input by the user, it uses the Retrieval-augmented Generation (RAG) technology to perform similarity retrieval on multiple rounds of dialogue information in the vector database, calculates the similarity scores between the multiple rounds of dialogue information and each set of reference data stored in the vector database, sorts each set of reference data according to the similarity scores, and selects a preset number of reference data with the highest similarity scores as example samples.
[0039] The multi-round dialogue information is the instructions, function information and reply information of the user and the dialogue system in the most recent rounds of dialogue, and the multi-round dialogue information at least includes the current round instructions input by the user. The current round instructions are the instructions input by the user in the current round, which are used to instruct the execution of a specific task or operation, such as: opening the countdown.
[0040] The vector database is used to store multiple sets of reference data and provide data retrieval functions. Multiple sets of reference data are used to provide sample examples for multiple rounds of dialogue information. Each set of reference data may include multiple rounds of instructions, function information corresponding to the last round of instructions, function information for each round of instructions before the last round of instructions, and reply information.
[0041] The example samples are used to guide the large model to understand the current round of instructions. The example samples may include example instructions and example function information of the current round of instructions, as well as reference dialogue information before the example instructions.
[0042] The example instruction is a specific instruction that a user may input. The example function information is information about the example function called in response to the example instruction, and is the result of understanding the example instruction and the reference dialogue information before the example instruction. The example function information may provide the specific function and related parameters required to execute the example instruction, and the example function information may include the function name and input parameters of the example function. The reference dialogue information is the dialogue information before the example instruction.
[0043] Exemplarily, the dialogue system performs similarity retrieval on multiple rounds of dialogue information in the vector database to generate two example samples. The example instruction of the first example sample is "open countdown", and the example function information is "function name of the example function: open_timer, input parameters of the example function: {}". The example instruction of the second example sample is "open timer", and the example function information is "function name of the example function: open_timer, input parameters of the example function: {}".
[0044] In one embodiment, the reference dialogue information may include at least one round of reference instructions, reference function information for each round of reference instructions, and reference reply information.
[0045] The reference instruction is the instruction input before the sample instruction. The reference reply information is generated based on the call result of the reference function corresponding to the reference function information, and is used to reflect the response result of the reference instruction. The reference function information is the information of the reference function called in response to the reference instruction, providing the specific function and related parameters required to execute the reference instruction. The reference function information may include the function name and input parameters of the reference function.
[0046] When suitable function information is not found for the reference instruction, the reference dialogue information may also include at least one round of reference instructions, understanding information for each round of reference instructions, and reference reply information.
[0047] For example, Figure 2 A schematic diagram of multiple example samples is shown. Figure 2 As shown, the dialogue system uses the understanding results of the reference dialogue information and the example instructions as the example function information. Figure 2 The two example samples shown include reference dialogue information, example instructions and corresponding example function information. The understanding information in the second example sample indicates that no suitable function information is found for the reference instruction.
[0048] As described above, by providing at least one round of reference instructions, reference function information and reference response information for each round of reference instructions in the reference dialogue information of the example sample, the large model can capture the evolution and consistency of user intentions, be exposed to more diverse dialogue scenarios and instruction types, and thus more accurately parse and execute this round of instructions.
[0049] Step 104: Input the prompt information, multi-round dialogue information and example samples into the large model, and the large model generates the target function information corresponding to this round of instructions.
[0050] In this step, the dialogue system can assemble prompt information, multi-round dialogue information and example samples, and input the assembled input data into the large model. The large model can refer to the context information in the example samples and multi-round dialogue information to generate the objective function information.
[0051] The prompt information is used to guide the large model to understand the multi-round dialogue information and example samples, and can be set based on actual business needs. The target function information is a structured understanding result generated based on the multi-round dialogue information and example samples, and provides the relevant parameters of the target function required to execute the current round of instructions. The target function information may include the function name and input parameters of the target function.
[0052] In one embodiment, the prompt information may include multiple candidate function data. The candidate function data is used to reflect the tools that the large model supports calling, and each candidate function data may include the function name, input parameters and function function of the candidate function. The target function information is determined from the multiple candidate function data, and the function function is the tool function executed by calling the candidate function.
[0053] For example, the prompt message may be: "Please follow my instructions strictly: You must select one of the following candidate function data based on multiple rounds of dialogue information and use it. You have the following candidate functions: candidate function data 1; candidate function data 2; candidate function data 3. You can insert zero, one, or more of the following commands in the reply to call the candidate function:
[0054] Action: Function name, must be one of the function names in [alternative function data 1, alternative function data 2, alternative function data 3].
[0055] Action Input: Input parameter, must be one of the input parameters of [alternative function data 1, alternative function data 2, alternative function data 3].
[0056] Observation: The result of calling the alternative function.
[0057] Answer: Reply according to the call result."
[0058] As described above, by providing multiple alternative function data in the prompt information, when the dialogue system needs to expand new tool functions, it only needs to add new alternative function data to the prompt information and add some relevant reference data to the vector database for application without retraining the large model, which greatly improves the scalability of the dialogue system.
[0059] In one embodiment, after retrieving and generating the sample samples, the dialogue system calculates the sample quantity of the sample samples. When it is determined that the sample quantity of the sample samples is less than the preset quantity, the preset samples are selected to fill the sample quantity to the preset quantity, and the prompt information, multi-round dialogue information, the sample samples and the preset samples are input into the large model, and the large model generates the objective function information according to the sample samples and the preset samples.
[0060] Among them, the preset samples are guiding data for understanding this round of instructions. The preset samples may include instructions and corresponding function information that meet conditions such as frequency of use and maximum number of uses. The preset samples are used to supplement the example samples.
[0061] As described above, by inputting prompt information, multi-round dialogue information, example samples and preset samples into the large model when it is determined that the number of example samples is lower than the preset number, the large model can maintain a certain performance and accuracy under different numbers of example samples, thereby improving the adaptability and flexibility of the large model.
[0062] Step 106: Based on the calling result of the target function information, generate the current round reply information of the current round instruction.
[0063] In this step, the dialogue system generates the target function information based on the large model. The dialogue system calls the corresponding target function processing logic through its own or external system's tool end, and generates and returns the reply information corresponding to the user's current round of instructions based on the call result of the target function information.
[0064] The call result is the return result of calling the target function information, which is used to reflect the execution status of this round of instructions by using parameters and other methods. The call result may include: the execution status of the target function, output data and other information. The reply information of this round is the reply information to the instructions of this round, which is used to reflect the execution status of this round of instructions by using natural language.
[0065] The tool side is a component that performs specific tasks or calls specific functions. It can call the corresponding target function and return the call result. It can be the dialogue system's own timing tool, navigation tool, home control tool, data query tool, text analysis tool, etc., or it can be an interface to an external system.
[0066] In one embodiment, after the large model generates the target function information corresponding to the current round of instructions, the dialogue system sends a function execution request to the tool end, and after receiving the function execution request, the tool end calls the corresponding target function execution processing logic. After the target function is executed, the tool end returns the call result of the target function to the dialogue system.
[0067] The dialogue system receives the call result returned by the tool end, generates this round of reply information based on the call result of the target function information, and returns the reply information to the user.
[0068] The function execution request is used to instruct the tool to call the target function, and the function execution request may carry the function name and input parameters of the target function.
[0069] As described above, by sending a function execution request to the tool side, so that the tool side calls the target function and receives the call result returned by the tool side, different tool functions inside or outside the dialogue system can be automatically executed with only the user's natural language instructions, providing users with convenient and accurate services and improving user experience and interaction efficiency.
[0070] The human-computer interaction method based on a big model in this embodiment generates example samples by performing similarity retrieval on multi-round dialogue information in a vector database, inputs prompt information, multi-round dialogue information and example samples into the big model, generates target function information corresponding to this round of instructions, generates this round of reply information of this round of instructions based on the call result of the target function information, and combines the vector database generated by retrieval enhancement with the big model. The big model can accurately understand and respond to user instructions based on example instructions and example function information in the example samples, thereby improving the accuracy and flexibility of human-computer interaction. In addition, the big model can quickly supplement external knowledge in the vector database, and has high scalability and rapid repair capabilities.
[0071] In the above-mentioned embodiments, it is introduced that the vector database and the large model are combined to understand the user's natural language instructions and generate corresponding structured understanding results, and the current round of reply information is generated based on the call result of the target function information. In the following embodiments, the training process of the large model will be described in detail, and it can be applied to any of the above embodiments.
[0072] In one embodiment, the dialogue system can use training prompt information, training example samples, training multi-round dialogue information and general question and answer data as sample sets for model training. According to the question and answer data format of the basic model, each data set in the sample set is preprocessed, and the sample set can be divided into a training set and a test set by using methods such as random partitioning and stratified partitioning, and there is no overlapping data in the data sets of the training set and the test set.
[0073] The dialogue system calculates the number of training steps for the basic model based on the preset number of training rounds (epochs) and batch size (batch). Using the full parameter fine-tuning technology, in each training step, a batch size data set is randomly selected from the training set to fine-tune the basic model, using the cross-entropy loss function (Cross-Entropy) as the optimization target, and adjusting the weight of the basic model by minimizing the cross-entropy loss function.
[0074] After each training round or after a certain number of training steps is reached, the weights of the adjusted basic model are verified using the test set, and the accuracy, recall, F1 score and other performance indicators of the basic model on the test set are calculated to evaluate the fine-tuning effect of the adjusted basic model. When it is determined that the number of training steps has been reached, the training is stopped to obtain the fine-tuned large model.
[0075] The basic model is a model with the function call capability. The training set is used to fine-tune the basic model, and the test set is used to verify and test the fine-tuning effect of the basic model.
[0076] The training prompt information is used to guide the basic model to generate accurate understanding results during the training process. The training multi-round dialogue information is a multi-round data set consisting of the user's multi-round instructions, the function information corresponding to the multi-round instructions, and the reply information to the instructions. The training example samples are used to guide the basic model to generate the function information of the last round of instructions in the multi-round dialogue information.
[0077] As described above, by calculating the number of training steps of the basic model according to the preset number of training rounds and batch size, adopting the full parameter fine-tuning technology, using the training set to adjust the weight of the basic model, using the test set to verify the weight of the adjusted basic model, and evaluating the fine-tuning effect of the adjusted basic model, when it is determined that the number of training steps has been reached, the training is stopped to obtain the fine-tuned large model. The basic model can directly learn the ability to understand natural language instructions from the training set and the test set, optimize the overall performance of the large model, and there is no need to design and tune each module in the large model separately, thereby enhancing the large model's ability to understand and generalize natural language.
[0078] In one embodiment, when dividing the sample set, the dialogue system divides all common question and answer data into the training set, which may include training prompt information, training example samples, training multi-round dialogue information and common question and answer data. The question and answer data is a public common question and answer pair, which is used to maintain the generalization ability of the large model.
[0079] As mentioned above, by learning training prompt information, training example samples, and training multi-round dialogue information, the model can more accurately understand user intentions and generate target function information, enhance the model's understanding and generation capabilities, and by learning general question-and-answer data, it helps the model learn a wider range of features and rules during the training process, thereby improving the generalization ability of large models when facing new inputs.
[0080] In the above-mentioned embodiment, the full parameter fine-tuning method is introduced to train the basic model using the sample set to generate a fine-tuned large model. In the following embodiment, the processing process of multi-round dialogue information will be described in detail and can be applied to any of the above embodiments.
[0081] In one embodiment, the dialogue system obtains the current round of instructions input by the user, obtains the historical dialogue set before the current round of instructions, and assembles the current round of instructions and the historical dialogue set to obtain multi-round dialogue information.
[0082] The historical conversation set may include historical instructions for each round of conversation, historical function information generated for historical instructions, and historical reply information. Historical instructions are instructions input by the user before the current round of instructions during this conversation, and historical function information is information about historical functions called in response to historical instructions. The historical function information may include the function name and input parameters of the historical function. The historical reply information is generated based on the call result obtained by calling the historical function corresponding to the historical function information.
[0083] As described above, by obtaining the current round of instructions input by the user, obtaining the historical dialogue set before the current round of instructions, assembling the current round of instructions and the historical dialogue set to obtain multi-round dialogue information, the dialogue system can more comprehensively understand the context of the current round of instructions currently input by the user, which helps the system to more accurately capture the user's true intentions, thereby maintaining the coherence and fluency of the dialogue.
[0084] In one embodiment, after generating the current round reply information of the current round instruction, the dialogue system compares the dialogue round of the historical dialogue set with the preset round. If the dialogue round of the historical dialogue set exceeds the preset round, the dialogue information of the dialogue round with the longest recording time is cleared from the historical dialogue set.
[0085] The current round of instructions, target function information and current round of reply information are recorded in the historical dialogue set as historical instructions, historical function information and historical reply information respectively, so as to be retrieved based on the latest multi-round dialogue information in the next round of dialogue.
[0086] As described above, by clearing the conversation information of the conversation round with the longest recording time in the historical conversation set when the conversation rounds in the historical conversation set exceed the preset rounds, it helps to reduce redundant information in the conversation context. Recording the current round of instructions, objective function information and current round of reply information in the historical conversation set can ensure the continuity of the conversation, facilitate subsequent retrieval of more accurate and coherent example samples, and improve the overall interactive experience and efficiency.
[0087] To further illustrate the human-computer interaction process based on the large model, Figure 3 A flowchart of another human-computer interaction method based on a large model is shown. The human-computer interaction method may include the following steps:
[0088] Step 302: Obtain the current round of instructions input by the user during the first round of conversation.
[0089] In this step, the dialogue system obtains the current round of instructions input by the user during the first round of dialogue.
[0090] Step 304: perform similarity search on the instructions of this round in the vector database to generate example samples.
[0091] In this step, the historical dialogue set is empty at this time, and the dialogue system performs a similarity search for the current round of instructions in the vector database. Taking the preset number N as an example, the N groups of reference data with the highest similarity scores are selected as N example samples.
[0092] Step 306: Determine the relationship between the sample quantity and the preset quantity N.
[0093] In this step, the dialogue system calculates the sample quantity of the example samples generated by the retrieval, and determines the relationship between the sample quantity of the example samples and the preset quantity.
[0094] If no relevant reference data is retrieved, the sample quantity of the example sample is 0, and step 308 is executed;
[0095] If the number of sample samples generated by retrieval is less than N, step 310 is executed;
[0096] If the number of sample samples generated by retrieval is equal to N, step 312 is executed.
[0097] Step 308: The dialogue system inputs prompt information, current round instructions, and preset samples into the large model.
[0098] Step 310: The dialogue system inputs prompt information, current round instructions, example samples and preset samples into the large model.
[0099] Step 312: The dialogue system inputs prompt information, current round instructions, and example samples into the large model.
[0100] Step 314: The large model generates the target function information corresponding to the current round of instructions.
[0101] In this step, the large model generates the objective function information corresponding to this round of instructions based on the input data.
[0102] Step 316: Generate this round of reply information based on the calling result of the target function information.
[0103] In this step, the dialog system sends a function execution request to the tool end inside or outside the system, and the tool end calls the target function according to the function name and input parameters carried in the function execution request. The dialog system receives the call result of the target function information returned by the tool end, and generates the reply information of this round based on the call result.
[0104] Step 318: Determine whether to start a new session.
[0105] In this step, the dialogue system determines whether the user starts a new dialogue process.
[0106] If the user starts a new conversation process, execute step 302;
[0107] If the user does not start a new dialog process, step 320 is executed.
[0108] Step 320: Assemble the current round instructions of the second round and the historical dialogue set to obtain multi-round dialogue information.
[0109] In this step, the dialogue system records the first round of current instructions, target function information and current round reply information into the historical dialogue set. The second round of current instructions and historical dialogue set are assembled to obtain multi-round dialogue information.
[0110] Step 322: The dialogue system performs similarity retrieval on multiple rounds of dialogue information in the vector database to generate example samples for the second round.
[0111] Step 324: Input the prompt information, multi-round dialogue information and example samples into the large model to generate the second round of objective function information.
[0112] In this step, when it is determined that the sample quantity of the example samples is equal to the preset quantity, the prompt information, multi-round dialogue information and the example samples are input into the large model, and the large model generates the objective function information of the second round.
[0113] Step 326: The dialogue system generates the second round of response information based on the calling result of the target function information.
[0114] Step 328: Enter the next round of the current dialogue process or start a new dialogue process.
[0115] In this step, the dialogue system enters the next round of this dialogue process. If the dialogue rounds in the historical dialogue set do not exceed the preset rounds, the current round instructions, objective function information and current round reply information of the second round are recorded in the historical dialogue set.
[0116] The dialogue system assembles the user's third-round instructions with the historical dialogue set to obtain multi-round dialogue information. Based on the multi-round dialogue information, it performs retrieval to generate the third-round objective function information and the current-round reply message.
[0117] When the number of conversation rounds in the historical conversation set exceeds the preset number of rounds, the conversation information of the conversation round with the longest recording time is cleared in the historical conversation set, and the latest historical conversation set and the current round instructions are used for retrieval and interaction.
[0118] If it is determined that the user starts a new dialog process, step 302 is executed again.
[0119] Figure 4This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment of the present application. The electronic device may be, for example, a learning machine, a mobile phone, a computer, a digital broadcast terminal, a message transceiver, a game console, a tablet device, a personal digital assistant, a server, a smart home appliance, a car machine, etc. Figure 4 At the hardware level, the electronic device includes a processor 402, an internal bus 404, a network interface 406, a memory 408, and a non-volatile memory 410, and may also include hardware required for other services. The processor 402 reads the corresponding computer program from the non-volatile memory 410 into the memory 408 and then runs it, forming a human-computer interaction device based on a large model at the logical level. Of course, in addition to the software implementation, this application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0120] Figure 5 is a block diagram of a human-computer interaction device based on a large model according to an exemplary embodiment of the present application. Figure 5 , the apparatus may include: a retrieval module 502, a generation module 504 and a reply module 506, wherein:
[0121] The retrieval module 502 is used to perform similarity retrieval on the multi-round dialogue information in the vector database to generate example samples; wherein the multi-round dialogue information includes the current round instructions input by the user, and the example samples include example instructions and example function information of the current round instructions;
[0122] The generating module 504 is used to input the prompt information, the multi-round dialogue information and the example sample into the large model, and the large model generates the target function information corresponding to the current round of instructions;
[0123] The reply module 506 is used to generate the current round reply information of the current round instruction based on the calling result of the target function information.
[0124] In one example, the generation module 504, when used to input the prompt information, the multi-round dialogue information and the example samples into the large model, includes: when it is determined that the sample quantity of the example samples is lower than a preset quantity, inputting the prompt information, the multi-round dialogue information, the example samples and the preset samples into the large model; wherein the preset samples are used to supplement the example samples.
[0125] In one example, the reference dialogue information includes at least one round of reference instructions, reference function information for each round of reference instructions, and reference reply information, and the reference reply information is generated based on a call result obtained by calling a reference function corresponding to the reference function information.
[0126] In one example, the generation module 504, before being used to input the prompt information, the multi-round dialogue information and the example samples into the large model and the large model generates the objective function information corresponding to the current round of instructions, also includes: calculating the number of training steps of the basic model according to the preset number of training rounds and batch size; using the full parameter fine-tuning technology to adjust the weight of the basic model using the training set; using the test set to verify the weight of the adjusted basic model and evaluate the fine-tuning effect of the adjusted basic model; when it is determined that the number of training steps has been reached, stopping the training to obtain the fine-tuned large model.
[0127] In one example, the target function information includes the function name and input parameters of the target function; the reply module 506, before being used to generate the current round reply information of the current round of instructions based on the calling result of the target function information, also includes: sending a function execution request to the tool side so that the tool side calls the target function; wherein the function execution request carries the function name and the input parameters; and receiving the calling result returned by the tool side.
[0128] In one example, the retrieval module 502, before being used to perform similarity retrieval on multiple rounds of dialogue information in a vector database and generating example samples, further includes: obtaining the current round of instructions input by the user; obtaining the historical dialogue set before the current round of instructions, the historical dialogue set including historical instructions, historical function information generated for the historical instructions, and historical reply information; assembling the current round of instructions and the historical dialogue set to obtain the multiple rounds of dialogue information.
[0129] In one example, the reply module 506, after being used to generate the current round reply information of the current round instruction based on the call result of the objective function information, further includes: when the conversation round of the historical conversation set exceeds the preset round, clearing the conversation information of the conversation round with the longest recording time in the historical conversation set; recording the current round instruction, the objective function information and the current round reply information in the historical conversation set.
[0130] In one example, the prompt information includes a plurality of candidate function data, each candidate function data includes a function name, input parameters and function function of the candidate function; and the target function information is determined from the plurality of candidate function data.
[0131] In one example, the training set includes training prompt information, training example samples, training multi-round dialogue information, and general question-answering data.
[0132] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0133] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.
[0134] In an exemplary embodiment, a non-temporary computer-readable storage medium including instructions is also provided, such as a memory including instructions. The instructions can be executed by a processor of a large model-based human-computer interaction device to implement any method described in the above embodiments.
[0135] The non-temporary computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc., and the present application does not limit this.
[0136] In an exemplary embodiment, a computer program product including a computer program / instruction is also provided. The computer program / instruction can be executed by a processor of a human-computer interaction device based on a large model to implement any method described in the above embodiments.
[0137] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0138] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the inventions claimed herein. The present application is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
[0139] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A human-computer interaction method based on a large model, characterized in that: The method comprises: Performing similarity retrieval on multiple rounds of dialogue information in a vector database to generate example samples; wherein the multiple rounds of dialogue information include current round instructions input by the user, and the example samples include example instructions and example function information of the current round instructions, and reference dialogue information before the example instructions; Inputting the prompt information, the multi-round dialogue information and the example samples into the big model, and the big model generates the target function information corresponding to the current round of instructions; Based on the calling result of the target function information, the current round reply information of the current round instruction is generated.
2. The method according to claim 1, characterized in that The step of inputting the prompt information, the multi-round dialogue information and the example sample into the large model comprises: In the case where it is determined that the sample quantity of the example sample is less than a preset quantity, inputting the prompt information, the multi-round dialogue information, the example sample and the preset sample into the large model; The preset samples are used to supplement the example samples.
3. The method according to claim 1, characterized in that The reference dialogue information includes at least one round of reference instructions, reference function information for each round of reference instructions, and reference reply information, wherein the reference reply information is generated based on a call result obtained by calling a reference function corresponding to the reference function information.
4. The method according to claim 1, characterized in that: Before the prompt information, the multi-round dialogue information and the example samples are input into the large model and the large model generates the target function information corresponding to the current round of instructions, the method further includes: Calculate the number of training steps for the base model based on the preset number of training rounds and batch size; Using full parameter fine-tuning technology, the weights of the basic model are adjusted using the training set; Using the test set to verify the weights of the adjusted basic model, and evaluating the fine-tuning effect of the adjusted basic model; When it is determined that the number of training steps has been reached, the training is stopped to obtain a fine-tuned large model.
5. The method according to claim 1, characterized in that The objective function information includes the function name and input parameters of the objective function; Before generating the current round reply information of the current round instruction based on the calling result of the target function information, the method further includes: Sending a function execution request to the tool end so that the tool end calls the target function; wherein the function execution request carries the function name and the input parameters; Receive the call result returned by the tool end.
6. The method according to claim 1, characterized in that Before performing similarity retrieval on the multi-round dialogue information in the vector database to generate example samples, the method further includes: Obtaining the current round of instructions input by the user; Acquire a historical dialogue set before the current round of instructions, wherein the historical dialogue set includes historical instructions, historical function information generated for the historical instructions, and historical reply information; The current round of instructions and the historical dialogue set are assembled to obtain the multi-round dialogue information.
7. The method according to claim 6, characterized in that After generating the current round reply information of the current round instruction based on the calling result of the target function information, the method further includes: When the number of conversation rounds in the historical conversation set exceeds a preset number of rounds, clearing the conversation information of the conversation round with the longest recording time in the historical conversation set; The current round of instructions, the target function information and the current round of reply information are recorded in the historical conversation set.
8. The method according to claim 1, characterized in that The prompt information includes a plurality of candidate function data, each candidate function data includes a function name, input parameters and function function of the candidate function; the target function information is determined from the plurality of candidate function data.
9. The method according to claim 4, characterized in that The training set includes training prompt information, training example samples, training multi-round dialogue information and general question-answering data.
10. A human-computer interaction device based on a large model, characterized in that: The device comprises: A retrieval module, used to perform similarity retrieval on multi-round dialogue information in a vector database to generate example samples; wherein the multi-round dialogue information includes the current round instructions input by the user, and the example samples include example instructions and example function information of the current round instructions; A generation module, used for inputting prompt information, the multi-round dialogue information and the example samples into a large model, wherein the large model generates objective function information corresponding to the current round of instructions; The reply module is used to generate the current round reply information of the current round instruction based on the calling result of the target function information.
11. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 9 by running the executable instructions.
12. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product having a computer program / instructions stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Tool calling method in task-based dialogue, medium, equipment and product
CN120523922A