Automatic template generation method for model project brief introduction in open source platform

By constructing a dedicated labeled dataset and multi-model classification system for ModelCards, and combining ethical review and code inspection agents, the issues of data structuring and accuracy in the automatic template generation process of ModelCards in open-source platforms are resolved, achieving efficient and compliant template generation that meets the needs of developers and users.

CN121901869APending Publication Date: 2026-04-21NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NAT UNIV OF DEFENSE TECH
Filing Date
2026-01-05
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing technologies for automatic template generation of ModelCards on open-source platforms suffer from problems such as insufficient data structuring, poor template usability, and low accuracy. In particular, the lack of labeled data in text classification tasks leads to poor generalization ability, and there are also ethical risks and insufficient code review.

Method used

A dedicated labeled dataset for ModelCards is constructed, employing a multi-model classification system and a dynamic committee voting mechanism. Combined with an ethical review and code inspection agent, a self-optimizing closed-loop system generates high-quality structured documents to ensure classification accuracy and compliance.

Benefits of technology

It improves the adoption rate and information delivery efficiency of ModelCards templates, reduces the difficulty for developers to write templates, and ensures the accuracy, compliance and executability of templates to meet user needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121901869A_ABST
    Figure CN121901869A_ABST
Patent Text Reader

Abstract

The invention relates to an automatic templated generation method for model project brief introduction in an open source platform. The method comprises the following steps: constructing a special tagged data set, cleaning invalid data, analyzing a high-frequency title, determining a target template in combination with an academic template, and processing a public data set to obtain a structured data set; and constructing a multi-model classification system: taking a deep learning model as a main part and a large language model as an auxiliary part, training by using a preset loss function, and adjusting the model weight according to a confusion matrix by means of a dynamic committee voting mechanism. The method comprises the steps that a multi-agent collaborative system is built, a template agent classifies unstructured data according to a target template, an ethical review agent reviews ethical risk fields, a code check agent checks code fields, and a central coordinator dispatches the agents and fuses results to obtain a preliminary structured template; and constructing a self-optimization closed-loop system to optimize the preliminary template, and outputting a final structured ModelCards template. By adopting the method, the high-quality structured document conforming to the writing habit of a developer can be generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data processing, and particularly to an automatic templating generation method for model project profiles in an open-source platform. Background Art

[0002] With the explosive growth of open-source machine learning models, ModelCards, as the core document for recording key information such as model details, training data, usage methods, and ethical risks, have become an important carrier for ensuring model transparency, reproducibility, and secure deployment. Currently, ModelCards on mainstream open-source platforms, such as those on HuggingFace, mostly appear in free text form, lacking a unified structured standard, leading to three core bottlenecks in the automatic templating process of existing technologies: Firstly, there is a lack of domain-adapted structured datasets. Existing technologies rely on raw, un-cleaned ModelCards data, which have no unified field划分 and semantic labels—for example, key information such as "ethical considerations" and "hardware requirements" are often mixed in natural language descriptions, and there are problems such as empty data, code block interference, and format chaos. Unannotated raw data cannot provide effective supervision signals for supervised learning, resulting in difficulties for the model to accurately learn the field classification boundaries and limited accuracy in automatic templating. Existing ModelCards templates are mostly based on academic paper definitions or platform-mandated standards, overemphasizing professional fields such as training data bias analysis and algorithm parameter details. Such templates not only increase the writing cost for developers—requiring additional supplementation of professional information, but also make it difficult for users to quickly locate core needs, such as how to use the model and the model's applicable scenarios, ultimately resulting in low template adoption rates and poor information transmission efficiency.

[0003] Current ModelCards automatic templating technologies are mainly divided into two categories: One category relies on unsupervised learning (such as K-means clustering, topic modeling). Due to the lack of annotated data, it has poor generalization ability, and the output results lack normativity and interpretability; The other category relies on generative large language models. However, large language models are known for their generative capabilities. In text classification tasks, their Decoder-only architecture has weaker local semantic capture ability than Encoder-only models, and zero-shot reasoning is not optimized for the ModelCards domain, resulting in large fluctuations in accuracy and being easily affected by prompt design, unable to ensure field integrity and consistency.

