Route configuration translation method and device based on large language model, equipment and medium

By combining a large language model with a configuration manual, the source configuration template of the router is extracted and the target large language model is trained, which solves the problem of mutual translation of configurations of routers from different manufacturers and achieves highly accurate and efficient configuration file conversion.

CN119544500BActive Publication Date: 2025-10-17TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411423001.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-10-17
Estimated Expiration
2044-10-12

AI Technical Summary

Technical Problem

Existing router configuration parsers are limited to parsing configurations from specific vendors and cannot translate between different vendors. In particular, they cannot parse the configurations of Huawei and H3C routers in FITI networks, making verification difficult.

Method used

The source configuration template of the router's original configuration file is extracted using a large language model, and the target large language model is trained through the configuration manual to enable it to have the vertical domain knowledge of the target manufacturer's router configuration method. Based on the target large language model, the source configuration template is translated into the target configuration template, and then the original configuration file is translated into the format of the target manufacturer.

Benefits of technology

It enables mutual translation of configuration files between routers from different manufacturers or from different series of routers from the same manufacturer, improving translation accuracy and avoiding the problem of large language models losing accuracy when processing large-scale configurations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544500B_ABST
    Figure CN119544500B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of computer network configuration, in particular to a routing configuration mutual translation method and device based on a large language model, equipment and medium, wherein the method comprises the following steps: obtaining an original configuration file of a router to be converted and a configuration manual of a router of a target manufacturer; extracting a source configuration template of the original configuration file based on a large language model; training the large language model by using the configuration manual to obtain a target large language model, translating the source configuration template into a target configuration template based on the target large language model, and mutual translating the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template, wherein the target large language model has vertical domain knowledge of a routing configuration method of the router of the target manufacturer. Therefore, the problems in the related art that a configuration parser is limited to parsing configurations from a specific supplier and cannot realize mutual translation between routers of different manufacturers are solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer network configuration, and in particular to a routing configuration mutual translation method and device based on a large language model, equipment and medium. BACKGROUND

[0002] Currently, the Internet is generally a distributed system composed of a plurality of routers to exchange routing information and forward data packets, so as to realize normal access of the network. These routers are mostly composed of routers of different manufacturers or different series of routers of the same manufacturer. However, the syntax commands between different manufacturers or different series of routers of the same manufacturer are generally different, which will cause difficulties in configuration conversion when configuring the network or configuration migration. In addition, in order to ensure the reliability of the network, the correctness of the network configuration to be deployed needs to be verified before being deployed to the actual network.

[0003] However, all existing verification tools rely on the Batfish parser to parse the router configuration, and lack support for the configuration of routers of domestic manufacturers. Therefore, when using routers of domestic manufacturers to build a network, it is difficult to verify. In addition, in the operation practice of FITI (Future Internet Technology Infrastructure, future Internet technology infrastructure) network, due to the challenges faced by configuration parsing, it is not simple to directly apply the previous verification tools to the verification of FITI network. Although there are many existing solutions, when building the FITI configuration verifier Ladybug, no network configuration verification tool can successfully parse the FITI configuration composed of routers of Huawei and H3C. Parsing the configuration is the first stage of network verification.

[0004] Due to the complexity of the configuration language specific to the router manufacturer, it is challenging to customize and develop a corresponding configuration parser for routers of different manufacturers: the development engineer must thoroughly understand the configuration manual, including various configuration items, commands and parameters, and the related syntax rules. In addition, it is also necessary to create a lexical and syntax parser according to the syntax rules, so as to form an abstract syntax tree. And it is necessary to design functions to traverse the abstract syntax tree, extract parameter values and store them in the specified data structure. Therefore, it is a very time-consuming and difficult work to write a specific parser for each manufacturer. However, the configuration parser in the existing verification tools is limited to parsing the configuration from a specific supplier (such as Cisco, Juniper). SUMMARY

[0005] The application provides a routing configuration mutual translation method and device based on a large language model, equipment and medium, to solve the problem that the configuration parser in the related art is limited to parsing configurations from a specific supplier and cannot realize mutual translation between routers of different manufacturers.

[0006] The first aspect embodiment of the application provides a routing configuration mutual translation method based on a large language model, including the following steps: obtaining an original configuration file of a router to be converted and a configuration manual of a router of a target manufacturer; extracting a source configuration template of the original configuration file based on a large language model; training the large language model using the configuration manual to obtain a target large language model, translating the source configuration template into a target configuration template based on the target large language model, and mutual translating the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template, wherein the target large language model has vertical domain knowledge of the configuration method of the router of the target manufacturer.

[0007] Optionally, translating the source configuration template into the target configuration template based on the target large language model includes: obtaining a table of contents of the configuration manual; inputting the source configuration template and the table of contents of the configuration manual into the target large language model, wherein the target large language model finds a target chapter based on the source configuration template and the table of contents of the configuration manual; obtaining the content of the target chapter; training the target large language model based on the content of the target chapter to obtain a first target large language model, wherein the first target large language model has vertical domain knowledge of the target configuration segment configuration method of the router of the target manufacturer; and translating the source configuration template into the target configuration template based on the first target large language model.

[0008] Optionally, mutual translating the original configuration file into the target format configuration file corresponding to the router of the target manufacturer based on the target configuration template includes: obtaining a translation mapping relationship of the source configuration template and the target configuration template; training the first target large language model using the translation mapping relationship to obtain a second target large language model, wherein the second target large language model has vertical domain knowledge of the mutual translation method of the source manufacturer and the target manufacturer of the router to be converted; and mutual translating the original configuration file into the target format configuration file corresponding to the router of the target manufacturer based on the second target large language model and the translation mapping relationship.

