Door lock information data processing and application method based on big model and knowledge graph

By constructing a door lock knowledge graph and an improved Transformer model, the problem of insufficient semantic understanding accuracy of door lock information data in the existing technology is solved, and higher question-answering accuracy and explainability are achieved.

CN120450017BActive Publication Date: 2025-09-16ZHEJIANG JOYCHINE IOT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510953142.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-09-16
Estimated Expiration
2045-07-10

AI Technical Summary

Technical Problem

When processing door lock information data, existing technologies have the problem of insufficient semantic understanding accuracy, making it difficult to simultaneously achieve both accuracy and interpretability of answers. Conventional methods are also unable to effectively resolve terminology ambiguity and noise interference problems.

Method used

By constructing a knowledge graph for door locks and combining it with a layered acquisition strategy to acquire diverse information data, the team employed adaptive normalization to eliminate terminology ambiguity and noise. Furthermore, the team utilized an improved Transformer model for data processing, including dynamic term-aware embedding initialization, improved context-aware position encoding, a gated multi-head self-attention mechanism, and adaptive layer normalization, to enhance the model's semantic understanding capabilities.

Benefits of technology

The semantic understanding accuracy of door lock information data is improved, the accuracy and explainability of question and answer are enhanced, and the problems of insufficient semantic understanding and terminology ambiguity in the existing technology are solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120450017B_ABST
    Figure CN120450017B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of natural language data processing, and more specifically, to a method for processing and applying door lock information data based on a large model and knowledge graph. The method comprises constructing a door lock knowledge graph, acquiring door lock information data using a layered acquisition strategy, adaptively normalizing the door lock information data using an adaptive normalization method, training an improved Transformer model using the normalized door lock information data, and enhancing the improved Transformer model with question-answering capabilities in conjunction with the door lock knowledge graph. Existing data processing and application methods suffer from a lack of semantic understanding accuracy, but the method provided by the present invention achieves higher semantic understanding accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language data processing, and in particular to a door lock information data processing and application method based on a large model and knowledge graph. Background Art

[0002] As a crucial security device, door locks require highly specialized, diverse, and complex information. Currently, people use a wide variety of door locks, including mechanical, electronic, and smart locks. Each has its own unique structure, function, and operation, significantly increasing the complexity of door lock repair personnel. When repairing a door lock, any unfamiliar lock or unusual issue typically requires consulting the corresponding operating instructions, maintenance manuals, technical documentation, and other information before proceeding.

[0003] However, door lock information data is often filled with a large number of professional terms, abbreviations, and spelling variations. These terms are highly inconsistent, posing a huge challenge to the accurate understanding and processing of information. Maintenance personnel may not be able to process and identify them themselves. Secondly, reading door lock information data to obtain useful information is time-consuming and costly.

[0004] Therefore, faced with similar situations, people have come up with the idea of ​​creating a question-and-answer platform for maintenance personnel. Maintenance personnel can simply enter relevant terms through an app or website to quickly obtain the information they need. The establishment of such a Q&A platform typically relies on a knowledge graph or a large model. After processing information data, people apply it to the creation of a knowledge graph or the training of a large model. The knowledge graph can then be used to organize information and understand its meaning, or the large model can be used to understand the context of sequence data, thereby enabling rapid processing of information data and providing relevant answers. In addition to serving maintenance personnel, Q&A platforms can also serve users, customers, sales, R&D personnel, and other related personnel.

[0005] However, the existing information data processing and application methods mainly have the following problems:

[0006] (1) Knowledge graphs or large models are usually used alone, but knowledge graphs lack flexible semantic understanding capabilities and large models lack systematic storage of professional knowledge, making it difficult for existing methods to simultaneously achieve both accuracy and interpretability of answers.

[0007] (2) Conventional text preprocessing techniques cannot effectively resolve terminology ambiguity and noise interference, and cannot cope with door lock information data with variable terminology, resulting in deviations in subsequent large model training;

[0008] (3) When using a large model to process data, for data such as door lock information data that contains a large number of domain-specific terms, the embedding layer of the conventional Transformer model uses random initialization or general pre-training embedding. The embedding layer cannot accurately capture the fine-grained semantics of professional terms, which is insufficient when processing domain-specific text and cannot accurately capture the fine-grained semantics of door lock terms; door lock information data has an uneven distribution in different chapters, and the conventional layer normalization uses global statistics, which cannot adapt to local distribution changes, resulting in unstable training; key operation steps in door lock text require higher attention weights, but the conventional Transformer's self-attention evenly distributes weights and cannot focus on key terms, causing the large model to ignore subtle operation risks; and the position encoding cannot dynamically adapt to local order changes, resulting in insufficient contextual understanding of the operation steps by the large model;

[0009] (4) Training large models with door lock information data involves multiple tasks, such as step classification and risk prediction. However, the conventional cross-entropy loss function in existing technologies treats all samples equally and fails to highlight high-risk operation steps. In the field of door locks, certain operation steps may involve security risks, but existing technologies have difficulty effectively identifying and optimizing these key steps.

[0010] Therefore, existing data processing and application methods have the problem of lack of semantic understanding accuracy. Summary of the Invention

[0011] The technical problem to be solved by the present invention is to overcome the shortcomings of the above-mentioned prior art and provide a door lock information data processing and application method based on a large model and knowledge graph with high semantic understanding accuracy.

[0012] To solve the above technical problems, the present invention provides a door lock information data processing and application method based on a large model and knowledge graph, including:

[0013] S1. Build a door lock knowledge graph to systematically store concepts, entities, and their relationships in the door lock field;

