Differentiable structure agent optimization method and device for image classification

By constructing a directed acyclic graph and optimizing the agent structure using gradient signals, the redundancy and inaccuracy issues of agents in vertical domains are resolved, improving execution efficiency and robustness, and achieving multi-dimensional optimization goal compliance.

CN120952046BActive Publication Date: 2026-02-03BEIJING HISIGN TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511485184.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-02-03
Estimated Expiration
2045-10-17

AI Technical Summary

Technical Problem

Existing technologies suffer from structural redundancy, slow execution speed, and inaccurate results when applying intelligent agents in vertical domains. Furthermore, parameter optimization based on large models may lead to forgetting, optimization based on structural layers cannot utilize gradient information, and optimization based on inference layers is difficult to consider factors other than semantics.

Method used

By constructing a directed acyclic graph, receiving differentiable selection vectors from prompting units, optimizing the microstructure and executable paths, adjusting the agent structure using gradient signals, pruning redundant edges, introducing a neural network scheduler for dynamic scheduling, and generating gradient signals to optimize the agent.

Benefits of technology

It simplifies and adjusts the agent structure, improves execution efficiency and accuracy, avoids forgetting in large models, and enhances robustness and versatility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120952046B_ABST
    Figure CN120952046B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of microstructure intelligent agent optimization method and device for image classification, by constructing directed acyclic graph, receiving prompt differentiable selection vector and prompt differentiable selection vector, obtain differentiable selection set, obtain adjusted tool call path, and by calling differentiable vector processing tool call path and determine microstructure, optimize microstructure until micro loss function value does not exceed preset micro loss value, determine the executable path of each node, give differentiable weight to edge to carry out iterative training, update differentiable weight, according to differentiable weight, the corresponding edge is pruned, determine the comprehensive loss function value and optimize the executable path of directed acyclic graph, obtain the probability distribution of next execution task, generate gradient signal according to probability distribution and optimization target, and optimize directed acyclic graph according to gradient signal.The method solves the problem that the optimization space of the preset agent is limited, and significantly improves the performance of the preset agent in processing target tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a method and apparatus for optimizing differentiable intelligent agents for image classification. Background Technology

[0002] With the leap in capabilities of large language and visual models, intelligent agents composed of different large models can efficiently and accurately handle complex logical tasks, further improving and expanding the application scope of large models.

[0003] In existing technologies, when applying intelligent agents in vertical domains, it is generally necessary to construct dedicated intelligent agents based on business logic. However, intelligent agents constructed based on business logic often suffer from problems such as structural redundancy, long execution chains, slow execution speed, and inaccurate results. These problems can be addressed by changing the model parameters of the large model, optimizing the intelligent agent based on the structural layer, or optimizing the intelligent agent based on the inference layer.

[0004] However, optimizing the agent by changing the model parameters of a large model may cause the forgetting problem of the large model, which will affect the robustness of the agent to some extent. Optimizing the agent based on the structural layer will prevent the agent from using gradient information, which will limit the optimization space and potential. Optimizing the agent based on the inference layer is more at the semantic level and it is difficult to consider factors other than semantics. Summary of the Invention

[0005] To address the problems in the prior art, this application provides a method and apparatus for optimizing differentiable intelligent agents for image classification. This method effectively solves the shortcomings of traditional techniques, such as inaccurate results due to limited optimization space of the preset intelligent agent. It significantly improves the performance of the optimized preset intelligent agent in processing the target task, and makes the task results conform to the optimization target from multiple dimensions.

[0006] To solve at least one of the above problems, this application provides the following technical solution:

[0007] In a first aspect, this application provides a method for optimizing differentiable intelligent agents for image classification, including:

[0008] The system receives the target task and its optimization objective, constructs a directed acyclic graph (DAG) based on the execution chain of the pre-defined intelligent agent, receives the prompt differentiable selection vectors corresponding to the prompt units, assigns differentiable selection vectors to each prompt unit to obtain a set of differentiable selections, parameterizes the tool call path of the tool call unit through the tool neural network, processes the tool call path by calling differentiable vectors, determines the microstructure based on the set of differentiable selections and the processed tool call path, and optimizes the microstructure until the micro loss function value corresponding to the microstructure does not exceed the pre-defined micro loss value. The nodes of the DAG are used to represent basic functional modules, and the nodes include prompt units or tool call units. The edges of the DAG represent the data flow direction between nodes.

[0009] The executable paths of each node are determined, and differentiable weights are assigned to the edges. Iterative training is performed based on the differentiable gating mechanism and the executable paths to update the differentiable weights. If the updated differentiable weights are less than the preset differentiable weights, the edges corresponding to the updated differentiable weights are pruned. The comprehensive loss function value is determined based on the pruned edges and the updated differentiable weights. The executable paths of the directed acyclic graph are optimized based on the comprehensive loss function value.

[0010] The execution state of the optimized directed acyclic graph is obtained. The execution state is processed by a neural network scheduler to obtain the probability distribution of the next execution task. Gradient signals are generated based on the probability distribution and the optimization objective, and the directed acyclic graph is optimized based on the gradient signals.

[0011] Furthermore, it also includes: determining the prompt types included in the prompt unit and the number of candidate prompt segments in each prompt type, wherein the prompt types include prompt words, visual cues, knowledge bases and memory layers, and a prompt type includes at least one prompt unit;

[0012] An initial prompt structure matrix is ​​constructed based on the prompt type and the number of segments. The prompt differentiable selection vector corresponding to the prompt unit is received. The prompt differentiable selection vector is multiplied by the initial prompt structure matrix to obtain the differentiable selection set. The matrix elements in the prompt structure matrix are used to represent the selection state of the candidate prompt segments.

[0013] Furthermore, it also includes: assigning a corresponding tool neural network to the current tool invocation unit, determining the context information, optimization objective, and output results of the upstream node of the current tool invocation unit as input data, and inputting the input data into the tool neural network;

[0014] The tool invocation unit is parameterized by performing forward computation on the input data based on the tool neural network to obtain the execution parameters of the tool invocation unit.

[0015] Furthermore, before determining the executable path for each node, the following steps are also included:

[0016] Receive a candidate subgraph pool, count the frequency of occurrence of each subgraph structure in the directed acyclic graph, and determine the subgraph structure whose frequency of occurrence exceeds the preset frequency as the subgraph structure to be replaced. The candidate subgraph pool includes at least one candidate subgraph.

[0017] Determine the output to be replaced in the subgraph structure to be replaced and the candidate outputs of each candidate subgraph in the candidate subgraph pool, and determine the distribution distance between the output to be replaced and each candidate output;

[0018] The replacement loss function is used to process the output to be replaced, candidate outputs, and distribution distance to obtain the replacement loss function value. The subgraph to be replaced is then replaced with a candidate subgraph whose replacement loss function value is less than the preset replacement loss function value.

[0019] Furthermore, after iterative training based on differentiable gating mechanisms and executable paths, the process also includes:

[0020] Receive the target expected result of the target task. If it is detected that there are multiple sub-paths in the current directed acyclic graph, the expected similarity between the task result obtained by processing the target task and the expected result of the target exceeds the preset expected similarity threshold, the differentiable synthesizer network is invoked.

[0021] The results of each task are input into a differentiable synthesizer network. By minimizing the synthesizer output of the differentiable synthesizer network, the distribution difference loss between the synthesizer output and the target expected result is determined. The differentiable synthesizer network is adjusted based on the distribution difference loss, and the sub-paths are replaced with the adjusted differentiable synthesizer network.

[0022] Furthermore, it also includes: updating the scheduler parameters of the neural network scheduler based on the gradient signal using the backpropagation algorithm to obtain the updated neural network scheduler;

[0023] After the neural network scheduler completes the update, the differentiable gating mechanism is updated based on the gradient signal.

[0024] With the differentiable gating mechanism completed, the network parameters of the tool neural network are updated based on the gradient signal, prompting the differentiable selection vector and the tool neural network.

[0025] Furthermore, it also includes: using the probability distribution output by the neural network scheduler as a distribution strategy, and determining the actual execution path for the next task;

[0026] The reward value of the actual execution path is determined based on the optimization objective. Based on the reward value, the gradient of the optimization objective with respect to the scheduler parameters of the neural network scheduler is determined by the policy gradient algorithm corresponding to the distribution strategy. The gradient signal is then generated based on the gradient.

[0027] Secondly, this application provides a differentiable intelligent agent optimization device for image classification, comprising:

[0028] The micro-module receives the target task and its optimization objective. It constructs a directed acyclic graph (DAG) based on the execution chain of a pre-defined agent. It receives the differentiable choice vectors corresponding to the prompt units, assigns differentiable choice vectors to each prompt unit to obtain a set of differentiable choices, parameterizes the tool call path of the tool call unit through the tool neural network, and processes the tool call path by calling differentiable vectors. Based on the set of differentiable choices and the processed tool call path, it determines the micro-structure and optimizes the micro-structure until the micro-loss function value corresponding to the micro-structure does not exceed the pre-defined micro-loss value. The nodes of the DAG represent basic functional modules. The nodes include prompt units or tool call units, and the edges of the DAG represent the data flow between nodes.

[0029] The meso-level module is used to determine the executable paths of each node, assign differentiable weights to edges, perform iterative training based on differentiable gating mechanism and executable paths to update differentiable weights, prune the edges corresponding to the updated differentiable weights when the updated differentiable weights are less than the preset differentiable weights, and determine the comprehensive loss function value based on the pruned edges and updated differentiable weights, and optimize the executable paths of the directed acyclic graph based on the comprehensive loss function value.

