Ancient chinese medical book labeling method based on multi-dimensional context fusion for model self-adaptive optimization

By integrating multi-dimensional contextual features and hierarchical rank adaptive adjustment, the model adaptability and efficiency issues in the annotation of ancient Chinese medical books were solved, and high-precision, low-resource annotation effects were achieved.

CN120579557BActive Publication Date: 2025-10-21CHENGDU UNIV OF TRADITIONAL CHINESE MEDICINE
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511093495.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-10-21
Estimated Expiration
2045-08-06

AI Technical Summary

Technical Problem

When processing ancient Chinese medical texts, existing technologies have poor model adaptability, limited annotation accuracy, strong dependence on high-quality annotated data, high consumption of computing resources and difficulty in updating, making it difficult to adapt to ancient Chinese medical texts from different dynasties, schools and complex contexts.

Method used

By integrating dynasty background, genre characteristics, cross-language translation and scholar annotation features, and through hierarchical rank adaptive adjustment strategy and gradient coordinated optimization, the parameters of the language model are dynamically adjusted to generate high-precision annotation results.

Benefits of technology

It improves the annotation accuracy across schools and eras, reduces the demand for computing resources, improves the annotation efficiency and robustness, and adapts to the complexity and diversity of different ancient books.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120579557B_ABST
    Figure CN120579557B_ABST
Patent Text Reader

Abstract

The application relates to the fields of ancient book processing and large model technology and discloses a traditional Chinese medicine ancient book marking method for model self-adaptive optimization by fusing multidimensional context, which comprises the following steps: extracting multidimensional context features corresponding to a traditional Chinese medicine ancient book text; according to the multidimensional context features, dynamically determining the rank of low-rank self-adaption of at least one level in a target language model through a hierarchical rank self-adaptive adjustment strategy, and obtaining an optimized target language model after fine-tuning; inputting the traditional Chinese medicine ancient book text and the multidimensional context features into the optimized target language model to generate a preliminary marking result, applying a rule engine to correct the preliminary marking result, and outputting a final marking result. The application can more deeply understand the connotation of the ancient book text, accurately identify the semantic differences of the same term in different schools or different dynasties, and improve the marking accuracy of the ancient books across schools and eras.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of ancient book processing and large model technology, and in particular to a method for annotating ancient Chinese medical books by integrating multi-dimensional contexts for model adaptive optimization. Background Art

[0002] Ancient Chinese medical texts are the jewels of Chinese medicine, embodying thousands of years of systematic theoretical systems, rich clinical experience, and profound cultural philosophy. However, digitizing and structuring this vast amount of unstructured knowledge to achieve its efficient utilization and inheritance is a major challenge currently faced. The challenges mainly stem from the uniqueness of ancient Chinese medical texts: first, their language system is highly abstract, ambiguous, and literary. Core concepts such as "yin and yang, the five elements," and "qi, blood, and body fluids" are rich in connotation and difficult to simply define with standardized labels. Second, medical knowledge is deeply bound to complex contexts. The precise meaning of the same term may vary in different eras, with different scholars' annotation characteristics, or in different contexts.

[0003] To address these issues, existing technologies primarily employ deep learning-based approaches for entity recognition and relationship extraction. For example, some approaches build entity dictionaries and combine models like recurrent neural networks (RNNs) and conditional random fields (CRFs) to train pre-annotated corpora to construct knowledge graphs. Others aim to automatically generate training corpora through techniques like remote supervision or phrase mining, reducing reliance on manual annotation.

[0004] However, when the existing technical solutions are applied to the processing of ancient Chinese medical books, there are still the following problems that need to be solved:

[0005] 1. Poor model adaptability and limited annotation accuracy: Existing models typically use fixed structures and parameters for fine-tuning, failing to adapt to the linguistic characteristics and knowledge density of different ancient texts (e.g., across dynasties, schools, and schools of thought). In particular, the connotations of the same term can differ significantly across different academic schools. For example, the term "shanghan" (febrile disease) refers to different pathological categories and dialectical approaches in the theoretical framework of the Zhongjing School of the Han Dynasty and the Warm Disease School of the Qing Dynasty. Existing models struggle to capture these deep-seated differences in academic context, resulting in insufficient annotation accuracy and generalization when dealing with diverse and complex ancient texts.

[0006] 2. Strong dependence on high-quality annotated data: Most models rely on large amounts of high-quality manually annotated data for training. However, the professionalism of ancient Chinese medical texts makes annotation costs high and it is difficult to ensure unified standards. Data quality issues directly affect model performance.

[0007] 3. High computing resource consumption and difficulty updating: Fine-tuning all parameters of large-scale language models requires enormous computing resources, and the training process is time-consuming. Furthermore, once the model is trained, its knowledge becomes static. With the constant emergence of new research and concepts, the model needs to be retrained to update, which is inefficient.

[0008] Therefore, how to reduce the dependence on manually annotated data and enable the model to adaptively and efficiently optimize according to the complexity of the text itself and the contextual background to improve the accuracy and efficiency of the annotation of ancient Chinese medical books is a technical problem that needs to be solved urgently in this field. Summary of the Invention

[0009] To address the aforementioned problems in the prior art, the present invention aims to provide a method and related system for annotating ancient Chinese medical texts that integrates multi-dimensional contextual information to achieve adaptive optimization of language models, thereby resolving the accuracy bottlenecks and efficiency issues faced by prior art when processing highly complex and uniquely linguistically diverse ancient texts. The technical solutions provided by the present invention include:

