Data set formation method for large code model fine-tuning
Patent Information
- Application Number
- CN202610364287.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2025-04-15
- Filing Date
- 2026-03-24
- Publication Date
- 2026-10-23
AI Technical Summary
[0005]然而,当前的数据集合成方法仍存在显著局限性,使其无法充分发挥潜力
Smart Images

Figure CN122963554A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence large model training and computer code data processing technology, specifically to a dataset synthesis method, electronic device, and computer-readable storage medium for fine-tuning large code models. Background Technology
[0002] Supervised fine-tuning (SFT) is a crucial step in improving the capabilities of large-code models. By retraining a pre-trained model on carefully constructed instruction-response pairs, SFT enables large-code models to generate higher-quality code that better reflects human intent across various programming domains. While this process is vital, its effectiveness is fundamentally limited by the quality of the existing datasets.
[0003] Current fine-tuning of large-code models faces a severe dataset problem. Existing datasets vary significantly in quality, consistency, and relevance: some samples demonstrate standard programming practices, while others contain inefficient or even erroneous code implementations, creating a mixed learning foundation. This inconsistency directly impacts model performance because large-code models inevitably learn both desirable and undesirable programming patterns from the training data. This leads to technical problems after fine-tuning, such as low code generation accuracy, poor API call compliance, insufficient generalization ability, and a high risk of overfitting.
[0004] The value of dataset synthesis has been widely recognized in the technology industry, as evidenced by the proliferation of commercial and research solutions addressing this issue. Leading companies have developed dedicated fine-tuning models for fields requiring high technical precision, such as machine learning code generation and SQL query construction. These domain-specific implementations demonstrate the commercial feasibility and technical necessity of targeted dataset optimization. Meanwhile, large-scale synthetic data generation systems capable of generating hundreds of thousands of training samples have been successfully deployed in production environments. To address dataset quality issues, various methods have emerged, including methods that integrate real code snippets and techniques that systematically adjust sample complexity through structured transformations. These implementations collectively demonstrate that dataset synthesis is a technically feasible and commercially valuable method for improving the capabilities of code models in both general and specialized scenarios.
[0005] However, current dataset synthesis methods still have significant limitations that prevent them from fully realizing their potential. Most existing methods fail to effectively utilize the structural characteristics of code, instead simply reducing code generation to a text generation problem, ignoring the rich semantic information inherent in programming structures and library interfaces. Furthermore, synthesis techniques often lack adaptability, failing to address the starkly different challenges in general and domain-specific scenarios. These limitations result in synthesized datasets that either lack diversity or fail to expose models to the full complexity of real-world programming tasks. The industry urgently needs a more advanced dataset synthesis method—one that systematically leverages programming abstractions to generate high-quality, diverse, and domain-relevant samples, maximizing the effectiveness of supervised fine-tuning.
[0006] Therefore, there is an urgent need in this field for a method to synthesize high-quality, diverse datasets that meet the needs of the field and take into account computational efficiency by systematically utilizing programming abstraction concepts. This would solve the aforementioned technical problems in the existing technology and improve the effectiveness and efficiency of fine-tuning large code models. Summary of the Invention
[0007] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description.
[0008] On one hand, the present invention provides a dataset synthesis method for fine-tuning large code models, comprising: Generate an API semantic knowledge graph for the target domain; Determine whether the target domain corresponds to a general programming scenario or a domain-specific scenario; In response to identifying the general programming scenario corresponding to the target domain, the following steps are performed: Based on the generated API semantic knowledge graph, feature analysis is performed on the dataset of the target domain, which includes multiple instruction-code sample pairs; The optimal subset is selected from the dataset using an optimization algorithm; In response to identifying a domain-specific scenario corresponding to the target domain, the following steps are performed: Build a code skeleton template; Based on the constructed code skeleton template and the API semantic knowledge graph, code implementation is generated; For the code implementation, generate natural language instructions that describe its intent and function, and construct instruction-code sample pairs.
[0009] In some embodiments, generating an API semantic knowledge graph of a target domain includes: Extract API specifications from official documentation in the target domain; Analyze API usage patterns in the existing codebase; Organize the APIs into a network / hierarchical structure based on their functions and relationships.
[0010] In some embodiments, generating an API semantic knowledge graph of a target domain further includes classifying APIs organized in a network / hierarchical structure based on importance, frequency of use, and semantic value.
[0011] In some embodiments, feature analysis of a dataset in a target domain based on the generated API semantic knowledge graph includes: performing feature analysis on the dataset based on API usage patterns, code complexity metrics, instruction-response matching degree, and domain specificity.
[0012] In some embodiments, generating code implementation based on the constructed code skeleton template and the API semantic knowledge graph includes: embedding API nodes and their specifications that match the target function into the corresponding structural positions of the code skeleton template based on the API semantic knowledge graph.
[0013] In some embodiments, after generating a code implementation based on the constructed code skeleton template, the method further includes quality verification and optimization of the generated code implementation.
[0014] In some embodiments, quality verification includes verifying syntax correctness, logical validity, execution efficiency, and specification compliance.
[0015] On the other hand, the present invention also provides a method for fine-tuning a large code model, comprising: synthesizing a dataset according to the dataset synthesis method for fine-tuning a large code model according to the present invention; and fine-tuning the large code model using the synthesized dataset.
[0016] In some embodiments, fine-tuning a large code model using a synthetic dataset includes configuring optimal fine-tuning parameters based on the characteristics of the synthetic dataset and the properties of the large code model.
[0017] In some embodiments, the characteristics of the synthesized dataset include average token length, instruction-response complexity distribution, and coverage density of high-value APIs.
[0018] On the other hand, the present invention also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to said at least one processor. The memory stores one or more computer programs executable by said at least one processor, said one or more computer programs being executed by said at least one processor to enable said at least one processor to perform a dataset synthesis method for fine-tuning large code models as described in the present invention.
[0019] On the other hand, the present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the dataset synthesis method for fine-tuning large code models as described in the present invention. Attached Figure Description
[0020] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed description of exemplary embodiments with reference to the accompanying drawings, in which: Figure 1 This invention provides a dataset synthesis method for fine-tuning large models. Figure 2 A flowchart for generating a target domain API semantic knowledge graph provided in an embodiment of the present invention; Figure 3 This is a block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0021] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0022] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.
[0023] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0024] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0025] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.
[0026] Existing dataset synthesis methods suffer from at least the following problems:
[0027] 1. Inadequate quality control mechanism
[0028] Current dataset synthesis methods lack robust quality control mechanisms specifically designed for code. While current methods may employ general text quality metrics or basic syntax validation, they do not incorporate programming-specific quality evaluation metrics, failing to assess algorithm efficiency, code readability, and best practice adherence. This limitation results in a large number of code samples in the generated datasets that appear syntactically correct but are actually flawed. Models fine-tuned based on such datasets inherit these flaws, potentially generating code that passes basic validation but performs poorly in real-world applications. The industry urgently needs a synthesis method that incorporates comprehensive code quality metrics to ensure that the generated samples represent truly exemplary programming solutions.
[0029] 2. Insufficient domain adaptability
[0030] Existing synthesis methods have limited effectiveness in adapting to specific programming domains. Most methods employ general prompting techniques, failing to capture the unique characteristics, conventions, and requirements of specialized programming domains such as scientific computing, web development, and data visualization. This limitation is particularly pronounced for organizations seeking to deploy large code models in specialized technical environments—scenarios where domain-specific programming patterns and library usage are core requirements. The inability to generate truly domain-specific samples forces organizations to choose between inefficient general-purpose models and costly, manually constructed datasets, severely restricting the practical application of large code models across various programming scenarios.
[0031] 3. Low computational efficiency
[0032] Current dataset synthesis and selection methods suffer from severe computational efficiency issues. Synthesis methods typically generate a large number of samples without policy guidance, leading to excessive redundancy and insufficient diversity. Selection methods, on the other hand, often process the entire dataset, failing to distinguish between high-value and low-value samples. These inefficiencies directly increase the computational costs of dataset construction and subsequent model fine-tuning. As computational efficiency becomes increasingly crucial for both economic and environmental benefits, the industry needs smarter methods that can accurately select or generate samples with the most information, maintaining or even improving model performance while reducing resource consumption.
[0033] Existing methods for synthesizing large code model datasets do not mine and utilize APIs as structured semantic units, nor do they construct API semantic knowledge graphs for the target domain. Furthermore, existing technologies do not involve a dual-path adaptive scheme of "general scenario screening + domain-specific scenario generation," which cannot simultaneously solve the redundancy problem in data-rich scenarios and the sample generation problem in data-scarce scenarios. They also fail to achieve quantitative feature analysis and optimization algorithm screening based on API semantics. This is the core reason why existing technologies cannot overcome the above-mentioned shortcomings.
[0034] In view of the above problems, this invention provides a comprehensive solution for synthesizing high-quality datasets, which can significantly improve model performance while reducing computational costs. This invention offers a dual-path solution that effectively handles two types of scenarios: one is a general scenario with abundant but inconsistent data quality, and the other is a domain-specific scenario with scarce data. This invention uses abstract concepts at the Application Programming Interface (API) level as information-intensive and semantically rich program units, enabling more efficient and effective fine-tuning processes in various programming scenarios.
[0035] This invention employs a novel algorithm that prioritizes API coverage while maintaining code length diversity, systematically selecting the optimal subset from existing datasets. It combines API specifications with manually constructed code skeletons, using a sophisticated process to translate high-level requirements into concrete code implementations. By collaborating with domain-specific languages for dedicated skeletons, it provides organizations with a flexible and cost-effective tool, consistently outperforming traditional methods and representing a significant breakthrough in code model customization and deployment.
[0036] On the one hand, this invention provides a dataset synthesis method for fine-tuning large code models, such as... Figure 1 As shown, it includes steps S100 to S900.
[0037] Step S100: Generate an API semantic knowledge graph for the target domain.
[0038] In this invention, the API semantic knowledge graph is a set of API semantic vectors organized into a network / hierarchical structure according to function and relationship, and quantitatively classified based on importance, usage frequency and semantic value. It serves as a unified technical benchmark for subsequent dual-path dataset synthesis, and can control the quality, domain adaptability and information density of the dataset.
[0039] Understandably, in this paper, the API semantic knowledge graph corresponds to a network / hierarchical structure composed of API nodes and their attributes (importance, frequency, semantic value) as well as the relationships between API nodes (functional subordination, call sequence, data dependency).
[0040] In embodiments of the present invention, such as Figure 2 As shown, step S100 includes the following steps S101 and S102.
[0041] Step S101: Perform a full API mapping for the target domain. This step systematically organizes, categorizes, and visualizes all available APIs within the target programming domain.
[0042] The core objective of this step is to break the limitations of existing technologies that "equate code with text," extract discrete APIs from unstructured documents and code, and construct a structured API semantic knowledge graph with semantic weights for the target programming domain. This will provide a unified and quantifiable decision benchmark for subsequent dual-path dataset synthesis (general scenario sample selection and domain-specific scenario sample generation), and control the quality, domain adaptability, and information density of the dataset.
[0043] In an embodiment of the present invention, step S101 includes steps S1011 to S1013.
[0044] Step S1011: Extract API specifications from official documentation. In this step, authoritative API definition information is fully extracted from the official documentation of the target domain, including function signatures, input / output parameter constraints, functional boundaries, exception handling specifications, dependencies, officially recommended best practices, deprecation warnings, and other core semantic information.
[0045] Most existing synthesis methods only perform basic syntax verification and cannot guarantee that API calls conform to the official design intent. However, the official specifications extracted in this step become the core judgment criteria for subsequent code generation and quality verification, ensuring that the generated / screened samples conform to standard programming practices.
[0046] Step S1012: Analyze the API usage patterns in the existing codebase.
[0047] We conduct full static analysis on high-quality open-source code libraries and industrial-grade project code in the target domain to uncover the real-world engineering usage patterns of APIs, including: high-frequency combined API call chains, common input parameter combination schemes, context adaptation methods, domain-specific usage conventions, engineering implementation of exception handling, and differences in API usage under different complexity scenarios.
[0048] The usage patterns explored in this stage ensure that the subsequently synthesized samples perfectly match real industrial scenarios.
[0049] Step S1013: Organize the APIs into a network / hierarchical structure based on their functions and relationships. Based on the outputs of steps S1011 and S1012, the discrete APIs are constructed into a network / hierarchical structure.
[0050] Based on functionality, APIs can be categorized into core domain capability APIs (such as data loading and model inference), auxiliary tool APIs (such as format conversion and log recording), and underlying infrastructure APIs (such as memory management and network communication).
[0051] Based on the relationship dimension, it can be divided into time-series dependency relationship (such as the Auth API must be called before the Request API), data flow relationship (the output of API A is the input of API B), and combination substitution relationship (API A and API B are often used together, or can be substituted for each other under specific conditions).
[0052] This step provides a core metric for structural coverage in subsequent sample selection algorithms, ensuring that the selected sample subset achieves balanced coverage of APIs across all levels, rather than focusing solely on high-frequency APIs, thus avoiding gaps in domain knowledge coverage. Furthermore, it provides a structural basis for template design in domain-specific languages, enabling fine-grained control over the structure and complexity of the generated code.
[0053] Step S102: Based on importance, frequency of use, and semantic value, classify the mapped APIs to obtain an API semantic knowledge graph.
[0054] In some embodiments, the AP can be divided into high-frequency core APIs, mid-frequency commonly used APIs, and low-frequency edge APIs based on its usage frequency.
[0055] In some embodiments, APIs are classified into high / medium / low importance based on their irreplaceability within the domain and their necessity for completing core tasks. For example, APIs that serve as entry points for core domain capabilities are considered high importance, while APIs that serve as auxiliary tools are considered low importance.
[0056] In some embodiments, the information density of domain-specific semantics and programming paradigms carried by an API is measured. For example, APIs that encapsulate complex domain logic have high semantic value, while simple, general-purpose utility functions have low semantic value.
[0057] This step provides the objective function and weight constraints for the subsequent sample selection optimization algorithm, ensuring that high-importance, high-semantic-value, and high-frequency APIs are prioritized for coverage, allowing the model to quickly master the core capabilities of the domain. Furthermore, it provides priority guidance for code generation for domain-specific scenarios, forcibly incorporating high-value APIs into the skeleton template.
[0058] Step S200: Determine whether the target domain corresponds to a general programming scenario or a domain-specific scenario. In response to determining that the target domain corresponds to a general programming scenario, execute steps S300 and S400. In response to determining that the target domain corresponds to a domain-specific scenario, execute steps S500 to S800.
[0059] Step S300: Based on the generated API semantic knowledge graph, perform feature analysis on the existing instruction-code sample dataset to identify data distribution patterns, quality differences, and coverage gaps.
[0060] In this step, based on the generated API semantic knowledge graph of the target domain, a multi-dimensional and comprehensive quantitative diagnosis is performed on the existing dataset to accurately identify the three core problems of the dataset—distribution pattern, quality difference, and domain coverage gap. Finally, a standardized dataset feature quantification system is output, transforming the subsequent sample selection from "manual subjective screening" to "a solvable mathematical optimization problem".
[0061] In some embodiments, datasets are characterized by API usage patterns, code complexity metrics, instruction-response matching, and domain specificity. Statistical models are applied to quantify these dataset characteristics, providing a scientific basis for the subsequent selection process.
[0062] Step S400 involves using an optimization-based selection algorithm to select the optimal subset from the existing instruction-code sample pair dataset, which will be used as the final synthesized dataset. This step transforms subset selection into a mathematical optimization problem, maximizing API coverage and structural diversity while minimizing redundancy. The algorithm employs gradient-based optimization techniques and sets constraints to ensure a balanced representation of samples from different programming concepts and complexity levels.
[0063] In embodiments of the present invention, the optimization selection algorithm employs a greedy algorithm based on submodular function maximization. Specifically, API coverage and structural diversity are defined as submodular objective functions, and the total number of tokens or samples in the dataset is used as a constraint. The greedy strategy iteratively selects samples that bring the maximum marginal gain (i.e., include uncovered high-frequency / high-value APIs) to add to the optimal subset until the resource constraint limit is reached.
[0064] Maximizing API coverage means that the subset should cover as many APIs as possible in the target domain. Maximizing structural diversity means that the subset should include diverse programming structures / paradigms (such as branching, looping, recursion, asynchronous programming, object-oriented programming, functional programming, etc.). Minimizing redundancy is to avoid duplicate / highly similar samples within the subset (such as code that is identical in logic but differs only in variable names) and to reduce unnecessary computations.
[0065] Step S500 involves constructing a code skeleton template for a domain-specific scenario. The skeleton construction process incorporates programming patterns extracted from high-quality reference implementations, generating code samples with diverse structures but consistent semantics.
[0066] For domain-specific scenarios with scarce data (such as scientific computing, embedded development, and industry-specific library programming), this project builds a template system based on the target domain's API semantic knowledge graph and engineering programming paradigms. This system utilizes a dedicated domain-specific language (DSL) to define high-level code structures while retaining flexibility in implementation details. This template system must simultaneously meet two core requirements: first, structural constraints, ensuring that the generated code conforms to the target domain's architectural specifications, API usage conventions, and best practices; and second, flexibility in details, allowing for systematic adjustments to implementation details to generate diverse but semantically consistent code samples. This provides a reusable "skeleton" for subsequent batch generation of high-quality domain-specific code samples.
[0067] Step S600: Based on the constructed code skeleton template and API semantic knowledge graph, generate the code implementation. Specifically, based on the API semantic knowledge graph, embed the specific API nodes and their specifications that match the target function into the corresponding structural positions of the code skeleton template. This step maps abstract function specifications to specific API calls, systematically exploring different implementation schemes while strictly adhering to best programming practices. The implementation generation process integrates multiple strategies, including serialized API composition, hierarchical function construction, and context-aware parameter selection.
[0068] "Mapping abstract function specifications to specific API calls" refers to identifying the functional descriptions in the code skeleton template, selecting specific APIs that can implement the function from the target domain API library based on the generated API semantic knowledge graph, and strictly following the official API specifications and engineering usage patterns to ensure compliant calls.
[0069] In an embodiment of the present invention, generating code implementation based on the constructed code skeleton template and API semantic knowledge graph specifically includes the following steps: 1) Parse placeholders: Identify logical placeholders (such as <network request module>) in the code skeleton template; 2) API retrieval and matching: Combine the contextual intent to retrieve the most suitable API (such as requests.post) from the API semantic knowledge graph. 3) Automatic parameter filling: Based on the extracted API specifications and existing usage patterns, automatically generate compliant input parameters and exception handling code (such as generating try-except blocks and setting timeouts). 4) Code assembly: Embed the filled API call logic into the skeleton to generate complete executable code.
[0070] Within the framework, diverse samples are generated through multi-dimensional adjustments to explore different implementation schemes.
[0071] Step S700 involves quality verification and optimization of the generated code. Quality verification includes verifying syntax correctness, logical validity, execution efficiency, and compliance with specifications. The verification process uses static analysis tools, test-based verification methods, and complexity metrics to identify potential problems. Code implementations that fail to meet quality thresholds will be automatically optimized through targeted transformation or replaced with other implementations.
[0072] This step prevents syntactically correct but practically unusable code from entering the training set, ensuring that the generated code conforms to domain engineering standards, allowing the model to learn standardized programming practices, balancing the "functional correctness" and "maintainability / efficiency" of the code, and improving the overall quality of the samples.
[0073] Step S800: Based on the optimized code, generate natural language instructions describing the intent and function of the optimized code, constructing instruction-code sample pairs as the final synthesized dataset. This step uses natural language templates and code analysis to generate natural language instructions that accurately describe the function and intent of the code segment. Simultaneously, the matching degree of the paired instructions and code implementations is verified to ensure they accurately represent the target programming task.
[0074] Supervised fine-tuning of large code models essentially teaches the model the ability to "output the corresponding code given a natural language instruction." The constructed instruction-code sample pairs are used as training data to train the model.
[0075] Step S900: Configure optimal fine-tuning parameters based on the features of the final synthesized dataset and the attributes of the target model. In some embodiments, the features of the final synthesized dataset include its statistical and structural characteristics, such as average token length, instruction-response complexity distribution, and coverage density of high-value APIs. The system determines appropriate learning rate, batch size, and training duration by conducting experiments on a representative subset of the final synthesized dataset. Simultaneously, early stopping criteria and validation procedures are set to prevent overfitting while ensuring that the knowledge from the synthesized dataset can be effectively transferred to the target model. In embodiments of the present invention, the representative subset can be a validation set constructed through stratified sampling. It is a small subset of core samples proportionally extracted from the "optimal subset selected under general programming scenarios" and "sample pairs synthesized under domain-specific scenarios," used to quickly validate and determine the optimal fine-tuning hyperparameters (such as learning rate and batch size) with low computational consumption.
[0076] This invention introduces a data-centric design philosophy into large-code model fine-tuning, achieving a significant breakthrough compared to existing methods. By using abstract concepts at the API level as the basic units for dataset construction, it systematically captures the semantic connotations of programming paradigms, something existing methods cannot achieve. The quality of the datasets generated by this method is significantly improved, allowing the model to be exposed to diverse programming patterns while maintaining consistent quality standards. Unlike traditional methods that require massive, highly redundant datasets, the selection algorithm in this invention can filter out the optimal subset, retaining the samples with the most information, while significantly compressing the dataset size (typically by an order of magnitude). This efficiency directly reduces the computational cost of the fine-tuning stage, while maintaining or even improving model performance.
[0077] This invention designs sophisticated domain-specific adaptation mechanisms for both data-rich and data-scarce scenarios, overcoming the core limitations of current methods. In general programming scenarios, it can intelligently identify the most valuable samples from existing datasets, preserving diversity while eliminating redundancy. In specialized domains, it generates high-quality samples by combining API specifications with structured code templates, enabling domain-specific fine-tuning without relying on proprietary models or costly manual editing. This dual-path approach gives organizations unprecedented flexibility, allowing them to customize and adapt large code models to their specific needs, regardless of data resource sufficiency. A dedicated domain-specific language further enhances this adaptability, enabling fine-grained control over the structure and complexity of the generated code, ensuring comprehensive coverage of relevant programming patterns for any target domain.
[0078] This invention provides a clear implementation mechanism for generating consistently high-quality samples by formally defining the relationship between API-level abstraction and code quality. Furthermore, organizations can choose flexible deployment schemes based on their own data resources and constraints. Extensive validation across various programming tasks has demonstrated that this method consistently outperforms traditional dataset construction methods, representing a fundamental breakthrough in the field of large-code model fine-tuning. This systematic approach enables organizations to confidently deploy large-code models in production environments, significantly improving model performance while drastically reducing the computational resources and technical expertise required for model customization.
[0079] The method of this invention significantly improves computational efficiency. The gradient-based optimization algorithm in general scenarios can accurately screen high-value samples and reduce invalid computations. The code skeleton template in domain-specific scenarios can be reused, realizing the batch generation of high-quality samples. At the same time, the size of the synthesized dataset is greatly compressed, effectively solving the technical problems of large computational resource consumption and long training cycle in existing technologies. It improves model performance while reducing resource consumption.
[0080] Figure 3 This is a block diagram of an electronic device provided in an embodiment of the present disclosure.
[0081] Reference Figure 3 This disclosure provides an electronic device comprising: at least one processor 301; at least one memory 302; and one or more I / O interfaces 303 connected between the processor 301 and the memory 302; wherein the memory 302 stores one or more computer programs executable by the at least one processor 301, the one or more computer programs being executed by the at least one processor 301 to enable the at least one processor 301 to execute the above-described dataset synthesis method for fine-tuning large code models.
[0082] This disclosure also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor / processor core, implements the aforementioned dataset synthesis method for fine-tuning large code models. The computer-readable storage medium may be volatile or non-volatile.
[0083] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device executes the above-described dataset synthesis method for fine-tuning large code models.
[0084] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).
[0085] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable program instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0086] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0087] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0088] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0089] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0090] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0091] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0093] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.
Claims
1. A dataset synthesis method for fine-tuning large code models, comprising: Generate an API semantic knowledge graph for the target domain; Determine whether the target domain corresponds to a general programming scenario or a domain-specific scenario; In response to identifying the general programming scenario corresponding to the target domain, the following steps are performed: Based on the generated API semantic knowledge graph, feature analysis is performed on the dataset of the target domain, which includes multiple instruction-code sample pairs; The optimal subset is selected from the dataset using an optimization algorithm; In response to identifying a specific scenario within the target domain, the following steps are performed: Build a code skeleton template; Based on the constructed code skeleton template and the API semantic knowledge graph, a code implementation is generated. For the code implementation, generate natural language instructions that describe its intent and function, and construct instruction-code sample pairs.
2. The method according to claim 1, wherein, The generation of the API semantic knowledge graph for the target domain includes: Extract API specifications from official documentation in the target domain; Analyze API usage patterns in the existing codebase; Organize the APIs into a network / hierarchical structure based on their functions and relationships.
3. The method according to claim 1, wherein, Generating an API semantic knowledge graph for the target domain also includes classifying APIs organized in a network / hierarchical structure based on importance, frequency of use, and semantic value.
4. The method according to claim 1, wherein, Based on the generated API semantic knowledge graph, feature analysis of the dataset in the target domain is performed, including feature analysis of the dataset from API usage patterns, code complexity indicators, instruction-response matching degree and domain specificity.
5. The method according to claim 1, wherein, Based on the constructed code skeleton template and the API semantic knowledge graph, the code implementation is generated by: embedding API nodes and their specifications that match the target function into the corresponding structural positions of the code skeleton template based on the API semantic knowledge graph.
6. The method according to claim 1, wherein, After generating the code implementation based on the constructed code skeleton template, the method further includes quality verification and optimization of the generated code implementation.
7. The method according to claim 6, wherein, Quality verification includes verifying syntax correctness, logical validity, execution efficiency, and specification compliance.
8. A method for fine-tuning a large code model, comprising: The method of claim 1 is used to synthesize datasets; Fine-tune large code models using synthetic datasets.
9. The method according to claim 8, wherein, Fine-tuning a large code model using a synthetic dataset includes configuring optimal fine-tuning parameters based on the features of the synthetic dataset and the properties of the large code model.
10. The method according to claim 9, wherein, The characteristics of the synthesized dataset include average token length, instruction-response complexity distribution, and coverage density of high-value APIs.
11. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the dataset synthesis method for fine-tuning large code models as described in any one of claims 1 to 7.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the dataset synthesis method for fine-tuning large code models as described in any one of claims 1-7.