Power industry cue word optimization method and system
By statically structuring and dynamically iteratively optimizing user-input prompts in the power industry, and combining knowledge graphs and reinforcement learning, the problem of insufficient professionalism of prompts in existing technologies has been solved, enabling efficient and accurate power industry applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING HUADUN ELECTRIC POWER INFORMATION SAFETY EVALUATION CO LTD
- Filing Date
- 2025-12-16
- Publication Date
- 2026-04-10
AI Technical Summary
Existing Prompt optimization methods lack deep integration with power regulations and domain knowledge in the power industry, resulting in insufficient professionalism in model responses, failing to meet the industry's stringent requirements for accuracy and reliability, and the optimization process is highly dependent on manual intervention, leading to high costs and low efficiency.
By performing static structural optimization and dynamic iterative optimization on non-standardized prompt words input by users, and combining knowledge graphs and reinforcement learning, structured prompt words that conform to the understanding logic of AI models and the standards of the power industry are generated. This includes semantic parsing specific to power scenarios, defect detection and completion, and dynamic template engine sorting. A reinforcement learning model is then built for secondary optimization.
It improves the accuracy, reliability, and adaptability of the generated results, reduces the cost of manual intervention, improves the efficiency and quality of task execution, and promotes the application of large models in the power industry.
Smart Images

