Exercise prescription generation based on llm

By employing an LLM-based exercise prescription generation method, utilizing data preprocessing and reinforcement learning optimization, and combining knowledge graphs and multi-source health information, the cold start and personalized matching problems of traditional exercise recommendation methods in complex situations are solved, achieving efficient generation and intelligent management of personalized exercise prescriptions.

CN120994900BActive Publication Date: 2026-05-05HANGZHOU INNOVATION RES INST OF BEIJING UNIV OF AERONAUTICS & ASTRONAUTICS +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU INNOVATION RES INST OF BEIJING UNIV OF AERONAUTICS & ASTRONAUTICS
Filing Date
2025-07-23
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Traditional exercise recommendation methods are prone to cold start problems when dealing with incomplete or missing user health data in complex situations, and they cannot effectively match personalized needs, resulting in poor recommendation performance.

Method used

We adopt an LLM-based exercise prescription generation method, which generates personalized exercise prescriptions that conform to the FITT principle by acquiring data preprocessing, constructing knowledge graphs, optimizing LLM models through reinforcement learning, and combining multimodal health information and environmental perception.

Benefits of technology

It improves the accuracy, interpretability, and credibility of exercise prescriptions, enables personalized recommendations in data-sparse scenarios, alleviates the cold start problem, and enhances user experience and the level of intelligence in sports and health management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994900B_ABST
    Figure CN120994900B_ABST
Patent Text Reader

Abstract

This invention relates to the field of exercise prescription generation and recommendation technology, and discloses an LLM-based generative recommendation method for exercise prescriptions. The method involves acquiring and preprocessing data, constructing a knowledge graph based on the preprocessed data (S1), pre-training the LLM model, inputting the constructed knowledge graph into the LLM model, and optimizing it through reinforcement learning. The PPO algorithm is used to optimize the LLM model's output strategy. Based on the optimized LLM model, the exercise prescription is derived and generated in natural language using FITT parameters. This method combines user characteristics and scenario information to generate high-quality, personalized exercise prescriptions. The invention utilizes a multi-dimensional reward function framework to quantify prescription quality and optimize the generation strategy, ensuring that the generated exercise prescriptions are not only scientifically sound but also conform to the user's actual situation and preferences. Synthetic data is generated through a user simulator, achieving an upgrade from static recommendation to dynamic adaptation, improving user experience and the level of intelligence in exercise and health management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of exercise prescription generation and recommendation technology, specifically to an LLM-based exercise prescription generation and recommendation method. Background Technology

[0002] In recent years, Large Language Models (LLMs) have demonstrated powerful capabilities in natural language understanding and multi-domain knowledge fusion. They also have the potential to generate exercise prescriptions in various scenarios at the generalization level. In the past, the application of LLMs in the field of exercise prescription generation has mainly been traditional content-based filtering, collaborative filtering recommendation, and data-driven model optimization. Applications in exercise prescription generation, dynamic personalized exercise prescription generation, and optimization of multimodal real-time interactive exercise prescriptions have been relatively few.

[0003] With the rise of national fitness activities and the popularity of smart wearable sports devices, sports and health management has encountered a contradiction between information overload and mismatch between individual needs. Traditional sports recommendations generally use rule-based expert systems or simple collaborative filtering algorithms. The key is to abstract the sports prescription as a mapping between input conditions and output schemes. In this rule matching mode, the system can only rely on the rules in the rule base. In complex situations, it is difficult to process user health data. When the user's personal data is incomplete or sports data is missing, traditional methods are prone to cold start problems and "one-size-fits-all" scheme recommendation results. The few studies on sports type matching based on machine learning also fail to grasp the internal relationship of sports prescriptions because they cannot extract sufficient feature dimensions, resulting in poor recommendation performance in the case of sparse data. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention provides an LLM-based method for generating and recommending exercise prescriptions. This method generates exercise prescriptions that are not only scientifically sound and reasonable, but also in line with the user's actual situation and preferences, thus solving the aforementioned technical problems.

[0005] To achieve the above objectives, the present invention provides the following technical solution: an LLM-based exercise prescription generative recommendation method, comprising the following steps:

[0006] S1: Acquire data and perform preprocessing;

[0007] S2: Construct a knowledge graph based on the preprocessed data from S1;

[0008] S3: Pre-train the LLM model, input the knowledge graph constructed in S2 into the LLM model, perform reinforcement learning optimization, and use the PPO algorithm to optimize the output strategy of the LLM model;

[0009] S4: Based on the optimized LLM model, the exercise prescription is derived through FITT parameters and generated in natural language.

[0010] As a preferred technical solution of the present invention, the acquisition and preprocessing of data in S1 specifically includes: noise removal, processing of missing values, and data standardization;

[0011] The standardized data specifically includes converting exercise intensity and various physiological indicators into Z-score standardized values;

[0012] The missing values ​​for physiological indicators are interpolated using time series interpolation.

[0013] As a preferred embodiment of the present invention, the specific steps for constructing a knowledge graph based on the preprocessed data in S1 in S2 are as follows:

[0014] S2.1: Extract entities from the preprocessed data in S1 using the BERT model;

[0015] S2.2: Identify the explicit relationships in the data preprocessed by S1 using SRL technology, identify the implicit relationships in the data preprocessed by S1 using the TransE model, and construct triples of head entity vector, relation vector, and tail entity vector;