[0004] In summary, existing technologies cannot simultaneously meet the requirements of data structuring, template practicality, and high technical precision. There is an urgent need for a ModelCards automatic templating solution that can break through synergistically in terms of data, templates, and technologies. Summary of the Invention

[0005] Based on this, in view of the above technical problems, it is necessary to provide an automatic templating generation method for the introduction of model projects in an open source platform, which can generate high-quality structured documents that conform to the writing habits of developers and meet the information needs of users.

[0006] An automatic templating generation method for the introduction of model projects in an open source platform, the method includes: Construct a ModelCards-specific tagged dataset; construct a multi-model classification system. The multi-model classification system uses a deep learning model as the main classification model, selects a large language model as the auxiliary classification model, takes a preset loss function as the optimization target, and uses the ModelCards-specific tagged dataset to train the main classification model and the auxiliary classification model to obtain the trained multi-model classification system; Construct a dynamic committee voting mechanism, and based on the confusion matrices of each model after training, dynamically adjust the voting weights of each model on different text categories through a preset weight update rule; Construct a templating agent. Using the model with the highest accuracy determined by the dynamic committee voting as the kernel, call the trained multi-model classification system to classify the input unstructured ModelCards template according to the determined target template; Construct an ethical review agent. Using a large language model with ethical reasoning ability as the kernel, call an external ethical guidelines database to conduct an ethical review on the field content involving ethical risks in the classified ModelCards, and output the review results and the corresponding confidence scores; Construct a code inspection agent. Using a large language model with code generation and inspection capabilities as the kernel, conduct code syntax, dependency, and running path inspections on the fields containing code snippets in the classified ModelCards, and generate executable code snippets and explanatory texts; set up a central coordinator. The central coordinator realizes the communication between the templating agent, the ethical review agent, and the code inspection agent through shared intermediate representations, dynamically schedules the calling order and weights of each agent, and fuses the output results of each agent through a dynamic ensemble learning mechanism to obtain a preliminary structured ModelCards template; Construct a self-optimizing closed-loop system to optimize the preliminary structured ModelCards template and output the finally optimized structured ModelCards template.

[0007] The aforementioned method for automatically generating templates for model project descriptions on open-source platforms addresses this issue by constructing a dedicated labeled dataset to define target templates. This involves cleaning and labeling invalid information such as empty data and code interference from publicly available data, resulting in structured data. This domain-adapted labeled data provides clear classification boundaries for supervised learning, completely overcoming the lack of structured signals in unsupervised methods. This ensures model classification accuracy from the source and addresses the pain point of models struggling to accurately learn field classification boundaries. Next, a user-oriented design approach is adopted for the target template. By analyzing high-frequency titles of popular ModelCards, core fields frequently used by developers and of interest to users are selected, eliminating redundant professional parameter requirements. This reduces the difficulty for developers, eliminating the need for additional professional information, and allows users to quickly identify key needs, directly improving template adoption rates and information delivery efficiency. Matching templates must adapt to both developer habits and user needs. Finally, a deep learning model is used as the primary classification model, supplemented by a large language model to compensate for weaknesses in the primary model's classification. A dynamic committee voting mechanism is used to adjust model weights based on the confusion matrix, allowing each model to leverage its strengths in its preferred categories, resolving issues of fluctuating classification accuracy and unreliable field completeness. Templated agents ensure accurate classification; an ethics review agent leverages an external ethics database to address issues of mixed ethical information and insufficient compliance; a code inspection agent verifies code executability; and a central coordinator enables efficient collaboration among agents. A self-optimizing closed loop utilizes counterexamples, patching, and mechanism-based quantification of four-dimensional quality, iteratively optimizing according to the gain-cost principle. An evolutionary memory pool facilitates experience transfer, resulting in structured documents that meet high-quality standards in classification, compliance, executability, and semantic logic, aligning with the needs of developers and users. Attached Figure Description

[0008] Figure 1 This is a flowchart illustrating an automatic template generation method for model project descriptions in an open-source platform, as shown in one embodiment. Figure 2 This is a schematic diagram of the framework of an automatic template generation method in one embodiment. Detailed Implementation