[0014] S2. Use a layered acquisition strategy to obtain door lock information data;

[0015] Door lock information data includes enterprise-level data and end-user data;

[0016] S3 uses an adaptive normalization method to perform adaptive term normalization on the door lock information data to obtain normalized door lock information data;

[0017] S4. Train the improved Transformer model using the normalized door lock information data;

[0018] S401. Define the structure of the improved Transformer model;

[0019] S402. Initialize the embedding layer using a word embedding method;

[0020] S403. Dynamically position encoding the input terms of the improved Transformer model by a term importance calculation method;

[0021] S404. Construct a multi-head self-attention mechanism through importance gate calculation method;

[0022] S405. Adaptively adjust the layer normalization of the improved Transformer model by calculating the hidden state mean and variance of the sample;

[0023] S406. Constructing a feedforward network by means of logic rule calculation;

[0024] S407. Optimizing focus perception loss by calculating focus weights of samples;

[0025] S5. Enhance question answering with the improved Transformer model by combining the door lock knowledge graph.

[0026] As a further improvement of the present invention: S1 constructs a door lock knowledge graph for systematically storing concepts, entities and their relationships in the door lock field, including:

[0027] S101 extracts domain knowledge data from door lock domain text data;

[0028] S102. Use rule matching and entity linking techniques to extract door lock terminology from domain knowledge data. Map the different expressions of door lock terminology to the same node as a standardized node. Identify relational terms and establish relationships between the nodes to obtain multiple triples.

[0029] S103. Use Neo4j graph database to store triples and verify the accuracy of the relationship.

[0030] Preferably, the domain knowledge data includes a glossary, a technical parameter table, and a fault solution.

[0031] As a further improvement of the present invention: S2 adopts a hierarchical acquisition strategy to obtain door lock information data including:

[0032] S201. Collect enterprise-level data;

[0033] Enterprise-level data is the official documents provided by various door lock manufacturers;

[0034] S202. Collect terminal user data; clean, filter and pre-process the terminal user data.

[0035] As a further improvement of the present invention: S402 initializing the embedding layer by the word embedding method includes:

[0036] S4021. Use the pre-trained word embedding function to convert all unique normalized term vectors in the training corpus into vectors; calculate the average value of these converted vectors; add the average value to the embedding correction increment to obtain an initialization matrix for the embedding layer;

[0037] S4022. Calculate the co-occurrence frequency of each normalized term vector in the corpus; calculate the maximum co-occurrence frequency among all terms; for each normalized term vector, divide its co-occurrence frequency by the sum of the maximum co-occurrence frequency and a smoothing constant to obtain a co-occurrence weighting factor for the term; for each normalized term vector, multiply the vector converted by the pre-trained word embedding function by its co-occurrence weighting factor; add the product results of all normalized term vectors, and multiply the sum by the adjustment rate of the embedding correction to obtain an embedding correction increment;

[0038] S4023. Use a sliding window to count the co-occurrence frequency of each normalized term vector in the corpus; find the maximum co-occurrence frequency value among all normalized term vectors; divide the co-occurrence frequency of each normalized term vector by the maximum co-occurrence frequency value plus a smoothing constant to obtain the co-occurrence weighting factor of the term.

[0039] Preferably, the initialization matrix of the embedding layer in S4021 is The calculation formula is:

[0040] ,

[0041] Where, is the total number of unique terms in the training corpus; is a positive integer index; is the pre-trained word embedding function; For the Normalized term vectors; Correction increment for embedding.

[0042] As a further improvement of the present invention: S403 dynamically positions the input terms of the improved Transformer model by using a term importance calculation method, including:

[0043] S4031. For a term indexed at a given position in the sequence, calculate its standard sinusoidal position code; calculate the term importance function value of the normalized term vector corresponding to the term at that position; calculate the position offset vector for that position; and add the product of the term importance function value, the importance adjustment coefficient, and the position offset vector to the standard sinusoidal position code to obtain a dynamic position code vector.

[0044] S4032. Count the frequency of documents containing the normalized term vector; count the term frequency of the normalized term vector in the entire corpus; find the maximum term frequency value of all terms in the corpus; divide the total number of documents by the document frequency containing the term, take the logarithm, and then multiply the result by the term frequency of the term divided by the maximum term frequency value to obtain a term importance function value of the normalized term vector;

[0045] S4033. Set a local window size, and for a term with a given position index in the sequence, traverse each position index within the range determined by its position index plus or minus the local window size; calculate the absolute difference between the current traversal position index and the term position index; calculate the weight coefficient of the current traversal position relative to the term position index based on the absolute difference and the attenuation factor; subtract the term position index from the current traversal position index to obtain the relative position difference; multiply the weight coefficient of each traversal position by its corresponding relative position difference to obtain the product result of the traversal position; add the product results of all traversal positions to obtain a position offset vector.

[0046] As a further improvement of the present invention: S404 constructs a multi-head self-attention mechanism by using an importance gate calculation method, including:

[0047] S4041. Add the initialization matrix of the embedding layer and the dynamic position code element-wise to obtain the embedding representation of the input sequence; perform linear transformation on the embedding representation of the input sequence to obtain the query matrix, key matrix and value matrix respectively; calculate the product of the query matrix and the transpose of the key matrix, and divide it by the square root of the key dimension; calculate the term importance gating function value of the embedding representation of the input sequence; multiply the product of the query matrix and the transpose of the key matrix by the term importance gating function value element-wise; calculate the multiplication result using the Softmax normalization function, and multiply the Softmax normalized result by the value matrix to obtain the gated attention output;

