Agent model generation method for power grid production command and related equipment
By constructing an agent model, the problem of reliance on manual operation in the power grid production command system was solved, enabling autonomous decomposition of natural language instructions and optimization of decision-making, thereby improving the intelligence level of power grid production command.
Patent Information
- Application Number
- CN202610938845.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-26
- Publication Date
- 2026-11-27
AI Technical Summary
The existing power grid production command system relies on manual operation, which results in long response times, high labor costs, high operational risks, and a lack of autonomous execution and self-reflection capabilities, leading to repeated errors.
An agent model is constructed, including a large language model task understanding module, a state encoding network, a deep reinforcement learning decision module, a tool execution interface, and a reflection feedback fusion module. The model is trained with historical data, enabling it to autonomously decompose natural language instructions into sub-task sequences and optimize decisions based on resource status and execution results.
It has achieved integrated autonomous execution from natural language commands to tool calls, which has improved the intelligence of power grid production command, reduced errors, and optimized the decision-making process.
Smart Images

Figure CN123178918A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a method and related equipment for generating agent models for power grid production command. Background Technology
[0002] Power grid production command involves various tasks, including equipment maintenance, dispatch optimization, troubleshooting, and emergency response. Currently, production command relies heavily on manual operation. Dispatchers must manually perform data queries, correlation analysis, and command issuance across multiple systems, resulting in long response times, high labor costs, and significant operational risks. Existing operation monitoring systems are large and complex, making it difficult for individual personnel to fully grasp the system status and quickly perform correlation analysis and make accurate decisions when faced with abnormal information.
[0003] In recent years, artificial intelligence (AI) technology has been explored and applied in power systems. Some studies have attempted to decompose power tasks using large language models or achieve coordination of distribution network equipment through intelligent agent technology. However, existing solutions still have the following shortcomings: First, they lack end-to-end autonomous execution capabilities from understanding natural language instructions to tool invocation, with insufficient semantic understanding accuracy and weak anomaly handling mechanisms. Second, most systems are developed for fixed scenarios, lacking self-reflection and strategy optimization capabilities based on execution results, making errors prone to recurrence. Therefore, the intelligence level of existing power grid production command and decision-making methods needs to be improved. Summary of the Invention
[0004] In view of this, the purpose of this disclosure is to provide a method and related equipment for generating proxy models for power grid production command, so as to improve the intelligence of power grid production command decision-making.
[0005] In a first aspect, embodiments of this disclosure provide a method for generating a proxy model for power grid production command. The method includes: acquiring historical multi-source operation data, wherein the historical multi-source operation data includes at least historical natural language instructions, standard task decomposition paths corresponding to the historical natural language instructions, historical tool call sequences, execution results, and resource consumption data; mapping the historical natural language instructions into a hierarchical sub-task sequence according to preset task decomposition rules, and encoding the sub-task sequence, the corresponding power grid resource status, and equipment alarm data into a historical state feature vector; wherein the sub-task sequence includes multiple sub-task nodes and dependencies between each sub-task; constructing an initial proxy model; wherein the initial proxy model includes: a large language model task understanding module, a state encoding network, a deep reinforcement learning decision module, a tool execution interface, and a reflection feedback fusion module, wherein the deep reinforcement learning decision module includes: a policy network and a value network, and the large language model task understanding module is used to process the input natural language instructions. The process is broken down into sub-task sequences. The state encoding network maps the sub-task sequences to the current resource state as fixed-length state embedding vectors. The policy network outputs the action to handle the current task in the sub-task sequence and the tool call parameters based on the state embedding vectors. The value network evaluates the expected cumulative reward corresponding to the state embedding vectors. The tool execution interface calls external power grid tools based on the tool call parameters. The reflection feedback fusion module performs deviation attribution analysis based on the tool execution results and generates correction suggestions. The initial agent model is trained using the historical state feature vectors as state samples and the tool selections and parameters in the historical tool call sequences as action samples. A reward signal indicating task completion timeliness and resource utilization efficiency is calculated based on the execution results and resource consumption data. The parameters of the policy network and the value network are updated based on the reward signal until the reward signal converges or reaches a preset number of iterations, thus obtaining the trained agent model.
[0006] Optionally, the step of mapping the historical natural language instructions into a hierarchical subtask sequence according to a preset task decomposition rule, and encoding the subtask sequence, the corresponding power grid resource status, and equipment alarm data into a historical state feature vector, includes: determining the task's attribute information, target type, and execution mode by semantically understanding the historical natural language instructions; decomposing the task into subtasks using a hierarchical decomposition algorithm based on the attribute information, target type, and execution mode; decomposing each level of task sequentially from the top-level task using an iterative decomposition algorithm until a preset level of refinement is reached to obtain a hierarchical subtask sequence; performing graph structure encoding on the dependencies among the subtasks; performing numerical normalization encoding on the power grid resource status at the corresponding time of the task; performing time-series feature encoding on the equipment alarm data at the corresponding time of the task; and concatenating the encoding results to obtain a historical state feature vector.
[0007] Optionally, the initial agent model is trained using the historical state feature vector as state samples and the tool selections and parameters in the historical tool call sequence as action samples. A reward signal indicating task completion timeliness and resource utilization efficiency is calculated based on the execution results and resource consumption data. The parameters of the policy network and the value network are updated based on the reward signal until the reward signal converges or reaches a preset number of iterations to obtain the trained agent model. This step includes: inputting the historical state feature vector as state samples into the policy network to obtain the predicted action output by the policy network; and applying a preset policy network loss function to compare the predicted action with the historical tool call sequence used as action samples. The tool selection and parameters are used to calculate the policy network loss value. The execution results and resource consumption data are weighted and fused using task completion timeliness and resource utilization efficiency indicators to obtain a reward signal. The reward signal is used as a monitoring signal through a preset value network loss function to calculate the value network loss value. The policy network parameters are updated using the policy network loss value to drive the policy network's output actions towards the specified reward direction. The value network parameters are also updated based on the value network loss value to drive the value network's state value estimation towards the actual cumulative reward. This process is repeated multiple times until the reward signal converges or a preset number of iterations is reached to obtain the trained surrogate model.
[0008] Optionally, after the step of inputting the historical state feature vector as a state sample into the policy network to obtain the predicted action output by the policy network, and before the step of updating the parameters of the policy network through the policy network loss value, the method further includes: obtaining the deviation attribution analysis result output by the reflective feedback fusion module, determining the deviation type and deviation penalty coefficient based on the deviation attribution analysis result, using the deviation penalty coefficient as the reverse adjustment amount of the reward signal, and constructing a modified reward function containing the deviation penalty term. ,in,
[0009]
[0010] This is a reward item for sub-task completion. This is a reward item for completing the task within a certain timeframe. This is a reward item for resource utilization efficiency. The deviation penalty term output by the reflection feedback fusion module is dynamically assigned a value based on the anomaly type in the deviation attribution analysis results. , , , Here, M represents the weighting coefficient for each reward item; M is the total number of preset deviation types. The deviation penalty coefficient for the m-th type of deviation. This is an indicator function that takes a value of 1 when the m-th type of deviation is detected, and 0 otherwise. The abnormal types include tool call timeout, parameter format error, data source unavailable, logical rule conflict, and insufficient resources.
[0011] Optionally, the policy network loss function includes a continuous action loss term. Discrete action loss term and regularization terms The continuous action loss term is used to constrain the decision-making of the policy network generation tool's invocation parameters, and the discrete action loss term is used to constrain the policy network's decision-making regarding the selection of tasks to be processed. The policy network loss value... for:
[0012]
[0013] in, , These are the continuous action loss weight coefficient and the rule regularization coefficient, respectively, where K is the total number of selectable subtasks. This is an indicator function; it takes a value of 1 when the policy network selects the k-th subtask, and 0 otherwise. For the k-th subtask in the current state Below are the parameters for calling the tool. The compliance penalty function, the compliance penalty function The criteria for determining the logical rule conflict anomaly type in the deviation attribution analysis results are predefined.
[0014] Optionally, after obtaining the trained proxy model, the method further includes: in response to the input of a power grid production command statement, acquiring real-time multi-source operation data; wherein the power grid production command statement is a natural language instruction, and the real-time multi-source operation data includes the current power grid resource status and equipment alarm data; inputting the power grid production command statement into the trained proxy model, and dynamically decomposing the power grid production command statement into a real-time sub-task sequence through the large language model task understanding module in the proxy model; inputting the real-time sub-task sequence and the current power grid resource status into a state encoding network in the proxy model, and mapping the real-time sub-task sequence and the current resource status into a fixed-length real-time state embedding vector through the state encoding network; inputting the real-time state embedding vector into a policy network in the proxy model, and outputting a policy based on the real-time state embedding vector for the real-time sub-task sequence. The process involves: determining the action and tool call parameters for the current task in the task sequence; sending these parameters to the tool execution interface in the proxy model; calling an external power grid tool through the tool execution interface based on the parameters; obtaining the tool execution result; inputting the execution result into the reflection feedback fusion module in the proxy model; performing deviation attribution analysis on the execution result to determine if there is an execution deviation; generating a correction suggestion through the reflection feedback fusion module; feeding the correction suggestion back to the policy network as an additional state feature or action space mask; and re-outputting the action and tool call parameters based on the correction suggestion; outputting the action and tool call parameters for the current task and continuing to process the next task in the real-time subtask sequence until all subtasks are completed.
[0015] Optionally, the step of generating correction suggestions through the reflection feedback fusion module includes: obtaining the abnormal event type in the tool execution result, and determining the attribution type based on the abnormal event type; the attribution type includes at least one of tool call timeout, parameter format error, data source unavailability, logical rule conflict, and insufficient resources; matching the corresponding correction operation from a preset correction strategy library according to the attribution type; wherein, if the attribution type is tool call timeout, the generated correction suggestion is to switch to a backup tool or adjust the call timeout threshold; if the attribution type is parameter format error, the generated correction suggestion is to correct the tool call parameters or regenerate the parameters; if the attribution type is data source unavailability, the generated correction suggestion is to switch to a backup data source or adjust the data query conditions; if the attribution type is logical rule conflict, the generated correction suggestion is to re-plan the subtask execution order; if the attribution type is insufficient resources, the generated correction suggestion is to reallocate resources or adjust the task priority; and outputting the execution instruction corresponding to the correction operation as the correction suggestion to the strategy network, so that the strategy network re-outputs the handling action and tool call parameters according to the correction suggestion.
[0016] Secondly, this disclosure provides an agent model generation device for power grid production command. The device includes: an acquisition module for acquiring historical multi-source operation data, wherein the historical multi-source operation data includes at least historical natural language instructions, standard task decomposition paths corresponding to the historical natural language instructions, historical tool call sequences, execution results, and resource consumption data; a mapping module for mapping the historical natural language instructions into hierarchical sub-task sequences according to preset task decomposition rules, and encoding the sub-task sequences, corresponding power grid resource status, and equipment alarm data into a historical state feature vector; wherein the sub-task sequence includes multiple sub-task nodes and dependencies between sub-tasks; and a construction module for constructing an initial agent model; wherein the initial agent model includes: a large language model task understanding module, a state encoding network, a deep reinforcement learning decision module, a tool execution interface, and a reflection feedback fusion module, wherein the deep reinforcement learning decision module includes: a policy network and a value network, and the large language model task understanding module is used to process the input... The natural language instructions are decomposed into a sequence of subtasks. The state encoding network maps the subtask sequence to the current resource state as a fixed-length state embedding vector. The policy network outputs the action to handle the current task in the subtask sequence and the tool call parameters based on the state embedding vector. The value network evaluates the expected cumulative reward corresponding to the state embedding vector. The tool execution interface calls external power grid tools based on the tool call parameters. The reflection feedback fusion module performs deviation attribution analysis based on the tool execution results and generates correction suggestions. The training module uses the historical state feature vector as state samples and the tool selection and parameters in the historical tool call sequence as action samples to train the initial agent model. It calculates a reward signal to indicate task completion timeliness and resource utilization efficiency based on the execution results and resource consumption data. It updates the parameters of the policy network and the value network based on the reward signal until the reward signal converges or reaches a preset number of iterations to obtain the trained agent model.
[0017] Thirdly, embodiments of this disclosure provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described proxy model generation method for power grid production command.
[0018] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the aforementioned proxy model generation method for power grid production command.
[0019] The embodiments disclosed herein bring the following beneficial effects: The aforementioned proxy model generation method and related equipment for power grid production command, by mapping natural language instructions into sub-task sequences and co-encoding them with resource status and alarm data, enable the model to simultaneously perceive the relationship between operational semantics and resource constraints; by constructing a proxy model that includes task understanding, status encoding, decision-making, tool execution, and reflective feedback, a unified architecture is used to connect the entire process of task decomposition, tool invocation, and strategy optimization; by using reward signals to drive strategy and value network parameter updates, the model can continuously optimize decisions based on execution results, overcoming the shortcomings of lacking self-reflection capabilities and repeated errors; ultimately, it achieves autonomous transformation from instructions to execution and feedback-based strategy optimization, improving the intelligence level of power grid production command decision-making.
[0020] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objects and other advantages of this disclosure are realized and obtained through the structures particularly pointed out in the description, claims and drawings.
[0021] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0023] Figure 1 This is a flowchart of one embodiment of the proxy model generation method for power grid production command in this disclosure; Figure 2 A schematic diagram of an agent model generation device for power grid production command provided in an embodiment of this disclosure; Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0025] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in this disclosure, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] For ease of understanding, the specific process of the embodiments of this disclosure is described below. Please refer to [link / reference]. Figure 1 One embodiment of the proxy model generation method for power grid production command in this disclosure includes: Step S10: Obtain historical multi-source job data. The historical multi-source job data includes at least historical natural language commands, standard task decomposition paths corresponding to historical natural language commands, historical tool call sequences, execution results, and resource consumption data. Historical multi-source operation data serves as the sample data source for training the agent model. It includes at least historical natural language commands, standard task decomposition paths corresponding to historical natural language commands, historical tool call sequences, execution results, and resource consumption data. It can be obtained from the production command database of the power grid management platform, but specific details are not limited here.
[0027] Historical natural language commands are operational instructions issued in natural language by dispatchers, maintenance personnel, or managers in power grid production command scenarios. These commands may include, but are not limited to, equipment maintenance commands, troubleshooting commands, emergency response commands, system detection commands, and data acquisition commands. Sources for obtaining historical natural language commands may include transcripts of dispatch telephone recordings, historical dispatch command tickets, and production command system operation logs.
[0028] For example, work instructions in natural language form could be: "Assess the impact of Typhoon XX on the coastal 220kV lines and activate the typhoon and flood prevention emergency plan," "Conduct preventive tests on the main transformer of XX substation before maintenance, including insulation resistance testing and winding DC resistance testing," or "Query the real-time load data and the load change trend of the 10kV distribution network line F12 in XX area over the past 7 days."
[0029] A standard task decomposition path refers to the execution path formed by breaking down a natural language instruction into an ordered sequence of subtasks according to preset task decomposition rules. This decomposition path can be derived from a historical experience database and a standard workflow database. The historical experience database stores standardized process templates for different types of production tasks. Each template includes the task's execution steps, required tool interfaces, resource configuration, and scheduling information. The standard task decomposition path reflects, in historical practice, the set of subtasks resulting from the decomposition of similar instructions, the execution order of each subtask, and the dependencies between subtasks.
[0030] For example, for the instruction "Assess the impact of Typhoon XX on coastal 220kV lines and activate the typhoon and flood prevention emergency plan", the standard task breakdown path can be as follows: Subtask 1—Obtain real-time path and wind speed data of Typhoon XX; Subtask 2—Identify the list of affected lines; Subtask 3—Query the load and user information of the affected lines; Subtask 4—Generate an impact assessment report; Subtask 5—Activate the corresponding level of emergency plan according to the assessment level.
[0031] The historical tool call sequence is a record of the external power grid tools and their call parameters actually invoked during the execution of each subtask in the above standard task breakdown path. The types of external power grid tools may include, but are not limited to: equipment maintenance tools, scheduling optimization tools, emergency response tools, troubleshooting tools, system detection and safety check tools, and data acquisition and monitoring tools. The tool call sequence records the tools invoked for each subtask, the order in which they were invoked, the parameters passed in for each invocation, and the results returned by the tools.
[0032] For example, for the subtask of "obtaining real-time path and wind speed data of Typhoon XX", the tool can call the sequence record, which may include: calling the meteorological data platform API, passing in the parameters {region="XX", time window="2025-09-01 00:00:00 to 2025-09-03 23:59:59", data type="typhoon path + wind speed"}, and returning the typhoon trajectory point set and wind speed time series data.
[0033] The execution results are the evaluation data obtained by assessing the execution effect from multiple dimensions after the completion of each sub-task and the overall task. The execution results can include at least the task objective achievement evaluation results, resource utilization efficiency evaluation results, time efficiency evaluation results, and task completion quality evaluation results. Specifically, task objective achievement can be determined by comparing the actual task output with the expected target; resource utilization efficiency can be determined by statistically analyzing token consumption and hardware resource usage; time efficiency can be determined by comparing the actual task completion time with the scheduled time; and task completion quality can be determined by comparing the accuracy of the execution results with a predetermined accuracy standard. Specific details are not limited here.
[0034] Resource consumption data can indicate the amount of computing resources consumed during the execution of each subtask. This data can include at least token consumption and hardware resource usage. Token consumption indicates the number of computing units consumed by the large language model for semantic understanding, reasoning, and generation; hardware resource usage indicates the CPU, GPU, memory, and other hardware resources used during model inference.
[0035] In one implementation, when acquiring historical multi-source operation data, historical dispatch instruction ticket records can be exported in batches from the production command database of the power grid management platform. Each dispatch instruction ticket record includes the original natural language instruction issued by the dispatcher, the instruction issuance time, the instruction execution completion time, the tools and parameters called during execution, and the archived report after execution. Specifically, historical natural language instructions can be extracted by parsing the structured fields and unstructured text of the dispatch instruction tickets; historical tool call sequences can be extracted by parsing the system call logs in the execution records; execution results can be extracted by parsing the evaluation information in the archived reports; and resource consumption data can be extracted by statistically analyzing the computing resource usage records in the system call logs. For each historical instruction, the standard task breakdown path is also extracted from its corresponding standard operating procedure document or historical execution record. This implementation is suitable for offline batch processing scenarios, allowing all historical data to be collected and processed in one go before model training.
[0036] In one implementation, during the operation of the power grid production command system, a log acquisition agent can monitor the operation logs of multiple subsystems in real time to obtain historical multi-source operation data. Specifically, natural language command text can be obtained from the voice transcription module of the dispatch telephone system; task breakdown records can be obtained from the task orchestration module of the production command system; tool call sequences and their parameters can be extracted from the API gateway's call logs; execution results can be extracted from the status tracking records of each business system; and token consumption and hardware resource usage data can be extracted from the resource monitoring platform. All data sources are associated with a unified timestamp and aggregated into complete historical multi-source operation data records by task instance, which are then stored in a historical database for subsequent model training. This implementation is suitable for online continuous data acquisition scenarios, ensuring the timeliness and completeness of historical data.
[0037] In one implementation, for new job instructions for which standard task breakdown paths have not yet been accumulated in the historical experience base, a hybrid approach combining automatic extraction and manual annotation is used to obtain standard task breakdown paths. Specifically, a large language model first generates preliminary task breakdown suggestions based on the instruction semantics, and then scheduling experts review, correct, and confirm the breakdown results. The confirmed breakdown paths are then stored in the historical experience base. This implementation is suitable for the standard task breakdown path accumulation stage of new scenarios and new types of instructions, and can reduce the cost of manual annotation to a certain extent while ensuring the accuracy of the breakdown paths.
[0038] Step S20: According to the preset task decomposition rules, the historical natural language instructions are mapped into a hierarchical sub-task sequence, and the sub-task sequence, the power grid resource status at the corresponding time and the equipment alarm data are jointly encoded into a historical status feature vector; wherein, the sub-task sequence contains multiple sub-task nodes and the dependencies between each sub-task. This step transforms unstructured natural language instructions into structured subtask sequences, enabling the policy network to learn using subtasks as basic decision-making units. By performing multimodal joint encoding of the subtask sequences with power grid resource status and equipment alarm data, the state samples trained subsequently can simultaneously reflect information from three dimensions: operation semantics, resource constraints, and equipment operating status.
[0039] The pre-defined task decomposition rules are a system of rules used to break down natural language instructions into an ordered sequence of subtasks according to the inherent logical structure of a task. This system can include three levels: task attribute analysis rules, task objective analysis rules, and task execution method analysis rules. Among them, the task attribute analysis rules can identify the job type, current status, plan number, and associated equipment information in the task input, and classify tasks into six categories: equipment maintenance, scheduling optimization, emergency response, troubleshooting, system detection and safety inspection, and data acquisition and monitoring, thereby determining the task's complexity level, resource requirement level, and time constraint level. Task objective analysis rules can identify the final state expected to be achieved by the task and determine whether the task type is a repair objective, maintenance objective, or optimization objective. Task execution method analysis rules can determine whether the execution mode is a single execution mode, a collaborative execution mode, or a parallel execution mode based on the attribute analysis results and the objective analysis results.
[0040] For example, for the instruction "Assess the impact of Typhoon XX on the coastal 220kV lines and activate the typhoon and flood prevention emergency plan", the task classification can be emergency response, the task objective can be repair objective (restoring the safe operation of the power grid), and the execution mode can be collaborative execution mode (requiring collaboration among multiple teams including meteorology, dispatching, and emergency repair).
[0041] In one implementation, the preset task decomposition rules can also be combined with a historical experience base and a standard workflow base for task decomposition. Specifically, a feature extraction and matching mechanism is used to retrieve historical cases that match the current task from the historical experience base, and a vector search or keyword search is used to match task features to find the corresponding task decomposition template and execution path; the standard workflow base stores standardized process templates for different types of production tasks, and each template contains the task's execution steps, required tools, resource configuration, and time schedule information.
[0042] Power grid resource status indicates the availability and load of various resources upon which the power grid depends for operation at any given moment. Specifically, power grid resource status may include, but is not limited to: the current load and response latency of various tool execution APIs, the remaining capacity and utilization rate of computing resources, the current location and availability of repair personnel and vehicles, and the inventory and availability status of backup equipment.
[0043] Equipment alarm data can include various abnormal events and status warnings generated by power grid equipment during operation. Specifically, equipment alarm data should at least include tripping events and power restoration time information. In particular, it may also include, but is not limited to, equipment overload alarms, abnormal temperature alarms, communication interruption alarms, and protection action alarms, etc., without further limitation here.
[0044] In one implementation, historical natural language instructions exported in batches from a historical database can be decomposed using rule-based template matching. Specifically, standard decomposition templates are pre-constructed for each type of production command task (e.g., equipment maintenance, scheduling optimization, emergency response, troubleshooting, system detection, and data acquisition). Each template contains a list of standard subtasks for that type of task, dependencies between subtasks, and a preset tool type for each subtask. For the input historical natural language instructions, the task category is first identified through keyword matching and semantic similarity calculation. Then, the standard decomposition template for the corresponding category is called to generate an initial subtask sequence. Finally, the placeholders in the template are instantiated and filled according to the specific parameters in the instructions (e.g., equipment name, area range, time window, etc.) to obtain a complete hierarchical subtask sequence.
[0045] After the data is disassembled, the power grid management platform's historical database is used to query the power grid resource status records and equipment alarm data records corresponding to the instruction at that time. Subtask dependencies can be encoded using graph neural networks, resource status can be encoded using numerical normalization, and alarm data can be encoded using time-series features. These three encoding results are then concatenated into a historical status feature vector. This implementation method is suitable for offline batch processing scenarios, allowing the disassembly and encoding of all historical data to be completed in one go before model training.
[0046] In one implementation, a large language model can be used for dynamic task decomposition of real-time input natural language commands. Specifically, the real-time natural language commands are input into the task understanding module of the large language model. This module parses the commands by calling task decomposition prompt word templates, where the prompt word templates may include task objective fields, task step fields, time requirement fields, resource requirement fields, and role and responsibility fields. Guided by the prompt word templates, the large language model dynamically decomposes the commands into a hierarchical sequence of sub-tasks. In unknown scenarios, adaptive reasoning and strategy adjustment can be achieved by embedding historical data and business rules into the prompt words. After decomposition, the current power grid resource status (such as the load of each API, the location of personnel and vehicles, etc.) and equipment alarm data can be obtained from the real-time data bus. Multimodal joint encoding is performed through a state coding network to obtain a real-time state embedding vector. This implementation is suitable for online reasoning scenarios and can respond to new production command commands in real time.
[0047] In one implementation, for the input historical natural language command, a feature extraction and matching mechanism is first used to retrieve historical cases matching the current task from a historical experience database. Specifically, this can be done through vector retrieval or keyword retrieval to match task features. If a historical case with a similarity higher than a preset threshold is found, the task decomposition template and execution path of that case are directly reused; if no historical case with a similarity higher than the preset threshold is found, a large language model is invoked for dynamic decomposition. After a successful match, adaptation and verification can be performed based on the environment and requirements of the current task to ensure that historical experience can be flexibly applied and adjusted to the most suitable execution plan. This implementation is suitable for scenarios with abundant historical data accumulation, and can improve decomposition efficiency while ensuring decomposition accuracy.
[0048] Step S30: Construct an initial agent model; the initial agent model includes: a large language model task understanding module, a state encoding network, a deep reinforcement learning decision module, a tool execution interface, and a reflection feedback fusion module. The deep reinforcement learning decision module includes: a policy network and a value network. The large language model task understanding module is used to decompose the input natural language instructions into a sequence of sub-tasks. The state encoding network is used to map the sub-task sequence and the current resource state into a fixed-length state embedding vector. The policy network is used to output the action to handle the current task in the sub-task sequence and the tool call parameters according to the state embedding vector. The value network is used to evaluate the expected cumulative reward corresponding to the state embedding vector. The tool execution interface is used to call external power grid tools according to the tool call parameters. The reflection feedback fusion module is used to perform deviation attribution analysis based on the tool execution results and generate correction suggestions. This implementation uses a modular architecture to connect the entire process from natural language command input to tool invocation and execution, and then to execution feedback optimization. This enables the agent model to not only have natural language understanding capabilities, but also self-reflection and error correction capabilities, making power grid production command more intelligent.
[0049] In the agent model, the trainable modules include a deep reinforcement learning decision module, which comprises a policy network and a value network. The policy network outputs the appropriate actions and tool invocation parameters for the current task in the sub-task sequence based on the state embedding vector. The policy network performs a non-linear transformation on the input state embedding vector using a deep neural network, outputting a probability distribution (discrete actions) or specific parameter values (continuous actions) in the action space. The training objective of the policy network is to maximize the expected cumulative reward.
[0050] In one implementation, the policy network employs a hybrid action space structure: discrete action heads are used to select task items to be handled, and continuous action heads are used to generate tool invocation parameters. For example, after receiving the state embedding vector, the policy network selects the subtask "activate the typhoon and flood prevention emergency plan" as the current task to be handled through the discrete action head, and generates tool invocation parameters {emergency level = "Level II", response area = "three coastal cities", activation time = "immediately"} through the continuous action head; the specific details are not limited here.
[0051] In this embodiment, a value network is used to evaluate the expected cumulative reward corresponding to a state embedding vector. The value network performs a nonlinear transformation on the state embedding vector and outputs a scalar value representing the expected cumulative reward obtainable by executing the current policy in the current state. The training objective of the value network is to make the state value estimate approximate the actual cumulative reward. For example, if the value network outputs an expected cumulative reward of 85.6 for a given state embedding vector, it means that executing the current policy in the current state is expected to yield a cumulative reward of 85.6.
[0052] In this embodiment, the tool execution interface is the execution channel connecting decision-making and external systems in the initial agent model, used to invoke external power grid tools according to the tool invocation parameters. The types of external power grid tools may include, but are not limited to, equipment maintenance tools, scheduling optimization tools, emergency response tools, troubleshooting tools, system detection and safety inspection tools, and data acquisition and monitoring tools.
[0053] In one implementation, the tool execution interface is processed in accordance with the unified tool access specification, which includes the definition of tool name, definition of tool function explanation, definition of tool input and output parameters, definition of tool parameters and definition of tool usage examples, and provides a standard plugin mode definition to support the Swagger standard format API definition.
[0054] In one implementation, the tool execution interface also includes a unified tool gateway, through which call requests can be centrally processed, including: performing identity authentication, permission verification and request filtering on requests through a centralized security control mechanism; distributing requests to multiple service instances through a load balancing mechanism; and performing rate limiting and circuit breaking through traffic control and circuit breaking mechanisms to prevent system overload.
[0055] In this embodiment, the reflection and feedback fusion module is used to perform deviation attribution analysis and generate correction suggestions based on the tool execution results. Specifically, the reflection and feedback fusion module can be used to: generate a preliminary sub-task sequence through the large language model task understanding module in the action phase; detect the quality and errors of the initial output through multi-dimensional evaluation in the observation phase; perform attribution analysis on the error types in the reflection phase to form an interpretable reflection report; and optimize the initial output based on the reflection results in the correction phase.
[0056] In one implementation, an open-source large language model (such as LLaMA, Qwen, etc.) can be used as the base model for the large language model task understanding module, and task decomposition capability can be achieved through prompt word engineering; the state encoding network can adopt a standard multilayer perceptron structure; the deep reinforcement learning decision module can adopt the proximal policy optimization (PPO) algorithm framework, with the policy network and value network sharing the feature extraction layer; the reflective feedback fusion module can adopt a rule-based simple attribution mechanism, determining the anomaly type by judging the tool execution return code and response time thresholds. This implementation is suitable for scenarios with limited model parameters and computing resources, and can reduce deployment costs while ensuring core functionality.
[0057] In one implementation, the large language model task understanding module can adopt a hybrid architecture combining a hierarchical task network and a large language model. Specifically, for pre-defined production command tasks (such as equipment maintenance and data acquisition), sub-task sequences can be directly generated using a pre-defined hierarchical task network template; for novel or complex tasks (such as unconventional disaster scenarios in emergency response), the large language model can be invoked for dynamic decomposition. The two methods are routed using a task classifier. This implementation is suitable for production command environments with a rich historical experience base that also need to handle new scenarios, ensuring efficiency in processing routine tasks while maintaining adaptability to new scenarios.
[0058] In one implementation, data flow between modules of the initial agent model can be scheduled and controlled via a hierarchical state machine. Specifically, the state machine corresponds to five states: pending parsing (waiting for output from the large language model task understanding module), pending encoding (waiting for output from the state encoding network), pending decision (waiting for output from the policy network), pending execution (waiting for return from the tool execution interface), and pending reflection (waiting for output from the reflection feedback fusion module). After each module completes its processing, it triggers a state transition and writes the output data to a shared context cache. The correction suggestions generated by the reflection feedback fusion module re-trigger the decision-making process through a state machine rollback mechanism. This implementation is suitable for scenarios with high requirements for inter-module collaboration efficiency and process traceability.
[0059] Step S40: Using historical state feature vectors as state samples and tool selections and parameters in historical tool call sequences as action samples, train the initial agent model. Calculate reward signals to indicate task completion timeliness and resource utilization efficiency based on execution results and resource consumption data. Update the parameters of the policy network and value network based on the reward signals until the reward signals converge or the preset number of iterations is reached to obtain the trained agent model.
[0060] Specifically, the training process of the proxy model includes: inputting historical state feature vectors into the policy network to obtain predicted actions; comparing the predicted actions with the actual actions in the historical tool call sequence to calculate the policy network loss; calculating the reward signal based on the execution results and resource consumption data; using the reward signal as a supervision signal to calculate the value network loss; updating the parameters of the policy network and value network respectively using the policy network loss and value network loss; and repeating the iteration until the reward signal converges or the preset number of iterations is reached. This implementation uses a deep reinforcement learning algorithm to enable the proxy model to have autonomous decision-making capabilities. After training, the proxy model can autonomously complete the entire process from task decomposition to tool call based on real-time natural language instructions during the online inference stage.
[0061] In this embodiment, each state sample corresponds to the situation of the power grid system at a given time step, including multi-dimensional information such as the current subtask queue status, power grid resource status, and equipment alarm data. The state sample serves as input to the policy network, driving the network to output decision actions under the current state.
[0062] Action samples refer to the tool selections and parameters in the historical tool call sequence obtained in step S10. Each action sample corresponds to the actual operation performed by the power grid system under a certain state sample, including selecting a target subtask as the current disposal object (discrete action) and generating tool call parameters for that target subtask (continuous action). Action samples serve as the supervision targets of the policy network output and are used to calculate the policy network loss.
[0063] The reward signal is a scalar value used in deep reinforcement learning training to evaluate the quality of the output actions of the policy network. Calculated based on execution results and resource consumption data, the reward signal indicates two dimensions: task completion timeliness and resource utilization efficiency. A larger reward signal value indicates a better action taken by the policy network in the current state; a smaller value indicates a worse action. The reward signal can also serve as a supervision signal for the value network, driving the state value estimation of the value network to approximate the actual cumulative reward.
[0064] The policy network loss function is a quantitative indicator used to measure the difference between the predicted actions output by the policy network and the action samples (historical actual actions). The smaller the policy network loss value, the closer the action output by the policy network is to the historical optimal action. The policy network loss function is used to indicate the parameters for updating the policy network.
[0065] In another implementation, the policy network loss function can be replaced by the pruning of the proximal policy optimization algorithm. The pruning mechanism limits the range of change in the action distribution output by the policy network, preventing drastic changes in the policy network during training.
[0066] The value network loss function is a quantitative indicator used to measure the difference between the value network's estimate of state value and the actual cumulative reward. A smaller value network loss value indicates a more accurate state value estimate. The value network loss function is used to indicate the parameters for updating the value network. In one implementation, the value network loss function can be a mean squared error loss function, calculating the mean squared error between the value network's estimate of state value and the temporal difference target value as the value loss value.
[0067] Whether the reward signal has converged can be determined by the change in the moving average of the reward signal over multiple consecutive training batches. For example, if the change is below a preset threshold, then the reward signal has converged. Reward signal convergence indicates that the decision quality of the policy network has reached a stable level, and further training will yield limited benefits.
[0068] In one implementation, the Soft Actor-Critic (SAC) algorithm can be used to train the initial agent model. Unlike the PPO algorithm, the SAC algorithm introduces an entropy regularization term into the policy network's loss function, encouraging the policy network to continue exploring the action space during training. When training the initial agent model using the SAC algorithm, the policy network not only optimizes action selection based on reward signals but also maximizes the entropy of the action distribution to avoid premature convergence to a suboptimal policy. This implementation is suitable for scenarios with a large action space and requiring extensive exploration of the optimal policy.
[0069] In one implementation, a priority experience replay mechanism and a soft update strategy can be introduced during training. Specifically, each training sample is assigned a priority based on its temporal difference error; samples with larger errors have a higher probability of being sampled in subsequent samplings. The parameters of the value network are not directly copied from the current value network parameters, but are updated incrementally according to the soft update coefficients. This implementation is suitable for scenarios where the training sample distribution is uneven and sample utilization efficiency needs to be improved.
[0070] In one implementation, the training process can be divided into two stages: In the first stage, the policy network is pre-trained using labeled samples through supervised fine-tuning; in the second stage, fine-tuning is performed using reinforcement learning based on the pre-trained network. Specifically, the first stage uses tool selections and parameters from historical tool call sequences as supervision labels, driving the policy network to learn historically optimal actions through cross-entropy loss and mean squared error loss; the second stage uses reward signals to further optimize the policy network. This implementation is suitable for scenarios with high-quality historical data and where faster training convergence is desired.
[0071] In one implementation, a distributed parallel training architecture can be used to accelerate model training. Specifically, multiple training nodes are pre-deployed, each independently sampling training samples and calculating gradients; the gradients from each node are aggregated and sent to a central parameter server for parameter updates; the updated parameters are then synchronously distributed to each training node. This implementation is suitable for scenarios with large amounts of training data and strict requirements on training time.
[0072] The proxy model generation method for power grid production command provided by the above implementation method maps natural language instructions into a sequence of sub-tasks and co-encodes them with resource status and alarm data, enabling the model to simultaneously perceive the relationship between operational semantics and resource constraints. By constructing a proxy model that includes task understanding, status encoding, decision-making, tool execution, and reflective feedback, a unified architecture is used to connect the entire process of task decomposition, tool invocation, and strategy optimization. By using reward signals to drive strategy and value network parameter updates, the model can continuously optimize decisions based on execution results, overcoming the shortcomings of lacking self-reflection capabilities and repeated errors. Ultimately, it achieves autonomous transformation from instructions to execution and feedback-based strategy optimization, improving the intelligence level of power grid production command decision-making.
[0073] Next, we will explain the specific generation and application methods of the power grid production command agent model.
[0074] In one implementation, the steps of mapping historical natural language instructions into a hierarchical sequence of subtasks according to preset task decomposition rules, and encoding the subtask sequence, the corresponding power grid resource status, and equipment alarm data into a historical state feature vector, include: determining the attribute information, target type, and execution mode of the task by semantic understanding of the historical natural language instructions; decomposing the task into subtasks using a hierarchical decomposition algorithm based on the attribute information, target type, and execution mode; decomposing each level of task sequentially from the top-level task using an iterative decomposition algorithm until a preset level of refinement is reached to obtain a hierarchical sequence of subtasks; encoding the dependencies in the number of subtasks using a graph structure; encoding the power grid resource status at the corresponding time of the task using numerical normalization; encoding the equipment alarm data at the corresponding time of the task using temporal feature encoding; and concatenating the encoding results to obtain a historical state feature vector.
[0075] This implementation transforms unstructured natural language instructions into fixed-length state feature vectors suitable for deep reinforcement learning processing through semantic understanding, hierarchical decomposition, and multimodal encoding. Specifically, by semantically understanding historical natural language instructions to determine the task's attribute information, target type, and execution mode, subsequent decomposition algorithms can select appropriate decomposition strategies based on the task's complexity, resource requirements, urgency, and other attributes. Through hierarchical decomposition algorithms and iterative decomposition algorithms, tasks are progressively decomposed from the top level to a predetermined level of refinement, enabling complex tasks to be broken down into executable atomic-level subtasks. This allows subsequent policy networks to learn using subtasks as basic decision-making units. By encoding the dependencies in the subtask sequence using a graph structure, subsequent policy networks can perceive the execution order constraints between subtasks during decision-making. By numerically normalizing the encoding of power grid resource status and temporally encoding equipment alarm data, subsequent training state samples can simultaneously reflect information from three dimensions: operational semantics, resource constraints, and equipment operating status. By concatenating the three encoding results into a fixed-length historical state feature vector, the state feature vectors in the training samples and the state embedding vectors in the online inference stage can be placed in the same feature space, allowing even offline training knowledge to be directly transferred to online inference scenarios.
[0076] In one implementation, the task attribute information may include the task's complexity level, resource requirement level, and time constraint level. The complexity level indicates the number of execution steps and the scale of collaboration required for the task; the resource requirement level indicates the type and quantity of human resources, equipment, technology, and other resources required for the task execution; and the time constraint level indicates the urgency of completing the task.
[0077] The target types can include repair targets, maintenance targets, and optimization targets. Repair targets correspond to tasks that urgently restore power system stability or normal equipment operation; maintenance targets correspond to routine inspection tasks that ensure equipment health and prevent faults; and optimization targets correspond to upgrade tasks that improve grid operating efficiency or introduce new technologies.
[0078] Execution modes can include single execution mode, collaborative execution mode, and parallel execution mode. Among them, single execution mode is suitable for tasks with clear processes that are completed by a single entity; collaborative execution mode is suitable for tasks that require coordination among multiple teams or processes; and parallel execution mode is suitable for large-scale tasks where multiple subtasks can be executed simultaneously.
[0079] In one implementation, the hierarchical decomposition algorithm can employ a task-granularity-based recursive decomposition algorithm, including: setting the top-level task as... Its complexity level is The preset threshold for refinement is The algorithm performs the following decomposition operations during recursion:
[0080] in, The number of sub-tasks in the first tier is determined by the resource requirement level of the task. and execution mode A joint decision is made regarding any subtask. , Continue decomposing until the complexity level of all leaf nodes is reached. This achieves the preset level of detail.
[0081] In this embodiment, graph structure encoding can convert the dependencies between subtask nodes in a subtask sequence into vector representations that can be processed by a graph neural network. These dependencies are used to indicate the execution order constraints between subtasks. In one embodiment, a graph attention network can be used for dependency encoding; details are not elaborated here.
[0082] Numerical normalization coding can convert the state of power grid resources into a numerical vector at a uniform scale. Normalization allows resource indicators with different dimensions to participate in calculations within the same feature space. In one implementation, a min-max normalization algorithm can be used for numerical normalization coding; however, the specific implementation is not limited here.
[0083] Time-series feature encoding can convert device alarm data into a vector representation that reflects time-series characteristics. In one implementation, a long short-term memory network can be used to encode the device alarm time-series data.
[0084] In one implementation, the initial agent model is trained using historical state feature vectors as state samples and tool selections and parameters from historical tool call sequences as action samples. A reward signal is calculated based on execution results and resource consumption data to indicate task completion timeliness and resource utilization efficiency. The parameters of the policy network and value network are updated based on the reward signal until the reward signal converges or a preset number of iterations is reached to obtain the trained agent model. This process includes: inputting historical state feature vectors as state samples into the policy network to obtain the predicted action output by the policy network; and using a preset policy network loss function to compare the predicted action with the tools in the historical tool call sequence used as action samples. The policy network loss is calculated by selecting parameters and obtaining the policy network loss value. The execution results and resource consumption data are weighted and fused using task completion timeliness and resource utilization efficiency indicators to obtain the reward signal. The reward signal is used as a supervision signal through a preset value network loss function to calculate the value network loss value. The policy network parameters are updated using the policy network loss value to drive the policy network's output actions towards the specified reward direction. The value network parameters are also updated based on the value network loss value to drive the value network's state value estimation to approximate the actual cumulative reward. This process is repeated multiple times until the reward signal converges or the preset number of iterations is reached, resulting in the trained surrogate model.
[0085] In this embodiment, by inputting historical state feature vectors as state samples into the policy network to obtain predicted actions, the policy network can directly learn the mapping relationship of "what action should be taken in what state" from real historical data. By comparing the predicted actions with historical actual actions through the policy network loss function, the output of the policy network can continuously approach the historical optimal decision. By performing weighted fusion calculations of task completion timeliness indicators and resource utilization efficiency indicators on the execution results and resource consumption data to obtain reward signals, the optimization objectives of the policy network can be aligned with the actual business objectives of power grid production command. By using the reward signal as a supervision signal to calculate the value network loss value through the value network loss function, the value network can accurately assess the long-term expected benefits under different states, providing a reliable value reference for the policy network's decision-making, thereby significantly improving the intelligence level of power grid production command decision-making.
[0086] In this embodiment, the input state embedding vector can be nonlinearly transformed using a deep neural network of the policy network to output the probability distribution or specific parameter values of the action space. In one embodiment, the policy network adopts a hybrid action space structure: the discrete action head outputs the probability distribution of each subtask selection through a softmax function, used to select the task to be processed; the continuous action head calls the specific values of the parameters through a Gaussian distribution parameter output tool. The policy network loss function can include discrete action loss terms and continuous action loss terms; the weighted sum of the two calculated separately can be used as the policy network loss value.
[0087] In this embodiment, the reward signal is calculated based on the execution results and resource consumption data, and is used to indicate two indicator dimensions: task completion time and resource utilization efficiency. In one embodiment, the reward signal is calculated using a weighted fusion method, where the calculation results of each indicator are weighted and fused according to the weight coefficients of each indicator; the specific details are not elaborated here.
[0088] The value network loss function is a quantitative indicator that measures the difference between the value network's estimate of state value and the actual cumulative reward. The smaller the value network loss value, the more accurate the state value estimate of the value network. In one implementation, the value network loss function uses the mean squared error loss function; however, this is not a specific limitation here.
[0089] When updating the parameters of a policy network using its loss value, the gradient of the policy network loss value can be propagated back along the network using the backpropagation algorithm to adjust the weight parameters of the policy network, making the future actions of the policy network more likely to obtain higher rewards. Similarly, when updating the parameters of a value network based on its loss value, the gradient of the value network loss value can also be propagated back along the network using the backpropagation algorithm to adjust the weight parameters of the value network, making the state value estimation of the value network more accurate.
[0090] In one implementation, the policy network parameters are updated using gradient ascent, and the value network parameters are updated using gradient descent. A soft update strategy for the target network can also be used to stabilize the training process of the value network. Training of the surrogate model can be stopped when the reward signal converges or a preset number of iterations is reached, resulting in the trained surrogate model.
[0091] In one implementation, after the step of inputting historical state feature vectors as state samples into the policy network to obtain the predicted actions output by the policy network, and before the step of updating the parameters of the policy network using the policy network loss value, the method further includes: obtaining the deviation attribution analysis results output by the reflective feedback fusion module, determining the deviation type and deviation penalty coefficient based on the deviation attribution analysis results, and using the deviation penalty coefficient as a reverse adjustment amount of the reward signal. ,in,
[0092]
[0093] This is a reward item for sub-task completion. This is a reward item for completing the task within a certain timeframe. This is a reward item for resource utilization efficiency. To reflect the deviation penalty term output by the feedback fusion module, the value is dynamically assigned based on the anomaly type in the deviation attribution analysis results. , , , Here, M represents the weighting coefficient for each reward item; M is the total number of preset deviation types. The deviation penalty coefficient for the m-th type of deviation. This is an indicator function. It takes a value of 1 when the m-th type of deviation is detected, and 0 otherwise. The exception types include tool call timeout, parameter format error, data source unavailable, logical rule conflict, and insufficient resources.
[0094] In this embodiment, by introducing a deviation penalty term as a reverse adjustment quantity into the reward signal, the reward signal, which originally only reflected the timeliness of task completion and resource utilization efficiency, can additionally reflect the compliance and robustness of the policy network's output actions. This drives the policy network to actively reduce the frequency of various execution anomalies while optimizing task execution efficiency. Furthermore, by dynamically assigning values based on the anomaly type in the deviation attribution analysis results, different deviation types can receive differentiated penalty intensities. Deviation types with higher severity correspond to larger penalty coefficients, guiding the policy network to prioritize avoiding high-risk errors. By using the modified reward signal for value network loss calculation, the value network can simultaneously learn the probability and impact of various deviations in different states when learning state value estimation. This makes the value network's state evaluation more comprehensive and conservative, assisting the policy network in making more cautious decisions in high-risk states.
[0095] In this embodiment, the deviation attribution analysis result refers to the structured information output by the reflection and feedback fusion module after detecting and analyzing deviations in the tool execution results. It may include at least a deviation type identifier and a deviation severity level. The deviation type refers to the category label obtained after classifying various abnormal events that occur during tool execution. The deviation type may include at least one of the following: tool call timeout, incorrect parameter format, unavailable data source, conflicting logical rules, and insufficient resources.
[0096] Understandably, tool call timeout means the tool execution time exceeds a preset threshold, which may be caused by network latency or insufficient processing capacity on the tool side; parameter format error means the parameter type, value range, or structure passed to the tool does not conform to the tool interface specification, which may be caused by the continuous actions generated by the policy network deviating from the valid range; data source unavailability means the external data service is inaccessible or returns an abnormal status code, which may be caused by third-party service failure or network interruption; logical rule conflict means the disposal action output by the policy network violates the topology constraints of power grid equipment, safe operation procedures, or operation priority rules; insufficient resources means that the currently available resources cannot meet the subtask execution requirements, such as API call quota exhaustion, full computing resources, or unavailability of emergency repair personnel.
[0097] The deviation penalty coefficient is a preset penalty weight value for each type of deviation, used to quantify the negative impact of different deviation types on the reward signal. Each deviation type corresponds to a specific type, and the penalty coefficient for each type can be set independently. Deviation types with higher severity (such as logical rule conflicts that may endanger power grid safety) are subject to larger penalty coefficients; deviation types with lower severity (such as parameter format errors that only affect the current tool call) are subject to smaller penalty coefficients.
[0098] In one implementation, deviation attribution analysis results can be obtained through a rule engine. Specifically, the reflection and feedback fusion module has a built-in deviation judgment rule library, where each rule defines a judgment condition for a deviation type and a corresponding penalty coefficient. When the various indicators of the tool's execution results meet the judgment conditions of a certain rule, the rule engine outputs the corresponding deviation type and penalty coefficient.
[0099] In one implementation, the bias attribution analysis results can be obtained using a lightweight classifier. Specifically, a large amount of tool execution logs labeled with bias types are collected in advance as training data to train a multi-classification model. This classifier takes the feature vector of the tool execution result as input, outputs the probability distribution of the bias type, takes the type with the highest probability as the attribution result, and outputs the corresponding penalty coefficient.
[0100] In this embodiment, the reverse adjustment amount is an additional negative penalty imposed on the deviation behavior based on the original reward signal. The mathematical expression of the reverse adjustment amount is the product of the deviation penalty coefficient and the deviation type indicator function. When a certain deviation type is detected, the corresponding deviation penalty coefficient is activated and deducted from the total reward; when no deviation is detected, the reverse adjustment amount is zero; when multiple abnormal types are detected simultaneously, the deviation penalty term is the sum of the penalty coefficients for each abnormality.
[0101] In one implementation, the weighting coefficient An adaptive adjustment strategy is adopted. Specifically, in the early stages of training, the policy network has a weak ability to avoid various biases, so... The initial value is set to zero, allowing the policy network to learn basic task execution capabilities first; once the policy network's basic execution capabilities reach a certain level, the value is gradually increased. The value of allows the policy network to gradually learn to avoid various execution anomalies during subsequent training.
[0102] In one implementation, penalty coefficients for different types of deviations The penalty is dynamically adjusted based on the power grid safety level. For deviation types that may endanger the safe operation of the power grid (such as logical rule conflicts), a larger penalty coefficient is set; for deviation types that only affect execution efficiency (such as tool call timeouts), a smaller penalty coefficient is set.
[0103] In another implementation, the deviation penalty term may not directly affect the reward signal at the current time step, but rather act as delayed feedback over multiple subsequent time steps. This implementation is suitable for situations where the negative impact of certain deviations is delayed—for example, a tool call parameter may not immediately report an error, but it causes multiple subsequent subtasks to fail due to data quality issues. Specifically, the delayed feedback reward correction formula is:
[0104] Where K is the length of the delayed feedback window. As a discount factor, This represents the bias penalty term for the k-th time step in the future. Through a delayed feedback mechanism, the policy network not only avoids immediate biases during training but also learns to avoid decision patterns that "do not currently cause errors but will lead to problems later." This implementation is suitable for scenarios where the impact of biases is delayed and where immediate rewards and long-term risks need to be weighed in multi-step decision-making.
[0105] In one implementation, the bias penalty coefficient may not be a fixed value, but rather dynamically adjusted according to the training progress. Specifically, in the early stages of training, the randomness of the policy network's output actions is relatively high, and biases occur frequently. At this time, all bias penalty coefficients are set to zero or a preset minimum value to avoid premature penalties that could cause the policy network to fall into a conservative strategy. In the middle stages of training, the policy network has acquired basic execution capabilities, and the bias penalty coefficient is gradually increased to guide the policy network to learn to avoid common anomalies. In the later stages of training, the policy network has become relatively stable, and the bias penalty coefficient reaches a preset maximum value, allowing the policy network to fully learn to avoid various anomalies during the refinement phase. The dynamic adjustment formula for the bias penalty coefficient is:
[0106] in, Here, t is the sigmoid function, and t is the current training step. To penalize the use of the starting step count, This is the number of transition steps for the penalty coefficient to increase from zero to its final value. This implementation is suitable for scenarios where the distribution of the policy network output changes significantly during training.
[0107] In one implementation, the policy network loss function includes a continuous action loss term. Discrete action loss term and regularization terms The continuous action loss term is used to constrain the decision-making process of the policy network invoking the tool, while the discrete action loss term is used to constrain the policy network's decision-making process of selecting tasks to be performed. The policy network loss value... for:
[0108]
[0109] in, , These are the continuous action loss weight coefficient and the rule regularization coefficient, respectively, where K is the total number of selectable subtasks. This is an indicator function; it takes a value of 1 when the policy network selects the k-th subtask, and 0 otherwise. For the k-th subtask in the current state Below are the parameters for calling the tool. The compliance penalty function, the compliance penalty function The criteria for determining the logical rule conflict anomaly type in the deviation attribution analysis results are predefined.
[0110] This implementation introduces a rule regularization term into the loss function, enabling the policy network to learn compliance constraints of actions simultaneously during training, thereby reducing execution anomalies caused by violations of power grid operation rules at the source. The policy network loss value output in this step can be used to indicate the update of policy network parameters.
[0111] In this embodiment, by constraining the policy network's decision to select the task to be handled by discrete action loss terms, the policy network can learn to select the optimal task from the current set of executable subtasks at each time step. By constraining the policy network's decision to generate tool call parameters by continuous action loss terms, the policy network can learn to generate accurate tool call parameters for the selected subtasks. By imposing penalties on non-compliant predicted actions by rule regularization terms, the policy network can learn compliance constraints of actions during training, thereby reducing execution anomalies caused by violations of power grid operation rules at the source.
[0112] Understandably, in the power grid production command scenario, the policy network needs to select one of the currently executable subtasks as the disposal object at each time step. This decision belongs to the discrete selection problem. After selecting a subtask, the policy network needs to generate specific tool call parameters (such as query area range, time window, equipment type, etc.) for the subtask. These parameters are usually continuous values or discrete values that can be encoded into continuous vectors.
[0113] In one implementation, the discrete action loss term adopts the cross-entropy loss function or the pruning replacement objective function form of the near-end policy optimization algorithm, while the continuous action loss term can adopt the mean squared error loss function or the pruning replacement objective function form of the near-end policy optimization algorithm.
[0114] In power grid production command scenarios, the actions output by the policy network must satisfy power grid equipment topology constraints, safe operation procedures, and operation priority rules. This implementation uses rule regularization terms to impose additional penalties on non-compliant actions in the loss function, guiding the policy network to learn and output compliant actions during training.
[0115] In this implementation, the compliance penalty function Based on the predefined criteria for determining logical rule conflict anomalies in the deviation attribution analysis results, for sub-task-parameter combinations that violate the rules, A positive value is used as the penalty; for compliant combinations, The value is 0. The specific form of the compliance penalty function can be flexibly designed according to different rule types, and is not limited here.
[0116] In one implementation, after obtaining the trained proxy model, the method further includes: in response to the input of a power grid production command statement, acquiring real-time multi-source operation data; wherein the power grid production command statement is a natural language instruction, and the real-time multi-source operation data includes the current power grid resource status and equipment alarm data; inputting the power grid production command statement into the trained proxy model, and dynamically decomposing the power grid production command statement into a real-time sub-task sequence through the large language model task understanding module in the proxy model; inputting the real-time sub-task sequence and the current power grid resource status into a state encoding network in the proxy model, and mapping the real-time sub-task sequence and the current resource status into a fixed-length real-time state embedding vector through the state encoding network; The real-time state embedding vector is input into the policy network of the agent model. The policy network outputs the action and tool call parameters for the current job in the real-time subtask sequence based on the real-time state embedding vector. The action and tool call parameters are then sent to the tool execution interface in the agent model. The tool execution interface calls the external power grid tool according to the tool call parameters to obtain the tool execution result. The tool execution result is input into the reflection feedback fusion module in the agent model. The reflection feedback fusion module performs deviation attribution analysis on the tool execution result to determine whether there is an execution deviation. If there is an execution deviation, the reflection feedback fusion module generates a correction suggestion and feeds it back to the policy network as an additional state feature or action space mask. The policy network re-outputs the action and tool call parameters based on the correction suggestion. If there is no execution deviation, the action and tool call parameters for the current job are output, and the next job in the real-time subtask sequence is processed until all subtasks are completed.
[0117] This implementation describes the execution flow of the proxy model during the inference phase. In the inference phase, the trained model is deployed to an actual production command scenario, receiving real natural language instructions and outputting executable actions. Dispatchers, maintenance personnel, or managers can input power grid production command statements in natural language to issue production command instructions to the system. Power grid production command statements can cover various typical operational scenarios in power grid production command, including but not limited to equipment maintenance instructions, troubleshooting instructions, emergency response instructions, system detection instructions, and data acquisition instructions.
[0118] Real-time multi-source operation data refers to operation-related data collected in real time from various power grid business systems. Real-time multi-source operation data includes at least the current power grid resource status and equipment alarm data. Power grid resource status includes the current load and response latency of various tool APIs, the remaining capacity and utilization rate of computing resources, and the current location and availability of repair personnel and vehicles. Equipment alarm data includes various abnormal events and status warnings generated by power grid equipment at the current time, including at least tripping events and power restoration time information.
[0119] In one implementation, real-time multi-source operational data can be obtained from various business systems in real time via message queues or data buses. Specifically, external power grid tools such as meteorological data platforms, GIS geographic information systems, equipment ledger systems, and load forecasting systems push real-time data to a unified data bus through standardized interfaces; the proxy model subscribes to the required data fields from the data bus to achieve on-demand acquisition of real-time data. In another implementation, real-time multi-source operational data can also be obtained through proactive API queries. After receiving a power grid production command statement, the proxy model proactively calls the query APIs of relevant systems to obtain real-time data for the current moment based on parameters such as equipment, region, and time involved in the statement.
[0120] In one implementation, the trained proxy model can be deployed in a production environment as a Representational State Transition RESTful API service. Power grid production command personnel input production command statements in natural language via a client (such as a web console or mobile terminal). The client encapsulates the statements as HTTP requests and sends them to the proxy model server. Upon receiving the request, the server executes the following sequentially: the large language model task understanding module breaks down the statement into a sequence of real-time sub-tasks; the state encoding network obtains the current power grid resource status and equipment alarm data from the data bus and encodes it together with the sub-task sequence into a real-time state embedding vector; the policy network performs forward inference and outputs the handling actions and tool call parameters; the tool execution interface synchronously calls external power grid tools and waits for the return results; and the reflection and feedback fusion module performs deviation detection on the execution results. The entire inference process is completed in a synchronous request-response mode, and the proxy model server returns the execution results to the client after all sub-tasks have been executed. This implementation is suitable for scenarios with high requirements for the integrity of inference results and acceptable second-level response delays.
[0121] In one implementation, the trained agent model can be deployed in a production environment using an event-driven architecture. Power grid production command statements enter the system via a message queue, triggering the agent model's inference process. Unlike synchronous methods, in asynchronous streaming, after each subtask is completed, the agent model outputs the execution status and intermediate results of the current subtask through an event channel, without waiting for all subtasks to complete. When a deviation occurs in the execution of a subtask, the reflection and feedback fusion module generates correction suggestions and feeds them back to the policy network for re-decision-making. The correction process also outputs status updates in the form of events. This implementation is suitable for scenarios with high real-time requirements and the need for continuous monitoring of task execution progress.
[0122] In one implementation, a human-machine collaboration mechanism can be introduced into the online inference process. When the reflective feedback fusion module detects that the policy network decision confidence is lower than a preset threshold (e.g., the highest probability of the discrete action head output is lower than 0.6), or detects an unknown type of anomaly not present in the training data, the proxy model automatically triggers a manual takeover interface. Specifically, the proxy model packages and sends the current state information, the sequence of executed subtasks, and the detected anomaly information to the scheduler's terminal for manual judgment and decision-making. The manual decision-making result is recorded as expert demonstration data for subsequent offline retraining of the proxy model. This implementation is suitable for scenarios with extremely high requirements for decision security and where the final human judgment right must be retained.
[0123] In one implementation, the trained agent model can be deployed on edge computing nodes after model compression and quantization. Specifically, knowledge distillation is used to compress the large-parameter language model task understanding module into a lightweight version, and weight quantization is used to compress the parameters of the policy network and value network from 32-bit floating-point numbers to 8-bit integers. The compressed agent model can run on resource-constrained edge devices, achieving low-latency local inference. Real-time multi-source operational data is directly acquired from the nearest data acquisition terminal, without going through a central cloud service. This implementation is suitable for scenarios sensitive to network bandwidth and response latency, such as production command applications in remote substations or mobile repair vehicles.
[0124] In one implementation, the step of generating correction suggestions through the reflection feedback fusion module includes: obtaining the abnormal event type in the tool execution result, and determining the attribution type based on the abnormal event type; the attribution type includes at least one of tool call timeout, parameter format error, data source unavailability, logical rule conflict, and insufficient resources; matching the corresponding correction operation from a preset correction strategy library according to the attribution type; wherein, if the attribution type is tool call timeout, the generated correction suggestion is to switch to a backup tool or adjust the call timeout threshold; if the attribution type is parameter format error, the generated correction suggestion is to correct the tool call parameters or regenerate the parameters; if the attribution type is data source unavailability, the generated correction suggestion is to switch to a backup data source or adjust the data query conditions; if the attribution type is logical rule conflict, the generated correction suggestion is to re-plan the subtask execution order; if the attribution type is insufficient resources, the generated correction suggestion is to reallocate resources or adjust the task priority; and outputting the execution instruction corresponding to the correction operation as a correction suggestion to the policy network, so that the policy network re-outputs the handling action and tool call parameters according to the correction suggestion.
[0125] This implementation method, through its streamlined design of acquiring abnormal event types, matching corrective operations based on attribution types, and outputting the corresponding execution instructions as corrective suggestions to the policy network, enables the reflection feedback fusion module to classify and process different types of execution deviations and output targeted corrective instructions.
[0126] An exception event type is a category identifier in the tool execution result that reflects various abnormal states or error signals. In power grid production command scenarios, the tool execution result may contain various exception signals, such as timeout error codes, parameter verification failure codes, empty data returns, and rule conflict alarms. The exception event type is obtained by parsing fields such as status codes, error messages, and returned data formats in the tool execution result.
[0127] In one implementation, the exception event type is determined by the structured status code in the parsing tool's execution result. The tool execution result is returned according to the unified tool access specification, including a status code field, an error message field, and a data field. The reflection and feedback fusion module first reads the status code field. If the status code is a non-successful status (such as 4xx or 5xx), it matches the preset exception event type based on the keywords in the status code and error message fields.
[0128] Attribution type is a deviation classification label determined after root cause analysis of anomaly types. Attribution type maps surface-level anomalies to deeper causes of deviations, providing a basis for matching subsequent corrective strategies. Attribution types include at least one of the following: tool call timeout, incorrect parameter format, unavailable data source, conflicting logical rules, and insufficient resources.
[0129] In this embodiment, the correction strategy library is a pre-built knowledge base used to store the mapping relationship between various attribution types and corresponding correction operations. The correction strategy library is built based on domain expert experience and historical success cases, with each attribution type corresponding to one or more correction operations. The matching logic of the correction strategy library is as follows: input attribution type label, output corresponding correction operation instructions, which are specific instructions for corrective measures taken for a specific attribution type.
[0130] In one implementation, the correction strategy library can be implemented using a lookup table structure. The key of the lookup table is the attribution type label, and the value is the corresponding correction operation template. The correction operation template includes an operation type identifier and operation parameter fields. Specific execution instructions are generated by instantiating the parameter placeholders in the template. In another implementation, the correction strategy library can be implemented using a decision tree structure. The root node of the decision tree is the attribution type, the internal nodes are the environmental conditions of the current state (such as the availability of backup tools, current resource utilization, etc.), and the leaf nodes are the specific correction operations. By traversing the decision tree, the optimal correction operation can be dynamically selected based on the attribution type and the current environmental conditions.
[0131] In this embodiment, the correction suggestion is an execution instruction generated after the correction operation template is instantiated and can be directly parsed by the policy network. The format of the correction suggestion is compatible with the input format of the policy network and can be received by the policy network as an additional state feature or action space mask. In one embodiment, the correction suggestion can be output to the policy network as an additional state feature. Specifically, the execution instruction corresponding to the correction operation is encoded into a vector form, concatenated with the current real-time state embedding vector, and then input into the policy network. When making a new decision, the policy network can perceive the correction direction indicated in the correction suggestion, thereby outputting a more reasonable action.
[0132] In one implementation, the correction suggestion can be output to the policy network as an action space mask. Specifically, based on the correction direction indicated in the correction suggestion, the action space of the policy network is dynamically adjusted—those action options that might repeatedly cause the same type of deviation are masked, while alternative action options indicated in the correction suggestion are given priority. After receiving the correction suggestion, the policy network performs forward reasoning again based on the correction suggestion and outputs new actions and tool invocation parameters. The new actions can avoid the problems that cause the current deviation and ensure that subsequent execution can be completed smoothly.
[0133] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 2The diagram shows a schematic of a proxy model generation device for power grid production command. The device includes: an acquisition module 22 for acquiring historical multi-source operation data, which includes at least historical natural language instructions, standard task decomposition paths corresponding to the historical natural language instructions, historical tool call sequences, execution results, and resource consumption data; a mapping module 24 for mapping the historical natural language instructions into hierarchical sub-task sequences according to preset task decomposition rules, and encoding the sub-task sequences, corresponding power grid resource status, and equipment alarm data into a historical state feature vector; wherein the sub-task sequence contains multiple sub-task nodes and dependencies between sub-tasks; and a construction module 26 for constructing an initial proxy model; wherein the initial proxy model includes: a large language model task understanding module, a state encoding network, a deep reinforcement learning decision module, a tool execution interface, and a reflection feedback fusion module. The deep reinforcement learning decision module includes a policy network and a value network. The large language model task understanding module is used to process the input... Natural language instructions are decomposed into a sequence of subtasks. The state encoding network maps the subtask sequence to the current resource state as a fixed-length state embedding vector. The policy network outputs the action to handle the current task in the subtask sequence and the tool call parameters based on the state embedding vector. The value network evaluates the expected cumulative reward corresponding to the state embedding vector. The tool execution interface calls external power grid tools based on the tool call parameters. The reflection feedback fusion module performs deviation attribution analysis based on the tool execution results and generates correction suggestions. The training module 28 uses the historical state feature vector as state samples and the tool selection and parameters in the historical tool call sequence as action samples to train the initial agent model. It calculates a reward signal to indicate task completion timeliness and resource utilization efficiency based on the execution results and resource consumption data. It updates the parameters of the policy network and the value network based on the reward signal until the reward signal converges or reaches a preset number of iterations to obtain the trained agent model.
[0134] The aforementioned proxy model generation device for power grid production command maps natural language instructions into a sequence of sub-tasks and co-encodes them with resource status and alarm data, enabling the model to simultaneously perceive the relationship between operational semantics and resource constraints. By constructing a proxy model that includes task understanding, status encoding, decision-making, tool execution, and reflective feedback, it connects the entire process of task decomposition, tool invocation, and strategy optimization in a unified architecture. Through reward signals driving strategy and value network parameter updates, the model can continuously optimize decisions based on execution results, overcoming the shortcomings of lacking self-reflection capabilities and repeated errors. Ultimately, it achieves autonomous transformation from instructions to execution and feedback-based strategy optimization, improving the intelligence level of power grid production command decision-making.
[0135] Optionally, the mapping module 24 is specifically used for: determining the attribute information, target type, and execution mode of the task by performing semantic understanding on the historical natural language instructions; decomposing the task into subtasks using a hierarchical decomposition algorithm based on the attribute information, target type, and execution mode; decomposing each level of task sequentially from the top-level task using an iterative decomposition algorithm until a preset level of refinement is reached, thereby obtaining a hierarchical subtask sequence; encoding the dependencies in the number of subtasks using graph structure; encoding the power grid resource status at the time corresponding to the task using numerical normalization; encoding the equipment alarm data at the time corresponding to the task using time-series feature encoding; and concatenating the encoding results to obtain a historical state feature vector.
[0136] Optionally, the training module 28 is specifically used for: inputting the historical state feature vector as a state sample into the policy network to obtain the predicted action output by the policy network; calculating the policy network loss value by performing a policy network loss calculation on the predicted action and the tool selection and parameters in the historical tool call sequence as the action sample using a preset policy network loss function; performing a weighted fusion calculation of the task completion time index and resource utilization efficiency index on the execution result and resource consumption data to obtain a reward signal; calculating the value network loss value by using the reward signal as a supervision signal using a preset value network loss function; updating the parameters of the policy network using the policy network loss value to drive the disposal action output by the policy network to update in the specified reward direction; updating the parameters of the value network according to the value network loss value to drive the state value estimation of the value network to approach the actual cumulative reward; repeating the above process multiple times until the reward signal converges or reaches a preset number of iterations to obtain the trained agent model.
[0137] Optionally, the above apparatus further includes: an analysis module, configured to acquire the deviation attribution analysis results output by the reflection feedback fusion module, determine the deviation type and deviation penalty coefficient based on the deviation attribution analysis results, use the deviation penalty coefficient as a reverse adjustment amount of the reward signal, and construct a modified reward function including a deviation penalty term. ,in,
[0138]
[0139] This is a reward item for sub-task completion. This is a reward item for completing the task within a certain timeframe. This is a reward item for resource utilization efficiency. The deviation penalty term output by the reflection feedback fusion module is dynamically assigned a value based on the anomaly type in the deviation attribution analysis results. , , , Here, M represents the weighting coefficient for each reward item; M is the total number of preset deviation types. The deviation penalty coefficient for the m-th type of deviation. This is an indicator function that takes a value of 1 when the m-th type of deviation is detected, and 0 otherwise. The abnormal types include tool call timeout, parameter format error, data source unavailable, logical rule conflict, and insufficient resources.
[0140] Optionally, the policy network loss function includes a continuous action loss term. Discrete action loss term and regularization terms The continuous action loss term is used to constrain the decision-making of the policy network generation tool's invocation parameters, and the discrete action loss term is used to constrain the policy network's decision-making regarding the selection of tasks to be processed. The policy network loss value... for:
[0141]
[0142] in, , These are the continuous action loss weight coefficient and the rule regularization coefficient, respectively, where K is the total number of selectable subtasks. This is an indicator function; it takes a value of 1 when the policy network selects the k-th subtask, and 0 otherwise. For the k-th subtask in the current state Below are the parameters for calling the tool. The compliance penalty function, the compliance penalty function The criteria for determining the logical rule conflict anomaly type in the deviation attribution analysis results are predefined.
[0143] Optionally, the above device further includes: a response module, used to respond to the input of a power grid production command statement and acquire real-time multi-source operation data; wherein the power grid production command statement is a natural language instruction, and the real-time multi-source operation data includes the current power grid resource status and equipment alarm data; the response module is used to input the power grid production command statement into the trained proxy model, and dynamically decompose the power grid production command statement into a real-time sub-task sequence through the large language model task understanding module in the proxy model; the response module is used to input the real-time sub-task sequence and the current power grid resource status into the state encoding network in the proxy model, and map the real-time sub-task sequence and the current resource status into a fixed-length real-time state embedding vector through the state encoding network; and an input module is used to input the real-time state embedding vector into the policy network in the proxy model, and output the current operation in the real-time sub-task sequence according to the real-time state embedding vector through the policy network. The system comprises: a handling action and tool call parameters; a calling module, used to send the handling action and tool call parameters to the tool execution interface in the proxy model, and call an external power grid tool through the tool execution interface according to the tool call parameters to obtain the tool execution result; a judgment module, used to input the tool execution result into the reflection feedback fusion module in the proxy model, and perform deviation attribution analysis on the tool execution result through the reflection feedback fusion module to determine whether there is an execution deviation; a reset module, used to generate a correction suggestion through the reflection feedback fusion module if there is an execution deviation, and feed the correction suggestion back to the policy network as an additional state feature or action space mask, and re-output the handling action and tool call parameters through the policy network according to the correction suggestion; and an output module, used to output the handling action and tool call parameters of the current job if there is no execution deviation, and continue to process the next job in the real-time subtask sequence until all subtasks are completed.
[0144] Optionally, the reset module is specifically used for: obtaining the abnormal event type in the tool execution result, and determining the attribution type based on the abnormal event type; the attribution type includes at least one of tool call timeout, parameter format error, data source unavailability, logical rule conflict, and insufficient resources; matching the corresponding correction operation from a preset correction strategy library according to the attribution type; wherein, if the attribution type is tool call timeout, the generated correction suggestion is to switch to a backup tool or adjust the call timeout threshold; if the attribution type is parameter format error, the generated correction suggestion is to correct the tool call parameters or regenerate the parameters; if the attribution type is data source unavailability, the generated correction suggestion is to switch to a backup data source or adjust the data query conditions; if the attribution type is logical rule conflict, the generated correction suggestion is to re-plan the subtask execution order; if the attribution type is insufficient resources, the generated correction suggestion is to reallocate resources or adjust the task priority; and outputting the execution instruction corresponding to the correction operation as the correction suggestion to the strategy network, so that the strategy network re-outputs the handling action and tool call parameters according to the correction suggestion.
[0145] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the aforementioned agent model generation method for power grid production command. This electronic device can be a server or a terminal device.
[0146] See Figure 3 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-described proxy model generation method for power grid production command.
[0147] Furthermore, Figure 3 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0148] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0149] The processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 100 or by instructions in software form. The processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.
[0150] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the above-described proxy model generation method for power grid production command, for example.
[0151] The computer program product for the agent model generation method, apparatus, electronic device and storage medium for power grid production command provided in this disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0152] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0153] Furthermore, in the description of the embodiments of this disclosure, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this disclosure based on the specific circumstances.
[0154] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0155] In the description of this disclosure, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this disclosure. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0156] Finally, it should be noted that the above embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.
Claims
1. A method for generating a proxy model for power grid production command, characterized in that, The method includes: Acquire historical multi-source job data, which includes at least historical natural language instructions, standard task decomposition paths corresponding to the historical natural language instructions, historical tool call sequences, execution results, and resource consumption data. According to the preset task decomposition rules, the historical natural language instructions are mapped into a hierarchical sub-task sequence, and the sub-task sequence, the power grid resource status at the corresponding time, and the equipment alarm data are jointly encoded into a historical status feature vector; wherein, the sub-task sequence contains multiple sub-task nodes and the dependencies between each sub-task; An initial agent model is constructed, comprising: a large language model task understanding module, a state encoding network, a deep reinforcement learning decision module, a tool execution interface, and a reflection feedback fusion module. The deep reinforcement learning decision module includes a policy network and a value network. The large language model task understanding module decomposes the input natural language instructions into a sequence of sub-tasks. The state encoding network maps the sub-task sequence to the current resource state as a fixed-length state embedding vector. The policy network outputs the action to be taken and the tool call parameters for the current task in the sub-task sequence based on the state embedding vector. The value network evaluates the expected cumulative reward corresponding to the state embedding vector. The tool execution interface calls external power grid tools based on the tool call parameters. The reflection feedback fusion module performs deviation attribution analysis based on the tool execution results and generates correction suggestions. Using the historical state feature vector as state samples and the tool selection and parameters in the historical tool call sequence as action samples, the initial agent model is trained. A reward signal is calculated based on the execution results and the resource consumption data to indicate the timeliness of task completion and the efficiency of resource utilization. The parameters of the policy network and the value network are updated based on the reward signal until the reward signal converges or reaches a preset number of iterations, thereby obtaining the trained agent model.
2. The method according to claim 1, characterized in that, The steps of mapping the historical natural language instructions into a hierarchical sequence of subtasks according to preset task decomposition rules, and encoding the subtask sequence, the corresponding power grid resource status, and equipment alarm data into a historical status feature vector, include: By performing semantic understanding on the historical natural language instructions, the attribute information, target type, and execution mode of the task can be determined; Based on the attribute information, the target type, and the execution mode, the task is decomposed into subtasks using a hierarchical decomposition algorithm. Then, an iterative decomposition algorithm is used to decompose each level of task sequentially from the top-level task until a preset level of refinement is reached, resulting in a hierarchical subtask sequence. The dependencies among the subtasks are encoded using graph structure, the power grid resource status at the corresponding time of the task is encoded using numerical normalization, and the equipment alarm data at the corresponding time of the task is encoded using time-series features. The encoding results are then concatenated to obtain a historical state feature vector.
3. The method according to claim 1, characterized in that, The steps of training the initial agent model using the historical state feature vector as state samples and the tool selection and parameters in the historical tool call sequence as action samples, and calculating a reward signal to indicate task completion timeliness and resource utilization efficiency based on the execution results and resource consumption data, updating the parameters of the policy network and the value network based on the reward signal until the reward signal converges or reaches a preset number of iterations to obtain the trained agent model include: The historical state feature vector is used as a state sample and input into the policy network to obtain the predicted action output by the policy network. The policy network loss value is obtained by calculating the policy network loss value by using a preset policy network loss function to calculate the policy network loss value between the predicted action and the tool selection and parameters in the historical tool call sequence that serves as the action sample. The execution results and resource consumption data are weighted and fused together using task completion timeliness indicators and resource utilization efficiency indicators to obtain a reward signal; The reward signal is used as a monitoring signal by using a preset value network loss function to calculate the value network loss value; The parameters of the policy network are updated by the loss value of the policy network to drive the action output by the policy network to be updated in the direction of the specified reward. The parameters of the value network are updated by the loss value of the value network to drive the state value estimate of the value network to approximate the actual cumulative reward. Repeat the above process multiple times until the reward signal converges or the preset number of iterations is reached to obtain the trained agent model.
4. The method according to claim 3, characterized in that, After the step of inputting the historical state feature vector as a state sample into the policy network to obtain the predicted action output by the policy network, and before the step of updating the parameters of the policy network using the policy network loss value, the method further includes: Obtain the deviation attribution analysis results output by the reflection feedback fusion module, determine the deviation type and deviation penalty coefficient based on the deviation attribution analysis results, use the deviation penalty coefficient as the reverse adjustment amount of the reward signal, and construct a modified reward function that includes the deviation penalty term. ,in, This is a reward item for sub-task completion. This is a reward item for completing the task within a certain timeframe. This is a reward item for resource utilization efficiency. The deviation penalty term output by the reflection feedback fusion module is dynamically assigned a value based on the anomaly type in the deviation attribution analysis results. , , , These are the weighting coefficients for each reward item; M represents the total number of preset deviation types. The deviation penalty coefficient for the m-th type of deviation. This is an indicator function that takes a value of 1 when the m-th type of deviation is detected, and 0 otherwise. The abnormal types include tool call timeout, parameter format error, data source unavailable, logical rule conflict, and insufficient resources.
5. The method according to claim 3, characterized in that, The policy network loss function includes a continuous action loss term. Discrete action loss term and regularization terms The continuous action loss term is used to constrain the decision-making of the policy network generation tool's invocation parameters, and the discrete action loss term is used to constrain the policy network's decision-making regarding the selection of tasks to be processed. The policy network loss value... for: in, , These are the continuous action loss weight coefficient and the rule regularization coefficient, respectively, where K is the total number of selectable subtasks. This is an indicator function; it takes a value of 1 when the policy network selects the k-th subtask, and 0 otherwise. For the k-th subtask in the current state Below are the parameters for calling the tool. The compliance penalty function, the compliance penalty function The criteria for determining the logical rule conflict anomaly type in the deviation attribution analysis results are predefined.
6. The method according to claim 1, characterized in that, After obtaining the trained surrogate model, the method further includes: In response to the input of power grid production command statements, real-time multi-source operation data is acquired; wherein, the power grid production command statements are natural language instructions, and the real-time multi-source operation data includes the current power grid resource status and equipment alarm data; The power grid production command statement is input into the trained proxy model, and the power grid production command statement is dynamically decomposed into a real-time sub-task sequence through the large language model task understanding module in the proxy model. The real-time subtask sequence and the current power grid resource status are input into the state encoding network in the proxy model. The state encoding network maps the real-time subtask sequence and the current resource status into a fixed-length real-time state embedding vector. The real-time state embedding vector is input into the policy network in the agent model, and the policy network outputs the handling actions and tool call parameters for the current job in the real-time subtask sequence based on the real-time state embedding vector. The processing action and the tool calling parameters are sent to the tool execution interface in the proxy model. The external power grid tool is called through the tool execution interface according to the tool calling parameters to obtain the tool execution result. The execution results of the tool are input into the reflection feedback fusion module in the agent model. The reflection feedback fusion module performs deviation attribution analysis on the execution results of the tool to determine whether there is any execution deviation. If there is an execution deviation, a correction suggestion is generated through the reflection feedback fusion module. The correction suggestion is fed back to the policy network as an additional state feature or action space mask. The policy network then re-outputs the disposal action and tool call parameters based on the correction suggestion. If there is no execution deviation, the current job's handling action and tool call parameters are output, and the next job in the real-time subtask sequence is processed until all subtasks are completed.
7. The method according to claim 6, characterized in that, The steps for generating corrective suggestions through the reflection and feedback fusion module include: Obtain the types of abnormal events in the execution results of the tool, and determine the attribution type based on the types of abnormal events; the attribution type includes at least one of the following: tool call timeout, parameter format error, data source unavailable, logical rule conflict, and insufficient resources; Based on the attribution type, a corresponding correction operation is matched from a preset correction strategy library; wherein, If the attribution type is tool call timeout, the generated correction suggestion is to switch to a backup tool or adjust the call timeout threshold; If the attribution type is parameter format error, the generated correction suggestion is to correct the tool call parameters or regenerate the parameters; If the attribution type is that the data source is unavailable, the generated correction suggestion is to switch to an alternative data source or adjust the data query conditions. If the attribution type is a logical rule conflict, the generated correction suggestion is to re-plan the execution order of subtasks; If the attribution type is insufficient resources, the generated correction suggestion is to reallocate resources or adjust task priorities; The execution instructions corresponding to the correction operation are output to the policy network as the correction suggestion, so that the policy network can re-output the handling action and tool call parameters according to the correction suggestion.
8. A proxy model generation device for power grid production command, characterized in that, The device includes: The acquisition module is used to acquire historical multi-source job data, which includes at least historical natural language instructions, standard task decomposition paths corresponding to the historical natural language instructions, historical tool call sequences, execution results, and resource consumption data. The mapping module is used to map the historical natural language instructions into a hierarchical subtask sequence according to the preset task decomposition rules, and encode the subtask sequence, the power grid resource status at the corresponding time and the equipment alarm data into a historical status feature vector; wherein, the subtask sequence contains multiple subtask nodes and the dependencies between each subtask. A construction module is used to build an initial agent model; wherein the initial agent model includes: a large language model task understanding module, a state encoding network, a deep reinforcement learning decision module, a tool execution interface, and a reflection feedback fusion module. The deep reinforcement learning decision module includes: a policy network and a value network. The large language model task understanding module is used to decompose the input natural language instructions into a sequence of sub-tasks. The state encoding network is used to map the sub-task sequence and the current resource state into a fixed-length state embedding vector. The policy network is used to output the action to handle the current task in the sub-task sequence and the tool call parameters according to the state embedding vector. The value network is used to evaluate the expected cumulative reward corresponding to the state embedding vector. The tool execution interface is used to call external power grid tools according to the tool call parameters. The reflection feedback fusion module is used to perform deviation attribution analysis based on the tool execution results and generate correction suggestions. The training module is used to train the initial agent model using the historical state feature vector as state samples and the tool selection and parameters in the historical tool call sequence as action samples. It also calculates a reward signal to indicate the timeliness of task completion and resource utilization efficiency based on the execution results and resource consumption data, and updates the parameters of the policy network and the value network based on the reward signal until the reward signal converges or reaches a preset number of iterations to obtain the trained agent model.
9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the proxy model generation method for power grid production command as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the proxy model generation method for power grid production command as described in any one of claims 1-7.
