Training method of retrieval model, answer obtaining method and device

By optimizing the retrieval redundancy and response factuality of the large language model, the problems of redundant retrieval and inaccurate responses are solved, achieving efficient and low-cost information retrieval and response generation.

CN120849541BActive Publication Date: 2026-08-04BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2025-06-16
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing large language models suffer from redundant retrieval and inconsistent results with facts during information retrieval, resulting in high retrieval costs and low response quality.

Method used

By acquiring fine-tuned samples of the candidate large model, calculating the fine-tuning loss of the retrieval redundancy dimension and the response factual dimension, performing iterative optimization, generating the optimized target large model, and using it to train the target retrieval model, thereby reducing the probability of redundant retrieval and improving the accuracy of response results.

Benefits of technology

It reduces redundant retrievals and costs in the retrieval model, improves the quality of generated response results, optimizes model performance, and reduces resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120849541B_ABST
    Figure CN120849541B_ABST
Patent Text Reader

Abstract

The present disclosure provides a training method and device of a retrieval model, and an answer obtaining method and device, and relates to the technical field of artificial intelligence such as natural language processing and deep learning. The method comprises the following steps: obtaining a candidate large model to be optimized, and obtaining a sample demand answer pair corresponding to the candidate large model to obtain a fine-tuning sample of the candidate large model; obtaining a set of answer results output by the candidate large model based on the fine-tuning sample, and obtaining a first fine-tuning loss of the candidate large model in a retrieval redundancy dimension and a second fine-tuning loss of the candidate large model in an answer factual dimension based on the set of answer results; iteratively optimizing the candidate large model based on the first fine-tuning loss and the second fine-tuning loss to obtain an optimized target large model; and obtaining a target retrieval model based on the target large model and a candidate retrieval model to be trained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of large language model technology, and in particular to the fields of artificial intelligence technology such as natural language processing and deep learning. Background Technology

[0002] With the development of technology, people can obtain the information they want through the search services provided by artificial intelligence. After receiving the input request information, artificial intelligence can generate corresponding answers through external information retrieval and return them to the user. However, the search cost is relatively high. Summary of the Invention

[0003] This disclosure proposes a method for training a retrieval model, a method for obtaining responses, and an apparatus.

[0004] According to a first aspect of this disclosure, a method for training a retrieval model is proposed, comprising: obtaining a candidate large model to be optimized, and obtaining sample demand-response pairs corresponding to the candidate large model to obtain fine-tuning samples of the candidate large model; obtaining a set of response results output by the candidate large model based on the fine-tuning samples, and obtaining a first fine-tuning loss of the candidate large model under the retrieval redundancy dimension and a second fine-tuning loss under the response factuality dimension based on the set of response results; iteratively optimizing the candidate large model based on the first fine-tuning loss and the second fine-tuning loss to obtain an optimized target large model; and obtaining a target retrieval model based on the target large model and the candidate retrieval model to be trained.

[0005] According to a second aspect of this disclosure, a response acquisition method is proposed, comprising: acquiring a target retrieval requirement and a target retrieval model from a user, wherein the target retrieval model is obtained based on the retrieval model acquisition method proposed in the first aspect above; in response to triggering an external retrieval by identifying the target retrieval requirement through the target retrieval model, obtaining a first target response result corresponding to the target retrieval requirement through the retrieval information obtained from the external retrieval; and in response to identifying that the target retrieval requirement has not triggered an external retrieval by the target retrieval model, obtaining a second target response result corresponding to the target retrieval requirement based on the historical learning knowledge base of the target retrieval model.

[0006] According to a third aspect of this disclosure, a training apparatus for a retrieval model is proposed, comprising: a first acquisition module, configured to acquire a candidate large model to be optimized, and acquire sample demand-response pairs corresponding to the candidate large model, so as to obtain fine-tuning samples of the candidate large model; a second acquisition module, configured to acquire a set of response results output by the candidate large model based on the fine-tuning samples, and acquire a first fine-tuning loss of the candidate large model under the retrieval redundancy dimension and a second fine-tuning loss under the response factuality dimension based on the set of response results; an optimization module, configured to iteratively optimize the candidate large model based on the first fine-tuning loss and the second fine-tuning loss to obtain an optimized target large model; and a training module, configured to obtain a target retrieval model based on the target large model and the candidate retrieval model to be trained.

[0007] According to a fourth aspect of this disclosure, a response acquisition device is proposed, comprising: a third acquisition module for acquiring a target retrieval requirement and a target retrieval model from a user terminal, wherein the target retrieval model is obtained based on the acquisition device for the retrieval model proposed in the third aspect; a first response module for obtaining a first target response result corresponding to the target retrieval requirement by means of external retrieval information obtained from external retrieval information in response to the target retrieval requirement not being triggered by external retrieval information obtained from the target retrieval model; and a second response module for obtaining a second target response result corresponding to the target retrieval requirement based on the historical learning knowledge base of the target retrieval model in response to the target retrieval requirement not being triggered by external retrieval information obtained from the target retrieval model.

[0008] According to a fifth aspect of this disclosure, an electronic device is proposed, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the training method of the retrieval model proposed in the first aspect and / or the response acquisition method proposed in the second aspect.

[0009] According to a sixth aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the training method of the retrieval model proposed in the first aspect and / or the response acquisition method proposed in the second aspect.

[0010] According to the seventh aspect of this disclosure, a computer program product is proposed, comprising a computer program that, when executed by a processor, implements the training method for the retrieval model proposed in the first aspect and / or the response acquisition method proposed in the second aspect.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0013] Figure 1 This is a flowchart illustrating a training method for a retrieval model according to an embodiment of the present disclosure.

[0014] Figure 2 This is a flowchart illustrating a training method for a retrieval model according to another embodiment of the present disclosure;

[0015] Figure 3 This is a flowchart illustrating a training method for a retrieval model according to another embodiment of the present disclosure;

[0016] Figure 4 This is a schematic flowchart of a response acquisition method according to an embodiment of the present disclosure;

