A sleep-aiding strategy recommendation method and system based on multi-source sleep data

CN122889272APending Publication Date: 2026-10-09SHANGHAI CHUANGSHENGJI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611129415.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0002]现有睡眠管理类App或设备通常能够记录用户睡眠时长、睡眠评分、心率、呼吸、体动等基础数据,但多停留在数据展示或单一维度分析层面

Benefits of technology

本发明提供一种基于多源睡眠数据的助眠策略推荐方法及系统,同时采集穿戴设备的生理时序数据、主机设备的环境时序数据和用户主观输入数据,并提取四大微观时序特征算子构造特征矩阵,实现了从“单一维度数据展示”到“多维度睡眠行为数学建模”的技术跨越。长期趋势画像标签的引入进一步融合了用户中长期睡眠行为模式,提升了识别的个性化精准度。通过权重调节矩阵将细粒度行为标签与长期画像标签融合,激活对应的睡眠障碍域通道,实现了“先路由分流,后精准泛化”的精准域分类。通过负向拦截(情节记忆检索)将历史失败干预转化为硬性约束规则,在输入端彻底阻断大模型下发不安全控制指令的可能性;通过正向增强(路由标签约束的RAG检索与深度Rerank)确保召回的知识切片具有高度医学相关性。两者协同作用,为步骤S6的大语言模型策略生成提供了“安全边界清晰、事实依据充分”的输入。云端完成大语言模型的多轮自反思推理,在端侧通过本地事件驱动状态机执行结构化SOP指令流,整个执行过程无需云端实时参与,彻底杜绝了网络抖动带来的声音卡顿或灯光闪烁。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122889272A_ABST
    Figure CN122889272A_ABST
Patent Text Reader

Abstract

The application provides a sleep-aiding strategy recommendation method and system based on multi-source sleep data. It belongs to the field of sleep-aiding. The method includes time axis alignment and denoising processing of collected data, construction of a time series feature matrix, and generation of a long-term trend portrait label. The time series feature matrix is input into a sleep behavior recognition model to output a set of fine-grained behavior pattern labels. According to the set of fine-grained behavior pattern labels and the long-term trend portrait label, the routing score of each sleep disorder domain is calculated and the corresponding sleep disorder domain channel is activated. According to the activated sleep disorder domain channel and the long-term trend portrait label, negative constraint rules are generated. According to the sleep disorder domain channel and the set of fine-grained behavior pattern labels, the corresponding knowledge slices are recalled. According to the negative constraint rules, the recalled knowledge slices, and the set of fine-grained behavior pattern labels and the long-term trend portrait label, an intervention strategy is generated through a large language model. It can give more accurate sleep-aiding strategies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of sleep aids, and more specifically, to a method and system for recommending sleep aid strategies based on multi-source sleep data. Background Technology

[0002] Existing sleep management apps and devices typically record basic data such as sleep duration, sleep score, heart rate, respiration, and body movement, but they mostly remain at the level of data display or single-dimensional analysis. Some products can provide sleep suggestions, but they usually lack execution linkage with physical sleep aid devices, making it difficult to transform analysis results into actionable sleep intervention strategies. Existing technologies mainly suffer from the following problems: data sources are singular; sleep analysis results are primarily used for display and cannot be effectively transformed into actionable intervention strategies on the device; sleep scores and suggestions lack personalized analysis based on different users' long-term behavioral patterns; and a closed loop is not formed between user sleep behavior, environmental disturbances, and device execution records. Therefore, a method is needed that can integrate multi-source sleep data, analyze user sleep behavior, and transform the analysis results into sleep aid strategy recommendations and device execution feedback. Summary of the Invention

[0003] The purpose of this application is to provide a method and system for recommending sleep-aid strategies based on multi-source sleep data, which can provide more accurate sleep-aid strategies.

[0004] This application is implemented as follows: Firstly, this application provides a method for recommending sleep-aid strategies based on multi-source sleep data, including: S1: Collect multi-source multimodal sleep data, which includes user physiological time-series data collected by wearable devices, environmental time-series data collected by host devices, and user subjective input data; S2: Perform timeline alignment and noise reduction on user physiological time series data and environmental time series data, extract time series feature parameters respectively, construct time series feature matrix, and generate long-term trend profile labels based on time series feature matrix; S3: Input the temporal feature matrix into the sleep behavior recognition model based on a one-dimensional convolutional bidirectional long short-term memory network, and output a set of fine-grained behavior pattern labels through the sleep behavior recognition model; S4: Based on the set of fine-grained behavioral pattern tags and long-term trend profile tags, calculate the routing score of each sleep disorder domain through the weight adjustment matrix, and activate the corresponding sleep disorder domain channel according to the routing score; S5: Based on the activated sleep disorder domain channel and long-term trend profile tags, retrieve the corresponding failed memory candidate subset in the episode memory bank, extract the extreme values ​​of physical intervention parameters in the failed cases, and generate negative constraint rules; at the same time, based on the sleep disorder domain channel and fine-grained behavior pattern tag set, retrieve and recall the corresponding knowledge slices in the medical knowledge base. S6: Based on negative constraint rules, recalled knowledge slices, fine-grained behavioral pattern label sets, and long-term trend profile labels, an intervention strategy is generated through a large language model; S7: Convert the intervention strategy into a structured control command stream and send it to the end device for execution.

