Model training method, question and answer reply method, device, equipment, medium and product

CN122946485APending Publication Date: 2026-10-20BEIJING CO WHEELS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510467996.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0002]目前,在检索增强生成(Retrieval-Augmented Generation,RAG)系统的时效性问答中,经常出现用户的提问时间和检索内容事件发生时间不一致的情况,例如,已经发生的事件在检索结果中仍用将来时表示,模型回复没有理解提问时间已经晚于事件发生时间,而照抄检索结果的内容,使得最终回复错误,模型的回复质量较差

Benefits of technology

[0029]本发明实施例的技术方案,在获得查询语句集合后,通过对查询语句集合中的查询语句进行筛选,得到具有时效性的查询语句;这里,对查询语句集合进行筛选,可以确保筛选结果的精确性;另外,在得到查询语句的检索结果后,可以根据查询语句的查询时间和检索结果中各个检索事件对应的事件发生时间,共同确定查询语句对应的回复结果;由于该回复结果的时效性和查询语句的时效性具有一致性,因而,利用该回复结果构建模型的训练数据集,可以增强模型在训练过程中对时间的理解能力,解决模型回复的时效性问题,提升模型的回复质量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure HDA0005359210360000011
    Figure HDA0005359210360000011
  • Figure HDA0005359210360000012
    Figure HDA0005359210360000012
  • Figure HDA0005359210360000013
    Figure HDA0005359210360000013
Patent Text Reader

Abstract

This application provides a model training method, a question-and-answer response method, an apparatus, a device, a computer-readable storage medium, and a computer program product. The method includes: obtaining a set of query statements; filtering the set of query statements to obtain a target set; obtaining a first retrieval result of the query statement at a first query time; the first retrieval result includes at least one retrieval event, and the retrieval event has a corresponding event occurrence time; determining the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result; the timeliness of the response result is consistent with the timeliness of the query statement; constructing a training dataset based on the query statement and the corresponding response result, and using the training dataset to train an initial response model to obtain a trained target response model; thus, ensuring the model training effect and improving the model's response quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a model training method, a question-and-answer method, an apparatus, a computer-readable storage medium, and a computer program product. Background Technology

[0002] Currently, in the timeliness question answering of Retrieval-Augmented Generation (RAG) systems, there are often discrepancies between the time of the user's question and the time of the event in the search content. For example, events that have already occurred are still represented in the future tense in the search results. The model does not understand that the question time is later than the event time and simply copies the content of the search results, resulting in an incorrect final response and poor model response quality. Summary of the Invention

[0003] This application provides a model training method, a question-and-answer method, an apparatus, a computer-readable storage medium, and a computer program product.

[0004] The technical solution of this application embodiment is implemented as follows:

[0005] This application provides a model training method, the method comprising:

[0006] Retrieve the set of query statements;

[0007] The set of query statements is filtered to obtain a target set; the target set includes time-sensitive query statements, each with a corresponding first query time.

[0008] Obtain the first search result of the query statement at the first query time; the first search result includes at least one search event, and the search event has a corresponding event occurrence time;

[0009] Based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result, the response result corresponding to the query statement is determined; the timeliness of the response result is consistent with the timeliness of the query statement.

[0010] Based on the query statement and the corresponding response results, a training dataset is constructed, and the initial response model is trained using the training dataset to obtain the target response model after training.

[0011] This application embodiment also provides a question-and-answer method, the method including:

[0012] Retrieve the target query statement to be responded to;

[0013] The target query statement is processed using a target response model to obtain the response result corresponding to the target query statement; wherein, the target response model is trained according to the model training method provided by one or more of the aforementioned technical solutions.

[0014] This application embodiment also provides a model training device, the model training device comprising:

[0015] The first acquisition module is used to acquire the set of query statements;

[0016] A filtering module is used to filter the set of query statements to obtain a target set; the target set includes query statements with timeliness, and each query statement has a corresponding first query time;

[0017] The retrieval module is used to obtain the first retrieval result of the query statement at the first query time; the first retrieval result includes at least one retrieval event, and the retrieval event has a corresponding event occurrence time;

[0018] The determining module is used to determine the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result; the timeliness of the response result is consistent with the timeliness of the query statement;

[0019] The training module is used to construct a training dataset based on the query statement and the corresponding response results, and to train the initial response model using the training dataset to obtain the trained target response model.

[0020] This application also proposes a question-and-answer response device, the device comprising:

[0021] The second acquisition module is used to acquire the target query statement to be replied to;

[0022] The response module is used to process the target query statement using the target response model to obtain the response result corresponding to the target query statement; wherein, the target response model is trained according to the model training method provided by one or more of the aforementioned technical solutions.

[0023] This application also provides an electronic device, the electronic device comprising:

[0024] Memory is used to store executable instructions for a computer;

[0025] A processor, when executing computer-executable instructions or computer programs stored in the memory, implements the model training method or question-and-answer method as described in any of the preceding claims.

[0026] This application also provides a computer-readable storage medium storing computer-executable instructions or computer programs, which, when executed by a processor, implement the model training method or question-and-answer method as described in any of the preceding claims.

[0027] This application also provides a computer program product, including computer-executable instructions or a computer program, which, when executed by a processor, can implement the model training method or question-and-answer method as described in any of the preceding claims.

[0028] The embodiments of this application have the following beneficial effects:

[0029] The technical solution of this invention, after obtaining a set of query statements, filters the query statements in the set to obtain timely query statements; here, filtering the set of query statements ensures the accuracy of the filtering results; furthermore, after obtaining the retrieval results of the query statements, the response results corresponding to the query statements can be jointly determined based on the query time of the query statement and the occurrence time of the events corresponding to each retrieval event in the retrieval results; since the timeliness of the response results is consistent with the timeliness of the query statements, using the response results to construct the training dataset of the model can enhance the model's ability to understand time during training, solve the problem of the timeliness of the model's response, and improve the quality of the model's response. Attached Figure Description

[0030] Figure 1 A schematic flowchart illustrating a model training method provided in an embodiment of this application;

[0031] Figure 2 A flowchart illustrating another model training method provided in an embodiment of this application;

[0032] Figure 3 A flowchart illustrating a question-and-answer response method provided in an embodiment of this application;

[0033] Figure 4 This is a schematic diagram of the composition structure of the model training device provided in the embodiments of this application;

[0034] Figure 5 This is a schematic diagram of the composition structure of the question-and-answer response device provided in the embodiments of this application;

[0035] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0036] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0037] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0038] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0039] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.

[0040] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.

[0041] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0042] 1) RAG: Retrieval Enhanced Generation, which combines two main techniques: retrieval and generation. The RAG model first retrieves the most relevant information to the input query from a large text database, and then uses this information to help generate the response or text.

[0043] 2) prompt: prompt words refer to input hints created for large models to guide them in generating expected outputs.

[0044] 3) query: The query or question entered by the user.

[0045] 4) Observation: Search results.

[0046] 5) assistant: model response.

[0047] In related technologies, to improve the quality of model responses, regular expressions are used to define specific query statements. For these queries, specific prompts are set to guide the model's output. However, this approach has the following drawbacks: 1) Using regular expressions to define time-sensitive queries may result in omissions or over-recalls, leading to incomplete or noisy prompts for the model, making it difficult to ensure the quality of the model's response. 2) There are various situations where the user's question time and the time of the retrieved content's occurrence are inconsistent. The prompt is not aware of the retrieved content and cannot provide targeted suggestions, affecting the model's response performance.

[0048] Based on the above technical problems, embodiments of this application provide a model training method, a question-and-answer method, a device, a computer-readable storage medium, and a computer program product.

[0049] Figure 1 This is a flowchart illustrating a model training method provided in an embodiment of this application, as shown below. Figure 1 As shown, the method includes the following steps:

[0050] Step 100: Obtain the set of query statements.

[0051] In this embodiment, the execution entity of the model training method is a model training device, which can be implemented by software and / or hardware. In this embodiment, the model training device can be an electronic device, or it can be configured in an electronic device.

[0052] For example, electronic devices may include, but are not limited to, terminal devices and servers, etc., and the embodiments of this application do not specifically limit them.

[0053] The query statement set can include multiple query statements, which include both time-sensitive and non-time-sensitive query statements.

[0054] Here, there is no specific limit to the number of query statements in the query statement set. For example, the query statement set may include 800 or 1000 query statements.

[0055] For example, timeliness refers to the significant differences in the nature of the same thing at different times; a query statement with timeliness refers to a query statement that includes timeliness keywords, while a query statement without timeliness refers to a query statement that does not include timeliness keywords.

[0056] It should be noted that time-sensitive keywords refer to keywords associated with time-related words. For example, time-sensitive keywords can be "will", "already", "today", "tomorrow", "yesterday", "recently", etc.