[0010] The method for annotating ancient Chinese medical books by integrating multi-dimensional context for model adaptive optimization includes the following steps:

[0011] S1. Extracting multi-dimensional contextual features corresponding to the text of ancient Chinese medical books, wherein the multi-dimensional contextual features include at least dynasty background features, school features, cross-language translation features, and scholar annotation features;

[0012] S2. Based on the multi-dimensional context features, dynamically determine the low-rank adaptive rank of at least one level in the target language model through a hierarchical rank adaptive adjustment strategy, and obtain an optimized target language model after fine-tuning;

[0013] S3. Input the ancient Chinese medical text and the multi-dimensional context features into the optimized target language model to generate preliminary annotation results, apply the rule engine to make corrections, and output the final annotation results.

[0014] Preferably, the layer rank adaptive adjustment strategy includes:

[0015] Calculating the dynasty term density, school term density, and context entropy corresponding to at least one level of the ancient Chinese medical text in the target language model;

[0016] The low-rank adaptive rank is calculated and determined by a preset weight formula according to the dynasty term density, the genre term density and the context entropy.

[0017] Preferably, the preset weight formula includes:

[0018] ;in, Represents the LoRA rank after adjustment of the lth layer; represents the density of dynasty terms at level l; Indicates rounding up; is the context entropy; Fl represents the The density of genre terms in the layer; α, β and is the preset weight coefficient; C and D are the preset upper and lower thresholds of the rank.

[0019] Preferably, the fine-tuning method includes: introducing a gradient mask guided by the scholar's annotation features, enhancing the gradient update at the term position covered by the scholar's annotation features, and retaining the basic model gradient effect or weakening the gradient update at the non-annotated term position to perform gradient coordinated optimization on the model parameters.

[0020] Preferably, the gradient coordination optimization further comprises: enhancing the gradient of the position of the genre-specific term contained in the genre term dictionary according to a preset genre term dictionary.

[0021] Preferably, extracting the dynasty background features includes: parsing dynasty information from metadata of the ancient Chinese medical text, and constructing a Chinese medical dynasty terminology dictionary to generate a dynasty embedding vector.

[0022] Preferably, extracting the genre features includes: parsing genre labels from metadata of the ancient Chinese medical texts, and constructing a Chinese medical genre term dictionary to generate a genre embedding vector.

[0023] Preferably, extracting the cross-language translation features includes:

[0024] Using a preset translation model to semantically align the original text of the ancient Chinese medical text with its modern translation;

[0025] A quality assessment model is used to evaluate the semantic similarity and sentence structure consistency of the alignment results to generate the cross-language translation features.

[0026] Preferably, extracting the scholar annotation features includes: using a BIO annotation method to identify term definitions in the scholar annotation feature text, and generating an annotation feature matrix.

[0027] Preferably, the rule engine includes correction rules based on professional knowledge in the field of traditional Chinese medicine, naming conventions of medical classics or preset by experts in the field, and the correction rules also include at least one of the naming conventions of genre terms or logical constraints of genre concepts.

[0028] Beneficial effects

[0029] 1. This invention integrates multi-dimensional contextual features such as dynasty background, school characteristics, cross-language translation, and scholar annotation features, and performs refined dynamic parameter adjustments on the model, enabling the model to have a deeper understanding of the connotation of ancient texts. By integrating the dual-dimensional context of school and dynasty, the model can accurately identify the semantic differences of the same term in different schools or dynasties (for example, the difference in the connotation of the word "stroke" in the Tang and Song dynasties and the Ming and Qing febrile disease schools), thereby improving the annotation accuracy of ancient books across schools and eras.

[0030] 2. The present invention adopts a hierarchical rank adaptive adjustment strategy, which only requires optimization of a very small number of parameters during fine-tuning, greatly reducing the demand for computing resources. The single-batch processing speed is significantly improved, making it possible to adapt large models to professional fields with limited resources.

[0031] By dynamically adjusting the LoRA rank, the present invention can automatically adapt to ancient texts from different dynasties, academic schools, and genres. Even in low-resource scenarios with sparse data, the present invention can still maintain a high annotation accuracy, demonstrating strong robustness and domain adaptability. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic flow chart of a method for annotating ancient Chinese medical books by integrating multi-dimensional contexts and performing model adaptive optimization, provided in a preferred embodiment of the present invention;

[0033] Figure 2 A comparison chart of experimental results with key terms provided in the experimental examples of the present invention;

[0034] Figure 3 A comparison chart of the experimental results of the number of trainable parameters provided in the experimental examples of the present invention;

[0035] Figure 4 A comparison chart of the training time experimental results provided in the experimental examples of the present invention;

[0036] Figure 5 A comparison chart of single batch processing speed results provided in the experimental examples of the present invention;

[0037] Figure 6 A comparison chart of the experimental results of the cross-paragraph term association accuracy provided in the experimental examples of the present invention;

[0038] Figure 7 This is a comparison chart of the experimental results of the maximum processing length of long texts provided in the experimental examples of the present invention. DETAILED DESCRIPTION

[0039] In order to make the objectives, technical solutions, and advantages of the present invention more clearly understood, the technical solutions of the present invention will be described in detail below with reference to specific embodiments. However, it should be understood that persons skilled in the art may make various changes or modifications to the present invention, and such changes or modifications are intended to fall within the scope of protection of the present invention.