[0005] Based on the first aspect, the time-series characteristic parameters include the dynamic baseline mean. Time series dispersion variation variance Instantaneous trend slope k and directional step size difference For any type of time-series data sequence , The time window length is x1 to For each data point in the time series data sequence: The dynamic baseline mean μ is calculated according to the following formula: ; in, The time window length, This refers to the i-th data point in the time-series data sequence; Temporal Discreteness Variation Variance Calculate according to the following formula: ; The instantaneous trend slope k is calculated using the least squares method according to the following formula: ; in, This refers to the i-th time point in the timeline sequence; Directional step size difference Calculate according to the following formula: ; in, It is a first-order difference. For a sign function, when When the value is 1, The value is -1 when The value is 0 at that time.

[0006] Based on the first aspect, the sleep behavior recognition model based on a one-dimensional convolutional bidirectional long short-term memory network in step S3 includes a one-dimensional convolutional layer, a bidirectional long short-term memory layer, and a fully connected layer; the one-dimensional convolutional layer is used to extract the spatial transient features of time series data, the bidirectional long short-term memory layer is used to capture the bidirectional evolutionary dependence of time series data, and the fully connected layer uses the Sigmoid activation function to output the confidence probability of each behavior label in parallel.

[0007] Based on the first aspect, the sleep disorder domain in step S4 includes the psychological anxiety domain, the circadian rhythm domain, the environmental physical stimulus domain, and the high-risk respiratory and blood oxygenation domain; the routing score is calculated according to the following formula: ; in, For the routing score of the j-th sleep disorder domain, For the Sigmoid mapping function, Let be the contribution coefficient of the i-th microbehavioral label to the j-th sleep disorder domain. Let be the confidence probability of the i-th behavior label. This is a bias term.

[0008] Based on the first aspect, step S5, retrieving the corresponding failed memory candidate subset in the episodic memory bank, includes: concatenating the fine-grained behavioral pattern label set, the sleep profile feature matrix, and the subjective psychological anxiety level into a query vector, and calculating the temperature coefficient-calibrated cosine similarity in the episodic memory bank according to the following formula: ; in, For query vector, For historical failure intervention vectors, For temperature hyperparameters, This is a candidate subset of failed memories.

[0009] Based on the first aspect, step S5, which involves retrieving and recalling the corresponding knowledge slices in the medical knowledge base, includes: pre-filtering the medical knowledge base according to the activated sleep disorder domain channel; recalling candidate knowledge slices in the pre-filtered knowledge base partitions using a dual-path parallel approach of sparse retrieval and dense vector retrieval; and scoring the confidence of the recalled candidate knowledge slices using a deep reordering model based on a cross-attention mechanism, selecting the knowledge slices with the highest confidence scores as the recalled knowledge slices.

[0010] Based on the first aspect, the intervention strategy generated by the large language model in step S6 includes: using negative constraint rules as hard boundary constraints, recalling knowledge slices as factual basis, and injecting fine-grained behavioral pattern label sets and long-term trend profile labels as user state context into the prompt word space of the large language model, and generating the intervention strategy through multi-round self-reflective reasoning of the large language model.

[0011] Based on the first aspect, the structured control command flow in step S7 includes acoustic control parameters, lighting control parameters, and aromatherapy control parameters for multiple stages.

[0012] Secondly, this application provides a sleep aid strategy recommendation system based on multi-source sleep data, including: The data acquisition module is used to collect multi-source multimodal sleep data, which includes user physiological time-series data collected by wearable devices, environmental time-series data collected by host devices, and user subjective input data. The feature extraction module is used to perform time axis alignment and noise reduction on user physiological time series data and environmental time series data, extract time series feature parameters respectively, construct time series feature matrix, and generate long-term trend profile labels based on the time series feature matrix; The behavior recognition module is used to input the temporal feature matrix into the sleep behavior recognition model based on a one-dimensional convolutional bidirectional long short-term memory network, and output a set of fine-grained behavior pattern labels through the sleep behavior recognition model. The routing activation module is used to calculate the routing score of each sleep disorder domain based on the set of fine-grained behavioral pattern tags and long-term trend profile tags through a weight adjustment matrix, and activate the corresponding sleep disorder domain channel according to the routing score. The knowledge retrieval module is used to retrieve the corresponding failed memory candidate subset in the episode memory bank based on the activated sleep disorder domain channel and long-term trend profile tags, extract the extreme values ​​of physical intervention parameters in failed cases, and generate negative constraint rules; at the same time, it retrieves and recalls the corresponding knowledge slices in the medical knowledge base based on the sleep disorder domain channel and fine-grained behavior pattern tag set. The strategy generation module is used to generate intervention strategies through a large language model based on negative constraint rules, recalled knowledge slices, fine-grained behavioral pattern label sets, and long-term trend profile labels. The instruction delivery module is used to convert intervention strategies into a structured control instruction stream and send it to the end-side device for execution.

[0013] Thirdly, this application provides an electronic device, comprising: Memory, used to store one or more programs; processor; The above method is implemented when one or more programs are executed by the processor.