[0048] S4042. Calculate the term importance function value for the normalized term vector corresponding to the input sequence embedding representation; multiply the term importance function value by the importance gating function weight matrix, and then add the value to the importance gating function bias vector; input the result into the Sigmoid function to obtain the term importance gating function value.

[0049] As a further improvement of the present invention: S405 adaptively adjusting the layer normalization of the improved Transformer model by calculating the hidden state mean and variance of the sample includes:

[0050] S4051. Clustering samples into chapters based on text structure; determining the chapter cluster to which the currently input gated attention output feature belongs; calculating the mean of the gated attention output features of all samples in the chapter cluster as the hidden state mean of the current chapter cluster sample; calculating the variance of the gated attention output features of all samples in the chapter cluster as the hidden state variance of the current chapter cluster sample; subtracting the hidden state mean of the current chapter cluster sample from the input gated attention output feature, and then dividing the result by the square root of the sum of the hidden state variance of the current chapter cluster sample and a smoothing constant; multiplying the result by a first learnable parameter and adding the result to a second learnable parameter to obtain a normalized feature;

[0051] S4052. Determine the chapter cluster to which the input gated attention output feature belongs; calculate the sum of the gated attention output feature values ​​of all samples in the chapter cluster, divide it by the number of samples in the cluster, and obtain the hidden state mean of the current chapter cluster samples; calculate the square of the gated attention output feature value of each sample in the chapter cluster minus the cluster mean, sum the square results of all samples, and then divide it by the number of samples in the cluster to obtain the hidden state variance of the current chapter cluster samples.

[0052] As a further improvement of the present invention: S407 optimizes the focus perception loss by calculating the focus weight of the sample, including:

[0053] S4071. For each sample, calculate its focal weight; calculate the cross entropy loss of the sample; multiply the focal weight of the sample by its cross entropy loss result; sum the weighted loss results of all samples and take the negative value to obtain the final loss function;

[0054] S4072. For each sample, the focus weight of the sample is obtained by combining the focus parameters and multiplying the result by the risk function.

[0055] The beneficial effects of the present invention are as follows: The door lock information data processing and application method based on a large model and knowledge graph provided by the present invention has high semantic understanding accuracy.

[0056] This method constructs a door lock knowledge graph and combines it with a large model to achieve an organic combination of structured storage and semantic understanding of door lock information data, thereby improving the accuracy and interpretability of question answering; a term normalization method based on k-means clustering and adaptive weight coefficients is proposed, which can effectively eliminate noise and ambiguity, provide high-quality input for the subsequent training of the improved Transformer model, and solve the problems of variable terminology and spelling errors, thereby improving the semantic understanding accuracy of the Transformer model; based on the characteristics of door lock information data, the improvements of the improved Transformer model include dynamic term-aware embedding initialization, improved context-aware position encoding, gated multi-head self-attention mechanism, adaptive layer normalization, etc., which significantly improve the performance and stability of the improved Transformer model; through focus-aware loss optimization, the improved Transformer model can pay more attention to high-risk operation steps, improve the accuracy and practicality of question answering, and solve the problem that the loss function in the existing technology cannot highlight key steps. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 It is a principle block diagram of the present invention;

[0058] Figure 2 This is a stability analysis diagram of the adaptive term normalization method in a complex noise environment;

[0059] Figure 3 This is the Transformer architecture ablation experiment analysis diagram;

[0060] Figure 4 The performance comparison chart of different models in the door lock knowledge question answering task. DETAILED DESCRIPTION

[0061] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0062] like Figure 1 As shown, the present invention provides a door lock information data processing and application method based on a large model and a knowledge graph, including:

[0063] S1. Build a door lock knowledge graph to systematically store concepts, entities, and their relationships in the door lock field;

[0064] S101 extracts domain knowledge data from door lock domain text data;

[0065] Door lock text data includes door lock manufacturer technical manuals, industry standard documents, maintenance case libraries, etc.

[0066] Domain knowledge data includes glossary, technical parameter table, fault solution, etc.

[0067] S102. Door lock terminology is extracted from the domain knowledge data using rule matching and entity linking techniques. Different door lock terminologies are mapped uniformly to the same node as a standardized node. Relational terms are identified and relationships between nodes are established. Multiple triples of the "entity-relationship-entity" format are obtained, such as "electronic lock - contains - motor", "lock cylinder type A - supports - key B", and "fault code E01 - corresponds to - poor battery contact".

[0068] Nodes include lock body type, lock core level, battery specifications, installation method, fault code, etc.

[0069] S103. A Neo4j graph database is used to store the triples, and a person skilled in the art verifies the accuracy of the relationships. For example, for the "auto-locking function" node, a person skilled in the art verifies the accuracy of the associated applicable lock types (e.g., "applicable to push-pull smart locks"), trigger conditions (e.g., "2-second delay after door closing"), and exception scenarios (e.g., "trigger failure when blocked by an obstacle") associated with the function.

[0070] S2. Use a layered acquisition strategy to acquire door lock information data, achieving full-link knowledge coverage from industry standards to user needs, ensuring diversity in training data.

[0071] Door lock information data includes enterprise-level data and end-user data;

[0072] S201. Collect enterprise-level data;

[0073] Enterprise-level data refers to official documents provided by various door lock manufacturers, including product specifications, installation manuals, user guides, troubleshooting manuals, etc. The user guide includes detailed instructions on how to set up fingerprints, passwords, and how to perform remote control.

[0074] S202. Collect terminal user data, clean, filter and pre-process the terminal user data;