[0016] S2.3: The Neo4j native graph database is used for storage to complete the construction of the knowledge graph;

[0017] When the LLM model calls the knowledge graph, it queries the subgraph through the Neo4j native graph database and calculates the attention weights between nodes in the subgraph using the graph attention mechanism. The specific expression is as follows:

[0018]

[0019]

[0020]

[0021] in, as well as Let be the feature vectors of node i and node j, respectively, and W be the learnable weight matrix. It is the parameter vector of the attention mechanism. express transpose, express, It is the attention weight of node i with respect to node j. This represents the activation function. It is the intermediate value of the attention calculation between nodes i and j. Refers to the set of neighboring nodes of node i. For activation function, It is the feature vector of node i after attention update.

[0022] As a preferred embodiment of the present invention, the specific steps of S3 are as follows:

[0023] S3.1: Pre-train the LLM model using the cross-entropy loss function;

[0024] S3.2: And a knowledge injection mechanism is used to input the knowledge graph into the LLM model;

[0025] S3.3: The LLM model is optimized using the Proximal Policy Optimization (PPO) algorithm, including the state, action, and reward function. The reward function is constructed as follows:

[0026] In-course diversity reward function:

[0027]

[0028] in, This represents the diversity reward function within the course. n and m This indicates two different actions. This indicates the average similarity of the muscles trained by the two exercises. : Represents the weight that decays with the action interval. The weight represents the positional difference between two actions in the sequence, and decreases as the interval increases. This represents the sum of the weights of all action pairs.

[0029] Inter-course diversity reward function:

[0030]

[0031] in, This represents the reward function for diversity among courses. This represents the count of each action in the t-th session. k Indicates the offset of the historical session. This represents the Pearson correlation coefficient. Indicates the number of historical sessions. Indicates weight;

[0032] Fitness level matching reward function:

[0033]

[0034] in, Represents the Gaussian kernel function. This represents a reward function that matches fitness level. Indicates the difficulty level of each exercise. This represents the user's difficulty preference for each exercise, where 'c' represents the index of the action in a single session. Represents the maximum value function. Represents absolute value. Indicates the total number of actions in a single session;

[0035] Fitness goal matching reward function:

[0036]

[0037] in, This represents the reward function that matches fitness goals. For indicator functions, if the action Types and User Goals If they match, the value is 1; otherwise, it is 0.

[0038] Overall reward during the optimization process Specifically, it is a weighted sum of all reward functions. When any reward function is lower than a set threshold, a penalty is triggered. When any penalty exists, the overall reward is negative.

[0039] S3.4: Strategy for optimizing LLM model output using the PPO algorithm.

[0040] As a preferred embodiment of the present invention, step S3.4 specifically includes the following steps:

[0041] S3.4.1: Based on supervised fine-tuning training of the LLM model, a basic prescription conforming to the FITT principle is generated as the initial strategy. ;

[0042] S3.4.2: The LLM model generates prescription sequences in the user simulator and obtains the state-action-reward trajectory, which includes user features, generated actions and corresponding reward values;

[0043] S3.4.3: Maximize the expected cumulative reward by using the policy gradient method, adjust the LLM model parameters θ, and increase the probability of generating high-reward sequences;

[0044] S3.4.4: Repeat steps S3.4.1-S3.4.3 until the strategy is stable.

[0045] Compared with existing technologies, this invention provides an LLM-based method for generating and recommending exercise prescriptions, which has the following advantages:

[0046] 1. This invention integrates multi-source health information by leveraging multimodal LLM; at the same time, it constructs a knowledge graph and achieves interaction with LLM through graph attention mechanism, thereby improving the accuracy, interpretability and credibility of exercise prescriptions.

[0047] 2. This invention forms a standardized user feature dataset through multi-source heterogeneous data preprocessing; and deeply integrates the entity-relationship-enhanced knowledge graph with the optimized LLM model, enabling the model to accurately call professional knowledge and generate structured exercise prescriptions that conform to the FITT principle;

[0048] 3. This invention integrates data from smart wearable devices with environmental perception information to dynamically adjust exercise prescriptions in real time according to changes in the context; at the same time, it uses supervised fine-tuning technology to optimize the generation capability of LLM in different sports scenarios, thereby promoting the upgrading of sports health management.

[0049] 4. This invention generates high-quality, personalized exercise prescriptions by using a Large Language Model (LLM) optimized through reinforcement learning, combined with user characteristics and scenario information. This invention utilizes a multi-dimensional reward function framework to quantify prescription quality and optimize the generation strategy, ensuring that the generated exercise prescriptions are not only scientifically sound but also conform to the user's actual situation and preferences. By generating synthetic data through a user simulator, the generalization ability of the model is enhanced, the cold start problem is alleviated, and the upgrade from static recommendation to dynamic adaptation is achieved, thereby improving the user experience and the level of intelligence in sports and health management. Attached Figure Description

[0050] Figure 1 This is a schematic diagram of the overall framework of the present invention;

[0051] Figure 2 Generate a graph for the exercise prescription. Detailed Implementation

[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0053] Please see Figures 1-2 The LLM-based generative recommendation method for exercise prescriptions includes the following steps:

[0054] S1: Acquire data and perform preprocessing;