[0030] The macro module is used to obtain the execution state of the optimized directed acyclic graph, process the execution state through a neural network scheduler to obtain the probability distribution of the next execution task, generate gradient signals based on the probability distribution and optimization objective, and optimize the directed acyclic graph based on the gradient signals.

[0031] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the image classification-oriented differentiable intelligent agent optimization method.

[0032] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the described method for optimizing differentiable intelligent agents for image classification.

[0033] Fifthly, this application provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the described method for optimizing differentiable intelligent agents for image classification.

[0034] As can be seen from the above technical solution, this application provides a method and apparatus for optimizing a differentiable structured intelligent agent for image classification. It innovatively receives the target task and the optimization objective of the target task, constructs a directed acyclic graph (DAG) based on the preset execution chain of the intelligent agent, receives the differentiable selection vector corresponding to the prompt unit, assigns the prompt unit a differentiable selection vector to obtain a set of differentiable choices, parameterizes the tool call path of the tool call unit through a tool neural network, processes the tool call path by calling differentiable vectors, determines the microstructure based on the set of differentiable choices and the processed tool call path, and optimizes the microstructure until the micro-loss function value corresponding to the microstructure does not exceed a preset micro-loss value. In this DAG, nodes represent basic functional modules, including prompt units or tool call units, edges represent the data flow between nodes, the executable paths of each node are determined, and differentiable weights are assigned to the edges. This method iteratively trains based on differentiable gating mechanisms and executable paths to update differentiable weights. When the updated differentiable weights are less than the preset differentiable weights, edges corresponding to the updated differentiable weights are pruned. A comprehensive loss function value is determined based on the pruned edges and the updated differentiable weights. The executable paths of the directed acyclic graph (DAG) are optimized based on the comprehensive loss function value, and the execution state of the optimized DAG is obtained. A neural network scheduler processes the execution state to obtain the probability distribution of the next execution task. Gradient signals are generated based on the probability distribution and the optimization objective, and the DAG is optimized based on the gradient signals. This method can transform the optimization objective into gradient information for optimizing the structure of the preset agent, thereby adjusting and simplifying the structure of the preset agent and improving its performance. Furthermore, since the optimization process does not involve fine-tuning the large model parameters and prompts within the preset agent, the general applicability of the optimization is improved. This method effectively solves the shortcomings of traditional techniques, such as inaccurate results due to limited optimization space in the preset agent, significantly improving the performance of the optimized preset agent in processing the target task, and ensuring that the task results conform to the optimization objective from multiple dimensions. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 This is a flowchart illustrating the optimization method for a differentiable intelligent agent for image classification in an embodiment of this application.

[0037] Figure 2 This is a structural diagram of the image classification-oriented differentiable intelligent agent optimization device in the embodiments of this application;

[0038] Figure 3 This is a schematic diagram of the structure of the electronic device in the embodiments of this application.

[0039] Figure label:

[0040] Electronic device 9600, central processing unit 9100, memory 9140, communication module 9110, input unit 9120, audio processor 9130, display 9160, power supply 9170, buffer memory 9141, application / function storage unit 9142, data storage unit 9143, driver storage unit 9144, antenna 9111, speaker 9131, microphone 9132. Detailed Implementation

[0041] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0042] The acquisition, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.

[0043] In existing technologies, optimization methods for pre-defined agents include policy layer optimization, structural layer optimization, and inference layer optimization. Policy layer optimization targets the parameters or parameter selection methods of the large model within the pre-defined agent, primarily achieved through reinforcement learning and policy distillation. Structural layer optimization targets the structural parameters of the pre-defined agent. This can involve transforming the agent's structure into a directed acyclic graph (DAG) and optimizing it using DAG optimization methods, or optimizing the control flow or thought process of the pre-defined agent through graph search methods, or optimizing the modules of the pre-defined agent through parameter pruning, branching, low-rank decomposition, and quantization. Inference layer optimization can optimize methods such as the arrangement of prompts and inference paradigms.

[0044] However, policy-layer optimization generally requires changing the model parameters of a large model. Once the parameters of a large model are changed, it is likely to cause the forgetting problem of the large model. That is, after receiving new training data and training, the performance of the large model on the old task or old data will drop significantly, which will affect the robustness of the pre-set agent to a certain extent. In addition, changing the model parameters of a large model and training it requires more hardware resources, which significantly increases the cost.

[0045] Structural layer optimization refers to transforming prompts, subtasks, and judgment logic structures into nodes and edges of a directed acyclic graph (DAG) to achieve multi-step structuring, conditional branching, and module reuse, shifting large models from black-box execution to explicit reasoning structures. However, since the nodes in a DAG are non-parametric operations, and the optimization objective is structural paths, sequences, and branching logic, traditional DAG optimization methods cannot use gradient information to optimize the pre-defined agent, limiting the optimization space and potential of the pre-defined agent. Gradient information includes user feedback, cost information, and accuracy.

[0046] Optimization based on the inference layer works from the perspective of optimizing the thinking process of the large model, that is, optimizing the structure, content, order and thought chain of the prompt words. However, optimization based on the inference layer is more at the semantic level and cannot consider factors other than semantics, which has certain limitations.

[0047] In view of the problems existing in the prior art, this application provides a method and apparatus for optimizing a differentiable intelligent agent for image classification. By converting a preset intelligent agent into a directed acyclic graph with a differentiable structure and converting the optimization objective into gradient information to optimize the structure of the preset intelligent agent, the method can adjust and simplify the structure of the preset intelligent agent and improve its performance. The optimization objective may include, but is not limited to, user feedback, cost information and accuracy.

[0048] To effectively address the shortcomings of traditional techniques, such as inaccurate results due to limited optimization space of pre-defined agents, and to significantly improve the performance of optimized pre-defined agents in processing target tasks, ensuring that task results meet optimization objectives from multiple dimensions, this application provides an embodiment of a differentiable structured agent optimization method for image classification. See [link to embodiment]. Figure 1 The image classification-oriented differentiable intelligent agent optimization method specifically includes the following:

[0049] Step S101: Receive the target task and the optimization target of the target task, construct a directed acyclic graph based on the execution chain of the preset agent, receive the prompt differentiable selection vectors corresponding to the prompt units, assign prompt differentiable selection vectors to each prompt unit to obtain a set of differentiable selections, parameterize the tool call path of the tool call unit through the tool neural network, process the tool call path by calling differentiable vectors, determine the microstructure based on the set of differentiable selections and the processed tool call path, and optimize the microstructure until the micro loss function value corresponding to the microstructure does not exceed the preset micro loss value.

[0050] In this graph, nodes represent basic functional modules, including prompting units or tool calling units, and edges represent the data flow between nodes.

[0051] Optionally, this embodiment receives a target task and an optimization target for the target task. The target task is used to indicate the specific work that the preset intelligent agent needs to complete, such as image classification, text generation, or data retrieval. The optimization target is used to indicate the expected effect of the preset intelligent agent in completing the target task, such as user feedback, cost information, and the accuracy of the task result.

[0052] In addition, a directed acyclic graph (DAG) is constructed based on the execution chain of the preset intelligent agent. The DAG describes the logical relationships and data flow in the process of the preset intelligent agent executing the target task. The nodes of the DAG represent basic functional modules, which can be prompting units or tool calling units. The prompting units are used to provide various prompting information required to execute the target task, and the tool calling units are used to call the tools required in the execution of the target task. The edges of the DAG represent the flow of data corresponding to the target task between nodes, so that the data corresponding to the target task can be transferred between different modules. The prompting information can be visual understanding, knowledge retrieval, or logical reasoning, etc.

[0053] By representing the execution chain of a predefined intelligent agent using a directed acyclic graph, the execution process of the predefined intelligent agent can be understood and managed intuitively and systematically.

[0054] The directed acyclic graph can be represented as , where each node This is used to represent a tool invocation unit or prompt unit (such as visual understanding, knowledge retrieval, logical reasoning, etc.), and each edge... Used to indicate information from arrive The flow direction, that is, the data flow direction between nodes.

[0055] Furthermore, the system receives the differentiable cue selection vector corresponding to the cue unit and assigns a differentiable cue selection vector to each cue unit to obtain a differentiable selection set. Each cue unit is assigned a differentiable selection vector, the value of which is between 0 and 1, and is used to represent the probability of the cue fragment being selected in different cue units. This allows the structure of the cue units to be adjusted during the optimization of the preset agent to adapt to different task requirements and optimization goals, so that the selection process of the cue units can be optimized through gradient descent and other methods.

[0056] The differentiable selection set summarizes all prompting units and their corresponding differentiable selection vectors, thereby enabling fine-grained control over the selection and combination of prompting units. This allows each prompting unit to play its optimal role in the execution of the target task, while also enabling dynamic adjustment of prompting units to improve the performance of the preset agent.

[0057] Furthermore, by parameterizing the tool invocation path of the tool invocation unit through a tool neural network, the tool invocation path can be transformed into an optimizable parameter form through the differentiability of the tool neural network. The invocation order and parameter configuration of the tool invocation unit can be dynamically adjusted through the training of the tool neural network. This allows the tool invocation path and parameter configuration of the tool invocation unit to be adjusted according to the target task and optimization goal, thereby improving the efficiency, flexibility and accuracy of the tool invocation unit.

[0058] Based on the parameterized tool call path, the processed tool call path is obtained by calling differentiable vectors. The calling of differentiable vectors provides a specific execution mechanism for the optimization of tool call paths. The differentiability of calling differentiable vectors can dynamically adjust the parameter configuration of tool call paths through algorithms such as gradient descent during the optimization of directed acyclic graphs and preset agents, and enable tool call paths to be optimized in real time according to the execution status of the target task and the optimization objective.

