Method for generating answers to questions based on large language model
Through internal guidance and external improvement methods, multiple inference paths are generated and the results are compared, clues are summarized and the classifier is enhanced by using contrast learning. The problem of large language models inference errors in medical information technology is solved, and the accuracy of answer generation is improved. and reliability.
Patent Information
- Application Number
- CN202411388945.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-02-18
AI Technical Summary
When large language models generate answers to questions in the field of medical information technology, they are prone to fabricating facts and details, resulting in incorrect reasoning directions, and it is difficult for existing technologies to effectively solve this problem.
Using internal guidance and external improvement methods, by generating multiple inference paths, comparing correct and wrong results, summarizing clues that help answer, and using contrast learning to strengthen lightweight classifiers to improve LLM's medical information technology Reasoning accuracy.
It effectively reduces the reasoning error rate of LLM in medical information technology, improves the accuracy and reliability of answer generation, and enhances the ability of LLM to distinguish the difference between correct and wrong results.
Smart Images

Figure CN119476471A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of medical information technology, and in particular relates to a method for generating answers to questions based on a large language model. Background Art
[0002] Question generation and answering are of great significance to the field of medical information technology. In clinical decision support, by generating questions for specific cases, doctors can consider more possible diagnosis and treatment options, reduce misdiagnosis rates, and improve the quality of diagnosis and treatment; in medical research, research hypotheses and questions are generated for large data sets to guide research directions and accelerate the discovery of new knowledge, such as the prediction of drug side effects and the identification of disease risk factors; teaching cases can also be designed for medical students and medical staff to deepen their understanding of disease mechanisms and treatment principles and improve their professional skills through problem-oriented learning; in hospital information systems, a list of questions is automatically generated based on the patient's description, guiding the patient to the appropriate department for treatment, or directly providing preliminary health consultation services to reduce the burden on medical staff.
[0003] In recent years, large language models (LLMs) have made significant progress in question generation and answer generation. The Chain of Thought (CoT) framework plays a key role in enabling LLMs to perform complex reasoning as it provides comprehensive guidance for generating step-by-step reasoning processes and producing accurate answers.
[0004] Although CoT-enhanced LLM has superior performance, it still cannot guarantee the accuracy of reasoning. The problem is that LLM tends to fabricate facts and details, which leads to the wrong direction of reasoning. To address this problem, existing research has mainly focused on two aspects: 1) Construction of CoT, studying how to improve methods to obtain effective CoT; for example, AutoCoT automatically clusters problems and selects centers to construct CoT. 2) Enhancement of CoT, using feedback interaction to optimize CoT; for example, VE uses external knowledge bases to verify and edit the original CoT. These existing studies, regardless of which category they belong to, mainly focus on improving the quality of CoT, that is, generating and obtaining good chains of thought.
[0005] Different from these studies, a recent method, CoT-SC (Wang, X., Wei, J., Schuurmans, D., Le, QV, Chi, EH, Narang, S., Chowdhery, A., Zhou, D., 2023. Self-consistency improves chain of thought reasoning in language models, in: The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023, OpenReview.net.), takes a different research direction. Specifically, it instantiates multiple CoT attempts and selects the most consistent result among the attempted predictions to output. Therefore, CoT-SC is shown to alleviate the randomness associated with single-sample generation, thereby improving reasoning performance.
[0006] However, the basic design of CoT-SC cannot prevent LLM from selecting inappropriate chains of thought, thus leading to wrong results and making multiple attempts futile.
[0007] This happens even when the correct answer has been encountered during CoT reasoning; in fact, empirical studies show that in a considerable number of error cases (e.g., 10.39% in ADVHOTPOTQA), the correct answer has already appeared in the LLM's attempts, but the model still fails. This phenomenon suggests that LLM could have provided accurate results, but ultimately failed. Even with the application of advanced ReAct technology, the rate is still as high as 7.14%. This means that current technologies on CoT quality cannot help solve this problem.
[0008] There is a need for a detailed analysis of the outstanding challenges of this phenomenon. (1) Given the above efforts, the lack of exploration in this area has resulted in a lack of knowledge of the clues contained in the principles. This hampers the ability of LLMs to discern the subtle differences between correct and incorrect principles. (2) Some of these subtle differences may be hidden in the semantic space and cannot be captured by surface analysis. Although fine-tuning LLMs can improve their understanding in specific domains, the required human resources and computational costs are prohibitive. Summary of the invention
[0009] In view of this, in order to meet these challenges, this application attempts to stimulate the comprehensive ability of LLM, and refers to the general idea of human learning mechanism, that is, attempt → summarize → enhance. Therefore, this application instructs LLM to generate multiple reasoning paths and select instances of correct answers and wrong answers. The distinction between the two categories is a key indicator to avoid misleading inferences, prompting LLM to actively extract and summarize relevant clues through understanding of attempts. Therefore, LLM continuously updates their understanding of a given task and makes another round of attempts based on their own summary.
[0010] In order to fully explore the semantic features of rationales and balance the associated costs, this application designs a small dedicated model to address this challenge externally. The customized model should be highly sensitive to subtle differences and make more accurate decisions on rationales that are difficult for LLM to handle. Therefore, attempts generated by the above module are collected, and positive and negative generation are interleaved. Subsequently, contrastive learning is used to strengthen the lightweight classifier to understand the differences.
[0011] Specifically, the method for generating question answers based on a large language model disclosed in this application includes the following steps:
[0012] Get medical questions, use manual annotations as examples to build medical question prompts;
[0013] Generate preliminary attempts based on the CoT-SC algorithm;
[0014] Compare correct and incorrect initial attempts and summarize clues that may help answer the question;
[0015] Modify prompts based on clues and make reinforcement attempts;
[0016] Use the enhanced attempts obtained in the above stage as positive and negative samples to train a lightweight professional classifier;
[0017] Use contrastive learning to enlarge the semantic distance between correct and incorrect results in the representation space;
[0018] Output answers to medical questions.
[0019] Furthermore, the attempt includes:
[0020] Use the base model to repeatedly predict question Q from the training dataset i t , i is the i-th question in a given data set, and t limits the current data source to the training set;
[0021] Randomly select a number of questions and manually provide corresponding reasons and answers to construct example D t ;
[0022] (D t , Qi t ) as a hint to guide the large language model to reason in the form of instances;
[0023] The correctness of each rationale is determined based on the annotated labels of the training samples; in order to refine the features of different categories, a set of attempts with both correct and incorrect predictions are selected as material for further processing.
[0024] Furthermore, the summarization includes: guiding the large language model to distinguish accurate and incorrect results by instructions to focus on the logical coherence within the text sequence; i t ,R 1 t +A 1 t ,...,R m t +A m t , generating clues from the large language model itself, where R t Indicates the basic principle, A t denotes the corresponding prediction and m denotes the number of attempts after augmentation.
[0025] Furthermore, the enhancement uses the acquired clues as experience to drive further reasoning process; requiring the large language model to pay attention to the previous key points in the prompt;
[0026] The clues are populated by the most consistent predictions obtained in the initial attempt step of generation;
[0027] Then, the clues are in the form of questions, clues, reasons, and answers, i.e. D' t Examples of the richness of form;
[0028] Finally, updated examples are randomly selected as components of the prompt.
[0029] Furthermore, the results are used as positive and negative samples to train lightweight professional classifiers, including:
[0030] The enhanced attempt is transformed as follows:
[0031]
[0032] in represents the correction result of the i-th question and the j-th prediction, is the rationale for the jth prediction, represents the j-th prediction, [CLS] and [SEP] are the only tokens in the language model;
[0033] Apply the SBERT algorithm to obtain its representation
[0034] Through a single-layer binary classifier F b To determine whether the answer is correct, that is:
[0035]
[0036] where p b represents the generation probability of the i-th question and the j-th prediction.
[0037] Furthermore, the contrastive learning includes:
[0038] For each correct reasoning path in the same problem, treat its representation as an anchor, and treat other correct instances as positive examples and incorrect paths as negative examples;
[0039] When only one correct reasoning path is available, the dropout mechanism is used to construct the corresponding positive instance, namely:
[0040]
[0041] Where τ is the temperature hyperparameter, cos() is the cosine similarity function, k represents the target reorganization result, Y represents the negative label set and the positive label set, is the representation of the revised result of the i-th question and the k-th prediction;
[0042] Afterwards, a multi-task learning framework is adopted to train the structure; that is, given the ground truth label L, the loss is calculated using the cross entropy loss function CE as follows:
[0043]
[0044] in and Indicates p b and p c The probability distribution of , α∈(0,1) is a hyperparameter that controls the magnitude of the loss value.
[0045] Furthermore, the model prediction includes:
[0046] Given a test question Q i e , according to the obtained (D t ,Q i e ) to reformulate the input and then try to generate the rationale, i.e.
[0047]
[0048] Where e indicates that the experiment is conducted on the test data set;
[0049] use Generate relevant clues, which means that the clues are closely related to the current question to obtain a probability distribution
[0050] After training, the binary classifier F b As an enhancement A complementary tool, predicting The questions, reasons, and answers in Will and The final result is a combination of Mathematically it is:
[0051]
[0052] Among them, β∈(0,1) represents the balance weight adjusted in the training dataset, Indicates the choice that supports the prediction, the final result with the highest probability will be determined as the answer.
[0053] This application discloses a framework INSET (Internal Guidance and External Enhancement in LLM) that integrates the above ideas. The beneficial effects of this application are as follows:
[0054] Focusing on the basic principles of LLM generation to improve its reasoning accuracy; a novel paradigm is proposed for LLM, including two innovative designs - internal guidance and external enhancement. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 The structural diagram of the external enhancement module of the present invention;
[0056] Figure 2 Experimental results in CoT-SC;
[0057] Figure 3 Experimental results in VE;
[0058] Figure 4 Experimental results in this application. DETAILED DESCRIPTION
[0059] The present invention is further described below in conjunction with the accompanying drawings, but the present invention is not limited in any way. Any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.
[0060] Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0061] Natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0062] The technical solutions provided in the embodiments of the present application involve technologies such as machine learning and natural language processing of artificial intelligence, which are specifically introduced and explained through the following embodiments.
[0063] Before introducing the embodiments of the present application, some terms involved in the present application are first explained.
[0064] 1. Construction of CoT
[0065] Small-shot CoT innovatively introduces the idea of thought chaining into the language model by leveraging natural language demonstrations as prompt examples, and its performance even surpasses that of the fine-tuned GPT-3. The following research focuses on how to improve the quality of manual CoT. PAL utilizes LLM to understand natural language questions and generate intermediate reasoning steps in the form of programs, and Math Prompter integrates algebraic expressions or Python functions into prompts to provide multiple solutions to the same math problem. Despite the impressive performance, the above works require tremendous efforts to build hand-crafted CoT. Therefore, zero-shot CoT first attempts to stimulate the potential of LLM through a simple and effective prompt, namely "Let's think step by step", to demonstrate the good ability of zero-shot and realize the automatic CoT process. Considering that the results of the zero-shot setting are subject to uncontrollable fluctuations, Auto-CoT automatically generates prompts by clustering representative examples. In addition, the CoT recipes that always perform well for a set of training samples are inferred through Gibbs sampling of Reprompting, where new recipes are iteratively sampled using previously sampled recipes as parent prompts.
[0066] However, models belonging to this category emphasize the construction variants of CoT and ignore the information leading to the true situation. In this work, we explore the functionalities covered by the original generation.
[0067] 2. Enhancement of CoT: The main idea of this line is to use feedback to verify the output of LLM. VerifyCoT uses a deductive reasoning form to enable LLM to decompose the process into a series of consecutive sub-processes, each of which specifically receives its necessary context and premise. DiVerSe also focuses on the reasoning steps and introduces a weighted voting mechanism to determine each step, where fine-grained verification helps filter out wrong predictions. VE turns its attention to leveraging external knowledge, such as Wikipedia and Google. This information serves as a fact to verify the results and supports the re-answering procedures generated by post-editing unconfidently. In order to think deeply, ReAct proposes an interactive framework to force LLM to perform a thought-action-observation cycle. At each stage, the model will make decisions that depend on feedback and prepare for the next state. The reflective agent verbally reflects on the task feedback signal and subsequently stores its own reflection text in the episodic memory buffer to improve decision-making efficiency in subsequent trials.
[0068] However, these attempts emphasize the results produced by LLM, but ignore the process of producing errors and the causes of errors. This may lead them to pursue formal correctness excessively and fail to figure out what determines the nature of the output.
[0069] The model framework of the present invention includes an internal guidance module and an external enhancement module. In the internal guidance module, prompts are first constructed using manual annotations as examples, and then attempts are generated according to CoT-SC. Subsequently, the model is forced to compare two types of results (i.e., correct and incorrect) and summarize clues that help answer. Finally, these clues help modify the prompts and make new enhanced attempts. In the external enhancement module, the results obtained in the above stages are used as positive and negative samples to train a lightweight professional classifier. In order to enhance LLM's understanding of the difference between correct and incorrect results, contrastive learning is introduced to expand their semantic distance in the representation space.
[0070] Internal boot module
[0071] To mimic the continuous evolution of human recognition, the present invention encourages LLM to learn through trial, summary and enhancement.
[0072] Try: Since LLM can automatically reason and gradually generate reasoning processes driven by self-consistency, the base model is used to repeatedly predict question Q from the training dataset i t The first step involves randomly selecting a few questions through INSET and then manually providing the corresponding reasons and answers to construct the sample D t . After that, (D t , Q i t ) as a hint to guide LLM to reason in the form of instances.
[0073] The correctness of each rationale can be determined based on the annotation labels of the training samples. In order to refine the features of different categories, a set of attempts with both correct and incorrect predictions are selected as materials for further processing.
[0074] Summary: Given a specific question, these multiple reasoning processes, especially those that contradict each other, demonstrate the potential of LLM in providing answers. These instructions are designed to guide LLM's attention to distinguish accurate and incorrect results, thereby prompting the model to focus on the logical coherence within the text sequence. According to the instructions, "Assuming you know a question and possible reasoning processes, your task is to summarize the clues that help solve the problem. i t ,R 1 t +A 1 t ,...,R m t +A m t ”,INSET can generate clues from LLM itself, where R t Indicates the basic principle, A trepresents the corresponding prediction, and m represents the number of results. Through this process, LLMs can become more familiar with the important details and have a comprehensive understanding of what they really need to complete the task. For example, "3. The answer is a specific allergic reaction", this clue provides direction for the final answer and limits the scope.
[0075] Enhancement: The clues obtained should be used as experience to promote further reasoning process, so this application adds "must strictly follow the main points" in the prompt, requiring LLM to focus on the previous main points. In order to let LLM further understand different features and self-enhance predictions, we designed the instruction "the answer may be [], if you think the answer is wrong, you can correct it", where [] is filled with the most consistent prediction obtained in the first step (as shown in the figure). Subsequently, the clues will be in the form of (question, clue, reason, answer) (i.e. D' t ), INSET randomly selects updated examples as components of the prompt.
[0076] The above samples are all from the training dataset, because true labels are needed to classify wrong and correct results. Finally, INSET enhances the ability of the basic model to understand and extract features, with the goal of distinguishing the two types of reasons, thus facilitating the subsequent final decision.
[0077] External Enhancement Modules
[0078] The goal of this module is to deeply explore the semantic nuances between reasons. The concept of tool learning aims to extend the capabilities of LLM by leveraging external tools. With this idea in mind, this application designs a lighter-weight dedicated model to achieve this goal.
[0079] First, transform the results obtained in the previous module as follows:
[0080]
[0081] in Represents the correction result of the i-th question and the j-th prediction, [CLS] and [SEP] are the only tokens in the language model. Then, SBERT (“Sentence-bert: Sentence embeddings using siamesebert-networks, in: Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing”) is applied to obtain its representation
[0082] By understanding these distinctions, the representations obtained encapsulate the core of reasoning, thereby indicating the accuracy of the final prediction. Therefore, we design a single-layer binary classifier F b to determine whether the answer is correct.
[0083] Officially,
[0084]
[0085] where p b represents the generation probability of the i-th question and the j-th prediction.
[0086] Furthermore, the generated reasons display repetitive and irrelevant content, potentially overwhelming subtle and essential features that contribute to the correct answer. Recall that contrastive learning brings instances in the same category closer together while expanding the distance between unrelated instances in the high-dimensional vector space. To emphasize that the model focuses on the differences between LLM reasoning patterns, this application introduces contrastive learning to expand the semantic distance of reasoning.
[0087] In detail, for each correct reasoning path in the same problem, its representation is regarded as an anchor point, and other correct instances are regarded as positive examples, while the wrong paths are negative examples. When only one correct reasoning path is available, the dropout mechanism is used to construct the corresponding positive instance. Mathematically speaking,
[0088]
[0089] Where τ is the temperature hyperparameter, cos() is the cosine similarity function, k represents the target reorganization result, and Y represents the negative label set and the positive label set.
[0090] Afterwards, INSET adopts a multi-task learning framework to train the structure. Specifically, given the ground truth label L, the cross entropy loss function CE is used to calculate the loss as follows:
[0091]
[0092] in and Indicates p b and p c The probability distribution of , α∈(0,1) is a hyperparameter that controls the magnitude of the loss value.
[0093] Model predictions
[0094] When it comes to the use of INSET, given a test question Q i e INSET initially obtains (D t ,Q i e ) to reformulate the input and then try to generate the rationale, i.e.
[0095]
[0096] Where e indicates that the experiment is conducted on the test dataset. Then, INSET uses Generate relevant clues to enrich the original reasoning process, thereby obtaining Facilitates obtaining probability distribution in the enhanced reasoning step
[0097] After INSET training is completed, only F in formula (1) b As an enhancement It predicts (question, reason, answer) and and The combination of determines the final result. Mathematically speaking,
[0098]
[0099] Among them, β∈(0,1) represents the balance weight adjusted in the training dataset. Support the predicted choice, and the result with the highest probability will be determined as the answer.
[0100] The present invention is experimentally evaluated on three datasets:
[0101] PhysioNet- provides multiple cardiovascular disease-related datasets, such as an electrocardiogram database for cardiac signal analysis and the development of diagnostic algorithms. It is a multi-hop question-answering dataset in which correct and incorrect predictions are balanced;
[0102] ClinicalTrials.gov-is a global clinical trial registry that contains detailed information on ongoing and completed clinical trials. It is very useful for drug development and efficacy evaluation research and contains three types of fact labels, namely "support", "refutation" and "inadequate information";
[0103] DrugBank-is a comprehensive drug information database that contains drug chemical structures, pharmacological properties, target information and drug interaction data. It is crucial for drug research and development. It is a multi-hop question-answering dataset that explores structured formats in the data and uses logical rules.
[0104] Competitors. To evaluate the results of this application, this application involved several competitive benchmarks:
[0105] Standard prediction (Stand): Given the same manual example, directly predict the answer based on the input;
[0106] Original CoT (CoT-Ori): After generating the reasoning path, predict the answer;
[0107] CoT and self-consistency (CoT-SC): According to the settings in the paper, 5 CoT trajectories were sampled and the decoding temperature was 0.7;
[0108] ReAct: A reasoning and action framework that attempts to enhance CoT by using the Wikipedia API;
[0109] VE: The post-editing framework aims to improve the realism of predictions based on external knowledge.
[0110] To avoid errors in hyperparameters, each experiment follows the default parameters reported in the original paper.
[0111] Metrics. To evaluate the performance of INSET, we use two metrics:
[0112] Exact Match (EM): EM represents the percentage of predictions that exactly match the ground truth.
[0113] Potential Matches (PM): PM represents the percentage of samples whose output is incorrect but contain the correct answer in the attempt.
[0114] execution. In order to comprehensively analyze the proposed framework and make the cost controllable, the open source base model Llama2-13B is adopted as the backbone of INSET in one embodiment. In order to ensure the fairness of the experiment, the same basis is used to support competitors for comparison. The experiments are conducted using 2*RTX 3090. For SBERT, the full MiniLML6-v2 is applied as the initial pre-trained weights. We use the training dataset of each task as an instance to train INSET and the evaluation dataset to evaluate the performance. The number of manual examples is set to 6-samples and the number of attempts is set to 5. In order to balance the contribution to the overall loss, α=0.1, and β is specified as 0.5 for similar objectives. The dropout value in SimCSE is set to 0.1.
[0115] Since LLM only makes one attempt in Stand and CoT-Ori, no PM value is available. In addition, it is obvious that the introduction of CoT-SC does not significantly improve the EM value; specifically, it only improves by 0.33% compared to CoT-Ori. This observation is consistent with human intuition, as CoT-SC simply repeats the original inference multiple times. Without a dedicated understanding of the previous rationale, accurately identifying attempts becomes challenging, resulting in its PM value being almost half of that of EM (10.39% vs. 25.65%). INSET aims to encourage LLM to understand the explicit and implicit characteristics of its attempts and evolve based on them. EM is improved by 5.52% and PM is reduced by 8.12%, which is an excellent performance, demonstrating the rationality of our motivation and the effectiveness of the proposed method.
[0116] In ReAct and VE, CoT-SC is used to generate a consistency value for each question, and the questions are below the threshold and need to rely on an external knowledge base to modify the results. On the surface, these two methods may be considering errors; however, they do not care about the fundamental difference between them and try to use external applications to correct the predictions. In other words, the improvement in performance mainly comes from the incorporation of high-quality facts rather than LLM itself. The effectiveness of these two methods is limited, as shown by their EM values (i.e., 24.35% and 28.25%). Notably, ReAct even leads LLM astray and erroneously changes the correct predictions. This behavior leads to a 1.30% reduction in EM compared to CoT-SC. While the results validate the design, INSET is in a completely different angle and outperforms them by 6.82% and 2.92%, respectively. This situation shows that once we identify the basic core of LLMs, their capabilities can promote impressive progress, such as reasoning chains in CoT and unique features in INSET.
[0117] In order to vividly demonstrate the differences between the above methods, this application provides prediction examples of the same problem in the PhysioNet dataset, such as Figure 2-Figure 4 shown.
[0118] Clearly, the reasoning process in ReAct becomes unpredictable after 1 or 2 steps. Its self-guidance framework, i.e., Think-Act-Observe, leads LLMs astray on irrelevant contexts, deepening their confusion on the given problem. Although VE asks validation questions to supervise the original problem, these queries simply reiterate the main points without going deeper, leading to the same incorrect predictions. Comparison with INSET results strongly supports our motivation, where the understanding of prior principles intrinsically contributes to the LLM’s capabilities.
[0119] This application proposes a novel and comprehensive INSET method to enhance the discrimination ability of LLM by evolving from previous principles. Building on the evolutionary path followed by humans and the idea of contrastive learning, this application introduces two modules: internal guidance and external promotion. By guiding LLM to summarize clues based on correct and incorrect results, the model is able to understand, especially errors, and thus achieve self-improvement. In addition, through contrastive learning, this application encourages the model to focus on the distinction between two categories of basic principles. Experiments demonstrate the superiority of INSET; for example, by incorporating only the internal guidance module, this application achieves advanced performance in most reasoning tasks.
[0120] As used herein, the word "preferred" is intended to be used as an example, instance, or illustration. Any aspect or design described herein as "preferred" is not necessarily to be construed as being more advantageous than other aspects or designs. On the contrary, the use of the word "preferred" is intended to present concepts in a specific way. The term "or" as used in this application is intended to mean an inclusive "or" rather than an exclusive "or". That is, unless otherwise specified or clear from the context, "X uses A or B" means any one of the naturally included permutations. That is, if X uses A; X uses B; or X uses both A and B, then "X uses A or B" is satisfied in any of the foregoing examples.
[0121] Moreover, although the present disclosure has been shown and described with respect to one or implementations, those skilled in the art will think of equivalent variations and modifications based on the reading and understanding of this specification and the accompanying drawings. The present disclosure includes all such modifications and variations, and is limited only by the scope of the appended claims. In particular, with respect to the various functions performed by the above-mentioned components (such as elements, etc.), the terms used to describe such components are intended to correspond to any component (unless otherwise indicated) that performs the specified function of the component (such as it is functionally equivalent), even if the structure is not equivalent to the disclosed structure of the function in the exemplary implementation of the present disclosure shown herein. In addition, although the specific features of the present disclosure have been disclosed with respect to only one of several implementations, such features can be combined with one or other features of other implementations that may be desired and advantageous for a given or specific application. Moreover, insofar as the terms "including", "having", "containing" or their variations are used in specific embodiments or claims, such terms are intended to be included in a manner similar to the term "comprising".
[0122] The functional units in the embodiments of the present invention may be integrated into a processing module, or each unit may exist physically separately, or multiple or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc. The above-mentioned devices or systems may execute the storage method in the corresponding method embodiment.
[0123] To sum up, the above embodiment is an implementation mode of the present invention, but the implementation mode of the present invention is not limited by the embodiment. Any other changes, modifications, substitutions, combinations, and simplifications that deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A method for generating answers to questions based on a large language model, characterized in that: The following steps are involved: Get medical questions, use manual annotations as examples to build medical question prompts; Generate preliminary attempts based on the CoT-SC algorithm; Compare correct and incorrect initial attempts and summarize clues that may help answer the question; Modify prompts based on clues and make reinforcement attempts; Use the enhanced attempts obtained in the above stage as positive and negative samples to train a lightweight professional classifier; Use contrastive learning to enlarge the semantic distance between correct and incorrect results in the representation space; Output answers to medical questions.
2. The method for generating question answers based on a large language model according to claim 1, characterized in that: The attempts include: Use the base model to repeatedly predict question Q from the training dataset i t , i is the i-th question in a given data set, and t limits the current data source to the training set; Randomly select a number of questions and manually provide corresponding reasons and answers to construct example D t ; (D t , Q i t ) as a hint to guide the large language model to reason in the form of instances; The correctness of each rationale is determined based on the annotated labels of the training samples; in order to refine the features of different categories, a set of attempts with both correct and incorrect predictions are selected as material for further processing.
3. The method for generating question answers based on a large language model according to claim 2, characterized in that: The summary includes: guiding the large language model to distinguish accurate and incorrect results by instructions to focus on the logical coherence within the text sequence; for Q i t ,R 1 t +A 1 t ,...,R m t +A m t , generating clues from the large language model itself, where R t Indicates the basic principle, A t denotes the corresponding prediction and m denotes the number of attempts after augmentation.
4. The method for generating question answers based on a large language model according to claim 3, characterized in that: The enhancement uses the acquired clues as experience to drive further reasoning process; requiring the large language model to pay attention to the previous key points in the prompt; The clues are populated by the most consistent predictions obtained in the initial attempt step of generating; Then, the clues are in the form of questions, clues, reasons, and answers, i.e. D' t Examples of the richness of form; Finally, updated examples are randomly selected as components of the prompt.
5. The method for generating question answers based on a large language model according to claim 4, characterized in that: Use the results as positive and negative samples to train lightweight specialized classifiers, including: The enhanced attempt is transformed as follows: in represents the correction result of the i-th question and the j-th prediction, is the rationale for the jth prediction, represents the j-th prediction, [CLS] and [SEP] are the only tokens in the language model; apply the SBERT algorithm to obtain its representation Through a single-layer binary classifier F b To determine whether the answer is correct, that is: where p b represents the generation probability of the i-th question and the j-th prediction.
6. The method for generating question answers based on a large language model according to claim 5, characterized in that: The contrastive learning includes: For each correct reasoning path in the same problem, treat its representation as an anchor, and treat other correct instances as positive examples and incorrect paths as negative examples; When only one correct reasoning path is available, the dropout mechanism is used to construct the corresponding positive instance, namely: Where τ is the temperature hyperparameter, cos() is the cosine similarity function, k represents the target reorganization result, Y represents the negative label set and the positive label set, is the representation of the revised result of the i-th question and the k-th prediction; Afterwards, a multi-task learning framework is adopted to train the structure; that is, given the ground truth label L, the loss is calculated using the cross entropy loss function CE as follows: in and Indicates p b and p c The probability distribution of , α∈(0,1) is a hyperparameter that controls the magnitude of the loss value.
7. The method for generating question answers based on a large language model according to claim 6, characterized in that: The model predictions include: Given a test question Q i e , according to the obtained (D t ,Q i e ) to reformulate the input and then try to generate the rationale, i.e. Where e indicates that the experiment is conducted on the test data set; use Generate relevant clues, which means that the clues are closely related to the current question to obtain a probability distribution After training, the binary classifier F b As an enhancement A complementary tool, predicting The questions, reasons, and answers in Will and The final result is a combination of Mathematically it is: Among them, β∈(0,1) represents the balance weight adjusted in the training dataset, Indicates the choice that supports the prediction, the final result with the highest probability will be determined as the answer.
Citation Information
Cited By
Conversation record question and answer method and system based on thinking chain and agent reflection mechanism
CN120104761A