[0055] During the data collection phase, this invention will gather data from multiple channels, including academic literature, professional guidelines, smart devices, and social media. Physiological indicators such as heart rate, blood oxygen saturation, and sleep quality will be collected through smart wearable devices. Simultaneously, detailed user information will be obtained through questionnaires. The collected data will cover key information such as exercise type, health status, training parameters, user characteristics, exercise contraindications, precautions, and exercise effects. This data will provide a rich information foundation for this invention. Subsequently, this invention will conduct in-depth analysis of this data to ensure its quality and usability, providing accurate support for subsequent exercise recommendation tasks.

[0056] The collected data undergoes data preprocessing. The purpose of data preprocessing is to convert the raw data into a format suitable for model training, while removing noise, handling missing values, and standardizing the data to improve data quality and the model's generalization ability.

[0057] Missing value handling: Time series interpolation was used for missing values ​​of physiological indicators; LLM was used to generate reasonable inferred values ​​for missing items in the questionnaire.

[0058] Feature standardization: Transform exercise intensity and various physiological indicators into Z-score standardized values ​​to eliminate the influence of dimensions, making the features comparable and facilitating LLM learning.

[0059] Text cleaning and encoding: Remove special characters, punctuation marks, and other interfering information from the text; unify the case of all letters in the text to lowercase to avoid treating the same word as different words with different capitalization. Segment the user feedback text, remove stop words, and convert it into semantic vectors using BERT.

[0060] Missing values ​​were handled by interpolating time series values ​​for physiological indicators.

[0061] S2: Construct a knowledge graph based on the preprocessed data from S1;

[0062] The specific steps for constructing a knowledge graph in S2 based on the preprocessed data from S1 are as follows:

[0063] S2.1: Extract entities from the preprocessed data in S1 using the BERT model;

[0064] In the entity extraction stage, named entity recognition algorithms from Natural Language Processing (NLP) are primarily used to accurately extract entities from semi-structured or unstructured texts such as sports medicine guidelines and academic literature. Named entity recognition algorithms are generally based on machine learning models, such as the BERT model with the Transformer architecture. Taking the BERT model as an example, it uses a multi-layer bidirectional Transformer encoder to capture semantic information in the text, learning a large amount of general language representations of text during the pre-training stage, and then fine-tuning it for sports-related texts. The specific mathematical principle is based on the core formula of the Transformer:

[0065] The formula for multi-head attention is:

[0066]

[0067] in,

[0068]

[0069] Where Q (Query), K (Key), and V (Value) are typically obtained from the input sequence through linear projection and are used to calculate the attention weights. h This indicates the number of heads of attention.

[0070] For single-head attention, 、 、 Indicates the first i The projection matrix is ​​used to map the input to different subspaces. The function calculates the attention weights. Calculate the dot product between the query and all keys to obtain the semantic similarity matrix. For the dimension of Key, Normalization transforms similarity into a probability distribution (attention weights), representing the importance of each position. The values ​​are then weighted according to these weights to obtain the final attention output.

[0071] When processing text related to sports, the model, based on the aforementioned computational mechanism, can accurately identify and extract various entities from the text, such as sports type, individual health status, and training parameters. For example, in the text "50-year-old woman, BMI 28, suffers from mild hypertension, doctor recommends brisk walking 4 times a week for 30 minutes each time, intensity controlled at 50%-60% of maximum heart rate, avoiding strenuous exercise such as rope skipping," the BERT model, in its entity extraction process, uses a multi-head attention mechanism to capture semantic relationships in the text, ultimately extracting the following entities: sports type: brisk walking, rope skipping; individual health: 50-year-old woman, BMI 28, mild hypertension; and training parameters: 4 times a week (frequency), 30 minutes (duration), 50%-60% of maximum heart rate (intensity).

[0072] S2.2: Identify explicit relationships in the data preprocessed by S1 using SRL technology, identify implicit relationships in the data preprocessed by S1 using the TransE model, and construct triples of head entity vector, relation vector, and tail entity vector;

[0073] The relationship definition phase relies on semantic understanding and domain knowledge to construct the associations between entities. This process primarily utilizes Semantic Role Labeling (SRL) technology. SRL analyzes text structure to identify core predicates and binds these predicates to the semantic roles of entities, defining explicit relationships. For example, from the text "Brisk walking is suitable for patients with mild hypertension," the predicate "suitable" is identified, defining "Brisk walking (type of exercise) - suitable population - patients with mild hypertension (health condition)."

[0074] Because text often implicitly contains relationships that are not directly stated, knowledge graph completion algorithms, such as the TransE model, are needed. Based on existing entity and relation data, these algorithms predict and supplement potential entity relationships. Taking the TransE model as an example, its basic idea is to map each entity and relation to a low-dimensional vector and supplement implicit relationships through vector operations. For each triple, the distance function is defined as:

[0075]

[0076] in, , , These represent the head entity vector, relation vector, and tail entity vector, respectively. This represents the L2 norm (Euclidean distance), which measures the distance between the head entity + relation and the tail entity in the vector space. The core logic of this distance function stems from the "translation assumption" of the TransE model, which states that for a reasonable triple (head entity, relation, tail entity), the superposition of the head entity vector and the relation vector should be as close as possible to the tail entity vector in the vector space, and ideally, the distance between them should approach 0.

[0077] Based on this distance function, the model's training objective is to minimize the distance values ​​of all real triples while maximizing the distance values ​​of false triples. During training, the model first initializes all entities and relations with random low-dimensional vectors, and then learns from a large amount of known real triple data. For each real triple, the model continuously adjusts its parameters. , , The vector representation of makes and The distance gradually decreases; however, for artificially constructed spurious triples (such as unreasonable triples formed by randomly replacing the head or tail entity), the model will... and The distance between entities and relationships should be increased as much as possible, so that the model can gradually grasp the potential relationship patterns between entities and relationships.