[0017] Figure 5 This is a schematic diagram of the structure of a training device for a retrieval model according to an embodiment of the present disclosure;

[0018] Figure 6 This is a schematic diagram of the structure of a response acquisition device according to an embodiment of the present disclosure;

[0019] Figure 7 This is a schematic block diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation

[0020] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0021] Data processing is a fundamental aspect of systems engineering and automatic control. Data is a form of expression of facts, concepts, or instructions, which can be processed manually or by automated devices. After data is interpreted and given meaning, it becomes information. Data processing involves the acquisition, storage, retrieval, processing, transformation, and transmission of data. The basic purpose of data processing is to extract and derive valuable and meaningful data from large amounts of potentially chaotic and difficult-to-understand data.

[0022] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Its main applications include machine translation, public opinion monitoring, automatic summarization, opinion extraction, text classification, question answering, text semantic comparison, speech recognition, and Chinese OCR.

[0023] Artificial Intelligence (AI) is a key driving force behind the new round of technological revolution and industrial transformation. It is a new technological science that studies and develops theories, methods, technologies, and application systems to simulate, extend, and expand human intelligence. AI is an important component of the discipline of intelligence; it attempts to understand the essence of intelligence and produce a new kind of intelligent machine capable of reacting in a manner similar to human intelligence.

[0024] Artificial intelligence is a very broad science, including robotics, speech recognition, image recognition, natural language processing, expert systems, machine learning, computer vision, and so on.

[0025] Figure 1 This is a flowchart illustrating a training method for a retrieval model according to an embodiment of the present disclosure, as shown below. Figure 1 As shown, the method includes:

[0026] S101, obtain the candidate large model to be optimized, and obtain the sample requirement response pair corresponding to the candidate large model, so as to obtain the fine-tuning sample of the candidate large model.

[0027] In this embodiment of the disclosure, people can input their needs for the information they want to retrieve into the retrieval model through interaction with the retrieval model, and then retrieve the relevant information through the services provided by the retrieval model, thereby obtaining the retrieval results returned by the model.

[0028] Optionally, the retrieval model can achieve information retrieval based on the capabilities of the large model. In this scenario, the large model can be fine-tuned and optimized to improve the performance of the retrieval model.

[0029] Specifically, the large model can be identified as a candidate large model to be optimized, and the samples used when fine-tuning the candidate large model can be identified as fine-tuning samples for the candidate large model.

[0030] Optionally, any search request and its corresponding search response can be extracted from a preset sample database, and the data pair consisting of the search request and its corresponding search response can be determined as a sample request-response pair.

[0031] Furthermore, based on the sample construction method in related technologies, the sample demand response pair is processed to construct samples, thereby obtaining samples generated based on the sample demand response pair, which are used as candidate large models for model optimization and fine-tuning.

[0032] S102, obtain the set of response results of the candidate large model based on the fine-tuned sample output, and obtain the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension and the second fine-tuning loss under the response factual dimension based on the set of response results.

[0033] In this embodiment of the disclosure, the large model can perform external information retrieval based on the input retrieval requirements to obtain the corresponding retrieval response. In this process, the large model may perform external information retrieval even when it has already learned the knowledge corresponding to the retrieval requirements. This situation can be understood as the large model performing unnecessary redundant retrieval.

[0034] In this scenario, when fine-tuning the candidate large model, a corresponding fine-tuning optimization task can be constructed based on the redundant retrieval situation of the large model mentioned above, in order to reduce the possibility of unnecessary redundant retrieval of the candidate large model. This task can be identified as the retrieval redundancy optimization task of the candidate large model.

[0035] Optionally, the fine-tuned sample can be input into the candidate large model, and the model capability of the candidate large model can be used to retrieve and respond to the sample retrieval requirements carried in the fine-tuned sample. The response output by the candidate large model is determined as the response result obtained based on the fine-tuned sample, and then the response results output by the candidate large model multiple times are used to form a response result set.

[0036] In this scenario, the loss algorithm used in the retrieval redundancy optimization task can be obtained, and the algorithm can be used to process each response result and fine-tuning sample in the response result set to obtain the loss value of each response result based on the fine-tuning sample. Then, based on each loss value, the fine-tuning loss of the candidate large model under the retrieval redundancy optimization task can be obtained and determined as the first fine-tuning loss.

[0037] In this embodiment of the disclosure, when the large model generates the corresponding set of response results, it can perform logical reasoning based on the retrieved information to obtain the output set of response results. In this scenario, the set of response results obtained by the large model may contain logically consistent but factually inconsistent response results.

[0038] In this scenario, a fine-tuning optimization task corresponding to the candidate large model is constructed based on the above possible situations, and this task is identified as the response factual optimization task of the candidate large model.

[0039] Optionally, the loss algorithm used by the candidate large model in the response factual optimization task can be obtained, and the algorithm can be used to process each response result and fine-tuning sample in the response result set to obtain the loss value of each response result based on the fine-tuning sample. Then, based on each loss value, the fine-tuning loss of the candidate large model in the response factual optimization task can be obtained and determined as the second fine-tuning loss.

[0040] S103, based on the first fine-tuning loss and the second fine-tuning loss, iteratively optimize the candidate large model to obtain the optimized target large model.

[0041] Optionally, based on the large model parameter fine-tuning method in related technologies, the model parameters of the candidate large model can be adjusted and iterated based on the first fine-tuning loss and the second fine-tuning loss until the model fine-tuning termination condition of the candidate large model is met, then the model fine-tuning of the candidate large model can be terminated, and the candidate large model obtained in the last fine-tuning round is determined as the optimized target large model.

[0042] The termination condition for fine-tuning the candidate large model can be set based on the response results output by the candidate large model or based on the number of fine-tuning rounds of the candidate large model; no specific limitation is made here.

[0043] S104. Based on the target large model and the candidate retrieval models to be trained, a trained target retrieval model is obtained.