[0009] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0010] In one embodiment, such as Figure 1 As shown, an automatic template generation method for model project descriptions in open source platforms is provided, including the following steps: Step 102: Construct a ModelCards-specific labeled dataset; construct a multi-model classification system. The multi-model classification system uses a deep learning model as the main classification model, selects a large language model as the auxiliary classification model, takes a preset loss function as the optimization target, and uses the ModelCards-specific labeled dataset to train the main classification model and the auxiliary classification model to obtain the trained multi-model classification system.

[0011] According to the official interface provided by the huggingface platform, the top 10,000 ModelCards with the highest download volume were directly obtained through code calls. The ModelCards of popular models are often more standardized and more popular among users. The ModelCards on the platform store text in the markdown file format, and the title part inside is marked with the # symbol. After removing the interference of the remarks in the code block, # can be directly used to match and identify the title. A new template was defined by comprehensively researching popular ModelCards and academic templates, including 7 parts: "Model Details", "Training Data", "Usage Method", "Evaluation", "Citation", "Purpose", "Limitations". Each part of the template matches the corresponding high-frequency keywords and common keywords.

[0012] Different from the data obtained in the previous step, the dataset collected in the previous step needs to reflect the common templates of popular ModelCards and needs to have standardized titles. What is needed in this step is a dataset composed of text categories, sentences, and labels. For example: (1)Model Details (the text category to which the sentence belongs) (2)This model is bert, often used for text classification… (the sentence under the template title) (3)0 (the digital label is mapped to the text category, and the number is convenient for model training) The complete model card dataset can be obtained through channels such as the huggingface platform interface and open-source papers. In this paper, 32,000 model cards collected from papers are used as the original data. There are also cases where the data of ModelCards is empty or there is no title. In the prepared original dataset, these unnecessary ones are removed, and the remaining ModelCards with template titles and text content are further cleaned, removing HTML tags, images, code blocks, links, tables, and redundant blank lines. When matching keyword titles are identified, the sentences are extracted to form a dataset containing 120,806 pieces of data.

[0013] The prior art relies on unlabeled raw data, and the lack of structured tags results in insufficient supervision signals. The present invention defines template tags based on high-frequency keywords, cleans and labels the data on the open-source platform, generates a high-quality dataset, provides a clear classification boundary for supervised learning, enables the model to accurately distinguish different template fields, and overcomes the problem of missing structured signals in unsupervised methods. Moreover, traditional templates overemphasize professionalism, resulting in high writing costs and low user information acquisition efficiency. This application surveys popular ModelCards and user requirements, extracts high-frequency titles to form practical templates, which not only reduce the writing difficulty for developers but also enhance users' ability to quickly locate key information, thereby improving the template adoption rate and information transmission efficiency.

[0014] For the ModelCards classification task of irregular long texts, it is necessary to select an appropriate model and train it. Considering the requirements for model templating accuracy, interpretability, and subsequent tasks in the present invention, several Encoder-only deep learning models and large language models are decided to be used as classification models here. They are co-trained, tested, and the performance differences from their individual models are compared. ModelCards often contain misclassified content such as code snippets. The Encoder-only model can filter noise and extract core semantics through multi-layer semantic encoding.

[0015] In the model training stage, a preset loss function is used to optimize the classification task. The prior art relies on large language models or general methods, and the accuracy in text classification tasks is insufficient. The present invention selects multiple Encoder-only models as the main models combined with contrastive learning, captures local and global features through multi-layer semantic encoding, enhances the semantic discrimination ability, and specifically improves the classification accuracy; at the same time, simplifies the model structure, reduces the computational complexity, and the multi-model collaborative work takes into account both efficiency and performance, providing a reliable technical guarantee for automated template generation.

[0016] Step 104: Construct a dynamic committee voting mechanism. Based on the confusion matrix after training each model, dynamically adjust the voting weights of each model on different text categories through a preset weight update rule.

[0017] For specific categories, different models are better at different aspects. Therefore, after training the model results, a dynamic committee voting method is adopted to improve the final classification accuracy. By establishing a dynamic decision-making system involving multiple models, adaptively adjusting the model voting weights for different text categories, and dynamically selecting the optimal model for classification, the classification problem of high-confusion categories can be effectively solved.

[0018] Step 106: Construct a templated agent with the model having the highest accuracy determined by dynamic committee voting as the core, call the trained multi-model classification system, and classify the input unstructured ModelCards template according to the determined target template.