[0014] Compared with the prior art, this application has at least the following advantages or beneficial effects: This invention provides a method and system for recommending sleep-aid strategies based on multi-source sleep data. It simultaneously collects physiological time-series data from wearable devices, environmental time-series data from host devices, and user subjective input data, and extracts four micro-time-series feature operators to construct a feature matrix, achieving a technological leap from "single-dimensional data display" to "multi-dimensional mathematical modeling of sleep behavior." The introduction of long-term trend profile tags further integrates users' medium- and long-term sleep behavior patterns, improving the personalized accuracy of identification. By fusing fine-grained behavioral tags with long-term profile tags through a weight adjustment matrix, the corresponding sleep disorder domain channels are activated, achieving precise domain classification through "first routing and then precise generalization." Negative interception (episode memory retrieval) transforms historical failed interventions into hard constraint rules, completely blocking the possibility of the large model issuing unsafe control commands at the input end; positive reinforcement (RAG retrieval and deep reranking based on routing tag constraints) ensures that the recalled knowledge slices have high medical relevance. The synergistic effect of these two methods provides input with "clear safety boundaries and sufficient factual basis" for the generation of the large language model strategy in step S6. The cloud completes multi-round self-reflective reasoning of the large language model, and the device executes the structured SOP instruction stream through a local event-driven state machine. The entire execution process does not require real-time cloud intervention, completely eliminating sound stuttering or light flickering caused by network jitter. Attached Figure Description

[0015] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a flowchart of an embodiment of a sleep aid strategy recommendation method based on multi-source sleep data according to this application; Figure 2 This is a schematic diagram of an embodiment of a sleep aid strategy recommendation system based on multi-source sleep data according to this application; Figure 3 This is a schematic diagram of the structure of an embodiment of an electronic device according to this application.

[0017] icon: 1. Data acquisition module; 2. Feature extraction module; 3. Behavior recognition module; 4. Route activation module; 5. Knowledge retrieval module; 6. Strategy generation module; 7. Instruction issuance module; 8. Processor; 9. Memory; 10. Communication interface. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0019] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the various embodiments and features described below can be combined with each other. Example

[0020] This application provides a method and system for recommending sleep-aid strategies based on multi-source sleep data, which can provide more accurate sleep-aid strategies.

[0021] Please refer to Figure 1 This application provides a method for recommending sleep-aid strategies based on multi-source sleep data, including: S1: Collect multi-source multimodal sleep data, which includes user physiological time-series data collected by wearable devices, environmental time-series data collected by host devices, and user subjective input data; Specifically, when a user gets into bed to prepare for sleep, the system initiates the data collection process. Wearable devices (smart bracelets) connect via Bluetooth and collect the following physiological data in real time at their respective hardware sampling rates: Heart rate time series The photoplethysmography (PPG) sensor continuously collects the user's heart rate at a sampling frequency of 1 Hz, with the unit being bpm (beats per minute).

[0022] Cardiac cycle time sequence The wearable device outputs the RR interval of continuous heartbeats in real time, in milliseconds (ms).

[0023] Respiratory waveform time series data The accelerometer or chest strap sensor of the wearable device collects the amplitude of respiratory fluctuations.

[0024] Triaxial dynamic acceleration amplitude sequence The accelerometer collects the combined amplitude values ​​along the X, Y, and Z axes.

[0025] Transcutaneous oxygen saturation time series Infrared optical sensor collects blood oxygen concentration percentage.

[0026] Simultaneously, the sensors built into the host device collect environmental data: Environmental audio decibel timing sequence A high-sensitivity microphone array captures the sound pressure level of indoor ambient noise in real time during nighttime.

[0027] Real-time indoor ambient temperature values The temperature sensor collects real-time temperature (°C).

[0028] Real-time indoor humidity values The humidity-sensitive capacitive sensor collects real-time relative humidity (%).

[0029] Real-time ambient light intensity values Digital light intensity sensor collects indoor low light intensity (Lux).

[0030] Users can set their subjective level of anxiety by sliding a slider on a mobile app before going to sleep. (Higher anxiety levels), and aromatherapy preference factors were set. Sound preference factor Lighting preference factor .

[0031] This step completes the synchronous streaming acquisition of three-dimensional data: "wearable device physiological data acquisition + host environmental perception + user subjective input," providing complete raw data input for the downstream step S2. By simultaneously acquiring human vital signs (heart rate, respiration, body movement, etc.) and environmental parameters (noise, temperature, humidity, light, etc.), it achieves simultaneous monitoring of human sleep state and sleep environment—user vital signs represent the sleep onset process, environmental parameters represent sleep conditions, and the two together constitute a complete basis for judging sleep behavior.

[0032] S2: Perform timeline alignment and noise reduction on user physiological time series data and environmental time series data, extract time series feature parameters respectively, construct time series feature matrix, and generate long-term trend profile labels based on time series feature matrix; Specifically, after receiving the heterogeneous multi-source basic data stream collected in step S1, full-time axis alignment is performed based on the hardware standard clock source. A timestamp filter is used to identify and remove abnormal flying points caused by Bluetooth disconnections, Wi-Fi network jitter, or momentary sensor contact problems, ensuring the accuracy of subsequent data analysis. Using a dynamic sliding window of 300 seconds prior to the current moment, non-linear sequence normalization is performed on the denoised valid data to eliminate individual differences in user baseline resting heart rate (e.g., the baseline difference between a user with a resting heart rate of 70 bpm and a user with a resting heart rate of 60 bpm). The heart rate time series sequence is then used for further analysis. For example, the four core time series feature parameters are calculated according to the following formula: dynamic baseline mean (Reflecting the current average heart rate): ; in, The time window length, This refers to the i-th data point in the time-series data sequence; Temporal Discreteness Variation Variance (Reflecting the degree of heart rate fluctuation): ; Instantaneous trend slope (Reflecting the direction and rate of heart rate changes, using least squares linear regression): ; in, This refers to the i-th time point in the timeline sequence; Directional step size difference (Reflecting the cumulative amplitude of positive heart rate jumps): ; in, It is a first-order difference. For a sign function, when When the value is 1, The value is -1 when The value is 0 at that time.