[0044] In this embodiment of the disclosure, the retrieval model needs to achieve retrieval response based on the model capabilities of the large model. In this scenario, when the optimized target large model is obtained, the relevant retrieval model can be trained accordingly based on the optimized target large model, so that the trained retrieval model can apply the model capabilities of the optimized target large model.

[0045] Among these, the retrieval models that need to be trained can be identified as candidate retrieval models to be trained.

[0046] Optionally, some model parameters required by the candidate retrieval model can be obtained from the model parameters of the target large model, and a training task for the candidate retrieval model can be constructed based on these model parameters. Furthermore, the execution of this training task enables the trained retrieval model to realize the application of the model capabilities of the target large model.

[0047] The trained retrieval model can then be identified as the target retrieval model.

[0048] The training method for the retrieval model proposed in this disclosure involves obtaining candidate large models and sample-response pairs to obtain fine-tuned samples for the candidate large models, obtaining a set of response results output by the candidate large models based on the fine-tuned samples, obtaining a first fine-tuning loss for the candidate large models under the retrieval redundancy dimension and a second fine-tuning loss under the response factual dimension, optimizing the candidate large models based on the first and second fine-tuning losses to obtain a target large model, and then obtaining a trained target retrieval model based on the target large model and the candidate retrieval models to be trained. In this disclosure, optimizing the candidate large models through the first fine-tuning loss under the retrieval redundancy dimension reduces the number and probability of redundant retrievals in the optimized target large model, thereby reducing the retrieval cost of generating response results. Optimizing the candidate large models through the second fine-tuning loss under the response factual dimension reduces the possibility that the response results output by the optimized target large model are inconsistent with the facts, improving the quality of response results generated. The trained target retrieval model obtained based on the target large model achieves the transfer of the performance of the target large model to the lightweight candidate retrieval model, reduces the resource consumption of the target retrieval model, and optimizes the model performance of the target retrieval model.

[0049] In the above embodiments, the acquisition of the target retrieval model can be combined with... Figure 2 To understand further, Figure 2 This is a flowchart illustrating a training method for a retrieval model according to another embodiment of the present disclosure, as shown below. Figure 2 As shown, the method includes:

[0050] S201, obtain the tag retrieval identifier corresponding to the fine-tuning sample, and the response retrieval identifier of each response result in the response result set, so as to obtain the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension. Among them, the tag retrieval identifier is used to characterize whether the sample retrieval requirement in the fine-tuning sample needs to perform external information retrieval, and the response retrieval identifier is used to characterize whether the response result is obtained based on external information retrieval.

[0051] Optionally, based on the tag retrieval identifier and the response retrieval identifier, a retrieval redundancy detection is performed on each response result to obtain the retrieval redundancy detection result for each response result.

[0052] In this embodiment of the disclosure, if any response result output by the candidate large model based on the fine-tuned sample input therein has a corresponding retrieval identifier, the retrieval identifier can be determined as the response retrieval identifier corresponding to the response result.

[0053] This can be understood as follows: based on the parameter value corresponding to the retrieval identifier of the response, it can be determined whether the candidate large model performed an external search during the process of generating the response result.

[0054] In this embodiment of the disclosure, the tag information of the fine-tuning sample includes a corresponding external retrieval identifier. This identifier can be identified as the tag retrieval identifier of the fine-tuning sample. It can be understood that, based on the parameter value of the tag retrieval identifier, it can be determined whether the sample retrieval requirement in the fine-tuning sample needs to obtain the information required to generate the corresponding response result through external retrieval.

[0055] In other words, when the parameter value of the tag retrieval identifier is the parameter value that needs to be retrieved, the candidate large model needs to obtain the corresponding information through external retrieval, and then generate the response result corresponding to the sample retrieval requirement based on the information obtained from external retrieval.

[0056] Correspondingly, when the parameter value of the tag retrieval identifier is a parameter value that does not need to be retrieved, the candidate large model can extract the relevant information required to generate the response result from the historical database it has already learned, without performing external retrieval, and thus generate the response result corresponding to the sample retrieval requirement.

[0057] Among these features, the historical learning knowledge base of the candidate large model can be obtained.

[0058] In this embodiment of the disclosure, the database composed of knowledge that the candidate large model has already learned can be determined as the historical learning knowledge base of the candidate large model. The historical learning knowledge base can be the pre-training database used when the candidate large model is pre-trained, or it can be any database that it has already learned. No specific limitation is made here.

[0059] Optionally, in response to the existence of sample retrieval needs in the historical learning knowledge base, the tag retrieval identifier for fine-tuned samples is determined to be that no external retrieval is required.

[0060] In this embodiment of the disclosure, for the fine-tuning sample used in the current fine-tuning round, the knowledge corresponding to the sample retrieval requirement can be obtained, and it can be used as a keyword to search in the historical learning knowledge base. When the knowledge corresponding to the sample retrieval requirement exists in the historical learning knowledge base, it can be determined that the knowledge corresponding to the sample retrieval requirement is historical knowledge that the candidate large model has already learned.

[0061] In this scenario, the candidate large model can extract the necessary information to generate the response results corresponding to the sample retrieval requirements based on the historical knowledge that the model has already learned, without the need for external information retrieval. In this scenario, the tag retrieval identifier of the fine-tuned sample can be determined as the corresponding identifier that does not require external retrieval.

[0062] Optionally, in response to the absence of a sample retrieval requirement in the historical learning knowledge base, the tag retrieval identifier for the fine-tuned sample is determined to require external retrieval.

[0063] In this embodiment of the disclosure, when the knowledge corresponding to the sample retrieval requirement is used as a keyword to retrieve the historical learning knowledge base, it is found that there is no corresponding knowledge for the sample retrieval requirement in the historical retrieval knowledge base. Therefore, it can be determined that the corresponding knowledge for the sample retrieval requirement is knowledge that the candidate large model has not learned.

[0064] In this scenario, the candidate large model needs to obtain the information required to generate the corresponding response results through external retrieval. In this scenario, the tag retrieval identifier of the fine-tuned sample can be determined as the corresponding representation that needs to be retrieved through external retrieval.

