Power fault diagnosis method and system based on large model retrieval enhancement
By utilizing a federated collaborative environment and large language model inference, the problems of data privacy and insufficient model generalization ability in power fault diagnosis are solved, achieving efficient and secure multimodal data fusion and accurate diagnosis.
Patent Information
- Application Number
- CN202511901008.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-03-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing power fault diagnosis technologies suffer from data privacy leaks and security risks. At the same time, distributed diagnosis methods lack model generalization ability and are unable to cope with complex cross-regional faults.
By constructing a federated collaborative environment, utilizing public key infrastructure and an initial cross-modal foundational model, a private vector index is generated for federated collaborative retrieval. Combined with large language model reasoning, fault diagnosis conclusions are generated, ensuring data privacy and security while improving diagnostic accuracy.
While protecting data privacy, the system effectively integrates multimodal heterogeneous power data, improving the accuracy and robustness of fault diagnosis and reducing data transmission costs and security risks.
Smart Images

Figure CN121706970A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of fault diagnosis technology, and in particular relates to a power fault diagnosis method and system based on large model retrieval enhancement. Background Technology
[0002] With the rapid development of smart grid and energy internet technologies, the scale, complexity, and intelligence level of power systems are constantly increasing, placing unprecedented demands on the real-time performance, accuracy, and reliability of power fault diagnosis. Data-driven intelligent diagnostic methods are gradually replacing traditional analysis methods based on physical models or human experience, becoming a current research hotspot. Against this backdrop, the data generated during power system operation is experiencing explosive growth, and its types are becoming increasingly diverse. It includes not only structured text logs and alarm information, but also a large amount of unstructured waveform data (such as voltage and current recordings) and image data (such as equipment infrared imaging and inspection photos), forming typical multimodal heterogeneous data. Simultaneously, due to the regional and hierarchical characteristics of power grid management, this valuable fault data is often scattered across different substations, power supply companies, or dispatch centers, forming "data silos."
[0003] Currently, the industry commonly employs two main technical approaches for power fault diagnosis. One is to build a centralized diagnostic system, where data from each node is uploaded to a centralized cloud platform or data center via a dedicated network, and the massive amount of aggregated data is used to train a globally unified diagnostic model. The other is distributed independent diagnosis, where each node independently deploys and runs a diagnostic model using only its local private data, with no data interaction or model collaboration between different nodes.
[0004] However, all of the aforementioned existing technologies have significant drawbacks. While centralized diagnostic systems can utilize global data, they require the complete exposure of raw power data, which may contain sensitive information, to the central platform. This poses serious risks of data privacy breaches and cybersecurity, failing to meet national management requirements for data security in critical infrastructure. Furthermore, the transmission of massive amounts of multimodal data incurs significant communication bandwidth costs and latency. While distributed independent diagnostic methods ensure the privacy and security of local data, the limited data volume and data types at each node result in models with narrow perspectives, poor generalization capabilities, and an inability to handle rare or complex cross-regional faults, ultimately failing to meet practical diagnostic accuracy requirements. Summary of the Invention
[0005] Therefore, it is necessary to provide a power fault diagnosis method and system based on large model retrieval enhancement, which can effectively integrate and utilize multimodal heterogeneous power data scattered in multiple locations without exposing the original data of each node, so as to improve the overall accuracy and robustness of fault diagnosis.
[0006] Firstly, this application provides a power fault diagnosis method based on large model retrieval enhancement, including:
[0007] S1. Initialize the federated network based on the registration information of each node in the federated network to obtain the federated cooperation environment; the federated cooperation environment includes public key infrastructure and initial cross-modal basic model;
[0008] S2. Based on the initial cross-modal basic model, the local multimodal heterogeneous power data of each node is vectorized to generate local private vector indexes for each node.
[0009] S3. Based on the fault diagnosis request, combined with the local private vector index and public key infrastructure of each node, perform federated collaborative retrieval to obtain a globally ranked list of knowledge fragments;
[0010] S4. Based on the globally sorted list of knowledge fragments and the fault diagnosis request, construct search enhancement suggestions to obtain search enhancement suggestions;
[0011] S5. Perform large language model reasoning on the enhanced search suggestions to generate fault diagnosis conclusion text.
[0012] In one embodiment, S3 includes:
[0013] S21. Based on the multimodal fault data in the fault diagnosis request, encode it using the initial cross-modal basic model to generate a query vector;
[0014] S22. Encrypt the query vector using public key infrastructure to generate an encrypted query vector.
[0015] S23. Distribute the encrypted query vector through a federated network to obtain the distribution task identifier;
[0016] S24. Collect encryption similarity results based on the distribution task identifier to obtain an encryption similarity result set;
[0017] S25. Decrypt the encrypted similarity result set using the private key to obtain the plaintext similarity score;
[0018] S26. Sort the knowledge fragments in descending order based on the plaintext similarity scores to generate a globally sorted list.
[0019] In one embodiment, the encryption similarity result generation step of S24 includes:
[0020] S241. For each local knowledge vector in the encrypted query vector and the local private vector index, perform a power multiplication operation between the ciphertext and plaintext numbers based on the properties of additive homomorphic encryption to obtain the encrypted dot product result; the formula for calculating the encrypted dot product result is:
[0021]
[0022] in, For query vector With local knowledge vectors The encrypted result of the dot product, For the query vector The encrypted value of the dimensional component, For local knowledge vectors The dimensional components, For vector dimensions, For public keys;
[0023] S242. Use the encrypted result of the dot product as the initial similarity score, and record the corresponding local knowledge vector identifier to generate initial similarity data;
[0024] S243. Aggregate and encapsulate the initial similarity data to generate encrypted similarity results for each node.
[0025] In one embodiment, S26 includes:
[0026] S261. Sort all candidate knowledge fragments in descending order according to plaintext similarity scores to obtain sorted candidate knowledge fragments.
[0027] S262. Perform similarity threshold filtering on the sorted candidate knowledge fragments to obtain high-scoring candidate knowledge fragments.
[0028] S263. Select the top K highest-ranked knowledge fragments from the high-scoring candidate knowledge fragments to generate a globally ranked knowledge fragment list; the globally ranked knowledge fragment list includes knowledge fragment identifiers, source nodes, and similarity scores.
[0029] In one embodiment, S4 includes:
[0030] S31. The fault multimodal data in the fault diagnosis request and the original text of the knowledge fragments in the globally sorted knowledge fragment list are structured and organized according to the preset prompt template to obtain structured data.
[0031] S32. For structured data, generate initial search enhancement prompts by filling in the prompt template; the prompt template includes role definition, task description, fault data display area, knowledge base fragment display area, and reasoning instruction area;
[0032] S33. Optimize the context length and enhance keywords of the initial search enhancement suggestions to generate search enhancement suggestions.
[0033] In one embodiment, S2 includes:
[0034] S41. The initial cross-modal base model is co-trained using a federated learning framework to obtain a globally consistent cross-modal base model;
[0035] S42. Based on a globally consistent cross-modal basic model, vectorize the local multimodal heterogeneous power data to generate an initial vector set.
[0036] S43. Construct an index for the initial vector set to generate local private vector indexes for each node.
[0037] In one embodiment, S41 includes:
[0038] S411. Based on the local private dataset of each node, train the initial cross-modal base model locally to obtain the model parameter update amount of each node.
[0039] S412. The model parameter update amounts of each node are made private to obtain encrypted model parameter update amounts; and the encrypted model parameter update amounts are uploaded to the coordination center.
[0040] S413. The coordination center performs secure aggregation on all received encrypted model parameter updates to obtain the global parameter update.
[0041] S414. Iteratively update the initial cross-modal basic model based on the global parameter update amount to obtain a globally consistent cross-modal basic model.
[0042] In one embodiment, S5 is followed by:
[0043] S51. Extract key information from the fault diagnosis conclusion text to obtain a set of diagnostic elements; the set of diagnostic elements includes the root cause of the fault, the evolution path, and the handling recommendations.
[0044] S52. Based on the preset report template, the diagnostic element set is laid out and filled to obtain semi-structured report data;
[0045] S53. Perform visualization rendering on the semi-structured report data to generate a fault diagnosis report containing charts and structured text.
[0046] In one embodiment, the large language model is fine-tuned and trained based on professional corpus in the field of power faults. The input of the large language model is retrieval enhancement prompts, and the output is fault diagnosis conclusion text.
[0047] Secondly, this application also provides a power fault diagnosis system based on large model retrieval enhancement, including:
[0048] The federated network initialization module is used to initialize the federated network based on the registration information of each node in the federated network, thereby obtaining the federated collaborative environment; the federated collaborative environment includes public key infrastructure and an initial cross-modal basic model.
[0049] The vectorization processing module is used to perform vectorization processing on the local multimodal heterogeneous power data of each node based on the initial cross-modal basic model, and generate local private vector indexes for each node.
[0050] The federated collaborative retrieval module is used to perform federated collaborative retrieval based on fault diagnosis requests, combining the local private vector indexes and public key infrastructure of each node, to obtain a globally ranked list of knowledge fragments.
[0051] The search enhancement suggestion building module is used to build search enhancement suggestions based on the globally sorted list of knowledge fragments and fault diagnosis requests, and obtain search enhancement suggestions.
[0052] The fault diagnosis reasoning module is used to perform large language model reasoning on the enhanced search suggestions and generate fault diagnosis conclusion text.
[0053] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement a power fault diagnosis method based on large model retrieval enhancement as described in the first aspect.
[0054] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a power fault diagnosis method based on large model retrieval enhancement as described in the first aspect.
[0055] The aforementioned power fault diagnosis method and system based on large-model retrieval enhancement, by constructing a federated collaborative environment and generating private vector indexes locally on each node, ensures that the original multimodal power data does not need to leave the domain, fundamentally guaranteeing data privacy and security. Based on this, the federated collaborative retrieval mechanism can effectively integrate knowledge scattered across multiple locations without aggregating the original data, breaking the data silo limitations of traditional distributed diagnosis. Finally, by constructing retrieval enhancement prompts from globally retrieved knowledge fragments to guide the large language model in reasoning, not only is model illusion avoided, but more reliable and comprehensive diagnostic conclusions are also generated. Thus, while protecting data privacy, the accuracy and robustness of fault diagnosis are significantly improved. Attached Figure Description
[0056] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0057] Figure 1 A schematic diagram illustrating the implementation environment of a power fault diagnosis method based on large model retrieval enhancement provided by the present invention;
[0058] Figure 2 A flowchart illustrating a power fault diagnosis method based on large model retrieval enhancement provided by the present invention;
[0059] Figure 3 This is a schematic diagram of the structure of a power fault diagnosis system based on large model retrieval enhancement provided by the present invention. Detailed Implementation
[0060] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0061] This application provides a power fault diagnosis method based on large model retrieval enhancement, which can be applied to, for example... Figure 1In the implementation environment shown, the power monitoring center terminal 101 communicates bidirectionally with the coordination center server 102 via the network, the federated node device 103 establishes a bidirectional communication link with the coordination center server 102 via the network, and the power monitoring center terminal 101 connects to the maintenance mobile terminal 104 via the network to send fault diagnosis reports. The data storage system can store local device data; the data storage system can be integrated on the coordination center server 102, or it can be placed on a dedicated power cloud or other network server. The coordination center server 102 can be implemented using a standalone coordination center server or a coordination center server cluster composed of multiple servers; the federated node device can be, but is not limited to, a substation edge gateway, a transmission line monitoring node, or a distribution terminal data acquisition device.
[0062] In one exemplary embodiment, such as Figure 2 As shown, a power fault diagnosis method based on large model retrieval enhancement is provided, and this method is applied to... Figure 1 Taking the power monitoring center terminal as an example, the following steps are taken: S1 to S5.
[0063] S1. Initialize the federated network based on the registration information of each node in the federated network to obtain the federated collaboration environment; the federated collaboration environment includes public key infrastructure and initial cross-modal basic model.
[0064] Optionally, the registration information includes a unique node identifier, data modality type, computing resource configuration, and secure communication protocol version. Asymmetric encryption algorithms are used to verify the integrity and legitimacy of each node's information, eliminating nodes with forged information or those that do not meet collaboration requirements. The public key infrastructure uses the RSA algorithm (Rivest-Shamir-Adleman Algorithm) to generate globally unified key pairs. Each node completes encrypted communication configuration by obtaining the public key, while the private key is stored independently locally by the node and is not transmitted over the network. The initial cross-modal base model uses a pre-trained CLIP model (Contrastive Language-Image Pre-training), which has been initialized using a large-scale public multimodal dataset and supports unified feature extraction from text, image, and waveform data. This model is distributed to each node through a federated network to ensure the consistency of the initial cross-modal base model.
[0065] S2. Based on the initial cross-modal basic model, the local multimodal heterogeneous power data of each node is vectorized to generate local private vector indexes for each node.
[0066] Optionally, multimodal heterogeneous power data includes structured text logs and alarm information, unstructured voltage and current waveform data, and equipment infrared imaging and inspection photo image data. The initial cross-modal basic model uses a built-in modal adaptation module to process different types of data in a targeted manner. Text data is segmented and embedded before being input into a text encoder to generate feature vectors. Waveform data is converted into Mel spectrograms and then features are extracted by an image encoder. Image data is directly processed by an image encoder. The feature vector dimension of all modal data is uniformly 512-dimensional. The generated feature vectors are used to construct an approximate nearest neighbor index using the FAISS (Facebook AI Similarity Search) tool. During the index construction process, the IVF_FLAT (Inverted File Flat) algorithm is used to cluster and partition the vectors. Each partition corresponds to an independent index substructure. The final private vector index is stored in the local storage unit of the node and is not transmitted across nodes.
[0067] S3. Based on the fault diagnosis request, and combining the local private vector indexes and public key infrastructure of each node, perform federated collaborative retrieval to obtain a globally ranked list of knowledge fragments.
[0068] Optionally, the fault diagnosis request is input in text form, containing core information such as the fault occurrence time, device number, and description of the abnormal phenomenon. This text is converted into a query vector with dimensions consistent with the private vector index by the text encoder of the initial cross-modal base model. Each node performs an approximate nearest neighbor search on its local private vector index based on the query vector, obtaining the top-50 similar local knowledge fragments and their corresponding similarity scores. The search process uses Euclidean distance to calculate vector similarity, using the formula: ,in For query vector, The feature vector in the index, For the number of indexes, The vector dimension is used. After encrypting the local search results through public key infrastructure, the encrypted similarity score and knowledge fragment identifier are sent to the federated collaboration nodes. A secure aggregation protocol is used to weight and fuse the results from each node. The weight coefficients are determined based on the node data quality assessment results. Finally, the knowledge fragments are sorted in descending order of the fused similarity score to form a globally ranked list.
[0069] S4. Based on the globally sorted list of knowledge fragments and the fault diagnosis request, construct search enhancement suggestions to obtain search enhancement suggestions.
[0070] Optionally, the top-20 highly similar knowledge fragments are selected from the globally ranked knowledge fragment list. Key information such as fault feature parameters, historical processing schemes, and fault-related factors are extracted from each fragment, while redundant content or content irrelevant to the fault diagnosis request is removed. The selected knowledge fragments are logically sorted according to their relevance to fault type and occurrence scenario, and structurally integrated with the core requirements of the fault diagnosis request to construct a retrieval enhancement prompt comprising three parts: background information, query question, and reference knowledge. The background information clarifies the power system operating scenario and the basic conditions for fault occurrence; the query question accurately expresses the fault question to be diagnosed; and the reference knowledge presents the key content of relevant knowledge fragments in order of similarity. Preferably, the reference knowledge is processed using natural language formatting to ensure that the prompt text conforms to the input format requirements of the large language model, thereby improving the accuracy of reasoning.
[0071] S5. Perform large language model reasoning on the enhanced search suggestions to generate fault diagnosis conclusion text.
[0072] Optionally, the retrieval enhancement prompts, as model input, must first undergo word segmentation processing adapted to the model. The prompt text is converted into a corresponding token sequence using the model's built-in vocabulary, mapped to a fixed-dimensional embedding vector, and [CLS] start markers and [SEP] separator markers are added to clarify the input boundaries, ensuring the input format conforms to the model's contextual processing requirements. During the model inference phase, relying on the Transformer architecture's encoder-decoder structure, the encoder semantically encodes the input retrieval enhancement prompts, capturing the association features between fault requests and knowledge fragments. The decoder, based on the encoded features and domain knowledge learned through model fine-tuning, outputs diagnostic conclusion text token by token through an autoregressive generation method. During inference, a bundle search strategy is used to control generation quality. Reasonable bundle width configuration balances generation speed and result accuracy, while a repetition penalty mechanism is introduced to avoid text redundancy. The temperature coefficient is configured according to the principle of balancing output determinism and flexibility, and the maximum generation length is reasonably set according to the completeness requirements of the information needed for fault diagnosis, ensuring that the output fault diagnosis conclusion text is logically coherent, complete in elements, covers key content such as fault type determination, core root cause analysis, and specific handling suggestions, and conforms to the professional expression standards of the power industry.
[0073] The aforementioned power fault diagnosis method based on large model retrieval enhancement constructs a secure collaborative environment through federated network initialization, utilizes an initial cross-modal basic model to vectorize multi-source data and build private indexes, integrates global knowledge through federated collaborative retrieval, optimizes model input through retrieval enhancement prompts, and finally generates diagnostic conclusions based on large language model reasoning. This method not only ensures the data privacy and security of each node but also achieves the effective utilization of global knowledge, significantly improving the accuracy and real-time performance of power fault diagnosis while reducing data transmission costs and security risks, thus meeting the high requirements of smart grids for fault diagnosis.
[0074] In one embodiment, S3 includes:
[0075] S21. Based on the multimodal fault data in the fault diagnosis request, encode it using the initial cross-modal basic model to generate a query vector.
[0076] Optionally, the multimodal fault data includes structured text descriptions, voltage and current waveform data, and equipment status image data related to the current fault. This data follows the same data format specifications as the multimodal heterogeneous power data stored locally on the node. The initial cross-modal basic model uses the deployed CLIP model. This model maintains the same technical path for fault data encoding logic and local data vectorization processing. Specifically, text-based fault data is segmented and mapped to indices in a pre-trained vocabulary. Feature representations are generated through the multi-head attention mechanism of the model's text encoder and feedforward neural network operations. Waveform-based fault data is first converted to Mel-spectrum format and then input into the model's image encoder for feature extraction. Image-based fault data is directly fed into the image encoder for encoding. All modal fault data, after encoding, outputs a dense vector of a uniform dimension, which is the query vector. Its dimension is strictly consistent with the feature vector dimension of the node's local private vector index.
[0077] S22. Encrypt the query vector using public key infrastructure to generate an encrypted query vector.
[0078] Optionally, the RSA algorithm provided by the public key infrastructure (PKIC) possesses asymmetric encryption characteristics, and the encryption process strictly adheres to the PKCS#1 v2.2 standard padding scheme to ensure encryption security. Specifically, the query vector is first serialized into a byte stream data that conforms to RSA encryption requirements. The serialization uses Protocol Buffers (Google Protocol Buffers) format, which effectively compresses data volume and maintains cross-platform compatibility. Then, the RSA algorithm's public key encryption interface is called, using the federated network's global public key as the encryption key, to perform a modular exponentiation operation on the serialized byte stream. The encryption formula is: ,in The encrypted ciphertext, This is the serialized query vector byte stream. The public key exponent for the RSA algorithm. The modulus of the RSA algorithm is denoted by , and the public key consists of (e, n). After encryption, the ciphertext data is encapsulated in a fixed format to generate an encrypted query vector. This vector can only be decrypted using the corresponding private key, ensuring that the query vector does not reveal the original feature information during network transmission.
[0079] S23. Distribute the encrypted query vector through a federated network to obtain the distribution task identifier.
[0080] Optionally, the distribution task identifier is a unique identifier generated by combining a 32-bit random string, a unique fault diagnosis request ID, and a timestamp. Its generation process uses SHA-256 (Secure Hash Algorithm 256) to hash the combined information, ensuring the identifier's uniqueness and unforgeability. The federated network distribution adopts a point-to-point communication mode, building a reliable data transmission channel based on the TCP / IP (Transmission Control Protocol / Internet Protocol) protocol. During transmission, TLS 1.3 (Transport Layer Security 1.3) is used to encrypt the communication link. In specific implementation, a list of communication addresses of all registered nodes within the federated network is first obtained, sorted by node network bandwidth and load status, and transmission requests are initiated to nodes with better network conditions. The transmitted content includes an encrypted query vector, the distribution task identifier, and a data checksum. Each node must return an acknowledgment response after receiving data. If no response is received within a timeout period, a retransmission mechanism is triggered until all nodes have completed receiving. The final output includes the task identifier, a list of receiving nodes, and the transmission completion time.
[0081] S24. Collect encryption similarity results based on the task distribution identifier to obtain an encryption similarity result set.
[0082] Optionally, the encrypted similarity result is the encrypted similarity score and corresponding knowledge fragment identifier calculated by each node based on its local private vector index and encrypted query vector, with the encryption method consistent with the encrypted query vector. The collection process uses the distribution task identifier as the core retrieval basis, receiving result data uploaded by each node through the federated network's result feedback channel. The feedback channel adopts a publish-subscribe model, with all nodes uploading results to a designated feedback topic. Specifically, the receiving end continuously monitors the feedback topic, first verifying the consistency of the distribution task identifier for each received result, confirming task matching through SHA-256 hash value comparison, and then verifying the data checksum to ensure result integrity. For duplicate uploaded results, the latest received version is retained; for missing or corrupted results, a re-upload request is initiated through the node list associated with the distribution task identifier. After the preset collection timeout expires or all nodes have completed uploading, all valid results are summarized and organized to form an encrypted similarity result set. The set is stored in key-value pairs, where the key is the distribution task identifier and the value is the encrypted similarity result list of each node.
[0083] S25. Decrypt the encrypted similarity result set using the private key to obtain the plaintext similarity score.
[0084] Optionally, the private key is an RSA algorithm private key stored independently on the node, consisting of (d, n), where d is the private key exponent and n is the modulus consistent with the public key. The private key storage is protected using a Hardware Security Module (HSM) or an encrypted file system to prevent leakage. The decryption process first extracts the encryption result of each node from the encryption similarity result set, performs depadding according to the PKCS#1 v2.2 standard padding scheme to remove the padding bytes added during encryption, and then calls the RSA algorithm's private key decryption interface, using the private key as the decryption key to perform modular exponentiation. The decryption formula is: ,in For the decrypted plaintext data, For the encrypted similarity results, d is the private key exponent and n is the modulus. The decrypted data is deserialized to restore the correspondence between similarity scores and knowledge fragment identifiers. At the same time, the plaintext data is validated, and results with scores exceeding a reasonable range or with abnormal identifier formats are removed. Finally, a set of plaintext similarity scores containing only valid data is obtained.
[0085] S26. Sort the knowledge fragments in descending order based on the plaintext similarity scores to generate a globally sorted list.
[0086] Optionally, the plaintext similarity score set includes the knowledge fragment identifier returned by each node, the corresponding similarity score, and the node source information. Deduplication is performed before sorting. For multiple records with the same knowledge fragment identifier, the entry with the highest similarity score is retained, and other duplicate records are removed to avoid data redundancy. Sorting uses the quicksort algorithm, which divides the dataset into multiple subsets using a divide-and-conquer strategy and recursively sorts them. The core sorting key is the similarity score, and the sorting direction is set to descending, meaning knowledge fragments with higher scores are ranked higher. If multiple records have completely identical similarity scores, the generation time of the knowledge fragment is used as a secondary sorting key, prioritizing entries with more recent generation times to ensure the uniqueness and rationality of the sorting results. After sorting, the knowledge fragment identifier, similarity score, and corresponding node source information are extracted according to the final sorting order and combined using a fixed data structure to form a globally sorted knowledge fragment list. Each record in the list has complete fields and a uniform format.
[0087] In the above embodiments, query vectors are generated by encoding fault multimodal data. After encryption distribution, result collection, decryption, and sorting, refined execution of federated collaborative retrieval is achieved by reusing existing cross-modal models and encryption systems. This not only ensures the privacy and security of query and result transmission through asymmetric encryption, but also ensures the relevance and orderliness of global knowledge fragments through standardized sorting logic, effectively avoiding the risk of data leakage, while improving the efficiency and accuracy of federated retrieval.
[0088] In one embodiment, the encryption similarity result generation step of S24 includes:
[0089] S241. For each local knowledge vector in the encrypted query vector and the local private vector index, perform a power multiplication operation between the ciphertext and plaintext numbers based on the properties of additive homomorphic encryption to obtain the encrypted dot product result; the formula for calculating the encrypted dot product result is:
[0090]
[0091] in, For query vector With local knowledge vectors The encrypted result of the dot product, For the query vector The encrypted value of the dimensional component, For local knowledge vectors The dimensional components, For vector dimensions, This is the public key.
[0092] Optionally, the additive homomorphic encryption employs the Paillier algorithm (Paillier Cryptosystem), which possesses the additive homomorphic property, meaning that multiplying ciphertext is equivalent to adding plaintext. Its mathematical foundation lies in the large integer factorization and quadratic residues problem, perfectly suited to the encryption requirements of dot product operations. The encrypted query vector has been split and stored dimensionally, with each dimension corresponding to an independent ciphertext component. Local knowledge vectors Dimensional components In plaintext format, it originates from feature vectors generated during the construction of the local private vector index. Specifically, it first iterates through each local knowledge vector in the local private vector index, and then, for each individual local knowledge vector... Extract its components from dimension 1 to dimension d sequentially. to Simultaneously, it matches the d ciphertext components corresponding to the encrypted query vector. to Perform ciphertext exponentiation on each dimension, i.e., calculate... of The exponentiation operation is efficiently implemented using modular exponentiation. The results of exponentiation across all dimensions are then subjected to modular product operations, and the final product is the query vector. With local knowledge vectors The encrypted result of the dot product follows the operational logic of the given formula completely, ensuring that the dot product calculation is completed within the ciphertext field without revealing the plaintext information.
[0093] S242. Use the encrypted result of the dot product as the initial similarity score and record the corresponding local knowledge vector identifier to generate initial similarity data.
[0094] Optionally, the dot product result is the core representation of vector similarity. Given that the vectors have been normalized, the dot product value is positively correlated with the cosine similarity value. Therefore, the encrypted dot product result can be directly used as the initial similarity score without additional conversion calculations. The local knowledge vector identifier is a unique string identifier assigned to each local knowledge vector during the private vector index construction phase. It is composed of the knowledge fragment source, generation time, and a random sequence. SHA-256 hashing ensures the identifier's uniqueness, and this identifier corresponds one-to-one with the locally stored knowledge fragment. When generating the initial similarity data, a key-value pair data structure is used, with the local knowledge vector identifier as the key and the corresponding encrypted dot product result as the value. A timestamp is also appended to each data entry for subsequent duplicate result detection. Specifically, the encrypted dot product results of all local knowledge vectors are traversed, and their corresponding local knowledge vector identifiers are associated with each one. These are then encapsulated into key-value pair records in a unified format. All records are summarized to form the initial similarity data list, where each record contains complete identifier and encrypted score information.
[0095] S243. Aggregate and encapsulate the initial similarity data to generate encrypted similarity results for each node.
[0096] Optionally, the aggregation and encapsulation process uses the initial similarity data list as the processing object. First, the records in the list are validated, and invalid records with abnormal identifier formats or encryption result lengths that do not conform to the Paillier algorithm ciphertext specifications are removed. After successful validation, valid records are grouped according to the category of the local knowledge vector. The grouping is based on the fault type label corresponding to the knowledge fragment, which is associated with and stored with the knowledge vector during the local data vectorization stage. Preferably, after grouping, each group of records is sorted according to the ciphertext length of the initial similarity score, which improves processing efficiency during global sorting. Then, an encapsulation operation is performed using Protocol Buffers, a format that supports cross-platform data interaction and has excellent compression efficiency. The encapsulated content includes the grouped initial similarity data list, data checksum, and node identifier information. The data checksum is generated by hashing the initial similarity data list using the SHA-256 algorithm. The node identifier is a unique node ID assigned during the federated network registration stage. The encrypted similarity result generated after encapsulation maintains the encrypted state of the data while possessing complete association information and a verification mechanism, and can be directly used for cross-node transmission and result aggregation.
[0097] In the above embodiments, based on the Paillier additive homomorphic encryption algorithm, the dot product calculation of the query vector and the local knowledge vector is completed in the ciphertext domain. The encrypted similarity result is generated through identifier association and standardized encapsulation. This not only continues the privacy protection characteristics of the original encryption system, but also realizes effective operation in the ciphertext domain through homomorphic encryption, avoiding the risk of plaintext leakage. At the same time, the standardized data structure and verification mechanism ensure the integrity and compatibility of the results, improving the security and efficiency of federated collaborative retrieval.
[0098] In one embodiment, S26 includes:
[0099] S261. Sort all candidate knowledge fragments in descending order according to plaintext similarity scores to obtain sorted candidate knowledge fragments.
[0100] Optionally, the plaintext similarity score is the effective dot product derived score obtained after decryption with the private key. Its value directly reflects the degree of correlation between the candidate knowledge fragment and the fault diagnosis request. The sorting algorithm uses quicksort, which is based on the divide-and-conquer approach. It divides the candidate knowledge fragment set into two subsets by selecting a pivot element. In one subset, all elements have scores greater than the pivot element, and in the other subset, all elements have scores less than the pivot element. This division process is recursively executed until all subsets contain only a single element, thus completing the overall sorting. Specifically, the plaintext similarity score is used as the core sorting key, and the sorting direction is set to descending, meaning that candidate knowledge fragments with higher plaintext similarity scores rank higher in the sorting results. If multiple candidate knowledge fragments have completely identical plaintext similarity scores, the generation time of the knowledge fragment is used as the secondary sorting key, prioritizing candidate knowledge fragments with more recent generation times to ensure the uniqueness and rationality of the sorting results. During the sorting process, the knowledge fragment identifier and source node information corresponding to each candidate knowledge fragment are simultaneously retained to avoid the loss of related information after sorting. The final output is a sorted set of candidate knowledge fragments arranged according to the above rules.
[0101] S262. Perform similarity threshold filtering on the sorted candidate knowledge fragments to obtain high-scoring candidate knowledge fragments.
[0102] Optionally, the similarity threshold is a predefined criterion based on the accuracy requirements of fault diagnosis. Its setting is based on the minimum relevance requirements of knowledge fragments in power fault diagnosis scenarios, independent of specific numerical parameters, and supports dynamic adjustment according to actual application scenarios. During filtering, the plaintext similarity score of each sorted candidate knowledge fragment is extracted and compared with the predefined similarity threshold. Specifically, candidate knowledge fragments with plaintext similarity scores greater than or equal to the similarity threshold are retained, while those with plaintext similarity scores less than the similarity threshold are removed. Each comparison result must be recorded during the filtering process to form a filtering log for subsequent traceability, while ensuring that the filtering operation does not change the original sorting order of the retained candidate knowledge fragments. Preferably, the similarity threshold can be validated before filtering to confirm that it is within a reasonable score range, avoiding the accidental deletion of valid knowledge fragments or the retention of too many invalid knowledge fragments due to abnormal threshold settings, ultimately resulting in a set of high-scoring candidate knowledge fragments with high relevance.
[0103] S263. Select the top K highest-ranked knowledge fragments from the high-scoring candidate knowledge fragments to generate a globally ranked knowledge fragment list; the globally ranked knowledge fragment list includes knowledge fragment identifiers, source nodes, and similarity scores.
[0104] Optionally, K is a predefined quantitative parameter based on the input length limit of the large language model and the sufficiency of fault diagnosis knowledge requirements. Its setting needs to balance the comprehensiveness of diagnostic results with model inference efficiency, and supports flexible configuration according to the performance of the selected large language model and the actual diagnostic scenario. The selection operation is based on the existing sorting order of high-scoring candidate knowledge fragments. Starting from the top-ranked knowledge fragment, the first K knowledge fragments are selected sequentially. If the total number of high-scoring candidate knowledge fragments is less than K, all high-scoring candidate knowledge fragments are selected to ensure no valid information is missed. When generating a globally sorted list of knowledge fragments, the associated information of each knowledge fragment is entered sequentially according to the selection order. The knowledge fragment identifier uniquely points to the corresponding original knowledge content, the source node information records the federated network node to which the knowledge fragment belongs, and the similarity score is the plaintext similarity score of the knowledge fragment. These three are combined according to a fixed data structure to form each record in the list, and the list as a whole maintains the sorting order at the time of selection.
[0105] In the above embodiments, the candidate knowledge fragments are sorted in descending order using a fast sorting algorithm, low-relevance fragments are filtered out by a similarity threshold, and core knowledge fragments are selected according to a predefined K value to generate a standardized list. This approach ensures the relevance and effectiveness of knowledge fragments through sorting and filtering, adapts to different application scenarios through flexibly configurable thresholds and K values, and fully preserves key related information.
[0106] In one embodiment, S4 includes:
[0107] S31. The fault multimodal data in the fault diagnosis request and the original text of the knowledge fragments in the globally sorted knowledge fragment list are structured and organized according to the preset prompt template to obtain structured data.
[0108] Optionally, the preset prompt template is a fixed text framework designed based on the reasoning habits of large language models. Its core function is to standardize the data organization logic and ensure that fault-related information can be efficiently identified by the model. The structured processing of multimodal fault data requires first converting different modal information into a unified text description format. Specifically, text-based fault data directly retains the original key information; waveform data is transformed into trend descriptions through feature extraction, such as voltage fluctuation amplitude and current mutation characteristics; and image data extracts key visual features, such as abnormal heating areas of equipment and component damage patterns. The original text of globally sorted knowledge fragments needs to extract key information such as fault type, core features, and handling measures, eliminating redundant descriptions. During structured organization, multimodal fault data is sorted according to the fault occurrence sequence and data importance, while the original text of knowledge fragments maintains the priority of the global sort. The two types of information are mapped to the preset information partition fields of the prompt template, ensuring that each field contains only the corresponding type of structured content, avoiding information confusion, and ultimately forming structured data with clear fields and logical coherence.
[0109] S32. For structured data, generate initial search enhancement prompts by filling them into the prompt template; the prompt template includes role definition, task description, fault data display area, knowledge base fragment display area, and reasoning instruction area.
[0110] Optionally, the prompt template clearly defines the role of the large language model, requiring it to act as a power fault diagnosis expert, possessing the ability to interpret multimodal fault data and correlate it with knowledge base information. The task description explicitly requires the model to infer the fault type, cause, impact range, and handling plan based on the provided fault data and knowledge base fragments. The fault data display area presents the structured multimodal fault data, the knowledge base fragment display area lists key information of knowledge fragments in a globally sorted order, and the inference instruction area explicitly requires the model's output conclusions to be logically rigorous, well-founded, and operable. During the population process, structured data is entered into each area of the template according to the field correspondence. The fault data display area fully retains the structured multimodal information description, while the knowledge base fragment display area marks the similarity score and source node of each knowledge fragment to enhance information credibility. After population, the completeness of each area's content needs to be verified to ensure no field omissions or information mismatches, ultimately generating a formatted and complete initial retrieval enhancement prompt.
[0111] S33. Optimize the context length and enhance keywords of the initial search enhancement suggestions to generate search enhancement suggestions.
[0112] Optionally, context length optimization is performed based on the maximum context window limit of the selected large language model. Specifically, redundant information in the initial retrieval enhancement prompts is simplified using text compression technology, prioritizing the retention of key content such as core fault features and highly similar knowledge fragments. For excessively long text descriptions, a key sentence extraction algorithm (based on TF-IDF, Term Frequency-Inverse Document Frequency) is used to filter core sentences, removing repetitive expressions and secondary information irrelevant to fault diagnosis. Keyword enhancement processing first extracts equipment type, abnormal parameters, fault feature words, and core technical terms from knowledge fragments in the fault data through part-of-speech tagging and named entity recognition. Then, these keywords are reasonably reused in key positions in the prompt text, such as at the beginning and near the inference instruction area, or the keyword expression is enriched through synonym substitution to ensure that the model can quickly capture core information. During the optimization and enhancement process, it is necessary to balance information integrity and text length to avoid the loss of key information due to excessive compression, ultimately generating retrieval enhancement prompts with a length adapted to model requirements and highlighting core information.
[0113] In the above embodiments, fault data and knowledge fragments are integrated through structured organization, and initial prompts are generated based on standardized templates. The quality of the prompts is improved through length optimization and keyword enhancement. This ensures the integrity and logic of the information and adapts to the reasoning needs of large language models. It enables the model to accurately capture core fault information and related knowledge, effectively improving the efficiency and accuracy of fault diagnosis reasoning and laying the foundation for generating reliable fault diagnosis conclusions.
[0114] In one embodiment, S2 includes:
[0115] S41. The initial cross-modal base model is collaboratively trained using a federated learning framework to obtain a globally consistent cross-modal base model.
[0116] Optionally, the federated learning framework uses the mature FedAvg (Federated Averaging) algorithm, a widely used parameter aggregation algorithm in the federated learning field. Its core principle is to achieve global collaborative updates of model parameters without sharing local data. Specifically, each node trains the initial cross-modal basic model locally based on local multimodal heterogeneous power data. During local training, the Stochastic Gradient Descent (SGD) algorithm is used to minimize the model loss function. After completing a preset number of local training rounds, only the model's weight parameters, such as the convolutional layer weights and fully connected layer parameters of the encoder, are extracted and uploaded to the federated collaboration nodes after being encrypted using public key infrastructure. After receiving the encrypted parameters from all nodes, the federated collaboration nodes decrypt them using a secure aggregation protocol and perform global parameter aggregation. The aggregation formula is: ,in These are the globally updated model parameters. This refers to the number of nodes participating in training within the federal network. For the first The number of local training samples per node. For the first Each node uploads its local model parameters. After aggregation, the globally consistent model parameters are encrypted and distributed to each node. Each node replaces its local model parameters, completing one round of collaborative training. This process is repeated until the model performance converges, ultimately resulting in a globally consistent cross-modal base model, ensuring that the model parameters of all nodes are completely consistent.
[0117] S42. Based on a globally consistent cross-modal basic model, vectorize the local multimodal heterogeneous power data to generate an initial vector set.
[0118] Optionally, the globally consistent cross-modal base model inherits the modality adaptation capability of the initial cross-modal base model and eliminates the distribution offset of local models at each node through federated collaborative training, making the feature extraction logic and vector space of all nodes completely unified. During vectorization processing, this global model is used to perform the same modality adaptation and feature encoding process on local multimodal heterogeneous power data as the initial cross-modal base model. Specifically, the preprocessing methods for text, waveform, and image data remain unchanged, but the feature extraction process relies on the unified parameters of the global model to ensure that different nodes generate feature vectors with the same dimension and semantic consistency for power data of the same type and semantics. The generated feature vectors still maintain a unified dimension, and their vector space is determined by the distribution characteristics of the global training data, rather than the local data distribution of a single node. This effectively avoids the vector space heterogeneity problem caused by independent training models, enabling the vectors generated by each node to have comparable semantic correlation across nodes, ultimately forming the initial vector set of each node.
[0119] S43. Construct an index for the initial vector set to generate local private vector indexes for each node.
[0120] Optionally, the initial vector set is generated by a globally consistent cross-modal base model, ensuring all vectors have a unified dimension and semantic space, thus guaranteeing the compatibility of index construction and the accuracy of retrieval. Index construction still uses the IVF_FLAT algorithm from the FAISS tool. Specifically, the initial vector set is first globally clustered using the K-means clustering algorithm, dividing the vector set into multiple non-overlapping cluster partitions. Each partition corresponds to an index substructure, with Euclidean distance between vectors used as the similarity metric during clustering. Subsequently, a flat index is built for each cluster partition. The flat index stores all vectors within that partition using an exact matching method, ensuring the accuracy of similarity calculations during retrieval. During index construction, the local knowledge fragment identifier corresponding to each vector is recorded synchronously, establishing a one-to-one mapping between vectors and original knowledge fragments. The index structure is entirely stored locally on each node, without cross-node transmission, ensuring data privacy. Because the generated private vector index is built on a globally consistent vector space, it has cross-node retrieval compatibility, ensuring semantic consistency in vector similarity calculation results across different nodes during subsequent federated collaborative retrieval, ultimately forming a local private vector index for each node.
[0121] In the above embodiments, federated collaborative training of cross-modal base models is achieved through the FedAvg algorithm. Under the premise of ensuring data privacy, a globally consistent cross-modal base model is obtained. Based on this model, a semantically unified initial vector set is generated and a private vector index is constructed. This not only avoids the security risks of data sharing, but also solves the vector heterogeneity problem caused by independent models, and improves the accuracy and compatibility of cross-node vector retrieval.
[0122] In one embodiment, S41 includes:
[0123] S411. Based on the local private dataset of each node, train the initial cross-modal base model locally to obtain the model parameter update amount of each node.
[0124] Optionally, the private dataset consists of multimodal heterogeneous power data stored locally on each node, covering labeled fault samples and normal operation samples. The sample labeling information includes fault type, feature parameters, and handling results, providing supervision signals for model training. The local training process starts with an initial cross-modal base model, employing a supervised learning paradigm. The loss function is a weighted combination of contrastive loss and cross-entropy loss, where contrastive loss optimizes the semantic consistency of cross-modal features, and cross-entropy loss enhances the discriminative ability of fault classification. During training, the model parameters are iteratively updated using a stochastic gradient descent algorithm. Each iteration first randomly samples a batch of samples from the private dataset, preprocesses them, inputs them into the model to generate prediction results, calculates the loss value between the prediction results and the labeled information, then uses backpropagation to solve for the gradient of the loss function with respect to the parameters of each layer, and finally adjusts the parameters according to a preset learning rate. The formula for calculating the model parameter update is: ,in For the first The amount of model parameter updates for each node. These are the local model parameters before the update. For learning rate, The gradient of the loss function. For the first The local training sample set of each node is used to iterate through a preset batch and output the final model parameter update.
[0125] S412. The model parameter update amounts of each node are made private to obtain encrypted model parameter update amounts; and the encrypted model parameter update amounts are uploaded to the coordination center.
[0126] Optionally, privacy processing employs the same RSA asymmetric encryption algorithm as described above, with the core objective of ensuring that the original information of the model parameter updates is not leaked during transmission. Specifically, the model parameter updates are first serialized in a layered structure and converted into a byte stream in Protocol Buffers format. During serialization, metadata such as parameter dimensions and data types are preserved to ensure accurate reconstruction after decryption. Then, the public-key encryption interface of the RSA algorithm is called, using the global public key of the federated network as the key to perform encryption operations on the serialized byte stream. The encryption process follows the PKCS#1 v2.2 standard padding scheme to prevent brute-force attacks on plaintext information. After encryption, a data packet containing the encrypted parameter updates, node identifiers, and a data checksum is generated. The data checksum is generated using the SHA-256 algorithm to verify the integrity of data transmission. The data packet is uploaded to the coordination center via a secure communication link based on the TLS 1.3 protocol. During the upload process, the transmission status is monitored in real time, and if an interruption occurs, a resume mechanism is triggered to ensure the complete delivery of the encrypted model parameter updates.
[0127] S413. The coordination center performs secure aggregation on all received encrypted model parameter updates to obtain the global parameter update.
[0128] Optionally, after receiving data packets uploaded by all nodes, the coordination center first verifies the integrity of each data packet using a data checksum, discarding invalid data packets that fail verification or have abnormal identifiers. The secure aggregation processing, based on the core logic of the FedAvg algorithm, first uses the private key of the RSA algorithm to decrypt the encrypted model parameter updates in valid data packets, restoring them to plaintext form. The decryption process strictly follows the depadding rules of the PKCS#1 v2.2 standard. Then, a global parameter aggregation operation is performed, with the aggregation formula as follows: ,in This is the global parameter update amount. The number of valid nodes participating in the aggregation. For the first The number of local training samples per node. For the first The plaintext model parameter update amount of each node. During the aggregation process, the number of node samples is used as the weight to ensure that nodes with larger data volumes and more representative samples contribute more to the global update amount. After aggregation, the validity of the global parameter update amount is verified to confirm that its value range is within a reasonable range, so as to avoid abnormal parameters affecting model performance.
[0129] S414. Iteratively update the initial cross-modal basic model based on the global parameter update amount to obtain a globally consistent cross-modal basic model.
[0130] Optionally, the iterative update uses the parameters of the initial cross-modal base model as a reference, and incorporates the global parameter update obtained from secure aggregation into the original model parameters by adding them element-wise. The update formula is as follows: ,in For the updated model parameters, These are the parameters of the initial cross-modal base model. This represents the global parameter update amount. After the update, the new model parameters are serialized, encrypted with a public key, and distributed to all nodes in the federated network. Each node receives, decrypts, and replaces its local model parameters, completing one round of iterative update. The process from S411 to S413 is repeated to perform multiple rounds of collaborative training. The iteration termination condition is set when the model's fault diagnosis accuracy on the local validation set of each node stabilizes for several consecutive rounds, or when the preset maximum number of training rounds is reached. The final output model is the globally consistent cross-modal base model, ensuring that all nodes' models have unified feature extraction logic and parameter configuration.
[0131] In the above embodiments, the parameter update amount is generated through local training, and the global update amount is obtained through encrypted uploading and secure aggregation. Then, the model parameters are iteratively updated. Under the premise of strictly protecting the data privacy of each node, global collaborative optimization of cross-modal basic models is realized, effectively eliminating model bias caused by the limitations of single node data, enabling the model to have a wider range of fault feature adaptation capabilities, and improving the reliability and generalization ability of the overall fault diagnosis system.
[0132] In one embodiment, S5 is followed by:
[0133] S51. Extract key information from the fault diagnosis conclusion text to obtain a set of diagnostic elements; the set of diagnostic elements includes the root cause of the fault, the evolution path, and the handling suggestions.
[0134] Optionally, key information extraction relies on mature natural language processing technology, using a pre-trained BERT model (Bidirectional Encoder Representations from Transformers) as the base model. This model possesses powerful contextual semantic understanding capabilities and can effectively identify structured information in text. Specifically, the fault diagnosis conclusion text is first preprocessed, performing word segmentation, part-of-speech tagging, and syntactic analysis to clarify the lexical relationships and syntactic structure in the text. For fault root cause extraction, Named Entity Recognition (NER) technology is used to identify core entities such as equipment names, abnormal parameters, and environmental factors. Then, Relation Extraction (RE) is used to establish causal relationships between entities, filtering out the set of core factors that directly lead to the fault. Evolution path extraction uses event extraction technology to extract key events, trigger words, and time nodes in the fault development process, organizing them into an ordered path description according to the logical chronological order of event occurrence. The extraction of treatment recommendations adopts a combination of text classification and key sentence extraction. It identifies imperative sentences and suggestive statements in the conclusion text, extracts the core actions, implementation objects and operating standards, and finally integrates the three types of information to form a set of diagnostic elements that include the root cause of the failure, the evolution path and treatment recommendations, ensuring that the information of each element is complete and logically coherent.
[0135] S52. Based on the preset report template, the diagnostic element set is laid out and filled to obtain semi-structured report data.
[0136] Optionally, the preset report template is a fixed structural framework designed based on the power industry fault diagnosis report specifications. It includes a title area, a diagnostic summary area, a fault root cause area, an evolution path area, a handling suggestion area, and an appendix description area. Each area has clearly defined content format and layout requirements. The data entry process uses the set of diagnostic elements as the data source, precisely matching element types with template fields. Specifically, the diagnostic summary area extracts the core conclusions of the diagnostic element set, concisely summarizing the fault type and core handling principles; the fault root cause area fills in the extracted root cause information in order of impact, with each root cause accompanied by relevant supporting data; the evolution path area arranges the event sequence chronologically, presenting it using point-by-point or flowchart-based descriptions; the handling suggestion area fills in the suggestion content in order of implementation priority, clearly defining the implementing entity, operational steps, and expected effects for each suggestion. During data entry, it is essential to ensure complete compatibility between element information and template fields to avoid omissions or mismatches, while preserving the inherent logical relationships between elements, such as the association between fault root causes and corresponding handling suggestions. The semi-structured report data generated after data entry includes tagged text content, format control instructions, and chart association labels.
[0137] S53. Perform visualization rendering on the semi-structured report data to generate a fault diagnosis report containing charts and structured text.
[0138] Optionally, visualization rendering utilizes Python's Matplotlib (Matrix Plot Library) and Plotly (a Python wrapper for Plotly.js), while structured text layout relies on HTML (HyperTextMarkup Language) and CSS (Cascading Style Sheets). Specifically, for the evolution path, key time nodes and event type data are extracted, and a time-series flowchart is generated using Matplotlib to clearly present the development of the fault. For the root causes of the fault, based on the influence weight data of each root cause, a causal relationship network diagram or pie chart is generated using Plotly to intuitively display the distribution and correlation of root causes. The structured text follows the template layout requirements, defining font styles, color distinctions, and spacing settings using CSS. Titles use bold and enlarged fonts, and fault root causes and handling suggestions are presented using numbered lists or bullet points. Key content is highlighted with background colors. During the rendering process, the text content in the semi-structured data is associated and bound with the chart data. The chart data extracts key values or category information from the diagnostic element set to ensure a high degree of consistency between the chart and the text content. After rendering, a fault diagnosis report in PDF or HTML format is generated, which can be directly exported and printed. This ensures both the professionalism and readability of the report and facilitates maintenance personnel to quickly obtain key information.
[0139] In the above embodiments, core diagnostic elements are extracted using mature natural language processing technology, structured filling is completed based on industry-standard templates, and report rendering is achieved using professional visualization tools. This transforms abstract diagnostic conclusion text into a professional report with a clear structure and high degree of visualization, highlighting the core fault information and logical connections, improving the readability and practicality of the report, and enabling maintenance personnel to quickly and accurately grasp key fault information and carry out efficient handling work. At the same time, it conforms to industry reporting standards, ensuring the accuracy and standardization of diagnostic results transmission.
[0140] In one embodiment, the large language model is fine-tuned and trained based on professional corpus in the field of power faults. The input of the large language model is retrieval enhancement prompts, and the output is fault diagnosis conclusion text.
[0141] Optionally, the professional corpus for power faults covers power system fault diagnosis reports, equipment maintenance records, industry technical standards, equipment operation manuals, and historical fault handling cases. All corpora undergo structured preprocessing. Specifically, data cleaning is performed to remove redundant and invalid information, duplicate content, and data with incorrect formatting. Then, through a combination of manual and rule-based annotation, structured tags such as fault type, root cause, handling measures, and equipment model are added to the corpus, forming a standardized fine-tuned corpus. The large language model uses a mature pre-trained model as its basic architecture, preferably a model with strong general reasoning capabilities such as Llama 2 or GPT-3.5. The LoRA (Low-Rank Adaptation) fine-tuning method is used to achieve domain adaptation. This method inserts a low-rank adapter into the Transformer layer of the pre-trained model, freezing most of the original model parameters and training only the low-rank matrix and bias terms of the adapter, which reduces the computational cost of fine-tuning and avoids catastrophic forgetting of the model. During fine-tuning, the cross-entropy loss function is used to measure the difference between the model's predicted output and the corpus annotation results. The AdamW optimizer is used to iteratively adjust the adapter parameters. The training objective is to enable the model to learn professional terminology, fault reasoning logic and text expression norms in the field of power faults, so that the model can accurately understand the semantic relationships and knowledge system in the field.
[0142] The retrieval enhancement prompts, as model input, first undergo word segmentation processing adapted to the model. The model's built-in vocabulary converts the prompt text into corresponding token sequences, mapping them to fixed-dimensional embedding vectors. Simultaneously, [CLS] start markers and [SEP] separator markers are added to clearly define the input boundaries, ensuring the input format conforms to the model's contextual processing requirements. During the model inference phase, relying on the Transformer architecture's encoder-decoder structure, the encoder semantically encodes the input retrieval enhancement prompts, capturing the association features between fault requests and knowledge fragments. The decoder, based on the encoded features and domain knowledge learned through model fine-tuning, outputs diagnostic conclusion text token by token through an autoregressive generation method. During inference, a bundle search strategy is used to control generation quality. A reasonable bundle width is set to balance generation speed and result accuracy. A repetition penalty mechanism is introduced to avoid text redundancy, ensuring that the output fault diagnosis conclusion text is logically coherent, complete in elements, covers key content such as fault type determination, core root cause analysis, and specific handling suggestions, and conforms to the professional expression standards of the power industry.
[0143] In the above embodiments, LoRA fine-tuning of professional corpus in the field of power faults enables the large language model to have domain-adaptive semantic understanding and reasoning capabilities. Combined with the accurate knowledge support provided by enhanced retrieval prompts, the model can efficiently output professional and standardized fault diagnosis conclusion texts, which not only ensures the accuracy and professionalism of the diagnosis results, but also fully leverages the logical reasoning and text generation advantages of the large language model, effectively meeting the dual requirements of power fault diagnosis for professionalism and practicality.
[0144] The aforementioned power fault diagnosis method and system based on large-model retrieval enhancement utilizes a federated learning framework to collaboratively train an initial cross-modal base model, forming a globally consistent cross-modal base model while ensuring data privacy. Based on this globally consistent cross-modal base model, local multimodal heterogeneous power data vectorization and private vector index construction are then completed. Upon receiving a fault diagnosis request, highly relevant knowledge fragments with global ranking are obtained through encrypted federated collaborative retrieval. Retrieval enhancement prompts are constructed and optimized according to a preset template. A large language model fine-tuned with professional corpus in the power fault field is input to generate diagnostic conclusion text. Finally, a standardized fault diagnosis report is generated through key information extraction, template filling, and visualization rendering. This technical solution avoids the data privacy leakage and high bandwidth cost issues of centralized diagnosis through federated learning and encryption technology. It compensates for the generalization capability deficiencies of distributed diagnosis by leveraging a globally consistent cross-modal base model and retrieval enhancement mechanism, while adapting to the processing needs of multimodal heterogeneous data. This significantly improves the accuracy, security, and practicality of power fault diagnosis, meeting the high requirements of smart grids for fault diagnosis.
[0145] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0146] Based on the same inventive concept, this application also provides a system for implementing the aforementioned power fault diagnosis method based on large model retrieval enhancement. The solution provided by this system is similar to the implementation described in the above method. Therefore, the specific limitations of one or more embodiments of a power fault diagnosis system based on large model retrieval enhancement provided below can be found in the limitations of the power fault diagnosis method based on large model retrieval enhancement described above, and will not be repeated here.
[0147] In one exemplary embodiment, such as Figure 3 As shown, a power fault diagnosis system 10 based on large model retrieval enhancement is provided, including:
[0148] The federated network initialization module 11 is used to initialize the federated network based on the registration information of each node in the federated network to obtain the federated cooperation environment; the federated cooperation environment includes public key infrastructure and initial cross-modal basic model;
[0149] The vectorization processing module 12 is used to perform vectorization processing on the local multimodal heterogeneous power data of each node based on the initial cross-modal basic model, and generate the local private vector index of each node.
[0150] The federated collaborative retrieval module 13 is used to perform federated collaborative retrieval based on fault diagnosis requests, combining the local private vector indexes and public key infrastructure of each node, to obtain a globally sorted list of knowledge fragments.
[0151] The retrieval enhancement suggestion construction module 14 is used to construct retrieval enhancement suggestions based on the globally sorted list of knowledge fragments and fault diagnosis requests, and obtain retrieval enhancement suggestions.
[0152] The fault diagnosis reasoning module 15 is used to perform large language model reasoning on the enhanced search prompts and generate fault diagnosis conclusion text.
[0153] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the power fault diagnosis method based on large model retrieval enhancement as described above.
[0154] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the power fault diagnosis method based on large model retrieval enhancement as described above.
[0155] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and 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 modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0156] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.
Claims
1. A power fault diagnosis method based on large model retrieval enhancement, characterized in that, The method includes: S1. Initialize the federated network based on the registration information of each node in the federated network to obtain the federated cooperation environment; the federated cooperation environment includes public key infrastructure and an initial cross-modal basic model; S2. Based on the initial cross-modal basic model, the local multimodal heterogeneous power data of each node is vectorized to generate a local private vector index for each node. S3. Based on the fault diagnosis request, and combining the local private vector index of each node with the public key infrastructure, perform federated collaborative retrieval to obtain a globally sorted list of knowledge fragments; S4. Based on the globally sorted list of knowledge fragments and the fault diagnosis request, construct search enhancement suggestions to obtain search enhancement suggestions; S5. Perform large language model reasoning on the enhanced search suggestions to generate fault diagnosis conclusion text.
2. The method according to claim 1, characterized in that, S3 includes: S21. Based on the fault multimodal data in the fault diagnosis request, encode it using the initial cross-modal basic model to generate a query vector; S22. The query vector is encrypted using the public key infrastructure to generate an encrypted query vector; S23. Distribute the encrypted query vector through a federated network to obtain a distribution task identifier; S24. Collect encryption similarity results based on the distribution task identifier to obtain an encryption similarity result set; S25. The encrypted similarity result set is decrypted using a private key to obtain a plaintext similarity score; S26. Sort the plaintext similarity scores in descending order to generate the globally sorted list of knowledge fragments.
3. The method according to claim 2, characterized in that, The encryption similarity result generation step of S24 includes: S241. For each local knowledge vector in the encrypted query vector and the local private vector index, perform a power multiplication operation between the ciphertext and plaintext numbers based on the properties of additive homomorphic encryption to obtain the encrypted result of the dot product; the formula for calculating the encrypted result of the dot product is: in, For query vector With local knowledge vectors The encrypted result of the dot product, For the query vector The encrypted value of the dimensional component, For local knowledge vectors The dimensional components, For vector dimensions, For public keys; S242. Use the encrypted result of the dot product as the initial similarity score, and record the corresponding local knowledge vector identifier to generate initial similarity data; S243. The initial similarity data is aggregated and encapsulated to generate the encrypted similarity results for each node.
4. The method according to claim 2, characterized in that, S26 includes: S261. Sort all candidate knowledge segments in descending order according to the plaintext similarity score to obtain the sorted candidate knowledge segments. S262. Perform similarity threshold filtering on the sorted candidate knowledge segments to obtain high-scoring candidate knowledge segments. S263. Select the top K highest-ranked knowledge fragments from the high-scoring candidate knowledge fragments to generate the globally ranked knowledge fragment list; the globally ranked knowledge fragment list includes knowledge fragment identifiers, source nodes, and similarity scores.
5. The method according to claim 1, characterized in that, S4 includes: S31. The fault multimodal data in the fault diagnosis request and the original text of the knowledge fragments in the globally sorted knowledge fragment list are structured and organized according to a preset prompt template to obtain structured data. S32. For the structured data, an initial search enhancement prompt is generated by filling it into a prompt template; the prompt template includes a role definition, task description, fault data display area, knowledge base fragment display area, and reasoning instruction area; S33. Optimize the context length and enhance the keywords of the initial search enhancement prompt to generate the search enhancement prompt.
6. The method according to claim 1, characterized in that, S2 includes: S41. The initial cross-modal base model is collaboratively trained using a federated learning framework to obtain a globally consistent cross-modal base model; S42. Based on the globally consistent cross-modal basic model, the local multimodal heterogeneous power data is vectorized to generate an initial vector set; S43. The initial vector set is indexed to generate the local private vector index of each node.
7. The method according to claim 6, characterized in that, S41 includes: S411. Based on the local private dataset of each node, the initial cross-modal base model is trained locally to obtain the model parameter update amount of each node. S412. The model parameter update amounts of each node are privatized to obtain encrypted model parameter update amounts; and the encrypted model parameter update amounts are uploaded to the coordination center. S413. The coordination center performs secure aggregation on all the received encrypted model parameter update amounts to obtain the global parameter update amount. S414. The initial cross-modal basic model is iteratively updated according to the global parameter update amount to obtain the globally consistent cross-modal basic model.
8. The method according to claim 1, characterized in that, Following S5, the following is also included: S51. Extract key information from the fault diagnosis conclusion text to obtain a set of diagnostic elements; the set of diagnostic elements includes the root cause of the fault, the evolution path, and the handling suggestions. S52. According to the preset report template, the set of diagnostic elements is laid out and filled to obtain semi-structured report data; S53. Perform visualization rendering processing on the semi-structured report data to generate a fault diagnosis report containing charts and structured text.
9. The method according to claim 1, characterized in that, The large language model is obtained by fine-tuning and training based on professional corpus in the field of power faults. The input of the large language model is the retrieval enhancement prompt, and the output is the fault diagnosis conclusion text.
10. A power fault diagnosis system based on large model retrieval enhancement, characterized in that, The device includes: The federated network initialization module is used to initialize the federated network based on the registration information of each node in the federated network, thereby obtaining a federated collaborative environment; the federated collaborative environment includes a public key infrastructure and an initial cross-modal basic model. The vectorization processing module is used to perform vectorization processing on the local multimodal heterogeneous power data of each node based on the initial cross-modal basic model, and generate local private vector indexes for each node. The federated collaborative retrieval module is used to perform federated collaborative retrieval based on the fault diagnosis request, combining the local private vector index of each node and the public key infrastructure, to obtain a globally sorted list of knowledge fragments; The retrieval enhancement suggestion construction module is used to construct retrieval enhancement suggestions based on the globally sorted knowledge fragment list and the fault diagnosis request, and obtain retrieval enhancement suggestions; The fault diagnosis reasoning module is used to perform large language model reasoning on the enhanced search prompts and generate fault diagnosis conclusion text.
Citation Information
Cited By
Intelligent maintenance suggestion recommendation method, system, equipment and medium
CN122112243A