Rehabilitation semantic understanding and intelligent inquiry method based on large language model fine tuning
By constructing a rehabilitation-specific corpus and a lightweight, fine-tuned large language model, and combining LoRA and semantic perturbation training, the problems of accuracy and computational efficiency in semantic understanding during rehabilitation consultations are solved, resulting in an efficient and interpretable intelligent consultation system suitable for rehabilitation medicine scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTH CHINA UNIV OF TECH
- Filing Date
- 2025-12-23
- Publication Date
- 2026-05-01
AI Technical Summary
Existing rehabilitation consultation systems struggle to accurately understand semantic details and context when faced with patients' ambiguous language expressions, resulting in low diagnostic accuracy. Furthermore, the deployment of large language models in the medical field is limited by computing power and privacy issues, making them unsuitable for effective application in rehabilitation medicine.
By constructing a rehabilitation-specific corpus system, introducing a low-rank adaptation parameter update mechanism (LoRA) and combining it with a semantic perturbation training strategy, a lightweight fine-tuning of the large language model is performed. A multi-task semantic parsing network and confidence calculation are designed, and combined with context memory units and an active consultation strategy, dynamic and interpretable consultation interaction is achieved.
It achieves accurate semantic understanding and consultation guidance in small sample and low resource environments, reduces computation by 68%, shortens training time by 55%, and has the ability to self-examine and dynamically follow up. It outputs structured rehabilitation semantic assessment results, improving the accuracy of diagnosis and computational efficiency.
Smart Images

