Medical field large model pre-training and fine tuning method and device based on knowledge graph

By combining high-quality medical text data and encoded medical knowledge graphs in large language models for pre-training and fine-tuning of instructions, the problem of insufficient professionalism when applied to the general large language model in the medical field is solved, and the professionalism and interpretability of the model are improved.

CN119514674AActive Publication Date: 2025-02-25HANGZHOU COOPER MEDICAL TECH CO LTD

Patent Information

Application Number
CN202411400141.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2025-02-25
Estimated Expiration
2044-10-09

AI Technical Summary

Technical Problem

The existing universal large language model is difficult to handle complex clinical information and provide accurate diagnostic or treatment advice due to lack of expertise and logical reasoning capabilities when applied in the medical field.

Method used

The reward model is trained to filter high-quality medical-related text data, and alternately input the encoded medical knowledge graph with high-quality data into a large language model for pre-training. The pre-trained model is then fine-tuned to the pre-trained model to improve the professionalism and interpretability of the model.

Benefits of technology

It improves the professionalism and reasoning ability of large-language models in the medical field, enables the model to handle medical-related tasks more accurately and provides interpretable reasoning paths, enhancing the application value of the model in the medical field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119514674A_ABST
    Figure CN119514674A_ABST
Patent Text Reader

Abstract

The invention discloses a medical field large model pre-training and fine tuning method and device based on a knowledge graph, and the method comprises the steps: training a reward model through employing collected medical related text data and a quality marking result, and screening out high-quality data from the newly obtained medical related text data through employing the trained reward model; coding the medical knowledge graph into a text format processed by a large language model, and alternately inputting the high-quality data and the coded medical knowledge graph into the large language model in different batches for model pre-training; and designing an instruction fine tuning data format comprising an instruction, a knowledge graph reasoning path and a generated answer, inputting a training sample constructed in the instruction fine tuning data format into the pre-trained large language model for model fine tuning, and outputting a final answer and reasoning path according to the instruction newly input by the user by utilizing the fine-tuned large language model. According to the method, the professionality of the large language model in the medical field can be effectively improved, and AI application in high-risk fields such as medical treatment is promoted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of large model training in the vertical field of medicine, and specifically relates to a method and device for pre-training and fine-tuning large models in the medical field based on a knowledge graph. Background Art

[0002] In recent years, with the rapid development of artificial intelligence technology, large language models (LLMs) have made great breakthroughs in the field of natural language processing (NLP), showing powerful language understanding and generation capabilities, and are changing the way humans interact with machines at an unprecedented speed. These large language models, such as the GPT series, BERT and its derivative models, are trained on massive text data through deep learning technology. They not only learn the complex structure of human language, but also can complete a variety of tasks from simple text classification and sentiment analysis to complex question-answering systems and text creation, greatly broadening the application boundaries of natural language processing.

[0003] However, although large language models have achieved remarkable results in the general field of natural language processing, their performance is often unsatisfactory when applied to highly specialized fields such as medicine. Since the medical field is highly professional and complex, involving a large number of professional terms, concepts and relationships, this places higher demands on the professional knowledge reserve and reasoning ability of large language models.

[0004] The medical field is a knowledge-intensive and highly specialized industry with a vast and constantly updated knowledge system. From basic anatomy and physiology to complex pathology and pharmacology, and to cutting-edge gene editing and immunotherapy, medical knowledge covers a wide range of content from micro to macro, from basic to clinical. In addition, the medical field is also filled with a large number of professional terms, abbreviations, and unique expressions, which pose a huge challenge to the understanding ability of language models.

[0005] Current large language models mainly rely on general text data on the Internet for training. Although this data is massive, it often lacks the professionalism and depth in the medical field. Therefore, when the model handles medical-related tasks, it often seems powerless due to the lack of necessary professional knowledge reserves.