[0078] After thorough training, the model can make predictions using the learned vector representations when encountering missing relationships in a knowledge graph. For example, given a head entity and a tail entity, if the model wants to find possible relationships between them, it will iterate through all possible relationship vectors. ,calculate and The relationship with the smallest distance is the most likely implicit relationship. If the head entity and relationship are known, and the goal is to predict the tail entity, the model will find the relationship among all entities that minimizes the distance between them. The entity with the smallest distance is the tail entity; similarly, when the tail entity and the relationship are known, the most likely head entity can be found in a similar way.

[0079] For example, in a knowledge graph in the field of sports and health, given the triple "yoga-improvement-flexibility", when the model learns the corresponding vector... (Yoga) (promote), (Body flexibility) will allow vector and The vectors are very close, with the distance approaching 0. If there are a head entity "Pilates" and a tail entity "Body Flexibility," the model will try different relation vectors. When the relation vector "Lift" is input, the calculated result... (Pilates) + (Enhancement) and The distance for (physical flexibility) is significantly smaller than other relationships, thus predicting the implicit relationship of "Pilates-lifting-physical flexibility". This vector-based prediction method allows the TransE model to efficiently complete the entity relationships not explicitly expressed in the knowledge graph, further enriching the relationship network between entities;

[0080] S2.3: The Neo4j native graph database is used for storage to complete the construction of the knowledge graph;

[0081] The graph storage phase utilizes the Neo4j native graph database, which employs an attribute graph model at its core. Extracted entities and relationships are stored within the Neo4j graph database, where each node corresponds to a type of entity, and edges represent relationships between entities. Both nodes and edges can carry attributes, making it more suitable for representing the multidimensional information of knowledge graphs. Neo4j is based on an index-free adjacency mechanism, where adjacent nodes directly refer to each other physically. When performing queries or graph pattern matching, efficient traversal can be completed without additional index jumps, achieving fast entity association retrieval and providing high-performance support for subsequent reasoning and analysis.

[0082] When the LLM needs to access information from the knowledge graph, it first retrieves the subgraph relevant to the current task using the graph database's query function. Then, the graph attention mechanism processes this subgraph—by calculating the attention weights between nodes, it focuses on the core nodes and relationships closely related to the task. When the LLM model calls the knowledge graph, it queries the subgraph using the Neo4j native graph database and calculates the attention weights between nodes in the subgraph using the graph attention mechanism. The specific expression is as follows:

[0083]

[0084]

[0085]

[0086] in, as well as Let be the feature vectors of node i and node j, respectively, and W be the learnable weight matrix. It is the parameter vector of the attention mechanism. express transpose, express, It is the attention weight of node i with respect to node j. This represents the activation function. It is the intermediate value of the attention calculation between nodes i and j. Refers to the set of neighboring nodes of node i. For activation function, It is the feature vector of node i after attention update.

[0087] S3: Pre-train the LLM model, input the knowledge graph constructed in S2 into the LLM model, perform reinforcement learning optimization, and use the PPO algorithm to optimize the output strategy of the LLM model;

[0088] The specific steps for S3 are as follows:

[0089] S3.1: Pre-train the LLM model using the cross-entropy loss function;

[0090] Domain-adaptive pre-training enables the general language model to grasp the knowledge and logic of the sports medicine field. This process utilizes transfer learning technology, on top of the pre-trained weights of the general LLM, and uses sports medicine corpora to continuously carry out training.

[0091] During the training of the sports medicine corpus, the model relies on a self-attention mechanism to capture the relationship between sports terminology and medical logic in the text. Backpropagation is used during training to minimize the loss function, which refers to the cross-entropy loss function.

[0092]

[0093] Where N represents the number of samples and C represents the number of categories. This refers to the true label to which sample i belongs to category j. This refers to the probability that the model predicts sample i belongs to category j. By continuously adjusting the model parameters, LLM can form a deep semantic understanding of the terminology, formulas and rules in the field of sports medicine.

[0094] S3.2: And a knowledge injection mechanism is used to input the knowledge graph into the LLM model;

[0095] The knowledge injection mechanism relies on prompting engineering to integrate entities and relationships in the knowledge graph into the input of the language model, guiding the model to generate more accurate exercise prescriptions. In the specific construction process, user characteristics are first processed in a structured manner, such as collecting information such as the user's age, gender, BMI, medical history, and exercise goals. Then, the knowledge graph is used to retrieve entity relationships corresponding to the user characteristics. For example, a list of contraindicated exercises can be retrieved based on a previous knee injury, and recommended exercise types can be obtained based on weight loss goals.

[0096] This information is input into the LLM in a specific format. During the model inference phase, the LLM uses the language knowledge learned through pre-training and the sports medicine knowledge adapted to the domain, combined with the conditions in the prompts, to generate exercise prescriptions through the decoding process of the generative model. The decoding process generally uses algorithms such as greedy search and bundle search. Taking bundle search as an example, when generating tokens at each step, the k candidates with the highest probabilities are retained. By comparing the probability products of the subsequently generated sequences, the sequence with the best overall probability is selected as the output. The formula can be expressed as:

[0097]