[0065] Optionally, for any response result, in response to the tag retrieval identifier indicating that no external retrieval is required, and the response retrieval identifier indicating that the response result is obtained based on external information retrieval, the candidate large model retrieval redundancy is determined, and the retrieval redundancy is determined as the retrieval redundancy detection result of the response result.

[0066] In this embodiment of the disclosure, for any response result, in a scenario where the tag retrieval identifier of the fine-tuned sample indicates that the sample retrieval requirement does not require external retrieval to obtain the information needed to generate the response result, when the response result is identified as being generated by the candidate large model through external retrieval based on the response retrieval identifier corresponding to the response result, it can be determined that the candidate large model still performed external retrieval even when it did not require external retrieval. Therefore, it can be determined that the external retrieval performed by the candidate large model in the process of generating the response result is an unnecessary redundant retrieval.

[0067] In this scenario, it can be determined that there is retrieval redundancy in the candidate large model, and thus the retrieval redundancy can be identified as the retrieval redundancy detection result corresponding to the response result.

[0068] Optionally, in response to the tag retrieval identifier indicating that no external retrieval is required, and the response retrieval identifier indicating that the response result is not obtained based on external information retrieval, it is determined that the candidate large model retrieval is not redundant, and the non-redundancy of retrieval is determined as the retrieval redundancy detection result of the response result.

[0069] In this embodiment of the disclosure, when the tag retrieval identifier indicates that the candidate large model does not need to perform external retrieval, when the response retrieval identifier of the response result indicates that the candidate large model did not perform external retrieval when generating the response result, it can be determined that there is no unnecessary redundant retrieval operation in the process of generating the response result of the candidate large model, and thus it can be determined that there is no redundant retrieval in the candidate large model in this scenario.

[0070] Furthermore, the non-redundancy of retrieval can be defined as the retrieval redundancy detection result of the response results.

[0071] Optionally, based on the retrieval redundancy detection results, the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension is obtained.

[0072] In this embodiment of the disclosure, the retrieval redundancy detection results of each response result can be processed by the algorithm based on the loss value algorithm preset by the retrieval redundancy optimization task to obtain the loss value of each response result in the retrieval redundancy dimension. Furthermore, the loss values ​​are integrated based on the integration algorithm in the related technology, and the integrated loss value is determined as the first fine-tuning loss of the candidate large model in the retrieval redundancy dimension.

[0073] S202, obtain the label factual responses corresponding to the fine-tuning samples, and based on the label factual responses and the response results in the response result set, obtain the second fine-tuning loss of the candidate large model under the response factual dimension.

[0074] In this embodiment of the disclosure, the label information of the fine-tuning sample contains corresponding response label information, and the response label information is consistent with the corresponding facts. In this scenario, the response label information can be identified as the label factual response of the fine-tuning sample.

[0075] Optionally, the factual responses corresponding to the fine-tuned samples are obtained to perform factual response testing on each response result, thereby obtaining the factual response testing results for each response result.

[0076] In this embodiment of the disclosure, for any response result, the response can be based on the factual response label. The response result can be judged and identified as consistent with the facts. Based on the judgment and identification results, it can be determined whether the response result is consistent with the facts, thereby obtaining the corresponding response factual detection result.

[0077] Specifically, for any response result, in response to the match between the response result and the factual response of the label, it is determined that the response result is consistent with the facts, and the consistency with the facts is determined as the factual detection result of the response result.

[0078] In this embodiment of the disclosure, when the response result matches the factual response of the label, it can be determined that the response result output by the candidate large model is consistent with the facts. That is, the response result is consistent with the facts. In this scenario, the load factual consistency can be determined as the response factual detection result of the response result.

[0079] Accordingly, in response to the mismatch between the response result and the factual response of the label, it is determined that the response result does not conform to the facts, and the non-consistency of facts is determined as the factual detection result of the response result.

[0080] In this embodiment of the disclosure, when the response result does not match the factual response of the label, it can be determined that the response result is inconsistent with the facts, that is, the response result does not conform to the consistency of facts. Furthermore, the inconsistency of facts can be determined as the factual detection result of the response result.

[0081] It should be noted that, regarding the response and the factual response to the label, when the two express the same meaning, the response can be determined to match the factual response to the label; conversely, when the two express different meanings, the response can be determined to not match the factual response to the label.

[0082] Optionally, based on the factuality test results of the responses, the second fine-tuning loss of the candidate large model under the factuality dimension of the responses can be obtained.

[0083] In this embodiment of the disclosure, the response fact detection results of each response result can be processed by the algorithm based on the loss value algorithm preset by the response fact optimization task, and then the loss value of each response result in the response fact dimension can be obtained based on the result of the algorithm processing. Furthermore, the loss values ​​are integrated based on the integration algorithm in the related technology, and the integrated loss value is determined as the second fine-tuning loss of the candidate large model in the response fact dimension.

[0084] S203, based on the first fine-tuning loss and the second fine-tuning loss, iteratively optimizes the candidate large model to obtain the optimized target large model.

[0085] Optionally, the target loss of the candidate large model can be obtained based on the first fine-tuning loss and the second fine-tuning loss.

[0086] In this embodiment of the disclosure, the first fine-tuning loss and the second fine-tuning loss can be integrated based on the loss value integration algorithm in related technologies, and the total loss obtained after integration can be determined as the target loss of the candidate large model.

[0087] The first and second fine-tuning losses can be integrated based on a weighted algorithm, or other algorithms can be used to integrate them; no specific limitations are made here.

[0088] It should be noted that the target loss of the candidate large model may include the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension and the second fine-tuning loss of the candidate large model under the response factual dimension, and may also include the loss of the candidate large model under other dimensions of the response result set generation. No specific limitation is made here.

[0089] Optionally, the parameters of the candidate large model are adjusted based on the target loss, and the next fine-tuning sample is obtained to continue optimizing the candidate large model after parameter adjustment until the end, and the optimized target large model is obtained.

