A personalized language model adapter generation method, device, equipment and medium

By separating user life log data into a four-layer progressive structure and further separating it into style, knowledge, preference, and judgment signals, and employing milestone gating and the TIES algorithm to merge adapters, the problems of high inference cost, signal interference, and privacy leakage in personalized AI assistants are solved, achieving efficient and secure training and deployment of personalized language model adapters.

CN123157879APending Publication Date: 2026-11-24BEIJING MULTISCREEN FUTURE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611528653.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-29
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing technical solutions for personalized AI assistants suffer from problems such as high inference costs, signal interference, models unable to reason according to the user's thinking, privacy leaks, and low-quality adapters due to insufficient training data.

Method used

User life log data is processed into cognitive data with a four-layer progressive structure and separated into four independent distillation pipelines: style, knowledge, preference, and judgment. Milestone gating training and TIES algorithm merging adapter are used, a three-threshold deployment gate is set, and a Replay mixing mechanism is used during incremental training.

Benefits of technology

It enables efficient, secure, and interpretable training of personalized language model adapters, optimizes computing resources, improves signal quality, prevents model quality degradation and privacy leaks, and prevents catastrophic amnesia.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157879A_ABST
    Figure CN123157879A_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and medium for generating a personalized language model adapter. It processes user life logs into cognitive data with a four-layer progressive structure, separating them into four independent distillation pipelines: style, knowledge, preference, and judgment. The judgment pipeline is explicitly excluded from model weights but distilled into a searchable decision case library. Milestone-gated training is employed, with dual adapters trained independently and then merged via TIES. Deployment is performed after verification using a three-threshold deployment gate, and replay sampling is used during incremental training to prevent catastrophic forgetting. This invention achieves efficient, secure, and interpretable training and deployment of a personalized language model adapter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a method, apparatus, device and medium for generating a personalized language model adapter. Background Technology

[0002] The current mainstream approach for personalized AI assistants is to store user data in a vector database and retrieve relevant memory fragments each time a user queries using Retrieval-Augmented Generation (RAG), injecting them into the context window of a Large Language Model (LLM) for temporary synthesis. The drawbacks of this approach are: each query consumes a large number of context tokens (approximately 3000 tokens / query), resulting in high inference costs that increase linearly with query frequency; the model lacks the user's cognitive patterns, only able to temporarily piece together retrieved fragments, and cannot reason or generate based on the user's thought process; and it lacks the ability to "judge / generate on behalf of the user"—it can only "help the user recall."

[0003] Another approach is to directly use user dialogue data for LoRA (Low-Rank Adaptation) fine-tuning, attempting to make the model "learn" everything about the user. Its drawbacks include: mixing style, knowledge, preference, and judgment signals during training, leading to signal interference (style training washes out knowledge, and knowledge training changes style); using fixed-period (e.g., weekly) training triggers low-quality adapters when data accumulation is insufficient, wasting computational resources; attempting to encode "judgment" into LoRA weights, but judgment is essentially a complex inference chain, and low-rank matrices struggle to effectively encode abstract inference patterns, especially given the sparse nature of training data; lacking effective deployment quality gating mechanisms, potentially leading to progressively worse performance; lacking a systematic solution to prevent catastrophic forgetting, as new data training can easily overwrite old capabilities; and posing a risk of training data leakage, as the model might verbatim output the user's private dialogue during inference.

[0004] Another approach uses carefully designed system prompts to describe the user's style and preferences, guiding a general model to mimic the user. Its drawbacks include: limited depth of style imitation, only guiding rather than internalizing; each inference requires a prompt token; small-parameter models have a weak ability to follow complex personality prompts; and it cannot achieve team capability aggregation.

[0005] Therefore, there is an urgent need in this field for a technical solution that can efficiently and securely transform the multidimensional cognitive signals contained in users' life logs into personalized language model adapters. Summary of the Invention

[0006] This application provides a method, apparatus, device, and medium for generating a personalized language model adapter to solve the above-mentioned technical problems.

[0007] In view of this, the first aspect of this application provides a method for generating a personalized language model adapter, the method comprising: Step S1: Process the user's life log data into cognitive data with a four-layer progressive structure, which includes an event layer, a fact layer, an observation layer, and a mental model layer, and continuously collect preference signals from the user's interaction with the system. Step S2: The cognitive data is separated into four independent distillation lines for processing. The first path distills the user text expression features contained in the event layer into style training data pairs; The second approach compiles the structured knowledge facts clustered in the fact layer and the observation layer into knowledge question answering training data pairs; The third path converts the preference signal into direct preference optimization training data pairs; The fourth approach distills the decision-type facts in the fact layer into structured decision cases and stores them in a searchable decision case library instead of using them as model training data. Step S3: Using the cumulative number of data pairs whose quality scores exceed a preset quality threshold in various training data sets reaching a preset threshold as the training trigger condition, perform independent training and merging of the dual adapters, specifically including: Train the representation adapter using the data from the first path and the third path; Train the knowledge adapter independently using the data from the second path; The expression adapter and the knowledge adapter are merged into a personalized language model adapter using the TIES algorithm; During incremental training, the training data is composed of a mixture of new data and historical data, wherein the historical data is sampled from the historical training data according to a quality-weighted strategy. Step S4: Perform win rate evaluation, style similarity evaluation, and knowledge accuracy evaluation on the personalized language model adapter. If all three evaluations pass the threshold, the personalized language model adapter can be deployed. If any evaluation fails, it will be rolled back to the previous version.

[0008] A second aspect of this application provides a personalized language model adapter generation apparatus, the apparatus comprising: The hierarchical memory accumulation module is configured to process user life log data into cognitive data with a four-layer progressive structure and collect preference signals. The four-channel signal separation and distillation module is configured to separate the cognitive data into four independent distillation pipelines for processing training data pairs; The milestone gating training trigger module is configured to use the accumulation of training data reaching a preset quality threshold as the training trigger condition. The incremental training data mixing module is configured to mix new data with data sampled from historical data using a quality-weighted strategy during incremental training. The dual-adaptor training and TIES merging module is configured to independently train the expression adapter and the knowledge adapter, and then merge the expression adapter and the knowledge adapter into a personalized language model adapter using the TIES algorithm. The three-threshold deployment gate module is configured to evaluate the merged personalized language model adapter based on three criteria: win rate, style similarity, and knowledge accuracy. If all three evaluations pass the threshold, the personalized language model adapter can be deployed. If any evaluation fails, the system will roll back to the previous version.

[0009] A third aspect of this application provides a personalized language model adapter generation device, the device comprising a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute, according to instructions in the program code, the steps of the method for generating a personalized language model adapter as described in the first aspect above.

[0010] A fourth aspect of this application provides a computer-readable storage medium for storing program code for performing the method described in the first aspect above.

[0011] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: This application provides a method, apparatus, device, and medium for generating a personalized language model adapter. It processes user life logs into cognitive data with a four-layer progressive structure and separates them into four independent distillation pipelines: style, knowledge, preference, and judgment. The judgment pipeline is explicitly excluded from model weights but distilled into a searchable decision case library. Milestone-gated training is employed, with dual adapters trained independently and then merged via TIES. Deployment is performed after verification using a three-threshold deployment gate, and replay sampling is used during incremental training to prevent catastrophic forgetting. This invention achieves efficient, secure, and interpretable training and deployment of a personalized language model adapter.

