LAB: Learnable Activation Binarizer for Binary Neural Networks

Binary Neural Networks (BNNs) are receiving an upsurge of attention for bringing power-hungry deep learning towards edge devices. The traditional wisdom in this space is to employ sign() for binarizing featuremaps. We argue and illustrate that sign() is a uniqueness bottleneck, limiting information propagation throughout the network. To alleviate this, we propose to dispense sign(), replacing it with a learnable activation binarizer (LAB), allowing the network to learn a fine-grained binarization kernel per layer - as opposed to global thresholding. LAB is a novel universal module that can seamlessly be integrated into existing architectures. To confirm this, we plug it into four seminal BNNs and show a considerable performance boost at the cost of tolerable increase in delay and complexity. Finally, we build an end-to-end BNN (coined as LAB-BNN) around LAB, and demonstrate that it achieves competitive performance on par with the state-of-the-art on ImageNet.

Introduction
Convolutional Neural Networks (CNNs) dominate the current state-of-the-art computer vision tasks. With evolving research, models gained increasingly higher accuracy, but in parallel they have grown in size and complexity. This imposes a significant burden for deploying deep learning models on resource-constrained edge devices. Recent studies explore model compression techniques to reduce model size and latency, such as pruning [25], quantization [36], knowledge distillation [13], neural architecture search [10] and low rank approximation [38]. The most extreme form of quantization is realized by binarization, resulting in binary weights and activations {−1, +1}. Networks utilizing this are known as Binary Neural Networks (BNNs) and promise a bright future for energy-efficient deep learning. By quantizing weights and activations aggressively, one can theoretically achieve a memory reduction of 32× and a computational speedup of 58× on typical CPUs [31]. 1 This paper is accepted to appear in the proceedings of WACV 2023 The current consensus in literature is to use sign(.) as a mapping from the full-precision to binary values. However, this imposes three widely-known issues: (i) the representational power of sign(.) with respect to the floating point counterpart decreases from 2 32 to only 2 information levels [26]; (ii) the derivative of sign(.) is a Dirac Delta returning a zero gradient almost everywhere [7]; (iii) sign(.) spatially uses the same threshold everywhere, which we further refer to as the global threshold. In this work, we identify and debate about a fourth problem (iv) which we refer to as uniqueness bottleneck. Approaching the problem from both qualitative and quantitative angles, we demonstrate that using sign(.) further limits the representational capacity of the network. Interestingly, several studies state that sign(.) is a sub-optimal binarization operation and that it is not straightforward to find a new binarization function [6,34]. This is exactly why we embark on this challenge in this paper.
Multiple remedies have been proposed to cope with the aforementioned issues of sign(.), including the introduction of scaling factors [31], gradient approximation [29] and pre-binarization distribution shaping [18]. Amongst these directions, we believe that the pre-binarization reshaping shows the most potential to alleviate the information bottleneck of BNNs. However, in contrast to the existing studies, we argue that shaping the pre-binarization distribution is a means an the end, and not the end in itself. To address the issues enumerated, we design a learnable activation binarization function (LAB) to automate the mapping from the full-precision feature maps to the binary counterparts, so that the representational capacity of the network (compared to full-precision) is least impacted. This is shown schematically in Fig. 1 (and elaborated in Section 3), where application of a global sign(.) threshold on the diverse spectrum of values in the discrete feature maps results in similar looking outputs (acting like a diversity bottleneck), whereas LAB can potentially avoid such loss of information and reveal important features for later layers. Figure 1: All channels before and after the binarization step for the first binary convolution after model training. In contrast to sign(.), binarization using LAB does not map some of the discrete output feature maps into similar binary feature maps, but learns to distinguish important features during binarization, improving the information propagation capacity of the BNN.
Our contributions can be summarized as follows: • To the best of our knowledge, for the first time, we identify the uniqueness bottleneck imposed by the sign(.). We demonstrate that sign(.) limits the representational capacity of binary feature maps.
• To address this bottleneck, we introduce a novel learnable activation binarization: LAB. We show that LAB is a universal module that can readily be plugged into any existing BNN architecture, and improve its performance. Our experimentation on four seminal BNN baselines corroborates this claim.
• We build an end-to-end network around LAB (coined as LAB-BNN) and demonstrate that it offers competitive accuracy (64.2% Top-1 validation accuracy) on par with the state-of-the-art in this space on ImageNet.

Related Work
Current BNNs binarize the full precision weights and activations by applying sign(.) on them: where x b and x r denote the binary and real (full precision) values, respectively. Naively applying these quantizations to a CNN yields low accuracy and to close the gap between BNN implementations and their real-valued counterparts, several research directions have arisen: minimization of quantization error [7,31], loss function improvement [9,16,24], gradient approximation [21,24,29], different network architecture designs [5,8,17,24,26,41], training strategies [1,23,27,33] and binary inference engines [3,12,37,39]. Apart from these main directions, a few studies investigate new methodologies for binarizing weights and activations, which will be elucidated next.
Weight binarization. A novel approach for weight binarization is presented in [14] where both full precision and binary weights are employed as noisy supervisors for learning a mapping towards the final binary weights. As this mapping is learnable, it can exploit the relationships between weights. SiMaN [20] and RBNN [21] both propose a new binarization method based on so-called angle alignment between the full-precision and binary weights.
Activation binarization. One way to approach activation binarization is through classic computer vision techniques, such as dithering. This technique can binarize an image in a way that shifts quantization error towards higher frequencies. As the human visual system is more receptive to lower frequencies, the binarized image is perceived as having a low quantization error, and thus, carrying more information. A realization of this idea is called DitherNN but it only reports mild improvement [2]. Most activation binarization approaches focus on shaping the prebinarization distribution, from which a higher entropy can be achieved after binarization [29]. For instance, an extra regularization term is proposed in [9] to explicitly shape the pre-binarization distribution so that it counteracts degeneration, saturation, and gradient mismatch problems. It is argued in [18] that BNNs benefit from an unbalanced pre-binarization distribution. ReActNet [24] argues that BNNs benefit from learning a similar activation distribution as their full-precision counterparts. On a related note, Si-BNN [34] approaches the activation binarization problem from a somewhat different angle and introduces sparsity in the activation binarization process. Even though these studies show promising performance results for BNNs, we argue that changing the pre-binarization distribution is still a form of adaptive global thresholding, and thus a suboptimal approach. Therefore, the output feature map does not fully reflect on, and adapt to the local information of the input feature map.

Problem Formulation
In this section, we reflect on the limitation a sign(.) binarization function inflicts on a BNN. We examine the capability of the network to cope with the single threshold value of sign(.), which we refer to as global thresholding -given that its value is the same for all spatial dimensions. In practice, as the input feature map to sign(.) is the output of a previous (convolutional) layer, the kernel of that convolution will learn to push or pull parts of the output feature map above or beneath the global threshold value, resulting in the fact that the output feature map will be closely centered around the threshold value. The batch normalization layer can further guide this process by effectively shifting the threshold value. Although this combination is essential for the current learning process of BNNs, we argue that there still is a limitation in its efficacy. Fig. 2 explains what we perceive as the bottleneck in information propagation of BNNs. Here, A denotes the discrete input feature map to the binary convolution. Assume W's represent the set of all unique weight kernels one can imagine. Given a kernel size k, the number of input channels C, and a single output channel per kernel, the total number of unique W i 's, ∀i ∈ [n] will then be n = 2 k 2 ×C . The output feature maps D 1 to D n are discrete finite-alphabet tensors. Note that n in this case is smaller than the theoretical maximum number of unique activations N = (k 2 × C) H×W , given a specific input A. Impacted by the activation design of the previous layers, proper design of A could potentially minimize the gap between n and N . Applying sign(.) on D 1 to D n maps them to their binary counterparts B 1 to B n . In theory, it is possible to have n unique binary feature maps B i 's, ∀i ∈ [n], even though in practice, we show the fact that if we give W the freedom to take any value, the set of possible tokens of the output feature map is limited for the sign(.). Low diversity means that multiple distinct values of W will lead to an identical binary output, which will hinder the optimization of the model. We dub the aforementioned issue as the uniqueness bottleneck. We argue that due to this bottleneck, the network does not utilize its full potential and the representational capacity of the network is going to be impacted.
To demonstrate that this hypothesis is valid, we design a toy experiment that uses single-layer binary input feature maps A (in this case with C = 1) extracted from the binarized feature maps (using sign(.)) in a trained Bi-RealNet-18 [26]. Kernel size k is set to 3, which makes up for a total of 2 k 2 = 512 unique kernels. Following the steps sketched in Fig. 2, we take A as the starting point, convolve it with every possible kernel W i and binarize the output activations D i 's with the sign(.) function. We then count the number of unique binary feature maps B i 's, and average over all the channels (per different layers) of 20 different input images. We denote the ratio of counted unique feature maps (n c ), and theoretical total number of unique feature maps (n t ) as the uniqueness ratio η = n c /n t . The results are shown in Table 1. We can see that going deeper with convolutions, leading to smaller feature maps for layers 9 to 16, the uniqueness ratio decreases and the bottleneck becomes more evident. In the next section, we propose a learnable activation binarizer (LAB) as a remedy for this bottleneck.

