A physically isolated single-user end-side private knowledge base context-aware generation method

CN122905023APending Publication Date: 2026-10-13FOSHAN XIZHAODE TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

[0004]现有的端侧推理方案如公开号为CN121434502A的发明专利申请、边缘计算方案如公开号为CN114490053A的发明专利申请虽然实现了情境感知,但情境特征输入较为单一,未融合用户多维情境信号,也未有根据用户不同身份实现算法逻辑的自动切换

Benefits of technology

本申请的核心技术贡献不在于数据层、交互与感知层、知识层或引擎层中任何单一层面的技术创新,而在于将上述四层以特定方式有机整合为一个完整的端侧智能系统,具体地:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122905023A_ABST
    Figure CN122905023A_ABST
Patent Text Reader

Abstract

The application discloses a physical isolation single-user end-side private knowledge base context-aware generation method, and relates to the technical field of information security and artificial intelligence. The method constructs an independent four-layer architecture for each user on the terminal: the data layer realizes storage and calculation physical isolation through hardware-level encryption; the interaction and perception layer fuses real-time sensor signals and local multi-source data to generate a multi-dimensional context feature vector; the knowledge layer constructs and incrementally updates a vector library or knowledge graph based on the user's own private data; the engine layer has multiple identity templates, and synchronously switches recall strategies, filtering rules and generation model parameters. The method uses the context vector to retrieve the private knowledge base, and generates content matching the user's identity and real-time context by template parameter constraints. The whole process of data reading and reasoning is completed on the end side, completely eliminating cross-user data access, ensuring the highest privacy and security, and realizing high real-time, strong context adaptation and personalized intelligent services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security and artificial intelligence, and more particularly to a method for generating a context-aware knowledge base on a physically isolated single-user-side private knowledge base. Background Technology

[0002] With the continuous improvement of computing power in smart terminal devices and the increasing awareness of privacy protection among users, personalized content recommendation based on edge devices has become a research hotspot. Edge recommendation systems can complete data processing and inference locally, avoiding the uploading of sensitive user data to the cloud, thereby providing real-time personalized services while protecting user privacy.

[0003] Existing user-side data isolation technologies, such as the invention patent applications with publication numbers CN114357514A and CN117852057A, focus on system-level security isolation in multi-user shared device scenarios, rather than the construction of private data space at the single-user application level. Although the invention patent with publication number CN113420232A protects the original data from leaving the local device, it still requires cross-user aggregation of model parameters, and the model relies on a central server for aggregation and updates.

[0004] Existing edge computing solutions, such as the invention patent application with publication number CN121434502A and the invention patent application with publication number CN114490053A, have achieved context awareness, but the context feature input is relatively simple, and it does not integrate multi-dimensional context signals of users, nor does it automatically switch the algorithm logic according to different user identities.

[0005] Therefore, there is an urgent need for a device-side personalized content generation method that can simultaneously achieve the construction of a private knowledge base with physical isolation for a single user, the fusion of multi-dimensional contextual features, the switching of recommendation logic driven by identity templates, and the updating of a closed-loop self-evolving local model. Summary of the Invention

[0006] To address the aforementioned issues, this invention provides a physically isolated single-user client-side private knowledge base context-aware generation method. It employs a completely physically isolated single-user data space and constructs an independently operating multi-layer architecture for each user on the terminal device, including a data layer, an interaction and perception layer, a knowledge layer, and an engine layer. The terminal device allocates a physically isolated encrypted storage area and an independent computing environment to each user, ensuring that the data and computing resources of different users are completely separated at the underlying level.

[0007] The data layer stores only the user's private data in a user-specific encrypted storage instance on the device side. Data from different users are physically isolated in storage space, making them invisible to each other and inaccessible to each other.

[0008] The interaction and perception layer integrates real-time signals collected by edge sensors and multi-dimensional contextual data from local data sources, performs spatiotemporal alignment and feature fusion, and forms a multi-dimensional contextual feature vector with temporal attributes.

[0009] The edge sensors include, but are not limited to, collecting environmental status data, and the local data sources include, but are not limited to, time-related event data, user profiles, and other data, which are mainly used to characterize the current environment, time, and user status.

[0010] The knowledge layer dynamically constructs and incrementally updates a user's private vector library or knowledge graph on the client side based on the private data corresponding to the logged-in user's identity. The construction and update process only uses the user's own data and does not perform any cross-user aggregation training or data fusion.

[0011] The engine layer incorporates multiple identity templates, each corresponding to a set of preset algorithm logic, including recall strategies, filtering rules, and generation model parameters. Based on the identity identified by the multi-dimensional contextual feature vector in the current scene, or based on the identity actively selected by the user, the engine layer automatically activates the corresponding identity template and synchronously switches the algorithm logic.

[0012] Based on the above architecture, the steps for performing context-aware generation in this invention are as follows: S1, through the interaction and perception layer, uniformly acquires environmental status sensor data via the edge sensor hub, and performs spatiotemporal alignment and feature fusion with local stored time-related events and user profiles, forming a multi-dimensional contextual feature vector.

[0013] S2, the data layer maps the user's private data-specific storage instance to the current independent computing environment based on the corresponding physically isolated encrypted storage partition mounted by the user. At the same time, it ensures that other users' storage partitions cannot be mounted or addressed in the current computing space, thereby completing the physical isolation switching of the data space at the underlying storage and computing layers.

[0014] S3, based on S2, loads only the data in the encrypted storage instance dedicated to the user, performs entity recognition, relation extraction and vectorization encoding on the user's private data, and builds an initial vector library or knowledge graph; when new local data is detected, incremental updates are performed on the new data on the device side, without relying on cloud computing power, and no user's original data or intermediate features are uploaded to the external device side.

[0015] S4, the engine layer can automatically identify the identity template that the user should match in the current scenario based on the multi-dimensional context feature vector for the user to confirm and select. The user can also select or switch identity templates through the interactive interface, automatically activate the corresponding identity template, and load the recall strategy, filtering rules and generation model parameter configuration corresponding to the template.

[0016] S5. Using the multi-dimensional context vector, the knowledge units in the current user's private knowledge base are retrieved by relevance weighting to obtain a candidate knowledge set. Then, using the generation control parameters and prompt templates corresponding to the current identity template as constraints, the candidate knowledge set is explained, synthesized, or suggested for generation. Finally, text, voice, or visual content that highly matches the current user identity and real-time context is output.

[0017] S6 incrementally updates the local model based on current user feedback data on the output content, forming a closed-loop self-evolution.

[0018] The entire process of data reading, knowledge retrieval, and content generation is limited to the physically isolated storage partition corresponding to the current user. No step involves accessing other users' data across partitions, and all data processing is completed on the device side.

[0019] The method can construct a completely independent encrypted data space, a private knowledge layer, a multi-dimensional context-aware layer, and a switchable identity template engine layer for each user, so that the generated content is not only entirely derived from the user's own private data, but also deeply integrated with real-time context and identity features.

[0020] The beneficial effects of this invention are as follows: The core technological contribution of this application does not lie in technological innovation at any single level of the data layer, interaction and perception layer, knowledge layer, or engine layer, but rather in organically integrating the above four layers into a complete edge-side intelligent system in a specific way, specifically: The data layer completely eliminates the possibility of data overlap between different users from the storage and computing levels by using a single-user data space that is physically isolated on the edge, preventing privacy leaks and unauthorized access, and meeting users' data security requirements. The knowledge layer builds a private knowledge base based solely on the user's own data. The interaction and perception layer incorporates multi-dimensional contextual signals such as temperature, weather, calendar, and physiology to generate multi-dimensional contextual feature vectors that fit the user's current environment and individual state. This provides real-time, accurate, and identity-adaptive personalized content services while protecting user privacy.