[0006] In addition, medical decisions often require logical reasoning and judgment based on complex clinical information, including but not limited to the patient's medical history, symptoms, signs, laboratory test results, imaging data, etc. However, existing large language models still have deficiencies in logical reasoning and contextual understanding, making it difficult for them to comprehensively consider multiple factors like professional doctors and make accurate diagnoses or treatment recommendations.

[0007] Therefore, it is necessary to further explore innovative large model training methods in the medical vertical field, such as pre-training and fine-tuning of large language models by combining traditional free-text corpus training with medical knowledge graph training, so as to solve the problem of insufficient professionalism of existing general large language models when applied in the medical field. Summary of the invention

[0008] In view of the above, the purpose of the present invention is to provide a method and device for pre-training and fine-tuning of a large model in the medical field based on a knowledge graph. The large language model is alternately pre-trained after the training reward model screens out high-quality data and combines it with the encoded knowledge graph, and then the pre-trained large language model is fine-tuned by instructions to obtain the model reasoning results and reasoning paths. The professionalism of the large language model in the medical field can be improved, and the interpretability, transparency and knowledge consistency of the reasoning results can be ensured, which is crucial for AI applications in high-risk fields such as medical care. In addition, the method and device provided by the present invention also demonstrate how to effectively inject domain-specific structured knowledge into large-scale language models, thereby providing new ideas for the development of large models in other professional fields, having broad technical promotion value, and pointing the way for the development of artificial intelligence in a more professional and reliable direction.

[0009] In order to achieve the above-mentioned invention object, the technical solution provided by the present invention is as follows:

[0010] The embodiment of the present invention provides a method for pre-training and fine-tuning a large model in the medical field based on a knowledge graph, comprising the following steps:

[0011] The reward model is trained using the collected medical-related text data and its quality annotation results, and the trained reward model is used to filter out high-quality data from the newly acquired medical-related text data;

[0012] Encode the medical knowledge graph into a text format that can be processed by a large language model, and alternately input high-quality data and the encoded medical knowledge graph into the large language model in different batches for model pre-training;

[0013] Design an instruction fine-tuning data format that includes instructions, knowledge graph reasoning paths, and generated answers. Input the training samples constructed in the instruction fine-tuning data format into the pre-trained large language model for model fine-tuning. Use the fine-tuned large language model to output the final answer and reasoning path based on the new instructions input by the user.

[0014] Preferably, the method of training the reward model using the collected medical-related text data and its quality annotation results includes:

[0015] Select several medical topics, each of which corresponds to two medical-related text contents of different qualities, and manually annotate the two medical-related text contents of different qualities corresponding to each topic into annotated text pairs including high-quality text contents and low-quality text contents through multi-dimensional evaluation;

[0016] The reward model is trained using a direct preference optimization algorithm. The annotated text pairs corresponding to each topic are input into the reward model. The reward model determines the high-quality text content in the annotated text pairs and gives corresponding quality scores, as well as determines the low-quality text content and gives corresponding quality scores.

[0017] Preferably, the method of using the trained reward model to screen out high-quality data from newly acquired medical-related text data includes:

[0018] The newly acquired medical-related text data is input into the trained reward model, and the reward model outputs the corresponding quality score. The medical-related text data with a quality score higher than the set quality threshold is retained as high-quality data.

[0019] Preferably, the method further comprises continuously optimizing the reward model, including:

[0020] Regularly sample and check the quality screening results and have them manually verified by medical experts. Adjust the quality threshold or update the reward model based on the verification results. Collect new manually annotated text pair data and retrain the reward model regularly.

[0021] Preferably, the reward model adopts the Qwen2-7B model as the basic model.

[0022] Preferably, encoding the medical knowledge graph into a text format for large language model processing includes:

[0023] The information in the medical knowledge graph exists in the form of triples, which include a head entity, a relationship, and a tail entity. Each triple is encoded in the following format:

[0024] <|node_start|>head entity<|node_end|><|relation_start|>relationship<|relation_end|><|node_start|>tail entity<|node_end|>;

[0025] Among them, <|node_start|> and <|node_end|> are used to identify the nodes in the medical knowledge graph, namely the head entity and the tail entity, and <|relation_start|> and <|relation_end|> are used to identify the relationship between nodes.