The Proposed Method: LAB
One possible approach towards addressing the bottleneck of sign(.) binarization is to find a mapping from full-precision activation values to corresponding binary values, in such a way that the embedded spatial information from the input feature map is preserved. To do so, we propose to forge a different path in contrast to the current wisdom of activation distribution shaping [9,18,24]. More concretely, we propose a novel learnable activation binarizer (LAB) to learn a binarization kernel per layer, as shown in Fig. 3. The figure demonstrates LAB as a building block of a standard BNN. Zooming into the LAB unit, as we need to apply channel-wise binarization like sign(.), the input is first reshaped for per-channel operations. To capture local spatial information per channel, a 3 × 3 depthwise convolution with a channel multiplier of 2 is applied. The core idea behind this channel doubling is to construct a miniature segmentation layer within the LAB unit to classify the input as −1 or +1. This classification is done through an ArgMax(.) across both channels, reducing the feature map back to a single output channel which is finally reshaped back to its original size. As the ArgMax(.) is non-differentiable, we apply the Soft-ArgMax(.) for the backward pass [11]. Given that we are dealing with only two classes, the Soft-ArgMax(.) in (2) simplifies to a single entry of the SoftMax(.) with an extra temperature controlling parameter β which controls the "hardness" of the ArgMax(.) approximation: The new binarization approach is only used for binarization of the feature maps and not for the binary convolution kernels, because the kernels do not contain enough spatial information for LAB to capture.  LAB ensures that the issues (ii), (iii) and (iv), introduced in section 1 are solved. The learnable depthwise kernel ensures that the binary value of a pixel is dependent its neighbouring pixels. Because of this property, more diverse binary feature maps will be constructed, resulting in lifting of the uniqueness bottleneck. We realize that the introduction of a full-precision depthwise convolution adds additional complexity to the network. However, we argue that the network with LAB is still a BNN, as the main convolutions are still binary; the depthwise convolution is an intermediate operation which is more often kept in full-precision in existing literature [20,21,25,27].

Experimental Evaluation
In this section, we first reflect on the experimental setup. Next, we analyze the uniqueness bottleneck and how employing LAB can help alleviate the problem. We then show that LAB is beyond a one-off remedy but more of a universal module that can straightforwardly be plugged into existing baselines. Finally, we propose an end-to-end model architecture (LAB-BNN) revolving around LAB offering competitive performance against state-of-the-art.

Experimental Setup
To be able to compare against a variety of existing stateof-the-art baselines -also to allow for a wider adoption by the community -we implement LAB both in PyTorch and TensorFlow. For comparison with the state-of-the-art baselines, the TensorFlow-based Larq framework [3] is used.
Network structure. To show the versatility of LAB, we plug it into four different architectures. First, XNOR-Net [31], is chosen to examine the improved information flow on an AlexNet-based architecture [19] with no skip connections. Then, Bi-RealNet [26] and ReActNet [24] are used for their ResNet [15] and MobileNet [17] backbones, respectively. Finally, QuickNet [3], an improved version of Bi-RealNet, is used to assess whether LAB can make an impact on a top performing state-of-the-art network.
Proposed end-to-end network: LAB-BNN. Going beyond the proposed module LAB, we also design an endto-end network based upon the architecture of Bi-RealNet-18 2 , which is further enhanced by combining PRelu in [7,24,27,33] and initial layers (further referred to as the STEM) as proposed by QuickNet [3].
Hyperparameters. All experiments are conducted using 4 NVIDIA GeForce GTX 1080 Ti GPUs and follow standard settings in Larq [3], unless otherwise mentioned. To reproduce nominal reported performance, we used a batch size of 128 and a learning rate of 1e −4 for the retraining of XNORNet. For Bi-RealNet a batch size of 256 and learning rate 2.5e −3 was used. For Quicknet we used a batch size of 512 and a learning rate of 2.5e −3 . Lastly, we re-trained ReActNet-A from scratch with a batch size of 128 and learning rate of 2.5e −3 . LAB-BNN uses a batch size of 256 and learning rate of 2.5e −3 and is trained from scratch for 300 epochs. We chose to train from scratch as recent studies [4] suggest that multi-stage training is not needed for high accuracy models, and that it simplifies the training process significantly. The temperature controlling parameter β of the Soft-ArgMax(.) is made a learnable parameter, initialized with the value 1.0.
Real-time inference on the edge. The research in BNNs is focussed on bringing deep learning to resourceconstrained edge devices. Recent studies report the computational complexity of their models using theoretical metrics such as floating-point operations (FLOPs) [24,27] multiplyaccumulate (MACs) [4] or arithmetic computation effort (ACE) [40]. In coherence with [3,30] we argue that latency is the best metric to compare model performances.
In order to benchmark model latency, we use a resourceconstrained edge computing device, Nvidia Jetson Xavier NX 3 development kit, which is an ARM-based board for development of embedded AI systems. Although this device has a built-in GPU, for the benchmarking exercise we only use the CPU. Thus, these benchmarks can be reproduced on commodity ARM64 devices. To convert models from TensorFlow to Jetson-compatible models, we use the Larq Compute Engine Converter [3], which outputs a Ten-sorFlow Lite (TFLite [22]) model. This model can now be evaluated using a Larq benchmark tool [3] adapted from the TFLite benchmark 4 . For all the benchmarking experiments, the power mode of the Jetson is set to 15W, we use the single thread mode, and report values averaged over 50 runs.

The Uniqueness Bottleneck: Qualitative and Quantitative Analysis
In section 3, we have shown that sign(.) can introduce a bottleneck in reaching the theoretical maximum number of unique binary states, which we argued would limit the capacity of BNNs. Here, we adopt a smallscale experiment (followed by large-scale end-to-end experiments in the next subsection) to qualitatively and quantitatively demonstrate that LAB reduces this bottleneck. To  Fig. 4 and Table 2. The figure depicts the selected feature maps from layer 1 and 6 (out of 18 layers). As can be seen, more structural information is preserved in layer 1 of LAB compared to sign(.), even though the features become too abstract for human understanding as we go to the deeper layer 6. The most important takeaway from Fig. 4 is to understand that LAB, in contrast to sign(.) can distinguish between similar pixel values (e.g. shades in the lemons and different tints of blue in the watch). Besides the qualitative demonstration, the impact of LAB is further quantified on the number of unique feature maps learned by both networks through two (dis)similarity measures: structural similarity loss (SSIM) [35] and a custom-designed metric we call Euclidean norm dissimilarity (ENDSIM), given by: where W and H denote the width and height of the input images in pixels and A i and A j , are different single channel feature maps being compared. The metric has two terms in which the first term measures discrepancy, and the second one ensures fully inverted feature maps are not penalized. The latter is because inverted feature map layers along the channels can occur but do not indicate structural differences. Both measures are computed and averaged over all possible combinations of feature map layer pairs across all the 16 convolutional layers of 10 randomly selected images of ImageNet passed through both networks. The results are summarized in Table 2, and as can be seen, except for the first layer, LAB shows higher dissimilarity values (a lower SSIM and a higher ENDSIM) indicating more uniqueness along the channels.

LAB: A Universal Module
The proposed method LAB can readily be applied to any BNN, with no architectural adjustments. In this subsection, we demonstrate this by replacing the sign(.) with LAB in four seminal BNN architectures and evaluate the impact on the downstream classification task of ImageNet. The results are illustrated in Table 3. As can be seen, at the cost of negligible increase in model size and tolerable increase in delay (max of 2x in [ms]), the boosted architectures XNORNet, Bi-RealNet, QuickNet, and ReActNet offer 3.3%, 7.9%, 3.8% and 1.7% improved Top-1 accuracies, respectively. The performance boost is slightly less pronounced for Top-5 accuracies. Note that the number of required training epochs to reach the nominal performance is dependent upon the architecture itself. The key message from this experiment is that irrespective of the backbone and architecture design, LAB makes a considerable impact on all architectures.