[0098] in, This refers to the optimal sequence generated. This represents the set of candidate sequences under the constraint of beam width k, where T represents the sequence length. For generating sequences based on history And input prompts to generate the current token. The probability of;

[0099] S3.3: The LLM model is optimized using the Proximal Policy Optimization (PPO) algorithm. Reinforcement learning optimization aims to construct a dynamic decision-making framework that allows the LLM to balance exercise science principles with personalized user needs when generating exercise prescriptions. It iterative optimization of the generated strategy through reward signals ultimately improves the applicability of the prescriptions and user satisfaction. Its core logic treats the LLM as an intelligent agent, using the generated exercise prescription sequence as the decision-making action, and the user's state and scene information as the environment. Continuous optimization of the policy, including state, action, and reward function, is achieved through reinforcement learning algorithms.

[0100] The State design is as follows:

[0101] The state contains all the information that the LLM needs to perceive when generating prescriptions, providing a basis for policy decisions, specifically including:

[0102] User characteristics: age, gender, BMI, health status (e.g., hypertension, joint injury), fitness level (assessed based on questionnaires or historical data), exercise goals (weight loss, rehabilitation, muscle gain, etc.);

[0103] Session status: generated training units (such as preceding action type, intensity, and duration), muscle fatigue level in the current training phase (inferred based on the "movement type-recovery threshold" relationship in the knowledge graph), and content of historical L prescriptions (to ensure diversity between courses).

[0104] Scenario constraints: available time, environmental conditions (weather, venue), equipment availability (e.g., whether there is a yoga mat, dumbbells, etc.);

[0105] User feedback: completion rate of historical prescriptions, preferred action types, and avoided actions (such as high-intensity exercise that the user explicitly refuses).

[0106] The Action space is as follows

[0107] The action is defined as the next training unit generated by the LLM in the current state, and is a key step in sequence decision-making, specifically including:

[0108] Action type: Based on the "movement type" entity in the knowledge graph, such as brisk walking, yoga, push-ups, etc.;

[0109] Exercise parameters: intensity (such as heart rate zone, weight), duration, sets / repetitions (for strength training), must comply with the constraints of "frequency, intensity, time, type" in the FITT principles;

[0110] Sequence attributes: logical connection with preceding actions (e.g., warm-up → main training → relaxation sequence), and difficulty progression (e.g., transition from beginner to intermediate level actions).

[0111] The reward function is constructed as follows:

[0112] The in-course diversity reward function measures the diversity of recommended exercises within a training session. It calculates the similarity between two exercises by comparing the muscles worked by each movement. The underlying assumption is that training sessions should offer sufficient diversity so that users can work multiple muscle groups without becoming bored by repetition.

[0113]

[0114] Here, p is a penalty factor; if the same action is repeated continuously, p is -1. This represents the diversity reward function within the course. n and m This indicates two different actions. This indicates the average similarity of the muscles trained by the two exercises. : Represents the weight that decays with the action interval. The weight represents the positional difference between two actions in the sequence, and decreases as the interval increases. This represents the sum of the weights of all action pairs.

[0115] The inter-training diversity reward function measures the difference between the recommended workout for the current training day and the recommended workouts for the previous L training days. As above, it assumes that users should perform a variety of workouts over a series of training days to allow their muscles sufficient rest between workouts.

[0116]

[0117] in, This represents the reward function for diversity among courses. This represents the count of each action in the t-th session. k Indicates the offset of the historical session. This represents the Pearson correlation coefficient. Indicates the number of historical sessions. This represents a weight, which decreases as session j progresses.

[0118] The fitness level matching reward function measures how well a given set of exercises matches a user's fitness level. This is measured by evaluating the difficulty (idiff) of each exercise and the user's difficulty preference (udiff), assuming they should be relatively close. This avoids recommending exercises that are too easy or too difficult, while allowing users to try more challenging exercises as their fitness level improves.

[0119]

[0120] in, Represents the Gaussian kernel function. This represents a reward function that matches fitness level. Indicates the difficulty level of each exercise. This represents the user's difficulty preference for each exercise, where 'c' represents the index of the action in a single session. Represents the maximum value function. Representing the absolute value, `rescale` is a Gaussian kernel function (scaling to the range [0,1]). It uses a normal distribution to rescale the scores based on the mean and standard deviation to ensure that the exercise difficulty is close to the user's fitness level, while still allowing for some variability. Indicates the total number of actions in a single session;

[0121] A fitness goal matching reward function measures how well the workout activities in a session align with the user's workout goals (aerobic or strength).

[0122]

[0123] It shows how close the percentage of aerobic / strength training in the training course is to the target value (i.e., 62.5% of the user-set goal). This represents the reward function that matches fitness goals. For indicator functions, if the action Types and User Goals If they match, the value is 1; otherwise, it is 0.

[0124] Targeted muscle group matching: Based on the "action-muscle group" relationship in the knowledge graph, the training percentage of user-specified key / minor muscle groups in the prescription is calculated. The higher the percentage, the higher the reward.

[0125] Overall reward during the optimization process Specifically, it is a weighted sum of all reward functions. When any reward function is lower than a set threshold, a penalty is triggered. When any penalty exists, the overall reward is negative.

[0126] S3.4: The strategy for optimizing the LLM model output using the PPO algorithm includes the following steps:

[0127] S3.4.1: Based on supervised fine-tuning training of the LLM model, a basic prescription conforming to the FITT principle is generated as the initial strategy. ;