[0033] Similarly, the above four feature parameters are calculated for eight types of time series data: RRI, RESP, ACC, SpO2, NOISE, TEMP, HUMI, and LUX, resulting in a 9×4 dimensional full-factor multimodal time series feature matrix. .

[0034] Simultaneously, long-term trend profile labels are generated based on the temporal feature matrix. Taking the psychological anxiety domain as an example, temporal clustering and frequency integration are performed on the heart rate trend slope over the past 30 days, and the heart rate trend slope in the 30 minutes before falling asleep is analyzed. When the cumulative number of days with a subjective psychological anxiety level (UANX) > 0 and a subjective psychological anxiety level (UANX) > 60 exceeds a preset threshold, a long-term trend profile label of "anxious type difficulty falling asleep" is generated.

[0035] This step transforms massive amounts of raw "physiological + environmental + equipment" time-series data into a structured time-series feature matrix. A deterministic mathematical mapping is used. Four micro-operators (mean, variance, slope, and step difference) are employed to mathematically summarize time-series data. The mean (M) represents the current level, the variance represents the degree of fluctuation, the slope represents the direction and speed of change, and the step difference represents the intensity of sudden rebounds. This transforms the raw data into a feature representation suitable for rapid inference by deep learning models. The introduction of long-term trend profile tags allows subsequent behavior recognition to not only be based on current real-time data but also incorporate users' long-term sleep behavior patterns, improving the personalized accuracy of the recognition.

[0036] S3: Input the temporal feature matrix into the sleep behavior recognition model based on a one-dimensional convolutional bidirectional long short-term memory network, and output a set of fine-grained behavior pattern labels through the sleep behavior recognition model; Specifically, the time-series feature matrix constructed in step S2 The input is a sleep behavior recognition model based on a one-dimensional convolutional bidirectional long short-term memory network. This model comprises a one-dimensional convolutional layer, a bidirectional long short-term memory layer, and a fully connected layer. The one-dimensional convolutional layer extracts spatial transient features from the temporal data, the bidirectional long short-term memory layer captures the bidirectional evolutionary dependencies of the temporal data, and the fully connected layer uses a sigmoid activation function to output the confidence probability of each behavior label in parallel.