[0012] The technical solution of the present invention produces the following specific technical effects: (1) Optimization effect of computing resources: The milestone gating training triggering mechanism ensures that training is only performed when there is sufficient data, which reduces the consumption of ineffective training computing resources when there is insufficient data compared with the fixed period training scheme. (2) Signal quality improvement effect: Four-way signal separation and distillation eliminates signal interference caused by mixed training, resulting in a significant improvement in style similarity and knowledge accuracy compared to the mixed scheme; (3) Model quality assurance effect: The three-threshold deployment gate ensures that the quality of each model update remains unchanged and automatically rolls back if any evaluation dimension fails to meet the standard, thus eliminating the risk of getting worse with training; (4) Data security protection effect: The precise matching interception mechanism during inference and the privacy-preserving processing of training data form a double layer of privacy protection, which effectively prevents the leakage of sensitive user information through model inference; (5) Anti-catastrophic forgetting effect: The Replay fusion mechanism significantly improves the retention rate of historical ability during incremental training. Attached Figure Description

[0013] Figure 1 This is a flowchart of the personalized language model adapter generation method in the embodiments of this application; Figure 2 This is a schematic diagram of the personalized language model adapter generation device in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of the personalized language model adapter generation device in the embodiments of this application. Detailed Implementation

[0014] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0015] For easier understanding, please refer to Figure 1 , Figure 1 This is a flowchart of the personalized language model adapter generation method in the embodiments of this application, such as... Figure 1 As shown, specifically: Step S1: Process user life log data into cognitive data with a four-layer progressive structure, including event layer, fact layer, observation layer and mental model layer, and continuously collect preference signals in user interaction with the system. It should be noted that hierarchical memory accumulation is a preprocessing pipeline that transforms unstructured, time-series user life logs into structured, multi-granular cognitive data. Its core idea is that the value of cognitive data increases with the level of abstraction, but the information density decreases. Therefore, a four-layer progressive structure is needed to balance "original fidelity" and "cognitive abstraction".

[0016] The technical definition of the four-layer progressive structure is shown in Table 1: Table 1. Data Hierarchy Table of Four-Level Progressive Structure Preference signal acquisition forms the supervisory feedback loop throughout the entire system. The system captures four types of signals through embedded points: Accept: The user directly adopts the system output without modification; Rejected: The user explicitly rejects the suggestion (e.g., clicking "Dissatisfied" or deleting the output). Correction: This is the strongest signal, as the correction clearly indicates the gap between the "ideal output" and the "actual output". Implicit approval: Users can directly copy / forward / reference system output without modification.

[0017] Each preference signal record is a structured JSON, containing: signal_id, signal_type, source_workflow, timestamp, context.input, context.system_output, and context.user_response.

[0018] Automated extraction from L1 event layer to L2 fact layer: Multi-task NLP models (such as the UIE unified information extraction framework) are used to perform entity recognition, relation extraction, and event extraction on L1 events. For dialogue-type data, Speaker Diarization is used to distinguish speakers, separating user speech from the speech of the dialogue object, and retaining only user speech as the input source for style distillation.

[0019] Pattern recognition from L2 fact layer to L3 observation layer: A two-layer clustering strategy is employed. The first layer performs K-Means clustering of L2 facts by topic; the second layer performs time-series analysis on the facts within each topic cluster and uses LLM to generate "observation summaries". For example, after clustering all "meeting decisions" facts within 6 months, LLM summarizes the observation that "users tend to assess risks before assessing benefits in technology decisions".

[0020] L3 observation layer → L4 mental model distillation: This process is triggered only when a certain number of L3 observations are accumulated (e.g., ≥20). LLM is used to perform metacognitive analysis on the L3 observations to generate the user's "decision framework" or "cognitive pattern." L4 layer data does not directly participate in training but serves as reference input for the distiller (e.g., style distillers refer to the L4 mental model to understand the user's deep expressive motivations).

[0021] Early-collected preference signals may become invalid due to changes in user habits. The system sets a half-life (e.g., 90 days) for preference signals, and signals exceeding the half-life have their weights decayed exponentially during DPO training.

[0022] Scenario 1: User Xiao Wang is a product manager who uses smart glasses to record his daily work.

[0023] L1 Event Layer: 2026-05-20 10:00, Transcription of a meeting recording with R&D Director Li Ming (3000 words in full); 2026-05-20 14:00, Record of discussions with the technical team on Slack; 2026-05-20 16:00, Read and saved an article about microservice architecture.

[0024] L2 Fact Layer: Extracted from meeting transcripts—"Li Ming agrees to complete the user profiling module before Q3"; "User (Xiao Wang) requests to add an A / B testing phase"; "Project budget has been approved at 2 million." Extracted from Slack discussions—"Xiao Wang prefers to use Kafka rather than RabbitMQ."

[0025] L3 Observation Layer: Cross-event analysis revealed that "Xiao Wang frequently mentioned 'scalability' and 'maintenance costs' during technical solution discussions"; "Xiao Wang is accustomed to confirming the other party's needs before proposing a solution when coordinating across departments."

[0026] L4 Mental Model Layer: "Xiao Wang's technical decision-making framework: scalability > development speed > cost, but data validation is essential when user experience is involved." Preference signal: When Xiao Wang uses the system-generated email draft, he changes "It is recommended to use Kafka" to "It is recommended to use Kafka (based on the team's existing technology stack and scalability requirements)" - this is a correction signal with a weight of 2.0.

[0027] Step S2: Separate the cognitive data into four independent distillation pipelines for processing: The first approach distills the user text expression features contained in the event layer into style training data pairs; The second approach compiles the structured knowledge facts clustered in the fact layer and observation layer into knowledge question-answering training data pairs; The third approach transforms the preference signal into a direct preference optimization training data pair. The fourth approach distills decision-related facts in the fact layer into structured decision cases, storing them in a searchable decision case library rather than using them as model training data. It's important to note that different types of cognitive signals exhibit different "learning dynamics" mathematically. Style signals are "distribution-level" features (influencing the probability distribution of output tokens), knowledge signals are "content-level" features (influencing the accuracy of specific facts), preference signals are "alignment-level" features (influencing the degree of matching between output and expectation), and judgment signals are "reasoning-level" features (influencing the decision chain of multi-factor trade-offs). Training with a mixture of these four signals can lead to signal interference—for example, style training can alter the model's output distribution, thus overwriting learned knowledge; new facts introduced by knowledge training can change the model's attention patterns, thereby affecting style representation.

[0028] Route 1: Style Distiller Input: Text of messages sent by L1 layer users; Processing flow: 1. Privacy-preprocessing removal: Use NER to identify privacy-sensitive entities (person names, company names, addresses, phone numbers, email addresses, ID card numbers, bank card numbers) and replace them with generalized identifiers (such as...).<PERSON_1> ,<ORG_1> ).