[0075] End-user data includes textual content posted online, including user reviews, user experiences, and technical forum discussions about door locks. This data often reveals problems users encounter when installing or using a particular door lock, along with their solutions. This data can be used as training data to help the improved Transformer model learn how to respond to similar user inquiries.

[0076] Cleaning and filtering refers to removing irrelevant advertisements, spam, and other content unrelated to door locks from the text data. Preprocessing refers to segmenting and sentence-by-sentence processing of the text data to facilitate subsequent training of the improved Transformer model.

[0077] S3. Adaptively normalize the door lock information data using an adaptive normalization method to obtain normalized door lock information data, resolve terminology ambiguity and noise interference, and improve the accuracy of subsequent embedding layer learning;

[0078] The system uses the k-means clustering algorithm to group semantically similar terms into clusters, each with a central term vector. The system calculates the cosine similarity between the original input term and the central term vector of each cluster. The system also calculates the Euclidean distance between the original input term and the central term vector of each cluster, and calculates the adaptive weight coefficient for each cluster based on this distance and a similarity decay factor. The system then multiplies each cluster's central term vector, its corresponding adaptive weight coefficient, and the cosine similarity between the original input term and the cluster center. These products are summed across all clusters to obtain a normalized term vector.

[0079] Normalized term vector The calculation formula is:

[0080] ,

[0081] Where, is a positive integer index; is the total number of term clusters generated by k-means clustering, representing the number of semantic categories of term variants. The k-means clustering algorithm dynamically divides semantically similar groups to reflect the variable nature of door lock terminology. In view of the data characteristics of high spelling error rate, clustering can adaptively identify the mapping between variants and standard terms. is the adaptive weight coefficient, which represents the semantic similarity contribution between the current term and the center of each cluster; is the similarity function, Representational Computing and The cosine similarity of The cluster center term vector is initialized by a pre-trained word embedding function, such as Word2Vec, which reflects the standard semantics of door lock terminology and can adaptively handle terminology inconsistencies.

[0082] Text data is characterized by a large number of professional terms, frequent abbreviations, high spelling errors, and inconsistent terminology. For example, "deadbolt" may be abbreviated as "dbolt" or misspelled as "deadboltt". Conventional text preprocessing techniques such as stop word removal and stemming cannot effectively resolve term ambiguity and noise interference, leading to bias in subsequent embedding layer learning. The normalized term vector Characterize the cleaned standard term representation to eliminate noise and ambiguity in the original text, solve existing technical problems, and provide high-quality input for subsequent embedding layers;

[0083] Adaptive weight coefficient The calculation formula is:

[0084] ,

[0085] Where, Similarity attenuation factor, used to adjust the sensitivity of distance to weight. The larger its value, the more concentrated the weight is on the nearest cluster, which enhances the robustness to spelling errors. The value can be set to 3; Represents calculation and The Euclidean distance of The original input terms, such as words or phrases, are unprocessed text data units directly derived from the door lock manual;

[0086] In order to verify the stability of the adaptive term normalization method proposed in this technology in a complex noise environment and analyze its ability to handle industry term variation and text noise, the adaptive term normalization method is compared with the traditional rule matching method and the conditional random field method based on the pre-trained Transformer model. The three-dimensional surface diagram of the experimental results clearly shows the performance changes of the three methods under the dual variables of term variation degree and noise level. Figure 2 As shown, the surface of the adaptive term normalization method (red gradient) remains stable and high in the high-variance and high-noise area (upper right quadrant), while the surfaces of the two baseline methods (blue and gray) show obvious collapse in this area, indicating that the adaptive weight mechanism dynamically adjusts the semantic similarity, effectively overcoming the problem of term variation and verifying the strong robustness of the method.

[0087] S4. Train the improved Transformer model using the normalized door lock information data;

[0088] S401. Define the structure of the improved Transformer model;

[0089] To address issues such as term variability, spelling errors, and sequential dependencies in door lock information data, the structure of the improved Transformer model is defined as follows:

[0090] 1) Embedding layer: The normalized term vector is converted into an embedding representation to provide input for subsequent layers;

[0091] 2) Dynamic Position Encoding Layer: After the output of the embedding layer, the dynamic position encoding layer uses dynamic position encoding to ensure that the order information of the sequence can be effectively captured and solve the order dependency problem. The order information of the sequence can be "insert the key first, then turn the handle";

[0092] 3) Self-attention mechanism module: This module uses a gated multi-head self-attention mechanism to enable the Transformer model to focus on key terms, improving the accuracy of understanding door lock operations.

[0093] 4) Adaptive layer normalization module: This module performs local normalization based on the feature distribution of different chapters to stabilize Transformer model training, avoid training instability caused by data distribution differences, and enhance the generalization ability of the Transformer model.

[0094] 5) Feedforward Network: The features after attention and normalization are passed to the feedforward network for semantic enhancement. By enhancing the understanding of semantic rules, the Transformer model improves its understanding and prediction accuracy of professional operations.

[0095] In addition to optimizing the structure of the improved Transformer model, during the subsequent Transformer model training, focus-aware loss optimization is used to guide the Transformer model to pay more attention to high-risk operation steps and optimize the training process.

[0096] S402. Initialize the embedding layer using a word embedding method;

[0097] S4021. Use the pre-trained word embedding function to convert all unique normalized term vectors in the training corpus into vectors; calculate the average value of these converted vectors; add the average value to the embedding correction increment to obtain an initialization matrix for the embedding layer;

[0098] Initialization matrix for the embedding layer The calculation formula is:

[0099] ,