[0128] S3.4.2: The LLM model generates prescription sequences in the user simulator and obtains the state-action-reward trajectory, which includes user features, generated actions and corresponding reward values;

[0129] S3.4.3: Maximize the expected cumulative reward by using the policy gradient method, adjust the LLM model parameters θ, and increase the probability of generating high-reward sequences;

[0130] The role of the user simulator

[0131] Due to the limited availability of real user feedback data, training relies on synthetic data generated by user simulators.

[0132] The simulator generates virtual users based on probability distribution, assigning them random characteristics (age, physical fitness), goals (such as "low-intensity aerobic exercise 3 times a week") and preferences (such as avoiding jumping movements).

[0133] For prescriptions generated by LLM, the simulator outputs feedback according to preset rules (such as "too difficult, marked as incomplete"), simulating real user behavior;

[0134] Large-scale training using simulators enables LLM to generalize in real-world scenarios, alleviating the cold start problem.

[0135] Through reinforcement learning optimization, LLM can dynamically adjust the prescription generation strategy, and can still generate personalized exercise prescriptions that conform to sports science and meet user needs in data-sparse scenarios, achieving an upgrade from "static recommendation" to "dynamic adaptation".

[0136] S3.4.4: Repeat steps S3.4.1-S3.4.3 until the strategy is stable;

[0137] S4: Based on the optimized LLM model, the exercise prescription is derived through FITT parameters and generated in natural language.

[0138] By integrating multi-dimensional features through user state modeling, deriving parameters based on the FITT principle, and generating natural language text, user needs and professional knowledge are transformed into personalized exercise prescriptions.

[0139] S4.1 User State Modeling

[0140] User state modeling is used to comprehensively and accurately depict user characteristics, thereby providing a basis for dynamic exercise prescription generation. It mainly includes two parts: user profile construction and semantic encoding conversion.

[0141] When constructing a user profile vector, data fusion technology is used to integrate multi-dimensional information. After preprocessing, various data such as health indicators, exercise goals, preferences, and historical prescription feedback are transformed into numerical features using feature engineering methods. For example, if the exercise goal is weight loss, it is encoded as a specific value; the type of exercise in the preferences is represented using one-hot encoding. These features are then concatenated into a complete user profile vector, achieving a quantitative description of the user's state.

[0142] When transforming user profile vectors into semantic codes, the LLM leverages all its natural language understanding capabilities. Using user profile vectors as input, the model uses a self-attention mechanism to capture the semantic relationships between various features, transforming the numerical user profile into a high-dimensional semantic code. This semantic code contains deep semantic information about the user's state, which is used as a key input for subsequent prescription generation, thereby guiding the model to generate exercise prescriptions that meet the user's needs.

[0143] S4.2: Derivation of FITT Parameters

[0144] FITT parameter derivation, as a key component in generating personalized exercise prescriptions, involves parameter calculation and decision-making based on user semantic encoding and a knowledge graph constructed through retrieval.

[0145] Frequency: Based on the relationship between "exercise type - recovery period" in the knowledge graph (e.g., "brisk walking - recovery period - 24 hours"), this invention dynamically adjusts exercise frequency by combining user goals and personal constraints. Specifically, this solution determines the frequency to be four times a week, scheduled on Mondays, Wednesdays, Fridays, and Sundays, ensuring that the interval between two exercise sessions is at least 24 hours. This aligns with the recovery threshold attribute of "brisk walking" exercise in the knowledge graph (i.e., a 24-hour recovery period is required after each exercise session). For example, after exercising on Monday, the interval between exercises on Wednesday is approximately 48 hours, and the intervals between exercises on Friday and Sunday are also greater than 24 hours. This optimizes the recovery period and avoids overtraining while meeting weight loss and health goals.

[0146] Intensity: Based on the "health status - intensity limit" relationship of a knowledge graph, multi-dimensional adjustments are superimposed. Maximum heart rate is calculated by combining the user's age with the formula: HRmax = 220 - age. A baseline upper and lower limit is determined through retrieval, forming a safe intensity range. For example, a 50-year-old user with mild hypertension and a BMI of 28 has a maximum heart rate of 170 beats / minute. The upper limit for intensity for mild hypertension is 60% of HRmax (102 beats / minute). After a 10% reduction for overweight (BMI=28), the lower limit is 92 beats / minute (54% of HRmax), resulting in an intensity range of 92-102 beats / minute.

[0147] Time: Integrating the knowledge graph's "exercise type - duration benchmark" with user time constraints: Searching for "brisk walking - recommended duration" → 30-60 minutes; combined with the user's input of "30 minutes of exercise per session", through the "time-intensity-goal" three-dimensional model (based on the rule of "cumulative load effect = intensity × time"), it is broken down into "5 minutes of warm-up + 20 minutes of main training + 5 minutes of cool-down", ensuring that the effective exercise duration of a single session is ≥20 minutes (meeting the "low-intensity aerobic threshold" attribute).

[0148] Type: A triple dynamic filtering mechanism based on knowledge graphs:

[0149] 1. Contraindication Exclusion: Exclude high-risk sports types based on health conditions.

[0150] 2. Health Fit: Search for suitable exercise types.

[0151] 3. Personalized Optimization: Combining user preference weights and specific needs, suitable exercise types are recommended first. For example, swimming is recommended first for users with joint stress requirements, with brisk walking as an alternative.