[0090] Among them, the model parameters of the candidate large model can be adjusted based on the target loss, based on the model parameter adjustment method in the relevant technology, so as to complete the model optimization of the candidate large model in the current round. Furthermore, the next fine-tuning sample is obtained to perform the next round of model optimization on the candidate large model after parameter adjustment, until the optimization termination condition is met, and the model fine-tuning of the candidate large model can be ended, and the optimized target large model is obtained.

[0091] It should be noted that, through the first fine-tuning loss, the candidate large model can learn the situations that require triggering external retrieval and the situations that do not require triggering external retrieval, thereby reducing the probability of redundant retrieval in the optimized target large model.

[0092] Furthermore, through the second fine-tuning loss, the candidate large model can learn the relevant features of the set of responses that are consistent with the facts, as well as the relevant features of the set of responses that are inconsistent with the facts, thereby improving the reasoning ability of the optimized target large model.

[0093] S204. Based on the target large model and the candidate retrieval models to be trained, the target retrieval model is obtained.

[0094] Optionally, a model distillation task is constructed for the target large model. Based on the model distillation task, the candidate retrieval model is distilled and trained to obtain the trained target retrieval model.

[0095] In this embodiment of the disclosure, a corresponding model distillation task can be constructed based on the target large model and the candidate retrieval model. In this scenario, the model parameters of the target large model can be transferred to the candidate retrieval model based on the execution of the model distillation task.

[0096] Optionally, the learning distillation loss corresponding to the model distillation task can be obtained, and the model parameters of the candidate retrieval model can be iteratively optimized based on the learning distillation loss, thereby completing the model training of the candidate retrieval model, and determining the trained retrieval model as the target retrieval model.

[0097] The training method of the retrieval model proposed in this disclosure optimizes the candidate large model by using a first fine-tuning loss under the retrieval redundancy dimension, which reduces the number and probability of redundant retrievals in the optimized target large model, thereby reducing the retrieval cost of generating the response result set. It optimizes the candidate large model by using a second fine-tuning loss under the response factual dimension, which reduces the possibility that the response result set output by the optimized target large model is inconsistent with the facts, and improves the generation quality of the response result set. Based on the target large model, a trained target retrieval model is obtained, realizing the transfer of the performance of the target large model to the lightweight candidate retrieval model, reducing the resource consumption of the target retrieval model, and optimizing the model performance of the target retrieval model.

[0098] In the above embodiments, the training of candidate large models can also be combined with... Figure 3 understand, Figure 3 This is a flowchart illustrating a training method for a retrieval model according to another embodiment of the present disclosure, as shown below. Figure 3 As shown, the method includes:

[0099] After inputting fine-tuning samples, based on the sample retrieval requirements carried in the fine-tuning samples, the candidate retrieval model can output response results multiple times based on the retrieval requirements input, thereby obtaining a set of response results.

[0100] like Figure 3 As shown, factual detection of each response result in the response result set can be performed to obtain the corresponding second fine-tuning loss, and the redundancy detection of each response result can be performed to obtain the corresponding first fine-tuning loss by verifying whether each response result can be obtained based on the knowledge already learned by the candidate large model.

[0101] like Figure 3 As shown, retrieval redundancy tests can also be performed directly on retrieval requests to obtain the corresponding losses, and then based on... Figure 3 The loss values ​​of the three detections shown are used to optimize the candidate large model, so that the optimized target large model can identify whether an external retrieval needs to be triggered for the input retrieval request, and then generate the corresponding response result.

[0102] The training method of the retrieval model proposed in this disclosure reduces the number and probability of redundant retrievals in the optimized target large model, thereby reducing the retrieval cost of generating a set of response results and optimizing the model performance of the target retrieval model.

[0103] This disclosure also proposes a method for obtaining a response, which can be combined with Figure 4 understand, Figure 4 This is a flowchart illustrating a response acquisition method according to an embodiment of the present disclosure, as shown below. Figure 4 As shown, the method includes:

[0104] S401, Obtain the target retrieval requirements and target retrieval model from the user's end.

[0105] In this embodiment of the disclosure, the search request input by the user terminal can be determined as the target search request of the user terminal, and the search model that provides response generation service for the target search request can be determined as the target search model.

[0106] Among them, the target retrieval model is based on the above. Figures 1 to 3 The retrieval model proposed in the embodiment is obtained through a specific method.

[0107] S402, in response to the external retrieval triggered by identifying the target retrieval requirement through the target retrieval model, the first target response result corresponding to the target retrieval requirement is obtained through the retrieval information obtained by the external retrieval.

[0108] In this embodiment of the disclosure, the target retrieval model can identify whether the target retrieval requirement needs to trigger an external retrieval. When the target retrieval model identifies that the target retrieval requirement triggers an external retrieval, it can be understood that the target retrieval model in the current scenario cannot generate a response result that meets the target retrieval requirement and is consistent with the facts based on the historical knowledge it has learned.

[0109] In this scenario, the target retrieval model can trigger an external retrieval process to obtain relevant information and then generate a response result corresponding to the target retrieval requirement.

[0110] This response result can be identified as the first target response result generated by the target retrieval model.

[0111] S403, in response to the fact that the target retrieval request identified by the target retrieval model has not triggered an external retrieval, the second target response result corresponding to the target retrieval request is obtained based on the historical learning knowledge base of the target retrieval model.

[0112] In this embodiment of the disclosure, when the target retrieval model identifies that the target retrieval requirement has not triggered an external retrieval, it can be determined that a response result that satisfies the target retrieval requirement and is consistent with the facts can be generated based on the historical knowledge that the target retrieval model has already learned.

[0113] In this scenario, the target retrieval model can extract historical knowledge corresponding to the target retrieval requirement from its learned historical knowledge base, and generate corresponding response results based on the extracted historical knowledge, which serve as the second target response result output by the target retrieval model.