Figure CN121835675A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent optimization technology for prompt words in the power industry, specifically to a method and system for optimizing prompt words in the power industry. Background Technology
[0002] With the increasing application of large-scale artificial intelligence models in the power industry, prompt management has become a core technical means to improve the quality and reliability of model output. Research shows that optimizing prompts can significantly impact model performance, even contributing nearly half of the potential performance improvement. Current mainstream prompt optimization methods include manual template design, semantic retrieval enhancement techniques, and manual debugging iteration strategies. While these methods have achieved some success in general domains, they still have significant limitations in specific scenarios within the power industry.
[0003] As a technology- and knowledge-intensive sector, the power industry has complex business scenarios, numerous technical terms, and extremely high requirements for safety and compliance. Existing Prompt optimization methods lack deep integration with power regulations and domain knowledge, resulting in insufficient professionalism in model responses and an inability to meet the industry's stringent requirements for accuracy and reliability. For example, in power equipment fault diagnosis scenarios, if users cannot clearly describe the fault phenomenon and relevant equipment parameters, the model struggles to understand the essence of the problem and may provide inaccurate or even dangerous guidance. Furthermore, existing methods are mostly static optimizations, lacking mechanisms for dynamic adjustment based on actual operating conditions and user feedback, and the optimization process heavily relies on manual intervention, leading to high costs and low efficiency.
[0004] In the process of solving business problems in the power industry, the interaction between users and models plays a decisive role in the quality and practicality of the output results. The Prompt, as the input guiding the model to generate accurate and effective answers, directly affects the model's performance. However, ordinary users find it difficult to accurately write high-quality Prompts, while general optimization methods do not fully consider the characteristics of the power industry, resulting in poor application performance of the model in scenarios such as grid dispatching, equipment operation and maintenance, and energy management. Summary of the Invention
[0005] To address the issues of insufficient professionalism and poor scenario adaptability of prompts in the power industry, this invention proposes a method for optimizing prompts in the power industry that deeply integrates power regulations and domain knowledge.
[0006] To achieve the above objectives, the present invention is implemented through the following technical solution: This invention is a method for optimizing prompt words in the power industry, comprising: Static structural optimization is performed on the non-standardized prompt words input by users to obtain structured prompt words that conform to the understanding logic of AI models and the standards of the power industry. The data generated by static structural optimization is recorded and stored in the static optimization result temporary storage library. Based on historical data in the static optimization result temporary storage library, a reinforcement learning model is constructed and trained offline and iterated online. The trained reinforcement learning model is used to perform secondary optimization on the structured prompt words, and the optimization results are input into the AI model. The AI model output, user feedback on the AI model output, data records generated from the static structured optimization of prompt words, and data generated from the secondary optimization of structured prompt words by the reinforcement learning model are stored in a prompt word optimization case library to support the dynamic optimization of the reinforcement learning model.
[0007] A further improvement of this invention lies in: performing static structural optimization on non-standardized prompt words input by the user, including: The non-standardized prompts input by users are semantically parsed specifically for the power industry scenario to obtain an "entity-relationship" graph; Based on the "entity-relationship" graph, a defect detection mechanism driven by both rule engine and similarity matching is constructed to detect the corresponding defects and correct them. Based on the scenario type determined by semantic parsing, the corresponding prompt word structure template is invoked. Based on the power business priority rules, the completed information is weighted and sorted to generate structured prompt words.
[0008] A further improvement of this invention lies in: performing semantic parsing specific to the power scenario on the non-standardized prompt words input by the user to obtain an "entity-relationship" graph, including: By using the BERT model in the power industry, non-standardized prompt words input by users are segmented and context-encoded to generate original prompt word vectors containing industry semantic information. The dependencies between word sequences in the original prompt word vectors are captured using a BiLSTM network. Based on the dependencies between word sequences, combined with an entity dictionary in the power field, entity recognition and boundary correction are completed through a CRF layer to obtain an "entity-relationship" graph; Based on the "entity-relationship" graph and non-standardized prompts input by the user, a scene classifier is used to identify scene types and output business scene labels, i.e. scene types.
[0009] A further improvement of this invention lies in: constructing a defect detection mechanism driven by both a rule engine and similarity matching based on an "entity-relationship" graph, detecting and correcting corresponding defects, including: The rule engine pre-sets a template of essential elements for prompt words in power business scenarios. By comparing the elements of the template with the "entity-relationship" graph, it locates the missing information. Non-professional expressions are identified by calculating the cosine similarity between the parsed entities and the power standard terminology database. Based on the detected missing information and non-professional descriptions, the system calls the power industry knowledge base through the API interface, automatically completes the corresponding equipment information according to the equipment identifier, and replaces colloquial descriptions with standardized terms through a terminology mapping table to complete the defect completion and correction.
[0010] A further improvement of this invention lies in: based on the scenario type determined by semantic parsing, calling the corresponding prompt word structure template, and based on the power business priority rules, weighting and sorting the completed information to generate structured prompt words, including: The dynamic template engine automatically calls the corresponding prompt word structure template based on the scene type determined by semantic parsing; Based on the priority rules of power business, the supplemented and corrected information is sorted by weight to ensure that key information is placed at the beginning and auxiliary information is placed at the end.
[0011] A further improvement of this invention lies in constructing a reinforcement learning model, including: defining the state, action, and reward in the reinforcement learning model, wherein the process of defining the state includes: concatenating the original prompt word vector, structured prompt word vector, AI model output vector, user feedback vector, and business scenario label into a 512-dimensional state vector, and assigning set weights to user feedback and business scenario through an attention mechanism; the action space is defined as a set of discretized optimized actions, each action containing action type and execution parameters; the reward function uses a weighted calculation of immediate reward and cumulative reward, wherein the immediate reward is quantified based on user feedback and output accuracy.
[0012] The present invention provides a power industry prompt word optimization system based on knowledge graphs and reinforcement learning, comprising: The input module is used to allow users to input prompts. The static optimization module is used to perform static structured optimization on the non-standardized prompt words input by the user, so as to obtain structured prompt words that conform to the understanding logic of the AI model and the power industry standards, and to store the data generated by the static structured optimization in the static optimization result temporary storage library; The dynamic optimization module is used to build a reinforcement learning model that supports dynamic optimization based on historical data in the static optimization result temporary storage library, and to perform offline training and online iteration. The trained reinforcement learning model is used to perform secondary optimization on the structured prompt words, and the optimization results are input into the AI model. The prompt word optimization case library module is used to store AI model output results, user feedback on AI model output results, data records generated by static structured optimization of prompt words, and data generated by secondary optimization of structured prompt words by reinforcement learning models; The support module provides end-to-end data support, including a power standard terminology library and a power industry knowledge base.
[0013] The beneficial effects of this invention are as follows: The method provided by this invention, through precise matching of knowledge graphs and dynamic optimization of reinforcement learning, not only improves the accuracy, reliability and adaptability of the generated results, but also significantly reduces the cost of manual intervention, improves the efficiency and quality of task execution, further promotes the application of large models in the power industry, and provides strong technical support for the intelligent transformation of the power industry. Attached Figure Description
[0014] Figure 1 This is a flowchart of the method in an embodiment of the present invention. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0016] like Figure 1 As shown, this embodiment is a method for optimizing prompt words in the power industry. It is implemented through a two-layer technical architecture of static structural optimization and dynamic iterative optimization of prompt words, specifically including: The non-standardized prompt words input by the user are reconstructed, i.e., static structured optimization, to obtain structured prompt words that conform to the understanding logic of the AI model and the standards of the power industry. The data generated by static structured optimization is recorded and stored in the static optimization result temporary storage library. Based on historical data in the static optimization result temporary storage library, a reinforcement learning model is constructed and trained offline and iterated online. The trained reinforcement learning model is used to perform secondary optimization on the structured prompt words, and the optimization results are input into the AI model. The AI model output, user feedback on the AI model output (user feedback), data records generated by static structured optimization of prompt words, and data generated by secondary optimization of structured prompt words by the reinforcement learning model are stored in a prompt word optimization case library to support dynamic optimization of the reinforcement learning model.
[0017] The core objective of static structured optimization of prompt words is to transform non-standardized prompt words input by users into structured prompt words that conform to the understanding logic of AI models and the standards of the power industry. This is achieved through three steps: semantic parsing, defect detection, and precise reconstruction. Non-standardized prompt words include colloquial descriptions and expressions of missing information.
[0018] The first step is semantic parsing specific to the power sector, implemented using a hybrid model architecture combining BERT-BiLSTM-CRF and a power sector entity dictionary, including: The non-standardized prompt words input by users are segmented and context-encoded using the BERT model in the power field (which is based on tens of thousands of professional data and fine-tuned power business text), generating original prompt word vectors containing industry semantic information; The BiLSTM network is used to capture the dependencies between word sequences, such as the relationship between "high oil temperature" and "transformer". By combining an entity dictionary in the power industry, entity recognition and boundary correction are completed through a CRF layer to obtain an "entity-relationship" graph. The entity dictionary in the power industry includes core entities such as equipment, faults, and parameters. Boundary correction includes filtering ambiguous expressions using a power industry stop word list. Entity recognition includes assigning priority weights to entities to achieve word order reordering. The "entity-relationship" graph is as follows: "[Main Transformer No. 1]-[Associated Fault]-[Abnormal Oil Temperature]".
[0019] Based on the obtained "entity-relationship" graph, a scenario classifier is further used to classify user intents and output business scenario labels, such as "fault diagnosis" and "equipment inspection". The "entity-relationship" graph serves as a supplementary input to the scenario classifier.
[0020] Building upon the general BERT model, domain-adaptive pre-training is performed using tens of thousands of power industry-specific texts (tens of thousands of professional data sets). Through tasks such as masked language modeling, the model deeply understands the contextual semantics of power industry terms such as "main transformer," "abnormal oil temperature," and "protection actions," forming a power industry-specific BERT model with prior industry knowledge. Subsequently, a lightweight multilayer perceptron is introduced as the classification head on top of this power industry-specific BERT model. The original prompt word vectors, encoded by the power industry-specific BERT model after user input, are used as input for supervised fine-tuning on a manually labeled scene classification dataset. This dataset contains hundreds to thousands of samples, each consisting of the original prompt word and its corresponding business scenario label (such as "fault diagnosis," "dispatch instruction," "equipment inspection," and "operation analysis"). During fine-tuning, the model learns to map semantic vectors to specific scene categories, ultimately forming a scene classifier.
[0021] This embodiment ensures that the parsing results focus on the core elements of the power business by adding a stop word list for the power sector (such as filtering out vague expressions like "probably" and "possibly") and entity priority weights (such as giving "equipment number" and "fault characteristics" higher weights than "time" and "location").
[0022] The second step is defect detection and completion of prompt words. Based on the "entity-relationship" graph obtained from semantic parsing, a defect detection mechanism driven by both a rule engine and similarity matching is constructed. The rule engine presets essential element templates for prompt words in power business scenarios. By comparing the elements of the "entity-relationship" graph with the essential element templates, missing information is located (e.g., the absence of "transformer rated oil temperature limit"). Power business scenarios include scenarios such as fault diagnosis and dispatching. The essential element templates for prompt words in power business scenarios are as follows: for fault diagnosis, the template includes "equipment identifier - fault phenomenon - core parameters"; for dispatching, the template includes "operation object - operation instruction - safety boundary". Similarity matching: by calculating the cosine similarity between the semantically parsed entities and the power standard terminology database, non-professional expressions are identified, such as matching "transformer emitting smoke" with "insulation damage causing abnormal temperature rise". For the detected defects, namely missing information and non-professional expressions, knowledge anchoring completion and terminology mapping correction technologies are used to complete and correct the defects. This includes entity completion and terminology replacement. Specifically, the power industry knowledge base is called through the API interface to automatically complete the corresponding equipment's rated parameters, historical faults and other related information based on the equipment identifier (such as "No. 1 main transformer"). Through the terminology mapping table, colloquial descriptions are replaced with standardized terms. The completion and correction process follows the "principle of minimal intervention", only supplementing core missing information and correcting ambiguous expressions without changing the user's original intent.
[0023] The third step is to generate structured prompts, which is achieved using a dynamic template engine and business logic sorting technology. The dynamic template engine has built-in prompt word structure templates bound to power business scenarios. It automatically calls the corresponding prompt word structure template based on the scenario type determined by semantic parsing (such as "fault diagnosis"), that is, it switches the prompt word structure template according to the scenario type. The business logic sorting is based on the power business priority rules (such as "equipment safety parameters > fault characteristics > auxiliary information"), and sorts the completed information by weight, that is, the information is weighted and adjusted to ensure that key information (such as "oil temperature 82℃ (rated 65℃)") is placed at the beginning and auxiliary information (such as "equipment commissioning time 2020") is placed at the end. Among them, the prompt word structure template, such as the prompt word structure template for fault diagnosis, is "[equipment basic information] (model / parameter) - [fault phenomenon] (characteristic / data) - [business requirements] (diagnosis / processing / early warning)".
[0024] Each data record in the static optimization result temporary storage library contains: user-input non-standardized prompt words (original prompt words), original prompt word vectors, corresponding structured prompt words, automatically recognized business scenario tags, "entity-relationship" graphs, and a writing timestamp, serving as historical power prompt word data.
[0025] The structured prompts generated in this embodiment meet the "three clear" technical standards: clearly define the equipment / object (including unique identifier), clearly define the problem / requirement (containing quantifiable data), and clearly define the business boundaries (including industry standard basis). For example, the original prompt "High oil temperature of main transformer No. 1" is generated as "The current operating oil temperature of main transformer No. 1 (model S11-M-1000 / 10, rated oil temperature limit 65℃) in a certain substation is 82℃, which exceeds the rated range. According to the requirements of GB / T1094.7, analyze the cause of the fault and the on-site emergency handling measures", ensuring that the AI model can directly extract key parameters for reasoning.
[0026] The core of dynamic iterative optimization of prompt words is to allow the prompt word optimization strategy to continuously evolve with user feedback and changes in power business scenarios. This is achieved through three steps: reinforcement learning model construction, offline training and online iteration, and closed-loop optimization execution. The entire process revolves around the "decision-evaluation-update" of prompt word optimization actions. In the dynamic optimization phase, firstly, based on the original prompt word vector of the new input prompt word, an exact or approximate match is performed in the static optimization result temporary storage library, such as using the hash value of the original prompt word vector for matching. If a match is found, the corresponding structured prompt word and its business scenario label (scenario type) are directly read. The read structured prompt word is encoded using the power domain BERT model to obtain a structured prompt word vector. This vector is then concatenated with other state components, including the original prompt word vector, the AI model output vector, the user feedback vector, and the business scenario label, to form the reinforcement learning state representation. The reinforcement learning policy library calls the corresponding policy parameters (policy network) according to the scenario label to perform secondary optimization actions on the structured prompt word, such as supplementing historical fault data, replacing non-standard terms, and adjusting information sorting, to generate the final prompt word. Specific steps include: The first step is to construct a reinforcement learning model specifically for power-related prompts, including the refined definition of state vectors, action space, and reward function. The state vector is represented using vector concatenation and attention weighting techniques. This involves concatenating the original prompt vector (obtained through a power-domain BERT model in static structured optimization), structured prompt vectors, AI model output vectors (with extracted keyword encodings), user feedback vectors, and business scenario labels (such as "fault diagnosis" and "dispatch instructions" mapped to one-hot vectors) into a 512-dimensional state vector. An attention mechanism is then used to assign weights to user feedback and business scenarios, ensuring focus on core influencing factors. The action space is defined as a set of discretized optimization actions, each containing an action type and execution parameters, covering the entire prompt optimization scenario. In this embodiment, user feedback includes satisfied, partially satisfied, and dissatisfied, mapped to 1, 0.5, and -0.5, respectively. Action types include entity completion, term replacement, word order rearrangement, information weighting adjustment, and prompt structure template switching. Execution parameters include the entity identifier to be operated on, the target term, weight coefficients, and the target template ID. The reward function uses a weighted calculation of immediate and cumulative rewards. The immediate reward is quantified based on user feedback and output accuracy (automatically determined by comparing with the power industry standard library), with user feedback having a weight of 0.4 and output accuracy having a weight of 0.6. The cumulative reward introduces a decay coefficient (γ=0.9) to encourage the algorithm to learn "long-term effective" optimization strategies. For example, if the optimization action of a certain type of fault prompt word receives high scores in multiple feedbacks, the cumulative reward will increase, avoiding interference from short-term random feedback. In this embodiment, the reward function is the sum of the immediate reward and the current cumulative reward.
[0027] The second step involves training and online iteration of the reinforcement learning model, employing the Proximal Policy Optimization (PPO) algorithm to construct the policy network. During offline training, the policy network uses a multi-layer neural network structure, with a 512-dimensional state vector as input and a probability distribution in the discrete action space as output. During training, the "clipping objective function" of PPO is used to limit the policy update magnitude, preventing training instability. In the online iteration phase, incremental learning and real-time feedback are employed. Feedback data from each user interaction is used as incremental samples, and a "sliding window" mechanism dynamically updates the training set. Every 50 new samples trigger a fine-tuning of the policy network, which is then stored in the reinforcement learning policy library, ensuring that the optimized policy can quickly adapt to new scenarios (such as handling prompts for newly added new energy station equipment). To improve training efficiency, an action priority sampling mechanism is introduced: optimized samples are extracted from the prompt optimization case library, sorted according to their corresponding reward values (calculated by the reward function), and the top 20% of optimized actions (corresponding actions in the action space) are selected as high-value samples. The sampling probability of high-value samples is assigned a double weight, thereby accelerating the learning of high-quality optimization policies.
[0028] The third step is dynamic closed-loop optimization execution, which includes: when the user inputs a new prompt word, the new prompt word is segmented and context-encoded using a BERT model for the power sector to obtain the original prompt word vector corresponding to the new prompt word. The original prompt word vector corresponding to the new prompt word is matched with the original prompt word vectors already stored in the static optimization result temporary storage library. If a match is successful, the corresponding structured prompt word in the static optimization result temporary storage library is called. A scene classifier is used to classify the original prompt word vector corresponding to the new prompt word into a scene type. Based on the obtained scene type, the optimal policy parameters for the corresponding scene are called from the reinforcement learning policy library. Based on the optimal policy parameters, the called structured prompt word is further optimized using a reinforcement learning model. The optimized structured prompt word is input into the AI model to obtain the output result. The user submits feedback data to the prompt word optimization case library through the interface, i.e., user feedback. Based on the amount of feedback data in the prompt word optimization case library or a preset time interval, the reinforcement learning model is triggered to perform another online iteration, i.e., the online iteration program is called to fine-tune the policy parameters. Simultaneously, this optimization and online iteration process are stored in the prompt word optimization case library. Subsequently, when similar prompt words are matched with user input, the optimization actions in the prompt word optimization case library can be directly reused to shorten response time. The prompt word optimization case library stores data including the complete optimization trajectory of each user interaction, including: original prompt words, structured prompt words, business scenario labels (scenario type), optimization actions (policy parameters) executed by the reinforcement learning model, final prompt words after secondary optimization, AI model output results, user feedback, reward value (obtained from the reward function of the reinforcement learning model), and timestamp. This embodiment uses a policy evaluation service to periodically (within a set evaluation period) evaluate the performance of policy parameters under each business scenario (scenario type). That is, the average reward value is calculated based on the reward value of the corresponding scenario type in the prompt word optimization case library. If the average reward value of a policy parameter decreases by more than 10% for two consecutive evaluation periods, the 'retraining' process is automatically triggered. That is, based on the updated historical power prompt word dataset, the offline training process is re-executed to ensure that the adopted dynamic optimization strategy, that is, the reinforcement learning optimization decision rules for each business scenario, continues to maintain stability and effectiveness.
[0029] The method of this embodiment will be further explained below with reference to a real test scenario. Test scenario: For the "Fault Diagnosis of Main Transformer No. 1" scenario of a 500kV substation, the user inputs the non-standard prompt word: "Main Transformer No. 1 oil temperature is high, please help me find out what's wrong". It is necessary to generate a structured prompt word that meets the inference requirements of the AI model through a two-layer technical architecture of static structured optimization and dynamic iterative optimization of the prompt word, and to realize strategy iteration.
[0030] Experimental steps: (1) Static structuring optimization steps for prompt words Semantic parsing specific to the power sector: Input: Original prompt: "Main transformer #1 has high oil temperature, please help me find out what's wrong"; The scene type "fault diagnosis" is obtained from the scene classifier; Model parameters: BERT fine-tuning data consists of 20,000 power fault warning words, BiLSTM hidden layer dimension is 256, CRF iteration count is 100, and learning rate is 5e-5; Execution process: a. In the power industry, the BERT model segments the input text ("No. 1 main transformer", "high oil temperature", "fault diagnosis") and generates 768-dimensional word vectors, which are the original prompt word vectors. b. BiLSTM captures the relationship between "main transformer No. 1" and "high oil temperature" and outputs the sequence dependency probability; c. Combining the power entity dictionary (including entities such as "main transformer", "oil temperature", and "fault diagnosis"), CRF completes entity recognition, filters out the stop word "help me see what's wrong", retains the core business elements "No. 1 main transformer", "high oil temperature" and "fault diagnosis", and outputs an "entity-relationship" graph: [No. 1 main transformer] - [related phenomenon] - [high oil temperature].
[0031] Defect detection and completion of prompt words: Defect detection: The rule engine called the "Fault Diagnosis Prompt Essential Elements Template" (equipment identifier + fault phenomenon + core parameters) and found that it was missing "Model of Main Transformer No. 1, Rated Oil Temperature, and Current Measured Oil Temperature Value"; Similarity matching is used to calculate the cosine similarity between "high oil temperature" and the power standard terminology database.
[0032] Completed and corrected: By calling the power industry knowledge base through API, parameters are completed based on "No. 1 main transformer" (equipment identifier), such as: model S11-M1000 / 10, rated oil temperature limit 60℃, put into operation in 2020, and has one historical fault (cooling fan failure in 2022). Terminology mapping correction: Replace "high oil temperature" with "operating oil temperature exceeds rated limit" to preserve the user's original intent (no irrelevant information added).
[0033] Structured generation: Dynamic template engine: Based on the "fault diagnosis" scenario, call the template "[Basic Device Information]-[Fault Phenomenon]-[Business Requirements]-[Standard Basis]"; Business logic sorting: sorted by weight of "safety parameters (oil temperature) > equipment information > historical data", generating structured prompts: "The current measured operating oil temperature of the No. 1 main transformer (model S11-M-1000 / 10, put into operation in 2020, rated oil temperature limit 65℃) of a certain 500kV substation is 82℃, which exceeds the rated range (historical fault: cooling fan failure in 2022). According to the requirements of GB / T1094.7-2015, it is necessary to analyze the cause of the fault and the on-site emergency handling measures."
[0034] (2) Prompt word dynamic iterative optimization steps Building a reinforcement learning environment: State vector: Concatenate "original prompt word vector (768 dimensions) + optimized prompt word vector (768 dimensions) + AI output result vector (extracted keyword "cooling system failure" encoding, 768 dimensions) + user feedback vector ("satisfaction" mapped to [1]) + scene label vector ("fault diagnosis" one-hot encoding, 10 dimensions)", and give "user feedback" and "scene label" 2 times weight through attention mechanism to finally generate a 512-dimensional state vector; Action space: Define 6 types of discrete actions (A1: Supplement historical fault data, A2: Add standard basis, A3: Adjust parameter sorting, A4: Correct terminology accuracy, A5: Supplement equipment operation and maintenance records, A6: No optimization). Reward function: Instant reward = (AI output accuracy × 0.6) + (user satisfaction × 0.4), Cumulative reward = Instant reward + γ × Cumulative reward in the next round (γ = 0.9).
[0035] Offline training versus online iteration: Offline training: Using 52,000 historical prompt words as the training set, we first trained an initial prompt optimization policy model on a publicly available general instruction optimization dataset (such as FLAN v2) through supervised fine-tuning (training for 1000 rounds with a learning rate of 3e-4). Then, we used the parameters of this policy model as the initial policy network of the PPO reinforcement learning framework and transferred it to the power prompt word optimization task. Migrating to the power scenario: Freeze the BERT feature extraction layer, fine-tune the policy network (500 iterations, batch size 32, clipping coefficient ε=0.2), and adopt "action priority sampling" (give double the sampling weight to the top 20% of actions A1 and A2, which are sorted according to reward value). Training results: The policy network achieved an accuracy of 90% in selecting the optimal action for the "fault diagnosis" scenario; Online iteration: A "sliding window" mechanism (window size 50 samples) is adopted, and a fine-tuning is triggered every 50 user feedbacks received. Dynamic closed-loop optimization execution: Workflow Trigger: After the user enters a new prompt, the structured prompt in the static optimization result temporary storage library is called, and then the optimal strategy parameters of the "Fault Diagnosis" scenario are called (A1 and A2 actions are executed first). Based on the optimal strategy parameters, the reinforcement learning model is used to supplement the called structured prompt with "2022 cooling fan failure handling solution". Feedback and Updates: When the user is "satisfied" with the secondary optimization results, the feedback data is written to the database and triggers a "strategy update event". The strategy network is then fine-tuned in the background, and the optimization case is stored in the case library (keywords: "No. 1 main transformer", "high oil temperature", "fault diagnosis"). Strategy evaluation: The average reward value of the strategy in the "fault diagnosis" scenario is calculated weekly. In this embodiment, the reward value increased from 0.72 to 0.89 for four consecutive weeks without any "decline > 10%" and therefore no retraining is required.
[0036] Results and effects of the experiment: Static optimization results: The AI output rate of structured prompts reached 94.2% (the accuracy of the original prompts was 68.5%, an improvement of 37.5%). Dynamic optimization results: After 5 rounds of iteration, user satisfaction with the "fault diagnosis" scenario prompts increased from 75% to 92%, and the average response time of AI output decreased from 1.2s to 0.8s; Core function: To achieve a breakthrough in prompting words from "non-standardized" to "industry-adapted and continuously evolving", and to solve the problem of AI understanding bias in power scenarios.
[0037] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless defined as herein.
[0038] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for power industry prompt word optimization, characterized in that, Comprise: Static structural optimization is carried out on the non-standardized prompt words input by the user to obtain structured prompt words conforming to the understanding logic of the AI model and the specifications of the power industry, and the data records generated by the static structural optimization are stored in the static optimization result temporary library; Based on the historical data in the static optimization result temporary library, a reinforcement learning model is constructed, and offline training and online iteration are carried out, and the trained reinforcement learning model is used to optimize the structured prompt words again, and the optimization results are input into the AI model; The AI model output results, user feedback on the AI model output results, data records generated by the static structural optimization of the prompt words, and data generated by the reinforcement learning model for secondary optimization of the structured prompt words are stored in the prompt word optimization case library for supporting dynamic optimization of the reinforcement learning model.
2. The power industry hotword optimization method of claim 1, wherein, Static structural optimization is carried out on the non-standardized prompt words input by the user, comprising: Carrying out power scene exclusive semantic analysis on the non-standardized prompt words input by the user to obtain an "entity-relation" graph; Based on the "entity-relation" graph, a rule engine and a similarity matching double-driven defect detection mechanism are constructed to detect corresponding defects and complete corrections; Based on the scene type determined by semantic analysis, the corresponding prompt word structure template is called, and the information after completion is weighted and sorted based on the power business priority rules to generate structured prompt words.
3. The power industry prompt word optimization method of claim 2, wherein, Carrying out power scene exclusive semantic analysis on the non-standardized prompt words input by the user to obtain an "entity-relation" graph, comprising: Carrying out word segmentation and context coding on the non-standardized prompt words input by the user through the power field BERT model to generate original prompt word vectors containing industry semantic information; Capturing the dependency relationship between word sequences in the original prompt word vectors through the BiLSTM network; Based on the dependency relationship between word sequences, combining the power field entity dictionary, completing entity recognition and boundary correction through the CRF layer to obtain the "entity-relation" graph; Based on the "entity-relation" graph and the non-standardized prompt words input by the user, using a scene classifier to identify the scene type and output a business scene label, i.e. the scene type.
4. The power industry prompt word optimization method of claim 3, wherein, Based on the "entity-relation" graph, a rule engine and a similarity matching double-driven defect detection mechanism are constructed to detect corresponding defects and complete corrections, comprising: The rule engine presets the prompt word essential element template in the power business scene, and locates the missing information through the element comparison between the "entity-relation" graph and the prompt word essential element template; Identify non-professional expressions by calculating the cosine similarity between the parsed entities and the power standard term library; Based on the detected missing information and non-professional expressions, the power field knowledge base is called through the API interface, the associated information of the corresponding equipment is automatically completed according to the equipment identifier, the colloquial description is replaced by standard terms through the term mapping table, and the completion and correction of the defect are completed.
5. The power industry prompt word optimization method of claim 2, wherein, Based on the scene type determined by semantic analysis, the corresponding prompt word structure template is called, and the information after completion is weighted and sorted based on the power business priority rules to generate structured prompt words, comprising: The dynamic template engine automatically calls the corresponding prompt word structure template according to the scene type determined by semantic analysis; Based on the power service priority rules, the completed and revised information is weighted and sorted to ensure that key information is placed in the front and auxiliary information is placed in the back.
6. The power industry prompt word optimization method of claim 4, wherein, The reinforcement learning model is constructed, including: defining the state, action and reward in the reinforcement learning model, wherein the definition process of the state includes: splicing the original prompt word vector, the structured prompt word vector, the AI model output result vector, the user feedback vector and the business scenario label into a 512-dimensional state vector, and giving the user feedback and the business scenario a set weight through the attention mechanism; the action space is defined as a discrete optimization action set, each action contains an action type and an execution parameter; the reward function adopts immediate reward and cumulative reward for weighted calculation, wherein the immediate reward is quantified based on user feedback and output accuracy.
7. A power industry prompt word optimization system based on a knowledge graph and reinforcement learning, characterized in that, The method comprises the steps of: an input module for user input prompt words; a static optimization module for static structural optimization of non-standardized prompt words input by the user to obtain structured prompt words conforming to the understanding logic of the AI model and the specifications of the power industry, and storing the data records generated by the static structural optimization in a static optimization result temporary database; a dynamic optimization module for constructing a reinforcement learning model supporting dynamic optimization based on historical data in the static optimization result temporary database, and performing offline training and online iteration, using the trained reinforcement learning model to perform secondary optimization on the structured prompt words, and inputting the optimization results into the AI model; a prompt word optimization case library module for storing AI model output results, user feedback on AI model output results, data records generated by static structural optimization of prompt words, and data generated by secondary optimization of structured prompt words by the reinforcement learning model; a support module for providing full-process data support, including a power standard terminology library and a power domain knowledge base.
Citation Information
Cited By
A method, system, electronic device, and storage medium for dynamically enhancing prompt words.
CN122133652A