Comparison Against State-of-the-Art
Now that the universality of LAB has been shown, the efficacy of the proposed end-to-end network (LAB-BNN) with LAB sitting at its core, is evaluated. We compare the performance of LAB-BNN against the state-of-the-art baselines focused on activation binarization. For fair comparison, we focus on reported Top-1 and 5 validation accuracies on Ima-geNet with a ResNet-18 backbone. The outcome is summarized in Table 4. Both Top-1 and 5 results are competitive with the state-of-the-art and come short of the full precision equivalent network by only about 5%. Notably, ReActNet reports a higher accuracy (that we could not reproduce in TensorFlow) in part owing to adopting a multi-stage training strategy, whereas LAB-BNN is trained from scratch.
Aside from accuracy, the time and computational complexity of a BNN is just as important, even though most existing baselines overlook the importance of these metrics and sometimes do not even report them. Following [24], in Table 4 we report the total binary and floating-point operations (OP = BOP/64 + FLOP). Here, we achieve a lower total computational complexity (in FLOPs) compared to other baselines including the original Bi-RealNet. To further break this down, in Table 5 we set Bi-RealNet as our reference and state the added (+) complexity per operation listed in the second column. Even though the mechanics of LAB adds slight complexity, we compensate for this with a more efficient implementation of the STEM layer [3] leading to an overall decrease of 73.16 × 10 6 in total FLOPs. Post-binarization distribution. To illustrate that the post-binarization distribution is not a telling factor about the performance of the network (in contrast to conclusions drawn in [9,18,24]), Fig. 5 shows the post-binarization distribution of +1's and −1's for original Bi-RealNet-18 and Bi-RealNet-18+LAB averaged over all channels of 1000 input images. As can be seen, while the distribution of binary values remains almost the same across both networks, the performance of the two (reported in Subsection 5.3) is apart by 7.9%, supporting our claim that the binary distribution is not important, but the spatial arrangement of pixels is.
Going deep or going LAB? Plugging LAB into the standard Bi-RealNet (our base to build LAB-BNN) adds additional complexity to the network, and one could argue that adding the kernel of LAB per layer could virtually help make the network deeper. However, as a counter-argument, we compare LAB-BNN against a Bi-RealNet with a deeper backbone. More specifically, in the current construct, our method adds a depthwise convolution for each binary layer in Bi-RealNet-18. This is (roughly) equivalent to addition of 16 convolution layers, yielding a total of 18 + 16 = 34 layers. According to [26], Bi-RealNet-34 and Bi-RealNet-50 respectively achieve 62.2% and 62.6% validation accuracies on ImageNet which are both still below the accuracy of LAB-BNN. Furthermore, the model size of BiRealNet-18+LAB is 4.24MB (FP32 weights for depthwise kernel), whereas BiRealNet-34 occupies 5.23MB. Thus, we are offering smaller model size and higher accuracy. To assess the impact of precision on the accuracy gain of LAB, we evaluated the depthwise convolution kernel of LAB for different bit widths. The results summarized in Table 6 indicate that going down from FP32 to INT8, the impact of LAB does not degrade, and even INT4 still offers a significant gain over no-LAB baseline.
Comparison against local thresholding We compare LAB against classical local binarization techniques, to show that LAB adheres to the common wisdom that learnable approaches outperform statistical approaches. We implement Niblack [28] and Sauvola [32] and use a window size of 3 and common values for k. Table 7 shows LAB has a gap of 11.5% with Niblack and improves with 2.7% over the best configuration for Sauvola.

Ablation Studies
In this section, the effect of different components of LAB-BNN is further inspected. In what follows, we use the same settings listed in Section 5.1, except for the number of epochs which are shortened to 30. We start with the original Bi-RealNet-18 (model A) and update the components progressively towards LAB-BNN (model D). We first upgrade model A by incorporating PRelu activation [33] resulting in B. Model B is then extended by replacing sign(.) by the proposed LAB module leading to model C. Lastly, we replace the initial convolution in Bi-RealNet with the STEM layer of QuickNet [3], which forms LAB-BNN (model D). The results are illustrated in Table 8. Plugging LAB into model B results in an improvement of about 6% on the Top-1 validation accuracy (and roughly 5% for Top-5), at an increase of 0.46MB in model size and 28.5ms in latency. To make up for the added latency, we apply the STEM layers as proposed by QuickNet [3] which results in decreasing the latency with respect to model A down to 9.7ms. To provide further insights into the distribution of peroperation latencies, in Fig. 6 we profile the network delays for models A to D. In other words, this is a fine-grained visual breakdown of the total latencies reported in Table 8. The depthwise convolution together with the ArgMax(.) operation in LAB are the main culprits behind the added latency. Additionally, it is clear that the STEM layer indeed helps to alleviate the overall latency as discussed in Table 8.  So far, when applying LAB, all instances of sign(.) in every binary layer of the network were replaced with LAB. For the architecture Bi-RealNet-18, this means for all of the four residual blocks, in all four convolutions per block. As we saw in Table 1, the uniqueness bottleneck is mainly visible in later layers. Therefore, in Table 9 we assess in which combination of blocks (out of 16 possible combinations) it is most impactful to apply LAB as a binarization function. In doing so, we apply LAB on all layers per selected block. The networks are trained for 30 epochs and we report Top-1 and Top-5 validation accuracies, model size and and latencies. We conclude from the table that omitting LAB (using the original sign(.) everywhere) leads to the worst results, and see that as we apply LAB in more blocks progressively, the accuracy increases, and applying LAB to every block gives the highest accuracy. Interestingly, the model with LAB applied to the last 3 blocks (in the second row) has an exceptional accuracy-latency trade-off. Table 9 shows that by applying LAB in different blocks across the network, it is possible to design a network with a certain accuracylatency trade-off, which gives useful design freedom for the practical use cases of BNN's.

Concluding Remarks
We have shown that the commonly adopted binarization operation sign(.) imposes a uniqueness bottleneck on BNNs, making it a sub-optimal choice for binarization. As a remedy, we introduce learnable activation binarizer (LAB), a novel binarization function that allows BNNs to learn a flexible binarization kernel per layer. We have demonstrated that LAB can readily be plugged into existing baseline BNNs boosting their performance regardless of their architecture design. Beyond that, we have also built a new end-to-end network (LAB-BNN) based upon LAB that offers competitive performance on par with the state-of-theart. For future work, we will investigate applying learnable binarization to weights in addition to activations. We also plan to further extend our experimentation especially around LAB-BNN to push the performance boundaries and advance the state-of-the-art.


extfieldsofstudy: Engineering Physics

text:
Modeling and Analysis of Metasurface-Based STAR-RISs

The reconfigurable intelligent surface (RIS) is a promising technology to provide smart radio environment. In contrast to the well-studied patch-array-based RISs, this work focuses on the metasurface-based RISs and simultaneously transmitting and reflecting (STAR)-RISs where the elements have millimeter or even molecular sizes. For these meticulous metasurface structures, a continuous electric current distribution should be adopted for capturing their electromagnetic response instead of discrete phase-shift matrices. Exploiting the electric current distribution, a Green's function method based channel model is proposed. Based on the proposed model, performance analysis is carried out for both transmitting/reflecting-only RISs and STAR-RISs. 1) For the transmitting/reflecting-only RIS-aided single-user scenario, closed-formed expressions for the near-field/far-field boundary and the end-to-end channel gain are derived. Then, degrees-of-freedom (DoFs) and the power scaling laws are obtained. It is proved that the near-field channel exhibits higher DoFs than the far-field channel. It is also confirmed that when communication distance increases beyond the field boundary, the near-field power scaling law degrades to the well-known far-field result. 2) For the STAR-RIS-aided multi-user scenario, three practical STAR-RIS configuration strategies are proposed, namely power splitting (PS), selective element grouping (SEG), and random element grouping (REG) strategies. The channel gains for users are derived within both the pure near-field regime and the hybrid near-field and far-field regime. Finally, numerical results confirm that: 1) for metasurface-based RISs, the field boundary depends on the sizes of both the RIS and the receiver, 2) the received power scales quadratically with the number of elements within the far-field regime and scales linearly within the near-field regime.