[0114] It should be noted that the target retrieval model can identify whether a target retrieval request triggers an external retrieval through its pre-trained database. In other words, when the target retrieval model receives a target retrieval request, it can perform a data retrieval in the pre-trained database based on the knowledge corresponding to the target retrieval request. When the corresponding data for that knowledge exists in the pre-trained database, it can be determined that the knowledge corresponding to the target retrieval request is historical knowledge that the target retrieval model has already learned. In this scenario, the target retrieval model can generate the corresponding target response result based on the historical knowledge it has already learned, without the need for external retrieval.

[0115] Accordingly, when the target retrieval model does not find the corresponding data for the knowledge in the pre-training database, it can be determined that the knowledge is knowledge that the target retrieval model has not learned. In this scenario, the target retrieval model cannot generate a response result that meets the target retrieval requirements and conforms to the facts. In other words, in this scenario, the target retrieval model needs to obtain relevant information through external retrieval in order to generate the corresponding target response result.

[0116] The response acquisition method proposed in this disclosure generates a first target response result by obtaining information from the external retrieval when the target retrieval model identifies a target retrieval request that triggers an external retrieval. Conversely, when the target retrieval model identifies a target retrieval request that does not trigger an external retrieval, it generates a second target response result based on the historical learning knowledge of the target retrieval model. This reduces the probability of redundant retrieval by the target retrieval model, thereby reducing its retrieval cost. Figures 1 to 3 The method proposed in the embodiments trains the target retrieval model to generate corresponding target response results, reducing the possibility that the target response results are inconsistent with the facts, improving the quality of the response results generated by the target retrieval model, and optimizing the user's retrieval experience.

[0117] An embodiment of this disclosure also proposes a training device for a retrieval model. Since the training device for the retrieval model proposed in this disclosure corresponds to the training method for the retrieval model proposed in the above embodiments, the implementation methods of the above-mentioned training methods for the retrieval model are also applicable to the training device for the retrieval model proposed in this disclosure. It will not be described in detail in the following embodiments.

[0118] Figure 5 This is a schematic diagram of the structure of a training device for a retrieval model according to an embodiment of the present disclosure, as shown below. Figure 5 As shown, the training device 500 for the retrieval model includes a first acquisition module 51, a second acquisition module 52, an optimization module 53, and a training module 54, wherein:

[0119] The first acquisition module 51 is used to acquire the candidate large model to be optimized and to acquire the sample requirement response pair corresponding to the candidate large model, so as to obtain the fine-tuning sample of the candidate large model.

[0120] The second acquisition module 52 is used to acquire the set of response results of the candidate large model based on the fine-tuned sample output, and to acquire the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension and the second fine-tuning loss under the response factual dimension based on the set of response results.

[0121] Optimization module 53 is used to iteratively optimize the candidate large model based on the first fine-tuning loss and the second fine-tuning loss to obtain the optimized target large model;

[0122] Training module 54 is used to obtain the target retrieval model based on the target large model and the candidate retrieval models to be trained.

[0123] In this embodiment of the disclosure, the second acquisition module 52 is further configured to: acquire the tag retrieval identifier corresponding to the fine-tuning sample, and the response retrieval identifier of each response result in the response result set, so as to obtain the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension; wherein, the tag retrieval identifier is used to characterize whether the sample retrieval requirement in the fine-tuning sample needs to perform external information retrieval, and the response retrieval identifier is used to characterize whether the response result is obtained based on external information retrieval; acquire the tag factual response corresponding to the fine-tuning sample, and based on the tag factual response and each response result in the response result set, obtain the second fine-tuning loss of the candidate large model under the response factual dimension.

[0124] In this embodiment of the disclosure, the second acquisition module 52 is further configured to: perform retrieval redundancy detection on each response result based on the tag retrieval identifier and the response retrieval identifier, so as to obtain the retrieval redundancy detection result of each response result; and obtain the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension based on the retrieval redundancy detection result.

[0125] In this embodiment of the present disclosure, the second acquisition module 52 is further configured to: for any response result, in response to a tag retrieval identifier indicating that no external retrieval is required, and a response retrieval identifier indicating that the response result is obtained based on external information retrieval, determine the candidate large model retrieval redundancy, and determine the retrieval redundancy as the retrieval redundancy detection result of the response result; in response to a tag retrieval identifier indicating that no external retrieval is required, and a response retrieval identifier indicating that the response result is not obtained based on external information retrieval, determine the candidate large model retrieval non-redundancy, and determine the retrieval non-redundancy as the retrieval redundancy detection result of the response result.

[0126] In this embodiment of the disclosure, the second acquisition module 52 is further configured to: acquire the historical learning knowledge base of the candidate large model; determine the tag retrieval identifier of the fine-tuned sample as not requiring external retrieval in response to the existence of the sample retrieval requirement in the historical learning knowledge base; and determine the tag retrieval identifier of the fine-tuned sample as requiring external retrieval in response to the absence of the sample retrieval requirement in the historical learning knowledge base.

[0127] In this embodiment of the disclosure, the second acquisition module 52 is further configured to: acquire the label factual responses corresponding to the fine-tuning samples, perform response factual detection on each response result, and obtain the response factual detection result of each response result; and obtain the second fine-tuning loss of the candidate large model in the response factual dimension based on the response factual detection result.

[0128] In this embodiment of the disclosure, the second acquisition module 52 is further configured to: for any response result, in response to the response result matching the factual response labeled, determine that the response result is consistent with the facts, and determine the consistency with the facts as the response factual detection result of the response result; in response to the response result not matching the factual response labeled, determine that the response result is not consistent with the facts, and determine the non-consistency with the facts as the response factual detection result of the response result.

[0129] In this embodiment of the disclosure, the optimization module 53 is further configured to: obtain the target loss of the candidate large model based on the first fine-tuning loss and the second fine-tuning loss; adjust the parameters of the candidate large model based on the target loss, and return to obtain the next fine-tuning sample to continue to optimize the candidate large model after parameter adjustment until the end, and obtain the optimized target large model.