[0057] In this embodiment of the application, the method of obtaining the query statement set is not specifically limited. For example, historical query statements can be obtained from the historical query logs of the question and answer system, and a query statement set can be generated based on the obtained historical query statements. Alternatively, it can be obtained from a preset database, etc.

[0058] Step 101: Filter the set of query statements to obtain the target set.

[0059] Understandably, to optimize the question-answering model's ability to understand time, after obtaining the query statement set, it is necessary to filter out the time-sensitive queries for subsequent model training. To ensure the reliability of the filtering results, the query statement set can be filtered to obtain a target set.

[0060] The target set may include time-sensitive query statements, and the number of query statements may be multiple. For example, the target set may include 500 or 800 time-sensitive query statements.

[0061] It should be noted that each query in the target set has a corresponding first query time, which refers to the time when the user enters the query in the question-and-answer system, that is, the time when the user asks the question; for example, the query is: What did XX company recently release?; the first query time is: 2024-11-07.

[0062] In some embodiments, filtering the set of query statements to obtain a target set may include: performing an initial timeliness filter on the set of query statements using preset timeliness keywords to obtain a first set; performing clustering and deduplication on the first set to obtain a second set; and performing a second timeliness filter on the second set using a second preset large model to obtain the target set.

[0063] Here, the preset time-sensitive keywords refer to time-sensitive keywords set based on actual conditions, and this application embodiment does not specifically limit them; for example, the preset time-sensitive keywords may include, but are not limited to, "will", "already", "today", "tomorrow", "yesterday", "recently", etc.

[0064] Understandably, since the query statement set includes a large number of queries, directly scoring and filtering them using a large model would be costly. Therefore, we can first use regular expressions to coarsely filter out queries with timeliness. Correspondingly, we can first use preset timeliness keywords to perform an initial timeliness filter on the queries in the query statement set to obtain a first set. At this time, the first set includes the coarsely filtered timeliness queries, which contain timeliness keywords.

[0065] For example, considering that the query statements in the first set may have similarities, if all of them are used for subsequent question-answering model training, it will result in low diversity of training data and reduced model performance. Therefore, clustering deduplication can be used to further filter the query statements in the first set to improve the diversity of training data. Correspondingly, the first set can be clustered to obtain the second set.

[0066] Here, the specific implementation method for cluster deduplication is not limited. For example, a clustering model can be used to perform cluster deduplication on the first set. The clustering model can be: K-Means clustering model, hierarchical clustering model, etc. For ease of understanding, the cluster deduplication process is illustrated below.

[0067] For example, firstly, a pre-trained clustering model can be loaded, designed to convert natural language text into high-dimensional semantic embedding representations. The loading path of the clustering model is configurable and deployed on a high-performance computing device, such as a Graphics Processing Unit (GPU), to ensure efficient inference. Then, the query statements in the first set are divided into batches and input into the clustering model for batch-by-batch transformation to obtain their corresponding embedding representations; this batch processing method aims to optimize resource usage and avoid memory overflow. Next, a similarity matrix is ​​constructed using the cosine similarity between the embedding representations to quantify the semantic closeness between different query statement pairs. Then, an agglomerative hierarchical clustering algorithm is applied for clustering. Correspondingly, based on a set distance threshold, query statements with similarity higher than this threshold are grouped into the same cluster, and the average connectivity method is used to measure the similarity between clusters to obtain more accurate clustering results. Since queries within the same cluster are highly similar, one query from each cluster can be selected as the representative query for that cluster. This selection method ensures that the output of each cluster has good representativeness and uniqueness. Finally, the queries selected from each cluster can be combined to obtain a second cluster, ensuring the diversity of queries within the second cluster.

[0068] Understandably, timely queries can be filtered out using regular expressions and clustering deduplication. However, the granularity of the above methods is relatively coarse, which may result in the second set still containing some non-time-sensitive queries. Therefore, a second preset large model can be used to further filter the second set based on timeliness to obtain the target set.

[0069] Here, the second preset large model is used to filter the query statements in the second set based on their timeliness, i.e., by scoring, to filter out query statements that are not timely. The second preset large model can be any high-performance large model; for example, it can be the GPT4 model. For ease of understanding, the filtering process of the second preset large model is illustrated below.

[0070] For example, in order to filter out queries that are not time-sensitive in the second set, prompts can be designed for the second preset large model to guide it in filtering out queries that are time-sensitive; for example, the prompts could be as follows:

[0071] Plain Text

[0072] You are a virtual assistant tasked with verifying whether a question-and-answer system's responses are based on a given user's question date and that the context is appropriate. Please provide your judgments in the following format:

[0073] -Date of user question

[0074] -question

[0075] -Background Information

[0076] -reply

[0077] Your task is to determine whether a response provides a relevant answer based on the user's question date and background information. Please indicate "yes" or "no" and provide a brief reason. If the response is not based on the question date context or is inaccurate, please specify the problem. The model's output should be in JSON format, containing the fields: is_correct (whether the question was answered correctly: yes, no), and reason (the reason for the determination).

[0078] It should be noted that the question in the above example is the query statement in the second set; the date of the user's question is the first query time corresponding to the query statement; the background information refers to the retrieval event related to the question; and the response refers to the output result of the second preset large model.

[0079] As can be seen, in this embodiment of the application, after obtaining the set of query statements, the timely query statements can be effectively filtered out by performing regular expression processing, cluster deduplication, and large model scoring on the set of query statements, thus ensuring the subsequent model training effect.

[0080] Step 102: Obtain the first search result of the query statement at the first query time.

[0081] In this embodiment of the application, after obtaining the target set, i.e., each query statement with timeliness, according to the above steps, the first retrieval result of these query statements at the first query time can be obtained.

[0082] For example, the way to obtain the first search result of the query statement at the first query time is to input the query statement and the corresponding first query time into the retrieval model of the question-and-answer system to obtain the corresponding first search result.

[0083] Here, the first search result includes at least one search event, and each search event has a corresponding event occurrence time. Understandably, if a search is performed on each query statement in the target set, one or more search events may be returned, and the event occurrence time for each search event may be different; the first query time may be earlier or later than the event occurrence time.

[0084] It should be noted that the tense of the searched events in the first search results is divided into two cases: one is that all the searched events are in the future tense, in which case there can be one or more searched events; the other is that the searched events have both future and past tenses, in which case there are multiple searched events. Since the first query time may be earlier or later than the event occurrence time, it can be divided into four different cases. For ease of understanding, the following are examples of these four cases.

[0085] For example, if all retrieved events are in the future tense, and the first query time is earlier than the event occurrence time corresponding to all retrieved events, then the model responds with the future tense retrieved events. For instance, the query is: "When will a certain sporting event open?"; the first query time is: 2024-06-04; the first search result is: "A certain sporting event will open on July 26, 2024"; the model responds: "A certain sporting event will open on July 26." In this example, the first query time (2024-06-04) is earlier than the event occurrence time (July 26, 2024) corresponding to the retrieved events.

[0086] For example, if all retrieved events are in the future tense, and the first query time is later than the event occurrence time corresponding to all retrieved events, the existing model response will still be a future tense retrieved event, which is incorrect. When constructing training data later, the model response can be changed to a more ambiguous statement. For instance, the query is: When will product XX be released? The first query time is: 2024-03-04; the first search result is: Product XX will hold a press conference on March 1, 2024; the modified model response is: The press conference for product XX is scheduled for March 1, 2024; the incorrect model response is: Product XX will hold a press conference on March 1, 2024. In this example, the first query time (2024-03-04) is later than the event occurrence time (March 1, 2024) corresponding to the retrieved event.

[0087] For example, if a search event has both future and past tenses, and the first query time is later than the event occurrence time corresponding to all search events, then the model responds with the past tense search event. For instance, the query is: "What did Company XX recently publish?"; the first query time is: 2024-11-07; the first search results are: "2024-09-09, Company XX will publish on September 10th"; "2024-10-09, Company XX published on September 10th"; the model response should be: "Company XX's most recent publication was on September 10th, 2024." In this example, the first query time (2024-11-07) is later than the event occurrence time (September 10th) corresponding to the two search events; where dates 2024-09-09 and 2024-10-09 represent the publication times of the two search events, respectively.

[0088] For example, if a retrieved event has both future and past tenses, and the first query time is later than the occurrence time of one set of retrieved events but earlier than the occurrence time of another set of retrieved events, then the model responds with a future tense retrieved event. For instance, the query is: "What matches does athlete XX have recently?"; the first query time is: 2024-11-07; the first search result is: "Athlete XX has a match on 2024-09-09 1"; "Athlete XX will have a match on November 8th 2"; the model response should be: "Athlete XX will have a match on November 8th 2". In this example, the first query time (2024-11-07) is later than the occurrence time of one of the retrieved events (September 9th) but earlier than the occurrence time of the other retrieved event (November 8th).