[0029] 2. Style Feature Extraction: Using LLM analysis, five dimensions were extracted from the processed text: Vocabulary preferences: high-frequency words, industry terms, slang, words to avoid Sentence structure: average sentence length, frequency of use in lists, proportion of rhetorical questions Thinking structure: Conclusion first vs. background and summary, frequency of analogy usage Tone spectrum: Formalism (0-1), Directness (0-1), Confidence (0-1) Scene switching: Style differences for different audiences (superiors / peers / subordinates / clients) 3. Training pairs are generated by constructing a (instruction, input, output) triple. The instruction is "Write a passage about [topic] in the user's style", the input is the scene description, and the output is the content actually written by the user (after privacy removal).

[0030] Maintain the version history of user style profiles, compare the style feature vector drift of adjacent versions during each distillation iteration, and mark it as a style mutation event when the drift exceeds a preset threshold and trigger manual review.

[0031] The second approach: Knowledge Compiler Input: L2 layer fact set + L3 layer observation (clustered by topic); Processing flow: 1. Topic Clustering: Use semantic embedding to cluster L2 facts into knowledge clusters (such as "project budget", "technology selection", "team members").

[0032] 2. Multi-angle QA generation: For each knowledge cluster, use LLM to generate 3-5 questions from different angles: Direct question: "What is the project budget?" Relationship question: "What is the relationship between budget and technology selection?" Negative verification: "Does the budget include design fees?" Timing question: "When was the budget approved?" 3. Answer generation: Generate accurate answers based on L2 facts, and reference source_fact_ids in the answers for traceability.

[0033] Third approach: Preference Curator Input: Original preference signal; Processing flow: 1. Signal classification and weight allocation: correction (user-corrected system output): chosen = user-corrected version, rejected = original system version, weight = 2.0 rejected (explicitly rejected by the user): Using LLM, a "version more likely to be accepted by the user" is generated based on the rejection reason and style profile as the choice, where rejected = system original version, weight = 1.5. chosen (directly adopted by the user): chosen=system original version, rejected=slightly inferior version generated by LLM, weight=1.0 2. DPO format conversion: Convert to a (prompt, chosen, rejected) triplet.

[0034] The preference signal also includes a time decay mechanism: a half-life is set for each preference signal, and historical preference signals that exceed the half-life decay exponentially in the weights of the DPO training data to adapt to the natural evolution of user preferences over time.

[0035] Furthermore, the present invention employs a completely different processing path for the judgment signal than the other three paths—instead of encoding it into the model weights, it distills it into a searchable decision case library.

[0036] This design is based on the following technical analysis: First, the LoRA adapter exhibits significant differences in its encoding capabilities for different signal types. Style signals are distribution-level features (influencing token probability distribution), and LoRA's low-rank matrix is ​​naturally well-suited for capturing such distribution shifts; rank=16 is sufficient to achieve good results. Knowledge signals are content-level features, and LoRA can effectively encode medium-scale factual knowledge. Preference signals are alignment-level features, and the combination of the DPO algorithm and LoRA has been widely validated. However, judgment signals are essentially complex inference chains (e.g., "because condition A is met and risk B is controllable, C is chosen after weighing C and D"), and this multi-step inference pattern is difficult to encode effectively with a low-rank matrix of rank=16-32.

[0037] Second, the training data for judgment is the sparsest among the four signal types. A typical user generates only about 30 decision-type facts per month, far below the minimum threshold of 300 required for effective LoRA training.

[0038] Forcing training under conditions of severely insufficient data can more easily lead to overfitting rather than effective learning.

[0039] Third, distilling judgment into structured decision cases and storing them in a searchable case library has the following technical advantages: (1) It naturally supports incremental updates, and can be added one by one without the risk of catastrophic forgetting; (2) Each decision suggestion can be traced back to a specific historical case, and is highly interpretable; (3) Even if there are only a few cases (10-20), the model reasoning can be effectively guided by injecting context windows with few-shot examples; (4) The case library is independent of the model architecture, and no retraining is required when changing the base model.

[0040] In summary, the failure to incorporate judgment into weighting is not a lack of ability, but rather an engineering decision to select the optimal technical path based on different signal characteristics.

[0041] Fourth approach: Judgment Extractor Input: Facts about the decision-type in the L2 layer + relevant dialogue context Processing flow: 1. Scenario abstraction: Replace specific person names, company names, and project names with generalized descriptions while preserving the decision-making structure.

[0042] 2. Reasoning chain reconstruction: Extract the user's reasoning process from the dialogue context (such as "Choose B because of A", "Choose X after weighing X and Y").

[0043] 3. Trade-off framework extraction: Identify the core trade-off dimensions in decision-making (such as speed vs. quality, cost vs. effectiveness, risk vs. benefit).

[0044] 4. Semantic Embedding Generation: Uses an embedding model to generate semantic vectors for cases, which are used for similar scene retrieval.

[0045] The style profile is not static, but updated with each distillation iteration. The system maintains the version history of style_profile_v{N}, compares style drift between adjacent versions (e.g., formality changing from 0.6 to 0.3), and if the drift exceeds a threshold, it is marked as a "style mutation" and triggers manual review.

[0046] The purpose of generating negative questions ("Are X and Y related?" → "No direct relationship") is to prevent the model from "illusioning"—if the training data only contains positive statements, the model may fabricate a connection without relevant knowledge. Negative verification questions train the model to say "I don't know" or "No direct relationship".

[0047] For a rejected signal, the system needs to generate a "better choice". This is not a simple "negation", but is based on: (1) the user's style profile (to ensure that the generated choice conforms to the user's expression habits); (2) semantic analysis of the reasons for rejection (e.g., the user rejects because it is "too wordy" → generate a concise version; because it is "factually incorrect" → correct the facts); (3) the current dialogue context (to ensure coherence).

[0048] A dual-path retrieval decision case library using "semantic + structural" methods is employed. Semantic retrieval uses the case's embedding vector; structural retrieval uses the case's domain and judgment_pattern tags. When a user queries "How is this solution?", the system first retrieves the top-5 similar cases semantically, then filters and retains cases within the same domain based on structural characteristics, and finally selects the top-2 cases for injection into the few-shot.

[0049] Scenario 2: User Xiao Wang accumulated the following data within 3 months: First output: 320 style_pairs (quality>0.7). Style characteristics: mainly short sentences (average 18 characters), frequent use of "alignment", "landing", and "closed loop", conclusion first, formality 0.6, directness 0.9.

[0050] The second output contains 1680 knowledge_qa records (quality > 0.7). These records cover topics such as project budget, technology selection, team members, and customer needs.

[0051] The third output consists of 720 pref_dpo signals (quality > 0.7). Among them, there are 180 correction signals (weight = 2.0), 240 rejected signals (weight = 1.5), and 300 chosen signals (weight = 1.0).

[0052] Fourth output: 120 decision cases (not included in training data). Typical case: "Decisions on the granularity of microservice decomposition—preferring a 'coarse-to-fine' approach to avoid over-design." Step S3: Using the cumulative number of data pairs whose quality scores exceed a preset quality threshold in various training data sets reaching a preset threshold as the training trigger condition, perform independent training and merging of the dual adapters, specifically including: The data from the first and third paths are used to train the representation adapter; Train the knowledge adapter independently using the data from the second path; The TIES algorithm is used to merge the expression adapter and the knowledge adapter into a personalized language model adapter. During incremental training, the training data is composed of a mixture of new data and historical data, where the historical data is sampled from the historical training data according to a quality-weighted strategy. Furthermore, when it is the first training session, the training trigger condition is that the cumulative quantity of each of the three types of training data reaches its respective preset quantity threshold. When performing incremental training, the training trigger condition is that the number of new high-quality data pairs added since the last training reaches the incremental number threshold. Furthermore, newly added data accounts for 60%-80%, while historical sampling data accounts for 20%-40%.