[0059] For example, when the target task is image classification, the tool call path can be dynamically adjusted according to the features and classification difficulty of the image to be classified. The tool call order and parameter configuration suitable for the current image to be classified can be selected, which improves the efficiency of tool calls and enhances the performance of the target task.

[0060] Furthermore, the microstructure is determined based on the set of differentiable choices and the processed tool call paths. The microstructure can represent the specific configuration and connection method of each functional module in the process of the preset agent executing the target task. By optimizing the set of differentiable choices and the tool call paths, each node can achieve optimal performance in its corresponding target task.

[0061] After determining the microstructure, the micro loss function value corresponding to optimizing the microstructure does not exceed the preset micro loss value. The micro loss function comprehensively considers multiple factors such as the accuracy and efficiency of the target task execution. By continuously optimizing the microstructure, the micro loss function value can be gradually reduced until the optimization target is reached, thus completing the micro-level optimization of the preset agent, improving the quality and efficiency of each node, and thereby improving the performance of the preset agent in the target task.

[0062] This embodiment achieves microstructural optimization of directed acyclic graphs. By assigning differentiable selection vectors to the prompting units and optimizing these vectors, and by parameterizing the tool invocation leader through a tool neural network, the input and execution parameters of each node can be dynamically adjusted, improving the execution efficiency of the nodes. At the same time, the prompting units and tool invocation units can directly select the optimal combination of prompt fragments and tool invocation path when receiving the target task, reducing unnecessary computational overhead and improving resource utilization.

[0063] Step S102: Determine the executable path for each node, assign differentiable weights to the edges, perform iterative training based on the differentiable gating mechanism and the executable path to update the differentiable weights, prune the edges corresponding to the updated differentiable weights if the updated differentiable weights are less than the preset differentiable weights, determine the comprehensive loss function value based on the pruned edges and the updated differentiable weights, and optimize the executable path of the directed acyclic graph based on the comprehensive loss function value.

[0064] Optionally, in this embodiment, the executable path of each node is determined based on the directed acyclic graph, and a differentiable weight is assigned to each edge. The executable path represents the path from the input node to the output node. The path defines the flow of data in the directed acyclic graph. Assigning differentiable weights to the edges allows for dynamic adjustment of the strength and direction of data flow during the optimization process. The differentiability of the differentiable weights can be adjusted by optimization algorithms such as gradient descent based on the execution of the target task and the optimization objective.

[0065] For example, in the case of an image classification task, the flow intensity of the data corresponding to the image to be classified can be adjusted between different nodes according to the characteristics and classification difficulty of the image to be classified, thereby improving the accuracy of classification and the flexibility of data flow.

[0066] In addition, iterative training is performed based on differentiable gating mechanism and executable path to update the differentiable weights of edges. The differentiable gating mechanism is used to control the data flow during training, thereby optimizing the data flow path in the directed acyclic graph.

[0067] Iterative training allows for the gradual adjustment of edge differentiable weights based on the execution of the target task and the optimization objective. This enables data to flow efficiently, allowing the graph structure to better adapt to the needs of the target task, thereby improving the overall performance of the pre-defined agent.

[0068] Furthermore, when the differentiable weight of an edge is less than a preset differentiable weight threshold after the update, the corresponding edge is pruned to remove edges that contribute little to task execution, eliminate redundant data flow paths, reduce unnecessary computational overhead, thereby simplifying the graph structure, improving execution efficiency, and maintaining the effectiveness and integrity of the graph structure, thus improving the execution efficiency of the preset agent.

[0069] Among them, the differentiable gating mechanism can be represented as ,in, Represented as differentiable weights, Represents a node The set of predecessor nodes is updated with differentiable weights through backpropagation of the loss function of the whole graph, so that the differentiable weights of useless edges approach 0, thus achieving path pruning.

[0070] Furthermore, after edge pruning and differentiable weight updates are completed, the comprehensive loss function value is determined based on the pruned edges and updated differentiable weights. The comprehensive loss function is obtained by combining the main task loss, path coefficient loss, subgraph substitution loss, and path selection loss. These losses are obtained before determining the comprehensive loss function value, so that the comprehensive loss function value can comprehensively consider multiple aspects such as the accuracy, efficiency, and resource consumption of the target task execution. The preset agent is optimized based on the comprehensive loss function value, making the preset agent closer to the optimization target.

[0071] Among them, the comprehensive loss function value can adjust the nodes and edges in the directed acyclic graph, enabling the preset agent to execute the target task in an efficient manner, making the flow of data related to the target task in the directed acyclic graph smoother, thereby improving the execution efficiency and accuracy of the preset agent.

[0072] This embodiment optimizes the subgraph structure and information flow path of a directed acyclic graph by pruning edges with differentiable weights less than a preset differentiable weight, enabling the directed acyclic graph to perform the target task more efficiently and reducing redundant paths and computational overhead.

[0073] Step S103: Obtain the execution state of the optimized directed acyclic graph, process the execution state through the neural network scheduler to obtain the probability distribution of the next execution task, generate gradient signals based on the probability distribution and optimization objective, and optimize the directed acyclic graph based on the gradient signals.

[0074] Optionally, this embodiment obtains the execution status of the optimized directed acyclic graph. The execution status is used to reflect the operation of the preset agent under the current optimized configuration, including the progress of the target task execution, resource usage, intermediate results, etc. By obtaining the execution status, the operation of the preset agent can be monitored in real time. It can also be used to realize task-level dynamic scheduling, path planning, and dynamic construction of policy chains, transforming the previous level of optimization objectives into an optimization objective related to multiple factors such as accuracy and cost.

[0075] In addition, the execution state is processed by a neural network scheduler to obtain the probability distribution of the next task to be executed. The neural network scheduler is a scheduling module based on a neural network that can predict the probability of the next task to be executed based on the current execution state. It can realize dynamic scheduling of tasks, that is, to reasonably arrange the execution order of tasks according to the priority of tasks and resource usage. This allows the preset agent to flexibly adjust the execution order of tasks according to the actual running situation, thereby improving the overall efficiency and resource utilization of the preset agent. The task can be a subtask of the target task or multiple target tasks.

[0076] For example, in multi-task processing scenarios, a neural network scheduler can dynamically adjust the execution order of tasks based on their urgency and resource requirements, allowing higher-priority tasks to be executed first. The neural network scheduler can be considered a policy network, which adds factors of interest to the user on top of the optimization of the current preset agent.

[0077] Furthermore, after obtaining the probability distribution of the next task to be executed, a gradient signal is generated based on the probability distribution and the optimization objective. The gradient signal is used to indicate the difference between the current parameter configuration and the optimization objective. By generating the gradient signal, the parameter configuration can be dynamically adjusted according to the optimization objective, thereby optimizing the performance of the preset agent.

[0078] Furthermore, the directed acyclic graph is optimized based on gradient signals, that is, the nodes and edges in the graph structure (directed acyclic graph) are adjusted by gradient signals so that the pre-defined agent can perform the target task in the most efficient way.

[0079] By optimizing the directed acyclic graph (DAG), some factors that users care about can be added to the DAG, so that the task results generated by the preset agent in the process of performing the target task are more in line with the user's expectations.

[0080] Furthermore, based on the probability distribution of the next task to be executed obtained by processing the execution state through a neural network scheduler, dynamic scheduling can be further performed through reinforcement learning. Reinforcement learning is a way to optimize the decision-making process through trial and error, which can dynamically adjust the execution order of tasks according to the current execution state and environmental feedback.

[0081] Furthermore, in the process of optimizing a directed acyclic graph based on gradient signals, an adaptive learning rate adjustment mechanism can be introduced. This mechanism dynamically adjusts the learning rate according to the current optimization progress and gradient information. For example, if the current learning rate is found to be too high during optimization, leading to instability, the learning rate can be automatically reduced; conversely, if the optimization progress is slow, the learning rate can be appropriately increased.

[0082] This embodiment realizes the processing of execution status through a neural network scheduler, dynamically mobilizes tasks, and further optimizes the directed acyclic graph through gradient signals to optimize the preset agent, enhance its stability, and make the task results obtained by the preset agent in executing the target task take into account the factors that users care about in multiple dimensions, so as to better meet user expectations.

[0083] This embodiment establishes a differentiable pre-defined intelligent agent structure optimization framework, enabling collaborative adaptation from micro-parameters to macro-scheduling. The continuous optimization space at the micro-level avoids the non-differentiability problem of discrete selection, making gradient propagation possible. The structured pruning at the meso-level eliminates redundant computational paths and reduces inference latency. The policy gradient scheduling at the macro-level transforms multi-dimensional optimization objectives into unified gradient signals, enabling precise decision-making under global resource constraints. This allows the pre-defined intelligent agent to maintain high accuracy while reducing computational costs and response time.

[0084] In some embodiments, a differentiable selection vector corresponding to a prompting unit is received, and a differentiable selection vector is assigned to each prompting unit to obtain a set of differentiable selections, including:

[0085] Determine the types of prompts included in the prompt unit and the number of candidate prompt segments in each prompt type. The prompt types include prompt words, visual cues, knowledge bases, and memory layers. Each prompt type includes at least one prompt unit.

[0086] An initial prompt structure matrix is ​​constructed based on the prompt type and the number of segments. The prompt differentiable selection vector corresponding to the prompt unit is received. The prompt differentiable selection vector is multiplied by the initial prompt structure matrix to obtain the differentiable selection set. The matrix elements in the prompt structure matrix are used to represent the selection state of the candidate prompt segments.

[0087] Optionally, this embodiment determines the prompt type included in the prompt unit and the number of candidate prompt segments in each prompt type. The prompt type includes a variety of prompt types with different functions, including but not limited to prompt words, visual prompts, knowledge bases and memory layers. Each prompt type includes at least one prompt unit, that is, one prompt unit corresponds to one prompt type, but one prompt type corresponds to at least one prompt unit.

