Training sample generation method and corresponding apparatus
Patent Information
- Application Number
- CN202610555721.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-23
- Publication Date
- 2026-08-28
AI Technical Summary
目前,在健康等专业领域的问答场景中,大语言模型回复的内容缺乏权威性,导致用户信任度低
1)本申请通过大语言模型分析第一答复数据中结论数据与参考文档中目标参考文档之间的对应关系,实现了结论溯源,以保证引用来源的可靠性;通过大语言模型获取指示目标参考文档的权威信息,实现了权威元数据获取;通过大模型将第一答复数据、对应关系和目标参考文档的权威信息自动生成第二答复数据,使第二答复数据集成权威信息。整体而言,本申请通过大语言模型对原始答复数据进行结论溯源、权威元数据获取以及答复数据自动生成,形成了自动化构建包含权威信息的训练样本的流程,从而可以高效、规模化地生产出高质量的包含权威信息的训练样本。
Smart Images

Figure CN122654652A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a training sample generation method and corresponding apparatus. Background Technology
[0002] With the development of artificial intelligence technology, large language models have been widely used in question-answering scenarios. Currently, in professional fields such as health, the responses from large language models lack authority, leading to low user trust. To improve the authority and credibility of large language models' responses in professional fields, it is usually necessary to train the model using training samples containing explicit authoritative citations. This ensures that the large language model's responses include authoritative sources. However, existing methods for constructing training samples suffer from poor generation quality and low efficiency. Summary of the Invention
[0003] In view of this, this application provides a training sample generation method and corresponding apparatus to improve the quality and generation efficiency of training samples.
[0004] This application provides the following solution: According to the first aspect, a training sample generation method is provided, the method comprising: Obtain raw question and answer data, which includes query text, document data, and first response data. The document data includes at least one reference document retrieved based on the query text and used to generate the first response data. The first response data includes conclusion data. The second language model is invoked to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference documents; The third language model is invoked to obtain the metadata of the target reference document, which is used to indicate the authoritative information of the target reference document; The fourth language model is invoked to generate second response data based on the first response data, the correspondence, and the authoritative information of the target reference document; Training samples are generated based on the query text and the second response data to train the question-answering model.
[0005] According to the second aspect, a method for training a question-answering model is provided, the method comprising: Obtain training samples, which are generated using the steps of the method described in any one of the first aspects above; The question-answering model is trained using the training samples so that when the query text is input, the target output of the question-answering model is the second response data.
[0006] According to the third aspect, a question-and-answer method is provided, the method comprising: Get the query text; After retrieving document data based on the query text, the question-answering model is invoked to generate a second response to the query text based on the document data. The question-answering model is pre-trained using the steps of the method described in any one of the second aspects above.
[0007] According to the fourth aspect, a method for generating a list of reference documents is provided, the method comprising: Obtain the correspondence between at least one conclusion data in the original document and at least one target reference document; The third language model is invoked to obtain the metadata of the target reference document, which is used to indicate the authoritative information of the target reference document; The fourth language model is invoked to generate a list of reference documents for the original document based on the authoritative information and the target reference document.
[0008] According to a fifth aspect, a training sample generation apparatus is provided, the apparatus comprising: The raw question and answer data acquisition unit is configured to acquire raw question and answer data, which includes query text, document data and first response data. The document data includes at least one reference document retrieved based on the query text and used to generate the first response data. The first response data includes conclusion data. The correspondence analysis unit is configured to invoke a second language model to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference documents; The document metadata acquisition unit is configured to call a third language model to obtain the metadata of the target reference document, the metadata being used to indicate the authoritative information of the target reference document; The training sample generation unit is configured to invoke a fourth language model to generate second response data based on the first response data, the correspondence, and the authoritative information of the target reference document; and to generate training samples based on the query text and the second response data to train the question-answering model.
[0009] According to a sixth aspect, an apparatus for training a question-answering model is provided, the apparatus comprising: A training sample acquisition unit is configured to acquire training samples, which are generated using the steps of the method described in any one of the first aspects above. The question-answering model training unit is configured to train a question-answering model using the training samples, so that when the question-answering model is input with the query text, the target output is the second response data.
[0010] According to the seventh aspect, a question-answering device is provided, the device comprising: The query text retrieval unit is configured to retrieve query text. The response data generation unit is configured to retrieve document data based on the query text, and then call the question-and-answer model to generate second response data for the query text based on the document data. The question-answering model is pre-trained using the steps of the method described in any one of the second aspects above.
[0011] According to the eighth aspect, an apparatus for generating a list of reference documents is provided, the apparatus comprising: The document correspondence acquisition unit is configured to acquire the correspondence between at least one conclusion data in the original document and at least one reference document; The document metadata acquisition unit is configured to call a third language model to obtain the metadata of the reference document, the metadata being used to indicate the authoritative information of the reference document; The reference document list generation unit is configured to invoke a fourth language model to generate a reference document list for the original document based on the authoritative information and the reference documents.
[0012] According to a ninth aspect, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in any one of the first to fourth aspects.
[0013] According to a tenth aspect, an electronic device is provided, comprising: One or more processors; and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any one of the first to fourth aspects.
[0014] According to the eleventh aspect, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the steps of the method described in any one of the first to fourth aspects.
[0015] Based on the specific embodiments provided in this application, the following technical effects are disclosed: 1) This application uses a large language model to analyze the correspondence between the conclusion data in the first response data and the target reference document in the reference document, thus achieving conclusion tracing to ensure the reliability of the cited sources; it also uses the large language model to obtain authoritative information indicating the target reference document, thus achieving authoritative metadata acquisition; and it automatically generates second response data by combining the first response data, the correspondence, and the authoritative information of the target reference document, thus integrating authoritative information into the second response data. Overall, this application uses a large language model to perform conclusion tracing, authoritative metadata acquisition, and automatic response data generation on the original response data, forming an automated process for constructing training samples containing authoritative information, thereby enabling the efficient and scalable production of high-quality training samples containing authoritative information.
[0016] 2) By introducing an authoritative information candidate library, this application transforms the open-ended generation task into a selection task from a limited set of options, effectively suppressing the illusion problem that may occur when large language models generate factual information such as source name, source organization, and authority level, and ensuring the authenticity and reliability of the cited sources.
[0017] 3) By adding citation marks and inserting a list of reference documents to the first response data, this application can ensure that the generated second response data is formatted correctly and the citations are clear. Moreover, the modification process itself does not change the core factual content of the original response, but only adds citation marks and authoritative information, thus ensuring the rigor of the response content.
[0018] 4) Before tracing the source of the conclusion, this application screens reference documents containing authoritative content, which can eliminate data with low authority in advance and concentrate limited computing resources on data with the potential to generate authoritative answers, thereby improving the throughput of the entire process and the quality of the training samples produced.
[0019] 5) This application trains a question-answering model using high-quality training samples containing authoritative information automatically generated by a large language model, which can enable the response content output by the question-answering model to contain authoritative information, thereby improving the authority and credibility of the question-answering model.
[0020] 6) This application optimizes the question-answering model through supervised fine-tuning and reinforcement learning, enabling the question-answering model to learn how to generate answer data with authoritative information from different perspectives, thereby improving the stability of the question-answering model's output answer data containing authoritative information.
[0021] 7) This application inputs the query text into the question-answering model to be optimized, and obtains the response data obtained by the question-answering model based on the query text; inputs the query text and the response data obtained based on the query text into the reward model; and optimizes the question-answering model based on the reward value output by the reward model, so that the optimization goal of the question-answering model is precisely aligned with the preference for generating responses containing authoritative information. This not only guides the model to learn formal citations, but also evolves towards a more authoritative and credible direction in terms of content selection and wording.
[0022] 8) During the model reasoning stage, the question-answering model of this application can generate response data with authoritative information, thereby significantly improving the authority and credibility of the response content.
[0023] 9) This application achieves conclusion tracing by obtaining the correspondence between the conclusion data in the original document and the reference documents, thus ensuring the reliability of the cited sources; it obtains authoritative metadata by acquiring authoritative information indicating the reference documents through a large language model; and it automatically generates a reference document list for the original document by combining the authoritative information and the reference documents through the large model, thus integrating the authoritative information into the reference document list. Overall, this application forms an automated process for constructing a reference document list containing authoritative information by acquiring authoritative metadata and automatically generating the reference document list through a large language model, thereby enabling the efficient and scalable production of high-quality, standardized reference document lists containing authoritative information.
[0024] Of course, any product implementing this application does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a system architecture diagram applicable to the embodiments of this application.
[0027] Figure 2 A flowchart illustrating the training sample generation method provided in this application embodiment.
[0028] Figure 3 A flowchart illustrating the method for training a question-answering model provided in this application embodiment.
[0029] Figure 4 A flowchart illustrating the question-and-answer method provided in this application embodiment.
[0030] Figure 5A flowchart illustrating the method for generating a list of reference documents provided in embodiments of this application.
[0031] Figure 6 A schematic block diagram of a training sample generation device provided in an embodiment of this application.
[0032] Figure 7 A schematic block diagram of an apparatus for training a question-answering model provided in an embodiment of this application.
[0033] Figure 8 A schematic block diagram of a question-and-answer device provided in an embodiment of this application.
[0034] Figure 9 A schematic block diagram of an apparatus for generating a list of reference documents provided for embodiments of this application.
[0035] Figure 10 A schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0037] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0038] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0039] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0040] Currently, in question-and-answer scenarios in professional fields such as health, the responses from large language models lack authority, leading to low user trust. To improve the authority and credibility of large language models' responses in professional fields, it is typically necessary to train the model using training samples containing authoritative citations, ensuring that the large language model's responses include authoritative sources.
[0041] Existing methods for constructing training samples mainly rely on two approaches: one is manual annotation by domain experts, which involves manually adding accurate citation sources to the model's responses; the other is rule-based automated methods, such as associating response content with source documents through keyword matching. While manual annotation can ensure the accuracy of citation sources, it suffers from low generation efficiency. Rule-based automated methods, although improving the efficiency of training sample generation to some extent, rely on pre-set keywords and lack a deep understanding of the complex semantic relationships between response content and source documents. Therefore, the generated citation source information is often inaccurate, easily leading to mismatches or omissions in training samples, thus reducing the quality of the training samples.
[0042] In view of this, this application provides a new approach. To facilitate understanding of this application, the system architecture on which this application is based will first be described. Figure 1 This is a system architecture diagram applicable to the embodiments of this application, such as... Figure 1 As shown, the system architecture may include: a terminal device, a question-answering device located on the server side, and a device for training the question-answering model.
[0043] The terminal device and the server can communicate. The terminal device and the server can be connected directly or indirectly through wired or wireless communication methods, which is not limited herein.
[0044] The terminal devices can include, but are not limited to, smart mobile terminals, smart home devices, wearable devices, and PCs (Personal Computers). Smart mobile devices can include mobile phones, tablets, laptops, PDAs (Personal Digital Assistants), and connected cars. Smart home devices can include smart TVs, smart refrigerators, and so on. Wearable devices can include smartwatches, smart glasses, virtual reality devices, augmented reality devices, and mixed reality devices (i.e., devices that support both virtual and augmented reality).
[0045] A server can be a standalone server, a server cluster, or a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a hosting product within the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Servers (VPS) services, such as high management difficulty and weak service scalability.
[0046] Before performing a question-answering task, the apparatus for training the question-answering model can use the method provided in the embodiments of this application to construct training samples and train the question-answering model based on the constructed training samples.
[0047] The terminal device collects input data and sends it (such as user-entered query text or voice) via the network to a server-side question-answering device. The question-answering device uses a trained question-answering model to generate response data containing authoritative information. In addition, the question-answering device can also respond to input data from other sources, generating response data containing authoritative information. Figure 1 In addition to the architecture shown, computer terminal devices with strong computing power can also use the methods provided in the embodiments of this application to generate training samples, train question-answering models, and generate response data containing authoritative information.
[0048] It should be understood that Figure 1 The number of terminal devices, devices for training question-answering models, question-answering devices, and question-answering models shown in the diagram is merely illustrative. Depending on implementation needs, any number of terminal devices, devices for training question-answering models, question-answering devices, and question-answering models can be included.
[0049] Figure 2 This is a flowchart of a training sample generation method provided in an embodiment of this application. This method can be... Figure 1 The device for training the question-answering model in the system shown is executed. For example... Figure 2 As shown, the method may include the following steps: Step 201: Obtain the original question and answer data, which includes query text, document data, and first response data. The document data includes at least one reference document retrieved based on the query text and used to generate the first response data. The first response data includes conclusion data.
[0050] Step 203: Invoke the second language model to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference documents.
[0051] Step 205: Call the third language model to obtain the metadata of the target reference document, which is used to indicate the authoritative information of the target reference document.
[0052] Step 207: Call the fourth language model to generate second response data based on the correspondence between the first response data, the conclusion data, and the target reference document, as well as the authoritative information of the target reference document; generate training samples based on the query text and the second response data to train the question-answering model.
[0053] As can be seen from the above process, this application achieves conclusion tracing by analyzing the correspondence between the conclusion data in the first response data and the target reference document in the reference document through a large language model, thus ensuring the reliability of the cited source; it also achieves authoritative metadata acquisition by obtaining authoritative information indicating the target reference document through the large language model; and it automatically generates second response data by combining the first response data, the correspondence, and the authoritative information of the target reference document through the large model, thus integrating authoritative information into the second response data. Overall, this application forms an automated process for constructing training samples containing authoritative information by tracing the conclusions of the original response data, acquiring authoritative metadata, and automatically generating response data through a large language model, thereby enabling the efficient and scalable production of high-quality training samples containing authoritative information.
[0054] The following describes in detail each step of the above process and the effects that can be further produced, with reference to the embodiments. It should be noted that the terms "first", "second", "third", "fourth", etc. involved in this disclosure do not have limitations in terms of size, order, or quantity, but are only used to distinguish them in name. For example, "first major language model", "second major language model", "third major language model" and "fourth major language model" can refer to the same major language model or different major language models.
[0055] First, the above step 201, namely "obtaining original question and answer data, which includes query text, document data and first response data, the document data includes at least one reference document obtained based on the query text and used to generate the first response data, and the first response data includes conclusion data", will be described in detail with reference to the embodiments.
[0056] In this embodiment of the invention, the original question-and-answer data refers to the data generated by the user's communication with the large language model, which may include, but is not limited to, query text, document data, and first response data. The query text is the query content entered by the user. For example, in a health question-and-answer scenario, the query text could be a health question such as "What are some recommended BB-type drugs for AA disease?". The document data is related documents retrieved based on the query text, such as documents like "XX Health Guide" or "XX Medical Journal". The first response data can be a reply generated by the question-and-answer model based on the query text and document data. It is a response that has not been optimized for authoritativeness. The question-and-answer model can be implemented based on the large language model or other types of generative models. For example, the first response data could be "For type A patients, CC and other drugs are recommended. For type B patients, DD or EE and other drugs are recommended."
[0057] For example, in a health question-and-answer scenario, raw question-and-answer data can be obtained from historical health question-and-answer data. Historical health question-and-answer data can be obtained through Retrieval-Augmented Generation (RAG) and may include query texts of multiple health questions, document data consisting of one or more health documents retrieved based on the query text, and response data generated by the question-and-answer model based on health questions and health documents.
[0058] It should be noted that, in addition to the aforementioned health-related Q&A scenarios, the embodiments of the present invention can also be applied to professional fields such as financial and legal Q&A scenarios. Specifically, when the query text is a financial-related question, the document data can be financial-related documents, and the first response data is a response generated based on the financial-related question and financial-related documents. Similarly, when the query text is a legal-related question, the document data can be legal-related documents, and the first response data is a response generated based on the legal-related question and legal-related documents.
[0059] The following describes in detail step 203, namely, "calling the second language model to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference documents," with reference to an embodiment.
[0060] In this embodiment of the invention, the first response data may include one or more conclusion data. Conclusion data refers to one or more data, numerical values, textual conclusions, or structured information in the first response data used to characterize the final judgment, result, indicator, or answer. For example, in a health Q&A scenario, conclusion data may be conclusions in the health field such as "recommended use of drugs like CC" or "sublingual administration once daily."
[0061] Furthermore, the document data may include one or more reference documents. The conclusion data must correspond to at least one of these reference documents; the reference document corresponding to the conclusion data is called the target reference document. In other words, the target reference document is the document that supports the conclusion data; that is, it contains content that supports the conclusion data. For example, the conclusion data might be "For type A patients, it is recommended to use drugs such as CC," and its corresponding target reference document could be the "XX Health Guidelines," meaning that the "XX Health Guidelines" contains content related to "For type A patients, it is recommended to use drugs such as CC." The correspondence refers to the relationship between the conclusion data and the target reference documents. For example, conclusion data "J1" corresponds to reference document B, conclusion data "J2" corresponds to reference documents C and D, and so on.
[0062] Specifically, a second prompt instruction can be generated using the first response data and document data. This second prompt instruction instructs the second large language model to extract conclusion data from the first response data and match the corresponding target reference document from the reference documents. Further, the second prompt instruction is provided to the second large language model, which outputs the correspondence between the conclusion data and the target reference document. It should be noted that the large language model possesses powerful natural language understanding and contextual reasoning capabilities, enabling it to accurately identify conclusion data in the response and understand the complex semantic correspondence between it and the target reference document, thereby improving the accuracy of conclusion tracing. Compared to keyword matching, this embodiment can handle more complex linguistic phenomena, ensuring the correctness of conclusion data extraction and thus guaranteeing the rigor of the generated content.
[0063] For example, the second prompt instruction could be: "Please read the model response and reference documents. Match each medical conclusion in the model response with the reference document identifier that supports that medical conclusion, and output it in JSON format. Model response: [First response data], Reference document: [{id: doc1, content: '...'}, ...]". Here, id: doc1 is the reference document identifier, and content: '...' represents the content in the reference document. The second language model can analyze each medical conclusion in the first response data according to the above prompt instruction, and match documents supporting the medical conclusion from the reference document set obtained through retrieval enhancement, establishing a correspondence between the medical conclusion and the reference document identifier that supports it, such as "Medical conclusion J3-doc1", indicating that doc1 supports medical conclusion J3.
[0064] In some alternative embodiments, natural language information extraction and semantic similarity models (such as Sentence-BERT) can also be used to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference documents.
[0065] The following describes step 205, namely "calling the third language model to obtain the metadata of the target reference document, the metadata being used to indicate the authoritative information of the target reference document", in detail with reference to the embodiments.
[0066] In this embodiment of the invention, metadata can be authoritative information, which indicates the authority of the target reference document and may include, but is not limited to, at least one of source name, source organization, and authority level. The source name refers to the original source or carrier information of the target reference document, such as journal name, book name, etc. The source organization refers to the issuing institution of the target reference document, such as a hospital, enterprise, etc. The authority level is used to characterize the degree of authority of the target reference document; for example, the authority level can be divided into A, B, and C, or into first, second, and third levels.
[0067] Specifically, a third prompt instruction can be generated based on the target reference document. This third prompt instruction prompts the third language model to extract authoritative information from the target reference document to indicate its authority. Furthermore, the third prompt instruction can be provided to the third language model, which then outputs the metadata of the target reference document.
[0068] To avoid illusions when generating metadata for target reference documents using large language models and to improve the accuracy of metadata, this application introduces an authoritative information candidate library to match accurate metadata. The authoritative information candidate library may include at least one preset authoritative information, i.e., widely recognized reference information with high credibility and scientific basis. Authoritative information may include at least one of the following: the source name, the source institution, and the level of authority. Each piece of authoritative information may exist in a list format in the authoritative information candidate library.
[0069] One possible approach is to invoke a third language model to obtain the metadata of the target reference document. This could involve invoking the third language model to match the target reference document against a pre-defined authoritative information candidate database to obtain the metadata of the target reference document.
[0070] Specifically, a third prompt instruction can be generated based on the target reference document and the information in the authoritative information candidate library. The third prompt instruction is provided to the third language model, which prompts the third language model to match the target reference document in the authoritative information candidate library to obtain the metadata of the target reference document. The authoritative information candidate library includes at least one of the preset source name, source organization, and authority level. The metadata of the target reference document output by the third language model is obtained. The metadata includes at least one of the source name, source organization, and authority level.
[0071] For example, the third prompt instruction could be designed as follows: "Please read the following document content and select the source name, source organization, and authority level that best matches this document from the provided candidate list. Document content: [Content of the target reference document], Candidate list: {A list of source names, source organizations, and authority levels contained in the authority information candidate library}. Please return your selection in JSON format." This third prompt instruction is provided to the third language model, which then outputs the source name, source organization, and authority level selected from the candidate list based on the third prompt instruction.
[0072] It should be noted that this application introduces an authoritative information candidate library for constrained generation, transforming the open generation task into a selection task from a limited set of options. This effectively suppresses the illusion problem that may occur when large language models generate factual information such as source names and institutions, ensuring the authenticity and reliability of cited sources.
[0073] As another feasible approach, a third language model can be invoked to generate initial metadata based on the target reference document. The obtained initial metadata is then matched against an authoritative information candidate database. If a match is found that is exactly the same as the initial metadata, the verification is successful, and the initial metadata is used as the metadata of the target reference document. If no match is found, the verification fails, and the metadata needs to be corrected.
[0074] The following describes in detail step 207, namely, "calling the fourth language model to generate second response data based on the correspondence between the first response data, the conclusion data, and the target reference document, and the authoritative information of the target reference document; generating training samples based on the query text and the second response data to train the question-answering model," with reference to the embodiments.
[0075] In this embodiment of the invention, the second response data refers to the response data optimized for authority, that is, the data after adding authoritative information to the first response data.
[0076] Specifically, the first response data can be modified based on the correspondence between the conclusion data and the target reference documents, and the authoritative information of the target reference documents, to obtain the second response data. The modification operations can include inserting citation markers, generating and inserting a reference list, etc. Citation markers are used to guide users to find authoritative information and can be citation superscripts or hyperlinks. The reference list is a structured list containing authoritative information such as the source names, institutions, and authority levels of multiple reference documents.
[0077] One possible approach involves using a fourth language model to generate second response data based on the correspondence between the first response data, the conclusion data, and the target reference document, as well as the authoritative information of the target reference document. This includes: using the fourth language model to add citation tags to the conclusion data in the first response data based on the correspondence between the conclusion data and the target reference document; using the fourth language model to generate a list of reference documents for the target reference document based on the authoritative information of the target reference document, the list of reference documents containing citation tags; and merging the list of reference documents with the first response data containing citation tags to obtain the second response data.
[0078] For example, the fourth language model can insert a citation mark at the end of the corresponding conclusion data in the first response data based on the correspondence between the conclusion data and the target reference document, such as "For type A patients, CC and other drugs are recommended [1]. For type B patients, DD or EE and other drugs are recommended [2]". Further, a formatted reference list can be generated based on the source name, source institution and authority level, such as [1] Source name: "XX Health Guide"; Source institution: Institution M; Authority level: A. The reference list is then inserted at the end or beginning of the first response data to obtain the second response data. In some embodiments, after obtaining the second response data, it can also be polished to ensure the fluency of the language.
[0079] It should be noted that by adding citation marks and inserting a list of reference documents to the first response data, this application can ensure that the generated second response data is formatted correctly and the citations are clear. Moreover, the modification process itself does not change the core factual content of the original response, but only adds citation marks and authoritative information, thus ensuring the rigor of the response content.
[0080] As another feasible approach, a text template can be pre-built, containing locations for filling in the first response data, the correspondence, and the authoritative information of the target reference document. Further, the first response data, the correspondence, and the authoritative information of the target reference document are filled into the pre-built text template to obtain the second response data.
[0081] After obtaining the second response data, this application can generate training samples for supervised fine-tuning of the question-answering model based on the query text and the second response data. Furthermore, first response data can be added, thus generating training samples for reinforcement learning of the question-answering model based on the query text, the first response data, and the second response data. It is understood that the training sample generation method of this application can simultaneously and holistically generate training samples for supervised fine-tuning and reinforcement learning, providing a logically consistent, goal-oriented, complete, and high-quality data foundation for the multi-stage training of the question-answering model.
[0082] To further optimize the efficiency of the overall processing flow in the above embodiments and avoid unnecessary subsequent analysis and processing of reference documents that do not contain authoritative content, this application also provides the following preferred solutions.
[0083] As one possible approach, after obtaining the original question-and-answer data, between steps 201 and 203, the following can be further performed: calling the first major language model to filter reference documents containing authoritative content of a preset type from the original question-and-answer data; and performing step 203 based on the reference documents containing authoritative content of the preset type, wherein the target reference document is derived from a reference document containing authoritative content of the preset type.
[0084] Among them, authoritative content refers to content that can characterize the authority of a reference document. For example, it can be of the type "guide", "consensus", "textbook", etc. That is, if a reference document is identified as a "guide", "consensus", "textbook", etc., it indicates that the reference document contains authoritative content.
[0085] For example, raw response data can be extracted from historical health data, and a document set containing multiple reference documents can be generated based on retrieval enhancement. Further, a first prompt instruction can be generated based on information such as the document set, document titles, or document summaries. The first prompt instruction could be: "Please determine whether the following document list contains clinical guidelines or expert consensus. If it does, answer 'Yes'; otherwise, answer 'No'. Document list: [document set]". Further, a first language model can determine whether the reference documents in the document set contain authoritative content such as "guidelines," "consensus," or "textbooks" based on the aforementioned first prompt instruction. If the first language model answers "Yes," the reference document containing authoritative content will undergo subsequent conclusion tracing, authoritative metadata acquisition, and response data synthesis processes. If the first language model answers "No," the reference document will not undergo further processing.
[0086] As another possible approach, reference documents can be filtered using rule filters based on keywords or source names to obtain reference documents containing authoritative content.
[0087] It should be noted that this application screens reference documents containing authoritative content before tracing the source of the conclusions. This can eliminate data with low authority, such as online popular science articles and personal blogs, in advance, and concentrate limited computing resources on data with the potential to generate authoritative answers, thereby improving the throughput of the entire process and the quality of the training samples produced.
[0088] Figure 3 This is a flowchart of a method for training a question-answering model provided in an embodiment of this application. This method can be... Figure 1 The device for training the question-answering model in the system shown is executed. For example... Figure 3 As shown, the method may include the following steps: Step 301: Obtain training samples.
[0089] Step 303: Train the question-answering model using training samples so that when the question-answering model is given the input query text, the target output is the second response data.
[0090] As can be seen from the above process, this application trains a question-answering model by using high-quality training samples containing authoritative information automatically generated by a large language model. This enables the question-answering model to output answers containing authoritative information, thereby improving the authority and credibility of the question-answering model.
[0091] The following describes in detail each step of the above process and the effects that can be further produced, with reference to the embodiments.
[0092] First, the above step 301, "obtaining training samples", will be described in detail with reference to the embodiments.
[0093] The training samples are obtained using any of the training sample generation methods in the above embodiments, and can include various types of training samples, such as pre-training samples for question answering models, supervised fine-tuning training samples, or reinforcement learning training samples.
[0094] Specifically, the process involves acquiring raw question-and-answer data, which includes query text, document data, and first-response data. A first-level language model is used to filter reference documents containing authoritative content from the raw question-and-answer data. Based on these authoritative reference documents, a second-level language model is used to analyze the correspondence between at least one conclusion in the first-response data and at least one target reference document. A third-level language model is used to obtain the metadata of the target reference documents. A fourth-level language model is used to generate second-response data based on the correspondence between the first-response data, conclusion data, and target reference documents, as well as the authoritative information of the target reference documents; training samples are then generated based on the query text and the second-response data.
[0095] The following describes in detail step 303, namely, "training a question-answering model using training samples so that when the question-answering model is input with query text, the target output is the second response data", with reference to the embodiments.
[0096] To adapt to different model training paradigms and enhance the authoritative expressive ability of question answering models, this application also provides preferred solutions for the specific use of training samples.
[0097] One possible approach involves training samples that include a first training sample, comprising query text and its corresponding labeled data, with the labeled data being second response data. Further, the first training sample may also include reference data, which could be reference documents retrieved based on the query text. Training the question-answering model using these training samples includes: Supervised Fine-Tuning (SFT) of the question-answering model to be optimized using the first training sample. The supervised fine-tuning process involves: inputting the query text (and potentially reference data) from the first training sample into the question-answering model to be optimized; obtaining the response data generated by the model in response to the query text; using the generated response data and the corresponding labeled data to determine the value of the loss function; and using the value of the loss function to optimize the model parameters, with the goal of minimizing the difference between the generated response data and the corresponding labeled data. It is understood that this training method aims to directly teach the question-answering model how to generate response formats and content organization methods with authoritative information.
[0098] As another feasible approach, the training samples include a second training sample, which comprises the query text and its corresponding preference and non-preference data. The preference data is the second response data, and the non-preference data is the first response data. Training the question-answering model using the training samples includes: performing reinforcement learning on the question-answering model to be optimized using the second training sample. It is understood that this training method aims to teach the question-answering model a preference for responses with authoritative information over those without, thus leading it to tend to choose the former during generation.
[0099] As another feasible approach, the training samples can include a first training sample and a second training sample. Training the question-answering model using these training samples includes: supervised fine-tuning of the question-answering model to be optimized using the first training sample and reinforcement learning of the question-answering model to be optimized using the second training sample. Understandably, this training method achieves multi-stage training of the question-answering model, gradually improving its authoritative expressive ability.
[0100] For example, a first training sample can be constructed based on health questions and authoritative health responses from a health Q&A platform. This first training sample is then used to perform supervised fine-tuning of the health Q&A model to be optimized, resulting in a supervised fine-tuned health Q&A model. Further, preference data pairs can be constructed based on health questions, health responses without authoritative information, and health responses containing authoritative information from the health Q&A platform. These preference data pairs serve as a second training sample. The supervised fine-tuned health Q&A model is then used for reinforcement learning using this second training sample.
[0101] It should be noted that this application optimizes the question-answering model through supervised fine-tuning and reinforcement learning, which enables the question-answering model to learn how to generate answer data with authoritative information from different perspectives, thereby improving the stability of the question-answering model's output answer data containing authoritative information.
[0102] In performing the above reinforcement learning, one possible approach is to input the query text into the question-answering model to be optimized, obtain the response data obtained by the question-answering model based on the query text, input the query text and the response data obtained based on the query text into the reward model, and optimize the question-answering model based on the reward value output by the reward model; wherein, the reward model is pre-trained using a second training sample.
[0103] In this embodiment of the invention, the second training sample can be used to train a reward model, enabling the model to assign high scores to responses containing authoritative information and low scores to responses lacking authoritative information. During the question-answering model optimization phase, this reward model can be used as an evaluation criterion, guiding the update direction of the question-answering model through reward values, thereby continuously optimizing the model.
[0104] The training process of the reward model includes: inputting the query text and its corresponding preferred and unpreferred data into the reward model, and the reward model outputting a reward value. The training objective can include: maximizing the difference between the reward value output for preferred data and the reward value output for unpreferred data, i.e., rewarding preferred data as much as possible and penalizing unpreferred data.
[0105] It should be noted that the above design of this application enables the optimization objective of the question-answering model to be precisely aligned with the preference for generating answers containing authoritative information. This not only guides the model to learn formal citations, but also enables it to evolve towards more authoritative and credible directions in terms of content selection and wording.
[0106] As another feasible approach, after obtaining the supervised fine-tuned question-answering model, direct preference optimization (DPO) can be performed on the supervised fine-tuned model based on a second training sample to obtain a reinforcement learning-based question-answering model. It is understandable that, compared to reward-based reinforcement learning, direct preference optimization can reduce the training of the reward model, thereby improving the model's training efficiency.
[0107] Figure 4 This is a flowchart of a question-and-answer method provided in an embodiment of this application. The method can be... Figure 1 The question-and-answer device in the system shown is executed. For example... Figure 4 As shown, the method may include the following steps: Step 401: Obtain the query text.
[0108] Step 403: After obtaining document data based on the query text, call the question-answering model to generate second response data for the query text based on the document data.
[0109] As can be seen from the above process, during the model reasoning stage, the question-answering model of this application can generate response data with authoritative information, thereby significantly improving the authority and credibility of the response content.
[0110] The query text can be either the question text currently entered by the user or the question text converted from the user's speech. For example, the query text could be "What are some recommended BB type medications for AA disease?".
[0111] The question-answering model is pre-trained using any of the methods described in the above embodiments.
[0112] Specifically, document data can be retrieved from the database based on the query text. A fifth prompt instruction is then generated using the query text and document data. This fifth prompt instruction instructs the question-answering model to generate a second response containing authoritative information based on the query text and document data. Furthermore, the fifth prompt instruction is provided to the question-answering model, which then outputs the second response containing authoritative information based on the fifth prompt instruction.
[0113] For example, when a user inputs the health question "What are some recommended BB type drugs for AA disease?", the question-answering model performs retrieval enhancement generation and retrieves multiple reference documents such as "XX Health Guide" and "XX Medical Journal". The question-answering model generates a second response data for the health question based on the health question and the reference documents. The second response data can be "For type A patients, CC and other drugs are recommended [1]. For type B patients, DD or EE and other drugs are recommended [2]. Reference document list: [1] Source name: "XX Health Guide"; Source institution: Institution M; Authority level: A. [2] Source name: "XX Medical Journal"; Source institution: Institution N; Authority level: A". It is understandable that by asking questions to the question-answering model, users can intuitively see the authoritative source of the response content, thereby greatly enhancing their trust in the model's response.
[0114] Figure 5 A flowchart illustrating a method for generating a list of reference documents provided in embodiments of this application. This method can be performed by... Figure 1 The server in the system shown executes the command. For example... Figure 5 As shown, the method may include the following steps: Step 501: Obtain the correspondence between at least one conclusion data in the original document and at least one reference document.
[0115] Step 503: Call the third language model to obtain the metadata of the reference document, which is used to indicate the authoritative information of the reference document.
[0116] Step 505: Invoke the fourth language model to generate a list of reference documents for the original document based on authoritative information and reference documents.
[0117] As can be seen from the above process, this application achieves conclusion tracing by obtaining the correspondence between the conclusion data in the original document and the reference documents, thus ensuring the reliability of the cited sources; it achieves authoritative metadata acquisition by obtaining authoritative information indicating the reference documents through a large language model; and it automatically generates a reference document list for the original document by combining the authoritative information and the reference documents through the large model, thus integrating the authoritative information into the reference document list. Overall, this application forms an automated process for constructing a reference document list containing authoritative information by acquiring authoritative metadata and automatically generating the reference document list through a large language model, thereby enabling the efficient and scalable production of high-quality, standardized reference document lists containing authoritative information.
[0118] First, the above step 501, namely "obtaining the correspondence between at least one conclusion data in the original document and at least one reference document", will be described in detail with reference to the embodiments.
[0119] The original document can be obtained in any way, including raw response data generated by a question-answering model, or an article or research report to be published. In this embodiment, the aim is to automatically generate a list of reference documents for the original document. The generation of the original document is based on the reference data. For example, if the original document is raw response data generated by a question-answering model for a query text that does not contain authoritative information, then the reference data is the reference documents retrieved based on the query text; similarly, if the original document is an article or research report to be published, then the reference data is the set of documents consulted when writing the article or research report.
[0120] The original document usually contains one or more conclusion data. You can select at least one conclusion data to obtain the correspondence between it and the reference document, or you can obtain the correspondence between the conclusion data and the reference document by examining all the conclusion data in the original document.
[0121] One feasible approach is to generate a second prompt instruction based on the original document. This second prompt instruction instructs the second language model to extract conclusion data from the original document and match the corresponding reference documents from the reference data. The second language model then analyzes the original document based on the second prompt instruction, obtaining a correspondence between at least one conclusion data point and at least one reference document.
[0122] The following describes in detail step 503, namely "calling the third language model to obtain the metadata of the reference document, the metadata being used to indicate the authoritative information of the reference document", with reference to the embodiments.
[0123] Specifically, a third prompt instruction can be generated using the reference document. This third prompt instruction instructs the third language model to extract authoritative information from the reference document, which indicates the authority of the reference document. Furthermore, the third prompt instruction can be provided to the third language model, which then outputs the metadata of the reference document.
[0124] One feasible approach is to invoke a third language model to match the reference document against a pre-defined authoritative information candidate database to obtain the reference document's metadata. The authoritative information candidate database can include at least one pre-defined set of authoritative information, such as source name, source organization, and authority level. These authoritative information items can exist in a list format within the database.
[0125] Specifically, a third prompt instruction can be generated using information from the reference document and the authoritative information candidate library. This third prompt instruction is then provided to the third language model, which prompts the third language model to match the reference document in the authoritative information candidate library to obtain the reference document's metadata. The authoritative information candidate library includes at least one of the preset source name, source organization, and authority level. The metadata of the reference document output by the third language model is then obtained, and the metadata includes at least one of the source name, source organization, and authority level.
[0126] The following describes in detail step 505, namely "calling the fourth language model to generate a list of reference documents for the original document based on authoritative information and reference documents", with reference to the embodiments.
[0127] The reference document list refers to a list displaying information related to reference documents, which may include, but is not limited to, authoritative information and document content. Document content refers to the data within the reference documents that supports the conclusions.
[0128] In this step, the fourth language model can be invoked to add citation tags to the conclusion data in the first response data based on the correspondence; the fourth language model can also be invoked to generate a list of reference documents for the reference documents based on the authoritative information of the reference documents, and the list of reference documents contains citation tags.
[0129] For example, a list of reference documents may look like this: [1] Source name: XX Health Guide; Source institution: M institution; Authority level: A; Supporting data 1: XXXX.
[0130] [2] Source name: "XX Medical Journal"; Source institution: N institution; Authority level: A”; Supporting data for conclusion 2: XXXX.
[0131] As one possible implementation, before step 501, the method further includes: calling a first large language model to filter reference documents containing authoritative content of a preset type from the reference data of the original document; and performing step 501 based on the reference documents containing authoritative content of the preset type, wherein the reference documents originate from the reference documents containing authoritative content of the preset type. Specific processing methods can be found in the relevant descriptions in previous embodiments, and will not be repeated here.
[0132] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0133] According to another embodiment, a training sample generation apparatus is provided. Figure 6 A schematic block diagram of the training sample generation apparatus according to one embodiment is shown, the apparatus being disposed in Figure 1 The server in the architecture shown. For example... Figure 6 As shown, the device 600 includes: The original question and answer data acquisition unit 601 is configured to acquire original question and answer data, which includes query text, document data, and first response data. The document data includes at least one reference document retrieved based on the query text and used to generate the first response data. The first response data includes conclusion data.
[0134] The correspondence analysis unit 602 is configured to invoke a second language model to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference documents.
[0135] The document metadata acquisition unit 603 is configured to call a third language model to obtain the metadata of the target reference document, the metadata being used to indicate the authoritative information of the target reference document.
[0136] The training sample generation unit 604 is configured to call a fourth language model to generate second response data based on the first response data, the correspondence, and the authoritative information of the target reference document; and to generate training samples based on the query text and the second response data to train the question-answering model.
[0137] As one possible implementation method, the document metadata acquisition unit 603 can also be specifically configured to: call the third language model to match the target reference document in a preset authoritative information candidate library to obtain the metadata of the target reference document; wherein, the preset authoritative information candidate library includes authoritative information, and the authoritative information includes at least one of source name, source organization and authority level.
[0138] As one possible implementation, the training sample generation unit 604 can also be specifically configured to: invoke the fourth language model to add citation tags to the conclusion data in the first response data based on the correspondence; invoke the fourth language model to generate a list of reference documents for the target reference document based on the authoritative information of the target reference document, the list of reference documents containing the citation tags; and merge the list of reference documents with the first response data with added citation tags to obtain the second response data.
[0139] As one possible implementation method, the reference document filtering unit 605 can be configured as follows: The first major language model is invoked to filter reference documents containing authoritative content of a preset type from the raw question-and-answer data.
[0140] Furthermore, the correspondence analysis unit 602 can be specifically configured as follows: Based on the reference document containing authoritative content of a preset type, the step of calling the second language model to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference document is performed, wherein the target reference document originates from the reference document containing authoritative content of a preset type.
[0141] According to another embodiment, an apparatus for training a question-answering model is provided. Figure 7 A schematic block diagram of an apparatus for training a question-answering model according to one embodiment is shown, the apparatus being disposed in... Figure 1 The server in the architecture shown. For example... Figure 7 As shown, the device 700 includes: The training sample acquisition unit 701 is configured to acquire training samples, which are generated using the steps of the method described in any one of the first aspects above.
[0142] The question-answering model training unit 702 is configured to train a question-answering model using the training samples, so that when the question-answering model is input with the query text, the target output is the second response data.
[0143] As one possible implementation, the training sample includes a first training sample, which includes the query text and its corresponding labeled data, wherein the labeled data is the second response data. Furthermore, the question-answering model training unit 702 can be specifically configured as follows: The question-answering model to be optimized is then fine-tuned under supervision using the first training sample.
[0144] And / or, the training samples include a second training sample, which includes the query text and its corresponding preference data and non-preference data, wherein the preference data is the second response data and the non-preference data is the first response data.
[0145] Furthermore, the question-answering model training unit 702 can also be specifically configured to perform reinforcement learning on the question-answering model to be optimized using the second training samples.
[0146] As one possible implementation, the question-answering model training unit 702 can also be configured as follows: Input the query text into the question-answering model to be optimized, and obtain the response data obtained by the question-answering model based on the query text; input the query text and the response data obtained based on the query text into the reward model; optimize the question-answering model based on the reward value output by the reward model; wherein, the reward model is pre-trained using the second training sample.
[0147] According to another embodiment, a question-and-answer device is provided. Figure 8 A schematic block diagram of the question-and-answer device according to one embodiment is shown, the device being disposed in Figure 1 The terminal devices in the illustrated architecture. For example... Figure 8 As shown, the device 800 includes: The query text acquisition unit 801 is configured to acquire query text.
[0148] The response data generation unit 802 is configured to, after retrieving document data based on the query text, call a question-and-answer model to generate second response data for the query text based on the document data.
[0149] According to another embodiment, an apparatus for generating a list of reference documents is provided. Figure 9 A schematic block diagram of an apparatus for generating a list of reference documents according to one embodiment is shown, the apparatus being disposed in Figure 1 The server in the architecture shown. For example... Figure 9 As shown, the device 900 includes: The document correspondence acquisition unit 901 is configured to acquire the correspondence between at least one conclusion data in the original document and at least one reference document.
[0150] The document metadata acquisition unit 902 is configured to call a third language model to obtain the metadata of the reference document, which is used to indicate the authoritative information of the reference document.
[0151] The reference document list generation unit 903 is configured to invoke a fourth language model to generate a reference document list for the original document based on the authoritative information and the reference documents.
[0152] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for apparatus or apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. The apparatus and apparatus embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0153] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0154] In addition, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.
[0155] And an electronic device, comprising: One or more processors; and A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any of the foregoing method embodiments.
[0156] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.
[0157] in, Figure 10An exemplary architecture of an electronic device is shown, which may include a processor 1010, a video display adapter 1011, a disk drive 1012, an input / output interface 1013, a network interface 1014, and a memory 1020. The processor 1010, video display adapter 1011, disk drive 1012, input / output interface 1013, network interface 1014, and memory 1020 can communicate with each other via a communication bus 1030.
[0158] The processor 1010 can be implemented using a general-purpose CPU, microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs and implement the technical solution provided in this application.
[0159] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system 1021 for controlling the operation of the electronic device 1000, and the basic input / output system (BIOS) 1022 for controlling the low-level operations of the electronic device 1000. Additionally, it can store a web browser 1023, a data storage management system 1024, and a training sample generation device 600, etc. The aforementioned training sample generation device 600 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when the technical solution provided in this application is implemented through software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0160] Input / output interface 1013 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.
[0161] The network interface 1014 is used to connect the communication module (not shown in the figure) to enable communication and interaction between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0162] Bus 1030 includes a pathway for transmitting information between various components of the device, such as processor 1010, video display adapter 1011, disk drive 1012, input / output interface 1013, network interface 1014, and memory 1020.
[0163] It should be noted that although the above-described device only shows the processor 1010, video display adapter 1011, disk drive 1012, input / output interface 1013, network interface 1014, memory 1020, bus 1030, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.
[0164] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer program product. This computer program product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0165] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for generating training samples, characterized in that, The method includes: Obtain raw question and answer data, which includes query text, document data, and first response data. The document data includes at least one reference document retrieved based on the query text and used to generate the first response data. The first response data includes conclusion data. The second language model is invoked to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference documents; The third language model is invoked to obtain the metadata of the target reference document, which is used to indicate the authoritative information of the target reference document; The fourth language model is invoked to generate second response data based on the first response data, the correspondence, and the authoritative information of the target reference document; Training samples are generated based on the query text and the second response data to train the question-answering model.
2. The method according to claim 1, characterized in that, The process of calling the third major language model to obtain the metadata of the target reference document includes: The third language model is invoked to match the target reference document in a preset authoritative information candidate library to obtain the metadata of the target reference document; The preset authoritative information candidate database includes authoritative information, which includes at least one of the following: source name, source organization, and authority level.
3. The method according to claim 1, characterized in that, The step of calling the fourth language model to generate second response data based on the first response data, the correspondence, and the authoritative information of the target reference document includes: The fourth language model is invoked to add reference tags to the conclusion data based on the correspondence; The fourth language model is invoked to generate a list of reference documents for the target reference document based on the authoritative information of the target reference document, the list of reference documents including the citation tags; The reference document list is merged with the first response data, which has been marked with citations, to obtain the second response data.
4. The method according to any one of claims 1 to 3, characterized in that, After obtaining the raw question-and-answer data, the method further includes: The first major language model is invoked to filter reference documents containing authoritative content of a preset type from the raw question and answer data; Based on the reference document containing authoritative content of a preset type, the step of calling the second language model to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference document is performed, wherein the target reference document originates from the reference document containing authoritative content of a preset type.
5. A method for training a question-answering model, characterized in that, The method includes: Obtain training samples, wherein the training samples are generated using the training sample generation method as described in any one of claims 1 to 4; The question-answering model is trained using the training samples so that when the query text is input, the target output of the question-answering model is the second response data.
6. The method according to claim 5, characterized in that, The training samples include a first training sample, which includes the query text and its corresponding labeled data, wherein the labeled data is the second response data; training the question-answering model using the training samples includes: supervised fine-tuning of the question-answering model to be optimized using the first training samples; and / or, The training samples include a second training sample, which includes the query text and its corresponding preference data and non-preference data. The preference data is the second response data, and the non-preference data is the first response data. The step of training the question-answering model using the training samples includes: using the second training samples to perform reinforcement learning on the question-answering model to be optimized.
7. The method according to claim 6, characterized in that, The step of using the second training samples to perform reinforcement learning on the question-answering model to be optimized includes: Input the query text into the question-answering model to be optimized, and obtain the response data obtained by the question-answering model based on the query text; Input the query text and the response data obtained based on the query text into the reward model; The question-answering model is optimized based on the reward value output by the reward model. The reward model is pre-trained using the second training sample.
8. A question-and-answer method, characterized in that, The method includes: Get the query text; After retrieving document data based on the query text, the question-answering model is invoked to generate a second response data for the query text based on the document data. The question-answering model is pre-trained using the method described in any one of claims 5 to 7.
9. A method for generating a list of reference documents, characterized in that, The method includes: Obtain the correspondence between at least one conclusion data in the original document and at least one reference document; The third language model is invoked to obtain the metadata of the reference document, which is used to indicate the authoritative information of the reference document; The fourth language model is invoked to generate a list of reference documents for the original document based on the authoritative information and the reference documents.
10. A training sample generation device, characterized in that, The device includes: The raw question and answer data acquisition unit is configured to acquire raw question and answer data, which includes query text, document data and first response data. The document data includes at least one reference document retrieved based on the query text and used to generate the first response data. The first response data includes conclusion data. The correspondence analysis unit is configured to invoke a second language model to analyze the correspondence between at least one conclusion data in the first response data and at least one target reference document in the reference documents; The document metadata acquisition unit is configured to call a third language model to obtain the metadata of the target reference document, the metadata being used to indicate the authoritative information of the target reference document; The training sample generation unit is configured to invoke a fourth language model to generate second response data based on the first response data, the correspondence, and the authoritative information of the target reference document; and to generate training samples based on the query text and the second response data to train the question-answering model.
11. An apparatus for generating a list of reference documents, characterized in that, The device includes: The document correspondence acquisition unit is configured to acquire the correspondence between at least one conclusion data in the original document and at least one reference document; The document metadata acquisition unit is configured to call a third language model to obtain the metadata of the reference document, the metadata being used to indicate the authoritative information of the reference document; The reference document list generation unit is configured to invoke a fourth language model to generate a reference document list for the original document based on the authoritative information and the reference documents.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 9.
13. An electronic device, characterized in that, include: One or more processors; as well as A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method according to any one of claims 1 to 9.
14. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 9.