[0021] The engine layer has multiple built-in identity templates, and the algorithm logic automatically switches according to the identity template. The same device can securely serve different users at different life stages or roles without the need to retrain the model or replace the system. Attached Figure Description

[0022] Figure 1 This is a schematic diagram of the overall architecture of a context-aware generation method for a physically isolated single-user-side private knowledge base provided in an embodiment of the present invention; Figure 2This is a schematic diagram of the overall steps of a context-aware generation method for a physically isolated single-user-side private knowledge base provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the multi-source context signal fusion process of a context-aware generation method for a physically isolated single-user-side private knowledge base provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the knowledge base loading process of a context-aware generation method for a physically isolated single-user-side private knowledge base provided in an embodiment of the present invention. Figure 5 This is a schematic diagram of the context-aware personalized content generation process of a context-aware generation method for a physically isolated single-user-side private knowledge base provided in an embodiment of the present invention. Detailed Implementation

[0023] This invention provides a method for generating a context-aware knowledge base for a physically isolated single-user terminal, applicable to various terminal devices with terminal computing capabilities, including but not limited to smartphones, tablets, smart wearable devices, smart home control screens, and in-vehicle terminal devices. The following description uses a smartphone as an example and details the invention in conjunction with specific application scenarios.

[0024] In real-world usage scenarios, the same terminal device may be shared by multiple users (e.g., family members sharing a mobile phone or a home control screen), or the same user may have differentiated personalized service needs at different life stages and roles (e.g., the same user needs different content recommendations and generation during different states such as weekdays, weight loss periods, and pregnancy). Traditional solutions rely on centralized cloud models, making it difficult to provide real-time, accurate, and identity-adaptive personalized content services while ensuring privacy. This invention effectively solves the above problems by physically isolating a private knowledge base on the terminal side and using a context-aware generation mechanism.

[0025] Please see Figure 1 , Figure 1 The diagram illustrates the overall architecture of a context-aware generation method for a physically isolated single-user-side private knowledge base proposed in this invention. It includes a four-layer architecture that runs independently for each user on the terminal device: a data layer, an interaction and perception layer, a knowledge layer, and an engine layer.

[0026] Physical isolation refers to the absence of any direct or indirect connection medium between two or more information systems or networks at the physical level. In this embodiment, the terminal device ensures that the data and computing resources of different users are completely separated at the underlying level by allocating a physically isolated encrypted storage area and an independent computing environment to each user.

[0027] In this embodiment, the terminal device can be a smartphone equipped with a Trusted Execution Environment (TEE), which integrates an embedded secure element (eSE) or a trusted execution environment built based on hardware isolation technologies such as ARM TrustZone, to achieve physical isolation storage and secure computation of user data. The terminal device is also equipped with a multimodal sensor hub for unified management of edge-side sensing devices such as accelerometers, gyroscopes, temperature sensors, heart rate sensors, and ambient light sensors.

[0028] The data layer, at the operating system level or trusted execution environment of the terminal device, divides each user's data into independent encrypted partitions. Each encrypted partition is protected by an independent encryption key, which is stored in the secure hardware of the terminal device and is completely isolated from the keys of other users.

[0029] Specifically, when a new user is added to a terminal device for the first time, the data layer creates a dedicated encrypted storage instance for that user in the secure storage area, including but not limited to the following sub-storage areas: Raw data storage area: Used to store the user's private raw data, such as album pictures, personal preference settings, browsing history, local files, etc.; Knowledge base storage area: used to store vector indexes and knowledge graph data generated after processing by the knowledge layer; Context cache: Used to cache timely contextual information such as environmental state data and time-related event data obtained by the interaction and perception layer; Model parameter storage area: Used to store the generated model parameters and prompt template configurations corresponding to each identity template in the engine layer.

[0030] Each storage area is encrypted using encryption standards such as AES-256, and the encryption key is bound to the user's biometric features (such as fingerprints or faces) or device-level keys to ensure that decryption and access can only be granted after the user's authentication is successful.

[0031] The interaction and perception layer continuously acquires environmental status data at a preset sampling frequency through an edge sensor hub, including but not limited to real-time sensor data such as ambient temperature, humidity, ambient light intensity, geographical location, and acceleration data. It periodically accesses locally stored multi-source data, including but not limited to locally cached weather forecasts, system calendar events, user-defined preference tags, and activity goals. After acquiring the above data, a spatiotemporal alignment strategy is used to align the multi-source heterogeneous data to the same time coordinate, and features from different sources are normalized and vectorized for fusion, forming a multi-dimensional contextual feature vector with temporal attributes.

[0032] Preferably, the dimensions of the multidimensional context feature vector are determined by a combination of the following factors: the number of sensor data types, the number of local data source fields, the time series window length, and the fusion strategy.

[0033] For example, in a scenario containing six types of sensor data (temperature, humidity, ambient light, geographic location, acceleration, and heart rate) and four types of local data sources (weather conditions, calendar events, user profile preference tags, and activity goals), if a fixed-length time-series window (e.g., the three most recent sampling times) is used, the multi-dimensional contextual feature vector generated after feature fusion has a dimension of 128. If a single-moment static fusion (without a time-series window) is used, the vector dimension is 64. The vector dimension is determined based on ensuring that each modal feature has sufficient representational power after encoding, while controlling the vector dimension within the acceptable range of on-device storage and computation (for example, no more than 256 dimensions), to balance contextual representation accuracy and on-device retrieval efficiency. All dimension values ​​are represented using 32-bit floating-point numbers (FP32) or 16-bit floating-point numbers (FP16), and the entire vector is stored in the contextual cache after L2 normalization.

[0034] After a user's identity is verified, the knowledge layer builds and maintains a private vector library or knowledge graph on the client side based on the data in the user's dedicated encrypted storage partition.

[0035] When a user logs in for the first time, the knowledge layer scans the user's private data space for historical data and performs the following processing: Entity recognition and relation extraction: For unstructured text data (such as notes, memos, chat logs), use lightweight natural language processing models on the device (such as BERT-Tiny, DistilBERT and other compressed models) to perform named entity recognition and relation extraction, and extract entities and their relationships; Preferably, the aforementioned lightweight natural language processing models for edge devices employ a Transformer architecture that has undergone knowledge distillation or pruning compression to adapt to edge storage and computing power constraints. For example, the BERT-Tiny model has approximately 4.4M parameters, 128 hidden layer dimensions, 2 Transformer layers, 2 attention heads, and 512 intermediate layer dimensions; the DistilBERT model has approximately 66M parameters, 768 hidden layer dimensions, 6 Transformer layers, 12 attention heads, and 3072 intermediate layer dimensions. These models are deployed on the edge device after INT8 dynamic quantization or FP16 half-precision quantization, and forward inference is performed using TensorFlow Lite, ONNX Runtime Mobile, or PyTorch Mobile inference frameworks. After quantization, the BERT-Tiny model file size is approximately 5MB, with a single sequence inference latency of approximately 10ms~30ms on an ARM Cortex-A76 architecture processor; the DistilBERT model file size is approximately 25MB, with a single sequence inference latency of approximately 30ms~80ms. In the named entity recognition task, the maximum length of the model input sequence is set to 128~256 tokens, and the output dimension corresponds to a predefined entity type label space; in the relation extraction task, a sequence classification method based on entity pair labels is adopted, and the probability distribution of relation categories is output.

