A model automatic optimization method and system based on task plug-ins and multi-layer memory

By using task plugin interfaces and multi-layer memory methods, the system core and optimization objects are decoupled, structured candidate solutions are generated and objectively evaluated, solving the problems of repetitive work and non-reproducibility in existing technologies, and achieving efficient and stable automatic model optimization.

CN123157248APending Publication Date: 2026-11-24TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611120659.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-27
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing technologies in AI-assisted software development and automated machine learning lack unified constraints, execution isolation, objective evaluation, and experimental evidence management. This results in automatically generated candidate implementations being unexecutable, unreproducible, deviating from task constraints, or merely remaining at the level of natural language suggestions. Consequently, there is a significant amount of repetitive work and reliance on manually recorded experience.

Method used

By establishing task plugin interfaces and multi-layered memory, the system core and specific optimization objects are decoupled, generating structured candidate solutions that conform to the interface contract, performing security checks and restricted execution, generating objective evaluation indicators and material evidence, and structurally saving success and failure information to multi-layered memory, updating the leaderboard, and achieving automated optimization.

Benefits of technology

It effectively reduces the cost of cross-task reuse, broadens the scope of automatic exploration, retains complete optimization data, reduces random error interference, supports the optimization of candidate solutions for various aspects such as parameters, model structure, and loss function, forms a traceable evidence closed loop, and improves the stability and efficiency of iterative optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157248A_ABST
    Figure CN123157248A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on task plug-in and the model automatic optimization method and system of multi-layer memory, it is related to artificial intelligence model automation optimization technical field, wherein the method includes: build task plug-in interface, isolate system core and various optimization objects, read configuration complete initialization;With running state, plug-in information constructs running context, outputs compliance candidate scheme;Verify scheme safety and limit execution, call plug-in evaluation scheme to generate index and supporting data;The execution result is layered and stored in memory bank, and the scheme ranking is updated, and memory, abstract, ranking is returned to generate the next round candidate, and the process is ended after circulating to meet the termination condition.The application stores historical data by layering and is matched with multiple evaluation mechanisms, which can control the data volume and reduce single random error interference, supporting long-term stable iterative optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automated optimization technology for artificial intelligence models, and in particular to an automated optimization method and system for models based on task plugins and multi-layer memory. Background Technology

[0002] Artificial intelligence-assisted software development and automated machine learning, as important technological directions, are widely used in scientific computing and industrial control for model, strategy, and parameter optimization. In the research and development of neural network models, control strategies, parameter estimation algorithms, and simulation proxy models, researchers typically need to repeatedly propose candidate structures or parameters, write candidate implementations or configurations, run training, simulations, or closed-loop control evaluations, and then continue to modify them based on experimental results. This process involves a large amount of repetitive work and relies on manual recording of experience. With the ability of large language models to generate candidate implementations and summarize techniques, it has become possible to incorporate them into candidate solution design. However, without unified constraints, execution isolation, objective evaluation, failure backfeeding, and experimental evidence management, automatically generated candidate implementations are prone to problems such as being unexecutable, unreproducible, deviating from task constraints, or merely remaining at the level of natural language suggestions. Summary of the Invention

[0003] The main objective of this invention is to provide an automatic optimization method for models based on task plugins and multi-layer memory.

[0004] Another objective of this invention is to propose an automatic model optimization device based on task plugins and multi-layer memory.

[0005] The third objective of this invention is to provide an electronic device.

[0006] A fourth objective of this invention is to provide a non-transitory computer-readable storage medium.

[0007] To achieve the above objectives, a first aspect of the present invention proposes an automatic model optimization method based on task plugins and multi-layered memory, comprising: S1. Establish a task plugin interface, decouple the system core from specific optimization objects through the task plugin interface, read and load configuration parameters, and initialize the system running state. S2, construct a controlled context based on the initial system running state and task plugin information, and generate a structured candidate solution that conforms to the interface contract; S3 performs security checks and restricted execution on structured candidate solutions, calls task plugins to objectively evaluate the candidate objects after execution, and generates evaluation indicators and material evidence. S4: Structure and save the success and failure information to multi-layer memory, update the leaderboard, and feed the working memory, compressed summary and leaderboard in the multi-layer memory to the next round of context construction steps, and end or continue according to the stopping condition.

[0008] Optionally, establish a task plugin interface, including: The interface allows the system to obtain task identifier, main indicator name, indicator direction, training or evaluation function, task background text, candidate solution constraint text, and model instantiation parameters, thereby decoupling the system core from specific optimization objects by calling the interface.

[0009] Optionally, a controlled context is constructed based on the initial system running state and task plugin information, and a structured candidate solution conforming to the interface contract is generated, including: The task background, hard constraints of candidate solutions, historical leaderboard, recent experiments, compressed summary, previous round error stack and resource budget are concatenated into controlled hints, so that the candidate solution generator can understand the task objective without deviating from the interface constraints. The candidate solution generator outputs a structured object, which includes at least the design rationale, executable candidate implementations, verifiable hypotheses, and non-random seed class hyperparameters, and the output must comply with preset key names and interface contracts.