[0152] S4.3: Natural Language Generation

[0153] In the natural language generation stage, the large language model transforms the structured FITT parameters into easily understood natural language prescriptions. Relying on the language generation capabilities learned during domain-adaptive pre-training, and combining this with the input FITT parameters, the large language model uses the decoding algorithm of a generative model to generate natural language text character by character. The formula is as follows:

[0154]

[0155] In this context This represents the final generated optimal natural language sequence, which is actually the complete exercise prescription text that this invention aims to achieve. argmax It means to find the parameter that will make the following expression reach its maximum value. It represents the set of all possible natural language output sequences, while It is a set A specific output sequence, where T represents the length of the generated natural language sequence. It is a conditional probability, meaning that given the previous t-1 tokens have already been generated and the FITT parameter is given, the token at the current position t will be generated. The probability of.

[0156] Through reinforcement learning optimization, the model considers multiple sub-objectives when generating prescriptions, such as intra-course diversity, inter-course diversity, fitness level matching, fitness goal matching, and key body part matching, to ensure that the generated prescriptions not only meet user needs but also have high quality and applicability.

[0157] During the generation process, the model automatically supplements relevant information based on the knowledge graph and user status. It also provides additional tips or adjustment suggestions for specific sports types or user groups, ultimately outputting a complete, detailed, and personalized exercise prescription. For example, for swimming, LLM might automatically add "Pay attention to the pool water temperature to avoid blood pressure fluctuations caused by excessive cold."

[0158] (1) Reinforcement learning optimization

[0159] This invention designs a rule-based multi-dimensional reward function framework. By decomposing exercise science principles and user preferences, it constructs five core indicators: intra-course diversity, inter-course diversity, fitness level matching, goal matching, and key body part matching. It also introduces a threshold activation mechanism (a negative reward is triggered when any indicator falls below the threshold) and weight allocation (e.g., intra-course diversity weight 0.3 > inter-course diversity weight 0.1). In open-domain scenarios where only periodic delayed feedback is obtained, exercise science rules are transformed into computable personalized reward signals, enabling data-driven continuous optimization of prescriptions and breaking through the high-cost bottleneck of traditional reinforcement learning in the field of sports and health.

[0160] (2) Generative recommendation

[0161] This invention uses a large language model based on the Transformer architecture as its core. Through a sports domain corpus dataset and combining data augmentation and transfer learning, the LLM (Language Model) accurately understands the semantics of sports and health. During interaction, a bidirectional attention mechanism is employed, allowing the model to identify key requirements and analyze underlying factors using a knowledge graph, dynamically adjusting response strategies. Finally, leveraging the LLM's generative capabilities, semantic understanding is transformed into personalized exercise prescriptions, achieving end-to-end generation from natural language requirements to personalized prescriptions. This breaks through the limitations of traditional interaction methods and enhances user experience.

[0162] (3) Explainable innovation

[0163] This invention utilizes knowledge graphs and generative large language models to provide users with personalized exercise prescriptions, clearly explaining the underlying medical logic and decision-making basis. By visually demonstrating the correlation between health indicators and exercise recommendations, or dynamically generating reasoning explanations, it helps users understand the recommended exercise types and intensities, thereby improving users' understanding, trust, and adherence to the prescriptions.

[0164] This invention deeply integrates large language models with knowledge graph technology to build a flexible and accurate personalized sports and health management system. In practical applications, this system can generate highly suitable exercise prescriptions based on the unique physiological characteristics, daily life scenarios, and health goals of different groups of people.

[0165] Taking students as an example, students often face heavy academic pressure and fragmented time. The system collects students' daily activity data, such as steps and exercise duration, using various devices like smart bracelets and mobile apps. It also combines this data with information from school health check reports, such as height, weight, and vision, as well as students' feedback on academic stress levels from questionnaires. In the knowledge graph, this data is linked to relevant medical logic. Based on this, the large language model generates exercise prescriptions according to the FITT principle. For example, it might schedule simple neck stretches and shoulder circles during 10-minute breaks between classes, and 30 minutes of aerobic exercise such as rope skipping and jumping jacks after school. This makes full use of fragmented time, relieves academic pressure, and promotes physical development.

[0166] Most office workers spend long hours sitting, which can easily lead to lower back and neck pain, as well as decreased physical fitness. This system utilizes sedentary monitoring plugins on office computers and various devices such as smartwatches to collect data on sedentary time, heart rate variability, and other relevant information, combined with physical indicators obtained from pre-employment medical examinations and self-assessments of work stress. Based on this data, relevant knowledge in a knowledge graph is activated, and the LLM (Lifecycle Management) system generates exercise prescriptions. For example, every 1 to 2 hours of work, perform 5 to 10 minutes of lumbar twisting and standing stretching exercises, and after get off work, engage in 30 to 60 minutes of jogging, yoga, or strength training. This helps office workers effectively prevent physical injuries caused by prolonged sitting and relieve work stress.

[0167] Chronic disease management is crucial for the elderly. By integrating the health checkup data (blood pressure, blood sugar, blood lipids, etc.) from community health checkup centers, and combining it with real-time data uploaded from home health monitoring devices, as well as feedback on the elderly's daily activities, the professional logic in the knowledge graph begins to play a role. LLM generates exercise prescriptions tailored to the elderly's physical condition, such as practicing Tai Chi or Baduanjin for 30 to 45 minutes every morning or evening, and arranging short walks 2 to 3 times a week. During the exercise, the system will also use smart devices to remind the elderly to adjust the exercise pace based on real-time physiological data, thereby ensuring exercise safety and chronic disease control.