I. INTRODUCTION
The sixth-generation (6G) wireless communication networks are envisioned to deliver significant performance improvements beyond existing technologies [1]. To sustainably achieve these goals, a promising way is to rely on new physical layer technologies. Recently, reconfigurable intelligent surfaces (RISs) have been proposed [2]. Consisting of a large number of passive reflective elements, an RIS can dynamically adjust the phase-shift of the reflected signals. Specifically, owning to the remarkable development of metasurface technologies over the past decade, it is now possible to accurately control the electromagnetic signal on sub-wavelength scale [3]. Thus, wavefront shaping for radio-frequency waves, millimeter waves, and even optical waves has become possible exploiting RISs with different period sizes [4]. To further J. Xu extend the coverage of RISs to full-space, a novel category of simultaneously transmitting and reflecting (STAR)-RISs has been proposed [5]. By facilitating both transmission and reflection of the incident signals on each element, STAR-RISs can simultaneously reconfigure the channels of multiple users located on different sides of the surface. This also removes the unnecessary topological constraint which often appears in the deployment of transmitting/reflecting-only RISs [6]. The smart radio environment coverage enabled by conventional RISs and STAR-RISs has attracted significant research interests. Among these research activities, the channel modeling and performance analysis of conventional RISs and STAR-RISs are the most fundamental aspects. In the following, we briefly introduce these existing works.
A. Prior Works 1) Conventional RISs: Depending on the location of the receiver, wireless communication might occur in the far-field regime or the near-field regime of an RIS. The boundary between these two regimes is usually considered to be 2L 2 /λ, where L is the largest dimension of the RIS and λ is the wavelength of the carrier signal. The far-field performance of reflecting-only RISs has been thoroughly studied in the pioneering studies [4,7]. Recently, increasing research interests have been focusing on the near-field performance of RISs or intelligent reflecting surfaces (IRSs). In [8], the near-field power scaling law and finite asymptotic SNR limits were derived. In [9], the power scaling law for optical IRSs was studied. In [10], the achievable near-field degree-of-freedom (DoF) and gain for large intelligent surfaces (LISs) were derived. It is proved that the Friis' formula is no longer valid within the near-field regime.
2) STAR-RISs: Motivated by the aforementioned favorable characteristics of STAR-RISs, extensive research efforts have been devoted to exploiting STAR-RIS in existing wireless technologies, such as non-orthogonal multiple access (NOMA) [11], full-duplex communications [12], and federated learning [13,14]. For STAR-RIS-aided wireless communication within the far-field regime, existing works modeled patch-array-based STAR-RISs using transmission and reflection (T&R) coefficients. In [5] and [15], independent and coupled phase-shift models was proposed for STAR-RISs. For the optimization and performance analysis, existing works optimized the far-field multi-user communication for different objectives. In [16], the active beamforming at the base station and the passive beamforming at the STAR-RIS were studied for minimizing the transmit power with three proposed STAR-RIS operating protocols. In [17], the fundamental coverage performance of STAR-RIS-assisted communications was investigated. In [11], the STAR-RIS-assisted multi-user NOMA communication system was studied where a suboptimal twolayer iterative algorithm was proposed for maximizing the sum rate. For the STAR-RIS-aided wireless communication in the near-field regime, [5] proposed a near-field channel model based on the Huygens-Fresnel principle and the Kirchhoff's diffraction formula.
Anther important topic is the study of the power scaling law and near-field performance of RISs and STAR-RISs. One major benefit of RISs is that the received power scales with the square of the number of elements, i.e., O(M 2 ) [18]. Thus, by accommodating more elements on the surface and increasing the size of the RIS, the transmit power can be reduced by 1/M 2 [8]. For STAR-RISs, the O(M 2 ) power scaling performance can be simultaneously achieved for users on both sides if energy splitting mode [16] is adopted for the STAR-RIS elements. However, these power scaling laws are only valid within the far-field regime. For near-field scenarios where the aperture area smart surface is larger and the carrier frequency of the information bearing signal is higher, the received power may scales linearly or may even saturate at a constant value [9]. In the meantime, there are also favorable aspects which the near-field regime can benefits wireless communication, such as a higher degree-of-freedom (DoF) compared to the far-field channel [10].

B. Motivations and Contributions
Note that hardware implementations of RISs and STAR-RISs can be classified into two major categories, namely patcharray-based RISs and metasurface-based RISs [19]. Specifically, patch-array-based RISs/STAR-RISs consist of periodic cells having sizes on the order of a few centimetres and the cells can be made tunable by accommodating diodes or delay lines. By contrast, matasurface-based RISs/STAR-RISs have cells on the order of a few millimetres, or even molecular sizes. While various research contribution focused on patcharray-based RISs and STAR-RISs [6,[11][12][13][14][15][16][17]20], the modeling and analysis of metasurface-based RISs and STAR-RISs are still in their infancy. Due to their small period structures, the metasurface-based RISs and STAR-RISs can be employed for wireless communication in high carrier frequencies [4,19], such as millimeter wave (mmWave) and terahertz (THz) frequency bands. As a result, their near-field effects are more dominated than their patch-array-based counterparts (the nearfield regime is larger). However, the aforementioned works on near-field analysis [5,8,9] mainly focused on the patcharray-based RISs. As summarized in Table I, there is a lack of comprehensive study on the channel modeling of metasurface-based RISs and STAR-RISs, which provides the main motivations of this work.
To reveal the fundamental performance limit of metasurfacebased RISs and STAR-RISs within both the far-field and the near-field regimes, we propose a general modelling method by characterizing the RIS elements using a continuous current distribution within each element. By exploiting this currentbased characterization of RISs and STAR-RISs, we propose a channel model based on the Green's function method. The channel modeling is carried out by integrating the contribution  [4,8,9] [5] Metasurface-Based Far-Field This work Near-Field for all induced currents within the volume of the receiver. In contrast to the phase-shift characterization, this channel modeling method reveals the best-achievable RIS-aided channel gain between the transmitter and receiver in both the near-field and far-field regimes. The main contributions of this work can be summarized as follows: • We propose a novel channel model for metasurface-based RISs and STAR-RISs, where we exploit the Green's function method and the current-based characterization for the elements. We illustrate how transmitting-only RISs, reflecting-only RISs, and STAR-RISs can be achieved by configuring the current distributions. We then analyze the near-field and far-field performance in both the transmitting/reflecting-only RISs-aided single-user scenario and the STAR-RIS-aided multi-user scenarios. • For transmitting/reflecting-only RIS-aided single-user scenario, we derive the position of the field boundary by taking into account the size of both the RIS and the receiver. We also derive the fundamental performance limits of RIS-aided communication in terms of the maximum end-to-end channel gain, DoF, and the power scaling law. These obtained near-field metrics are then compared with those in the far-field regime. Specifically, we show that the received power scales linearly with the number of elements within the near-field regime and scales quadratically within the far-field regime. • For STAR-RIS-aided multi-user scenario, we propose three practical configuration strategies for employing STAR-RISs, namely power splitting (PS), selective element grouping (SEG), and random selective element grouping (REG) strategies. We derive closed-form expressions for the channel gain of each proposed strategies within the pure near-field regime. We also evaluate the performance of STAR-RIS in the hybrid near-field and far-field regime, where the STAR-RIS is deployed to assist one near-field user on the transmission side and one far-field user on the reflection side. The channel gains for both users are derived for the case without STAR-RIS and for the case with STAR-RIS under three proposed configuration strategies. • Our simulation results verify that 1) for metasurfacebased RISs with larger sizes and receivers with larger aperture areas, the near-field regime expands and the field boundary is further away from the RIS, 2) for the STAR-RIS-aided multi-user pure near-field communication scenario, the SEG strategy has the best sum rate performance of all three strategies but yields lower DoFs for the endto-end channel, and 3) for the STAR-RIS-aided multiuser hybrid near-and far-field communication scenario, STAR-RIS can significantly increase the channel gains of users and thus can improve the signal coverage especially in the indoor "blind zone".

C. Organization
The rest of this paper is organized as follows: Section II introduces the Green's function method, based on which the channel model for metasurface-based RISs and STAR-RISs is proposed. Section III analyze the fundamental performance limits in the transmitting/reflecting-only RIS-aided singleuser scenario. The upper bound of the end-to-end channel gain, DoF, and the power scaling law are given. In Section IV, the three proposed configuration strategies for STAR-RIS-aided multi-user communication scenario are given. The performance analysis is carried out in both pure near-field regime and hybrid near-and far-field regime. Finally, Section V provides numerical results to verify our theoretical analysis.

II. A GREEN'S FUNCTION METHOD BASED CHANNEL MODEL FOR METASURFACE-BASED RISS AND STAR-RISS
In this section, we give the general formulation of the Green's function method based channel modeling method for metasurface-based STAR-RISs, where transmitting/reflectingonly RISs can be regarded as a special case. Then, we present the current-based characterization of STAR elements and the channel model for both near-field and far-field regimes. We then show the differences and connections between the proposed model and the transmission and reflection (T&R) coefficients based channel model for patch-array-based STAR-RISs, which was previously given in [5]. Finally, we give an example on how reflecting-only RISs, transmitting-only RISs, and STAR-RISs can be modeled with different equivalent current distributions.

A. The Green's Function Method
We denote the volume (space) occupied by the STAR-RIS (or RIS) as V T and the volume of the receiver as V R . The EM response of STAR-RIS can be characterized using equivalent current distribution within V T . According to electromagnetic (EM) theory, the reflected/transmitted EM field in the region outside of V T can be calculated using the electric current J(r ′ ), where r ′ is the position of the source point within V T . Particularly, exploiting the Green's function approach, the electric field vector at field point r (position of the receiver) is given by [21,Eq. (9)]: where G(r, r ′ ) is the tensor Green's function. The exact form of G(r, r ′ ) depends on the boundary conditions and the position of the user [21]. If multiple users are involved, each of them corresponds with a different Green's function.