[0026] Preferably, a node-centric processing method is adopted to capture the local structure of the knowledge graph. For each starting node, all triples related to it are collected to form a subgraph. Each subgraph will be put into a batch for input into a large language model for model pre-training.

[0027] Preferably, in the instruction fine-tuning data format, the instruction is the user's question or task description, the knowledge graph reasoning path is the medical knowledge graph reasoning steps required to answer the question, and the generated answer is the final answer based on the reasoning path.

[0028] Preferably, the reasoning path output by the fine-tuned large language model is visualized using knowledge graph visualization technology.

[0029] To achieve the above-mentioned purpose of the invention, the embodiment of the present invention further provides a large model pre-training and fine-tuning device in the medical field based on knowledge graph, comprising: a data quality screening module, a model pre-training module and a model fine-tuning module;

[0030] The data quality screening module is used to train a reward model using the collected medical-related text data and its quality annotation results, and use the trained reward model to screen out high-quality data from the newly acquired medical-related text data;

[0031] The model pre-training module is used to encode the medical knowledge graph into a text format that can be processed by a large language model, and alternately input high-quality data and the encoded medical knowledge graph into the large language model in different batches for model pre-training;

[0032] The model fine-tuning module is used to design an instruction fine-tuning data format including instructions, knowledge graph reasoning paths and generated answers, input the training samples constructed in the instruction fine-tuning data format into the pre-trained large language model for model fine-tuning, and use the fine-tuned large language model to output the final answer and reasoning path according to the new instructions input by the user.

[0033] Compared with the prior art, the present invention has the following beneficial effects:

[0034] (1) The present invention automatically screens and retains high-quality data in medical-related text data by training a reward model, thereby effectively improving the quality and reliability of the pre-trained data of the large language model, and improving the reliability and accuracy of the pre-trained large language model.

[0035] (2) The present invention introduces a dual pre-training data source. In addition to the free text prediction of high-quality data, the encoded medical knowledge graph data is also introduced as pre-training data. The medical knowledge graph contains rich medical concepts, entities and the complex relationships between them, which enables the large language model to learn unstructured high-quality data and structured medical knowledge graph knowledge respectively, thereby improving the professionalism of the large language model in the medical field.

[0036] (3) The present invention encodes the medical knowledge graph so that the large language model can effectively encode and represent the structured information in the knowledge graph, and through alternating training of different batches, the model can not only understand natural language, but also understand the structure of the knowledge graph, thereby improving the comprehensiveness and effectiveness of model pre-training.

[0037] (4) The present invention fine-tunes the pre-trained large language model by designing a special instruction fine-tuning data format, so that the large language model can use the learned knowledge graph knowledge for reasoning, and finally the training model generates a reasoning path based on the knowledge graph, thereby improving the interpretability of the model in answering complex medical questions. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 It is a flowchart of a method for pre-training and fine-tuning a large model in the medical field based on a knowledge graph provided in an embodiment of the present invention;

[0040] Figure 2 It is a structural diagram of a large model pre-training and fine-tuning device in the medical field based on a knowledge graph provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0041] To make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.

[0042] The inventive concept of the present invention is: in view of the problem of insufficient professionalism of general large language models in the prior art when applied in the medical field, the embodiments of the present invention provide a method and device for pre-training and fine-tuning of a large model in the medical field based on a knowledge graph. In the pre-training stage, high-quality data is screened by training a reward model, and the knowledge graph is encoded by encoding technology. The high-quality data and the encoded knowledge graph are used alternately in the pre-training process, and the model learns unstructured text and structured knowledge respectively; in the fine-tuning stage, a special instruction fine-tuning data format is designed to input the pre-trained large language model, so that the model outputs the inference result and the inference path, thereby ensuring the interpretability, transparency and knowledge consistency of the inference result.