[0089] Step 103: Determine the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result.

[0090] Here, the timeliness of the response results is consistent with the timeliness of the query statement.

[0091] In some embodiments, determining the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result may include: determining the scenario type corresponding to the query statement based on the relationship between the event occurrence time of each retrieval event in the first retrieval result and the first query time; and determining the response result corresponding to the query statement based on the scenario type corresponding to the query statement.

[0092] Here, the scenario type can be at least one of the four situations mentioned above. As can be seen from the examples of the four situations mentioned above, the scenario type of the query statement can be determined according to the relationship between the occurrence time of each retrieval event in the first retrieval result and the first query time. The process of determining the scenario type can be referred to the above examples, and will not be repeated here.

[0093] Furthermore, after obtaining the scenario type of each query statement in the target set, the corresponding response result of each query statement can be determined based on the scenario type corresponding to each query statement.

[0094] In some embodiments, determining the response result corresponding to the query statement based on the scenario type corresponding to the query statement may include: constructing prompt words for a first preset large model based on the scenario type corresponding to the query statement; the prompt words are used to instruct the first preset large model to generate a response result with timeliness consistent with the query statement; and processing the query statement and prompt words using the first preset large model to obtain the response result corresponding to the query statement.

[0095] Here, the first preset large model can be any large model with good performance; for example, the first preset large model can be the GPT4 model, etc.

[0096] For example, the implementation of constructing prompt words for the first preset large model according to the scenario type corresponding to the query statement can be as follows: if the scenario type corresponding to the query statement is that all the search events are in the future tense, and the first query time is earlier than the event occurrence time corresponding to all the search events, then construct future tense prompt words to instruct the first preset large model to generate a response result consistent with the timeliness of the query statement. In this case, the response result of the first preset large model is the future tense search event. The other three cases are implemented in a similar way, and will not be elaborated here to avoid repetition.

[0097] For example, the query is: When will a certain sporting event open? The first query time is: 2024-06-04. The first search result is: A certain sporting event will open on 24-07-26. Since the scenario type corresponding to this query is that the searched event is in the future tense, and the first query time 2024-06-04 is earlier than the event occurrence time 24-07-26, we can construct future tense prompts so that the first preset model generates a response result consistent with the timeliness of the query. For example, the model response could be: A certain sporting event will open on July 26.

[0098] Understandably, after obtaining the scenario types of each query statement in the target set, prompt words for the first pre-defined large model can be constructed based on the scenario type corresponding to the query statement. These prompt words instruct the first pre-defined large model to generate response results consistent with the timeliness of the query statement. The first pre-defined large model is then used to process the query statement and the prompt words to obtain the response result corresponding to the query statement. This response result is constructed specifically for the query statement. Subsequently, a training dataset can be constructed based on each query statement and its corresponding response result.

[0099] In this embodiment of the application, after obtaining the response result corresponding to the query statement, the above method may further include: performing quality screening on the response result corresponding to the query statement to obtain a target response result whose quality meets preset requirements.

[0100] Furthermore, after quality screening using response rules, model scoring can be used for further quality screening. Correspondingly, the query statement, retrieval time, and response results can be input into the model. Then, prompts are designed in a thought-chain manner to progressively check the relevance and authenticity of the response results. The model output is either 0 or 1, where 0 indicates an error and 1 indicates a correct result. If the output is 0, the response result is filtered; if the output is 1, the response result is retained. After this quality screening, target response results that meet the preset quality requirements can be obtained. Subsequently, a training dataset can be constructed based on the query statement and the corresponding target response results.

[0101] As can be seen, in this embodiment of the application, by performing quality screening on the response results corresponding to the query statement, the quality of training data can be ensured and the quality of model response can be improved.

[0102] Understandably, based on the first retrieval result obtained from the above steps, the chronological relationship between the first query time of the query statement and the event occurrence time can be determined. To ensure the richness of the model training data, the above method may further include: adjusting the first query time corresponding to the query statement and obtaining the second retrieval result of the query statement at the adjusted second query time; determining the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result may include: determining the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result, as well as the second query time and the event occurrence time corresponding to each retrieval event in the second retrieval result.

[0103] For example, based on query statements in the target set where the first query time is earlier than the event occurrence time, several other cases of query statements can be constructed; for example, for query statements where the first query time is earlier than the event occurrence time, at least one of the other three cases can be constructed.

