Long text dynamic compression method and system based on multi-modal big health knowledge graph

CN122903596APending Publication Date: 2026-10-13HEALTH HOPE (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611080603.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-21
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

[0002]目前,随着大语言模型在医疗健康领域的广泛应用,如何将超长健康档案高效地适配至模型的上下文窗口成为亟待解决的技术问题,现有长文本处理方法主要面临上下文窗口限制与计算成本高昂的双重挑战,因此需要对输入文本进行压缩处理以降低序列长度;

Benefits of technology

通过引入医学领域先验知识和用户查询意图,实现了对超长健康文本的高效动态压缩,首先,利用多模态大健康知识图谱为医学实体提供临床价值评估,确保高风险指标和关键术语在压缩过程中被准确识别和保留,避免了通用压缩算法因缺乏医学知识而误删关键数据的问题,其次,结合用户健康查询进行条件相关性评估,使得压缩结果能够根据不同的查询意图动态调整侧重点,在此基础上,通过强制召回和子串恢复机制,保证了医学数值和术语的完整性,防止因压缩导致临床语义失真,最后,采用健康要点标记聚合全文语义并在推理阶段仅保留少量键值对缓存,显著降低了大语言模型处理超长文本时的计算开销和显存占用,使得在有限资源下仍能快速生成准确的健康响应。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122903596A_ABST
    Figure CN122903596A_ABST
Patent Text Reader

Abstract

The application provides a long text dynamic compression method based on a multi-modal health knowledge graph, comprising: collecting health data and identifying medical entities to construct a multi-modal health knowledge graph; dividing the original long health text into semantic units, obtaining the self-information and the relevance of each unit to the user query, determining the medical weight of the matching entity based on the graph, and calculating the comprehensive importance score by fusing the self-information, the medical weight and the relevance; generating a candidate compression set by extracting target units according to the score; scanning the candidate set to detect key medical entities, triggering forced recall and substring recovery when there is a defect, and obtaining lossless compressed text; inputting the lossless compressed text into a large language model to convert it into a target sequence, concatenating a learnable health point marker at the end of the sequence, aggregating the full text semantics through the health point marker under the constraint of asymmetric masking, and storing in a key-value pair cache, and generating a response based on the cache in the reasoning stage. The efficient dynamic compression of the super-long health text is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of natural language processing and medical informatics, and in particular to a method and system for dynamic compression of long texts based on a multimodal big health knowledge graph. Background Technology

[0002] Currently, with the widespread application of large language models in the medical and health field, how to efficiently adapt ultra-long health records to the model's context window has become an urgent technical problem to be solved. Existing long text processing methods mainly face the dual challenges of context window limitations and high computational costs. Therefore, it is necessary to compress the input text to reduce the sequence length. Existing long text compression technologies can be mainly divided into three categories. The first category is the heuristic rule-based filtering method, which simplifies the text by deleting stop words or low-frequency words. This type of method is prone to accidentally deleting clinically significant medical keywords when processing medical texts. The second category is the general cue word compression model, which relies on the self-information or perplexity of the language model to evaluate the importance of lemmas. However, due to the lack of prior knowledge in the medical field, it often regards specific numerical values ​​or units as statistically low-information redundancy, resulting in the incorrect truncation of key clinical indicators. The third category is the vector retrieval slicing method, which slices the document and recalls it based on similarity. However, due to the excessive slicing, medical entities are often destroyed, which in turn leads to the breakage of contextual semantics. Therefore, the existing technology has several defects: the general compression model lacks prior knowledge in the medical field, making it difficult to identify the clinical value of numerical indicators and drug names. Under high compression ratios, it is easy to cause the diagnostic suggestions to be distorted. At the same time, the existing methods have poor dynamic adaptability and cannot adjust the compression focus in real time according to different health queries of users, causing the compression results to deviate from the user's intention. In addition, word-level compression will destroy the structural integrity of medical entities, causing subsequent models to produce illusions. For very long texts, key health data located in the middle of the document is easily ignored, causing the "lost in the middle" phenomenon. Therefore, in order to overcome the above-mentioned defects, the present invention provides a method and system for dynamic compression of long texts based on a multimodal big health knowledge graph. Summary of the Invention

[0003] This invention provides a method and system for dynamic compression of long texts based on a multimodal big health knowledge graph. By introducing prior knowledge in the medical field and user query intent, it achieves efficient dynamic compression of ultra-long health texts. First, it uses a multimodal big health knowledge graph to provide clinical value assessments for medical entities, ensuring that high-risk indicators and key terms are accurately identified and retained during the compression process, avoiding the problem of general compression algorithms accidentally deleting key data due to a lack of medical knowledge. Second, it combines user health queries with conditional relevance assessment, enabling the compression results to dynamically adjust their focus according to different query intents. On this basis, through forced recall and substring recovery mechanisms, it ensures the integrity of medical values ​​and terms, preventing clinical semantic distortion caused by compression. Finally, it uses health point tags to aggregate the full-text semantics and retains only a small number of key-value pairs in the inference stage, significantly reducing the computational overhead and memory usage when large language models process ultra-long texts, enabling the rapid generation of accurate health responses even with limited resources.

[0004] This invention provides a method for dynamic compression of long texts based on a multimodal big health knowledge graph, including: Step 1: Collect multimodal health data, identify medical entities in the multimodal health data, and construct a multimodal big health knowledge graph based on the medical entities; Step 2: Divide the original long health text into several semantic units, obtain the self-information of each semantic unit and the relevance of the semantic unit to the user query, and determine the medical weight of the entity that matches the semantic unit based on the multimodal big health knowledge graph. At the same time, calculate the comprehensive importance score of each semantic unit based on self-information, medical weight and relevance. Step 3: Sort each semantic unit in descending order according to the comprehensive importance score, and extract the target semantic units based on the sorting results and preset criteria to generate a candidate compressed set; Step 4: Scan the candidate compression set to detect semantic units marked as key medical entities. When a missing semantic unit marked as a key medical entity is detected, forced recall and substring recovery are triggered to supplement the key medical entity and obtain lossless compressed text. Step 5: Input the lossless compressed text into the large language model and convert it into a target sequence. Then, concatenate learnable health point tags at the end of the target sequence. Under the constraint of asymmetric attention mask, aggregate the full-text semantics of the compressed text based on the health point tags and store the full-text semantics in the corresponding key-value pair cache. During the inference phase, generate a response based on the aggregated semantics stored in the key-value pair cache.

[0005] Preferably, a method for dynamic compression of long text based on a multimodal big health knowledge graph includes the following steps: Step 1 involves collecting multimodal health data, identifying medical entities within the multimodal health data, and constructing a multimodal big health knowledge graph based on these medical entities, including: The management terminal acquires the source database corresponding to the multimodal health data and accesses the source database to collect multimodal health data, which includes at least one of electronic medical records, physical examination reports, diet logs, and exercise records. Standardized health data is obtained by unifying the format of the collected multimodal health data, cleaning the data, and mapping it to medical terms. Named entity recognition is performed on standardized health data to extract medical entities, and semantic relationships between medical entities are identified based on relation extraction technology. A multimodal big health knowledge graph is constructed by using medical entities as nodes and semantic relationships as edges, and the multimodal big health knowledge graph is stored in a graph database.

[0006] Preferably, a long text dynamic compression method based on a multimodal big health knowledge graph, which identifies semantic relationships between medical entities based on relation extraction technology, includes: Obtain the extracted medical entities and locate the text fragments containing each medical entity from standardized health data to construct a candidate sentence set containing entity pairs; The candidate sentence set is input into a pre-trained language model, and the semantic relationship type between entity pairs in the candidate sentences is identified based on sequence labeling. The identified semantic relationships are filtered out, and weak relationships with confidence levels below a preset threshold are removed to obtain a set of candidate semantic relationships; Align and deduplicate the candidate semantic relation set with the existing relations in the multimodal big health knowledge graph to eliminate redundant or conflicting relations; The final semantic relationships between medical entities are determined based on the alignment results.

[0007] Preferably, a dynamic compression method for long text based on a multimodal big health knowledge graph includes the following steps: In step 2, the original long health text is divided into several semantic units, and the self-information of each semantic unit and the relevance of the semantic unit to the user query are obtained. Furthermore, based on the multimodal big health knowledge graph, the medical weights of entities matching the semantic units are determined. Simultaneously, based on the self-information, medical weights, and relevance, a comprehensive importance score for each semantic unit is calculated, including: Obtain the original long health text and receive the health query input by the user, where the health query represents the user's question or search intent; The original long health text is divided into semantic units to obtain a sequence of semantic units; The sequence of semantic units is input into a large language model, and the language model self-information of each semantic unit is determined based on the conditional probability output by the large language model. Each semantic unit is matched with medical entities in the pre-built multimodal big health knowledge graph. If the match is successful, the entity type weight and centrality index of the medical entity in the graph are obtained, and the knowledge graph importance item of the current semantic unit is calculated based on the entity type weight and centrality index. If a match fails, the importance of the knowledge graph is zero. Based on the embedding model, the user health query and each semantic unit are vectorized and encoded to obtain the query embedding vector and the unit embedding vector, and the cosine similarity between the query embedding vector and the unit embedding vector is determined. The conditional relevance score between the current semantic unit and the user's health query is obtained based on cosine similarity. The comprehensive importance score of the corresponding semantic unit is obtained by weighting and summing the language model self-information, knowledge graph importance items, and conditional relevance scores of each semantic unit.

[0008] Preferably, in a long text dynamic compression method based on a multimodal big health knowledge graph, step 3 involves sorting each semantic unit in descending order according to its comprehensive importance score, and extracting target semantic units based on preset criteria according to the sorting results to generate a candidate compression set, including: Based on the comprehensive importance score, all semantic units are sorted in descending order to obtain the sorted sequence; Based on the preset compression rate, the top K semantic units in the sorted sequence are selected as the high-scoring retention set; The original long health text is scanned independently to detect the preset key medical entities contained therein, and all detected key medical entities are used as a mandatory retention set. The high-scoring retention set and the forced retention set are merged, and duplicate semantic units are removed to obtain a preliminary retention set; All semantic units in the initial retained set are rearranged according to their original index order in the original long healthy text to generate a candidate compressed set.

[0009] Preferably, in a dynamic long text compression method based on a multimodal big health knowledge graph, step 4 involves scanning the candidate compression set to detect semantic units marked as key medical entities. When a missing semantic unit marked as a key medical entity is detected, forced recall and substring recovery are triggered to supplement the key medical entity, resulting in lossless compressed text, including: Scan the candidate compressed set and identify semantic units containing preset key medical entities; For each identified semantic unit containing a key medical entity, detect whether the key medical entity is missing; When a critical medical entity is detected to be incomplete, the complete entity information is located and extracted from the original long health text according to the type of the critical medical entity, triggering a forced recall operation. Based on the substring recovery mechanism, the extracted complete entity information is supplemented to the missing position of the corresponding semantic unit in the candidate compression set to repair the entity. Once the physical repair is complete, lossless compressed text is obtained.

[0010] Preferably, a long text dynamic compression method based on a multimodal big health knowledge graph includes the following steps: In step 5, the lossless compressed text is input into a large language model and converted into a target sequence. Learnable health point tags are then appended to the end of the target sequence. Under the constraint of an asymmetric attention mask, the full-text semantics of the compressed text are aggregated based on the health point tags and stored in the corresponding key-value pair cache. During the inference phase, a response is generated based on the aggregated semantics stored in the key-value pair cache, including: The lossless compressed text is obtained and input into a large language model to be converted into a target sequence composed of word sequences. The large language model is a deep neural network model based on the Transformer architecture. A set of pre-initialized and learnable health point tags is appended to the end of the target sequence; Construct an asymmetric attention mask matrix and configure it to allow each health point tag to have full attention access to all lexical units in the target sequence, while prohibiting any original lexical unit in the target sequence from having attention computation on the health point tag; The concatenated sequence is input into the large language model for forward propagation under the constraint of the asymmetric attention mask matrix. In each Transformer layer, the full-text semantic information of the health point markers is aggregated without loss and compressed based on the self-attention mechanism, and the aggregated semantics are stored in the vector representation of the health point markers. After the forward propagation is completed, the key-value pair cache of all lexical units is calculated, and the key-value pair cache corresponding to the health point marker is retained. At the same time, the key-value pair cache corresponding to the original lexical units in the target sequence is discarded. During the inference phase, the key-value pairs marked with health points are cached as input and input into a large language model for decoding and generation, outputting a response corresponding to the user's health query.

[0011] Preferably, a long text dynamic compression method based on a multimodal big health knowledge graph, after obtaining lossless compressed text, further includes: The lossless compressed text is obtained, and the medical entities contained in the lossless compressed text are determined based on the multimodal big health knowledge graph. At the same time, the semantic relationships between medical entities are determined based on the multimodal big health knowledge graph. The medical entities are used as nodes and the semantic relationships are used as edges to construct the semantic subgraph corresponding to the lossless compressed text. Perform topological analysis on the semantic subgraph, calculate the graph density, number of connected components and degree of key nodes of the semantic subgraph, and generate a structural integrity coefficient based on the graph density, number of connected components and degree of key nodes; The lossless compressed text is input into a pre-trained medical language understanding model to extract the semantic feature vector of the lossless compressed text. The cosine similarity between the semantic feature vector and the semantic feature vector of the original long health text is determined to generate a semantic fidelity coefficient. The overall importance score of each semantic unit is obtained, and the sum of the overall importance scores of all semantic units in the lossless compressed text is divided by the total number of semantic units to generate the importance retention density coefficient. The structural integrity coefficient, semantic fidelity coefficient, and importance retention density coefficient are input into a pre-trained compression quality evaluation network for analysis, resulting in a comprehensive compression quality score. The obtained overall compression quality score is compared with the preset quality threshold. If the overall compression quality score is lower than the preset quality threshold, a secondary compression optimization process will be triggered. Based on the triggering result, the missing semantic units that are not included in the current lossless compressed text and whose comprehensive importance score is higher than the dynamic threshold are located in the original long healthy text. The missing semantic units are then inserted into the corresponding positions in the current lossless compressed text according to the original index order, and the quality is re-evaluated until the comprehensive compression quality score reaches the preset quality threshold. Otherwise, the current lossless compressed text will be used as the final compressed text.

[0012] Preferably, a long text dynamic compression method based on a multimodal big health knowledge graph detects whether key medical entities are missing in each identified semantic unit containing key medical entities, including: For each identified semantic unit containing a key medical entity, obtain the standard entity representation of the corresponding key medical entity; The standard regular expression pattern corresponding to the standard entity expression is determined based on the regular expression matching, and the structural integrity score of the key medical entity in the semantic unit is calculated based on the standard regular expression pattern of the key medical entity. ; in, This represents the structural integrity score of key medical entities within semantic units; Represents semantic units Standard regular expression pattern for text and key medical entities Does it match exactly? Represents semantic units Standard regular expression pattern for text and key medical entities Exact match; The text coverage score of key medical entities in semantic units is calculated according to the following formula; ; in, This represents the text coverage score of key medical entities within semantic units; Represented as key entity text fragments actually extracted from semantic units. Length; Indicates the overall text length of a semantic unit; Based on a pre-trained semantic embedding model, the semantic consistency score between key medical entities and semantic units is calculated. ; in, This represents the semantic consistency score between key medical entities and semantic units. The embedding vector representing the standard entity is entity_standard; The embedding vector representing the semantic unit text unit; This refers to the process by which a pre-trained semantic embedding model maps input text into a high-dimensional dense vector. This represents the semantic similarity between standard entity representations and semantic unit text in the vector space. The integrity score of key medical entities is obtained by weighted summation of structural integrity score, text coverage score, and semantic consistency score. ; in, Indicates the integrity score of key medical entities; Weighting coefficients representing structural integrity; Weighting coefficients representing text coverage; Weighting coefficients representing semantic consistency; Integrity score Compared with the preset defect determination threshold Compare; when If so, it is determined that the key medical entity in the semantic unit is incomplete; Otherwise, the key medical entities in the semantic unit are determined to be complete.

[0013] This invention provides a long text dynamic compression system based on a multimodal big health knowledge graph, comprising: The multimodal big health knowledge graph construction module is used to collect multimodal health data, identify medical entities in the multimodal health data, and construct a multimodal big health knowledge graph based on the medical entities. The comprehensive importance score determination module is used to divide the original long health text into several semantic units, obtain the self-information of each semantic unit and the relevance of the semantic unit to the user query, and determine the medical weight of the entity matching the semantic unit based on the multimodal big health knowledge graph. At the same time, the comprehensive importance score of each semantic unit is calculated based on the self-information, medical weight and relevance. The candidate compression set determination module is used to sort each semantic unit in descending order according to the comprehensive importance score, and extract target semantic units based on the sorting results and preset criteria to generate a candidate compression set. The lossless compressed text acquisition module is used to scan the candidate compression set and detect semantic units marked as key medical entities in the candidate compression set. When a missing semantic unit marked as a key medical entity is detected, forced recall and substring recovery are triggered to supplement the key medical entity and obtain lossless compressed text. The cache response module is used to convert lossless compressed text input into a large language model into a target sequence, and to concatenate learnable health point tags at the end of the target sequence. Under the constraint of asymmetric attention mask, the full-text semantics of the compressed text are aggregated according to the health point tags and stored in the corresponding key-value pair cache. During the inference phase, the response is generated according to the aggregated semantics stored in the key-value pair cache.

[0014] Compared with the prior art, the beneficial effects of the present invention are as follows: By incorporating prior knowledge from the medical field and user query intent, efficient dynamic compression of ultra-long health texts is achieved. First, a multimodal big health knowledge graph is used to provide clinical value assessments for medical entities, ensuring that high-risk indicators and key terms are accurately identified and preserved during the compression process. This avoids the problem of general compression algorithms mistakenly deleting key data due to a lack of medical knowledge. Second, conditional relevance assessment is performed in conjunction with user health queries, allowing the compression results to dynamically adjust their focus according to different query intents. On this basis, through forced recall and substring recovery mechanisms, the integrity of medical values ​​and terms is guaranteed, preventing clinical semantic distortion caused by compression. Finally, health point tags are used to aggregate the full-text semantics, and only a small number of key-value pairs are cached during the inference stage. This significantly reduces the computational overhead and GPU memory usage when the large language model processes ultra-long texts, enabling the rapid generation of accurate health responses even with limited resources.

[0015] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in this application.

[0016] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0017] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of a long text dynamic compression method based on a multimodal big health knowledge graph in an embodiment of the present invention; Figure 2 This is a flowchart of step 1 in a long text dynamic compression method based on a multimodal big health knowledge graph according to an embodiment of the present invention; Figure 3 This is a structural diagram of a long text dynamic compression system based on a multimodal big health knowledge graph, as described in an embodiment of the present invention. Detailed Implementation