[0088] Among them, prompt words are used to guide the preset intelligent agent to understand the user's intention, visual prompts are used to provide image-related auxiliary information, the knowledge base is used to provide background knowledge, and the memory layer is used to store and retrieve historical information.

[0089] In addition, based on the determined prompt types and the number of fragments in each prompt type, an initial prompt structure matrix is ​​constructed. The initial prompt structure matrix is ​​a two-dimensional array, where each row represents a prompt type, each column represents a candidate prompt fragment of that prompt type, and each element in the matrix indicates whether the corresponding candidate prompt fragment is selected. The initial prompt structure matrix can be represented as:

[0090] Where n represents the cue type, m represents the number of candidate cue fragments in that cue type, and the elements in P are... , This indicates whether the j-th segment of the i-th type of prompt is selected, with a value of 0 or 1.

[0091] Furthermore, the differentiable selection vector corresponding to the received prompt unit allows for dynamic adjustment of the selection and combination of prompt units. The introduction of the differentiable selection vector makes the selection process of the prompt unit differentiable, thus enabling optimization through algorithms such as gradient descent. The differentiable selection vector can be expressed as: ,in, represents the differentiable selection vector for the cue, where m represents the number of candidate segments in the cue type. Cue units with the same cue type can use the same differentiable selection vector for the cue.

[0092] Furthermore, the received differentiable choice vector of the prompt is multiplied by the initial prompt structure matrix to obtain the differentiable choice set. This means that the weight information in the differentiable choice vector of the prompt is incorporated into the initial prompt structure matrix, making the selection state of each prompt unit differentiable.

[0093] Here, the differentiable set of choices can be represented as Where Q represents the set of differentiable choices, This indicates a differentiable vector to choose from. This indicates whether the j-th segment of the i-th type of prompt is selected, where n represents the prompt type and m represents the number of candidate prompt segments in that prompt type.

[0094] In the constructed prompt structure matrix, each matrix element represents the selection status of the candidate prompt fragment. A value of 1 indicates that the candidate prompt fragment is selected, and a value of 0 indicates that it is not selected. This allows for a clear understanding of the initial state of each prompt unit, and optimization and adjustment can be made based on this understanding.

[0095] Furthermore, based on the differentiable selection vector of the received prompts, an adaptive prompt selection mechanism can be introduced, which can dynamically adjust the selection of prompt units according to the specific needs of the target task and real-time data.

[0096] For example, when dealing with complex multimodal tasks, appropriate prompting units can be adaptively selected based on the modal characteristics of the current task. This not only improves the flexibility of prompting unit selection but also enhances the adaptability of the pre-defined agent to complex tasks.

[0097] This embodiment achieves automatic optimization of the prompt structure through a differentiable prompt selection mechanism. It can transform the discrete selection problem into a continuous parameter optimization problem, enabling prompt combinations to be trained together with model parameters. The prompt structure matrix provides a systematic prompt management framework, supporting complex prompt organization methods with multiple types and segments. The prompt differentiable selection vector gives the model the ability to automatically select important prompt segments according to task requirements, reducing the human cost of prompt design and improving the adaptability of prompt combinations.

[0098] In some embodiments, the tool invocation path of the tool invocation unit is parameterized via a tool neural network, including:

[0099] Assign a corresponding tool neural network to the current tool calling unit, determine the context information, optimization objective and output results of the upstream node of the current tool calling unit as input data, and input the input data into the tool neural network;

[0100] The tool invocation unit is parameterized by performing forward computation on the input data based on the tool neural network to obtain the execution parameters of the tool invocation unit.

[0101] Optionally, in this embodiment, a corresponding tool neural network is assigned to the current tool calling unit. The allocation of the tool neural network is based on the function and task requirements of the tool calling unit. For example, if the current tool calling unit is used for image processing tasks, the allocated tool neural network includes convolutional layers and pooling layers to adapt to the processing requirements of image data.

[0102] In addition, after the tool neural network is assigned, the context information, optimization objective, and output results of the upstream node of the current tool calling unit are determined as input data. The context information is used to clarify the position and role of the tool calling unit in the preset agent execution chain, the optimization objective is used to clarify the specific performance indicators that the tool calling unit needs to achieve, and the output results of the upstream node are used to represent the necessary input data of the tool calling unit.

[0103] Based on the input data, the tool's neural network can fully understand the execution environment and requirements of the current tool calling unit, thereby generating more accurate execution parameters so that the execution parameters of the tool calling unit meet the optimization goals and can also coordinate with the execution chain of the preset intelligent agent.

[0104] In addition, the tool neural network performs forward computation on the input data, in which multi-level feature transformations can be performed. The primary network is used to extract local features of the input data, such as identifying entities from upstream outputs or capturing state changes from contextual information. The intermediate layer is used for feature fusion and abstraction, performing cross-attention computation on information from different sources to generate joint representations. The output layer determines the execution parameters of the tool invocation unit. The execution parameters can be structured key-value pairs, continuous control values, or discrete operation instructions.

[0105] By performing forward computation of the tool neural network, the execution parameters of the tool invocation unit are obtained, thereby parameterizing the tool invocation path of the tool invocation unit. This enables dynamic adjustment of the behavior of the tool invocation unit, allowing it to be flexibly configured according to the specific needs of the task and optimization goals, thus achieving end-to-end mapping.

[0106] Here, a tuple corresponding to a tool invocation unit can be defined, which can be represented as:

[0107] ,in, Used to represent the k-th tool invocation unit. The parameter configuration used to represent the current tool invocation unit can be used to represent the tool invocation sequence of the entire toolchain for the current tool invocation unit as follows: .

[0108] The process of calling a unit through a neural network parameterization tool can be represented as follows: ,in, Used to represent differentiable neural networks, capable of adapting to context. Generate parameters, where, This includes, but is not limited to, contextual information, optimization objectives, and the output results of upstream nodes.

[0109] Furthermore, define the task loss function. This indicates that by optimizing the parameters This minimizes the loss of the tool call sequence.

[0110] Furthermore, a differentiable tool selection vector can be introduced to determine whether a tool invocation unit needs to be called. After introducing the tool selection vector, the execution path of the entire toolchain can be represented as:

[0111] .

[0112] In summary, the microstructure can be determined based on the differentiable set of choices and the processed tool call paths. The microstructure can be represented as follows: Where Q represents the microstructure, This indicates the tool call path, and can also be used. .

[0113] Furthermore, the context awareness of the tool invocation unit can be enhanced through an attention mechanism. By dynamically allocating weights, the attention mechanism enables the tool neural network to focus on important parts of the input data, thereby improving its ability to perceive contextual information and perform the target task more accurately.

[0114] This embodiment enables the integration of contextual information during the tool invocation process through neural network parameterization, allowing the tool invocation unit to adapt to specific execution scenarios. For example, the same tool invocation unit can use different parameter configurations in different session states. The direct introduction of upstream output ensures that the tool's neural network parameter generation and data processing pipeline are closely connected, avoiding information loss during transmission and achieving intelligent adaptation for tool use.

[0115] In some embodiments, before determining the executable path for each node, the method further includes:

[0116] Receive a candidate subgraph pool, count the frequency of occurrence of each subgraph structure in the directed acyclic graph, and determine the subgraph structure whose frequency of occurrence exceeds the preset frequency as the subgraph structure to be replaced. The candidate subgraph pool includes at least one candidate subgraph.

[0117] Determine the output to be replaced in the subgraph structure to be replaced and the candidate outputs of each candidate subgraph in the candidate subgraph pool, and determine the distribution distance between the output to be replaced and each candidate output;

[0118] The replacement loss function is used to process the output to be replaced, candidate outputs, and distribution distance to obtain the replacement loss function value. The subgraph to be replaced is then replaced with a candidate subgraph whose replacement loss function value is less than the preset replacement loss function value.

[0119] Optionally, this embodiment receives a candidate subgraph pool, wherein the candidate subgraph pool includes at least one predefined candidate subgraph. The candidate subgraph is pre-trained and optimized to efficiently perform a specific task. The candidate subgraph can be a common functional module, such as an image processing module or a text analysis module, or it can be a module customized for a specific task.

[0120] The structure of each subgraph in the directed acyclic graph is analyzed, and the frequency of occurrence of each subgraph structure is counted. This can be done by traversing the directed acyclic graph to identify frequently occurring subgraph structures. Subgraph structures with a frequency exceeding a preset frequency are marked as subgraph structures to be replaced. The preset frequency is set according to task requirements and optimization goals and is used to filter out subgraph structures that have a greater impact on task execution.

[0121] In addition, the replacement output of the subgraph structure to be replaced and the candidate output of each candidate subgraph in the candidate subgraph pool are determined. That is, the replacement output of the subgraph structure to be replaced in the current task and the candidate output of each candidate subgraph in the candidate subgraph pool in the current task are determined. The replacement output and the candidate output can be intermediate results, final results or any data related to task execution, in order to evaluate the performance of different subgraph structures in task execution.

[0122] In addition, to quantify the difference between the output to be replaced and the candidate output, the distribution distance between the output to be replaced and the candidate output is determined. The distribution distance can be determined by various metrics, such as KL divergence and mean square error, to provide quantitative information about the similarity of the output distribution, thereby determining the closest candidate output to be replaced.

[0123] Furthermore, based on the calculated distribution distance, candidate outputs, and outputs to be replaced, the replacement effect of each candidate subgraph is determined by a preset replacement loss function. That is, by minimizing the replacement loss function value, the candidate subgraph that is closest to the subgraph to be replaced is determined, thus avoiding the impact of the replacement operation on the overall performance of the preset agent and ensuring that the replaced subgraph can better adapt to the task requirements.