[0053] It's important to note that fixed-cycle training (e.g., weekly) assumes a constant rate of data accumulation, but in reality, user data output is highly uneven. For low-frequency users, fixed-cycle triggering can lead to a vicious cycle of insufficient data → low-quality training → wasted computing power; for high-frequency users, fixed cycles can result in delays where they have sufficient data but are forced to wait. Milestone gating transforms the triggering condition from a time-based dimension to a data-based dimension, allowing the training rhythm to naturally adapt to each user's data accumulation rate.

[0054] The training configuration of the expression adapter used in this embodiment is as follows: the LoRA rank value ranges from 8 to 32, with a preferred value of 16; the scaling factor (alpha) is twice the rank; the target module includes a query projection layer (q_proj), a value projection layer (v_proj), and an output projection layer (o_proj). The training configuration for the knowledge adapter is as follows: the LoRA rank (rank) ranges from 8 to 32, with a preferred value of 16; the scaling factor (alpha) is twice the rank; the target module includes a query projection layer (q_proj) and a value projection layer (v_proj). Initial training trigger conditions (all three conditions must be met simultaneously): Condition 1: The number of style pairs is ≥ 300 and the quality score is > 0.7; Condition 2: The number of knowledge_qa queries is ≥ 500 and the quality_score is > 0.7; Condition 3: The number of preference_dpo is ≥ 200 and the quality_score is > 0.7; The initial training requires all three signals to be complete, ensuring the adapter possesses basic "representation + knowledge + preference" capabilities. If any one signal is insufficient (e.g., preference signal <200), it indicates insufficient user interaction with the system, and the trained adapter may have inadequate preference alignment.

[0055] Subsequent retraining trigger conditions: Since the last training, the number of new high-quality data pairs (quality>0.7) has been ≥ 200; During incremental training, the system already possesses basic capabilities, and it is only necessary to ensure that "there are enough new signals worth learning". The threshold of 200 points balances "timely updates" with "avoiding over-training".

[0056] Regarding "how to train," the core idea is "learn separately first, then combine them for use." The system trains two independent adapters: one specifically learns "how to speak" (expression adapter), trained using style and preference data; the other specifically learns "what to know" (knowledge adapter), trained using knowledge question-and-answer data. Each adapter learns fully on its own data without interfering with the other. After training, an adapter merging mechanism combines the two into a unified personal adapter. This merging is not a simple weight addition, but a refined fusion involving pruning, conflict resolution, and direction selection, ensuring that the content learned by the two adapters does not generate internal friction after merging. After merging, a lightweight preference alignment is performed to ensure that the overall output after the "knowledge + expression" fusion still conforms to the user's preferences.

[0057] This application embodiment specifically includes merging via the TIES algorithm: (1) Trim step: Sort the weight changes of the expression adapter and the knowledge adapter by absolute value, retain only the top K% of weight changes with the largest changes, and set the rest to zero, where K ranges from 10% to 30%, preferably 20%; (2) Symbol election step (Elect Sign): When two adapters produce opposite weight changes at the same parameter position, they are weighted and voted according to their respective change magnitudes to determine the final weight change direction at that position; (3) Merge step: Merge the weight changes of the two adapters in the direction determined by the election to obtain the personalized language model adapter.

[0058] The key to the merging mechanism lies in handling conflicts. Two independently trained adapters may give opposite adjustment directions at the same weight position. The merging algorithm decides which one to follow by comparing the magnitude of the adjustment—the one with the larger magnitude usually means that the signal has been learned more "firmly" at that position. Weights with small adjustment magnitudes are considered noise and are ignored. This "denoising + conflict resolution" strategy makes the merged adapter perform better than training a single adapter together.

[0059] If only new data is used for training, the model will quickly forget its old skills; if new and old data are evenly mixed, the model will not learn enough new information. The system's approach is to use mostly new data and a small portion of historical data. Furthermore, the historical data is not randomly selected, but rather prioritized from high-quality, recent, and balanced samples. This ensures effective learning of new skills while preserving the basic capabilities of existing skills. New data accounts for 60%-80%, and historical sampling data accounts for 20%-40%.

[0060] The specific strategies for historical quality-weighted sampling include: (1) Quality first: The sampling probability of each historical data pair is positively correlated with its quality score. The higher the quality score, the greater the probability of the sample being sampled. (2) Proximal factor: The sampling probability of recent data (such as the last 3 months) is slightly higher than that of long-term data; (3) Type balance: Maintain a balanced proportion of style / knowledge / preference data in the sampling process to prevent the ability bias caused by oversampling of a certain type of data.

[0061] Step S4: Perform win rate evaluation, style similarity evaluation, and knowledge accuracy evaluation on the personalized language model adapter. If all three evaluations pass the threshold, the personalized language model adapter can be deployed. If any evaluation fails, it will be rolled back to the previous version.

[0062] It is important to note that the deployment of an LLM adapter cannot rely on a single metric. A single "accuracy" metric cannot capture style degradation; a single "style similarity" metric cannot capture knowledge forgetting; and a single "human review" metric cannot be scaled. This invention designs an evaluation based on three independent dimensions and adopts a strict strategy of "rollback if any one fails" to ensure that the quality of the online model does not degrade monotonically (i.e., the new version will not be worse than the old version).

[0063] Gate 1 — Win Rate Assessment (win_rate): Evaluation objective: Ensure that the adapter does not at least worsen the overall model.

[0064] method: Extract N queries (e.g., N=100) from the reserved validation set (20% of queries reserved during training, which do not participate in training); For each query, generate answers using "new adapter + base model" and "base model only (without adapter)" respectively; Using an independent LLM (such as GPT-4) as the judge, input two responses and ask to judge which one is better (or a tie). Calculate the win rate of the new adapter: win_rate = number of wins with the new adapter / total number of wins.

[0065] Threshold: win_rate ≥ 0.55 (new version requires win rate to exceed 55%).

[0066] The first dimension is "whether there has been a deterioration". The system puts the new adapter and the base model (the original model without any personal adapters) together, each answering the same batch of test questions. Then, an independent judging model blindly evaluates which answer is better. The new version's win rate must significantly exceed the random level to ensure that the adapter does not at least cause the model's overall performance to deteriorate.

[0067] Using LLM judges in Gate 1 may introduce bias (such as a preference for longer responses). Control measures could include: Use double-blind judging: Randomly label the two answers as A / B, without letting the judges know which one comes from the new adapter; Multi-judge voting is used: three different LLMs (GPT-4, Claude, and local model) are judged independently, and the majority vote is taken; Use structured judging criteria: give judges clear scoring dimensions (accuracy, relevance, conciseness, stylistic consistency), rather than a vague "which is better".