[0009] Optionally, after translating the source configuration template into the target configuration template based on the target large language model, the method further includes: obtaining an initial translation result of the source configuration template translated into the target configuration template; identifying errors in the initial translation result, and training a second target large language model based on the errors and the configuration manual, wherein the second target large language model outputs a final target configuration template after training, and the errors are iteratively corrected during the training process until a preset number of iterations is reached or a correct translation result is generated.

[0010] Optionally, the types of errors include at least one of a syntax error, a view structure error, and a semantic error, and identifying the error in the initial translation result includes: identifying the syntax error and the view structure error by using a preset parser, wherein the preset parser is a Batfish parser, and the Batfish parser is generated based on a unified syntax rule of the target manufacturer.

[0011] Optionally, the iterative correction of the error is performed until a preset number of iterations is reached or a correct translation result is generated, and the iterative correction of the error includes: if the error is a syntax error, determining a corresponding chapter in the configuration manual that solves the syntax of the error according to the syntax of the error, and correcting the syntax of the error according to a correction method of the corresponding chapter; if the error is a view structure error, determining a corresponding chapter and an error part to which the error belongs according to the view structure of the error, and extracting a configuration example from the corresponding chapter, and correcting the view structure of the error according to the configuration example, wherein the configuration example and the error part run the same protocol and have a correct view structure; and if the error is a semantic error, generating a first semantic for each source segment in a source configuration template based on a large language model, generating a second semantic of a target configuration template, and correcting the semantic of the error according to a similarity between the first semantic and the second semantic.

[0012] Optionally, the source configuration template of the original configuration file is extracted based on the large language model, and the extraction includes: segmenting the original configuration file according to a structure of the original configuration file to obtain a plurality of segments; and synthesizing the source configuration template according to a structure of the plurality of segments, wherein all features in the original configuration file are encapsulated in the source configuration template.

[0013] The second aspect embodiment of the present application provides a routing configuration translation device based on a large language model, which includes: an acquisition module configured to acquire an original configuration file of a router to be converted and a configuration manual of a router of a target manufacturer; an extraction module configured to extract a source configuration template of the original configuration file based on a large language model; and a translation module configured to train the large language model by using the configuration manual to obtain a target large language model, translate the source configuration template into a target configuration template based on the target large language model, and translate the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template, wherein the target large language model has vertical domain knowledge of a configuration method of the router of the target manufacturer.

[0014] Optionally, the mutual translation module is further configured to: obtain a table of contents of the configuration manual; input the source configuration template and the table of contents of the configuration manual into the target large language model, wherein the target large language model finds the target chapter based on the source configuration template and the table of contents of the configuration manual; obtain content of the target chapter; train the target large language model based on the content of the target chapter to obtain a first target large language model, wherein the first target large language model has target configuration segment configuration method vertical domain knowledge of the router of the target manufacturer; and translate the source configuration template into a target configuration template based on the first target large language model.

[0015] Optionally, the mutual translation module is further configured to: obtain a translation mapping relationship of the source configuration template and the target configuration template; train the first target large language model based on the translation mapping relationship to obtain a second target large language model, wherein the second target large language model has vertical domain knowledge of a source manufacturer and a target manufacturer mutual translation method of the router to be converted; and translate the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the second target large language model and the translation mapping relationship.

[0016] Optionally, the mutual translation module is further configured to: obtain an initial translation result of the source configuration template translated into the target configuration template after the source configuration template is translated into the target configuration template based on the target large language model; identify errors in the initial translation result; and train a second target large language model based on the errors and the configuration manual, wherein the second target large language model outputs a final target configuration template after training, and the training process iteratively corrects errors until a preset iteration number is reached or a correct translation result is generated.

[0017] Optionally, the types of errors include at least one of a syntax error, a view structure error, and a semantic error, and the training module is further configured to: identify the syntax error and the view structure error using a preset parser, wherein the preset parser is a Batfish parser generated based on a uniform syntax rule of the target manufacturer.

[0018] Optionally, the training module is further configured to: if the error is a syntax error, determine a corresponding chapter in the configuration manual that solves the syntax of the error according to the syntax of the error, and correct the syntax of the error according to a correction method of the corresponding chapter; if the error is a view structure error, determine an error part and a corresponding chapter to which the view structure of the error belongs, and extract a configuration example from the corresponding chapter, and correct the view structure of the error according to the configuration example, wherein the configuration example and the error part run the same protocol and have a correct view structure; and if the error is a semantic error, generate a first semantic in the source configuration template based on the large language model, generate a second semantic of the target configuration template, and correct the semantic of the error according to a similarity between the first semantic and the second semantic.

[0019] Optionally, the extraction module is further configured to segment the original configuration file according to a structure of the original configuration file to obtain a plurality of segments; and synthesize a source configuration template according to a structure of the plurality of segments, wherein all features in the original configuration file are encapsulated in the source configuration template.

[0020] The third aspect of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to perform the large language model-based routing configuration mutual translation method according to the above embodiments.

[0021] The fourth aspect of the present application provides a computer-readable storage medium having a computer program or instructions stored thereon, wherein the computer program or instructions are executed by a processor to perform the large language model-based routing configuration mutual translation method according to the above embodiments.

[0022] Therefore, the present application has at least the following beneficial effects:

[0023] The present application extracts a source configuration template of an original configuration file of a router to be converted by using a large language model, and trains a target large language model by using a configuration manual to make it have vertical domain knowledge of a router configuration method of a target manufacturer, and translates the source configuration template into a target configuration template based on the target large language model and the configuration manual, and further translates the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template, uses the configuration manual to guide the translation of the large language model, improves the accuracy of the translation of the large language model, realizes the mutual translation of configuration files of routers of different manufacturers or different series of the same manufacturer, and translates the configuration template first, and uses the translated target configuration template to guide the translation of the entire original configuration file, effectively avoiding the problem of accuracy decline of the large language model when processing large-scale configurations. Therefore, the technical problems such as the configuration parser being limited to parsing configurations from a specific supplier and being unable to realize mutual translation between routers of different manufacturers are solved.

[0024] Additional aspects and advantages of the present application will be in part apparent and in part pointed out hereinafter. BRIEF DESCRIPTION OF DRAWINGS

[0025] The above and / or additional aspects and advantages of the present application will become apparent and be readily appreciated from the following description, including the accompanying drawings, wherein:

[0026] Figure 1 A flowchart of the large language model-based routing configuration mutual translation method according to the embodiments of the present application is provided.

[0027] Figure 2A schematic diagram of a large language model-based routing configuration mutual interpretation method according to an embodiment of the present application is shown in FIG. 1.

[0028] Figure 3 A schematic diagram of a large language model-based routing configuration mutual interpretation device according to an embodiment of the present application is shown in FIG. 2.

[0029] Figure 4 A structural schematic diagram of an electronic device according to an embodiment of the present application is shown in FIG. 3. DETAILED DESCRIPTION

[0030] Embodiments of the present application are described in detail below with reference to the accompanying drawings, examples of which are shown in the drawings, in which the same or similar notations are used to denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to explain the present application, and cannot be understood as limiting the present application.

[0031] A large language model-based routing configuration mutual interpretation method, device, equipment and medium of an embodiment of the present application are described below with reference to the accompanying drawings. In view of the complexity of the router manufacturer-specific configuration language mentioned in the above background art, it is difficult to customize and develop a corresponding configuration parser for routers of different manufacturers, and the configuration parser in the existing verification tool is limited to parsing configurations from a specific supplier. The present application provides a large language model-based routing configuration mutual interpretation method, in which a source configuration template of an original configuration file of a router to be converted is extracted using a large language model, a target large language model is obtained by training the large language model using a configuration manual, so that the target large language model has vertical domain knowledge of the router configuration method of the target manufacturer, and the source configuration template is translated into a target configuration template based on the target large language model and the configuration manual, and then the original configuration file is mutually interpreted into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template. Thus, the problem that the configuration parser in the related art is limited to parsing configurations from a specific supplier and cannot realize mutual interpretation between routers of different manufacturers is solved.

[0032] Specifically, Figure 1 A flowchart of a large language model-based routing configuration mutual interpretation method according to an embodiment of the present application is shown in FIG. 4.

[0033] As Figure 1 shown, the large language model-based routing configuration mutual interpretation method includes the following steps:

[0034] In step S101, an original configuration file of a router to be converted and a configuration manual of a router of a target manufacturer are obtained.

[0035] The router to be converted is, for example, a first series of routers of Huawei, and the router of the target manufacturer is, for example, a router of Cisco or a second series of routers of Huawei, that is, the two routers can be routers of different manufacturers or routers of the same manufacturer.

[0036] It can be understood that the embodiment of the present application can obtain the original configuration file of the router to be converted and the configuration manual of the router of the target manufacturer, so as to subsequently translate the original configuration file into the configuration file in the format corresponding to the router of the target manufacturer based on the configuration manual.

[0037] In step S102, the source configuration template of the original configuration file is extracted based on the large language model.

[0038] It can be understood that the embodiment of the present application can extract the source configuration template of the original configuration file based on the large language model ChatGPT, and the specific extraction process is as follows.

[0039] In the embodiment of the present application, the source configuration template of the original configuration file is extracted based on the large language model, including segmenting the original configuration file according to the structure of the original configuration file to obtain a plurality of segments, and synthesizing the source configuration template according to the structure of the plurality of segment configurations, wherein all features in the original configuration file are encapsulated in the source configuration template.

[0040] It can be understood that the embodiment of the present application can segment the original configuration file according to the structure of the original configuration file to obtain a plurality of segments, and synthesize the source configuration template according to the structure of the plurality of segment configurations, so that the source configuration template contains all configuration commands that can represent the features of the segments and the corresponding structure, and the source configuration template accurately encapsulates all features existing in the configuration file.

[0041] In step S103, the target large language model is obtained by training the large language model using the configuration manual, the source configuration template is translated into the target configuration template based on the target large language model, and the original configuration file is translated into the target format configuration file corresponding to the target manufacturer based on the target configuration template, wherein the target large language model has the vertical domain knowledge of the router configuration method of the target manufacturer. The source configuration template is translated into the target configuration template based on the large language model and the configuration manual, and the original configuration file is translated into the target format configuration file corresponding to the second router based on the target configuration template.

[0042] It can be understood that the embodiments of the present application can utilize the configuration manual to perform lightweight training on the large language model to obtain a target large language model, so that the target large language model is a large language model with vertical domain knowledge of the target manufacturer's router configuration method, and the target large language model is used to translate the source configuration template into a target configuration template, and based on the target configuration template, the original configuration file is translated into a target format configuration file corresponding to the target manufacturer, thereby realizing the translation process of the large language model guided by the configuration manual, improving the accuracy of translation, realizing the translation of configuration files of different manufacturers' routers or the same manufacturer's routers, and first translating the configuration template, and guiding the translation of the entire original configuration file based on the translated target configuration template, thereby effectively avoiding the problem of accuracy decline of the large language model when processing large-scale configurations.