B. Current-Based Characterization of STAR-RIS Elements
In this work, the STAR-RIS is characterized using the strength and phases of the equivalent current, i.e., J(r ′ ). Its distribution depends on the incident field and the surface impedance configuration of the STAR-RIS elements. In prior works, the patch-array-based STAR-RIS is modeled using the transmission and reflection (T&R) coefficients of each element [5,15]. Note that the T&R coefficient of each patch is the macroscopic effect of the microscopic electric currents induced within each STAR-RIS element. For the purpose of obtaining fundamental performance limit for metasurface-based STAR-RIS, in this work, we use the equivalent current-based characterization. However, the T&R coefficients characterization for the mth element can be related to the equivalent current-based characterization through the following integration: where |E| denotes the complex amplitudes of a field, r T and r R are the reference point on the transmission/reflection side of the STAR-RIS, J(r ′ ) is the electric current induced by a normalized incident field, and V m is the volume of the mth element. In practice, the induced current J(r ′ ) can be configured by adjusting the electric impedance of the STAR-RIS elements [22]. Thus, using the equivalent current instead of the T&R coefficients, we can obtain more fundamental performance limits of STAR-RISs 1 .

C. Channel Model
As illustrated in Fig. 1, we consider a STAR-RIS centered at the origin of the coordinate. With the assistance of a STAR-RIS, a single antenna base station (BS) communicates with receivers which are located on the x − z plane. We assume that the BS is located in the far-field of the STAR-RIS and the receivers are within the near-field of STAR-RIS. Consider the case of a vertically polarized wireless signal, the equivalent electric currents induced within V T are in the y-direction, i.e., J(r ′ ) =ŷJ y (r ′ ), and the electric field they generate at receiver i is E (i) (r) =ŷE (i) y (r). According to (1), these received fields are given by: where G (i) yy is the (y, y)-element of the Green's tenser for receiver i. For free space transmission, we have [23]: where µ 0 and ǫ 0 are the free space permeability and permittivity, respectively, ω and k are the signal frequency and wave number, respectively. Next, we formulate the received power at the receiving volume V R . To obtain the largest received power possible, J y (r ′ ) must be configured such that the electric field it 1 The current distribution provides a more detailed EM-response than the element-wise T&R phase-shift coefficients. The phase-shift model uses only a single phase-shift value for the entire element, thus ignoring the phase difference of the electric fields within each element. Also, in existing models, the phase-shift coefficients are assumed to be the same for receivers in different directions, although this is not the case in practice. generate, according to (4), yield the largest integrated E-field magnitude within V R , i.e., For brevity, we omit the index (i) for the ith user and give the end-to-end channel gain between the BS and V R in the following lemma: The maximum magnitude of the end-to-end channel gain between the BS and the receiving volume (V R ) is given as follows: where D is the directivity of the BS antenna, A T is the aperture size of STAR-RIS facing the base station, d is the distance between BS and STAR-RIS, J y (r) is the normalized current distribution within V T , i.e., < j 1 , j 2 >= Vt j T 1 j * 2 dV T = 1, A T is the transpose of vector A, * denotes the complex conjugate, and Proof. The channel gain can be expressed as the product of two parts, D AT 4πd 2 is the maximum channel gain between BS and the STAR-RIS, and |h T-to-R | 2 is the gain between STAR-RIS and a receiver. For the first part, according to the Friis' formula, the received power from a far-field antenna with a directivity of D is P r = D AT 4πd 2 P t , where P t is the transmit power. For the second part, the proof is straightforward by substituting (4) into (6): Since in (9), only the Green's functions G yy are functions of the field point r, the integral within V R can be evaluated separately as a kernel, i.e., K(r ′ 1 , r ′ 2 ). Remark 1. The kernel function can be understand as a measurement of the coupling strength of two source point (located at r ′ 1 and r ′ 2 ) which is then averaged within V R . According to its definition, , and thus is diagonalizable under a complete set of basis functions in V T . According to linear algebra [24], the quantity in (7) is maximized when J y (r ′ ) is chosen to be the eigenfunction of K(r ′ 1 , r ′ 2 ) with the largest eigenvalue. In other words, we have the following relation for In practice, J y (r ′ ) is determined by the phase-shift configuration of the STAR-RIS elements and the kernel K(r ′ 1 , r ′ 2 ) is determined by the positional information of the receiver as well as the environment. In addition, the DoF of the end-to-end channel is related to the number of eigenfunctions of the kernel function in (10) with substantially large eigenvalues [25]. In the following sections, we can obtain the closed-form channel gain by choosing different current distribution J y (r ′ ) for transmitting/reflecting-only RISs and STAR-RISs.