[0068] Style similarity is a comprehensive indicator, which can be broken down into sub-indicators for problem localization: vocab_sim: Vocabulary distribution similarity; length_sim: Sentence length distribution similarity; tone_sim: tone spectrum similarity; structure_sim: Similarity of thought structure; If Gate 2 fails, check the sub-indicators to locate the problem (e.g., tone_sim is normal but vocab_sim is decreasing → knowledge training has washed away user-specific industry terminology).

[0069] Gate 2 — Style Similarity Assessment (style_sim): Evaluation objective: To ensure that the model speaks like the user.

[0070] method: Select M (e.g., M=50) queries from the validation set that need to be "generated on behalf of the user" (e.g., "reply to this email" or "write a product description").

[0071] Generate answers using the new adapter.

[0072] At the same time, real outputs from corresponding scenarios are selected from users' actual text as a reference.

[0073] Extracting style feature vectors: Lexical distribution: Calculate the word distribution vector using TF-IDF; Sentence length distribution: mean sentence length, standard deviation of sentence length; Tone indicators: formality (based on dictionary matching), directness (proportion of imperative sentences), confidence (proportion of deterministic words); Calculate cosine similarity: style_sim = cosine(generated text feature vector, user's real text feature vector); Threshold: style_sim ≥ 0.75.

[0074] The second dimension examines "how similar it is to the user." The system presents the new adapter and real user text with the same questions, comparing the similarity in expression style between the two outputs. This includes multiple sub-dimensions such as word choice habits, sentence length, formality of tone, and thought structure. If knowledge learning during training washes away from style, or if style learning goes astray, this dimension will trigger an alert.

[0075] Gate 3 — Knowledge Accuracy Assessment (knowledge_acc): Assessment objective: To ensure that knowledge and skills have not deteriorated.

[0076] method: Use the 20% of knowledge QA pairs reserved during training as the test set (these QA pairs are not used in training and are used as a "final exam"); The new adapter answers directly without retrieval (without relying on RAG or case library, but purely on the knowledge in the adapter weights). Use independent LLM to judge the semantic equivalence of the answer to the ground truth (rather than literal matching, because users may have multiple ways of expressing it); Accuracy calculation: knowledge_acc = number of correct answers / total number of questions.

[0077] Threshold: knowledge_acc ≥ 0.65.

[0078] The third dimension examines "whether knowledge has been lost." The system uses a set of knowledge-related questions reserved during training as a "final exam," requiring the new adapter to answer them in a closed-book format (without allowing reference materials), to test whether its mastery of the user's personal knowledge meets the standard. This dimension prevents the catastrophic forgetting of "learning new things but forgetting old things."

[0079] The three dimensions are evaluated independently and do not substitute for each other. Even if the overall win rate is high, if the style is no longer in line with the user's preferences or if there is significant knowledge gaps, the application cannot be launched. The system retains the most recent historical versions, and if a new version is rejected, it immediately switches back to the previous stable version to ensure that users are always using a verified adapter.

[0080] Furthermore, step S4 is followed by: The output text from the personalized language model adapter inference is matched precisely with the training data using a sliding window. When the matching length exceeds a preset token threshold, the output text is intercepted and an alternative answer is regenerated for the same query using the base model without loading the personalized language model adapter.

[0081] It's important to note that even with privacy-preserving measures during training, the model may still "memorize" certain segments from the training data during inference. This is because language models essentially learn statistical patterns in the training text. When the amount of training data is small and the model capacity is relatively ample, the model may develop a near-word-by-word memory for certain training samples. This risk is particularly concerning for personal adapters—because the training data comes from users' real lives, and its leakage could expose users' private conversations, trade secrets, or other sensitive information.

[0082] Therefore, the system implements a security check after the model generates an answer but before returning it to the user. The core logic of this check is to compare the output text generated by the model segment by segment with all content in the training data storage to see if there are any long, completely identical segments. If such a match is found, it indicates that the model may be "reciting" the original text from the training data, and the system will immediately intercept this output, preventing it from reaching the user. After interception, the system does not simply reject the answer but instead has the base model, without loading a personal adapter, regenerate an answer. This alternative answer is based on general knowledge; although the personalization is reduced, it is absolutely safe, and then this rewritten content is returned to the user. Using the base model without an adapter to regenerate the answer is because the base model does not contain any memory of the user's training data, fundamentally eliminating the possibility of leakage.

[0083] Scenario 3: Passes the test normally User Xiao Wang asked the system, "Please summarize my recent collaboration with Zhang Wei." The personal adapter generated a response: "Based on your communication records, you've primarily been pushing forward with the cloud service migration project. The other party has specific requirements regarding the budget and timeline. We suggest you confirm the latest progress." The system compared this response with the training data and found no exact match for any longer segments. The detection passed, and the response was directly returned to Xiao Wang.

[0084] Scenario 4: Interception triggered and rewriting successfully Similarly, when Xiao Wang asked, "Please summarize my recent collaboration with Zhang Wei," the personal adapter's generated response included the following sentence: "Zhang Wei is the CTO of ABC Company. You discussed the cloud service migration plan on March 15, 2026. He mentioned that the budget limit is 2 million, and it needs to be completed before Q3." During the sliding window comparison, the system discovered that nearly thirty words in this sentence were completely identical to a knowledge-based question-and-answer record in the training data—a record extracted from a meeting transcript.

[0085] The system identified this as a potential data leak risk and immediately intercepted the original output. It then regenerated the response using the base model: "Based on your communication with Zhang Wei, you've recently been discussing a cloud service migration project. He has specific requirements regarding the budget and timeline. We suggest you check the latest status." The rewritten response retained useful information (mentioning cloud service migration, budget, and timeline) but removed specific numbers, dates, and company names. This secure alternative response was returned to Xiao Wang, and the entire process was seamless for the user.

[0086] Further, in step S2, the first distillation process includes: When generating style training data pairs, specific person names are replaced with entity identifiers, specific organization names are replaced with general descriptions, sensitive information that can trace personal identity is deleted, while retaining style features such as word usage habits, sentence structure, and thought patterns.

[0087] It's important to note that when extracting style training material from users' original text, the system faces a fundamental tension: on the one hand, it must protect user privacy as much as possible, avoiding any traceable personal information remaining in the training data; on the other hand, it must fully preserve the user's expressive personality, allowing the model to truly learn "how this person speaks." If the content is removed too completely for privacy reasons, the model won't learn the style; if too much original content is retained for style reasons, sensitive information may be leaked.

[0088] A multi-stage Named Entity Recognition (NER) pipeline is employed. The first stage uses a lightweight BERT-CRF model for coarse-grained entity recognition, identifying three main categories: personal names, organization names, and place names. The second stage uses a domain-specific rule engine to capture structured sensitive information, including mobile phone numbers (regular expression matching), ID card numbers (verification code verification), bank card numbers (Luhn algorithm verification), and email addresses (RFC 5322 pattern matching). The third stage uses a large language model for context-aware fine-grained recognition, handling nested entities and implicit privacy information missed in the first two stages (such as the surname + job title combination in "Zhang Zong").

[0089] Identified entities are categorized by risk level: high-risk entities (those whose personal identity can be directly identified, such as ID card number or mobile phone number) must be replaced; medium-risk entities (those whose identity can be indirectly inferred, such as specific company name or project name) are replaced or generalized according to a strategy; low-risk entities (general information for the group, such as "product manager" or "Q3") are retained.

[0090] A replacement mapping table is established, and a deterministic replacement strategy is adopted—the same entity is replaced with the same identifier in all training data to maintain the consistency of textual reference.

[0091] After the replacement is complete, a style analysis model is used to extract the style skeleton. This model is based on a pre-trained language model, fine-tuned for style classification tasks, and outputs a five-dimensional style vector: Vocabulary dimension: Extract users' high-frequency vocabulary and avoidance vocabulary through TF-IDF, and calculate industry terminology density; Syntactic dimension: Dependency parsing was used to statistically analyze the average sentence length, clause nesting depth, and passive voice proportion; Textual dimension: Analyze paragraph structure patterns (conclusion first / layered foreshadowing / problem-solution-summary); Tone dimension: Outputs formality, directness, and certainty scores based on sentiment lexicon and tone classifier; Variation dimension: Identifying style switching rules in different audience scenarios; The extracted style vectors are packaged together with the replaced text into training pairs. When stored, the style vectors are attached as metadata and used as conditional inputs during training.

[0092] Furthermore, it also includes: The personalized language model adapter is encrypted and stored using a symmetric encryption algorithm. The encryption key of the personalized language model adapter is encrypted by the user's master key. The user's master key is derived from the user's credentials and the server does not hold the plaintext. During inference, it is only temporarily decrypted and loaded into the memory of the computing device.

[0093] It's important to note that the adapter file itself is encrypted using a high-strength symmetric encryption algorithm. The encryption key is not generated by the system and stored on the server; instead, it's protected by the user's own master key, derived from the user's login credentials or biometric information. This means that only the user (the person with the correct credentials or biometrics) can unlock the file. Even if the server possesses the hardware to store the adapter, it will only be dealing with a bunch of undecipherable ciphertext.

[0094] During the inference phase, when a user initiates a query, the adapter is temporarily decrypted and loaded into the computing device's memory for this inference. Once inference is complete, the decrypted adapter content is immediately cleared from memory, leaving no plaintext copy on the disk. Users have complete control over their adapters—they can choose to delete them at any time (deletion is a true physical deletion and cannot be recovered); they can also export the adapter and migrate it to other devices or platforms for continued use.

[0095] Furthermore, step S2 is followed by: Each training data pair from distillation is given a quality score from 0 to 1, and only data pairs with scores exceeding a preset quality threshold are allowed to enter the training data storage.

[0096] It's important to note that the training data produced by the four-way distillation pipeline is not inherently usable; it may contain samples of varying quality. For example, style distillation might produce a "command-response" pair, but the response may not accurately reflect the user's expression habits; knowledge compilation might generate a question, but the facts upon which the answer is based may be outdated or incorrectly extracted; preference sorting might transform a vaguely defined feedback into a training pair with weak discriminative power. Allowing this low-quality data into the training process would not only waste computational resources but could also skew the model.

[0097] Therefore, the system incorporates a quality checkpoint at the end of each distillation pipeline. An independent evaluation model reviews each output training data point and makes a quality judgment based on the characteristics of that data. Style data is evaluated on whether the output truly captures the user's expressive features; knowledge data is evaluated on whether the answers are accurate and reliable, and whether the questions are natural and reasonable; preference data is evaluated on whether there is a clear and perceptible difference in quality between the preferred and second-best answers. Only data that meets a sufficient quality level is allowed to enter the training library; samples below the threshold are marked and temporarily stored for later reference and improvement when analyzing distillation strategies.

[0098] An independent evaluation model (isolated from the main training model to avoid evaluation bias) is employed, built upon a large language model fine-tuned based on instructions. The scoring model receives training data pairs as input and outputs structured quality assessment results. The scoring model itself is periodically calibrated using manually labeled high-quality / low-quality samples to ensure the stability of the scoring criteria.

[0099] First-line (style data) scoring dimensions: Style consistency: Cosine similarity between the style vector of the output text and the style vector of the archived users; Privacy Residuality: The density of residual privacy entities is calculated by scanning the output using a privacy entity detector; Structural integrity: Check whether the (instruction, input, output) triplet has all fields and conforms to the format.

[0100] Second-line (knowledge data) scoring dimensions: Factual accuracy: The answer is semantically compared with the source facts, and the entailment model is used to determine whether the answer is supported by the facts; Question naturalness: Assess whether the question aligns with users' actual questioning habits (the degree of deviation from generic template questions); Adequacy of coverage: Check whether the answer covers the key factual points involved in the question.

[0101] Third-way (preference data) scoring dimensions: Discrimination: The perceptible gap between chosen and rejected is measured using the difference in perplexity. Preference consistency: Whether the style / content characteristics of the chosen samples are consistent with the user's historical preference profile; Noise detection: Identify whether rejected samples are indeed worse than chosen samples, and rule out labeling errors.

[0102] Furthermore, when a user query involves a scenario requiring judgment, after identifying the user query as a judgment-type query through an intent classifier, a search is performed in the decision case library using semantic vectors to match the historical decision case most similar to the current scenario. The historical decision case is then injected into the model context window as a few-sample example.

[0103] It's important to note that when a user's query involves a scenario requiring judgment, trade-offs, or decision-making, the system does not attempt to make the model "remember" what the user would do from the weights—because judgment is intentionally excluded from adapter training. Instead, the system actively searches the decision case library for historical decision records that are most similar to the current situation.

[0104] Retrieval is based on semantic similarity: the system transforms the current query into a semantic vector, compares it with the vectors of all cases in the case library, and identifies the few cases that are closest in semantic space. These extracted cases are then injected into the model's context window as reference material. After reviewing these cases—"how the user considered things in similar situations in the past, how they ultimately chose, and what the underlying logic was"—the model, combined with the specific constraints of the current query, provides a suggestion that references the user's historical decision-making patterns.

[0105] Each decision case is encoded into a dense semantic vector using a vectorization model. The vectorization model employs a contrastive learning-based sentence transformer, fine-tuned on domain-specific decision text pairs. The vectorized input for each case includes concatenated text from four fields: scenario description, decision result, reasoning process, and trade-off dimensions, ensuring that the vector simultaneously captures contextual features and decision logic.

[0106] The case library is stored using a vector database (such as Milvus / Pinecone / self-developed vector index), supporting Approximate Nearest Neighbor (ANN) retrieval. The index structure is an HNSW (Hierarchical Navigable Small World) graph, balancing retrieval speed and recall.

[0107] The retrieval process is divided into two stages: semantic retrieval and structure filtering. Semantic retrieval stage: Encode the current user's query into a query vector; Perform ANN retrieval in the vector database to recall the Top-K (default K=10) semantically most similar cases; Calculate the semantic similarity score between the query and each recalled case.

[0108] Structural filtering stage: Check the metadata tags (domain, judgment_pattern, time_range) of the recalled cases. Filter out candidate cases that are clearly not a match for the current query domain; Score adjusted by time decay factor (recent cases have higher weight); Deduplication is performed based on diversity constraints (to avoid multiple highly similar cases being selected at the same time).

[0109] Few-shot injection: A top-N (typically N=2-3) case study is selected for injection into the model context. Multiple cases are injected in descending order of similarity, positioned after the system prompt and before the user's query, ensuring the model can reference the reasoning patterns of these cases when generating an answer. After injection, the model's output answer will include a citation tag indicating which cases were referenced, allowing the user to trace the source.

[0110] Furthermore, the training strategy for the expression adapter is as follows: Supervised fine-tuning of the expression adapter is performed using style training data pairs, and DPO alignment training is performed using preference-optimized training data pairs.

[0111] It should be noted that the first stage, supervised fine-tuning (SFT), has the following training configuration: Data: Style training data pairs (instruction, input, output); Optimizer: AdamW, learning rate uses cosine annealing scheduling, initial learning rate 2e-4; Batch strategy: Dynamic padding to the maximum sequence length, with the gradient accumulation step count adjusted based on GPU memory; Loss function: Standard autoregressive language modeling loss, only calculating the cross-entropy loss of the output part.

[0112] Phase 2: Direct Preference Optimization (DPO), Training Configuration: Data: Pairs of preferred training data (prompt, chosen, rejected); Optimizer: AdamW, learning rate reduced to 1 / 4 of the SFT stage (approximately 5e-5) to prevent destruction of learned styles; Loss function: DPO loss.

[0113] DPO does not use an independent reward model during training; instead, it directly uses the SFT model as a reference. The reference model (π_ref) remains frozen during DPO training and does not participate in gradient updates; The log probability ratio is calculated for both chosen and rejected samples. The optimization objective is to increase the marginal preference of chosen samples relative to rejected samples. The number of training steps should be kept within 1 / 3 of the SFT stage to prevent overfitting to preferred data and losing generalization ability.

[0114] Furthermore, it also includes: Multiple users each declare their own personalized language model adapters that can be shared. The personalized language model adapters of multiple users are merged into a team adapter through an adapter merging algorithm.

[0115] It should be noted that each user declares shareable segments in their personal adapter. The adapter is divided into logical sub-modules based on functionality: Style submodule: corresponds to the style-related weights in o_proj and v_proj; Knowledge submodule: corresponds to the factual knowledge weights in q_proj and v_proj; Preference submodule: corresponds to the preference adjustment weights generated by DPO alignment; Users select which submodules to share using a permission matrix. The system only extracts the weights of the selected submodules, keeping the rest private.

[0116] Multiple adapter merging is performed using either the TIES (TrIm, Elect Sign & Merge) or DARE (Drop And Rescale) algorithm. TIES merging process: Trim: For each submodule to be merged, sort by absolute value of the weight change ΔW, retain only the top K% (default 20%) of the most significant weight changes, and set the rest to zero; Elect Sign: For multiple adapters with non-zero changes at the same parameter position, the final sign direction is determined by weighted voting based on the magnitude of the change; Merge: Merge the weight changes of each adapter according to the direction of the elected sign.

[0117] DARE consolidation (an alternative solution for situations with a large number of adapters): Drop: Randomly discard a certain percentage (e.g., 50%) of the weight changes for each adapter. Rescale: Amplifies and compensates the retained weights according to the proportion of those discarded; Merge: Directly sums the weights of multiple adapters after scaling.

[0118] When multiple members have overlapping contributions in the same area: If the conflict dimension can be decomposed (such as different technology stack selections), route to the most relevant member adapter by professional domain label; If the conflict dimension cannot be decomposed (such as disagreement on the merits of the same technical solution), weighted aggregation is used, with the weights based on the member's confidence score in that domain (determined by the amount of training data and validation performance of the individual adapter).

[0119] When a member leaves: Locate the weighted fragment of the member's contribution from the merged record of the team adapter; Subtract the member's ΔW contribution from the team adapter's total weight (calculated in reverse based on the records at the time of merging); The weights of the remaining members are renormalized; If the weights at some positions are zero after subtraction, the original weights of the corresponding positions in the base model are used to fill them; Re-execute lightweight validation to ensure the team adapter remains stable after a member leaves.

[0120] Please see Figure 2 , Figure 2 This is a schematic diagram of the personalized language model adapter generation device in the embodiments of this application, such as... Figure 2 As shown, specifically: The hierarchical memory accumulation module 201 is configured to process user life log data into cognitive data with a four-layer progressive structure and collect preference signals. The four-channel signal separation and distillation module 202 is configured to separate the cognitive data into four independent distillation lines for processing training data pairs; The milestone gating training trigger module 203 is configured to use the accumulation of training data reaching a preset quality threshold as the training trigger condition. The dual-adaptor training and TIES merging module 204 is configured to independently train the expression adapter and the knowledge adapter and merge the expression adapter and the knowledge adapter into a personalized language model adapter through the TIES algorithm. The three-threshold deployment gate module 205 is configured to evaluate the merged personalized language model adapter based on three criteria: win rate, style similarity, and knowledge accuracy. If all three evaluations pass the threshold, the personalized language model adapter can be deployed. If any evaluation fails, the system will roll back to the previous version.

[0121] Another embodiment of the present invention provides a personalized language model adapter generation device, such as... Figure 3 As shown, device 10 includes: One or more processors 110 and memory 120, Figure 3The following description uses a processor 110 as an example. The processor 110 and the memory 120 can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.

[0122] Processor 110 is used to perform various control logics of device 10, and can be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), microcontroller, ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. Furthermore, processor 110 can also be any conventional processor, microprocessor, or state machine. Processor 110 can also be implemented as a combination of computing devices, such as a combination of DSP and microprocessor, multiple microprocessors, one or more microprocessors combined with DSP and / or any other such configuration.

