Problem processing method and device, equipment, medium and program product
By filtering and structuring key information from external candidate documents, the illusion problem of large language models in specific domains is solved, ensuring the accuracy and interpretability of answers.
Patent Information
- Application Number
- CN202511846550.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-03-10
AI Technical Summary
Large language models are prone to illusions in specific domains or knowledge-intensive tasks, with redundant external search results that can obscure key information and lead to answers that deviate from the true question.
By identifying the target document from external candidate documents, performing structured processing, obtaining the correlation between key target information and candidate answers, and combining this with the question to be retrieved to determine the target answer, key information can be avoided due to long reasoning chains.
It significantly reduces illusions in text generation, ensures that answers are closely coupled with questions, and improves the accuracy and interpretability of answers.
Smart Images

Figure CN121636683A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, in particular to a problem processing method and device, equipment, medium and program product. BACKGROUND
[0002] In recent years, large language models (LLM) have shown excellent performance in various tasks such as question answering, reasoning, and long text generation. However, in specific domains or knowledge-intensive tasks, using LLM models to complete retrieval tasks often leads to "hallucination" phenomenon, i.e., outputting content that is not consistent with the facts but appears reasonable in form.
[0003] To alleviate and solve the problem of model hallucination, retrieval-augmented language models (RALM) are gradually used to achieve this goal. The basic idea is to introduce external knowledge in the reasoning stage and answer generation stage to supplement the lack of model parameter memory, thereby improving the factual and timeliness of the generated results to alleviate the occurrence of model hallucination. However, this approach relies entirely on external retrieval results, which have a lot of redundant content, making it easy to obscure key information, and in the generation process, it is easy to forget the intermediate reasoning results and evidence. As a result, the final generated answer related to the retrieval task not only deviates from the previous information, but also deviates from the real problem, leading to the hallucination phenomenon still not reduced. SUMMARY
[0004] Embodiments of the present application provide a problem processing method, device, equipment, medium and program product, which are used to improve the problem retrieval effect and reduce the hallucination phenomenon in text generation.
[0005] In a first aspect, embodiments of the present application provide a problem processing method. The method comprises:
[0006] obtaining a to-be-retrieved question and N candidate documents, N being an integer greater than or equal to 1;
[0007] calling a target large language model to determine M target documents from the N candidate documents based on the to-be-retrieved question, the M target documents including M target key information and a candidate answer corresponding to each target key information, each target key information being used to represent key evidence for the corresponding candidate answer in the target document, and 1≤M≤N;
[0008] invoke the target large language model, and perform structured processing on the M target key information and the M candidate answers to obtain target structured information, the target structured information being used to represent an association relationship between the M target key information and the M candidate answers;
[0009] invoke the target large language model, and determine a target answer based on the to-be-retrieved question and the target structured information, the target answer being contained in the M candidate answers;
[0010] answer the to-be-retrieved question based on the target answer and target key information corresponding to the target answer.
[0011] In a second aspect, an embodiment of the present application provides a question processing apparatus. The question processing apparatus comprises:
[0012] an obtaining unit, configured to obtain a to-be-retrieved question and N candidate documents, N being an integer greater than or equal to 1;
[0013] a processing unit, configured to invoke a target large language model, and determine M target documents from the N candidate documents based on the to-be-retrieved question, the M target documents comprising M target key information and a candidate answer corresponding to each target key information, each target key information being used to represent a key evidence of the corresponding candidate answer in the target document, 1≤M≤N;
[0014] the processing unit is configured to invoke the target large language model, and perform structured processing on the M target key information and the M candidate answers to obtain target structured information, the target structured information being used to represent an association relationship between the M target key information and the M candidate answers;
[0015] the processing unit is configured to invoke the target large language model, and determine a target answer based on the to-be-retrieved question and the target structured information, the target answer being contained in the M candidate answers;
[0016] the processing unit is configured to answer the to-be-retrieved question based on the target answer and target key information corresponding to the target answer.
[0017] In some optional examples, in an implementation manner of the second aspect of the embodiment of the present application, the processing unit is specifically configured to:
[0018] invoke the target large language model, and construct M key-value pairs by taking each target key information in the M target key information as a key and taking a candidate answer corresponding to each target key information as a value;
[0019] generate target structured information based on the M key-value pairs.
[0020] In some optional examples, in the implementation manner of the second aspect of the embodiment of the present application, the processing unit is specifically configured to:
[0021] invoke the target large language model to perform parsing processing on the to-be-retrieved question, to obtain question key information of the to-be-retrieved question;
[0022] based on matching of the question key information of the to-be-retrieved question and each key of the M key-value pairs in the target structured information, obtain a target key;
[0023] extract a value in a target key-value pair from the target structured information, and determine the value in the target key-value pair as a target answer, the target key-value pair being a key-value pair corresponding to the target key in the M key-value pairs.
[0024] In some optional examples, in the implementation manner of the second aspect of the embodiment of the present application, the processing unit is specifically configured to:
[0025] invoke the target large language model to calculate semantic similarities between the to-be-retrieved question and each key of the M key-value pairs in the target structured information;
[0026] select a maximum semantic similarity from the M semantic similarities, and determine a key corresponding to the maximum semantic similarity as a target key;
[0027] extract a value in a target key-value pair from the target structured information, and determine the value in the target key-value pair as a target answer, the target key-value pair being a key-value pair corresponding to the target key in the M key-value pairs.
[0028] In some optional examples, in the implementation manner of the second aspect of the embodiment of the present application,
[0029] The obtaining unit is specifically further configured to obtain a question retrieval sample and N document samples.
[0030] The processing unit is specifically configured to:
[0031] invoke a first large language model to determine M target document samples from the N document samples based on the question retrieval sample, the M target document samples including M sample key information and a sample candidate answer corresponding to each sample key information, and each sample key information being used to represent a key evidence for the sample candidate answer in the corresponding target document sample;
[0032] invoke the first large language model to perform structured processing on the M pieces of sample key information and the M pieces of sample candidate answers, to obtain sample structured information, the sample structured information being used to represent an association relationship between the M pieces of sample key information and the M pieces of sample candidate answers;
[0033] invoke the first large language model to perform prediction processing on the question retrieval sample and the sample structured information, to obtain a first answer prediction probability, the first answer prediction probability being used to represent a probability value of retrieving an answer related to the question retrieval sample in the sample structured information;
[0034] invoke a reference large language model to perform prediction processing on the question retrieval sample and the sample structured information, to obtain a second answer prediction probability;
[0035] calculate a total reward value based on the first answer prediction probability and a rule reward value, and perform KL divergence calculation based on the first answer prediction probability and the second answer prediction probability, to obtain a target divergence value, the rule reward value being obtained based on an answer corresponding to the first answer prediction probability and the question retrieval sample;
[0036] calculate a difference value between the total reward value and the target divergence value, to obtain a target loss value;
[0037] perform model parameter update processing on the first large language model based on the target loss value, to obtain the target large language model.
[0038] In some other optional examples, in an implementation manner of the second aspect of the embodiment of the present application, the processing unit is specifically configured to:
[0039] invoke a second large language model to perform prediction processing on the question retrieval sample and the sample structured information, to obtain a third answer prediction probability, the first large language model being a machine learning model obtained by updating model parameters of the second large language model;
[0040] calculate a ratio between the first answer prediction probability and the third answer prediction probability, to obtain a strategy proportion, the strategy proportion being used to represent a change range of the first large language model relative to the second large language model;
[0041] perform a clip operation on the strategy proportion, to obtain an updated strategy proportion;
[0042] calculate a difference value between the rule reward value and a preset benchmark reward value, to obtain an advantage function value, the advantage function value being used to represent a relative value of selecting the answer corresponding to the first answer prediction probability under the question retrieval sample;
[0043] The total reward value is calculated based on the predicted probability of the third answer, the strategy proportion, the updated strategy proportion, the advantage function value, and the number of answer samples. The number of answer samples refers to the number of times the question retrieval samples are sampled.
[0044] In some alternative examples, in one implementation of the second aspect of the embodiments of this application, the processing unit is specifically used for:
[0045] Based on the first mask value, the M target document samples and the sample structure information are masked to obtain the mask values of the M target document samples and the mask values of the sample structure information. The first mask value is used to represent the masking of the M target document samples and the sample structure information.
[0046] The answer corresponding to the first answer prediction probability is masked based on the second mask value to obtain the mask value of the answer corresponding to the first answer prediction probability. The first mask value is different from the second mask value. The second mask value is used to represent the retention of the answer corresponding to the first answer prediction probability.
[0047] Based on the first major language model, the M target document samples, the sample structure information, the mask values of the M target document samples, the mask values of the sample structure information, and the mask values of the answers corresponding to the first answer prediction probabilities are predicted to obtain the fourth answer prediction probabilities.
[0048] The total reward value is calculated based on the fourth answer prediction probability, the strategy proportion, the updated strategy proportion, the advantage function value, and the number of answer samples.
[0049] In some alternative examples, in one implementation of the second aspect of the embodiments of this application, the processing unit is specifically used for:
[0050] The answer reward value is calculated based on the answer corresponding to the predicted probability of the first answer, the preset standard answer, and the sample structure information;
[0051] Calculate the format score of the M target document samples and the format score of the sample structured information to obtain the format reward value;
[0052] The rule reward value is determined based on the answer reward value and the format reward value.
[0053] In some alternative examples, in one implementation of the second aspect of the embodiments of this application, the processing unit is specifically used for:
[0054] Calculate the correctness score between the answer corresponding to the predicted probability of the first answer and the preset standard answer;
[0055] Calculate the information matching score between the first key information and the preset standard answer, wherein the first key information is the sample key information in the sample structured information that corresponds to the answer with the predicted probability of the first answer;
[0056] Calculate the alignment matching score between the answer corresponding to the first answer prediction probability and the first key information;
[0057] The answer reward value is calculated based on the result correctness score, the information matching score, and the alignment matching score.
[0058] In some alternative examples, in one implementation of the second aspect of the embodiments of this application, the processing unit is specifically used for:
[0059] The information matching score and the alignment matching score are weighted to obtain the weighted information matching score and the weighted alignment matching score.
[0060] The answer reward value is obtained by summing the correctness score of the result, the weighted information matching score, and the weighted alignment matching score.
[0061] In some alternative examples, in one implementation of the second aspect of the embodiments of this application, the first large language model includes a reasoning retrieval module and an answer generation module; the processing unit is specifically used for:
[0062] Based on the reasoning retrieval module, the question retrieval sample and the N document samples are matched to obtain M target document samples;
[0063] Based on the reasoning and retrieval module, the key information of the M samples and the candidate answers of the M samples are processed in a structured manner to obtain the structured information of the samples;
[0064] Based on the answer generation module, the question retrieval sample and the sample structured information are subjected to prediction processing to obtain the first answer prediction probability.
[0065] A third aspect of this application provides a computer device, including: a memory, an input / output interface, and a processor. The memory stores program instructions. The processor executes the program instructions in the memory to perform the problem-solving method corresponding to the embodiments of the first aspect described above.
[0066] The fourth aspect of this application provides a computer-readable storage medium storing program instructions that, when executed on a computer device, cause the computer device to perform the method corresponding to the implementation of the first aspect described above.
[0067] The fifth aspect of this application provides a computer program product containing program instructions that, when executed on a computer device, cause the computer device to perform the method described above for implementing the embodiments of the first aspect.
[0068] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0069] In this embodiment, the retrieval question and N candidate documents are first obtained. Then, a target large language model is invoked to determine M target documents from the N candidate documents based on the retrieval question. It should be noted that the M target documents include M target key information and candidate answers corresponding to each target key information. Each target key information is used to characterize key evidence of the candidate answer in the corresponding target document, where 1 ≤ M ≤ N, and N is an integer greater than or equal to 1. Subsequently, the target large language model is invoked to perform structured processing on the M target key information and the M candidate answers to obtain target structured information. Through this target structured information, the relationship between the M target key information and the M candidate answers can be understood. Then, the target large language model is invoked again to determine the target answer based on the retrieval question and the target structured information. The target answer is contained within the M candidate answers. Finally, based on the target answer and the target key information corresponding to the target answer, the retrieval question is answered. In other words, this application employs a two-stage retrieval approach: first, a macro-level search is performed on external candidate documents; then, the retrieved key information and candidate answers are structured and stored; finally, the answer is retrieved micro-level from the structured information. This approach ensures both the full utilization of external candidate documents and the tight coupling of key information related to the answer with the final answer generation stage, preventing the answer from deviating from the question. Furthermore, by introducing structured processing and storage of key information and candidate answers, this application allows for direct retrieval of key information from the structured information during the answer generation stage. This avoids the problem of forgetting key information due to long reasoning chains, ensuring that the final output answer correctly answers the question and significantly reducing the illusion phenomenon in text generation. Attached Figure Description
[0070] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art 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.
[0071] Figure 1 A schematic diagram of a retrieval scenario is shown;
[0072] Figure 2 This diagram illustrates a retrieval process provided by a related solution.
[0073] Figure 3A A schematic diagram of an implementation environment for the problem-solving method provided in this application is shown;
[0074] Figure 3B A schematic diagram of an implementation environment for the problem-solving method provided in this application is shown;
[0075] Figure 4 A flowchart illustrating the problem-solving method provided in this application is shown.
[0076] Figure 5 An optional schematic diagram of the target structured information provided in this application is shown;
[0077] Figure 6 An optional schematic diagram illustrating the solution to the search query provided in this application is shown;
[0078] Figure 7 This paper illustrates a schematic diagram of a model training process provided in an embodiment of this application.
[0079] Figure 8 This paper illustrates a schematic diagram of a training framework for model training provided in an embodiment of this application.
[0080] Figure 9 This paper illustrates a schematic diagram of a framework for calculating the total reward value provided in an embodiment of this application.
[0081] Figure 10 This paper illustrates another framework diagram for calculating the total reward value provided in an embodiment of this application;
[0082] Figure 11 This paper illustrates a framework diagram of the reward value calculation rule provided in an embodiment of this application.
[0083] Figure 12 This application provides a schematic diagram illustrating the trend of reward changes.
[0084] Figure 13A schematic diagram illustrating the comparison of hallucination relief effects provided in an embodiment of this application is shown;
[0085] Figure 14 A schematic diagram of one embodiment of the problem-solving apparatus provided in this application is shown;
[0086] Figure 15 A schematic diagram of one embodiment of the computer device provided in this application is shown. Detailed Implementation
[0087] This application provides a method, apparatus, device, medium, and program product for problem processing, which can improve the problem retrieval effect and reduce the illusion phenomenon in text generation.
[0088] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0089] 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. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0090] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0091] The vast amount of documents contains immense informational value; these documents can be used to answer user questions, support decision-making, and drive knowledge discovery. For example, Figure 1 A schematic diagram of a retrieval scenario is shown. For example... Figure 1As shown, when user A asks a question (e.g., "What is a tourist introduction to XXX city?"), they can obtain a large number of tourism documents from websites, social media, email subscriptions, news articles, etc. These documents cover attractions, transportation guides, accommodation recommendations, and tourist reviews. Then, using these tourism documents as a basis, relevant fragments are retrieved from them, such as text fragments containing opening hours, ticket prices, and tour routes for major attractions in the city, to ultimately generate a relevant answer. For example, the answer could be, "Famous attractions in the city, such as People's Park, are open daily from 8:00 to 18:00, and admission is free; the city center museum is open Tuesday to Sunday from 9:00 to 17:00, closed on Mondays, and the adult ticket price is 30 yuan..." Therefore, by retrieving answers related to the question from documents, the required content can be quickly located from a massive amount of information, improving the efficiency of knowledge acquisition.
[0092] With the advancement of artificial intelligence (AI) technology, it has been researched and applied in various fields, such as common question retrieval, question-answering scenarios, and intelligent customer service. Through neural network models in AI, semantic understanding of natural language questions posed by users can be achieved, combining this with textual information from document databases to efficiently match and generate answers. For example, in specific domains or knowledge-intensive tasks, LLM models are often used to complete retrieval tasks. However, this LLM model is prone to the "illusion" phenomenon during task processing, i.e., outputting content that is inconsistent with reality but appears reasonable in form.
[0093] To alleviate and resolve the problem of model illusion, related solutions are increasingly employing the RALM model. This approach introduces external knowledge during the inference and generation phases to supplement the model's parameter memory, thereby improving the factuality and timeliness of the generated results and mitigating model illusion. For example, Figure 2 A schematic diagram of a retrieval process provided by a relevant solution is shown. For example... Figure 2 As shown above, Figure 1For example, if the question is "What is the tourist information for XXX city?", then a large number of tourism documents need to be obtained from various external knowledge bases such as web pages, social media, email subscriptions, and news information, for example, Tourism Document 1, Tourism Document 2, and so on up to Tourism Document N. Then, using these N tourism documents as a basis, relevant fragments are retrieved from them to find information related to the user's question, such as text fragments containing the opening hours, ticket prices, and tour routes of major attractions in the city, thus ultimately generating a relevant answer. For example, the answer could be: "Famous attractions in the city, such as People's Park, are comprehensive parks integrating natural landscapes and cultural history. They are mainly used for leisure and entertainment, cultural displays, and ecological education. The park has plant viewing areas, children's playgrounds, etc. Tourist A mentioned in a travelogue written during a visit that the seasonal flower exhibitions in People's Park are particularly charming. The park is open daily from 6:00 to 22:00, free to the public, and is an important place for citizens to get close to nature and carry out outdoor activities; the city center museum is open from 9:00 to 17:00 from Tuesday to Sunday, closed on Mondays, and the adult ticket price is 30 yuan..."
[0094] However, from Figure 2 It is evident that this method, which relies entirely on external search results, suffers from a high degree of redundancy in the results, easily obscuring crucial information. For example, the search results may contain a large amount of irrelevant historical background about the attraction, such as "People's Park is a comprehensive park integrating natural landscapes and cultural history, mainly used for leisure, entertainment, cultural display, and ecological education, with plant viewing areas, children's playgrounds, etc."; or, it may include personal travelogues (e.g., "Tourist A mentioned in their travelogue during a visit that the seasonal flower shows at People's Park are particularly charming"). This causes crucial information such as opening hours and ticket prices to be buried. Furthermore, intermediate reasoning results and evidence are easily forgotten during the generation process. Consequently, the final answer, relevant to the search task, is not only disconnected from the initial information but also deviates from the actual question, resulting in the illusion phenomenon not being reduced.
[0095] Therefore, to solve the above-mentioned technical problems, this application provides a problem-solving method. This method combines a macro-level retrieval from external candidate documents, followed by structured processing and storage of the retrieved key information and candidate answers, and finally micro-level retrieval of the answer from the structured information. This combination ensures full utilization of external candidate documents and guarantees that key information related to the answer remains tightly coupled with the answer during the final answer generation stage, preventing the answer from deviating from the question. Furthermore, by introducing structured processing and storing key information and candidate answers, this application allows for direct retrieval of key information from the structured information during the answer generation stage, avoiding the problem of forgetting key information due to long reasoning chains. This ensures that the final output answer correctly answers the question, significantly reducing the illusion phenomenon in text generation. For example, the problem-solving method provided by this application can be applied to at least one of the following scenarios:
[0096] Scenario 1: Question-answering task scenario;
[0097] For example, question-answering tasks are a typical knowledge-intensive task, including but not limited to medical report generation, legal document drafting, scientific literature summarization, and multi-turn dialogue generation. The questions raised by users often rely on precise information in specific documents or knowledge bases. Applying the question processing method of this application to question-answering tasks involves first obtaining the user's question and N candidate documents from an external knowledge base. Then, in the macro-level retrieval process, M target documents related to the question are identified from these N candidate documents, and the key information in these M target documents, along with the candidate answers, are structured and stored to generate target structured information. Furthermore, in the micro-level retrieval process, instead of searching from an external knowledge base, the most relevant key information to the question is retrieved from the target structured information to determine the target answer. In this way, by combining the target answer with the key information corresponding to the target answer, an accurate and interpretable answer can be generated, ensuring that the answer content is highly relevant to the original question. At the same time, by retaining structured information in the middle, key evidence is avoided from being lost or reasoning is broken, effectively suppressing model illusion caused by information redundancy or long-range dependence, thereby improving the credibility of the answer and enhancing the transparency of the system.
[0098] Scenario 2: A reasoning task scenario;
[0099] For example, reasoning tasks are typically logic-intensive tasks, such as proving mathematical theorems, causal inference analysis, and complex decision deduction, which rely on rigorous logical chains and multi-step information association. Applying the method of this application to reasoning task scenarios allows for the selection of evidence documents related to the reasoning proposition in the macro-retrieval stage, extracting key propositions and candidate reasoning paths for structured storage; in the micro-retrieval stage, key propositions are retrieved from the structured information based on the question to be retrieved, thus determining the corresponding candidate reasoning paths as the target answer. Through explicit modeling and hierarchical association of key information, it ensures that each step of reasoning is based on evidence, avoiding logical breaks or erroneous derivations caused by context window limitations or semantic drift, thereby improving the stability and accuracy of the system in long-chain reasoning tasks.
[0100] Scenario 3: Scenarios involving intelligent writing assistance;
[0101] For example, intelligent writing assistance scenarios involve tasks with high semantic consistency requirements, such as report writing, press release generation, and academic paper drafting. Applying the method of this application to this scenario allows for the selection of topic-related information documents from a reference library during the macro-retrieval stage, and the extraction and structured organization of key facts, data, and cited excerpts. During the micro-retrieval stage, the target answer is determined from the structured information based on the current search question, enabling real-time retrieval of key information and logical coherence during sentence generation. Through hierarchical management and fine-grained retrieval of structured information, the generated text is ensured to be not only fluent in language but also factually accurate and rigorously argued, effectively avoiding issues of fabricated information or contradictions, and enhancing the professionalism and credibility of the generated content.
[0102] Scenario 4: Fact verification and misinformation identification scenarios;
[0103] For example, in fact-checking and misinformation identification scenarios, faced with a massive amount of statements or reports from diverse sources, the method of this application can quickly locate multi-source evidence documents related to the proposition to be verified during the macro-search stage, and extract key elements such as time, subject, behavior, and causal relationships for structured modeling. During the micro-search stage, by comparing key elements in the search question and structured information, the relevant target answer can be determined. Thus, through the correlation analysis of multi-angle evidence, false statements, misinterpretations, or misleading expressions can be accurately identified, generating verification conclusions with interpretable paths, significantly improving verification efficiency and decision-making transparency.
[0104] It should be noted that the above application scenarios are merely examples, and the problem-solving methods provided in this embodiment can also be applied to other scenarios, which are not limited here.
[0105] The method provided in this application can be applied to... Figure 3A The terminal implementation environment shown, or, applicable toFigure 3B The implementation environment for terminal-server interaction is shown. Figure 3A The implementation environment shown includes terminal 110. Figure 3B The illustrated implementation environment includes a terminal 110 and a server 120, and the terminal 110 and server 120 can communicate with each other via a communication network 130. The communication network 130 uses standard communication technologies and / or protocols, typically the Internet, but can also be any network, including but not limited to Bluetooth, a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), mobile, private networks, or any combination of virtual private networks. In some embodiments, customized or dedicated data communication technologies may be used to replace or supplement the aforementioned data communication technologies.
[0106] The terminal 110 involved in this application includes, but is not limited to, mobile phones, tablets, laptops, desktop computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. The client is deployed on the terminal 110 and can run on the terminal 110 via a browser or as a standalone application (APP).
[0107] The server 120 involved in this application can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence (AI) platforms.
[0108] The following will be combined with Figure 3A The implementation environment shown Figure 3B The implementation environment shown is described.
[0109] I. Terminal-based implementation environment;
[0110] like Figure 3AAs shown, in step A1, the user can input the retrieval question through terminal 110. In step A2, terminal 110 can obtain N candidate documents from, for example, an external knowledge base. N is an integer greater than or equal to 1. In step A3, terminal 110 calls the target large language model and determines M target documents from the N candidate documents based on the retrieval question. It should be noted that these M target documents include M target key information and candidate answers corresponding to each target key information. Each target key information is used to characterize the key evidence of the candidate answer in the corresponding target document, 1≤M≤N. In step A4, terminal 110 calls the target large language model again to perform structured processing on the M target key information and M candidate answers to obtain target structured information. In this way, the target structured information can characterize the association between the M target key information and the M candidate answers. Thus, in step A5, terminal 110 calls the target large language model again to determine the target answer based on the retrieval question and the target structured information. The target answer is contained in the M candidate answers. Finally, in step A6, terminal 110 answers the question to be retrieved based on the target answer and the corresponding key information. Then, in step A7, terminal 110 presents the target answer and key information to the user, completing the full reasoning loop from question input to answer output.
[0111] II. Implementation environment based on terminal-server interaction;
[0112] like Figure 3BAs shown, in step B1, the user can input the retrieval question through terminal 110. In step B2, terminal 110 can send the retrieval question to server 120 through communication network 130. In step B3, server 120 also needs to obtain N candidate documents from, for example, an external knowledge base. N is an integer greater than or equal to 1. In step B4, server 120 calls the target large language model and determines M target documents from the N candidate documents based on the retrieval question. It should be noted that these M target documents include M target key information and candidate answers corresponding to each target key information. Each target key information is used to characterize the key evidence of the candidate answer in the corresponding target document, 1≤M≤N. In step B5, server 120 again calls the target large language model to perform structured processing on the M target key information and M candidate answers to obtain target structured information. In this way, the target structured information can characterize the relationship between the M target key information and the M candidate answers. Thus, in step B6, server 120 invokes the target large language model to determine the target answer based on the retrieval question and target structured information. The target answer is contained among M candidate answers. In step B7, server 120 sends the target answer and corresponding target key information to terminal 110 via communication network 130. In step B8, terminal 110 then answers the retrieval question based on the target answer and corresponding target key information. Finally, in step B9, terminal 110 presents the target answer and target key information to the user, facilitating the user's understanding of the basis and logical connections for answer generation, and improving the interpretability and credibility of the answer.
[0113] Based on the above introduction, the methods for handling the problems in this application will be described below. Please refer to [link / reference]. Figure 4 The problem-solving methods in the embodiments of this application can be completed independently by the terminal, or in cooperation with the server, or independently by the service; no specific limitations are made in this application. Figure 4 As shown, the method of this application includes:
[0114] 401. Obtain the question to be searched and N candidate documents, where N is an integer greater than or equal to 1.
[0115] In one or more embodiments, the retrieval question can be understood as a natural language question input by a user, used to express the content that the user needs to query or answer. Regarding the format of the retrieval question, it can be in the form of text, voice, or image, or it can be a multimodal input such as text and image, or text and voice; this application does not impose any limitations. Furthermore, the form of the retrieval question includes, but is not limited to, interrogative sentences or statements containing interrogative semantics.
[0116] For example, the search question could be "How to improve the collaboration efficiency of WPS documents?" or "Please explain the basic principle of XX speed calculation", etc., without specific limitations in this application.
[0117] Each of the N candidate documents can be understood as text content stored in an external knowledge base. External knowledge bases include public databases, internal corporate databases, or internet web pages, and their document formats can be PDF, Word, web page text, or structured data tables, etc., which are not limited in this application. Therefore, in the process of obtaining the N candidate documents, these N candidate documents can be obtained from an external knowledge base, facilitating subsequent relevance matching and filtering based on the search query.
[0118] 402. Call the target large language model to determine M target documents from N candidate documents based on the retrieval question. The M target documents include M target key information and candidate answers corresponding to each target key information. Each target key information is used to characterize the key evidence of the candidate answer in the corresponding target document, 1≤M≤N.
[0119] In one or more embodiments, after obtaining the question to be retrieved and N candidate documents, a target large language model can be invoked to retrieve and filter M target documents related to the question from the N candidate documents. In other words, these M target documents are a set of documents highly relevant to the question to be retrieved, determined after retrieval and filtering from the N candidate documents in an external knowledge base, and are used to support subsequent answer generation. Here, M is an integer less than or equal to N and greater than or equal to 1.
[0120] As an illustrative description, the process of selecting M target documents from N candidate documents can be summarized as follows: First, extract the semantic features of the retrieval question and the textual features of each candidate document. Then, call the target large language model, using the semantic features of the retrieval question and the textual features of each candidate document as input. Further, the target large language model calculates the semantic matching degree between the semantic features of the retrieval question and the textual features of each candidate document. Based on these semantic matching degrees, the semantic similarity between the retrieval question and each candidate document can be obtained. A higher semantic similarity indicates a higher relevance between the retrieval question and the corresponding candidate document, and a greater likelihood that the document contains the key information needed to answer the question. Conversely, a lower semantic similarity indicates a lower relevance between the retrieval question and the corresponding candidate document, and a lower probability that the candidate document contains the key information needed to answer the question, meaning it is more likely to be excluded. Thus, by setting a threshold or sorting by similarity, M target documents are selected. For example, these M target documents can be the top M candidate documents with the highest similarity after sorting N semantic similarities. Alternatively, these M target documents can also be candidate documents with a semantic similarity greater than a preset threshold. The M target documents selected in this way ensure a high degree of relevance to the retrieval question while effectively reducing interference from irrelevant information, thus improving the accuracy and efficiency of subsequent answer generation.
[0121] For example, taking N=20 as an example, the corresponding 20 candidate documents include documents 1 to 20. If the search question is "How to improve the collaboration efficiency of WPS documents?", the target large language model can calculate the semantic similarity between the question "How to improve the collaboration efficiency of WPS documents?" and documents 1 to 20, such as similarities of 0.92, 0.87, 0.45, 0.33, 0.78, 0.65, 0.21, 0.15, 0.53, 0.49, 0.81, 0.72, 0.39, 0.28, 0.61, 0.57, 0.74, 0.68, 0.36, and 0.41 respectively. After sorting according to the above similarity, the top M=5 documents, namely documents 1, 2, 5, 11, and 17, are selected as target documents.
[0122] It should be noted that because the selected M target documents are highly semantically relevant to the retrieval question, key information sources can be effectively focused. In other words, each of these M target documents includes corresponding key information and candidate answers for each key piece of information. Each key piece of information serves as the reasoning basis for generating the corresponding candidate answer.
[0123] As an illustrative example, for these M target documents, this application can also invoke a target large language model to perform fine-grained semantic parsing on the M target documents, extracting key sentences or paragraphs in each target document that are highly relevant to the retrieval question, as target key information. Furthermore, the content corresponding to this target key information is structured into candidate answers. This process ensures the logical consistency between the key information and the candidate answers through a semantic alignment mechanism, thereby providing accurate and traceable reasoning support for subsequent answer generation.
[0124] For example, taking Document 1, Document 2, Document 5, Document 11, and Document 17 as target documents, in the question "How to improve the collaboration efficiency of WPS documents?", the key information in Document 1 might point to "enabling real-time collaborative editing," the key information in Document 2 corresponds to "setting hierarchical permission management," the key information in Document 5 emphasizes "using comment and revision modes to improve communication efficiency," the key information in Document 11 proposes "integrating team calendar sharing templates," and the key information in Document 17 suggests "regular automatic backups to prevent version conflicts." This key information not only supports the accuracy of candidate answers but also provides a traceable logical chain for generating the final answer.
[0125] Furthermore, the candidate answer corresponding to the key information in Document 1 is "By enabling real-time collaborative editing, multiple members can edit the same document online simultaneously, thereby improving collaboration efficiency." The candidate answer corresponding to the key information in Document 2 is "By setting hierarchical permission management, the scope of members' editing and viewing operations is clearly defined, reducing the risk of accidental operations and information leakage." The candidate answer corresponding to the key information in Document 5 is "Using comment and revision modes can effectively record modification opinions and communication content, improving team feedback efficiency." The candidate answer corresponding to the key information in Document 11 is "Integrating a team schedule sharing module to achieve synchronized linkage between task progress and document updates." For Document 17, the candidate answer corresponding to its key information is "Regularly and automatically backing up document versions to avoid content loss due to editing conflicts." All of the above candidate answers are structured and semantically coherent based on the corresponding target key information, providing a reliable basis for the final answer aggregation.
[0126] 403. Call the target large language model to perform structured processing on M target key information and M candidate answers to obtain target structured information. The target structured information is used to represent the relationship between the M target key information and the M candidate answers.
[0127] In one or more embodiments, directly using N candidate documents obtained from an external knowledge base to answer the retrieval question can easily lead to decreased accuracy and the "illusion problem" due to information redundancy or insufficient relevance in these N candidate documents. Therefore, in this application, after selecting M target documents related to the retrieval question from these N documents during the macro-retrieval stage, it is also necessary to perform structured processing on the key information and related candidate answers in these M target documents to enhance the clarity and logical traceability of information association.
[0128] Specifically, after retrieving M target documents from an external knowledge base, the system further uses a target large language model to perform structured modeling of the M key target information and M candidate answers within these documents, generating structured target information. This structured target information reflects the logical correspondence between the M key target information and the M candidate answers, thus supporting accurate reasoning and content organization in the subsequent answer generation module and preventing the answers generated in later stages from being disconnected from the key information obtained earlier. By establishing structured information between the key target information and candidate answers, it ensures that each answer fragment can be traced back to the semantic unit of the original document, thereby maintaining logical consistency and factual accuracy during multi-source information fusion and effectively curbing the risk of illusions caused by information fragmentation or semantic bias.
[0129] Optionally, the process of obtaining the target structured information can be represented using key-value pairs. For example, a target large language model can be invoked, using each of the M target key information pieces as a key and the corresponding candidate answer as a value, constructing a key-value structured mapping, thus generating M key-value pairs. For each key-value pair, the key corresponds to the target key information, and the value corresponds to its associated candidate answer, forming a structured semantic unit. Thus, these M key-value pairs constitute a set of structured information, generating the target structured information. This set of structured information serves as an intermediate representation, preserving key semantic fragments from the original document while establishing a clear mapping relationship with candidate answers, supporting subsequent modules to dynamically retrieve and combine information according to logical priority or scenario requirements.
[0130] For example, taking the target documents mentioned in step 402 above, which include the five documents: Document 1, Document 2, Document 5, Document 11, and Document 17, as an example... Figure 5 An optional schematic diagram of the target structured information provided in this application is shown.
[0131] like Figure 5As shown, based on the target key information and corresponding candidate answers in documents 1, 2, 5, 11 and 17, five key-value pairs are constructed, such as key-value pair 1 to key-value pair 5.
[0132] Specifically, for key-value pair 1, the key is the target key information in document 1 (such as "Enable real-time collaborative editing"), and the value is the corresponding candidate answer "By enabling real-time collaborative editing, multiple members can edit the same document online simultaneously, thereby improving collaboration efficiency." For key-value pair 2, the key is the target key information in document 2 "Set up hierarchical permission management," and the value is the corresponding candidate answer "By setting up hierarchical permission management, the scope of members' editing, viewing, and other operations is clearly defined, reducing the risk of accidental operation and information leakage." Similarly, for key-value pair 3, the key is the target key information in document 5 "Use comment and revision mode to improve communication efficiency," and the value is the corresponding candidate answer "Using comment and revision mode can effectively record modification opinions and communication content, improving team feedback efficiency." In key-value pair 4, the key is "Integrate team schedule sharing template" in document 11, and the value is "Integrate team schedule sharing module to achieve synchronous linkage between task progress and document updates." In key-value pair 5, the key is "Regular automatic backup to prevent version conflicts" in document 17, and the value is "Regular automatic backup of document versions to avoid content loss due to editing conflicts." Thus, the target structured information can be constructed based on these 5 key-value pairs.
[0133] The structured information constructed using the above methods not only achieves precise anchoring of key semantics but also supports rapid location and dynamic retrieval through key-value mapping. In subsequent processing, the system can prioritize matching highly relevant key-value pairs based on the query intent and combine this with contextual logic to reorganize and optimize the output, thereby improving response accuracy and information integration efficiency.
[0134] Alternatively, the process of obtaining structured target information can be represented using a semantic graph. For example, a target large language model can be invoked, treating each of the M target keywords as a node, and the corresponding candidate answers as associated attributes. Directed edges can then be used to construct semantic associations between the target keywords and the candidate answers. This results in a semantic subgraph composed of M nodes and their corresponding attributes. Finally, these M semantic subgraphs are further aggregated to form a complete semantic graph structure, which represents the target structured information. This graph structure not only reflects the association paths between target keywords and candidate answers but also supports the discovery of implicit logical relationships through graph reasoning mechanisms, improving the coherence and accuracy of answer generation.
[0135] It should be noted that in practical applications, other structured processing methods are also included, which are not specifically limited in this application.
[0136] 404. Call the target large language model to determine the target answer based on the question to be retrieved and the target structured information. The target answer is contained in M candidate answers.
[0137] In one or more embodiments, after obtaining the target structured information through structured processing, the retrieval question and the target structured information can be used as input to the target large language model. Thus, through the deep semantic understanding capabilities of the target large language model, joint reasoning is performed on the retrieval question and the target structured information to determine the target answer. It should be noted that the described target answer can be the candidate answer corresponding to the key information highly relevant to the retrieval question among these M target key information pieces. This process fully integrates question intent and structured knowledge to ensure answer accuracy and contextual consistency.
[0138] Optionally, regarding how to determine the target answer in step 404, it can be achieved through key information matching or semantic similarity calculation. This can be understood as follows:
[0139] Method 1: Matching based on key information;
[0140] For example, in determining the target answer, the target large language model can be invoked to parse and process the question to be retrieved, thereby obtaining the key information of the question. It should be noted that the key information reflects the core semantic requirements of the question. For instance, the target large language model can identify and extract keywords from the question, and then generate key information based on these keywords. For example, if the question is "How to improve the collaboration efficiency of WPS documents?", after parsing by the target large language model, the key information obtained can be "WPS documents" and "improving collaboration efficiency".
[0141] Furthermore, the aforementioned key information about the problem is matched with the M key information pieces in the target structured information. Specifically, the key information about the problem is compared one by one with each key in the M key-value pairs in the target structured information to determine the target key. This target key can be understood as the key in the key-value pair that matches the key information about the problem.
[0142] Subsequently, the key-value pair corresponding to the target key is determined from M key-value pairs, and the value of the target key-value pair is extracted from the target's structured information as the target answer. This value is the candidate answer that semantically matches the key information of the question, ensuring that the output results are highly consistent with the user's query intent. Through the precise key-value pair matching mechanism, combined with the deep understanding of the context by the large language model, the accuracy and response efficiency of answer retrieval are effectively improved.
[0143] For example, let's say the search query is "How to improve the collaboration efficiency of WPS documents?", and the aforementioned... Figure 5 The target structured information shown is an example. From the aforementioned... Figure 5 It can be seen that its target structured information contains 5 key-value pairs, namely key-value pair 1 to key-value pair 5.
[0144] Therefore, the key information of the problem, "WPS document" and "improved collaboration efficiency," is compared one by one with each key in key-value pairs 1 to 5. The matching shows that the key "enable real-time collaborative editing" in key-value pair 1 has a high semantic match with the key information of the problem. Thus, the key of key-value pair 1 can be identified as the target key. Furthermore, the value corresponding to the key of key-value pair 1, namely "By enabling real-time collaborative editing, multiple members can simultaneously edit the same document online, thereby improving collaboration efficiency," is extracted as the target answer.
[0145] By using the above methods, we can rely on the target large language model's ability to make precise judgments on semantic associations, avoid ambiguity caused by superficial keyword matching, and ensure that the returned answers are both in line with technical logic and meet the actual needs of users in their scenarios.
[0146] Method 2: Based on semantic similarity;
[0147] For example, in determining the target answer, the target large language model can be invoked to calculate the semantic similarity between the retrieval question and each key in the M key-value pairs in the target structured information. For instance, the semantic vector of the retrieval question and the semantic vector of each key in the M key-value pairs can be extracted first, and then the semantic similarity between the retrieval question and each key in each key-value pair can be calculated using vector similarity algorithms such as cosine similarity.
[0148] Subsequently, the maximum semantic similarity is selected from the M calculated semantic similarity values, and the key corresponding to the maximum semantic similarity is determined as the target key.
[0149] Then, the key-value pair corresponding to the target key is determined from the M key-value pairs, and the value in the target key-value pair is extracted from the target structured information as the target answer.
[0150] For example, let's say the search query is "How to improve the collaboration efficiency of WPS documents?", and the aforementioned... Figure 5 The target structured information shown is an example. From the aforementioned... Figure 5 It can be seen that its target structured information contains 5 key-value pairs, namely key-value pair 1 to key-value pair 5.
[0151] Thus, the retrieval question is encoded into a semantic vector using a large language model. Simultaneously, the keys of key-value pairs 1 through 5 are individually vectorized to obtain the semantic vectors for each key in key-value pairs 1 through 5. Next, the cosine similarity between the semantic vector of the retrieval question and the semantic vectors of the five keys is calculated. The key with the highest similarity is identified as "improved collaboration efficiency," corresponding to key-value pair 1. Therefore, the key of key-value pair 1 can be determined as the target key. Further, the value corresponding to the key of key-value pair 1, namely "By enabling real-time collaborative editing, multiple members can simultaneously edit the same document online, thereby improving collaboration efficiency," is extracted as the target answer.
[0152] By using the above methods and relying on similarity matching in semantic vector space, we can accurately capture the deep connection between questions and knowledge items. This not only goes beyond the limitations of literal keyword matching, but also maintains consistency in judgment in complex contexts such as polysemy, synonymy, and hierarchical relationships, ensuring that the returned results are both accurate and interpretable.
[0153] It should be noted that the above description only uses method 1 or method 2 as an example to illustrate the process of determining the target answer. In actual applications, the advantages of both methods can be combined for a fusion judgment, or other methods can be used to determine the answer. This application does not make any specific limitations.
[0154] 405. Based on the target answer and the target key information corresponding to the target answer, answer the question to be retrieved.
[0155] In one or more embodiments, after determining the target answer, the target answer can be coupled with the target key information corresponding to the target answer to obtain a structured solution result. In this way, based on the structured solution result, a precise response can be given to the retrieval question, presenting both the core answer and contextual support.
[0156] For example, when answering "How to improve the collaboration efficiency of WPS documents?", in addition to outputting the answer "By enabling the real-time collaborative editing function, multiple members can edit the same document online at the same time, thereby improving collaboration efficiency", it also links the relevant key information of the target, such as "enable the real-time collaborative editing function", so that the knowledge source path can be automatically traced based on the key information of the target, generating an interpretable reasoning chain and enhancing the credibility of the answer.
[0157] For example, Figure 6 This illustration shows an optional diagram of the solution to the search query provided in this application. For example... Figure 6As shown, taking the question to be searched as "How to improve the collaboration efficiency of WPS documents?", with N=20, from the 20 candidate documents in the external knowledge base, 5 target documents can be retrieved in the macro-search stage, such as document 1, document 2, document 5, document 11, and document 17. Combining the target key information in these 5 target documents with the corresponding candidate answers, a structured processing is performed to generate the results as described above. Figure 5 The described target structured information. Thus, by combining this target structured information, the most relevant key information to the question can be retrieved from this target structured information during the micro-retrieval stage, namely the key information "enable real-time collaborative editing function" in document 1. Therefore, during the answer generation process, the candidate answers corresponding to "enable real-time collaborative editing function" can be used as the target answer, namely, "By enabling real-time collaborative editing function, multiple members can simultaneously edit the same document online, thereby improving collaboration efficiency." This target answer and related key information can then be displayed to the user.
[0158] In this embodiment, a two-stage retrieval approach is employed: first, a macro-level search is performed from external candidate documents; then, the retrieved key information and candidate answers are structured and stored; finally, the answer is retrieved from the structured information. This approach ensures full utilization of external candidate documents and guarantees that key information related to the answer remains tightly coupled with the answer during the final answer generation stage, preventing the answer from deviating from the question. Furthermore, by introducing structured processing and storage of key information and candidate answers, this application allows for direct retrieval of key information from the structured information during the answer generation stage. This avoids the problem of forgetting key information due to long reasoning chains, ensuring that the final output answer correctly answers the question and significantly reducing the illusion phenomenon in text generation.
[0159] In some other alternative embodiments, in the foregoing Figure 4 Based on the described embodiments, another embodiment provided in this application can further update the model parameters of the target large language model to optimize its reasoning ability and knowledge matching accuracy in real time. Optionally, taking a server as the execution entity as an example, Figure 7 This illustration shows a schematic diagram of a model training process provided in an embodiment of this application. Figure 7 As shown, it includes at least the following steps:
[0160] 701. The server retrieves a problem retrieval sample and N document samples.
[0161] In one or more embodiments, the question retrieval sample can be understood as a sample of questions used during the training phase, which may include, but is not limited to, real questions raised by users in actual scenarios, etc., and is not limited in this application. It should be noted that the question format of the question retrieval sample may be text, voice, or image, and may also be a multimodal input such as text and image, text and voice, etc., and is not limited in this application. In addition, the form of the question retrieval sample includes, but is not limited to, expressions containing interrogative semantics in interrogative sentences or declarative sentences.
[0162] In addition, the N document samples can also be understood as a set of document samples during the training phase, which mainly come from document content in external knowledge bases. For example, external knowledge bases include, but are not limited to, public web pages, professional databases, internal enterprise knowledge bases, and other text resources from various channels, and the document formats cover a variety of types such as plain text, tables, PDF, and HTML, which are not limited in this application.
[0163] 702. The server calls the first major language model to determine M target document samples from N document samples based on the question retrieval samples. The M target document samples include M sample key information and sample candidate answers corresponding to each sample key information.
[0164] In one or more embodiments, after obtaining a question retrieval sample and N document samples, the server can invoke a first large language model to retrieve and filter M target document samples related to the question retrieval sample from the N document samples. In other words, these M target document samples are a set of documents highly relevant to the question retrieval sample, determined after retrieval and filtering from the N document samples in an external knowledge base, and are used to support subsequent answer generation.
[0165] As an illustrative description, regarding the process of selecting M target document samples from N document samples, the server can first extract the semantic features of the question retrieval sample and the text features of each document sample. Next, the server calls a primary language model, using the semantic features of the question retrieval sample and the text features of each document sample as input. The server then calculates the semantic matching degree between the semantic features of the question retrieval sample and the text features of each document sample using the primary language model. Thus, the server obtains the semantic similarity between the question retrieval sample and each document sample based on the semantic matching degree. Subsequently, the server selects M document samples from the N document samples as target document samples based on semantic similarity, using methods such as thresholding or sorting by similarity.
[0166] It should be noted that among the M target document samples selected in this application, each target document sample includes corresponding key information and candidate answers for each key information. Each key information serves as crucial evidence for generating the corresponding candidate answer.
[0167] As an illustrative description, in this application, when determining M target document samples, the server can also invoke the first major language model to perform fine-grained semantic parsing on the M target document samples, extract key sentences or paragraphs in each target document sample that are highly relevant to the question retrieval sample, as key information of the sample, and structure the content corresponding to the key information of the sample into candidate answers for the sample. For details, please refer to the foregoing. Figure 4 The content described in step 402 needs to be understood, and will not be elaborated here. Through the above method, the semantic alignment mechanism ensures the logical consistency between key information and sample candidate answers, thereby providing accurate and traceable reasoning chain support for subsequent answer generation.
[0168] 703. The server calls the first major language model to perform structured processing on the key information of M samples and the candidate answers of M samples to obtain the structured information of the samples. The structured information of the samples is used to represent the relationship between the key information of M samples and the candidate answers of M samples.
[0169] In one or more embodiments, after retrieving M target document samples from an external knowledge base, the server further performs structured modeling on the M key information and M candidate answers of the M target document samples by calling a first major language model, generating sample structured information. This sample structured information reflects the logical correspondence between the M key information and the M candidate answers, thereby supporting accurate reasoning and content organization in the subsequent answer generation stage.
[0170] Optionally, regarding the process of obtaining structured information from samples, the server can use key-value pairs to represent it. For example, the first major language model can be invoked, using each of the M sample key information pieces as a key and the corresponding candidate answer as a value, constructing a key-value structured mapping, thus generating M key-value pairs. For each key-value pair, the key corresponds to the sample key information, and the value corresponds to its associated candidate answer, forming a structured semantic unit. Thus, these M key-value pairs constitute a set of structured information, generating the sample structured information. This set of structured information serves as an intermediate representation, preserving key semantic fragments from the original document while establishing a clear mapping relationship with the candidate answers, supporting subsequent modules to dynamically retrieve and combine information according to logical priority or scenario requirements. See the foregoing for details.Figure 5 The process of constructing the target structured information described herein will be understood, but will not be elaborated upon here.
[0171] Alternatively, the server can also represent the process of obtaining structured information from samples using a semantic graph. For example, it can call the first major language model to treat each sample key information among the M target keys as a node, and the corresponding sample candidate answers as associated attributes, constructing semantic associations between sample key information and sample candidate answers through directed edges. In this way, a semantic subgraph composed of M nodes and their corresponding attributes can be constructed. Finally, the server further aggregates these M semantic subgraphs to form a complete semantic graph structure, which is the structured information of the samples. This graph structure not only reflects the association path between sample key information and sample candidate answers, but also supports the mining of implicit logical relationships through graph reasoning mechanisms, improving the coherence and accuracy of answer generation.
[0172] It should be noted that in practical applications, other structured processing methods are also included, which are not specifically limited in this application.
[0173] 704. The server calls the first major language model to perform prediction processing on the question retrieval samples and sample structured information to obtain the first answer prediction probability.
[0174] In one or more embodiments, after obtaining the structured information of the samples through structured processing, the server can also use the question retrieval sample and the sample structured information as input to the first large language model. In this way, the server, through the deep semantic understanding capabilities of the first large language model, performs joint reasoning on the question retrieval sample and the sample structured information to predict the probability of obtaining a first answer. This first answer prediction probability reflects the probability of retrieving an answer related to the question retrieval sample from the sample structured information.
[0175] For example, the matching degree between the question retrieval sample and the keys in each key-value pair in the sample's structured information can be calculated. The corresponding relevance score is then output by the first language model and normalized to a probability form, which yields the first answer prediction probability. The higher this probability value, the higher the confidence level that the sample's structured information contains answers for answering the question retrieval sample, providing a reliable basis for subsequent answer generation.
[0176] 705. The server calls the reference large language model to perform prediction processing on the question retrieval samples and sample structured information to obtain the prediction probability of the second answer.
[0177] In one or more embodiments, after obtaining the structured information of the samples through structured processing, the server may also introduce a reference large language model to independently predict the question retrieval samples and the sample structured information to generate a second answer prediction probability. This reference large language model can serve as a benchmark model to compare and verify the reliability of the prediction results of the first large language model.
[0178] It should be noted that the process of how the large language model predicts the probability of obtaining the second answer is similar to that of the first large language model, and no specific limitations are made in this application.
[0179] 706. The server calculates the total reward value based on the first answer prediction probability and the rule reward value, and performs KL divergence calculation based on the first answer prediction probability and the second answer prediction probability to obtain the target divergence value. The rule reward value is obtained based on the answer and question retrieval samples corresponding to the first answer prediction probability.
[0180] In one or more embodiments, after obtaining the first answer prediction probability and the second answer prediction probability through the first large language model and the reference large language model, the server can further evaluate the answer and question retrieval samples corresponding to the first answer prediction probability by combining a preset rule reward function to obtain a rule reward value. This rule reward value can measure the degree to which the answer corresponding to the first answer prediction probability conforms to preset logical rules.
[0181] Thus, after calculating the rule reward value, the server combines this reward value with the prediction probability of the first answer to calculate the total reward value. This total reward value comprehensively reflects the credibility and rule compliance of the answer, providing clear feedback signals for model optimization.
[0182] In addition, the server needs to calculate the KL divergence between the predicted probabilities of the first and second answers to determine the target divergence value. This target divergence value measures the degree of difference between the two probability distributions. A smaller target divergence value indicates that the prediction distributions of the first and second large language models are closer, resulting in higher answer consistency and more reliable results. Conversely, a larger target divergence value reflects a significant discrepancy between the two models' predictions.
[0183] 707. The server calculates the difference between the total reward value and the target divergence value to obtain the target loss value.
[0184] In one or more embodiments, after calculating the total reward value and the target divergence value, the server can calculate the target loss value based on the total reward value and the target divergence value. This target loss value is used to reflect the comprehensive deviation between the model's current prediction result and the expected output, and is a key basis for optimizing the parameters of the primary language model.
[0185] For example, the target loss value can satisfy the following expression, namely:
[0186]
[0187] in, This represents the predicted probability of the first answer. θ represents the probability of predicting the second answer, and θ represents the first language model. The parameters, This refers to a large language model, where β represents a hyperparameter controlling the influence of KL divergence, and D... KL (·||·) represents the KL divergence calculation function. This represents M target document samples. This represents the key information of the sample that matches the question retrieval sample, found from the structured information of the sample. x represents the question retrieval sample, and y represents the predicted answer corresponding to question retrieval sample x. Additionally, Represents the total reward value. Indicates the rule reward value. This represents the target divergence value. By calculating the difference between this total reward value and the target divergence value, the target loss value can be obtained, which is used for backpropagation to optimize the model parameters θ.
[0188] 708. The server updates the model parameters of the first large language model based on the target loss value to obtain the target large language model.
[0189] In one or more embodiments, after calculating the target loss value, the server can update the model parameters of the first large language model based on the target loss value, adjusting the parameter θ using gradient descent or its variant optimization algorithm. This optimization process is iterated until the model converges. In this way, the target large language model can be trained. After training the target large language model, it can be applied to the aforementioned... Figure 4 The described problem retrieval process aims to achieve accurate matching and answer generation for the problem to be retrieved.
[0190] Optionally, for Figure 7 The training process described can also be referred to Figure 8 Use the illustrated training framework diagram to understand it. Figure 8 As shown, first, a question retrieval sample and N document samples are obtained. Then, these sample and N document samples are input into the first large language model. Thus, during the processing of the question retrieval sample and the N document samples, the first large language model is invoked to perform the following operations:
[0191] First, based on the question retrieval sample, M target document samples are determined from N document samples. These M target document samples include M key information points and corresponding candidate answers for each key information point. After determining the M target document samples, the M key information points and M candidate answers are then structured to obtain sample structured information. This sample structured information is used to characterize the association between the M key information points and the M candidate answers. Finally, prediction processing is performed on the question retrieval sample and the sample structured information to obtain the predicted probability of the first answer.
[0192] In addition, a reference large language model is invoked to perform prediction processing on the question retrieval samples and sample structured information to obtain the second answer prediction probability.
[0193] Then, the total reward value is calculated based on the first answer prediction probability and the rule reward value, and the target divergence value is obtained by calculating the KL divergence based on the first answer prediction probability and the second answer prediction probability. The described rule reward value is obtained based on the answer and question retrieval samples corresponding to the first answer prediction probability. Furthermore, the target loss value is obtained by calculating the difference between the total reward value and the target divergence value.
[0194] Then, the model parameters of the first large language model are adjusted according to the target loss value, and the target large language model is trained in this way.
[0195] Through the above method, in the macro-retrieval stage, M target document samples related to the question retrieval sample are retrieved from N document samples. The key information and candidate answers of these M target document samples are then structured and stored. In the micro-retrieval stage, highly relevant key information is retrieved from the structured information of the samples. These M target document samples, the retrieved key information, and the question retrieval sample are used together as training data and input into a reinforcement learning-based training framework. This optimizes the accuracy and stability of the first language model in answer generation, greatly solving the model illusion problem and improving its reliability in practical applications. Furthermore, this application introduces rule-based rewards and divergence constraints to ensure that the model's answer generation conforms to preset logical norms while maintaining a moderate consistency between the output distribution and the reference model, thereby improving the reliability and interpretability of the answers.
[0196] Optionally, in the foregoing Figure 7 Based on one or more embodiments shown, another embodiment provided in this application can further calculate the total reward value by introducing group relative policy optimization (GRPO). That is, for... Figure 7In step 706, how to calculate the total reward value based on the predicted probability and rule reward value of the first answer can be found in [reference needed]. Figure 9 The processing framework diagram shown is for reference.
[0197] like Figure 9 As shown, the second language model can be called first to predict the question retrieval samples and their structured information, thus obtaining the third answer prediction probability. It should be understood that the first language model described is a machine learning model obtained by updating the parameters of the second language model. Therefore, the third answer prediction probability corresponds to the model output before the update. For example, the third answer prediction probability satisfies the following expression: .in, This represents the second largest language model. Let x represent the predicted probability of the third answer, and y represent the sample retrieved for the question. i This represents the answer obtained when the second largest language model is used to sample the question retrieval sample x for the i-th time, 1≤i≤G, where i and G are integers, and θ old This represents the model parameters of the second largest language model, where G is the number of answer samples.
[0198] The number of answer samples G described can be understood as the number of times the question retrieval samples are sampled using the second largest language model.
[0199] Subsequently, the strategy proportion is obtained by calculating the ratio between the predicted probabilities of the first and third answers. This strategy proportion reflects the magnitude of change of the first language model relative to the second language model. For example, the strategy proportion can satisfy the following expression, such as: Strategy Proportion = .in, This represents the predicted probability of the first answer.
[0200] Then, a clip operation is performed on the strategy proportion to obtain the updated strategy proportion. For example, the updated strategy proportion can be expressed as: Here, ∈ is a preset truncation threshold used to limit the magnitude of policy updates and avoid drastic fluctuations during training. In other words, the clip operation limits the proportion of policy updates to a preset range (e.g., [1-∈, 1+∈]) to prevent excessively large update magnitudes from causing model training instability.
[0201] Then, by calculating the difference between the rule-based reward value and the preset benchmark reward value, the advantage function value is obtained. This advantage function value reflects the relative value of the answer corresponding to the predicted probability of selecting the first answer in the question retrieval sample. For example, the advantage function value can be expressed as: Among them, A i Indicates the value of the dominant function. V(x) is the rule reward value, i.e., the reward value of the model's answer. V(x) is the preset baseline reward value, which is the average reward of multiple sampled answers for the same question retrieval sample x. This advantage function value is normalized and used to guide the policy gradient update, making the model more inclined to generate high-value answers while suppressing the generation probability of low-reward responses, thereby achieving an efficient and stable reinforcement learning optimization process.
[0202] Finally, the total reward value is calculated based on the predicted probability of the third answer, the strategy proportion, the updated strategy proportion, the advantage function value, and the number of answer samples. For example, this total reward value... It can be expressed in another form, namely:
[0203]
[0204] The total reward value calculated using the above method comprehensively considers model output changes, reward shifts, and sampling stability, and then optimizes model parameters through gradient updates and backpropagation. This process effectively balances exploration and exploitation, improving the accuracy and robustness of answer generation. By introducing a group-relative policy optimization method, the model gradually improves the stability and rationality of answer generation in multiple iterations.
[0205] Optionally, in the foregoing Figure 7 Based on one or more embodiments shown, since the large language model does not need to perform gradient updates because it retrieves M target document samples matching the question retrieval sample from an external knowledge base, and retrieves key sample information related to the question retrieval sample from the sample structured information, it can also introduce a masking mechanism to shield the gradient propagation paths corresponding to the M target document samples and the key sample information. Specifically, refer to... Figure 10 The processing framework diagram shown is for reference.
[0206] like Figure 10 As shown, before calculating the total reward value, a first mask value and a second mask value can be configured. The first mask value and the second mask value are different. The first mask value is used to mask the M target document samples and their structured information, that is, to mask the gradient outputs corresponding to these M target document samples and their structured information, ensuring that they do not participate in parameter updates during backpropagation. The second mask value is used to retain the answer corresponding to the first answer prediction probability predicted by the first language model, thus optimizing only the model generation part.
[0207] Thus, the configured first mask value is used to perform mask marking processing on M target document samples and sample structure information to obtain the mask values of M target document samples and the mask values of sample structure information.
[0208] Similarly, the second mask value is used to mask the answer corresponding to the predicted probability of the first answer, thus obtaining the mask value of the answer corresponding to the predicted probability of the first answer.
[0209] For example, the first mask value can be 0, and the second mask value can be 1. Thus, the first mask value of 0 can be assigned to the M target document samples and their structured information, blocking gradient propagation and preventing external knowledge from interfering with model parameter updates. Similarly, the second mask value of 1 is assigned to the answer part corresponding to the first answer prediction probability, ensuring normal gradient backpropagation in the model generation path. This masking mechanism effectively isolates the negative impact of retrieval enhancement input on training stability, preserves the optimizability of answer generation, and improves answer quality while ensuring the convergence and reliability of the training process.
[0210] Next, based on the first language model, prediction processing is performed on M target document samples, sample structured information, mask values of the M target document samples, mask values of the sample structured information, and the mask value of the answer corresponding to the first answer prediction probability to obtain the fourth answer prediction probability. For example, this fourth answer prediction probability can satisfy the following expression, namely:
[0211]
[0212] in, This represents the mask value, where t=0. The first mask value; when t=1, This is the second mask value. When t=0, the gradient flow is effectively truncated, ensuring that external inputs do not interfere with the updating of internal model parameters; when t=1, the gradient is preserved and propagated back to the generation module, driving the continuous optimization of the answer output.
[0213] Thus, in the aforementioned Figure 9 In the process of calculating the total reward value based on the third answer prediction probability, strategy proportion, updated strategy proportion, dominance function value, and number of answer samples, specifically, after calculating the fourth answer prediction probability, the total reward value can be calculated based on the fourth answer prediction probability, strategy proportion, updated strategy proportion, dominance function value, and number of answer samples. That is, the fourth answer prediction probability is used to update the aforementioned... Figure 9 The third answer prediction probability in the total reward value expression accurately reflects the actual performance of the generated answer under the current strategy.
[0214] It should be noted that the strategy proportions, updated strategy proportions, and number of answer samples described here can be referred to in the preceding text. Figure 9 The content described is for your understanding and will not be elaborated upon here.
[0215] By employing the above method, gradient isolation of external knowledge input and gradient preservation of the core generation path are achieved through masking, thereby avoiding parameter perturbations caused by the introduction of external knowledge and ensuring the stability of the model's core semantic understanding ability. Simultaneously, gradient optimization is performed only on the generation module, allowing the model to focus on improving the quality and relevance of generated responses while fully utilizing external information, further enhancing the system's controllability and convergence efficiency.
[0216] Optionally, in the foregoing Figure 7 Based on one or more embodiments described, for Figure 7 The rule reward value mentioned in step 706 is obtained based on the answer and question retrieval samples corresponding to the predicted probability of the first answer. Regarding how to calculate this rule reward value, another embodiment provided in this application implements it by introducing a rule-based reward design. See below for details. Figure 11 Use the schematic diagram shown to understand the framework.
[0217] like Figure 11 As shown, in calculating the rule reward value, the reward value can be calculated first based on the answer corresponding to the predicted probability of the first answer, the preset standard answer, and the sample structured information. This reward value reflects the semantic consistency and structural matching degree between the answer predicted by the model corresponding to the predicted probability of the first answer and the preset standard answer, thereby quantifying the accuracy of the generated content. By introducing sample structured information as a constraint, the calculation precision of the reward value is further calibrated, making the model more inclined to generate answers that conform to factual logic and domain norms during the reasoning process, thus improving the reliability and interpretability of the overall answer.
[0218] As an illustrative example, the calculation of answer reward values can be quantified from multiple dimensions, such as result correctness, key information correctness, and consistency between the answer and key information, thereby improving the accuracy of answer reward value calculation. For instance, the result correctness score between the answer corresponding to the first answer prediction probability and the preset standard answer can be calculated by calculating at least one of the keyword matching degree and semantic similarity between them. Similarly, the information matching degree between the key information of the sample related to the answer corresponding to the first answer prediction probability (i.e., the first key information) in the sample structured information and the preset standard answer can be calculated to obtain the information matching score between the first key information and the preset standard answer, thus prompting the retention of only the key information most relevant to the answer. In addition, the vector representations of the first key information and the answer corresponding to the first answer prediction probability can be extracted, and the semantic similarity between the vector representation of the first key information and the vector representation of the answer corresponding to the first answer prediction probability can be calculated. Then, the semantic similarity is weighted and fused with the first answer prediction probability to obtain the alignment matching score between the first key information and the answer corresponding to the first answer prediction probability. Thus, the answer reward value is calculated based on the result correctness score, information matching score, and alignment matching score.
[0219] Optionally, during the calculation of the answer reward value, the information matching score and the alignment matching score can be weighted separately to obtain a weighted information matching score and a weighted alignment matching score. Then, the result correctness score, the weighted information matching score, and the weighted alignment matching score are summed to obtain the answer reward value. For example, the answer reward value can satisfy the following expression: Rans = S final +α×S key +γ×S cons , among which, S final S represents the score for the correctness of the result. key S represents the information matching score. cons The score represents the alignment matching score. α and γ are adjustable non-negative weight parameters used to balance the contribution of each score to the overall reward, ensuring that the model takes into account semantic accuracy, key information coverage and structured logical consistency when generating answers, thereby achieving a trade-off between correctness and evidence consistency.
[0220] Similarly, in addition to calculating the answer reward value, this embodiment also needs to calculate the format score of M target document samples and the format score of sample structured information to obtain the format reward value.
[0221] For example, different judgment conditions can be defined in advance for different formatting specifications. Document formatting specifications may include elements such as font type, paragraph spacing, heading levels, and list styles, with each element corresponding to one or more quantifiable detection rules. When the structured representation of the target document sample matches the preset format template on a specified dimension, a corresponding score is assigned, and the final format score is obtained. Similarly, the format compliance of the sample's structured information can also be evaluated through the same mechanism to obtain its format score. After weighted fusion and normalization, the final format reward value is generated to guide the model to output an answer that is both accurate in content and conforms to the formatting specifications.
[0222] Finally, based on the calculated answer reward value and format reward value, the rule reward value is determined. For example, the final rule reward value can satisfy the following expression, such as:
[0223]
[0224] in, The rule reward value is represented by , the answer reward value by RANS, and the F1 score is the harmonic mean of format accuracy and recall, used to measure the completeness and standardization of structured information presentation.
[0225] In addition, if the format reward value is greater than the preset threshold, the format can be judged as correct; otherwise, if the format reward value is less than or equal to the preset threshold, the format is judged as incorrect.
[0226] Therefore, when the format is correct and the F1 score is greater than 0, the answer reward value Rans can be selected as the rule reward value, which can effectively incentivize the model to generate answers that meet both content accuracy requirements and structured expression norms. When the answer is incorrect but the format is correct, a pre-set value, such as 0.1, can be selected as the rule reward value to weaken the absolute impact of content errors on the overall score, while encouraging the model to maintain format compliance. When both the format and the answer are incorrect, the rule reward value can be set to 0 to reflect the penalty for both content and format failures.
[0227] By using the above method, the generation quality of different dimensions is effectively distinguished by hierarchical criteria. While ensuring the semantic correctness of the answer, the model is encouraged to follow the specified structure and typesetting specifications, thereby improving the readability and professionalism of the output results.
[0228] Optionally, in the foregoing Figure 7Based on one or more of the described embodiments, in another embodiment provided by this application, the first large language model includes an inference retrieval module and an answer generation module, with the inference retrieval module deployed before the answer generation module. Accordingly, in the process of calling the first large language model to determine M target document samples from N document samples based on question retrieval samples, the inference retrieval module can specifically perform matching processing on the question retrieval samples and the N document samples to obtain M target document samples. Similarly, in the process of calling the first large language model to perform structured processing on the key information of M samples and the candidate answers of M samples to obtain sample structured information, the inference retrieval module can specifically perform structured processing on the key information of M samples and the candidate answers of M samples to obtain sample structured information. Further, in the process of calling the first large language model to perform prediction processing on the question retrieval samples and sample structured information to obtain the first answer prediction probability, the answer generation module can specifically perform prediction processing on the question retrieval samples and sample structured information to obtain the first answer prediction probability.
[0229] For example, the probability of predicting the first answer can be represented by the following expression:
[0230]
[0231] in, This indicates the answer generation module. This represents the inference retrieval module. V represents the sample structured information, which is extracted and structured by the inference retrieval module from M target document samples. Indicates sequential combination.
[0232] Thus, this application decouples reasoning retrieval and answer generation into two independent modules to achieve a fixed retrieval order from macro-level retrieval to micro-level retrieval. This integrates the two-layer retrieval strategy into the model's architecture design, strengthening the orderly collaboration between information filtering and answer generation. The reasoning retrieval module prioritizes the accurate location of relevant documents and the extraction of key information, ensuring that the content input to the answer generation module has high relevance and structural consistency.
[0233] Optionally, in the foregoing Figure 4 Based on one or more of the described embodiments, in another embodiment provided by this application, the M target documents retrieved from the macro-retrieval stage and the target structured information obtained through structured processing can also be visualized, making it easier for users to trace the basis for the generation of each candidate answer and to annotate and provide feedback on abnormal results.
[0234] Furthermore, the timing of the invocation of key target information retrieved during the micro-retrieval phase can be extracted and dynamically displayed visually. This helps users intuitively observe the proximity between the evidence and the output content.
[0235] Optionally, in the foregoing Figure 4 Based on the one or more embodiments described, another embodiment provided in this application can also visually display a trend chart of reinforcement learning reward changes. For example... Figure 12 As shown, (a) illustrates the change in reward score when the training step size is T1, and (b) illustrates the trend of reward score change when the training step size is T2. Thus, these trend graphs allow for real-time monitoring of the model's gradual mastery of micro and macro retrieval capabilities.
[0236] Optionally, in the foregoing Figure 4 Based on one or more of the described embodiments, another embodiment provided in this application can also visually display a comparison chart of hallucination relief effects. For example... Figure 13 As shown, this application presents the target large language model (such as M). 2 This paper compares the changes in factual consistency and illusion rate between the proposed method (R) and related large language models (e.g., ReSearch, ..., Native RAG) under different tasks and context lengths. The comparison shows that the proposed method exhibits lower illusion rate and higher factual consistency across different context lengths, validating the significant gain of the two-layer retrieval mechanism in generating reliable answers.
[0237] In this embodiment, the large language model illusion mitigation method based on micro-macro retrieval possesses end-to-end closed-loop characteristics, significantly improving factual consistency and stability for long text generation without introducing cumbersome external engineering dependencies. Specifically, through a two-level mechanism of "macro retrieval—micro retrieval," key information is injected into the answer generation stage as close as possible, ensuring the temporal proximity of evidence and output, effectively mitigating the illusion caused by "key information being submerged / forgotten" in long contexts. Furthermore, target structured information is stored in the form of structured key-value pairs, and answer generation is forced to be based on micro-retrieval results. Combined with "consistency rewards," traceable and verifiable outputs are produced, reducing fabrication and bias. In addition, this application can also employ a combination of GRPO reinforcement learning and retrieval result masking, only backpropagating gradients to model-generated fragments to avoid pseudo-gradients from environment-injected text. Combined with phased training of course learning, this significantly improves training stability and convergence speed. Furthermore, the micro-retrieval frequency is automatically increased in long inference chains / high uncertainty scenarios to ensure accuracy; the call frequency is reduced in short contexts / high latency-sensitive scenarios to balance throughput and cost. Furthermore, the method in this application decouples the base LLM model, retrieval unit, and external knowledge sources, allowing for integration with various open-source / commercial models and retrieval systems without modifying the underlying network structure, resulting in low migration costs. Additionally, this application provides a graphical user interface (GUI) that displays graphs related to evidence retrieval, evidence retrieval timelines, reward trends, and effect comparisons, visually demonstrating evidence flow and training mastery, facilitating R&D participation, business-side review, and compliance documentation. Moreover, the method provided in this application is applicable to scenarios such as long-text question answering, retrieval enhancement generation, knowledge-intensive summary and report writing, and multi-turn dialogues, demonstrating significant improvements and promotional value in terms of factual consistency, stability, and auditability. In summary, the problem-solving method proposed in this application effectively reduces illusions and improves factual consistency and traceability in long-text and knowledge-intensive scenarios, possessing good engineering feasibility and cross-domain adaptability, making it suitable for various generative applications with high content security and quality requirements.
[0238] The foregoing primarily describes the solutions provided by the embodiments of this application from a methodological perspective. It is understood that to achieve the above functions, corresponding hardware structures and / or software modules are included to execute each function. Those skilled in the art should readily recognize that, based on the modules and algorithm steps described in conjunction with the embodiments disclosed in this application, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0239] This application embodiment can divide the device into functional modules according to the above method example. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0240] In the embodiments of this application, 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.
[0241] The problem-solving apparatus in the embodiments of this application will now be described in detail. Figure 14 A schematic diagram of one embodiment of the problem-solving apparatus provided in this application is shown. For example... Figure 14 As shown, the problem-solving device may include an acquisition unit 1401 and a processing unit 1402.
[0242] Among them, the acquisition unit 1401 is used to acquire the question to be retrieved and N candidate documents, where N is an integer greater than or equal to 1;
[0243] Processing unit 1402 is used to call the target large language model and determine M target documents from the N candidate documents based on the retrieval question. The M target documents include M target key information and candidate answers corresponding to each target key information. Each target key information is used to characterize key evidence of the candidate answer in the corresponding target document, 1≤M≤N;
[0244] The processing unit 1402 is used to call the target large language model to perform structured processing on the M target key information and the M candidate answers to obtain target structured information. The target structured information is used to characterize the association between the M target key information and the M candidate answers.
[0245] The processing unit 1402 is used to invoke the target large language model and determine the target answer based on the question to be retrieved and the target structured information, wherein the target answer is contained in the M candidate answers;
[0246] The processing unit 1402 is used to answer the question to be retrieved based on the target answer and the target key information corresponding to the target answer.
[0247] In the above Figure 14 Based on one or more of the described embodiments, in another embodiment provided in this application, the processing unit 1402 is specifically used for:
[0248] The target large language model is invoked, and each of the M target key information is used as a key, and the candidate answer corresponding to each target key information is used as a value, so as to construct M key-value pairs;
[0249] Target structured information is generated based on the M key-value pairs.
[0250] In the above Figure 14 Based on one or more of the described embodiments, in another embodiment provided in this application, the processing unit 1402 is specifically used for:
[0251] The target large language model is invoked to parse and process the question to be retrieved, thereby obtaining the key information of the question to be retrieved;
[0252] The target key is obtained by matching the key information of the question to be searched with each key of the M key-value pairs in the target structured information;
[0253] Extract the value from the target key-value pair from the target structured information, and determine the value in the target key-value pair as the target answer. The target key-value pair is the key-value pair corresponding to the target key among the M key-value pairs.
[0254] In the above Figure 14 Based on one or more of the described embodiments, in another embodiment provided in this application, the processing unit 1402 is specifically used for:
[0255] The target large language model is invoked to calculate the semantic similarity between the retrieval question and each key of the M key-value pairs in the target structured information;
[0256] Select the largest semantic similarity from the M semantic similarities, and determine the key corresponding to the largest semantic similarity as the target key;
[0257] Extract the value from the target key-value pair from the target structured information, and determine the value in the target key-value pair as the target answer. The target key-value pair is the key-value pair corresponding to the target key among the M key-value pairs.
[0258] In the above Figure 14Based on one or more of the described embodiments, another embodiment provided in this application,
[0259] The acquisition unit 1401 is specifically used to acquire a question retrieval sample and N document samples;
[0260] Processing unit 1402 is specifically used for:
[0261] The first language model is invoked to determine M target document samples from the N document samples based on the question retrieval sample. The M target document samples include M sample key information and sample candidate answers corresponding to each sample key information. Each sample key information is used to characterize the key evidence of the sample candidate answer in the corresponding target document sample.
[0262] The first large language model is invoked to perform structured processing on the M key information of the samples and the M candidate answers of the samples to obtain sample structured information. The sample structured information is used to characterize the relationship between the M key information of the samples and the M candidate answers of the samples.
[0263] The first large language model is invoked to perform prediction processing on the question retrieval sample and the sample structure information to obtain the first answer prediction probability. The first answer prediction probability is used to characterize the probability value of retrieving an answer related to the question retrieval sample in the sample structure information.
[0264] The reference large language model is invoked to perform prediction processing on the question retrieval samples and the structured information of the samples to obtain the second answer prediction probability;
[0265] The total reward value is calculated based on the first answer prediction probability and the rule reward value, and the target divergence value is obtained by calculating the KL divergence based on the first answer prediction probability and the second answer prediction probability. The rule reward value is obtained based on the answer corresponding to the first answer prediction probability and the question retrieval sample.
[0266] Calculate the difference between the total reward value and the target divergence value to obtain the target loss value;
[0267] Based on the target loss value, the model parameters of the first large language model are updated to obtain the target large language model.
[0268] In the above Figure 14 Based on one or more of the described embodiments, in another embodiment provided in this application, the processing unit 1402 is specifically used for:
[0269] The second largest language model is invoked to perform prediction processing on the question retrieval sample and the sample structured information to obtain the third answer prediction probability. The first largest language model is a machine learning model obtained by updating the model parameters of the second largest language model.
[0270] The ratio between the predicted probability of the first answer and the predicted probability of the third answer is calculated to obtain the strategy proportion, which is used to characterize the change of the first large language model relative to the second large language model.
[0271] Perform a clip operation on the strategy percentage to obtain the updated strategy percentage;
[0272] The difference between the rule reward value and the preset benchmark reward value is calculated to obtain the advantage function value, which is used to characterize the relative value of selecting the answer corresponding to the predicted probability of the first answer under the question retrieval sample;
[0273] The total reward value is calculated based on the predicted probability of the third answer, the strategy proportion, the updated strategy proportion, the advantage function value, and the number of answer samples. The number of answer samples refers to the number of times the question retrieval samples are sampled.
[0274] In the above Figure 14 Based on one or more of the described embodiments, in another embodiment provided in this application, the processing unit 1402 is specifically used for:
[0275] Based on the first mask value, the M target document samples and the sample structure information are masked to obtain the mask values of the M target document samples and the mask values of the sample structure information. The first mask value is used to represent the masking of the M target document samples and the sample structure information.
[0276] The answer corresponding to the first answer prediction probability is masked based on the second mask value to obtain the mask value of the answer corresponding to the first answer prediction probability. The first mask value is different from the second mask value. The second mask value is used to represent the retention of the answer corresponding to the first answer prediction probability.
[0277] Based on the first major language model, the M target document samples, the sample structure information, the mask values of the M target document samples, the mask values of the sample structure information, and the mask values of the answers corresponding to the first answer prediction probabilities are predicted to obtain the fourth answer prediction probabilities.
[0278] The total reward value is calculated based on the fourth answer prediction probability, the strategy proportion, the updated strategy proportion, the advantage function value, and the number of answer samples.
[0279] In the above Figure 14 Based on one or more of the described embodiments, in another embodiment provided in this application, the processing unit 1402 is specifically used for:
[0280] The answer reward value is calculated based on the answer corresponding to the predicted probability of the first answer, the preset standard answer, and the sample structure information;
[0281] Calculate the format score of the M target document samples and the format score of the sample structured information to obtain the format reward value;
[0282] The rule reward value is determined based on the answer reward value and the format reward value.
[0283] In the above Figure 14 Based on one or more of the described embodiments, in another embodiment provided in this application, the processing unit 1402 is specifically used for:
[0284] Calculate the correctness score between the answer corresponding to the predicted probability of the first answer and the preset standard answer;
[0285] Calculate the information matching score between the first key information and the preset standard answer, wherein the first key information is the sample key information in the sample structured information that corresponds to the answer with the predicted probability of the first answer;
[0286] Calculate the alignment matching score between the answer corresponding to the first answer prediction probability and the first key information;
[0287] The answer reward value is calculated based on the result correctness score, the information matching score, and the alignment matching score.
[0288] In the above Figure 14 Based on one or more of the described embodiments, in another embodiment provided in this application, the processing unit 1402 is specifically used for:
[0289] The information matching score and the alignment matching score are weighted to obtain the weighted information matching score and the weighted alignment matching score.
[0290] The answer reward value is obtained by summing the correctness score of the result, the weighted information matching score, and the weighted alignment matching score.
[0291] In the above Figure 14Based on one or more of the described embodiments, in another embodiment provided by this application, the first large language model includes a reasoning retrieval module and an answer generation module; the processing unit 1402 is specifically used for:
[0292] Based on the reasoning retrieval module, the question retrieval sample and the N document samples are matched to obtain M target document samples;
[0293] Based on the reasoning and retrieval module, the key information of the M samples and the candidate answers of the M samples are processed in a structured manner to obtain the structured information of the samples;
[0294] Based on the answer generation module, the question retrieval sample and the sample structured information are subjected to prediction processing to obtain the first answer prediction probability.
[0295] The computer device in the embodiments of this application has been described above from the perspective of modular functional entities. The computer device in the embodiments of this application will now be described below from the perspective of hardware processing. Figure 14 A schematic diagram of the structure of a computer device provided in an embodiment of this application is shown. This computer device can vary considerably due to differences in configuration or performance, and may include, but is not limited to, the aforementioned terminal or server.
[0296] like Figure 15 As shown, the computer device may include one or more central processing units (CPUs) 322 (e.g., one or more processors) and a memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) for storing application programs 342 or data 344. The memory 332 and storage media 330 may be temporary or persistent storage. The program stored in the storage media 330 may include one or more modules (not shown in the figure), each module may include a series of instruction operations on the computer device. Furthermore, the CPU 322 may be configured to communicate with the storage media 330 and execute a series of instruction operations in the storage media 330 on the computer device. Exemplarily, the CPU 322 is used to execute the application program 342 stored in the storage media 330, thereby implementing the problem-solving method provided in the above embodiments of this application.
[0297] The computer device may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input / output interfaces 358, and / or one or more operating systems 341, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0298] For example, Figure 15 The central processing unit 322 can invoke computer execution instructions stored in memory 332 to cause the computer device to perform actions such as... Figure 15 The method in one or more of the corresponding method embodiments.
[0299] The steps performed by the computer device in the above embodiments can be based on this Figures 4 to 13 Figure 15 The computer device structure shown.
[0300] This application also provides a computer-readable storage medium storing program instructions thereon, which, when executed by a computer device, implement the steps of the methods described in the foregoing embodiments.
[0301] This application also provides a computer program product, including program instructions, which, when executed by a computer device, implement the steps of the methods described in the foregoing embodiments.
[0302] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0303] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0304] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.
[0305] 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 units can be selected to achieve the purpose of this embodiment according to actual needs.
[0306] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0307] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0308] A computer program product includes one or more computer instructions. When these computer instructions are loaded and executed on a computer, they generate, in whole or in part, the processes or functions according to embodiments of this application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD), etc.
[0309] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method of problem handling, characterized by, The method comprises: obtaining a to-be-retrieved question and N candidate documents, N being an integer greater than or equal to 1; calling a target large language model to determine M target documents from the N candidate documents based on the to-be-retrieved question, the M target documents comprising M target key information and a candidate answer corresponding to each target key information, each target key information being used to represent a key evidence for a candidate answer in the corresponding target document, 1≤M≤N; calling the target large language model to perform structured processing on the M target key information and the M candidate answers to obtain target structured information, the target structured information being used to represent an association relationship between the M target key information and the M candidate answers; calling the target large language model to determine a target answer based on the to-be-retrieved question and the target structured information, the target answer being contained in the M candidate answers; answering the to-be-retrieved question based on the target answer and the target key information corresponding to the target answer.
2. The method of claim 1, wherein, The method further comprises: obtaining a question retrieval sample and N document samples; 3. The method of claim 2, wherein, 4. The method of claim 2, wherein, 5. The method according to any one of claims 1 to 4, characterized in that, calling a first large language model, determining M target document samples from the N document samples based on the question retrieval sample, the M target document samples comprising M sample key information and a sample candidate answer corresponding to each sample key information, each sample key information being used to represent key evidence of the sample candidate answer in the corresponding target document sample; calling the first large language model, performing structured processing on the M sample key information and the M sample candidate answers to obtain sample structured information, the sample structured information being used to represent the association between the M sample key information and the M sample candidate answers; calling the first large language model, performing prediction processing on the question retrieval sample and the sample structured information to obtain a first answer prediction probability, the first answer prediction probability being used to represent a probability value of retrieving an answer related to the question retrieval sample in the sample structured information; calling a reference large language model, performing prediction processing on the question retrieval sample and the sample structured information to obtain a second answer prediction probability; calculating a total reward value based on the first answer prediction probability and a rule reward value, and calculating a target divergence value based on the first answer prediction probability and the second answer prediction probability, the rule reward value being obtained based on an answer corresponding to the first answer prediction probability and the question retrieval sample; calculating a difference value between the total reward value and the target divergence value to obtain a target loss value; performing model parameter update processing on the first large language model based on the target loss value to obtain the target large language model.
6. The method of claim 5, wherein, calculating a total reward value based on the first answer prediction probability and a rule reward value, comprising: calling a second large language model, performing prediction processing on the question retrieval sample and the sample structured information to obtain a third answer prediction probability, the first large language model being a machine learning model obtained by updating model parameters of the second large language model; calculating a ratio between the first answer prediction probability and the third answer prediction probability to obtain a strategy proportion, the strategy proportion being used to represent a change amplitude of the first large language model relative to the second large language model; performing a clip operation on the strategy proportion to obtain an updated strategy proportion; calculating a difference value between the rule reward value and a preset benchmark reward value to obtain an advantage function value, the advantage function value being used to represent a relative value of selecting an answer corresponding to the first answer prediction probability under the question retrieval sample; calculating a total reward value based on the third answer prediction probability, the strategy proportion, the updated strategy proportion, the advantage function value, and an answer sampling number, the answer sampling number being a sampling number when performing sampling processing on the question retrieval sample.
7. The method of claim 6, wherein, The method further comprises: The M target document samples and the sample structured information are marked based on a first mask value to obtain a mask value of the M target document samples and a mask value of the sample structured information, the first mask value being used to represent shielding of the M target document samples and the sample structured information; The answer corresponding to the first answer prediction probability is marked based on a second mask value to obtain a mask value of the answer corresponding to the first answer prediction probability, the first mask value being different from the second mask value, and the second mask value being used to represent retaining of the answer corresponding to the first answer prediction probability; The M target document samples, the sample structured information, the mask value of the M target document samples, the mask value of the sample structured information, and the mask value of the answer corresponding to the first answer prediction probability are predicted based on a first large language model to obtain a fourth answer prediction probability; The total reward value is calculated based on the third answer prediction probability, the strategy proportion, the updated strategy proportion, the advantage function value, and the number of answer samplings. The total reward value is calculated based on the fourth answer prediction probability, the strategy proportion, the updated strategy proportion, the advantage function value, and the number of answer samplings.
8. The method according to any one of claims 5 to 7, characterized in that, The rule reward value is obtained based on the answer corresponding to the first answer prediction probability and the question retrieval sample, and includes: An answer reward value is calculated based on the answer corresponding to the first answer prediction probability, a preset standard answer, and the sample structured information; A format reward value is obtained by calculating a format score of the M target document samples and a format score of the sample structured information; The rule reward value is determined based on the answer reward value and the format reward value.
9. The method of claim 8, wherein, An answer reward value is calculated based on the first answer prediction probability, a preset standard answer, and the sample structured information, and includes: A result correctness score between the answer corresponding to the first answer prediction probability and the preset standard answer is calculated; An information matching score between first key information and the preset standard answer is calculated, the first key information being sample key information corresponding to the answer corresponding to the first answer prediction probability in the sample structured information; An alignment matching score between the answer corresponding to the first answer prediction probability and the first key information is calculated; The answer reward value is calculated based on the result correctness score, the information matching score, and the alignment matching score.
10. The method of claim 9, wherein, The answer reward value is calculated based on the result correctness score, the information matching score, and the alignment matching score, and includes: The information matching score and the alignment matching score are respectively weighted to obtain a weighted information matching score and a weighted alignment matching score; The result correctness score, the weighted information matching score, and the weighted alignment matching score are summed to obtain the answer reward value.
11. The method of claim 5, wherein, The first large language model includes an inference retrieval module and an answer generation module. calling a first large language model, determining M target document samples from the N document samples based on the question retrieval sample, including: Based on the inference retrieval module, the question retrieval sample and the N document samples are matched to obtain M target document samples; Call the first large language model, structure the M sample key information and M sample candidate answers, and obtain sample structured information, including: Based on the inference retrieval module, the M sample key information and M sample candidate answers are structured to obtain sample structured information; Call the first large language model, and perform prediction processing on the question retrieval sample and the sample structured information to obtain a first answer prediction probability, including: Based on the answer generation module, the question retrieval sample and the sample structured information are predicted to obtain a first answer prediction probability.
12. A problem processing apparatus characterized by comprising: Comprising: An acquisition unit is configured to acquire a to-be-retrieved question and N candidate documents, N being an integer greater than or equal to 1; A processing unit is configured to call a target large language model, and determine M target documents from the N candidate documents based on the to-be-retrieved question, the M target documents including M target key information and a candidate answer corresponding to each target key information, each target key information being used to represent a key evidence of the corresponding candidate answer in the target document, and 1≤M≤N; The processing unit is configured to call the target large language model, structure the M target key information and the M candidate answers, and obtain target structured information, the target structured information being used to represent an association between the M target key information and the M candidate answers; The processing unit is configured to call the target large language model, determine a target answer based on the to-be-retrieved question and the target structured information, and the target answer is contained in the M candidate answers; The processing unit is configured to answer the to-be-retrieved question based on the target answer and the target key information corresponding to the target answer.
13. A computer device, comprising: Comprising: An input / output interface, a processor and a memory, the memory storing program instructions; The processor is configured to execute the program instructions, and execute the method of any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer readable storage medium includes program instructions, when the program instructions run on the computer equipment, make the computer equipment execute the method as claimed in any one of claims 1 to 11.
15. A computer program product, characterised in that, The computer program product includes program instructions, when the program instructions run on the computer equipment, make the computer equipment execute the method as claimed in any one of claims 1 to 11.