[0043] Figure 1 Schematic diagram of the process of pre-training and fine-tuning a large model in the medical field based on a knowledge graph provided by an embodiment of the present invention. Figure 1 As shown, the embodiment provides a method for pre-training and fine-tuning a large model in the medical field based on a knowledge graph, comprising the following steps:

[0044] S1, uses the collected medical-related text data and its quality annotation results to train the reward model, and uses the trained reward model to screen out high-quality data from the newly acquired medical-related text data.

[0045] In the embodiment, when pre-training a large language model in the medical field, the problem of uneven quality of content of a large number of medical knowledge websites crawled from the Internet is faced. Therefore, in order to ensure that high-quality data is used for model training, a data quality screening method based on the RLHF (Reinforcement Learning from Human Feedback) idea in reinforcement learning is developed. The core of this method is to train a reward model to evaluate the quality of web page content. The specific implementation steps are as follows:

[0046] (1) Data collection and annotation

[0047] First, we collected a large amount of medical-related web content and performed manual labeling to train the reward model. Specifically, we:

[0048] a) Select 1,000 medical topics, each of which corresponds to two web pages of different quality;

[0049] b) Medical experts evaluate the content of these web pages from multiple dimensions such as accuracy and harmfulness of the content;

[0050] c) Based on the expert evaluation results, a pair of web pages including one high-quality content and one low-quality content is marked for each topic.

[0051] (2) Reward model training

[0052] The Qwen2-7B model is used as the basic model, and the DPO (Direct Preference Optimisation) algorithm is used for training to obtain the reward model. The training process is as follows:

[0053] a) Input: Each training sample contains a pair of web pages with high-quality content and low-quality content on the same topic;

[0054] b) Goal: Enable the reward model to distinguish high-quality content from low-quality content and give corresponding scores;

[0055] c) Optimization: Through the DPO algorithm, the reward model learns human preferences and gradually improves its ability to judge content quality.

[0056] (3) Large-scale content scoring

[0057] Use the trained reward model to score all crawled medical web page content:

[0058] a) Input each web page content into the reward model;

[0059] b) The model outputs a quality score, with the score range set from 0 to 100. The quality score takes into account multiple aspects such as the accuracy, reliability, and harmfulness of the content.

[0060] (4) Data screening

[0061] Based on the scoring results of the reward model, data screening is performed:

[0062] a) setting a quality threshold, which is set to 75 points in the embodiment;

[0063] b) Only webpages with quality scores above the quality threshold are retained. Data screening can effectively filter out low-quality webpages that may contain false information or harmful content.

[0064] (5) Continuous Optimization

[0065] In order to ensure the quality of screening and adapt to new content characteristics, the following measures are taken:

[0066] a) Regular sampling and quality screening results are manually verified by medical experts.

[0067] b) Based on the verification results, adjust the quality score threshold or update the reward model.

[0068] c) Collect new manually annotated data and retrain the reward model regularly.

[0069] This method can effectively filter out high-quality data from massive medical webpage content for large language model pre-training. This not only improves the quality of training data, but also indirectly enhances the reliability and accuracy of the final large language model. This method combines manual expert judgment and machine learning technology, and can efficiently process large-scale data, laying a solid foundation for building a high-quality medical knowledge base and training reliable medical AI models.

[0070] S2, encodes the medical knowledge graph into a text format that can be processed by a large language model, and alternately inputs high-quality data and the encoded medical knowledge graph into the large language model in different batches for model pre-training.

[0071] In the embodiment, for the pre-training of the large language model in the medical vertical field, the encoding of the knowledge graph is a key link. A novel encoding method is developed to convert the structured medical knowledge graph information into a text format that can be processed by the large language model. The specific implementation method is as follows:

[0072] (1) Special mark introduction

[0073] In order to distinguish and identify different elements of the knowledge graph in the text, a series of special tokens are introduced:

[0074] <|node_start|> and <|node_end|>: used to identify nodes in the knowledge graph;

[0075] <|relation_start|> and <|relation_end|>: used to identify the relationship between nodes.

[0076] (2) Triplet encoding