D. Modeling of Reflecting-Only RISs, Transmitting-Only RISs, and STAR-RISs with Equivalent Current Distributions
Before commencing with deriving the closed-form channel gain for the metasurface-based RISs and STAR-RISs, we elaborate on the relation between the distribution of J y (r ′ ) and the types of RISs, i.e., reflecting-only RISs, transmittingonly RISs, and STAR-RISs. As shown in (2) and (3), the T&R coefficients are determined by the distribution of J y (r ′ ) within each macroscopic element (V m ). To give the readers a better idea of the Green's function-based channel model, we give examples of the exact distributions of J y (r ′ ) which corresponds to the different RIS types.
As shown in Fig. 2, the considered element is centered at the origin and one/two receivers are located on the z-axis with distances R 0 to the element 2 . Assume that the width of the element ∆z = λ/4 and the size of the element is small compared to R 0 . Thus, according to the kernel function can be reduced to a function of z ′ , i.e., G yy ( In this example, we consider that the induced currents are only present on the front and back surfaces of the element. As illustrated in Fig. 2, we denote the surface density of the currents on the incident side and on the transmission side as J 1 and J 2 , respectively. Under these assumptions, the integration in (2) and (3) simply reduce to two-sum: Note that both J 1 , J 2 , and G yy are complex values with amplitudes and phases. Exploiting the fact that R 0 ≫ ∆z and e jk∆z = e jπ/2 , the macroscopic T&R coefficients of this element can be further simplified as: where G 0 = β 2 e |R0−∆z/2| /(4πR 0 ). Here, (13) reveals the relation between the surface current configuration, i.e., J 1 , J 2 and the T&R coefficients. Suppose that the surface currents have the same amplitudes and we rewrite them as J 1 = |J 0 |e jφ1 and J 2 = |J 0 |e jφ2 . The reflecting-only RISs, transmitting-only RISs, and STAR-RISs can be modeled by the phase differences of the currents, i.e., φ 1 − φ 2 , according to Table II. Note that the configuration shown in the above table are not the only way to achieve these three RIS types. In practice, the current may exhibit a continuous distribution within each element and have x and z components as well. As a result, the STAR-RIS elements can potentially achieve more complex and intricate phase-shift control. For example, the overall T&R coefficients for an element may change with the angle of arrival or different polarization of the incident signal [26]. In this work, we only focus on scalar currents, i.e., J(r ′ ) =ŷJ y (r ′ ).

III. FUNDAMENTAL PERFORMANCE LIMITS OF TRANSMITTING/REFLECTING-ONLY RIS-AIDED SINGLE-USER SCENARIO
Exploiting the proposed channel model, we first analyze the fundamental performance limits for transmitting-only and reflecting-only RISs, including the best achievable end-to-end channel gain, the maximum degrees of freedom of the endto-end channel, and the power scaling law. The performance analysis of STAR-RIS-aided multi-user scenario is presented in the next section. As illustrated in Fig. 3, assume that the user is located in the x-z plane. Thus, the kernel function defined in (8) can be calculated since the geometry of the problem is given. Exploiting (5), the kernel function should take the following form: where β = jωµ 0 + k 2 jωǫ0 .

A. Field Boundary
In previous studies, the field boundary is usually considered to be r b = 2L 2 λ [27], where L is the largest dimension of the smart surface aperture. However, this result does not considered the angular position of the receiver, nor the physical size of the receiver. In our work, we investigate the field boundary exploiting the kernel function given in (14). For a receiver to be located within the far-field regime of the RIS, the phase-term in (14) should not vary within the receiving volume V R [25, eq. (88)]. At the same time, the phase-term should also stay roughly constant for any two source point r ′ 1 and r ′ 2 within V T . If we use half of a period as the criteria, we have the following: where ∆x T,max , ∆y T,max are the largest dimensions of V T in the x/y direction and ∆x R,max , ∆y R,max are the largest dimensions of V R . By multiplying these results, we have the following lemma: The boundary between the radiating near-field and far-field, i.e., the maximum distance for near-field communication is given by: or equivalently, for a user with a distance of r to fall within the far-field regime of the RIS, the maximum volume of the RIS is given as follows: where z T,max is the maximum width of the RIS.
Proof. The proof is straightforward by multiplying the results in (15) and exploiting the fact that k = 2π/λ.

Remark 2.
According to Lemma 2, the field boundary not only depends on the size of the RIS, but also on the carrier frequency and the aperture size of the receiver. The near-field region expands with the increase of carrier frequency and the size of the receiver. For example, if the receiving device is also a large intelligent surface (LIS), then the field boundary r b will be significantly larger so that near-field effect need to be considered. In Table III, we provide the value of r b for several typical communication scenarios. As can be observed from the table, for wireless communication in higher frequency, the volume of usable near-field regime is significantly larger. Moreover, for visible light frequency, if the RIS dimension is still considered to be in the order of magnitude of meters, the position of the field boundary is farther than any practical communicating distances. This indicates that near-field effect should always be considered for visible light communication. As will be discussed in later sections, the near-field channel has higher degrees of freedom compare to the far-field channel.

B. An Upper Bound of the End-to-End Channel Gain
According to previous results discussed in Remark 1, to obtain the best available received power for the receiver V R , we need to find the eigenfunction and eigenvalues of i.e., to solve for J y (r ′ 1 ) in the integral equation (10). In order to keep our derivations cleaner, we simply the kernel function. Recall in (8), the kernel function measures the averaged received power (within V R ) for two source point. If r ′ 1 and r ′ 2 are two far away from each other, their corresponding kernel will tend to zero due to the fast oscillating phase terms in (14). As a result, in (7), the integral can be separately evaluated within smaller volumes of sizes ∆V T whose size is given in (17). Since we are now evaluating the integral in smaller volumes, we can assume that each volume of ∆V T and V R are far apart compared with their sizes. As a result, exploiting the paraxial approximation, the kernel function can be expressed as follows [25]: where is the focusing phase function within V T and r is the distance between the chosen small volume of ∆V T and V R ,x ′ ,ỹ ′ , andz ′ are the coordinates of the source point r ′ in the coordinate originated at the center of ∆V T (as illustrated in Fig. 3). For the above approximation to be valid, the phase terms in (18) should not osculate within the volume of V R . Based on lemma 2, this is guaranteed if we take ∆V T ≈ λr 2∆xmax λr 2∆ymax 2∆z T . We denote N = VT ∆VT as the number of smaller volumes which V T is divided into. Thus, we can evaluate the integral separately within each volume of ∆V T , i.e., where i ∈ [1, N ] is the index of each volume ∆V T , r i is the distance between (∆V T ) i and V R , and is the value of the kernel function within (∆V T ) i . To obtain the upper bound of the channel gain, we assume that J y (r ′ ) can be configured to a detailed distribution within ∆V T . According to (18), the following current source distribution yields the largest eigenvalue (see also [25,Eq. (92)]): where F i (r ′ ) is the focusing function given in (19). Note that for F i (r ′ ), the coordinatex −ỹ −z used in (19) is located at the center of (∆V T ) i . The focusing function ensures that the phase terms of all source point r ′ within (∆V T ) i add up constructively at V R . Thus, by substituting (22) into (20), we have the following theorem.
Theorem 1. The maximum channel gain between the RIS and a near-field receiver takes the following form: Proof. Substituting (22) into (20) and (7), we have the following: Note that the integration within V T can be split into N -sum since J y (r ′ i ) is zero outside (∆V T ) i . Thus, the other integral can be evaluated in a similar way where the focusing function in J y cancels out the phase terms in the kernel function: Finally, by using the definition of β in (14), the theorem is proved.

C. Maximum Degrees of Freedom of the End-to-End Channel
According to (23), the maximum channel gain is a summation of N terms. In the following corollary, we prove that these N components are in fact parallel channels. This demonstrates an important difference between near-field and far-field RISaided communication. Within the far-field regime, the channel is a rank-one matrix for free-space transmission. However, as we will show in the next corollary, due to the varying path lengths between different parts of the RIS and the receiver, the near-field end-to-end channel potentially has higher degrees of freedom.
Corollary 1. For RIS-aided near-field communication, the available degrees of freedom for multiplexing is: where r is the distance between the centers of RIS and the receiving volume, z T and z R are the maximum width of the RIS and the receiver, respectively, and ⌈x⌉ is the ceiling function.
Proof. For convenience, we denote the current distribution within (∆V T ) i as J (i) y (r ′ ) and its generated E-field within V R as E (i) y (r). We only need to prove that E (i) y (r) are orthogonal to each other within V R . Note that two functions are orthogonal if their inner product is zero, i.e., < E 1 , E 2 >= where E T is the transpose of vector E and * denotes the complex conjugate. Thus, we have < E where K is the operator of the kernel function K, i.e., KJ y (r ′ ) = VT K · J y (r ′ )dV T . According to (22), < J  (17), the corollary is proved.
Remark 3. According to (26), for the case where the aperture size of the RIS is larger and the carrier frequency is higher, the available DoF is higher. However, utilize these DoF is a challenge due to the lack of RF chains on RISs. In theory, it is possible to send a superimposed signal to the RIS and these parallel signals excited different surface current patterns, and thus, at the receiver, the signals can be independently decoded by summing up the signals with weights according to the eigenfunctions within the V R [10, Fig. 2].

D. Power Scaling Law
Next, we present the near-field and far-field power scaling laws. In (22), we used normalized currents within V T , i.e., VT J * y J y dV T = 1. However, in practice, if we consider the RIS is illuminated by a far-field base station, we need to use the unnormalized currents 3 , i.e., J y (r ′ ) = F (r ′ ). Thus, we have the following corollary: Corollary 2. Suppose that the RIS has M elements, the power scaling law is given as follows: where P r is the received power, V ele is the volume of each RIS element and M i is the number of element within The corollary is proved by substituting J y (r ′ ) = F (r ′ ) into (7) and following the similar derivations in Theorem 1. (27) can be further simplified. Within the farfield regime, the volume ∆V T,max given in (17) is larger than the entire volume of RIS. Thus, the summation can be simply removed and we arrive at the similar far-field power scaling law as given in previous works:

Remark 4. Far away from the field boundary, the power scaling law in
where rr indicates the boundary of the reactive near-field. According to antenna theory, this value is typically given by rr = 0.62 L 3 /λ, where L is the largest dimension of the RIS.
Within the near-field region when the volume ∆V T,max is smaller or equal to the size of V ele , there are only one element within each (∆V T ) i and N = M. Thus, the received power starts to scale linearly with M : (29) wherer is the distance between the centers of the RIS and the receiver.

E. Summary
For the convenience of the readers, we summarize and compare the performance limits for near-field and far-field regimes as derived in the above subsections in Table IV.

IV. PERFORMANCE ANALYSIS FOR THE STAR-RIS-AIDED
MULTI-USER SCENARIO In this section, we extend our analysis to the case where multiple users are simultaneously served by the STAR-RIS. We first consider the case where the multiple users are all within the near-field regime and propose three configuration strategies. Then, we consider the hybrid near-field and farfield case where the transmission-side (indoor) user is within the near-field and the reflection-side (outdoor) user is within the far-field. As illustrated in Fig. 4, assume that the total number of user is U . To demonstrate the STAR functionality, we assume that the users are located on both sides of the STAR-RIS. According to our proposed channel model, for the multi-user case, the channel gain for user p is given as follows: is the kernel function corresponding to user p. Similar to the single-user case, we evaluate the above integral within each smaller volumes of sizes ∆V T . However, the difference is that for the multi-user case, J y (r ′ 2 ) need to be optimized for all users. In the following, we give the fundamental performance limit of STAR-RIS serving multiple near-field users in terms of the sum of their channel gains.
To start with, we exploit the fact that only the term (30) is related to the users position. Thus, the sum of the channel gains for all U users can be expressed as follows: is the sum of the kernel function for all users. Here, we assume that the STAR-RIS elements are smaller than V T,max . According to last section, the value of the kernel function for user p within the mth element (V m ) is given in (21) as K Note that thex ′ i ,ỹ ′ i , andz ′ i are evaluated in the local coordinate centered at (∆V T ) i where its z i -axis points in the direction of user p. Thus, calculating the sum of the kernel functions involves transformations between all these local coordinates: where F (p) i (r ′ ) is the focus function for (∆V T ) i and user p. Unlike the single-user case in (21), variables r ′ 1 and r ′ 2 in (33) are not separable in the summed kernel functions. As a result, there are no trivial solutions for J y (r ′ ) which could maximize the summed channel gain in (31). In practice, the channel and positional information of users are difficult to obtain in real time. As a result, we propose three heuristic strategies for configuring J y (r ′ ) in the multi-user scenario, namely the power splitting (PS), the selective element grouping (SEG), and the random element grouping (REG) strategies.
As illustrated in Fig. 5, for the PS strategy, all the STAR-RIS elements split their power equally to simultaneously serve all users. For the REG and SEG strategies, elements are divided into U groups so that each group has roughly M/U elements. Elements in each group are dedicated to serve one single user. In REG, the element grouping is randomly assigned whereas in SEG, we select M/U elements which are closest to the user on the STAR-RIS. In the following, we discuss the current distribution configuration and performance of these three strategies in detail.

A. Power Splitting (PS) Strategy
As illustrate in Fig. 5(a), in PS strategy, all STAR-RIS elements simultaneously serve all users. To achieve that, for the mth element, the current is configured as the linear superposition of the focusing functions for all users, normalized by the volume of the element (V m ), i.e., where F (p) m (r ′ ) is the focus function for user p within the mth element (defined in (19)) and V m A m = Vm || U p=1 F (p) m (r ′ )||dV m is the normalization factor. Next, we evaluate the channel gain for the users. To obtain tractable results, we further assume that the size of each STAR-RIS element is small compared to r p i . Thus, the kernel function for the mth element can be reduced to K 1 e +jkz p 2 , wherez p 1/2 are the z-coordinate of the source point r ′ 1/2 in their own orientates originated at the center of the mth element and r p m is the distance between the mth element and user p. With this simplification, the end-to-end channel gain can be formulated in a closed-form expression.
Theorem 2. For the PS strategy, the end-to-end channel gains for user q is given as follows: where where β = jωµ 0 + k 2 jωǫ0 is the constant defined earlier, ξ pq m = π · (1 − cos α pq m )∆z m /λ, ∆z m is the width of each STAR-RIS element, and α pq m is the angle between O ′ p and O ′ q, for O ′ being the center of the mth element, as illustrated in Fig. 4.

B. Random Element Grouping (REG) Strategy
As illustrate in Fig. 5(c), in REG strategy, the STAR-RIS elements are randomly assigned to focus a single user. Similar to the last subsection, we assume that the STAR-RIS elements are small so that within the volume of ∆V T , there are multiple elements. Thus, the current configuration for REG strategy is given as follows: m is the focus function for user p within V m defined in (19) and M p denotes the group of elements chosen to focus user p. For this configuration, we show the channel gain in the following theorem.
Theorem 3. For the REG strategy, the end-to-end channel gains for user p are given as follows:  In other cases, the channel gain for a given user is always smaller compared to the upper bound given in (23). This gap is determined by the argument of ξ pq i , which itself depends on the locations of the users.

C. Selective Element Grouping (SEG) Strategy
The path lengths between the near-field user and different STAR-RIS elements varies significantly. Thus, unlike in the far-field region, element grouping has a greater effect on the overall channel gains for all users. As illustrate in Fig. 5(b), for the SEG strategy, the elements which are closest to one user are all assigned to this particular user. In this case, the STAR-RIS can be regrouped into U volumes, the pth volume contains all elements assigned to user p. The channel gain can be calculated as follows: Corollary 3. For the SEG strategy, the end-to-end channel gains for user p are given as follows: (38) where V p denotes the volume of STAR-RIS which is assigned to user p, the index i denotes the volume (∆V T ) i , r p i is the distance between (∆V T ) i user p, M i is the number of elements within (∆V T ) i .
Proof. Since SEG is a special case of REG strategy, (38) can be derived from (37) by using the fact all element within (∆V T ) i , i ∈ V p is assigned to user p and thus M q i = 0 if q = p. Remark 6. The performance of SEG strategy is strictly better than that of the REG strategy. Comparing the the results in (37) and (38), we have r p ≤ r p i , ∀i. Thus, for each element, the coefficients in the SEG is larger than those in the REG strategy. This difference is more significant within the near-field regime due to the greater differences between path-lengths r p i . However, to obtain the element grouping configuration for SEG, positional information for all users is required which may significantly increase the overhead of the channel estimation procedure.

D. Performance Analysis in the Hybrid Near-Field and Far-Field Regimes
In the above sections, we investigated the performance of the PS, SEG, and REG strategies within the near-field regime. However, in practical applications, users could be located in both the near-field and the far-field regimes. Here, we evaluate the performance of STAR-RISs in the hybrid near-field and farfield regimes. Specifically, we investigate an outdoor-to-indoor communication scenario where the STAR-RIS is deployed on the window to simultaneously transmit and reflect wireless signals to indoor and outdoor users, respectively. As illustrated in Fig. 6, we consider the case where mobile users are located both indoor and outdoor. The origin O is at bottom left of the room. The BS is far from the origin and its main lobe is pointing in the x-direction. Thus, the wireless signal can be regard as a plane wave near the origin. As shown in the figure, the wireless signal cannot penetrate walls and can only enters through the opened bottom edge of the room (x-axis) or through the STAR-RIS on the y-axis. For simplicity, we further assume that the system is translation invariant in the zdirection. In terms of multiple access, we assume that all users are served simultaneously. This can be achieved by employing frequency division multiple access. Furthermore, we assume that the base station antenna follows 3GPP model where the radiation pattern within each sector is as follows [28]: where θ 3dB = 65 • is the horizontal 3 dB beamwidth.
As illustrated in Fig. 6, user F is an outdoor, far-field receiver in the direction of θ F with respect to the BS. User N is an indoor user where the angle between ON and the x-axis is θ N . In the following, we investigate how the end-to-end channel gain for the two users change with θ F and θ N .

1) Distribution of Signal Strength Without STAR-RISs:
First, we consider the benchmark scenario without STAR-RIS. Assuming the wall along the y-axis is completely sealed so that the signal cannot penetrate. Nevertheless, a small portion of the signal strength can still be received by user F and N . This is because for user N , the wireless signal is diffracted at point O, and for user F , there are sidelobes of the BS antenna which radiates towards the horizontal direction of θ 2 . According to the radiation pattern given in (39), the channel gain between BS and user F can be expressed as follows: where A F is the aperture area of user F and r OF is the length of OF . Here, we assume that the contribution of the reflected signals (by the wall) at user P is weak and can be neglected. For user N , the received signal power can also be expressed in terms of θ N and distance ON . According to [29, eq. (39)], the angular distribution of the signal power within the shadow edge (the first quadrant in Fig. 6) can be expressed as follows 4 : where A N is the aperture area of user N and r ON is the length of ON . It is shown in (41) that the channel gain for user N falls off inversely with sin 2 θ N and the distance r ON . This is consistent with common intuition that the top-left corner of the room should have the worst signal (see Fig. 11(a) for the simulated result for the indoor radiation power distribution).