[0036] Vectorization encoding: For image data (such as outfit photos, product images), a lightweight visual encoder (such as MobileNet, EfficientNet-Lite, etc.) is used to extract image feature vectors. For text data, a text encoder is used to map the text content into a vector representation. Preferably, the aforementioned lightweight edge visual encoder employs a convolutional neural network architecture optimized using depthwise separable convolution or compound scaling strategies. For example, the MobileNet-V3-Small model has approximately 2.5M parameters, an input image size of 224×224 pixels, and an output feature vector dimension of 1280; the EfficientNet-Lite0 model has approximately 5.3M parameters, an input image size of 224×224 pixels, and an output feature vector dimension of 1280. These models are deployed after INT8 full integer quantization (Post-Training Integer Quantization) or FP16 half-precision quantization, and inference is performed using TensorFlow Lite, MNN, or NCNN inference frameworks. After INT8 quantization, the MobileNet-V3-Small model file size is approximately 2MB, and the inference latency per image is approximately 5ms~15ms on an ARM Cortex-A76 architecture processor; the EfficientNet-Lite0 model file size is approximately 5MB, and the inference latency per image is approximately 10ms~25ms. When deployed on the edge, the image data is normalized to the range of [0,1] or [-1,1] after hardware decoding. It is input into the model with RGB three channels. After the feature vector is extracted by the global average pooling layer, L2 normalization is performed to adapt to the subsequent similarity calculation.

[0037] Preferably, the aforementioned edge text encoder employs a lightweight sentence embedding model optimized based on the Siamese network architecture. For example, the all-MiniLM-L6-v2 model is used, with approximately 22M parameters, 6 Transformer layers, 384 hidden layer dimensions, 12 attention heads, and an output sentence embedding dimension of 384; or a sentence embedding model optimized based on DistilBERT is used, with an output dimension of 768. After dynamic quantization with INT8, the above models are deployed and inference is performed using the ONNX Runtime Mobile or TensorFlow Lite inference framework. The model file size is approximately 10MB~15MB, and the inference latency for a single text is approximately 15ms~40ms on an ARM Cortex-A76 architecture processor. The text preprocessing stage uses WordPiece or BPE word segmenters, with a maximum sequence length of 128-256 tokens. The output embedding vectors are normalized by L2 and stored in the vector library. An approximate nearest neighbor retrieval index is constructed based on FAISS Mobile, HNSW, or IVF index structures. The index file is stored in the knowledge base storage area of ​​the user's dedicated storage partition.

[0038] Knowledge fusion and storage: Entity relationships are stored in a knowledge graph, vector representations are stored in a vector library, and corresponding indexes are established to support efficient retrieval.

[0039] When new local data is detected (such as newly entered user preference information), the knowledge layer performs incremental processing on the device side, only updating the relevant parts of the user's knowledge graph or vector library affected by the new data, without performing a full reconstruction or relying on cloud computing power.

[0040] The engine layer has multiple built-in identity templates, each corresponding to a complete set of algorithm logic configurations. For example, in this embodiment, the engine layer pre-configures, but is not limited to, the following identity templates: Pregnant woman template: The corresponding algorithm logic includes filtering rules (filtering recommendations containing prohibited elements) and gentle tone generation parameters; Children's template: The corresponding algorithm logic includes cognitive level adaptation strategy (using simpler vocabulary and expressions) and content safety filtering rules; Fat loss period template: The corresponding algorithm logic includes calorie control knowledge constraints and exercise suggestion generation strategies; Exam preparation template: The corresponding algorithm logic includes learning plan optimization strategies and key knowledge point reinforcement and recall logic; Business Person Template: The corresponding algorithm logic includes a time efficiency priority strategy and formal tone generation parameters.