Figure CN121964099A_ABST
Abstract
Description
A Rehabilitation Semantic Understanding and Intelligent Consultation Method Based on Fine-tuning of a Large Language Model Technical Field
[0001] This invention relates to the interdisciplinary field of artificial intelligence and rehabilitation medicine, specifically to a rehabilitation semantic understanding and intelligent consultation method and system based on fine-tuning of a large language model. Background Technology
[0002] In recent years, with the development of rehabilitation medicine and the arrival of an aging society, the number of patients with neurological dysfunction, motor dysfunction, and cognitive impairment has increased significantly. The rehabilitation process often relies on doctor-patient consultations, where doctors assess the degree of functional impairment based on the patient's complaints, symptom descriptions, and feedback on daily life, and then select appropriate assessment scales and intervention programs. However, significant cognitive and linguistic barriers exist in actual rehabilitation consultations: patients often cannot clearly describe their own condition, and doctors need to extract useful information from vague expressions.
[0003] Traditional rehabilitation consultation systems primarily rely on structured questionnaires or keyword matching for automated assessment. While these systems can cover some standard scales (such as the Constant Shoulder Rating Scale, Berg Balance Scale, and MoCA Cognitive Scale), they perform poorly in natural communication environments. Patients' everyday language contains numerous omissions, ambiguities, and metaphors, such as "I always drag my feet when I walk," "My hands tremble when I hold chopsticks," and "My memory hasn't been very good lately." These natural language expressions cannot be directly mapped to standard medical terminology, requiring doctors to make judgments based on experience. Further complicating matters, patients' expressions often contain time cues ("in the last few days," "never before") and latent symptoms ("I always feel unsteady," "I get tired easily"), details that traditional template-based systems struggle to capture.
[0004] In recent years, Large Language Models (LLMs) have made breakthroughs in natural language understanding, capable of capturing contextual semantics and generating natural language output. However, general-purpose LLMs face three major problems when applied in the field of rehabilitation medicine: First, the semantic space of the model lacks rehabilitation knowledge support, making it unable to correctly understand medical terms and descriptions of bodily functions; second, medical data privacy requirements are high, limiting the direct use of clinical data for large-scale fine-tuning; and third, complete fine-tuning of large language models requires extremely high computing power, which does not meet the deployment conditions of hospital information systems. For example, the general-purpose LLM developed by Thirunavukarasu et al. faces core bottlenecks in the medical field, including a lack of domain knowledge, data privacy constraints, and extremely high computing power costs, which limit its reliable deployment in professional scenarios (Thirunavukarasu AJ, Ting DSJ, Elangovan K, et al. Large language models in medicine. Nature medicine, 2023, 29(8):1930-1940.).
[0005] Currently, there have been explorations in the field of intelligent consultation both domestically and internationally, such as rule-based symptom dialogue systems or medical question-answering platforms based on small models. However, these solutions generally suffer from poor generalization ability, rigid consultation strategies, and one-sided semantic understanding. For example, when a patient says, "I'm a little unsteady on my feet," the system can only match lower limb training items based on the keyword "walking," and cannot further determine whether it is a balance dysfunction or a gait coordination problem, nor can it identify the duration, severity, or accompanying manifestations of symptoms based on the context. This superficial semantic matching is insufficient to meet the personalized and accurate requirements of rehabilitation assessment. The latest empirical research further reveals the severity of these problems. For example, the CRAFT-MD assessment framework proposed by Johri et al. in 2025 (Johri S, Jeong J, Tran BA, et al. An evaluation framework for clinical use of large language models in patient interaction tasks[J]. Nature Medicine, 2025, 31(1):77-86.) found that even the most advanced GPT-4 model, when diagnosis requires multiple rounds of dialogue (simulating real doctor-patient consultations), saw its accuracy plummet from 82% in static responses to 26%. This directly proves that current LLM-based intelligent consultation solutions suffer from fundamental defects such as "rigid consultation strategies" and "partial semantic understanding," failing to effectively guide dialogue, integrate fragmented information, and form accurate judgments in dynamic interactions. Summary of the Invention
[0006] This invention proposes a rehabilitation semantic understanding and intelligent consultation system based on the fine-tuning of a lightweight large language model. By constructing a rehabilitation-specific corpus, introducing a low-rank adaptation parameter update mechanism (LoRA), and combining it with a semantic perturbation training strategy, the system can achieve accurate semantic understanding and consultation guidance in a small sample and low-resource environment, providing a new path for the intelligentization of rehabilitation.
[0007] Compared with existing technologies, the beneficial effects of the present invention are as follows: a rehabilitation semantic understanding and intelligent consultation method based on fine-tuning of a large language model includes the following steps: (1) semantically parsing the input natural language through a trained large language model and outputting semantic labels and confidence scores; (2) after completing semantic parsing, entering the intelligent consultation stage to realize dynamic and interpretable consultation interaction.
[0008] Furthermore, the training of the large language model includes the following steps: S1, constructing and preprocessing the corpus data; S2, performing lightweight fine-tuning of the large language model through low-rank adaptation techniques.
[0009] Furthermore, a multi-task semantic parsing network is designed on the fine-tuned large language model, and confidence is calculated. The specific steps include: first, the input natural language is mapped to a contextual feature representation through the encoding layer, and then the keywords in the sentence are aggregated through the attention weight distribution via a multi-head self-attention mechanism; then, using two trainable low-rank matrices introduced by the fine-tuning, the final high-level feature vector obtained after processing by the feature extraction layer and attention module of the large language model is mapped to the rehabilitation semantic label space. At the same time, the large language model uses the Softmax layer to output the probability of the structured semantic label and calculate the confidence.
[0010] Furthermore, the rehabilitation semantic label space includes a three-dimensional semantic classification system of functional parts, functional types, and impairment levels, enabling the structured semantic structure output by the large language model.
[0011] Furthermore, the large language model employs a dual-channel confidence calculation mechanism to generate a final confidence score, which is used to determine the reliability of the structured semantic labels output by the large language model. The first channel calculates the label confidence based on the probability distribution; the second channel evaluates the stability of the model's decision-making through the rate of change of the attention gradient. The two are weighted together to generate the final confidence score.
[0012] Furthermore, the intelligent consultation stage achieves dynamic and interpretable consultation interaction through a context memory unit and an active consultation strategy controller. The context memory unit is used to generate a semantic state based on the patient's historical dialogue and the generated structured semantic tags. The semantic state is dynamically updated in multiple rounds of interaction, enabling the large language model to maintain semantic continuity in multiple rounds of dialogue. The consultation strategy controller is used to generate the most distinctive question text based on the current semantic state.
[0013] Furthermore, when the confidence level reaches a preset threshold, the semantics are written into the context memory and the semantic state is updated; when the confidence level is insufficient or there are semantic gaps, new follow-up questions are generated based on the current semantic state to guide the patient to supplement their expression, thereby realizing a continuous, multi-round, and dynamic consultation dialogue process, and finally outputting a complete rehabilitation semantic assessment result; the proactive consultation strategy controller identifies semantic gaps based on the semantic state and generates follow-up question text, formally expressed as:
[0014] in Indicates the first The semantic vector representation of the optimal follow-up questions generated by the consultation strategy controller during round-robin consultations. For the generation function based on policy gradient optimization, The current semantic state, These are learnable parameters.
[0015] The system for implementing a rehabilitation semantic understanding and intelligent consultation method based on large language model fine-tuning includes: a data construction and preprocessing module for constructing a rehabilitation corpus to support the semantic transfer and structured understanding of the large language model; a model fine-tuning and training module for lightweight training of the large language model under limited computing power and loss optimization to enable it to have semantic parsing capabilities in the rehabilitation field and generate corresponding consultation texts according to context, thereby enhancing the model's adversarial and robust properties; a semantic parsing module for converting the patient's natural language input into a standardized rehabilitation semantic structure, presenting the keyword fragments that the large language model focuses on through attention visualization, and calculating confidence to ensure the credibility of semantic result predictions; and an intelligent consultation module for achieving dynamic and interpretable consultation interactions through contextual memory mechanisms, semantic state modeling, and policy controllers.
[0016] A computer device according to the present invention includes a memory and a processor, the memory being electrically connected to the processor, the memory storing a computer program, which, when executed by the processor, causes the processor to implement the method described herein.
[0017] The present invention provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor implements the method described herein.
[0018] The beneficial effects of this invention are reflected in three main aspects: improved model capabilities, optimized engineering efficiency, and improved clinical adaptability.
[0019] Firstly, regarding semantic understanding capabilities, this invention, through the construction of a multi-source rehabilitation corpus system and a command-based training mechanism, enables the system to deeply understand the implicit semantics in patients' natural language expressions, achieving automatic mapping from vague statements to standardized rehabilitation terminology. The system can not only identify explicit symptoms but also parse out semantic-level functional impairment relationships. For example, when a patient says, "I've been falling down a lot lately," the system can infer the latent semantics "lower limb coordination disorder—impaired balance function" and calculate the semantic confidence level. This depth of understanding is unattainable by traditional keyword matching methods.
[0020] Secondly, in terms of computational efficiency, this invention minimizes parameter updates through LoRA lightweight fine-tuning. Experiments show that, while maintaining the same semantic accuracy, the system's computational load is reduced by approximately 68%, training time is shortened by 55%, and GPU memory usage is reduced by two-thirds. This means that medical institutions can deploy this system without expensive computing power, achieving a lightweight AI model innovation that is "hospital-grade and deployable." Compared with the full parameter fine-tuning scheme, this invention not only has lower training costs but also the advantage of rapid iteration and updates, allowing for periodic local retraining based on new hospital corpora.
[0021] Furthermore, regarding intelligent interaction and interpretability, this invention employs an intelligent consultation strategy controller and a semantic confidence mechanism, enabling the system to possess self-censorship and dynamic follow-up questioning capabilities. When the system detects semantic ambiguity or low confidence, it automatically generates subsequent questions, such as "Does this dragging of the feet occur throughout the day or only in the morning?" This transforms the system from a passive responder into an active information collector, greatly enhancing the naturalness and clinical applicability of human-computer dialogue. Simultaneously, the system's attention heatmap and semantic interpretation interface provide doctors with visual evidence, resolving the "black box" problem of deep learning models and meeting the regulatory requirements for traceability, safety, and controllability in medical artificial intelligence.
[0022] Furthermore, the knowledge mapping mechanism of this invention directly links language output with a rehabilitation knowledge graph, achieving interconnection between semantic understanding results and databases of standard rehabilitation terminology, scale items, and training movements. This structured output provides high-quality data input for rehabilitation assessment and recommendation systems, supporting automatic program generation, intelligent follow-up, and individualized training path planning. The ternary semantic structure output by the system (such as "symptom entity—functional label—confidence") can be directly invoked by the inference engine, thereby achieving an integrated closed loop of "understanding—reasoning—recommendation".
[0023] Overall, this invention breaks through the performance bottleneck of previous semantic understanding models in rehabilitation scenarios, takes into account algorithm innovation, computing power optimization and medical application value, provides a feasible implementation path for intelligent rehabilitation systems, and has significant academic and industrial promotion significance. Attached Figure Description
[0024] Figure 1 is a schematic diagram of the overall architecture of a rehabilitation semantic understanding and intelligent consultation method and system based on fine-tuning of a large language model, according to an embodiment.
[0025] Figure 2 is a schematic diagram of the semantic parsing and consultation process in the embodiment.
[0026] Figure 3 is a schematic diagram of the intelligent consultation closed-loop structure of the embodiment. Detailed Implementation
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] As shown in Figure 1, this implementation of a rehabilitation semantic understanding and intelligent consultation system based on fine-tuning of a large language model includes: a data construction and preprocessing module, which is used to construct a rehabilitation corpus system with semantic unity and clear label hierarchy, and to clean, annotate and instruct the corpus to support the semantic transfer and structured understanding of the model.
[0029] The model fine-tuning and training module is used to perform lightweight training of large language models under limited computing power and to optimize the loss, enabling them to have semantic parsing capabilities in the rehabilitation field and to generate corresponding consultation texts based on context, thereby enhancing the model's adversarial and robust capabilities.
[0030] The semantic parsing module is used to transform the patient's natural language input into a standardized rehabilitation semantic structure, and to present the keyword fragments that the model focuses on in the form of attention visualization, and to calculate the confidence level to ensure the credibility of the semantic result prediction.
[0031] The intelligent consultation module is used to realize dynamic and interpretable consultation interaction through contextual memory mechanism, semantic state modeling and policy controller. The goal is to simulate the dynamic consultation logic of clinicians, so that the system can actively generate questions and guide patients to supplement symptom descriptions, thereby forming a more complete profile of the recovery status.
[0032] As shown in Figure 2, the consultation process in this embodiment is as follows: First, the user inputs natural language text, and the encoder obtains the contextual representation of the text, and aggregates semantic features based on a multi-head attention mechanism; then, the semantic parsing module outputs structured semantic labels such as functional parts, functional types, and impairment levels, and forms a confidence judgment by combining probability distribution and information entropy; when the confidence reaches a preset threshold, the semantic is written into the context memory and the semantic state is updated; when the confidence is insufficient or there is a gap in the semantics, new follow-up questions are generated based on the current semantic state to guide the patient to supplement their expression, thereby realizing a continuous, multi-round, and dynamic consultation dialogue process; finally, a complete rehabilitation semantic assessment result is output.
[0033] As shown in Figure 3, the intelligent consultation closed-loop structure of this implementation consists of semantic parsing, confidence calculation, context memory unit, semantic state, and active consultation strategy controller.
[0034] Semantic parsing is responsible for extracting semantic vectors and preliminary semantic labels from patient input, and performing operations such as semantic encoding, attention aggregation, and semantic prediction. Confidence calculation assesses the reliability of the current semantics based on probability output and information entropy. When the confidence meets the threshold requirement, the label is written into the context memory unit and updated cumulatively through semantic states, enabling the system to grasp the continuous changing trend of patient symptoms in multi-turn dialogues. When the confidence is insufficient or the semantics are incomplete, the proactive consultation strategy controller identifies semantic gaps based on the semantic state and generates targeted follow-up questions. Through the closed loop of "semantic parsing - confidence judgment - memory writing / follow-up question generation - state update", the system possesses a dynamic consultation logic similar to that of a clinician, achieving adaptive, multi-turn, and interpretable rehabilitation consultation capabilities.
[0035] The purpose of this invention is to provide an intelligent language model with semantic understanding, intent recognition, and proactive consultation capabilities. This model can automatically extract rehabilitation-related semantic features from patients' natural language, generating structured symptom labels and functional classification information to provide doctors with auxiliary consultation information. This method achieves domain transfer and semantic adaptation of the model through lightweight fine-tuning based on a large language model, thus balancing understanding ability and computational efficiency.
[0036] The system, centered on a lightweight large language model, combines semantic perturbation training, confidence control, and intelligent consultation strategies to achieve a complete closed-loop process of "natural language input—semantic parsing—structured output—semantic follow-up." Through targeted fine-tuning on rehabilitation domain data, this invention enables the model to possess high-precision semantic understanding and physician-style consultation capabilities. It can automatically identify functional impairment features in patients' natural expressions and generate structured semantic tags that can be directly used by subsequent knowledge reasoning and rehabilitation recommendation systems, providing underlying support for intelligent and interpretable rehabilitation decisions.
[0037] This embodiment of a rehabilitation semantic understanding and intelligent consultation method based on fine-tuning of a large language model includes the following steps: S1, constructing corpus data and preprocessing, including the following steps: S11, constructing a rehabilitation corpus system with semantic unity and clear label hierarchy through a rehabilitation corpus construction mechanism that combines multi-source fusion and instruction-based modeling, so as to support the semantic transfer and structured understanding of the model.
[0038] In rehabilitation settings, patients' natural language expressions are diverse, semantically ambiguous, and exhibit obvious colloquial characteristics. For example, phrases like "I always drag my feet when I walk," "My handwriting is always crooked," and "My memory hasn't been very good lately" are difficult to map directly to standard rehabilitation scales or medical terminology. Therefore, it is first necessary to construct a rehabilitation corpus system to support the semantic transfer and structured understanding of the model.
[0039] First, raw data is acquired. Sources of raw data include items from rehabilitation assessment scales (such as the Constant Shoulder Rating Scale, Berg Balance Scale, MoCA, etc.), desensitized doctor-patient dialogue texts, medical record summaries, and rehabilitation instruction manuals. Through multi-stage data cleaning, desensitization, and semantic normalization, the system removes statements without medical significance (such as small talk and emotional expressions) and performs semantic standardization on key symptom expressions. For example, "cannot raise hand high" and "cannot lift arm" are uniformly labeled as "limited upper limb movement"; "walking unsteadily" and "always prone to falling" are categorized as "lower limb balance dysfunction."
[0040] Then, semantically equivalent samples are constructed. This is used to introduce a semantic perturbation mechanism during training, enhancing the robustness of the large language model by constructing semantically equivalent samples. In this invention, the large language model refers to the fine-tuned DeepSeek-R1-14B large language model. For example, sentences such as "unsteady walking," "wavering gait," and "lower limbs not obeying commands" in the original data are considered equivalent samples, enabling the large language model to learn to recognize synonymous semantics in different expressions. This mechanism effectively reduces the large language model's dependence on keywords and enhances its generalization ability to natural expressions. In this way, this invention can handle the complex and diverse language expressions in rehabilitation scenarios, maintaining semantic consistency and high accuracy.
[0041] Finally, to enable the large language model to learn the mapping logic from natural language to structured semantics, this invention transforms the processed rehabilitation corpus into training samples in an "instruction-response" format. The instruction refers to the system's input, where the patient's language is fed into the large language model, formatted as "Please identify the functional impairment described by the patient: XXX" or "Patient's chief complaint: XXX." The response refers to the large language model's output, which is manually or expertly labeled with doctor-style structured semantic tags, forming instruction-based training samples that can be used for fine-tuning the large language model. For example: Input: "Patient's chief complaint: I've been dragging my feet a lot lately." Output: "Identify symptoms: Lower limb motor dysfunction; Semantic label: Gait and balance control abnormality; Impairment level: Moderate; Confidence: 0.91." This format allows the large language model to explicitly learn the semantic parsing chain, the logical path from language understanding to functional label generation, rather than relying solely on shallow keyword matching, thus directly generating structured results that can be called by the system during the inference stage. All samples are ultimately converted into JSON structure for storage to support subsequent batch training and automatic labeling.
[0042] S12. To ensure data quality, a semi-automatic manual review mechanism was introduced during preprocessing.
[0043] Automatic label prediction is performed using a pre-trained large language model, and the prediction results are sampled and reviewed by a team of rehabilitation experts. Incorrect labels from the large language model are re-labeled and added to the training set to form a data loop for continuous optimization. This mechanism effectively improves the accuracy and diversity of the corpus, enabling the model to maintain high performance even with small sample sizes.
[0044] In addition, to ensure the compliance and security of the corpus, all data undergoes a three-stage privacy protection process of "de-identification - embedding - backfilling" during the preprocessing stage: First, sensitive information such as names, hospitals, and contact information is replaced; second, the semantic distribution vectors of these words are learned through a semantic embedding model (i.e., the embedding vector layer in a large language model); finally, semantic placeholders are backfilled according to the semantic context when the semantic embedding model outputs, thereby maintaining the integrity of the context and preventing privacy leakage.
[0045] After preprocessing, the large language model can receive high-quality rehabilitation corpus input in a unified format. The semantic sample set covers multiple semantic levels such as disease, symptoms, functional parts, impairment level and rehabilitation movements, providing a solid data foundation for fine-tuning the large language model.
[0046] S2. Lightweight fine-tuning of the DeepSeek model using low-rank adaptation (LoRA) technique.
[0047] Traditional large language models require billions of parameter updates for full parameter fine-tuning, consuming enormous computational resources and making them unsuitable for deployment in hospital environments. To address this issue, this invention uses DeepSeek-R1-14B as the base model. While DeepSeek-R1-14B performs excellently in general semantic understanding, it lacks knowledge specific to the rehabilitation domain. To solve this problem, this invention introduces a low-rank adaptation technique (LoRA module) to perform lightweight fine-tuning of the base model. The core idea of LoRA is to fine-tune the attention layer weight matrix without modifying the original parameters. Add a low-rank matrix and By training only these parameters, new domain knowledge can be learned at minimal cost.
[0048] Specifically, for the attention layer weight matrix of the base model DeepSeek-R1-14B This invention introduces two trainable low-rank matrices into its update path. and ,in , and These represent the original attention layer weight matrices in the base model. The dimension, that is OK The final weight of the column is expressed as:
[0049] in The effective weights after fine-tuning This is the weight increment matrix. These are the low-rank vector downlink mapping matrix and the low-rank vector uplink mapping matrix, respectively.
[0050] This structure updates only the existing model language knowledge without affecting it. Two sets of parameters enable the transfer of knowledge to new domains with a minimal number of parameters. The LoRA module is inserted into the multi-head attention layer of the base model, where each attention head independently learns the feature distribution of the rehabilitation domain, allowing the base model to retain general language capabilities while acquiring a unique understanding of medical semantics.
[0051] During the optimization phase, the large language model uses the AdamW optimizer to update parameters, with a learning rate set to [value missing]. The batch size is 16, and the training rounds are 20. To prevent overfitting and gradient oscillations, this invention introduces a learning rate warm-up and linear decay strategy, and performs validation set evaluation after each training round. The model automatically stops early when the F1 score on the validation set does not improve for three consecutive rounds, ensuring stable convergence.
[0052] To simultaneously improve the overall performance of large language models in entity recognition, intent classification, and generation tasks, this invention designs a joint loss function:
[0053] in: The value obtained from the joint loss function is used to measure the difference between the model's prediction and the true label. This represents the semantic entity recognition loss; Indicates the intention to seek medical advice and classifies losses; Indicates the text generation loss; The weighting coefficients are dynamically adjusted using an uncertainty-weighted method to maintain a balance among tasks.
[0054] After fine-tuning, the large language model can not only accurately identify rehabilitation-related semantics, but also generate targeted consultation questions and suggested texts based on context. This lightweight design not only reduces GPU memory consumption during training by approximately 65%, but also enables the system to be deployed independently on hospital-grade GPU servers, achieving real-time consultation and semantic understanding functions.
[0055] S3. Based on the fine-tuned DeepSeek model, a multi-task semantic parsing network is designed to transform the patient's natural language input into a standardized rehabilitation semantic structure, realize the mapping from language to knowledge, identify semantic information, and output semantic labels.
[0056] Traditional methods often rely on keyword matching or fixed templates, making it difficult to capture semantic context and implicit logical relationships. This paper designs a multi-task semantic parsing network, combining attention mechanisms, hierarchical labeling systems, and confidence evaluation strategies to achieve high-precision extraction and interpretable output of semantic information. Specifically, the steps include: firstly, mapping the input text to contextual feature representations through an encoding layer. Then, global semantic aggregation is performed through a multi-head self-attention mechanism:
[0057] in These are the query, key, and value matrices, respectively. express The dimension is used for normalization. Through attention weight distribution, the model automatically focuses on keywords in the patient's sentences, such as "walking," "dragging one's feet," and "balance," forming semantic aggregation centers in the latent space. This process simulates the attention mechanism of doctors during consultations, enabling large language models to extract core semantics from long sentences and possess contextual understanding capabilities.
[0058] Subsequently, the semantic output layer utilizes the semantic mapping rules learned in the fine-tuning stage, namely the two trainable low-rank matrices, to obtain the final high-level feature vector after processing by the model feature extraction layer and attention module. Mapped to the rehabilitation semantic label space, this is a stable three-tiered labeling system constructed based on rehabilitation scales, expert experience, and corpus distribution. It includes a three-dimensional semantic classification system encompassing functional body parts (upper limbs, lower limbs, trunk), functional types (balance, coordination, fine motor skills), and impairment levels (mild, moderate, severe). Through hierarchical design, this system ensures that the semantic structure output by the large language model is both clinically interpretable and facilitates subsequent system recommendations for rehabilitation training programs. Simultaneously, the large language model utilizes the Softmax layer to output the probabilities of structured semantic labels.
[0059] in This represents the final confidence probability of the structured semantic label. Indicates input, This indicates a specific label category, such as "lower limbs," "balance function," or "moderate impairment." This represents the normalized exponential function.
[0060] To ensure the credibility of the semantic results, this invention designs a dual-channel confidence calculation mechanism. The first channel calculates the label confidence based on a probability distribution; the second channel evaluates the model's decision stability through the rate of change of the attention gradient. The two channels are weighted together to generate the final confidence score, which is used to determine the reliability of the structured semantic labels output by the large language model. The overall confidence score is defined as:
[0061] in As a confidence weighting factor, in one example, Take 0.6, This represents the rate of change of the attention gradient.
[0062] As one example, when If the system determines that the model's understanding is insufficient, it automatically invokes the intelligent consultation module to ask follow-up questions and supplement the information, thereby avoiding semantic ambiguity. In this way, the system can self-assess whether its understanding is sufficient, avoiding erroneous reasoning and missing information.
[0063] In the output phase, the semantic parsing results are represented as a ternary structure: ( This structure can be directly mapped to corresponding nodes in the knowledge graph, achieving a seamless connection from semantics to knowledge. For example, when the input is "I always shake when I hold chopsticks", the system outputs "Upper limb fine motor disorder - moderate - confidence 0.88", and maps this label to the "Upper limb fine motor dysfunction" node in the self-built knowledge graph for subsequent reasoning.
[0064] Meanwhile, the semantic parsing module also has interpretable output capabilities. It can generate semantic heatmaps based on attention weights, displaying the keyword fragments that the model focuses on in decision-making, such as "dragging feet" and "shaking," to help doctors review whether the model's understanding is reasonable, ensuring the safety and transparency of medical AI, and making the model traceable and safe in medical scenarios.
[0065] Through parsing, an automatic mapping from the patient's natural language to structured semantics was completed, significantly improving the completeness and accuracy of information extraction and providing high-quality input for rehabilitation knowledge reasoning and recommendation.
[0066] S4. After completing semantic parsing, the intelligent consultation stage begins, where dynamic and interpretable consultation interaction is achieved through context memory units, semantic state modeling, and policy controllers.
[0067] Traditional consultation systems often rely on fixed templates, lacking flexibility and context awareness, resulting in incomplete semantic collection and rigid interaction.
[0068] The Context Memory Unit (CMU) records the patient's historical dialogues and generated structured semantic tags. Based on these historical dialogues and generated structured semantic tags, a semantic state is generated. The semantic state is dynamically updated during multiple rounds of interaction, and its evolution process can be represented as follows:
[0069] in The current semantic state, , For input by the current user, the function This represents context fusion and semantic update operations. Through this mechanism, the large language model can maintain semantic continuity in multi-turn dialogues. For example, when a patient first says "can't raise their hand high," and then adds "actually, it hurts when they raise it to their shoulder," the semantics are automatically updated to "limited upper limb shoulder joint movement (pain-induced type)," forming a logical semantic evolution path.
[0070] When the model confidence is low or semantic ambiguity is high, the InquiryStrategyController (ISC) will be activated. The controller generates the most discriminative question based on the current semantic state, formally expressed as:
[0071] in Indicates the first The semantic vector representation of the optimal follow-up questions generated by the proactive consultation strategy controller during round-robin consultations. For the generation function based on policy gradient optimization, These are learnable parameters. The system optimizes the questioning order through reinforcement learning, making the consultation both efficient and natural. The output questions are generated by the Language Generation Engine based on contextual semantics, such as "Is this tremor more noticeable when at rest or when exerting force?" and "Is this dragging of the leg a constant throughout the day or is it worse in the morning?" These questions are stylistically closer to doctors' expressions, enhancing the naturalness of human-computer interaction and clinical usability.
[0072] Furthermore, the intelligent consultation module forms a closed loop with the semantic parsing module. After a patient answers, the system re-feeds the new input to the semantic parsing network for label updates. If the confidence level of the new label increases by more than a threshold of 0.1, the semantic state is updated; otherwise, the original state is retained. This mechanism ensures the system's robustness and dynamic correction capabilities at the semantic level.
[0073] Intelligent consultation transforms the consultation process from passive answering to proactive guidance, achieving cross-layered interaction from perception to reasoning. Through contextual memory and strategy control, it can maintain semantic consistency and logical coherence in multi-turn dialogues, making the intelligent consultation process closer to the doctor's thinking mode and significantly improving the interactive experience and the completeness of information collection.
[0074] In summary, this invention achieves three methodological breakthroughs: First, it realizes a deep understanding of rehabilitation semantics and standardized structural output; second, it introduces lightweight and adversarial training strategies during the fine-tuning of the large language model to achieve efficient adaptation; and third, it constructs a closed-loop interface between semantic parsing and proactive consultation strategies, enabling the model to automatically trigger follow-up questions when semantics are uncertain and to stably output structured results when semantics converge, thereby forming a dynamic consultation mechanism with medical interpretability.
[0075] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, enabling those skilled in the art to better understand and utilize the invention.
Claims
1. A rehabilitation semantic understanding and intelligent consultation method based on fine-tuning of a large language model, characterized in that, The process includes the following steps: (1) Semantically analyze the input natural language through a trained large language model and output semantic labels and confidence scores; (2) After completing the semantic analysis, enter the intelligent consultation stage to achieve dynamic and interpretable consultation interaction.
2. The rehabilitation semantic understanding and intelligent consultation method based on large language model fine-tuning according to claim 1, characterized in that, Training a large language model involves the following steps: S1. Constructing and preprocessing the corpus data; S2. Lightweight fine-tuning of the large language model using low-rank adaptation techniques.
3. The rehabilitation semantic understanding and intelligent consultation method based on large language model fine-tuning according to claim 2, characterized in that, A multi-task semantic parsing network is designed on the fine-tuned large language model, and confidence is calculated. The specific steps include: First, the input natural language is mapped to the context feature representation through the encoding layer, and then the keywords in the sentence are aggregated through the attention weight distribution of the multi-head self-attention mechanism. Then, using the two trainable low-rank matrices introduced by the fine-tuning, the final high-level feature vector obtained after processing by the feature extraction layer and attention module of the large language model is mapped to the rehabilitation semantic label space. At the same time, the large language model uses the Softmax layer to output the probability of the structured semantic label and calculate the confidence.
4. The rehabilitation semantic understanding and intelligent consultation method based on large language model fine-tuning according to claim 3, characterized in that, The rehabilitation semantic label space includes a three-dimensional semantic classification system of functional parts, functional types and impairment levels, which enables the structured semantic structure output by the large language model.
5. The rehabilitation semantic understanding and intelligent consultation method based on large language model fine-tuning according to claim 3, characterized in that, The large language model employs a dual-channel confidence calculation mechanism to generate a final confidence score, which is used to determine the reliability of the structured semantic labels output by the large language model. The first channel calculates the label confidence based on the probability distribution; the second channel evaluates the stability of the model's decision-making through the rate of change of the attention gradient. The two are weighted together to generate the final confidence score.
6. The rehabilitation semantic understanding and intelligent consultation method based on large language model fine-tuning according to claim 1, characterized in that, In the intelligent consultation phase, dynamic and interpretable consultation interaction is achieved through the context memory unit and the active consultation strategy controller. The context memory unit is used to generate semantic state based on the patient's historical dialogue and the generated structured semantic tags. The semantic state is dynamically updated in multi-turn interactions, enabling the large language model to maintain semantic continuity in multi-turn dialogues. The consultation strategy controller is used to generate the most distinctive question text based on the current semantic state.
7. The rehabilitation semantic understanding and intelligent consultation method based on large language model fine-tuning according to claim 6, characterized in that, When the confidence level reaches a preset threshold, the semantics are written into the context memory and the semantic state is updated. When the confidence level is insufficient or there are semantic gaps, new follow-up questions are generated based on the current semantic state to guide the patient to supplement their expression, thereby realizing a continuous, multi-round, and dynamic consultation dialogue process, and finally outputting a complete rehabilitation semantic assessment result. The proactive consultation strategy controller identifies semantic gaps based on the semantic state and generates follow-up question text, which is formally expressed as: in Indicates the first The semantic vector representation of the optimal follow-up questions generated by the consultation strategy controller during round-robin consultations. For the generation function based on policy gradient optimization, For the current semantic state, These are learnable parameters.
8. A system for implementing the rehabilitation semantic understanding and intelligent consultation method based on large language model fine-tuning as described in claim 1, characterized in that, It includes a data construction and preprocessing module for building a rehabilitation corpus system to support the semantic transfer and structured understanding of large language models; The model fine-tuning and training module is used to perform lightweight training of large language models under limited computing power and to optimize the loss, enabling them to have semantic parsing capabilities in the rehabilitation field and to generate corresponding consultation texts based on context, thereby enhancing the adversarial and robust nature of the model. The semantic parsing module is used to transform patients' natural language input into standardized rehabilitation semantic structures, and to present the keyword fragments that the large language model focuses on through attention visualization, and to calculate confidence to ensure the credibility of semantic result predictions; the intelligent consultation module is used to realize dynamic and interpretable consultation interaction through contextual memory mechanism, semantic state modeling and policy controller.
9. A computer device comprising a memory and a processor, the memory being electrically connected to the processor, the memory storing a computer program, characterized in that: When the computer program is executed by the processor, it causes the processor to implement the method as described in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the processor implements the method as described in any one of claims 1 to 8.