[0100] Where, is the total number of unique terms in the training corpus; is a positive integer index; A pre-trained word embedding function, such as Word2Vec, maps terms to a vector space; For the Normalized term vectors; Characterization will Convert to vector; is the embedding correction increment, which is used to compensate for the embedding deviation of low-frequency terms;

[0101] Initialization matrix for the embedding layer Combined with normalized term distribution, this ensures that the embedding can capture the unique semantics of door locks, especially enhancing contextual relevance in areas where terms frequently co-occur. Characterizes the mean of normalized term embeddings to offset the variance of random initialization;

[0102] S4022. Calculate the co-occurrence frequency of each normalized term vector in the corpus; calculate the maximum co-occurrence frequency among all terms; for each normalized term vector, divide its co-occurrence frequency by the sum of the maximum co-occurrence frequency and a smoothing constant to obtain a co-occurrence weighting factor for the term; for each normalized term vector, multiply the vector converted by the pre-trained word embedding function by its co-occurrence weighting factor; add the product results of all normalized term vectors, and multiply the sum by the adjustment rate of the embedding correction to obtain an embedding correction increment;

[0103] Embedded Correction Increment The calculation formula is:

[0104] ,

[0105] Where, The adjustment rate of embedding correction characterizes the response to the co-occurrence intensity, and the value can be set to 0.005; is the co-occurrence weighting factor function;

[0106] S4023. To enhance the embedding effect of frequently co-occurring terms, use a sliding window to count the co-occurrence frequency of each normalized term vector in the corpus; find the maximum co-occurrence frequency value among all normalized term vectors; divide the co-occurrence frequency of each normalized term vector by the maximum co-occurrence frequency value plus a smoothing constant to obtain a co-occurrence weighting factor for the term;

[0107] Input is The co-occurrence weighting factor function The calculation formula is:

[0108] ,

[0109] Where, For term The co-occurrence frequency in the corpus is calculated using a sliding window; is the maximum frequency value; For the smoothing constant used to avoid division by zero errors, the value can be set to ;

[0110] This step avoids the problem of skewed embedding representations when co-occurrences are sparse, as is conventional practice if only mean correction is used, which ignores local patterns of term co-occurrences.

[0111] S403. Dynamically position encoding the input terms of the improved Transformer model by a term importance calculation method;

[0112] S4031. For a term indexed at a given position in the sequence, calculate its standard sinusoidal position code; calculate the term importance function value of the normalized term vector corresponding to the term at that position; calculate the position offset vector for that position; and add the product of the term importance function value, the importance adjustment coefficient, and the position offset vector to the standard sinusoidal position code to obtain a dynamic position code vector.

[0113] Dynamic Position Encoding Vector The calculation formula is:

[0114] ,

[0115] Where, is the index of the term's position in the sequence; It is a standard sinusoidal position encoding; is the importance adjustment coefficient, the value can be set to 0.3; is the term importance function; is the position offset vector;

[0116] Dynamic Position Encoding Vector Representation of enhanced position representation for output in the embedding layer Adding position information later allows the Transformer model to better understand the sequence order;

[0117] S4032. Conventional methods tend to ignore the semantic weight of terms, so the frequency of documents containing the normalized term vector is counted; the term frequency of the normalized term vector in the entire corpus is counted; the maximum term frequency value of all terms in the corpus is found; the total number of documents is divided by the frequency of documents containing the term, the logarithm is taken, and the result is multiplied by the term frequency of the term divided by the maximum term frequency value to obtain the term importance function value of the normalized term vector;

[0118] Term vector Applying the term importance function Expressed as , The calculation formula is:

[0119] ,

[0120] Where, It is a logarithmic function, and the default base is 10; is the total number of documents; is the term vector Document frequency; is the term vector frequency; is the maximum term frequency value of all terms in the corpus;

[0121] S4033. To capture local sequence changes, a local window size is set. For a term with a given position index in the sequence, each position index is traversed within a range determined by its position index plus or minus the local window size. The absolute difference between the current traversal position index and the term position index is calculated. Based on the absolute difference and a decay factor, a weight coefficient of the current traversal position relative to the term position index is calculated. The term position index is subtracted from the current traversal position index to obtain a relative position difference. The weight coefficient of each traversal position is multiplied by its corresponding relative position difference to obtain a product of the traversal positions. The product results of all traversal positions are summed to obtain a position offset vector.

[0122] Position offset vector The calculation formula is:

[0123] ,

[0124] Where, is a positive integer index; represents the maximum value function, Indicates taking and The larger value of is the index of the term's position in the sequence; is the local window size; represents the minimum function, Indicates taking and The smaller value of is the sequence length; For the The position index relative to the term in the sequence The weight coefficient of

[0125] No. The position index relative to the term in the sequence The weight coefficient The calculation formula is:

[0126] ,

[0127] Where, is an exponential function with a natural constant as its base; is the attenuation factor, the value can be set to 0.95; Represents the position index of the term in the sequence Hedi The absolute difference between the position indices;

[0128] The text in the door lock operation manual has strict sequential dependencies, such as descriptions such as "unlock first and then open the door." Conventional Transformers use sinusoidal positional encoding, but this cannot dynamically adapt to local order changes and long-distance dependencies in the text sequence, which can easily cause large models to ignore the order of key steps. However, this step can avoid this problem.

[0129] S404. Construct a multi-head self-attention mechanism through importance gate calculation method;