[0104] For example, the construction method can be: adjust the query time corresponding to the query statement so that the query statement can cover at least one of the other three cases.

[0105] In some embodiments, adjusting the first query time corresponding to the query statement may include: adjusting the first query time corresponding to the query statement backward by a first preset duration; or, adjusting the first query time corresponding to the query statement forward by a second preset duration.

[0106] Here, the first preset duration and the second preset duration can be the same or different; the values ​​of both can be set according to the actual situation, and this application embodiment does not make specific limitations; for example, the first preset duration and the second preset duration can both be set to 1 year.

[0107] For example, when the first preset time is 1 year, adjusting the first preset time corresponding to the query statement to the next preset time means changing all the first query times to the time of the next year; after the above modification, the modified second query time is later than the time of all events.

[0108] For example, when the second preset duration is 1 year, adjusting the second preset duration of the first query time corresponding to the query statement forward means changing all the first query times to the previous year. After the above modification, the modified second query time is earlier than the retrieval time corresponding to the future tense retrieval event, and may be later than the retrieval time corresponding to the past tense retrieval event, or may be earlier than the retrieval time corresponding to the past tense retrieval event.

[0109] For example, by adjusting the query time corresponding to the query statement, the second search result of the query statement at the adjusted second query time can be obtained again; after obtaining the second search result, the first search result and the second search result can be mixed so that the search events of the query statement are partly in the past tense and partly in the future tense, thus ensuring the richness of the search events.

[0110] It should be noted that the process of obtaining the second search result is similar to the process of obtaining the first search result, and will not be repeated here to avoid repetition.

[0111] Furthermore, after obtaining the second search result, the response result corresponding to the query statement can be determined based on the first query time and the event occurrence time corresponding to each search event in the first search result, as well as the second query time and the event occurrence time corresponding to each search event in the second search result.

[0112] Step 104: Based on the query statement and the corresponding response results, construct a training dataset, and use the training dataset to train the initial response model to obtain the target response model after training.

[0113] In this embodiment of the application, after obtaining the query statement and the corresponding response result according to the above steps, a training dataset for model training can be constructed based on the query statement and the corresponding response result.

[0114] In some embodiments, constructing a training dataset based on a query statement and its corresponding response results may include: constructing a training dataset based on a query statement and its corresponding target response results; here, the target response results are the response results that have undergone quality screening as described above.

[0115] In this embodiment of the application, after obtaining the training dataset according to the above steps, the initial response model can be trained using the training dataset to obtain the target detection model.

[0116] Here, the initial response model can be understood as a response model with training requirements; the target response model is the trained response model; the response model can be a large language model (LLM), such as the ChatGPT (Chat Generative Pre-trained Transformer) model, or other types of large models, which are not limited here.

[0117] The technical solution of this invention, after obtaining a set of query statements, filters the query statements in the set to obtain timely query statements. Here, filtering the set of query statements ensures the accuracy and diversity of the filtering results. In addition, after obtaining the retrieval results of the query statements, adjusting the query time corresponding to the query statements and re-obtaining the retrieval results of the query statements at the adjusted query time can improve the coverage of the retrieval results for the time-sensitive question-and-answer scenarios of the query statements. Subsequently, constructing a training dataset based on the retrieval results of the query statements at different query times can ensure the integrity of the training data, ensure the model training effect, and improve the model's response quality.

[0118] To better illustrate the purpose of this application, further examples are provided based on the above embodiments.

[0119] For example, Figure 2 A flowchart illustrating another model training method provided in this application embodiment is shown below. Figure 2 As shown, the method includes: after obtaining a set of query statements, filtering the set of query statements to obtain query statements with timeliness, i.e., timeliness queries; obtaining the retrieval results of the query statements at a first query time, then modifying the first query time to obtain a modified second query time, and re-obtaining the retrieval results of the query statements at the adjusted second query time; determining the scenario type corresponding to the query statements based on the obtained retrieval results and query statements, constructing model responses based on query statements of different scenario types, i.e., constructing the response results of the question-answering model for the query statements; filtering the response results of the query statements using response rules and model scoring to obtain target response results that meet preset quality requirements; subsequently, constructing a training dataset based on the target response results and the query statements corresponding to the target response results, and using the training dataset to train the initial response model to obtain the trained target response model. The corresponding process has been described in the above embodiments, and will not be repeated here to avoid repetition.