[0043] In the embodiments of the present application, the source configuration template is translated into the target configuration template based on the target large language model, which includes: obtaining the directory of the configuration manual; inputting the source configuration template and the directory of the configuration manual into the target large language model, wherein the target large language model finds the target chapter based on the source configuration template and the directory of the configuration manual; obtaining the content of the target chapter; training the target large language model based on the content of the target chapter to obtain a first target large language model, wherein the first target large language model has vertical domain knowledge of the target configuration segment configuration method of the router of the target manufacturer.

[0044] It can be understood that the embodiments of the present application can obtain the directory of the configuration manual, and then the target large language model identifies the target chapter that may be related in the configuration manual of the target manufacturer based on the source configuration template, and trains the target large language model using the content of the target chapter to obtain a first target large language model, so that the first target large language model has vertical domain knowledge of the target configuration segment configuration method of the router of the target manufacturer.

[0045] In the embodiments of the present application, the original configuration file is translated into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template, which includes: obtaining the translation mapping relationship of the source configuration template and the target configuration template; training the first target large language model using the translation mapping relationship to obtain a second target large language model, wherein the second target large language model has vertical domain knowledge of the source manufacturer and the target manufacturer translation method of the router to be converted; and translating the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the second target large language model and the translation mapping relationship.

[0046] It can be understood that the embodiments of the present application can obtain the translation mapping relationship of the configuration template and the target configuration template, train the first target large language model to obtain the second target large language model using the translation mapping relationship, make the second target large language model have the vertical field large language model of the source manufacturer and the target manufacturer mutual translation method related knowledge of the router to be converted, and based on the second target large language model and the translation mapping relationship, the original configuration file is translated into the target format configuration file corresponding to the router of the target manufacturer, so that the original configuration file can be converted into the format corresponding to the router of the target manufacturer in a scalable manner with high precision and minimum manual intervention.

[0047] In the embodiments of the present application, after the source configuration template is translated into the target configuration template based on the target large language model, the initial translation result of the source configuration template translated into the target configuration template is obtained, the errors in the initial translation result are identified, and the second target large language model is trained based on the errors and the configuration manual, wherein the final target configuration template is output by the trained second target large language model, and the errors are iteratively corrected in the training process until a preset iteration number is reached or a correct translation result is generated.

[0048] The preset iteration number can be set according to specific conditions, and is not limited, for example, it can be 8 or 10.

[0049] The types of errors include at least one of syntax errors, view structure errors and semantic errors.

[0050] Since there may be some errors in the initial translation, the embodiments of the present application can obtain the initial translation result of the source configuration template translated into the target configuration template, and train the second target large language model based on the errors in the initial translation result and the configuration manual, the final target configuration template is output by the trained second target large language model, and the errors are iteratively corrected in the training process until a preset iteration number is reached or a correct translation result is generated.

[0051] In the embodiments of the present application, identifying the errors in the initial translation result includes: identifying syntax errors and view structure errors using a preset parser.

[0052] The preset parser is a modified Batfish parser, which can be used to identify syntax errors and view structure errors. The Batfish parser is generated based on the uniform syntax rules of the target vendor. Specifically, a corresponding g4 syntax file can be written according to the uniform syntax rules specified by the target vendor, and a syntax parser and a lexical parser can be generated from the g4 syntax file using ANTLR. Then, the configuration file is input into the parser to generate a syntax tree corresponding to the configuration file. During the process, an error listener generated by extension is used to identify errors in the process of building the syntax tree, and the errors are classified into syntax errors and view structure errors according to the error types.

[0053] In the embodiments of the present application, the errors are iteratively corrected until a preset number of iterations is reached or a correct translation result is generated. If the error is a syntax error, the corresponding chapter in the configuration manual that solves the error syntax is determined according to the error syntax, and the error syntax is corrected according to the correction method in the corresponding chapter. If the error is a view structure error, the error part and the corresponding chapter are determined according to the error view structure, and a configuration example is extracted from the corresponding chapter. The error view structure is corrected according to the configuration example, wherein the configuration example and the error part run the same protocol and have correct view structure. If the error is a semantic error, a first semantics of each source segment in the source configuration template is generated based on a large language model, and a second semantics of the target configuration template is generated. The error semantics is corrected according to the similarity between the first semantics and the second semantics.

[0054] The syntax error includes that the command in the configuration template does not conform to the syntax rules specified by the target vendor, such as incorrect parameter name, incorrect parameter order, etc. The view structure error refers to the case that the position or order of some commands in the configuration does not conform to the rules specified by the vendor, such as the command of configuring BGP (Border Gateway Protocol) neighbor appearing before the command of enabling BGP protocol, which is considered as a view structure error. The semantic error refers to the case that the function or intention between the source configuration template and the translated target configuration template does not match, such as the BGP neighbor relationship between AS A and AS B existing in the source configuration, while the neighbor relationship between AS A and AS B is missing or incorrectly configured in the translated target configuration template.

[0055] It can be understood that the embodiments of the present application can use different methods to correct errors according to the type of the error, specifically:

[0056] If the error type is a syntax error, the corresponding chapter in the configuration manual that solves the error syntax is determined according to the error syntax, and the error syntax is corrected according to the correction method in the corresponding chapter.

[0057] If the error type is a view structure error, determine the error part and the corresponding chapter to which the error belongs according to the error view structure, extract a configuration example from the corresponding chapter, and correct the error view structure according to the configuration example, wherein the configuration example and the error part run the same protocol and have a correct view structure;

[0058] If the error type is a semantic error, generate a first semantics for each source segment in the source configuration template based on a large language model, generate a second semantics of the translated target configuration template, and correct the error semantics according to the similarity of the first semantics and the second semantics.

[0059] In summary, the large language model-based routing configuration translation method according to the embodiments of the present application has a specific process as shown in Figure 2 , which includes:

[0060] 1. Configuration template extraction

[0061] Considering the challenges ChatGPT faces when processing large amounts of text, first, let ChatGPT segment the configuration according to the original configuration file structure, thereby aggregating configurations with strong similarity. Then, gradually input these segments into ChatGPT, enabling it to synthesize the source configuration template from different segments according to the structure of the segment configuration, so that the template contains all configuration commands and corresponding structures that can represent the characteristics of the segment. Finally, this process can successfully output a source configuration template that accurately encapsulates all features present in the original configuration file.

[0062] 2. Configuration template translation

[0063] The correct template configuration translation is mainly achieved through two steps: (1) initial configuration translation using expert knowledge (i.e., configuration manual); (2) error correction using accurate feedback information.

[0064] 2.1 Initial configuration translation

[0065] According to the configuration manual provided by the user, use ChatGPT to translate the configuration template. First, parse the configuration manual provided by the user to extract the directory and the content of each chapter. Then, provide the directory and the original configuration of the manual to ChatGPT and prompt "If I want to translate the Huawei configuration into the corresponding Cisco configuration, please help me determine which parts of the manual I need." This enables ChatGPT to provide the relevant chapter names. Finally, extract the content of the relevant chapters from the parsed configuration manual and provide it to ChatGPT, and prompt "Please learn the content in this configuration manual and translate the previous Huawei configuration into the corresponding Cisco configuration." In this way, accurate expert knowledge (content of relevant chapters) can be used to obtain the preliminary result of translating the source configuration template into the target configuration template.

[0066] 2.2 Error Iterative Correction

[0067] The initial translation result may contain some errors, and the accuracy of the result is ensured by correcting the errors and providing accurate feedback information for each error. All errors in the translation process are divided into three types: syntax errors, view structure errors, and semantic errors. In order to realize the identification of error types, the Batfish parser is modified to distinguish between syntax errors and view structure errors.

[0068] Syntax Errors: Syntax errors refer to commands in the configuration file that do not conform to the syntax rules specified by the target manufacturer, such as incorrect parameter names, incorrect parameter order, etc. The translated configuration is input into the modified Batfish parser to identify such errors, and the modified Batfish parser can accurately determine which line contains a syntax error. For each syntax error, ChatGPT is used again to determine the manual chapter that may help to solve this error. Finally, the content of the corresponding chapter is extracted and fed back to ChatGPT together with the error information. Based on accurate error positioning and accurate correction methods provided by specific manual chapters, ChatGPT can effectively correct these syntax errors.

[0069] View Structure Errors: View structure errors refer to cases where the position or order of some commands in the configuration does not conform to the rules set by the manufacturer. For example, if the command to configure BGP neighbors appears before the command to enable the BGP protocol, it is considered a view structure error. By inputting the translated configuration into the modified Batfish parser, it can be identified which part of the configuration contains a view structure error. Then, according to the function and protocol related to the error part, ChatGPT is requested to extract configuration examples from related chapters, and the configuration examples extracted from the manual run the same protocol as the error part and have the correct view structure. Therefore, this example can be fed back to ChatGPT to correct the error. By utilizing accurate error type information and correct view structure examples, ChatGPT can significantly correct view structure errors in the translated configuration.

[0070] Semantic error: Semantic error refers to the mismatch of functionality or intent between the original configuration and the translated configuration. For example, there is a BGP neighbor relationship between AS A and AS B in the original configuration, while the translated configuration lacks or incorrectly configures this neighbor relationship between AS A and AS B. To solve such errors, first provide the original configuration template to ChatGPT, so that ChatGPT can generate semantics for each segment in the configuration. Save the semantics of each source segment, and then use ChatGPT to generate the semantics of the translated target configuration. Subsequently, let ChatGPT correct the translated configuration by comparing the semantic similarity between the original configuration segment and the translated configuration segment. With its powerful language processing capabilities, when there is a semantic difference between the two segments, ChatGPT can usually correct the translated configuration according to the semantics provided by the source configuration segment.

[0071] Iterate the above error correction process until a correct translation configuration is generated or the number of iterations reaches a threshold, at which point it is returned to the operator for further processing. In practice, most of the time, a basically correct translation configuration can be obtained through a small number of iterations.

[0072] 3. Complete configuration translation

[0073] Since the configuration template can cover all key aspects of the original configuration file, the mapping relationship between the source configuration template and the translated configuration template can be used to effectively guide the translation of other parts of the configuration file. In this process, the source configuration template, the translated configuration template, and the original configuration file are provided to ChatGPT, and the prompt is "Please understand the translation mapping relationship between the original configuration template and the translated configuration template, and use it as a reference to translate the original configuration file". Through this method, the configuration file can be converted into the format of the target vendor in a scalable manner with high precision and minimal manual intervention.

[0074] The above embodiment first extracts the template configuration from the user-provided configuration, and then performs initial translation according to expert knowledge (configuration manual). Subsequently, iterative correction is performed according to the accurate information feedback of different errors until a correct translated template configuration is generated. Finally, this translated template configuration is used to guide the translation of other similar components within the configuration. The use of ChatGPT ensures scalability, and through template-based translation and accurate error information feedback, the accuracy of the translated configuration is effectively guaranteed.

[0075] The method of the present application based on large language model routing configuration translation is illustrated by a specific embodiment, using real configuration data from FITI network to evaluate the accuracy and efficiency of the configuration conversion method. The configuration consists of configurations from 80 Huawei routers, each running ISIS, BGP and EVPN protocols. There are two roles in the network: border routers and core routers. Each border router has an average of 130,000 lines of configuration, while each core router has an average of 1,000 lines of configuration. In this experiment, the configuration of Huawei is converted to Cisco IOS configuration, and there are significant differences between the command syntax and view structure of the two, while the Cisco IOS configuration manual is used as expert knowledge input.