2) Distribution of Signal Strength With the aid of STAR-RIS:
To improve the channel gain for both the outdoor and indoor users, we open a window in the wall on the y-axis and deploying a STAR-RIS. As illustrated in Fig. 6, the STAR-RIS is plotted as a blue rectangle. Exploiting the criteria given in (16), we identify the field boundary for the STAR-RIS and user pair. According to the parameters in Table V, the field boundary is r b = 10 m. This indicates that the indoor user N always located within the near-field region and the outdoor user can be considered as far-field if the distance r SF > 10 m. Next, we calculate the critical volume given in Lemma 2: For near-field user N , we have r SN = 2 m, then we have ∆V N T ≈ 0.02 m 2 · z STAR . This means that the degrees of freedom of the channel between STAR-RIS and user N is For far-field user F , we have r SF = 20 m, then ∆V F T ≈ 2 m 2 · z STAR . This volume is significantly larger than the STAR-RIS since the volume of STAR is only V STAR = 0.25 m 2 · z STAR .
To further obtain the channel gains for the indoor and outdoor users, we consider the employment of the three proposed STAR-RIS configuration strategies, i.e., PS, REG, and SEG strategies.

Corollary 4. For the PS strategy, the end-to-end channel gains between the BS and user P/Q through STAR-RIS are given as follows:
where D 0 = D(θ = 0) is the directivity of the BS antennas, A T is the aperture size of STAR-RIS, d is the distance between BS and STAR-RIS, V R is the volume of the receiver, V ST AR is the volume of the STAR-RIS, ξ F N = π(1 − cos α F N )∆z m /λ, α F N is the angle between user F and user N observed at the center of STAR-RIS, and V m is the volume of each STAR-RIS element.
Proof. For the far-field user F , its distances and angles to different STAR-RIS elements are almost the same. Thus, by using r F m = r F and ξ F N m = ξ F N in (35), (43) can be proved. For the near-field user F , its channel gain follows the same form in (35).
Corollary 5. For the REG and SEG strategy, the end-to-end channel gains between the BS and user P/Q through STAR-RIS are given as follows: where is the angle between user F and user N observed at (∆V T ) i , and M i is the number of STAR-RIS element within (∆V T ) i .
Proof. For the far-field user F , its distances and angles to different STAR-RIS elements can be regarded as the same. Thus, by using r F m = r F and ξ F N m = ξ F N in (37), (45) can be proved. For the near-field user N , its channel gain follows similar forms in (46) and (47).

Remark 7.
Comparing the channel gains for user F and N with and without the aid of STAR-RIS, it can be observed that the undesirable angle dependencies with θ F and θ N in (40) and (41) are removed in the STAR-RIS-aided links. This will be further illustrated in our numerical results (see Fig. 12).