[0123] The memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions corresponding to the personalized language model adapter generation method in the embodiments of the present invention. The processor 110 executes various functional applications and data processing of the device 10 by running the non-volatile software programs, instructions, and units stored in the memory 120, thereby implementing the personalized language model adapter generation method in the above method embodiments.

[0124] The memory 120 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created according to the use of the device 10. Furthermore, the memory 120 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 120 may optionally include memory remotely located relative to the processor 110, and these remote memories may be connected to the device 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0125] One or more units are stored in memory 120, and when executed by one or more processors 110, perform the following steps: Step S1: Process user life log data into cognitive data with a four-layer progressive structure, including event layer, fact layer, observation layer and mental model layer, and continuously collect preference signals in user interaction with the system. Step S2: Separate the cognitive data into four independent distillation pipelines for processing: The first approach distills the user text expression features contained in the event layer into style training data pairs; The second approach compiles the structured knowledge facts clustered in the fact layer and observation layer into knowledge question-answering training data pairs; The third approach transforms the preference signal into a direct preference optimization training data pair. The fourth approach distills decision-related facts in the fact layer into structured decision cases, storing them in a searchable decision case library rather than using them as model training data. Step S3: Using the accumulated amount of various training data reaching a preset quality threshold as the training trigger condition, perform independent training and merging of the dual adapters, specifically including: Train the representation adapter using the data from the first and third paths; Train the knowledge adapter independently using the data from the second path; The TIES algorithm is used to merge the expression adapter and the knowledge adapter into a personalized language model adapter. Step S4: Perform win rate evaluation, style similarity evaluation, and knowledge accuracy evaluation on the personalized language model adapter. If all three evaluations pass the threshold, the personalized language model adapter can be deployed. If any evaluation fails, it will be rolled back to the previous version.

