Natural language based network configuration command generation system and method

CN116545854BActive Publication Date: 2026-10-23BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310523415.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-10
Publication Date
2026-10-23
Estimated Expiration
2043-05-10

AI Technical Summary

Technical Problem

然而,基于CLI的配置方法以手动操作为主,严重依赖网络运营工程师的个人专业知识与经验,使得其面临诸多挑战

Benefits of technology

[0059]本发明的有益效果在于:本发明所提出的系统和方法解决了在平行网络配置语料匮乏的情况下,自动生成可靠、广泛适用的网络配置命令的问题,不但减少了对平行数据的依赖,而且避免了人工注释的成本;本发明所提出的系统和方法的核心是实现了一种由粗到细的语法检索和语法引导的解码过程,利用功能描述弥补意图和语法之间的语义差距,能够在不同厂家网络设备之间共享相似表达,获得跨网络设备厂商的扩展性,具有网络设备配置命令自动生成的高准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116545854B_ABST
    Figure CN116545854B_ABST
Patent Text Reader

Abstract

A natural language-based network configuration command generation system includes the following modules: a configuration command library module, a syntax retriever module, and a command generator module; a natural language-based network configuration command generation method includes the following operation steps: (1) the configuration command library module extracts semi-structured configuration information in a network device manual into structured configuration functions of the network device; (2) the syntax retriever module retrieves the most matching k syntaxes from the configuration command library module according to a network configuration intention input by a user in natural language; and (3) the command generator module generates a network configuration command of the network device and a context thereof according to the network configuration intention input by the user in natural language and the most matching k syntaxes retrieved by the syntax retriever module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a network configuration command generation system and method based on natural language, belonging to the field of information technology, and particularly to the field of automatic generation technology of network configuration commands for network devices. Background Technology

[0002] Correct and efficient network configuration is a crucial foundation for ensuring the normal flow of network traffic. Statistics show that the Command Line Interface (CLI) remains the most common method for configuring, managing, and maintaining network devices. It offers excellent support for almost all network devices and allows interaction with devices at a level of complexity and depth that graphical user interfaces (GUIs) and application programming interfaces (APIs) cannot handle. However, CLI-based configuration methods are primarily manual, heavily reliant on the personal expertise and experience of network operations engineers, leading to several challenges. First, vendors are constantly merging new service functions and optimizing configurations to improve service quality, resulting in a continuous evolution in the number and complexity of configuration rules, placing a heavy memory burden on network administrators. Second, the trend towards multi-vendor networks requires users to master the command syntax of different vendors, creating high learning costs for any single network operations team. Although network operations engineers can sometimes assist with configuration by consulting device manuals, this significantly reduces configuration efficiency. With the rapid development of the Internet in recent years, the construction of telecommunications infrastructure has accelerated, network scale has increased year by year, and the massive number of terminals on the network have brought unprecedented difficulties to network configuration management.

[0003] In summary, effectively addressing the aforementioned problems associated with traditional command-line interface-based network device configuration has become a pressing technical challenge in the field of network operation and maintenance. Summary of the Invention

[0004] In view of this, the purpose of this invention is to provide a network configuration command generation system and method based on natural language, so as to achieve the purpose of using natural language to describe network configuration intentions, shielding the command details of network devices from different manufacturers, and automatically generating network configuration commands.

[0005] To achieve the above objectives, this invention proposes a network configuration command generation system based on natural language, the system comprising the following modules:

[0006] Configuration Command Library Module: This module stores all configuration functions of the network device. It includes a parser submodule and different sub-command libraries, forming a searchable storage structure that stores all configuration functions of the network device. The sub-command libraries refer to subsets of the network device's configuration functions based on the manufacturer's name, device type, and operating system version. The parser submodule extracts the semi-structured configuration information from the network device manual into searchable structured data.

[0007] The configuration command library module is an explicit external storage; during system runtime, it retrieves commands from the sub-command library corresponding to the network device, ensuring that the retrieved syntax conforms to the command-line interface (CLI) of the aforementioned network device; this ensures that the system can be easily extended to more network configuration commands that did not appear in the system training, without excessively increasing the complexity of the system.

[0008] Syntax Retrieval Module: This module's function is to retrieve the k most matching syntaxes from the configuration command library module based on the user's network configuration intent input in natural language. The syntax retrieval module consists of an intent-function description retrieval submodule and a function description-syntax retrieval submodule. The intent-function description retrieval submodule retrieves the configuration function that best matches the user's network configuration intent input in natural language. The function description-syntax retrieval submodule retrieves the syntax that best matches the user's network configuration intent under the best matching configuration function; k is a natural number.

[0009] Command Generator Module: This module generates network configuration commands and their context for the network device based on the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module. The command generator module consists of an encoder submodule and a decoder submodule.

[0010] The command generator module is implemented using a sequence-to-sequence (seq2seq) encoding and decoding architecture; the encoder submodule encodes the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module into a feature vector; the decoder submodule generates network configuration commands for the network device and their context based on the feature vector.

[0011] The configuration command library module is constructed as follows: the parser submodule extracts configuration information from the network device manuals of different device manufacturers and stores it in the unified manual format UMF; the unified manual format UMF is specifically a "key-value pair" format, where "key" represents the project name and "value" represents the specific content.

[0012] The intent-function description retrieval submodule consists of an intent encoding subnetwork that receives network configuration intents input by the user in natural language, a function description encoding subnetwork that receives function descriptions of network devices, and a similarity measurement subunit.

[0013] The function of the intent encoding sub-network is to encode the network configuration intent input by the user in natural language into a high-dimensional intent feature vector u; the function of the function description encoding sub-network is to encode the configuration function description of the network device into a high-dimensional function description feature vector v; the function of the similarity measurement sub-unit is to calculate the similarity between the intent feature vector u and the function description feature vector v.

