{'fraction_non_alphanumeric': 0.031197192252697258, 'fraction_numerical': 0.007994280514753671, 'mean_word_length': 4.62390350877193, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Reinforcement Learning of Graph Neural Networks for Service Function Chaining

In the management of computer network systems, the service function chaining (SFC) modules play an important role by generating efficient paths for network traffic through physical servers with virtualized network functions (VNF). To provide the highest quality of services, the SFC module should generate a valid path quickly even in various network topology situations including dynamic VNF resources, various requests, and changes of topologies. The previous supervised learning method demonstrated that the network features can be represented by graph neural networks (GNNs) for the SFC task. However, the performance was limited to only the fixed topology with labeled data. In this paper, we apply reinforcement learning methods for training models on various network topologies with unlabeled data. In the experiments, compared to the previous supervised learning method, the proposed methods demonstrated remarkable flexibility in new topologies without re-designing and re-training, while preserving a similar level of performance.


INTRODUCTION
Development of computer network system based on software such as software defined networking (SDN) and network function virtualization (NFV) has provided many advantages to managing network systems [1] [2]. Due to the advances in such developments, the automatic network controlling system has become a promising technology [3], which includes some modules such as virtualized network function (VNF) deployment, resource demand prediction, auto-scaling, anomaly detection system, and service function chaining (SFC). Among them, the SFC module carries out the essential task of generating a path that connects the requested VNF instances This work was supported by Institute for Information and communications Technology Promotion (IITP) grant funded by the Korea government (MSIT) (No.2018-0-00749, Development of virtual network management technology based on artificial intelligence). [4]. A path is generated according to active user requests that consist of a chain of VNFs and locations of source and destination. The resulting paths should satisfy not only these requested requirements, but also provide services with the shortest possible delay. In addition, the SFC module should be flexible with various VNF resources statuses, various types of user requests, and various network topologies. Thus, it is a challenging task to develop an efficient SFC module.
Recently, deep learning techniques have been applied to the complicated SFC task with high capacity models. To the best of our knowledge, the first deep learning application to the SFC task was based on simple deep neural networks (DNNs) as introduced in [5], where the performance was not sufficient to use as an actual SFC module. Another deep learning approach to the SFC task was based on the gated graph neural network (GG-NN) [6] as in [7]. As variants of the graph neural networks (GNNs) [8], the GG-NN models could capture the features of the network topology statuses and map them to the node level vector representations based on the topology [7]. The GG-NN models outperformed the DNN models in terms of time delay for service and failure ratio for finding paths. Also, the GG-NN models could be applied to even dynamically changing network topologies without re-designing or re-training, since GNNs could accept the variable number of nodes as the input to the networks.
However, since the GG-NN models in [7] were trained with a supervised learning (SL) algorithm, the models needed a large amount of labeled data for training. Actually, it is possible to produce labeled data (true path) from various topologies only if a network topology simulator and the integer linear programming (ILP) algorithm are available. Even in such cases, the labels are not available from real-time network systems because it takes too much time to generate labels. Therefore, the SL approach is inevitably biased to specific topology with labeled data, so that the performance seriously deteriorates in tests on new computer network topology, because the model can not be trained on various topologies.
To make the GG-NN models flexible with various topologies while maintaining the good performance, we propose the arXiv:2011.08406v1 [cs.AI] 17 Nov 2020 use of reinforcement learning (RL) algorithms to train the models with the same architecture as [7]. The RL algorithms have the advantage of the agent that can learn from rewards that are provided by the network environment, so that the models can learn from various topologies even when labels are not available. We design a simple reward setting and train the models with the REINFORCE algorithm [9,10]. We train the models with randomly changed topologies and randomly placed VNF instances during the training episodes.
In the experiment with the fixed topology test, the proposed RL approach had a similar level of performance to the SL approach. However, it significantly outperformed the SL approach in tests with changed topologies and changed positions of VNF instances.

Service Function Chaining
We follow the same problem definition as in [7] for the SFC task, and briefly describe it in this section. On the network topology, several VNF instances are deployed on the computing nodes as described in [11], which deploys a sufficient number of requested VNF resources while minimizing leftovers. According to user requests for a service, the SFC module should generate a resulting path to provide high quality of services (QoS). The QoS is generally measured by packet loss, bit rate, throughput, transmission delay and availability. However, because our experiments are conducted on simulated situations, the QoS is measured by the success of generation and the total time delay. The generated path is classified as a success case if it processes all of the requested VNFs and arrives at the destination node within a pre-defined number of maximum steps. Delays are caused by forwarding network traffic and processing VNFs. Below is the formulation of the total delay time of a path p i .
where E is the set of edges and M is the set of VNF instances in the network topology. d uv and d m are delay time of that edge and VNF instance, respectively. y pi uv and x pi m indicate that the edge uv and VNF instance m are included in the resulting path p i .

GG-RNN
In the GNN-based SFC task [7], they designed a model with the encoder-decoder architecture. Since they used GG-NN [6] for the encoder and recurrent neural network (RNN) for the decoder, they referred it to as GG-RNN. In this section, we briefly describe the GG-RNN model as shown in Fig. 1. For more details of the model architecture, see [7].

Encoder
As an encoder, GG-NN produces a vector representation of nodes as follows: where h (0) u is the initial hidden state of node u which is annotation consisting of the label of that node l u , the feature of that node u. In Eq. (3), A is the adjacency matrix describing the connection between nodes, where N is the number of nodes in the network topology. With the adjacency matrix A, Eq. (3) calculates the information exchange between neighbor nodes so that the output representation of the encoder reflects how the computing nodes and the switches are connected in the network. The GRU function is the gated recurrent unit (GRU) [12] with the previous hidden state h

Decoder
Given the final representation of the GG-NN encoder, the decoder receives additional inputs from the network topology. The first one is V all which includes the list of requested VNF types, and the second one is V now for the VNF type with the top priority to process at the current time. The decoder estimates the probabilities of the nodes to forward the network traffic. In addition, it also estimates the probabilities of whether or not to process the top priority VNF instance on the next node. By repeating this step with RNN, the decoder generates a valid path or fails.

Reinforcement Learning Components
To apply RL methods for the SFC task, we define the core components of RL: state, action, and reward. The state is composed of the input into the GG-RNN model including annotation, adjacency matrix, and three additional inputs of the decoder as mentioned above. In addition, the previous hidden state of the decoder RNN is also part of the state. The action consists of the selection of the next node and decision to process the VNF at the selected node by the policy network (GG-RNN). We assign a positive reward to the agent only when it succeeds in generating a valid path. For the model to generate a shorter path, we also add a negative total delay time of the path to the reward as a penalty, where λ can control the weight of the penalty. The reward can be defined by where P is a complete episode with the sequence of transitions {s 1 , a 1 , r 2 , . . . s T −1 , a T −1 , r T }. The total delay is computed by Eq. (1).

REINFORCE algorithm
The REINFORCE algorithm [9] is one of the policy gradient algorithms in reinforcement learning. The agent makes an action on a given state according to its policy. After repeating such transitions with the policy until the state reaches a terminal state, an episode is finished. Then, the update algorithm calculates the returns for all of the actions that are included in the episode from the last transition to the first transition. After these calculations are made, the parameters of the policy network are updated based on the derivative of the log probability of those actions, where the derivative is weighted by the return of the actions. As a result, the policy network is trained to maximize returns for each episode.
Since the GG-RNN model repeatedly makes an action to find the next node until it completes a path to serve a user request, REINFORCE can be applied to train the model. We can update and compute the returns of the GG-RNN model for a resulting path as follows. where we use GG-RNN θ (s t , a t ) as a policy network in RE-INFORCE. In the episode, s t , a t , and r t are state, action and reward at t, respectively, as described in the previous section. G t is the return value at t, and α and γ are a learning rate and a discount factor, respectively.

Training on Random Topologies
The SL approach [7] stated that the reason for performance deterioration in the changed topology tests was because the model could not be trained on various topology where labels were not available. In our proposed RL method, we change the original topology randomly at each episode during training. For the experiments, we applied two strategies for changing the topology. First, we add a random number of nodes and edges at random locations. The probability and the number of trials to add a node and an edge are set to (0.1 and 12) and (0.3 and 15), respectively. Whenever we add a new node, for the node we added two edges with its neighbor nodes. After the adding processes, we remove randomly selected edges. The probability and the number of trials for removing edges are set to (0.3 and 30). When removing a selected edge disconnects any node, we dismiss the removal trial. Another strategy makes additional changes after applying the first strategy. We change the locations of the existing VNF instances randomly. Fig. 2  shows examples of changed topology using these strategies. With one of two strategies, we generated 100 random topologies before training and selected one structure randomly at the beginning of each episode for training. For testing, we also generated 100 random topologies using one of the strategies.

Experimental Settings
We trained the GG-RNN model from scratch by SL [7] and used it as the pre-trained model for RL methods. The hyperparameters are the same as [7] except for the learning rate of the proposed RL approaches, which is 0.00001. We used the -greedy sampling for exploration where was 0.01. The discount factor γ in Eq. (6) was set to 0.999. In the experiments, the models were trained and tested on a simulated dataset [7], which was generated in the same scenarios as [11].
We conducted three types of tests, (1) 'Original Topo. Test', (2) 'Random Topo. Test', and (3) 'Random Topo.+VNFs Test': (1) the model generates paths on the topology 'inter-net2' which we also used for training, (2) the model generates paths on randomly changed topology using the first strategy mentioned in section 3.3, and (3) the model generates on the same topologies as the second test, but the positions of the VNF instances are also changed randomly.
The 'Failure Ratio' is the ratio of the failed SFC requests out of all the SFC requests. The 'Delay Ratio' is the total delay time of the generated path over the total delay time of the label path. Note that this metric is computable only for the first test, because the labels are not available for the other tests. The deterioration rate 'Deter. Rate' is the ratio of 'Failure Ratio' of the random tests (the second or third test) to 'Failure Ratio' of the first test indicating how much the quality deteriorated because of topology change. Table 1 summarizes the experiment results comparing the proposed methods to the baseline method. In the first test ('Original Topo. Test'), our proposed methods have similar performance in terms of 'Failure Ratio', though they are slightly lower for 'Delay Ratio'. It is mainly because the reward for the RL methods is based on whether the model generates a valid path or not. Actually, 'RL(λ=0)' outperforms the baseline model for 'Failure Ratio' since it was trained to minimize failures on the same topology.

Results and Analysis
We compared the RL methods trained with different topology change strategies. In Table 1, 'CS1' and 'CS2' indicate that the model was trained using topology change strategies 1 and 2, respectively, as in section 3.3. Although the increased complexity of the task lowers the quality of the models in the first test, they significantly outperform the baseline model in the second and the third tests. Moreover, the models trained by 'CS2' demonstrated greater robustness than the models trained by 'CS1' in the third test. These results confirm that the model trained on various topologies becomes more flexible and robust for different topologies.
To verify the effect of the delay penalty term in Eq. (1), we compared the RL methods with different λ values, 0 or 1. When λ = 1, the reward includes delay time as a penalty and it decreases 'Delay Ratio' compared to the models with λ = 0, while 'Failure Ratio' slightly increased. Simply stated, this is because the models were trained to maximize the reward, and this demonstrates that we can adapt λ depending on various context of network management.

CONCLUSION
In this paper, to make the SFC module more flexible and robust for various network topologies, we proposed the RL methods to train the GNN based SFC model. The proposed methods could train the model on various topologies where the SL method could not because the labels are not available. The experiment results demonstrated that the proposed approaches make the SFC module work on random topology tests where the baseline method does not work.
In future, we can evaluate the methods in real computing network environments where a lot of different topologies exist without labels.