[0126] This invention provides a non-volatile computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are executed by one or more processors, they implement any of the embodiments of the personalized language model adapter generation method described above.

[0127] As examples, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The memory components or memories disclosed in the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.

[0128] This application provides a method, apparatus, device, and medium for generating a personalized language model adapter. It processes user life logs into cognitive data with a four-layer progressive structure and separates them into four independent distillation pipelines: style, knowledge, preference, and judgment. Judgment is explicitly excluded from model weights but distilled into a searchable decision case library. Milestone-gated training is employed, with dual adapters trained independently and then merged via TIES. Deployment is performed after verification using a three-threshold deployment gate, and replay sampling is used during incremental training to prevent catastrophic forgetting. This invention achieves efficient, secure, and interpretable training and deployment of a personalized language model adapter.

[0129] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0130] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0131] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0132] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0133] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0134] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0135] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.

[0136] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

[0137] It should be noted that if any software tools or components not belonging to our company appear in the embodiments of this application, they are merely for illustrative purposes and do not represent actual use.

Claims

1. A personalized language model adapter generation method, characterized by, include: Step S1: Process the user's life log data into cognitive data with a four-layer progressive structure, which includes an event layer, a fact layer, an observation layer, and a mental model layer, and continuously collect preference signals from the user's interaction with the system. Step S2: The cognitive data is separated into four independent distillation lines for processing. The first path distills the user text expression features contained in the event layer into style training data pairs; The second approach compiles the structured knowledge facts clustered in the fact layer and the observation layer into knowledge question answering training data pairs; The third path converts the preference signal into direct preference optimization training data pairs; The fourth approach distills the decision-type facts in the fact layer into structured decision cases and stores them in a searchable decision case library instead of using them as model training data. Step S3: Using the cumulative number of data pairs whose quality scores exceed a preset quality threshold in various training data sets reaching a preset threshold as the training trigger condition, perform independent training and merging of the dual adapters, specifically including: Train the representation adapter using the data from the first path and the third path; Train the knowledge adapter independently using the data from the second path; The expression adapter and the knowledge adapter are merged into a personalized language model adapter using the TIES algorithm; During incremental training, the training data is composed of a mixture of new data and historical data, wherein the historical data is sampled from the historical training data according to a quality-weighted strategy. Step S4: Perform win rate evaluation, style similarity evaluation, and knowledge accuracy evaluation on the personalized language model adapter. If all three evaluations pass the threshold, the personalized language model adapter can be deployed. If any evaluation fails, it will be rolled back to the previous version.