[0076] 1. Configuration template translation

[0077] Configuration templates are extracted from routers of two different roles. After processing, the border router configuration template has about 300 lines, while the core configuration template has about 200 lines. Then, the main focus of is to evaluate the performance of the method in translating configuration templates.

[0078] Translation mainly targets three types of configurations that appear in network configurations: BGP, ISIS and EVPN. In BGP configuration, this includes regular BGP, IPv4 family, IPv6 family and VRF configuration. ISIS configuration includes basic ISIS configuration, IPv4 family, IPv6 family and VRF-related ISIS configuration. EVPN configuration involves basic EVPN settings (such as EVPN instance configuration and VPN instance configuration) and related BGP settings.

[0079] As shown in Table 1, Table 1 is the BGP configuration translation statistics table. For the BGP configuration translation part, after five iterations of correction, the accuracy of the translated configuration increased from 44% to 97%. However, it is worth mentioning that due to the differences between the two vendors, the translated configuration cannot be guaranteed to be completely accurate. For example, in practice, the lack of "fake-as" command in Cisco leads to incorrect translation of this part.

[0080] Table 1

[0081]

[0082] As shown in Table 2, Table 2 is the translation result table of ISIS configuration. Similarly, after five iterations of correction, the accuracy of the translated Cisco ISIS configuration reached 80%.

[0083] Table 2

[0084]

[0085] As shown in Table 3, Table 3 is the translation result table of EVPN configuration. The translation result of EVPN configuration is worse than BGP and ISIS, and after five iterations of correction, the accuracy is only 83%. This is due to the significant differences between Huawei and Cisco NXOS in EVPN protocol, and the instability of large language generation model, resulting in errors in the final result, which need to be corrected by network operators in subsequent steps.

[0086] Table 3

[0087]

[0088] 2. Complete configuration translation

[0089] After obtaining the translated configuration template, the corresponding relationship in the template is used to guide the completion of the complete configuration translation. The most common errors in this process are determined: (1) structure error in view; (2) command syntax error; (3) redundant command. These errors are in a structured form in the translated configuration file. By using the translated configuration template, ChatGPT is guided to correct the translation result, and the correct result can be obtained after an average of 2 iterations of correction.

[0090] In addition, it is worth mentioning that the effectiveness of translation is affected by the configuration manual provided by the user for guidance. The limitations of the configuration manual will affect the experimental results. In addition, preliminary experiments have been conducted to transplant Huawei configuration to more common Cisco IOS, and it is found that for common protocols such as BGP, ISIS, etc., an average of two iterations of correction can achieve an accuracy of 90%. In addition, each router has unique configuration commands specific to each series of routers. These configurations may not be universally applicable, so translation for actual applications may require more effort from network administrators.

[0091] The present application solves the problem of configuration translation between different manufacturers based on large language models, and proposes a new configuration translation method: extracting configuration templates according to features, and then translating configuration templates, which effectively solves the problem of accuracy decline of large language models when processing large-scale configurations, and proposes a method for classifying errors in the configuration translation process: syntax error, view structure error and semantic error, and for each type of error, a corresponding correction method is proposed.

[0092] According to the method for converting router configuration provided in the embodiments of the present application, the source configuration template of the original configuration file of the router to be converted is extracted by using the large language model, the target large language model is obtained by training the large language model by using the configuration manual, the target large language model has the vertical field knowledge of the router configuration method of the target manufacturer, the source configuration template is translated into the target configuration template based on the target large language model and the configuration manual, and then the original configuration file is converted into the target format configuration file corresponding to the router of the target manufacturer based on the target configuration template. The configuration manual is used to guide the translation of the large language model, the accuracy of the translation of the large language model is improved, the configuration files of the routers of different manufacturers or different series of the same manufacturer are converted, and the configuration template is translated first, the translation of the entire original configuration file is guided based on the translated target configuration template, and the problem of the decrease in the accuracy of the large language model when processing large-scale configurations is effectively avoided.

[0093] Secondly, the device for converting router configuration based on a large language model according to the embodiments of the present application is described with reference to the accompanying drawings.

[0094] Figure 3 FIG. 1 is a block schematic diagram of the device for converting router configuration based on a large language model according to the embodiments of the present application.

[0095] As shown in FIG. 1, the device for converting router configuration based on a large language model 10 comprises an acquisition module 100, an extraction module 200 and a conversion module 300. Figure 3 The acquisition module 100 is configured to acquire the original configuration file of the router to be converted and the configuration manual of the router of the target manufacturer.The extraction module 200 is configured to extract the source configuration template of the original configuration file based on the large language model. The conversion module 300 is configured to train the large language model by using the configuration manual to obtain a target large language model, translate the source configuration template into a target configuration template based on the target large language model, and convert the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template, wherein the target large language model has the vertical field knowledge of the router configuration method of the target manufacturer.

[0096] In the embodiments of the present application, the conversion module 300 is further configured to: acquire the table of contents of the configuration manual; input the source configuration template and the table of contents of the configuration manual into the target large language model, wherein the target large language model finds the target chapter based on the source configuration template and the table of contents of the configuration manual; acquire the content of the target chapter; train the target large language model based on the content of the target chapter to obtain a first target large language model, wherein the first target large language model has the vertical field knowledge of the target configuration segment configuration method of the router of the target manufacturer; and translate the source configuration template into the target configuration template based on the first target large language model.

[0097]