[0124] Furthermore, by replacing the subgraph to be replaced with a candidate subgraph whose replacement loss function value is less than the preset replacement loss function value, the subgraph structure in the directed acyclic graph can be dynamically optimized, thereby improving the overall performance of the agent.

[0125] The candidate subgraph pool can be represented as Each Represents a pre-trained or optimized composite structure (candidate subgraph), for the subgraph to be replaced. The replacement candidate subgraph can be determined from the candidate subgraph pool using the replacement loss function, which can be expressed as:

[0126] ,in, Used to represent the output to be replaced in the subgraph to be replaced. Candidate outputs used to represent candidate subgraphs Used to represent distribution distance, it can be KL divergence or MSE, in Furthermore, if computational / path costs are reduced, the subgraph to be replaced will be replaced with this candidate subgraph. This indicates the preset replacement loss function value.

[0127] This embodiment identifies frequently occurring subgraph structures as subgraphs to be replaced, and uses distribution distance to ensure the functional equivalence of the subgraphs to be replaced and candidate subgraphs. This avoids the replacement affecting the input and output behavior of the preset agent, thereby reducing the redundancy of the preset agent structure, improving execution efficiency, and maintaining functional integrity.

[0128] In some embodiments, after iterative training based on differentiable gating mechanisms and executable paths, the method further includes:

[0129] Receive the target expected result of the target task. If it is detected that there are multiple sub-paths in the current directed acyclic graph, the expected similarity between the task result obtained by processing the target task and the expected result of the target exceeds the preset expected similarity threshold, the differentiable synthesizer network is invoked.

[0130] The results of each task are input into a differentiable synthesizer network. By minimizing the synthesizer output of the differentiable synthesizer network, the distribution difference loss between the synthesizer output and the target expected result is determined. The differentiable synthesizer network is adjusted based on the distribution difference loss, and the sub-paths are replaced with the adjusted differentiable synthesizer network.

[0131] Optionally, this embodiment receives the target expected result related to the target task, wherein the target expected result represents the ideal output of the target task, or the ideal output of the target task at a certain stage, providing a clear reference standard for the optimization process and optimization goal. By comparing with the actual task result, the execution effect of the current directed acyclic graph can be evaluated, and the optimization strategy can be adjusted accordingly.

[0132] In addition, if it is detected that the expected similarity between the task result obtained by processing the target task and the target expected result exceeds the preset expected similarity in the current directed acyclic graph, a differentiable synthesis network is invoked. The expected similarity can be determined by cosine similarity, Jaccard similarity, etc., and the above-mentioned multiple sub-paths are considered to have high similarity and can be optimized by a differentiable synthesizer network.

[0133] Differentiable synthesizer networks are a type of neural network that can synthesize the results of multiple tasks to generate a single output. The outputs of its sub-paths can be adjusted using optimization algorithms such as gradient descent to better approximate the desired result.

[0134] Furthermore, the task results from multiple sub-paths are input into a differentiable synthesizer network. These task results include, but are not limited to, different information and features. The information contained in the input results can be integrated through the processing of the differentiable synthesizer network.

[0135] Furthermore, after the differentiable synthesizer network processes the task results, the distribution difference loss between the synthesizer output and the target expected result is determined. The distribution difference loss can be determined by metrics such as KL divergence and mean squared error, which are used to quantify the difference between the synthesizer output and the target expected result. This allows for the adjustment of the parameters of the differentiable synthesizer network, making its output result closer to the target expected result and enabling it to replace sub-paths. The process of adjusting the parameters of the differentiable synthesizer network can be achieved through optimization algorithms such as gradient descent.

[0136] Replacing multiple sub-paths with an adjusted differentiable synthesizer network enables the pre-defined agent to process the target task more efficiently, reduces redundant paths, improves execution efficiency, optimizes the structure of sub-paths, enhances the overall performance of the directed acyclic graph, and thus improves the performance of the pre-defined agent.

[0137] In other words, when multiple sub-paths in a directed acyclic graph produce similar outputs for the same target task, path merging and reparameterization can be performed; that is, the aforementioned sub-paths can be named... The task results corresponding to each sub-path are as follows: It can train a differentiable synthesizer network. So that the synthesizer output of the differentiable synthesizer network satisfies g ,in, This is used to represent the desired outcome or the selected sub-path to be learned, thereby approximating redundant paths and achieving path compression.

[0138] In this context, after the differentiable synthesizer network replaces multiple sub-paths, a path selection loss exists. This path selection loss is obtained through a path selection loss function, the expression of which can be:

[0139] Where KL represents the KL divergence.

[0140] Furthermore, the optimal path or optimal combination of paths can be dynamically selected from multiple optional sub-paths to execute the target task. That is, a path route is introduced into a node with multiple optional sub-paths, and the route distribution of this path route can be represented as follows: This allows us to obtain each branch in the route, which can be represented as... .

[0141] The distribution of each route can be differentiable by the Gumble-Softmax implementation of path selection, specifically represented as:

[0142] ,in, , Used to represent temperature coefficient.

[0143] Furthermore, the comprehensive loss function can be expressed as:

[0144] ,in, Used to indicate the loss of the main task. Used to represent path sparsity loss Used to represent the subgraph replacement loss Used to represent path selection loss Used to represent the weights of the corresponding loss function.

[0145] This embodiment achieves the merging of multiple sub-paths when the outputs generated by multiple sub-paths are approximate. That is, there is functional overlap between sub-paths. Merging sub-paths reduces the repeated consumption of computing resources. After end-to-end training, the differentiable synthesizer network can make the output distribution of the merged synthesizer highly consistent with the expected result, avoid the performance degradation caused by merging, reduce the complexity of the preset agent structure, and enable the preset agent to obtain a more compact structure and higher execution efficiency while maintaining the original functions.

[0146] In some embodiments, optimizing a directed acyclic graph based on gradient signals includes:

[0147] The scheduler parameters of the neural network scheduler are updated based on the gradient signal using the backpropagation algorithm, resulting in the updated neural network scheduler.

[0148] After the neural network scheduler completes the update, the differentiable gating mechanism is updated based on the gradient signal.

[0149] With the differentiable gating mechanism completed, the network parameters of the tool neural network are updated based on the gradient signal, prompting the differentiable selection vector and the tool neural network.

[0150] Optionally, this embodiment uses the backpropagation algorithm to update the scheduler parameters of the neural network scheduler based on the gradient signal, thereby obtaining the updated neural network scheduler. This enables the neural network scheduler to more accurately predict the probability distribution of the next task to be executed, improving the efficiency and accuracy of task scheduling.

[0151] In addition, after the parameters of the neural network scheduler are updated, the differentiable gating mechanism is updated. The differentiable gating mechanism is used to control the flow path of data related to the target task in the directed acyclic graph. By updating the gradient signal, the differentiable gating mechanism can more flexibly adjust the data flow, prune redundant paths, and optimize the data transmission efficiency.

[0152] Furthermore, after the differentiable gating mechanism is updated, the parameters of the cue differentiable selection vector and the tool neural network are updated. The update of the cue differentiable selection vector enables more accurate selection and combination of cue units, improving the accuracy of target task execution. The update of the tool neural network parameters further optimizes the tool invocation path, enabling each tool invocation unit to execute the target task in the optimal way.

[0153] Furthermore, the above process can be viewed as completing the overall structural optimization of the directed acyclic graph, including the execution dependencies, order, and link structure of multiple subtasks. The main purpose is to achieve dynamic scheduling, path planning, and dynamic construction of policy chains at the task level, thereby transforming the optimization objectives at each level into an optimization objective related to factors that users care about, such as accuracy and cost, i.e., the optimization objective received when receiving the target task.

[0154] The structure that selects the overall optimal path can be represented in the following way:

[0155] ,in, This represents the loss (accuracy, output consistency, etc.) of the directed acyclic graph inference result on input x. The regularization terms used to represent structural complexity (including but not limited to path length, branch complexity, call cost, etc.) can be considered as the optimization at this stage being based on the accuracy of micro and meso structural optimization, with the addition of some factors of concern to the user.

[0156] This embodiment realizes that the gradient signal is generated from the macroscopic target task and sequentially transmitted to the differentiable parameters at each level to form a collaborative optimization closed loop. This ensures that the update mechanism maintains the coordination of parameter updates at each level, avoids conflicts in the optimization directions of different components, and can continuously improve execution efficiency while maintaining functional integrity. At the same time, the integrity of the gradient propagation path ensures that the optimization target can directly affect the adjustment of the underlying parameters, achieving accurate optimization results.

[0157] In some embodiments, generating gradient signals based on probability distributions and optimization objectives includes:

[0158] The probability distribution output by the neural network scheduler is used as the distribution strategy to determine the actual execution path of the next task.

[0159] The reward value of the actual execution path is determined based on the optimization objective. Based on the reward value, the gradient of the optimization objective with respect to the scheduler parameters of the neural network scheduler is determined by the policy gradient algorithm corresponding to the distribution strategy. The gradient signal is then generated based on the gradient.

[0160] Optionally, in this embodiment, the probability distribution output by the neural network scheduler is used as the distribution strategy. The distribution strategy provides clear guidance for task scheduling and can select the actual execution path of the next task to be executed based on the probability distribution, which increases flexibility and enables the preset agent to better adapt to the dynamic changes of the task, thereby improving the efficiency and accuracy of task scheduling.

[0161] The task path with the highest probability can be selected from the probability distribution, or a path can be selected by sampling. The selection of the actual execution path needs to take into account the priority of the task, the availability of resources, and the complexity of the task, so that the selected execution path can meet the task requirements and be executed efficiently in a resource-constrained environment.