[0018] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0019] Example 1: This example provides a method for dynamic compression of long texts based on a multimodal big health knowledge graph, such as... Figure 1 As shown, it includes: Step 1: Collect multimodal health data, identify medical entities in the multimodal health data, and construct a multimodal big health knowledge graph based on the medical entities; Step 2: Divide the original long health text into several semantic units, obtain the self-information of each semantic unit and the relevance of the semantic unit to the user query, and determine the medical weight of the entity that matches the semantic unit based on the multimodal big health knowledge graph. At the same time, calculate the comprehensive importance score of each semantic unit based on self-information, medical weight and relevance. Step 3: Sort each semantic unit in descending order according to the comprehensive importance score, and extract the target semantic units based on the sorting results and preset criteria to generate a candidate compressed set; Step 4: Scan the candidate compression set to detect semantic units marked as key medical entities. When a missing semantic unit marked as a key medical entity is detected, forced recall and substring recovery are triggered to supplement the key medical entity and obtain lossless compressed text. Step 5: Input the lossless compressed text into the large language model and convert it into a target sequence. Then, concatenate learnable health point tags at the end of the target sequence. Under the constraint of asymmetric attention mask, aggregate the full-text semantics of the compressed text based on the health point tags and store the full-text semantics in the corresponding key-value pair cache. During the inference phase, generate a response based on the aggregated semantics stored in the key-value pair cache.