[0040] Traditional methods for annotating ancient Chinese medical texts often face problems such as insufficient annotation accuracy, weak model generalization, and high computational resource consumption when dealing with ancient texts with abstract language, complex context, and strong technical content. For example, the connotation of a term may vary slightly in works from different dynasties or under the annotations of different scholars, and existing technologies have difficulty effectively capturing and utilizing this deep contextual information. This invention addresses the above-mentioned technical problems and proposes a method and related system for annotating ancient Chinese medical texts that integrates multi-dimensional context for model adaptive optimization. The core idea of ​​this method is to systematically extract and integrate multi-dimensional contextual features such as the dynasty background of the ancient text, cross-language translation content, and scholar annotation features, and use these features to dynamically and adaptively guide and optimize the fine-tuning process of a deep learning language model (hereinafter referred to as the "target language model"), thereby significantly improving the accuracy and efficiency of annotation of ancient Chinese medical texts, especially key terms and complex concepts.

[0041] The technical solution proposed by the present invention will be described in detail below. Figure 1 As shown, the present invention can generally include the following core stages: first, for a given ancient Chinese medical text, the corresponding multi-dimensional context features are systematically extracted; second, based on the extracted features, a novel hierarchical rank adaptive adjustment strategy is adopted to optimize the fine-tuning process of the target language model; finally, the optimized model is used to annotate the text, and post-processing correction is performed in combination with the rule engine to output the final high-quality annotation results.

[0042] S1. Extract multidimensional contextual features corresponding to the ancient TCM text, where these multidimensional contextual features include at least dynasty background features, school of thought features, cross-language translation features, and scholar annotation features. This step aims to provide rich and valuable contextual information for subsequent model optimization.

[0043] Those skilled in the art will recognize that Traditional Chinese Medicine (TCM) theories and terminology evolve over different historical periods. To capture this temporal dimension, the present invention proposes extracting dynastic context features. Specifically, the process first automatically parses metadata associated with the ancient TCM text to be processed (e.g., title, author, year of publication, etc.) to determine the dynasty to which it belongs. Next, to convert this discrete dynasty information into numerical features understandable to the model, a "TCM Dynasty Terminology Dictionary" can be constructed. This dictionary, constructed through statistical analysis of a large-scale corpus, is used to identify the frequency of occurrence, typical usage, or specific meaning of key TCM terms in each dynasty. Based on this dictionary, each dynasty can be represented as a high-dimensional dynasty embedding vector. This vector can quantitatively characterize the medical language style, theoretical focus, and terminology preferences of a specific dynasty, thereby providing an important historical contextual reference for the model's understanding of the ancient text. Preferably, based on the logic of extracting dynasty background features, the school label to which the ancient Chinese medical text belongs is parsed from the metadata of the ancient Chinese medical text to be processed (such as the school to which the author belongs, the title page annotation of the book, the academic inheritance record, etc.), such as "Zhongjing School", "Warm Disease School", "Four Great Masters of Jin and Yuan Dynasty", etc. At the same time, a pre-built "Dictionary of Chinese Medical School Terminology" is maintained, which counts and includes the core or unique terms of a specific school (for example, "Wei Qi Ying Xue", "Li Qi", etc. of the Warm Disease School). Based on the parsed school label and with reference to the dictionary, a school embedding vector is generated for the ancient text. The vector quantitatively characterizes the academic school tendency, terminology preference and core theoretical system of the text, thereby providing the model with key academic school context.

[0044] The dynasty background characteristics and school characteristics form a dual time / academic dimension of "dynasty + school", enhancing the accuracy of contextual semantic analysis.

[0045] Considering the conciseness and ambiguity of the original texts of ancient Chinese medical books (usually written in classical Chinese), introducing their modern translations (such as vernacular or English translations) can provide clearer semantic correspondences and help eliminate ambiguity. The present invention extracts cross-language translation features in the following way. First, a preset, powerful multilingual translation model, such as the mBART (multilingualBART) model, is used to input and process the original text of the ancient book and its corresponding modern translation in pairs, with the goal of achieving deep alignment between the two at the semantic representation level. During the alignment process, techniques such as contrastive loss functions can be used to narrow the distance between the representation vectors of the original text and the translation in the model's latent semantic space, so that the model learns cross-language semantic equivalence.

[0046] In order to ensure the quality of alignment, the present invention further introduces a quality assessment model. The assessment model can be built based on models with strong semantic understanding capabilities, such as DeepSeek. The evaluation process includes two aspects: one is the calculation of semantic similarity, such as by calculating the cosine similarity between the corresponding words or sentence embedding vectors of the original and translated texts, and judging whether it is higher than a preset threshold (for example, 0.7); the other is sentence structure consistency analysis, such as by generating respective dependency trees and using algorithms such as tree edit distance to calculate structural similarity, and judging whether it is higher than a preset threshold (for example, 0.6). Only when the comprehensive quality score meets the requirements, its aligned semantic representation vector, sentence structure representation and other information will be adopted as the final cross-language translation features. This ensures that the introduced translation information is high-quality and reliable, and can effectively assist the model in more accurate semantic understanding.