[0037] One-dimensional convolutional layer spatial feature extraction: One-dimensional convolutional kernels slide convolution along the time step dimension to capture local abrupt changes in physiological or environmental data. Taking environmental noise sequences as an example, when sudden transient noise occurs at night, the one-dimensional convolutional kernel can quickly capture the temporal local features of the noise (such as the noise's start time, duration, peak amplitude, etc.), extracting the spatial transient features of the "sudden change in environmental noise." The output features of the j-th convolutional kernel at time step t are: ; in This represents a one-dimensional convolution operation. For convolution kernel weights, For bias terms, This is the ReLU activation function.

[0038] Bi-LSTM full-time domain temporal correlation capture: The pooled feature sequence is input into a bidirectional long short-term memory network, and forward evolution (such as the trend of heart rate gradually decreasing when falling asleep) and reverse confirmation (such as the reverse confirmation of the intense body movement in the second half of the sleep stage to the light sleep stage in the first half of the sleep stage) are extracted.

[0039] ; in, This is a forward hidden state. These are the pooled CNN features. This represents the forward hidden state from the previous moment. Forward LSTM unit, This is the reverse hidden state. This is the reverse hidden state for the next time step.

[0040] The bidirectional hidden state vectors are linearly concatenated and fused into a comprehensive latent representation that includes full-time contextual information: ; Sigmoid Fully Connected Multi-Label Parallel Classification: The global feature vector at the final time step is fed into the fully connected layer. Since user sleep behavior patterns are often multi-causal and non-exclusive (e.g., a user may be both "sensitive to environmental noise" and simultaneously experiencing "stress-induced tachycardia"), the exclusive Softmax approach is abandoned, and the Sigmoid activation function is used to independently and in parallel calculate the confidence probability of each behavior label. ; like (Preset threshold) Hard activate the behavior tag and output a set of fine-grained behavior pattern tags. .in, Let be the confidence probability of the i-th behavior label. For the i-th behavior label, To normalize the global feature tensor, Let be the weight vector of the fully connected layer for the i-th label. This is the global hidden state vector at the final time step. For the bias term of the i-th label, The total number of behavior tags. It is an exponential function. The logit score is the original linear score for the i-th label, ranging from... The Sigmoid function compresses it to the (0,1) interval and converts it into a probability value.

[0041] In this embodiment, the label set output by the recognition model includes three behavioral labels: "heart rate rebound during sleep onset," "sensitivity to environmental noise," and "frequent body movement during light sleep," with confidence levels of 0.87, 0.76, and 0.68, respectively. This step extracts transient features of the user's physiological and environmental data using 1D-CNN and captures the temporal evolution dependence during sleep using Bi-LSTM, achieving multi-dimensional and accurate recognition of the user's sleep behavior. Compared with traditional single-threshold judgment methods, the deep learning model can simultaneously identify multiple concurrent sleep behavior patterns (such as the combination of "noise sensitivity + heart rate rebound"), providing refined behavioral label input for subsequent personalized sleep aid strategy generation.

[0042] S4: Based on the set of fine-grained behavioral pattern tags and long-term trend profile tags, calculate the routing score of each sleep disorder domain through the weight adjustment matrix, and activate the corresponding sleep disorder domain channel according to the routing score; Specifically, based on the long-term trend profile labels generated in step S2 and the set of fine-grained behavioral pattern labels output in step S3, the routing score for each sleep disorder domain is calculated using a weight adjustment matrix.

[0043] In this embodiment, the fine-grained behavioral pattern label set output in step S3 includes "heart rate rebound during sleep onset" (e.g., confidence level 0.87), "sensitivity to environmental noise" (e.g., confidence level 0.76), and "frequent body movements during light sleep" (e.g., confidence level 0.68). The long-term trend profile labels generated in step S2 include "anxious difficulty falling asleep" and "frequent awakenings during light sleep." The preset sleep disorder domain includes the psychological anxiety domain. Circadian rhythm domain Environmental physical stimulus domain High-risk areas for respiratory blood oxygen The routing score is calculated using the following formula: Based on the first aspect, the sleep disorder domain in step S4 includes the psychological anxiety domain, the circadian rhythm domain, the environmental physical stimulus domain, and the high-risk respiratory and blood oxygenation domain; the routing score is calculated according to the following formula: ; in, For the routing score of the j-th sleep disorder domain, For the Sigmoid mapping function, Let be the contribution coefficient of the i-th microbehavioral label to the j-th sleep disorder domain. Let be the confidence probability of the i-th behavior label. These are bias terms. For example, the contribution coefficient α of "sleep-onset heart rate rebound" to the psychological anxiety domain is 0.9, and the contribution coefficient α of "sensitivity to environmental noise" to the environmental physical stimulus domain is 0.85.

[0044] The routing scores for each sleep disorder domain were calculated:

[0045] A hard segmentation threshold γ=0.65 was set. The routing scores of both the psychological anxiety domain and the environmental physical stimulus domain exceeded the threshold and were therefore hard activated. The activated sleep disorder domain channel will directly determine the index range of downstream knowledge retrieval, realizing "routing and splitting first, then precise generalization".

[0046] This step achieves precise domain classification of user sleep disorders by fusing fine-grained behavioral labels output by the deep learning model with long-term trend profile labels and calculating routing scores using clinical medical correlation coefficients. It not only identifies the user's current psychological anxiety issues but also recognizes environmental noise interference. The activated disorder domain channel, as a hard routing parameter, directly limits the index range of downstream knowledge base retrieval, avoiding false recalls of knowledge across disease domains (such as falsely recalling intervention literature for sleep apnea insomnia for anxious users), thus ensuring the accuracy of downstream strategy generation from the outset.

[0047] S5: Based on the activated sleep disorder domain channel and long-term trend profile tags, retrieve the corresponding failed memory candidate subset in the episode memory bank, extract the extreme values ​​of physical intervention parameters in the failed cases, and generate negative constraint rules; at the same time, based on the sleep disorder domain channel and fine-grained behavior pattern tag set, retrieve and recall the corresponding knowledge slices in the medical knowledge base. Specifically, step S5 performs dual-track context engineering, namely negative interception and positive knowledge enhancement. Step S5 involves retrieving the corresponding failed memory candidate subset from the episodic memory bank, including concatenating the fine-grained behavioral pattern label set, the sleep profile feature matrix, and subjective psychological anxiety level into a query vector, and calculating the temperature-coefficient-calibrated cosine similarity in the episodic memory bank using the following formula: ; in, For query vector, For historical failure intervention vectors, For temperature hyperparameters, This is a candidate subset of failed memories.

[0048] Step S5, retrieving and recalling the corresponding knowledge slices in the medical knowledge base, includes: pre-filtering the medical knowledge base according to the activated sleep disorder domain channel; recalling candidate knowledge slices in the pre-filtered knowledge base partitions using a dual-path parallel approach of sparse retrieval and dense vector retrieval; and scoring the confidence of the recalled candidate knowledge slices using a deep re-ranking model based on a cross-attention mechanism, selecting the knowledge slices with the highest confidence scores as the recalled knowledge slices.

[0049] Negative interception: Episode memory retrieval and anti-pitfall mechanism This is equivalent to concatenating the fine-grained behavioral pattern label set output in step S3, the sleep profile feature matrix in step S2, and the user's pre-sleep subjective psychological anxiety level UANX=75 into a tensor to construct the current instantaneous state query vector q. Simultaneously, based on the sleep disorder domain channel (psychological anxiety domain) hard-activated in step S4... and environmental physical stimulus domain In the plot memory bank, directly lock and map the corresponding candidate subset of failed memories. This narrows the retrieval space from global filtering to the current symptom domain. It then compares the current query vector q with the historical failed intervention vectors in this specific candidate subset. A cosine similarity matching search based on temperature coefficient calibration was performed. The search revealed two failed incidents from three weeks prior: one where excessive white noise (over 45dB) caused the user to wake up during light sleep, and another where excessive blue light (over 30%) caused a rebound in heart rate during sleep onset. The negative constraint extraction engine immediately extracted the extreme values ​​of the multi-sensory physical intervention parameters in these failed cases and solidified them into a set of forced interception rule matrices: Constraints_neg={volume < 40dB, blue channel proportion < 15%, aromatherapy PWM duty cycle < 0.4} This constraint set, as a set of hard boundary rules, is forcibly and rigidly written into the highest-level contextual exclusive slots in the large language model prompts, thereby blocking the physical outputs of sound, light, and scent that may trigger secondary nerve excitation in users from the source.

[0050] Positive Enhancement: Multi-path Hybrid Recall RAG and Deep Rerank Based on the sleep disorder domain channel activated in step S4 and the set of fine-grained behavioral pattern tags output in step S3, a proprietary search term cluster "anxious sleep onset difficulty AND environmental noise sensitivity AND aromatherapy intervention" is constructed, and a dual-path asynchronous search is initiated: First approach (sparse search BM25): Perform keyword matching in medical literature branches of the psychological anxiety domain and the environmental physical stimulus domain to ensure accurate text hits for high-frequency clinical terms.

[0051] The second approach (Dense Vector Retrieval): Retrieves slices of high-dimensional semantically relevant interventional medical literature within the corresponding low-dimensional vector space.

[0052] The candidate document slices generated by the dual-path retrieval are assembled into a candidate document set and fed into a deep Rerank model based on a cross-attention mechanism. This model performs a non-linear spatial concatenation of each document text with the global sleep profile feature matrix, engaging in full interaction through a deep attention mechanism, and calculating the final medical confidence score, Score_rerank.

[0053] Extract the top 3 high-confidence medical literature snippets from the Score_rerank score, including "Guidelines for the Application of Lavender Essential Oil in Anxiety-Related Insomnia", "Clinical Operational Standards for Progressive Muscle Relaxation", and "Review of Environmental White Noise Masking Therapy Techniques", and mix them into the context space of the cue words as explicit factual evidence (Ground Truth).

[0054] This step implements a dual-track context engineering approach of "negative interception + positive reinforcement." Negative interception transforms historical failed intervention cases into hard constraint rules through episodic memory retrieval, completely blocking the possibility of the large model issuing unsafe control commands at the input end. Positive reinforcement ensures that the recalled knowledge slices have high medical relevance through multi-path hybrid recall with routing label constraints and deep reranking. The two work together to provide "clearly defined safety boundaries and sufficient factual basis" as input for the large language model strategy generation in the subsequent step S6.

[0055] S6: Based on negative constraint rules, recalled knowledge slices, fine-grained behavioral pattern label sets, and long-term trend profile labels, an intervention strategy is generated through a large language model; Step S6 involves generating intervention strategies through a large language model, including: using negative constraint rules as hard boundary constraints, recalling knowledge slices as factual basis, and injecting fine-grained behavioral pattern label sets and long-term trend profile labels as user state context into the prompt word space of the large language model, and generating intervention strategies through multi-round self-reflective reasoning of the large language model.

[0056] The cloud-based agent combines the negative constraint rules generated in step S5, the recalled knowledge slices, the fine-grained behavioral pattern label set from step S3, and the long-term trend profile labels from step S2 into structured prompt words, initiating multi-round self-reflective reasoning of the large language model: Round 1: Multidimensional Problem Diagnosis and Root Cause Analysis. The model is instructed to "address the user's current dual problems of anxiety-related difficulty falling asleep (long-term label) and sensitivity to environmental noise (micro-label), combining medical literature for etiological analysis, and strictly prohibiting the direct output of hardware control commands." The large language model outputs a multidimensional root cause diagnosis report. "The user's heart rate remained consistently high before falling asleep." =78 bpm), accompanied by subjective anxiety (UANX=75). Although the ambient noise level was not high (38 dB), the user was highly sensitive to it, resulting in a prolonged sleep latency. It is recommended to use progressive relaxation guidance combined with natural soundscape masking for intervention. Round Two: Critique & Safety Reflection on Control Action Safety. The negative constraint rules from step S5 (volume < 40dB, blue channel percentage < 15%, aromatherapy PWM duty cycle < 0.4) are forcibly fed into the model as reverse alignment criteria. The large language model performs a safety self-check under strong boundary constraints and outputs a calibrated intervention strategy blueprint B_cal.