[0019] The templated agent is the precision cornerstone of the system, mainly responsible for highly accurate classification and information extraction of extremely technical text paragraphs. It uses the bert model with the highest measured accuracy in the experiment as the core, and adopts a dynamic committee voting mechanism in actual classification. Other models (such as DeBERTaV3) are used to participate and supplement in the classification categories with poor performance, and the unstructured model cards are classified with high precision according to the templates formulated above. Its input is the unstructured ModelCards to be templated.

[0020] Step 108: Construct an ethical review agent with a large language model with ethical reasoning ability as the core, call the external ethical guidelines database, conduct an ethical review of the field content involving ethical risks in the classified ModelCards, and output the review results and the corresponding confidence scores.

[0021] ModelCards is not a simple model introduction text. Its characteristics determine that it needs to pass an ethical review to meet industry requirements. Therefore, in addition to classifying by category, its templating also needs to ensure its quality. The system requires an agent for security and compliance to handle ambiguous areas that require value judgment, risk identification, and social impact. This agent uses Claude3 as the core and is responsible for handling categories that require complex ethical reasoning such as "bias", "risk", and "limitations". In addition to checking the original data, it can also call the external ethical guidelines database for auxiliary judgment. In addition, it will output a confidence score for each judgment. Low-confidence judgments will trigger the system's subsequent iterative optimization mechanism.

[0022] Step 110: Construct a code inspection agent with a large language model with code generation and inspection capabilities as the core, conduct code syntax, dependency, and running path inspections on the fields containing code snippets in the classified ModelCards, generate executable code snippets and explanatory texts; set up a central coordinator, and the central coordinator realizes communication between the templated agent, the ethical review agent, and the code inspection agent through shared intermediate representations, dynamically schedules the calling order and weights of each agent, and fuses the output results of each agent through a dynamic ensemble learning mechanism to obtain a preliminary structured ModelCards template.

[0023] Besides the model's introduction, ModelCards typically include sections with code blocks such as usage instructions, code examples, and quick start guides. Unlike directly readable text, the code requires further verification for runnability and correctness. The agent, serving as the system's user experience interface, uses a large model as its core and is responsible for sections requiring natural language generation, such as "Usage Instructions" and "Deployment Examples." Based on retrieval results and the output of the technical agent, it generates fluent and accurate code snippets and explanatory text. Agents communicate by sharing intermediate representations. For example, the "Model Architecture" classification result output by the technical agent can serve as a direct basis for the application generation agent to write example code. These three agents do not work sequentially in a pipeline; instead, they are scheduled by a central coordinator (Orchestrator). The coordinator dynamically determines the order and weight of agent calls based on the characteristics of the input text, exchanges data through a shared workspace, and ultimately fuses the results through a dynamic ensemble learning mechanism, forming an efficient, accurate, and reliable organic whole, transforming irregular ModelCards into high-quality, templated content.

[0024] Step 112: Construct a self-optimizing closed-loop system to optimize the initial structured ModelCards template and output the final optimized structured ModelCards template.

[0025] While multi-agent collaborative classification modules output a single structured result, its quality, logical coherence, and ethical compliance may still have local flaws. To further improve output quality, this invention introduces an Optimization Intelligence Agent (OIA), an internal closed-loop optimization unit that can be implemented based on a pre-trained language model with contextual understanding capabilities. With self-consistent feedback and a counterexample-repair-pass mechanism at its core, it performs multi-dimensional reinforcement of the result without changing the output interface, achieving counterexample-driven high-dimensional semantic optimization and self-consistent learning.

[0026] The optimized agent mainly consists of three core modules: a cluster of constraint validators, a counterexample generator, and a patching planner. These modules evaluate the model's performance across four dimensions: template consistency, semantic coherence, ethical safety, and executability. The four dimensions are explained as follows: The template consistency validator checks field completeness, hierarchical order, and placeholders for required fields; the semantic coherence validator checks the causal / reference consistency of "purpose → data → training → evaluation → limitations"; the ethical compliance validator checks for high-risk expressions such as bias / leakage; and the executability validator checks the syntax, dependencies, and minimum execution path (static level) of code segments.

