Pancreatic cancer prediction method and system based on local and global perplexity weighted pruning
By employing a weighted pruning method based on local and global perplexity, the interpretability and lengthy reasoning issues of traditional models are addressed, resulting in a logically clear pancreatic cancer prediction system that improves diagnostic efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- QINGDAO UNIV
- Filing Date
- 2026-03-13
- Publication Date
- 2026-06-16
AI Technical Summary
Existing deep learning-based pancreatic cancer prediction methods lack interpretability, have lengthy reasoning processes, consume large computational resources, and are prone to noise interference that affects diagnostic accuracy.
By employing a weighted pruning method based on local and global perplexity, a structured cue word sequence is constructed. An initial reasoning path is generated using a large language model, the changes in local and global perplexity are calculated, a comprehensive importance scoring function is constructed, and redundant steps are automatically eliminated to form a logically clear thought chain.
It achieves efficient and clear pancreatic cancer risk prediction, outputs logically transparent diagnostic results, and improves reasoning efficiency and diagnostic accuracy.
Smart Images

Figure CN121839088B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence natural language processing technology, and in particular to a method and system for predicting pancreatic cancer based on local and global perplexity weighted pruning. Background Technology
[0002] In existing assisted diagnostic technologies, time series analysis methods based on deep learning dominate. These methods typically employ recurrent neural networks or long short-term memory (LSTM) network architectures for modeling. The working principle involves mapping a patient's biochemical test results at different time points to clinical text records, transforming these into a high-dimensional feature vector sequence. The model then uses internal recurrent structures and gating mechanisms to update the hidden layer states, capturing the dynamic evolution of clinical indicators over time. The extracted time series features are ultimately input into a fully connected layer, and a classification algorithm directly outputs the probability of the patient having pancreatic cancer. While this method achieves a degree of automated prediction, it essentially focuses on numerical pattern recognition and struggles to meet the clinical requirement for transparency in diagnostic evidence.
[0003] The existing technology has two insurmountable shortcomings in practical clinical applications:
[0004] Traditional models lack interpretability: Traditional models based on RNN and LSTM can only output a cancer probability value, but cannot provide the medical logic or thought process that led to the result. It is impossible to know the judgment based on features or the medical principles, which makes the prediction results unconvincing and difficult to be trusted and adopted in serious clinical decision-making.
[0005] Existing generation mechanisms often lack effective constraints on inference quality, easily generating a large number of redundant, trivial, or even nonsensical steps that deviate from the core of diagnosis. Redundant inference not only significantly increases computational costs and inference latency, but more seriously, it constitutes inference noise, distracts the model from key pathogenic evidence, and interferes with the accuracy of the final diagnosis.
[0006] To address the aforementioned technical shortcomings, a solution is proposed. Summary of the Invention
[0007] The purpose of this invention is to provide a pancreatic cancer reasoning method and system based on local and global perplexity weighted pruning, which solves the technical problems of traditional models lacking interpretability and existing methods and large language models having lengthy reasoning processes, high computational resource consumption, and core logic being submerged by noise. Through this invention, by utilizing a dual perplexity evaluation mechanism, invalid steps in the reasoning chain can be automatically identified and eliminated without large-scale manual annotation, thereby achieving intelligent assisted diagnosis and treatment with both high computational efficiency and high diagnostic accuracy.
[0008] To achieve the above objectives, the present invention employs the following technical solution: a pancreatic cancer prediction method based on local and global perplexity weighted pruning, comprising the following steps:
[0009] Step 1: Obtain the electronic medical record text data of the patient to be diagnosed, perform data filtering and processing, and construct a structured prompt word sequence that conforms to the input specifications of the large language model. Input the sequence into the base large language model, and generate an initial inference path set containing complete inference steps through the thinking chain strategy.
[0010] Step 2: Based on the reasoning steps in the initial inference path set, perform local importance calculation, evaluate the necessity of the current step in the context logic connection, and obtain the local perplexity change by evaluating the change in perplexity of the predicted subsequent steps before and after removing the current step.
[0011] Step 3: Calculate the global change in perplexity for the current reasoning step to assess the substantial contribution of the current step to the final diagnostic conclusion. The global change in perplexity is obtained by removing the change in perplexity of the final diagnostic conclusion generated before and after the current step.
[0012] Step 4: Based on the changes in local and global perplexity, construct a comprehensive importance scoring function through weighted fusion, calculate the comprehensive importance score of the reasoning steps, set a pruning threshold, extract the reasoning steps with comprehensive importance scores that meet the screening criteria, and smooth the extracted key reasoning steps to form a thought chain.
[0013] Step 5: Based on the thought chain as the final reasoning basis, output the pancreatic cancer risk prediction results and the preprocessed key reasoning path.
[0014] Furthermore, through the thought chain strategy, an initial set of reasoning paths containing complete reasoning steps is generated, as follows:
[0015] The electronic medical record text data of patients to be diagnosed is obtained from the hospital information system, and the data is cleaned and filtered. Structured fields are extracted and all data is sorted according to timestamps to construct the patient's time-series health record data. The preprocessed data is reorganized according to the optimal input format of the large language model to form a structured prompt word sequence containing three parts: role setting, task instructions, and data input.
[0016] The constructed complete structured prompt word sequence is input into the base big language model, which activates the chain thinking mode internally and guides the base big language model to use the thinking chain strategy for step-by-step reasoning. Before generating the final diagnosis, the base big language model generates intermediate reasoning steps sentence by sentence. Each step is a complete natural language sentence that expresses an independent medical reasoning logic.
[0017] The final conclusion is generated and all intermediate reasoning steps and their order are recorded to form an initial reasoning path set, preserving the original thought chain from the medical record information to derive the final conclusion.
[0018] Furthermore, based on the reasoning steps in the initial inference path set, local importance is calculated to assess the necessity of the current step in the contextual logical connection. By evaluating the change in perplexity of the predicted subsequent steps before and after removing the current step, the change in local perplexity is obtained. The specific process is as follows:
[0019] For the reasoning steps in the initial inference path set, select a step to be evaluated, and locate the preceding steps and adjacent subsequent steps of the step to be evaluated to construct a local context window;
[0020] Based on the cases of retaining the current step and removing the current step, we obtain the perplexity of the complete subsequent step and the perplexity of the missing subsequent step. Based on the current step and the preceding step, we calculate the baseline perplexity in the complete context, and based on the preceding step and removing the current step, we calculate the comparative perplexity after removing the current step.
[0021] Subtract the baseline perplexity from the comparison perplexity to obtain the change in perplexity for predicting subsequent steps after removing the current step. Store the obtained change in perplexity and establish a mapping relationship with the current step.
[0022] Furthermore, the change in global perplexity is calculated for the current inference step to assess its substantial contribution to the final diagnostic conclusion. This change is obtained by removing the perplexity change in the final diagnostic conclusion generated before and after the current step. The specific process is as follows:
[0023] The original medical record prompt sequence is concatenated with the complete set of initial reasoning paths in sequence to form a complete input pre-processing step;
[0024] The final diagnostic conclusion output by the base language big model is used as the target text sequence to be evaluated. The preceding steps are input into the base language big model to obtain the conditional probability of each word in the diagnostic conclusion. The inverse of the geometric mean probability of all words is calculated to generate the global baseline perplexity.
[0025] Furthermore, based on the changes in local and global perplexity, a comprehensive importance scoring function is constructed through weighted fusion to calculate the comprehensive importance score of the reasoning steps. The specific process is as follows:
[0026] Obtain the local and global perplexity changes for the current inference step, integrate the data from all inference steps to obtain a set of local perplexity changes, and standardize the set of global perplexity changes to obtain standardized local and global perplexity changes.
[0027] The standardized local and global variations are linearly combined according to their weights to obtain the comprehensive importance score of each step. The comprehensive scores of all steps are sorted from largest to smallest to obtain the importance ranking of each step, thus generating a set of comprehensive importance scores.
[0028] Furthermore, a pruning threshold is set, and the reasoning steps of the comprehensive importance score that meet the screening criteria are extracted. The key reasoning steps extracted are then smoothed to form a thought chain. The specific process is as follows:
[0029] Obtain the comprehensive importance score set of all reasoning steps, perform statistical analysis, and obtain the minimum, maximum, mean, and standard deviation;
[0030] The pruning threshold is set based on the mean and adjustment coefficient. Steps with a comprehensive importance score exceeding the pruning threshold are filtered out, marked as key steps and retained. They are then constructed into a key step sequence according to the order and smoothed to obtain smoothed text fragments.
[0031] The smoothed text is used as the final thought chain, and combined with the final diagnostic structure to generate the output of the thought chain.
[0032] Furthermore, based on a simplified thought process chain as the final reasoning basis, the results of pancreatic cancer risk prediction and the preprocessed key reasoning path are output. The specific process is as follows:
[0033] Based on the output of the thought chain, extract the final diagnostic conclusion. If the thought chain does not show a conclusion, re-input the thought chain into the base language model, add the prompt word "Please give the final diagnostic conclusion based on the above reasoning", generate the conclusion and add key evidence markers.
[0034] The generated thought chain is concatenated with the medical record prompt sequence to form the final inference input. The base language big model outputs the final diagnostic conclusion, including the diagnostic conclusion, key inference path, supporting evidence summary and pruned statistical information, and the generated structured diagnostic report is presented to clinicians in a visual form.
[0035] Furthermore, the specific construction process of the base large language model in step one is as follows:
[0036] Based on the pre-trained base language model as the basic framework, the base language model is pre-trained using medical text data. During the pre-training process, thought chain examples are added, and intermediate reasoning steps are output before generating the final conclusion.
[0037] The pre-trained base language model is encapsulated to provide a text generation interface and a conditional probability calculation structure. The input is a sequence of structured prompt words. Based on the input sequence of structured prompt words, the base language model generates an initial set of reasoning paths containing complete reasoning steps, as well as a final diagnostic conclusion. Each step is an independent natural language sentence, which together constitute a complete logical chain from medical record information to diagnostic conclusion.
[0038] A pancreatic cancer prediction system based on local and global perplexity weighted pruning includes a data acquisition module, a local assessment module, a global assessment module, a fusion scoring module, and a diagnostic output module.
[0039] The data acquisition module acquires the electronic medical record text data of the patients to be diagnosed, performs data filtering and processing, and constructs a structured prompt word sequence that conforms to the input specifications of the large language model. This sequence is then input into the base large language model, and an initial set of reasoning paths containing complete reasoning steps is generated through the thinking chain strategy.
[0040] The local evaluation module calculates the local importance of the current step based on the reasoning steps in the initial inference path set, evaluates the necessity of the current step in the context logic connection, and obtains the change in local perplexity by evaluating the change in perplexity of the predicted subsequent steps before and after removing the current step.
[0041] The global evaluation module calculates the change in global perplexity for the current reasoning step, which is used to evaluate the substantial contribution of the current step to the final diagnostic conclusion. The change in global perplexity is obtained by removing the change in perplexity of the final diagnostic conclusion generated before and after the current step.
[0042] The fusion scoring module constructs a comprehensive importance scoring function by weighted fusion based on the changes in local and global perplexity. It calculates the comprehensive importance score of the reasoning steps, sets a pruning threshold, extracts the reasoning steps with comprehensive importance scores that meet the screening criteria, and smooths the extracted key reasoning steps to form a thought chain.
[0043] The diagnostic output module, based on a simplified thought chain as the final reasoning basis, outputs pancreatic cancer risk prediction results and preprocessed key reasoning paths.
[0044] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0045] This pancreatic cancer prediction method and system, based on weighted pruning of local and global perplexity, constructs a structured cue word sequence and guides a large language model to generate an initial reasoning path. By calculating the change in local perplexity, it assesses the necessity of reasoning steps in logical coherence, automatically identifying steps that play a key role in contextual coherence and effectively distinguishing core logical nodes from redundant modifiers. By calculating the change in global perplexity, it assesses the contribution of reasoning steps to the final diagnostic conclusion, locating steps containing key medical evidence and directly measuring the support of each reasoning link for the diagnostic conclusion. By weighted fusion of local and global perplexity changes, a comprehensive importance scoring function is constructed to achieve a comprehensive analysis of reasoning steps. The adaptive pruning threshold setting automatically eliminates redundant steps, retains core reasoning nodes, and smooths the linguistic coherence of the pruned thought chain, ultimately forming a logically clear optimized thought chain, significantly improving reasoning efficiency. Based on the thought chain, it outputs pancreatic cancer risk prediction results and key reasoning paths, achieving complete clarity in the diagnostic process. Attached Figure Description
[0046] Figure 1 A schematic diagram of the overall structure of the method flow steps of the present invention is shown;
[0047] Figure 2 A schematic diagram of the overall system structure of the present invention is shown;
[0048] Figure 3 A schematic diagram comparing the inference results of the present invention, the inference results of inference without pruning optimization, and the non-inference results is shown. Detailed Implementation
[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and 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.
[0050] Example 1:
[0051] like Figure 1-3 As shown, the pancreatic cancer prediction method based on local and global perplexity weighted pruning is characterized by the following steps:
[0052] Step 1: Obtain the electronic medical record text data of the patient to be diagnosed, perform data filtering and processing, and construct a structured prompt word sequence that conforms to the input specifications of the large language model. Input the sequence into the base large language model, and generate an initial inference path set containing complete inference steps through the thinking chain strategy.
[0053] Step 2: Based on the reasoning steps in the initial inference path set, perform local importance calculation, evaluate the necessity of the current step in the context logic connection, and obtain the local perplexity change by evaluating the change in perplexity of the predicted subsequent steps before and after removing the current step.
[0054] Step 3: Calculate the global change in perplexity for the current reasoning step to assess the substantial contribution of the current step to the final diagnostic conclusion. The global change in perplexity is obtained by removing the change in perplexity of the final diagnostic conclusion generated before and after the current step.
[0055] Step 4: Based on the changes in local and global perplexity, construct a comprehensive importance scoring function through weighted fusion, calculate the comprehensive importance score of the reasoning steps, set a pruning threshold, extract the reasoning steps with comprehensive importance scores that meet the screening criteria, and smooth the extracted key reasoning steps to form a thought chain.
[0056] Step 5: Based on the thought chain as the final reasoning basis, output the pancreatic cancer risk prediction results and the preprocessed key reasoning path.
[0057] The thought chain strategy generates an initial set of reasoning paths containing complete reasoning steps. The specific process is as follows:
[0058] The electronic medical record text data of patients to be diagnosed is obtained from the hospital information system, and the data is cleaned and filtered. Structured fields are extracted and all data is sorted according to timestamps to construct the patient's time-series health record data. The preprocessed data is reorganized according to the optimal input format of the large language model to form a structured prompt word sequence containing three parts: role setting, task instructions, and data input.
[0059] The constructed complete structured prompt word sequence is input into the base big language model, which activates the chain thinking mode internally and guides the base big language model to use the thinking chain strategy for step-by-step reasoning. Before generating the final diagnosis, the base big language model generates intermediate reasoning steps sentence by sentence. Each step is a complete natural language sentence that expresses an independent medical reasoning logic.
[0060] The final conclusion is generated and all intermediate reasoning steps and their order are recorded, forming an initial reasoning path set. ,in Representing the One reasoning step, The total number of steps is used to preserve the original thought process that leads to the final conclusion from the medical record information.
[0061] Based on the reasoning steps in the initial inference path set, local importance is calculated to assess the necessity of the current step in the context of logical coherence. By evaluating the change in perplexity of predicted subsequent steps before and after removing the current step, the change in local perplexity is obtained. The specific process is as follows:
[0062] For the reasoning steps in the initial inference path set, select a step to be evaluated, and locate the preceding steps and adjacent subsequent steps of the step to be evaluated to construct a local context window;
[0063] Based on the cases of retaining the current step and removing the current step, we obtain the perplexity of the complete subsequent step and the perplexity of the missing subsequent step. Based on the current step and the preceding step, we calculate the baseline perplexity in the complete context, and based on the preceding step and removing the current step, we calculate the comparative perplexity after removing the current step.
[0064] Compare the levels of confusion Subtract the baseline perplexity We obtain the change in perplexity for predicting subsequent steps after removing the current step, store the obtained change in perplexity, and establish a mapping relationship with the current step.
[0065] In this scheme, the local perplexity calculation process is as follows:
[0066] Calculate the conditional probability: The language model generates subsequent steps based on this prefix. The conditional probability of each word, and the preceding steps and current steps Assemble in sequence, and set... From T words Composition, the predicted probability for each word element is The conditional probability of removing the lexical in the current step is: ;
[0067]
[0068]
[0069]
[0070] in, Indicates the first The change in local perplexity for each inference step; a larger value indicates the removal of... The more difficult it becomes to predict the next sentence, the stronger the logical connection between the steps. This indicates the number currently being evaluated. One reasoning step, express The immediately preceding step, express The immediately following steps; The perplexity calculation function for a language model measures the uncertainty of the model generating a specific text sequence. This indicates that the current step is being removed. In this case, based solely on the previous step Predict the next step Conditional perplexity This indicates that the current step is retained. Predicting in the complete context The baseline condition perplexity.
[0071] The change in global perplexity is calculated for the current inference step to assess its substantial contribution to the final diagnostic conclusion. This change is obtained by removing the perplexity changes in the final diagnostic conclusions generated before and after the current step. The specific process is as follows:
[0072] The original medical record prompt sequence is concatenated with the complete set of initial reasoning paths in sequence to form a complete input pre-processing step;
[0073] The final diagnostic conclusion output by the base language big model is used as the target text sequence to be evaluated. The preceding steps are input into the base language big model to obtain the conditional probability of each word in the diagnostic conclusion. The inverse of the geometric mean probability of all words is calculated to generate the global baseline perplexity.
[0074] The global perplexity calculation process in this scheme is as follows:
[0075]
[0076] in, Indicates the first The change in global perplexity for each reasoning step; the larger the positive value, the greater the contribution of the key information contained in that step to the confidence of the final diagnosis. This indicates the final diagnostic conclusion generated by the model, such as a high risk of pancreatic malignancy. This represents the structured cue word sequence containing the patient's complete medical record information constructed in step S1; Indicates that it includes all A complete set of initial inference paths for each step Indicates from set Remove the first Steps The remaining subset of reasoning paths; This indicates a prediction conclusion based on the complete reasoning path. The baseline perplexity, Indicates based on missing Incomplete path prediction conclusions The degree of confusion in comparison.
[0077] Based on the changes in local and global perplexity, a comprehensive importance scoring function is constructed through weighted fusion. The comprehensive importance score of each reasoning step is then calculated. The specific process is as follows:
[0078] Obtain the local and global perplexity changes for the current inference step, integrate the data from all inference steps to obtain a set of local perplexity changes, and standardize the set of global perplexity changes to obtain standardized local and global perplexity changes.
[0079] The standardized local and global changes are linearly combined according to their weights to obtain the comprehensive importance score of each step. The comprehensive scores of all steps are sorted from largest to smallest to obtain the importance ranking of each step, and a set of comprehensive importance scores is generated.
[0080] The process of weighted fusion of dual indicators and importance score calculation in this scheme is as follows:
[0081]
[0082] in, and As a weighting coefficient, if the logical fluency of reasoning is given more emphasis, it can be set to... If the accuracy of the conclusion is of greater importance, then let... , If it can be set =0.4, =0.6, on the validation set, try different combinations and select the weight combination that optimizes the performance after pruning. This represents the overall importance score of the i-th reasoning step; the higher the value, the greater the value of the step in the reasoning chain. An adjustment coefficient representing the weight of local logical coherence, used to set the proportion of logical fluency in the overall score; An adjustment coefficient representing the weight of the global diagnostic contribution, used to set the proportion of diagnostic accuracy in the total score; This represents the change in local perplexity after removing the i-th step, as determined by the evaluation, reflecting the contribution of the step to the contextual coherence. This represents the change in global perplexity after removing the i-th step, reflecting the degree to which this step supports the final diagnostic conclusion. It is adjusted... and The ratio can preserve key medical evidence while also ensuring the fluency of the reasoning report.
[0083] A pruning threshold is set, and the reasoning steps of the comprehensive importance scores that meet the screening criteria are extracted. The key reasoning steps extracted are then smoothed to form a thought chain. The specific process is as follows:
[0084] Obtain the comprehensive importance score set of all reasoning steps, perform statistical analysis, and obtain the minimum, maximum, mean, and standard deviation;
[0085] The pruning threshold is set based on the mean and adjustment coefficient. Steps with a comprehensive importance score exceeding the pruning threshold are filtered out, marked as key steps and retained. They are then constructed into a key step sequence according to the order and smoothed to obtain smoothed text fragments.
[0086] The smoothed text is used as the final thought chain, and combined with the final diagnostic structure to generate the output of the thought chain.
[0087] Based on a simplified thought process chain as the final reasoning basis, the results of pancreatic cancer risk prediction and the preprocessed key reasoning path are output. The specific process is as follows:
[0088] Based on the output of the thought chain, extract the final diagnostic conclusion. If the thought chain does not show a conclusion, re-input the thought chain into the base language model, add the prompt word "Please give the final diagnostic conclusion based on the above reasoning", generate the conclusion and add key evidence markers.
[0089] The generated thought chain is concatenated with the medical record prompt sequence to form the final inference input. The base language big model outputs the final diagnostic conclusion, including the diagnostic conclusion, key inference path, supporting evidence summary and pruned statistical information, and the generated structured diagnostic report is presented to clinicians in a visual form.
[0090] The specific construction process of the base large language model in step one is as follows:
[0091] Based on the pre-trained base language model as the basic framework, the base language model is pre-trained using medical text data. During the pre-training process, thought chain examples are added, and intermediate reasoning steps are output before generating the final conclusion.
[0092] The pre-trained base language model is encapsulated to provide a text generation interface and a conditional probability calculation structure. The input is a sequence of structured prompt words. Based on the input sequence of structured prompt words, the base language model generates an initial set of reasoning paths containing complete reasoning steps, as well as a final diagnostic conclusion. Each step is an independent natural language sentence, which together constitute a complete logical chain from medical record information to diagnostic conclusion.
[0093] The specific construction and training process of the base large language model is as follows:
[0094] S101. Obtain large-scale medical text corpus data, including electronic medical records, medical literature, clinical guidelines, and treatment standards. Integrate multiple sets of medical text data as training samples. Divide the generated training samples into training set, validation set, and test set according to a ratio of 7:2:1. Build a base large language model based on the Transformer architecture.
[0095] S102. Download the pre-trained general large language model weight file (such as Qwen3-8B) and load it onto the corresponding network architecture to initialize the model parameters and realize knowledge transfer.
[0096] S103. Modify the output layer of the model while keeping the input dimension unchanged. Set the output layer to adapt to the vocabulary probability distribution generated by medical text. Initialize the weights of this layer, use the gradient descent algorithm for learning, and use a fixed step size decay strategy to adjust the learning rate to optimize the training process. Retrain the entire network on the medical text corpus to obtain a medical-domain-adapted base large language model.
[0097] S104. During the training process, small batches of samples are randomly and non-repeatedly drawn from the training set for training. Each time the full training set is traversed, it is a training cycle. The training is completed when the loss on the validation set converges or the preset number of cycles is reached, and the final base large language model is obtained.
[0098] S205. Deploy the trained base language model on the server, providing text generation and conditional probability calculation interfaces. After constructing a structured prompt word sequence from the real-time collected electronic medical record text data of the patients to be diagnosed, input it into the model. Generate an initial inference path set containing complete inference steps and a final diagnostic conclusion through the thinking chain strategy.
[0099] The specific experimental reasoning process is as follows:
[0100] System prompt: You are a senior oncology expert. Please carefully analyze the electronic medical record information of the following patient to assess whether the patient is at risk of pancreatic cancer. Please provide a predictive conclusion based on the patient's diagnostic history, laboratory test results, medical history and other relevant information.
[0101] Input: Male patient, 62 years old, presented on December 10; Diagnosis: Bilateral allergic conjunctivitis;
[0102] A 63-year-old patient presented on August 7th; diagnosis: inguinal hernia; another 63-year-old patient presented on September 27th.
[0103] Blood test results: Glucose 4.66 mmol / L, D-dimer 1.2 ng / mL, Potassium 4.15 mmol / L, Alkaline phosphatase 83.2 U / L, Sodium 140.3 mmol / L, Alanine aminotransferase 25.7 U / L, Neutrophil percentage 55.9%, PT percentage activity 117.0%, Uric acid 278.7 μmol / L, Thrombin time 12.1 sec, Fibrinogen 3.2 g / L, Aspartate aminotransferase 23.9 U / L, Total bilirubin 16.7 μmol / L. / L, prothrombin time 10.5 sec, international normalized ratio 0.95 INR, thrombin time ratio 0.93, total bile acids 6.6 μmol / L, platelet count 152.0 × 10^9 / L, chloride 105.7 mmol / L, lymphocyte percentage 35.3%, white blood cell count 8.75 × 10^9 / L, gamma-glutamyl transferase 15.2 U / L, hemoglobin 137.0 g / L, albumin 44.5 g / L, creatinine 84.5 μmol / L, diagnosis: unilateral inguinal hernia;
[0104] The patient, aged 63, presented on September 28th with a 30-year smoking history. Chief complaint: a mass in the right lower abdomen for over two months. Diagnoses included: unilateral inguinal hernia, gout, and unilateral right inguinal hernia. On September 29th, further diagnoses included: right inguinal hernia, unilateral direct inguinal hernia, gout, unilateral inguinal hernia, spermatic cord lipoma, and right direct inguinal hernia. On October 1st, a unilateral inguinal hernia was diagnosed. On October 8th, the same unilateral inguinal hernia was diagnosed.
[0105] A 64-year-old patient presented on October 12th. Blood tests showed: white blood cell count 6.26 × 10^9 / L, creatinine 86.8 μmol / L, lymphocyte percentage 34.3%, hemoglobin 129.0 g / L, neutrophil percentage 55.2%, and platelet count 247.0 × 10^9 / L. Diagnosis: Benign prostatic hyperplasia (BPH).
[0106] A 64-year-old patient presented on October 13th with a 10-year smoking history. Chief complaint: dysuria, urgency, and pain for one week. Blood tests showed: D-dimer 2.3 ng / mL, albumin 47.9 g / L, alkaline phosphatase 85.7 U / L, aspartate aminotransferase 13.4 U / L, high-density lipoprotein 1.57 mmol / L, fibrinogen 3.49 g / L, thrombin time ratio 1.08, albumin electrophoresis 59.3%, cholesterol 4.9 mmol / L, uric acid 388.1 μmol / L, sodium 137.3 mmol / L, international normalized ratio 0.9 INR, and PT percentage activity 1. 27.0%, creatinine 86.8 μmol / L, thrombin time 14.1 sec, chloride 102.2 mmol / L, gamma-glutamyl transferase 13.9 U / L, prothrombin time 10.0 sec, glucose 5.45 mmol / L, magnesium 0.82 mmol / L, alanine aminotransferase 13.8 U / L, potassium 4.24 mmol / L, total bile acids 1.0 μmol / L, total bilirubin 26.6 μmol / L, triglycerides 0.52 mmol / L, low-density lipoprotein 2.78 mmol / L;
[0107] Abnormal blood test values: Total bilirubin 26.6 μmol / L, aspartate aminotransferase 13.4 U / L. Diagnosis: Postoperative right inguinal hernia surgery, inguinal hernia, benign prostatic hyperplasia, elevated PSA;
[0108] A 64-year-old patient presented on October 17th. Blood tests showed: hemoglobin 109.0 g / L, neutrophil percentage 75.7%, white blood cell count 11.14 × 10^9 / L, D-dimer 20.6 ng / mL, platelet count 199.0 × 10^9 / L, and lymphocyte percentage 16.2%. Abnormal blood test values included: white blood cell count 11.14 × 10^9 / L, lymphocyte percentage 16.2%, hemoglobin 109.0 g / L, and neutrophil percentage 75.7%.
[0109] A 64-year-old patient presented on October 20th with the following diagnoses: elevated PSA, benign prostatic hyperplasia, post-operative right inguinal hernia, and inguinal hernia.
[0110] Based on the above medical record information, assess whether the patient has a risk of pancreatic cancer, output whether there is a risk of pancreatic cancer or not, and explain in detail the basis for the judgment.
[0111] The inference results of the unpruned model are as follows:
[0112] No risk of pancreatic cancer:
[0113] 1. The patient was diagnosed with allergic conjunctivitis at age 62. This is an allergic reaction of the eye and is usually not directly related to pancreatic cancer, but it is necessary to pay attention to whether the patient has a systemic immune system abnormality.
[0114] 2. The patient visited the hospital multiple times at age 63 for inguinal hernia, on August 7, September 28, September 29, October 1, and October 8, and underwent surgical treatment.
[0115] Although hernia surgery itself is not related to pancreatic cancer, the stress response before and after surgery may affect blood sugar fluctuations. The patient's glucose level on September 27 was 4.66 mmol / L, which is within the normal range, temporarily ruling out the risk of diabetes caused by impaired pancreatic endocrine function.
[0116] 3. The patient has a 30-year history of smoking, which is an important risk factor. Smoking not only increases the risk of lung cancer, but is also a high-risk factor for pancreatic cancer. Current examinations mainly focus on the urinary system, such as benign prostatic hyperplasia and elevated PSA, and lack specific imaging examinations for the pancreas, such as CT and MRI.
[0117] 4. The patient has gout (diagnosed on September 28) and high uric acid levels (278.7 μmol / L, 388.1 μmol / L). Gout is a metabolic disease, and although it is not directly causally related to pancreatic cancer, it reflects the patient's poor metabolic status.
[0118] 5. Blood tests on October 13 showed a slight increase in total bilirubin (26.6 μmol / L), which may indicate a slight obstruction of the biliary system or abnormal liver function. Although pancreatic head cancer may compress the bile duct and cause jaundice, the increase in this indicator was small, and other liver enzyme indicators such as ALT, AST, and GGT were basically normal. Therefore, it is more likely to be a benign factor or physiological fluctuation.
[0119] In summary, despite a history of smoking and slightly elevated bilirubin, there was a lack of core evidence such as elevated CA19-9, sudden hyperglycemia, abdominal pain, and weight loss. Furthermore, a large number of medical records showed hernia and benign prostatic hyperplasia. Therefore, it was determined that there was no risk of pancreatic cancer.
[0120] Although the reasoning is correct, it contains a lot of redundant analysis that is irrelevant to the diagnosis of pancreatic cancer, such as details about conjunctivitis, gout, and hernia surgery. It is in an unpruned state.
[0121] Based on the final model inference results, the process to determine the absence of pancreatic cancer risk is as follows:
[0122] Excluding specific biochemical abnormalities: The patient's blood glucose level was stable in each blood test, such as 4.66 mmol / L on September 27 and 5.45 mmol / L on October 13. There were no signs of sudden hyperglycemia or new-onset diabetes common in early pancreatic cancer.
[0123] Key enzyme indicators were normal: key indicators reflecting pancreatobiliary patency—alkaline phosphatase (ALP) and gamma-glutamyl transferase (GGT)—were both within the normal range (e.g., ALP 85.7 U / L and GGT 13.9 U / L on October 13). Although total bilirubin was slightly elevated at 26.6 μmol / L, the lack of a synchronous increase in GGT did not support the hypothesis of pancreatic head tumor compressing the bile duct.
[0124] Lack of clinical symptom support: The patient's chief complaints and diagnoses during multiple visits were clearly focused on the genitourinary system, such as inguinal hernia and benign prostatic hyperplasia, without mentioning typical upper abdominal pain, radiating pain in the lower back, or unexplained sudden weight loss typical of pancreatic cancer.
[0125] Despite the patient's history of smoking, a high-risk factor, no pathophysiological evidence pointing to pancreatic malignancy was found when the entire chronological medical record was examined, and the current abnormal indicators could be explained by benign diseases.
[0126] Non-reasoning models only output "no risk of pancreatic cancer" and lack transparency of evidence. Non-reasoning models, such as traditional LSTM networks, can only calculate a probability value based on the input numerical sequence and cannot indicate which indicator's normality excludes the risk of cancer. For the abnormal point of slightly elevated bilirubin, doctors cannot know whether the model has taken it into consideration or simply ignored it due to missing data. This leads doctors to be hesitant to trust the model's judgment when faced with complex cases.
[0127] Unable to handle information redundancy and noise, electronic medical records contain a large amount of noise unrelated to pancreatic cancer, such as allergic conjunctivitis and inguinal hernia. Non-inference models usually treat all input features equally or based on statistical weights, making it difficult to extract key negative evidence, such as normal blood sugar, from a large amount of noise like human experts. This makes it easy to reduce the robustness of predictions due to noise interference when facing complex medical records with long sequences and multiple diseases.
[0128] Example 2:
[0129] like Figure 2 As shown, the pancreatic cancer prediction system based on local and global perplexity weighted pruning includes a data acquisition module, a local assessment module, a global assessment module, a fusion scoring module, and a diagnostic output module.
[0130] The data acquisition module acquires the electronic medical record text data of the patients to be diagnosed, performs data filtering and processing, and constructs a structured prompt word sequence that conforms to the input specifications of the large language model. This sequence is then input into the base large language model, and an initial set of reasoning paths containing complete reasoning steps is generated through the thinking chain strategy.
[0131] The local evaluation module calculates the local importance of the current step based on the reasoning steps in the initial inference path set, evaluates the necessity of the current step in the context logic connection, and obtains the change in local perplexity by evaluating the change in perplexity of the predicted subsequent steps before and after removing the current step.
[0132] The global evaluation module calculates the change in global perplexity for the current reasoning step, which is used to evaluate the substantial contribution of the current step to the final diagnostic conclusion. The change in global perplexity is obtained by removing the change in perplexity of the final diagnostic conclusion generated before and after the current step.
[0133] The fusion scoring module constructs a comprehensive importance scoring function by weighted fusion based on the changes in local and global perplexity. It calculates the comprehensive importance score of the reasoning steps, sets a pruning threshold, extracts the reasoning steps with comprehensive importance scores that meet the screening criteria, and smooths the extracted key reasoning steps to form a thought chain.
[0134] The diagnostic output module, based on a simplified thought chain as the final reasoning basis, outputs pancreatic cancer risk prediction results and preprocessed key reasoning paths.
[0135] The size of the interval and threshold is set to facilitate comparison. The size of the threshold depends on the amount of sample data and the number of bases set by those skilled in the art for each set of sample data; as long as it does not affect the ratio between the parameter and the quantized value.
[0136] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0137] In the two embodiments provided in this application, it should be understood that the disclosed apparatus and system can be implemented in other ways; for example, the apparatus embodiments described above are merely illustrative, and the division of modules is merely a logical functional division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed; furthermore, the coupling or direct coupling or communication connection between the shown or discussed mutuals can be through some interfaces, and the indirect coupling or communication connection between the apparatus or modules can be electrical, mechanical or other forms.
[0138] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A pancreatic cancer prediction method based on local and global perplexity-weighted pruning, characterized in that, Includes the following steps: Step 1: Obtain the electronic medical record text data of the patient to be diagnosed, perform data filtering and processing, and construct a structured prompt word sequence that conforms to the input specifications of the large language model. Input the sequence into the base large language model, and generate an initial inference path set containing complete inference steps through the thinking chain strategy. Step 2: Based on the reasoning steps in the initial inference path set, perform local importance calculations to assess the necessity of the current step in the contextual logical coherence. The change in local perplexity is obtained by evaluating the change in perplexity of predicted subsequent steps before and after removing the current step. The specific process is as follows: For the reasoning steps in the initial inference path set, select a step to be evaluated, and locate the preceding steps and adjacent subsequent steps of the step to be evaluated to construct a local context window; Based on the cases of retaining the current step and removing the current step, we obtain the perplexity of the complete subsequent step and the perplexity of the missing subsequent step. Based on the current step and the preceding step, we calculate the baseline perplexity in the complete context, and based on the preceding step and removing the current step, we calculate the comparative perplexity after removing the current step. Subtract the baseline perplexity from the comparison perplexity to obtain the change in perplexity for predicting subsequent steps after removing the current step. Store the obtained change in perplexity and establish a mapping relationship with the current step. Step 3: Calculate the global change in perplexity for the current reasoning step to assess the substantial contribution of the current step to the final diagnostic conclusion. The global change in perplexity is obtained by removing the change in perplexity of the final diagnostic conclusion generated before and after the current step. Step 4: Based on the changes in local and global perplexity, construct a comprehensive importance scoring function through weighted fusion, calculate the comprehensive importance score of the reasoning steps, set a pruning threshold, extract the reasoning steps with comprehensive importance scores that meet the screening criteria, and smooth the extracted key reasoning steps to form a thought chain. Step 5: Based on the thought chain as the final reasoning basis, output the pancreatic cancer risk prediction results and the preprocessed key reasoning path. The specific process is as follows: Based on the output of the thought chain, extract the final diagnostic conclusion. If the thought chain does not show a conclusion, re-input the thought chain into the base language model, add the prompt word "Please give the final diagnostic conclusion based on the above reasoning", generate the conclusion and add key evidence markers. The generated thought chain is concatenated with the medical record prompt sequence to form the final inference input. The base language big model outputs the final diagnostic conclusion, including the diagnostic conclusion, key inference path, supporting evidence summary and pruned statistical information, and the generated structured diagnostic report is presented to clinicians in a visual form.
2. The pancreatic cancer prediction method based on local and global perplexity weighted pruning according to claim 1, characterized in that, The thought chain strategy generates an initial set of reasoning paths containing complete reasoning steps. The specific process is as follows: The electronic medical record text data of patients to be diagnosed is obtained from the hospital information system, and the data is cleaned and filtered. Structured fields are extracted and all data is sorted according to timestamps to construct the patient's time-series health record data. The preprocessed data is reorganized according to the optimal input format of the large language model to form a structured prompt word sequence containing three parts: role setting, task instructions, and data input. The constructed complete structured prompt word sequence is input into the base big language model, which activates the chain thinking mode internally and guides the base big language model to use the thinking chain strategy for step-by-step reasoning. Before generating the final diagnosis, the base big language model generates intermediate reasoning steps sentence by sentence. Each step is a complete natural language sentence that expresses an independent medical reasoning logic. The final conclusion is generated and all intermediate reasoning steps and their order are recorded to form an initial reasoning path set, preserving the original thought chain from the medical record information to derive the final conclusion.
3. The pancreatic cancer prediction method based on local and global perplexity weighted pruning according to claim 1, characterized in that, The change in global perplexity is calculated for the current inference step to assess its substantial contribution to the final diagnostic conclusion. This change is obtained by removing the perplexity changes in the final diagnostic conclusions generated before and after the current step. The specific process is as follows: The original medical record prompt sequence is concatenated with the complete set of initial reasoning paths in sequence to form a complete input pre-processing step; The final diagnostic conclusion output by the base big language model is used as the target text sequence to be evaluated. The preceding steps are input into the base big language model to obtain the conditional probability of each word in the diagnostic conclusion. The inverse of the geometric mean probability is calculated for all words to generate the global baseline perplexity.
4. The pancreatic cancer prediction method based on local and global perplexity weighted pruning according to claim 1, characterized in that, Based on the changes in local and global perplexity, a comprehensive importance scoring function is constructed through weighted fusion. The comprehensive importance score of each reasoning step is then calculated. The specific process is as follows: Obtain the local and global perplexity changes for the current inference step, integrate the data from all inference steps to obtain a set of local perplexity changes, and standardize the set of global perplexity changes to obtain standardized local and global perplexity changes. The standardized local and global variations are linearly combined according to their weights to obtain the comprehensive importance score of each step. The comprehensive scores of all steps are sorted from largest to smallest to obtain the importance ranking of each step, thus generating a set of comprehensive importance scores.
5. The pancreatic cancer prediction method based on local and global perplexity weighted pruning according to claim 1, characterized in that, A pruning threshold is set, and the reasoning steps of the comprehensive importance scores that meet the screening criteria are extracted. The key reasoning steps extracted are then smoothed to form a thought chain. The specific process is as follows: Obtain the comprehensive importance score set of all reasoning steps, perform statistical analysis, and obtain the minimum, maximum, mean, and standard deviation; The pruning threshold is set based on the mean and adjustment coefficient. Steps with a comprehensive importance score exceeding the pruning threshold are filtered out, marked as key steps and retained. They are then constructed into a key step sequence according to the order and smoothed to obtain smoothed text fragments. The smoothed text is used as the final thought chain, and combined with the final diagnostic structure to generate the output of the thought chain.
6. The pancreatic cancer prediction method based on local and global perplexity weighted pruning according to claim 1, characterized in that, The specific construction process of the base large language model in step one is as follows: Based on the pre-trained base language model as the basic framework, the base language model is pre-trained using medical text data. During the pre-training process, thought chain examples are added, and intermediate reasoning steps are output before generating the final conclusion. The pre-trained base language model is encapsulated to provide a text generation interface and a conditional probability calculation structure. The input is a sequence of structured prompt words. Based on the input sequence of structured prompt words, the base language model generates an initial set of reasoning paths containing complete reasoning steps, as well as a final diagnostic conclusion. Each step is an independent natural language sentence, which together constitute a complete logical chain from medical record information to diagnostic conclusion.
7. A pancreatic cancer prediction system based on local and global perplexity-weighted pruning, used in the pancreatic cancer prediction method based on local and global perplexity-weighted pruning as described in any one of claims 1-6, characterized in that, It includes a data acquisition module, a local evaluation module, a global evaluation module, a fusion scoring module, and a diagnostic output module; The data acquisition module acquires the electronic medical record text data of the patients to be diagnosed, performs data filtering and processing, and constructs a structured prompt word sequence that conforms to the input specifications of the large language model. This sequence is then input into the base large language model, and an initial set of reasoning paths containing complete reasoning steps is generated through the thinking chain strategy. The local evaluation module calculates the local importance of the current step based on the reasoning steps in the initial inference path set, evaluates the necessity of the current step in the context logic connection, and obtains the change in local perplexity by evaluating the change in perplexity of the predicted subsequent steps before and after removing the current step. The global evaluation module calculates the change in global perplexity for the current reasoning step, which is used to evaluate the substantial contribution of the current step to the final diagnostic conclusion. The change in global perplexity is obtained by removing the change in perplexity of the final diagnostic conclusion generated before and after the current step. The fusion scoring module constructs a comprehensive importance scoring function by weighted fusion based on the changes in local and global perplexity. It calculates the comprehensive importance score of the reasoning steps, sets a pruning threshold, extracts the reasoning steps with comprehensive importance scores that meet the screening criteria, and smooths the extracted key reasoning steps to form a thought chain. The diagnostic output module, based on a simplified thought chain as the final reasoning basis, outputs pancreatic cancer risk prediction results and preprocessed key reasoning paths.
Citation Information
Patent Citations
System and method for fact-checking complex claims with program-guided reasoning
US20250148203A1
Systems and methods for jailbreaking black-box large language models
US20250181836A1