[0010] Optionally, the structured candidate solutions undergo security verification and restricted execution. The task plugin is invoked to objectively evaluate the executed candidate objects, generating evaluation metrics and materialized evidence, including: The executable candidate implementations in the structured candidate scheme are parsed, the dependency whitelist is checked, dangerous calls are prohibited, and the candidate objects are loaded in the restricted runtime environment. After execution, the candidate implementations that meet the conditions are identified. If the candidate implementation is invalid, an error feedback is generated and the retry path is entered. Candidate objects and hyperparameters are passed to the task plugin, which generates objective indicators and material evidence according to a fixed random seed, fixed data partitioning, early stopping strategy, simulation conditions or control evaluation conditions. The main indicators are prediction error, control error integral, energy consumption, cost or success rate.

[0011] Optionally, the task plugin can be invoked to objectively evaluate the candidate objects after execution, generating evaluation metrics and materialized evidence, and may also include: Let the observed values ​​of the i-th candidate solution at N evaluation points be... The model output or target value is Control variables, state variables, or task results are The reference value is The sampling period is The evaluation indicators are then formed as follows:

[0012]

[0013]

[0014]

[0015]

[0016]

[0017]

[0018] in, The mean absolute error, The root mean square error, For the integral absolute error, Total energy consumption, For real-time operating power, To account for overall operating costs, For fixed additional costs, To improve the success rate of task execution, Complete the coverage inspection of the m-th partition for the i-th task. For the overall goal, For normalized individual indicators, It is a non-negative weight; if the task plugin declares that the smaller the metric, the better, then it is based on... Alternatively, the smallest selected primary indicator is preferred; if it is stated that the larger the indicator, the better, then the largest one is preferred.

[0019] Optionally, successful and failed results are structured and saved to multi-layered memory, the leaderboard is updated, and the working memory, compressed summary, and leaderboard in the multi-layered memory are fed back to the next round of context construction steps. The process ends or continues based on stopping conditions, including: If a candidate solution fails to execute or there are no effective evaluation metrics, the error stack, failure stage, and retry count are injected into the next round context so that the candidate solution generator can make targeted repairs and retain failure evidence even after the number of retries has been exceeded. Each round of evaluation yields a candidate solution record with a globally unique identifier. Main indicator values Advantages and disadvantages And a set of evidence including candidate implementations, parameters, logs, graphs, reports, and reproducible experimental configurations. Only when A record is included in the leaderboard only when it has a finite number of valid values ​​and the evidence set is complete. The ranking priority relationship is defined as follows:

[0020] The leaderboard is sorted by priority and retains the Top K; If batch evaluation, grid search, or multiple random seed repeated evaluation is enabled, the same candidate configuration... exist The main indicators in the repeated evaluation are first aggregated as follows:

[0021]

[0022] in, The mean, Here, S represents the standard deviation, S is the total number of repeated independent experiments, and s is the sequence number of each repeated experiment. The main indicators for comprehensive evaluation; If a smaller value is better, then choose the mean. For the minimum configuration, if a higher metric is always better, then choose the average. Maximum configuration, As a reference for stability and error band, when the difference between the main indicators of two candidate schemes is less than the preset tolerance... At that time, a lexicographical comparison is performed based on the auxiliary indicators pre-declared by the task plugin; The most recent K experiments are used as working memory. When the working memory exceeds its capacity, earlier experiments are compressed into summaries. All experiments are saved in the disk evidence layer. The next round of prompts uses working memory, compressed summaries, and leaderboards simultaneously.

[0023] To achieve the above objectives, a second aspect of the present invention provides an automatic model optimization device based on task plugins and multi-layer memory, comprising: The initialization unit is used to establish the task plugin interface, decouple the system core from specific optimization objects through the task plugin interface, read and load configuration parameters, and initialize the system running state. The construction unit is used to construct a controlled context based on the initialization system running state and task plugin information, and generate a structured candidate solution that conforms to the interface contract. The evaluation unit is used to perform security verification and restricted execution on structured candidate solutions, and calls the task plugin to objectively evaluate the candidate objects after execution, generating evaluation indicators and material evidence. The update unit is used to structure and save success and failure information to multi-layer memory, update the leaderboard, and feed the working memory, compressed summary and leaderboard in the multi-layer memory to the next round of context construction steps, and end or continue according to the stopping condition.

[0024] Regarding the apparatus in the above embodiments, the specific manner in which each unit performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0025] To achieve the above objectives, a third aspect of this application provides an electronic device, including a processor and a memory; wherein the processor runs a program corresponding to the executable program code by reading executable program code stored in the memory, for implementing the automatic optimization method for a model based on task plug-ins and multi-layer memory as described in the first aspect embodiment.

[0026] To achieve the above objectives, a fourth aspect of this application provides a non-transitory computer-readable storage medium storing a computer program that, when executed by a processor, implements the automatic optimization method for a model based on task plug-ins and multi-layer memory as described in the first aspect embodiment.

[0027] The embodiments of the present invention have the following beneficial effects: This invention relies on task plugins to carry various core modules. Changing the optimization object only requires replacing the plugin, without rebuilding the entire process, effectively reducing the cost of cross-task reuse. It can support multiple types of content such as parameters, model structure, and loss function as candidate solutions, and at the same time, it relies on output contracts and execution constraints to filter invalid solutions, thus broadening the scope of automatic exploration. It completely retains all data from each round of optimization, forming a traceable evidence loop, which facilitates review and reproduction of experiments. It stores historical data in layers and is equipped with multiple evaluation mechanisms, which can control the data volume and reduce the interference of single random errors, supporting long-term stable iterative optimization. Attached Figure Description