[0027] Calculate the comprehensive utility function. When the comprehensive score or the local dimension score is lower than the threshold, the system automatically starts the "counterexample - repair - pass" closed-loop process. Around the output result Perform a three-step loop: generate counterexamples → plan repairs → verify passing. Only the "problem fragments" are modified in each step, without changing the overall structure.

[0028] First, generate counterexamples. The optimization agent does not regenerate the output, but performs a local scan on the output result to automatically discover potential defects and construct counterexample tuples through structural probes (giving challenging questions for missing template fields / abnormal order / mismatch of upper and lower positions), semantic probes (constructing "rhetorical questions" with domain knowledge to generate inconsistencies), and compliance probes (triggering self-checks of sensitive sites such as biases and leaks through scenario-based interrogations): c , = loc, type, evidence

[0029] where loc represents the defect location, type is the problem type (template, semantic, ethical, execution), and evidence is local counterevidence, such as missing fields, semantic inversion, or non-compliant descriptions.

[0030] In the planning of repairs, instead of globally rewriting the model card after the collaborative output of multiple agents, the system performs local fixed-point optimization repairs on the most local problem parts. For each counterexample, the optimal set of repair operators R = {interpolation, replacement, rearrangement, cropping, reference alignment, code correction} is selected, and it is optimized through the principle of minimum modification:

[0031] where represents the repair cost function, including edit length, rearrangement span, and new fact penalty. This optimization criterion ensures both minimum perturbation and maximum gain.

[0032] Finally, through the determination: applying the optimal modification plan to the current result to obtain a new output:

[0033] The system recalculates the comprehensive utility function after repair: ​​​​​​​​​​​

[0036] Taking different fragments generated by the model card as an example: ① Field omission: Data source segment for interpolation; Counterexample: loc=training data, type=temp, evidence: missing data source description; Repair: Insert a data source description and align the training set link; Judgment: Template score increases, semantic score does not decrease, and ethical score is unaffected → Pass.

[0037] ② Semantic misordering: Rearrange the training → evaluation order; Counterexample: loc=evaluation, type=sem, evidence: the metrics are given before the training settings, which reverses the causal relationship; Repair: Reorder the sentences, train / data first, then evaluate / metrics; Judgment: Increased semantic score, low cost → Pass.

[0038] ③ Code failure: Simplest variable correction; Counterexample: loc=usage method, type=exe, evidence: missing dependency installation / inconsistent model name; Repair: Δ = code minimization correction; Judgment: The executability score is increased and the ethics / template is not damaged → pass.

[0039] ④ Ethical deviation: Replace risky words and insert warnings.

[0040] Counterexample: loc=purpose, type=eth, evidence: making qualitative assertions about the attributes of the population and suggesting a single purpose; Repair: Replace high-risk phrases + insert risk warnings / restriction instructions; Judgment: Qeth exceeds the threshold, other dimensions show no significant regression → pass.

[0041] After each patch, the validator cluster is re-evaluated. If the improvement is effective, it enters the pass phase; otherwise, it is fed back as a new negative example and enters the next cycle.

[0042] The system records the entire process of each counterexample, patch, and successful completion, forming a counterexample trajectory memory. During long-term operation, the system inputs these trajectories into an evolutionary memory pool and employs a lightweight structure-guided incremental tuning (SGIT) strategy to update local parameters of highly involved submodules. When encountering semantically similar or structurally similar task segments, OIA first retrieves historically valid patches, initializing the search space with empirical priors, significantly reducing invalid attempts. The learning object here is the entire trajectory of counterexample—patching—success, possessing interpretability and transferability.

[0043] The method of multi-agent collaboration abandons the single-model templated classification method and instead adopts an expert mode with clear division of labor, collaborative work, and the simultaneous guarantee of templated and model card characteristics. Each agent is deeply optimized for its specific field and forms an accurate and reliable organic whole through an efficient communication mechanism, ultimately achieving performance superior to any single model and generating model cards that meet the requirements of the academic community and user needs.

[0044] Execute the counterexample-patch-pass local patch cycle on the same result, aggregate the four-dimensional indicators of template consistency, semantic coherence, ethical compliance, and executability with the formal utility function F(Y), and cooperate with the principle of minimum modification of the gain cost to achieve great benefits with small changes, and use thresholds and convergence conditions to ensure that the improvement is quantifiable and decidable; at the same time, introduce self-consistency feedback and an evolutionary memory pool to precipitate the counterexample→patch→pass trajectory for subsequent sample structure guidance and lightweight self-learning; this mechanism can be served by any LLM as a semantic probe and patch inference kernel, significantly improving the template specification, semantic consistency, and compliance security of the model card.

