{'fraction_non_alphanumeric': 0.051151024538325325, 'fraction_numerical': 0.014217050341512775, 'mean_word_length': 4.08908341915551, 'pattern_counts': {'":': 0, '<': 1, '<?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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Machine Learning-based Reconfigurable Intelligent Surface-aided MIMO Systems

Reconfigurable intelligent surface (RIS) technology has recently emerged as a spectral- and cost-efficient approach for wireless communications systems. However, existing hand-engineered schemes for passive beamforming design and optimization of RIS, such as the alternating optimization (AO) approaches, require a high computational complexity, especially for multiple-input-multiple-output (MIMO) systems. To overcome this challenge, we propose a low-complexity unsupervised learning scheme, referred to as learning-phase-shift neural network (LPSNet), to efficiently find the solution to the spectral efficiency maximization problem in RIS-aided MIMO systems. In particular, the proposed LPSNet has an optimized input structure and requires a small number of layers and nodes to produce efficient phase shifts for the RIS. Simulation results for a 16x2 MIMO system assisted by an RIS with 40 elements show that the LPSNet achieves 97.25% of the SE provided by the AO counterpart with more than a 95% reduction in complexity.


I. INTRODUCTION
Reconfigurable intelligent surface (RIS) technology has recently been shown to be a promising solution for substantially enhancing the performance of wireless communications systems [1]. An RIS is often realized by a planar array comprising a large number of reconfigurable passive reflecting elements that can be configured to reflect incoming signals by a predetermined phase shift. Theoretical analyses have shown that an RIS of N elements can achieve a total beamforming gain of N 2 [2] and an increase in the received signal power that increases quadratically with N [3], [4].
Machine learning (ML) has recently attracted much attention for wireless communication systems [14]- [16], and particularly for RIS, e.g., [17]- [22]. The work in [17], [18] considers SISO systems where the RIS contains some active elements. While a deep neural network (DNN) is used in [17], the work in [18] exploits advances in deep reinforcement learning (DRL). Their solutions can approach the upper bound achieved with perfect channel state information (CSI). However, the introduction of active elements at the RIS causes additional hardware costs and power consumption. DRL is also exploited to optimize the RIS in assisting a system with a single-antenna user in [19], and for MIMO channels without a direct base station (BS) -mobile station (MS) link [20]. Gao et al. [21] propose a DNN-based passive beamforming (PBF) design, but only for a single-antenna user. Ma et al. [22] exploit federated learning (FL) to enhance the PBF performance and user privacy, but again for a simplified system with a singleantenna BS and no direct link to the MS.
Unlike the aforementioned studies on ML-based PBF, we consider a more general RIS-aided MIMO system in this paper. Furthermore, both the direct BS-MS and the reflected BS-RIS-MS links are taken into consideration, which imposes significantly more difficulty in the optimization of the ML models. In particular, the ML model needs to be optimized so that the signals through the different links add constructively at the MS. This implies another challenge, in that a large amount of information must be extracted by the ML model from the extremely high-dimension input data. Furthermore, unless an exhaustive search is performed, it is challenging to develop supervised learning-based ML models due to the unavailability of data labels. Fortunately, these challenges can be overcome by the findings in our paper. Specifically, by formulating the SE maximization problem and studying the AO solution, we discover an informative input structure that enables a DNN, even with a single hidden layer and an unsupervised learning strategy, to generate efficient phase shifts for PBF. The proposed DNN-based PBF scheme, referred to as a learningphase-shift neural network (LPSNet), is numerically shown to perform very close to the AO method in [11] with a substantial complexity reduction.

A. System Model
We consider downlink transmission between a BS and MS that are equipped with N t and N r antennas, respectively. The communication is assisted by an RIS with N passive reflecting elements. Let H d ∈ C Nr×Nt , H t ∈ C N ×Nt , and H r ∈ C Nr×N denote the BS-MS, BS-RIS, and RIS-MS channels, respectively, and let Φ = diag{α 1 , α 2 , . . . , α N } denote the diagonal reflecting matrix of the RIS. The RIS coefficients are assumed to have unit-modulus, i.e., α n = e jθn , ∀n, and, thus, it only introduces phase shifts θ n ∈ [0, 2π), ∀n to the impinging signals. Let x ∈ C Nt×1 be the transmitted signal vector. We focus on the design of the PBF and assume a uniform power allocation, i.e., E xx H = P BS I Nt , where P BS is the transmit power at the BS. The MS receives the signals through the direct channel and via the reflection by the RIS. Therefore, the received signal vector at the MS can be expressed as where H H d + H r ΦH t is the combined effective channel, and n ∼ CN (0, σ 2 I Nr ) is complex additive white Gaussian noise (AWGN) at the MS.

B. Problem Formulation
Based on (1), the SE of the RIS-aided MIMO system can be expressed as [11] SE ({α n }) = log 2 det(I Nr + ρHH H ), where {α n } = {α 1 , α 2 , . . . , α N } is the set of the phase shifts at the RIS that needs to be optimized, and ρ = PBS σ 2 . The PBF design maximizing the SE can be formulated as subject to |α n | = 1, ∀n.
The objective function SE ({α n }), given in (2), is nonconvex with respect to {α n }, and the feasible set for (P0) is nonconvex due to the unit-modulus constraint (3b). Therefore, (P0) is intractable and is difficult to find an optimal solution. Efficient solutions to (P0) can be solved by the AO [11]- [13] or projected gradient descent (PGD) [23] methods. However, these algorithms require an iterative update of {α n }. In particular, to obtain the phase shifts in each iteration, computationally expensive mathematical operations are performed, and as a result these algorithms have high complexity and latency. In the next section, we propose the low-complexity LPSNet to find an efficient solution to (P0).

A. DNN-based PBF
Instead of employing a high-complexity algorithm (e.g., AO or PGD), a DNN can be modeled and trained to solve (P0), i.e., to predict {α n }. While the phase shifts {α n } are complex numbers and cannot be directly generated by a DNN, since |α n | = 1, ∀n, the coefficients {α n } are completely specified only by their real-valued phase shifts {θ n }. Hence, (P0) is equivalent to whose solution is found by a DNN in this work. Leth be a vector containing the CSI parameters (i.e., the information in H d , H t , and H r ). The phase shifts learned by a DNN can be mathematically modeled as where f NN (·) represents the non-linear mapping fromh to {θ n } performed by the DNN. The efficiency and structure of f NN significantly depend on the input. Therefore, properly designingh is one of the first and most important tasks in modeling f NN . Leth 0 be the input vector constructed from the original CSI (i.e., entries of H d , H t , and H r ), i.e., where vec(·) is a vectorization. Obviously,h 0 contains the required CSI for a conventional hand-engineered algorithm to solve (P0). However,h 0 does not possess any structure or meaningful patterns that the DNN can exploit. Furthermore, if a very deep DNN is used, the resulting computational complexity may be as high as that of the conventional schemes, making it computationally inefficient. Our experimental results obtained by training DNNs with the inputh 0 show that the DNNs cannot escape from local optima even after extensive fine tuning. This motivates us to select more informative features as input of the proposed DNN.

B. Proposed Efficient Input Structure
To design a better-performing input structure for f NN , we first extract the role of each individual phase shift θ n in SE ({θ n }). Let r n be the nth column of H r and t H n be the nth row of H t , i.e., H r = [r 1 , . . . , r N ] and H t = [t 1 , . . . , t N ] H . Furthermore, for ease of notation, defineH (0) H d and whereH (n) r n t H n , n = 1, . . . , N . Consequently, SE ({θ n }) can be recast in an explicit form where n = 1, . . . , N . It is observed that neither A n or B n involves θ n . This means that if all variables {θ i } N i=0,i =n are fixed, A n and B n are determined, and θ n can be found by [11] where λ(A −1 n B n ) denotes the sole non-zero eigenvalue of A −1 n B n [11]. This implies that the information necessary to obtain θ n is contained in A −1 n B n , which can be computed if the values {H (i) } are available, as observed in (9) and (10). We summarize this important result in the following remark.
Remark 1: In a DNN predicting the phase shifts {θ n } of the RIS, the input vector should contain the coefficients of {H (i) }. More specifically, it can be constructed as where R(A) and I(A) represent the real and imagine parts of the entries of A, respectively. There are N + 1 matricesH (i) ∈ C Nr×Nt . Thus,h consists of 2N t N r (N + 1) real elements. Some interesting observations can be made from (7) and (12), as noted in the following remark.
Remark 2: The efficient input structure of Remark 1 is constructed from the pairwise products of the N columns of H r and the N rows of H t . This is of interest because there are various ways to extract/combine the information from the entries of H t and H r . Based on Remark 1, it is reasonable to expect that the raw CSIh 0 is not readily exploited by the DNN to learn our regression model successfully. Furthermore, H d , i.e., {H (0) } in (12), contributes toh with its original entries, and no manipulation is required.
In addition, we note that although additional mathematical operations are required to obtain {H (i) }, they are just lowcomplexity multiplications of a column and a row vector and matrix additions. Therefore, generating the proposed input structure requires low computational complexity, but it has a significant impact on the learning ability and structure of the DNN employed for PBF, as will be shown in the next section.

C. Proposed LPSNet
Here we propose a learning-phase-shift neural network, referred to as LPSNet, for solving the PBF problem (P) in (4). We stress that the informative input structure in (12) plays a deciding role in the efficiency of the LPSNet. Specifically,h in (12) already contains the meaningful information necessary to obtain {θ n }. The network structure, training strategy, and computational complexity of LPSNet are presented next.
1) Network Structure: LPSNet has a fully-connected DNN architecture, and like any other DNN model, it is optimized by fine-tuning the number of hidden layers and nodes, and the activation function. However, thanks to the handcrafted feature selection, the LPSNet can predict {θ n } efficiently with only a small number of layers. Through fine-tuning, we have found that only a single or a few hidden layers with N nodes in each is sufficient to ensure satisfactory performance. As a result, the sizes of the input, hidden, and output layers are 2N t N r (N + 1) (i.e., the size ofh), N , and N , respectively. Furthermore, we have found that Sigmoid activation functions at both the hidden and output layers can provide better training of the LPSNet than other activation functions. With such a shallow network, the complexity of LPSNet is very low. Moreover, we have found that to optimize the LPSNet, fine-tuning can be done by slightly increasing the number of hidden layers and nodes, e.g., for large MIMO systems. For example, to predict the phase shifts of an RIS equipped with N = 40 elements assisting an 8 × 2 MIMO system, a single hidden layer with N nodes can guarantee an efficient training, while for a 16 × 2 MIMO system, two hidden layers, each deployed with N nodes, is sufficient (see Table I). For other systems, it is recommended to begin fine-tuning with such a proposed simple network to avoid overfitting.
2) Training Strategy: For offline training, we propose employing an unsupervised training strategy [21]. We note that, on the other hand, if supervised training is used, labels ({θ n }) have to be obtained using a conventional high-complexity method such as AO [11] or PGD [23]. To avoid this high computational load, unsupervised training is adopted for training the LPSNet so that it can maximize the achievable SE without the labels {θ n }. To this end, we set the loss function to  , H t , and H r by their corresponding large-scale fading coefficients so that their entries have zero-mean and unit-variance. This preprocessing is also applied to obtain the input data inh. In other words,h is obtained from H d,train , H t,train , and H r,train rather than H d , H t , and H r . Furthermore,Φ = diag{e jθ1 , . . . , e jθN }, where {θ n } are the outputs of the LP-SNet, as given in (5). During training, the weights and biases of the LPSNet are optimized such that Loss is minimized, or equivalently, SE is maximized.
3) Online LPSNet-based PBF: Once LPSNet has been trained, it is ready to be used online for PBF. At first,h is constructed from the CSI based on Remark 1. Then, the LPSNet takesh as the input for output {θ n }, which are then transformed to the reflecting coefficients {α n }, witĥ α n = cosθ + j sinθ, ∀n. At this stage, the PBF matrix is obtained as Φ = diag{α 1 , . . . ,α N }.