[0130] S4041. Add the initialization matrix of the embedding layer and the dynamic position code element-wise to obtain the embedding representation of the input sequence; perform linear transformation on the embedding representation of the input sequence to obtain the query matrix, key matrix and value matrix respectively; calculate the product of the query matrix and the transpose of the key matrix, and divide it by the square root of the key dimension; calculate the term importance gating function value of the embedding representation of the input sequence; multiply the product of the query matrix and the transpose of the key matrix by the term importance gating function value element-wise; calculate the multiplication result using the Softmax normalization function, and multiply the Softmax normalized result by the value matrix to obtain the gated attention output;

[0131] ,

[0132] Where, The gated attention output represents an improved context representation to capture sequential dependencies; for the reason The query matrix obtained by linear transformation; for the reason The bond matrix obtained by linear transformation; for the reason The value matrix obtained by linear transformation; is the Softmax normalization function; for The transpose of is the key dimension; is the importance gating function; is the sum of embedding and position encoding, the sum of embedding representation and dynamic position encoding representing the input sequence, used for attention calculation, that is, ;

[0133] S4042. Calculate the term importance function value for the normalized term vector corresponding to the input sequence embedding representation; multiply the term importance function value by the importance gating function weight matrix, and then add the value to the importance gating function bias vector; input the result to the Sigmoid function to obtain the term importance gating function value;

[0134] ,

[0135] Where, is the Sigmoid function; is the importance gating function weight matrix, which is a learnable parameter; is the bias vector of the importance gating function, which is a learnable parameter;

[0136] S405. Adaptively adjust the layer normalization of the improved Transformer model by calculating the hidden state mean and variance of the sample;

[0137] S4051. Clustering samples into chapters based on text structure; determining the chapter cluster to which the currently input gated attention output feature belongs; calculating the mean of the gated attention output features of all samples in the chapter cluster as the hidden state mean of the current chapter cluster sample; calculating the variance of the gated attention output features of all samples in the chapter cluster as the hidden state variance of the current chapter cluster sample; subtracting the hidden state mean of the current chapter cluster sample from the input gated attention output feature, and then dividing the result by the square root of the sum of the hidden state variance of the current chapter cluster sample and a smoothing constant; multiplying the result by a first learnable parameter and adding the result to a second learnable parameter to obtain a normalized feature. The normalized feature represents a stabilized representation, which is used as input to the feedforward network;

[0138] Normalized features The calculation formula is:

[0139] ,

[0140] Where, is the normalized input of the adaptive layer, i.e., the gated attention output feature; is the hidden state mean of the current chapter cluster sample; Represents the hidden state variance of the current chapter cluster sample; is the first learnable parameter; is the second learnable parameter;

[0141] S4052: Determine the chapter cluster to which the input gated attention output feature belongs; calculate the sum of the gated attention output feature values ​​of all samples in the chapter cluster, and divide the sum by the number of samples in the cluster to obtain the hidden state mean of the current chapter cluster samples; calculate the square of the gated attention output feature value of each sample in the chapter cluster minus the cluster mean, sum the squared results of all samples, and divide the sum by the number of samples in the cluster to obtain the hidden state variance of the current chapter cluster samples;

[0142] The hidden state mean of the current chapter cluster sample The calculation formula is:

[0143] ,

[0144] Where, is the number of samples in the chapter cluster to which the current sample belongs; The chapter cluster to which the current sample belongs is determined by text structure clustering; is a positive integer index; For the The gated attention output features of samples;

[0145] Hidden state variance of the current chapter cluster sample The calculation formula is:

[0146] ,

[0147] S406. Constructing a feedforward network by means of logic rule calculation;

[0148] S4061. Multiply the normalized features by the first weight matrix and add the first bias vector; perform calculations on the result using the ReLU activation function; multiply the result of the ReLU activation function by the second weight matrix and add the result to the second bias vector; calculate the logic rule function value of the normalized features; multiply the logic rule function value by the logic strength coefficient; add the result of the previous linear transformation to the product result to obtain the feedforward network output;

[0149] ,

[0150] Where, is the output of the feedforward network; is the first weight matrix of the feedforward network, which is a learnable parameter; is the first bias vector of the feedforward network, which is a learnable parameter; is the second weight matrix of the feedforward network, which is a learnable parameter; is the second bias vector of the feedforward network, which is a learnable parameter; is the logic strength coefficient, the value can be set to 0.3; is the logic rule function; Represents the ReLU activation function;

[0151] S4062. Traverse all predefined rule indexes, and for each rule, calculate the matching function value between the normalized feature and the rule embedding vector, multiply the matching function value by the rule embedding vector corresponding to the rule; add the multiplication results of all rules to obtain the logical rule function value;

[0152] ,

[0153] Where, Is the rule index, a positive integer, and the range value is ~ ; is the number of predefined rules; is the matching function, calculate and rules Similarity, such as calculating the cosine similarity between the two; Embedding vector for rules;

[0154] The door lock operation description contains implicit logical relationships. Conventional feedforward networks use fixed activation functions and cannot enforce such semantic rules. However, the semantically enhanced feedforward network can avoid this problem.

[0155] S407. Optimizing focus perception loss by calculating focus weights of samples;

[0156] S4071. For each sample, calculate its focus weight; calculate the cross entropy loss of the sample; multiply the focus weight of the sample by its cross entropy loss result; sum the weighted loss results of all samples and take the negative value to obtain the final loss value;

[0157] Loss value The calculation formula is:

[0158] ,

[0159] Where, is the number of samples; For the The focal weight of each sample; For the The true labels of samples; For the The predicted probability of a sample;

[0160] S4072. For each sample, calculate the focus parameter and then multiply it by the risk function to obtain the focus weight of the sample;

[0161] No. The focal weight of the samples The calculation formula is:

[0162] ,

[0163] Where, is the focus parameter, the value can be set to 0.3; is a risk function that returns the risk score of the term, Representation term vector The risk level function value is used to represent the degree of operational danger corresponding to the door lock term. It can be obtained through expert knowledge base mapping or prediction based on risk annotation training Transformer model. It is the semantic basis of the focus mechanism in the loss function.

[0164] In order to quantitatively evaluate the contribution of core modules such as dynamic position encoding and gated attention to the overall performance, the experiment compares the improved Transformer model, the standard Transformer model and its simplified variants, and removes each innovative module in turn, such as Figure 3 As shown, the experimental results show that the parallel coordinate diagram intuitively displays the overall performance of the Transformer model through a six-dimensional indicator space. The complete model of the Transformer model (purple line) is at the outermost side on all indicator axes, forming a performance envelope. On the long sequence dependency indicator axis, the variant that removes the dynamic position encoding (green line) shows an obvious depression, proving that this module is crucial for processing sequential dependencies.

[0165] S5. Enhance question answering with the improved Transformer model by combining the door lock knowledge graph;

[0166] By combining the door lock knowledge graph with the Transformer model through the Retrieval Augmentation Generation (RAG) framework, we can improve the accuracy and explainability of question answering. The following steps are involved:

[0167] S501. User question analysis;

[0168] After the user enters a question such as "How do I fix the V3 model lock tongue not rebounding?", the Transformer model performs semantic analysis on the user's question and extracts key terms such as "V3 model" and "lock tongue not rebounding";

[0169] S502. Door lock knowledge graph retrieval;

[0170] Query using terms as indexes to match related entities and relationships in the door lock knowledge graph. For example, if a lock tongue fails to rebound, common causes include spring aging or foreign object obstruction. Generate and return a topological subgraph containing relevant knowledge.

[0171] S503. Answer synthesis;

[0172] The Transformer model combines retrieved graph information (topological subgraphs) with its own semantic understanding to generate structured answers, such as "Step 1: Check the lock bolt slot for dust → Step 2: Lubricate the spring → If ineffective, replace the part (refer to fault code F30)." This enhances interpretability and accurately calls upon expertise.

[0173] To evaluate the effect of door lock knowledge graph enhancement on door lock professional question answering performance, grouped bar charts were used to compare the performance of conventional Transformer, general pre-trained model BERT basic version, door lock knowledge graph enhanced BERT, and the complete solution of this invention on four typical problems, such as Figure 4 As shown, the experimental results show that the method of the present invention has a leading advantage in all problem categories, especially in highly professional problems such as fault diagnosis and security settings (the columnar group on the right side of the figure), where the advantage is most significant, proving the synergistic effect of this technical framework. The door lock knowledge graph provides precise structured professional knowledge, and the Transformer model contributes deep semantic understanding. The two are deeply integrated through the retrieval enhancement generation mechanism, enabling the system to generate logically rigorous solutions and greatly improve the ability to solve complex problems.

Claims

1. A door lock information data processing and application method based on a large model and knowledge graph, characterized in that: include: S1. Build a door lock knowledge graph to systematically store concepts, entities, and their relationships in the door lock field; S2. Use a layered acquisition strategy to obtain door lock information data; Door lock information data includes enterprise-level data and end-user data; S3 uses an adaptive normalization method to perform adaptive term normalization on the door lock information data to obtain normalized door lock information data; S4. Train the improved Transformer model using the normalized door lock information data; S401. Define the structure of the improved Transformer model; S402. Initialize the embedding layer using a word embedding method; S403. Dynamically position encoding the input terms of the improved Transformer model by a term importance calculation method; S404. Construct a multi-head self-attention mechanism through importance gate calculation method; S405. Adaptively adjust the layer normalization of the improved Transformer model by calculating the hidden state mean and variance of the sample; S406. Constructing a feedforward network by means of logic rule calculation; S407. Optimizing focus perception loss by calculating focus weights of samples; S5. Enhance question answering with the improved Transformer model by combining the door lock knowledge graph.

2. The door lock information data processing and application method based on a large model and knowledge graph according to claim 1 is characterized in that: The door lock knowledge graph constructed by S1 for systematically storing concepts, entities and their relationships in the door lock field includes: S101 extracts domain knowledge data from door lock domain text data; S102. Use rule matching and entity linking techniques to extract door lock terminology from domain knowledge data. Map the different expressions of door lock terminology to the same node as a standardized node. Identify relational terms and establish relationships between the nodes to obtain multiple triples. S103. Use Neo4j graph database to store triples and verify the accuracy of the relationship.

3. The door lock information data processing and application method based on a large model and knowledge graph according to claim 2 is characterized in that: The domain knowledge data includes a glossary, a technical parameter table, and a fault solution.

4. The door lock information data processing and application method based on a large model and knowledge graph according to claim 1 is characterized in that: The S2 adopts a hierarchical acquisition strategy to obtain door lock information data, including: S201. Collect enterprise-level data; Enterprise-level data is the official documents provided by various door lock manufacturers; S202. Collect terminal user data; clean, filter and pre-process the terminal user data.