[0162] In addition, after determining the actual execution path, the reward value of the actual execution path is determined based on the optimization goal. The reward value is a key indicator for measuring the degree of matching between the execution path and the optimization goal, and reflects the quality of the path.

[0163] The optimization objectives can be the task's execution time, resource consumption, and execution accuracy. By determining the reward value, the performance of the actual execution path can be determined.

[0164] Furthermore, based on the reward value, the gradient of the optimization objective with respect to the scheduler parameters of the neural network scheduler can be determined using the policy gradient algorithm corresponding to the distribution policy, and a gradient signal can be generated based on the gradient. The policy gradient algorithm is a reinforcement learning method that guides the direction of parameter updates by calculating the gradient of the reward value with respect to the neural network scheduler parameters. It can dynamically adjust the scheduler parameters based on the performance feedback of the actual execution path, thereby optimizing the task scheduling strategy.

[0165] Gradient signals are used to guide the updating of neural network scheduler parameters. Through gradient signals, the parameters of the neural network scheduler can be dynamically adjusted to better adapt to task requirements and improve the efficiency and accuracy of task scheduling.

[0166] Furthermore, a dynamic task scheduler (i.e., a neural network scheduler) can be used as a policy network, accepting the current execution state of the directed acyclic graph. (Including but not limited to historical results, current input, intermediate memory states, etc.), output the probability distribution of the next task selection. The policy network can be represented as:

[0167] ,in, It is a neural network scheduler, composed of Transformers. It is a constant obtained through reinforcement learning training.

[0168] The objective function can be expressed as: ,in, The entropy regularization of the policy distribution, i.e., the reward value, is used to encourage exploration.

[0169] This embodiment transforms a multi-objective optimization problem into a unified scalar signal through a reward function, guiding the neural network scheduler to evolve towards the optimal overall performance. The policy gradient algorithm makes the optimization process directly oriented towards performance indicators, thereby enabling the preset agent to learn scheduling strategies that adapt to different task characteristics through gradient-based optimization, achieving intelligent resource allocation and task scheduling.

[0170] To effectively address the shortcomings of traditional technologies, such as limited optimization space leading to inaccurate results, and to significantly improve the performance of optimized pre-defined agents in processing target tasks, ensuring that task results meet optimization objectives from multiple dimensions, this application provides an embodiment of an image classification-oriented differentiable agent optimization device for implementing all or part of the aforementioned image classification-oriented differentiable agent optimization. See [link to embodiment]. Figure 2 The image classification-oriented differentiable intelligent agent optimization device specifically includes the following components:

[0171] Micro-module 10 is used to receive the target task and the optimization target of the target task, construct a directed acyclic graph based on the execution chain of the preset intelligent agent, receive the prompt differentiable selection vectors corresponding to the prompt units, assign prompt differentiable selection vectors to each prompt unit to obtain a set of differentiable selections, parameterize the tool call path of the tool call unit through the tool neural network, process the tool call path by calling differentiable vectors, determine the micro structure based on the set of differentiable selections and the processed tool call path, optimize the micro structure until the micro loss function value corresponding to the micro structure does not exceed the preset micro loss value. The nodes of the directed acyclic graph are used to represent basic functional modules. The nodes include prompt units or tool call units, and the edges of the directed acyclic graph represent the data flow direction between nodes.

[0172] Mesoscopic module 20 is used to determine the executable path of each node, assign differentiable weights to edges, perform iterative training based on differentiable gating mechanism and executable path to update differentiable weights, prune the edges corresponding to the updated differentiable weights when the updated differentiable weights are less than the preset differentiable weights, and determine the comprehensive loss function value based on the pruned edges and updated differentiable weights, and optimize the executable path of the directed acyclic graph based on the comprehensive loss function value;

[0173] The macro module 30 is used to obtain the execution state of the optimized directed acyclic graph, process the execution state through a neural network scheduler to obtain the probability distribution of the next execution task, generate gradient signals based on the probability distribution and optimization objective, and optimize the directed acyclic graph based on the gradient signals.

[0174] As described above, the image classification-oriented differentiable structure intelligent agent optimization device provided in this application embodiment can innovatively receive the target task and the optimization target of the target task, construct a directed acyclic graph according to the execution chain of the preset intelligent agent, receive the prompt differentiable selection vector corresponding to the prompt unit, assign the prompt differentiable selection vector to the prompt unit to obtain the differentiable selection set, parameterize the tool call path of the tool call unit through the tool neural network, process the tool call path by calling differentiable vectors, determine the microstructure according to the differentiable selection set and the processed tool call path, and optimize the microstructure until the micro loss function value corresponding to the microstructure does not exceed the preset micro loss value. The nodes of the directed acyclic graph represent basic functional modules, including prompt units or tool call units. The edges of the directed acyclic graph represent the data flow between nodes, determine the executable path of each node, and assign differentiable weights to the edges. This method iteratively trains based on differentiable gating mechanisms and executable paths to update differentiable weights. When the updated differentiable weights are less than the preset differentiable weights, edges corresponding to the updated differentiable weights are pruned. A comprehensive loss function value is determined based on the pruned edges and the updated differentiable weights. The executable paths of the directed acyclic graph (DAG) are optimized based on the comprehensive loss function value, and the execution state of the optimized DAG is obtained. A neural network scheduler processes the execution state to obtain the probability distribution of the next execution task. Gradient signals are generated based on the probability distribution and the optimization objective, and the DAG is optimized based on the gradient signals. This method can transform the optimization objective into gradient information for optimizing the structure of the preset agent, thereby adjusting and simplifying the structure of the preset agent and improving its performance. Furthermore, since the optimization process does not involve fine-tuning the large model parameters and prompts within the preset agent, the general applicability of the optimization is improved. This method effectively solves the shortcomings of traditional techniques, such as inaccurate results due to limited optimization space in the preset agent, significantly improving the performance of the optimized preset agent in processing the target task, and ensuring that the task results conform to the optimization objective from multiple dimensions.

[0175] From a hardware perspective, in order to effectively address the shortcomings of traditional technologies, such as inaccurate results due to limited optimization space of preset intelligent agents, and to significantly improve the performance of optimized preset intelligent agents in processing target tasks, ensuring that task results meet optimization objectives from multiple dimensions, this application provides an embodiment of an electronic device for implementing all or part of the aforementioned optimization method for differentiable structured intelligent agents for image classification. The electronic device specifically includes the following components:

[0176] The system comprises a processor, memory, a communication interface, and a bus; wherein the processor, memory, and communication interface communicate with each other via the bus; the communication interface is used to realize information transmission between the image classification-oriented differentiable intelligent agent optimization device and core business systems, user terminals, and related databases and other related devices; the logic controller can be a desktop computer, tablet computer, or mobile terminal, etc., and this embodiment is not limited to these. In this embodiment, the logic controller can be implemented with reference to the embodiments of the image classification-oriented differentiable intelligent agent optimization method and the image classification-oriented differentiable intelligent agent optimization device, the contents of which are incorporated herein, and repeated details will not be described again.

[0177] It is understood that the user terminal may include smartphones, tablet computers, network set-top boxes, portable computers, desktop computers, personal digital assistants (PDAs), in-vehicle devices, smart wearable devices, etc. Among these, the smart wearable devices may include smart glasses, smartwatches, smart bracelets, etc.

[0178] In practical applications, parts of the optimization method for differentiable intelligent agents for image classification can be executed on the electronic device side as described above, or all operations can be completed in the client device. The choice can be made based on the processing power of the client device and the limitations of the user's usage scenario. This application does not impose any limitations on this. If all operations are completed in the client device, the client device may further include a processor.

[0179] The aforementioned client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side; in other implementation scenarios, it may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, a server cluster consisting of multiple servers, or a distributed server structure.

[0180] Figure 3 This is a schematic block diagram illustrating the system configuration of the electronic device 9600 according to an embodiment of this application. Figure 3 As shown, the electronic device 9600 may include a central processing unit 9100 and a memory 9140; the memory 9140 is coupled to the central processing unit 9100. It is worth noting that... Figure 3 This is an example; other types of structures can also be used to supplement or replace this structure to achieve telecommunications functions or other functions.

[0181] In one embodiment, the optimization method for differentiable intelligent agents for image classification can be integrated into a central processing unit 9100. The central processing unit 9100 can be configured to perform the following control:

[0182] Step S101: Receive the target task and the optimization target of the target task, construct a directed acyclic graph based on the execution chain of the preset intelligent agent, receive the prompt differentiable selection vector corresponding to the prompt unit, assign prompt differentiable selection vector to each prompt unit to obtain the set of differentiable selections, parameterize the tool call path of the tool call unit through the tool neural network, and process the tool call path by calling differentiable vectors, determine the microstructure based on the set of differentiable selections and the processed tool call path, optimize the microstructure until the micro loss function value corresponding to the microstructure does not exceed the preset micro loss value, the nodes of the directed acyclic graph are used to represent basic functional modules, the nodes include prompt units or tool call units, and the edges of the directed acyclic graph represent the data flow direction between nodes;

[0183] Step S102: Determine the executable path for each node, assign differentiable weights to the edges, perform iterative training based on the differentiable gating mechanism and the executable path to update the differentiable weights, prune the edges corresponding to the updated differentiable weights when the updated differentiable weights are less than the preset differentiable weights, determine the comprehensive loss function value based on the pruned edges and the updated differentiable weights, and optimize the executable path of the directed acyclic graph based on the comprehensive loss function value.