[0028] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 A flowchart illustrating an automatic model optimization method based on task plugins and multi-layer memory, provided for an embodiment of the present invention; Figure 2 A structural diagram of an automatic model optimization system based on task plugins and multi-layer memory provided in an embodiment of the present invention; Figure 3 A multi-layered memory and evidence closed-loop diagram provided in the embodiments of the present invention; Figure 4 This is a structural diagram of an automatic model optimization device based on task plugins and multi-layer memory, provided in an embodiment of the present invention. Detailed Implementation

[0029] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0030] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0031] The following description, with reference to the accompanying drawings, describes an automatic model optimization method and apparatus based on task plugins and multi-layer memory, according to embodiments of the present invention.

[0032] Example 1 This invention provides an automatic model optimization method based on task plugins and multi-layered memory, such as... Figure 1 As shown, the method includes the following steps: S1. Establish a task plugin interface, decouple the system core from specific optimization objects through the task plugin interface, read and load configuration parameters, and initialize the system running state.

[0033] To overcome the shortcomings of traditional optimization systems, such as high coupling, non-standard data interaction, and inability to resume from breakpoints, this application achieves system and task decoupling through a layered architecture and standardized task plugin interfaces, and completes configuration loading and historical state restoration.

[0034] The overall architecture of this application is divided into six layers: task configuration layer, state diagram orchestration layer, candidate solution generation layer, restricted execution layer, task evaluation layer, and evidence memory layer. Information interaction and data transfer between each layer are uniformly completed through standardized structured state objects, completely abandoning the inefficient and non-standard interaction methods of traditional systems that rely on manual log copying and free text descriptions to transmit results. This achieves full-process data structuring, traceability, and reusability. It should be understood that this embodiment uses a six-layer independent hierarchical architecture as an illustrative example. In other embodiments, adjacent functional layers can be merged or split, and auxiliary scheduling layers can be added. Such equivalent variations of the architecture also fall within the protection scope of this invention.

[0035] In this embodiment, a standardized task plugin interface is first established. Based on the task plugin interface, the system core and specific optimization tasks are completely decoupled, so that the system core will not be directly bound to a fixed neural network structure, a fixed dataset or a specific simulator, but will complete the entire process scheduling and operation by uniformly calling the standardized interface exposed by the task plugin.

[0036] In this embodiment, the task plugin interface standardizes and defines a number of core parameters and functional units, including a unique task identifier, optimization main indicator name, indicator quality judgment direction, dedicated training or evaluation function, task background description text, candidate solution constraint text, and model instantiation configuration parameters, which can adapt to various differentiated optimization scenarios such as prediction tasks, control tasks, energy consumption optimization tasks, cost optimization tasks, and success rate optimization tasks.

[0037] In this embodiment, after the task plugin interface is built, the global configuration reading and system state initialization operations are performed. The system automatically reads the complete configuration parameters preset by the user, including key configuration items such as refined task configuration information, maximum number of optimization iterations, language model provider type, experimental result storage directory, upper limit of scheme retry times, hyperparameter grid search range, and maximum working memory capacity.

[0038] In this embodiment of the application, in order to ensure that the iterative optimization process can continue without losing data and has the ability to iterate over a long period of time, the system of this application automatically restores historical running data during the initialization phase, including the historical best solution ranking list, experimental compressed summary, recent batch experimental records, and incomplete iteration breakpoint data. Based on the above restored data, the system integrates and generates a complete structured running state of the current iteration round, providing complete initial state support for subsequent context construction, candidate solution generation, experimental execution, and result evaluation.

[0039] In this embodiment, by constructing a six-layer structured interaction architecture, defining standardized task plugin interfaces, reading global configurations, and restoring historical breakpoint data, system initialization and task decoupling are achieved, laying the foundation for subsequent iterative optimization.

[0040] S2 constructs a controlled context based on the initialization system running state and task plugin information, and generates a structured candidate solution that conforms to the interface contract.

[0041] To avoid generating unconstrained natural language schemes and reduce invalid iterations, this application integrates multi-dimensional historical and constraint information to construct a controlled context and outputs structured candidate objects, with a grid search to complete refined hyperparameter optimization.

[0042] This application abandons the traditional, singular, one-sided, and unconstrained prompt construction method, and adopts a multi-dimensional information fusion and splicing approach to construct a standardized and controlled prompt context. In the embodiments of this application, the system fully retrieves the task background information and candidate solution hard constraints carried by the task plugin, and simultaneously integrates the optimal solution ranking list accumulated from the historical iteration process, recent complete experimental data, long-term experimental compressed summaries, error stack information generated in the previous iteration, and the current system real-time resource budget information. This multi-type heterogeneous information is structured, organized, and orderly spliced ​​to ultimately form a generated prompt context that is uniform in format, comprehensive in dimensions, logically standardized, and clearly constrained.

[0043] In this embodiment, through the constraints and guidance of this structured and controlled context, the backend candidate solution generator can comprehensively and accurately grasp the task optimization goals of the current iteration round, the clear task constraint boundaries, the optimization experience accumulated from multiple historical iterations, and the hardware resources and computing power limitations of the current system. This context construction method enables each round of solution generation to have complete iterative continuity and historical reference, optimize solution design based on historical effective experimental experience, avoid historical iteration defects based on error stack information, and strictly limit the scope of solution generation, eliminating invalid solution generation that deviates from task interface specifications, violates hardware operating conditions, or does not conform to algorithm design logic. This reduces the number of invalid experimental iterations from the source and improves the iterative efficiency and convergence speed of the overall automated optimization process.