[0057] Subsequently, the physical parameter semantic distance Dist_param between the newly generated intervention blueprint and the old intervention process currently running on the edge is calculated.

[0058] At the same time, the expected value of sleep improvement benefits for users after receiving the new intervention is calculated: ; in, Expected benefits of improved sleep This is the weight adjustment vector for the sleep dimension. This is the global sleep profile feature matrix. This is the transpose of the set of fine-grained behavior pattern labels.

[0059] The final intervention strategy generated:

[0060] Policy update decision matrix The output is Action_Update_All, and the system triggers an active action.

[0061] This step employs multi-round self-reflective reasoning, with the large language model first diagnosing the problem and then verifying its safety, ensuring that the generated strategy possesses both medical rigor and physical safety. The strategy update decision matrix ensures that updates are only executed when the user has a clear expectation of improved benefits, avoiding interference from frequent adjustments to physical parameters.

[0062] S7: Convert the intervention strategy into a structured control command stream and send it to the end device for execution.

[0063] The structured control command flow in step S7 includes acoustic control parameters, lighting control parameters, and aromatherapy control parameters for multiple stages.

[0064] The cloud-based system asynchronously distributes the intervention strategy generated in step S6 to the endpoint host device via the MQTT protocol. The intervention strategy is then converted into a multi-stage structured SOP control command stream, including: Acoustic control parameters: Guide voice URL, volume 35dB, fade-in / fade-out time 5000ms, transition curve type is logarithmic; Lighting control parameters: RGBW target value [255,140,0,50] (red, green, blue, white), gradient time 10000ms; Aromatherapy control parameters: PWM duty cycle 0.35, pulse frequency 2Hz; After receiving the SOP command stream, the lightweight agent on the client side loads it into the local event-driven state machine. When player A reaches the end of the introductory paragraph, the system initiates the dual-player logarithmic crossfade algorithm. During the fade-in / fade-out cycle... Inside: ; The two PCM sampling point data are multiplied by their respective real-time gain factors and then superimposed to synthesize the final output digital audio stream. This achieves seamless and imperceptible cross-track transitions. Among them, This is the real-time gain factor for player A. Let t be the real-time gain factor of player B, and t be the current time. To cross-fade the total duration, For phonological correction coefficients; To synthesize and output digital audio streams, The original PCM sample values ​​of player A. This is the original PCM sample value of player B.