[0098] In the embodiment of the present application, the mutual translation module 300 is further configured to: obtain a translation mapping relationship between the source configuration template and the target configuration template; train the first target large language model to obtain a second target large language model using the translation mapping relationship, wherein the second target large language model has vertical domain knowledge of the source manufacturer and the target manufacturer mutual translation method of the to-be-converted configuration; and translate the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the second target large language model and the translation mapping relationship.

[0099] In the embodiment of the present application, the device 10 of the present application further includes a training module.

[0100] The training module is configured to: after translating the source configuration template into the target configuration template based on the target large language model, obtain an initial translation result of the source configuration template translated into the target configuration template; identify errors in the initial translation result, and train a second target large language model based on the errors and the configuration manual, wherein the second target large language model outputs a final target configuration template after training, and the training process iteratively corrects errors until a preset iteration number is reached or a correct translation result is generated.

[0101] In the embodiment of the present application, the types of errors include at least one of a syntax error, a view structure error and a semantic error, and the training module is further configured to: identify the syntax error and the view structure error using a preset parser, wherein the preset parser is a Batfish parser, and the Batfish parser is generated based on a unified syntax rule of the target manufacturer.

[0102] In the embodiment of the present application, the training module is further configured to: if the error is a syntax error, determine a corresponding chapter in the configuration manual that solves the syntax of the error according to the syntax of the error, and correct the syntax of the error according to the correction method of the corresponding chapter; if the error is a view structure error, determine the error part and the corresponding chapter to which the view structure of the error belongs, and extract a configuration example from the corresponding chapter, and correct the view structure of the error according to the configuration example, wherein the configuration example and the error part run the same protocol and have correct view structures; and if the error is a semantic error, generate a first semantic of each source segment in the source configuration template based on the large language model, generate a second semantic of the target configuration template, and correct the semantic of the error according to the similarity between the first semantic and the second semantic.

[0103] In the embodiment of the present application, the extraction module 200 is further configured to: segment the original configuration file according to the structure of the original configuration file to obtain a plurality of segments; and synthesize the source configuration template according to the structure of the plurality of segments, wherein the source configuration template encapsulates all features in the original configuration file.

[0104] It should be noted that the foregoing explanation and description of the embodiment of the route configuration mutual translation method based on the large language model also applies to the embodiment of the route configuration mutual translation device based on the large language model, which will not be described here.

[0105] The route configuration mutual translation device based on the large language model according to the embodiment of the present application can extract the source configuration template of the original configuration file of the router to be converted by using the large language model, train the large language model by using the configuration manual to obtain a target large language model, make the target large language model have the vertical field knowledge of the router configuration method of the target manufacturer, and translate the source configuration template into a target configuration template based on the target large language model and the configuration manual, and then translate the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template. The configuration manual is used to guide the translation of the large language model, improve the accuracy of the translation of the large language model, realize the mutual translation of the configuration files of the routers of different manufacturers or different series of the same manufacturer, and first translate the configuration template, guide the translation of the entire original configuration file based on the translated target configuration template, and effectively avoid the problem of accuracy reduction of the large language model when processing large-scale configurations.

[0106] Figure 4 The structure schematic diagram of the electronic device provided by the embodiment of the present application is provided. The electronic device can include:

[0107] The memory 401, the processor 402, and the computer program stored in the memory 401 and executable on the processor 402.

[0108] The processor 402 implements the route configuration mutual translation method based on the large language model provided in the above embodiments when executing the program.

[0109] Further, the electronic device further includes:

[0110] The communication interface 403 is used for communication between the memory 401 and the processor 402.

[0111] The memory 401 is used to store the computer program executable on the processor 402.

[0112] The memory 401 can include a high-speed RAM memory, and can also include a non-volatile memory, for example, at least one disk memory.

[0113] If the memory 401, the processor 402 and the communication interface 403 are implemented independently, the communication interface 403, the memory 401 and the processor 402 can be connected with each other through a bus and complete communication between each other. 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. The bus can be divided into an address bus, a data bus, a control bus, etc. For convenience of representation, Figure 4 Only one thick line is used to represent the bus in the figure, but it does not mean that there is only one bus or only one type of bus.

[0114] Optionally, in a specific implementation, if the memory 401, the processor 402 and the communication interface 403 are integrated on a chip, the memory 401, the processor 402 and the communication interface 403 can complete communication between each other through an internal interface.

[0115] The processor 402 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.

[0116] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program or instructions, and the computer program or instructions are executed by a processor to implement the above-mentioned method for route configuration interpretation based on a large language model.

[0117] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example" or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the present specification and the features of the different embodiments or examples without contradiction.

[0118] Furthermore, the terms "first", "second", etc. are used herein only to describe different instances, and do not imply or suggest relative importance or a number of the indicated technical features. Thus, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "N" is at least two, such as two, three, etc., unless otherwise explicitly and specifically limited.

[0119] Any process or method descriptions or descriptions of the flow diagrams described herein or otherwise described in the present application can be understood as representing executable instructions, code segments, or portions of code that include one or more steps for performing the processes described in the flow diagrams. The various embodiments of the present application can include additional or fewer steps or processes, and the order of the steps or processes can be altered, depending on the implementation.

[0120] It should be understood that portions of the present application can be realized with hardware, software, firmware or a combination thereof. In the above embodiments, the N steps or methods can be realized with software or firmware stored in a memory and executed by a suitable instruction execution system. As in another embodiment, if realized with hardware, any one or a combination of the following technologies known in the art can be used: discrete logic circuit with logic gates for implementing logic functions on data signals, application specific integrated circuit with suitable combination logic gates, programmable gate array (PGA), field programmable gate array (FPGA), etc.