2. The personalized language model adapter generation method according to claim 1, characterized in that, In step S3: When it is the first training session, the training trigger condition is that the cumulative quantity of each of the three types of training data reaches its respective preset quantity threshold. When incremental training is performed, the training trigger condition is that the number of new high-quality data pairs added since the last training reaches the incremental number threshold.

3. The personalized language model adapter generation method according to claim 1, characterized in that, In step S3, newly added data accounts for 60%-80%, and historical sampling data accounts for 20%-40%.

4. The personalized language model adapter generation method according to claim 1, characterized in that, The process following step S4 also includes: The output text inferred from the personalized language model adapter is matched with the training data using a sliding window for precise matching detection. When the matching length exceeds a preset token number threshold, the output text is intercepted and a replacement answer is regenerated for the same query using the base model without loading the personalized language model adapter.

5. The personalized language model adapter generation method according to claim 1, characterized in that, In step S2, the first distillation process includes: When generating style training data pairs, specific person names are replaced with entity identifiers, specific organization names are replaced with general descriptions, sensitive information that can trace personal identity is deleted, while retaining style features such as word usage habits, sentence structure, and thought patterns.

6. The personalized language model adapter generation method according to claim 5, characterized in that, The first distillation process also includes: Maintain the version history of user style profiles, compare the style feature vector drift of adjacent versions during each distillation iteration, and mark it as a style mutation event when the drift exceeds a preset threshold and trigger manual review.

7. The personalized language model adapter generation method according to claim 1, characterized in that, Also includes: The personalized language model adapter is encrypted and stored using a symmetric encryption algorithm. The encryption key of the personalized language model adapter is encrypted by the user master key. The user master key is derived from the user credentials and is not held in plaintext on the server side. During inference, it is only temporarily decrypted and loaded in the memory of the computing device.

8. The personalized language model adapter generation method according to claim 1, characterized in that, The process following step S2 also includes: Each training data pair from distillation is given a quality score from 0 to 1, and only data pairs with scores exceeding a preset quality threshold are allowed to enter the training data storage.

9. The personalized language model adapter generation method according to claim 1, characterized in that, When a user query involves a scenario that requires judgment, the intent classifier identifies the user query as a judgment-type query. Then, the semantic vector is used to search the decision case library to match the historical decision case that is most similar to the current scenario. The historical decision case is then injected into the model context window as a few-sample example.

10. The personalized language model adapter generation method according to claim 1, characterized in that, The training strategy for the expression adapter is as follows: Supervised fine-tuning of the expression adapter is performed using style training data, and preference-optimized alignment training is performed on the merged personalized language model adapter using preference-optimized training data.

11. The personalized language model adapter generation method according to claim 1, characterized in that, Also includes: Multiple users each declare their own personalized language model adapters that can be shared. The personalized language model adapters of multiple users are merged into a team adapter through an adapter merging algorithm.

12. The personalized language model adapter generation method according to claim 1, characterized in that, The rollback to the previous version in step S4 specifically includes: The system retains a preset number of recent versions of the historical personalized language model adapter. When any evaluation of a new version adapter fails, the system automatically continues to use the current online version and records the failed evaluation dimensions and index values ​​for subsequent training data quality checks.

13. A personalized language model adapter generation device, characterized in that, include: The hierarchical memory accumulation module is configured to process user life log data into cognitive data with a four-layer progressive structure and collect preference signals. The four-channel signal separation and distillation module is configured to separate the cognitive data into four independent distillation pipelines for processing training data pairs; The milestone gating training trigger module is configured to use the accumulation of training data reaching a preset quality threshold as the training trigger condition. The incremental training data mixing module is configured to mix new data with data sampled from historical data using a quality-weighted strategy during incremental training. The dual-adaptor training and TIES merging module is configured to independently train the expression adapter and the knowledge adapter, and then merge the expression adapter and the knowledge adapter into a personalized language model adapter using the TIES algorithm. The three-threshold deployment gate module is configured to evaluate the merged personalized language model adapter based on three criteria: win rate, style similarity, and knowledge accuracy. If all three evaluations pass the threshold, the personalized language model adapter can be deployed. If any evaluation fails, the system will roll back to the previous version.

14. A personalized language model adapter generation device, characterized in that, The device includes a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is configured to execute the personalized language model adapter generation method according to any one of claims 1-12 according to the instructions in the program code.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store program code for executing the personalized language model adapter generation method according to any one of claims 1-12.