[0045] For the above automatic templated generation method for the model project introduction in the open source platform, this application defines the target template by constructing a dedicated labeled dataset, and then cleans and annotates the invalid information such as empty data and code interference in the public data to form structured data. This domain-adapted annotated data provides a clear classification boundary for supervised learning, completely overcomes the defect of the lack of structured signals in the unsupervised method, guarantees the model classification accuracy from the source, and solves the pain point that it is difficult for the model to accurately learn the field classification boundary. Then design the target template with user orientation. By analyzing the high-frequency titles of popular ModelCards, screen out the core fields commonly used by developers and concerned by users, and abandon redundant professional parameter requirements. This not only reduces the writing difficulty of developers without the need to supplement professional information additionally, but also allows users to quickly locate key needs, directly improving the template adoption rate and information transmission efficiency, and matching the requirement that the template needs to adapt to the habits of developers and user needs. Then use the deep learning model as the main classification model and introduce the large language model for assistance to make up for the weak links in the main model classification. Use the dynamic committee voting mechanism to adjust the model weights based on the confusion matrix, so that each model can play its advantages in the categories it is good at, and solve the problems of fluctuating classification accuracy and inability to guarantee field integrity. Set up a templated agent to ensure accurate classification, an ethical review agent to solve the problems of mixed ethical information and insufficient compliance through an external ethical database, a code inspection agent to verify the executability of the code, and a central coordinator to achieve efficient cooperation among agents. The self-optimizing closed loop quantifies the four-dimensional quality through the counterexample, patch, and pass mechanism, iteratively optimizes according to the gain-cost principle, and the evolutionary memory pool realizes experience migration. Finally, the output structured document meets high-quality standards in terms of classification, compliance, executability, and semantic logic, meeting the needs of developers and users.

[0046] In one embodiment, a labeled dataset dedicated to ModelCards is constructed, including: Call the official interface of the HuggingFace platform to obtain multiple ModelCards data with the highest download volume. The ModelCards data is stored in the markdown file format, and the title is identified by the "#" symbol; Perform preliminary cleaning on the ModelCards data to remove empty data, data without titles, and interfering data marked with "#" in the code blocks, and obtain ModelCards data with valid titles; Perform title statistical analysis and visualization on the ModelCards data with valid titles, combine with the ModelCards template in the academic field, determine the target template containing 7 core fields, and match corresponding high-frequency keywords for each core field; Using a publicly available dataset containing 32,000 ModelCards as the original data, remove the empty data and data without titles in it, then filter HTML tags, images, code blocks, links, tables, and extra blank lines. Based on the target template and corresponding high-frequency keywords, perform sentence extraction on the filtered data to obtain structured data where each data contains text category, sentence, and digital label, forming a labeled dataset dedicated to ModelCards.

[0047] In one embodiment, the preset loss function is

[0048] where represents the sign function. If the true category of the sample i is equal to c then it takes 1, otherwise it takes 0. is the predicted probability that the observed sample i belongs to the category c , represents the total number of samples, represents the total number of categories.

[0049] In one embodiment, a self-optimizing closed-loop system is constructed to optimize the preliminary structured ModelCards template and output the finally optimized structured ModelCards template, including: Construct an optimization agent. The optimization agent includes a constraint validator cluster, a counterexample generator, and a repair planner. The constraint validator cluster contains validators for verifying the quality of different dimensions of ModelCards; Calculate the comprehensive utility value of the preliminary structured ModelCards template according to the constraint validator cluster. The comprehensive utility value is calculated by the preset comprehensive utility rule; If the calculated overall utility value is lower than the preset threshold, the counterexample-repair-pass mechanism is activated. The counterexample generator scans the preliminary structured ModelCards template with multiple types of probes to generate counterexample tuples containing defect locations, problem types, and local counter-evidence. The optimal repair operator is selected from the preset repair operator set using the repair planner, and the optimal repair scheme is determined by the preset minimum modification rule; The optimal repair scheme is applied to the current structured ModelCards template to obtain the updated structured ModelCards template. The updated comprehensive utility value is recalculated. If the utility value gain meets the preset gain condition, the repair is successful. If the utility value change meets the preset convergence condition or reaches the maximum number of iterations, the final optimized structured ModelCards template is output.