[0120] Figure 3 This is a flowchart illustrating a question-and-answer response testing method according to an embodiment of this application, as shown below. Figure 3 As shown, the method includes the following steps:

[0121] Step 300: Obtain the target query statement to be replied to;

[0122] Step 301: Process the target query statement using the target response model to obtain the response result corresponding to the target query statement.

[0123] For example, the target query statement refers to the query statement that requires a response from the target response model.

[0124] In this embodiment of the application, the target response model can be obtained according to the above steps 100 to 104. To avoid repetition, it will not be described again here.

[0125] Understandably, since the training dataset used in the target response model training process can cover the timeliness of question-and-answer scenarios of query statements, and the constructed response results have undergone quality screening, the integrity of the training data can be ensured, the model training effect can be ensured, and the model's response quality can be improved.

[0126] Based on the foregoing embodiments, this application also provides a model training apparatus. Figure 4 This is a schematic diagram of the structure of the model training device provided in the embodiments of this application, as shown below. Figure 4 As shown, the model training device 4 may include:

[0127] The first acquisition module 401 is used to acquire a set of query statements;

[0128] The filtering module 402 is used to filter the set of query statements to obtain a target set; the target set includes query statements with timeliness, and each query statement has a corresponding first query time;

[0129] The retrieval module 403 is used to obtain the first retrieval result of the query statement at the first query time; the first retrieval result includes at least one retrieval event, and the retrieval event has a corresponding event occurrence time;

[0130] The determination module 404 is used to determine the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result; the timeliness of the response result is consistent with the timeliness of the query statement.

[0131] The training module 405 is used to construct a training dataset based on the query statement and the corresponding response results, and to train the initial response model using the training dataset to obtain the trained target response model.

[0132] In some embodiments, the determining module 404 is further configured to:

[0133] Based on the relationship between the occurrence time of each search event in the first search result and the first query time, the scenario type corresponding to the query statement is determined;

[0134] Determine the response result corresponding to the query statement based on the scenario type corresponding to the query statement.

[0135] In some embodiments, the determining module 404 is further configured to:

[0136] Based on the scenario type corresponding to the query statement, construct prompt words for the first preset large model; the prompt words are used to instruct the first preset large model to generate response results that are consistent with the timeliness of the query statement;

[0137] The query statement and prompt words are processed using the first preset large model to obtain the corresponding response results.

[0138] In some embodiments, after determining the response result corresponding to the query statement, the filtering module 402 is further configured to:

[0139] The response results corresponding to the query statement are filtered for quality to obtain the target response results that meet the preset quality requirements;

[0140] Training module 405 is also used for:

[0141] Construct a training dataset based on the query statement and the target response result corresponding to the query statement.

[0142] In some embodiments, the filtering module 402 is further configured to:

[0143] The query statement set is initially filtered for timeliness using preset timeliness keywords to obtain the first set;

[0144] Cluster the first set to remove duplicates, and obtain the second set;

[0145] The second set is further filtered for timeliness using the second pre-set large model to obtain the target set.

[0146] In some embodiments, the above-described apparatus further includes an adjustment module, the adjustment module being configured to:

[0147] Adjust the first query time corresponding to the query statement, and obtain the second search result of the query statement at the adjusted second query time;

[0148] Module 404 is also used for:

[0149] Based on the first query time and the event occurrence time corresponding to each search event in the first search result, as well as the second query time and the event occurrence time corresponding to each search event in the second search result, the response result corresponding to the query statement is determined.

[0150] In some embodiments, the adjustment module is further configured to:

[0151] Adjust the first query time backward by the first preset duration; or...

[0152] Adjust the second preset duration forward from the first query time.

[0153] Based on the foregoing embodiments, this application also provides a question-and-answer response device. Figure 5 This is a schematic diagram of the question-and-answer response device provided in the embodiments of this application, as shown below. Figure 5 As shown, the question-and-answer response device 5 may include:

[0154] The second acquisition module 501 is used to acquire the target query statement to be replied to;

[0155] The response module 502 is used to process the target query statement using the target response model to obtain the response result corresponding to the target query statement; wherein, the target response model is trained according to the model training method provided by one or more of the aforementioned technical solutions.

[0156] In practical applications, the first acquisition module 401, the filtering module 402, the retrieval module 403, the determination module 404, the training module 405, the second acquisition module 501, the response module 502, and the adjustment module can all be implemented by a processor located in the model training device. The processor can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), Central Processing Unit (CPU), controller, microcontroller, and microprocessor.