V. NUMERICAL RESULTS
In this section, numerical results are provided to validate the proposed Green's function based channel model and power scaling laws for the transmitting/reflecting-only RIS-aided single user scenario. We also present simulation results for the three STAR-RIS configuration strategies and coverage simulation results for the STAR-RIS-aided multi-user scenario.
A. Transmitting/Reflecting-Only RIS-Aided Single User Scenario 1) RIS Power Scaling Laws: In Fig. 7 we investigate the power scaling laws for the near-field and far-field regimes proposed in (29) and (28), respectively. In the simulation, we assume that the receiver is located at a distance of d = 0.7 m to the center of RIS and the dimension of the receiver is z R ≈ 1.0 cm. The number of RIS elements range from 1 to 16 and its size range from 1 cm to 10 cm. The wavelength of the carrier signal is 0.01 m. As can be observed from the figure, since the position of the receiver is fixed, the user is Simulation Far-field power scaling (28) Near-field power scaling (29) Near-field regime (linear scaling) Far-field regime (quadratic scaling) Field boundary according to (16) Fig. 7: Near-field and far-field power scaling laws of transmitting/reflecting-only RIS.
within the far-field regime if the RIS has smaller size and the user is within the near-field regime if the RIS becomes larger. Within the far-field regime, the power scales with M 2 , as derived in (28). However, by increasing the size of the RIS, this quadratically growth cannot continue forever. As the size of the RIS reach the volume correspond to the boundary position, i.e., (17), the user falls into the near-field regime. As indicated with the red dashed line, a linear power scaling law is observed, as derived in (29).

2) Power Scaling Laws for Receivers with Different Sizes:
In Fig. 8, we investigate the power scaling laws of conventional RISs for receivers with different sizes. The red markers are the simulation results for a receiver with volume V R = 1 cm 3 while the blue markers are the results for V R = 1.7 cm 3 . As can be shown in the figure, the simulations fit well with the derived near-field and far-field power scaling laws. Within the far-field regime, both receivers exhibit linear power scaling. As derived in (28), the blue curve has a larger slope because its larger volume. Also, the field boundary positions differ for the two receivers. Fig. 9 illustrates the results for the upper bound of the end-toend channel gain. The STAR-RIS is configured to split power equally on both sides. However, the volumes of the receivers are different. User 1 (receiver with d < 0) has a dimension of V R = 0.125 cm 3 and the user 2 with d > 0 has volume V R = 1 cm 3 . The STAR-RIS is located at the center with d = 0. As shown in the figure, within the near-fields, the channel gains of both users oscillates with the change of distance. In contrast, the far-field regimes, the channel gain follows the d −2 dependency as derived in (28).

1) Channel Gain and Field Boundary for STAR-RISs:
2) Comparison between the PS, REG, and SEG Strategies within Near-Field Regime: In Fig. 10, we investigate the sum rate performance of the three proposed configuration strategies. We consider two users, p and q, located on different sides of the STAR-RIS. Both users are located in the x-z plane with d = 0.5 m to the center of the STAR-RIS (refer to Fig. 4 for the coordinate system). Specifically, we assume that x p = −0.5 m and x q = 0.3 m. The carrier wavelength is set at   λ c = 0.01 m and the dimension of the STAR-RIS ranges from 20 cm to 60 cm. The dimension of the receiver is z R ≈ 1 cm. As can be observed in the figure, the SEG strategy outperform both REG and PS strategies, and the PS strategy has the lowest sum rate. This result is in accordance with remark 6. Although SEG and REG strategies achieve higher sum rate, the DoFs of their corresponding channels are lower than the PS strategy.
Recall that in (26), the DoF is proportional to the total volume of operating STAR-RIS elements. In SEG and REG, only a portion of the elements are designated to one user. As a result, for a particular user, the volume V T is smaller than the overall volume of the STAR-RIS. Thus, Fig. 10 reveals a trade-off bettwen the sum rate and channel DoF within the near-field regime. A similar trade-off is also present in the farfield regime between the beam-forming gain and multiplexing gain of RISs or phased-array antennas [30].

C. STAR-RIS within Hybrid Near-Field and Far-Field Regimes
1) Radiation Pattern for the Indoor User: In Fig. 11 we plot the radiation pattern for the indoor space under the setting of the case study. Fig. (11(a)) shows the power distribution without the STAR-RIS deployed. The radiation pattern agrees with the derived analytical result given in (41). The power falls off with 1/ sin 2 θ N , where θ N is angle between the xaxis and the field-point N . Thus, the power is the lowest near the top-left corner of the room. Fig. (11(b)) shows the In Fig. (11(c)), we show the power distribution in which the STAR-RIS is configured to improved the signal power near the top-left of the room. It can be observed that the STAR-RIS improves the received power within the area of interest by about 5 dB compared to the case without STAR-RIS and 3 dB compared to the case with an open window (without passive STAR-RIS beamforming). Furthermore, by employing the three proposed STAR-RIS configuration strategies,it is also achievable to improve the signal power at multiple locations simultaneously.
2) Channel Gains for the Outdoor and Indoor Users: In Fig. 12, we investigate the channel gains for user F amd N as a function of the angles of θ F and θ N (as illustrated in Fig. 6). The indoor and outdoor channel gains with and without deploying the STAR-RIS are compared where the STAR-RIS adopts the PS strategy. As can be observed, the channel gains for both users without STAR-RIS decreased significantly with θ F and θ N , as derived in (40) and (41). Specifically, the channel gain for the indoor user N decreases with (sin θ N ) −2 and the channel gain for the outdoor user F decreases with −θ 2 F . The channel gains for both users are significantly improved with the aid of STAR-RIS. With the STAR-RIS deployed, the undesired angle-dependency is removed and the channel gains for both users remain high (compared to the case where θ F/N = 0 but without STAR-RIS) within the entire angle range of (0 • , 90 • ).

VI. CONCLUSIONS
In this paper, a channel model based on Green's function method were proposed for investigating the performance limit of metasurface-based RISs and STAR-RISs. Instead of modeling the RIS elements with the transmission and/or reflection coefficients, we used the distribution of the induced electric currents within the metasurface-based RIS. We also gave revealed how transmitting-only RISs, reflecting-only RISs and STAR-RISs can be achieved by configuring the distribution of the induced electric current. For the single-user scenario with transmitting/reflecting-only RISs, the upper bound of the end-to-end channel gain was derived by choosing the current distribution that is optimized for the receiver. In addition, the position of the near-field and far-field boundary, the maximum DoF of the channel, and the power scaling law were derived. It was shown that the size of RIS, the carrier signal frequency, and the size of the receiver all affect the above performance metrics. For the multi-user scenario with STAR-RISs, we proposed three configuration strategies, i.e, the PS, SEG, and REG strategies. Closed-form expressed were derived for the channel gains for all three strategies. By comparing the results, it was shown that the SEG performs better than REG, especially within the near-field regime. We further analyzed the performance of STAR-RIS in the hybrid near-field and far-field regimes. Specifically, we conducted study where the STAR-RIS assists the transmission of the signal from outdoor to indoor. Analytical and numerical results shown that the STAR-RIS significantly improved the signal power in the indoor "blind zone". The results obtained in this paper confirm the effectiveness of metasurface-based RIS-aided and STAR-RIS-aided wireless communication.

APPENDIX A GREEN'S FUNCTION AS AN OPERATOR
One can formulate the relation given in (1) into a linear mapping between J(r ′ ) and E inc . An arbitrary distribution of J(r ′ ) within V T can be expanded into the sum of a complete orthogonal bases of currents, {j 1 (r ′ ), j 2 (r ′ ), · · · }. Note that two current functions are orthogonal if their inner product is zero, i.e., < j 1 , j 2 >= Vt j T 1 j * 2 dV T = 0, where A T is the transpose of vector A and * denotes the complex conjugate. Similarly, the received electric field within V R can be represented in a similar way. Thus, we have the following representations: where {e 1 , e 2 , · · · } are the complete basis for the received electric field within V R , a i =< J(r ′ ), j i (r ′ ) > and b i =< E(r), e i (r) > are the coefficients for the ith basis. Using these two sets of basis, (1) can be reformulated into a linear mapping between the coefficients: are the corresponding strength for the mapping between a j and b i and A H denotes the transpose conjugate of a complex-valued vector A. Till here, we have captured the communication channel between V T (the STAR-RIS) and V R (the receiver) in terms of a matrix G whose (i, j)-th item is g ij . For clarity, (A.2) can be expressed in matrix terms as follows: We start from the formulation in (30), and substituting the current distribution (34) and the approximated kernel function K where in equality (a), z p ′ 2 is transformed into the coordinate of centered at element m with the z-axis pointing towards user q, α pq m is the angle between user p and user q from the perspective of the mth element, and S m is the aperture area of the mth element. The integration of z 1 in (A.2) can be evaluated similarly. Thus, by substituting (A.3) into (A.2), we have: Again, we start from the formulation in (30), and substituting the current distribution for REG in (36) and the approximated kernel function into (30), we have the following: For the integration for r ′ 2 within element m, the value depends on the element's grouping. For the elements assigned for user p, the focusing factor in the kernel function is cancelled by J y,m (r ′ 2 ). However, for other elements, the integrated value yields a similar result as in (A.3). Thus, by evaluating the integral within each volume (∆V T ) i the we have: where M p i denote the number of element assigned to user p within (∆V T ) i . Thus, the overall integration can be calculated as follows: