Gastrointestinal medical intelligent diagnosis and treatment model modeling system and method based on multi-dimensional knowledge enhancement
Patent Information
- Application Number
- CN202610947939.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-29
- Publication Date
- 2026-10-30
AI Technical Summary
[0005]本发明旨在解决现有技术中的诊疗模型在胃肠领域的可靠性和适应性不足的技术问题,提供一种基于多维知识增强的胃肠医学智能诊疗模型建模系统及方法,以实现专用于胃肠疾病、兼具高准确性与强共情能力的胃肠医学智能诊疗
本发明提供了一种基于多维知识增强的胃肠医学智能诊疗模型建模系统及方法,通过构建高质量、多维度的胃肠疾病知识数据集,并创新性地提出一种参数高效的微调策略,通过构建低秩自注意力结构的预训练大语言模型,所述预训练大语言模型Transformer解码器的自注意力层的投影权重矩阵通过跨层共享低秩矩阵和层特有低秩矩阵进行自适应更新,且各个Transformer解码器的自注意力权重矩阵基于输入序列与所述全局医学知识向量之间的相似度进行知识引导更新,因此,本发明可以实现低资源消耗下的高性能输出,为胃肠医学智能诊疗提供有力工具。
Smart Images

Figure CN123017515A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and medical information processing, specifically relating to a modeling system and method for an intelligent diagnosis and treatment model of gastrointestinal medicine based on multidimensional knowledge enhancement. Background Technology
[0002] Gastrointestinal diseases are among the most prevalent and deadliest diseases globally. Their complex etiologies, diverse types, and prolonged course, coupled with significant variations in clinical presentation, pose numerous challenges to early diagnosis, treatment, and long-term management. With the rapid development of natural language processing (NLP) technology, medical AI systems based on Large Language Models (LLMs) have demonstrated immense potential in disease prevention, diagnosis, treatment, and health management. In recent years, significant progress has been made in medical LLMs thanks to the development of open-source Chinese LLM models and instruction fine-tuning techniques. For example, some models have been fine-tuned using doctor-patient dialogue data to improve question-answering capabilities, some methods combine medical knowledge graphs to enhance structured knowledge understanding, and other studies have introduced reinforcement learning and multi-turn dialogue data to improve interaction performance in complex medical scenarios. Furthermore, the application of LLMs in the field of gastrointestinal diseases is gradually increasing, with related research showing potential in tasks such as assisted diagnosis, electronic medical record analysis, colonoscopy screening recommendations, and gastrointestinal question answering. However, most existing research is based on performance evaluation of general-purpose LLM models, lacking specialized model design and structural optimization for gastrointestinal disease scenarios.
[0003] While existing medical large-scale language models have made some progress, they still have significant shortcomings. Firstly, training data largely relies on internet question-and-answer platforms or automatically generated data, lacking a systematic integration of real clinical data, authoritative medical guidelines, and standardized examination data, leading to insufficient reliability of the model's medical knowledge. Secondly, existing models are mostly geared towards general medicine, lacking specialist optimization for gastrointestinal diseases, making it difficult to meet the needs of refined diagnosis and treatment. Furthermore, the methods for integrating multi-source medical knowledge are relatively simple, lacking unified representation and deep fusion mechanisms, limiting the efficiency of knowledge utilization. Regarding model optimization, the widely used low-rank adaptation method (LoRA), while reducing parameter size, generally suffers from problems such as cross-layer parameter independence, low convergence efficiency, and insufficient adaptability to new knowledge. Simultaneously, existing AI models typically lack attention-guided mechanisms based on medical knowledge, easily leading to medical inconsistencies or "illusion" phenomena during result generation.
[0004] Therefore, there is an urgent need for a technical solution that can integrate multi-source medical knowledge, optimize model structure, and improve generation reliability in order to enhance the application effect of large language models in intelligent diagnosis and treatment of gastrointestinal diseases. Summary of the Invention
[0005] This invention aims to address the technical problem of insufficient reliability and adaptability of existing diagnostic and treatment models in the gastrointestinal field, and provides a modeling system and method for intelligent diagnostic and treatment models in gastrointestinal medicine based on multidimensional knowledge enhancement, so as to realize intelligent diagnosis and treatment of gastrointestinal diseases with high accuracy and strong empathy.
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement, comprising the following steps: Step 1: Obtain multidimensional gastrointestinal medical data to obtain multiple knowledge subsets, and construct a gastrointestinal disease instruction dataset using the knowledge subsets; Step 2: Perform unified vector encoding on the data of each knowledge subset in the gastrointestinal disease instruction dataset, and then fuse the encoded knowledge subset vectors to obtain the global medical knowledge vector; Step 3: Construct a pre-trained large language model with a low-rank self-attention structure. The pre-trained large language model is a generative language model based on the Transformer architecture, including an L-layer Transformer decoder. Each Transformer decoder includes a self-attention layer and a feedforward neural network layer. In the L-layer Transformer decoder, the projection weight matrix of each self-attention layer is adaptively updated by sharing a low-rank matrix across layers and a layer-specific low-rank matrix. Furthermore, the self-attention weight matrix of each Transformer decoder is updated based on the similarity between the input sequence and the global medical knowledge vector. Step 4: Based on the original parameters of the frozen pre-trained large language model, the gastrointestinal disease instruction dataset is used as a training sample to supervise and fine-tune the pre-trained large language model with the low-rank self-attention structure, updating the low-rank matrix, layer-specific low-rank matrix and knowledge mapping parameters to obtain a multi-dimensional knowledge-enhanced intelligent diagnosis and treatment model for gastrointestinal medicine.
[0007] In step 1, the method for obtaining multidimensional gastrointestinal medical data is as follows: The first knowledge subset is constructed by extracting gastrointestinal disease-related question-and-answer pairs from the doctor-patient dialogue dataset; the second knowledge subset is constructed by filtering gastrointestinal disease-related concept entries from the medical knowledge graph and converting them into standard question-and-answer pairs; the third knowledge subset is constructed by extracting information from clinical medical guidelines for gastrointestinal diseases and converting it into standard question-and-answer pairs; and the fourth knowledge subset is constructed by filtering gastrointestinal disease test questions from the medical qualification examination dataset and converting them into standard question-and-answer pairs. Then, automated cleaning, semantic equivalence rewriting, and expert sampling review are performed on the question-answer pairs in each knowledge subset to form the gastrointestinal disease instruction dataset.
[0008] The doctor-patient dialogue dataset consists of MedDialog and cMedQA2. Initial question-answer pairs related to gastrointestinal diseases are extracted using keyword matching technology, and then automatically cleaned using GPT-3.5-turbo to obtain the first knowledge subset. The medical knowledge graph is a CMeKG knowledge graph. After filtering out gastrointestinal disease entries, the key clinical concepts and descriptions are transformed into standard question-answer pairs. The standard question-answer pairs are then rewritten semantically invariantly using GPT-3.5-turbo to generate a second knowledge subset. Information was extracted from clinical medical guidelines for gastrointestinal diseases and transformed into standard question-answer pairs. GPT-3.5-turbo was used to rewrite the standard question-answer pairs semantically invariantly to generate a third knowledge subset. The medical qualification examination dataset used is the CMExam dataset.
[0009] In step 2, the formula for uniformly vector encoding the data of each subset in the gastrointestinal disease instruction dataset is as follows: ; in, This represents the nth knowledge subset in the gastrointestinal disease instruction dataset. The corresponding knowledge subset vector; Represents the unified vector coding function; , Indicates the first The number of data entries in each knowledge subset, where d represents the dimension of each data entry; The method for fusing the various knowledge subset vectors obtained from encoding is as follows: First, average pooling is performed on each knowledge subset vector to obtain the global representation: ; in, This represents the average pooling data corresponding to the nth knowledge subset. Indicates the first The j-th data item in a subset of knowledge; Then, splicing, fusion, and linear mapping dimensionality reduction are performed: ; ; in, This indicates the concatenation of vectors. Represents the mapping matrix. , Represents a global medical knowledge vector. .
[0010] In step 3, the pre-trained large language model used is Baichuan, GPT, LLaMA, Qwen, or ChatGLM.
[0011] In step 3, the formula for calculating the self-attention weight matrix of each Transformer decoder is as follows: ; in, This represents the self-attention weight matrix corresponding to the i-th layer decoder. Represents the query vector. Represents the key vector. This represents the similarity between the input of the i-th layer decoder and the knowledge vector. Indicates the weighting coefficient. This represents the scaling factor.
[0012] The formula for calculating the similarity between the input of the Transformer decoder and the knowledge vector is: ; in, This represents the input to the i-th self-attention layer. Let represent the expanded global medical knowledge vector, which can be expressed as: in, Indicates length is A vector of all 1s Represents an extended matrix. .
[0013] In step 4, when using the gastrointestinal disease instruction dataset as training samples to supervise and fine-tune the pre-trained large language model with the low-rank self-attention structure, the input question sequences of the training samples are mapped in high dimension to obtain vector sequences. These vector sequences are then enhanced using global medical knowledge vectors to obtain enhanced input vectors, which are then input into the pre-trained large language model with the low-rank self-attention structure. The formula is as follows: ; in, This represents the enhanced input vector. This represents the initial vector of the input problem. and For a trainable parameter matrix, Represents a global medical knowledge vector; The loss function used during training is: ; in, Let N represent the loss function, N represent the total number of training samples, and m represent the total number of time steps t. This indicates that the s-th training sample is at time step [0, 1]. Generating lexical units The probability of.
[0014] In step 3, the projection weight matrix of the self-attention layer of each Transformer decoder is: ; ; ; in, , and These represent the projected weight matrices corresponding to the query, key, and value matrices, respectively. , and This represents the pre-trained weight matrix corresponding to the query, key, and value matrices, which remains frozen during training. This indicates a cross-level shared low-rank matrix corresponding to the query, key, and value matrices. , and They represent the first The unique low-rank matrix corresponding to the query, key, and value matrices of the layer.
[0015] Furthermore, this invention also provides a multi-dimensional knowledge-enhanced intelligent diagnostic and treatment modeling system for gastrointestinal medicine, used to execute the aforementioned modeling method, including: High-quality gastrointestinal disease instruction dataset construction module: used to acquire multidimensional gastrointestinal medical data and construct a gastrointestinal disease instruction dataset; Encoding module: Used to encode the gastrointestinal disease instruction dataset to obtain a global medical knowledge vector; Model building module: used to build a pre-trained large language model with a low-rank self-attention structure. The pre-trained large language model is a generative language model based on the Transformer architecture, including an L-layer Transformer decoder. The projection weight matrix of the self-attention layer of the Transformer decoder is adaptively updated by sharing a low-rank matrix across layers and a layer-specific low-rank matrix. Furthermore, the self-attention weight matrix of each Transformer decoder is updated based on the similarity between the input sequence and the global medical knowledge vector. Efficient parameter fine-tuning module: Used to train a pre-trained large language model with a low-rank self-attention structure using a gastrointestinal disease instruction dataset and global medical knowledge vectors.
[0016] Compared with the prior art, the present invention has the following advantages: This invention provides a modeling system and method for intelligent diagnosis and treatment of gastrointestinal medicine based on multidimensional knowledge enhancement. It constructs a high-quality, multidimensional knowledge dataset of gastrointestinal diseases and innovatively proposes a parameter-efficient fine-tuning strategy. By constructing a pre-trained large language model with a low-rank self-attention structure, the projection weight matrix of the self-attention layer of the Transformer decoder in the pre-trained large language model is adaptively updated through cross-layer shared low-rank matrices and layer-specific low-rank matrices. Furthermore, the self-attention weight matrix of each Transformer decoder is updated based on the similarity between the input sequence and the global medical knowledge vector. Therefore, this invention can achieve high-performance output with low resource consumption, providing a powerful tool for intelligent diagnosis and treatment of gastrointestinal diseases. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic diagram of a modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement, provided in Embodiment 1 of the present invention. Figure 2 This is a schematic diagram illustrating the construction of the gastrointestinal disease question-and-answer dataset of the present invention; Figure 3 This is a model framework diagram of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Example 1 like Figure 1-3 As shown, Embodiment 1 of the present invention provides a modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement, comprising the following steps: Step 1: Obtain multidimensional gastrointestinal medical data and construct a gastrointestinal disease instruction dataset.
[0021] In step 1, the method for obtaining multidimensional gastrointestinal medical data is as follows: After extracting gastrointestinal disease-related question-and-answer pairs from the doctor-patient dialogue dataset, a first knowledge subset is constructed. The doctor-patient dialogue dataset consists of MedDialog and cMedQA2. Initial question-and-answer pairs related to gastrointestinal diseases are extracted using keyword matching technology, and then automatically cleaned using GPT-3.5-turbo to obtain the first knowledge subset. A second knowledge subset is constructed by screening gastrointestinal disease-related concept entries from a medical knowledge graph and converting them into standard question-and-answer pairs. The medical knowledge graph is a CMeKG knowledge graph. After screening gastrointestinal disease entries, the key clinical concepts and descriptions are converted into standard question-and-answer pairs. The standard question-and-answer pairs are then rewritten semantically invariantly using GPT-3.5-turbo to generate the second knowledge subset. Information is extracted from clinical medical guidelines for gastrointestinal diseases and transformed into standard question-and-answer pairs to construct a third knowledge subset. Specifically, after extracting information from clinical medical guidelines for gastrointestinal diseases and transforming it into standard question-and-answer pairs, GPT-3.5-turbo is used to rewrite the standard question-and-answer pairs semantically invariantly to generate the third knowledge subset. A fourth knowledge subset was constructed by screening gastrointestinal disease questions from a medical qualification examination dataset and converting them into standard question-answer pairs; the medical qualification examination dataset used was the CMExam dataset. Then, automated cleaning, semantic equivalence rewriting, and expert sampling review are performed on the question-answer pairs in each knowledge subset to form the gastrointestinal disease instruction dataset.
[0022] Furthermore, the specific methods for constructing each knowledge subset are as follows: The first knowledge subset: Initial question-answer pairs related to gastrointestinal diseases were extracted from publicly available medical dialogue datasets MedDialog and cMedQA2 using keyword matching technology. Subsequently, automated cleaning was performed using GPT-3.5-turbo to identify and remove low-quality entries that were ambiguous, contradictory, or misused in terminology. These were then manually sampled and validated by three senior gastroenterologists, ultimately yielding 89,946 high-quality doctor-patient dialogue data.
[0023] The second knowledge subset: 3,278 gastrointestinal disease entries were selected from the CMeKG knowledge graph. Experts transformed key clinical concepts (such as symptoms and diagnoses) and descriptions into standard question-answer pairs. To further expand the data and improve the model's generalization ability, the existing question-answer pairs were rewritten semantically invariantly using GPT-3.5-turbo, generating an initial 24,095 pairs. After expert review, 21,273 high-quality pairs were retained.
[0024] The third knowledge subset: Based on 35 of the latest clinical guidelines for gastrointestinal diseases from China, Europe, the United States, Japan, and other countries, experts systematically extracted information and transformed it into 1,514 standard question-and-answer pairs. GPT-3.5-turbo was also used for data augmentation, generating an initial 24,617 pairs of data, of which 21,107 pairs were retained after review.
[0025] Fourth Knowledge Subset: To enhance the model's comprehensive medical capabilities, this invention integrates the training set portion of the CMExam dataset. CMExam originates from the National Medical Licensing Examination and contains over 54,497 multiple-choice questions, with added annotations categorized into five types: disease grouping, clinical department, medical discipline, competency domain, and question difficulty level. As a standardized, authoritative dataset derived from the national examination, CMExam ensures high data quality and reliability. Compared to traditional medical question-answering datasets, the comprehensive annotations and detailed explanations of the questions provide richer context, significantly improving the quality and interpretability of the model-generated answers.
[0026] To ensure data quality, this invention performed additional quality checks on the final comprehensive training set, randomly selecting 5% of the question-answer pairs for expert validation. The evaluation confirmed that all samples met our pre-defined criteria in terms of clinical relevance, medical accuracy, and linguistic clarity. These findings support the overall consistency and quality of the generated dataset.
[0027] In step 1, by fusing multi-dimensional data sources, a gastrointestinal disease instruction dataset containing 191,615 high-quality question-answer pairs is constructed. The constructed gastrointestinal disease instruction dataset K can be represented as: (1) in, This represents the first subset of knowledge, obtained based on real doctor-patient dialogue data. The second knowledge subset is derived from structured data based on a medical knowledge graph (in triplet form). This represents the third subset of knowledge, obtained from unstructured data based on clinical guidelines. This represents the fourth knowledge subset, derived from medical qualification examination data.
[0028] Step 2: Perform unified vector encoding on the data of each knowledge subset in the gastrointestinal disease instruction dataset, and then fuse the encoded knowledge subset vectors to obtain the global medical knowledge vector.
[0029] In step 2, the formula for uniformly vector encoding the data of each knowledge subset in the gastrointestinal disease instruction dataset is as follows: (2) in, This represents the nth knowledge subset in the gastrointestinal disease instruction dataset. The corresponding knowledge subset vector; Represents the unified vector coding function; , Indicates the first The number of data items in each knowledge subset, where d represents the dimension of each data item; n = 1, 2, 3, 4.
[0030] The method for fusing the various knowledge subset vectors obtained from encoding is as follows: First, average pooling is performed on each knowledge subset vector to obtain the global representation: (3) in, This represents the average pooling data corresponding to the nth knowledge subset. Indicates the first The j-th data item in a subset of knowledge; Then, splicing, fusion, and linear mapping dimensionality reduction are performed: (4) (5) in, This indicates the concatenation of vectors. Represents the mapping matrix. , Represents a global medical knowledge vector. .
[0031] Step 3: Construct a pre-trained large language model with a low-rank self-attention structure. The pre-trained large language model is a generative language model based on the Transformer architecture, including an L-layer Transformer decoder. Each Transformer decoder includes a self-attention layer and a feedforward neural network layer. In the L-layer Transformer decoder, the projection weight matrix of each self-attention layer is adaptively updated by sharing a low-rank matrix across layers and a layer-specific low-rank matrix. Furthermore, the self-attention weight matrix of each Transformer decoder is updated based on the similarity between the input sequence and the global medical knowledge vector.
[0032] Furthermore, in step 3, in the Transformer decoder, the projection weight matrices of all self-attention layers are adaptively updated by sharing low-rank matrices across layers and layer-specific low-rank matrices.
[0033] In step 3, the pre-trained large language models used are Baichuan, GPT, LLaMA, Qwen, and ChatGLM. Further, this embodiment uses the Baichuan-13B-Chat model as an example. It contains an L-layer Transformer decoder structure formed by stacking L Transformer decoders. Each Transformer decoder includes a self-attention layer and a feedforward neural network layer, capable of performing contextual modeling on the input sequence and generating target text.
[0034] The experimental environment used a single NVIDIA A100 GPU with 80GB of VRAM, running Linux as the operating system and PyTorch as the deep learning framework. Let the model's hidden dimension be d and the number of attention heads be h. Then, the dimension of each attention head... for: ; (6) In this embodiment, the specific settings are as follows: Transformer layer number: L=40, hidden layer dimension: d=5120, attention head number: h=40, and dimension of each attention head: =128, the maximum length of the input sequence is m=2048, and the maximum length of the output sequence is 1024.
[0035] The following is the first Taking an attention layer as an example, assuming its input... This section introduces the calculation process of each self-attention layer in this embodiment.
[0036] Step 1: Calculate the query, key, and value matrix using linear mapping.
[0037] In the standard Transformer, the projection weight matrix W includes the projection weight matrices corresponding to the query, key, and value matrices. ,in, This invention introduces a low-rank incremental parameter: (7) in: This indicates the pre-trained weights (frozen). Let W represent the low-rank increment, and W represent the projected weight matrix.
[0038] To enhance the consistent propagation of knowledge across different layers, this invention designs a cross-layer shared low-rank matrix A, which includes: , These represent the shared low-rank matrices across layers corresponding to the query, key, and value matrices, respectively, and are shared across all Transformer layers. Meanwhile, each layer retains independent parameters, i.e., setting a layer-specific low-rank matrix B, including: , and , , and They represent the first The unique low-rank matrix corresponding to the query, key, and value matrices of the self-attention layer of each Transformer decoder. .in, ; ; It is a low-rank dimension, satisfying The present invention is defined as follows: (8) That is, the low-rank increment is jointly determined by the cross-layer shared low-rank matrix A and the layer-specific low-rank matrix B. Then, the projection weight matrix of the self-attention layer of each Transformer decoder is: (9) (10) (11) in, , and These represent the projected weight matrices corresponding to the query, key, and value matrices, respectively. , and This represents the pre-trained weight matrix corresponding to the query, key, and value matrices, which remains frozen during training. This indicates a cross-level shared low-rank matrix corresponding to the query, key, and value matrices. , and They represent the first The unique low-rank matrix corresponding to the query, key, and value matrices of the self-attention layer of each Transformer decoder. and , and Both are low-rank trainable matrices used for incremental updates of weights, ensuring a significant reduction in the number of training parameters and improving training efficiency. r≪d ensures that the model is updated in low rank without affecting its expressive power. .
[0039] Therefore, in this embodiment, the calculation formula for the query, key, and value matrix in the corresponding self-attention layer is as follows: (12) (13) (14) in: The pre-trained weight matrix corresponding to the query, key, and value is kept frozen during training; , , Therefore, the model structure of this invention only requires training a low-rank matrix, reducing the number of parameters.
[0040] Step 2: Attention weight calculation: A conventional self-attention layer obtains the query matrix Bond matrix Then, by calculating the dot product of the two and scaling it, the relevance score between each position in the input sequence is obtained. This score is then normalized using the softmax function to obtain the attention weight matrix, which represents the information dependency between positions. The calculation formula is as follows: (15) in, Represents the attention weight matrix. This is the scaling factor.
[0041] In this embodiment, to enable the model to reference medical knowledge when calculating attention, a knowledge similarity term is introduced. First, the knowledge vector is extended to the sequence dimension. Then, the similarity between the input sequence and the knowledge vector is calculated, and a self-attention weight matrix is implemented through a knowledge-guided attention mechanism. The update mechanism prioritizes medically relevant content in the model.
[0042] Expanding the dimensions of the global medical knowledge vector can be represented as follows: (16) in, This represents a vector of length m consisting entirely of 1s, where m equals the length of the input sequence of the self-attention layer. It is used to broadcast and expand the global medical knowledge vector along the sequence dimension. Represents a global medical knowledge vector; This represents a learnable linear mapping matrix used to map medical knowledge to the model's latent space representation; This represents the expanded global medical knowledge vector. The length of the input sequence is consistent with that of the i-th self-attention layer, so that it can be used for subsequent similarity calculation and knowledge-guided modeling.
[0043] The formula for calculating the similarity between the input of the Transformer decoder and the knowledge vector is as follows: ; (17) in, This represents the input to the i-th self-attention layer. This represents the expanded global medical knowledge vector. And achieve a self-attention weight matrix through a knowledge-guided attention mechanism. The specific formula for updating is: ; (18) in, This represents the self-attention weight matrix corresponding to the i-th layer decoder. Represents the query vector. Represents the key vector. This represents the similarity between the input of the i-th layer decoder and the knowledge vector. Indicates the weighting coefficient. This represents the scaling factor.
[0044] Step 3: Output Calculation Obtaining the self-attention weight matrix Then, combine it with the value matrix. A weighted summation operation is performed to aggregate the information in the input sequence, resulting in the output representation of the self-attention layer. This output integrates contextual information from different positions, and its calculation formula is as follows: (19) in, This represents the output of the i-th self-attention layer.
[0045] Step 4: Based on the original parameters of the frozen pre-trained large language model, the gastrointestinal disease instruction dataset is used as a training sample to supervise and fine-tune the pre-trained large language model with the low-rank self-attention structure, updating the low-rank matrix, layer-specific low-rank matrix and knowledge mapping parameters to obtain a multi-dimensional knowledge-enhanced intelligent diagnosis and treatment model for gastrointestinal medicine.
[0046] In step 4, when the gastrointestinal disease instruction dataset is used as a training sample to supervise and fine-tune the pre-trained large language model of the low-rank self-attention structure, the initial input question vector is obtained by mapping each input question of the training sample in a high dimension. Then, the initial input question vector is enhanced by the global medical knowledge vector to obtain the enhanced input question vector. Finally, the enhanced input question vector is input into the pre-trained large language model of the low-rank self-attention structure for training.
[0047] When the gastrointestinal disease instruction dataset is used as a training sample, the dataset includes an input question sequence Q and a target answer sequence A', represented as: (20) Before training, first, each input question in the input question sequence is... Mapped to a high-dimensional vector The initial input problem vector is obtained. It is represented as: ;(twenty one) The initial input question vector represents the semantic information captured by the question text. This invention introduces a knowledge-aware projection matrix. , to transform global medical knowledge vectors The initial input question vector is enhanced by embedding it into the initial input question vector, as shown in the formula: ; (twenty two) in, This represents the augmented input problem vector. This represents the initial input problem vector. and Let the first parameter matrix and the second parameter matrix be trainable. This represents the global medical knowledge vector; the above enhancement formula uses vector interaction to transform the global medical knowledge vector... Information injection into the augmented input problem vector This allows the pre-trained large language model with a low-rank self-attention structure to perceive relevant medical background knowledge during the encoding stage, providing a richer information foundation for subsequent decoding and generation.
[0048] In step 4, the pre-trained large language model with a low-rank self-attention structure is subjected to supervised fine-tuning (SFT) using the constructed high-quality gastrointestinal disease instruction dataset. Specifically, the pre-trained large language model with a low-rank self-attention structure is fine-tuned at time steps... Generating lexical units The conditional probability is defined as: ;(twenty three) Where Q represents the input, This represents the output before time step t. Represents the projection weight matrix. This represents the hidden layer state at the current time step. This represents the global medical knowledge vector at input Q. and sequences generated before time t Under the common constraint of conditional probabilities, the time step Generating lexical units The probability of.
[0049] The goal during training is to minimize the negative log-likelihood loss function, therefore the loss function used is: ;(twenty four) in, Let N represent the loss function, N represent the total number of training samples, and m represent the total number of time steps t. This indicates that the s-th training sample is at time step [0, 1]. Generating lexical units The probability of.
[0050] In terms of training strategy, a parameter-efficient fine-tuning scheme is adopted. Specifically, during training, the pre-trained weight matrix in the original model, i.e., the parameters, is frozen. ,(include Only update the following parameters: cross-layer shared low-rank matrix Layer-specific low-rank matrix Knowledge mapping parameters, including linear mapping matrices. The first parameter matrix Second parameter matrix .
[0051] Example 2 Embodiment 2 of the present invention provides a multi-dimensional knowledge-enhanced intelligent diagnostic and treatment modeling system for gastrointestinal medicine, used to execute the modeling method described in Embodiment 1, including: High-quality gastrointestinal disease instruction dataset construction module: used to acquire multidimensional gastrointestinal medical data and construct a gastrointestinal disease instruction dataset; Encoding module: Used to encode the gastrointestinal disease instruction dataset to obtain a global medical knowledge vector; Model building module: used to build a pre-trained large language model with a low-rank self-attention structure. The pre-trained large language model is a generative language model based on the Transformer architecture, including an L-layer Transformer decoder. The projection weight matrix of the self-attention layer of the Transformer decoder is adaptively updated by sharing a low-rank matrix across layers and a layer-specific low-rank matrix. Furthermore, the self-attention weight matrix of each Transformer decoder is updated based on the similarity between the input sequence and the global medical knowledge vector. Efficient parameter fine-tuning module: Used to train a pre-trained large language model with a low-rank self-attention structure using a gastrointestinal disease instruction dataset and global medical knowledge vectors.
[0052] In addition, the present invention provides a multidimensional knowledge-enhanced intelligent diagnosis and treatment system for gastrointestinal medicine, which includes an intelligent diagnosis and treatment model trained by the modeling method of Embodiment 1 or the modeling system of Embodiment 2.
[0053] In this embodiment, after obtaining the intelligent diagnosis and treatment model, the trained model is used for gastrointestinal disease diagnosis and treatment inference during the model application phase. The model generation process adopts an autoregressive approach, with time steps... The model is based on the input question Q and the generated sequence. and global medical knowledge vector Calculate the probability distribution of the next word and select the word with the highest probability as the output: (25) This process is repeated until an end symbol is generated or the maximum output length is reached. The final output sequence of diagnostic answers represents the intelligent diagnostic and treatment suggestions for gastrointestinal diseases provided by the model. Through the above steps, this embodiment effectively injects multi-source medical knowledge into a large language model with low resource consumption, significantly improving the accuracy and professionalism of gastrointestinal disease diagnosis and treatment. Specific experimental results are shown in Table 1.
[0054] Table 1 shows the experimental results of the method of the present invention on two public medical question-and-answer datasets. As shown in Table 1, the method of this invention outperforms both the medical large language model and the general large model used in the comparison on both datasets, fully validating its effectiveness. Notably, compared with advanced open-source large models such as ChatGPT and GPT-4, the method of this invention achieves a significant average performance improvement of 17% on both datasets.
[0055] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A modeling method for an intelligent diagnosis and treatment model in gastrointestinal medicine based on multidimensional knowledge enhancement, characterized in that, Includes the following steps: Step 1: Obtain multidimensional gastrointestinal medical data to obtain multiple knowledge subsets, and construct a gastrointestinal disease instruction dataset using the knowledge subsets; Step 2: Perform unified vector encoding on the data of each knowledge subset in the gastrointestinal disease instruction dataset, and then fuse the encoded knowledge subset vectors to obtain the global medical knowledge vector; Step 3: Construct a pre-trained large language model with a low-rank self-attention structure. The pre-trained large language model is a generative language model based on the Transformer architecture, including an L-layer Transformer decoder. Each Transformer decoder includes a self-attention layer and a feedforward neural network layer. In the L-layer Transformer decoder, the projection weight matrix of each self-attention layer is adaptively updated by sharing a low-rank matrix across layers and a layer-specific low-rank matrix. Furthermore, the self-attention weight matrix of each Transformer decoder is updated based on the similarity between the input sequence and the global medical knowledge vector. Step 4: Based on the original parameters of the frozen pre-trained large language model, the gastrointestinal disease instruction dataset is used as a training sample to supervise and fine-tune the pre-trained large language model with the low-rank self-attention structure, updating the low-rank matrix, layer-specific low-rank matrix and knowledge mapping parameters to obtain a multi-dimensional knowledge-enhanced intelligent diagnosis and treatment model for gastrointestinal medicine.
2. The modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement according to claim 1, characterized in that, In step 1, the method for obtaining multidimensional gastrointestinal medical data is as follows: The first knowledge subset is constructed by extracting gastrointestinal disease-related question-and-answer pairs from the doctor-patient dialogue dataset; the second knowledge subset is constructed by filtering gastrointestinal disease-related concept entries from the medical knowledge graph and converting them into standard question-and-answer pairs; the third knowledge subset is constructed by extracting information from clinical medical guidelines for gastrointestinal diseases and converting it into standard question-and-answer pairs; and the fourth knowledge subset is constructed by filtering gastrointestinal disease test questions from the medical qualification examination dataset and converting them into standard question-and-answer pairs. Then, automated cleaning, semantic equivalence rewriting, and expert sampling review are performed on the question-answer pairs in each knowledge subset to form the gastrointestinal disease instruction dataset.
3. The modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement according to claim 2, characterized in that, The doctor-patient dialogue dataset consists of MedDialog and cMedQA2. Initial question-answer pairs related to gastrointestinal diseases are extracted using keyword matching technology, and then automatically cleaned using GPT-3.5-turbo to obtain the first knowledge subset. The medical knowledge graph is a CMeKG knowledge graph. After filtering out gastrointestinal disease entries, the key clinical concepts and descriptions are transformed into standard question-answer pairs. The standard question-answer pairs are then rewritten semantically invariantly using GPT-3.5-turbo to generate a second knowledge subset. Information was extracted from clinical medical guidelines for gastrointestinal diseases and transformed into standard question-answer pairs. GPT-3.5-turbo was used to rewrite the standard question-answer pairs semantically invariantly to generate a third knowledge subset. The medical qualification examination dataset used is the CMExam dataset.
4. The modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement according to claim 1, characterized in that, In step 2, the formula for uniformly vector encoding the data of each subset in the gastrointestinal disease instruction dataset is as follows: ; in, This represents the nth knowledge subset in the gastrointestinal disease instruction dataset. The corresponding knowledge subset vector; Represents the unified vector coding function; , Indicates the first The number of data entries in each knowledge subset, where d represents the dimension of each data entry; The method for fusing the various knowledge subset vectors obtained from encoding is as follows: First, average pooling is performed on each knowledge subset vector to obtain the global representation: ; in, This represents the average pooling data corresponding to the nth knowledge subset. Indicates the first The j-th data item in a subset of knowledge; Then, splicing, fusion, and linear mapping dimensionality reduction are performed: ; ; in, This indicates the concatenation of vectors. Represents the mapping matrix, , Represents a global medical knowledge vector. .
5. The modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement according to claim 1, characterized in that, In step 3, the pre-trained large language model used is Baichuan, GPT, LLaMA, Qwen, or ChatGLM.
6. The modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement according to claim 1, characterized in that, In step 3, the formula for calculating the self-attention weight matrix of each Transformer decoder is as follows: ; in, This represents the self-attention weight matrix corresponding to the i-th layer decoder. Represents the query vector. Represents the key vector. This represents the similarity between the input of the i-th layer decoder and the knowledge vector. Indicates the weighting coefficient. This represents the scaling factor.
7. The modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement according to claim 6, characterized in that, The formula for calculating the similarity between the input of the Transformer decoder and the knowledge vector is: ; in, This represents the input to the i-th self-attention layer. Let represent the expanded global medical knowledge vector, which can be expressed as: in, Indicates length is A vector of all 1s Represents an extended matrix. .
8. The modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement according to claim 1, characterized in that, In step 4, when using the gastrointestinal disease instruction dataset as training samples to supervise and fine-tune the pre-trained large language model with the low-rank self-attention structure, the input question sequences of the training samples are mapped in high dimension to obtain vector sequences. These vector sequences are then enhanced using global medical knowledge vectors to obtain enhanced input vectors, which are then input into the pre-trained large language model with the low-rank self-attention structure. The formula is as follows: ; in, This represents the enhanced input vector. This represents the initial vector of the input problem. and For a trainable parameter matrix, Represents a global medical knowledge vector; The loss function used during training is: ; in, Let N represent the loss function, N represent the total number of training samples, and m represent the total number of time steps t. This indicates that the s-th training sample is at time step [0, 1]. Generating lexical units The probability of.
9. The modeling method for a gastrointestinal medical intelligent diagnosis and treatment model based on multidimensional knowledge enhancement according to claim 1, characterized in that, In step 3, the projection weight matrix of the self-attention layer of each Transformer decoder is: ; ; ; in, , and These represent the projected weight matrices corresponding to the query, key, and value matrices, respectively. , and This represents the pre-trained weight matrix corresponding to the query, key, and value matrices, which remains frozen during training. This indicates a cross-level shared low-rank matrix corresponding to the query, key, and value matrices. , and They represent the first The unique low-rank matrix corresponding to the query, key, and value matrices of the layer.
10. A multi-dimensional knowledge-enhanced intelligent diagnostic and treatment modeling system for gastrointestinal medicine, used to execute the modeling method according to any one of claims 1-9, comprising: High-quality gastrointestinal disease instruction dataset construction module: used to acquire multidimensional gastrointestinal medical data and construct a gastrointestinal disease instruction dataset; Encoding module: Used to encode the gastrointestinal disease instruction dataset to obtain a global medical knowledge vector; Model building module: used to build a pre-trained large language model with a low-rank self-attention structure. The pre-trained large language model is a generative language model based on the Transformer architecture, including an L-layer Transformer decoder. The projection weight matrix of the self-attention layer of the Transformer decoder is adaptively updated by sharing a low-rank matrix across layers and a layer-specific low-rank matrix. Furthermore, the self-attention weight matrix of each Transformer decoder is updated based on the similarity between the input sequence and the global medical knowledge vector. Efficient parameter fine-tuning module: Used to train a pre-trained large language model with a low-rank self-attention structure using a gastrointestinal disease instruction dataset and global medical knowledge vectors.