[0044] After completing the controlled context construction, this application uses a candidate solution generator driven by a complete and standardized controlled context to complete the iterative generation of solutions. The candidate solution generator of this application no longer outputs unstructured natural language suggestions commonly used in traditional models, but uniformly outputs fully structured and standardized structured objects, which completely changes the shortcomings of traditional solution outputs that are coarse, cannot be parsed by machines, cannot be automatically executed, and cannot be quantitatively verified.

[0045] In this embodiment, the structured candidate solution object generated strictly adheres to the system's preset key name rules and unified interface contract, ensuring that the output content can be automatically recognized, parsed, and invoked by the system. In this embodiment, the structured candidate solution object includes at least four core elements: the rationale for the solution design, directly deployable candidate implementation code, quantifiable and verifiable technical assumptions, and non-random seed class hyperparameter configurations. In this embodiment, through a standardized and structured solution output format, the architecture ensures that each iteration's generated candidate solution possesses parsability, verifiability, executableness, and reproducibility, laying a solid structural foundation for subsequent stages of security verification, restricted loading, automated execution, and quantitative evaluation, achieving fully automated closed-loop operation.

[0046] In this embodiment, as a preferred implementation, the system incorporates a built-in grid search module for refined hyperparameter optimization based on a determined structural solution. In this embodiment, the candidate solution generator first outputs the overall structural optimization scheme, completing the main design of the algorithm structure, network architecture, and control logic. Then, based on the built-in grid search module, the system conducts batch repeated evaluation experiments within a preset range of hyperparameter combinations, combined with multiple sets of random seeds. By using a fixed structure, traversing hyperparameters, and repeatedly verifying with multiple sets of seeds, refined parameter optimization can be achieved while ensuring the stability and reliability of the main scheme. This effectively reduces the interference of random errors on the experimental results, significantly improves the global optimality of the final selected scheme and the statistical robustness of the experimental results, and further enhances the iterative accuracy and generalization capability of the automated optimization system.

[0047] In this embodiment, a controlled prompting context is constructed by splicing multi-source information, a standardized solution object conforming to the interface contract is generated, and a grid search traversal hyperparameter is built in, so as to realize the automatic generation of compliant and executable candidate solutions, laying the foundation for subsequent objective evaluation.

[0048] S3 performs security checks and restricted execution on structured candidate solutions, calls task plugins to objectively evaluate the candidate objects after execution, and generates evaluation indicators and material evidence.

[0049] To mitigate security risks during implementation, standardize quantitative evaluation criteria across multiple scenarios, and enable automatic fault tolerance and repair, this application establishes a full-link processing flow for sandbox verification execution, plug-in standardized indicator calculation, and failure retry.

[0050] For structured candidate solutions, this application's system first performs security verification and dynamic loading processing. In this embodiment, the system performs complete syntax parsing and compliance screening on all executable implementations corresponding to the candidate solutions. Simultaneously, based on a pre-defined dependency whitelist mechanism, it completes comprehensive legality verification, strictly blocking candidate solution code containing dangerous calls, illegal syntax structures, or unauthorized dependency references. This eliminates security issues such as system crashes, memory overflows, illegal resource consumption, and malicious program execution caused by abnormal code execution from the system's underlying layer, greatly improving the overall security and stability of the automated iteration process.

[0051] In this embodiment, all legitimate candidate implementations that pass security verification will be dynamically loaded and automatically run in a restricted operating environment configured independently by the system. This restricted environment has the characteristics of resource isolation, permission restriction, and sandbox protection, which can further avoid the risk of illegal operation.

[0052] In this embodiment, the system can automatically identify and mark all valid candidate solutions that pass the verification and can run normally. For candidate solutions with illegal issues such as syntax errors, dependency violations, logical defects, and runtime conflicts, the system can automatically generate standardized structured error feedback information and actively trigger the preset retry path, so that the current iteration process enters the failure retry iteration mechanism, and completes the abnormal response without manual intervention.

[0053] In this application embodiment, valid candidate objects that have completed multi-layer security verification and environment adaptation, along with all hyperparameter configurations corresponding to the candidate schemes, will be uniformly and completely transmitted into the task plugin of this application. Based on the standardized adaptation capabilities of the task plugin, this application automates the entire process of model training, system simulation, algorithm evaluation, and performance testing according to a unified and solidified standardized execution specification.

[0054] To completely eliminate the interference of random factors on experimental results and ensure the fairness and consistency of multi-round iterative experiments and comparison evaluation of multiple candidate schemes, this application uses a task plugin to uniformly fix the random seed, fixed dataset partitioning rules, fixed early training stopping strategy, fixed simulation environment parameters, and fixed control evaluation conditions. This ensures that the execution environment, data source, and termination conditions of each experiment are completely unified, effectively avoiding evaluation bias caused by inconsistent experimental conditions, and stably outputting objective quantitative indicators with high credibility and complete material experimental evidence.

[0055] The task plugin of this application possesses strong scenario adaptability and is compatible with various types of optimization master metrics, comprehensively covering various task evaluation dimensions such as prediction error evaluation, control error integral evaluation, system energy consumption optimization, operating cost optimization, and task success rate optimization. In the embodiments of this application, the task plugin accurately declares the name of the master metric for the current optimization task through the metric_name parameter, and explicitly declares the direction of judgment of the corresponding metric's merits through the metric_higher_is_better parameter. Finally, it uniformly outputs the master metric and various auxiliary evaluation metrics in a structured data format, realizing the visualization, configurability, and unification of evaluation standards.

[0056] In this embodiment, to achieve unified quantitative evaluation across all scenarios, this application configures multiple standardized quantitative evaluation formulas to accurately calculate experimental indicators across different dimensions. In this embodiment, the observed value of the i-th candidate solution at N evaluation points is set as... The model output or target value is Control variables, state variables, or task results are The reference base value is The system sampling period is .

[0057] The magnitude of the model's prediction bias is quantified by calculating the mean absolute error of the prediction.

[0058] The discrete error characteristics of the model prediction are characterized by calculating the root mean square error of the prediction:

[0059] The dynamic deviation performance of the control system is evaluated by calculating the integral absolute error of the control:

[0060] By statistically analyzing the total energy consumption of the system, a quantitative evaluation of energy consumption can be achieved.

[0061] By calculating the overall operating cost of the system, taking into account both energy consumption costs and model deployment costs:

[0062] The overall task completion effect is evaluated by calculating the task execution success rate.

[0063] in, The mean absolute error, The root mean square error, For the integral absolute error, Total energy consumption, For real-time operating power, To account for overall operating costs, For fixed additional costs, To improve the success rate of task execution, Complete the coverage inspection of the m-th partition for the i-th task.

[0064] To achieve integrated evaluation of multi-dimensional indicators, this application further constructs a comprehensive evaluation objective. The corresponding calculation formula is:

[0065] in, For normalized individual indicators, Let be the weighting coefficient, satisfying and The system integrates multiple individual indicators into a unified comprehensive score through weighted fusion, thereby achieving quantitative judgment of multi-objective optimization. In this embodiment, the system strictly judges the performance of candidate solutions based on the indicator superiority / inferiority direction pre-declared by the task plugin. If the task indicator is of the "smaller is better" type, then... The optimal criterion is the minimum value of the composite value or the preset main indicator; if the task indicator is of the type where the larger the better, then... The comprehensive value or the maximum value of the preset main indicator is used as the optimal judgment standard.

[0066] In the embodiments of this application, different prediction models, optimization algorithms, and control strategies only need to replace the business meaning of the corresponding variables within the task plugin. Without modifying the generation logic, execution logic, and evaluation logic of the main system, the entire generation, execution, evaluation, and evidence closed-loop process can be fully reused, making the system of this application highly versatile, portable, and scalable.

[0067] In this embodiment, when candidate solutions encounter abnormal situations such as execution errors, runtime anomalies, program interruptions, or inability to generate effective evaluation metrics, the system can automatically capture error stack information, locate the specific failure stage, count the current number of retries, and inject the aforementioned abnormal data into the next iteration context in a structured manner. The candidate solution generator can quickly locate the root cause of solution defects based on accurate abnormal information, and perform targeted solution correction and iterative optimization, effectively improving problem-solving efficiency.

[0068] In this embodiment, even if the number of retries reaches the system's preset limit and the system still cannot execute normally, the system will still retain all data such as the corresponding failure evidence, error logs, and solution parameters. This completely avoids the problem of losing abnormal information during the iteration process, ensuring that the entire automated optimization process is traceable, reviewable, and analyzable, and further improves the closed-loop iterative optimization system of this application.

[0069] In this embodiment, the candidate solution is evaluated automatically and securely through syntax and dependency whitelist security checks, restricted sandbox isolation operation, fixed experimental conditions combined with multiple sets of unified evaluation formulas for quantitative scoring, and failure information injection into the context for retry, laying the foundation for subsequent leaderboard updates.

[0070] S4: Structure and save the success and failure information to multi-layer memory, update the leaderboard, and feed the working memory, compressed summary and leaderboard in the multi-layer memory to the next round of context construction steps, and end or continue according to the stopping condition.

[0071] To overcome the shortcomings of traditional optimization systems, such as lack of iterative memory, coarse convergence control, and inability to continuously iterate, this application constructs a three-layer memory maintenance mechanism and a two-layer stopping decision strategy to achieve cross-session continuous optimization and precise convergence control.

[0072] In this embodiment, the system is specifically divided into a three-level memory storage structure: working memory, compressed summary long-term memory, and full disk evidence memory. In this embodiment, the system completely saves the data from the K most recent complete iterations of experiments, constructing a high-precision working memory. This level of memory fully retains the fine-grained parameters, scheme details, operating status, evaluation indicators, and failure / defect information of recent experiments, providing accurate and detailed reference for the next round of candidate scheme generation, ensuring the continuity and relevance of iterative optimization.

[0073] In this embodiment, when the amount of data stored in the working memory exceeds the system's preset capacity limit, the system does not directly discard early valid experimental data. Instead, it automatically performs intelligent compression and summary extraction on the earlier historical experimental data, transforming the complex full experimental data into a lightweight, highly generalized long-term memory summary. This effectively avoids the problem of infinite expansion of the iteration context while fully preserving long-term iteration patterns, continuously ensuring the overall iteration efficiency of the system. Simultaneously, the system persistently stores all original experimental data from all iteration rounds on the disk evidence layer, achieving permanent retention of all experimental data. This fully supports subsequent experimental auditing, result tracing, model reproduction, scheme review, and manual verification, greatly improving the rigor and traceability of the entire optimization framework.

[0074] In the embodiments of this application, during each round of context construction, the application simultaneously calls and integrates three types of core data resources: working memory, compressed summary, and global best leaderboard. It obtains the latest experimental details and failure experience based on short-term working memory, grasps the overall iterative optimization trend and global rules based on long-term compressed summary, and anchors the current best optimization benchmark based on the leaderboard. It takes into account both short-term iterative details and long-term iterative rules, realizes continuous iterative optimization across processes and sessions, and completely overcomes the technical defects of traditional optimization frameworks that start from scratch every time and cannot reuse historical experience.

[0075] In this embodiment, the system completes full-dimensional evidence updates and data archiving for each round of iterative experiments. The system uniformly and structurally stores various core data generated in each iteration, specifically including executable implementation code for candidate solutions, standardized structured evaluation metrics, rationale for solution design, quantifiable and verifiable technical hypotheses, complete input and output data of the generator, model training convergence curves, experimental evaluation visualization charts, trained model and strategy artifacts, multi-solution comparative analysis reports, and a complete artifact list. While archiving the data, the system iteratively updates the global optimal solution ranking list and session-level metric trend charts in real time, intuitively presenting the evolution process and performance change patterns of the entire iterative optimization process.

[0076] In this embodiment, the leaderboard constructed is entirely driven by the primary metrics pre-declared by the task plugin, ensuring a high degree of consistency between the leaderboard selection rules and the task optimization goals. In this embodiment, each valid candidate solution obtained from each round of iterative evaluation is recorded by the system with a globally unique identifier. The corresponding main indicator value Direction for judging the merits of indicators and a complete set of evidence The evidence set Specifically, it covers a complete set of experimental materials, including candidate implementation code, hyperparameter configuration, runtime logs, visualization charts, experimental reports, and reproducible experimental configurations.

[0077] In this embodiment of the application, the system sets a strict ranking admission mechanism, only allowing entries when the main indicator value is [not specified]. For finite effective values ​​and evidence set Only when all candidate solutions are complete and without missing data can they enter the leaderboard for optimal ranking, effectively preventing invalid or incomplete data from interfering with the leaderboard's accuracy. The system pre-sets a strict priority relationship for solution ranking, specifically satisfying the rule that 'a' is superior to 'b':

[0078] The system sorts the listed solutions according to this rule and continuously retains the top K best solutions, thus achieving continuous accumulation and screening of high-quality solutions.

[0079] In this embodiment, for high-precision optimization scenarios such as grid search, batch evaluation, and repeated evaluation with multiple random seeds, this application supports statistical aggregation optimization of experimental results for the same candidate configuration, effectively eliminating the impact of random experimental errors on the evaluation results. For S independent repeated evaluation experiments of the same candidate configuration q, the mean and standard of multiple sets of experimental indicators are obtained through formulas:

[0080]

[0081] in, The mean, Here, S represents the standard deviation, S is the total number of repeated independent experiments, and s is the sequence number of each repeated experiment. The main indicators are used for comprehensive evaluation.

[0082] In this embodiment, the system performs optimal configuration filtering based on task indicator attributes. If the current task indicator is of the "smaller is better" type, the average value is selected. The smallest candidate configuration; if the current task metric is of the type where larger is better, then the average value is selected. The largest candidate configuration, along with the calculated standard deviation. This serves as a core reference for the stability of the scheme's operation and the experimental error band.

[0083] In this embodiment of the application, when the difference in the main indicators of the two candidate schemes is less than the preset tolerance When the primary metrics cannot distinguish between superior and inferior solutions, the system automatically performs a lexicographical comparison based on auxiliary metrics pre-configured in the task plugin, such as constraint violation rate, resource consumption, execution time, model complexity, result variance, and evidence completeness. This accurately differentiates the performance differences between solutions, and the optimal solution selected at the end must retain a complete set of evidence. This ensures that the optimal selection results are traceable, reproducible, and verifiable.

[0084] This phase innovatively integrates a dual-layer intelligent stopping mechanism that combines an outer global optimization loop with an inner training sub-process, achieving full-dimensional and refined convergence control from global iteration to single model training, effectively avoiding invalid iterations, wasted computing resources, and model overfitting.

[0085] In this embodiment of the application, the number of valid experiments completed in the r-th round is defined as r, and the maximum preset number of iteration rounds is . Resource budget consumption is The system budget limit is Manual interruption flag is The completion of batch evaluation and grid search is marked as The convergence count of the most recent P rounds of iterations is The outer global iteration stop function configured in this application is:

[0086] In this embodiment of the application, when the batch grid search is completed, the flag indicates that the search is complete. When the value is 0, it indicates that the current batch evaluation experiment or grid search task has not been fully completed. The system will maintain the current experiment number and continue to complete the remaining experiment content based on the breakpoint resume mechanism, without generating new candidate solutions, effectively ensuring the integrity of the batch experiment; only when A value of 1 indicates that the current batch of experiments will be counted in the total number of valid iterations only when the current batch of experiments is completely completed, ensuring the accuracy and standardization of iteration count statistics.

[0087] In this embodiment, the system dynamically updates the convergence count based on different performance indicators. For metrics where smaller is better, define the historical best metric. The corresponding formula for calculating the indicator improvement rate is: For metrics where larger is always better, define the historical best metric. The corresponding formula for calculating the indicator improvement rate is: .

[0088] In this embodiment of the application, the system presets an improvement rate threshold. If the calculated improvement rate Less than the threshold If no effective optimization is achieved in this iteration, the convergence count is reduced. Increment by one; otherwise, the count will converge. Reset to zero; when convergence count... If the preset value P is reached for multiple consecutive rounds, or if no effective evaluation index is produced for P consecutive rounds of iteration, the system determines that the global iteration has reached a convergence state and automatically terminates the global optimization process.

[0089] In this embodiment, a dedicated, refined early stopping rule is set for the inner model training sub-process to further optimize the single training effect and save computing resources. In this embodiment, the validation loss for the e-th training round is defined as... The threshold for minimizing model loss is The training patience value is patience, and the initial training no-improvement count is used. During training, if the current round of validation loss... Less than the optimal loss in the previous round With minimum improvement threshold If the difference is less than or equal to the target value, the training round is considered to have effectively optimized the system, and the count of no improvement is reset to zero; otherwise, the training round is considered to have no optimization effect, and the count of no improvement is accumulated.

[0090] In this embodiment of the application, when training does not improve the counting... When the training stops early, the training mechanism is triggered when the patience value is greater than or equal to the preset patience value. The model training process is terminated early to avoid model overfitting and ineffective computing power consumption. At the same time, the model parameters, weight data and quantitative evaluation indicators corresponding to the optimal training round are written into the evidence layer for persistent storage.

[0091] After completing a single full-link closed-loop iteration process, the system will determine in real time whether the current iteration state meets various preset stopping conditions. In this embodiment, if any stopping condition is not met, the system will automatically jump to stage S3 and start a new round of candidate solution execution, evaluation, and iterative optimization process, continuously running in a closed loop; if the system determines that the iteration stopping condition is met, it will immediately terminate the entire iterative optimization process and output the final optimal solution obtained during the entire iteration process, as well as a complete set of experimental evidence data.

[0092] In this embodiment, a three-layer hierarchical memory structure is built to reuse the experience of long and short cycle iterations, an inner and outer double-layer convergence judgment rule is adopted to accurately terminate the iteration, and a closed-loop loop is used to execute multiple rounds of optimization, thereby achieving highly robust, traceable, and fully automatic intelligent iterative optimization.

[0093] Example 2 This invention relates to an automatic model optimization system based on task plugins and multi-layered memory, such as... Figure 2 As shown, it includes a task configuration layer, a state diagram orchestration layer, a candidate solution generation layer, a constrained execution layer, a task evaluation layer, and an evidence memory layer. Information is exchanged between these layers through structured state objects, rather than through manually copied logs or free text descriptions.

[0094] Multi-layered memory is a key feature that distinguishes this solution from ordinary loop scripts, such as... Figure 3 As shown, the first layer retains a complete summary of recent experiments, facilitating the candidate generator to reference fine-grained metrics and failure modes; the second layer retains compressed long-term experience to prevent the context from growing indefinitely; and the third layer stores a complete evidence catalog for auditing, reproduction, and manual review. This mechanism enables the automated optimization process to continue across processes and sessions, rather than starting from scratch with each run.

[0095] The process of this invention does not provide suggestions all at once, but rather forms a loop around the objective evaluation results. This loop allows candidate solutions to vary at both the structural and hyperparameter levels; it also allows for more robust evaluation results to be obtained through parameter combination evaluation, multiple random seed repetition, and breakpoint continuation running while keeping the candidate solutions unchanged.

[0096] This invention provides an automatic model optimization device 10 based on task plugins and multi-layer memory, such as... Figure 4 As shown, the device includes: Initialization unit 100 is used to establish a task plugin interface, decouple the system core from specific optimization objects through the task plugin interface, read and load configuration parameters, and initialize the system running state. Construction unit 200 is used to construct a controlled context based on the initialization system running state and task plugin information, and generate a structured candidate solution that conforms to the interface contract. Evaluation unit 300 is used to perform security verification and restricted execution on structured candidate solutions, call task plugins to objectively evaluate the candidate objects after execution, and generate evaluation indicators and material evidence. The update unit 400 is used to structurally save the success and failure information to the multi-layer memory, update the leaderboard, and feed the working memory, compressed summary and leaderboard in the multi-layer memory to the next round of context construction steps, and end or continue according to the stopping condition.

[0097] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0098] Example 4 To implement the methods of the above embodiments, the present invention also provides an electronic device, which includes a memory and a processor; wherein the processor reads executable program code stored in the memory to run a program corresponding to the executable program code, so as to implement the various steps of the methods described above.

[0099] Example 5 To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the method described in the foregoing embodiments.

[0100] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

[0101] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0102] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

Claims

1. An automatic model optimization method based on task plugins and multi-layer memory, characterized in that, include: S1. Establish a task plugin interface, decouple the system core from specific optimization objects through the task plugin interface, read and load configuration parameters, and initialize the system running state. S2, construct a controlled context based on the initial system running state and task plugin information, and generate a structured candidate solution that conforms to the interface contract; S3 performs security checks and restricted execution on structured candidate solutions, calls task plugins to objectively evaluate the candidate objects after execution, and generates evaluation indicators and material evidence. S4: Structure and save the success and failure information to multi-layer memory, update the leaderboard, and feed the working memory, compressed summary and leaderboard in the multi-layer memory to the next round of context construction steps, and end or continue according to the stopping condition.

2. The method according to claim 1, characterized in that, The task creation plugin interface includes: The interface allows the system to obtain task identifier, main indicator name, indicator direction, training or evaluation function, task background text, candidate solution constraint text, and model instantiation parameters, thereby decoupling the system core from specific optimization objects by calling the interface.

3. The method according to claim 1, characterized in that, The process of constructing a controlled context based on the initialization system running state and task plugin information, and generating structured candidate solutions that conform to the interface contract, includes: The task background, hard constraints of candidate solutions, historical leaderboard, recent experiments, compressed summary, previous round error stack and resource budget are concatenated into controlled hints, so that the candidate solution generator can understand the task objective without deviating from the interface constraints. The candidate solution generator outputs a structured object, which includes at least the design rationale, executable candidate implementations, verifiable hypotheses, and non-random seed class hyperparameters, and the output must comply with preset key names and interface contracts.

4. The method according to claim 1, characterized in that, The process involves performing security checks and restricted execution on structured candidate solutions, invoking a task plugin to objectively evaluate the executed candidate objects, and generating evaluation metrics and materialized evidence, including: The executable candidate implementations in the structured candidate scheme are parsed, the dependency whitelist is checked, dangerous calls are prohibited, and the candidate objects are loaded in the restricted runtime environment. After execution, the candidate implementations that meet the conditions are identified. If the candidate implementation is invalid, an error feedback is generated and the retry path is entered. Candidate objects and hyperparameters are passed to the task plugin, which generates objective indicators and material evidence according to a fixed random seed, fixed data partitioning, early stopping strategy, simulation conditions or control evaluation conditions. The main indicators are prediction error, control error integral, energy consumption, cost or success rate.

5. The method according to claim 1, characterized in that, The task plugin is invoked to objectively evaluate the candidate objects after execution, generating evaluation indicators and materialized evidence, and also includes: Let the observed values ​​of the i-th candidate solution at N evaluation points be... The model output or target value is Control variables, state variables, or task results are The reference value is The sampling period is The evaluation indicators are then formed as follows: in, The mean absolute error, The root mean square error, For the integral absolute error, Total energy consumption, For real-time operating power, To account for overall operating costs, For fixed additional costs, To improve the success rate of task execution, Complete the coverage inspection of the m-th partition for the i-th task. For the overall goal, For normalized individual indicators, The weights are non-negative; if the task plugin declares that the smaller the metric, the better, then... Alternatively, the smallest selected primary indicator is preferred; if it is stated that the larger the indicator, the better, then the largest one is preferred.

6. The method according to claim 1, characterized in that, The process of structurally saving success and failure information to multi-layered memory, updating the leaderboard, and feeding back the working memory, compressed summary, and leaderboard from the multi-layered memory to the next round of context construction steps, ending or continuing based on stopping conditions, includes: If a candidate solution fails to execute or there are no effective evaluation metrics, the error stack, failure stage, and retry count are injected into the next round context so that the candidate solution generator can make targeted repairs and retain failure evidence even after the number of retries has been exceeded. Each round of evaluation yields a candidate solution record with a globally unique identifier. Main indicator values Advantages and disadvantages And a set of evidence including candidate implementations, parameters, logs, graphs, reports, and reproducible experimental configurations. Only when A record is included in the leaderboard only when it has a finite number of valid values ​​and the evidence set is complete. The ranking priority relationship is defined as follows: The leaderboard is sorted by priority and retains the Top K; If batch evaluation, grid search, or multiple random seed repeated evaluation is enabled, the same candidate configuration exist The main indicators in the repeated evaluation are first aggregated as follows: in, The mean, Here, S represents the standard deviation, S is the total number of repeated independent experiments, and s is the sequence number of a single repeated experiment. The main indicators for comprehensive evaluation; If a smaller value is better, then choose the mean. For the minimum configuration, if a higher metric is always better, then choose the average. Maximum configuration, As a reference for stability and error band, when the difference between the main indicators of two candidate schemes is less than the preset tolerance... At that time, a lexicographical comparison is performed based on the auxiliary indicators pre-declared by the task plugin; The most recent K experiments are used as working memory. When the working memory exceeds its capacity, earlier experiments are compressed into summaries. All experiments are saved in the disk evidence layer. The next round of prompts uses working memory, compressed summaries, and leaderboards simultaneously.

7. A model automatic optimization device based on task plugins and multi-layer memory, characterized in that, include: The initialization unit is used to establish the task plugin interface, decouple the system core from specific optimization objects through the task plugin interface, read and load configuration parameters, and initialize the system running state. The construction unit is used to construct a controlled context based on the initialization system running state and task plugin information, and generate a structured candidate solution that conforms to the interface contract. The evaluation unit is used to perform security verification and restricted execution on structured candidate solutions, and calls the task plugin to objectively evaluate the candidate objects after execution, generating evaluation indicators and material evidence. The update unit is used to structure and save success and failure information to multi-layer memory, update the leaderboard, and feed the working memory, compressed summary and leaderboard in the multi-layer memory to the next round of context construction steps, and end or continue according to the stopping condition.

8. An electronic device, characterized in that, Including processor and memory; The processor reads executable program code stored in the memory to run a program corresponding to the executable program code, so as to implement the method as described in any one of claims 1-6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-6.