[0130] In this embodiment of the disclosure, the training module 54 is further configured to: construct a model distillation task for the target large model; and perform distillation training on the candidate retrieval model based on the model distillation task to obtain a trained target retrieval model.

[0131] The training apparatus for the retrieval model proposed in this disclosure acquires candidate large models and sample-response pairs to obtain fine-tuned samples for the candidate large models. It then acquires a set of response results output by the candidate large models based on the fine-tuned samples, and obtains a first fine-tuning loss for the candidate large models under the retrieval redundancy dimension and a second fine-tuning loss under the response factuality dimension. Based on the first and second fine-tuning losses, the candidate large models are optimized to obtain a target large model. Finally, based on the target large model and the candidate retrieval models to be trained, a trained target retrieval model is obtained. In this disclosure, optimizing the candidate large models using the first fine-tuning loss under the retrieval redundancy dimension reduces the number and probability of redundant retrievals in the optimized target large model, thereby reducing the retrieval cost of generating the response result set. Optimizing the candidate large models using the second fine-tuning loss under the response factuality dimension reduces the possibility that the response result set output by the optimized target large model is inconsistent with the facts, improving the quality of the generated response result set. The trained target retrieval model is obtained based on the target large model, realizing the transfer of the target large model's performance to the lightweight candidate retrieval model, reducing the resource consumption of the target retrieval model, and optimizing the model performance of the target retrieval model.

[0132] An embodiment of this disclosure also proposes a response acquisition device. Since the response acquisition device proposed in this disclosure corresponds to the response acquisition methods proposed in the above embodiments, the implementation methods of the above response acquisition methods are also applicable to the response acquisition device proposed in this disclosure, and will not be described in detail in the following embodiments.

[0133] Figure 6 This is a schematic diagram of the structure of a response acquisition device according to an embodiment of the present disclosure, as shown below. Figure 6 As shown, the response acquisition device 600 includes a third acquisition module 61, a first response module 62, and a second response module 63, wherein:

[0134] The third acquisition module 61 is used to acquire the user's target retrieval requirements and target retrieval model, wherein the target retrieval model is based on the above. Figure 5 The retrieval model proposed in the embodiment is obtained by the acquisition device;

[0135] The first response module 62 is used to respond to the external retrieval triggered by identifying the target retrieval requirement through the target retrieval model, and to obtain the first target response result corresponding to the target retrieval requirement through the retrieval information obtained by the external retrieval.

[0136] The second response module 63 is used to respond to the fact that the target retrieval request has not been triggered by external retrieval through the target retrieval model, and to obtain the second target response result corresponding to the target retrieval request based on the historical learning knowledge base of the target retrieval model.

[0137] The response acquisition device proposed in this disclosure generates a first target response result by acquiring information from the external retrieval when the target retrieval model identifies a target retrieval request that triggers an external retrieval. When the target retrieval model identifies a target retrieval request that does not trigger an external retrieval, it generates a second target response result based on the historical learning knowledge of the target retrieval model. This reduces the probability of redundant retrieval by the target retrieval model, thereby reducing the retrieval cost of the target retrieval model. Figures 1 to 3 The method proposed in the embodiments trains the target retrieval model to generate corresponding target response results, reducing the possibility that the target response results are inconsistent with the facts, improving the quality of the response results generated by the target retrieval model, and optimizing the user's retrieval experience.

[0138] According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0139] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments 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 may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0140] like Figure 7 As shown, device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 702 or a computer program loaded from storage unit 709 into random access memory (RAM) 703. RAM 703 may also store various programs and data required for the operation of device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via bus 704. Input / output (I / O) interface 705 is also connected to bus 704.

[0141] Multiple components in device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 706, such as various types of monitors, speakers, etc.; storage unit 709, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0142] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as methods for training a retrieval model and / or methods for obtaining a response. For example, in some embodiments, the methods for training a retrieval model and / or methods for obtaining a response may be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 709. In some embodiments, part or all of the computer program may be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the methods for training a retrieval model and / or methods for obtaining a response described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured by any other suitable means (e.g., by means of firmware) to perform a training method for the retrieval model and / or a response acquisition method.

[0143] Various embodiments 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-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0144] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0145] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0146] To initiate interaction with a user account, 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 account; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user account can submit input to the computer. Other types of devices can also be used to initiate interaction with the user account; for example, feedback submitted to the user account can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user account can be received in any form (including voice input, speech input, or tactile input).

[0147] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user account computer with a graphical user interface or web browser through which a user account can interact with the implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0148] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0149] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0150] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for training a retrieval model, wherein, The method includes: Obtain candidate large models to be optimized, and obtain sample demand response pairs corresponding to the candidate large models to obtain fine-tuning samples for the candidate large models; Obtain the set of response results output by the candidate large model based on the fine-tuned samples, and obtain the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension and the second fine-tuning loss under the response factual dimension based on the set of response results; Based on the first fine-tuning loss and the second fine-tuning loss, the candidate large model is iteratively optimized to obtain the optimized target large model; Based on the target large model and the candidate retrieval models to be trained, the target retrieval model is obtained; The step of obtaining the set of response results output by the candidate large model based on the fine-tuned samples, and obtaining the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension and the second fine-tuning loss under the response factuality dimension based on the set of response results, includes: Obtain the tag retrieval identifier corresponding to the fine-tuned sample, and the response retrieval identifier of each response result in the response result set, so as to obtain the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension; wherein, the tag retrieval identifier is used to characterize whether the sample retrieval requirement in the fine-tuned sample needs to perform external information retrieval, and the response retrieval identifier is used to characterize whether the response result is obtained based on external information retrieval. Obtain the labeled factual responses corresponding to the fine-tuned samples, and based on the labeled factual responses and each response result in the response result set, obtain the second fine-tuning loss of the candidate large model in the response factual dimension.