[0014] Both the intent encoding subnetwork and the function description encoding subnetwork are composed of ConfBERT networks, and the two subnetworks have the same network parameters. The ConfBERT network is a BERT network adapted to the network configuration technology field of network devices. The ConfBERT network is obtained by retraining the BERT network using a large hybrid corpus containing unsupervised network configuration information and network configuration annotations, and the same training task and training objective as the BERT network are used in the retraining process.

[0015] The retraining process of the ConfBERT network is as follows:

[0016] Given a set of intent-function description pairs In the formula, Indicates the i-th intention. Let represent the i-th function description, and m represent the number of intent-function description pairs; the training loss function is defined as follows:

[0017]

[0018] In the above formula, and They represent and eigenvectors; τ C Represents temperature hyperparameter; sim represents cosine similarity, l i Indicates the i-th intention The corresponding losses.

[0019] The functional description - syntax retrieval submodule finds a set of syntaxes by using the most matching configuration function, and then calculates the relevance score between the user's network configuration intent and each syntax in the set to find the syntax that best matches the user's network configuration intent, that is, the syntax with the highest relevance score;

[0020] The calculation process of the correlation score between the aforementioned user's network configuration intent and the syntax is as follows:

[0021] (41) Segment intent I to obtain i1,...,i |I| ; |I| represents the number of segmented words contained in intent I;

[0022] (42) For an intent a syntax and a set of parameters and descriptions of the parameters if parameter p k appears in syntax S, then after the parameter p contained in the syntax k add the corresponding parameter description pd k to obtain the enhanced syntax traverse all parameters; s i represents the i-th word of syntax S, |S| represents the length of syntax S, |P| represents the size of the parameter set P; |PD| represents the size of the parameter description set PD;

[0023] (43) Calculate the number of occurrences of the j-th segmented word i of intent I j in syntax S', that is, the word frequency

[0024] (44) Calculate the weight of i j , that is, the inverse document frequency w j =IDF(i j );

[0025] (45) Calculate the correlation score between i j and syntax S'

[0026] In the formula

[0027] k1 is a parameter used to normalize the word frequency range of the document, with a value range of 0<k1<3; bt is another adjustable parameter, with a value range of 0<bt<1, used to determine the range for representing information quantity by the document length, L S' is the length of syntax S', L ave is the average length of all syntaxes;

[0028] (46) Calculate the correlation score between intent I and syntax S' as which is the correlation score between intent I and syntax S.

[0029] The encoder submodule in the command generator module is constructed using the ConfBERT network to adaptively capture contextual dependencies. Following the BERT network input format, [CLS] is added before the network configuration intent I input by the user in natural language. This is then mixed with the k most matching syntaxes retrieved by the syntax retrieval module to form an intent-syntax sequence X = [CLS], I, [SEP], [S], S1, [S], S2, ..., [S], S i ,…,[S],S k [SEP], where S i This represents the i-th syntax, where [S] represents the delimiter. [SEP] is added after the last syntax. Then, the intent-syntax sequence X is encoded using ConfBERT, followed by a bidirectional LSTM to form the encoding vector of the intent-syntax sequence X. |X| is the encoding vector h X The length of the encoding vector h is n, where n is the length of the encoding vector h. X Dimensions.

[0030] The decoder submodule in the command generator module is constructed using an improved pointer generation network that introduces a copying mechanism;

[0031] The aforementioned replication mechanism is implemented through a multi-head attention mechanism; at each time step t, given the decoder state h t and the encoded vector h of the intent-syntax sequence X output by the encoder. X Calculate multi-head attention:

[0032]

[0033]

[0034] Where h∈[1,…,H] is the number of the attention head, H is the total number of attention heads, and the superscript (h) indicates the h-th attention head; Let h be the parameters that can be learned by the h-th attention head. This represents the attention score of the h-th attention head pair for the j-th word in X at time step t. This represents the normalized weight at time step t where the h-th attention head copies the j-th word from X into the current decoding result. This represents the attention vector after weighting the h-th attention head at time step t; h Xj The encoding vector h of the intention-syntax sequence X X The j-th component;

[0035] The intent does not explicitly mention default parameters, therefore the decoder submodule needs to generate additional words to supplement the copying mechanism; at time step t, from the output vocabulary The probability of generation is defined as:

[0036]

[0037] in b gen If the parameter is learnable, then at time step t, the replication probability is defined as follows:

[0038] At time step t, the total output probability can be defined as

[0039] Where y t This is the output of the decoder submodule at time step t. Let |X| be the output distribution of the decoder submodule at time step t, and |X| be the encoding vector h of the intent-syntax sequence X. X Length; This represents the normalized weight at time step t for the H-th attention head to copy the j-th word in X into the current decoding result;

[0040] The decoder submodule generates network configuration commands and their context for the network device based on the feature vector, and includes the following steps:

[0041] (11) Determine the initial hidden state h0 of the decoder;

[0042] (12) Find the set of all derived sets of the retrieved syntax S. derive ;

[0043] (13) At each beam search decoding time step t, calculate the b new decoder states in the beam. and the predicted command segment from decoding time step 1 to decoding time step t b is a natural number;

[0044] (14) For each beam in the beam search, if the above partial command segment If a partial command segment matches a certain derivative of syntax S, then that partial command segment is kept in the beam; otherwise, it is removed.

[0045] (15) Repeat steps (13) and (14);

[0046] (16) Return the command with the highest conditional probability. In the formula To generate partial command segments The conditional probability.

[0047] The step (12) involves finding the set of all derived sets of the retrieved grammar S.derive The specific content is the set of all derived forms of grammar S. derive It is obtained from the grammar derivation graph G of the grammar S; the generation process of the grammar derivation graph G includes the following steps:

[0048] (21) Use the pyparsing library to parse the syntax S into a nested list. Nested lists consist of |L| elements, which are divided into unparseable elements and parseable elements. Parsable elements can also be regarded as nested lists.