[0020] In this embodiment, the semantic unit can be a token, a NER phrase, or a slice.

[0021] In this embodiment, the comprehensive importance score refers to the value obtained by weighting and summing three factors: language model self-information, knowledge graph medical weights, and relevance to user queries. It is used to quantify the retention priority of each semantic unit during the compression process.

[0022] In this embodiment, the candidate compression set refers to the set of semantic units initially selected after being sorted in descending order according to their comprehensive importance scores. It includes high-scoring semantic units as well as key medical entities added through a mandatory protection mechanism.

[0023] In this embodiment, forced recall refers to the system automatically adding semantic units that have a low overall importance score but are marked as key medical entities back to the retention set.

[0024] In this embodiment, substring recovery refers to a mechanism that automatically fills in the missing parts from the original text to restore the complete entity when medical values ​​are detected to be separated from units or terms are truncated.

[0025] In this embodiment, lossless compressed text refers to healthy text that, after forced recall and substring recovery processing, meets the compression rate requirements while fully preserving all key medical entities and semantic relationships.

[0026] In this embodiment, the health point marker refers to a set of learnable vectors concatenated at the end of the target sequence, which are used to aggregate full-text semantic information through an attention mechanism in the Transformer layer.

[0027] In this embodiment, the asymmetric attention mask refers to an attention matrix constraint that allows health point markers to pay attention to all original lexical units but prohibits original lexical units from paying attention to health point markers. This constraint is used to prevent representation contamination and ensure the effectiveness of semantic aggregation.

[0028] The working principle and beneficial effects of the above technical solution are as follows: By introducing prior knowledge in the medical field and user query intent, efficient dynamic compression of ultra-long health texts is achieved. First, a multimodal big health knowledge graph is used to provide clinical value assessment for medical entities, ensuring that high-risk indicators and key terms are accurately identified and retained during the compression process, avoiding the problem of general compression algorithms accidentally deleting key data due to a lack of medical knowledge. Second, conditional relevance assessment is performed in conjunction with user health queries, enabling the compression results to dynamically adjust their focus according to different query intents. On this basis, through forced recall and substring recovery mechanisms, the integrity of medical values ​​and terms is guaranteed, preventing clinical semantic distortion caused by compression. Finally, health point tags are used to aggregate the full-text semantics and only a small number of key-value pairs are cached during the inference stage, significantly reducing the computational overhead and memory usage when the large language model processes ultra-long texts, enabling the rapid generation of accurate health responses even with limited resources.

[0029] Example 2: Based on Example 1, this example provides a method for dynamic compression of long texts based on a multimodal big health knowledge graph, such as... Figure 2 As shown, in step 1, multimodal health data is collected, medical entities are identified within the multimodal health data, and a multimodal big health knowledge graph is constructed based on these medical entities, including: Step 101: Obtain the source database corresponding to the multimodal health data based on the management terminal, access the source database, and collect multimodal health data, wherein the multimodal health data includes at least one of electronic medical records, physical examination reports, diet logs, and exercise records; Step 102: Standardize the health data by unifying the format, cleaning the data, and mapping it to medical terms. Step 103: Perform named entity recognition on the standardized health data, extract medical entities, and identify the semantic relationships between medical entities based on relation extraction technology; Step 104: Construct a multimodal big health knowledge graph using medical entities as nodes and semantic relationships as edges, and store the multimodal big health knowledge graph in a graph database.

[0030] In this embodiment, the medical entity includes at least one of the following: disease name, drug name, test indicator, traditional Chinese medicine syndrome, and nutrient.

[0031] In this embodiment, semantic relationships include the relationship between indicators and reference ranges, the relationship between drugs and indications, and the relationship between diseases and symptoms.

[0032] In this embodiment, the source database refers to various data source systems that store raw multimodal health data, including hospital information systems, physical examination center databases, and backend servers for personal health management applications.

[0033] In this embodiment, standardized health data refers to health text data that has a consistent data structure and standardized terminology after being processed through format unification, data cleaning, and medical terminology mapping.

[0034] The working principle and beneficial effects of the above technical solution are as follows: By collecting multi-source heterogeneous health data and performing standardized processing, a high-quality data foundation is provided for subsequent compression. By utilizing named entity recognition and relation extraction technologies, unstructured text is transformed into structured medical entities and their semantic relationships, constructing a knowledge graph containing rich medical prior knowledge. This not only provides quantifiable evidence for medical entity recognition and importance assessment in subsequent steps, but also supports the real-time acquisition of the clinical value and semantic constraints of entities during the compression process through the efficient storage and query capabilities of the graph database, thereby ensuring that the compression results conform to medical logic.

[0035] Example 3: Building upon Example 1, this example provides a method for dynamic compression of long texts based on a multimodal big health knowledge graph. It identifies semantic relationships between medical entities based on relation extraction technology, including: Obtain the extracted medical entities and locate the text fragments containing each medical entity from standardized health data to construct a candidate sentence set containing entity pairs; The candidate sentence set is input into a pre-trained language model, and the semantic relationship type between entity pairs in the candidate sentences is identified based on sequence labeling. The identified semantic relationships are filtered out, and weak relationships with confidence levels below a preset threshold are removed to obtain a set of candidate semantic relationships; Align and deduplicate the candidate semantic relation set with the existing relations in the multimodal big health knowledge graph to eliminate redundant or conflicting relations; The final semantic relationships between medical entities are determined based on the alignment results.

[0036] In this embodiment, the candidate sentence set refers to the set of text sentences located from standardized health data that contain at least one pair of medical entities, which are used as input material for relation extraction.

[0037] In this embodiment, the pre-trained language model refers to a deep neural network model pre-trained based on a large-scale corpus, used to identify the semantic relationship type between entity pairs from candidate sentences.