[0065] Meanwhile, the lighting control parameters are mapped to the PWM duty cycle change step of the MCU, gradually and linearly transitioning to the target value within 10,000ms, achieving absolutely flicker-free and smooth LED lighting.

[0066] This step achieves a perfect decoupling between cloud-based "strategy cognition" and edge-side "physical execution." The edge-side local event-driven mechanism ensures millisecond-level synchronization of control, completely eliminating sound stuttering or light flickering caused by network jitter. The dual-player logarithmic crossfading algorithm eliminates transient acoustic stimuli during audio switching at the sample level, and multi-sensory hardware micro-control enables smooth and gradual changes in lighting and aromatherapy. Together, these three elements ensure zero-perceptible interference to the user during sleep-aid intervention.

[0067] Please refer to Figure 2 This application provides a sleep aid strategy recommendation system based on multi-source sleep data, including: Data acquisition module 1 is used to collect multi-source multimodal sleep data, which includes user physiological time-series data collected by wearable devices, environmental time-series data collected by host devices, and user subjective input data. Feature extraction module 2 is used to perform time axis alignment and noise reduction on user physiological time series data and environmental time series data, extract time series feature parameters respectively, construct time series feature matrix, and generate long-term trend profile labels based on time series feature matrix; The behavior recognition module 3 is used to input the temporal feature matrix into the sleep behavior recognition model based on a one-dimensional convolutional bidirectional long short-term memory network, and output a set of fine-grained behavior pattern labels through the sleep behavior recognition model. The routing activation module 4 is used to calculate the routing score of each sleep disorder domain based on the fine-grained behavioral pattern label set and long-term trend profile label through a weight adjustment matrix, and activate the corresponding sleep disorder domain channel according to the routing score. The knowledge retrieval module 5 is used to retrieve the corresponding failed memory candidate subset in the episode memory bank based on the activated sleep disorder domain channel and long-term trend profile label, extract the extreme values ​​of physical intervention parameters in the failed cases, and generate negative constraint rules; at the same time, it retrieves and recalls the corresponding knowledge slices in the medical knowledge base based on the sleep disorder domain channel and fine-grained behavior pattern label set. The strategy generation module 6 is used to generate intervention strategies through a large language model based on negative constraint rules, recalled knowledge slices, fine-grained behavioral pattern label sets, and long-term trend profile labels. The instruction issuing module 7 is used to convert the intervention strategy into a structured control instruction stream and issue it to the end-side device for execution.

[0068] For a detailed implementation of the sleep aid strategy recommendation system based on multi-source sleep data, please refer to the above-mentioned implementation of the sleep aid strategy recommendation method based on multi-source sleep data. Further details will not be provided here.

[0069] Please refer to Figure 3 This application also provides an electronic device, including: Memory 9 is used to store one or more programs; Processor 8; Processor 8 and memory 9 are connected via communication interface 10; When one or more programs are executed by processor 8, all or some of the above methods are implemented.

[0070] The memory 9 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.

[0071] Processor 8 can be an integrated circuit chip with signal processing capabilities. This processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0072] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered illustrative and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within this application. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. A method for recommending sleep-aid strategies based on multi-source sleep data, characterized in that, include: S1: Collect multi-source multimodal sleep data, which includes user physiological time-series data collected by wearable devices, environmental time-series data collected by host devices, and user subjective input data; S2: Perform time axis alignment and noise reduction on the user's physiological time series data and the environmental time series data, extract time series feature parameters respectively, construct a time series feature matrix, and generate long-term trend profile labels based on the time series feature matrix; S3: Input the time-series feature matrix into a sleep behavior recognition model based on a one-dimensional convolutional bidirectional long short-term memory network, and output a fine-grained behavior pattern label set through the sleep behavior recognition model; S4: Based on the fine-grained behavior pattern label set and the long-term trend profile label, calculate the routing score of each sleep disorder domain through the weight adjustment matrix, and activate the corresponding sleep disorder domain channel according to the routing score; S5: Based on the activated sleep disorder domain channel and the long-term trend profile label, retrieve the corresponding failed memory candidate subset in the episode memory bank, extract the extreme values ​​of physical intervention parameters in the failed cases, and generate negative constraint rules; at the same time, based on the sleep disorder domain channel and the fine-grained behavior pattern label set, retrieve and recall the corresponding knowledge slices in the medical knowledge base. S6: Based on the negative constraint rules, the recalled knowledge slices, the fine-grained behavior pattern label set, and the long-term trend profile labels, an intervention strategy is generated through a large language model; S7: Convert the intervention strategy into a structured control command stream and send it to the end device for execution.