[0184] Step S103: Obtain the execution state of the optimized directed acyclic graph, process the execution state through the neural network scheduler to obtain the probability distribution of the next execution task, generate gradient signals based on the probability distribution and optimization objective, and optimize the directed acyclic graph based on the gradient signals.

[0185] As described above, the electronic device provided in this application embodiment innovatively receives the target task and the optimization target of the target task, constructs a directed acyclic graph based on the execution chain of a preset intelligent agent, receives the prompt differentiable selection vector corresponding to the prompt unit, assigns the prompt differentiable selection vector to the prompt unit to obtain a set of differentiable choices, parameterizes the tool call path of the tool call unit through a tool neural network, processes the tool call path by calling differentiable vectors, determines the microstructure based on the set of differentiable choices and the processed tool call path, and optimizes the microstructure until the micro loss function value corresponding to the microstructure does not exceed a preset micro loss value. The nodes of the directed acyclic graph represent basic functional modules, including prompt units or tool call units. The edges of the directed acyclic graph represent the data flow between nodes. The executable path of each node is determined, and differentiable weights are assigned to the edges. Based on the differentiable gating machine... The method iteratively trains the system and executable paths to update differentiable weights. If the updated differentiable weights are less than the preset differentiable weights, the edges corresponding to the updated differentiable weights are pruned. A comprehensive loss function value is determined based on the pruned edges and the updated differentiable weights. The executable paths of the directed acyclic graph (DAG) are optimized based on the comprehensive loss function value. The execution state of the optimized DAG is obtained, and a neural network scheduler processes the execution state to obtain the probability distribution of the next execution task. Gradient signals are generated based on the probability distribution and the optimization objective, and the DAG is optimized based on the gradient signals. This method can transform the optimization objective into gradient information for optimizing the structure of the preset agent, thereby adjusting and simplifying the structure of the preset agent and improving its performance. Furthermore, since the optimization process does not involve fine-tuning the large model parameters and prompts within the preset agent, the general applicability of the optimization is improved. This method effectively solves the shortcomings of traditional techniques, such as inaccurate results due to limited optimization space in the preset agent, significantly improving the performance of the optimized preset agent in processing the target task, and ensuring that the task results conform to the optimization objective from multiple dimensions.

[0186] In another embodiment, the image classification-oriented differentiable intelligent agent optimization device can be configured separately from the central processing unit 9100. For example, the image classification-oriented differentiable intelligent agent optimization device can be configured as a chip connected to the central processing unit 9100, and the image classification-oriented differentiable intelligent agent optimization method function can be implemented through the control of the central processing unit.

[0187] like Figure 3 As shown, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily need to include these components. Figure 3 All components shown; in addition, the electronic device 9600 may also include Figure 3For components not shown, please refer to existing technologies.

[0188] like Figure 3 As shown, the central processing unit 9100, sometimes also referred to as a controller or operating control, may include a microprocessor or other processor device and / or logic device, which receives inputs and controls the operation of various components of the electronic device 9600.

[0189] The memory 9140 may be, for example, one or more of a cache, flash memory, hard drive, removable media, volatile memory, non-volatile memory, or other suitable devices. It may store the aforementioned failure-related information, and also store a program for executing that information. The central processing unit 9100 may execute the program stored in the memory 9140 to perform information storage or processing, etc.

[0190] Input unit 9120 provides input to central processing unit 9100. Input unit 9120 may be, for example, a keypad or touch input device. Power supply 9170 provides power to electronic device 9600. Display 9160 displays images and text. Display may be, for example, an LCD display, but is not limited thereto.

[0191] The memory 9140 can be a solid-state memory, such as a read-only memory (ROM), random access memory (RAM), a SIM card, etc. It can also be a memory that retains information even when power is off, can be selectively erased, and contains more data; examples of this type of memory are sometimes referred to as EPROMs. The memory 9140 can also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142 for storing application programs and function programs or processes for executing the operation of the electronic device 9600 via the central processing unit 9100.

[0192] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for the electronic device for communication functions and / or for performing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0193] The communication module 9110 is a transmitter / receiver that sends and receives signals via the antenna 9111. The communication module 9110 (transmitter / receiver) is coupled to the central processing unit 9100 to provide input signals and receive output signals, which is the same as in a conventional mobile communication terminal.

[0194] Based on different communication technologies, multiple communication modules 9110 can be configured in the same electronic device, such as cellular network modules, Bluetooth modules, and / or wireless LAN modules. The communication module 9110 (transmitter / receiver) is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby realizing typical telecommunications functions. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. Additionally, the audio processor 9130 is coupled to a central processing unit 9100, enabling on-device recording via the microphone 9132 and on-device playback of stored audio via the speaker 9131.

[0195] Embodiments of this application also provide a computer-readable storage medium capable of implementing all steps of the image classification-oriented differentiable intelligent agent optimization method with a server or client as the execution subject in the above embodiments. The computer-readable storage medium stores a computer program that, when executed by a processor, implements all steps of the image classification-oriented differentiable intelligent agent optimization method with a server or client as the execution subject in the above embodiments. For example, when the processor executes the computer program, it implements the following steps:

[0196] Step S101: Receive the target task and the optimization target of the target task, construct a directed acyclic graph based on the execution chain of the preset intelligent agent, receive the prompt differentiable selection vector corresponding to the prompt unit, assign prompt differentiable selection vector to each prompt unit to obtain the set of differentiable selections, parameterize the tool call path of the tool call unit through the tool neural network, and process the tool call path by calling differentiable vectors, determine the microstructure based on the set of differentiable selections and the processed tool call path, optimize the microstructure until the micro loss function value corresponding to the microstructure does not exceed the preset micro loss value, the nodes of the directed acyclic graph are used to represent basic functional modules, the nodes include prompt units or tool call units, and the edges of the directed acyclic graph represent the data flow direction between nodes;

[0197] Step S102: Determine the executable path for each node, assign differentiable weights to the edges, perform iterative training based on the differentiable gating mechanism and the executable path to update the differentiable weights, prune the edges corresponding to the updated differentiable weights when the updated differentiable weights are less than the preset differentiable weights, determine the comprehensive loss function value based on the pruned edges and the updated differentiable weights, and optimize the executable path of the directed acyclic graph based on the comprehensive loss function value.

[0198] Step S103: Obtain the execution state of the optimized directed acyclic graph, process the execution state through the neural network scheduler to obtain the probability distribution of the next execution task, generate gradient signals based on the probability distribution and optimization objective, and optimize the directed acyclic graph based on the gradient signals.

[0199] As described above, the computer-readable storage medium provided in this application innovatively receives the target task and the optimization target of the target task, constructs a directed acyclic graph based on the execution chain of a preset intelligent agent, receives the prompt differentiable selection vector corresponding to the prompt unit, assigns the prompt differentiable selection vector to the prompt unit to obtain a set of differentiable choices, parameterizes the tool call path of the tool call unit through the tool neural network, processes the tool call path by calling differentiable vectors, determines the microstructure based on the set of differentiable choices and the processed tool call path, and optimizes the microstructure until the micro loss function value corresponding to the microstructure does not exceed the preset micro loss value. In this process, the nodes of the directed acyclic graph represent basic functional modules, including prompt units or tool call units, the edges of the directed acyclic graph represent the data flow between nodes, the executable path of each node is determined, differentiable weights are assigned to the edges, and differentiable gates are used to... The control mechanism and executable paths are iteratively trained to update differentiable weights. When the updated differentiable weights are less than the preset differentiable weights, the edges corresponding to the updated differentiable weights are pruned. A comprehensive loss function value is determined based on the pruned edges and the updated differentiable weights. The executable paths of the directed acyclic graph (DAG) are optimized based on the comprehensive loss function value, and the execution state of the optimized DAG is obtained. The execution state is processed by a neural network scheduler to obtain the probability distribution of the next execution task. Gradient signals are generated based on the probability distribution and the optimization objective, and the DAG is optimized based on the gradient signals. This method can transform the optimization objective into gradient information for optimizing the structure of the preset agent, thereby adjusting and simplifying the structure of the preset agent and improving its performance. Furthermore, since the optimization process does not involve fine-tuning the large model parameters and prompts within the preset agent, the general applicability of the optimization is improved. This method effectively solves the shortcomings of traditional techniques, such as inaccurate results due to limited optimization space in the preset agent, significantly improving the performance of the optimized preset agent in processing the target task, and ensuring that the task results conform to the optimization objective from multiple dimensions.

[0200] Embodiments of this application also provide a computer program product capable of implementing all steps in the image classification-oriented differentiable intelligent agent optimization method with the execution subject being a server or client as described in the above embodiments. When executed by a processor, this computer program / instruction implements the steps of the image classification-oriented differentiable intelligent agent optimization method. For example, the computer program / instruction implements the following steps:

[0201] Step S101: Receive the target task and the optimization target of the target task, construct a directed acyclic graph based on the execution chain of the preset intelligent agent, receive the prompt differentiable selection vector corresponding to the prompt unit, assign prompt differentiable selection vector to each prompt unit to obtain the set of differentiable selections, parameterize the tool call path of the tool call unit through the tool neural network, and process the tool call path by calling differentiable vectors, determine the microstructure based on the set of differentiable selections and the processed tool call path, optimize the microstructure until the micro loss function value corresponding to the microstructure does not exceed the preset micro loss value, the nodes of the directed acyclic graph are used to represent basic functional modules, the nodes include prompt units or tool call units, and the edges of the directed acyclic graph represent the data flow direction between nodes;

[0202] Step S102: Determine the executable path for each node, assign differentiable weights to the edges, perform iterative training based on the differentiable gating mechanism and the executable path to update the differentiable weights, prune the edges corresponding to the updated differentiable weights when the updated differentiable weights are less than the preset differentiable weights, determine the comprehensive loss function value based on the pruned edges and the updated differentiable weights, and optimize the executable path of the directed acyclic graph based on the comprehensive loss function value.