[0038] In this embodiment, the candidate semantic relation set refers to the set of semantic relations identified from candidate sentences that have undergone preliminary screening but have not yet been aligned and deduplicated with existing relations in the graph.

[0039] In this embodiment, the final semantic relationship refers to the semantic association between medical entities used to construct a multimodal big health knowledge graph, which is determined after alignment, deduplication, and conflict elimination processing.

[0040] The working principle and beneficial effects of the above technical solution are as follows: by automatically identifying the semantic relationships between medical entities, an effective conversion from unstructured text to structured knowledge is achieved. By using a pre-trained language model for relation extraction, the clinical associations between entities can be accurately captured. Furthermore, through confidence filtering and alignment deduplication mechanisms, redundant and conflicting relationships are eliminated, ensuring the accuracy and consistency of semantic relationships in the constructed knowledge graph, and providing reliable medical prior knowledge support for the subsequent compression process.

[0041] Example 4: Building upon Example 1, this example provides a method for dynamic compression of long text based on a multimodal big health knowledge graph. In step 2, the original long health text is divided into several semantic units, and the self-information of each semantic unit and the relevance of the semantic unit to the user query are obtained. Furthermore, the medical weights of entities matching the semantic units are determined based on the multimodal big health knowledge graph. Simultaneously, a comprehensive importance score for each semantic unit is calculated based on self-information, medical weights, and relevance, including: Obtain the original long health text and receive the health query input by the user, where the health query represents the user's question or search intent; The original long health text is divided into semantic units to obtain a sequence of semantic units; The sequence of semantic units is input into a large language model, and the language model self-information of each semantic unit is determined based on the conditional probability output by the large language model. Each semantic unit is matched with medical entities in the pre-built multimodal big health knowledge graph. If the match is successful, the entity type weight and centrality index of the medical entity in the graph are obtained, and the knowledge graph importance item of the current semantic unit is calculated based on the entity type weight and centrality index. If a match fails, the importance of the knowledge graph is zero. Based on the embedding model, the user health query and each semantic unit are vectorized and encoded to obtain the query embedding vector and the unit embedding vector, and the cosine similarity between the query embedding vector and the unit embedding vector is determined. The conditional relevance score between the current semantic unit and the user's health query is obtained based on cosine similarity. The comprehensive importance score of the corresponding semantic unit is obtained by weighting and summing the language model self-information, knowledge graph importance items, and conditional relevance scores of each semantic unit.

[0042] In this embodiment, each semantic unit is a phrase or word segmented by named entity recognition.

[0043] In this embodiment, the weighting coefficients are preset hyperparameters or learnable parameters.

[0044] In this embodiment, a health query refers to a natural language question or keyword entered by the user to represent their inquiry or retrieval intent, such as "what to do about abnormal blood sugar" or "postoperative dietary advice".

[0045] In this embodiment, the semantic unit sequence refers to the set of semantic elements arranged in the original order after dividing the original long healthy text according to the granularity of words or phrases.

[0046] In this embodiment, language model self-information refers to the information content metric calculated based on the conditional probability of a large language model. The larger the value, the lower the probability of the semantic unit appearing under given context conditions, that is, the more unique or important the information contained.

[0047] In this embodiment, entity type weight refers to a weight value preset according to the category of medical entity, which is used to distinguish the basic differences in clinical value of different categories of medical entities. For example, the weight of numerical test entities is greater than that of general descriptive entities.

[0048] In this embodiment, the centrality index refers to the degree of coreness of a medical entity in a multimodal big health knowledge graph network. It is usually calculated using PageRank or betweenness centrality to reflect the influence of the entity in the medical knowledge system.

[0049] In this embodiment, the knowledge graph importance term refers to a value calculated based on entity type weights and centrality indicators, which is used to quantify the clinical importance of the medical entity corresponding to the semantic unit in the medical knowledge graph.

[0050] In this embodiment, the query embedding vector refers to the dense vector representation obtained by encoding the user health query input embedding model, which is used to represent the semantic information of the query in the semantic space.

[0051] In this embodiment, the unit embedding vector refers to the dense vector representation obtained by encoding each semantic unit into the embedding model, which is used to represent the semantic information of the unit in the semantic space.

[0052] In this embodiment, the conditional relevance score refers to the numerical value obtained by calculating the cosine similarity between the query embedding vector and the unit embedding vector, which is used to quantify the semantic association strength between the semantic unit and the user health query.

[0053] In this embodiment, first, an original long health text X is acquired, and a health query q input by a user is received. The health query q is used to characterize the user's question or retrieval intention. The original long health text X is a text sequence composed of multimodal health data, such as electronic medical records, physical examination reports, etc.; Next, semantic unit division is performed on the original long health text X to obtain a semantic unit sequence X = {x1, x2,…, x n}, where each semantic unit x_i is a phrase or token obtained through named entity recognition (NER) preprocessing. The granularity of the semantic unit can be determined according to the actual application scenario, which can be a single token, or a phrase or medical entity with complete semantics; Then, the semantic unit sequence is input into a large language model, and the language model self-information I_LM(x_i) of each semantic unit is calculated. The language model self-information is obtained as the negative logarithm of the conditional probability of the semantic unit under the condition of all semantic units X_{<i} before it, and its calculation formula is: I_LM(x_i)=-logP_LLM(x_i|X_{<i};θ); Wherein, P_LLM(·) represents the conditional probability prediction function of the pre-trained large language model, θ is the model parameter, X_{<i} represents the context sequence composed of all semantic units located before x_i, and the self-information value reflects the "degree of surprise" of the semantic unit under the general language distribution. A larger value indicates that the information contained in the unit is more difficult to predict, that is, more important; Subsequently, each semantic unit x_i is matched with the medical entities in the pre-constructed multimodal big health knowledge graph G. If x_i matches an entity e∈ε in the graph, the knowledge graph importance term I_KG(x_i) is calculated based on the attributes of the entity. Specifically, the entity type weight w(e) of the entity e and the centrality index Centrality_G(e) in the graph are acquired, and the calculation is performed according to the following formula: I_KG(x_i) = w(e)·(1+α·Centrality_G(e)); Wherein, w(e) is a preset entity type weight, which is used to distinguish the basic clinical value of different types of medical entities, for example, the weight of test value type entities is higher than that of general description type entities; Centrality_G(e) is the centrality measure of the entity in the graph network, such as PageRank value or betweenness centrality, which reflects the clinical influence of the entity; α is a non-negative topology influence adjustment coefficient, which is used to control the gain amplitude of the graph structure on the score. If x_i does not match any entity, I_KG(x_i) =0; Simultaneously, to reflect the intent of the user query, a conditional relevance score C(x_i; q) between each semantic unit and the user's health query q is calculated. Vector similarity is used to approximate the complex conditional entropy calculation. Specifically, this involves: using an embedding model to vectorize and encode the user's health query q and each semantic unit x_i respectively, obtaining the query embedding vector e_q and the unit embedding vector e_i; then, the cosine similarity between the two is calculated as the conditional relevance score, i.e.: C(x_i; q) = cos(e_q,e_i); The higher the score, the stronger the semantic relationship between the semantic unit and the user query, and the more it should be retained during compression; Finally, for each semantic unit x_i, the language model self-information I_LM(x_i), the knowledge graph importance term I_KG(x_i), and the conditional relevance score C(x_i; q) are weighted and summed to obtain the comprehensive importance score S(x_i) of the semantic unit. The calculation formula is as follows: S(x_i)=λ1·I_LM(x_i)+λ2·I_KG(x_i)+λ3·C(x_i;q); Here, λ1, λ2, and λ3 are learnable weighting coefficients or preset hyperparameters used to balance the contributions of the three factors to the final importance judgment. This comprehensive importance score S(x_i) is the sole quantitative basis for subsequent screening and compression decisions.

[0054] The working principle and beneficial effects of the above technical solution are as follows: By integrating three dimensions—language model self-information, knowledge graph medical weights, and user query relevance—a comprehensive evaluation mechanism for semantic units in the health field is constructed. This mechanism can quantify the information content of each semantic unit under the distribution of common language, its clinical value in the medical knowledge system, and the strength of its semantic association with the user's current health problems. This provides an accurate and interpretable quantitative basis for subsequent screening and compression, effectively identifying and retaining medical indicators and terms. At the same time, it dynamically adjusts the evaluation focus according to user queries, avoiding the problems of accidental deletion and distortion caused by the lack of domain knowledge and user intent in general compression algorithms.