[0077] The information in the knowledge graph exists in the form of triples (head entity, relationship, tail entity). Each triple is encoded in the following format:

[0078] <|node_start|>head entity<|node_end|><|relation_start|>relationship<|relation_end|><|node_start|>tail entity<|node_end|>.

[0079] For example, for the triple ("aspirin", "used to treat", "fever"), the encoded text is:

[0080] <|node_start|>Aspirin<|node_end|><|relation_start|> is used to treat <|relation_end|><|node_start|>fever<|node_end|>.

[0081] (3) Node Centralization Processing

[0082] Taking into account the limited capacity of the large language model and in order to better capture the local structure of the knowledge graph, a node-centric processing approach is adopted. For each starting node, all triples related to it are collected to form a subgraph. Each subgraph will be put into a batch for input into the large language model for model pre-training.

[0083] (4) Batch Generation Strategy

[0084] When generating training batches, a separation strategy is adopted:

[0085] a) Knowledge graph batch: contains the encoded knowledge graph triples;

[0086] b) Normal text batch: contains regular high-quality free-text data.

[0087] These two types of batches are used alternately during the pre-training process of the large language model, but are not mixed in the same batch. This approach prevents the two types of data from interfering with each other, while allowing the large language model to learn structured knowledge and unstructured text separately.

[0088] S3, designs the instruction fine-tuning data format including instructions, knowledge graph reasoning paths and generated answers, inputs the training samples constructed in the instruction fine-tuning data format into the pre-trained large language model for model fine-tuning, and uses the fine-tuned large language model to output the final answer and reasoning path according to the new instructions input by the user.

[0089] In the embodiment, the large language model in the medical vertical field adopts an innovative knowledge graph reasoning mechanism in the fine-tuning stage, aiming to improve the reasoning ability and interpretability of the large language model. The specific technical implementation method is as follows:

[0090] (1) Special instructions to fine-tune the data format

[0091] A special instruction fine-tuning data format is designed, and each training sample contains three key components:

[0092] a) Instruction: user's problem or task description;

[0093] b) KG Reasoning Path: the knowledge graph reasoning steps required to answer the question;

[0094] c) Generated Answer: The final answer based on the reasoning path.

[0095] This format is designed to allow the model to learn how to reason with the knowledge graph and generate corresponding answers.

[0096] (2) Knowledge Graph Reasoning Path

[0097] The reasoning path is a series of connected knowledge graph triples, representing the reasoning process from question to answer, and each triple contains the structure of (entity 1, relationship, entity 2). For example:

[0098] (Aspirin, used to treat fever) -> (fever, is a symptom, cold) -> (cold, recommended medication, ibuprofen).

[0099] The symbol -> represents the reasoning logic, that is, the process from one reasoning result to another. This representation method enables the large language model to learn and follow the knowledge graph structure obtained in the pre-training phase.

[0100] (3) Model training process

[0101] During the fine-tuning process of the large language model, the large language model improves its reasoning ability by learning these special instructions to fine-tune the data format. The large language model not only learns to generate correct answers, but also learns how to build a reasonable reasoning path. This training method ensures that the reasoning process of the large language model follows the knowledge graph knowledge learned during pre-training.

[0102] (4) Output of the Reasoning Phase

[0103] When the fine-tuned large language model performs inference, it not only gives the final answer, but also outputs the reasoning path used to obtain the answer. This reasoning path reflects how the model uses the information in the knowledge graph to answer the question.

[0104] (5) Reasoning Path Visualization

[0105] Based on the reasoning path output by the large language model, the existing knowledge graph visualization technology is used for visualization. Through visualization, the reasoning process of the large language model becomes more transparent and easy to understand, allowing users to clearly see how the model reasoned from the initial question to the final answer step by step. By outputting the reasoning path and supporting its visualization, this method significantly improves the interpretability and transparency of the model. Users can not only see the final answer, but also understand how the model came up with this answer. This is especially important in fields such as medicine that require high reliability and interpretability. Since the reasoning process of the large language model follows the knowledge graph structure learned in the pre-training phase, this method also helps to ensure the consistency and reliability of the large language model output, thereby reducing the possibility of the model generating answers that are inconsistent with known medical knowledge.