[0041] Each identity template is stored locally on the terminal device in the form of a configuration file. Preferably, the configuration file is stored in a structured data format, for example, JSON (JavaScript Object Notation) or YAML (YAML Ain't Markup Language), organizing each parameter item in key-value pairs for easy parsing and dynamic loading by the engine layer. The configuration file is stored in the model parameter storage area of ​​the user's dedicated storage partition, encrypted with AES-256, and decrypted and read by the engine layer only after the current user's authentication is successful. The configuration file content includes, but is not limited to, the following parameters: Recall strategy parameters include the upper limit on the number of knowledge units to be recalled, the similarity threshold, and the ranking weight coefficient. Filtering rule parameters include prohibited knowledge categories, keyword blacklists, and security level thresholds. Generate model parameters include the temperature coefficient, top-k sampling parameters, maximum output length, and prompt template.

[0042] Preferably, the aforementioned identity template configuration file is stored in JSON format in the model parameter storage area of ​​the user-specific storage partition, with a unified character encoding of UTF-8. All configuration parameters are organized in a hierarchical key-value pair format. The top-level data structure of the configuration file is divided into four logical blocks: The first block is the template metadata block, which records the template's unique identifier, display name, version number, functional description, and creation and update timestamps. This is used for version management and template list display at the engine layer. For example, the identifier in the metadata of the pregnant woman template is `pregnant_v2`, the version number is 2.1.0, and the description field explains the template's recommendation and generation strategy for pregnant users, emphasizing nutritional safety and a gentle tone.

[0043] The second block is the recall strategy configuration block, which includes the upper limit of the number of knowledge units to be recalled (exemplarily set to 15), the similarity threshold (exemplarily set to 0.65), the ranking weight coefficient, and the modality weight coefficient. Among them, the ranking weight coefficient sets normalized weight values ​​for the three knowledge types of text, image, and multimodal, which is used to balance the contribution of different modalities when recalling and ranking.

[0044] The third block is the filtering rule configuration block, which includes a list of prohibited knowledge categories (such as prohibiting caffeine, alcohol, raw and cold foods, and high-mercury fish in the pregnant woman template), a keyword blacklist (such as terms like "quit smoking," "diet pills," and "strenuous exercise"), a security level threshold (using integer values ​​from 1 to 5; knowledge units below this threshold will be filtered), and a list of custom rules. Custom rules are organized in the form of condition-action pairs. For example, a rule can be defined as "execute interception when the beverage type is alcohol" to implement fine-grained business-level filtering logic.

[0045] The fourth block is the generative model configuration block, which includes the temperature coefficient (exemplarily set to 0.4), top-k sampling parameters (exemplarily set to 40), maximum output word count (exemplarily set to 256 words), repetition penalty coefficient (exemplarily set to 1.1), prompt template text, the name of the generative model used and its quantization method, and the maximum context length. The prompt template text embeds variable placeholders, which are dynamically replaced by the engine layer during generation with the actual multi-dimensional contextual feature vector text description and candidate knowledge set summary, thus constructing a complete generative input context. For example, the prompt template for pregnant women requires the model to act as a caring pregnancy life assistant, providing safe, gentle, and practical advice based on contextual information and candidate knowledge, and constraining the response tone to be warm and encouraging, while explicitly requiring avoidance of stimulating or vague expressions, and the content must comply with pregnancy nutrition and activity safety guidelines.

[0046] All numeric parameters are stored as JSON numeric types, boolean parameters as boolean types, and text parameters as string types. Configuration files use a two-space indentation format for easy manual review and editing. When the engine layer starts or switches templates, it first performs strict pattern validation on the configuration file, checking if required fields are complete and if data types match. If validation fails, it automatically reverts to the template's factory default configuration (stored in a read-only partition of the system) and generates an error log for user troubleshooting. Since each user's template configuration file is stored in their own dedicated encrypted storage partition, when the data layer switches users, the engine layer synchronously unloads the current configuration object from memory and loads the new user's configuration file, ensuring complete isolation of algorithmic logic between different users at the configuration level.

[0047] The engine layer provides an identity template management interface, which supports users to add or switch identity templates, and also supports automatically recommending suitable identity templates for user confirmation based on multi-dimensional contextual signals.

[0048] Figure 2 This diagram illustrates the overall steps of a context-aware generation method for a physically isolated single-user-side private knowledge base. Please refer to [link / reference]. Figure 2 The physical isolation single-user-side private knowledge base context-aware generation method of this invention includes the following steps: S1, When a user logs into their personal account on a terminal device after successful authentication, the interaction and perception layer is activated. The authentication methods include, but are not limited to: explicit account and password input login, automatic wake-up login based on the terminal device's saved login state, or contactless authentication login using biometric features such as face / fingerprint / voiceprint. Figure 3 This diagram illustrates a multi-source context signal fusion process for a context-aware generation method using a physically isolated single-user-side private knowledge base. Please refer to [link / reference]. Figure 3 The details are as follows: S11, the interaction and perception layer acquires sensor data such as current ambient temperature, ambient light intensity and geographical location through the edge sensor hub at a preset sampling frequency (set to once every 30 seconds in this embodiment).

[0049] S12, the interaction and perception layer accesses local storage data, for example, including reading the weather forecast for the day (including weather conditions, temperature range, probability of precipitation, etc.) from the weather cache, reading the current and preset time period (such as the next 24 hours) of scheduled events (such as meeting arrangements, fitness plans, travel arrangements, etc.) from the system calendar, and reading the user's preset color preferences, style preferences, activity goals, and other information data from the user profile cache.

[0050] S13, the interaction and perception layer aligns the aforementioned sensing data and locally stored data in time and space according to the acquisition timestamps to ensure that data from different sources correspond to the same time and space context. Then, it uses feature concatenation or attention-based fusion strategies to generate normalized multidimensional contextual feature vectors.

[0051] Preferably, the spatiotemporal alignment includes the following steps: S131, Time Base Unification: Using the system clock of the interaction and perception layer as the reference, the timestamps of each sensor data and the local data source data are aligned to the same millisecond precision. For data sources with different sampling frequencies (such as sensors sampling once every 30 seconds, and scheduled events being discretely triggered), nearest neighbor interpolation or linear interpolation is used to fill the time grid of high-frequency data with low-frequency data, or downsampling is used to aggregate high-frequency data into the low-frequency time grid, ensuring that each data source has a valid value at the same time point.

[0052] S132, Spatial Coordinate Unification: For geographic location data, the WGS-84 coordinate system is used for unified representation; for other data without spatial attributes (such as temperature, ambient light), the spatial coordinates are marked with default values ​​or device-bound coordinates.

[0053] Preferably, the feature splicing strategy is specifically implemented as follows: The original features from each data source, after spatiotemporal alignment, are directly concatenated into a one-dimensional vector in a fixed order. For example, suppose the sensor data, after normalization, has a dimension of... =12 (temperature 1D, humidity 1D, ambient light 1D, geographic location latitude and longitude 2D, acceleration 3-axis 3D, heart rate 1D, gyroscope 3-axis 3D), local data source after encoding has the following dimensions. =20 (weather condition One-Hot encoding 5-dimensional, schedule event type embedding 8-dimensional, user profile preference tag embedding 4-dimensional, activity goal encoding 3-dimensional), then the dimensions of the concatenated original feature vector are: Subsequently, a fully connected layer (Linear layer) is used to map the original 32-dimensional features to the target dimension (such as 64-dimensional or 128-dimensional), and the mapping layer weight matrix... After initialization on the client side, local fine-tuning and updates can be performed based on user feedback. The mapped vector is then activated by ReLU and normalized by L2 to obtain the final multidimensional contextual feature vector.

[0054] Preferably, the attention fusion strategy is specifically implemented as follows: Each data source is treated as an independent modal input, and each is mapped to a unified hidden dimension via a modality-specific encoder (e.g., sensor data via a single fully connected network, and textual local data via a BERT-Tiny encoder). (For example, If there are M modes in total, then the modal feature set is obtained. ,in, Introduce learnable modal attention weight vectors. Calculate the attention score for each modality:

[0055] in, For the first Attention weights for each modality The attention score is scaled using the dot product. The weighted fused contextual feature vector is...

[0056] fused vector After L2 normalization, it becomes the final multidimensional contextual feature vector. Attention weight vector. After initialization on the device side, local fine-tuning can be performed based on user feedback to adaptively increase the attention weight for the current user's high-value modalities (such as schedule events or physiological signals).

[0057] Preferably, the selection of the above two fusion strategies is based on the following: when the importance of each data source is relatively fixed and the computing power on the edge is limited, the feature splicing strategy is preferred, with a computational complexity of O(n). When the importance of each data source changes dynamically and the edge has sufficient NPU computing power, an attention fusion strategy is preferred, with a computational complexity of O(n). .

[0058] For example, the vector can be expressed in the form:

[0059] in, This represents the normalized value of the current temperature. Indicates weather condition codes, Indicates time period code, Indicates the type code of the scheduled activity. This indicates the user's color preference encoding.

[0060] Preferably, the normalization method for each of the above dimensions is as follows: temperature Local temperature range based on historical statistics, using Min-Max normalization. Scaling (e.g., from -10°C to 45°C) is performed using the following formula:

[0061] The output range is [0,1]. If the current temperature exceeds the historical range, it will be truncated to the boundary value.

[0062] Weather conditions One-Hot encoding or predefined integer encoding is used. For example, the weather category set is defined as {sunny, cloudy, overcast, light rain, heavy rain, snow, haze}, a total of 7 categories. After One-Hot encoding, the dimension is 7, and each dimension takes a value of 0 or 1; or integer encoding {0, 1, 2, 3, 4, 5, 6} is used, which is mapped to a continuous vector space through the embedding layer.

[0063] Time period Cyclic encoding or segmented encoding can be used. For example, the 24 hours can be divided into 8 time periods (0:00-3:00, 3:00-6:00, ..., 21:00-24:00), using One-Hot encoding in 8 dimensions; or sine or cosine cyclic encoding can be used. or To preserve the periodicity of time, the encoding dimension is 2-dimensional.

[0064] Schedule Activity Types It employs a combination of predefined category encoding and embedding. For example, the activity type set is defined as {work meeting, fitness, travel, medical appointment, family gathering, study preparation, no specific arrangements}, a total of 7 categories. The embedding matrix can be learned on the client side and mapped to an 8-dimensional continuous vector. The embedding matrix has a dimension of 7×8 and is randomly initialized when the user uses it for the first time. It is then fine-tuned locally based on user feedback.

[0065] User color preferences RGB color space normalization or predefined style tag encoding is used. For example, if the user sets the preferred color to RGB value (255,128,0), it is normalized to [1.0,0.5,0.0]; or the style tag {warm, cool, neutral, high saturation, low saturation} is used for one-hot encoding in 5 dimensions.

[0066] In a preferred embodiment of the invention, the normalization of user physiological signals and acceleration and gyroscope data is further included. Specifically, the user physiological signals (taking heart rate as an example) are Z-score normalized based on the mean of the user's historical heart rate data. and standard deviation Normalization is performed using the following formula: The output range is approximately [ [3,3], if the range is exceeded, it will be truncated. If the user's historical data is insufficient (e.g., first-time user), the default value for the user demographics will be used. =72, =12); Acceleration and gyroscope data are encoded using sliding window statistical features. The three-axis acceleration data within the last 10 seconds can be taken, and the mean, standard deviation, maximum value, and minimum value of each axis are calculated, for a total of 12 dimensions (3 axes × 4 statistics). Each statistic is normalized to [0,1] by Min-Max.

[0067] Each of the above dimensions is independently encoded and then concatenated in a fixed order to form the original feature vector. This vector is then mapped to a unified target dimension (such as 64 or 128 dimensions) using the aforementioned feature concatenation or attention fusion strategy. Finally, it is normalized using L2 to obtain the final vector. Its modulus is 1, which facilitates subsequent cosine similarity calculation with the knowledge base vector.

[0068] The multidimensional contextual feature vector is then passed to the engine layer for caching and management. This vector will serve as the unified contextual input for subsequent identity template matching in the engine layer and relevance knowledge retrieval in the knowledge layer.

[0069] Preferably, the caching and management mechanism of the multi-dimensional contextual feature vector at the engine layer includes: Cache Structure: The engine layer maintains a circular buffer with a capacity set to store multi-dimensional contextual feature vectors from the most recent N moments (for example, N=10, corresponding to approximately 5 minutes of historical context, calculated based on sampling every 30 seconds). Each vector entry is accompanied by a timestamp and a confidence score. The confidence score is generated by data integrity checks (e.g., a confidence score of 1.0 for a sensor data missing rate below 20%, a confidence score of 0.5 for a missing rate between 20% and 50%, and the vector for that moment is discarded if the missing rate is above 50%).

[0070] Temporal modeling: When performing identity template matching, the engine layer can use not only the current time-stamp vector, but also an aggregated representation of the vectors from the most recent k time-stamps (for example, k=3). Aggregation methods include mean pooling, max pooling, or a time-decay-based weighted average (weights...). ,in The attenuation coefficient is... (Time interval).

[0071] Vector persistence: The multidimensional context feature vector at the current moment is encrypted and written to the context cache area of ​​the user's dedicated storage partition, using AES-256 encryption. The key is bound to the user's identity. The vector file format is a binary floating-point array (.bin) or Protocol Buffers serialization format, with each file occupying approximately [size missing]. Byte (FP32) or A single 128-dimensional FP32 vector is approximately 512 bytes (FP16). The context buffer has a capacity limit (exemplarily 10MB), and when the limit is exceeded, it is overwritten in a cyclic manner according to the timestamp from oldest to newest.

[0072] Vector update frequency: Sensor data is sampled and updated every 30 seconds. Local data sources (such as calendar events) trigger real-time updates when system calendar changes are detected. User profile preferences are updated when users actively modify them. After each vector update, the engine layer re-executes the identity template matching logic. If an identity switching condition is detected (such as switching from "weekday template" to "fitness template"), a confirmation prompt is pushed to the user or the switch is automatic (based on the user's preset switching strategy).

[0073] S2, after a user logs in, the data layer mounts the corresponding physically isolated encrypted storage partition according to the user.

[0074] Specifically, the data layer sends a partition mount request to the security hardware of the terminal device. After verifying the trustworthiness of the current operating environment, the security hardware uses the decryption key bound to the user's identity to unlock the corresponding encrypted storage partition and maps the storage space of the partition to the file system namespace of the current computing environment. The data in the partition cannot be mounted or addressed in the current computing space.

[0075] In this step, the data layer also cleans up temporary caches and intermediate states in the current computing environment to prevent data left over from the previous user from remaining in memory or cache, ensuring the purity of the computing environment. At the same time, the data layer sets file access control policies, restricting all processes in the current computing environment to access only the mounted user-specific partitions. Any cross-partition access requests are intercepted by the underlying operating system and return an "insufficient permissions" error response.

[0076] S3. After the data space switch is completed, the knowledge layer executes the knowledge base loading process after confirming that the encrypted storage partition corresponding to the current user has been successfully mounted. Figure 4 This diagram illustrates the knowledge base loading process of a context-aware generation method for a physically isolated single-user-side private knowledge base. Please refer to [link / reference]. Figure 4 The specific process is as follows: S31, the knowledge layer first scans the knowledge base index file in the user's dedicated storage partition to determine whether the user is logging in for the first time.

[0077] If this is the user's first login and the knowledge base index file is empty, the knowledge layer jumps to the initialization construction process: iterates through all historical data in the user's private data space, calls the client-side lightweight natural language processing model and visual encoder to perform entity recognition, relation extraction and vectorization encoding, builds the initial knowledge graph and vector library, and generates the corresponding index file and writes it to the storage partition.

[0078] S33, if the user is not logging in for the first time, the knowledge layer reads existing knowledge graph nodes and edge data or vector indices and their corresponding metadata from the vector library. Under normal operating conditions, the knowledge layer monitors data change events in the user's dedicated storage partition. When new data is detected (such as a new outfit photo uploaded by the user, a new schedule entry, or a new preference entry), the knowledge layer triggers an incremental update: For newly added structured data (such as user tag settings), it is directly parsed and converted into entities and attributes in the knowledge graph; For newly added unstructured data (such as images and text), the edge model is called to extract feature vectors, clustering algorithms or similarity retrieval are used to determine its relationship with existing knowledge units, and then it is incrementally inserted into the vector library; Preferably, the specific implementation of the above clustering algorithm or similarity retrieval is as follows: For newly added unstructured data, the knowledge layer first calls the end-side encoder to extract feature vectors, and then uses a similarity retrieval algorithm based on approximate nearest neighbors (such as HNSW or IVF-PQ) to retrieve the k existing knowledge units in the current vector library that are most similar to the newly added vector (the value of k is specified by the number of similarity retrieval neighbors in the engine layer recall strategy parameter, for example, k=10).

[0079] Similarity is measured using cosine similarity or dot product. The similarity score between the new vector and each existing vector in the search results is calculated, and the highest similarity score, s_max, is taken. If s_max is greater than a preset association threshold τ (for example, τ=0.75), the new knowledge unit is determined to have a strong association with the existing knowledge unit corresponding to the highest score. It is then inserted into the knowledge graph as a child node or attribute of the existing knowledge unit, inheriting its modality label and contextual association weight. If s_max is between the threshold τ and the lower threshold τ_low (for example, τ_low=0.5), a weak association is determined. A "related" relationship edge is established in the knowledge graph, and the association confidence is recorded. If s_max is lower than τ_low, the new knowledge unit is determined to be an independent new concept. A new node is created in the knowledge graph, and its metadata is initialized based on the modality type and contextual features of the new vector.

[0080] Meanwhile, for the clustering algorithm scheme, when the cumulative number of newly added knowledge units reaches the preset batch threshold (for example, 50), the knowledge layer triggers local clustering on the edge (using DBSCAN or K-Means algorithm) to discover potential topic clusters in the newly added data, assigns common topic labels to knowledge units in the same cluster, and updates the cluster center vector as the centroid vector of the topic and stores it in the auxiliary index structure of the vector library.

[0081] The index update strategy is as follows: When one or more vectors are incrementally inserted, the knowledge layer does not perform a full index reconstruction. Instead, an incremental index update mechanism is adopted. That is, for the HNSW-based index structure, a dynamic node insertion method is used. The new vector is inserted into the graph structure layer by layer according to the HNSW hierarchical strategy, and the neighbor list of each layer is updated without rebuilding the existing graph. For the IVF-based index structure, the new vector is assigned to the corresponding inverted chain according to its cluster center. Only the vector list and center vector statistics (mean and standard deviation) of the inverted chain are updated.

[0082] To ensure real-time retrieval, incremental insertion operations are executed asynchronously in an independent thread on the client side. During insertion, the vector library continues to provide read-only retrieval services, and the system atomically switches to the new index version after insertion is complete. The similarity thresholds τ and τ_low are set based on the distribution of positive and negative samples in the user's historical feedback data, and are adaptively adjusted—if the user's positive feedback rate for strongly correlated recall results is higher than the preset expectation (e.g., >60%), the τ value is appropriately increased to reduce false recalls of weakly correlated results; if the positive feedback rate is low, the τ value is decreased to improve recall coverage. The adjusted thresholds are written to the knowledge layer configuration file in the user's dedicated storage partition for subsequent incremental updates.

[0083] S34. Update the corresponding index file to ensure that subsequent searches include the new knowledge.

[0084] The knowledge layer operates solely on data within the current user's dedicated encrypted storage partition, without reading any other user's data partitions, performing cross-user aggregation training, or uploading any user's original data or intermediate features to external devices.

[0085] S4: After the user's private knowledge base is loaded, the engine layer automatically activates the corresponding identity template based on the current user's selected status role.

[0086] Specifically, the engine layer first reads the identity template configuration file (stored in a user-specific storage partition, isolated from the user) to obtain a list of all identity templates selected by that user. Different users can choose different combinations of identity templates according to their own needs.

[0087] The engine layer determines the identity template that should be activated based on one or a combination of the following mechanisms: User-initiated selection: The engine layer receives a manual selection instruction from the user for a specific identity template through the user interface, and then activates the corresponding template accordingly.

[0088] Automatic reasoning: Based on the multi-dimensional context feature vector obtained in S1, the engine layer uses a preset rule engine or a lightweight classification model on the edge (such as decision tree, logistic regression, etc.) to perform reasoning and automatically match the identity template most suitable for the current context.

[0089] After determining the active identity template, the engine layer loads the identity template configuration file from the local configuration storage. This template contains a complete set of algorithm parameters, including but not limited to the following: Recall strategy parameters: upper limit K value for the number of knowledge units recalled, similarity threshold, and weight coefficient of multimodal features in similarity calculation; Filtering rule parameters: blacklist of knowledge categories to be prohibited from recommendation, keyword filtering rules, and security level thresholds; Generative model control parameters: temperature coefficient, top-k sampled values, maximum output length; Prompt Template: Template text used to constrain the style and form of generated content. It can embed descriptions of the current identity / role, tone and style constraints, content format requirements, etc.

[0090] The temperature coefficient is a hyperparameter that controls the randomness of the output of the generation model. Its value range is usually 0 to 1. The lower the value, the more deterministic the output tends to be, and the higher the value, the stronger the output diversity. The top-k sampling parameter is used to limit the candidate word range of each generation step to the k words with the highest probability. The smaller the value of k, the more deterministic the output tends to be, and the larger the value of k, the stronger the output diversity. The maximum output length is used to limit the upper limit of the total number of words in the generated content.

[0091] After the above parameters are loaded, the engine layer will pass the recall strategy parameters to the retrieval interface of the knowledge layer, and pass the filtering rules and generation model parameters to the subsequent generation module to realize the synchronous switching of algorithm logic.

[0092] To ensure isolation in multi-user shared device scenarios, each user's identity template configuration and its corresponding algorithm parameters are stored in a dedicated encrypted storage partition for that user. When the data layer switches between different user spaces, the engine layer synchronously unloads the previous user's template configuration and loads the current user's configuration, maintaining isolation between different users' template configurations at both the storage and memory levels.

[0093] S5, after completing the preparation processes at each of the above layers, can perform context-aware personalized content generation based on the user's specific needs. Figure 5 This diagram illustrates the context-aware personalized content generation process of a context-aware generation method using a physically isolated single-user-side private knowledge base. Please refer to [link / reference]. Figure 5 The specific process is as follows: S51, Receive a query request input by the user. The query can take various forms: user input via voice (e.g., saying "What to wear today?"), text input (e.g., typing "Recommend outfits for today" in the search box), image input (e.g., taking a photo of existing clothing), or implicit query (the user simply opening the application interface is considered the default query request). The input query is parsed on the client side. For voice queries, the client-side speech recognition model is used to convert it into text; for image queries, the client-side image understanding model is used to extract features such as object category, color, and style from the image; for text queries, the client-side natural language understanding model is used to extract the query intent and key constraints.

[0094] Preferably, the aforementioned edge-side speech recognition model adopts a Whisper-Tiny architecture with approximately 39M parameters, 4 encoder layers, and 4 decoder layers. After INT8 quantization, the model file size is approximately 40MB. Using the ONNX Runtime or TensorFlow Lite inference framework, the real-time factor (RTF) on ARM Cortex-A76 is approximately 0.5~1.0. The edge-side image understanding model adopts a lightweight multimodal alignment architecture, such as a combination of a CLIP ViT-B / 32-based visual encoder (approximately 86M parameters) and a projection layer. After INT8 quantization, the model file size is approximately 90MB. Using the ONNX Runtime inference framework, the feature extraction latency for a single image is approximately 50ms~100ms. The edge-side natural language understanding model adopts a BERT-Tiny or DistilBERT backbone network shared with the aforementioned entity recognition task. Multi-task output is achieved by adding an intent classification head and a slot filling head. After INT8 quantization, the model file size is approximately 5MB~25MB, and the inference latency for a single query is approximately 10ms~50ms. All of the above models are deployed in the memory space of the current user's independent computing environment. The model weight file is stored in the model parameter storage area of ​​the user's dedicated storage partition. It is only loaded into memory after the user's authentication is successful, and is unloaded and the model cache is cleared when the user logs out.

[0095] In step S52, the knowledge layer receives the recall strategy parameters from the engine layer and uses the multi-dimensional contextual feature vector generated in S1 as the query vector to perform similarity retrieval in the current user-specific private vector library. Specifically, the knowledge layer calculates the relevance score between each knowledge unit and the multi-dimensional contextual feature vector using vector dot product or cosine similarity, and filters candidate knowledge units according to the recall limit and similarity threshold specified by the engine layer.

[0096] During the recall process, the knowledge layer can apply differentiated weighting to knowledge units of different modalities based on the recall strategy parameters of the engine layer.

[0097] Preferably, the specific implementation of multimodal feature differential weighting and cross-modal similarity unified calculation includes the following steps: S521, Modal Semantic Space Alignment: Since text feature vectors and image feature vectors are generated by different encoders, their original semantic space dimensions and distribution characteristics differ. For example, text features are generated by an edge-side text encoder (e.g., all-MiniLM-L6-v2), with a dimension of 384, and their values ​​are distributed on a unit hypersphere after L2 normalization; image features are generated by an edge-side visual encoder (e.g., MobileNet-V3-Small), with a dimension of 1280, and their values ​​are also distributed on a unit hypersphere after global average pooling and L2 normalization. To unify the calculation of similarity, the knowledge layer uses a Modality Projection Network to map each modality feature to a unified cross-modal alignment space. For example, the alignment space dimension is set... Text modal projection matrix With image modal projection matrix After initialization on the device side, fine-tuning can be performed based on the user's local multimodal association data. The projected feature vector... and All modal features are L2 normalized to ensure that they have comparable geometric distances in a unified space.

[0098] S522, Modality-Specific Context Subvector Extraction: Multidimensional Context Feature Vector Different dimensions correspond to different contextual semantics. The knowledge layer will... Semantically categorized into modality-related sub-vectors: text-related sub-vectors (Such as dimensions corresponding to schedule event descriptions, user query intent text encoding, weather condition text labels, etc.), image-related sub-vectors (such as dimensions corresponding to ambient light intensity, color preference, and geographic location scene labels), and general context sub-vectors. (Such as modality-independent dimensions like time, temperature, and user physiological state). The dimensionality partitioning of subvectors is specified by the recall strategy parameters in the engine layer identity template. For example, The corresponding text-related context dimensions (of which the embedded description of schedule events accounts for 32 dimensions, the text encoding of user query intent accounts for 16 dimensions, and the embedded text tags of weather conditions account for 16 dimensions). The corresponding image-related context dimensions are as follows: ambient light intensity normalized value accounts for 8 dimensions, color preference RGB encoding accounts for 24 dimensions, geographic location scene label embedding accounts for 16 dimensions, and current activity visual scene description accounts for 16 dimensions. Corresponding to the general context dimensions (of which time encoding accounts for 16 dimensions, temperature normalized value accounts for 8 dimensions, user heart rate Z-Score accounts for 8 dimensions, acceleration statistical features account for 24 dimensions, and gyroscope statistical features account for 8 dimensions), when hour, The concatenation of each sub-vector completely covers the context feature space.

[0099] S523, Differentiated Weighted Similarity Calculation: For the first... There are knowledge units, and their modal types are denoted as follows: The projected feature vector is The relevance score Sj between the knowledge unit and the context vector is calculated using the following formula:

[0100] in, Represents cosine similarity. For modality The intramodal context weight coefficient is specified by the identity template currently active in the engine layer. The general context weights ensure that even if the modality-specific subvectors do not perfectly match the knowledge units, the general context (such as time or physiological state) can still contribute to the relevance score.

[0101] For example, if the currently activated template in the engine layer is the one corresponding to "pregnant woman", and the user queries "outfit recommendations", the image modality weights... Text modality weights Specifically, image knowledge units (clothing images) primarily match image-related contextual sub-vectors (color preferences, ambient light), while text knowledge units (outfit guide text) primarily match general contextual sub-vectors (time, temperature). When the query is switched to "recipe recommendations," the engine layer dynamically adjusts... , Textual knowledge units (ingredient descriptions, cooking steps) receive higher intramodal context matching weights.

[0102] S524, The weighting coefficients are determined based on the modal weighting coefficients. The determination follows these principles: The engine layer parses the user's query intent (e.g., "outfit recommendations" prioritizes visual modality, while "learning plans" prioritizes text modality), and drives the initialization of the modality mapping table (stored in the identity template configuration file) based on the query intent. The mapping table is defined as follows: Outfit / Scene Class Query , Knowledge / Text Query , Multimodal integrated query .

[0103] If the confidence of a modality-related subvector in the current multidimensional contextual feature vector is lower than a threshold (e.g., sensor absence leads to incomplete image-related context), then the weight of that modality is automatically reduced. ,in This is the modal confidence decay factor, which is calculated in real time by the interaction and perception layers based on data integrity.

[0104] The knowledge layer records user feedback behavior to different modal recall results (such as the ratio of clicking on image results vs. clicking on text results). When the cumulative positive feedback ratio of a certain modality exceeds a threshold (such as 70%), it is fine-tuned and updated on the device side using gradient descent. The learning rate is set to 0.01, and the update formula is:

[0105] in The positive feedback ratio, For the learning rate, after the update Cut off to the interval [0,1].

[0106] Calculate the relevance score for all knowledge units. Then, the knowledge layer places knowledge units from different modalities into a unified candidate pool, according to... The data is sorted in descending order, and the final candidate set is selected based on the recall limit K specified by the engine layer and the global similarity threshold θ (e.g., θ=0.6). During the sorting process, if there are multimodal knowledge units of the same entity (e.g., an image and text description of a piece of clothing), a maximum score deduplication strategy is adopted to retain only the knowledge unit with the highest score for that entity, thus avoiding duplicate recall.

[0107] The knowledge layer encapsulates the recalled candidate knowledge units, their relevance scores, and metadata information into a candidate knowledge set, which is then passed to the engine layer for content generation.

[0108] S53, the engine layer interprets, synthesizes, and generates suggestions for knowledge units in the candidate knowledge set based on the loaded generation control parameters and prompt templates.

[0109] Specifically, the engine layer first performs security filtering on the candidate knowledge set according to filtering rules, eliminating knowledge units that belong to prohibited recommendation categories or contain blacklisted keywords. Then, the candidate knowledge set is sorted according to relevance scores, and combined with the current multi-dimensional contextual feature vector and user query intent, it is populated into the prompt template to construct the input context for the generative model.

[0110] The engine layer infers and generates data from the input context by calling a lightweight generative model on the device side (such as a small language model or a multimodal generative model deployed on the device side). Temperature coefficient, top-k sampling parameters, and maximum output length can be selected as generation control parameters.

[0111] Preferably, the aforementioned lightweight generation model on the edge adopts a decoder-only Transformer architecture with instruction fine-tuning and quantization compression.

[0112] For example, the model parameter size is selected from the range of 100M to 2B parameters, preferably 100M to 500M parameters to balance generation quality and edge inference efficiency, such as Qwen2-0.5B (approximately 0.5B parameters, 896 hidden layer dimensions, 24 layers, 12 attention heads), TinyLlama-1.1B (approximately 1.1B parameters, 2048 hidden layer dimensions, 22 layers, 4 attention heads), or Gemma-2B (approximately 2B parameters, 2048 hidden layer dimensions, 18 layers, 8 attention heads).

[0113] The aforementioned models are deployed after INT4 or INT8 weight quantization, with quantization methods including GPTQ, AWQ, or GGUF format integer quantization. The key-value cache (KV Cache) uses FP16 or INT8 precision storage. The inference framework employs a C++-based Llama series model efficient inference engine, a machine learning compilation framework for large language models (MLC-LLM), a TensorFlow Lite generative API, and an ONNX Runtime GenAI extension for optimized runtime of large language models and diffusion models.

[0114] After INT4 quantization, the file size of the 0.5B parameter model is approximately 300MB~400MB, the 1.1B parameter model is approximately 700MB~900MB, and the 2B parameter model is approximately 1.2GB~1.6GB. On terminal devices equipped with NPU (Neural Processing Unit) or TPU (Tensor Processing Unit), the generation and inference speed is approximately 5~20 words / second, and on a pure CPU architecture, it is approximately 1~5 words / second. The maximum context length of the generated model is set to 2048~4096 words, the temperature coefficient ranges from 0.1 to 1.0, the top-k sampling parameter ranges from 1 to 100, and the maximum output length ranges from 50 to 512 words.

[0115] The generated model parameter configuration file and the quantized model weight file are both stored in the model parameter storage area of ​​the current user's dedicated storage partition. The generated model configurations of different users are completely isolated at the storage and memory levels.

[0116] For example, when the "children's template" is activated, the temperature coefficient is set to a low value (such as 0.3) to ensure the determinism of the output content, and the template is prompted to embed constraint descriptions such as "please use simple language that children can understand"; when the "weight loss template" is activated, the template is prompted to embed constraint descriptions such as "please provide low-calorie options".

[0117] S54, based on the current user identity and real-time context, outputs the generated result. The generated result may take the form of text, image, voice, or a multimodal combination (such as a visual card with text suggestions paired with recommended clothing images).

[0118] S6, after outputting context-aware content to the user, the interaction and perception layer receives the user's feedback behavior on the generated content, including but not limited to explicit feedback (such as the user clicking the "like" or "dislike" button on the recommended content, rating, etc.) and implicit feedback (such as whether the user adopts the recommendation, the length of browsing time, whether secondary editing is performed, etc.).

[0119] The knowledge layer associates user feedback with current multi-dimensional contextual features and the user, recording it in a feedback log within the user's dedicated storage partition. When the accumulated feedback data reaches a preset threshold, the knowledge layer triggers a local model update on the client side: strengthening the weight of corresponding knowledge units based on positive user feedback, and reducing the weight of corresponding knowledge units or adding them to the filter list based on negative feedback. This ensures that subsequent generated results continuously approach user preferences, achieving a closed-loop self-evolution of the private knowledge base.

[0120] Preferably, the incremental updates of the aforementioned local model employ the Parameter-Efficient Fine-Tuning (PEFT) method to reduce on-device computation and storage overhead. For example, using LoRA (Low-Rank Adaptation) or QLoRA fine-tuning strategies, while freezing the main parameters of the pre-trained model, low-rank adaptation matrices are injected into the attention module and fully connected layer of the Transformer layer. The LoRA rank r is set to 8–64, and the scaling parameter α is set to 16–128, updating only approximately 0.1%–1% of the total parameters. The fine-tuning data is constructed based on feedback logs accumulated in the user's dedicated storage partition, including user query intent, multi-dimensional contextual feature vectors, generated output results, and explicit / implicit feedback labels.

[0121] When the number of feedback log entries reaches a preset threshold (for example, 100), a local fine-tuning process is triggered: a training batch is constructed by sampling from the feedback logs, using the AdamW optimizer with a learning rate of 1e-4 to 5e-4 and a training epoch of 1 to 3. Gradient calculation and parameter updates are performed in an independent computing environment on the device. After fine-tuning, only the updated low-rank adaptation matrix (file size approximately 1MB to 10MB) is saved and loaded in combination with the base model weights. The original pre-trained weights are not modified to ensure the rollback capability of the model update. The above fine-tuning process only accesses data in the current user's dedicated storage partition, does not introduce any cross-user data, and all gradient calculations and parameter updates are completed in a trusted execution environment or an independent computing environment on the device. The updated adaptation matrix file is encrypted and stored in the model parameter storage area of ​​the user's dedicated storage partition.

[0122] Data transfer between the above layers and steps is carried out through the independent computing environment memory space of the same user, and there is no cross-user data channel.

[0123] The core technological contribution of this invention does not lie in the technological innovation of any single layer among the data layer, interaction and perception layer, knowledge layer, or engine layer, but rather in the organic integration of these four layers into a complete edge-side intelligent system in a specific manner. Specifically, the data layer completely blocks cross-user data access through physical isolation and hardware encryption; the interaction and perception layer integrates multi-source sensor signals and local static data to generate a unified multi-dimensional contextual feature vector, perceiving the user's current scenario in real time; the knowledge layer constructs a vector library and knowledge graph based solely on single-user private data, achieving local knowledge closed-loop evolution through incremental updates to ensure that generated content originates from user-specific information; the engine layer automatically matches the contextual vector or the user-selected identity template, synchronously switching recall strategies, filtering rules, and generation parameters to ensure that the output content is highly aligned with the user's identity. The four layers use contextual vectors and template configuration as a unified interface, and all calculations are completed in a trusted edge-side environment without uploading any data, fundamentally preventing privacy leaks while simultaneously achieving personalized intelligent services with contextual adaptation, switchable identities, and self-evolving knowledge.

[0124] This embodiment uses outfit recommendation as an example for illustration. Those skilled in the art should understand that by replacing the private data types in the data layer (such as replacing outfit data with an ingredient library, exercise records, or reading lists), modifying the entity definitions in the knowledge layer (such as defining the entity relationship as "ingredient-nutrition-taste" instead of "clothing-scene-style"), and configuring the identity template parameters in the engine layer (such as setting "patient template" or "graduate student template"), this method can be applied to other personalized content generation scenarios without departing from the protection scope of this invention.

Claims

1. A method for generating a context-aware knowledge base on a physically isolated single-user-side client, characterized in that, A multi-layered architecture is built for each user on the terminal device, which includes a data layer, an interaction and perception layer, a knowledge layer, and an engine layer. The data layer maps the user's private data storage instance to the current independent computing environment based on the physical isolation encrypted storage partition mounted by the currently logged-in user, thus completing the physical isolation switching of the data space; The interaction and perception layer acquires environmental state sensor data and performs spatiotemporal alignment and feature fusion with locally stored multi-source data to form a multi-dimensional context feature vector with temporal attributes. The knowledge layer only loads data from the user's exclusive encrypted storage instance to build an initial vector library or knowledge graph; when new local data is detected, incremental updates are performed on the new data on the device side, and no user's original data or intermediate features are uploaded to the external device side. The engine layer automatically identifies the identity template that the user should match in the current scenario based on the multi-dimensional context feature vector, or automatically activates the corresponding identity template and loads the recall strategy, filtering rules and generation model parameter configuration corresponding to the template based on the identity template actively selected by the user through the interactive interface.

2. The method for generating a context-aware private knowledge base on a physically isolated single-user-side device according to claim 1, characterized in that, When switching users, the data layer clears the temporary cache and intermediate state in the current computing environment and sets file access control policies to intercept any cross-partition access requests. Each physically isolated encrypted storage partition is protected by an independent encryption key, which is stored in the secure hardware of the terminal device and is completely isolated from the keys of other users.

3. The method for generating a context-aware private knowledge base on a physically isolated single-user side according to claim 1, characterized in that, The multidimensional contextual feature vector is passed to the engine layer for caching and management, serving as a unified contextual input basis for the engine layer to perform identity template matching and for the knowledge layer to perform relevant knowledge retrieval.

4. The method for generating a context-aware private knowledge base on a physically isolated single-user-side device according to claim 1, characterized in that, After the knowledge layer successfully mounts the physically isolated encrypted storage partition corresponding to the currently logged-in user, it constructs and maintains a private vector library or knowledge graph on the client side based on the data in the encrypted storage partition dedicated to that user. When the user logs in for the first time, it traverses the historical data in the user's private data space, calls the client-side lightweight natural language processing model to perform named entity recognition and relation extraction, calls the client-side lightweight visual encoder to extract image feature vectors, calls the client-side text encoder to map the text content into vector representations, stores the entity relations into the knowledge graph, stores the vector representations into the vector library and establishes an index.

5. The method for generating a context-aware private knowledge base on a physically isolated single-user side according to claim 4, characterized in that, The knowledge layer monitors data change events in the dedicated storage partition of users who are not logging in for the first time. When new data is detected, an incremental update process is triggered: for new structured data, it is directly parsed and converted into entities and attributes in the knowledge graph; for new unstructured data, the edge model is called to extract feature vectors, and clustering algorithms or similarity retrieval are used to determine its relationship with existing knowledge units. Then, it is incrementally inserted into the knowledge graph or vector library and the corresponding index file is updated.

6. The method for generating a context-aware private knowledge base on a physically isolated single-user-side device according to claim 1, characterized in that, The engine layer has multiple built-in identity templates, each of which corresponds to a complete set of algorithm logic configurations. Each identity template is stored in the user's dedicated storage partition in the form of a configuration file. The configuration content includes recall strategy parameters, filtering rule parameters, generation model parameters, and prompt templates.

7. The method for generating a context-aware private knowledge base on a physically isolated single-user-side device according to claim 6, characterized in that, The recall strategy parameters include the upper limit of the number of knowledge units to be recalled, the similarity threshold, the ranking weight coefficient, and the weight coefficient of multimodal features in the similarity calculation; the filtering rule parameters include the knowledge categories to be prohibited from recommendation, the keyword blacklist, and the security level threshold; the generation model parameters include the temperature coefficient, the top-k sampling parameters, and the maximum output length; the prompt template is used to embed the current identity role description, tone style constraints, and content format requirements.

8. The method for generating a context-aware private knowledge base on a physically isolated single-user side according to claim 1, characterized in that, During the recall process at the engine layer, the knowledge layer uses vector dot product or cosine similarity to calculate the relevance score between each knowledge unit and the multidimensional contextual feature vector, and filters candidate knowledge units according to the recall limit and similarity threshold specified by the engine layer. The knowledge layer applies differentiated weights to knowledge units of different modalities based on the recall strategy parameters of the engine layer.

9. A method for generating a context-aware private knowledge base on a physically isolated single-user side according to claim 1, characterized in that, The engine layer first performs security filtering on the candidate knowledge set according to the filtering rules, eliminating knowledge units that belong to the prohibited recommendation category or contain blacklist keywords; then, it sorts the candidate knowledge set according to the relevance score, and fills the prompt template with the current multi-dimensional context feature vector and the user's query intent to construct the input context of the generation model. The engine layer calls the lightweight generative model on the client side, and performs inference generation using temperature coefficient, top-k sampling parameters, and maximum output length as generation control parameters.

10. A method for generating a context-aware private knowledge base on a physically isolated single-user-side device according to claim 1, characterized in that, The terminal device integrates an embedded secure element or a trusted execution environment built on hardware isolation technology to achieve physical isolation storage and secure computation of user data; the terminal device is also equipped with a multimodal sensor hub for unified management of end-side sensing devices including accelerometers, gyroscopes, temperature sensors, heart rate sensors and ambient light sensors.

Citation Information

Patent Citations

  • Graph neural network federal recommendation method for privacy protection

    CN113420232A

  • Multi-user partition isolation method based on security chip

    CN114357514A

  • Context awareness strategy recommendation system based on edge calculation and supervised learning method

    CN114490053A

  • Data isolation device and method based on operating system user and electronic equipment

    CN117852057A

  • Vehicle-mounted interaction recommendation method and system based on end side state depth reasoning

    CN121434502A