[0047] Furthermore, the annotations of ancient books by scholars throughout history are a valuable resource for understanding their deeper meanings. This paper proposes extracting features from scholarly annotations to leverage this expert knowledge. Specifically, we first collect the features of scholarly annotations related to the ancient text. Then, we use the BIO (Beginning, Inside, Outside) annotation method, commonly used in sequence annotation, to process the annotations to automatically identify and extract definitions, explanations, and interpretations of key terms. For example, for the annotation "Guizhi Decoction, the combination of cinnamon twig and peony root can harmonize the Ying and Wei meridians," we could annotate "Guizhi Decoction" as a "B-prescription name" and "cinnamon twig" as a "B-herbal ingredient name." This method transforms unstructured annotation text into structured feature information, ultimately generating an annotation feature matrix. Each row of this matrix corresponds to an annotation, and each column to a feature dimension, whose values ​​reflect key information such as term definitions contained in the annotation text. This matrix can then be used to directly guide the model's learning process, focusing on terms that have been clearly explained by experts.

[0048] S2. Based on the multi-dimensional context features, the rank of the low-rank adaptation of at least one level in the target language model is dynamically determined through a hierarchical rank adaptive adjustment strategy, and the optimized target language model is obtained after fine-tuning.

[0049] After acquiring these multi-dimensional contextual features, the present invention does not simply feed them as standard input to the model. Instead, it creatively utilizes these features to dynamically and precisely control the model's own fine-tuning process. The core of this step is a hierarchical rank adaptive adjustment strategy combined with an annotation-guided gradient coordination optimization mechanism.

[0050] Specifically, this invention uses Low-Rank Adaptation (LoRA) technology to efficiently fine-tune the parameters of the target language model. The core idea of ​​LoRA is to train the model by adding a low-rank factorization matrix (i.e., the product of two small matrices) in parallel to the original weight matrix, significantly reducing the number of parameters required for training. However, traditional LoRA typically uses a fixed rank for all layers, ignoring the diversity of information processed at different levels of the model.

[0051] Some preferred embodiments improve this by proposing a layer-by-layer rank adaptive adjustment strategy. This strategy assumes that different ranks should be assigned to layers in the model that process information of different complexity. Specifically, for at least one layer in the target language model (e.g., different intermediate layers of the encoder), three key metrics are calculated:

[0052] Dynastic term density ( ) refers to the proportion of professional terms in the field of traditional Chinese medicine in the input content of the current level. Its calculation formula is: The higher the density of dynasty terms, the more domain-specific the content handled by this layer. For the Dynastic term density of layers.

[0053] Domain terminology refers to professional terminology in the field of Traditional Chinese Medicine, including basic concepts in Traditional Chinese Medicine theory (such as Qi, blood, Yin, Yang, meridians, etc.), names of symptoms (such as cold, cough, insomnia, etc.), names of prescriptions (such as Guizhi Decoction, Mahuang Decoction, etc.), names of Chinese medicines (such as ginseng, astragalus, angelica, etc.), and related diagnostic methods (such as observation, auscultation, questioning, palpation, etc.), treatment methods (such as acupuncture, massage, etc.), etc.

[0054] Contextual Entropy ( ): It is used to measure the semantic diversity and uncertainty of the input content at the current level. Its calculation formula is: ,in, is the context entropy of the lth layer, is the probability of the i-th word appearing in the current context. A layer with a high density of dynasty terms may indicate that the context in that layer contains a large number of domain terms. This affects the probability distribution of words, making the occurrence probability of domain terms relatively high, thereby affecting the calculation of contextual entropy. Contextual entropy measures the semantic diversity of the input features in the i-th layer and directly reflects the breadth of the model's understanding of the current context. Higher entropy values ​​indicate that the model believes the current context may have multiple semantic interpretations or diverse subsequent word choices.

[0055] School term density (Fl): refers to the proportion of unique terms of a certain school of TCM in the input content at the current level. Its calculation formula is: The higher the density of school terms, the more the content processed by this layer tends to be related to a certain school of Chinese medicine. is the density of school terms at the first level. School-specific terms are key variables in the context of ancient Chinese medical texts (the same term can have significantly different connotations in different schools, such as the difference between the term "shanghan" in the Zhongjing School and the Warm Disease School). By dynamically adjusting the rank based on the proportion of school-specific terms, the model assigns higher ranks to texts with dense school characteristics (such as "Wenbing Tiaobian") (enhancing learning ability) and lower ranks to texts that are common across schools (saving resources), without the need to restructure the adjustment strategy framework.

[0056] According to the dynasty term density and the context entropy, the low-rank adaptive rank is calculated and determined by a preset weight formula. In some preferred embodiments, the preset weight formula includes:

[0057] ;in, Represents the LoRA rank after adjustment of the lth layer; represents the density of dynasty terms at level l; Indicates rounding up; is the context entropy; Fl represents the The density of genre terms in the layer; α, β and is a preset weight coefficient used to balance the importance of the three indicators (for example, α=0.5, β=0.3, =0.2); C and D are preset upper and lower rank thresholds (for example, the upper limit is 20 and the lower limit is 2) to ensure that the rank value is within a reasonable range.

[0058] This weight distribution method automatically assigns higher ranks to layers with dense domain terminology, obvious genre bias, and complex semantics in the input content, enabling them to have stronger learning and expression capabilities. Conversely, lower ranks are assigned to layers with dense domain terminology, conserving computing resources. This adaptive mechanism makes the model fine-tuning process more intelligent and efficient.