[0106] In summary, the method for pre-training and fine-tuning a large model in the medical field based on a knowledge graph provided by an embodiment of the present invention breaks through the limitation of traditional large language models that only rely on free text training, and organically integrates structured professional knowledge, which not only improves the performance of the model in the medical field, but also enhances its reasoning ability and interpretability. By generating a reasoning path based on a knowledge graph, the decision-making process of the model becomes more transparent. The large language model in the medical field after pre-training and fine-tuning has broad application prospects. It can provide more accurate and professional medical consultation and preliminary diagnosis suggestions in intelligent consultation, provide doctors with evidence-based diagnosis and treatment plan recommendations in decision support, assist in literature review, hypothesis generation and experimental design in medical research, provide personalized learning and simulation training for medical students in medical education, and assist in patient screening, data analysis and report generation in clinical trials.

[0107] Based on the same inventive concept, Figure 2 As shown, an embodiment of the present invention also provides a large model pre-training and fine-tuning device 200 in the medical field based on a knowledge graph, including: a data quality screening module 210, a model pre-training module 220 and a model fine-tuning module 230.

[0108] The data quality screening module 210 is used to train a reward model using the collected medical-related text data and its quality annotation results, and use the trained reward model to screen out high-quality data from newly acquired medical-related text data.

[0109] The model pre-training module 220 is used to encode the medical knowledge graph into a text format that can be processed by a large language model, and alternately input high-quality data and the encoded medical knowledge graph into the large language model in different batches for model pre-training.

[0110] The model fine-tuning module 230 is used to design an instruction fine-tuning data format including instructions, knowledge graph reasoning paths and generated answers, input the training samples constructed in the instruction fine-tuning data format into the pre-trained large language model for model fine-tuning, and use the fine-tuned large language model to output the final answer and reasoning path according to the new instructions input by the user.

[0111] It should be noted that the device for pre-training and fine-tuning a large model in the medical field based on the knowledge graph provided in the above-mentioned embodiment belongs to the same inventive concept as the method for pre-training and fine-tuning a large model in the medical field based on the knowledge graph. The specific implementation process is detailed in the embodiment of the method for pre-training and fine-tuning a large model in the medical field based on the knowledge graph, which will not be repeated here.

[0112] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for pre-training and fine-tuning a large model in the medical field based on knowledge graph, characterized in that: The following steps are involved: The reward model is trained using the collected medical-related text data and its quality annotation results, and the trained reward model is used to filter out high-quality data from the newly acquired medical-related text data; Encode the medical knowledge graph into a text format that can be processed by a large language model, and alternately input high-quality data and the encoded medical knowledge graph into the large language model in different batches for model pre-training; Design an instruction fine-tuning data format that includes instructions, knowledge graph reasoning paths, and generated answers. Input the training samples constructed in the instruction fine-tuning data format into the pre-trained large language model for model fine-tuning. Use the fine-tuned large language model to output the final answer and reasoning path based on the new instructions input by the user.

2. The method for pre-training and fine-tuning a large medical model based on a knowledge graph according to claim 1, characterized in that: The method of training the reward model using the collected medical-related text data and its quality annotation results includes: Select several medical topics, each of which corresponds to two medical-related text contents of different qualities, and manually annotate the two medical-related text contents of different qualities corresponding to each topic into annotated text pairs including high-quality text contents and low-quality text contents through multi-dimensional evaluation; The reward model is trained using a direct preference optimization algorithm. The annotated text pairs corresponding to each topic are input into the reward model. The reward model determines the high-quality text content in the annotated text pairs and gives corresponding quality scores, as well as determines the low-quality text content and gives corresponding quality scores.