[0203] Step S103: Obtain the execution state of the optimized directed acyclic graph, process the execution state through the neural network scheduler to obtain the probability distribution of the next execution task, generate gradient signals based on the probability distribution and optimization objective, and optimize the directed acyclic graph based on the gradient signals.

[0204] As described above, the computer program product provided in this application innovatively receives the target task and the optimization target of the target task, constructs a directed acyclic graph based on the execution chain of a preset intelligent agent, receives the prompt differentiable selection vector corresponding to the prompt unit, assigns the prompt differentiable selection vector to the prompt unit to obtain a set of differentiable choices, parameterizes the tool call path of the tool call unit through the tool neural network, processes the tool call path by calling differentiable vectors, determines the microstructure based on the set of differentiable choices and the processed tool call path, and optimizes the microstructure until the micro loss function value corresponding to the microstructure does not exceed the preset micro loss value. The nodes of the directed acyclic graph represent basic functional modules, including prompt units or tool call units. The edges of the directed acyclic graph represent the data flow between nodes. The executable path of each node is determined, and differentiable weights are assigned to the edges. Differentiable gating is then applied. The mechanism and executable paths are iteratively trained to update differentiable weights. If the updated differentiable weights are less than the preset differentiable weights, the edges corresponding to the updated differentiable weights are pruned. A comprehensive loss function value is determined based on the pruned edges and the updated differentiable weights. The executable paths of the directed acyclic graph (DAG) are optimized based on the comprehensive loss function value, and the execution state of the optimized DAG is obtained. The execution state is processed by a neural network scheduler to obtain the probability distribution of the next execution task. Gradient signals are generated based on the probability distribution and the optimization objective, and the DAG is optimized based on the gradient signals. This method can transform the optimization objective into gradient information for optimizing the structure of the preset agent, thereby adjusting and simplifying the structure of the preset agent and improving its performance. Furthermore, since the optimization process does not involve fine-tuning the large model parameters and prompts within the preset agent, the general applicability of the optimization is improved. This method effectively solves the shortcomings of traditional techniques, such as inaccurate results due to limited optimization space in the preset agent, significantly improving the performance of the optimized preset agent in processing the target task, and ensuring that the task results conform to the optimization objective from multiple dimensions.

[0205] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0206] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0207] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0208] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0209] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A method for optimizing differentiable intelligent agents for image classification, characterized in that, The method includes: The system receives an image classification target task and its optimization objective. It constructs a directed acyclic graph (DAG) based on the execution chain of a preset agent. Nodes in the DAG represent basic functional modules, including prompting units or tool invocation units. Edges in the DAG represent data flow between nodes. The prompting units include visual prompts, and the tool invocation units are used for image processing tasks. The system receives differentiable selection vectors corresponding to the prompting units, assigns these vectors to each prompting unit to obtain a differentiable selection set, and parameterizes the tool invocation path of the tool invocation unit using a tool neural network. Based on the features and classification difficulty of the image to be classified, the tool neural network processes the tool invocation path by calling differentiable vectors. Based on the differentiable selection set and the processed tool invocation path, the system determines the microstructure and optimizes the microstructure until the micro-loss function value corresponding to the microstructure does not exceed a preset micro-loss value. The executable path of each node is determined, and the edges are assigned differentiable weights. Iterative training is performed based on the differentiable gating mechanism and the executable path to update the differentiable weights. If the updated differentiable weight is less than the preset differentiable weight, the edges corresponding to the updated differentiable weight are pruned. A comprehensive loss function value is determined based on the pruned edges and the updated differentiable weight. The executable path of the directed acyclic graph is optimized based on the comprehensive loss function value to improve the accuracy of image classification. The execution state of the optimized directed acyclic graph is obtained, and the execution state is processed by a neural network scheduler to obtain the probability distribution of the next execution task. A gradient signal is generated based on the probability distribution and the optimization objective, and the directed acyclic graph is optimized based on the gradient signal to achieve efficient execution of the image classification task.

2. The method according to claim 1, characterized in that, The prompt differentiable selection vector corresponding to the receiving prompt unit is assigned to each prompt unit to obtain a differentiable selection set, including: Determine the prompt types included in the prompt unit and the number of candidate prompt segments in each prompt type. The prompt type includes prompt words, visual cues, knowledge bases, and memory layers. Each prompt type includes at least one prompt unit. An initial prompt structure matrix is ​​constructed based on the prompt type and the number of segments. The prompt differentiable selection vector corresponding to the prompt unit is received. The prompt differentiable selection vector is multiplied by the initial prompt structure matrix to obtain a differentiable selection set. The matrix elements in the prompt structure matrix are used to represent the selection state of the candidate prompt segments.

3. The method according to claim 1, characterized in that, The tool invocation path of the tool invocation unit parameterized by the tool neural network includes: Assign a corresponding tool neural network to the current tool invocation unit, determine the context information of the current tool invocation unit, the optimization target and the output results of the upstream node as input data, and input the input data into the tool neural network; The tool's neural network performs forward computation on the input data to obtain the execution parameters of the tool invocation unit, thereby parameterizing the tool invocation path of the tool invocation unit.

4. The method according to claim 1, characterized in that, Before determining the executable path for each of the nodes, the method further includes: Receive a candidate subgraph pool, count the occurrence frequency of each subgraph structure in the directed acyclic graph, and determine the subgraph structure whose occurrence frequency exceeds a preset occurrence frequency as the subgraph structure to be replaced. The candidate subgraph pool includes at least one candidate subgraph. Determine the output to be replaced in the subgraph structure to be replaced and the candidate outputs of each candidate subgraph in the candidate subgraph pool, and determine the distribution distance between the output to be replaced and each candidate output; The output to be replaced, the candidate output, and the distribution distance are processed by a preset replacement loss function to obtain a replacement loss function value. The subgraph to be replaced is then replaced with the candidate subgraph whose replacement loss function value is less than the preset replacement loss function value.

5. The method according to claim 1, characterized in that, After the iterative training based on the differentiable gating mechanism and the executable path, the method further includes: Receive the target expected result of the target task. If it is detected that there are multiple sub-paths in the current directed acyclic graph that process the target task and the expected similarity between the task result and the target expected result exceeds a preset expected similarity threshold, call the differentiable synthesizer network. The results of each task are input into the differentiable synthesizer network. By minimizing the synthesizer output of the differentiable synthesizer network, the distribution difference loss between the synthesizer output and the target expected result is determined. Based on the distribution difference loss, the differentiable synthesizer network is adjusted, and the sub-path is replaced with the adjusted differentiable synthesizer network.

6. The method according to claim 1, characterized in that, The optimization of the directed acyclic graph based on the gradient signal includes: The scheduler parameters of the neural network scheduler are updated based on the gradient signal using the backpropagation algorithm, thus obtaining the updated neural network scheduler. When the neural network scheduler completes its update, the differentiable gating mechanism is updated based on the gradient signal. Once the differentiable gating mechanism has been updated, the cue differentiable selection vector and the network parameters of the tool neural network are updated based on the gradient signal.

7. The method according to claim 1, characterized in that, The generation of gradient signals based on the probability distribution and the optimization objective includes: The probability distribution output by the neural network scheduler is used as a distribution strategy to determine the actual execution path of the next task. The reward value of the actual execution path is determined based on the optimization objective, and the gradient of the optimization objective with respect to the scheduler parameters of the neural network scheduler is determined based on the reward value through the policy gradient algorithm corresponding to the distribution strategy, and a gradient signal is generated based on the gradient.

8. A differentiable intelligent agent optimization device for image classification, characterized in that, The device includes: A micro-module is used to receive the image classification target task and the optimization target of the target task. It constructs a directed acyclic graph (DAG) based on the execution chain of a preset agent. The nodes of the DAG represent basic functional modules, including prompting units or tool invocation units. The edges of the DAG represent the data flow between the nodes. The prompting units include visual prompts, and the tool invocation units are used for image processing tasks. It receives the prompt differentiable selection vectors corresponding to the prompting units, assigns the prompt differentiable selection vectors to each prompting unit to obtain a differentiable selection set, and parameterizes the tool invocation path of the tool invocation unit through a tool neural network. The tool neural network processes the tool invocation path by calling differentiable vectors based on the features and classification difficulty of the image to be classified. Based on the differentiable selection set and the processed tool invocation path, it determines the microstructure and optimizes the microstructure until the micro-loss function value corresponding to the microstructure does not exceed a preset micro-loss value. The meso-level module is used to determine the executable path of each node, assign differentiable weights to the edges, perform iterative training based on the differentiable gating mechanism and the executable path to update the differentiable weights, prune the edges corresponding to the updated differentiable weights when the updated differentiable weights are less than the preset differentiable weights, determine the comprehensive loss function value based on the pruned edges and the updated differentiable weights, and optimize the executable path of the directed acyclic graph based on the comprehensive loss function value to improve the accuracy of image classification. The macro module is used to obtain the execution state of the optimized directed acyclic graph, process the execution state through a neural network scheduler to obtain the probability distribution of the next execution task, generate a gradient signal based on the probability distribution and the optimization objective, and optimize the directed acyclic graph based on the gradient signal to achieve efficient execution of the image classification task.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the image classification-oriented differentiable intelligent agent optimization method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the image classification-oriented differentiable intelligent agent optimization method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • AGV task scheduling method based on multi-agent reinforcement learning

    CN118278845A

  • Expressway super-large-scale road network management and control response method based on heterogeneous multi-agent reinforcement learning

    CN120564410A