[0049] (22) Initialize the syntax derivation graph G, which is a directed graph containing a starting node node. start ;

[0050] (23) Create a node whose value is the first unparseable element, and connect the starting node to that node;

[0051] (24) Determine whether the relationship between elements in a nested list is inheritance or parallel. If it is inheritance, then the node corresponding to the inherited element is called the parent node of all nodes corresponding to the inherited elements. parent If they are parallel, add several edges in graph G that point from the parent node to the corresponding node of the parallel element.

[0052] (25) If the current element e i If it is an optional element, then an empty node is created. blank Parent node parent Connect to the empty node blank On, and simultaneously add the parent node. parent It is also connected to the node corresponding to the optional element; the optional element is the element enclosed in [] in the syntax;

[0053] (26) Recursively execute steps (24)(25)(26) until the last level of the nested list L is parsed;

[0054] (27) Simplify graph G by traversing the nodes in graph G. If two nodes are connected through an empty node, remove the edge between the two nodes and the empty node, and add an edge that directly connects the two nodes to obtain the grammar-derived graph G of grammar S.

[0055] A method for generating network configuration commands based on natural language, the method comprising the following steps:

[0056] (31) The parser submodule of the configuration command library module extracts the semi-structured configuration information in the network device manual into structured data that can be retrieved, namely the structured configuration functions of the network device; the configuration command library module divides the obtained structured configuration functions into subsets according to the manufacturer name, device type and operating system version of the network device, and stores them in different sub-command libraries in the configuration command library module;

[0057] (32) The syntax retrieval module retrieves the k most matching syntaxes from the configuration command library module based on the network configuration intent input by the user in natural language. The specific process is as follows: first, the intent-function description retrieval submodule retrieves the configuration function that best matches the network configuration intent input by the user in natural language; then, the function description-syntax retrieval submodule retrieves the syntax that best matches the user's network configuration intent under the best matching configuration function.

[0058] (33) The command generator module generates network configuration commands and their context for the network device based on the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module. The specific process is as follows: first, the encoder submodule encodes the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module into a feature vector; then, the decoder submodule generates network configuration commands and their context for the network device based on the feature vector.

[0059] The beneficial effects of this invention are as follows: The system and method proposed in this invention solve the problem of automatically generating reliable and widely applicable network configuration commands when parallel network configuration corpora are scarce. This not only reduces the dependence on parallel data but also avoids the cost of manual annotation. The core of the system and method proposed in this invention is to implement a coarse-to-fine syntax retrieval and syntax-guided decoding process. It uses functional descriptions to bridge the semantic gap between intent and syntax, enabling the sharing of similar expressions among network devices from different manufacturers, achieving cross-network device vendor scalability, and possessing high accuracy in automatically generating network device configuration commands. Attached Figure Description

[0060] Figure 1 This is a schematic diagram of the module of the network configuration command generation system based on natural language proposed in this invention;

[0061] Figure 2 This is a schematic diagram of the configuration command library module proposed in this invention;

[0062] Figure 3 This is a schematic diagram of the structure of the syntax retrieval module proposed in this invention;

[0063] Figure 4This is a schematic diagram of the command generator module proposed in this invention;

[0064] Figure 5 This is a schematic diagram of the structure of the intent-function description retrieval submodule proposed in this invention;

[0065] Figure 6 This is an example diagram illustrating how the decoder submodule generates network configuration commands for network devices based on feature vectors in an embodiment of the present invention.

[0066] Figure 7 This is an intermediate result diagram of an example of the syntax derivation diagram G in an embodiment of the present invention;

[0067] Figure 8 This is a final result diagram of an example of the syntax derivation diagram G in an embodiment of the present invention;

[0068] Figure 9 This is a schematic diagram of the workflow of the network configuration command generation method based on natural language proposed in this invention; Detailed Implementation

[0069] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings.

[0070] See Figure 1 This invention introduces a network configuration command generation system based on natural language, which includes the following modules:

[0071] Configuration command library module: This module stores all configuration functions for the network device; see [link / reference]. Figure 2 The configuration command library module includes a parser submodule and different subcommand libraries. It is a searchable storage structure that stores all the configuration functions of the network device. The subcommand library refers to a subset of the network device's configuration functions, which are divided according to the network device's manufacturer name, device type, and operating system version. The function of the parser submodule is to extract the semi-structured configuration information in the network device manual into searchable structured data.

[0072] The configuration command library module is an explicit external storage; during system runtime, it retrieves commands from the sub-command library corresponding to the network device, ensuring that the retrieved syntax conforms to the command-line interface (CLI) of the aforementioned network device; this ensures that the system can be easily extended to more network configuration commands that did not appear in the system training, without excessively increasing the complexity of the system.

[0073] Syntax Retrieval Module: This module's function is to retrieve the k most matching syntaxes from the configuration command library module based on the network configuration intent input by the user in natural language.

[0074] See Figure 3 The syntax retrieval module consists of an intent-function description retrieval submodule and a function description-syntax retrieval submodule. The intent-function description retrieval submodule retrieves the configuration function that best matches the network configuration intent entered by the user in natural language. The function description-syntax retrieval submodule retrieves the syntax that best matches the user's network configuration intent under the best-matching configuration function. k is a natural number.

[0075] Command Generator Module: This module generates network configuration commands for the network device and their context based on the user's network configuration intent input in natural language and the k most matching syntaxes retrieved by the syntax retrieval module; see also Figure 4 The command generator module consists of an encoder submodule and a decoder submodule;

[0076] The command generator module is implemented using a sequence-to-sequence (seq2seq) encoding and decoding architecture; the encoder submodule encodes the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module into a feature vector; the decoder submodule generates network configuration commands for the network device and their context based on the feature vector.

