Code migration method and device based on large language model, equipment, storage medium and program product
By parsing non-standard format configuration files using a large language model to generate target code structure, the problems of low efficiency and poor adaptability in existing technologies are solved, achieving efficient and stable code migration.
Patent Information
- Application Number
- CN202511901766.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-03-20
AI Technical Summary
Existing code migration methods rely on manual operations, resulting in low efficiency and poor adaptability, making it impossible to achieve technology stack migration efficiently and at low cost.
A large language model is used to parse non-standard format configuration files and generate code structures that conform to the target framework specifications, reducing manual intervention and improving migration efficiency and adaptability through training data and dynamic context analysis.
It improves the efficiency and adaptability of code migration, reduces manual intervention, and ensures the stability and accuracy of migration results.
Smart Images

Figure CN121704900A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a code migration method, apparatus, device, storage medium, and program product based on a large language model. Background Technology
[0002] In the financial industry, migrating the core system's technology stack is a crucial step in digital transformation. When faced with technology adjustments or environmental changes, efficiently and cost-effectively migrating code to the target technology stack is paramount.
[0003] Currently, existing code migration methods primarily rely on manual migration. This method requires developers to parse the legacy technology stack's Extensible Markup Language (XML) configuration files line by line and manually map them to the target technology stack's code structure.
[0004] However, existing code migration methods rely on manual code migration, which requires repeated verification of the migration results, resulting in low efficiency and poor adaptability. Summary of the Invention
[0005] This application provides a code migration method, apparatus, device, storage medium, and program product based on a large language model, which aims to improve migration efficiency and enhance adaptability.
[0006] Firstly, this application provides a code migration method based on a large language model, including:
[0007] Obtain a non-standard format configuration file, which is a configuration file that does not conform to standard syntax specifications;
[0008] The non-standard format configuration file is parsed using a large language model to generate a target code structure, which is a code structure that conforms to the target framework specification.
[0009] The target code structure is output to the target framework.
[0010] In one possible implementation, the step of parsing the non-standard format configuration file and generating the target code structure using a large language model includes:
[0011] Obtain the training data for the non-standard format configuration file;
[0012] The large language model is fine-tuned using the training data;
[0013] The fine-tuned large language model parses the non-standard format configuration file and generates the target code structure.
[0014] In one possible implementation, obtaining the training data for the non-standard format configuration file includes:
[0015] Synthetic data is generated from standard templates based on human examples using a large language model.
[0016] The training data is obtained by updating the synthesized data through mapping rules, an incremental data synthesis mechanism, and a data labeling and cleaning agent; wherein, the mapping rules are updated in real time through an online learning mechanism, and the mapping rules are used to map the synthesized data to the training data; the incremental data synthesis mechanism is used to periodically collect and expand the synthesized data; and the data labeling and cleaning agent is used to identify and correct the synthesized data.
[0017] In one possible implementation, the step of parsing the non-standard format configuration file and generating the target code structure using the fine-tuned large language model includes:
[0018] The business scenarios of the non-standard format configuration file are analyzed based on dynamic context.
[0019] Generate a code structure adapted to the target framework based on the described business scenario.
[0020] In one possible implementation, the business scenario of analyzing the non-standard format configuration file based on dynamic context includes:
[0021] The semantic mapping relationship of the non-standard format configuration file is matched using a knowledge graph;
[0022] Generate a code structure adapted to the target framework based on the semantic mapping relationship.
[0023] In one possible implementation, the step of parsing the non-standard format configuration file and generating the target code structure using the fine-tuned large language model further includes:
[0024] The intent recognition module identifies the conversion intent of the non-standard format configuration file;
[0025] The target code structure is generated by calling the corresponding modular sub-stream according to the transformation intent. The modular sub-stream is used to indicate an independent processing unit that encapsulates specific transformation logic.
[0026] In one possible implementation, outputting the target code structure to the target framework includes:
[0027] Integrate the target code structure into the project directory of the target framework;
[0028] The target framework's build tools generate a compileable and runnable project.
[0029] Secondly, this application provides a code migration device based on a large language model, comprising:
[0030] The acquisition module is used to acquire non-standard format configuration files;
[0031] The generation module is used to parse the non-standard format configuration file using a large language model and generate the target code structure;
[0032] The output module is used to output the target code structure to the target framework.
[0033] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0034] The memory stores computer-executed instructions;
[0035] The processor executes computer execution instructions stored in the memory, causing the processor to perform the method described in any of the first aspects above.
[0036] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in any of the first aspects above.
[0037] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in any of the first aspects above.
[0038] This application provides a code migration method, apparatus, device, storage medium, and program product based on a large language model. By acquiring a non-standard format configuration file (which does not conform to standard syntax specifications), a foundation is laid for subsequent generation of the target code structure. The large language model parses this non-standard format configuration file and generates the target code structure, which conforms to the target framework's specifications. This reduces manual intervention and improves the adaptability of code migration. Outputting this target code structure to the target framework ensures the stability of code migration, thereby improving the efficiency and adaptability of code migration. Attached Figure Description
[0039] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0040] Figure 1A flowchart illustrating a code migration method based on a large language model provided in this application;
[0041] Figure 2 A flowchart illustrating another code migration method based on a large language model provided in this application;
[0042] Figure 3 A schematic diagram of the structure of a code migration device based on a large language model provided in this application;
[0043] Figure 4 This is a schematic diagram of the structure of an electronic device provided in this application.
[0044] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0045] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0046] In this application, the term "comprising" and its variations can refer to non-limiting inclusion; the term "or" and its variations can refer to "and / or". The terms "first", "second", etc., in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. In this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0047] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of the relevant data all comply with the relevant laws, regulations, and standards of the relevant countries and regions, have taken necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation access points for users to choose to authorize or refuse.
[0048] Furthermore, the technical solution involved in this application, which involves big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.) and the use of artificial intelligence technology for automated decision-making, and makes decisions that have a significant impact on personal rights based on the results of automated decision-making, provides users with corresponding operation entry points for users to choose to agree to or reject the results of automated decision-making; if the user chooses to reject, the process will proceed to the expert decision-making process.
[0049] First, let's explain some of the terms used in this application:
[0050] The Branch Transformation Toolkit (BTT) is an e-commerce application framework model for the financial industry provided by International Business Machines Corporation (IBM) for financial institutions.
[0051] Financial Services Framework: This refers to a modern application framework based on Spring Boot.
[0052] Large language models refer to deep learning models with natural language processing capabilities, which can learn complex grammatical rules and generate target code through training data.
[0053] Prompt words: Input instructions used to guide a large language model to perform a specific task.
[0054] The existing code migration methods mainly include the following:
[0055] 1. Manual migration testing method. This method requires developers to parse the Extensible Markup Language (XML) configuration files of the legacy technology stack line by line and manually map them to the code structure of the target technology stack. However, this method requires repeated verification of the correctness of the migration results, resulting in high overall system costs. Furthermore, parsing and verifying code line by line is time-consuming and inefficient.
[0056] 2. Traditional methods for migrating automation tools. Tools based on structured parsing attempt to convert configuration files from legacy technology stacks into target code using predefined rules. However, this method relies on predefined rules and requires frequent modifications to the rule code, resulting in poor adaptability.
[0057] Therefore, existing code migration methods suffer from low migration efficiency and poor adaptability.
[0058] Considering the aforementioned problems with existing code migration methods, this application proposes a method for code migration that eliminates the need for manual intervention and frequent modifications to rule code. This method utilizes a large language model to migrate code from the legacy technology stack to the target technology stack, improving migration efficiency and enhancing adaptability.
[0059] The execution entity of this code migration method based on a large language model can be, for example, a code migration system. Optionally, the code migration system can be any existing electronic device with processing capabilities, such as a terminal or a server. In some embodiments, the code migration system can also be deployed in a server cluster or cloud environment. This application does not limit the deployment environment of the code migration system.
[0060] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments.
[0061] The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0062] Figure 1 This is a flowchart illustrating a code migration method based on a large language model provided in this application. Figure 1 As shown, the method includes:
[0063] S101, Obtain a non-standard format configuration file, which is a configuration file that does not conform to the standard syntax specification.
[0064] For example, a configuration file can be a file used to store configuration information such as parameters, settings, and rules for a system, application, or device.
[0065] For example, standard syntax specifications can include delimiters, nesting rules, and data type definitions.
[0066] For example, a non-standard format configuration file can be a custom configuration file or one that does not conform to the standard syntax specifications described above. For instance, a non-standard format configuration file can be an XML file with incorrect tag nesting, missing attributes, or incomplete formatting.
[0067] Optionally, the code migration system can read the non-standard format configuration file from local storage, receive it from an external device or remote server via a network protocol, or analyze and locate the non-standard format configuration file by parsing a compressed package containing it. Alternatively, the code migration system can obtain the aforementioned non-standard format file through any existing implementation method, which will not be elaborated upon here.
[0068] S102, the non-standard format configuration file is parsed using a large language model and a target code structure is generated, which is a code structure that conforms to the target framework specification.
[0069] For example, the target code structure can be a code structure that conforms to the target framework specification, including class definitions, configuration files, and engine calling logic.
[0070] For example, the target framework specification can be the technical standard defined by the target framework. For instance, the target framework specification may include syntax rules, directory structure, and configuration methods.
[0071] In some embodiments, the code migration system can acquire training data from the non-standard format configuration file. Then, it uses this training data to fine-tune the large language model. Finally, it uses the fine-tuned large language model to parse the non-standard format configuration file and generate the target code structure.
[0072] For example, training data can be mapping data between non-standard format configuration files and target code structures.
[0073] Optionally, the code migration system can obtain training data for the non-standard format configuration file based on historical data, or it can construct training data by pre-setting the format configuration and configuration code of the non-standard format configuration file.
[0074] Optionally, the code migration system can construct prompt words based on the training data, and input the prompt words and the training data into the large language model to obtain a fine-tuned large language model. The prompt words are used to adjust the large language model based on the training data to obtain the fine-tuned large language model. It should be understood that the large language model can also be fine-tuned using any existing large language model fine-tuning training method, which will not be elaborated upon here.
[0075] Optionally, the code migration system can perform semantic understanding on the non-standard format file based on a fine-tuned large language model, extracting key information and logical connections. Based on the aforementioned key information and logical connections, the corresponding target code structure is constructed according to the target framework specifications.
[0076] The above method yields training data for the non-standard format configuration file, providing a data basis for subsequent fine-tuning of the large language model. Fine-tuning the large language model using this training data improves its parsing and generation accuracy. The fine-tuned large language model then parses the non-standard format configuration file and generates the target code structure, reducing manual intervention and thus improving code migration efficiency.
[0077] S103, output the target code structure to the target framework.
[0078] In some embodiments, the code migration system can integrate the target code structure into the target framework's project directory. Then, the target framework's build tools generate a compileable and runnable project.
[0079] For example, the project directory of the target framework can be a standardized file or directory organization structure defined by the target framework. For instance, the project directory of the target framework may include fixed paths, file naming rules, etc.
[0080] For example, a build tool could be a tool used to generate a compilable project.
[0081] Optionally, the code migration system can automatically place the generated target code structure into the corresponding path in the project directory according to the target framework's directory structure, ensuring that file location and naming conform to the target framework's recognition requirements. It then calls the target framework's build tools to perform compilation, dependency download, and packaging operations. For example, the code migration system can use the target framework's build tools to convert source code into executable code, automatically obtain the necessary third-party libraries, and generate deployable files.
[0082] By integrating the target code structure into the target framework's project directory using the above method, and generating a compileable and runnable project using the target framework's build tools, it is possible to ensure that the target framework correctly identifies and loads the code, shortening the code migration cycle and thus improving the stability and efficiency of code migration.
[0083] In this embodiment, a non-standard format configuration file is obtained. This non-standard format configuration file does not conform to standard syntax specifications, laying the foundation for subsequent generation of the target code structure. The non-standard format configuration file is parsed using a large language model to generate the target code structure. This target code structure conforms to the target framework's specifications, reducing manual intervention and improving the adaptability of code migration. Outputting this target code structure to the target framework achieves code migration stability, thereby improving the efficiency and adaptability of code migration.
[0084] The following section provides a detailed explanation of how the code migration system parses the non-standard format configuration file and generates the target code structure using the finely tuned large language model.
[0085] As one possible implementation, the code migration system can generate synthetic data based on standard templates generated from manually created examples, using a large language model. Then, the synthetic data is updated using mapping rules, an incremental data synthesis mechanism, and a data annotation and cleaning agent to obtain the training data. Specifically, the mapping rules are updated in real-time through an online learning mechanism and are used to map the synthetic data to the training data; the incremental data synthesis mechanism is used to periodically collect and expand the synthetic data; and the data annotation and cleaning agent is used to identify and correct the synthetic data.
[0086] For example, a standard template generated by human examples can be a manually defined mapping example of configuration files and target code.
[0087] For example, an online learning mechanism could be one that updates the model in real time during code migration. For instance, when the code migration system detects a new label, it automatically triggers a process of fine-tuning the large language model.
[0088] For example, an incremental data synthesis mechanism can dynamically expand the scale of the synthesized data. For instance, a code migration system could use this incremental data synthesis mechanism to automatically generate new synthesized data by setting a time period, or by automatically calling a large language model to generate new synthesized data when the synthesized data coverage falls below a preset coverage threshold, thus gradually increasing the amount of synthesized data.
[0089] For example, a data labeling and cleaning agent can be an intelligent tool that identifies and corrects errors in synthetic data.
[0090] Optionally, the code migration system can input manually defined standard templates into a large language model, which will then learn the mapping logic between non-standard format configuration files in the templates and the target code structure, generating a large amount of initial synthetic data that is structurally similar but has different content.
[0091] Optionally, the code migration system can use the mapping rule and the data annotation and cleaning agent to identify and correct the synthetic data, generate new synthetic data based on the incremental data synthesis mechanism, and merge it with the corrected synthetic data to obtain the target synthetic data.
[0092] Using the method described above, initial synthetic data can be obtained by generating synthetic data from standard templates based on manually generated examples and through a large language model. Training data is then obtained by updating this synthetic data using mapping rules, an incremental data synthesis mechanism, and a data annotation and cleaning agent. This approach reduces maintenance costs and improves code migration adaptability. Specifically, the mapping rules are updated in real-time through an online learning mechanism and are used to map the synthetic data to the training data. The incremental data synthesis mechanism is used to periodically collect and expand the synthetic data, and the data annotation and cleaning agent is used to identify and correct the synthetic data.
[0093] In some embodiments, the code migration system can analyze the business scenario of the non-standard format configuration file based on dynamic context. Then, it generates a code structure adapted to the target framework based on the business scenario.
[0094] For example, the business scenario can be a specific business area, process, or functional scenario of the non-standard format configuration file service.
[0095] For example, dynamic context analysis can be performed by combining the location of the configuration file in the business process and attribute dependencies.
[0096] Optionally, the code migration system collects the dynamic context information of the non-standard format configuration file and analyzes the specific business domain served by the configuration file, combined with key parameters in the configuration file. Based on this specific business domain and the target framework, it generates a code structure containing configuration parameters, mapping relationships, and business logic. For example, dynamic context information could be related business logs or real-time business metrics.
[0097] Optionally, the code migration system can also construct prompt words based on dynamic context and input these prompt words into a semantic analysis model to determine the business scenario of the non-standard format configuration file. These prompt words are used to analyze the business scenario of the non-standard format configuration file based on dynamic context. For example, the semantic analysis model can be any pre-trained deep learning model or machine learning model capable of analyzing the business scenario of the non-standard format configuration file based on dynamic context.
[0098] By using the above method, the business scenario of the non-standard format configuration file can be analyzed based on dynamic context, and a code structure adapted to the target framework can be generated according to the business scenario. This can improve the adaptability of the code to the business scenario, thereby improving the practicality and reliability of code migration.
[0099] As one possible implementation, the code migration system can match the semantic mapping relationship of the non-standard format configuration file using a knowledge graph. Then, it can generate a code structure adapted to the target framework based on this semantic mapping relationship.
[0100] For example, a knowledge graph can be structured data that stores the semantic mapping relationship between source frames and target frames.
[0101] Optionally, the code migration system can parse non-standard format configuration files to extract key concepts, attribute values, and logical relationships to determine semantic information. Based on this semantic information, it matches source framework semantic nodes in the knowledge graph, locates corresponding target framework semantic nodes, and identifies semantic mapping rules. Based on the matched semantic mapping rules, it converts the non-standard configuration's semantic information into code elements of the target framework, generating a code structure that conforms to the target framework's syntax specifications.
[0102] By employing the methods described above, the semantic mapping relationships of this non-standard format configuration file are matched using a knowledge graph, thereby improving code standardization. Based on these semantic mapping relationships, a code structure adapted to the target framework is generated, reducing manual verification and improving the accuracy of code migration.
[0103] As another possible implementation, the code migration system can also identify the conversion intent of the non-standard format configuration file through an intent recognition module. Then, based on the conversion intent, the corresponding modular sub-stream is invoked to generate the target code structure. This modular sub-stream is used to indicate independent processing units that encapsulate specific conversion logic.
[0104] For example, the intent recognition module could be a component used to recognize the conversion intent of the non-standard format configuration file.
[0105] For example, the conversion intent can be a specific goal or requirement that a non-standard format configuration file needs to achieve during the migration process. For instance, the conversion intent of the non-standard format configuration file can be determined based on the intent recognition module, and the conversion intent can be, for example, a core logic conversion, or an adaptation to the scenario.
[0106] For example, a modular subflow can be an independent processing unit that includes processes such as parsing non-standard format configuration files and generating target code. For instance, a modular subflow could be a core code transformation subflow or a scenario adaptation subflow.
[0107] Optionally, the code migration system can perform multi-dimensional analysis of non-standard format configuration files based on this intent recognition module to determine the conversion intent and output conversion intent tags. Based on these conversion intent tags, the code migration system matches and invokes predefined modular sub-flows. These modular sub-flows process the configuration information according to the encapsulated conversion logic, outputting a code structure that conforms to the target framework specifications.
[0108] Optionally, the intent recognition module can also be any pre-trained deep learning model or machine learning model with intent recognition capabilities.
[0109] The above method utilizes an intent recognition module to identify the conversion intent of the non-standard format configuration file, enhancing the scalability of code migration. Based on this conversion intent, the corresponding modular sub-flow is invoked to generate the target code structure. This modular sub-flow indicates independent processing units that encapsulate specific conversion logic, avoiding the generation of redundant code, reducing maintenance costs, and improving code migration efficiency.
[0110] Figure 2 A flowchart illustrating another code migration method based on a large language model provided in this application. Figure 2 As shown, the method includes:
[0111] 1. Model fine-tuning
[0112] (1) Data synthesis:
[0113] Optionally, the code migration system can generate high-quality training data for fine-tuning the Large Language Model (LLM), such as rule-transformation pairs.
[0114] Optionally, the code migration system can first define rules. These rules extract the mapping rules from BTT configuration elements to the target code of the target framework. The BTT configuration elements can include variable collections (KColl), message definitions (fmtDef), operation steps (opstep), context references (context), executors (operation), and their referencing relationships. The target code can be a computer language (Java classes) or configuration files, etc.
[0115] Optionally, the code migration system can also manually select typical processing files containing various complex scenarios and convert these typical processing files into target code as standard templates. These typical files may include execution chain Java code, data model Java code, configurations, etc.
[0116] Optionally, the code migration system can generate synthetic data using an LLM (Learning Power Management). The LLM generates a large amount of new synthetic training data combining BTT (Browser-to-Track) processing configurations and target code, based on defined rules and standard templates.
[0117] (2) Data cleaning:
[0118] For example, synthetic training data needs to be cleaned to ensure quality. Manual data cleaning is too labor-intensive. Therefore, a data labeling and cleaning agent can be developed to automatically clean the synthetic training data according to preset rules. Then, a deduplication tool is used for fuzzy deduplication.
[0119] (3) Model fine-tuning:
[0120] Optionally, the code migration system can use cleaned synthetic training data to perform supervised fine-tuning on a selected base large language model, improving the accuracy of code translation from 70% to 90%.
[0121] 2. Construct a code-transformation intelligent agent
[0122] Optionally, code migration systems can overcome the shortcomings of hard-coded rules in traditional tools by building intelligent agents based on intent recognition.
[0123] (1) Code conversion entry agent:
[0124] At its core is a scheduling engine with intent recognition capabilities.
[0125] Optionally, the code migration system can receive input to be converted, such as operation definitions and button template files. By analyzing the characteristics of the input, the system identifies its corresponding conversion intent. For example, the conversion intent could be a conversion of core processing logic, a conversion of common configuration, or an adaptation to a specific scenario.
[0126] (2) Work subflow:
[0127] Optionally, independent, modular workflows can be designed and deployed for different transformation intentions. Each workflow encapsulates the logic for handling transformation tasks with a specific intention. For example, a fine-tuned LLM is typically invoked as the core transformation engine, and other components of the agent are used to implement the necessary pre- and post-processing rules.
[0128] For example, the main sub-stream types include the following:
[0129] Core code transformation sub-streams: Processing operation definition files are transformed into target execution chain Java code, and data model Java code.
[0130] Configuration file conversion sub-stream: Processes button template files to convert them into the target framework's public configuration file, as well as the implementation class configuration file.
[0131] Scene Adaptation Sub-stream: Identify the original BTT application scenario (such as online processing, batch tasks) and generate the standard call entry code for the corresponding target framework scene engine (such as distributed interface engine, timed thread engine).
[0132] (3) Application Programming Interface (API): Provides a standard API interface for external tools to call the transformation function of the intelligent agent.
[0133] 3. Develop a project code conversion tool
[0134] Optionally, automated tools can be developed in conjunction with code transformation agents to achieve engineering-level transformation.
[0135] (1) Engineering Scan: Scan the existing BTT project directory structure.
[0136] (2) File extraction: Identify and extract the operation definitions that need to be converted, as well as the button template files.
[0137] (3) Agent call: The extracted XML content is used as input parameters to call the code conversion agent API built in (2).
[0138] (4) Output results: Receive the transformation results (Java code file, target framework configuration file) returned by the agent and output them to the specified directory in accordance with the target framework engineering specifications.
[0139] (5) Project construction: For example, the generated target code and configuration are integrated to form a compileable and runnable project framework.
[0140] The above are the method embodiments provided in this application. The apparatus provided in this application will be described below.
[0141] Figure 3 A schematic diagram of a code migration device based on a large language model provided in this application is shown below. Figure 3 As shown, the code migration device 300 based on a large language model provided in this embodiment includes: an acquisition module 301, a generation module 302, and an output module 303. Among them,
[0142] Module 301 is used to obtain non-standard format configuration files;
[0143] The generation module 302 is used to parse the non-standard format configuration file using a large language model and generate the target code structure.
[0144] Output module 303 is used to output the target code structure to the target framework.
[0145] Optionally, the generation module 302 is also used to obtain the training data of the non-standard format configuration file; to fine-tune the large language model using the training data; and to parse the non-standard format configuration file and generate the target code structure using the fine-tuned large language model.
[0146] Optionally, the generation module 302 is further configured to generate synthetic data based on standard templates generated from human examples using a large language model; and update the synthetic data using mapping rules and an incremental data synthesis mechanism to obtain the training data; wherein the mapping rules are updated in real time through an online learning mechanism, and the mapping rules are used to map the synthetic data to the training data, and the incremental data synthesis mechanism is used to periodically collect and expand the synthetic data.
[0147] Optionally, the generation module 302 is also used to analyze the business scenario of the non-standard format configuration file based on the dynamic context; and generate a code structure adapted to the target framework based on the business scenario.
[0148] Optionally, the generation module 302 is also used to match the semantic mapping relationship of the non-standard format configuration file through a knowledge graph; and generate a code structure adapted to the target framework based on the semantic mapping relationship.
[0149] Optionally, the generation module 302 is also used to identify the conversion intent of the non-standard format configuration file through the intent recognition module; and to call the corresponding modular sub-stream to generate the target code structure according to the conversion intent, wherein the modular sub-stream is used to indicate the independent processing unit that encapsulates specific conversion logic.
[0150] Optionally, the output module 303 is also used to integrate the target code structure into the project directory of the target framework; and to generate a compileable and runnable project through the build tools of the target framework.
[0151] This embodiment provides a code migration device based on a large language model, which can execute the methods provided in any of the above method embodiments. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0152] Figure 4 This is a schematic diagram of the structure of an electronic device provided in this application. Figure 4 As shown, the electronic device 400 provided in this embodiment includes at least one processor 401 and a memory 402. Optionally, the device 400 further includes a communication component 403. The processor 401, memory 402, and communication component 403 are connected via a bus 404.
[0153] In a specific implementation, at least one processor 401 executes computer execution instructions stored in memory 402, causing at least one processor 401 to perform the above-described method.
[0154] The specific implementation process of processor 401 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0155] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0156] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0157] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0158] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0159] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0160] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0161] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0162] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0163] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0164] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0165] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0166] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0167] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0168] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A code migration method based on a large language model, characterized in that, include: Obtain a non-standard format configuration file, which is a configuration file that does not conform to standard syntax specifications; The non-standard format configuration file is parsed using a large language model to generate a target code structure, which is a code structure that conforms to the target framework specification. The target code structure is output to the target framework.
2. The method according to claim 1, characterized in that, The step of parsing the non-standard format configuration file using a large language model and generating the target code structure includes: Obtain the training data for the non-standard format configuration file; The large language model is fine-tuned using the training data; The fine-tuned large language model parses the non-standard format configuration file and generates the target code structure.
3. The method according to claim 2, characterized in that, The step of obtaining the training data for the non-standard format configuration file includes: Synthetic data is generated from standard templates based on human examples using a large language model. The training data is obtained by updating the synthesized data through mapping rules, an incremental data synthesis mechanism, and a data labeling and cleaning agent; wherein, the mapping rules are updated in real time through an online learning mechanism, and the mapping rules are used to map the synthesized data to the training data; the incremental data synthesis mechanism is used to periodically collect and expand the synthesized data; and the data labeling and cleaning agent is used to identify and correct the synthesized data.
4. The method according to claim 2, characterized in that, The process of parsing the non-standard format configuration file and generating the target code structure using the fine-tuned large language model includes: The business scenarios of the non-standard format configuration file are analyzed based on dynamic context. Generate a code structure adapted to the target framework based on the described business scenario.
5. The method according to claim 4, characterized in that, The business scenarios based on dynamic context analysis of the non-standard format configuration file include: The semantic mapping relationship of the non-standard format configuration file is matched using a knowledge graph; Generate a code structure adapted to the target framework based on the semantic mapping relationship.
6. The method according to any one of claims 2-4, characterized in that, The step of parsing the non-standard format configuration file and generating the target code structure using the fine-tuned large language model also includes: The intent recognition module identifies the conversion intent of the non-standard format configuration file; The target code structure is generated by calling the corresponding modular sub-stream according to the transformation intent. The modular sub-stream is used to indicate an independent processing unit that encapsulates specific transformation logic.
7. The method according to claim 1 or 2, characterized in that, The step of outputting the target code structure to the target framework includes: Integrate the target code structure into the project directory of the target framework; The target framework's build tools generate a compileable and runnable project.
8. A code migration device based on a large language model, comprising: The acquisition module is used to acquire non-standard format configuration files; The generation module is used to parse the non-standard format configuration file using a large language model and generate the target code structure; The output module is used to output the target code structure to the target framework.
9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 7.