Agent-based model post-training method, device, equipment and medium
Patent Information
- Application Number
- CN202611067555.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-17
- Publication Date
- 2026-10-09
AI Technical Summary
[0006]本发明提供一种基于智能体的模型后训练方法、装置、设备及介质,以解决模型后训练分析时效率较低的问题
[0011]在本发明中,通过自研智能体实例对自身的物理计算资源和任务执行时间条件进行盘点、检索外部知识并自主编译训练流水线代码、在执行过程中实时捕获报错日志并进行闭环错误修复、在训练中根据中间指标和任务性质动态演进训练范式与微调策略,通过独立审计智能体对训练产物进行全量合规性审查,从而实现了端到端的模型后训练自动化,显著降低了对人类专家经验的依赖,提升了研发效率与模型的可信度。用户只需提供高层目标与资源约束,系统即可自主完成从数据检索、策略制定、代码编写到模型优化的全过程,并在严格的防作弊框架下确保性能的真实性,从而实现了从人力驱动迭代到智能体自主演进的研发范式转变可以解决模型后训练分析时效率较低的问题。
Smart Images

Figure CN122885501A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent decision-making technology, and in particular to a model post-training method, apparatus, device, and medium based on intelligent agents. Background Technology
[0002] Currently, large language models (LLMs) have become the core driving force for the development of artificial intelligence. They evolve from basic pre-trained models into practical assistants with specific capabilities that conform to human instructions and values. The key link is post-training, which includes a series of complex alignment and capability enhancement processes such as supervised fine-tuning and reinforcement learning from human feedback.
[0003] In the healthcare field, post-training of models often involves tasks such as medical question answering, diagnostic assistance, and medical record summary generation. These tasks place extremely high demands on the accuracy, security, and compliance of the models. When fine-tuning medical models, researchers often need to manually search and organize the latest datasets from medical literature and manually write decontamination logic to remove samples that overlap with the test set. This entire process takes weeks and is highly prone to errors. More seriously, due to the lack of automated anti-cheating mechanisms, developers may unintentionally or intentionally mix test samples from medical evaluation benchmarks into the training data, leading to inflated model evaluation scores and questionable actual clinical generalization ability. The lack of an auditable R&D black box makes it difficult for medical institutions to trust whether the trained model truly possesses safe and reliable reasoning capabilities.
[0004] In the fintech sector, post-training of models is widely used in scenarios such as financial statement sentiment analysis, financial named entity recognition, credit risk assessment, and robo-advisor dialogue. Financial data is highly sensitive and time-sensitive, and regulatory agencies have strict requirements for the traceability and compliance of models. R&D teams need to manually configure the training process, manually process noisy data in financial texts, and repeatedly adjust hyperparameters to adapt to the data distribution of different financial institutions. Furthermore, evaluation benchmarks in the financial field often contain proper nouns specific to certain financial reporting periods. Developers may reverse engineer test set formats to generate training samples containing the same proper nouns, thereby misrepresenting the model's true performance.
[0005] The shortcomings of existing post-training techniques lie in their heavy reliance on human experience, leading to low R&D efficiency; their rigid and fixed training paradigms and strategies, which cannot be dynamically adjusted based on real-time feedback; and the severe lack of built-in automated anti-fraud auditing mechanisms. These deficiencies make it difficult to achieve efficient, reliable, and scalable large-scale production of post-training models. Therefore, there is an urgent need for a solution that starts from high-level objectives, allows intelligent agents to autonomously complete the entire process orchestration, and incorporates built-in compliance auditing. Summary of the Invention
[0006] This invention provides a method, apparatus, device, and medium for post-training of models based on intelligent agents, in order to solve the problem of low efficiency in post-training analysis.
[0007] Firstly, a post-training method for a model based on an agent is provided, the method comprising: When the pre-defined self-developed intelligent agent instance receives the target optimization task of the target model, it takes stock of the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself. Based on the inventory of physical computing resources and task execution time conditions, retrieve the external knowledge corresponding to the target optimization task, generate the training process corresponding to the target optimization task based on the external knowledge, and compile the training process into the training pipeline code corresponding to the target model; The training pipeline code is executed, and error logs are acquired in real time during the execution of the training pipeline code. Errors in the training pipeline code are corrected based on the error logs to obtain the target training code. The target model is trained using the target training code, and intermediate metrics and task properties are obtained during the model training process. The training parameters of the target model are dynamically evolved based on the intermediate metrics and task properties to obtain the target training parameters. A full compliance audit is performed on the target training parameters and the target training code. When the full compliance audit is passed, the model parameters of the target model are adjusted according to the target training parameters to obtain the trained target model.
[0008] Secondly, a post-training device for a model based on an intelligent agent is provided, the device comprising: The resource inventory module is used to inventory the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself after the preset self-developed intelligent agent instance receives the target optimization task of the target model. The training process compilation module is used to retrieve external knowledge corresponding to the target optimization task based on the inventory of physical computing resources and task execution time conditions, generate the training process corresponding to the target optimization task based on the external knowledge, and compile the training process into the training pipeline code corresponding to the target model. The training pipeline error repair module is used to execute the training pipeline code, acquire error logs in real time during the execution of the training pipeline code, and repair errors in the training pipeline code according to the error logs to obtain the target training code; The dynamic policy evolution module is used to train the target model using the target training code, obtain intermediate indicators and task properties during the model training process, and perform dynamic policy evolution on the training parameters of the target model based on the intermediate indicators and task properties to obtain the target training parameters. The model parameter adjustment module is used to perform a full compliance audit on the target training parameters and the target training code. When the full compliance audit is passed, the model parameters of the target model are adjusted according to the target training parameters to obtain the trained target model.
[0009] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described agent-based model post-training method.
[0010] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps of the above-described agent-based model post-training method.
[0011] In this invention, a self-developed intelligent agent instance takes stock of its physical computing resources and task execution time conditions, retrieves external knowledge, autonomously compiles training pipeline code, captures error logs in real time during execution and performs closed-loop error repair, and dynamically evolves the training paradigm and fine-tuning strategy based on intermediate indicators and task nature during training. An independent auditing agent performs a full compliance review of the training output, thereby achieving end-to-end automated post-model training. This significantly reduces reliance on human expert experience and improves R&D efficiency and model credibility. Users only need to provide high-level goals and resource constraints, and the system can autonomously complete the entire process from data retrieval, strategy formulation, code writing to model optimization, ensuring performance authenticity under a strict anti-cheating framework. This achieves a paradigm shift from human-driven iteration to agent-autonomous evolution in R&D, solving the problem of low efficiency in post-model training analysis. Attached Figure Description
[0012] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a schematic diagram of a system architecture for a model post-training method based on an agent according to an embodiment of the present invention; Figure 2This is a flowchart illustrating a model post-training method based on an agent according to an embodiment of the present invention; Figure 3 This is a schematic diagram of a model post-training device based on an intelligent agent according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention; Figure 5 This is another structural schematic diagram of a computer device according to one embodiment of the present invention. Detailed Implementation
[0014] It should be noted that in the technical solutions disclosed in this invention, the acquisition of user information (personal image data (e.g., facial videos or pictures, facial feature videos or pictures, etc.) and personal privacy information (e.g., name, ID number, occupation, address, etc.)) is all completed with the user's knowledge and consent, and the acquisition of the relevant user information is legal and compliant.
[0015] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0016] The agent-based model post-training method provided in this invention can be applied to, for example... Figure 1 The system architecture diagram is shown below. This system architecture is deployed on the server side and includes a task receiving layer, self-developed intelligent agent instances, and a compliance audit layer. These layers communicate with each other through the server's internal scheduling network. The task receiving layer is used to obtain the target optimization task of the target model and trigger the self-developed intelligent agent instance. After the self-developed intelligent agent instance is triggered, it sequentially executes resource inventory, training pipeline code generation, error log repair, and dynamic training parameter evolution. The compliance audit layer is used to perform an independent full-scale compliance audit of the training output, and outputs the trained target model after the audit is passed. The invention will be described in detail below through specific embodiments.
[0017] Please see Figure 2 As shown, Figure 2 A schematic flowchart of a post-training method for an agent-based model provided in an embodiment of the present invention is shown. The method includes the following steps: S1. When the preset self-developed intelligent agent instance receives the target optimization task of the target model, it takes stock of the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself.
[0018] In this embodiment of the invention, the target optimization task refers to a task description provided by the user in the form of natural language or structured instructions, which includes a high-level optimization objective, such as "improving the accuracy of the model on the benchmark test for medical licensing examinations," and resource boundary conditions, such as maximum execution time and the upper limit of the number of GPUs. A self-developed intelligent agent instance refers to an autonomous agent program pre-loaded with large language model weights and equipped with tool invocation capabilities, capable of understanding task objectives, invoking external interfaces, generating code, and executing operations.
[0019] In detail, when the self-developed intelligent agent instance receives the target optimization task, the self-developed intelligent agent instance first performs environmental perception and resource inventory, autonomously queries the remaining time budget, GPU computing power status and pre-installed software libraries, and establishes the physical boundary of subsequent decision-making. That is, the intelligent agent will automatically query: how much time budget is left to complete this task, how much GPU computing power is available, and which software libraries have been installed on the server, etc.
[0020] In this embodiment of the invention, the inventory of the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself includes: Parse the task type identifier and maximum allowed execution time in the target optimization task; The preset hardware monitoring interface is invoked based on the task type identifier, and the number of graphics processors corresponding to the target optimization task is queried using the hardware monitoring interface. The maximum allowed execution time is determined as the task execution time condition for the self-developed intelligent agent instance, and the number of graphics processors and the preset software library list are determined as the physical computing resources of the self-developed intelligent agent instance.
[0021] In detail, a rule engine based on keyword matching and preset templates drives a self-developed intelligent agent instance to perform natural language parsing of the user-input task description. This can also be accomplished by leveraging the semantic understanding capabilities of a large language model. For example, to improve the model's accuracy on a medical licensing exam benchmark, the task type is identified as an objective standard answer, since the medical licensing exam has definite standard answers. Simultaneously, the maximum allowed execution time of 48 hours is extracted from resource boundary conditions. The self-developed intelligent agent instance calls the hardware monitoring application interface at the operating system level to query the model, quantity, and total memory of each available GPU. For example, the query result shows 8 NVIDIA A100 GPUs, each with 80GB of memory, of which 2 are already occupied by other processes, therefore the number of available GPUs is 6, and the total available memory is 480GB.
[0022] Specifically, the agent performs environmental perception and resource inventory, autonomously querying the remaining time budget, GPU computing power status, and pre-installed software libraries to establish the physical computing resources and task execution time conditions for subsequent decisions. Furthermore, the self-developed agent instance integrates the above information into a structured environment snapshot. This snapshot is a metadata object in key-value pair format, for example: {Remaining Time Budget: 48 hours, Available GPUs: 6, Single Card Memory: 80GB, Total Memory Limit: 480GB, Pre-installed Libraries: {torch: 2.0.0, transformers: 4.30.0}}. This structured environment snapshot is the core of the self-developed agent instance's subsequent decisions (such as whether to use full parameter fine-tuning, batch size limits, and whether to enable distributed training) must not exceed this boundary. This achieves proactive environmental perception and constraint establishment, solving the problem of resource overruns or execution failures caused by the agent's blind operations.
[0023] For example, in medical scenarios, training a diagnostic assistance model often requires strict adherence to hospital data security policies. Remaining time budgets may be limited to a few hours to prevent prolonged consumption of computing resources. The agent automatically embeds the time budget into the monitoring statements of the training script, automatically saving the model as a safety net when time is about to run out, thus avoiding the risk of losing all training results due to timeouts in medical settings. In fintech scenarios, financial regulations require model training to be completed within specific computing power quotas, such as nighttime batch processing windows. Structured environment snapshot mechanisms ensure that the agent does not over-apply for resources, thereby complying with the resource compliance requirements of the financial industry.
[0024] Furthermore, a structured environment snapshot was generated through situational awareness, providing a clear resource constraint benchmark for subsequent autonomous exploration and decision-making, thus avoiding ineffective idle work. Simultaneously, this structured environment snapshot was continuously referenced as context throughout the post-training process, ensuring that each operation remained within feasible limits.
[0025] S2. Based on the inventory of physical computing resources and task execution time conditions, retrieve the external knowledge corresponding to the target optimization task, generate the training process corresponding to the target optimization task based on the external knowledge, and compile the training process into the training pipeline code corresponding to the target model.
[0026] In this embodiment of the invention, external knowledge refers to academic papers, open-source datasets, and best practice cases related to the target task obtained through active network retrieval.
[0027] In detail, by leveraging open network access, we proactively retrieve the latest academic papers, open-source datasets (such as the Magicoder dataset for code tasks), and best practice examples relevant to the target task, rather than relying on pre-built static knowledge bases.
[0028] In this embodiment of the invention, the training process refers to a structured multi-stage scheme, including a data preprocessing stage, a training paradigm execution stage, and a hyperparameter configuration stage.
[0029] In this embodiment of the invention, the step of generating the training process corresponding to the target optimization task based on the external knowledge includes: Extract the literature content from the external knowledge, and determine multiple candidate training paradigms based on the literature content; Among the multiple candidate training paradigms, an initial training paradigm corresponding to the attribute keywords of the target optimization task is matched, and the initial training paradigm is used as the first training stage. Analyze the data description documents in the open-source dataset from the external knowledge, and extract the data cleaning logic and decontamination filtering logic from the data description documents; The data cleaning logic and the decontamination filtering logic are arranged into a data processing sub-flow according to the execution order, and the data processing sub-flow is used as the second training stage. Based on the best practice cases in the external knowledge, determine the hyperparameter recommendation range and verification frequency corresponding to the initial training paradigm, encapsulate the hyperparameter recommendation range and the verification frequency into a training configuration sub-process, and use the training configuration sub-process as the third training stage. The first training phase, the second training phase, and the third training phase are combined to form the training process corresponding to the target optimization task.
[0030] In detail, the self-developed agent instance, based on the remaining time budget in the task execution time condition, calls the academic search engine API to retrieve papers related to medical question answering and large-scale language model fine-tuning. Among the retrieved literature, the agent extraction method section identifies three candidate training paradigms: Supervised Fine-Tuning (SFT), Reinforcement Learning from Human Feedback (RLHF), and Group Relative Policy Optimization (GRPO). The agent parses the property keywords in the objective optimization task. Since the medical licensing exam has objective standard answers, the property keyword is "objective standard answer," thus matching the initial training paradigm as Supervised Fine-Tuning and using it as the first training stage. For format-following or basic dialogue ability tasks, such as making the model output conform to the format of a medical complaint response, the property keyword is "format-following," so the initial training paradigm is directly selected as SFT without subsequent switching, and this initial training paradigm is used as the first training stage.
[0031] Specifically, the self-developed intelligent agent instance retrieves publicly available medical question-answering datasets (such as the MedQA dataset), downloads their data documentation, and extracts data cleaning logic from the documentation. This includes removing entries containing personal health information, standardizing multiple-choice options to A / B / C / D, and decontamination filtering logic, such as calculating the ROUGE-L similarity between each training sample and the official test set samples of the medical licensing exam, and removing samples with a similarity greater than 0.9. The intelligent agent prioritizes data cleaning logic over decontamination filtering logic because format standardization is necessary before similarity comparison. The orchestrated data processing sub-flow consists of loading raw JSONL format data, performing format cleaning, calculating the similarity with test set samples, and filtering out highly similar samples. This data preprocessing sub-flow serves as the second training stage.
[0032] Furthermore, the agent extracts recommended hyperparameter ranges for the SFT stage from best practice examples retrieved from papers or open-source code repositories. For example, the learning rate should be between 1e-5 and 5e-5, the batch size between 16 and 32, and the validation frequency should be once every 100 training steps. This information is encapsulated into a training configuration sub-flow, serving as the third training stage. The agent then sequentially executes these three stages: first, the second training stage (data processing); then, the first training stage (SFT model training); and finally, the hyperparameter configuration and validation frequency from the third training stage are applied during training. The combined training flow is a multi-stage blueprint, with each stage annotated with the URLs of the external resources it depends on.
[0033] Furthermore, each training stage enables the autonomous construction and dynamic optimization of the training process, significantly reducing reliance on human experience during post-training and improving R&D efficiency and the reliability of model generalization capabilities.
[0034] In this embodiment of the invention, the training pipeline code refers to the script code that converts the training process into an actual executable program, including a data loading module, a model initialization module, and a training loop module.
[0035] In this embodiment of the invention, compiling the training process into training pipeline code corresponding to the target model includes: Obtain the dependencies of each process in the training process, and generate the data loader configuration code snippet corresponding to the dependencies; The loading strategy for the target model is selected based on the upper limit of computing power in the physical computing resources, and the initialization code fragment for the target model is generated based on the loading strategy. The data loader configuration code snippet and the initialization code snippet are embedded into a preset training loop template, and the call statements for model training iterations are completed in the training loop template; The completed training loop template is encapsulated into the training pipeline code corresponding to the target model.
[0036] In detail, the dependencies between each stage of the self-developed agent instance analysis training process are analyzed. The output of the second training stage is the cleaned dataset file path, which serves as the input for the first training stage (SFT training). Based on this dependency, the agent uses the API of the PyTorch or Transformers library to generate data loader code snippets. For example, it generates class instantiation code, specifying the dataset path, batch size, random sampler, etc. For example, if the total GPU memory limit in the physical computing resources is 480GB, and the target model is a 7B parameter LLaMA variant, full parameter loading requires approximately 28GB of GPU memory. Therefore, full parameter fine-tuning can be used (efficient parameter fine-tuning is not required). The agent generates the model initialization code snippet: model=AutoModelForCausalLM.from_pretrained(base_model_path).
[0037] Specifically, the agent maintains a pre-defined training loop template, which includes the framework for forward propagation, loss calculation, and backpropagation. The agent fills the data loading section of the template with the data loader code snippet, the model preparation section with the initialization code snippet, and completes the calling statements for one training iteration. The completed template is a complete training script. The agent saves the completed training script as a .py file and adds physical computation resource monitoring statements. If a timeout occurs, the model is automatically saved and the process exits. This training pipeline code forms the basis for subsequent execution and correction.
[0038] Furthermore, without the need for manual coding, the agent automatically transforms the high-level training process into an executable script, and the generated code has built-in resource constraint monitoring, solving the problems of time-consuming and error-prone manual coding.
[0039] S3. Execute the training pipeline code, obtain error logs in real time during the execution of the training pipeline code, and perform error repair on the training pipeline code according to the error logs to obtain the target training code.
[0040] In this embodiment of the invention, the error log refers to the standard error stream output generated when the training pipeline code runs in the sandbox environment, which includes information such as error type, file name and line number, and error description.
[0041] In this embodiment of the invention, the self-developed intelligent agent instance starts an independent subprocess in an isolated sandbox environment, such as a Docker container or virtual environment, to execute the training pipeline code. The standard output stream and standard error stream of this subprocess are redirected to a resident memory buffer via a pipe. Simultaneously, the self-developed intelligent agent instance starts an asynchronous listening thread to poll the buffer at a set sampling interval, reading newly output text lines in real time. When a text line is detected to contain preset error keywords such as ERROR, Exception, Traceback, or ModuleNotFoundError, the self-developed intelligent agent instance immediately captures the line and its surrounding context (such as by using a sliding window to save the 10 most recent log records) into a structured error record, attaching the current timestamp, execution stage identifier, code file name, and line number. This error record is encapsulated into a JSON message and pushed to the log analysis queue of the self-developed intelligent agent instance, serving as the basis for subsequent error correction steps.
[0042] Furthermore, through a mechanism based on process redirection and asynchronous polling, the self-developed intelligent agent instance can capture all runtime error information in real time and completely without blocking the normal execution of the training pipeline code, providing a reliable data source for subsequent autonomous log parsing and error repair.
[0043] In this embodiment of the invention, the target training code refers to a training script version that can run without errors until the termination condition is met after zero or more corrections. Error repair refers to the process of parsing error logs, locating the root cause of errors, and automatically modifying the code for the self-developed intelligent agent instance.
[0044] In this embodiment of the invention, the step of correcting errors in the training pipeline code based on the error log to obtain the target training code includes: Identify the error type tags in the error log and query the code modification actions corresponding to the error type tags in the preset repair strategy mapping table; The code modification action is used as the corrected version of the training pipeline code, and a breakpoint resume marker is added to the beginning of the corrected version of the code. Based on the breakpoint resume flag, the corrected version code is executed in a preset sandbox environment, and the target error log of the corrected version code during execution is captured; If the target error log is empty, mark the corrected version code as the target training code; If the target error log is not empty, return to the step of identifying the error type label in the error log until the target error log meets the preset code execution verification conditions, and use the code version that meets the code execution verification conditions as the target training code.
[0045] In detail, if the error log contains "ModuleNotFoundError: No module named peft" when the training pipeline code is executed for the first time, the agent extracts the error type label as "missing environment dependency" using regular expression matching. The pre-defined repair strategy mapping table is a key-value table, for example, {missing environment dependency: insert the command '!pip install peft' at the beginning of the script, memory overflow: halve the batch size and add gradient accumulation, configuration file syntax error: correct YAML indentation}. The code modification action obtained by querying the label is to insert the command to install the peft library. The agent inserts `import subprocess; subprocess.run([pip, install, peft])` at the first line or appropriate position of the original training pipeline code, generating the corrected version of the code. Simultaneously, it adds the comment `#resumed_from_error: ModuleNotFoundError` to the beginning of the code to facilitate subsequent tracking of the exact cause of the correction. Here, the `subprocess` module is a Python standard library used to create new processes and obtain their output; `subprocess.run()` synchronously executes the passed-in command list (`pip` is the executable file for the package manager, `install` is the installation action, and `peft` is the target library name); `resumed_from_error` indicates recovery from a certain error, and `ModuleNotFoundError` specifies the original error type.
[0046] Specifically, the agent re-executes the corrected version of the code in an isolated Docker sandbox environment. This sandbox has the same pre-installed dependencies as the production environment. After execution, the standard error stream is captured again. If there are no new errors, the target error log is empty; if there are still errors, the target error log contains new error information. If the second execution has no errors, the agent stops iterating and uses the corrected version of the code as the final target training code. If the target error log is not empty (e.g., memory overflow), the agent extracts the new error type label as memory overflow, queries the mapping table to halve the batch size and add gradient accumulation, generates a new corrected version of the code, and executes it in the sandbox again. This process is repeated until the code has no errors or the maximum number of iterations is reached. Finally, the error-free version of the code is used as the target training code.
[0047] Furthermore, error correction enables the agent to autonomously correct code execution errors in a closed loop, eliminating the need for manual debugging and significantly shortening the time from code development to runtime. The agent can analyze runtime error logs in real time, autonomously locate problems such as missing environment dependencies, memory overflows, or configuration conflicts, and achieve self-repair by modifying code or adjusting parameters. This end-to-end autonomous orchestration capability means that post-model training is no longer limited by the scope of expert experience, realizing a paradigm shift from passively executing preset processes to actively building solutions.
[0048] S4. Train the target model using the target training code, and obtain intermediate indicators and task properties during the model training process. Based on the intermediate indicators and task properties, dynamically evolve the training parameters of the target model to obtain the target training parameters.
[0049] In this embodiment of the invention, after obtaining the target training code that has been corrected for errors, the self-developed intelligent agent instance starts the training loop in a multi-process or multi-threaded manner by calling the training application programming interface of a deep learning framework (such as PyTorch or TensorFlow). In each iteration, forward propagation, loss calculation, and back propagation are performed to update the parameters of the target model. At the same time, the self-developed intelligent agent instance embeds multiple monitoring hooks in the training loop. After each validation cycle or every N training steps, it automatically extracts key intermediate indicators from the trainer's logger, including but not limited to the training loss value, validation set accuracy, gradient norm, current learning rate value, and GPU memory usage ratio. These indicators are then temporarily stored in the memory cache in the form of a structured dictionary.
[0050] Furthermore, the self-developed intelligent agent instance parses the user-input target optimization task text, automatically determines the task nature using keyword matching or a lightweight semantic classifier, and encapsulates the determination result along with the aforementioned intermediate metrics into a status message. Through this mechanism that integrates training execution and real-time metric collection, the self-developed intelligent agent instance can continuously obtain feedback signals during model training, providing quantitative basis for adaptively adjusting training paradigms, fine-tuning techniques, and data supplementation strategies. The task nature refers to the characteristics of the task itself, such as whether the task is to teach the model to follow an instruction format (SFT is suitable) or to improve the model's accuracy in solving mathematical problems (which may require reinforcement learning). The task nature determines the general direction of training. Intermediate results refer to the feedback information generated in real time during training. For example, how quickly the model's loss value decreases during training, what the accuracy is on a small test set, and whether the current GPU memory usage is about to be full. The intelligent agent monitors these intermediate results like humans observe experiments and decides whether to continue the current approach or adjust the strategy based on their quality.
[0051] In this embodiment of the invention, the target training parameters are structured objects that encapsulate all decision results and are used to guide the final adjustment of model parameters.
[0052] In this embodiment of the invention, the step of dynamically evolving the training parameters of the target model based on the intermediate indicators and the task characteristics to obtain the target training parameters includes: Extract the task type feature vector from the task properties, and determine the target training paradigm based on the objective standard answer identifier in the task type feature vector; Determine the hyperparameters in the reinforcement learning strategy based on the target training paradigm; The training process based on the target model acquires the GPU memory usage ratio in real time, and determines the parameter adjustment strategy of the target model based on the GPU memory usage ratio. The training set corresponding to the target model is used to determine the breadth of conceptual coverage of the task properties, and a synthetic dataset corresponding to the target model is generated based on the breadth of conceptual coverage. The target training paradigm, the hyperparameters, the parameter adjustment strategy, and the synthetic dataset are summarized and integrated to form the target training parameters.
[0053] In detail, the agent performs semantic parsing on the target optimization task, extracting a task type feature vector. Its components include: whether an objective standard answer exists (yes), whether format compliance capability is required (no), and whether it belongs to a long-tail scenario (no). Since the objective standard answer is affirmative, the determined target training paradigm is: first, supervised fine-tuning is performed as a warm-up phase; then, based on the convergence of the validation set, a decision is made whether to switch to reinforcement learning. For format compliance or basic capability alignment tasks, it can autonomously decide to adopt supervised fine-tuning (SFT) as the preferred strategy to quickly establish basic capabilities. For tasks with clear objective standard answers, such as mathematical reasoning or code generation, after completing the initial SFT, the agent can autonomously identify and introduce more advanced reinforcement learning strategies (such as Group Relative Policy Optimization, GRPO), using simple correctness checks as reward signals for a second-stage optimization. This phased, hierarchical strategy evolution is entirely driven autonomously by the agent based on its understanding of the task and experimental results, without requiring manual intervention to adjust the algorithm framework. When the switching conditions are met, the agent needs to prepare the hyperparameters for the reinforcement learning phase in advance, extract recommended values from the best practices in external knowledge, and the reward model uses a correctness check function, that is, compare whether the model output is consistent with the standard answer.
[0054] Specifically, during the SFT warm-up phase, the agent calls the NVML interface every 10 training steps to obtain the current memory usage ratio. If the usage ratio is far below the warning threshold, no switching is triggered. However, in the later stages of training, if memory usage exceeds the threshold due to model weight updates, the agent automatically switches the parameter adjustment strategy from full parameter fine-tuning to low-rank adaptation and dynamically calculates the LoRA rank parameter: rank = memory margin / baseline rank coefficient. During training, the agent checks whether the training set contains enough rare medical concepts. For example, if it finds that there are insufficient rare disease case samples in the training set and the concept coverage breadth is lower than the preset completeness threshold, the agent autonomously writes a data generation script, calls an external medical knowledge base API to obtain seed terms, and generates synthetic data through formal transformations, such as changing sentence structure from declarative sentences to question-answer pairs and increasing difficulty, such as adding distractors, and attaching sampling weight decay curves. The agent summarizes and integrates all decision results to form a structured training parameter object, i.e., the target training parameters, including paradigm, SFT hyperparameters, RL hyperparameters, fine-tuning strategy, synthetic data path, and sampling decay curves.
[0055] Furthermore, in terms of model adaptation technology, the agent can dynamically select efficient parameter fine-tuning techniques (such as LoRA and QLoRA) or full-parameter fine-tuning techniques based on real-time monitoring of GPU memory usage, maximizing training efficiency under resource-constrained conditions. In addition, the agent possesses creative data-level problem-solving capabilities. When it finds that existing open-source data is insufficient to cover a specific task scenario, it can autonomously write code to call external APIs to generate synthetic data, effectively solving the data scarcity problem for long-tail tasks. This dynamic evolution at the strategy level endows the system with powerful generalization capabilities to handle complex and unknown tasks.
[0056] For example, in a medical setting, medical licensing exam questions have clear, objective standard answers. This allows the agent to automatically detect a flattening slope in the accuracy increase on the validation set after supervised fine-tuning, thus switching to the group-relative policy optimization stage, using correctness checks as the reward signal. In a fintech setting, for financial statement sentiment analysis, it is classified as a non-objective standard task, thus avoiding switching to reinforcement learning and preventing performance degradation caused by inappropriate reward signals.
[0057] Furthermore, real-time adaptive decision-making during the training process enables the system to dynamically optimize training strategies based on task type and resource status, avoiding the performance bottleneck under a fixed paradigm.
[0058] S5. Perform a full compliance audit on the target training parameters and the target training code. When the full compliance audit passes, adjust the model parameters of the target model according to the target training parameters to obtain the trained target model.
[0059] In this embodiment of the invention, full compliance audit refers to launching an audit agent instance independent of the training agent to conduct a semantic understanding-based review of the final product set, including training scripts, data loading paths, model configuration files, and final model weights, in order to detect whether there is any loading behavior pointing to test set data or unauthorized external pre-trained model replacement behavior.
[0060] In this embodiment of the invention, the full compliance audit of the target training parameters and the target training code includes: Obtain the data loading path and model configuration file of the target model during the training process, and combine the target training code, the target training parameters, the data loading path and the model configuration file into the target output; The target product is semantically parsed using a pre-defined audit agent instance to obtain semantic content, and the semantic content is then checked for explicit and implicit violations. When explicit or implicit violations are detected in the semantic content, an audit failure report corresponding to the target product is generated. When no explicit or implicit violations are detected in the semantic content, an audit success report corresponding to the target product is generated.
[0061] In detail, the auditing agent is a large language model instance specifically configured with violation detection rules. Its system prompts include explicit prohibitions and detection methodologies, namely an automated anti-cheating audit mechanism based on an LLM judge. This mechanism comprises two layers of protection: the first layer is embedded principles, embedding strict constraints into the agent's system prompts to explicitly prohibit violations such as data contamination (e.g., directly using test sets for training) and model substitution (e.g., downloading off-the-shelf instruction models to impersonate training results), leveraging the instruction compliance capabilities of the large model for initial behavioral constraints; the second layer is post-event judicial auditing, employing a dedicated LLM judge agent for violation detection. This agent is responsible for a full audit of the final output generated by the training agent, including all training scripts, data loading processes, model configuration files, and the final submitted model weights. The judge agent can identify various complex cheating patterns, ranging from explicit violations (e.g., directly loading benchmark data) to implicit violations (e.g., generating training data through reverse engineering of evaluation logic). For example, it can detect hidden operations such as hard-coded test cases, unauthorized modifications to evaluation scripts, and the use of third-party datasets containing benchmark information. If the audit results indicate a violation, the system will automatically reject the submission and use the original score of the base model as the final result, thereby ensuring the fairness and credibility of the evaluation results.
[0062] Specifically, the agent collects all relevant files used during training, including the target training code (.py files), target training parameters (.json files), data loading paths (e.g., URLs or local paths pointing to the training dataset), and model configuration files (config.json). These files are packaged into a temporary directory as audit input. Explicit violations include file read statements that directly load benchmark dataset data, unauthorized modifications to the evaluation script, and calls to download pre-trained instruction models from external sources and replace the current model's weights. Implicit violations involve patterns in the training data generated through reverse engineering of the test case format used in the evaluation logic. Examples include deliberately generating similar samples based on the test set's question type distribution in the code, and indirect references to third-party datasets containing benchmark dataset information. The auditing agent scans the code and configuration files line by line, leveraging the semantic understanding capabilities of the large model to identify these patterns.
[0063] Furthermore, if a violation is detected, the auditing agent generates a line number containing evidence of the violation, a description of the violation type, and suggested actions, such as rejecting the submission. Upon receiving this report, the system automatically rejects the current training result and outputs the original, untrained parameters of the target model as the final result. If the audit passes, the auditing agent generates a digitally signed certificate containing the audit time, audit version, and approval conclusion. Based on the target training parameters, a final round of parameter adjustments is performed on the target model, such as applying LoRA weight merging or executing the final reinforcement learning policy, to obtain the trained target model, and its output is stored in a designated path.
[0064] For example, in the medical field, some unscrupulous developers might mix variations of medical exam test sets (such as synonym substitutions) into the training set to improve scores. An auditing agent identifies implicit violation patterns in the reverse-engineered evaluation logic through semantic parsing, generating audit failure reports to ensure that the models obtained by medical institutions are truly based on generalization ability rather than data contamination. In the fintech field, the auditing agent can detect whether the training code attempts to download pre-trained models optimized for financial assessment sets from internal servers (model substitution behavior), thereby preventing fraudulent evaluation reports.
[0065] Furthermore, the paradigm and fine-tuning policy fields in the target training parameters are analyzed. If the parameters indicate low-rank adaptive fine-tuning and the reinforcement learning stage has not yet begun, the model merging interface of the deep learning framework is called to linearly weight and fuse the low-rank adaptive weight matrix saved during training with the full parameters of the original base model, generating a complete weight file that can be directly deployed. If the parameters indicate that the reinforcement learning stage of group-relative policy optimization has been completed, the weights output by the final policy network are used as the updated model parameters, and auxiliary modules such as the value network are discarded. The trained model weights, corresponding configuration files, and data preprocessing logic are packaged into a unified model file package and stored in the target path. At the same time, the hash value of the target training parameters on which this adjustment is based and the audit voucher number are written to the system log to achieve full traceability. If the audit fails, the parameter adjustment is skipped directly, and the weights of the original base model are used as the final output. Through a trusted automated closed loop, it is ensured that the final model does not obtain high scores through cheating, thereby meeting the compliance requirements of fields such as finance and healthcare.
[0066] As can be seen, the above solution achieves end-to-end automated post-model training by using self-developed intelligent agent instances to inventory their physical computing resources and task execution time conditions, retrieve external knowledge and autonomously compile training pipeline code, capture error logs in real time during execution and perform closed-loop error repair, dynamically evolve training paradigms and fine-tuning strategies based on intermediate metrics and task characteristics during training, and conduct full compliance reviews of training products through independent auditing agents. This significantly reduces reliance on human expert experience and improves R&D efficiency and model credibility. Users only need to provide high-level goals and resource constraints, and the system can autonomously complete the entire process from data retrieval, strategy formulation, code writing to model optimization, ensuring performance authenticity under a strict anti-cheating framework. This realizes a paradigm shift from human-driven iteration to autonomous evolution of intelligent agents, solving the problem of low efficiency in post-model training analysis.
[0067] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0068] In one embodiment, an agent-based model post-training device 100 is provided, which corresponds one-to-one with the agent-based model post-training method described in the above embodiments. For example... Figure 3 As shown, the agent-based model post-training device 100 includes a resource inventory module 101, a training process compilation module 102, a training pipeline error repair module 103, a dynamic policy evolution module 104, and a model parameter adjustment module 105. Detailed descriptions of each functional module are as follows: The resource inventory module 101 is used to inventory the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself after the preset self-developed intelligent agent instance receives the target optimization task of the target model. The training process compilation module 102 is used to retrieve external knowledge corresponding to the target optimization task based on the inventory of physical computing resources and task execution time conditions, generate the training process corresponding to the target optimization task based on the external knowledge, and compile the training process into the training pipeline code corresponding to the target model. The training pipeline error repair module 103 is used to execute the training pipeline code, acquire error logs in real time during the execution of the training pipeline code, and repair errors in the training pipeline code according to the error logs to obtain the target training code; The dynamic policy evolution module 104 is used to train the target model using the target training code, obtain intermediate indicators and task properties during the model training process, and perform dynamic policy evolution on the training parameters of the target model based on the intermediate indicators and task properties to obtain the target training parameters. The model parameter adjustment module 105 is used to perform a full compliance audit on the target training parameters and the target training code. When the full compliance audit is passed, the model parameters of the target model are adjusted according to the target training parameters to obtain the trained target model.
[0069] In one embodiment, the resource inventory module 101, when performing an inventory of the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself, is used for: Parse the task type identifier and maximum allowed execution time in the target optimization task; The preset hardware monitoring interface is invoked based on the task type identifier, and the number of graphics processors corresponding to the target optimization task is queried using the hardware monitoring interface. The maximum allowed execution time is determined as the task execution time condition for the self-developed intelligent agent instance, and the number of graphics processors and the preset software library list are determined as the physical computing resources of the self-developed intelligent agent instance.
[0070] In one embodiment, the training process compilation module 102, when executing the training process corresponding to the target optimization task generated based on the external knowledge, is used to: Extract the literature content from the external knowledge, and determine multiple candidate training paradigms based on the literature content; Among the multiple candidate training paradigms, an initial training paradigm corresponding to the attribute keywords of the target optimization task is matched, and the initial training paradigm is used as the first training stage. Analyze the data description documents in the open-source dataset from the external knowledge, and extract the data cleaning logic and decontamination filtering logic from the data description documents; The data cleaning logic and the decontamination filtering logic are arranged into a data processing sub-flow according to the execution order, and the data processing sub-flow is used as the second training stage. Based on the best practice cases in the external knowledge, determine the hyperparameter recommendation range and verification frequency corresponding to the initial training paradigm, encapsulate the hyperparameter recommendation range and the verification frequency into a training configuration sub-process, and use the training configuration sub-process as the third training stage. The first training phase, the second training phase, and the third training phase are combined to form the training process corresponding to the target optimization task.
[0071] In one embodiment, the training process compilation module 102, when executing the compilation of the training process into training pipeline code corresponding to the target model, is further configured to: Obtain the dependencies of each process in the training process, and generate the data loader configuration code snippet corresponding to the dependencies; The loading strategy for the target model is selected based on the upper limit of computing power in the physical computing resources, and the initialization code fragment for the target model is generated based on the loading strategy. The data loader configuration code snippet and the initialization code snippet are embedded into a preset training loop template, and the call statements for model training iterations are completed in the training loop template; The completed training loop template is encapsulated into the training pipeline code corresponding to the target model.
[0072] In one embodiment, the training pipeline error repair module 103, when performing error repair on the training pipeline code based on the error log to obtain the target training code, is used to: Identify the error type tags in the error log and query the code modification actions corresponding to the error type tags in the preset repair strategy mapping table; The code modification action is used as the corrected version of the training pipeline code, and a breakpoint resume marker is added to the beginning of the corrected version of the code. Based on the breakpoint resume flag, the corrected version code is executed in a preset sandbox environment, and the target error log of the corrected version code during execution is captured; If the target error log is empty, mark the corrected version code as the target training code; If the target error log is not empty, return to the step of identifying the error type label in the error log until the target error log meets the preset code execution verification conditions, and use the code version that meets the code execution verification conditions as the target training code.
[0073] In one embodiment, the dynamic policy evolution module 104, when performing dynamic policy evolution on the training parameters of the target model based on the intermediate indicators and the task characteristics to obtain the target training parameters, is used to: Extract the task type feature vector from the task properties, and determine the target training paradigm based on the objective standard answer identifier in the task type feature vector; Determine the hyperparameters in the reinforcement learning strategy based on the target training paradigm; The training process based on the target model acquires the GPU memory usage ratio in real time, and determines the parameter adjustment strategy of the target model based on the GPU memory usage ratio. The training set corresponding to the target model is used to determine the breadth of conceptual coverage of the task properties, and a synthetic dataset corresponding to the target model is generated based on the breadth of conceptual coverage. The target training paradigm, the hyperparameters, the parameter adjustment strategy, and the synthetic dataset are summarized and integrated to form the target training parameters.
[0074] In one embodiment, the model parameter adjustment module 105, when performing a full compliance audit of the target training parameters and the target training code, is used to: Obtain the data loading path and model configuration file of the target model during the training process, and combine the target training code, the target training parameters, the data loading path and the model configuration file into the target output; The target product is semantically parsed using a pre-defined audit agent instance to obtain semantic content, and the semantic content is then checked for explicit and implicit violations. When explicit or implicit violations are detected in the semantic content, an audit failure report corresponding to the target product is generated. When no explicit or implicit violations are detected in the semantic content, an audit success report corresponding to the target product is generated.
[0075] This invention provides a post-training device based on intelligent agents. It utilizes self-developed intelligent agent instances to inventory their physical computing resources and task execution time conditions, retrieve external knowledge, autonomously compile training pipeline code, capture error logs in real-time during execution and perform closed-loop error repair, dynamically evolve training paradigms and fine-tuning strategies based on intermediate metrics and task characteristics during training, and conduct full compliance reviews of training outputs through an independent auditing agent. This achieves end-to-end automated post-training, significantly reducing reliance on human expert experience and improving R&D efficiency and model credibility. Users only need to provide high-level objectives and resource constraints, and the system can autonomously complete the entire process from data retrieval, strategy formulation, code writing to model optimization, ensuring performance authenticity under a strict anti-cheating framework. This represents a paradigm shift from human-driven iteration to autonomous evolution by intelligent agents, solving the problem of low efficiency in post-training analysis.
[0076] Specific limitations regarding the agent-based model post-training device can be found in the limitations of the agent-based model post-training method described above, and will not be repeated here. Each module in the aforementioned agent-based model post-training device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0077] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When executed by the processor, the computer program implements the functions or steps of a server-side method for model post-training based on intelligent agents.
[0078] In one embodiment, a computer device is provided, which may be a client, and its internal structure diagram may be as follows: Figure 5As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with an external server via a network connection. When executed by the processor, the computer program implements client-side functions or steps of a model post-training method based on intelligent agents.
[0079] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps: When the pre-defined self-developed intelligent agent instance receives the target optimization task of the target model, it takes stock of the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself. Based on the inventory of physical computing resources and task execution time conditions, retrieve the external knowledge corresponding to the target optimization task, generate the training process corresponding to the target optimization task based on the external knowledge, and compile the training process into the training pipeline code corresponding to the target model; The training pipeline code is executed, and error logs are acquired in real time during the execution of the training pipeline code. Errors in the training pipeline code are corrected based on the error logs to obtain the target training code. The target model is trained using the target training code, and intermediate metrics and task properties are obtained during the model training process. The training parameters of the target model are dynamically evolved based on the intermediate metrics and task properties to obtain the target training parameters. A full compliance audit is performed on the target training parameters and the target training code. When the full compliance audit is passed, the model parameters of the target model are adjusted according to the target training parameters to obtain the trained target model.
[0080] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor: When the pre-defined self-developed intelligent agent instance receives the target optimization task of the target model, it takes stock of the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself. Based on the inventory of physical computing resources and task execution time conditions, retrieve the external knowledge corresponding to the target optimization task, generate the training process corresponding to the target optimization task based on the external knowledge, and compile the training process into the training pipeline code corresponding to the target model; The training pipeline code is executed, and error logs are acquired in real time during the execution of the training pipeline code. Errors in the training pipeline code are corrected based on the error logs to obtain the target training code. The target model is trained using the target training code, and intermediate metrics and task properties are obtained during the model training process. The training parameters of the target model are dynamically evolved based on the intermediate metrics and task properties to obtain the target training parameters. A full compliance audit is performed on the target training parameters and the target training code. When the full compliance audit is passed, the model parameters of the target model are adjusted according to the target training parameters to obtain the trained target model.
[0081] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0082] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0083] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0084] It should be noted that any AI models, software tools, or components not belonging to this company appearing in the embodiments of this application are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this application has been authorized (with the knowledge and consent) by the relevant parties or has been fully authorized by all parties, and the executing entity may obtain it through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.
[0085] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A post-training method for a model based on an agent, characterized in that, The method includes: When the pre-defined self-developed intelligent agent instance receives the target optimization task of the target model, it takes stock of the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself. Based on the inventory of physical computing resources and task execution time conditions, retrieve the external knowledge corresponding to the target optimization task, generate the training process corresponding to the target optimization task based on the external knowledge, and compile the training process into the training pipeline code corresponding to the target model; The training pipeline code is executed, and error logs are acquired in real time during the execution of the training pipeline code. Errors in the training pipeline code are corrected based on the error logs to obtain the target training code. The target model is trained using the target training code, and intermediate metrics and task properties are obtained during the model training process. The training parameters of the target model are dynamically evolved based on the intermediate metrics and task properties to obtain the target training parameters. A full compliance audit is performed on the target training parameters and the target training code. When the full compliance audit is passed, the model parameters of the target model are adjusted according to the target training parameters to obtain the trained target model.
2. The agent-based model post-training method as described in claim 1, characterized in that, The inventory of the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself includes: Parse the task type identifier and maximum allowed execution time in the target optimization task; The preset hardware monitoring interface is invoked based on the task type identifier, and the number of graphics processors corresponding to the target optimization task is queried using the hardware monitoring interface. The maximum allowed execution time is determined as the task execution time condition for the self-developed intelligent agent instance, and the number of graphics processors and the preset software library list are determined as the physical computing resources of the self-developed intelligent agent instance.
3. The agent-based model post-training method as described in claim 1, characterized in that, The training process for generating the target optimization task based on the external knowledge includes: Extract the literature content from the external knowledge, and determine multiple candidate training paradigms based on the literature content; Among the multiple candidate training paradigms, an initial training paradigm corresponding to the attribute keywords of the target optimization task is matched, and the initial training paradigm is used as the first training stage. Analyze the data description documents in the open-source dataset from the external knowledge, and extract the data cleaning logic and decontamination filtering logic from the data description documents; The data cleaning logic and the decontamination filtering logic are arranged into a data processing sub-flow according to the execution order, and the data processing sub-flow is used as the second training stage. Based on the best practice cases in the external knowledge, determine the hyperparameter recommendation range and verification frequency corresponding to the initial training paradigm, encapsulate the hyperparameter recommendation range and the verification frequency into a training configuration sub-process, and use the training configuration sub-process as the third training stage. The first training phase, the second training phase, and the third training phase are combined to form the training process corresponding to the target optimization task.
4. The agent-based model post-training method as described in claim 1, characterized in that, The step of compiling the training process into training pipeline code corresponding to the target model includes: Obtain the dependencies of each process in the training process, and generate the data loader configuration code snippet corresponding to the dependencies; The loading strategy for the target model is selected based on the upper limit of computing power in the physical computing resources, and the initialization code fragment for the target model is generated based on the loading strategy. The data loader configuration code snippet and the initialization code snippet are embedded into a preset training loop template, and the call statements for model training iterations are completed in the training loop template; The completed training loop template is encapsulated into the training pipeline code corresponding to the target model.
5. The agent-based model post-training method as described in claim 1, characterized in that, The step of correcting errors in the training pipeline code based on the error log to obtain the target training code includes: Identify the error type tags in the error log and query the code modification actions corresponding to the error type tags in the preset repair strategy mapping table; The code modification action is used as the corrected version of the training pipeline code, and a breakpoint resume marker is added to the beginning of the corrected version of the code. Based on the breakpoint resume flag, the corrected version code is executed in a preset sandbox environment, and the target error log of the corrected version code during execution is captured; If the target error log is empty, mark the corrected version code as the target training code; If the target error log is not empty, return to the step of identifying the error type label in the error log until the target error log meets the preset code execution verification conditions, and use the code version that meets the code execution verification conditions as the target training code.
6. The agent-based model post-training method as described in claim 1, characterized in that, The step of dynamically evolving the training parameters of the target model based on the intermediate indicators and the nature of the task to obtain the target training parameters includes: Extract the task type feature vector from the task properties, and determine the target training paradigm based on the objective standard answer identifier in the task type feature vector; Determine the hyperparameters in the reinforcement learning strategy based on the target training paradigm; The training process based on the target model acquires the GPU memory usage ratio in real time, and determines the parameter adjustment strategy of the target model based on the GPU memory usage ratio. The training set corresponding to the target model is used to determine the breadth of conceptual coverage of the task properties, and a synthetic dataset corresponding to the target model is generated based on the breadth of conceptual coverage. The target training paradigm, the hyperparameters, the parameter adjustment strategy, and the synthetic dataset are summarized and integrated to form the target training parameters.
7. The agent-based model post-training method as described in claim 1, characterized in that, The full compliance audit of the target training parameters and the target training code includes: Obtain the data loading path and model configuration file of the target model during the training process, and combine the target training code, the target training parameters, the data loading path and the model configuration file into the target output; The target product is semantically parsed using a pre-defined audit agent instance to obtain semantic content, and the semantic content is then checked for explicit and implicit violations. When explicit or implicit violations are detected in the semantic content, an audit failure report corresponding to the target product is generated. When no explicit or implicit violations are detected in the semantic content, an audit success report corresponding to the target product is generated.
8. A post-training device for a model based on an intelligent agent, characterized in that, The device includes: The resource inventory module is used to inventory the physical computing resources and task execution time conditions of the self-developed intelligent agent instance itself after the preset self-developed intelligent agent instance receives the target optimization task of the target model. The training process compilation module is used to retrieve external knowledge corresponding to the target optimization task based on the inventory of physical computing resources and task execution time conditions, generate the training process corresponding to the target optimization task based on the external knowledge, and compile the training process into the training pipeline code corresponding to the target model. The training pipeline error repair module is used to execute the training pipeline code, acquire error logs in real time during the execution of the training pipeline code, and repair errors in the training pipeline code according to the error logs to obtain the target training code; The dynamic policy evolution module is used to train the target model using the target training code, obtain intermediate indicators and task properties during the model training process, and perform dynamic policy evolution on the training parameters of the target model based on the intermediate indicators and task properties to obtain the target training parameters. The model parameter adjustment module is used to perform a full compliance audit on the target training parameters and the target training code. When the full compliance audit is passed, the model parameters of the target model are adjusted according to the target training parameters to obtain the trained target model.
9. A computer 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 computer program, it implements the agent-based model post-training method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the agent-based model post-training method as described in any one of claims 1 to 7.