5. The door lock information data processing and application method based on a large model and knowledge graph according to claim 1 is characterized in that: The step S402 of initializing the embedding layer by the word embedding method includes: S4021. Use the pre-trained word embedding function to convert all unique normalized term vectors in the training corpus into vectors; calculate the average value of these converted vectors; add the average value to the embedding correction increment to obtain an initialization matrix for the embedding layer; S4022. Calculate the co-occurrence frequency of each normalized term vector in the corpus; calculate the maximum co-occurrence frequency among all terms; for each normalized term vector, divide its co-occurrence frequency by the sum of the maximum co-occurrence frequency and a smoothing constant to obtain a co-occurrence weighting factor for the term; for each normalized term vector, multiply the vector converted by the pre-trained word embedding function by its co-occurrence weighting factor; add the product results of all normalized term vectors, and multiply the sum by the adjustment rate of the embedding correction to obtain an embedding correction increment; S4023. Use a sliding window to count the co-occurrence frequency of each normalized term vector in the corpus; find the maximum co-occurrence frequency value among all normalized term vectors; divide the co-occurrence frequency of each normalized term vector by the maximum co-occurrence frequency value plus a smoothing constant to obtain the co-occurrence weighting factor of the term.

6. The door lock information data processing and application method based on a large model and knowledge graph according to claim 5 is characterized in that: Initialization matrix of the embedding layer in S4021 The calculation formula is: , Where, is the total number of unique terms in the training corpus; is a positive integer index; is the pre-trained word embedding function; For the Normalized term vectors; Correction increment for embedding.

7. The door lock information data processing and application method based on a large model and knowledge graph according to claim 1 is characterized in that: The step S403 of dynamically encoding the input terms of the improved Transformer model by calculating the term importance includes: S4031. For a term indexed at a given position in the sequence, calculate its standard sinusoidal position code; calculate the term importance function value of the normalized term vector corresponding to the term at that position; calculate the position offset vector for that position; and add the product of the term importance function value, the importance adjustment coefficient, and the position offset vector to the standard sinusoidal position code to obtain a dynamic position code vector. S4032. Count the frequency of documents containing the normalized term vector; count the term frequency of the normalized term vector in the entire corpus; find the maximum term frequency value of all terms in the corpus; divide the total number of documents by the document frequency containing the term, take the logarithm, and then multiply the result by the term frequency of the term divided by the maximum term frequency value to obtain a term importance function value of the normalized term vector; S4033. Set a local window size, and for a term with a given position index in the sequence, traverse each position index within the range determined by its position index plus or minus the local window size; calculate the absolute difference between the current traversal position index and the term position index; calculate the weight coefficient of the current traversal position relative to the term position index based on the absolute difference and the attenuation factor; subtract the term position index from the current traversal position index to obtain the relative position difference; multiply the weight coefficient of each traversal position by its corresponding relative position difference to obtain the product result of the traversal position; add the product results of all traversal positions to obtain a position offset vector.

8. The door lock information data processing and application method based on a large model and knowledge graph according to claim 1 is characterized in that: The S404 constructs a multi-head self-attention mechanism by using the importance gate calculation method, including: S4041. Add the initialization matrix of the embedding layer and the dynamic position code element-wise to obtain the embedding representation of the input sequence; perform linear transformation on the embedding representation of the input sequence to obtain the query matrix, key matrix and value matrix respectively; calculate the product of the query matrix and the transpose of the key matrix, and divide it by the square root of the key dimension; calculate the term importance gating function value of the embedding representation of the input sequence; multiply the product of the query matrix and the transpose of the key matrix by the term importance gating function value element-wise; calculate the multiplication result using the Softmax normalization function, and multiply the Softmax normalized result by the value matrix to obtain the gated attention output; S4042. Calculate the term importance function value for the normalized term vector corresponding to the input sequence embedding representation; multiply the term importance function value by the importance gating function weight matrix, and then add the value to the importance gating function bias vector; input the result into the Sigmoid function to obtain the term importance gating function value.

9. The door lock information data processing and application method based on a large model and knowledge graph according to claim 1 is characterized in that: The step S405 of adaptively adjusting the layer normalization of the improved Transformer model by calculating the hidden state mean and variance of the sample includes: S4051. Clustering samples into chapters based on text structure; determining the chapter cluster to which the currently input gated attention output feature belongs; calculating the mean of the gated attention output features of all samples in the chapter cluster as the hidden state mean of the current chapter cluster sample; calculating the variance of the gated attention output features of all samples in the chapter cluster as the hidden state variance of the current chapter cluster sample; subtracting the hidden state mean of the current chapter cluster sample from the input gated attention output feature, and then dividing the result by the square root of the sum of the hidden state variance of the current chapter cluster sample and a smoothing constant; multiplying the result by a first learnable parameter and adding the result to a second learnable parameter to obtain a normalized feature; S4052. Determine the chapter cluster to which the input gated attention output feature belongs; calculate the sum of the gated attention output feature values ​​of all samples in the chapter cluster, divide it by the number of samples in the cluster, and obtain the hidden state mean of the current chapter cluster samples; calculate the square of the gated attention output feature value of each sample in the chapter cluster minus the cluster mean, sum the square results of all samples, and then divide it by the number of samples in the cluster to obtain the hidden state variance of the current chapter cluster samples.

10. The door lock information data processing and application method based on a large model and knowledge graph according to claim 1 is characterized in that: The method of optimizing the focus perception loss by calculating the focus weight of the sample in S407 includes: S4071. For each sample, calculate its focal weight; calculate the cross entropy loss of the sample; multiply the focal weight of the sample by its cross entropy loss result; sum the weighted loss results of all samples and take the negative value to obtain the final loss function; S4072. For each sample, the focus weight of the sample is obtained by combining the focus parameters and multiplying the result by the risk function.

Citation Information

Patent Citations

  • Data intelligent question and answer method and system fusing domain knowledge

    CN118779438A

  • Information processing method and system based on large model and knowledge graph

    CN119226535A