[0157] Based on the foregoing embodiments, this application also provides an electronic device. Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 6 As shown, the electronic device 6 may include a processor 601 and a memory 602; wherein,

[0158] Memory 602 is used to store computer-executable instructions;

[0159] The processor 601, when executing computer-executable instructions or computer programs stored in the memory 602, implements a model training method or a question-and-answer response method as described above.

[0160] Based on the foregoing embodiments, this application also provides a computer-readable storage medium storing computer-executable instructions or computer programs, which, when executed by a processor, implement the model training method or question-and-answer method as described above.

[0161] Based on the foregoing embodiments, this application also provides a computer program product, including computer-executable instructions or a computer program, which, when executed by a processor, can implement the model training method or question-and-answer method as described above.

[0162] In some embodiments, the computer-readable storage medium may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM), etc.; or it may be a device that includes one or any combination of the above-mentioned memories.

[0163] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.

[0164] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).

Claims

1. A model training method, characterized in that, The method includes: Retrieve the set of query statements; The set of query statements is filtered to obtain a target set; the target set includes time-sensitive query statements, each with a corresponding first query time. Obtain the first search result of the query statement at the first query time; the first search result includes at least one search event, and the search event has a corresponding event occurrence time; Based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result, the response result corresponding to the query statement is determined; the timeliness of the response result is consistent with the timeliness of the query statement. Based on the query statement and the corresponding response results, a training dataset is constructed, and the initial response model is trained using the training dataset to obtain the target response model after training.

2. The method according to claim 1, characterized in that, The step of determining the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result includes: Based on the relationship between the occurrence time of each retrieval event in the first retrieval result and the first query time, the scenario type corresponding to the query statement is determined; The response result corresponding to the query statement is determined based on the scenario type corresponding to the query statement.

3. The method according to claim 2, characterized in that, The step of determining the response result corresponding to the query statement based on the scenario type corresponding to the query statement includes: Based on the scenario type corresponding to the query statement, a prompt word for a first preset large model is constructed; the prompt word is used to instruct the first preset large model to generate a response result with the same timeliness as the query statement; The query statement and the prompt words are processed using the first preset large model to obtain the response result corresponding to the query statement.

4. The method according to any one of claims 1 to 3, characterized in that, After determining the response result corresponding to the query statement, the method further includes: The response results corresponding to the query statement are filtered for quality to obtain target response results that meet preset quality requirements; The step of constructing a training dataset based on the query statement and the corresponding response results includes: The training dataset is constructed based on the query statement and the target response result corresponding to the query statement.

5. The method according to any one of claims 1 to 4, characterized in that, The step of filtering the set of query statements to obtain the target set includes: The query statement set is initially filtered for timeliness using preset timeliness keywords to obtain a first set; Cluster the first set to remove duplicates, and obtain the second set; The second set is further filtered for timeliness using a second preset large model to obtain the target set.

6. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Adjust the first query time corresponding to the query statement, and obtain the second search result of the query statement at the adjusted second query time; The step of determining the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result includes: The response result corresponding to the query statement is determined based on the first query time and the event occurrence time corresponding to each search event in the first search result, as well as the second query time and the event occurrence time corresponding to each search event in the second search result.

7. The method according to claim 6, characterized in that, Adjusting the first query time corresponding to the query statement includes: Adjust the first query time backward by a first preset duration; or... Adjust the first query time forward by the second preset duration.

8. A question-and-answer method, characterized in that, The method includes: Retrieve the target query statement to be replied to; The target query statement is processed using a target response model to obtain the response result corresponding to the target query statement; wherein the target response model is trained by the method according to any one of claims 1 to 7.

9. A model training device, characterized in that, The model training device includes: The first acquisition module is used to acquire the set of query statements; A filtering module is used to filter the set of query statements to obtain a target set; the target set includes query statements with timeliness, and each query statement has a corresponding first query time; The retrieval module is used to obtain the first retrieval result of the query statement at the first query time; the first retrieval result includes at least one retrieval event, and the retrieval event has a corresponding event occurrence time; The determining module is used to determine the response result corresponding to the query statement based on the first query time and the event occurrence time corresponding to each retrieval event in the first retrieval result; the timeliness of the response result is consistent with the timeliness of the query statement; The training module is used to construct a training dataset based on the query statement and the corresponding response results, and to train the initial response model using the training dataset to obtain the trained target response model.

10. An electronic device, characterized in that, The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method according to any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 8.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method according to any one of claims 1 to 8.