Chinese medical large language model training method and device
Through medical text pre-learning, supervised fine-tuning and knowledge feedback reinforcement learning, the 'hallucination' phenomenon when the Chinese medical large language model generates answers is solved, improving its accuracy and robustness in the medical field, and solving the problems in the existing technology. Problems with inaccurate information.
Patent Information
- Application Number
- CN202410949277.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-16
AI Technical Summary
The existing Chinese medical large language model is prone to 'hallucination' when generating answers, resulting in low information accuracy and hindering its application in the professional medical field.
Conduct pre-learning training on the preset large language model through medical texts, use the open source Chinese medical examination data set for supervised fine-tuning training, and build a knowledge graph and reinforcement learning data set to conduct reinforcement learning training based on knowledge feedback to solve the problem of model overshooting. Fitting problem.
It improves the accuracy of large language model answers in the medical field, fully aligns its output with professional medical knowledge, reduces computational complexity and memory requirements, and enhances the model's robustness and adaptability.
Smart Images

Figure CN118485141B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing technology, and in particular to a method and device for training a large Chinese medical language model. Background Art
[0002] The existing technical solutions for enhancing large language models with Chinese medical knowledge can be mainly divided into two types. The first is supervised fine-tuning, namely SFT (Supervised Fine-Tuning). Taking HuatuoGPT-2 as an example, it uses large language models (LLM, Large Language Model) such as GPT-4 to preprocess several medical corpora, obtain a unified format instruction fine-tuning dataset, and finally supervise fine-tune the base model (Baichuan2). The second is retrieval-augmented generation, namely RAG (Retrieval-Augmented Generation). First, information related to the question is retrieved from an external medical knowledge base, and then the large language model is enabled to use this retrieved information to answer the question, generally using this information to construct a prompt for the large language model. Retrieval-augmented generation has strong interpretability and customization capabilities, and can achieve instant knowledge updates.
[0003] However, the above-mentioned large language model often exhibits "hallucination" when generating answers, that is, the generated information may be untrue or inaccurate, which poses a major obstacle to the application of large language models in the professional medical field. Summary of the invention
[0004] The main purpose of this application is to provide a Chinese medical large language model training method and device, aiming to solve the technical problem that the existing large language model is prone to "hallucination" when generating answers in the Chinese medical field, resulting in low accuracy of the generated information.
[0005] To achieve the above objectives, the present application proposes a method for training a Chinese medical large language model, wherein the method comprises:
[0006] Performing pre-learning training on a preset large language model according to preset medical texts to obtain a pre-trained model;
[0007] Performing supervised fine-tuning training on the pre-trained model according to a preset open source Chinese medical examination dataset to obtain a supervised fine-tuned model;
[0008] Build knowledge graphs and reinforcement learning datasets based on preset open source professional medical knowledge datasets;
[0009] The supervised fine-tuned model is trained with reinforcement learning based on knowledge feedback according to the knowledge graph and the reinforcement learning dataset to obtain a large Chinese medical language model.
[0010] In one embodiment, the step of pre-training a preset large language model according to preset medical text to obtain a pre-trained model includes:
[0011] Perform named entity recognition and restoration on preset medical texts to obtain named entities of medical texts;
[0012] Identifying randomly replaced entities in the medical text named entities, and correcting the randomly replaced entities;
[0013] A knowledge test type training text is generated according to the preset medical text, and a preset large language model is pre-learned and trained according to the knowledge test type training text to obtain a pre-trained model.
[0014] In one embodiment, the step of performing supervised fine-tuning training on the pre-trained model according to a preset open source Chinese medical examination dataset to obtain a supervised fine-tuned model includes:
[0015] Decomposing the weight matrix of the pre-trained model into a low-rank matrix according to a preset open source Chinese medical examination dataset;
[0016] The pre-trained model is subjected to supervised fine-tuning training according to the low-rank matrix, and the low-rank matrix and the original parameter matrix of the pre-trained model are merged to obtain a supervised fine-tuning model.
[0017] In one embodiment, the step of performing knowledge feedback-based reinforcement learning training on the supervised fine-tuned model according to the knowledge graph and the reinforcement learning dataset to obtain a Chinese medical large language model includes:
[0018] Determining a reward signal based on the triples in the knowledge graph and the reinforcement learning dataset;
[0019] The supervised fine-tuned model is trained by reinforcement learning based on knowledge feedback according to the reward signal to obtain a large Chinese medical language model.
[0020] In one embodiment, the step of determining a reward signal according to the triples in the knowledge graph and the reinforcement learning dataset comprises:
[0021] The reward signal is calculated according to the triples in the knowledge graph and the reinforcement learning data set by a preset reward model, and the reward signal includes , , , , the calculation formula of the reward signal is as follows:
[0022] ,
[0023] ,
[0024] ,
[0025] ,
[0026] in , represents the triples contained in the answer generated by the supervised fine-tuned model according to the reinforcement learning dataset, , Represents the triples in the knowledge graph corresponding to the questions and options in the reinforcement learning dataset.
[0027] In one embodiment, after the step of calculating the reward signal according to the triples in the knowledge graph and the reinforcement learning data set by using a preset reward model, the method further includes:
[0028] determining the reward signal as a preference for knowledge feedback;
[0029] The preset reward model is trained according to the preference of the knowledge feedback through an optimization algorithm.
[0030] In addition, to achieve the above-mentioned purpose, the present application also proposes a Chinese medical large language model training device, the Chinese medical large language model training device comprising:
[0031] A pre-learning module, used to perform pre-learning training on a preset large language model according to preset medical texts to obtain a pre-trained model;
[0032] A supervised fine-tuning module, used to perform supervised fine-tuning training on the pre-trained model according to a preset open source Chinese medical examination data set to obtain a supervised fine-tuned model;
[0033] Data construction module, used to build knowledge graphs and reinforcement learning datasets based on preset open source professional medical knowledge datasets;
[0034] A reinforcement learning module is used to perform reinforcement learning training based on knowledge feedback on the supervised fine-tuned model according to the knowledge graph and the reinforcement learning dataset to obtain a Chinese medical language model.
[0035] In addition, to achieve the above-mentioned objectives, the present application also proposes a Chinese medical large language model training device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the Chinese medical large language model training method as described above.
[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the Chinese medical large language model training method as described above are implemented.
[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the Chinese medical large language model training method as described above.
[0038] The present application provides a method for training a large language model for Chinese medicine, which pre-learns and trains a preset large language model through medical texts, so that the large language model understands professional medical knowledge at the semantic level. The pre-trained model is supervised and fine-tuned according to the open source Chinese medical examination data set to reduce computational complexity and memory requirements, which enables efficient fine-tuning under limited computing resources while maintaining model performance. Finally, reinforcement learning with knowledge feedback is performed based on the constructed knowledge graph and reinforcement learning data set, which helps to solve the "hallucination" phenomenon caused by overfitting of the model after supervised fine-tuning, thereby fully aligning the output of the large language model with relevant professional medical knowledge and improving the accuracy of the large language model's answers in the medical field. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0040] In order to more clearly illustrate the embodiments of the present application 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1 A flowchart diagram of the first embodiment of the Chinese medical large language model training method of the present application;
[0042] Figure 2 This is a schematic diagram of the architecture of the Chinese medical large language model training method of this application;
[0043] Figure 3 A flowchart diagram of the second embodiment of the Chinese medical large language model training method of the present application;
[0044] Figure 4 This is a schematic diagram of the module structure of the Chinese medicine large language model training device according to the embodiment of the present application;
[0045] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the Chinese medical large language model training method in the embodiment of the present application.
[0046] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0048] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0049] The main solution of the embodiment of the present application is: pre-learning and training a preset large language model according to preset medical text to obtain a pre-trained model; supervised fine-tuning training is performed on the pre-trained model according to a preset open source Chinese medical examination data set to obtain a supervised fine-tuned model; a knowledge graph and a reinforcement learning data set are constructed according to a preset open source professional medical knowledge data set; reinforcement learning training based on knowledge feedback is performed on the supervised fine-tuned model according to the knowledge graph and the reinforcement learning data set to obtain a Chinese medical large language model.
[0050] The technical solutions of the existing Chinese medical knowledge enhancement large language model can be mainly divided into two types. The first is supervised fine-tuning, namely SFT (Supervised Fine-Tuning). Taking HuatuoGPT-2 as an example, as shown in the figure, it uses large language models (LLM, Large Language Model) such as GPT-4 to pre-process several medical corpora, obtain a unified format instruction fine-tuning data set, and finally supervise the base model (Baichuan2) for fine-tuning training. The second is retrieval-augmented generation, namely RAG (Retrieval-Augmented Generation). First, information related to the question is retrieved from an external medical knowledge base, and then the large language model is enabled to use the retrieved information to answer the question, generally using this information to construct a prompt for the large language model. Retrieval-augmented generation has strong interpretability and customization capabilities, and can achieve instant knowledge updates. However, the above-mentioned large language model often has a "hallucination" phenomenon when generating answers, that is, the generated information may be untrue or inaccurate, which has created a major obstacle to the application of large language models in the field of professional medicine.
[0051] This application provides a solution to pre-learn and train a preset large language model through medical text, so that the large language model can understand professional medical knowledge at the semantic level. The pre-trained model is supervised and fine-tuned according to the open source Chinese medical examination dataset to reduce computational complexity and memory requirements, which enables efficient fine-tuning under limited computing resources while maintaining model performance. Finally, reinforcement learning with knowledge feedback based on the constructed knowledge graph and reinforcement learning dataset helps to solve the "hallucination" phenomenon caused by overfitting of the model after supervised fine-tuning, thereby fully aligning the output of the large language model with relevant professional medical knowledge and improving the accuracy of the large language model's answers in the medical field.
[0052] It should be noted that the execution subject of the method of this embodiment can be a computing service device with Chinese medical large language model training, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc.; it can also be the above-mentioned Chinese medical large language model training device with the same or similar functions. This embodiment and the following embodiments will be described by taking the Chinese medical large language model training device as an example.
[0053] Based on this, the present application embodiment provides a Chinese medical language model training method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the Chinese medical large language model training method of the present application.
[0054] In this embodiment, the Chinese medical language model training method includes steps S10 to S40:
[0055] Step S10, pre-learning and training a preset large language model according to preset medical text to obtain a pre-trained model.
[0056] It can be understood that this embodiment proposes a multi-stage reinforcement training framework for a large language model based on Chinese medical knowledge feedback, including a pre-learning stage, a supervised fine-tuning stage, and a reinforcement learning stage based on knowledge feedback. The overall framework diagram is shown in Figure 2 As shown in the figure, the pre-learning stage is the first stage in the entire knowledge feedback reinforcement training framework. Its main purpose is to enable the large language model to understand professional medical knowledge at the semantic level. Pre-learning tasks can be relationship extraction, question relevance judgment, knowledge completion and other tasks.
[0057] In a feasible implementation, step S10 may include steps S101 to S103:
[0058] Step S101, performing named entity recognition and restoration on a preset medical text to obtain medical text named entities.
[0059] In the specific implementation, the pre-learning stage specifically includes three pre-learning tasks, among which Task 1 is Named Entity Recognition (NER) of medical texts and its dual task of restoring medical named entity texts. The entity recognition and standardization task involves identifying specific entities in medical texts, such as diseases, drugs, and treatment methods, and standardizing these entities to reduce ambiguity caused by different expressions. The dual task of entity recognition is the restoration task, which aims to check whether the entity has been incorrectly replaced or modified, and try to restore the original correct entity. This helps to ensure the consistency and accuracy of information.
[0060] Step S102, identifying the randomly replaced entities in the medical text named entities, and correcting the randomly replaced entities.
[0061] It should be understood that Task 2 determines whether an entity has been randomly replaced based on Task 1. In the medical field, incorrect entity replacement may lead to serious misunderstandings. This task aims to identify and correct these errors to improve the reliability of text processing. By identifying and correcting randomly replaced entities, the model learns to handle various variations and errors, thereby improving its robustness and stability in practical applications.
[0062] Step S103, generating a knowledge test type training text according to the preset medical text, and performing pre-learning training on a preset large language model according to the knowledge test type training text to obtain a pre-trained model.
[0063] It is understandable that Task 3 is to generate relevant questions, options, answers, and analysis from medical texts. This task automatically generates relevant questions and answers based on medical texts, which helps machine learning models better understand and integrate medical knowledge. In addition to question and answer, the model also needs to be able to provide analysis of questions and explanations of answers, which is particularly important for education and understanding by non-professionals.
[0064] Through these three gradually deepening pre-learning tasks, the large language model can not only more accurately identify and process professional terms and concepts in the medical field, but also maintain a high degree of accuracy and consistency in the presence of errors or variations. The design of these tasks enables the model to show higher adaptability and accuracy in complex medical text environments, laying a solid foundation for subsequent knowledge feedback reinforcement training.
[0065] In this embodiment, in the pre-learning stage, tasks one, two, and three, which respectively target entity recognition and restoration, entity replacement judgment and correction, and question and answer generation in medical texts, are used for specific task training, so that the large language model can better understand professional medical knowledge at the semantic level.
[0066] Step S20, performing supervised fine-tuning training on the pre-trained model according to a preset open source Chinese medical examination data set to obtain a supervised fine-tuned model.
[0067] It should be understood that the supervised fine-tuning stage (SFT) is the stage of core knowledge injection in the entire knowledge feedback reinforcement training framework. This embodiment uses several open source Chinese medical examination data sets to perform supervised fine-tuning training on a large language model, thereby improving the model's ability to understand Chinese medicine.
[0068] It is understandable that the supervised fine-tuning technology in this embodiment can also be replaced by P-Tuning, Freeze, full parameter fine-tuning and other methods, which are not limited here.
[0069] In a feasible implementation, step S20 may include steps S201-S202:
[0070] Step S201, decomposing the weight matrix of the pre-trained model into a low-rank matrix according to a preset open source Chinese medical examination data set.
[0071] Step S202: Perform supervised fine-tuning training on the pre-trained model according to the low-rank matrix, and merge the low-rank matrix and the original parameter matrix of the pre-trained model to obtain a supervised fine-tuning model.
[0072] In a specific implementation, the specific method of supervised fine-tuning can be to use several open source Chinese medical examination data sets to perform supervised fine-tuning training based on low-rank adaptation (LoRA) on the large language model. By applying the decomposed low-rank matrix to the weight matrix of the large language model and merging the low-rank matrix with the original parameter matrix of the pre-trained model, the number of model parameters is greatly reduced, thereby reducing the computational complexity and memory requirements, which enables efficient fine-tuning with limited computing resources while maintaining model performance.
[0073] In this implementation, by applying low-rank matrix decomposition to the weight matrix of a large language model, the number of model parameters is greatly reduced, thereby reducing computational complexity and memory requirements, which enables efficient fine-tuning with limited computing resources while maintaining model performance.
[0074] Step S30, constructing a knowledge graph and a reinforcement learning dataset based on a preset open source professional medical knowledge dataset.
[0075] It should be understood that the reinforcement learning stage based on knowledge feedback (RLKF, Reinforcement Learning from Knowledge Feedback) is the stage of knowledge verification and knowledge correction in the entire knowledge feedback reinforcement training framework in this embodiment. Its idea comes from reinforcement learning based on human feedback (RLHF, Reinforcement Learning from Human Feedback). RLHF combines reinforcement learning with human feedback, and human preferences are used as reward signals to guide the training of large language models, so as to fully align the output of large language models with the understanding and satisfaction of human intentions. RLKF combines reinforcement learning with knowledge feedback. First, a knowledge graph (KG, Knowledge Graph) is constructed using several open source professional medical knowledge data sets. The relevant triples in the knowledge graph are used to calculate reward signals to guide the training of large language models. It is also necessary to construct a reinforcement learning data set for subsequent reinforcement learning training, so as to fully align the output of the large language model with the relevant professional medical knowledge. Therefore, this stage will help solve the "hallucination" phenomenon caused by overfitting of the model after supervised fine-tuning.
[0076] Step S40, performing knowledge feedback-based reinforcement learning training on the supervised fine-tuned model according to the knowledge graph and the reinforcement learning dataset to obtain a Chinese medical large language model.
[0077] It can be understood that in the reinforcement learning stage based on knowledge feedback, the supervised fine-tuned model is trained by reinforcement learning based on knowledge feedback according to the constructed knowledge graph and reinforcement learning dataset to obtain a Chinese medical large language model.
[0078] This embodiment provides a Chinese medical large language model training method, which pre-learns and trains the preset large language model through medical text, so that the large language model understands professional medical knowledge at the semantic level. The pre-trained model is supervised and fine-tuned according to the open source Chinese medical examination data set, thereby reducing the computational complexity and memory requirements, which enables efficient fine-tuning under limited computing resources while maintaining model performance. Finally, reinforcement learning with knowledge feedback is performed based on the constructed knowledge graph and reinforcement learning data set, which helps to solve the "hallucination" phenomenon caused by overfitting of the model after supervised fine-tuning, thereby fully aligning the output of the large language model with relevant professional medical knowledge, and improving the accuracy of the large language model's answers in the medical field.
[0079] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 3 , step S40, the Chinese medical language model training method further includes steps S401-S402:
[0080] Step S401, determining a reward signal according to the triples in the knowledge graph and the reinforcement learning data set.
[0081] In a feasible implementation, step S401 may include step S4011:
[0082] Step S4011, calculating a reward signal based on the triples in the knowledge graph and the reinforcement learning data set through a preset reward model, wherein the reward signal includes , , , , the calculation formula of the reward signal is as follows:
[0083] ,
[0084] ,
[0085] ,
[0086] ,
[0087] in , represents the triples contained in the answer generated by the supervised fine-tuned model according to the reinforcement learning dataset, , Represents the triples in the knowledge graph corresponding to the questions and options in the reinforcement learning dataset.
[0088] It is worth noting that this paper proposes a reward model (RM, RewardModel) based on knowledge feedback, which receives a series of related triplets and returns four scalar rewards , , , As a reward signal, it numerically corresponds to the "preference" of knowledge feedback. The specific calculation method of the reward function is as follows:
[0089] ,
[0090] ,
[0091] ,
[0092] ,
[0093] in Refers to the triples contained in the answers generated by the supervised fine-tuned model based on the reinforcement learning dataset, Refers to the triples in the knowledge graph that correspond to the questions and options in the reinforcement learning dataset. In addition, the retrieval and re-ranking of related triples in the knowledge graph are mainly based on the similarity calculation of the corresponding vectors of the triples.
[0094] In this implementation, a reward model (RM) based on knowledge feedback is proposed. This model receives a series of related triplets and returns four scalar rewards as reward signals. The reward signal is calculated based on the relationship between the triplets contained in the answers generated by the reinforcement learning dataset and the triplets in the knowledge graph corresponding to the questions and options in the reinforcement learning dataset through supervised fine-tuning of the model, thereby improving the accuracy of reward signal calculation and better guiding the training of large language models.
[0095] In a feasible implementation manner, after step S4011, steps S4012 to S4013 may also be included:
[0096] Step S4012: determining the reward signal as a preference for knowledge feedback.
[0097] Step S4013: training the preset reward model according to the preference of the knowledge feedback through an optimization algorithm.
[0098] As you can understand, the reward model receives a sequence of related triplets and returns four scalar rewards , , , , which numerically corresponds to the "preference" of knowledge feedback. Therefore, the reward model can be trained using the Direct Preference Optimization (DPO) or Proximal Policy Optimization (PPO).
[0099] In this embodiment, the reward signal numerically corresponds to the "preference" of knowledge feedback, and the reward model is trained by using a direct preference optimization algorithm (DPO) or a proximal strategy optimization algorithm to improve the robustness of the reward model.
[0100] Step S402: performing knowledge feedback-based reinforcement learning training on the supervised fine-tuned model according to the reward signal to obtain a Chinese medical large language model.
[0101] It can be understood that the reward signal is calculated based on the relevant triples in the knowledge graph and the reinforcement learning dataset to guide the training of the large language model, so as to fully align the output of the large language model with the relevant professional medical knowledge.
[0102] In this embodiment, reinforcement learning is combined with knowledge feedback, and the relevant triplets in the knowledge graph are used to calculate the reward signal. The training of the large language model is guided by the reinforcement learning dataset, so that the output of the large language model is fully aligned with the relevant professional medical knowledge. Therefore, this stage will help solve the "hallucination" phenomenon caused by overfitting of the model after supervised fine-tuning.
[0103] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the Chinese medical large language model training method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0104] This application also provides a Chinese medical language model training device, please refer to Figure 4 , the Chinese medical large language model training device comprises:
[0105] A pre-learning module 10 is used to perform pre-learning training on a preset large language model according to a preset medical text to obtain a pre-trained model;
[0106] A supervised fine-tuning module 20 is used to perform supervised fine-tuning training on the pre-trained model according to a preset open source Chinese medical examination data set to obtain a supervised fine-tuned model;
[0107] A data construction module 30, used to construct a knowledge graph and a reinforcement learning dataset based on a preset open source professional medical knowledge dataset;
[0108] The reinforcement learning module 40 is used to perform reinforcement learning training based on knowledge feedback on the supervised fine-tuned model according to the knowledge graph and the reinforcement learning dataset to obtain a Chinese medical language model.
[0109] The Chinese medical large language model training device provided by the present application adopts the Chinese medical large language model training method in the above embodiment to solve the technical problem. Compared with the prior art, the beneficial effects of the Chinese medical large language model training device provided by the present application are the same as the beneficial effects of the Chinese medical large language model training method provided by the above embodiment, and the other technical features in the Chinese medical large language model training device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0110] The present application provides a Chinese medical large language model training device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the Chinese medical large language model training method in the above-mentioned embodiment one.
[0111] Reference below Figure 5 , which shows a schematic diagram of the structure of a Chinese medical language model training device suitable for implementing the embodiment of the present application. The Chinese medical language model training device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions: tablet computers), PMPs (Portable Media Players: portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The Chinese medical large language model training device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0112] like Figure 5 As shown, the Chinese medical large language model training device may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the Chinese medical large language model training device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the Chinese medical large language model training device to communicate wirelessly or wired with other devices to exchange data. Although the Chinese medical large language model training device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0113] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0114] The Chinese medical large language model training device provided by the present application adopts the Chinese medical large language model training method in the above embodiment, which can solve the technical problems of Chinese medical large language model training. Compared with the prior art, the beneficial effects of the Chinese medical large language model training device provided by the present application are the same as the beneficial effects of the Chinese medical large language model training method provided by the above embodiment, and the other technical features in the Chinese medical large language model training device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0115] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0116] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0117] The present application provides a computer-readable storage medium having computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the Chinese medical large language model training method in the above-mentioned embodiment.
[0118] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0119] The above-mentioned computer-readable storage medium may be included in the Chinese medical large language model training device; or it may exist independently without being assembled into the Chinese medical large language model training device.
[0120] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the Chinese medical large language model training device, the Chinese medical large language model training device: performs pre-learning training on the preset large language model according to the preset medical text to obtain the pre-trained model; performs supervised fine-tuning training on the pre-trained model according to the preset open source Chinese medical examination data set to obtain the supervised fine-tuned model; constructs a knowledge graph and a reinforcement learning data set according to the preset open source professional medical knowledge data set; performs reinforcement learning training based on knowledge feedback on the supervised fine-tuning model according to the knowledge graph and the reinforcement learning data set to obtain the Chinese medical large language model.
[0121] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0122] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0123] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0124] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned Chinese medical large language model training method, and can solve technical problems. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the Chinese medical large language model training method provided in the above-mentioned embodiment, and will not be repeated here.
[0125] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned Chinese medical large language model training method.
[0126] The computer program product provided in this application can solve the technical problem. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the Chinese medical large language model training method provided in the above embodiment, which will not be repeated here.
[0127] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A Chinese medical language model training method, It is characterized in that The method includes: Performing pre-learning training on a preset large language model according to preset medical texts to obtain a pre-trained model; Performing supervised fine-tuning training on the pre-trained model according to a preset open source Chinese medical examination dataset to obtain a supervised fine-tuned model; Build knowledge graphs and reinforcement learning datasets based on preset open source professional medical knowledge datasets; According to the knowledge graph and the reinforcement learning dataset, the supervised fine-tuned model is trained with reinforcement learning based on knowledge feedback to obtain a Chinese medical language model; The step of performing knowledge feedback-based reinforcement learning training on the supervised fine-tuned model according to the knowledge graph and the reinforcement learning dataset to obtain a Chinese medical large language model includes: The reward signal is calculated according to the triples in the knowledge graph and the reinforcement learning data set by a preset reward model, and the reward signal includes , , , , the calculation formula of the reward signal is as follows: , , , , in , represents the triples contained in the answer generated by the supervised fine-tuned model according to the reinforcement learning dataset, , Representing triples in the knowledge graph corresponding to questions and options in the reinforcement learning dataset; The supervised fine-tuned model is trained by reinforcement learning based on knowledge feedback according to the reward signal to obtain a large Chinese medical language model.
2. The method according to claim 1, It is characterized in that The step of pre-training a preset large language model according to preset medical text to obtain a pre-trained model includes: Perform named entity recognition and restoration on preset medical texts to obtain named entities of medical texts; Identifying randomly replaced entities in the medical text named entities, and correcting the randomly replaced entities; A knowledge test type training text is generated according to the preset medical text, and a preset large language model is pre-learned and trained according to the knowledge test type training text to obtain a pre-trained model.
3. The method according to claim 1, It is characterized in that The step of performing supervised fine-tuning training on the pre-trained model according to a preset open source Chinese medical examination data set to obtain a supervised fine-tuned model includes: Decomposing the weight matrix of the pre-trained model into a low-rank matrix according to a preset open source Chinese medical examination data set; The pre-trained model is subjected to supervised fine-tuning training according to the low-rank matrix, and the low-rank matrix and the original parameter matrix of the pre-trained model are merged to obtain a supervised fine-tuning model.
4. The method according to claim 1, It is characterized in that After the step of calculating the reward signal according to the triples in the knowledge graph and the reinforcement learning data set by using the preset reward model, the method further includes: determining the reward signal as a preference for knowledge feedback; The preset reward model is trained according to the preference of the knowledge feedback through an optimization algorithm.
5. A Chinese medical language model training device, It is characterized in that The Chinese medical large language model training device comprises: A pre-learning module, used to perform pre-learning training on a preset large language model according to preset medical texts to obtain a pre-trained model; A supervised fine-tuning module, used to perform supervised fine-tuning training on the pre-trained model according to a preset open source Chinese medical examination data set to obtain a supervised fine-tuned model; Data construction module, used to build knowledge graphs and reinforcement learning datasets based on preset open source professional medical knowledge datasets; A reinforcement learning module, used to perform reinforcement learning training based on knowledge feedback on the supervised fine-tuned model according to the knowledge graph and the reinforcement learning dataset to obtain a Chinese medical language model; The reinforcement learning module is used to calculate a reward signal according to the triples in the knowledge graph and the reinforcement learning data set through a preset reward model, and the reward signal includes , , , , the calculation formula of the reward signal is as follows: , , , , in , represents the triples contained in the answer generated by the supervised fine-tuned model according to the reinforcement learning dataset, , Representing triples in the knowledge graph corresponding to questions and options in the reinforcement learning dataset; performing reinforcement learning training based on knowledge feedback on the supervised fine-tuning model according to the reward signal to obtain a Chinese medical large language model.
6. A Chinese medical language model training device, It is characterized in that The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the Chinese medical large language model training method as described in any one of claims 1 to 4.
7. A storage medium, It is characterized in that The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the Chinese medical large language model training method as described in any one of claims 1 to 4 are implemented.
8. A computer program product, It is characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the Chinese medical large language model training method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Method and device for training generative large language model based on knowledge base feedback
CN117009490A
Cited By
Multi-modal AI health assessment method and system based on professional medical data training
CN122314393A
Multi-modal ai health assessment method and system trained based on professional medical data
CN122314393B
