Lightweight method and device for yolo model based on multi-agent cooperation and computer program
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-30
- Publication Date
- 2026-06-23
Smart Images

Figure CN122263981A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of model lightweighting technology, and in particular to a method, apparatus and computer program for lightweighting YOLO models based on multi-agent collaboration. Background Technology
[0002] In recent years, with the rapid development of edge computing and edge intelligent devices, deploying high-performance computer vision models, especially real-time object detection models represented by the YOLO series, on terminal devices with limited computing power, memory, and energy consumption has become a key requirement in fields such as industrial inspection, mobile security, and autonomous driving. To achieve this goal, model lightweighting and compression techniques, such as structured pruning, parameter quantization, and knowledge distillation, have become indispensable. Existing technologies typically rely on domain experts manually designing compression processes, selecting compression algorithms based on experience, setting hyperparameters, and repeatedly conducting tests that balance accuracy and efficiency. This process is not only time-consuming, labor-intensive, and costly, but also heavily reliant on the expert's personal experience, resulting in poor versatility and weak transferability of compression solutions. Once the target hardware platform, performance constraints, or model version changes, the entire compression process often needs to be redesigned and optimized, making rapid and automated adaptation difficult.
[0003] To improve the automation level of complex task processing, several solutions based on Large Language Models (LLM) and multi-agent collaboration have emerged in existing technologies. For example, some solutions utilize multi-agent collaboration for general software code generation, improving development efficiency through task decomposition, knowledge retrieval, and code integration; others design multi-agent collaborative frameworks for complex task reasoning, improving task execution accuracy through the division of roles such as planning, execution, and reflection; still others apply multi-agents to database queries, achieving automatic conversion of natural language to SQL statements and visualization of results. While these existing technologies have verified the potential of multi-agent frameworks in handling serialized and logical tasks, their applications are generally concentrated in logical and text processing domains such as code generation, task planning, or data querying, and their processing objects are mostly business logic, natural language instructions, or structured queries.
[0004] However, when applying such multi-agent frameworks directly to deep learning model compression—a highly specialized task heavily reliant on model structure understanding and domain knowledge—existing technologies exhibit significant limitations: First, they lack embedded expertise in deep learning models, especially the structure, parameter distribution, and compression algorithm characteristics of the YOLO series models, making in-depth model analysis and targeted policy generation impossible. Second, the optimization process of existing solutions often relies on external manual feedback or simple rule judgments, failing to construct a fully automated closed-loop optimization chain from policy generation, code implementation, automatic verification to performance evaluation. Finally, when faced with the inherent multi-objective trade-off between accuracy, speed, and volume in model compression tasks, existing technologies lack systematic quantitative evaluation and dynamic iteration mechanisms, making it difficult to automatically generate reliable solutions that satisfy stringent edge constraints while maintaining high performance.
[0005] Therefore, there is an urgent need in the current technology field for an intelligent model compression method that can deeply integrate domain knowledge, achieve end-to-end automation, and have continuous self-optimization capabilities, in order to solve the problems of existing technologies being overly reliant on human experience, having poor adaptability, and being difficult to reliably deploy on resource-constrained edge devices. Summary of the Invention
[0006] In view of this, embodiments of the present invention provide a method, apparatus and computer program for lightweighting YOLO models based on multi-agent collaboration, which solves the defects of existing YOLO model compression methods that rely heavily on expert experience, lack automated closed-loop optimization capabilities and are difficult to adapt to diverse edge deployment constraints.
[0007] One aspect of the present invention provides a lightweight method for YOLO models based on multi-agent cooperation, the method comprising the following steps: The system receives the model configuration file, weight file, and task requirements of a YOLO model provided by the user; the task requirements record the model compression constraints; the model configuration file is parsed to obtain the model structure, and the task requirements are semantically parsed to obtain constraint information; A first prompt word project is introduced, and the strategy generation agent is input into the model structure, weight file, and constraint information respectively. The strategy generation agent includes multiple decision generation large language models and decision arbitration large language models with differentiated inference-driven logic. Each decision generation large language model selects candidate schemes for compression strategies based on task complexity analysis and self-determinism assessment, constructing inference paths according to basic compression theory, YOLO structural knowledge, and hardware constraint knowledge; or selects a method based on enhanced retrieval, generating search keywords to retrieve relevant entries in a preset compression knowledge database, and then integrating the inference context to obtain candidate schemes for the compression strategies. A second prompt word project is introduced, and the decision arbitration large language model is input into each of the candidate schemes, outputting the performance evaluation results of each candidate scheme and determining the compression strategy. The model configuration file, the weight file, and the compression strategy are transferred to the code implementation agent, and the resulting engineering code is converted and output.
[0008] In some embodiments, the method further includes: The engineered code is input into the feasibility verification agent, which constructs a syntax analysis tree to extract the program structure and verify the syntax integrity. It also parses the referenced dependency libraries and external resources and checks the dependency availability. If the syntax integrity and dependency availability checks pass, the complete engineered code is run in the first sandbox environment. If the run is successful, a verification success message is displayed. If it fails, the process is terminated and a failure message is generated. The validated engineered code is input into the performance evaluation agent for training and testing in a second sandbox environment, and the output displays preset performance parameters.
[0009] In some embodiments, parsing the model configuration file yields the model structure, and semantic parsing the task requirements yields constraint information, including: The AST module of Python is used to parse the Python script submitted by the user for loading and running the YOLO model, extract the model configuration file, construct a static grammar, perform layer type statistics and connection pattern analysis, and represent the model structure in a structured way. The task requirements are subjected to format detection, language detection, and noise filtering. A domain-adaptive named entity recognition model is used to identify hardware entities, performance entities, and constraint entities. Conditional logic analysis and fuzzy constraint quantization are then performed to obtain the constraint information.
[0010] In some embodiments, the first prompt word project and the second prompt word project include a role definition section, a task description section, and a constraint description section; The role definition section of the first prompt word project defines the role of the decision generation large language model as a model quantization compression expert. The task description section includes prompt task understanding and analysis, compression strategy generation, inference chain recording, self-evaluation and confidence labeling. The constraint description section references the constraint information. The role definition section of the second prompt word project defines the role of the decision arbitration big language model as a compression strategy evaluation and integration expert. The task description section includes a statement of decision principles, an evaluation framework and evaluation criteria description, a task execution process description, a comparative analysis scheme and integration strategy, and a constraint description section including requirements for the output format. The decision-generating large language model includes the Qwen large language model based on introspective multi-perspective collaborative reasoning, the DeepSeek large language model based on relational mapping logical self-consistent reasoning, the Llama large language model based on probability-driven generative reasoning, and the GPT large language model based on tool-enhanced multimodal reasoning; the decision-generating large language model also selects sub-versions of various large language models based on reasoning cost and response speed. The maximum inference depth of the decision arbitration big language model is higher than the set value, and the decision arbitration big language model adopts the Gemini 3.0 Pro big language model.
[0011] In some embodiments, the decision-generating large language model determines whether to perform enhanced retrieval by analyzing task complexity and monitoring its own level of certainty, including: The model structure complexity and constraint strictness of the YOLO model to be lightweight are calculated based on the first preset rule; the reasoning depth index, knowledge reference integrity index and scheme specificity index are dynamically detected in the reasoning process based on the second preset rule; and the enhanced retrieval method is selected based on the preset standard.
[0012] In some embodiments, the pre-deployment process of the preset compressed knowledge database includes: Collect and validate YOLO model compression strategy cases, including quantization, pruning, and knowledge distillation operations for models with specific model structures and parameter sizes, and verify their feasibility; For the YOLO model compression strategy case, extract keywords, compression strategy descriptions, and corresponding reference code; The keywords are vectorized for retrieval, and the vectorized keywords, the corresponding compression strategy description, and the reference code are stored in the ChromaDB database.
[0013] In some embodiments, the code implementation agent loads the DeepSeek-Coder-V2 / V3 model, StarCoder2 model, CodeLlama-70B-Instruct model, Qwen-2-Coder model, or GPT-4o model to generate the engineered code; The feasibility verification agent loads the DeepSeek-Coder-V2 / V3 model or the CodeLlama-70B-Instruct model, and uses static analysis tools and dynamic sandbox tools to verify the feasibility of the engineered code. The performance evaluation agent is loaded with a Qwen-Max model or a Claude 3 Opus model, and uses metric collection tools and data visualization tools to evaluate the performance of the engineered code.
[0014] On the other hand, the present invention also provides a lightweight device for YOLO model based on multi-agent collaboration, including a processor, a memory, and a computer program or instructions stored in the memory. The processor is used to execute the computer program or instructions, and when the computer program / instructions are executed, the device implements the steps of the above method.
[0015] On the other hand, the present invention also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.
[0016] On the other hand, the present invention also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.
[0017] The present invention describes a YOLO model lightweighting method, device, and computer program based on multi-agent collaboration. It constructs an agent-based collaborative workflow encompassing policy generation, evaluation and arbitration, and code implementation. By receiving and parsing model configuration files, weight files, and task requirements, it utilizes differentiated prompt word engineering to drive multiple decision-generating large language models. These models can autonomously select from internal knowledge reasoning or external retrieval enhancement methods based on task complexity and their own determinism to generate diverse compression strategy candidate schemes. The arbitration large language model then performs multi-dimensional comprehensive evaluation and strategy integration. Finally, the code implementation agent automatically converts the optimized compression strategy into executable engineering code. This achieves full-process automation from model parsing and policy generation to code implementation, significantly reducing the reliance on expert experience in model compression and improving the adaptability, reliability, and deployment efficiency of the lightweighting process.
[0018] Additional advantages, objects, and features of the invention will be set forth in part in the description which follows, and will also become apparent in part to those skilled in the art upon studying the description, or may be learned by practice of the invention. The objects and other advantages of the invention can be realized and obtained by means of the structures specifically pointed out in the specification and drawings.
[0019] Those skilled in the art will understand that the objectives and advantages achievable with the present invention are not limited to those specifically described above, and that the above and other objectives achievable with the present invention will become clearer from the following detailed description. Attached Figure Description
[0020] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, are not intended to limit the scope of the invention. In the drawings: Figure 1 This is a flowchart illustrating a method for lightweighting the YOLO model based on multi-agent collaboration, as described in an embodiment of the present invention.
[0021] Figure 2 This is a schematic diagram illustrating the working logic of the end-to-end automated YOLO model compression method according to an embodiment of the present invention.
[0022] Figure 3 This is a schematic diagram illustrating the working logic of the feasibility verification agent in the end-to-end automated YOLO model compression method according to an embodiment of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this invention are used to explain the invention, but are not intended to limit the invention.
[0024] It should also be noted that, in order to avoid obscuring the invention with unnecessary details, only the structures and / or processing steps closely related to the solution according to the invention are shown in the accompanying drawings, while other details that are not closely related to the invention are omitted.
[0025] It should be emphasized that the term "including / comprises" as used herein refers to the presence of a feature, element, step, or component, but does not exclude the presence or addition of one or more other features, elements, steps, or components.
[0026] In existing technologies, although multi-agent collaborative frameworks have been applied to fields such as code generation and complex task reasoning, current methods still heavily rely on experts to manually design compression processes and optimize parameters for compression tasks of deep learning models such as YOLO. This process is cumbersome and difficult to transfer. At the same time, existing agent systems lack a deep integration of understanding of model structure and knowledge of compression domains. Their processing objects are mostly general logic or text information, and they cannot achieve end-to-end automated processes from automatic policy generation and feasibility verification to performance closed-loop optimization. This results in poor adaptability, low efficiency, and insufficient reliability when facing diverse edge deployment constraints.
[0027] In view of this, the present invention provides a lightweight method for YOLO models based on multi-agent cooperation, such as... Figure 1 As shown, the method includes the following steps S101~S103: Step S101: Receive the model configuration file, weight file, and task requirements of the YOLO model provided by the user; record the model compression constraints in the task requirements; parse the model configuration file to obtain the model structure, and perform semantic parsing on the task requirements to obtain constraint information.
[0028] Step S102: Introduce the first prompt word project, and input the strategy generation agent with the model structure, weight file and constraint information respectively. The strategy generation agent includes multiple decision generation big language models and decision arbitration big language models with different reasoning-driven logic. Each decision generation big language model selects candidate schemes for compression strategies based on task complexity analysis and self-determinism assessment, and constructs reasoning paths according to basic compression theory, YOLO structural knowledge and hardware constraint knowledge; or selects a method based on enhanced retrieval, generates search keywords to retrieve relevant entries in the preset compression knowledge database, and integrates the reasoning context to obtain the candidate schemes of the compression strategy; Introduce the second prompt word project, and input each candidate scheme with the decision arbitration big language model, output the performance evaluation results of each candidate scheme and determine the compression strategy.
[0029] Step S103: Transfer the model configuration file, weight file, and compression strategy to the code implementation agent and convert the output into engineering code.
[0030] In step S101, user input is first received and processed, which is the starting point of the entire automated process. Specifically, the received model configuration file and weight file are the source code locations of a typical YOLO model network. The source code is a Python script (such as train.py or inference.py) used to load and run the YOLO model. Its function is to locate the paths and loading methods of the model configuration file (e.g., .yaml) and weight file (e.g., .pt). The task requirements are the compression goals and constraints proposed by the user in natural language or structured forms, such as deploying to Jetson Nano, model size less than 10MB, and accuracy loss not exceeding 3%. During implementation, the parsing of the model configuration file adopts a combination of static and dynamic methods: static parsing extracts class definitions, layer structures, and connection relationships by analyzing the abstract syntax tree; dynamic parsing instantiates the model in an isolated sandbox environment, traverses all modules in conjunction with the weight file, accurately obtains structured information such as the type of each layer, the number of input and output channels, and the size of the convolutional kernel, and calculates key indicators such as the number of parameters and FLOPs. Meanwhile, the semantic parsing of task requirements utilizes a named entity recognition model finely tuned with domain knowledge to accurately extract key constraint entities such as hardware platform, performance threshold, and priority description, and quantifies them into a machine-processable set of weighted structured constraints, such as {max_size_mb: 10, min_fps: 30, max_map_drop: 0.03}, thereby providing clear and quantifiable targets for subsequent agent decision-making.
[0031] In some embodiments, the model structure is obtained by parsing the model configuration file, and the constraint information is obtained by semantic parsing the task requirements, including steps S1011~S1012: Step S1011: Use Python's AST module to parse the user-submitted Python script for loading and running the YOLO model, extract the model configuration file to construct a static grammar, perform layer type statistics and connection pattern analysis, and represent the model structure in a structured way.
[0032] Specifically, the system converts model configuration files into a structured model representation through static analysis and structural reconstruction. Utilizing abstract syntax tree parsing technology, it extracts the model configuration files used in the Python script's source code, extracting detailed parameters, connections, and control flow logic of the network layers without running the code, thereby reconstructing a complete computational graph topology. Based on this, the system automatically analyzes the distribution of various layers, identifies key structural patterns such as residual connections and feature pyramids, and ultimately generates a structured digital blueprint containing micro-layer information, macro-component partitioning, and core indicators such as total parameters and computational cost, providing a precise model profile for subsequent decision-making.
[0033] Step S1012: Perform format detection, language detection and noise filtering on the task requirements, use a domain-adaptive named entity recognition model to identify hardware entities, performance entities and constraint entities, and perform conditional logic analysis and fuzzy constraint quantization to obtain constraint information.
[0034] Specifically, the system aims to transform users' vague natural language requirements into precise quantitative constraints. The process begins with formatting, language conversion, and filtering of irrelevant information from the input text. Next, a named entity recognition model, finely tuned with domain knowledge specifically for model compression, is invoked to accurately extract key entities from the text, such as hardware platforms, performance metrics, and constraint relationships. The system further analyzes the conditional logic and priorities between these entities and performs quantitative anchoring of vague expressions such as "as fast as possible" and "small enough" based on context and domain common sense. Finally, it outputs a structured constraint set containing target values, tolerance thresholds, and weight coefficients, thus clearly defining the specific goals and acceptance criteria of the compression task.
[0035] In step S102, first cue word engineering is used to construct expert roles and inference contexts for multiple differentiated decision-making large language models (LLMs). Differentiated roles can also be defined separately to guide different task orientations; for example, one model is prompted to act as a structural pruning expert, focusing on analyzing the redundancy of each layer of the model; another acts as a quantization deployment expert, focusing on the operator support of the target hardware.
[0036] Each model evaluates task complexity based on the structured information and quantified constraints obtained from step S101. For example, the YOLOv8n model has X convolutional layers, with the Yth layer having the highest computational cost. The model must be ≤10MB, and the model must simultaneously satisfy both extremely low precision loss and extremely high compression rate for a high-complexity task. Subsequently, based on its certainty about the current inference path, the model autonomously decides whether to initiate enhanced retrieval: if the model lacks confidence in a certain technical detail, it generates targeted search keywords and retrieves relevant compression strategies from a pre-set compression knowledge database to strengthen its reasoning basis. The candidate solutions generated in parallel by all models are then submitted to the decision arbitration big language model. At this point, the second prompt word project guides the decision arbitration big language model to act as the chief architect. Its prompt words can explicitly require quantitative and qualitative comparative evaluation of each candidate solution from multiple pre-set dimensions such as technical feasibility, accuracy preservation, hardware adaptability, implementation risk, and resource consumption. The decision arbitration big language model not only provides a score, but also generates a detailed evaluation report. It may also creatively integrate the advantages of each option, such as "adopting the pruning ratio of option A, but using the more robust quantitative calibration strategy of option B, and adding the distillation fine-tuning stage suggested by option C as a guarantee of accuracy", and finally outputting a final compression strategy that has been deeply demonstrated and optimized.
[0037] In some embodiments, the first prompt word project and the second prompt word project include a role definition section, a task description section, and a constraint description section.
[0038] The first prompt word project's role definition section defines the role of the decision-making large language model as a model quantization and compression expert. The task description section includes prompt task understanding and analysis, compression strategy generation, inference chain recording, self-evaluation, and confidence labeling. The constraint description section references constraint information.
[0039] The second prompt word's role definition section defines the role of the decision arbitration big language model as a compression strategy evaluation and integration expert. The task description section includes a statement of decision principles, an evaluation framework and evaluation criteria description, a task execution process description, a comparative analysis scheme and integration strategy, and a constraint description section including requirements for the output format.
[0040] The decision-generating large language model includes the Qwen large language model based on introspective multi-perspective collaborative reasoning, the DeepSeek large language model based on relational mapping-based logical self-consistent reasoning, the Llama large language model based on probability-driven generative reasoning, and the GPT large language model based on tool-enhanced multimodal reasoning. The decision-generating large language model also selects sub-versions of each large language model based on reasoning cost and response speed. The maximum reasoning depth of the decision-arbitration large language model is higher than the set value, and the decision-arbitration large language model adopts the Gemini 3.0 Pro large language model.
[0041] Among them, the strategy generation model focuses on breadth coverage and response efficiency, requiring the model to have rich knowledge reserves and rapid divergent thinking ability, aiming to propose as many solutions as possible from multiple dimensions; the arbitration model focuses on deep reasoning and decision quality, and its role is to make the optimal solution in complex trade-offs.
[0042] Furthermore, in the policy generation stage, a combination of models with balanced inference costs, fast response speeds, and strong capabilities can be selected, including Qwen-Max, Qwen-Plus, and DeepSeek-V3.2. Among them, Qwen-Max, as the most effective model in the Tongyi Qianwen series, emphasizes detailed, rigorous, and structured reasoning, particularly excelling in mathematical reasoning and logical derivation, providing the system with a comprehensive baseline solution. Qwen-Plus, while ensuring output quality, significantly improves response speed and computational cost efficiency, rapidly generating a large number of candidate policies and providing the system with a broad policy exploration space. DeepSeek, as one of the best-performing open-source models currently available, with its unique training architecture and innovative thinking mode, can capture more details and potential optimization directions during policy generation.
[0043] For policy arbitration models, Google's Gemini 3.0 Pro can be selected. It not only possesses excellent long-context understanding capabilities, enabling it to simultaneously process and compare multiple previously generated candidate policies, but also conducts comprehensive and in-depth evaluations based on multiple dimensions such as task requirements, performance constraints, and feasibility analysis. Gemini 3.0 Pro's multi-dimensional decision-making capabilities allow it to make optimal decisions within a complex compressed policy space, ensuring that the system's output policy not only meets the task objectives but also possesses high feasibility and efficiency.
[0044] In some embodiments, the decision-generating large language model determines whether to perform enhanced retrieval by analyzing task complexity and monitoring its own level of certainty, including: calculating the model structure complexity and constraint strictness of the YOLO model to be lightweight based on a first preset rule; dynamically detecting inference depth indicators, knowledge reference integrity indicators, and scheme specificity indicators in the inference process based on a second preset rule; and selecting whether to perform enhanced retrieval based on preset criteria.
[0045] Specifically, before initiating detailed inference, the model quickly scans the parsed model structure and constraint information, calculating an initial complexity score. For example, if the model structure parsing results show that the target is a YOLO variant containing a dynamic attention module, and the constraint requires "achieving less than 1% accuracy loss on resource-constrained embedded devices," the system will identify this as a challenging task with both high architectural complexity and stringent constraints. This evaluation acts as an early warning system, anticipating potential deficiencies in its inherent knowledge even before the model has deeply considered specific solutions, thus significantly increasing its tendency to initiate retrieval for such tasks.
[0046] During the specific process of generating a solution, the model continuously performs introspective analysis. The "inference depth metric" it monitors is similar to checking whether its thinking remains superficial. For example, does the solution merely list terms like pruning and quantization, or does it elaborate on how to determine the importance of each channel based on the BN layer scaling factor and perform structured pruning? The knowledge reference integrity metric assesses whether its proposals stem from general principles or can be linked to specific algorithm names or known practices. The solution specificity metric directly measures whether the output contains executable parameters, such as "pruning rate 30%" or the vague "perform appropriate pruning." When monitoring detects weak inference chains, vague knowledge references, or ambiguous solution parameters, it indicates that the model is in a state of low determinism.
[0047] The model makes choices based on pre-defined decision criteria (such as a combination of confidence and complexity thresholds). For example, even when faced with a moderately complex task, if the model lacks confidence in considering the details of quantization calibration, it will still proactively generate precise keywords to initiate a search. Conversely, for a task with a conventional structure and loose constraints, where the model can generate a highly deterministic and specific solution based on its own knowledge, it will choose not to search in order to improve efficiency.
[0048] In some embodiments, the pre-deployment process of the preset compressed knowledge database includes steps S1021 to S1023: Step S1021: Collect and validate YOLO model compression strategy cases, including quantization, pruning, and knowledge distillation operations for models with specific model structures and parameter sizes, and verify their feasibility.
[0049] Step S1022: Extract keywords, compression strategy descriptions, and corresponding reference code for YOLO model compression strategy cases.
[0050] Step S1023: Vectorize the keywords for retrieval, and store the vectorized keywords, corresponding compression strategy descriptions, and reference codes using the ChromaDB database.
[0051] This pre-deployment process constructs a structured, efficiently searchable domain knowledge base specifically for YOLO model compression. It first systematically collects validated compression strategy examples from authoritative papers, open-source projects, and practical reports, ensuring that each example is associated with a specific model structure, parameter scale, and effectiveness verification on the target hardware. Then, each example is structurally refined, extracting core keywords for retrieval, complete strategy description text, and core code snippets that can be directly referenced or adapted. Finally, by converting keywords into vector embeddings and storing and managing them using the ChromaDB vector database, subsequent agents can perform fast and accurate retrieval based on semantic similarity, thereby transforming discrete expert experience into digital knowledge assets that the system can directly call upon and reason about.
[0052] Step S103 marks the transition from policy decision-making to engineering implementation. This step delivers the final compressed policy produced in the previous steps, along with the original model configuration file and weight file, to the code implementation agent. The core task of this agent is to transform the abstract, text-described policy instructions into engineering code, typically a Python script, that can be immediately run or debugged in the target environment. Its implementation involves several key steps: First, the agent performs environment and dependency verification, checking the availability and version compatibility of the tool libraries mentioned in the policy. Next, based on its understanding of the model configuration file structure, it maps each policy instruction to specific code operations. For example, "prune the 5th to 10th convolutional layers by 30%" is converted into a function that calls the corresponding pruning API, precisely passing in the layer identifier and scaling parameters. Simultaneously, it inserts scaffolding code into the code to complete the entire process, including model loading, data preprocessing, training loops (such as fine-tuning), evaluation, and result saving. To ensure code reliability, the generated code typically undergoes a static analysis, such as syntax and import checks, before being placed in a minimal trial run within an isolated sandbox consistent with the target environment to verify its basic execution correctness. The final output is a complete, independently runnable project file that users can directly use to initiate the compression process or have the system trigger execution in an automated pipeline, thus truly achieving end-to-end automated delivery of decision-making and code.
[0053] In some embodiments, the method further includes steps S104 and S105: Step S104: Input the engineered code into the feasibility verification agent, construct a syntax analysis tree for the engineered code to extract the program structure and verify the syntax integrity, parse the referenced dependency libraries and external resources, and check the dependency availability; if the syntax integrity and dependency availability checks pass, run the complete engineered code based on the first sandbox environment. If the run is successful, a verification success message will be displayed; if it fails, the process will terminate and a failure message will be generated.
[0054] Step S105: Input the verified engineering code into the performance evaluation agent for training and testing in the second sandbox environment, and output the preset performance parameters.
[0055] In step S104, the core task is to ensure that the engineered code generated by the strategy is actually executable, which is a key bridge connecting automated decision-making and reliable deployment. The feasibility verification agent first performs a deep static analysis of the code. This is not a simple syntax check, but rather the construction of a complete syntax analysis tree to deconstruct the program's logical structure, identifying all function calls, class definitions, control flow, and the most critical resource dependency paths. For example, when the code contains an import statement like "from torch_pruning import dependency", the agent will analyze whether the library is a core dependency required by the project and further verify whether its version is compatible with the API interfaces used in the code. Simultaneously, it will also keenly detect references to specific file paths or dataset paths in the code and pre-check whether these resources are reachable and correctly formatted within the context of the first sandbox environment. Only after the static analysis confirms that all syntax elements are complete and dependencies are satisfied will the code be submitted to the dynamic runtime verification stage. At this point, the system will attempt to run the entire engineered code in a completely isolated first sandbox environment consistent with the final target platform. This sandbox environment is pre-configured with the necessary underlying drivers and basic dependencies, but strictly limits network access and file system writes to prevent experimental code from causing any unexpected impact on the production environment. During operation, the agent monitors standard output, error streams, and system resource usage in real time. If the code executes successfully and outputs the expected intermediate files, the verification is successful. If the operation crashes due to uncaught exceptions, library version conflicts, memory overflows, or resource deficiencies, the agent will not only terminate the process but also comprehensively analyze error logs, stack traces, and previous static analysis results to generate a structured failure message that clearly indicates the root cause of the failure, such as "missing 'torchvision 0.15' version dependency" or "weight file path '. / input / model.pt' does not exist." This information is then fed back as key feedback to the code implementation agent, triggering automatic code correction and iteration.
[0056] Step S105 aims to perform empirical performance evaluation on the validated code to quantitatively verify whether the actual effect of the compression strategy has achieved the preset goals. The performance evaluation agent will perform this task in a separate, independent second sandbox environment, specifically optimized for model training and testing, equipped with the necessary GPU support and benchmark datasets. The agent first initiates the training or fine-tuning phase of the compression process, such as performing knowledge distillation or quantization-aware training. During this process, it does not passively run scripts but actively monitors the training dynamics, parsing logs to capture key information, such as the convergence of the loss curve, model save points, and the presence of gradient anomalies. After training, the agent automatically loads the obtained optimal or final model and performs a comprehensive inference evaluation on a reserved test dataset. Its evaluation goes far beyond a single accuracy metric, constructing a multi-dimensional performance profile: it not only calculates the mean average accuracy (mAP) to measure accuracy preservation but also tests the model's inference speed (frame rate FPS or single-frame latency) in detail, accurately measures the compressed model file size, and may evaluate simulated power consumption or memory usage based on task requirements. All these metrics will be automatically compared with the original model performance baseline parsed in step S101 and the constraints explicitly stated in the task requirements. Ultimately, the agent does not simply output a binary "pass / fail" decision, but generates a comprehensive evaluation report. This report clearly shows the achievement of each preset performance parameter in the form of structured data and visual charts, such as "Model size: 9.8MB, meeting the ≤10MB requirement; Inference speed: 35 FPS, meeting the ≥30FPS requirement; mAP decrease: 2.5%, meeting the ≤3% requirement." This provides an objective and quantitative final verification conclusion for the entire automated lightweight process and marks the completion of the end-to-end closed loop from requirement input to verification delivery.
[0057] In some embodiments, the code implementation agent loads the DeepSeek-Coder-V2 / V3 model, StarCoder2 model, CodeLlama-70B-Instruct model, Qwen-2-Coder model, or GPT-4o model to generate engineered code.
[0058] The feasibility verification agent loads the DeepSeek-Coder-V2 / V3 model or the CodeLlama-70B-Instruct model, and combines static analysis tools and dynamic sandbox tools to verify the feasibility of the engineered code.
[0059] Static analysis tools can include pylint for syntax checking, tree-sitter for syntax tree building, and pipreqs for dependency extraction. Dynamic sandboxing tools can include Docker components for environment isolation and PyTest for automated test case generation and execution.
[0060] The performance evaluation agent is loaded with the Qwen-Max model or the Claude 3 Opus model, and uses metric collection tools and data visualization tools to evaluate the performance of the engineered code.
[0061] Metrics acquisition tools may include TorchMetrics for calculating accuracy metrics, PyTorch Profiler for inference time analysis, and NVIDIA Nsight for monitoring GPU resource usage. Data visualization tools may include Matplotlib and Seaborn for automatically generating visualization code from models.
[0062] On the other hand, the present invention also provides a lightweight device for YOLO model based on multi-agent collaboration, including a processor, a memory, and a computer program or instructions stored in the memory. The processor is used to execute the computer program or instructions, and when the computer program / instructions are executed, the device implements the steps of the above method.
[0063] On the other hand, the present invention also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.
[0064] On the other hand, the present invention also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.
[0065] The present invention will now be described with reference to a specific embodiment: This embodiment aims to provide an end-to-end automated YOLO model compression method. The input is a user-provided YOLO model weight file, and it can also receive user-defined metrics such as accuracy thresholds, model size limits, and inference latency. The output is a lightweight model that meets preset performance metrics and an optimization report. The validity of the input file is verified through preprocessing, and multi-agent collaboration is used to complete compression strategy generation, code implementation, automatic error correction based on error feedback, and strategy iteration based on performance feedback, ultimately generating a lightweight model that can be directly deployed.
[0066] This embodiment employs a multi-agent collaborative architecture and organizes and schedules the overall process based on the LangGraph state graph mechanism. To achieve precise control and traceable flow of the global state, this embodiment encapsulates agents with different functions as independent process nodes, allowing them to execute sequentially in the state graph as nodes, jump through conditional branches, or iterate cyclically based on performance feedback. Figure 2 As shown, four types of intelligent agents are designed, each responsible for key functions such as compression strategy generation, code implementation, feasibility verification, and performance evaluation. To ensure that these agents can perform inference, collaborative information processing, and drive code execution, training, and testing normally during execution, this embodiment constructs an isolated sandbox execution environment and provides a professional domain knowledge base, which includes model compression strategies, typical implementation paradigms, and corresponding engineering code templates. Simultaneously, this embodiment integrates multiple mainstream large language model API interfaces to achieve unified encapsulation and scheduling of inference capabilities for different models. By providing standardized calling interfaces, flexible switching between multiple models can be achieved, thereby improving the inference stability and result reliability in strategy generation, code implementation, and error correction stages.
[0067] The overall process begins at the input node. After receiving the model configuration file, weight file, and task requirements provided by the user, the input preprocessing node first performs format parsing, integrity verification, and resource standardization to ensure the legality and usability of the input data. After preprocessing, the state graph automatically flows to the subsequent automated model compression process, and various tasks are progressively advanced through multi-agent collaboration.
[0068] The policy generation agent is responsible for the most critical part of the entire task: generating compression policies. Its output quality directly affects the subsequent compression effect, including accuracy preservation, inference efficiency, and edge deployment friendliness. To address the problems of traditional policies relying on experience and being difficult to automate, this method designs a multi-model collaborative compression policy generation mechanism based on retrieval-enhanced generation technology.
[0069] In this mechanism, the input YOLO model structure is first deeply analyzed, and preliminary semantic and constraint information is extracted in conjunction with the task objective. Based on these analysis results, this method launches multiple large language models in parallel. Each model decides whether to initiate a search in its built-in professional knowledge base based on its own reasoning needs. If a search is selected, search keywords are generated, and its reasoning context is strengthened based on the search results. Each large model ultimately outputs a candidate compression strategy, which not only includes detailed compression steps and implementation points, but also provides an explanation of the rationality of the solution, the knowledge sources on which it is based, and a complete reasoning chain. Subsequently, a more capable arbitration model quantitatively and qualitatively evaluates the candidate strategies from the dimensions of executability, accuracy preservation capability, computational constraint adaptability, and training recoverability, and integrates and optimizes the strategies to ultimately form an efficient and engineering-feasible compression solution for edge deployment.
[0070] Once the final strategy is determined, the data is processed by a code implementation agent. This agent is responsible for automatically translating the abstract compression strategy into actual, executable Python project code. To ensure the engineering quality and executability of the code, the agent has the ability to actively invoke tools during the generation process. It can detect the reachability of key resources such as dataset paths, pre-trained weights, and dependent library versions in real time, thereby avoiding common errors such as inconsistent file paths, environment configurations, and dependencies during the generation phase. The code implementation agent ultimately outputs engineered compression code with preliminary execution capabilities.
[0071] After the project code is generated, it is handed over to a feasibility verification agent for multi-stage verification to ensure that the code can be fully executed in a real environment. This agent first performs static analysis, extracting dependencies through a syntax tree, checking the validity of library imports and file paths, and recording potential risks. If the static checks pass, the agent performs dynamic verification in an isolated sandbox, including dynamic parameter adjustment, small-scale runs, and simulation of key processes. If the code is found to be infeasible, the agent analyzes the root cause of the problem based on error logs and generates actionable repair suggestions. These suggestions, along with the original code, are then sent back to the code implementation agent for automatic correction. This process can be repeated multiple times until the code fully passes feasibility verification.
[0072] After the code passes feasibility verification, it will enter the training and testing phase handled by the performance evaluation agent. This agent will perform lightweight model training and necessary fine-tuning operations in an isolated sandbox environment. Upon completion of training, the agent will evaluate the inference performance of the compressed model on a standard test set and comprehensively assess key metrics such as average accuracy, inference frame rate, and model size in the metrics verification module. If all metrics meet the preset requirements, the final compressed model and a complete evaluation report will be output, and the process will end. If any metrics fail to meet the standards, the performance evaluation agent will conduct an in-depth analysis of the key reasons for performance degradation, such as determining whether excessive pruning has led to accuracy loss, and propose parameter adjustments or strategy optimization suggestions accordingly. This feedback is then sent back to the code implementation agent, triggering a new round of code generation and training loops until the model performance meets the final delivery standards.
[0073] Specifically, the inputs in this embodiment include model weight files, model configuration files, task description information, performance metric requirements, and evaluation dataset paths. At the start of the method execution, the above inputs are first preprocessed, including validating the file format and path validity, and converting the model weights or model configuration files into standardized Python code snippets that can be directly read and manipulated by subsequent steps. Simultaneously, this method initializes a task status table based on the input content to record basic information about the compression task and intermediate results that need to be maintained subsequently.
[0074] After input preprocessing and task state initialization, the method enters the model compression execution phase based on multi-agent collaboration. Agents with different functions participate in steps such as policy generation, code implementation, feasibility verification, and performance evaluation according to the task state sequence. A state-driven mechanism is used to continuously advance and optimize the compression process. The specific execution process is described below: 1. Policy-generating intelligent agents The agent first performs a deep analysis of the YOLO model structure used. By reading the model configuration file, basic information such as the network's hierarchical structure and the number of channels can be directly extracted. Simultaneously, preliminary semantic information and constraints, such as object detection accuracy, inference latency, and computational limitations, are extracted in conjunction with the task objective. This structured information constitutes the initial context for generating the model compression strategy, providing a foundation for subsequent strategy design.
[0075] The initial prompts predefine the model output specifications and task understanding requirements, and provide a list of optional compression methods. The prompts not only guide the model in generating compression schemes but also clarify output format and content requirements, ensuring that each strategy includes a justification statement, cited knowledge sources, and a complete inference chain.
[0076] This embodiment employs a multi-model collaborative compression strategy generation mechanism based on retrieval-enhanced generation technology for strategy generation. First, multiple large language models are launched in parallel, with each model performing inference independently. Depending on the inference requirements, the model can choose whether to initiate a retrieval from its built-in professional knowledge base. If a retrieval is selected, relevant knowledge entries are retrieved from the vectorized knowledge base based on the retrieval keywords generated by the model, and the retrieval results are integrated into the inference context to enhance the rationality and feasibility of the generated strategy. Each model ultimately outputs a set of candidate compression strategies, including specific compression steps, strategy basis, and a complete inference chain, providing sufficient information for subsequent scheme integration and evaluation.
[0077] Building upon this foundation, a more powerful large model is introduced as an arbitrator to systematically evaluate all candidate solutions. Evaluation dimensions include policy executability, accuracy preservation, computational adaptability, and training recoverability. After optimal integration, a highly efficient compression solution is output that can be directly deployed on edge devices, achieving a unified goal of model lightweighting and performance optimization.
[0078] To clearly characterize the information interaction and arbitration mechanisms in multi-model collaborative reasoning and decision-making processes, this study formalizes the compressed strategy generation process into a mathematical expression as follows: For compression strategy generation task Larger models with stronger selection capabilities As arbitrators, the remaining models This is used to generate candidate compression strategies. The output of each large model is combined with the knowledge base it references as a candidate solution, expressed as: ; in, Candidate solutions; To generate the complete reasoning chain for this solution, i.e., the basis for the decision; For the referenced knowledge base entries.
[0079] Therefore, the outputs generated by all parallel models constitute a set of alternative solutions: ; arbiter Evaluate each candidate and calculate its credibility. Among them, the evaluation function The study comprehensively considers task requirements, the feasibility of the strategy, the ability to maintain accuracy, the adaptability of computing power, and the recoverability of training.
[0080] ; The final compression scheme selected: .
[0081] 2. Implement the intelligent agent in code. After the compression scheme is finalized, the data will be transferred to a code generation agent, which will be responsible for converting the abstract compression strategy into directly executable Python code. This agent has tool-calling capabilities during the code generation phase, and can verify the existence and accuracy of key resources such as dataset paths and pre-trained weight paths in real time, avoiding path errors caused by inconsistent environment configurations from the outset. The output is in a predefined JSON format, including an indicator of whether additional dataset or model information is needed; if no additional resources are needed, the output will provide a complete Python code snippet. The code will then be automatically extracted from the output and written to the global state, achieving a fast and reliable mapping from the abstract compression strategy to executable code on the client side.
[0082] 3. Feasibility Verification Intelligent Agent like Figure 3 As shown, in the code feasibility assessment phase, the agent first performs static analysis on the generated project code, and then conducts necessary dynamic trials in an isolated sandbox environment to verify its runnability under real execution conditions. The static analysis phase extracts the program structure and verifies syntactic integrity by constructing a syntax analysis tree, while simultaneously parsing the dependent libraries and external resources referenced in the code. Dependency loading and consistency checks are performed based on the sandbox environment to ensure that the environment before execution meets the code's logical requirements. After completing static verification, the complete code is written to a file and dynamically run in the sandbox environment. Parameter adjustments are made to keep the trial run scope under a minimal configuration to reduce unnecessary overhead. During dynamic execution, the program's standard output and error logs are captured in real time for subsequent feasibility assessment and automated repair processes.
[0083] When static or dynamic checks indicate that the code is infeasible, error logs and exception information are used as input. The reasoning capabilities of a large language model are leveraged to analyze syntax problems, dependency conflicts, missing paths, and logical errors, generating targeted remediation suggestions. These suggestions, along with the original model configuration file and relevant error context, are passed back to the code generation agent to drive automated code correction. The corrected code then re-enters the static analysis and sandbox running verification steps, repeating this process until all checks pass, ensuring that the final code can execute stably and correctly in a unified environment.
[0084] 4. Performance evaluation of the intelligent agent After the code passes feasibility verification, it immediately enters the model training and testing phase. This phase is executed in an isolated sandbox environment to ensure operational independence and avoid impacting the external environment. First, the generated code is written to a temporary script file, and the training task is started as an independent subprocess. Training output is captured in real time, and all information is written line by line to a log file, with key progress displayed synchronously on the terminal. During training, the output content is automatically parsed, recording key information such as the model save path, results directory, and the locations of the best and latest model files. Simultaneously, the start and end times of training, runtime, and exit status are monitored.
[0085] After training, the best model will be extracted based on the recorded path information and used as input for subsequent performance evaluation. During the evaluation phase, the model is first loaded into a sandbox environment, and complete inference is performed on the test set. GPU memory usage is continuously monitored before and after model loading, during single-image inference, and at key points in the complete evaluation process. In addition to performance metrics such as accuracy, recall, and mAP, information such as model file size, inference speed, and parameter size is also extracted to form a comprehensive evaluation result.
[0086] The performance verification phase then begins. If core metrics such as average accuracy, inference speed, and model size meet the preset requirements, the final compressed model and a detailed evaluation report will be directly output, and the process will end. If the metrics fail to meet the requirements, the AI will analyze possible causes based on the performance gap, such as determining whether excessive pruning has led to accuracy loss, and generate corresponding parameter adjustment or strategy optimization suggestions. This information will be fed back to the code adjustment phase, triggering a new round of code correction, training, and testing cycles until the model performance meets the final delivery standards.
[0087] Corresponding to the above method, the present invention also provides an apparatus / system including a computer device, the computer device including a processor and a memory, the memory storing computer instructions, the processor executing the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the apparatus / system performs the steps of the method as described above.
[0088] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the aforementioned edge computing server deployment method. The computer-readable storage medium can be a tangible storage medium, such as random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, floppy disks, hard disks, removable storage disks, CD-ROMs, or any other form of storage medium known in the art.
[0089] In summary, this invention proposes a lightweight YOLO model method, device, and computer program based on multi-agent collaboration. By constructing an intelligent collaborative workflow integrating policy generation, evaluation arbitration, and code implementation, it achieves a high degree of automation and intelligence throughout the entire model compression process. This scheme takes model configuration files, weight files, and task requirements as input. After intelligent parsing, it leverages differentiated prompt word engineering to drive multiple decision-making large language models. These models can autonomously select methods based on internal knowledge reasoning or external retrieval enhancement, generating a diverse and operable set of model compression strategy candidates, according to task complexity and their own confidence level. Based on this, a dedicated arbitration large language model is introduced to comprehensively evaluate and integrate candidate strategies from multiple dimensions, outputting an optimized solution that balances efficiency, accuracy, and resource constraints. Finally, the intelligent agent automatically converts the compression strategy into executable engineering code, achieving a seamless transition from strategy design to deployment. The core technical advantages of this invention are: 1. Full-process automation: It connects the entire chain from model parsing, strategy generation, evaluation and optimization to code implementation, greatly reducing manual intervention; 2. Intelligent decision-making: A dynamic strategy generation mechanism that combines internal reasoning and external retrieval enhances the diversity and adaptability of strategies; 3. Collaborative optimization mechanism: Through multi-agent division of labor and arbitration evaluation, the reliability and overall performance of the compression strategy are improved; 4. Engineering-friendly: Directly outputs executable code, significantly reducing the deployment threshold and accelerating the process of lightweight model deployment.
[0090] This solution effectively reduces the reliance on professional experience for model compression, improves the adaptability of the lightweighting process under diverse tasks and resource constraints, enhances the reliability of results and the overall deployment efficiency, and provides a systematic and reusable automated solution for the efficient lightweighting of visual inspection models.
[0091] Those skilled in the art will understand that the exemplary components, systems, and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. Whether implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention. When implemented in hardware, it can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the desired tasks. The programs or code segments can be stored in a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave.
[0092] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.
[0093] In this invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or in place of features of other embodiments.
[0094] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations of the embodiments of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A lightweight method for YOLO models based on multi-agent collaboration, characterized in that, The method includes the following steps: The system receives the model configuration file, weight file, and task requirements of a YOLO model provided by the user; the task requirements record the model compression constraints; the model configuration file is parsed to obtain the model structure, and the task requirements are semantically parsed to obtain constraint information; A first prompt word project is introduced, and the strategy generation agent is input into the model structure, weight file, and constraint information respectively. The strategy generation agent includes multiple decision generation large language models and decision arbitration large language models with differentiated inference-driven logic. Each decision generation large language model selects candidate schemes for compression strategies based on task complexity analysis and self-determinism assessment, constructing inference paths according to basic compression theory, YOLO structural knowledge, and hardware constraint knowledge; or selects a method based on enhanced retrieval, generating search keywords to retrieve relevant entries in a preset compression knowledge database, and then integrating the inference context to obtain candidate schemes for the compression strategies. A second prompt word project is introduced, and the decision arbitration large language model is input into each of the candidate schemes, outputting the performance evaluation results of each candidate scheme and determining the compression strategy. The model configuration file, the weight file, and the compression strategy are transferred to the code implementation agent, and the resulting engineering code is converted and output.
2. The lightweight YOLO model based on multi-agent collaboration method according to claim 1, characterized in that, The method further includes: The engineered code is input into the feasibility verification agent, which constructs a syntax analysis tree to extract the program structure and verify the syntax integrity. It also parses the referenced dependency libraries and external resources and checks the dependency availability. If the syntax integrity and dependency availability checks pass, the complete engineered code is run in the first sandbox environment. If the run is successful, a verification success message is displayed. If it fails, the process is terminated and a failure message is generated. The validated engineered code is input into the performance evaluation agent for training and testing in a second sandbox environment, and the output displays preset performance parameters.
3. The lightweight YOLO model based on multi-agent cooperation method according to claim 1, characterized in that, The model structure is obtained by parsing the model configuration file, and the constraint information is obtained by semantic parsing the task requirements, including: The AST module of Python is used to parse the Python script submitted by the user for loading and running the YOLO model, extract the model configuration file to construct static syntax, perform layer type statistics and connection pattern analysis, and represent the model structure in a structured way. The task requirements are subjected to format detection, language detection, and noise filtering. A domain-adaptive named entity recognition model is used to identify hardware entities, performance entities, and constraint entities. Conditional logic analysis and fuzzy constraint quantization are then performed to obtain the constraint information.
4. The lightweight YOLO model based on multi-agent collaboration method according to claim 1, characterized in that, The first prompt word project and the second prompt word project include a role definition section, a task description section, and a constraint description section; The role definition section of the first prompt word project defines the role of the decision generation large language model as a model quantization compression expert. The task description section includes prompt task understanding and analysis, compression strategy generation, inference chain recording, self-evaluation and confidence labeling. The constraint description section references the constraint information. The role definition section of the second prompt word project defines the role of the decision arbitration big language model as a compression strategy evaluation and integration expert. The task description section includes a statement of decision principles, an evaluation framework and evaluation criteria description, a task execution process description, a comparative analysis scheme and integration strategy, and a constraint description section including requirements for the output format. The decision-generating large language model includes the Qwen large language model based on introspective multi-perspective collaborative reasoning, the DeepSeek large language model based on relational mapping logical self-consistent reasoning, the Llama large language model based on probability-driven generative reasoning, and the GPT large language model based on tool-enhanced multimodal reasoning; the decision-generating large language model also selects sub-versions of various large language models based on reasoning cost and response speed. The maximum inference depth of the decision arbitration big language model is higher than the set value, and the decision arbitration big language model adopts the Gemini 3.0 Pro big language model.
5. The lightweight YOLO model based on multi-agent collaboration method according to claim 1, characterized in that, The decision-generating large language model determines whether to perform enhanced retrieval by analyzing task complexity and monitoring its own level of certainty, including: The model structure complexity and constraint strictness of the YOLO model to be lightweight are calculated based on the first preset rule; the reasoning depth index, knowledge reference integrity index and scheme specificity index are dynamically detected in the reasoning process based on the second preset rule; and the enhanced retrieval method is selected based on the preset standard.
6. The lightweight YOLO model based on multi-agent cooperation method according to claim 1, characterized in that, The pre-deployment process of the preset compressed knowledge database includes: Collect and validate YOLO model compression strategy cases, including quantization, pruning, and knowledge distillation operations for models with specific model structures and parameter sizes, and verify their feasibility; For the YOLO model compression strategy case, extract keywords, compression strategy descriptions, and corresponding reference code; The keywords are vectorized for retrieval, and the vectorized keywords, the corresponding compression strategy description, and the reference code are stored in the ChromaDB database.
7. The lightweight YOLO model based on multi-agent cooperation method according to claim 2, characterized in that, The code implements the intelligent agent to load the DeepSeek-Coder-V2 / V3 model, StarCoder2 model, CodeLlama-70B-Instruct model, Qwen-2-Coder model, or GPT-4o model to generate the engineering code; The feasibility verification agent loads the DeepSeek-Coder-V2 / V3 model or the CodeLlama-70B-Instruct model, and uses static analysis tools and dynamic sandbox tools to verify the feasibility of the engineered code. The performance evaluation agent is loaded with a Qwen-Max model or a Claude 3 Opus model, and uses metric collection tools and data visualization tools to evaluate the performance of the engineered code.
8. A lightweight device for YOLO model based on multi-agent collaboration, comprising a processor, a memory, and a computer program or instructions stored in the memory, characterized in that, The processor is configured to execute the computer program or instructions, and when the computer program / instructions are executed, the device implements the steps of the method as described in any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method as described in any one of claims 1 to 7.
10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 7.