[0059] When the rank of each layer is determined and fine-tuned, in other preferred embodiments, a gradient coordination optimization mechanism guided by scholar annotation features is also introduced. This is intended to allow the model to pay more attention to knowledge points endorsed by expert annotations during the learning process. In specific implementation, the scholar annotation feature matrix generated in the first stage is used to construct an annotation-guided gradient mask. When the model performs backpropagation to calculate the gradient, the mask modulates the gradient. The specific fine-tuning method includes: enhancing the gradient update at the term position covered by the scholar annotation feature, while retaining the basic model gradient influence or weakening the gradient update at the non-annotated term position, so as to perform gradient coordination optimization on the model parameters.

[0060] For example, for a gradient vector , the updated gradient It can be calculated by the following formula:

[0061] ;in, represents the annotation-guided gradient mask; Represents the gradient of the base model; ʘ represents element-wise multiplication. Gradient mask In the , positions corresponding to term nodes covered by scholar annotation features are set to a boost coefficient greater than 1 (e.g., 1.5), while at non-annotated term positions, the value is set to a dampening coefficient less than 1 (e.g., 0.5) or directly to 1 to preserve the influence of the base model gradient. When updating model parameters, knowledge related to expert annotations receives a stronger gradient signal, allowing it to be more fully learned and memorized by the model, effectively improving the accuracy of key term recognition.

[0062] In a more optimized implementation, this coordinated gradient optimization mechanism operates in two parallel ways: first, a gradient mask guided by "scholar annotation features" is introduced; second, a "school term gradient enhancement" logic is added. Specifically, based on the "Dictionary of Chinese Medicine School Terminology," a gradient enhancement factor (e.g., 1.2) is applied to school-specific terms (such as "Six-Jing Differentiation" for the Zhongjing School) contained in the dictionary, while non-school terms retain the original gradient processing logic. This dual enhancement mechanism enables the model to prioritize learning and mastering core knowledge jointly certified by experts and specific academic schools, greatly improving learning efficiency and the ability to grasp deeper semantics.

[0063] S3. Input the ancient Chinese medical text and the multi-dimensional context features into the optimized target language model to generate preliminary annotation results, apply the rule engine to make corrections, and output the final annotation results.

[0064] In some preferred embodiments, in order to effectively process the large amount of long continuous text commonly found in ancient Chinese medical books, the backbone network of the model can use a model such as Longformer that is good at processing long sequences. It uses a sliding window attention mechanism to effectively capture semantic dependencies across long distances, avoiding the problem of semantic breaks caused by text truncation.

[0065] Those skilled in the art will recognize that any statistically based model may produce individual errors that do not fully conform to domain standards. To this end, the present invention introduces a rule engine to perform post-processing and correction on preliminary results. This rule engine embeds a set of correction rules based on professional knowledge in the field of Traditional Chinese Medicine. These rules can be preset by domain experts and cover, for example, naming conventions in medical texts (e.g., "prescription names must include the number of medicinal ingredients + efficacy keywords"), hierarchical relationships between terms, and logical constraints between entities. In some preferred embodiments, the correction rules also include at least one of naming conventions for school terms or logical constraints for school concepts. For example, school term naming conventions include the fact that prescriptions of the Zhongjing School are often named "decoction" (e.g., Guizhi Decoction), while prescriptions of the Four Great Masters of the Jin and Yuan Dynasties are often named "powder" or "pill" (e.g., Jiuwei Qianghuo Pill). For example, the "attack down" treatment method is more widely applicable in the theories of Zhang Congzheng (the attack down school), but requires caution in the theories of Li Dongyuan (the Bu Tu school), with strict logical constraints on its scope of application. The rule engine automatically scans the model's output, checking and correcting annotations that don't conform to pre-set rules, further improving the accuracy and standardization of the final results. Ultimately, the system outputs corrected, high-quality annotations that can be directly used in downstream applications such as ancient book digitization and knowledge graph construction.

[0066] Experimental example

[0067] 1. Experimental preparation

[0068] 1.1. Data collection and organization: 700 ancient Chinese medical books collected in the early stage were used, covering representative medical literature from the Han Dynasty to the Qing Dynasty, including classic works such as "Huangdi Neijing", "Shanghan Lun" and "Taiping Huimin Hejijufang" as well as literature of niche medical scholars.

[0069] 1.2 Data preprocessing:

[0070] Annotate metadata for each ancient book, including information such as dynasty, school, author, and genre;

[0071] Provide modern vernacular translations for each ancient book and English translations for some ancient books;

[0072] Organize scholars' annotations on ancient book terms and build an annotation corpus;

[0073] 2. Experimental steps

[0074] S1. Multidimensional contextual feature extraction.

[0075] Step 1: Dynasty background feature extraction.

[0076] Objective: Extract dynasty information from ancient book metadata and generate dynasty embedding vectors.

[0077] Implementation:

[0078] Parsing dynasty information from metadata of 700 ancient Chinese medical books.

[0079] Construct a "Dictionary of Traditional Chinese Medicine Dynasty Terminology" and count the frequency of occurrence of each term in each dynasty.

[0080] The dynasty information is mapped to a 10-dimensional vector space to generate a dynasty embedding vector D∈R^(d×T) (d is the embedding dimension, T is the number of dynasties).

[0081] Step 2: Genre feature extraction.

[0082] Objective: Extract genre information from ancient book metadata and generate genre embedding vectors.

[0083] Implementation:

[0084] Parse school labels (such as "Zhongjing School", "Warm Disease School", etc.) from ancient book metadata.

[0085] Construct a "Dictionary of Chinese Medicine Schools of Terminology" to count and include the core or unique terms of specific schools.

[0086] The genre information is mapped into a 10-dimensional vector space to generate a genre embedding vector to quantitatively represent the theoretical system and terminology preferences of each genre.

[0087] Step 3: Cross-language translation feature extraction.

[0088] Objective: Align the original text of ancient books with modern translations and extract cross-lingual semantic features.

[0089] Implementation:

[0090] The mBART model was used to align the original text of ancient books (classical Chinese) with modern translations (vernacular / English), and to calculate semantic similarity (threshold 0.7) and structural similarity (threshold 0.6).

[0091] Enforcing cross-lingual semantic representation alignment via contrastive loss function.

[0092] The DeepSeek model was used to evaluate the alignment results, including semantic similarity and sentence structure consistency analysis. If the comprehensive score was lower than 0.65, the alignment was performed again.

[0093] Step 4: Scholar annotation feature extraction.

[0094] Objective: To identify term definitions from scholars' annotation features and generate an annotation feature matrix.

[0095] Implementation:

[0096] Use BIO notation to identify term definitions in annotations.

[0097] Generate the annotation feature matrix A∈R^(n×m) (n is the number of annotation entries, m is the feature dimension).

[0098] S2. Adaptive adjustment of layer rank.

[0099] Step 1: Calculate the density of dynasty terms in each layer.

[0100] Objective: To measure the proportion of TCM terms in input features.

[0101] Implementation:

[0102] Count the number of domain terms (such as "qi and blood", "Guizhi decoction", etc.) and the total number of words in each layer of input.

[0103] The density of dynasty terms is calculated according to the formula Tl=(number of field terms / total number of words)×100%.

[0104] Step 2: Calculate context entropy.

[0105] Goal: Measure the semantic diversity of input features.

[0106] Implementation:

[0107] Calculate the probability distribution of each word in the context.

[0108] According to the formula Calculate context entropy.

[0109] Step 3: Calculate the term density of each genre in each layer.

[0110] Objective: To measure the proportion of genre-specific terms in the input features.

[0111] Implementation:

[0112] Count the number and total number of unique terms of each genre in each layer of input.

[0113] According to the formula Compute genre term density.

[0114] Step 4: Dynamically adjust LoRA rank.

[0115] Objective: Adaptively adjust LoRA rank based on dynasty term density and context entropy.

[0116] Implementation:

[0117] The adjusted LoRA rank is calculated according to the formula rl=min(20,max(2,[0.5×Tl+0.3×Cl+0.2×Fl])), and the result is limited to the range of 2-20.

[0118] S3. Gradient coordination optimization.

[0119] Step 1: Generate multi-source guided gradient masks.

[0120] Objective: Apply gradient boosting to key term nodes.

[0121] Implementation:

[0122] Construct annotation-guided gradient masks: determine key term positions based on scholar annotation features, set the annotation coverage term positions to 1.5, and non-annotation positions to 0.5.

[0123] Construct a gradient mask for school terms: For the positions of school-specific terms in the "Dictionary of Chinese Medicine School Terms", also set the gradient enhancement coefficient (such as 1.2).

[0124] Step 2: Update the model gradients.

[0125] Objective: To adjust the gradient by combining external knowledge and enhance the learning ability of key terms.

[0126] Implementation:

[0127] According to the formula Update the gradient, where G A Annotation-guided gradient mask.

[0128] S4. Multi-strategy fusion processing.

[0129] Step 1: Long text processing.

[0130] Goal: Use the Longformer model to process long texts and capture long-distance dependencies.

[0131] Implementation:

[0132] Load the Longformer model and use the sliding window attention mechanism (window size 512).

[0133] Input ancient book text with a maximum length of 16K characters and output contextual semantic representation.

[0134] Step 2: Rule engine post-processing.

[0135] Objective: To correct annotation results based on knowledge in the field of Traditional Chinese Medicine.

[0136] Implementation:

[0137] Define general rules (such as "the name of a prescription must contain the number of medicinal ingredients + efficacy keywords").

[0138] Define the rules specific to each school, for example: the prescriptions of the Zhongjing school are mostly named "decoction", while the prescriptions of the Jin and Yuan schools are mostly named "powder" and "pill"; and the scope of application of the "attack xia" method is restricted among different schools.

[0139] Apply the rule engine to perform post-processing correction on the preliminary annotation results of the model.

[0140] 3. Comparative experimental design and result analysis.

[0141] (A) Comparative experimental setup.

[0142] 1. Selection of comparison methods: Based on the analysis of existing technologies, the following three representative methods are selected for comparison:

[0143] Comparative Method 1: A method and system for extracting traditional Chinese medicine terms based on ancient Chinese medical literature is disclosed in Chinese invention patent publication number CN117633157A, which adopts named entity recognition + scoring screening strategy.

[0144] Comparison method 2: A method, device, electronic device, storage medium, and computer program product for extracting entities from ancient Chinese medical books disclosed in Chinese invention patent publication number CN118504564A, which selects the optimal extraction method through accuracy evaluation.

[0145] Comparison method 3: The large model construction method and device for the vertical field of traditional Chinese medicine disclosed in the Chinese invention patent publication number CN118841183A adopts a full-parameter pre-training + supervised fine-tuning strategy.