[0055] Example 5: Based on Example 1, this example provides a method for dynamic compression of long texts based on a multimodal big health knowledge graph. In step 3, the semantic units are sorted in descending order according to their comprehensive importance scores, and target semantic units are extracted based on preset criteria according to the sorting results to generate a candidate compression set, including: Based on the comprehensive importance score, all semantic units are sorted in descending order to obtain the sorted sequence; Based on the preset compression rate, the top K semantic units in the sorted sequence are selected as the high-scoring retention set; The original long health text is scanned independently to detect the preset key medical entities contained therein, and all detected key medical entities are used as a mandatory retention set. The high-scoring retention set and the forced retention set are merged, and duplicate semantic units are removed to obtain a preliminary retention set; All semantic units in the initial retained set are rearranged according to their original index order in the original long healthy text to generate a candidate compressed set.

[0056] In this embodiment, the compression ratio refers to the proportion of the number of semantic units retained after compression to the total number of semantic units in the original long healthy text, and is used to control the intensity of compression.

[0057] In this embodiment, the high-score retention set refers to the set composed of the top K semantic units selected after sorting them in descending order according to their comprehensive importance scores.

[0058] In this embodiment, the preset key medical entities refer to the types of medical entities that are pre-defined based on medical knowledge and must be forcibly retained during the compression process, such as specific test values, drug names, disease codes, etc.

[0059] In this embodiment, the forced retention set refers to the set of semantic units formed by independently scanning the original long health text, detecting and extracting all preset key medical entities.

[0060] In this embodiment, the preliminary retention set refers to the intermediate result set obtained by merging the high-score retention set and the forced retention set and removing duplicate semantic units.

[0061] In this embodiment, the original index order refers to the order in which each semantic unit appears in the original long healthy text.

[0062] The working principle of the above technical solution is as follows: First, based on the calculated comprehensive importance score of each semantic unit, all semantic units are sorted in descending order to obtain a sorted sequence. The top K semantic units in the sorted sequence are selected as the high-score retention set according to a preset target compression rate. This is track one (high-score retention) in the dual-track screening, selecting the top-K units with the highest scores to enter the retention set. Second, the original long health text is independently scanned to detect whether it contains preset key medical entities. These key medical entities include at least one of the following: medical numerical values ​​and their unit combinations, drug names, disease diagnosis codes, and traditional Chinese medicine syndrome terms. All detected key medical entities are forcibly added to the retention set, regardless of their comprehensive importance score. This is track two (forced protection, Must-Keep) in the dual-track screening. Then, the high-score retention set and the forced retention set are merged, and duplicate semantic units are removed to obtain the final retained unit set X_kept. This is the set merging and deduplication step. Finally, all semantic units in the final retained unit set X_kept are reordered according to their original index positions in the original long health text to restore the natural reading order of the text, ensuring the coherence of medical logic, and generating a candidate compression set. This is the time-series reorganization step.

[0063] The beneficial effects of the above technical solution are: through dual-track screening and temporal reorganization, it ensures the priority retention of highly important content, ensures that key medical entities are not missed, and maintains the semantic logical order of the original text, laying the foundation for subsequent integrity detection and semantic aggregation.

[0064] Example 6: Based on Example 1, this example provides a dynamic compression method for long texts based on a multimodal big health knowledge graph. In step 4, the candidate compression set is scanned to detect semantic units marked as key medical entities. When a missing semantic unit marked as a key medical entity is detected, forced recall and substring recovery are triggered to supplement the key medical entity, resulting in lossless compressed text, including: Scan the candidate compressed set and identify semantic units containing preset key medical entities; For each identified semantic unit containing a key medical entity, detect whether the key medical entity is missing; When a critical medical entity is detected to be incomplete, the complete entity information is located and extracted from the original long health text according to the type of the critical medical entity, triggering a forced recall operation. Based on the substring recovery mechanism, the extracted complete entity information is supplemented to the missing position of the corresponding semantic unit in the candidate compression set to repair the entity. Once the physical repair is complete, lossless compressed text is obtained.

[0065] In this embodiment, the factors that exist when completeness is not preserved are incomplete situations such as separation of numerical values ​​and units, truncation of terms, or partial omissions caused by compression.

[0066] In this embodiment, forced recall refers to the operation whereby, when a critical medical entity is detected to be incomplete, the system automatically locates and extracts the complete information of the entity from the original long health text and adds it back to the candidate compression set.

[0067] In this embodiment, the substring recovery mechanism refers to the repair rules and methods for restoring the complete entity expression by filling in the missing parts for truncated medical terms or combinations of numerical values ​​and units.

[0068] In this embodiment, complete entity information refers to a complete text fragment presented in the original long health text that contains all the necessary components of a key medical entity, such as a complete test result containing numerical values ​​and corresponding units.

[0069] In this embodiment, lossless compressed text refers to the compressed result that, after key medical entity integrity detection and repair, meets the preset compression rate requirements while fully preserving all core clinical information.

[0070] The working principle of the above technical solution is as follows: First, the generated candidate compression set is scanned to identify semantic units containing preset key medical entities. These preset key medical entities include at least one of the following: medical numerical values ​​and their unit combinations, drug names, disease diagnosis codes, and traditional Chinese medicine syndrome terms. Second, for each identified semantic unit containing a key medical entity, the integrity of the key medical entity is checked to determine if it is incomplete due to compression, such as separation of numerical values ​​and units, truncation of terms, or partial loss. Then, when an incomplete key medical entity is detected, the complete entity information is located and extracted from the original long health text according to the type of the key medical entity, triggering a forced recall strategy to re-insert the key entities that were not retained or were truncated into the candidate compression set. Next, using a substring recovery mechanism, the extracted complete entity information is supplemented to the missing positions of the corresponding semantic units in the candidate compression set, repairing truncated or separated entities, and completing missing units or terms to ensure the complete presentation of the key medical entities. Finally, after completing the above repairs on all the missing key medical entities, a clinically semantically lossless compressed text is obtained. The lossless compressed text not only meets the compression rate requirements but also completely preserves all the key medical information.

[0071] The beneficial effects of the above technical solution are as follows: by performing integrity checks on key medical entities in the candidate compression set and triggering a forced recall and substring recovery mechanism when incompleteness is detected, the core clinical information is accurately repaired. This effectively avoids semantic damage problems such as separation of medical values ​​and units and truncation of drug names caused by compression operations, ensuring that the final output compressed text fully retains all key clinical information while meeting the compression rate requirements, thus providing an accurate data foundation for subsequent semantic aggregation and response generation.

[0072] Example 7: Based on Example 1, this example provides a long text dynamic compression method based on a multimodal big health knowledge graph. In step 5, the lossless compressed text is input into a large language model and converted into a target sequence. Learnable health point tags are concatenated at the end of the target sequence. Under the constraint of an asymmetric attention mask, the full-text semantics of the compressed text are aggregated according to the health point tags and stored in the corresponding key-value pair cache. In the inference stage, a response is generated based on the aggregated semantics stored in the key-value pair cache, including: The lossless compressed text is obtained and input into a large language model to be converted into a target sequence composed of word sequences. The large language model is a deep neural network model based on the Transformer architecture. A set of pre-initialized and learnable health point tags is appended to the end of the target sequence; Construct an asymmetric attention mask matrix and configure it to allow each health point tag to have full attention access to all lexical units in the target sequence, while prohibiting any original lexical unit in the target sequence from having attention computation on the health point tag; The concatenated sequence is input into the large language model for forward propagation under the constraint of the asymmetric attention mask matrix. In each Transformer layer, the full-text semantic information of the health point markers is aggregated without loss and compressed based on the self-attention mechanism, and the aggregated semantics are stored in the vector representation of the health point markers. After the forward propagation is completed, the key-value pair cache of all lexical units is calculated, and the key-value pair cache corresponding to the health point marker is retained. At the same time, the key-value pair cache corresponding to the original lexical units in the target sequence is discarded. During the inference phase, the key-value pairs marked with health points are cached as input and input into a large language model for decoding and generation, outputting a response corresponding to the user's health query.

[0073] In this embodiment, the lossless compressed text is a health text fragment that retains key medical entities and has complete semantics.

[0074] In this embodiment, the number of health point markers is a preset value, and each health point marker corresponds to a health task semantic.

[0075] In this embodiment, the target sequence refers to the sequence of ordered words obtained after inputting lossless compressed text into a large language model and performing lexicalization.

[0076] In this embodiment, the health point marker refers to a set of pre-initialized and learnable vectors concatenated at the end of the target sequence, which are used to aggregate the full-text semantic information of lossless compressed text through an attention mechanism in the Transformer layer.

[0077] In this embodiment, the asymmetric attention mask matrix refers to a mask constraint matrix that allows health tokens to have full attention access to all original words in the target sequence, while prohibiting any original words from having attention calculations on the health tokens.