4) Computational Complexity Analysis:
Let L denote the number of hidden layers of LPSNet. LPSNet requires a complexity of O(N r N t N ) for constructing the input h, O(N r N t N 2 ) for the first hidden layer, and O(N 2 ) for subsequent hidden layers and the output layer. Therefore, the total complexity of the proposed LPSNet is O(max (N r N t N 2 , LN 2 )). When L < N r N t , the complexity of LPSNet is O (N r N t N 2 ). This should be the case since we found that LPSNet requires a small L to produce efficient phase shift values; for example in Table I, it is seen that only 1 or 2 hidden layers are required.
For comparison, the computational complexity of the AO method in [11]  number of random sets {α n } initializing the AO method, and I is the number of iterations. Since I is polynomial over N r , N t , and N , the total complexity of the AO method is at least quadratic in N r , cubic in N t , and quadratic in N . The complexity of LPSNet is only linear in N r and N t , and quadratic in N . Therefore, LPSNet is less computationally demanding than the AO method. The computational complexity for each iteration of the PGM method in [23] Similarly, when the number of iterations is large, the PGM method is also more computationally expensive than LPSNet.

IV. SIMULATION RESULTS
In this section, we numerically investigate the SE performance and computational complexity of the proposed LPSNet. We assume that the BS, MS, and RIS are deployed in a two-dimensional coordinate system at (0, 0), (x MS , y MS ), and (x RIS , 0), respectively. The path loss for link distance d is given by β(d) = β 0 (d/1m) ǫ , where β 0 is the path loss at the reference distance of 1 m, and ǫ is the path loss exponent [2], [11]. Following [2], [11], [12], we assume a Rician fading channel model for the small-scale fading of all the involved channels, including H d , H t , and H r . For more details on the the small-scale fading, please refer to [2], [11], [12]. We consider two systems, namely, 8 × 2 MIMO and 16 × 2 MIMO, both of which are aided by a RIS with N = 40 reflecting elements [2], [11]. The bandwidth is set to 10 MHz, and the noise power is −170 dBm/Hz [11]. Let ǫ (·) and κ (·) respectively denote the path loss exponent and Rician factor of the corresponding channel H (·) . We set {ǫ d , ǫ t , ǫ r } = {3.5, 2, 2.8} [2], and due to the large distance and random scattering on the BS-MS channel, we set κ d = 0 [2]. By contrast, to show that the proposed LPSNet can generalize to perform well for various physical deployments of the devices, in the simulations the RIS is randomly located on the x−axis, at a maximum distance of 100m from the BS. Then, the MS is randomly placed 2m away from the RIS. This setting implies that the MS is near the RIS, as widely assumed in the literature [2], [11], [13]. Consequently, κ t and κ r are both randomly generated. This procedure applies to the generation of both the training and testing data sets.
LPSNet is implemented and trained using Python with the Tensorflow and Keras libraries and an NVIDIA Tesla V100 GPU processor. For the training phase, we employ the Adam optimizer (with a decaying learning rate of 0.99 and a starting learning rate of 0.001) and the loss function (13) with ρ 0 = 30 dB. We train and test the performance of the LPSNets, summarized in Table I,  training these LPSNets are 10 and 20 samples, respectively, selected from data sets of 40,000 samples.

A. The Significance of Input Structure
In Fig. 1, we justify the efficiency of the proposed input structureh in (12) by comparing the resultant loss to that offered byh 0 in (6). It is observed for both the 8 × 2 MIMO ( Fig. 1(a)) and 16 × 2 MIMO (Fig. 1(b)) systems that, as the epoch number increases, the loss value of the LPSNet withh quickly decreases until reaching convergence, with almost no or acceptable overfitting/underfitting. In contrast, whenh 0 is used, LPSNet cannot escape from the local optima, providing almost constant loss values (Figs. 1(c)). This is not overcome even when we increase the learning rate to 0.002 and batch size to 100 samples as in Fig. 1(d). The results in Fig. 1 demonstrate that the input structure plays a key role in the learning ability of LPSNet, and the proposed informative input structureh enables LPSNet to be trained well for PBF even with simple architectures.

B. SE Performance and Complexity of the Proposed LPSNet
In Fig. 2, the SE performance and computational complexity of the proposed LPSNet are shown for 8 × 2 and 16 × 2 MIMO systems. For comparison, we also consider the cases where {θ n } are either randomly generated, obtained based on the AO method [11], or when RISs are not employed. For both considered MIMO systems we see that the proposed LPSNet performs far better than when using random phases for the RIS or without RIS. It performs similarly to the AO method but requires much lower complexity. For example, in the 16 × 2 MIMO system, LPSNet achieves 97.25% of the SE provided by the AO approach with more than a 95% reduction in complexity.
In Fig. 3, we show the SE of the considered schemes when fixing x RIS = 100 m, x MS ∈ [80, 120] m, and P BS = 40 dBm. Clearly, the proposed LPSNet attains good performance over the entire considered range of x MS , which demonstrates its ability to perform well regardless of the physical distances between devices. This is because the training data (i.e., the channel coefficients) have been pre-processed to remove the effect of the large-scale fading. Furthermore, LPSNet provides the highest SE at x MS = x RIS = 100 m, i.e., when the RIS and MS are closest to each other, in agreement with the findings of [2], [24].

V. CONCLUSION
In this paper, we have considered the application of DNN to passive beamforming in RIS-assisted MIMO systems. Specifically, we formulated the SE maximization problem, and showed how it can be solved efficiently by the proposed unsupervised learning-based LPSNet. With the optimized input structure, LPSNet requires only a small number of layers and nodes to output reliable phase shifts for PBF. It achieves almost the same performance as the AO method with considerably less computational complexity. Furthermore, the proposed unsupervised learning scheme does not require any computational load for data labeling.