[0146] Comparison method 4: A variant of the present invention (containing only dynasty background features, without genre features) is used to verify the gain effect of genre features.

[0147] 2. Experimental data set division:

[0148] We randomly selected 500 of the 700 ancient Chinese medical texts as the training set, 100 as the validation set, and 100 as the test set. The test set includes ancient texts from different dynasties (Han, Tang, Song, Ming, and Qing), genres (theoretical works, prescriptions, and medical records), and schools of thought.

[0149] 3. Evaluation indicators:

[0150] 1. Cross-genre term F1 value (Precision, Recall, F1 Score).

[0151] 2. Accuracy of cross-genre polysemous term disambiguation (the percentage of terms with different semantics correctly distinguished).

[0152] 3. Number of training parameters and training time.

[0153] 4. Accuracy of cross-paragraph term association recognition in long texts (text length ≥ 5000 words).

[0154] (2) Comparative experiment on key term annotation across genres.

[0155] 1. Experimental Design

[0156] Fifteen cross-school ambiguous key terms from four representative schools in the test set, namely, the Zhongjing School, the Zhongjing School, the Four Great Masters of the Jin and Yuan Dynasties, and the Ming and Qing Medical Cases School, were labeled and evaluated.

[0157] Key terms include but are not limited to:

[0158] Disease types: stroke, typhoid fever, abdominal distension, and diabetes.

[0159] Treatment methods: attacking downward, warming and tonifying, nourishing yin, and reconciling.

[0160] Prescriptions: Baihu Decoction, Chengqi Decoction, and Guizhi Decoction.

[0161] Theoretical categories: triple burner, meridians, qi and blood, yin and yang.

[0162] 2. Experimental results are as follows Figure 2 As shown in the figure, it can be seen that the overall F1 value of the cross-school key term labeling of the present invention is improved by 21% compared with the most effective existing method (CN118841183A), and is improved by 17% compared with the variant method of the present invention that only considers the dynasty background features. Thanks to the multi-dimensional context feature extraction (dynasty, translation, genre, annotation) providing multi-dimensional semantic information for the model, the present invention significantly improves the annotation accuracy of key terms.

[0163] (3) Comparative experiment on disambiguation of typical polysemous terms.

[0164] 1. Experimental Design

[0165] We selected three cross-disciplinary polysemous terms: "stroke," "cold typhoid," and "attack down." Each term contains two or three distinct meanings. For example, "stroke" requires distinction between "exogenous wind evil" (a Traditional Chinese Medicine disease name) and "cerebral apoplexy" (a modern medical concept). We compared the accuracy of various methods in disambiguating the semantics of these typical polysemous terms.

[0166] 2. As shown in Table 1, the experimental results of the present invention show an average improvement of 35.5% in accuracy compared to the most accurate method in the prior art (CN118841183A), and an improvement of 22.8% compared to the variant method of the present invention that only considers dynasty background features, achieving a better effect in disambiguating polysemous terms.

[0167] Table 1. Comparative experimental results of typical polysemous term disambiguation

[0168]

[0169] (IV) Parameter efficiency and training speed comparison experiment.

[0170] 1. Experimental Design

[0171] On the same 8-card V100 cluster, we compared the number of parameters and time required for 10 epochs of training for each method. Our method used LoRA fine-tuning (approximately 200K trainable parameters), while the comparison method used full parameter fine-tuning. Input data: a training set of 300 ancient books (approximately 1.2M tokens).

[0172] 2. Experimental results are as follows Figure 3-Figure 5 As shown, the present invention reduces the number of trainable parameters by 98% through hierarchical rank adaptive adjustment (LoRA rank dynamic adjustment), significantly reducing computing resource requirements; gradient coordinated optimization reduces invalid parameter updates, and the training time is shortened by 25.8% compared with the fastest existing method (CN118504564A); the single batch processing speed is increased by 47.8%, thanks to the parallel computing optimization of dynamic rank adjustment and multi-strategy fusion.

[0173] (5) Comparative experiment on long text processing capabilities.

[0174] 1. Experimental Design

[0175] We selected 10 long texts from ancient books (e.g., the full text of Huangdi Neijing: Suwen) with a length of 10,000 characters or more. We compared the accuracy of various methods in identifying cross-paragraph term associations. Cross-paragraph term association refers to identifying semantic consistency when the same term appears in different paragraphs.

[0176] 2. Experimental results are as follows Figure 6-Figure 7 As shown, the accuracy of cross-paragraph term association and the maximum number of words processed in long texts of the present invention are improved by 11.9% and 700% respectively compared with the method of CN118841183A. Obviously, thanks to the multi-strategy fusion processing and rule engine, the present invention has made a major breakthrough in the long text processing capability compared with the existing technology, and can better cope with the input of long texts.

[0177] (6) Comparative experiment on domain adaptability.

[0178] 1. Experimental Design

[0179] The data were divided into the following categories: Han Dynasty (50 books), Tang Dynasty (80 books), Song Dynasty (100 books), and Qing Dynasty (70 books); and the data were divided into the following categories: theoretical works (120 books), prescription books (150 books), and medical records (80 books). The annotation accuracy of each method was compared on different subsets.

[0180] 2. The experimental results are shown in Table 2. As can be seen, the present invention effectively captures the semantic evolution of medical terminology across different eras by extracting dynasty background features. The scholar annotation feature provides additional semantic constraints for niche medical literature, resolving annotation ambiguity in low-resource scenarios. The dynamic rank adjustment mechanism enables the model to automatically optimize parameter expression capabilities in both prescription books (which are densely packed with prescription terms) and theoretical works (which are densely packed with concept terms).

[0181] Table 2. Domain adaptability comparison experiment results

[0182]

[0183] 4. Summary of experimental examples.

[0184] This experimental example verifies that the method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization provided by the present invention can achieve high-precision annotation of ancient Chinese medical books, specifically including:

[0185] Multi-dimensional context feature extraction (dynasties, schools, translations, annotations) provides the model with multi-dimensional semantic information; hierarchical rank adaptive adjustment dynamically optimizes LoRA parameters based on dynasty term density and context entropy; gradient coordinated optimization enhances the learning ability of key terms through annotation-guided masking; multi-strategy fusion processing combines Longformer and rule engine to improve the accuracy of long text annotation.

[0186] Experimental results show that the present invention significantly outperforms existing technical methods in many aspects such as annotation accuracy, parameter efficiency, long text processing capabilities and domain adaptability by introducing and integrating multi-dimensional contextual features (especially dynasties and schools) and combining innovative hierarchical rank adaptive adjustment and gradient coordination optimization strategies. It can provide an efficient, accurate and robust solution for application scenarios such as digitization of ancient Chinese medical books, knowledge graph construction and intelligent assisted diagnosis and treatment.

[0187] The basic principles, main features, and advantages of the present invention are shown and described above. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions are merely illustrative of the principles of the present invention. Various changes and modifications may be made to the present invention without departing from the spirit and scope of the present invention. Such changes and modifications are intended to fall within the scope of the present invention. The scope of protection claimed in the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for annotating ancient Chinese medical books by integrating multi-dimensional context for model adaptive optimization, characterized by: Including steps: S1. Extracting multi-dimensional contextual features corresponding to the text of ancient Chinese medical books, wherein the multi-dimensional contextual features include at least dynasty background features, school features, cross-language translation features, and scholar annotation features; S2. Based on the multi-dimensional context features, dynamically determine the low-rank adaptive rank of at least one level in the target language model through a hierarchical rank adaptive adjustment strategy, and obtain an optimized target language model after fine-tuning; S3. Input the ancient Chinese medical text and the multi-dimensional context features into the optimized target language model to generate preliminary annotation results, apply the rule engine to make corrections, and output the final annotation results.

2. The method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization as claimed in claim 1, characterized in that: The layer rank adaptive adjustment strategy includes: Calculating the dynasty term density, school term density, and context entropy corresponding to at least one level of the ancient Chinese medical text in the target language model; The low-rank adaptive rank is calculated and determined by a preset weight formula according to the dynasty term density, the genre term density and the context entropy.

3. The method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization as claimed in claim 2, characterized in that: The preset weight formula includes: ;in, Represents the LoRA rank after adjustment of the lth layer; represents the density of dynasty terms at level l; Indicates rounding up; is the context entropy; Fl represents the The density of genre terms in the layer; α, β and is the preset weight coefficient; C and D are the preset upper and lower thresholds of the rank.

4. The method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization as claimed in claim 1, characterized in that: The fine-tuning method includes: introducing a gradient mask guided by the scholar's annotation features, enhancing the gradient update at the term position covered by the scholar's annotation features, and retaining the basic model gradient influence or weakening the gradient update at the non-annotated term position to perform gradient coordinated optimization on the model parameters.

5. The method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization as claimed in claim 4, characterized in that: The gradient coordination optimization further includes: enhancing the gradient of the genre-specific term positions contained in the genre term dictionary according to a preset genre term dictionary.

6. The method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization as claimed in claim 1, characterized in that: Extracting the dynasty background features includes: parsing dynasty information from metadata of the ancient Chinese medical text, and constructing a Chinese medical dynasty terminology dictionary to generate a dynasty embedding vector.

7. The method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization as claimed in claim 1, characterized in that: Extracting the genre features includes: parsing genre labels from metadata of the ancient Chinese medical texts, and constructing a Chinese medical genre terminology dictionary to generate a genre embedding vector.

8. The method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization as claimed in claim 1, characterized in that: Extracting the cross-language translation features includes: Using a preset translation model to semantically align the original text of the ancient Chinese medical text with its modern translation; A quality assessment model is used to evaluate the semantic similarity and sentence structure consistency of the alignment results to generate the cross-language translation features.

9. The method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization as claimed in claim 1, characterized in that: Extracting the scholar annotation features includes: using the BIO annotation method to identify term definitions in the scholar annotation feature text, and generating an annotation feature matrix.

10. The method for annotating ancient Chinese medical books by integrating multi-dimensional context and performing model adaptive optimization as claimed in claim 1, characterized in that: The rule engine includes correction rules based on professional knowledge in the field of traditional Chinese medicine, naming standards of medical classics or preset by field experts. The correction rules also include at least one of the naming standards of genre terms or logical constraints of genre concepts.

Citation Information

Patent Citations

  • Traditional Chinese medicine ancient book entity extraction method and device, electronic equipment, storage medium and computer program product

    CN118504564A

  • Large model construction method and device for vertical field of traditional Chinese medicine

    CN118841183A

  • Word segmentation method based on ancient Chinese

    CN113239692A

  • Traditional Chinese medicine term extraction method and system based on traditional Chinese medicine ancient literature

    CN117633157A