2. The method according to claim 1, wherein, The step involves obtaining the tag retrieval identifier corresponding to the fine-tuned sample and the response retrieval identifier of each response result in the response result set to obtain the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension; wherein, the tag retrieval identifier is used to characterize whether the sample retrieval requirement in the fine-tuned sample needs to perform external information retrieval, and the response retrieval identifier is used to characterize whether the response result is obtained based on external information retrieval, including: Based on the tag retrieval identifier and the response retrieval identifier, a retrieval redundancy detection is performed on each response result to obtain the retrieval redundancy detection result for each response result; Based on the retrieval redundancy detection results, the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension is obtained.

3. The method according to claim 2, wherein, The step of performing retrieval redundancy detection on each response result based on the tag retrieval identifier and the response retrieval identifier to obtain the retrieval redundancy detection result for each response result includes: For any response result, in response to the tag retrieval identifier indicating that no external retrieval is required, and the response retrieval identifier indicating that the response result is obtained based on external information retrieval, the candidate large model retrieval redundancy is determined, and the retrieval redundancy is determined as the retrieval redundancy detection result of the response result; In response to the tag retrieval identifier indicating that no external retrieval is required, and the response retrieval identifier indicating that the response result is not obtained based on external information retrieval, it is determined that the candidate large model retrieval is not redundant, and the non-redundancy of retrieval is determined as the retrieval redundancy detection result of the response result.

4. The method according to claim 3, wherein, The method further includes: Obtain the historical learning knowledge base of the candidate large model; In response to the existence of the sample retrieval requirement in the historical learning knowledge base, the tag retrieval identifier of the fine-tuned sample is determined to be that no external retrieval is required; In response to the fact that the sample retrieval request does not exist in the historical learning knowledge base, the tag retrieval identifier of the fine-tuned sample is determined to require external retrieval.

5. The method according to claim 1, wherein, The step of obtaining the labeled factual responses corresponding to the fine-tuned samples, and obtaining the second fine-tuning loss of the candidate large model in the response factual dimension based on the labeled factual responses and each response result in the response result set, includes: Obtain the factual responses corresponding to the fine-tuned samples, perform factual response detection on each response result, and obtain the factual response detection results for each response result; Based on the factuality detection results of the responses, the second fine-tuning loss of the candidate large model in the factuality dimension of the responses is obtained.

6. The method according to claim 5, wherein, The step of obtaining the factual responses corresponding to the fine-tuned samples, performing factual response detection on each response result, and obtaining the factual response detection results for each response result includes: For any response result, in response to the response result matching the factual response of the label, it is determined that the response result is consistent with the facts, and the consistency with the facts is determined as the factual detection result of the response result; In response to a mismatch between the response result and the factual response to the label, it is determined that the response result does not conform to factual consistency, and the non-consistency in factual consistency is determined as the factual detection result of the response result.

7. The method according to claim 1, wherein, The step of iteratively optimizing the candidate large model based on the first fine-tuning loss and the second fine-tuning loss to obtain the optimized target large model includes: Based on the first fine-tuning loss and the second fine-tuning loss, the target loss of the candidate large model is obtained; Based on the target loss, the parameters of the candidate large model are adjusted, and the next fine-tuning sample is obtained to continue optimizing the candidate large model after parameter adjustment until the end, and the optimized target large model is obtained.

8. The method according to claim 7, wherein, The process of obtaining the target retrieval model based on the target large model and the candidate retrieval models to be trained includes: The model distillation task is to construct the target large model; Based on the model distillation task, the candidate retrieval model is trained by distillation to obtain the trained target retrieval model.

9. A method for obtaining a response, wherein, The method includes: The target retrieval requirements and target retrieval model of the user are obtained, wherein the target retrieval model is obtained based on the retrieval model acquisition method of any one of claims 1-8; In response to triggering an external search by identifying the target search requirement through the target search model, the first target response result corresponding to the target search requirement is obtained through the search information obtained from the external search. In response to the identification by the target retrieval model that the target retrieval request has not triggered an external retrieval, a second target response result corresponding to the target retrieval request is obtained based on the historical learning knowledge base of the target retrieval model.

10. A training apparatus for a retrieval model, wherein, The device includes: The first acquisition module is used to acquire candidate large models to be optimized and to acquire sample requirement response pairs corresponding to the candidate large models, so as to obtain fine-tuning samples of the candidate large models. The second acquisition module is used to acquire the set of response results output by the candidate large model based on the fine-tuned samples, and to acquire the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension and the second fine-tuning loss under the response factual dimension based on the set of response results. An optimization module is used to iteratively optimize the candidate large model based on the first fine-tuning loss and the second fine-tuning loss to obtain the optimized target large model; The training module is used to obtain the target retrieval model based on the target large model and the candidate retrieval models to be trained; The second acquisition module is further configured to: Obtain the tag retrieval identifier corresponding to the fine-tuned sample, and the response retrieval identifier of each response result in the response result set, so as to obtain the first fine-tuning loss of the candidate large model under the retrieval redundancy dimension; wherein, the tag retrieval identifier is used to characterize whether the sample retrieval requirement in the fine-tuned sample needs to perform external information retrieval, and the response retrieval identifier is used to characterize whether the response result is obtained based on external information retrieval. Obtain the labeled factual responses corresponding to the fine-tuned samples, and based on the labeled factual responses and each response result in the response result set, obtain the second fine-tuning loss of the candidate large model in the response factual dimension.

11. A response acquisition device, wherein, The device includes: The third acquisition module is used to acquire the user's target retrieval requirements and target retrieval model, wherein the target retrieval model is obtained based on the retrieval model acquisition device described in claim 10. The first response module is used to respond to the external retrieval triggered by identifying the target retrieval requirement through the target retrieval model, and to obtain the first target response result corresponding to the target retrieval requirement through the retrieval information obtained by the external retrieval. The second response module is used to respond to the fact that the target retrieval request has not triggered an external retrieval by identifying through the target retrieval model, and to obtain the second target response result corresponding to the target retrieval request based on the historical learning knowledge base of the target retrieval model.

12. 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 executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8 and / or 9.

13. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-8 and / or 9.

14. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-8 and / or 9.