3. The method for pre-training and fine-tuning a large medical model based on a knowledge graph according to claim 2, characterized in that: The trained reward model is used to filter out high-quality data from newly acquired medical-related text data, including: The newly acquired medical-related text data is input into the trained reward model, and the reward model outputs the corresponding quality score. The medical-related text data with a quality score higher than the set quality threshold is retained as high-quality data.

4. The method for pre-training and fine-tuning a large medical model based on a knowledge graph according to claim 3, characterized in that: The method also includes continuously optimizing the reward model, including: Regularly sample and check the quality screening results and have them manually verified by medical experts. Adjust the quality threshold or update the reward model based on the verification results. Collect new manually annotated text pair data and retrain the reward model regularly.

5. The method for pre-training and fine-tuning a large model in the medical field based on a knowledge graph according to claim 1 or 4, characterized in that: The reward model uses the Qwen2-7B model as the basic model.

6. The method for pre-training and fine-tuning a large medical model based on a knowledge graph according to claim 1, characterized in that: The encoding of the medical knowledge graph into a text format for processing by a large language model includes: The information in the medical knowledge graph exists in the form of triples, which include a head entity, a relationship, and a tail entity. Each triple is encoded in the following format: <|node_start|>head entity<|node_end|><|relation_start|>relationship<|relation_end|><|node_start|>tail entity<|node_end|>; Among them, <|node_start|> and <|node_end|> are used to identify the nodes in the medical knowledge graph, namely the head entity and the tail entity, and <|relation_start|> and <|relation_end|> are used to identify the relationship between nodes.

7. The method for pre-training and fine-tuning a large medical model based on a knowledge graph according to claim 6, characterized in that: A node-centric processing method is used to capture the local structure of the knowledge graph. For each starting node, all triples related to it are collected to form a subgraph. Each subgraph will be put into a batch for input into a large language model for model pre-training.

8. The method for pre-training and fine-tuning a large medical model based on a knowledge graph according to claim 1, characterized in that: In the instruction fine-tuning data format, the instruction is the user's question or task description, the knowledge graph reasoning path is the medical knowledge graph reasoning steps required to answer the question, and the generated answer is the final answer based on the reasoning path.

9. The method for pre-training and fine-tuning a large medical model based on a knowledge graph according to claim 1, characterized in that: The knowledge graph visualization technology is used to visualize the reasoning path output by the fine-tuned large language model.

10. A large model pre-training and fine-tuning device in the medical field based on knowledge graph, characterized in that: include: Data quality screening module, model pre-training module and model fine-tuning module; The data quality screening module is used to train a reward model using the collected medical-related text data and its quality annotation results, and use the trained reward model to screen out high-quality data from the newly acquired medical-related text data; The model pre-training module is used to encode the medical knowledge graph into a text format that can be processed by a large language model, and alternately input high-quality data and the encoded medical knowledge graph into the large language model in different batches for model pre-training; The model fine-tuning module is used to design an instruction fine-tuning data format including instructions, knowledge graph reasoning paths and generated answers, input the training samples constructed in the instruction fine-tuning data format into the pre-trained large language model for model fine-tuning, and use the fine-tuned large language model to output the final answer and reasoning path according to the new instructions input by the user.

Citation Information

Patent Citations

  • Liver cancer auxiliary diagnosis and question answering method and system based on large language model and medium

    CN116975241A

  • Knowledge graph generation type question answering method and system based on large language model

    CN117033608A

  • Data knowledge dual-drive intelligent medical dialogue system and method based on knowledge graph

    CN117077786A

  • Causal medical knowledge graph construction method based on large-scale pre-training language model

    CN117668245A

  • Knowledge graph construction method and device, equipment and storage medium

    CN117952208A

Cited By

  • An intelligent annotation method and system for semantic structural units in medical texts

    CN119783681A

  • Automatic iteration method and system of medical identification and diagnosis model and storage medium

    CN119851965A

  • Industrial large language model training method and device based on reinforcement learning

    CN120278270A

  • Digital intelligent treatment auxiliary method based on generative AI large model

    CN120278403A

  • Text data synthesis method and system for helicobacter pylori special disease model

    CN120745808A