[0078] In this embodiment, the key-value pair cache refers to the cached data generated by the large language model during the self-attention calculation process, which is used to store the key matrix and value matrix of each word, and is used to accelerate the subsequent decoding and generation process.

[0079] The working principle and beneficial effects of the above technical solution are as follows: By introducing health point markers and asymmetric attention masking mechanism, efficient semantic aggregation and inference acceleration of compressed text are achieved. In the encoding stage, the asymmetric attention masking mechanism enables the health point markers to absorb full-text semantic information unidirectionally, while preventing interference with the original word units, thus ensuring the accuracy and purity of semantic aggregation. In the inference stage, only the key-value pairs of the health point markers are cached and the original text cache is discarded, which greatly reduces the computational burden and memory usage of the large language model when generating responses, enabling the accurate answer corresponding to the user's health query to be output quickly under limited resources.

[0080] Example 8: Based on Example 1, this example provides a method for dynamic compression of long texts based on a multimodal big health knowledge graph. After obtaining lossless compressed text, it also includes: The lossless compressed text is obtained, and the medical entities contained in the lossless compressed text are determined based on the multimodal big health knowledge graph. At the same time, the semantic relationships between medical entities are determined based on the multimodal big health knowledge graph. The medical entities are used as nodes and the semantic relationships are used as edges to construct the semantic subgraph corresponding to the lossless compressed text. Perform topological analysis on the semantic subgraph, calculate the graph density, number of connected components and degree of key nodes of the semantic subgraph, and generate a structural integrity coefficient based on the graph density, number of connected components and degree of key nodes; The lossless compressed text is input into a pre-trained medical language understanding model to extract the semantic feature vector of the lossless compressed text. The cosine similarity between the semantic feature vector and the semantic feature vector of the original long health text is determined to generate a semantic fidelity coefficient. The overall importance score of each semantic unit is obtained, and the sum of the overall importance scores of all semantic units in the lossless compressed text is divided by the total number of semantic units to generate the importance retention density coefficient. The structural integrity coefficient, semantic fidelity coefficient, and importance retention density coefficient are input into a pre-trained compression quality evaluation network for analysis, resulting in a comprehensive compression quality score. The obtained overall compression quality score is compared with the preset quality threshold. If the overall compression quality score is lower than the preset quality threshold, a secondary compression optimization process will be triggered. Based on the triggering result, the missing semantic units that are not included in the current lossless compressed text and whose comprehensive importance score is higher than the dynamic threshold are located in the original long healthy text. The missing semantic units are then inserted into the corresponding positions in the current lossless compressed text according to the original index order, and the quality is re-evaluated until the comprehensive compression quality score reaches the preset quality threshold. Otherwise, the current lossless compressed text will be used as the final compressed text.

[0081] In this embodiment, the semantic subgraph refers to a local knowledge graph structure constructed with medical entities contained in the lossless compressed text as nodes and semantic relationships between these entities in the multimodal big health knowledge graph as edges.

[0082] In this embodiment, graph density refers to the ratio of the actual number of edges in a semantic subgraph to the maximum possible number of edges, and is used to measure the tightness of semantic associations between entities in the subgraph.

[0083] In this embodiment, the number of connected components refers to the number of node subgraphs in the semantic subgraph that are interconnected by edges, which is used to reflect the structural connectivity of the subgraph.

[0084] In this embodiment, the key node degree refers to the number of connecting edges of nodes with a degree higher than a preset threshold in the semantic subgraph, which is used to measure the semantic radiation range of the core entity.

[0085] In this embodiment, the structural integrity coefficient refers to a value calculated based on graph density, the number of connected components, and the degree of key nodes, and is used to quantify the structural integrity of the semantic subgraph.

[0086] In this embodiment, the pre-trained medical language understanding model refers to a deep neural network model pre-trained based on a large-scale medical corpus, used to extract semantic feature vectors from medical texts.

[0087] In this embodiment, the semantic fidelity coefficient refers to the cosine similarity between the semantic feature vector of the lossless compressed text and the semantic feature vector of the original long healthy text, which is used to measure the degree of consistency of the semantics of the text before and after compression.

[0088] In this embodiment, the importance retention density coefficient refers to the value obtained by dividing the sum of the comprehensive importance scores of all semantic units in the lossless compressed text by the total number of semantic units, and is used to measure the average level of retention of the original key information by the compressed text.

[0089] In this embodiment, the compression quality evaluation network refers to a neural network model pre-trained based on a multilayer perceptron architecture, which is used to input structural integrity coefficient, semantic fidelity coefficient and importance retention density coefficient and output a comprehensive compression quality score.

[0090] In this embodiment, the overall compression quality score refers to the scalar value output by the compression quality assessment network, which is used to quantify the overall quality level of lossless compressed text.

[0091] In this embodiment, the preset quality threshold refers to a pre-set critical score value used to determine whether the compression quality meets the standard.

[0092] In this embodiment, the secondary compression optimization process refers to the iterative optimization process triggered when the overall compression quality score is lower than a preset quality threshold, which includes locating and supplementing missing highly important semantic units from the original text.

[0093] In this embodiment, the dynamic threshold refers to the importance score screening threshold that is adaptively adjusted based on the current comprehensive compression quality score during the secondary compression optimization process.

[0094] In this embodiment, the final compressed text refers to the compressed result determined after quality assessment and reaching a preset quality threshold, which is used to input a large language model for semantic aggregation.

[0095] The working principle and beneficial effects of the above technical solution are as follows: By constructing a multi-dimensional compression quality assessment system, quantitative analysis and closed-loop optimization of the compression results are achieved. First, the structural integrity, semantic consistency, and information importance retention level of the compressed text are comprehensively evaluated from three dimensions: the topological structure of the semantic subgraph, the fidelity of the text semantics, and the density of key information retention. This overcomes the limitations of traditional methods that rely solely on compression rate or manual judgment. On this basis, a comprehensive score is generated through the compression quality assessment network and compared with a preset threshold. When the score does not meet the standard, a secondary optimization process is automatically triggered to dynamically supplement the missing high-importance semantic units and perform iterative optimization until the preset quality standard is reached. This ensures that the final compressed text meets the compression rate requirements while retaining the structured semantics and key clinical information of the original text to the maximum extent, providing high-quality input for subsequent accurate responses.

[0096] Example 9: Building upon Example 6, this example provides a method for dynamic compression of long texts based on a multimodal big health knowledge graph. It detects whether key medical entities are incomplete in each identified semantic unit containing them, including: For each identified semantic unit containing a key medical entity, obtain the standard entity representation of the corresponding key medical entity; The standard regular expression pattern corresponding to the standard entity expression is determined based on the regular expression matching, and the structural integrity score of the key medical entity in the semantic unit is calculated based on the standard regular expression pattern of the key medical entity. ; in, This represents the structural integrity score of key medical entities within semantic units; Represents semantic units Standard regular expression pattern for text and key medical entities Does it match exactly? Represents semantic units Standard regular expression pattern for text and key medical entities Exact match; The text coverage score of key medical entities in semantic units is calculated according to the following formula; ; in, This represents the text coverage score of key medical entities within semantic units; Represented as key entity text fragments actually extracted from semantic units. Length; Indicates the overall text length of a semantic unit; Based on a pre-trained semantic embedding model, the semantic consistency score between key medical entities and semantic units is calculated. ; in, This represents the semantic consistency score between key medical entities and semantic units. The embedding vector representing the standard entity is entity_standard; The embedding vector representing the semantic unit text unit; This refers to the process by which a pre-trained semantic embedding model maps input text into a high-dimensional dense vector. This represents the semantic similarity between standard entity representations and semantic unit text in the vector space. The integrity score of key medical entities is obtained by weighted summation of structural integrity score, text coverage score, and semantic consistency score. ; in, Indicates the integrity score of key medical entities; Weighting coefficients representing structural integrity; Weighting coefficients representing text coverage; Weighting coefficients representing semantic consistency; Integrity score Compared with the preset defect determination threshold Compare; when If so, it is determined that the key medical entity in the semantic unit is incomplete; Otherwise, the key medical entities in the semantic unit are determined to be complete.