2. The method for recommending sleep-aid strategies based on multi-source sleep data according to claim 1, characterized in that, The time-series feature parameters include the dynamic baseline mean. Temporal dispersion variation variance Instantaneous trend slope k and directional step size difference For any type of time-series data sequence w is the length of the time window, x1 to For each data point in the time series data sequence: The dynamic baseline mean μ is calculated according to the following formula: ; Where w is the length of the time window. This refers to the i-th data point in the time-series data sequence; The time-series discreteness variation variance Calculate according to the following formula: ; The instantaneous trend slope k is calculated using the least squares method according to the following formula: ; in, This refers to the i-th time point in the timeline sequence; The directional step size difference Calculate according to the following formula: ; in, It is a first-order difference. For a sign function, when When the value is 1, The value is -1 when The value is 0.

3. The method for recommending sleep-aid strategies based on multi-source sleep data according to claim 1, characterized in that, The sleep behavior recognition model based on a one-dimensional convolutional bidirectional long short-term memory network described in step S3 includes a one-dimensional convolutional layer, a bidirectional long short-term memory layer, and a fully connected layer. The one-dimensional convolutional layer is used to extract the spatial transient features of time-series data, the bidirectional long short-term memory layer is used to capture the bidirectional evolutionary dependence of time-series data, and the fully connected layer uses the Sigmoid activation function to output the confidence probability of each behavior label in parallel.

4. The method for recommending sleep-aid strategies based on multi-source sleep data according to claim 1, characterized in that, The sleep disorder domain mentioned in step S4 includes the psychological anxiety domain, the circadian rhythm domain, the environmental physical stimulus domain, and the high-risk respiratory and blood oxygenation domain; the routing score is calculated according to the following formula: ; in, For the routing score of the j-th sleep disorder domain, For the Sigmoid mapping function, Let be the contribution coefficient of the i-th microbehavioral label to the j-th sleep disorder domain. Let be the confidence probability of the i-th behavior label. This is a bias term.

5. The method for recommending sleep-aid strategies based on multi-source sleep data according to claim 1, characterized in that, Step S5, which involves retrieving the corresponding candidate subset of failed memories from the episodic memory bank, includes: concatenating the fine-grained behavioral pattern label set, the sleep profile feature matrix, and the subjective psychological anxiety level into a query vector, and calculating the temperature-coefficient-calibrated cosine similarity in the episodic memory bank according to the following formula: ; in, For query vector, For historical failure intervention vectors, For temperature hyperparameters, This is the candidate subset of the failed memories.

6. The method for recommending sleep-aid strategies based on multi-source sleep data according to claim 1, characterized in that, Step S5, which involves retrieving and recalling the corresponding knowledge slices in the medical knowledge base, includes: pre-filtering the medical knowledge base based on the activated sleep disorder domain channel; recalling candidate knowledge slices in the pre-filtered knowledge base partitions using a dual-path parallel approach of sparse retrieval and dense vector retrieval; scoring the confidence of the recalled candidate knowledge slices using a deep reordering model based on a cross-attention mechanism; and selecting several knowledge slices with the highest confidence scores as the recalled knowledge slices.

7. The method for recommending sleep-aid strategies based on multi-source sleep data according to claim 1, characterized in that, The step S6 of generating an intervention strategy through a large language model includes: using the negative constraint rule as a hard boundary constraint, using the recalled knowledge slices as factual basis, and using the fine-grained behavior pattern label set and the long-term trend profile label as user state context, all of which are injected into the prompt word space of the large language model, and generating an intervention strategy through multi-round self-reflective reasoning of the large language model.

8. The method for recommending sleep-aid strategies based on multi-source sleep data according to claim 1, characterized in that, The structured control command flow described in step S7 includes acoustic control parameters, lighting control parameters, and aromatherapy control parameters in multiple stages.

9. A sleep aid strategy recommendation system based on multi-source sleep data, characterized in that, include: The data acquisition module is used to collect multi-source multimodal sleep data, which includes user physiological time-series data collected by wearable devices, environmental time-series data collected by host devices, and user subjective input data. The feature extraction module is used to perform time axis alignment and noise reduction on the user's physiological time series data and the environmental time series data, extract time series feature parameters respectively, construct a time series feature matrix, and generate long-term trend profile labels based on the time series feature matrix. The behavior recognition module is used to input the temporal feature matrix into a sleep behavior recognition model based on a one-dimensional convolutional bidirectional long short-term memory network, and output a fine-grained behavior pattern label set through the sleep behavior recognition model. The routing activation module is used to calculate the routing score of each sleep disorder domain based on the fine-grained behavior pattern label set and the long-term trend profile label through a weight adjustment matrix, and activate the corresponding sleep disorder domain channel based on the routing score. The knowledge retrieval module is used to retrieve the corresponding failed memory candidate subset in the plot memory bank based on the activated sleep disorder domain channel and the long-term trend profile label, extract the extreme values ​​of physical intervention parameters in the failed cases, and generate negative constraint rules; at the same time, it retrieves and recalls the corresponding knowledge slices in the medical knowledge base based on the sleep disorder domain channel and the fine-grained behavior pattern label set. The strategy generation module is used to generate intervention strategies through a large language model based on the negative constraint rules, the recalled knowledge slices, the fine-grained behavior pattern label set, and the long-term trend profile labels. The instruction issuing module is used to convert the intervention strategy into a structured control instruction stream and issue it to the end-side device for execution.

10. An electronic device, characterized in that, include: Memory, used to store one or more programs; processor; When the one or more programs are executed by the processor, the method as described in any one of claims 1-8 is implemented.