[0121] Those skilled in the art of the present technology can understand that all or part of the steps carried out by the above-mentioned embodiment methods can be completed by programs instructing relevant hardware, and the programs can be stored in a computer readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiments.

Claims

1. A routing configuration translation method based on a large language model, characterized in that: The following steps are involved: Obtain the original configuration file of the router to be converted and the configuration manual of the target manufacturer's router; Extracting a source configuration template of the original configuration file based on a large language model; The large language model is trained using the configuration manual to obtain a target large language model, the source configuration template is translated into a target configuration template based on the target large language model, and the original configuration file is translated into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template, wherein the target large language model has vertical domain knowledge of the router configuration method of the target manufacturer; the source configuration template is translated into a target configuration template based on the target large language model, including: obtaining the directory of the configuration manual; inputting the source configuration template and the directory of the configuration manual into the target large language model, wherein the target large language model searches the directory of the configuration manual based on the source configuration template to obtain a target chapter; obtains the content of the target chapter; trains the target large language model based on the content of the target chapter to obtain a first target large language model. Language model, wherein the first target large language model has vertical domain knowledge of the target configuration segment configuration method of the router of the target manufacturer; based on the first target large language model, the source configuration template is translated into a target configuration template; based on the target configuration template, the original configuration file is translated into a target format configuration file corresponding to the router of the target manufacturer, including: obtaining a translation mapping relationship between the source configuration template and the target configuration template; using the translation mapping relationship to train the first target large language model to obtain a second target large language model, wherein the second target large language model has vertical domain knowledge of the translation method between the source manufacturer and the target manufacturer of the router to be converted; based on the second target large language model and the translation mapping relationship, the original configuration file is translated into a target format configuration file corresponding to the router of the target manufacturer.

2. The method for routing configuration translation based on a large language model according to claim 1, characterized in that: After translating the source configuration template into a target configuration template based on the target large language model, the method further includes: Obtaining an initial translation result of the source configuration template into the target configuration template; Identify errors in the initial translation result, and train the second target large language model based on the errors and the configuration manual, wherein the trained second target large language model outputs a final target configuration template, and iteratively correct the errors during the training process until a preset number of iterations is reached or a correct translation result is generated.

3. The method for routing configuration translation based on a large language model according to claim 2, characterized in that: The error type includes at least one of a grammatical error, a view structure error, and a semantic error. The identifying the error in the initial translation result includes: The grammatical errors and the view structure errors are identified using a preset parser, wherein the preset parser is a Batfish parser, and the Batfish parser is generated based on the unified grammatical rules of the target manufacturer.

4. The method for translating routing configurations based on a large language model according to claim 2, wherein the iterative correction of the error until a preset number of iterations is reached or a correct translation result is generated comprises: If the error is a syntax error, determining a corresponding section in the configuration manual that resolves the syntax error according to the syntax error, and correcting the syntax error according to the correction method in the corresponding section; If the error is a view structure error, determining the erroneous part and corresponding chapter according to the erroneous view structure, extracting a configuration example from the corresponding chapter, and correcting the erroneous view structure according to the configuration example, wherein the configuration example and the erroneous part run the same protocol and have a correct view structure; If the error is a semantic error, a first semantic is generated for each source segment in the source configuration template based on the large language model, and a second semantic is generated for the target configuration template, and the erroneous semantic is corrected according to the similarity between the first semantic and the second semantic.

5. The method for routing configuration translation based on a large language model according to claim 1, characterized in that: The extracting of the source configuration template of the original configuration file based on the large language model includes: Segmenting the original configuration file according to the structure of the original configuration file to obtain multiple segments; A source configuration template is synthesized according to the structure of the multiple fragment configurations, wherein the source configuration template encapsulates all features in the original configuration file.

6. A routing configuration translation method based on a large language model, characterized in that: include: An acquisition module is used to obtain the original configuration file of the router to be converted and the configuration manual of the router of the target manufacturer; An extraction module, configured to extract a source configuration template of the original configuration file based on a large language model; A translation module is used to train the large language model using the configuration manual to obtain a target large language model, translate the source configuration template into a target configuration template based on the target large language model, and translate the original configuration file into a target format configuration file corresponding to the router of the target manufacturer based on the target configuration template, wherein the target large language model has the vertical domain knowledge of the router configuration method of the target manufacturer; the translation of the source configuration template into the target configuration template based on the target large language model includes: obtaining the directory of the configuration manual; inputting the source configuration template and the directory of the configuration manual into the target large language model, wherein the target large language model searches the directory of the configuration manual based on the source configuration template to obtain the target chapter; obtains the content of the target chapter; trains the target large language model based on the content of the target chapter to obtain a first A target large language model, wherein the first target large language model has vertical domain knowledge of the target configuration segment configuration method of the router of the target manufacturer; based on the first target large language model, the source configuration template is translated into a target configuration template; based on the target configuration template, the original configuration file is translated into a target format configuration file corresponding to the router of the target manufacturer, including: obtaining a translation mapping relationship between the source configuration template and the target configuration template; using the translation mapping relationship to train the first target large language model to obtain a second target large language model, wherein the second target large language model has vertical domain knowledge of the translation method between the source manufacturer and the target manufacturer of the router to be converted; based on the second target large language model and the translation mapping relationship, the original configuration file is translated into a target format configuration file corresponding to the router of the target manufacturer.

7. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the routing configuration mutual translation method for a large language model according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: The computer program or instruction is executed by a processor to implement the routing configuration translation method of a large language model as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and system for transiting router configuration

    CN102420754A

  • Neural network hyper-parameter extracting and converting method, system and device and storage medium

    CN107992299A