[0097] In this embodiment, The contribution of text conformity to standard writing format to the final completeness score is predetermined based on the actual standards. When the text type has extremely strict formatting requirements (such as the requirement for consecutive "value + unit" in medical laboratory reports), then... The corresponding values ​​are set to values ​​within the first interval to ensure that any formatting mismatch will significantly lower the overall completeness score. Conversely, if the text source is an unstructured spoken record (such as a doctor's oral notes), the formatting requirements are relatively lenient. The corresponding value is set to a value within the second interval, where the first interval is greater than the second interval.

[0098] In this embodiment, The extent to which the amount of non-critical information contained in a semantic unit affects the judgment result is predetermined based on the actual standard. When the value is high, such as This will tend to punish semantic units that, while mentioning key entities, devote a large portion to describing irrelevant details (e.g., the coverage of "hypertension" in "the patient said he probably has a bit of hypertension" is very low); when When the value is low, more attention is paid to "whether it was mentioned" rather than "how much it was mentioned".

[0099] In this embodiment, It is pre-set according to actual standards, and for medical texts with diverse terminology (such as "coronary heart disease" and "coronary atherosclerotic heart disease"), Higher values, such as Conversely, for numerical entities that require precise values ​​(such as "3.5mg" and "approximately 3.5" being semantically similar but physically incomplete), then The value is relatively low.

[0100] In this embodiment, .

[0101] In this embodiment, the defect determination threshold T is an adjustable parameter between 0 and 1. The value is calibrated based on the accuracy of integrity detection on the validation set according to the clinical task requirements, or set based on experience, for example, as a constant between 0.6 and 0.8.

[0102] In this embodiment, the pre-trained semantic embedding model is a deep neural network based on the Transformer architecture. It is unsupervised pre-trained on large-scale general corpora or medical domain corpora (such as PubMed summaries and clinical medical record texts) to learn distributed representations of text, including but not limited to BioBERT, ClinicalBERT, PubMedBERT, or Sentence-BERT. The semantic embedding model maps the input standard entity representation or semantic unit text into a fixed-dimensional real-valued vector, so that semantically similar texts are closer in the cosine distance in the vector space, thereby being used to calculate the semantic consistency score.

[0103] The working principle and beneficial effects of the above technical solution are as follows: First, the structural integrity score based on regular expression matching can strictly verify the writing standards of medical documents, ensuring the format compliance of key information such as numerical values, units, and diagnostic codes. Second, the text coverage score quantifies the information concentration of key entities in semantic units, effectively identifying situations where characters are truncated or key information is insufficient due to compression. Third, the introduction of a pre-trained medical domain semantic embedding model to calculate semantic consistency scores can deeply understand the deep semantic equivalence relationships between clinical terms, avoiding misjudgments caused by diverse expression methods (such as abbreviations and colloquial descriptions). By weighted and fused the scores of the above three dimensions and making a comprehensive judgment based on preset thresholds, the detection accuracy of the incomplete state of key medical entities is significantly improved; the accuracy of the forced recall mechanism is ensured, providing a reliable basis for generating truly lossless compressed text.

[0104] Example 10: This example provides a long text dynamic compression system based on a multimodal big health knowledge graph, such as... Figure 3 As shown, it includes: The multimodal big health knowledge graph construction module is used to collect multimodal health data, identify medical entities in the multimodal health data, and construct a multimodal big health knowledge graph based on the medical entities. The comprehensive importance score determination module is used to divide the original long health text into several semantic units, obtain the self-information of each semantic unit and the relevance of the semantic unit to the user query, and determine the medical weight of the entity matching the semantic unit based on the multimodal big health knowledge graph. At the same time, the comprehensive importance score of each semantic unit is calculated based on the self-information, medical weight and relevance. The candidate compression set determination module is used to sort each semantic unit in descending order according to the comprehensive importance score, and extract target semantic units based on the sorting results and preset criteria to generate a candidate compression set. The lossless compressed text acquisition module is used to scan the candidate compression set and detect semantic units marked as key medical entities in the candidate compression set. When a missing semantic unit marked as a key medical entity is detected, forced recall and substring recovery are triggered to supplement the key medical entity and obtain lossless compressed text. The cache response module is used to convert lossless compressed text input into a large language model into a target sequence, and to concatenate learnable health point tags at the end of the target sequence. Under the constraint of asymmetric attention mask, the full-text semantics of the compressed text are aggregated according to the health point tags and stored in the corresponding key-value pair cache. During the inference phase, the response is generated according to the aggregated semantics stored in the key-value pair cache.

[0105] The working principle and beneficial effects of the above technical solution are as follows: By introducing prior knowledge in the medical field and user query intent, efficient dynamic compression of ultra-long health texts is achieved. First, a multimodal big health knowledge graph is used to provide clinical value assessment for medical entities, ensuring that high-risk indicators and key terms are accurately identified and retained during the compression process, avoiding the problem of general compression algorithms accidentally deleting key data due to a lack of medical knowledge. Second, conditional relevance assessment is performed in conjunction with user health queries, enabling the compression results to dynamically adjust their focus according to different query intents. On this basis, through forced recall and substring recovery mechanisms, the integrity of medical values ​​and terms is guaranteed, preventing clinical semantic distortion caused by compression. Finally, health point tags are used to aggregate the full-text semantics and only a small number of key-value pairs are cached during the inference stage, significantly reducing the computational overhead and memory usage when the large language model processes ultra-long texts, enabling the rapid generation of accurate health responses even with limited resources.

[0106] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A method for dynamic compression of long texts based on a multimodal big health knowledge graph, characterized in that, include: Step 1: Collect multimodal health data, identify medical entities in the multimodal health data, and construct a multimodal big health knowledge graph based on the medical entities; Step 2: Divide the original long health text into several semantic units, obtain the self-information of each semantic unit and the relevance of the semantic unit to the user query, and determine the medical weight of the entity that matches the semantic unit based on the multimodal big health knowledge graph. At the same time, calculate the comprehensive importance score of each semantic unit based on self-information, medical weight and relevance. Step 3: Sort each semantic unit in descending order according to the comprehensive importance score, and extract the target semantic units based on the sorting results and preset criteria to generate a candidate compressed set; Step 4: Scan the candidate compression set to detect semantic units marked as key medical entities. When a missing semantic unit marked as a key medical entity is detected, forced recall and substring recovery are triggered to supplement the key medical entity and obtain lossless compressed text. Step 5: Input the lossless compressed text into the large language model and convert it into a target sequence. Then, concatenate learnable health point tags at the end of the target sequence. Under the constraint of asymmetric attention mask, aggregate the full-text semantics of the compressed text based on the health point tags and store the full-text semantics in the corresponding key-value pair cache. During the inference phase, generate a response based on the aggregated semantics stored in the key-value pair cache.

2. The method for dynamic compression of long texts based on a multimodal big health knowledge graph according to claim 1, characterized in that, In step 1, multimodal health data is collected, medical entities are identified within the multimodal health data, and a multimodal big health knowledge graph is constructed based on these medical entities, including: The management terminal acquires the source database corresponding to the multimodal health data and accesses the source database to collect multimodal health data, which includes at least one of electronic medical records, physical examination reports, diet logs, and exercise records. Standardized health data is obtained by unifying the format of the collected multimodal health data, cleaning the data, and mapping it to medical terms. Named entity recognition is performed on standardized health data to extract medical entities, and semantic relationships between medical entities are identified based on relation extraction technology. A multimodal big health knowledge graph is constructed by using medical entities as nodes and semantic relationships as edges, and the multimodal big health knowledge graph is stored in a graph database.

3. The method for dynamic compression of long texts based on a multimodal big health knowledge graph according to claim 2, characterized in that, Identifying semantic relationships between medical entities based on relation extraction technology, including: Obtain the extracted medical entities and locate the text fragments containing each medical entity from standardized health data to construct a candidate sentence set containing entity pairs; The candidate sentence set is input into a pre-trained language model, and the semantic relationship type between entity pairs in the candidate sentences is identified based on sequence labeling. The identified semantic relationships are filtered out, and weak relationships with confidence levels below a preset threshold are removed to obtain a set of candidate semantic relationships; Align and deduplicate the candidate semantic relation set with the existing relations in the multimodal big health knowledge graph to eliminate redundant or conflicting relations; The final semantic relationships between medical entities are determined based on the alignment results.

4. The method for dynamic compression of long texts based on a multimodal big health knowledge graph according to claim 1, characterized in that, In step 2, the original long health text is divided into several semantic units, and the self-information of each semantic unit and the relevance of the semantic unit to the user query are obtained. Furthermore, based on the multimodal big health knowledge graph, the medical weights of entities matching the semantic units are determined. Simultaneously, based on the self-information, medical weights, and relevance, a comprehensive importance score for each semantic unit is calculated, including: Obtain the original long health text and receive the health query input by the user, where the health query represents the user's question or search intent; The original long health text is divided into semantic units to obtain a sequence of semantic units; The sequence of semantic units is input into a large language model, and the language model self-information of each semantic unit is determined based on the conditional probability output by the large language model. Each semantic unit is matched with medical entities in the pre-built multimodal big health knowledge graph. If the match is successful, the entity type weight and centrality index of the medical entity in the graph are obtained, and the knowledge graph importance item of the current semantic unit is calculated based on the entity type weight and centrality index. If a match fails, the importance of the knowledge graph is zero. Based on the embedding model, the user health query and each semantic unit are vectorized and encoded to obtain the query embedding vector and the unit embedding vector, and the cosine similarity between the query embedding vector and the unit embedding vector is determined. The conditional relevance score between the current semantic unit and the user's health query is obtained based on cosine similarity. The comprehensive importance score of the corresponding semantic unit is obtained by weighting and summing the language model self-information, knowledge graph importance items, and conditional relevance scores of each semantic unit.

5. The method for dynamic compression of long texts based on a multimodal big health knowledge graph according to claim 1, characterized in that, In step 3, the semantic units are sorted in descending order based on their comprehensive importance scores, and target semantic units are extracted based on preset criteria according to the sorting results to generate a candidate compression set, including: Based on the comprehensive importance score, all semantic units are sorted in descending order to obtain the sorted sequence; Based on the preset compression rate, the top K semantic units in the sorted sequence are selected as the high-scoring retention set; The original long health text is scanned independently to detect the preset key medical entities contained therein, and all detected key medical entities are used as a mandatory retention set. The high-scoring retention set and the forced retention set are merged, and duplicate semantic units are removed to obtain a preliminary retention set; All semantic units in the initial retained set are rearranged according to their original index order in the original long healthy text to generate a candidate compressed set.

6. The method for dynamic compression of long texts based on a multimodal big health knowledge graph according to claim 1, characterized in that, In step 4, the candidate compression set is scanned to detect semantic units marked as key medical entities. When a missing semantic unit marked as a key medical entity is detected, forced recall and substring recovery are triggered to supplement the key medical entity, resulting in lossless compressed text, including: Scan the candidate compressed set and identify semantic units containing preset key medical entities; For each identified semantic unit containing a key medical entity, detect whether the key medical entity is missing; When a critical medical entity is detected to be incomplete, the complete entity information is located and extracted from the original long health text according to the type of the critical medical entity, triggering a forced recall operation. Based on the substring recovery mechanism, the extracted complete entity information is supplemented to the missing position of the corresponding semantic unit in the candidate compression set to repair the entity. Once the physical repair is complete, lossless compressed text is obtained.

7. The method for dynamic compression of long texts based on a multimodal big health knowledge graph according to claim 1, characterized in that, In step 5, the lossless compressed text is input into the large language model and converted into a target sequence. Learnable health point tags are appended to the end of the target sequence. Under the constraint of an asymmetric attention mask, the full-text semantics of the compressed text are aggregated based on the health point tags and stored in the corresponding key-value pair cache. During the inference phase, a response is generated based on the aggregated semantics stored in the key-value pair cache, including: The lossless compressed text is obtained and input into a large language model to be converted into a target sequence composed of word sequences. The large language model is a deep neural network model based on the Transformer architecture. A set of pre-initialized and learnable health point tags is appended to the end of the target sequence; Construct an asymmetric attention mask matrix and configure it to allow each health point tag to have full attention access to all lexical units in the target sequence, while prohibiting any original lexical unit in the target sequence from having attention computation on the health point tag; The concatenated sequence is input into the large language model for forward propagation under the constraint of the asymmetric attention mask matrix. In each Transformer layer, the full-text semantic information of the health point markers is aggregated without loss and compressed based on the self-attention mechanism, and the aggregated semantics are stored in the vector representation of the health point markers. After the forward propagation is completed, the key-value pair cache of all lexical units is calculated, and the key-value pair cache corresponding to the health point marker is retained. At the same time, the key-value pair cache corresponding to the original lexical units in the target sequence is discarded. During the inference phase, the key-value pairs marked with health points are cached as input and input into a large language model for decoding and generation, outputting a response corresponding to the user's health query.

8. The method for dynamic compression of long texts based on a multimodal big health knowledge graph according to claim 1, characterized in that, After obtaining the lossless compressed text, it also includes: The lossless compressed text is obtained, and the medical entities contained in the lossless compressed text are determined based on the multimodal big health knowledge graph. At the same time, the semantic relationships between medical entities are determined based on the multimodal big health knowledge graph. The medical entities are used as nodes and the semantic relationships are used as edges to construct the semantic subgraph corresponding to the lossless compressed text. Perform topological analysis on the semantic subgraph, calculate the graph density, number of connected components and degree of key nodes of the semantic subgraph, and generate a structural integrity coefficient based on the graph density, number of connected components and degree of key nodes; The lossless compressed text is input into a pre-trained medical language understanding model to extract the semantic feature vector of the lossless compressed text. The cosine similarity between the semantic feature vector and the semantic feature vector of the original long health text is determined to generate a semantic fidelity coefficient. The overall importance score of each semantic unit is obtained, and the sum of the overall importance scores of all semantic units in the lossless compressed text is divided by the total number of semantic units to generate the importance retention density coefficient. The structural integrity coefficient, semantic fidelity coefficient, and importance retention density coefficient are input into a pre-trained compression quality evaluation network for analysis, resulting in a comprehensive compression quality score. The obtained overall compression quality score is compared with the preset quality threshold. If the overall compression quality score is lower than the preset quality threshold, a secondary compression optimization process will be triggered. Based on the triggering result, the missing semantic units that are not included in the current lossless compressed text and whose comprehensive importance score is higher than the dynamic threshold are located in the original long healthy text. The missing semantic units are then inserted into the corresponding positions in the current lossless compressed text according to the original index order, and the quality is re-evaluated until the comprehensive compression quality score reaches the preset quality threshold. Otherwise, the current lossless compressed text will be used as the final compressed text.

9. A method for dynamic compression of long texts based on a multimodal big health knowledge graph according to claim 6, characterized in that, For each identified semantic unit containing a key medical entity, detect whether the key medical entity is incomplete, including: For each identified semantic unit containing a key medical entity, obtain the standard entity representation of the corresponding key medical entity; The standard regular expression pattern corresponding to the standard entity expression is determined based on the regular expression matching, and the structural integrity score of the key medical entity in the semantic unit is calculated based on the standard regular expression pattern of the key medical entity. ; in, This represents the structural integrity score of key medical entities within semantic units; Represents semantic units Standard regular expression pattern for text and key medical entities Does it match exactly? Represents semantic units Standard regular expression pattern for text and key medical entities Exact match; The text coverage score of key medical entities in semantic units is calculated according to the following formula; ; in, This represents the text coverage score of key medical entities within semantic units; Represented as key entity text fragments actually extracted from semantic units. Length; Indicates the overall text length of a semantic unit; Based on a pre-trained semantic embedding model, the semantic consistency score between key medical entities and semantic units is calculated. ; in, This represents the semantic consistency score between key medical entities and semantic units. The embedding vector representing the standard entity is entity_standard; The embedding vector representing the semantic unit text unit; This refers to the process by which a pre-trained semantic embedding model maps input text into a high-dimensional dense vector. This represents the semantic similarity between standard entity representations and semantic unit text in the vector space. The integrity score of key medical entities is obtained by weighted summation of structural integrity score, text coverage score, and semantic consistency score. ; in, Indicates the integrity score of key medical entities; Weighting coefficients representing structural integrity; Weighting coefficients representing text coverage; Weighting coefficients representing semantic consistency; Integrity score Compared with the preset defect determination threshold Compare; when If so, it is determined that the key medical entity in the semantic unit is incomplete; Otherwise, the key medical entities in the semantic unit are determined to be complete.

10. A long text dynamic compression system based on a multimodal big health knowledge graph, characterized in that, include: The multimodal big health knowledge graph construction module is used to collect multimodal health data, identify medical entities in the multimodal health data, and construct a multimodal big health knowledge graph based on the medical entities. The comprehensive importance score determination module is used to divide the original long health text into several semantic units, obtain the self-information of each semantic unit and the relevance of the semantic unit to the user query, and determine the medical weight of the entity matching the semantic unit based on the multimodal big health knowledge graph. At the same time, the comprehensive importance score of each semantic unit is calculated based on the self-information, medical weight and relevance. The candidate compression set determination module is used to sort each semantic unit in descending order according to the comprehensive importance score, and extract target semantic units based on the sorting results and preset criteria to generate a candidate compression set. The lossless compressed text acquisition module is used to scan the candidate compression set and detect semantic units marked as key medical entities in the candidate compression set. When a missing semantic unit marked as a key medical entity is detected, forced recall and substring recovery are triggered to supplement the key medical entity and obtain lossless compressed text. The cache response module is used to convert lossless compressed text input into a large language model into a target sequence, and to concatenate learnable health point tags at the end of the target sequence. Under the constraint of asymmetric attention mask, the full-text semantics of the compressed text are aggregated according to the health point tags and stored in the corresponding key-value pair cache. During the inference phase, the response is generated according to the aggregated semantics stored in the key-value pair cache.