[0168] For special groups such as pregnant women, the system collects fetal development data from prenatal checkup reports and various physical indicators of the pregnant woman. Combined with the pregnant woman's assessment of her daily activities, the knowledge graph links relevant information, and LLM generates customized exercise prescriptions. For example, simple walking and introductory prenatal yoga poses are arranged in early pregnancy, while pelvic floor muscle training is added in mid-pregnancy. Detailed instructions are provided for each movement to ensure the safety of both the pregnant woman and the fetus. For post-operative recoveries, the system, based on the type of surgery, recovery stage, and physical recovery data, links content from the knowledge graph to generate rehabilitation exercise prescriptions from LLM. These prescriptions begin with simple limb activities in the early post-operative period, gradually transitioning to strength training and functional training in later stages to promote the recovery of bodily functions.

[0169] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A generative recommendation method for exercise prescriptions based on LLM, characterized in that: Includes the following steps: S1: Acquire data and perform preprocessing; S2: Construct a knowledge graph based on the preprocessed data from S1; S3: Pre-train the LLM model, input the knowledge graph constructed in S2 into the LLM model, perform reinforcement learning optimization, and use the PPO algorithm to optimize the output strategy of the LLM model; The specific steps of S3 are as follows: S3.1: Pre-train the LLM model using the cross-entropy loss function; S3.2: And a knowledge injection mechanism is used to input the knowledge graph into the LLM model; S3.3: The LLM model is optimized using the proximal policy optimization algorithm, including the state, action, and reward function. The reward function is constructed as follows: In-course diversity reward function: ; in, This represents the diversity reward function within the course, where n and m represent two different actions. This indicates the average similarity of the muscles trained by the two exercises. : Represents the weight that decays with the action interval. The weight represents the positional difference between two actions in the sequence, and decreases as the interval increases. This represents the sum of the weights of all action pairs; Inter-course diversity reward function: ; in, This represents the reward function for diversity among courses. This represents the count of each action in the t-th session, and k represents the offset of the historical session. This represents the Pearson correlation coefficient. Indicates the number of historical sessions. Indicates weight; Fitness level matching reward function: ; in, Represents the Gaussian kernel function. This represents a reward function that matches fitness level. Indicates the difficulty level of each exercise. This represents the user's difficulty preference for each exercise, where 'c' represents the index of the action in a single session. Represents the maximum value function. Represents absolute value. Indicates the total number of actions in a single session; Fitness goal matching reward function: ; in, This represents the reward function that matches fitness goals. For indicator functions, if the action Types and User Goals If they match, the value is 1; otherwise, it is 0. Overall reward during the optimization process Specifically, it is a weighted sum of all reward functions. When any reward function is lower than a set threshold, a penalty is triggered. When any penalty exists, the overall reward is negative. S3.4: Strategy for optimizing LLM model output using the PPO algorithm; S4: Based on the optimized LLM model, the exercise prescription is derived through FITT parameters and generated in natural language.

2. The LLM-based exercise prescription generation and recommendation method according to claim 1, characterized in that: The data acquisition and preprocessing in S1 specifically includes: noise removal, handling missing values, and data standardization. The standardized data specifically includes converting exercise intensity and various physiological indicators into Z-score standardized values; The missing values ​​for physiological indicators are interpolated using time series interpolation.

3. The LLM-based exercise prescription generation and recommendation method according to claim 2, characterized in that: The specific steps for constructing the knowledge graph in S2 based on the preprocessed data from S1 are as follows: S2.1: Extract entities from the preprocessed data in S1 using the BERT model; S2.2: Identify explicit relations in the data preprocessed by S1 using SRL technology, identify implicit relations in the data preprocessed by S1 using the TransE model, and construct triples of head entity vector, relation vector, and tail entity vector. S2.3: The Neo4j native graph database is used for storage to complete the construction of the knowledge graph; When the LLM model calls the knowledge graph, it queries the subgraph through the Neo4j native graph database and calculates the attention weights between nodes in the subgraph using the graph attention mechanism. The specific expression is as follows: ; ; ; in, as well as Let be the feature vectors of node i and node j, respectively, and W be the learnable weight matrix. It is the parameter vector of the attention mechanism. express transpose, It is the attention weight of node i with respect to node j. This represents the activation function. It is the intermediate value of the attention calculation between nodes i and j. Refers to the set of neighboring nodes of node i. For activation function, It is the feature vector of node i after attention update.

4. The LLM-based exercise prescription generation and recommendation method according to claim 1, characterized in that: S3.4 specifically includes the following steps: S3.4.1: Based on supervised fine-tuning training of the LLM model, a basic prescription conforming to the FITT principle is generated as the initial strategy. ; S3.4.2: The LLM model generates prescription sequences in the user simulator and obtains the state-action-reward trajectory, which includes user features, generated actions and corresponding reward values; S3.4.3: Maximize the expected cumulative reward by using the policy gradient method, adjust the LLM model parameters θ, and increase the probability of generating high-reward sequences; S3.4.4: Repeat steps S3.4.1-S3.4.3 until the strategy is stable.

Citation Information

Patent Citations

  • Exercise prescription generation method and device, storage medium and electronic equipment

    CN114974508A