[0050] In one embodiment, the preset weight update rule is implemented through a weight update formula, which is as follows:

[0051] in, The learning rate factor, For the model in category c The ratio of true positive rate to false positive rate. For the first t In the next iteration, the model is in the category c Weight on, For the first In the next iteration, the model is in the category c Weighting on.

[0052] In one embodiment, the constraint validator cluster includes a template consistency validator, a semantic coherence validator, an ethical compliance validator, and an executability validator; wherein, the template consistency validator is used to check the field completeness, hierarchical order, and required field placeholders of ModelCards; the semantic coherence validator is used to check the causal relationship and referential consistency between purpose, data, training, evaluation, and limitations; the ethical compliance validator is used to check high-risk expressions such as biased expressions and information leakage in ModelCards; and the executability validator is used to check the syntactic correctness, dependency integrity, and minimum execution path validity of code segments from a static level.

[0053] In one embodiment, the preset comprehensive utility rule is implemented through a comprehensive utility function, the formula of which is:

[0054] in, Indicates the template consistency score. The score represents semantic coherence. Indicates the ethical compliance score. Indicates the executability score. , , and These are the weighting coefficients corresponding to each score.

[0055] In one embodiment, the preset set of patching operators includes interpolation, replacement, rearrangement, pruning, reference alignment, and code correction; the preset minimum modification rule is implemented through the minimum modification principle formula, which is:

[0056] in, This is the structured ModelCards template for the t-th iteration. For the repair plan, To repair the cost function, This represents the cost coefficient.

[0057] In one embodiment, the preset gain condition is:

[0058] in, To preset the gain threshold, The updated structured ModelCards template after applying the optimal patching solution; The preset convergence condition is ,in This is the preset convergence threshold.

[0059] In one embodiment, the shared intermediate means that the model architecture classification results output by the templated agent are directly used as the basis for the code inspection agent to write sample code, and the ethical risk points output by the ethical review agent are used as a reference for the templated agent to adjust the classification boundaries of ethical-related fields.

[0060] It should be understood that, although Figure 1 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order in which these steps are executed, and they can be performed in other orders. Furthermore, Figure 1 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0061] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0062] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these modifications and improvements all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for automatically generating templated descriptions of model projects in open-source platforms, characterized in that, The method includes: Construct a ModelCards-specific labeled dataset; construct a multi-model classification system, wherein the multi-model classification system uses a deep learning model as the main classification model and selects a large language model as the auxiliary classification model with a preset loss function as the optimization objective. The main classification model and the auxiliary classification model are trained using the ModelCards-specific labeled dataset to obtain the trained multi-model classification system. A dynamic committee voting mechanism is constructed, which dynamically adjusts the voting weights of each model on different text categories based on the confusion matrix after each model is trained, and through preset weight update rules. A templated intelligent agent is constructed with the model with the highest accuracy determined by a dynamic committee vote as its kernel. The trained multi-model classification system is then invoked to classify the input unstructured ModelCards templates according to the determined target template. An ethical review agent is constructed with a large language model with ethical reasoning capabilities as its core. It calls an external ethical guidelines database to conduct ethical review of the fields in the classified ModelCards that involve ethical risks, and outputs the review results and corresponding confidence scores. A code inspection agent is constructed with a large language model capable of code generation and inspection as its core. It performs code syntax, dependency, and execution path checks on fields containing code snippets in the classified ModelCards, generating runnable code snippets and explanatory text. A central coordinator is set up, which realizes communication between the template agent, the ethics review agent, and the code inspection agent through a shared intermediate representation. It dynamically schedules the calling order and weight of each agent and merges the output results of each agent through a dynamic ensemble learning mechanism to obtain a preliminary structured ModelCards template. A self-optimizing closed-loop system is constructed to optimize the initial structured ModelCards template, and the final optimized structured ModelCards template is output.

