{'fraction_non_alphanumeric': 0.04345458505772163, 'fraction_numerical': 0.009638423001524721, 'mean_word_length': 4.563465616479855, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Stochastic Beamforming for Reconfigurable Intelligent Surface Aided Over-the-Air Computation

Over-the-air computation (AirComp) is a promising technology that is capable of achieving fast data aggregation in Internet of Things (IoT) networks. The mean-squared error (MSE) performance of AirComp is bottlenecked by the unfavorable channel conditions. This limitation can be mitigated by deploying a reconfigurable intelligent surface (RIS), which reconfigures the propagation environment to facilitate the receiving power equalization. The achievable performance of RIS relies on the availability of accurate channel state information (CSI), which however is generally difficult to be obtained. In this paper, we consider an RIS-aided AirComp IoT network, where an access point (AP) aggregates sensing data from distributed devices. Without assuming any prior knowledge on the underlying channel distribution, we formulate a stochastic optimization problem to maximize the probability that the MSE is below a certain threshold. The formulated problem turns out to be non-convex and highly intractable. To this end, we propose a data-driven approach to jointly optimize the receive beamforming vector at the AP and the phase-shift vector at the RIS based on historical channel realizations. After smoothing the objective function by adopting the sigmoid function, we develop an alternating stochastic variance reduced gradient (SVRG) algorithm with a fast convergence rate to solve the problem. Simulation results demonstrate the effectiveness of the proposed algorithm and the importance of deploying an RIS in reducing the MSE outage probability.


I. INTRODUCTION
It is envisioned that Internet of Things (IoT) will provide ubiquitous connectivity for billions of low-cost devices with sensing and communication capabilities, thereby enabling automated operations for various intelligent services [1]. Aggregating data from a large amount of distributed IoT devices is an important but also challenging task billions. The conventional transmit-then-compute approach is not spectrumefficient and incurs excessive delay in dense IoT networks. Fortunately, over-the-air computation (AirComp), integrating communication and computation, has the potential to enable ultra-fast data aggregation by allowing the concurrent data transmission and leveraging the superposition property of multi-access channels [2], [3].
With great potentials, AirComp has recently attracted considerable research interests. In particular, the authors in [4] for the first time showed that the superposition property of multiaccess channels can be exploited to compute the nomographic functions. Subsequently, the authors in [5] adopted AirComp to facilitate multiple linear functions computation with antenna arrays, while taking into account the intranode interference of multiple functions. The authors in [6] proposed a computation-optimal policy for AirComp systems and studied the ergodic performance under fading channels. In addition, AirComp was exploited in [7] to accelerate the convergence rate of federated learning by overcoming the challenge due to limited communication bandwidth. According to the aforementioned studies, the performance of AirComp, quantified by the mean-squared error (MSE), is bottlenecked by the unfavorable channel conditions of IoT devices.
Reconfigurable intelligent surface (RIS) has recently been recognized as a promising technology that is capable of overcoming unfavorable channel conditions by reconfiguring the radio propagation environment [8]- [10]. In particular, an RIS is a man-made flat surface composed of many passive reflecting elements, each of which can independently scatter and shift the phase of the impinging waves [11]. The phase-shift pattern generated by all reflecting elements determines the reflection direction of the incident signal, thereby enhancing the signal power at the receiver. RIS was exploited in [12] to enhance the signal power in multiple-input single-output (MISO) systems. The authors in [13] adopted RIS to minimize the power consumption of non-orthogonal multiple access (NOMA) networks. Moreover, the authors in [14] leveraged the benefits of RIS to reduce the MSE of AirComp. However, all the aforementioned studies relied on perfect instantaneous channel state information (CSI) to design effective transmit/receive beamforming vectors.
It is generally difficult to obtain accurate instantaneous CSI in RIS-assisted cellular networks [15], [16]. Without perfect CSI, a widely adopted approach is to approximate the actual channel coefficient by the estimated channel coefficient and the channel estimation error, which is assumed to subject to a certain bounded perturbation. In this case, robust beamforming can be adopted to address the channel uncertainty [17]. However, the robust beamforming design is very conservative as it only guarantees the worst case performance. Besides, an optimal phase shift design of the RIS was proposed in [18] that based on the upper bound of the ergodic spectral efficiency. However, this work relied on the prior knowledge of the underlying channel distribution, which may not be available in many practical scenarios.
In this paper, we consider an RIS-aided IoT network, where a multi-antenna access point (AP) aggregates sensing data from multiple IoT devices using AirComp with the assistance of an RIS. Without any prior knowledge on the underlying channel distribution, we formulate a stochastic optimization problem that maximizes the probability of MSE being smaller than a certain threshold. However, the formulated problem turns out to be a highly intractable non-convex optimization problem, which faces many challenges, including non-smooth probabilistic objective function, coupled optimization variables, and non-convex unimodular constraints. To this end, we propose a data-driven approach that relies on the historical channel realizations to jointly optimize the receive beamforming vector at the AP and the phase-shift matrix at the RIS. To handle the non-smoothness of the objective function, we adopt a sigmoid function as surrogate, resulting in a continuous optimization problem. To decouple the optimization variables and tackle the unimodular constraints, we propose an alternating stochastic variance reduced gradient (SVRG) algorithm with a fast convergence rate. Simulation results demonstrate the effectiveness of the proposed algorithm and show the performance gain achieved by deploying an RIS in terms of minimizing the MSE.
Notations: Matrices, vectors, and scalars are denoted by bold capital, bold lowercase, and lowercase letters, respectively. (·) H and (·) T stand for conjugate transpose and transpose of a matrix or a vector, respectively. | · | and · denote the l 1 and l 2 norm operators, respectively.
[·] and [·] represent the real and imaginary parts of a complex matrix, vector, or scalar, respectively. E [·] and Pr(·) denote the expectation of a random variable and probability of an event, respectively.

A. System Model
We consider the concurrent uplink transmission via Air-Comp in an RIS-aided IoT system consisting of K singleantenna IoT devices, an AP with N antennas, and an RIS equipped with M passive reflecting elements. We denote K = {1, 2, . . . , K} as the set of device indices. We denote z k ∈ C as the information-bearing signal at device k. The AP aims to recover a nomographic function (e.g., arithmetic mean) of the sensing data from all devices. The target function can be expressed as where ϕ k (·) denotes the pre-processing function at device k and ψ(·) denotes the post-processing function at the AP [19]. We denote s k = ϕ k (z k ) as the transmitted data at device k, and assume that {s k } are independent and have zero mean and unit power, i.e., E[s k s H k ] = 1, and E[s k s H j ] = 0, ∀k = j. The target function to be estimated is given by We assume that all IoT devices are synchronized and transmit concurrently to the AP [5]. The signal received at the AP from all the devices is given by where w k ∈ C denotes the transmit scalar of device k, Θ = diag e jθ1 , · · · , e jθ M is the diagonal phase-shift matrix of the RIS with θ m ∈ [0, 2π), and h d,k ∈ C N ×1 , G ∈ C N ×M , and h r,k ∈ C M ×1 are the channel coefficients from device k to the AP, from the RIS to the AP, and from device k to RIS, respectively. Besides, n ∼ CN (0, σ 2 I N ) is the additive white Gaussian noise (AWGN) with zero mean and power σ 2 . Each device has a maximum transmit power, denoted as P . Hence, we have |w k | 2 ≤ P, ∀ k ∈ K.

B. Problem Formulation
The estimated function before post-processing at the AP is given bŷ where m ∈ C N denotes the receive beamforming vector and η is power normalizing factor. We adopt MSE to evaluate the distortion ofĝ with respect to g, which quantifies the AirComp performance To minimize the estimation error, we need to jointly optimize transmit scalar w k , receive beamforming vector m, and phase-shift matrix Θ.
When receive beamforming vector m and phase-shift matrix Θ are given, the optimal transmit scalar that minimizes the MSE can be expressed as [5], [7], [14] Due to the transmit power constraint, η can be expressed as With (5) and (6), the MSE can be further rewritten as To minimize the MSE, the instantaneous CSI is required, which however is impratical to obtain [16]. In this paper, we completely forego the assumption of the availability of instantaneous CSI. We maximize the probability that the MSE falls below to a predetermined threshold denoted as τ . Hence, the formulated problem is given by We define f (m, v) as the MSE outage probability, which is given by By denoting γ = τ P/σ 2 , problem (7) can be equivalently expressed as where where h e,k = {h d,k , h r,k , G} is an abstraction of channel coefficient between device k and the AP. Thus, for all k ∈ K, we have As a result, the MSE outage probability can be rewritten as where I (0,+∞) (x) is an indicator function defined as The channel distribution is indispensable when it comes to compute f (m, v) accurately. Due to the ergodicity of the channel process, we can approximate f (m, v) by averaging over a set of historical channel realizations, i.e., sample average. The approximation converges when the number of historical channel samples is sufficiently large. In particular, we denote the channel sample set as H T = {h t e,k } T t=1 with T samples, where h t e,k denotes the t-th channel sample of device k. We assume that these historical channel samples are available at the AP based on the previous measurements, as in [20]. With a set of channel samples, we adopt the following sample average to approximate f (m, v) As a result, we rewrite problem (9) Problem (13) is an MSE outage probability minimization problem, which is still highly intractable due to the following challenges. First, the indicator function is non-convex and discontinuous. Second, the unimodular constraint of the phase shift of each RIS element is not convex. Third, the optimization variables m and v are coupled in the objective function.

A. Sigmoid Function for Indicator Function
To deal with the discontinuiality of the indicator function I (0,+∞) (x), we adopt the smooth sigmoid function as its surrogate [20] S where x ∈ R. Although the sigmoid function is not convex, it is continuously differentiable and strictly monotonic increasing. With the smooth surrogate, problem (13) Problem (15) is a continuous stochastic optimization problem. The coupling between optimization variables m and v makes the problem difficult to be solved. In the following two subsections, we shall decouple the variables by alternatively designing the receive beamforming vector and the phase shift vector.

B. Receive Beamforming Vector Design
Therefore, problem (15) can be simplified as It is worth noting that h t k is obtained based on h t e,k . To facilitate efficient algorithm design, we definẽ We can equivalently express problem (16) in terms of real variables (i.e.,m andH k ) as where d(m;H k ) = m 2 − γ H T km 2 .

C. Phase-Shift Vector Design
On the other hand, for fixed m, we denote b k = m H h d,k ∈ C and a H k = m H Gdiag(h r,k ) ∈ C 1×M . Therefore, we rewrite d(m, v; h e,k ) as where We equivalently express problem (15) in terms of real variables (i.e.,ṽ,b k , andÃ k ) as subject to |ṽ m | 2 + |ṽ m+M | 2 = 1, m = 1, . . . , M. (25) Problems (19) and (25) are still non-convex. We shall develop an efficient alternating SVRG algorithm to solve both problems in the following section.

IV. PROPOSED ALTERNATING SVRG ALGORITHM
The objective functions of problems (19) and (25) (i.e., u 1 (m) and u 2 (ṽ)) are continuous and differentiable. Stochastic gradient descent (SGD) has been extensively applied to solve this kind of finite-sum-form problems [21]. However, inherent variance is inevitable, as SGD approximates the full gradient by a single gradient. To ensure convergence, the step size has to be decayed to zero. Thus, the SGD method suffers from slow convergence. Fortunately, the SVRG algorithm can effectively address this issue [22]. Although there is some loss in complexity, SVRG achieves a faster convergence rate than SGD. Hence, we propose an alternating SVRG algorithm to solve problems (19) and (25) alternatively until the convergence. Moreover, the mini-batch version of SVRG is adopted to further reduce the variance and enhance the parallelism [23].

A. Receive Beamforming Vector Optimization
In this subsection, we updatem by applying SVRG to minimize u 1 (m). Different from SGD, each epoch of SVRG has an inner loop. We denote R and Q as the number of epochs and the number of iterations in each epoch, respectively. Specifically, we randomly choose mini-batch samples I q ⊂ {1, · · · , T } for the q-th iteration in the inner loop and then updatem according to the following rulẽ where αm is the step size and g r+1 q is the descent direction of the (rQ+q)-th iteration (i.e., q-th iteration at the (r +1)-th epoch). In addition, g r+1 q can be calculated by where |I q | denotes the cardinality of I q and ∇u 1 (m r Q ) is the batch gradient computed at the end of the rQ-th iteration and used in the next epoch's Q iterations.
The gradient of S max k∈K d(m;H k ) is presented in the following lemma.
where k * = arg max k∈K d(m;H t k ). By substituting (28) into (27), we obtain g r+1 q , which can in turn be used to updatem according to (26).

B. Phase-Shift Vector Optimization
Similarly, we update the phase-shift vector by applying SVRG as follows where αṽ denotes the update step size ofṽ and (·) m represents the m-th component of a vector. Due to the unimodular constraint, we take an extra Euclidean projection onỹ r+1 q+1 to obtainṽ r+1 q+1 according to (31), where (ỹ r+1 The gradient of S max k∈K d(ṽ;Ã k ,b k ) is provided by the following lemma.
Lemma 2. The gradient of S max k∈K d(ṽ;Ã k ,b k ) with respect toṽ denoted as ∇ṽS max k∈K d(ṽ;Ã k ,b k ) is given by where k * = arg max k∈K d(ṽ;Ã k ,b k ).
The overall algorithm for solving problem (15) is summarized in Algorithm 1, where L is the number of the iterations that alternately optimize the two optimization variables. In this section, we present the simulation results of the proposed algorithm for AirComp in RIS-aided IoT networks. We consider a three-dimentional setting, where the AP and the RIS are located at (0, 0, 10) and (20, 10, 10) meters, respectively. Besides, K = 20 devices are randomly located at the square centered at (25, 5, 0) with side length 10 meters. In simulations, we take Rayleigh fading as an example to generate historical channel realizations. Note that, the proposed algorithm can be applied to any other fading models. The path loss of a link with length d is modeled as L(d) = d −β , where β denotes the path loss exponent. For the device-AP link, the RIS-AP link, and the device-RIS link, the path loss exponents are set to be 3.0, 2.0, and 2.2, respectively. We set the maximum transmit power of the AP and the noise power as P = 20 dBm and σ 2 = −60 dBm, respectively. We set the size of the historical channel set as T = 250. The step sizes are set to αw = 0.1 and αṽ = 0.01. Besides, we set L = 100, R = 200 and Q = 25.   The MSE outage probability decreases as the number of reflecting elements increases. This is because an RIS with more elements can better overcome the unfavorable channel conditions and achieve a higher received signal power, which in turn reduce the MSE outage probability of AirComp. In addition, the proposed algorithm achieves a lower MSE outage probability than the SVRG with random phase scheme , which highlights the importance of optimizing the phase shifts and shows that the proposed algorithm can effectively solve the stochastic optimization problem. probability decreases for both schemes under consideration. This is because, with more receiving antennas, a higher power gain can be achieved to mitigate the detrimental effect of noise, which in turn reduces the MSE outage probability. Fig. 3 illustrates the MSE outage probability versus threshold τ when N = 20 and M = 30. It can be observed that, with the increase of threshold τ , the probability that the achievable MSE is below τ decreases, which in turn decreases the MSE outage probability. In addition, we can also observe that deploying an RIS can significantly reduces the MSE outage probability, as RIS is capable of overcoming the unfavorable channel conditions, thereby eliminating the bottleneck of AirComp.

VI. CONCLUSIONS
In this paper, we investigated the MSE outage probability of AirComp in an IoT network with the assistance of an RIS. Without instantaneous CSI and any prior knowledge on the underlying channel distribution, we proposed a data-driven approach to jointly optimize the receive beamforming vector at the AP and the phase-shift matrix at the RIS, taking into account the maximum transmit power constraint and the unit modulus constraint. The sigmoid function was adopted to smooth the indicator function. We developed an alternating SVGR algorithm with a fast convergence rate to solve the original problem. Simulation results showed that deploying an RIS can significantly reduce the MSE outage probability by eliminating the bottleneck of AirComp and demonstrated the effectiveness of the proposed algorithm.