[0077] Table 1

[0078] Function Name String Function Description String grammar Non-empty string list Parameter Description Dictionary list Command mode Non-empty string list Example Nested Lists

[0079] The construction process of the configuration command library module is as follows: the parser submodule extracts configuration information from the network device manuals of different device manufacturers and stores it in the unified manual format UMF; see Table 1, the unified manual format UMF is specifically a "key-value pair" format, where "key" represents the project name and "value" represents the specific content.

[0080] See Figure 5 The intent-function description retrieval submodule consists of an intent encoding subnetwork that receives network configuration intents input by the user in natural language, a function description encoding subnetwork that receives function descriptions of network devices, and a similarity measurement subunit.

[0081] The function of the intent encoding sub-network is to encode the network configuration intent input by the user in natural language into a high-dimensional intent feature vector u; the function of the function description encoding sub-network is to encode the configuration function description of the network device into a high-dimensional function description feature vector v; the function of the similarity measurement sub-unit is to calculate the similarity between the intent feature vector u and the function description feature vector v.

[0082] Both the intent encoding subnetwork and the function description encoding subnetwork are composed of ConfBERT networks, and the two subnetworks have the same network parameters. The ConfBERT network is a BERT network adapted to the network configuration technology field of network devices. For detailed information about the BERT network, please refer to the literature (Kenton JDMWC, Toutanova L K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding[C] / / Proceedings of NAACL-HLT.2019:4171-4186.). The ConfBERT network is obtained by retraining the BERT network using a large hybrid corpus containing unsupervised network configuration information and network configuration annotations, using the same training task and training objective as the BERT network during the retraining process.

[0083] The retraining process of the ConfBERT network is as follows:

[0084] Given a set of intent-function description pairs In the formula, Indicates the i-th intention. Let represent the i-th function description, and m represent the number of intent-function description pairs; the training loss function is defined as follows:

[0085]

[0086] In the above formula, and They represent and eigenvectors; τ C The value represents the temperature hyperparameter, which is 0.05 in this example; sim represents the cosine similarity, l i Indicates the i-th intention The corresponding losses.

[0087] The functional description - syntax retrieval submodule finds a set of syntaxes by using the most matching configuration function, and then calculates the relevance score between the user's network configuration intent and each syntax in the set to find the syntax that best matches the user's network configuration intent, that is, the syntax with the highest relevance score;

[0088] The calculation process for the relevance score between the user's network configuration intent and the syntax is as follows:

[0089] (41) Segment the intent I to obtain i1,…,i |I|; |I| represents the number of segmented words contained in intent I;

[0090] (42) For an intent a grammar and a set of parameters and descriptions of the parameters if parameter p k appears in grammar S, the corresponding parameter description pd is added after the parameter p contained in the grammar k to obtain an enhanced grammar k , and all parameters are traversed; s represents the i-th word of grammar S, |S| represents the length of grammar S, |P| represents the size of parameter set P; |PD| represents the size of parameter description set PD; i

[0091] (43) Calculate the number of occurrences of the j-th segmented word i of intent I in grammar S', that is, the word frequency j

[0092] (44) Calculate the weight of i, that is, the inverse document frequency w j j =IDF(i j );

[0093] (45) Calculate the relevance score between i and grammar S' j

[0094] wherein

[0095] k1 is a parameter for normalizing the range of article word frequency, with a value range of 0<k1<3; bt is another adjustable parameter, with a value range of 0<bt<1, for determining the range of using document length to represent the amount of information, L S' is the length of grammar S', L ave is the average length of all grammars;

[0096] (46) The relevance score calculated between intent I and grammar S' is which is the relevance score between intent I and grammar S.

[0097] The above process is illustrated by the following example.

[0098] Given an intent "Create a user ACL6 numbered 6999.", a grammar "acl ipv6[number] <ucl-acl6-number>"[match-order{auto|config}]", and a set of parameters and their corresponding descriptions (see Table 2).

[0099] Table 2

[0100]

[0101]

[0102] Based on the steps above, the enhanced syntax is "acl ipv6[number]". <ucl-acl6-number>A user ACL6 is created with a number [match-order indicates the order in which ACL6 rules are matched {auto indicates the automatic order, meaning that ACL6 rules are matched based on the depth-first principle | config indicates the configuration order, meaning that ACL6 rules are matched in the order they are configured}]. The term frequencies of all tokens in the intent are calculated, such as the term frequency of the token "user" being 1. The inverse document frequencies of all tokens in the intent are calculated, such as the inverse document frequency of the token "user" being 0.85. The relevance scores between tokens and syntax are calculated, such as the relevance score between the token "user" and syntax being 0.87. The weighted sum of the relevance scores of all tokens and syntax in the intent yields a relevance score of 0.58 between the intent and syntax.

[0103] The encoder submodule in the command generator module is constructed using the ConfBERT network to adaptively capture contextual dependencies. Following the BERT network input format, [CLS] is added before the network configuration intent I input by the user in natural language. This is then mixed with the k most matching syntaxes retrieved by the syntax retrieval module to form an intent-syntax sequence X = [CLS], I, [SEP], [S], S1, [S], S2, ..., [S], S i ,…,[S],S k [SEP], where S i This represents the i-th syntax, where s i This indicates the i-th syntax, where [S] represents the separator, and in the last syntax s... k Add [SEP] after it; then encode the intent-syntax sequence X using ConfBERT, and then use bidirectional LSTM to form the encoding vector of the intent-syntax sequence X. |X| is the encoding vector h X The length of the encoding vector h is n, where n is the length of the encoding vector h. X The dimension;

[0104] The above process is illustrated with examples as follows:

[0105] Splicing the intent and syntax, we get "[CLS]configure the TCP transport connection to be passive for neighbor 172.16.1.2 [SEP] [S]neighbor{ip-address|peer-group-name}transport{connection-mode{active|passive}| path-mtu-discovery[disable] |multi-session|single-session}[S]neighbor{ip-address|peer-group-name}local-as[autonomous-system-number[no-prepend[replace-as[dual-as]]]][SEP],

[0106] That is, the intent-syntax sequence X is used to obtain the encoding vector h through ConfBERT and bidirectional LSTM. X for

[0107]

[0108] For detailed information on bidirectional LSTM networks, please refer to the literature (Graves A, Schmidhuber J. Framewisephoneme classification with bidirectional LSTM and other neural network architectures[J].Neural networks,2005,18(5-6):602-610.).

[0109] The decoder submodule in the command generator module is constructed using an improved pointer generation network that introduces a copying mechanism;

[0110] The aforementioned replication mechanism is implemented through a multi-head attention mechanism; at each time step t, given the decoder state h t and the encoded vector h of the intent-syntax sequence X output by the encoder. X Calculate multi-head attention:

[0111]

[0112]

[0113] Where h∈[1,…,H] is the number of the attention head, H is the total number of attention heads, and the superscript (h) indicates the h-th attention head; Let h be the parameters that can be learned by the h-th attention head. This represents the attention score of the h-th attention head pair for the j-th word in X at time step t. This represents the normalized weight at time step t where the h-th attention head copies the j-th word in X into the current decoding result. This represents the attention vector after weighting the h-th attention head at time step t; h Xj The encoding vector h of the intention-syntax sequence X X The j-th component;

[0114] The intent does not explicitly mention default parameters, therefore the decoder submodule needs to generate additional words to supplement the copying mechanism; at time step t, from the output vocabulary (the output vocabulary) This refers to the set of words that the decoder submodule can select when generating text. In this embodiment, the probability of selecting a fixed vocabulary of length 32000 is defined as follows:

[0115]

[0116] in b gen If the parameter is learnable, then at time step t, the replication probability is defined as follows:

[0117] At time step t, the total output probability can be defined as

[0118] Where y t P is the output of the decoder submodule at time step t. v (y t ) is the output distribution of the decoder submodule at time step t, and |X| is the encoding vector h of the intent-syntax sequence X. X Length; This represents the normalized weight at time step t for the H-th attention head to copy the j-th word in X into the current decoding result;

[0119] The decoder submodule generates network configuration commands and their context for the network device based on the feature vector, and includes the following steps:

[0120] (11) Determine the initial hidden state h0 of the decoder;

[0121] (12) Find the set of all derived sets of the retrieved syntax S. derive ;

[0122] (13) At each beam search decoding time step t, calculate the b new decoder states in the beam. and the predicted command segment from decoding time step 1 to decoding time step t b is a natural number;

[0123] (14) For each beam in the beam search, if the above partial command segment If a partial command segment matches a certain derivative of syntax S, then that partial command segment is kept in the beam; otherwise, it is removed.

[0124] (15) Repeat steps (13) and (14);

[0125] (16) Return the command with the highest conditional probability. In the formula To generate partial command segments The conditional probability.

[0126] See Figure 6 The above operation steps are illustrated with examples below.

[0127] For example, the syntax S is:

[0128] neighbor{ip-address|peer-group-name}transport{connection-mode{active|passive}|path-mtu-discovery[disable]|multi-session|single-session};

[0129] set of all its derived sets derive for:

[0130] ['neighbor','ip-address','transport','connection-mode','active']

[0131] ['neighbor','ip-address','transport','connection-mode','passive']

[0132] ['neighbor','ip-address','transport','path-mtu-discovery']

[0133] ['neighbor','ip-address','transport','path-mtu-discovery','disable']

[0134] ['neighbor','ip-address','transport','multi-session']

[0135] ['neighbor','ip-address','transport','single-session']

[0136] ['neighbor','peer-group-name','transport','connection-mode','active']

[0137] ['neighbor','peer-group-name','transport','connection-mode','passive']

[0138] ['neighbor','peer-group-name','transport','path-mtu-discovery']

[0139] ['neighbor','peer-group-name','transport','path-mtu-discovery','disable']

[0140] ['neighbor','peer-group-name','transport','multi-session']['neighbor','peer-group-name','transport','single-session']

[0141] from <start>Decoding begins. Assuming decoding reaches time step t5, retain the four decoding states with the highest conditional probabilities. Their corresponding partial instruction segments are as follows: For neighbor 172.16.1.2transport connection-mode active, For neighbor172.16.1.2transport connection-mode passive, For neighbor172.16.1.2transport path-mtu-discovery disable, Enable `transportpath-mtu-discovery` for `neighbor172.16.1.2transportpath-mtu-discovery`, where... Match the above set derive A certain derivation of S in Chinese grammar, and If there is a mismatch, the corresponding state is removed from the beam until the last time step t6, at which point the command with the highest conditional probability, neighbor 172.16.1.2transport connection-modepassive, with a score of -3.7, is returned.

[0142] The step (12) involves finding the set of all derived sets of the retrieved grammar S. derive The specific content is the set of all derived forms of grammar S. derive It is obtained from the grammar derivation graph G of the grammar S; the generation process of the grammar derivation graph G includes the following steps:

[0143] (21) Use the pyparsing library to parse the syntax S (e.g., t{a|b|c[d]}) into a nested list. (For example: ['t',['a','|','b','|','c','[','d',']']) Nested lists consist of |L| elements, which are divided into unparseable elements (e.g., 't') and parseable elements (e.g., ['a','|','b','|','c','[','d',']']). Parsable elements can also be considered as nested lists.

[0144] (22) Initialize the syntax derivation graph G, which is a directed graph containing a starting node node. start ;

[0145] (23) Create a node whose value is the first unparseable element (e.g., 't') and connect the starting node to that node;

[0146] (24) Determine whether the relationship between elements in a nested list is inheritance or parallel. If it is inheritance (e.g., element [['a'],'|',['b'],'|',['c',['[',['d'],']']]] inherits from element 't'), then the node corresponding to the inherited element is called the parent node of all nodes corresponding to the inherited elements. parent If the relationship is parallel (several elements separated by a vertical bar |), add several edges in graph G pointing from the parent node to the corresponding node of the parallel element (e.g., 't' points to ['a'], 't' points to ['b'], 't' points to ['c', ['[', ['d'], ']']]). Regarding inheritance, the following example illustrates this: For a syntax defined as x{y|z}, the elements y and z in {} are said to have an inheritance relationship with x, where x is the inherited element and y and z are the inheriting elements. Several elements separated by | in the syntax constitute a parallel relationship, and parallel elements are elements with a parallel relationship.

[0147] (25) If the current element e i If an element is optional (represented by multiple layers of square brackets, such as ['[',['d'],']']), then an empty node is created. blank Parent node parent Connect to the empty node blank On, and simultaneously add the parent node. parent It is also connected to the node corresponding to the optional element; the optional element is the element enclosed in [] in the syntax;

[0148] (26) Recursively execute steps (24)(25)(26) until the last level of the nested list L is parsed;

[0149] (27) Simplify graph G by traversing the nodes in graph G. If two nodes are connected through an empty node, remove the edge between the two nodes and the empty node, and add an edge that directly connects the two nodes to obtain the grammar-derived graph G of grammar S.

[0150] See Figure 7 and Figure 8 The above operation steps are illustrated with examples below.

[0151] Using the pyparsing library, the syntax `neighbor{ip-address|peer-group-name}transport{connection-mode{active|passive}|path-mtu-discovery[disable]|multi-session|single-session}` is parsed into a nested list `['neighbor',[['ip-address'],'|',['peer-group-name']]],'transport',[['connection-mode',[['active'],'|',['passive']]],'|',['path-mtu-discovery',['[',['disable'],']']],'|',['multi-session'],'|',['single-session']],'end'`. Initialization begins with a starting node. start neighbor is the first unresolvable element, and node start Connect to its corresponding node; next, determine the relationships between elements, such as {ip-address|peer-group-name}. The two elements within {} are parallel, while neighbor and they form an inheritance relationship. neighbor is the inherited element, and ip-address and peer-group-name are the inheriting elements. Therefore, add an edge in graph G from the parent node neighbor pointing to ip-address and peer-group-name; disable in the parsing result is an optional element (represented by ['[',['disable'],']']). Create an empty node, connect the parent node path-mtu-discovery to the empty node, and also connect it to the node corresponding to disable. Similarly, recursively process other elements in the nested list (see...). Figure 7 The edges involving empty nodes are simplified to obtain the final grammar-derived graph G( Figure 8 ).

[0152] See Figure 9 A method for generating network configuration commands based on natural language, the method comprising the following steps:

[0153] (31) The parser submodule of the configuration command library module extracts the semi-structured configuration information in the network device manual into structured data that can be retrieved, namely the structured configuration functions of the network device; the configuration command library module divides the obtained structured configuration functions into subsets according to the manufacturer name, device type and operating system version of the network device, and stores them in different sub-command libraries in the configuration command library module;

[0154] (32) The syntax retrieval module retrieves the k most matching syntaxes from the configuration command library module based on the network configuration intent input by the user in natural language;

[0155] Table 3

[0156]

[0157] Referring to Table 3, the syntax styles of configuration commands for network devices from different manufacturers vary greatly. In order to achieve the retrieval target from configuration intent to syntax, this invention proposes a two-stage retrieval process from coarse to fine.

[0158] The specific process is as follows: First, the intent-function description retrieval submodule retrieves the configuration function that best matches the network configuration intent entered by the user in natural language; then, the function description-syntax retrieval submodule retrieves the syntax that best matches the user's network configuration intent under the best matching configuration function.

[0159] Table 4

[0160]

[0161] See Table 4 for an example illustrating the above process.

[0162] First, the intent-feature description retrieval submodule finds the configuration feature "acl ipv6 number" that best matches the intent "Create auserACL6 numbered6999". This configuration feature contains a total of 8 syntaxes. Then, the feature description-syntax retrieval submodule finds the syntax "acl ipv6[number]ucl-acl6-number[match-order{auto|config}]" that best matches it.

[0163] (33) The command generator module generates network configuration commands and their context for the network device based on the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module. The specific process is as follows: first, the encoder submodule encodes the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module into a feature vector; then, the decoder submodule generates network configuration commands and their context for the network device based on the feature vector.

[0164] The inventors conducted numerous experiments on network equipment from various manufacturers, including Huawei, Cisco, Nokia, and Juniper. The experimental information is as follows:

[0165] (1) Experimental Environment

[0166] This paper utilizes the Scrapy framework to implement vendor-specific parsers and adapts them to other device manuals. The inventors used the Pyparsing library to parse command syntax to obtain its hierarchical structure. Furthermore, they pre-computed feature vectors for all function descriptions in ConfLib and indexed them using FAISS, an open-source toolkit for efficient vector search. Experiments retrieved the first three syntaxes. The system is based on the PyTorch library. All experiments were conducted on Ubuntu 18.04, equipped with a 10-core 4.7 GHz CPU, 128 GB of RAM, and two Nvidia RTX 3090 GPUs.

[0167] (2) Experimental Dataset

[0168] Table 5

[0169] Huawei NE40E VRPv8 12298 15066 Cisco NCS5000 iOS XR v7.4 1518 2485 Nokia 7750SR SROSv21.10 14530 / Zhanbo MX240 JUNOSv22.3 11038 /

[0170] To evaluate overall performance, the inventors collected four corpora from different manufacturers, including Huawei, Cisco, Nokia, and Juniper. The corpora were obtained from official device manuals to ensure standardization and reliability. Table 5 describes the details, including device models, system versions, and key statistics. The inventors built a retrieval library using the "Configuration Function" and constructed intent-command pairs from "Configuration Examples." A total of 17,000 pairs were used to form the training set (InConf). For testing, the inventors invited engineers to manually write a set of intents for a more realistic evaluation. Each engineer wrote 20 intents, for a total of 80, to ensure diversity of expression. These were then manually translated into commands, forming four test sets (Huawei, Cisco, Nokia, and Juniper).

[0171] (3) Evaluation indicators

[0172] Two metrics were considered in the experimental evaluation: Bilingual Evaluation Alternative (BLEU) and Exact Match Rate (EM). BLEU is commonly used in machine translation to measure the overlap between the predicted result and the reference command to determine their similarity. EM is a more stringent metric, which can be calculated as follows: Where N represents the total number of examples in the dataset, N em This indicates the number of examples that exactly match the reference command.

[0173] (4) Experimental Results

[0174] Table 6

[0175] BLEU indicator 77.05 75.31 70.13 71.33 EM index 64.11 60.32 51.19 52.42

[0176] The experimental results are shown in Table 6. Overall, good results were obtained, and the network configuration command generation speed is fast. The experimental results demonstrate that the system and method proposed in this invention are effective and feasible.< / start> ​​​​

Claims

1. A network configuration command generation system based on natural language, characterized in that: The system includes the following modules: Configuration Command Library Module: This module stores all configuration functions of the network device. It includes a parser submodule and different sub-command libraries, forming a searchable storage structure that stores all configuration functions of the network device. The sub-command libraries refer to subsets of the network device's configuration functions based on the manufacturer's name, device type, and operating system version. The parser submodule extracts the semi-structured configuration information from the network device manual into searchable structured data. The configuration command library module is an explicit external storage; during system runtime, it retrieves commands from the sub-command library corresponding to the network device, ensuring that the retrieved syntax conforms to the command-line interface (CLI) of the aforementioned network device; this ensures that the system can be easily extended to more network configuration commands that did not appear in the system training, without excessively increasing the complexity of the system. Syntax Retrieval Module: This module's function is to retrieve the k most matching syntaxes from the configuration command library module based on the user's network configuration intent input in natural language. The syntax retrieval module consists of an intent-function description retrieval submodule and a function description-syntax retrieval submodule. The intent-function description retrieval submodule retrieves the configuration function that best matches the user's network configuration intent input in natural language. The function description-syntax retrieval submodule retrieves the syntax that best matches the user's network configuration intent under the best matching configuration function; k is a natural number. Command Generator Module: This module generates network configuration commands for network devices and their context based on the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module. The command generator module consists of an encoder submodule and a decoder submodule; The command generator module is implemented using a sequence-to-sequence (seq2seq) encoding and decoding architecture; the encoder submodule encodes the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module into a feature vector; the decoder submodule generates network configuration commands for the network device and their context based on the feature vector. The decoder submodule in the command generator module is constructed using an improved pointer generation network that introduces a copying mechanism; The aforementioned replication mechanism is implemented through a multi-head attention mechanism; at each time step Given the decoder state and the intent-syntax sequence output by the encoder Encoding vector Calculate multi-head attention: in It is the number of the attention head. This represents the total number of attention heads, with the superscript (h) indicating the h-th attention head. , Let h be the parameters that can be learned by the h-th attention head. Indicates at time step The hth head of attention The Middle Attention score for each word Indicates at time step The hth attention will The Middle The normalized weights of each word are copied into the current decoding result. Indicates at time step The attention vector after weighting the h-th attention head; Intent-Syntax Sequence Encoding vector The j-th component, Encoding vector The dimension; The intent does not explicitly mention default parameters, therefore the decoder submodule needs to generate additional words to supplement the copying mechanism; at time step At that time, from the output vocabulary list The probability of generation is defined as: , in , , If the parameters are learnable, then at time step When, the replication probability is defined as , At time step When the total output probability can be defined as , in This is the output of the decoder submodule at time step t. This refers to the output distribution of the decoder submodule at time step t. It is an intention-grammar sequence Encoding vector Length; Indicates at time step The Hth attention head will The Middle Each word is copied into the normalized weights of the current decoding result.

2. The network configuration command generation system based on natural language according to claim 1, characterized in that: The configuration command library module is constructed as follows: the parser submodule extracts configuration information from the network device manuals of different device manufacturers and stores it in the unified manual format UMF; the unified manual format UMF is specifically a "key-value pair" format, where "key" represents the project name and "value" represents the specific content.

3. The network configuration command generation system based on natural language according to claim 1, characterized in that: The intent-function description retrieval submodule consists of an intent encoding subnetwork that receives network configuration intents input by the user in natural language, a function description encoding subnetwork that receives function descriptions of network devices, and a similarity measurement subunit. The function of the intent encoding sub-network is to encode the network configuration intent input by the user in natural language into a high-dimensional intent feature vector u; the function of the function description encoding sub-network is to encode the configuration function description of the network device into a high-dimensional function description feature vector v; the function of the similarity measurement sub-unit is to calculate the similarity between the intent feature vector u and the function description feature vector v. Both the intent encoding subnetwork and the function description encoding subnetwork are composed of ConfBERT networks, and the two subnetworks have the same network parameters. The ConfBERT network is a BERT network adapted to the network configuration technology field of network devices. The ConfBERT network is obtained by retraining the BERT network using a large hybrid corpus containing unsupervised network configuration information and network configuration annotations, and the same training task and training objective as the BERT network are used in the retraining process.

4. The network configuration command generation system based on natural language according to claim 3, characterized in that: The retraining process of the ConfBERT network is as follows: Given a set of intent-function description pairs In the formula, Indicates the i-th intention. Let represent the i-th function description, and m represent the number of intent-function description pairs; the training loss function is defined as follows: In the above formula, and They represent and eigenvectors; The temperature hyperparameter is represented by 'sim'; cosine similarity is represented by 'sim'. Indicates the i-th intention The corresponding losses.

5. The network configuration command generation system based on natural language according to claim 1, characterized in that: The functional description - syntax retrieval submodule finds a set of syntaxes by using the most matching configuration function, and then calculates the relevance score between the user's network configuration intent and each syntax in the set to find the syntax that best matches the user's network configuration intent, that is, the syntax with the highest relevance score; The calculation process for the relevance score between the user's network configuration intent and the syntax is as follows: (41) Regarding the intention Word segmentation is performed to obtain ; Intent The number of participles contained; (42) For an intention A grammar and a set of parameters And a description of this parameter. If the parameter Appears in grammar In the syntax, the parameters are... Then add the corresponding parameter descriptions. The enhanced syntax is obtained. Iterate through all the parameters; This represents the i-th word in the grammar S. Indicates the length of the syntax S. Indicates the size of the parameter set P; Indicates the size of the parameter description set PD; (43) Calculation intention The j-th word In grammar The number of times a word appears in a word, i.e., word frequency. ; (44) Calculate The weight, i.e., inverse document frequency ; (45) Calculate and grammar Correlation score between , In the formula ; It is a parameter used to standardize the frequency range of words in an article, and its value range is... ; It is another adjustable parameter, with a value range of... This is used to determine the range of information content represented by document length. It's grammar. Length, It is the average length of all syntaxes; (46) Calculation Intent and grammar The correlation score between them is Intent The relevance score to the grammar S.

6. The network configuration command generation system based on natural language according to claim 3, characterized in that: The encoder submodule in the command generator module is constructed using the ConfBERT network to adaptively capture contextual dependencies; it adds a parameter before the network configuration intent I entered by the user in natural language, according to the input format of the BERT network. This is combined with the k most matching syntaxes retrieved by the syntax retrieval module to form an intent-syntax sequence. In the formula This represents the i-th syntax. To indicate a separator, add it after the last syntax statement. Then, the intent-syntax sequence is encoded using the ConfBERT encoding described above. Then, the intention-grammar sequence is formed using a bidirectional LSTM. Encoding vector , Encoding vector Length, Encoding vector Dimensions.

7. The network configuration command generation system based on natural language according to claim 1, characterized in that: The decoder submodule generates network configuration commands and their context for the network device based on the feature vector, and includes the following steps: (11) Determine the initial hidden state of the decoder. ; (12) Find the retrieved syntax The set of all derivatives ; (13) At each beam search decoding time step t, calculate the b new decoder states in the beam. and from decoding time step Decoding time step Predicted partial command segment b is a natural number; (14) For each beam in the beam search, if the above partial command segment A partial command segment matching syntax If a certain derivative is used, that part of the command segment is retained in the beam; otherwise, it is removed. (15) Repeat steps (13) and (14); (16) Return the command with the highest conditional probability. In the formula To generate partial command segments The conditional probability.

8. The network configuration command generation system based on natural language according to claim 7, characterized in that: The step (12) described above involves finding the retrieved syntax. The set of all derivatives The specific content is grammar. The set of all derivatives From this syntax The grammar derivation graph G is obtained from the grammar derivation graph G; the generation process of the grammar derivation graph G includes the following steps: (21) Use the pyparsing library to translate the syntax Parsed as a nested list Nested lists are composed of It consists of 10 elements, which are divided into unparseable elements and parsable elements. Parsable elements can be viewed as nested lists. (22) Initialize the syntax derivation graph G, which is a directed graph containing a starting node. ; (23) Create a node whose value is the first unresolvable element, and connect the starting node to that node; (24) Determine whether the relationship between the elements in the nested list is an inheritance relationship or a parallel relationship. If it is an inheritance relationship, then the node corresponding to the inherited element is called the parent node of all nodes corresponding to the inherited elements. If they are parallel, in the diagram Add several edges from parent nodes to the corresponding nodes of parallel elements; in the syntax, several elements separated by | form a parallel relationship, and parallel elements are elements that have a parallel relationship. (25) If the current element If it is an optional element, then an empty node is created. Parent node Connect to this empty node Up, and simultaneously the parent node It is also connected to the node corresponding to the optional element; the optional element is the element enclosed in [] in the syntax; (26) Recursively execute steps (24), (25), and (26) until the nested list is parsed. The last layer; (27) Simplify graph G by traversing the nodes in graph G. If two nodes are connected through an empty node, remove the edges between the two nodes and the empty node, and add an edge directly connecting the two nodes. This yields the syntax. The grammatical derivation graph G.

9. A method for generating network configuration commands based on natural language, applied to the system described in claim 1, characterized in that: The method includes the following steps: (31) The parser submodule of the configuration command library module extracts the semi-structured configuration information in the network device manual into structured data that can be retrieved, namely the structured configuration function of the network device; the configuration command library module divides the obtained structured configuration function into subsets according to the manufacturer name, device type and operating system version of the network device, and stores them in different sub-command libraries in the configuration command library module. (32) The syntax retrieval module retrieves the k most matching syntaxes from the configuration command library module based on the network configuration intent input by the user in natural language. The specific process is as follows: first, the intent-function description retrieval submodule retrieves the configuration function that best matches the network configuration intent input by the user in natural language; then, the function description-syntax retrieval submodule retrieves the syntax that best matches the user's network configuration intent under the best matching configuration function. (33) The command generator module generates network configuration commands for the network device and their context based on the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module. The specific process is as follows: First, the encoder submodule encodes the network configuration intent input by the user in natural language and the k most matching syntaxes retrieved by the syntax retrieval module into a feature vector; then, the decoder submodule generates the network configuration command and its context for the network device based on the feature vector.