2. The method according to claim 1, characterized in that, Construct a labeled dataset specifically for ModelCards, including: Call the official interface of the HuggingFace platform to obtain data on the multiple ModelCards with the highest download volume. The ModelCards data is stored in markdown file format and the title is identified by the "#" symbol. The ModelCards data is initially cleaned to remove empty data, data without titles, and interfering data marked with "#" in code blocks, resulting in ModelCards data with valid titles. The ModelCards data containing valid titles were subjected to title statistical analysis and visualization. Combined with academic ModelCards templates, a target template containing 7 core fields was determined, and corresponding high-frequency keywords were matched for each core field. Using a public dataset containing 32,000 ModelCards as the original data, empty data and untitled data are removed, and HTML tags, images, code blocks, links, tables, and redundant blank lines are filtered out. Based on the target template and corresponding high-frequency keywords, the filtered data is segmented and extracted to obtain structured data in which each data point contains text category, sentence, and number label, forming a dedicated labeled dataset for ModelCards.

3. The method according to claim 1, characterized in that, The preset loss function is: in, Represents the sign function, if the sample i The true category equals c Then take 1, otherwise take 0. For observation samples i Category c The predicted probability, Represents the total sample size. This indicates the total number of categories.

4. The method according to claim 1, characterized in that, A self-optimizing closed-loop system is constructed to optimize the initial structured ModelCards template, outputting the final optimized structured ModelCards template, including: Construct an optimization agent, which includes a constraint validator cluster, a counterexample generator, and a patching planner. The constraint validator cluster contains validators for validating the quality of ModelCards in different dimensions. The overall utility value of the preliminary structured ModelCards template is calculated based on the constraint validator cluster, and the overall utility value is calculated by a preset overall utility rule; If the calculated overall utility value is lower than the preset threshold, the counterexample-repair-pass mechanism is activated. The counterexample generator scans the preliminary structured ModelCards template with multiple types of probes to generate counterexample tuples containing defect locations, problem types, and local counter-evidence. The optimal repair operator is selected from the preset repair operator set using the repair planner, and the optimal repair scheme is determined by the preset minimum modification rule; The optimal repair scheme is applied to the current structured ModelCards template to obtain the updated structured ModelCards template. The updated comprehensive utility value is recalculated. If the utility value gain meets the preset gain condition, the repair is successful. If the utility value change meets the preset convergence condition or reaches the maximum number of iterations, the final optimized structured ModelCards template is output.

5. The method according to claim 1, characterized in that, The preset weight update rule is implemented through a weight update formula, which is as follows: in, The learning rate factor, For the model in category c The ratio of true positive rate to false positive rate. For the first t In the next iteration, the model is in the category c Weight on, For the first In the next iteration, the model is in the category c Weighting on.

6. The method according to claim 4, characterized in that, The constraint validator cluster includes a template consistency validator, a semantic coherence validator, an ethical compliance validator, and an executability validator. The template consistency validator checks the completeness, hierarchical order, and required field placement of ModelCards. The semantic coherence validator checks the causal relationships and referential consistency between purpose, data, training, evaluation, and limitations. The ethical compliance validator checks for high-risk expressions such as biased representations and information leaks in ModelCards. The executability validator checks the syntactic correctness, dependency integrity, and minimum execution path validity of code segments from a static perspective.

7. The method according to claim 4, characterized in that, The preset comprehensive utility rule is implemented through a comprehensive utility function, the formula of which is: in, Indicates the template consistency score. The score represents semantic coherence. Indicates the ethical compliance score. This indicates the feasibility score. , , and These are the weighting coefficients corresponding to each score.

8. The method according to claim 4, characterized in that, The preset repair operator set includes interpolation, replacement, rearrangement, pruning, reference alignment, and code correction; the preset minimum modification rule is implemented through the minimum modification principle formula, which is: in, This is the structured ModelCards template for the t-th iteration. For the repair plan, To repair the cost function, This represents the cost coefficient.

9. The method according to claim 4, characterized in that, The preset gain condition is: in, The preset gain threshold, The updated structured ModelCards template after applying the optimal patching solution; The preset convergence condition is: ,in This is the preset convergence threshold.

10. The method according to claim 1, characterized in that, The shared intermediate means that the model architecture classification results output by the templated agent are directly used as the basis for the code inspection agent to write sample code, and the ethical risk points output by the ethical review agent are used as a reference for the templated agent to adjust the classification boundaries of ethical-related fields.