Mismatch Analysis and Cooperative Calibration of Array Beam Patterns for ISAC Systems Thanks: H. Chen, M. Li, A. Pourafzal, H. Huang, Y. Ge and H. Wymeersch are with the Department of Electrical Engineering, Chalmers University of Technology, 412 58 Gothenburg, Sweden (Email: hui.chen; limeng; alireza.pourafzal; huiping; yuge; henkw@chalmers.se). Thanks: M. Li, S. S. Petersen and M. Shen are with the Aalborg University, Denmark (Email: mengli; mish@es.aau.dk, sp19@student.aau.dk). Thanks: G. C. Alexandropoulos is with the Department of Informatics and Telecommunications, National and Kapodistrian University of Athens, 16122 Athens, Greece (Email: alexandg@di.uoa.gr). Thanks: This work was supported, in part by the research grant (VIL59841) from VILLUM FONDEN, the Swedish Research Council (VR grant 2022-03007), the SNS JU project 6G-DISAC under the EU’s Horizon Europe research and innovation programme under Grant Agreement No 101139130, Vinnova B5GPOS Project under Grant 2022-01640, and the Chalmers Area-of-Advance Transport (Project ID: 95418010). Hui Chen, Mengting Li, Alireza Pourafzal, Huiping Huang, Yu Ge, Sigurd Sandor Petersen, Ming Shen Abstract Integrated sensing and communication (ISAC) is a key technology for enabling a wide range of applications in future wireless systems. However, the sensing performance is often degraded by model mismatches caused by geometric errors (e.g., position and orientation) and hardware impairments (e.g., mutual coupling and amplifier non-linearity). This paper focuses on the angle estimation performance with antenna arrays and tackles the critical challenge of array beam pattern calibration for ISAC systems. To assess calibration quality from a sensing perspective, a novel performance metric that accounts for angle estimation error, rather than beam pattern similarity, is proposed and incorporated into a differentiable loss function. Additionally, a cooperative calibration framework is introduced, allowing multiple user equipments to iteratively optimize the beam pattern based on the proposed loss functions and local data, and collaboratively update global calibration parameters. The proposed models and algorithms are validated using real-world beam pattern measurements collected in an anechoic chamber. Experimental results show that the angle estimation error can be reduced from 1.01 ∘ \textbf{1.01}^{\circ} to 0.11 ∘ \textbf{0.11}^{\circ} in 2D calibration scenarios, and from 5.19 ∘ \textbf{5.19}^{\circ} to 0.86 ∘ \textbf{0.86}^{\circ} in 3D calibration ones. I Introduction Fig. 1: Illustration of the considered cooperative beam calibration scenario. Local calibrated array beam patterns are obtained from cooperative UEs and then fused globally. isac ( isac ) is becoming a central pillar of next-generation wireless systems to provide location information and environment awareness [ 13 ] . With large array apertures and wide bandwidths, the communication signals enable not only higher data rates but also finer angular and delay resolutions [ 6 ] . In addition to traditional toa ( toa ) and tdoa ( tdoa ) methods, angle-based measurements, such as aoa ( aoa ) and aod ( aod ), are now integrated into standardized systems like 3GPP NR [ 2 ] . Such angle measurements provide substantial improvements in localization coverage and accuracy and enable complex tasks, including multipath-aided single bs ( bs ) localization [ 18 ] , device orientation estimation [ 35 ] , and slam ( slam ) [ 16 ] . These developments point toward a future in which 6G networks will support a diverse array of ISAC-driven services, from extended reality to autonomous navigation [ 25 ] . Despite the significant potential of ISAC, most current studies assume ideal system models and overlook the effects of calibration errors, such as geometric error [ 36 ] and hardware impairments [ 5 ] . While these assumptions facilitate performance analysis and the development of low-complexity algorithms (including super-resolution techniques for channel parameter estimation [ 30 , 23 ] ), model mismatches lead to system performance degradation. Inaccurate beamforming caused by such mismatches reduces array gain, increases interference, and degrades link reliability [ 24 ] . In sensing applications, the consequences are even more pronounced, as angular errors amplify with distance and can severely degrade system performance. 1 1 1 The snr ( snr ) degradation caused by an angle-estimation error \Delta\theta in an N\times 1 ula ( ula ) with half-wavelength inter-element spacing is given by \mathrm{SNR}_{\text{loss}}=\left|\frac{1}{N}\sum_{n=0}^{N-1}e^{j\pi n\left(\sin\theta-\sin(\theta+\Delta\theta)\right)}\right|^{2} , while the corresponding location error due to this angular error at distance r is \Delta x=r\left|\tan(\theta+\Delta\theta)-\tan(\theta)\right| . For a user at \theta=0^{\circ} and r=100~\mathrm{m} with \Delta\theta=1^{\circ} and N=8 , the SNR degradation and distance error are 0.069~\mathrm{dB} and 1.75~\mathrm{m} , respectively. These inaccuracies affect the performance of channel parameter extraction and subsequent high-level tasks such as localization and mapping [ 9 ] . This indicates that array calibration is needed to fully harness the potential of communication systems for sensing. TABLE I: Summary of Beam Pattern Calibration Methods Ref. Purpose (Calibration Focus) Hardware Type (Array Size) Scenario Key Methodology [ 21 ] 5G array error calibration Digital array ( 4 -element) In situ Expectation–maximization with interference cancellation [ 22 ] SLAC: joint position + calibration Digital array (up to 4) Self-calibration Bayesian filtering, orientation, bias estimation [ 28 ] Beam pattern characterization Phased array ( 4\times 5 ) Offline REV method (element-wise phase sweep) [ 27 ] Fast REV-based calibration Phased array ( 4\times 5 ) Offline Enhanced REV (multi-element switching) [ 26 ] Amplitude-only calibration Phased array ( 4\times 5 ) Offline Fourier-based recovery from amplitude sweeps [ 14 ] Amplitude-only fast calibration Phased array ( 8 -element) Offline 3-phase shift measurement (0°, 90°, 180°) [ 15 ] Simultaneous element calibration Phased array ( 8 -element) Offline Linear system solver using all-on measurements [ 31 ] Reduced measurement load Phased array ( 4\times 8 ) Offline Sparse measurement, linear recovery [ 29 ] OTA beam-mode calibration Phased array ( 4\times 4 ) Offline Calibration in beam-steering mode only [ 10 ] Mutual coupling-aware modeling RIS (up to 4\times 8 ) Self-calibration Electromagnetic end-to-end circuit model [ 33 ] OTA phase calibration RIS ( 8\times 8 ) In situ Alternating block descent, CRB benchmark [ 8 ] MC-aware localization RIS ( 20\times 20 ) Self-calibration Alternating optimization for joint localization and calibration [ 37 ] Excitation vector learning Phased array (up to 4\times 8 ) Offline Transfer-learning-based surrogate model (power-only) [ 17 ] Antenna displacement calibration Phased array ( 8\times 8 ) Self-calibration Model-driven learning-based ISAC under hardware impairment Ours Sensing-based calibration Phased array (up to 16\times 16 ) In situ Response and angle error loss based optimization I-A Related Works Array calibration scenarios can be broadly categorized into offline calibration (e.g., in chamber or controlled environment with dedicated calibration process), in situ calibration with known calibration agent state, and self-calibration that can calibrate the array without additional devices [ 21 ] , as shown in Table I . Generally, offline calibration achieves the highest accuracy but requires specialized setups, whereas in situ and self-calibration methods are more practical in real deployments, with the former relying on a dedicated calibration agent. In terms of calibration methods, they can be classified into element pattern calibration, amplitude-only calibration, complex-valued/structure-aware calibration, and ai ( ai )-based calibration. In the following, we review the state-of-the-art in each category and discuss their applicability and limitations for ISAC systems. I-A 1 Element Pattern Calibration Element calibration focuses on estimating element-wise antenna response. In [ 21 ] , the calibration problem is framed as the estimation of an array error function (gain and phase error for each antenna), with experimental validation on a 4\times 1 antenna array. With the cooperation of multiple mobile agents, [ 22 ] presents a simultaneous localization and calibration (SLAC) approach that uses Bayesian filtering to estimate positions and calibration parameters in mobile networks jointly. While effective, such methods are generally limited to small-scale or linear arrays and do not scale efficiently to large or hybrid analog-digital arrays. I-A 2 Amplitude-Only Calibration Amplitude-only calibration methods, such as the widely-used rev ( rev ) method and its variations [ 28 , 27 , 26 ] , enable antenna array calibration by introducing additional phase shifters to perform element-wise phase sweeps and reconstruct the array response using only amplitude measurements. Enhanced REV methods, such as multi-element switching [ 27 ] and Fourier-based recovery [ 26 ] , further reduce calibration time and complexity. The fast amplitude-only calibration in [ 14 ] employs three-phase shift measurements (0°, 90°, 180°). Amplitude-only methods are particularly valuable when accurate phase measurements are unavailable or impractical; however, they fail to fully restore the complex beam pattern, limiting their effectiveness for angle estimation and high-precision sensing. Additionally, these methods often require hardware modifications (such as extra phase shifters), which may not be feasible for all array architectures, especially in the context of hybrid or distributed ISAC deployments. I-A 3 Complex-Valued and Structure-Aware Calibration The third category of calibration techniques leverages linear algebraic structures and advanced modeling to reduce the number of required calibration measurements or to account for mutual coupling and hardware impairments. For example, [ 15 , 31 , 29 ] exploit linear system formulations and sparse recovery methods for calibration, reducing measurement overhead. In the context of ris , impedance-based modeling has been proposed to describe mutual coupling [ 10 ] , while alternating optimization-based approaches have demonstrated high performance in ota ( ota ) test with complex propagation environments [ 33 ] and joint localization and calibration scenarios [ 8 ] . These methods can provide accurate calibration in the presence of hardware non-idealities, but they often require access to detailed hardware parameters, precise control over system operation, or additional measurement campaigns. Furthermore, the assumptions made regarding array geometry, mutual coupling, or propagation environment may not generalize well to large-scale, distributed, or hybrid analog-digital systems. I-A 4 AI-Based Calibration Recent advances in data-driven calibration approaches aim to address practical challenges in dynamic and distributed environments. In [ 37 ] , a surrogate-model-based method is introduced for phased array calibration using only power measurements, leveraging transfer learning to adapt excitation vector models across devices. Model-driven deep learning frameworks have also shown promise for correcting antenna displacement errors [ 17 ] . These AI-based methods are attractive for large-scale and practical deployments, as they can learn from real-world data and adapt to changing conditions. However, they typically focus on beam pattern reconstruction accuracy and do not directly address the impact of calibration on sensing accuracy. Moreover, these approaches often require extensive training data and may not be robust to all types of hardware impairments or environmental dynamics. While the above calibration methods offer valuable solutions for specific scenarios, most existing works evaluate calibration quality based on beam pattern reconstruction accuracy, without explicitly quantifying the impact of beam mismatch on sensing or localization performance. Additionally, much of the literature assumes fully digital architectures or fixed array types, overlooking the analog and hybrid beamforming structures and distributed calibration needs common in practical mmwave ( mmwave ) ISAC systems. These limitations reduce the practical relevance of current calibration methods for real-world sensing and localization tasks. I-B Contributions In this work, we address in situ beam pattern calibration using downlink pilot signals from a sensing-oriented perspective: we quantify how beam mismatch degrades localization accuracy, and we develop both a practical beam pattern model and a scalable cooperative calibration algorithm suitable for distributed implementation under hybrid beamforming constraints. The main contributions of this paper are as follows: • We formulate a cooperative beam calibration problem in a distributed isac scenario. Array calibration of the bs is performed at each ue ( ue ) via communication pilot signals, and multiple ue collaborate to jointly calibrate the beam pattern of the bs antenna array, as illustrated in Fig. 1 . • We develop a novel, sensing-oriented performance metric, obtained by calculating the pseudo-true parameter that minimizes the Kullback-Leibler divergence between the actual model and the mismatched model after calibration. Unlike traditional beam pattern similarity metrics, the proposed metric better reflects calibration quality in terms of sensing performance. • We propose an iterative optimization algorithm adopting a differentiable objective function, approximated from the sensing-based performance metric. The algorithm can further refine communication-based calibration for better sensing performance and support cooperation between multiple calibration agents. • We validate the proposed beam pattern models and calibration algorithms based on real-world beam pattern measurements in an anechoic chamber. Both communication- and sensing-oriented performance metrics are assessed across various scenarios and hyperparameter settings. Notations and Symbols: Italic letters denote scalars (e.g., a ), bold lower-case letters denote vectors (e.g., {\bf a} ), and bold upper-case letters denote matrices (e.g., {\bf A} ). (\cdot)^{\top} , (\cdot)^{\sf H} , (\cdot)^{*} , (\cdot)^{-1} , {\hbox{tr}}(\cdot) , \|{\cdot}\| , and \|{\cdot}\|_{\text{F}} represent the transpose, Hermitian transpose, complex conjugate, inverse, trace, \ell -2 norm, and Frobenius norm operations, respectively; {\bf A}\odot{\bf B} , {\bf A}\oslash{\bf B} , {\bf A}\otimes{\bf B} , {\bf a}\circ{\bf b} are the Hadamard product, Hadamard division, Kronecker product, and outer product, respectively; [\cdot,\ \cdot,\ \cdots,\cdot]^{\top} denotes a column vector; [\cdot]_{i,j} is the element in the i -th row, j -th column of a matrix, and [\cdot]_{a:b,c:d} is the submatrix constructed from the a -th to the b -th row, and the c -th to d -th column of a matrix; \mathrm{Re}\{a\} and \mathrm{Im}\{a\} extracts the real and imaginary parts of a complex variable, \angle(a) denotes the phase of a complex scalar a ; \bm{1}_{N} denotes an N\times 1 all-ones vector, and \mathbf{I}_{N} denotes a size- N identity matrix. II System Model In this section, we begin with a general system model that includes geometrical information about the transmitter and receiver, as well as the beam pattern. Then, several beam representations will be described, followed by the corresponding calibration models. II-A Generic System Model We consider a far-field ofdm ( ofdm )-based downlink system with one bs and multiple ue . For simplicity, we describe the system model for a specific bs - ue link, and thus the UE index is dropped throughout this section. The BS located at {\bf p}_{\text{B}}\in\mathbb{R}^{3} is equipped with an analog uniform planar array consisting of N=N_{r}\times N_{c} antennas ( N_{r} rows and N_{c} columns), and a single-antenna UE moves following a predefined trajectory (e.g., from {\bf p}_{\text{U},1}\in\mathbb{R}^{3} to {\bf p}_{\text{U},T} with a total T snapshots) and is receiving pilot signals from the bs . 2 2 2 This work uses downlink signals to highlight cooperative calibration in a distributed system, and the feedback between UEs and BS is needed to provide calibrated parameters. The calibration problem can also be performed using uplink signals with proper interference management. At snapshot t , G ofdm symbols are transmitted from bs to ue , each with K subcarriers and a unique beamforming vector (forming a G codewords beam sweeping), and the received signals {\bf Y}_{t}\in\mathbb{C}^{G\times K} can be expressed as the combination of signals propagating L+1 paths given by {\bf Y}_{t}=\sum_{\ell=0}^{L}\alpha_{\ell,t}{\bf b}(\hbox{\boldmath$\vartheta$}_{\ell,t})({\bf d}(\tau_{\ell,t})\odot{\bf x}_{t})^{\top}+{\bf N}_{t}, (1) where \ell is the index of path with \ell=0 denoting the los ( los ) path, \alpha_{0,t}=\sqrt{P}\frac{\lambda}{4\pi r_{0,t}}e^{j\beta_{0,t}} is the LOS complex channel gain with P as the transmit power, \beta_{0,t} as the phase, and r_{0}=\|{\bf p}_{\text{B}}-{\bf p}_{\text{U}}\| as the distance between the t -th measurement location and the BS array. The channel gain of the nlos ( nlos ) path ( \ell>0 ) can be expressed as \alpha_{\ell,t}=\sqrt{P}\frac{c_{\ell}}{\sqrt{4\pi}}\frac{\lambda}{4\pi r_{\ell,t,1}r_{\ell,t,2}}e^{j\beta_{\ell,t}} , with c_{\ell} as the radar cross-section coefficient, r_{\ell,t,1}=\|{\bf p}_{\text{B}}-{\bf p}_{\text{S},\ell,t}\| and r_{\ell,t,1}=\|{\bf p}_{\text{U}}-{\bf p}_{\text{S},\ell,t}\| denoting the distances from the BS and UE to the scattering point (located at {\bf p}_{\text{S},\ell,t} ), respectively. Angle pair \hbox{\boldmath$\vartheta$}_{\ell,t}=[\theta^{\mathrm{az}}_{\ell,t},\theta^{\mathrm{el}}_{\ell,t}]^{\top} is the aod in both azimuth and elevation, \tau_{\ell,t} is the signal delay. The pilot signal vector is denoted by {\bf x}_{t}\in\mathbb{C}^{K} with unit norm as |x_{t,g}|=1 , and {\bf N}_{t}\in\mathbb{C}^{G\times K} is the additive white Gaussian noise matrix with each element n_{t,g}\in\mathcal{CN}(0,\sigma_{n}^{2}) . The beam response vector (for G codewords) at a specific angle pair \vartheta is denoted as {\bf b}(\hbox{\boldmath$\vartheta$})=[b_{1}(\hbox{\boldmath$\vartheta$}),\ldots,b_{G}(\hbox{\boldmath$\vartheta$})]^{\top}\in\mathbb{C}^{G} , which will be detailed in the following subsection, and {\bf d}(\tau)\in\mbox{\bb C}^{K} reflects the phase offset across different subcarriers with each element d_{k}(\tau)=e^{j2\pi k\Delta_{f}\tau} , where \tau is the delay and \Delta_{f} is the subcarrier spacing. A detailed geometric relationship between the BS/UE position, orientation, and channel parameters can be found in [ 6 ] . By de-rotating the phase caused by the LOS delay \hat{\tau}_{0,t} , removing the pilot signals as {\bf Y}_{t}\oslash(\bm{1}_{{}_{G}}{\bf x}_{t}^{\top}) , and performing coherent combining the K subcarriers, the generic system model can be simplified from ( 1 ) as {\bf y}_{t}=\underbrace{\tilde{\gamma}_{t}{\bf b}(\hbox{\boldmath$\vartheta$}_{t})}_{\text{LOS path}}+\underbrace{\sum_{\ell=1}^{L}\alpha_{\ell,t}{\bf b}(\hbox{\boldmath$\vartheta$}_{\ell,t}){\bf d}^{\sf H}(\hat{\tau}_{0,t}){\bf d}(\tau_{\ell,t})}_{\text{NLOS paths}}+{\bf n}_{t}. (2) Here, \tilde{\gamma}_{t}=\tilde{\gamma}_{0,t}=\alpha_{\ell,t}{\bf d}^{\sf H}(\hat{\tau}_{0,t}){\bf d}(\tau_{0,t}) with \hat{\tau}_{0,t} as the estimated LOS delay, and the noise level is scaled as n_{t,g}\in\mathcal{CN}(0,K\sigma_{n}^{2}) . We further assume that the bandwidth is sufficiently wide to resolve the delay of the LOS path and NLOS paths [ 23 ] , and the NLOS path term in ( 2 ) approximates to zero. By concatenating beam pattern vectors for all the codewords into a matrix {\bf B}(\hbox{\boldmath$\Theta$})\in\mathbb{C}^{G\times T} with \hbox{\boldmath$\Theta$}=[\hbox{\boldmath$\vartheta$}_{1},\ldots,\hbox{\boldmath$\vartheta$}_{T}] , we obtain {\bf Y}={\bf B}(\hbox{\boldmath$\Theta$})\tilde{\hbox{\boldmath$\Gamma$}}+{\bf N}. (3) Here, {\bf Y}\in\mathbb{C}^{G\times T} contains all the measurements from T position/angles for a specific UE, and \tilde{\hbox{\boldmath$\Gamma$}}=\text{diag}{([\tilde{\gamma}_{1},\ldots,\tilde{\gamma}_{T}])} contains the LOS complex channel gain for each measurement. II-B Beam Representation Model The goal of beam representation is to find a simplified model to represent {\bf B}(\hbox{\boldmath$\Theta$}) and characterize the ground truth beam patterns (e.g., measured from a chamber). We adopt two beam representation models, namely, an ideal model (steering-based codebook with fixed beamforming directions) and a practical model (learned codebook). The former model is widely used in existing works [ 13 , 35 , 36 , 5 , 30 ] and will be used as a benchmark for the latter practical model. II-B 1 Ideal Beam Model Without loss of generality, we define an ideal array response at angle \vartheta as \tilde{\bf b}{(\hbox{\boldmath$\vartheta$})}=g(\hbox{\boldmath$\vartheta$}){\bar{\bf W}^{\sf H}(\bar{\hbox{\boldmath$\Phi$}})}{\bf a}(\hbox{\boldmath$\vartheta$}), (4) where g(\hbox{\boldmath$\vartheta$}) is the element pattern. 3 3 3 At the UE side, element pattern should also be considered. However, we will show in Sec. II-C that the element patterns of both UE and BS do not affect sensing performance and hence are treated as nuisance parameters. A simple patch antenna model can be implemented as [ 3 ] g(\hbox{\boldmath$\vartheta$},\beta)=\cos^{\beta}(\theta_{\mathrm{eff}})=(\cos\theta^{\mathrm{az}}\cos\theta^{\mathrm{el}})^{\beta} (5) with \theta_{\mathrm{eff}}=\cos^{-1}(\cos\theta^{\mathrm{az}}\cos\theta^{\mathrm{el}}) being the effective angle between the target direction and the array boresight, and \beta>0 is the directivity parameter. However, the following calibration tasks are not limited to the beam pattern model defined in ( 5 ). The steering vector \mathbf{a}(\hbox{\boldmath$\vartheta$}) captures the phase differences due to array configuration across different antennas (assuming half-wavelength spacing) as \displaystyle\mathbf{a}(\hbox{\boldmath$\vartheta$})=\mathbf{a}_{c}(\theta^{\mathrm{az}},\theta^{\mathrm{el}})\otimes\mathbf{a}_{r}(\theta^{\mathrm{el}}), (6) with \displaystyle\mathbf{a}_{c}(\theta^{\mathrm{az}},\theta^{\mathrm{el}}) \displaystyle=[1,\ \cdots,\ e^{j\pi(N_{c}-1)\sin\theta^{\mathrm{az}}\cos\theta^{\mathrm{el}}}]^{\top}, (7) \displaystyle\mathbf{a}_{r}(\theta^{\mathrm{el}}) \displaystyle=[1,\ \cdots,\ e^{j\pi(N_{r}-1)\sin\theta^{\mathrm{el}}}]^{\top}. (8) In the ideal model, each codeword in the precoding matrix (or codebook) \bar{\bf W}(\hbox{\boldmath$\Phi$})=[{\bf w}(\bar{\hbox{\boldmath$\varphi$}}_{1}),\ldots,{\bf w}(\bar{\hbox{\boldmath$\varphi$}}_{G})]\in\mathbb{C}^{N\times G} is defined the same as the steering vector (e.g., {\bf w}(\hbox{\boldmath$\varphi$})={\bf a}(\hbox{\boldmath$\varphi$}) ) with the constraints |w_{g,n}|=1 , and \hbox{\boldmath$\varphi$}=[\phi^{\mathrm{az}},\phi^{\mathrm{el}}]^{\top} is the beamforming direction. Thus, each codeword maximizes the snr at a certain direction \bar{\hbox{\boldmath$\varphi$}}_{g} , and \bar{\bf W} can be represented by a set of beamforming angles \bar{\hbox{\boldmath$\Phi$}}=[\bar{\hbox{\boldmath$\varphi$}}_{1},\ldots,\bar{\hbox{\boldmath$\varphi$}}_{G}]\in\mathbb{C^{2\times G}} (predefined by the array manufacturer). II-B 2 Practical Beam Model As investigated in our initial work in [ 11 ] , an ideal codebook can lead to severe mismatch and performance degradation. Alternatively, a practical codebook {\bf W} (with each codeword satisfying \|{\bf w}_{g}\|=1 ) containing hardware limitations and realization issues can be defined as 4 4 4 Note that the definition of {\bf W} could be either \bar{\bf W}(\bar{\hbox{\boldmath$\Phi$}})+\Delta_{\bf W} or \bar{\bf W}(\bar{\hbox{\boldmath$\Phi$}})\odot\Delta_{\bf W} . Since we estimate {\bf W} as a whole without access to \Delta_{{\bf W}} , the choice of these two forms does not affect calibration. {\bf W}=\bar{\bf W}(\bar{\hbox{\boldmath$\Phi$}})+\Delta_{\bf W}. (9) Hence, the beam pattern model of a specific direction can further be defined as {\bf b}{(\hbox{\boldmath$\vartheta$})}=g(\hbox{\boldmath$\vartheta$}){{\bf W}}^{\sf H}{\bf a}(\hbox{\boldmath$\vartheta$}). (10) While more complex impairment models exist (e.g., array gain error considered in [ 5 ] ), the formulation in ( 10 ) is an approximation that yields accurate calibration performance with reduced complexity, which will be the main focus of this work. II-C Sensing Model Given a beam representation model, the sensing task can be defined as extracting the angle \vartheta from the observed signal {\bf y} . Considering the beam pattern error has a limited effect on delay estimation [ 5 ] , we focus on angle estimation based on mle ( mle ). We show that based on the model in ( 3 ), sensing relies only on the codebook {\bf W} , and the channel gain matrix \Gamma is a nuisance parameter for sensing-based calibration. The angle estimation for the LOS scenario can be formulated as [ 7 ] [\hbox{\boldmath$\vartheta$},\alpha]=\argmin_{\bm{\vartheta},\alpha}\|{\bf y}-\alpha{\bf b}(\hbox{\boldmath$\vartheta$})\|, (11) where {\bf y} is an observation vector for a specific location. To simplify the estimation, the nuisance parameter \alpha can be represented as \alpha=\frac{{\bf b}^{\sf H}(\bm{\vartheta}){\bf y}}{{\bf b}^{\sf H}(\bm{\vartheta}){\bf b}(\bm{\vartheta})} based on ( 11 ) with a given \vartheta , and the estimation problem can be written as [ 7 ] \begin{split}\hbox{\boldmath$\vartheta$}&=\argmin_{\bm{\vartheta}}\|{\bf y}-\frac{{\bf b}^{\sf H}(\bm{\vartheta}){\bf y}}{{\bf b}^{\sf H}(\bm{\vartheta}){\bf b}(\bm{\vartheta})}{\bf b}(\hbox{\boldmath$\vartheta$})\|^{2}\\ &=\argmin_{\bm{\vartheta}}{\bf y}^{\sf H}{\bf y}-\frac{{\bf b}^{\sf H}(\hbox{\boldmath$\vartheta$}){\bf y}}{{\bf b}^{\sf H}(\hbox{\boldmath$\vartheta$}){\bf b}(\hbox{\boldmath$\vartheta$})}{\bf y}^{H}{\bf b}(\hbox{\boldmath$\vartheta$})\\ &=\argmax_{\bm{\vartheta}}\frac{|{\bf b}^{\sf H}(\hbox{\boldmath$\vartheta$}){\bf y}|}{\|{\bf b}(\hbox{\boldmath$\vartheta$})\|}=\argmax_{\bm{\vartheta}}\frac{|{\bf a}^{\sf H}(\hbox{\boldmath$\vartheta$}){\bf W}{\bf y}|}{\|{\bf W}^{\sf H}{\bf a}(\hbox{\boldmath$\vartheta$})\|}.\end{split} (12) From ( 12 ) we can see that angle estimation is not related to the element pattern as g(\hbox{\boldmath$\vartheta$}) . However, to reconstruct the beam pattern for communication purposes, estimation of the element pattern is needed. II-D Calibration Models The goal of this calibration work is to find a beam representation {\bf b}(\hbox{\boldmath$\vartheta$}) defined in ( 10 ), based on the received pilot signals {\bf Y} in ( 3 ), such that the sensing performance in ( 11 ) can be improved. Next, we first describe the compact calibration model, followed by several calibration models. To assist calibration, we incorporate the element pattern (originally from {\bf b}(\hbox{\boldmath$\vartheta$}_{t}) as shown in ( 10 )) into the gain matrix \tilde{\hbox{\boldmath$\Gamma$}} to form \hbox{\boldmath$\Gamma$}=\text{diag}(\hbox{\boldmath$\gamma$}) with each diagonal element as \gamma_{t}=\tilde{\gamma}_{t}g(\hbox{\boldmath$\vartheta$}_{t}) . Consequently, the generic system model can be reformulated from ( 3 ) as {\bf Y}={\bf W}^{\sf H}{\bf A}(\hbox{\boldmath$\Theta$})\hbox{\boldmath$\Gamma$}+{\bf N}, (13) with {\bf A}(\hbox{\boldmath$\Theta$})=[{\bf a}(\hbox{\boldmath$\vartheta$}_{1}),\ldots,{\bf a}(\hbox{\boldmath$\vartheta$}_{T})]\in\mathbb{C}^{N\times T} as the steering matrix. Once the codebook \hat{\bf W} and the gain matrix \hat{\hbox{\boldmath$\Gamma$}} are obtained, the calibrated beam response can be expressed as \hat{\bf b}(\hbox{\boldmath$\vartheta$})=\hat{g}(\hbox{\boldmath$\vartheta$})\hat{\bf W}^{\sf H}{\bf a}(\hbox{\boldmath$\vartheta$}). (14) Since the gain estimate \Gamma corresponds to certain angles, we interpolate the element pattern \hat{g}(\hbox{\boldmath$\vartheta$}_{t})=r_{t}|\gamma_{t}| to obtain \hat{g}(\hbox{\boldmath$\vartheta$}) , where r_{t} is the compensation of path loss. Note that the beam response {\bf b}(\hbox{\boldmath$\vartheta$}) reflects the complex response gain for different angles, and normalization will be performed when evaluating the calibration accuracy. In this work, we assume UEs are dedicated calibration agents with known location 5 5 5 If UE positions are unknown, calibration (i.e., estimating {\bf W} and \Gamma ) needs to be performed jointly with localization (i.e., estimating \Theta ). However, this joint problem is non-identifiable, as the observation model is invariant to unitary transformations of the latent factors. For any for any unitary matrix {\bf D} , ({\bf D}{\bf W})^{\sf H}{\bf D}{\bf A}={\bf W}^{\sf H}{\bf A} , yielding equivalent observations. With appropriate priors (e.g., a partially calibrated codebook {\bf W} or known reference directions), the joint estimation can be reformulated as a Bayesian inference problem, which is left for future work. in each of the T measurements (e.g., from GPS), and hence the calibration task is to estimate the unknown parameters (e.g., codebook {\bf W} and beam gain matrix \Gamma , depending on the scenarios) and reconstruct the beam pattern {\bf b}(\theta) for better communication and sensing performance. Next, we detail different calibration scenarios, where model M1 works as the benchmark for models M2-M4, and the main focus is on M4 throughout this work. II-D 1 Benchmark Beam Pattern Model (M1) This model adopts an ideal codebook \bar{\bf W}(\bar{\hbox{\boldmath$\Phi$}}) with known beamforming directions \bar{\hbox{\boldmath$\Phi$}} . We assume the sample angle \hbox{\boldmath$\vartheta$}_{t} and distance r_{t} are known for each measurement point, the calibration objective is to estimate the channel gain matrix \Gamma and then extract the element pattern as g(\hbox{\boldmath$\vartheta$}_{t})=r_{t}|\gamma_{t}| . The corresponding signal model can be expressed as {\bf Y}^{\text{M1}}={\bar{\bf W}^{\sf H}(\bar{\hbox{\boldmath$\Phi$}}){\bf A}(\bar{\hbox{\boldmath$\Theta$}})\hbox{\boldmath$\Gamma$}}+{\bf N}. (15) From sensing perspective, no calibration is needed for M1, and the \Gamma is estimated for beam reconstruction purpose. II-D 2 Beamforming Angle Calibration (M2) Considering the inaccuracy of the beamforming angle provided by the array manufacturer, M2 focuses on the calibration of the matrices \Phi and \Gamma at the same time. The signal model in this case can be expressed as follows: {\bf Y}^{\text{M2}}={\bar{\bf W}^{\sf H}(\hbox{\boldmath$\Phi$}){\bf A}(\bar{\hbox{\boldmath$\Theta$}})\hbox{\boldmath$\Gamma$}}+{\bf N}. (16) The calibration M2 is expected to provide better performance than M1 with more accurate beamforming angles. II-D 3 Codebook Calibration (M3) Codebook calibration can only be performed offline to remove the effect of channel gain (e.g., inside the chamber or a well-controlled environment). Then, the calibration task becomes estimating the codebook {\bf W} and the directionality coefficient \beta defined in ( 5 ), assuming UE locations are known, and the signal model can be expressed as [ 32 , 29 ] {\bf Y}^{\text{M3}}={{\bf W}^{\sf H}{\bf A}(\bar{\hbox{\boldmath$\Theta$}})\hbox{\boldmath$\Gamma$}(\bar{\hbox{\boldmath$\Theta$}},\beta,\bar{\bf d})}+{\bf N}. (17) Note that M3 is the only model that uses the element pattern model defined in ( 5 ). The purpose of this model is to highlight the coupling of channel gain and element pattern, and a simple element pattern cannot well-capture the beam response. II-D 4 Joint Codebook and Gain Matrix Calibration (M4) The most practical model is to estimate {\bf W} and nuisance parameters \Gamma jointly, and the calibration model can be formulated as [ 29 ] {\bf Y}^{\text{M4}}={{\bf W}^{\sf H}{\bf A}(\bar{\hbox{\boldmath$\Theta$}})\hbox{\boldmath$\Gamma$}}+{\bf N}. (18) Compared with ( 15 ) to ( 16 ), the introduced unknowns {\bf W} and \Gamma increase the difficulties of the beam calibration task, requiring dedicated calibration algorithms, which will be detailed in Section IV . III Performance Metrics and Loss Functions This section starts by introducing several performance metrics, namely, response similarity, bias angle error, and codebook gain loss. Then, response error loss and angle error loss will be explained for calibration. III-A Performance Metrics To evaluate the quality of beam calibration, we introduce beam response similarity, angle estimation error, and codebook gain loss to evaluate the beam pattern error, sensing, and communication performances using the calibrated beams, respectively. III-A 1 Beam Response Similarity The total variation distance of power angular spectrum is often used to quantify the similarity between the reconstructed beam pattern and the reference one in ota and channel emulation testing, as defined in 3GPP TR 38.827 [ 1 ] . With the reconstructed pattern \hat{{\bf b}}(\hbox{\boldmath$\vartheta$}) and the ground truth \bar{\bf b}(\hbox{\boldmath$\vartheta$}) , the variation distance of two beam patterns can be defined as \tilde{E}_{\mathrm{R}}=\frac{1}{2}\int_{\bm{\vartheta}}\left|\frac{|\hat{b}(\hbox{\boldmath$\vartheta$})|}{\int_{\bm{\vartheta}}|\hat{b}(\hbox{\boldmath$\vartheta$})|\text{d}\hbox{\boldmath$\vartheta$}}-\frac{|\bar{b}(\hbox{\boldmath$\vartheta$})|}{\int_{\bm{\vartheta}}|\bar{b}(\hbox{\boldmath$\vartheta$})|\text{d}\hbox{\boldmath$\vartheta$}}\right|\text{d}\hbox{\boldmath$\vartheta$}. (19) However, the above equation only reflects the gain of the beam pattern (i.e., phase is ignored) and the integral is impractical for the discrete measurements. Based on ( 19 ), we define a discrete version of the normalized response error E_{\mathrm{R}} . By choosing a set of evaluation angles \hbox{\boldmath$\Theta$}_{s}=[\hbox{\boldmath$\vartheta$}_{1},\ldots,\hbox{\boldmath$\vartheta$}_{S}] ( S\leq T with \hbox{\boldmath$\Theta$}_{s} as a subset of all the measurement angles \Theta ), the response similarity S_{\mathrm{R}} ( 0\leq S_{\mathrm{R}}\leq 1 ) can be defined as S_{\mathrm{R}}=1-E_{\mathrm{R}}=1-\frac{1}{2}\left\|\frac{\hat{\bf B}(\hbox{\boldmath$\Theta$}_{s})}{\|\hat{\bf B}(\hbox{\boldmath$\Theta$}_{s})\|_{\text{F}}}-\frac{\bar{\bf B}(\hbox{\boldmath$\Theta$}_{s})}{\|\bar{\bf B}(\hbox{\boldmath$\Theta$}_{s})\|_{\text{F}}}\right\|_{\text{F}}. (20) Here, the response similarity can also be modified by adding different weighting factors for each evaluation angle, depending on the area of interest (e.g., large weights for boresight directions). For simplicity, we set the weighting factor to be identical for all the measurement angles and yield ( 20 ). III-A 2 Angle Estimation Bias Although response similarity can be used to evaluate differences between reconstructed beam patterns and ground truth, its performance in angle estimation cannot be directly quantified. To facilitate sensing-based performance evaluation, we adopt a pseudo-true parameter vector, which is defined as the point that minimizes the Kullback-Leibler divergence between f_{\text{TM}}({\bf y}|\bar{\bm{\eta}}) and f_{\text{MM}}({\bf y}|{\bm{\eta}}) as \displaystyle{\bm{\eta}}_{0}={\hbox{arg}}\min_{\bm{\eta}}D_{\text{KL}}(f_{\text{TM}}({\bf y}|\bar{\bm{\eta}})\|f_{\text{MM}}({\bf y}|{\bm{\eta}})). (21) with f_{\text{TM}}({\bf y}|\bar{\bm{\eta}}) and f_{\text{MM}}({\bf y}|{\bm{\eta}}) as the probability density functions of the true model and the mismatched model, respectively. The pseudo-true parameter is denoted as \hbox{\boldmath$\eta$}_{0}=[\mathrm{Re}(\gamma_{0}),\mathrm{Re}(\gamma_{0}),\theta_{0}^{\text{az}},\theta_{0}^{\text{el}}] , containing the nuisance parameter channel gain and the angle estimation. The groundtruth state vector and the state variable are denoted as \bar{\hbox{\boldmath$\eta$}} and \eta . Specifically, we adopt the ground truth beam pattern measurement \bar{\bf b}(\hbox{\boldmath$\vartheta$}) from the chamber as the true model {\bf y}_{\text{TM}}=\underbrace{\gamma\bar{\bf b}(\hbox{\boldmath$\vartheta$})}_{=\bar{\hbox{\boldmath$\mu$}}(\hbox{\boldmath$\eta$})}+{\bf n}, (22) and take the calibrated model as the mismatched model {\bf y}_{\text{MM}}=\underbrace{\gamma{\bf b}(\hbox{\boldmath$\vartheta$})}_{=\hbox{\boldmath$\mu$}(\hbox{\boldmath$\eta$})}+{\bf n}=\gamma{\bf W}^{\sf H}{\bf a}(\hbox{\boldmath$\vartheta$})+{\bf n}, (23) where {\bf y}_{\text{TM}}\sim f_{\text{TM}}({\bf y}|\hbox{\boldmath$\eta$}) and {\bf y}_{\text{MM}}\sim f_{\text{MM}}({\bf y}|\hbox{\boldmath$\eta$}) . Note that the pseudo-true parameter reflects the best performance that an estimator can achieve, which is limited by the bias as \|\hbox{\boldmath$\vartheta$}_{0}-\bar{\hbox{\boldmath$\vartheta$}}\| . By defining \hbox{\boldmath$\epsilon$}(\hbox{\boldmath$\eta$})\triangleq\bar{\hbox{\boldmath$\mu$}}(\bar{\bm{\eta}})-\hbox{\boldmath$\mu$}({\bm{\eta}}) , the pseudo-true parameter can be obtained as follows [ 20 ] : {\bm{\eta}}_{0}={\hbox{arg}}\min_{{\bm{\eta}}}\|\hbox{\boldmath$\epsilon$}(\hbox{\boldmath$\eta$})\|^{2}={\hbox{arg}}\min_{{\bm{\eta}}}\|\bar{\hbox{\boldmath$\mu$}}(\bar{\bm{\eta}})-\hbox{\boldmath$\mu$}({\bm{\eta}})\|^{2}. (24) A practical solution is to estimate {\bm{\eta}}_{0} using gradient-based methods initialized with the true value \bar{\bm{\eta}} under the assumption that UE positions are known. With the pseudo-true angle estimation \hbox{\boldmath$\vartheta$}_{0}=[\theta_{0}^{\text{az}},\theta_{0}^{\text{ele}}]^{\top} , we define angle estimation error as \tilde{E}_{\mathrm{A}}=\int_{\bm{\vartheta}}\|\hat{\hbox{\boldmath$\vartheta$}}_{{\bf y}_{\text{MM}|\hat{\bf b}(\cdot)}}(\bar{\bf b}(\hbox{\boldmath$\vartheta$}))-\hbox{\boldmath$\vartheta$}\|^{2}\text{d}\hbox{\boldmath$\vartheta$}, (25) where \hat{\hbox{\boldmath$\vartheta$}}_{{\bf y}_{\text{MM}}|\hat{\bf b}(\cdot)}(\bar{\bf b}(\hbox{\boldmath$\vartheta$}))\triangleq\hbox{\boldmath$\vartheta$}_{0} denotes the estimated angle with \bar{\bf b}(\hbox{\boldmath$\vartheta$}) as the input and the reconstructed beam pattern \hat{\bf b}(\cdot) for signal model {\bf y}_{\text{MM}|\hat{\bf b}(\cdot)} . Similar to ( 20 ), a tractable angle error loss can be defined using a set of evaluation angles \hbox{\boldmath$\Theta$}_{s}=[\hbox{\boldmath$\vartheta$}_{1},\ldots,\hbox{\boldmath$\vartheta$}_{S}]^{\top} as {E}_{\mathrm{A}}=\frac{\sum_{s}\|\hat{\hbox{\boldmath$\vartheta$}}_{{\bf y}_{\text{MM}|\hat{\bf b}(\theta)}}(\bar{\bf b}(\hbox{\boldmath$\vartheta$}_{s}))-\hbox{\boldmath$\vartheta$}_{s}\|^{2}}{S}. (26) Here, the angle error E_{\mathrm{A}} captures the average angle estimation error using the calibrated beam pattern model to process the data from the true model, which serves as a sensing-oriented performance metric. III-A 3 Codebook Gain Loss As a benchmark for communications, we define gain loss to quantify the effect of calibration on communication performance in the LOS scenario. Specifically, the best beam is selected based on the known beam pattern to achieve the maximum LOS gain (i.e., ideal beam pattern for the uncalibrated case and M1 to M4 for the calibrated array). Similar to the E_{\text{R}} and E_{\text{A}} , the gain loss can be expressed as the average relative gain between the BS-assumed beam pattern and the ideal beam pattern among all the evaluation angles E_{\mathrm{C}}=\frac{1}{S}\sum_{s}\frac{\left\|\bar{{\bf b}}^{\sf H}_{\hat{g}^{\star}_{s}}(\hbox{\boldmath$\vartheta$}_{s}){\bf a}(\hbox{\boldmath$\vartheta$}_{s})\right\|^{2}}{\left\|\tilde{{\bf b}}^{\sf H}_{\tilde{g}^{\star}_{s}}(\hbox{\boldmath$\vartheta$}_{s}){\bf a}(\hbox{\boldmath$\vartheta$}_{s})\right\|^{2}}. (27) where \hat{g}^{\star}_{s}\!=\!\argmax_{g}|{\hat{\bf b}}_{g}(\hbox{\boldmath$\vartheta$}_{s})| and \tilde{g}^{\star}_{s}\!=\!\argmax_{g}|{\tilde{\bf b}}_{g}(\hbox{\boldmath$\vartheta$}_{s})| are the optimal beam indices obtained from the calibrated beam pattern \hat{\bf b}(\hbox{\boldmath$\vartheta$}) and the ideal beam pattern \tilde{\bf b}(\hbox{\boldmath$\vartheta$}) defined in ( 4 ), respectively. The above equation captures the weighted gain loss compared with an ideal array beam pattern, which is used for evaluating communication performance improvement after calibration. III-B Loss Functions III-B 1 Response Error Loss Inspired by the response similarity defined in ( 20 ), we aim to reduce the error between the reconstructed beam pattern and the reference one, and formulate the rel ( rel )-based calibration. Given the received signal {\bf Y} , the calibration task is to find the optimal {\bf W} and \Gamma that minimize the rel L_{\text{REL}} as [\hat{{\bf W}},\hat{\hbox{\boldmath$\Gamma$}}]={\hbox{arg}}\min_{{\bf W},\,\hbox{\boldmath$\Gamma$}}\;L_{\mathrm{R}}({\bf Y},{\bf W},\hbox{\boldmath$\Gamma$}),\quad\text{s.t.}\|{\bf w}_{g}\|_{2}=1,\;\forall g, (28) where L_{\mathrm{R}}({\bf Y},{\bf W},\hbox{\boldmath$\Gamma$})=\|{\bf Y}-{\bf W}^{\sf H}{\bf A}\bm{\Gamma}\|_{\text{F}}^{2}/T. (29) The above formulation can be implemented for both 2D and 3D beams, with each column of {\bf A} representing a steering vector for a specific target position. III-B 2 Angle Error Loss Based on the definition of angle error in ( 26 ), we can formulate ael ( ael ) as \tilde{L}_{\mathrm{A}}({\bf Y},{\bf W},\hbox{\boldmath$\Gamma$})={\sum_{t=1}^{T}\|\hat{\hbox{\boldmath$\vartheta$}}_{{\bf y}_{\text{MM}|\hat{\bf b}(\theta)}}({\bf y}_{t})-\hbox{\boldmath$\vartheta$}_{t}\|^{2}}/T. (30) However, this loss function requires bilevel optimization [ 34 ] , where an inner optimization (i.e., finding the pseudo-true angle) needs to be solved to calculate the loss values. To assist calibration, we propose a differentiable ael function to reduce sensing angle error. From ( 12 ), it is shown that the angle estimation is trying to find the maximized normalized projection of the beam response onto the observations. Inspired by this, we define a new loss function as an alternative to L_{2} by matching the normalized projection of the observations as \begin{split}&L_{\mathrm{A}}({\bf Y},{\bf W},\hbox{\boldmath$\Gamma$})=\frac{\sum_{t,s}|e_{t,s}|^{2}}{TS},\\ &e_{t,s}=u_{t,s}-\check{u}_{t,s}=\frac{{\bf b}^{\sf H}(\hbox{\boldmath$\vartheta$}_{t}){\bf y}_{s}}{\|{\bf b}(\hbox{\boldmath$\vartheta$}_{t})\|}-\frac{{\bf y}_{t}^{\sf H}{\bf y}_{s}}{\|{\bf y}_{t}\|}.\end{split} (31) Here, {\bf b}(\hbox{\boldmath$\vartheta$})=\gamma(\hbox{\boldmath$\vartheta$}){\bf W}^{\sf H}{\bf a}(\hbox{\boldmath$\vartheta$}) denotes the calibrated beam pattern, and {\bf y}_{t} and {\bf y}_{s} are the received signal at the \hbox{\boldmath$\vartheta$}_{t} and \hbox{\boldmath$\vartheta$}_{s} , respectively. For the ease of gradient calculation, we adopt {{\bf b}^{\sf H}(\hbox{\boldmath$\vartheta$}_{t}){\bf y}_{s}} instead of {|{{\bf b}^{\sf H}(\hbox{\boldmath$\vartheta$}_{t}){\bf y}_{s}}|} . Similar to ( 20 ), the evaluation angles \hbox{\boldmath$\Theta$}_{s}=[\hbox{\boldmath$\vartheta$}_{1},\ldots,\hbox{\boldmath$\vartheta$}_{S}]^{\top} are chosen as a subset of the measurement angles \hbox{\boldmath$\Theta$}=[\hbox{\boldmath$\vartheta$}_{1},\ldots,\hbox{\boldmath$\vartheta$}_{T}]^{\top} to reduce the complexity of the algorithm. The term \check{u}_{t,s} is defined by replacing \bar{{\bf b}}(\hbox{\boldmath$\vartheta$}_{t}) in \frac{\bar{\bf b}^{\sf H}(\hbox{\boldmath$\vartheta$}_{t}){\bf y}_{s}}{\|\bar{\bf b}(\hbox{\boldmath$\vartheta$}_{t})\|} with a noisy measurement {\bf y}_{t} for practical implementation purposes. With the loss function defined in ( 31 ), the problem can be solved using iterative optimization. IV Calibration Algorithm In this section, we start with the rel -based calibration algorithm for model M4 using ao ( ao ). Then, REL-based and ael -based calibration algorithms using gd ( gd ) will be detailed, followed by the discussions on cooperative strategies and complexity analysis. The calibration using models M1-M3 can be performed as a subproblem of model M4-based calibration, with the knowledge of beamforming angle (M2) and element pattern (M3) that can be obtained from the chamber. IV-A REL-Based Calibration (AO) The idea of ao is to optimize one variable while fixing the other one. We start with the most general case (i.e., M4), where both the beamforming matrix {\bf W} and the channel gain matrix \Gamma need to be estimated jointly. For simplicity, the angle set \Theta in ( 13 ) is ignored (i.e., using {\bf A} instead of {\bf A}(\hbox{\boldmath$\Theta$}) ), and we set \rho_{s}=1 for all the sample angles. IV-A 1 Update \Gamma given \hat{\bf W} A practical way of initializing ao is to use the beamforming direction \bar{\hbox{\boldmath$\Phi$}} given by the antenna array manufacturer (see M1 in ( 15 )). With an estimated \hat{\bf W} , the update on \Gamma is straightforward, which can be formulated as \hat{\hbox{\boldmath$\Gamma$}}=\argmin_{\bm{\Gamma}}\|{\bf Y}-\hat{\bf W}^{\sf H}{\bf A}\hbox{\boldmath$\Gamma$}\|_{\text{F}}^{2}. (32) Since \Gamma is diagonal, each diagonal element \gamma_{t} can be updated independently and in parallel as \hat{\gamma}_{t}=\argmin_{\gamma}\|{\bf y}_{t}-\gamma\hat{\bf b}_{t}\|^{2}, (33) where {\bf y}_{t}\in\mathbb{C}^{G\times 1} and \hat{\bf b}_{t} are the t -th columns of matrices {\bf Y} and \hat{\bf W}{\bf A} , respectively. The closed-form solution is then given by \hat{\gamma}_{t}=\frac{\hat{\bf b}_{t}^{\sf H}{\bf y}_{t}}{\hat{\bf b}_{t}^{\sf H}\hat{\bf b}_{t}}. (34) IV-A 2 Update {\bf W} given \hat{\hbox{\boldmath$\Gamma$}} With a known \hat{\hbox{\boldmath$\Gamma$}} , the update of {\bf W} under the unit-norm constraint on each column can be formulated as \min_{\|{\bf w}_{g}\|_{2}=1}\|{\bf y}_{g}-{\bf w}_{g}^{\sf H}{\bf A}\hat{\hbox{\boldmath$\Gamma$}}\|^{2}, (35) where {\bf y}_{g} denotes the g -th row of {\bf Y} . Let {\bf B}={\bf A}\hat{\hbox{\boldmath$\Gamma$}} , {\bf Q}={\bf B}{\bf B}^{\sf H} (Hermitian psd), and {\bf b}_{g}={\bf B}{\bf y}_{g}^{\sf H} . The Karush–Kuhn–Tucker (KKT) optimality conditions for ( 35 ) (using Wirtinger calculus for complex variables [ 4 ] , and the trust-region form [ 19 ] ) yield the following system: ({\bf Q}+\lambda_{g}{\bf I}){\bf w}_{g}={\bf b}_{g},\qquad\|{\bf w}_{g}\|=1, (36) where \lambda_{g}\in\mathbb{R} is the Lagrange multiplier. The function f(\lambda_{g})=\|({\bf Q}+\lambda_{g}{\bf I})^{-1}{\bf b}_{g}\| is strictly decreasing in \lambda_{g} . If the least-squares solution {\bf w}_{g}^{\dagger}={\bf Q}^{\dagger}{\bf b}_{g} satisfies \|{\bf w}_{g}^{\dagger}\|_{2}\leq 1 , then it already meets the constraint and the optimum is {\bf w}_{g}^{\star}={\bf w}_{g}^{\dagger} (i.e., \lambda_{g}^{\star}=0 ). Otherwise, its root \lambda_{g}^{\star} satisfying f(\lambda_{g})=1 can be found efficiently via a one-dimensional bisection search. Consequently, the resulting vector {\bf w}_{g}^{\star}=({\bf Q}+\lambda_{g}^{\star}{\bf I})^{-1}{\bf b}_{g} satisfies the unit-norm constraint \|{\bf w}_{g}^{\star}\|_{2}=1 and provides the exact constrained minimizer of ( 35 ). IV-B REL-Based Calibration (GD) The trust-region formulation in ( 36 ) guarantees KKT optimality. However, it incurs a high computational cost since each column {\bf w}_{g} requires solving a scalar root-finding problem involving the matrix inverse ({\bf Q}+\lambda_{g}{\bf I})^{-1} . This subsection provides a gd -based solution for REL-based calibration with a batch size S_{\text{batch}} . Considering the real-valued loss function defined in ( 20 ) and its involved complex variables, we develop a gradient-based method to update {\bf W} and \gamma based on complex gradient operators [ 4 ] (Theorem 4). Specifically, the codebook {\bf W} and the channel gain vector \gamma for each iteration are updated with a learning rate l_{r} as \displaystyle{\bf W}^{(i+1)} \displaystyle={\bf W}^{(i)}-l_{r}\frac{\partial L_{\mathrm{R}}}{\partial{\bf W}^{*}}\Bigg|_{{\bf W}={\bf W}^{(i)}}, (37) \displaystyle\hbox{\boldmath$\gamma$}^{(i+1)} \displaystyle=\hbox{\boldmath$\gamma$}^{(i)}-l_{r}\frac{\partial L_{\mathrm{R}}}{\partial\hbox{\boldmath$\gamma$}^{*}}\Bigg|_{\hbox{\boldmath$\gamma$}=\hbox{\boldmath$\gamma$}^{(i)}}. (38) Note that the calculation of {\bf W}^{(i+1)} in ( 37 ) is followed by the normalization of each codeword to fulfill the constraint. For REL-based calibration, we need to calculate the gradient term \partial L_{\mathrm{R}}/\partial{\bf W}^{*} . Based on ( 29 ), we can define the residual {\bf e}_{t}={\bf y}_{t}-{\bf b}_{t}={\bf y}_{t}-\gamma_{t}{\bf W}^{\sf H}{\bf a}_{t}, (39) where \check{\bf b}_{t} , {\bf b}_{t} and {\bf a}_{t} are defined after ( 44 ). Expanding the squared norm, we get \|{\bf e}_{t}\|^{2}={\bf y}_{t}^{\sf H}{\bf y}_{t}-{\bf y}_{t}^{\sf H}\gamma_{t}{\bf W}^{\sf H}{\bf a}_{t}-\gamma_{t}^{*}{\bf a}_{t}^{\sf H}{\bf W}{\bf y}_{t}+|\gamma_{t}|^{2}{\bf a}_{t}^{\sf H}{\bf W}{\bf W}^{\sf H}{\bf a}_{t}. (40) And the gradient of L_{\mathrm{R}} with respect to {\bf W}^{*} and \gamma_{t} can be expressed respectively as \displaystyle\frac{\partial L_{\mathrm{R}}}{\partial{\bf W}^{*}} \displaystyle=\frac{1}{T}\sum_{t=1}^{T}\left(-\gamma_{t}{\bf a}_{t}{\bf y}_{t}^{\sf H}+|\gamma_{t}|^{2}{\bf a}_{t}{\bf a}_{t}^{\sf H}{\bf W}\right), (41) \displaystyle\frac{\partial L_{\mathrm{R}}}{\partial\gamma_{t}^{*}} \displaystyle=\frac{1}{T}(-{\bf a}_{t}^{\sf H}{\bf W}{\bf y}_{t}+\gamma_{t}{\bf a}_{t}^{\sf H}{\bf W}{\bf W}^{\sf H}{\bf a}_{t}). (42) Note that the GD-based update on \gamma is not mandatory. By insterting the updated codebook \hat{\bf W}={\bf W}-l_{r\text{R}}\frac{\partial L_{\mathrm{R}}}{\partial{\bf W}^{*}} into ( 32 ) with column normalization, AO-based update on the gain matrix \Gamma can still be performed for REL-based calibration. In the simulation section that follows, we will keep the best-performing method (GD-based update on {\bf W} only) and show how mini-batch gd empirically outperforms ao and how the hyperparameters affect the calibration performance. IV-C AEL-Based Calibration Based on the available estimated {\bf W} , \Gamma (e.g., from REL-based calibration), the current beam response can be calculated as {\bf B}={\bf W}^{\sf H}{\bf A}(\hbox{$\bm{\theta}$})\hbox{\boldmath$\Gamma$} . Together with the normalized measurement \check{\bf B} , the iterative optimization can be performed for AEL-based calibration for M4 using the loss function L_{\mathrm{A}} . To assist derivation, we compute the gradients of the proposed error loss L_{\text{DA}} with respect to the model parameters {\bf W}^{*} and \gamma_{t}^{*} using Wirtinger calculus, by calculating the derivative of the loss e_{t,s} with respect to the unknown parameters and summing over T samples and S anchors. The gradients of the proposed error loss L_{\text{DA}} with respect to the model parameters {\bf W}^{*} and \gamma_{t}^{*} are given by \displaystyle\frac{\partial L_{\mathrm{A}}}{\partial{\bf W}^{*}} \displaystyle=\frac{\sum_{t,s}\!\left[\frac{\gamma_{t}}{q_{t}}\,e_{t,s}\,{\bf a}_{t}{\bf y}_{s}^{{\sf H}}-\frac{|\gamma_{t}|^{2}}{q_{t}^{2}}\,\Re\{e_{t,s}u_{t,s}^{*}\}\,{\bf a}_{t}{\bf a}_{t}^{{\sf H}}{\bf W}\right]}{TS}, (43) \displaystyle\frac{\partial L_{\mathrm{A}}}{\partial\gamma_{t}^{*}} \displaystyle=\frac{j\sum_{s}\rho_{t,s}\,\Im\{e_{t,s}^{*}u_{t,s}\}}{\gamma_{t}^{*}TS}. (44) The intermediate variables are defined as {\bf a}_{t}={\bf a}(\hbox{\boldmath$\vartheta$}_{t}) , q_{t}=|\gamma_{t}|\|{\bf W}^{\sf H}{\bf a}_{t}\| , p_{t,s}=\gamma_{t}{\bf a}_{t}^{\sf H}{\bf W}{\bf y}_{s} , u_{t,s}=\frac{p_{t,s}}{q_{t}} , \check{u}_{t,s}=\frac{{\bf y}_{t}^{\sf H}{\bf b}_{s}}{\|{\bf y}_{t}\|} , with {\bf b}_{t}=\gamma_{t}{\bf W}^{\sf H}{\bf a}_{t} . The AEL-based calibration is based on the loss function in ( 31 ) and hence there is no closed-form solution for \gamma_{t} , in contrast to the REL-based calibration in ( 34 ). The detailed derivation is provided in Appendix A . IV-D Cooperative Calibration From the calibration models, we can see that the channel gain matrix is only used for beam representation, which aligns the reconstructed beam pattern as closely as the original ground truth pattern. When performing localization and sensing, the complex gain will be a function of the target angle and the codebook, as shown in equation ( 11 ). Consequently, the matrix {\bf W} is the variable of interest for calibration. Ideally, the BS can collect all the received signals from several UEs, and calibration can be done centrally based on the ground truth UE state. However, the communication between BS and UEs introduces overhead. Instead, distributed calibration at each UE side can largely reduce the complexity, such as large matrix inversion, and communication overhead. By using a federated learning strategy initialized with a local model broadcasted by the BS as {\bf W}^{-} , each user m can update the local model with the beam pattern difference \Delta_{{\bf W}_{m}} , and the BS can aggregate the local models as {\bf W}^{+}={\bf W}^{-}+\sum_{m}\xi_{m}\Delta_{{\bf W}_{m}}, (45) where \xi_{m} is the weighting coefficient for the m -th local model. While the choice of coefficients (e.g., based on the UE’s hardware capability, location, and number of measurements) influences performance, this work focuses on evaluation rather than on their optimization. In the above equation, the nuisance parameter \hbox{\boldmath$\Gamma$}_{m} is not included and the beamforming matrix {\bf W}^{+} also needs to be normalized after each update. However, it could be utilized to design the weighting coefficients (e.g., larger coefficients for the model with a larger channel gain). IV-E Complexity Analysis The computational complexity of the proposed calibration methods is analyzed as follows. For REL-based calibration with ao , the update of \Gamma in ( 32 ) requires matrix multiplication cost as \mathcal{O}(GNT) . The update of {\bf W} in ( 35 ) requires \mathcal{O}(GNT+N^{2}T+GN^{2}) operations for matrix multiplication, followed by eigen decomposition and bisection search with the complexity of \mathcal{O}(N^{3}) and \mathcal{O}(LGN^{2}) , respectively. Therefore, the total computational complexity per iteration is \mathcal{O}\big(GNT+N^{2}T+GN^{2}+N^{3}+LGN^{2}\big) . For REL-based calibration using gd in ( 41 ), the gradient evaluation can be efficiently implemented via rank-one updates, resulting in a per-sample cost of \mathcal{O}(GN) and hence \mathcal{O}(GNT_{b}) per iteration with batch size T_{b} . For AEL-based calibration in ( 43 ) and ( 44 ), evaluating the gradient requires computing a_{s}^{{\sf H}}{\bf W} once per sample at cost \mathcal{O}(NG) , and then accumulating across T_{b} samples and S anchors, resulting a complexity of \mathcal{O}(GNT_{b}S) . In summary, REL-based calibration using gd scales linearly with the batch size and the number of antennas and anchors, providing a flexible and robust solution towards calibration. In addition, we notice that the AEL-based algorithm has a higher complexity than the REL-based calibration, depending on the anchor size S . Fig. 2: The photo of the RIS pattern measurements in the anechoic chamber. V Simulation and Experimental Validation We start with the measurement data from the chamber, which serves two purposes: (i) to provide ideal measured data to evaluate different beam pattern models, and (ii) to benchmark the developed calibration algorithms in more practical settings (e.g., different transmit powers). However, the proposed cooperative calibration can also be applied in practical scenarios. In addition, both 2D and 3D beam pattern calibration results will be presented, and different calibration scenarios will also be evaluated. (a) -100 -50 0 50 100 0 0.5 1 Angles [Deg] Normalized Amplitude Beam Pattern Beamforming Angle (b) (c) Fig. 3: Visualization of beam pattern measurements collected from the chamber: (a) 3D beam pattern for scanning angle at [-20^{\circ},-20^{\circ}] ; (b) Visualization of 2D beam patterns ( 11 codewords) when elevation angle is 0^{\circ} ; (c) Visualization of 3D beam patterns ( 6\times 11 codewords, and the red cross indicates ideal beamforming angle). V-A System Setup To obtain the ground truth calibration data, we measured the reflected beam pattern of a real-world RIS plate 6 6 6 The proposed calibration models can be implemented in both analog arrays and passive RISs. In this work, the transmitter and the RIS board have a fixed position and are treated as an analog array. in the anechoic chamber, as shown in Fig. 2 . The specifications of the RIS board under test are summarized in Table II , and more details on its design can be found in [ 12 ] . In each beam, RIS coefficients can be programmed to assign the phase shift values to maximize the energy in this direction, and the corresponding beam pattern requires calibration. Here, we measured G=6\times 11=66 beam patterns with its target boresight direction pointing at \bar{\hbox{\boldmath$\Phi$}}=[\bar{\phi}^{\mathrm{az}},\bar{\phi}^{\mathrm{el}}]^{\top} where \bar{\phi}^{\mathrm{az}}\in\{-50^{\circ},-40^{\circ},\ldots,50^{\circ}\} , \bar{\phi}^{\mathrm{el}}\in\{-50^{\circ},-40^{\circ},\ldots,0^{\circ}\} , respectively. The SNR of the measurements in the chamber was around 35 dB. Note that the boresight direction of the practical RIS beams can be different from the target angles, which is one of the key motivations for beam calibration. The resulting beam patterns were measured over a hemispherical range, with the azimuth angle varying from -90^{\circ} to 90^{\circ} and the elevation angle from -90^{\circ} to 90^{\circ} , both sampled at 1^{\circ} intervals, resulting in a measurement dataset \bar{\bf B}_{\text{3D}}\in\mathbb{C}^{66\times 181\times 181} . For 2D beam pattern calibration, we set the elevation angle as 0^{\circ} and use a subset of the measurement data as \bar{\bf B}_{\text{2D}}\in\mathbb{C}^{11\times 181} . The measurement data is used as the ground truth and for generating synthetic measurement data for calibration performance evaluation in different scenarios. TABLE II: RIS Specifications and Calibration Parameters Parameters 2D 3D Operation frequency 5 GHz Phase-shifter resolution 2-bit (0 ∘ , 90 ∘ , 180 ∘ and 270 ∘ ) Polarization linear polarization G (beams) 11 66 N (antennas) 16 256 T (sample angles) 561 12831 Sample angle range (azi.) [-70^{\circ},70^{\circ}] [-70^{\circ},70^{\circ}] Sample angle range (ele.) - [-70^{\circ},20^{\circ}] S (evaluation angles) 81 119 Anchor angle range (azi.) [-40^{\circ},40^{\circ}] [-40^{\circ},40^{\circ}] Anchor angle range (ele.) - [-40^{\circ},10^{\circ}] M (cooperative users) 3 - l_{r\text{R}} : REL learning rate 0.02 0.1 l_{r\text{A}} : REL learning rate 0.03 0.2 V-B Visualization of Measurement Data The visualization of a specific 3D codeword (beamforming direction [0^{\circ},0^{\circ}]^{\top} ) can be found in Fig. 3 (a). When considering 2D beam pattern calibration, the beam patterns of 11 codewords are shown in Fig. 3 (b). For better visualization of the whole codebook in 3D calibration, we extract the largest gain (e.g., getting the maximum amplitude in the first dimension of the reshaped measurement dataset \bar{{{\bf B}}}_{\text{3D}} ) at certain angles as shown in Fig. 3 (c). We can clearly see the offset between the main lobe direction and the expected beamforming direction \bar{\hbox{\boldmath$\Phi$}} (red cross markers), necessitating the need for calibration. TABLE III: Beam Pattern Calibration Results (in terms of beam similarity S_{\mathrm{R}} , angle error E_{\mathrm{A}} , and codebook gain loss E_{\mathrm{C}} ) Model S_{\mathrm{R}} [%] E_{\mathrm{A}} [ ∘ ] E_{\mathrm{C}} [dB] 2D M1 (uncalibrated) 80.60 1.0123 -1.4019 M2 80.62 0.7926 -1.2367 M3 80.40 2.5284 -1.5944 M4 ( L_{\mathrm{R}} -AO) 96.45 0.1654 -1.1640 M4 ( L_{\mathrm{R}} -GD) 96.81 0.1506 -1.1636 M4 ( L_{\mathrm{A}} ) 95.81 0.1086 -1.1636 3D M1 (uncalibrated) 63.72 5.1874 -2.7750 M2 63.30 3.5235 -1.6316 M3 78.79 2.3497 -3.2833 M4 ( L_{\mathrm{R}} -AO) 95.65 0.9559 -1.5236 M4 ( L_{\mathrm{R}} -GD) 97.30 0.8906 -1.5250 M4 ( L_{\mathrm{A}} ) 93.93 0.8556 -1.5241 V-C Calibration Performance Evaluation The calibration methods described in this work are implemented in 2D and 3D scenarios. The comparison of different calibration methods on various performance metrics and models is shown in Table III . We notice that the calibration model M4, which considers estimating both the beamforming matrix {\bf W} and channel gain matrix \Gamma , achieves the best performance. Furthermore, the implementation of the loss function L_{\text{DA}} further improves AEL, showing the effectiveness of the proposed loss function. We also noticed that the calibration error of 3D beam patterns is much larger than the 2D benchmark, and the improvement using AEL is limited. This is due to the higher dimension of calibration parameters that produces a large number of local minima, which affect the gradient-based calibration processes and lead to suboptimal solutions. In summary, the calibration method in this work can improve the angle estimation performance from 1.01^{\circ}/5.19^{\circ} to 0.11^{\circ}/0.86^{\circ} in 2D/3D scenarios, respectively. -80 -60 -40 -20 0 20 40 60 80 0 0.2 0.4 0.6 0.8 Angles [Deg] Normalized Amplitude Ground Truth M2 M3 M4 ( L_{\text{R}} -GD) M4 (L_{\text{A}}) Fig. 4: Visualization of the reconstructed 2D beam patterns ( \bar{\varphi}=-20^{\circ} ). (a) Ground truth (b) Ideal beam pattern (c) M4 ( L_{\text{R}} -GD) (d) M4 ( L_{\text{DA}} ) Fig. 5: Visualization of the reconstructed 3D beam patterns. The visualization of one specific calibrated 2D beam patterns (beamforming angle \bar{\phi}^{\text{az}}=-20^{\circ} ) is shown in Fig. 4 . Here, we omit M1 and M4 ( L_{R} ) due to the better performance of M2 and M4 ( L_{\text{R}} -GD), respectively. Despite the superior performance of L_{\text{R}} -based calibrations over L_{\text{DA}} in REL, the reconstructed beam pattern based on L_{\text{DA}} is closer to the ground truth beam pattern in the main lobe, which is also reflected from other beam patterns that are not visualized. The visualization of calibrated 3D beam patterns (beamforming angle \bar{\hbox{\boldmath$\varphi$}}=[-20^{\circ},-20^{\circ}]^{\top} ) is shown in Fig. 5 . The calibrated beam patterns in Fig. 5 (c) and Fig. 5 (d) can capture the features of ground truth much better than the uncalibrated one in Fig. 5 (b). It is also seen that there are some outliers in AEL-based calibration on edge angles, which is due to the selection of evaluation angles. The heatmap of angle estimation bias using the calibrated beam pattern is shown in Fig. 6 , where the error level in all areas of interest can be largely reduced using the calibrated beam pattern. (a) M1 (b) M4 ( L_{\mathrm{A}} ) Fig. 6: Visualization of angle estimation errors before and after calibration. V-D Evaluation of Calibration Parameters Due to the high calculation complexity using 3D beam data, we next focus on 2D beam pattern calibration and evaluate the impact of different parameters on calibration model M4. We first assess the performance improvement using gd -based method compared with AO in REL-based calibration, as shown in Fig. 7 . It is shown that the AO-based benchmark cannot converge well even with a sufficient number of iterations. In contrast, the gd -based method performs better with sufficient iterations and appropriate parameters. Specifically, a smaller mini-batch size requires a larger learning rate compared with processing all the measurement data at the same time. However, when the learning rate is too high, performance will be affected with oscillating loss, as shown in the curve with l_{r}=0.1 with the whole batch processing. It is foreseen that more advanced optimizers can be adopted for better performance, which is beyond the scope of this work. 0 20 40 60 80 100 10^{-1} 10^{0} Iteration Angle Error Loss ( L_{\text{A}} ) l_{r}=0.02 , S_{\text{batch}}=100 l_{r}=0.1 , S_{\text{batch}}=100 l_{r}=0.02 , S_{\text{batch}}=561 l_{r}=0.1 , S_{\text{batch}}=561 M3 ( L_{\text{R}} -AO) Benchmark Fig. 7: Evaluation of different parameters using REL-based calibration ( gd ). With a calibrated beam based on L_{\text{R}} , AEL-based calibration can be performed. The evaluation of 20 different initial beamforming matrices {\bf W} is shown in Fig. 8 . Specifically, multiple realizations are visualized in the green area, with two specific realizations and mean loss plotted in dashed and solid curves. It is seen that the initial point directly affects calibration performance. Nevertheless, the proposed AEL-based calibration loss function can stably decrease the angle error in general. 0 50 100 150 200 250 300 0.1 0.12 0.14 0.16 0.18 Iteration Angle Loss Mean Multiple realizations Realization 1 Realization 2 Fig. 8: AEL-based calibration with different initial codebooks {\bf W} obtained using REL-based calibration. For more practical consideration, we evaluate the impact of measurement noise on calibration. In this simulation, the BS is located at [0,0]~\text{m} , and the UE moves from [10,-30]~\text{m} to [10,30]~\text{m} along the line x=10~\text{m} , with samples taken every 0.2\,\text{m} along the y -axis. Three scatterers are evenly spaced along the y -range [-30,30]~\text{m} at x=10 , and each scatterer is surrounded by 5 scattering points randomly distributed within a 1-meter radius circle centered at the scatterer. With different transmit power, the calibration performance (using angle loss) of M4-AEL is shown in Fig. 9 (a). Benchmarked against the scenario without noise and MPCs, the angle loss in noise-free calibration with MPCs increases the angle error from 0.21^{\circ} to 0.33^{\circ} . The blue, yellow, and red curves combine the effects of received signal noise and the MPCs, showing that the calibration performance will be affected by strong MPCs (e.g., RCS = 10). As for the effect of signal noise, it can be mitigated by increasing transmit power. We further investigate different calibration scenarios at the transmit power of 15 dBm. The CDF of angle estimation error is shown in Fig. 9 (b), highlighting a large gap caused by MPCs in the range of 0.2\leq\epsilon\leq 1.2 . -5 0 5 10 15 20 25 30 0.2 0.4 0.6 0.8 1 Transmit Power [dBm] Angle Loss With noise and MPCs (RCS = 10) With noise and MPCs (RCS = 2) With only MPCs (RCS = 10) With only noise Without noise and MPCs (a) 0 0.5 1 1.5 2 0 0.2 0.4 0.6 0.8 1 \epsilon \text{Pr(Angle Loss \textless}\epsilon\text{)} With noise and MPCs (RCS = 10) With noise and MPCs (RCS = 2) With only MPCs (RCS = 10) With only noise Without noise and MPCs (b) Fig. 9: Evaluation of the impacts of MPCs and transmit power on calibration performance. (a) Angle loss vs. transmit power; (b) CDF of the angle loss under different scenarios. V-E Cooperative Calibration We further evaluate the performance using a cooperative calibration strategy, where M=3 UEs process the local dataset to obtain a local beam pattern, which is then used for global fusion. The total dataset T=561 is randomly split into 3 subsets with T_{1}=100 , T_{2}=200 , and T_{3}=261 . The AELs for all the users using local calibrated results are shown in Fig. 10 , benchmarked by the global calibration with all of the measurements (solid green curve). The cooperative calibration result is shown in the dashed black curve. For each point of the fused results, it reflects merging the calibrated local parameters after i iterations {\bf W}_{m,i} with equal coefficients as described in ( 45 ). It is shown that with a sufficient number of iterations, cooperative calibration can achieve comparable performance as the global calibration strategy with a much reduced communication overhead when the measurements are large (reduced to M\times G\times N from M\times G\times T in terms of complex entries). Note that the calibration performance is also decided by the coverage of the data, and calibration strategies that consider the UE trajectory can be discussed in future work. 0 20 40 60 80 100 10^{-1} 10^{0} 10^{1} Iteration Angle Error Loss ( L_{\text{A}} ) User 1 User 2 User 3 Cooperative Calibration Global Calibration Fig. 10: Angle error loss evaluation for local calibration, cooperative calibration, and global calibration. The evaluation of different weighting factors is shown in Fig. 11 . Instead of using equal weights as \xi_{1}=\xi_{2}=\xi_{3}=1/3 in Fig. 10 , we take \xi_{1} as the reference and choose \xi_{2} and \xi_{3} from \xi_{1}/100 to 100\xi_{1} and visualize the AEL. As can be inferred from the figure, large values of \xi_{2} and \xi_{3} result in a better calibration performance (shown in green). This is also verified from Fig. 10 that UE 1 has the worst performance, and should be allocated a small weight. However, these results only demonstrate the effectiveness of the cooperative strategy. More optimized weighting factor values can be investigated, e.g., based on a Bayesian framework. Fig. 11: Weights selection for global fusion. VI Conclusion This work presents a comprehensive framework for beam pattern calibration tailored to ISAC systems, prioritizing angular sensing accuracy over traditional pattern similarity metrics. A novel sensing-oriented metric based on angle estimation bias, derived through minimization of the KL divergence, is introduced to evaluate calibration quality. To enable gradient-based optimization, a corresponding differentiable loss function is developed, supporting scalable and effective calibration across multiple user devices. Experimental validation using measured beam patterns from an anechoic chamber setup confirms the practical effectiveness of the proposed models and algorithms. Furthermore, the cooperative calibration strategy demonstrates that distributed updates from multiple UEs can achieve performance on par with centralized methods while significantly reducing communication overhead. These results establish a solid foundation for robust and adaptive beam calibration in future ISAC-enabled 6G systems. Looking ahead, future work should consider calibration algorithms that account for multipath propagation and non-ideal, frequency-dependent beam patterns in wideband systems. Appendix A Gradient Derivations for L_{\mathrm{A}} Recall the loss function L_{\mathrm{A}} defined as L_{\mathrm{A}}=\frac{\sum_{t,s}\rho_{t,s}\left|e_{t,s}\right|^{2}}{\sum_{t,s}\rho_{t,s}}=\frac{\sum_{t,s}\rho_{t,s}\left|u_{t,s}-\check{u}_{t,s}\right|^{2}}{\sum_{t,s}\rho_{t,s}}, (46) where u_{t,s}={{\bf b}_{t}^{\sf H}{\bf y}_{s}}/{\|{\bf b}_{t}\|} , \check{u}_{t,s}={{\bf y}_{t}^{\sf H}{\bf y}_{s}}/{\|{\bf y}_{t}\|} , {\bf b}_{t}=\gamma_{t}{\bf W}^{\sf H}{\bf a}_{t} , {\bf a}_{t}={\bf a}(\hbox{\boldmath$\vartheta$}_{t}) . By using Wirtinger calculus, the gradient with respect to the conjugate of the matrix variable {\bf W}^{*} can be calculated as \frac{\partial L_{\mathrm{A}}}{\partial{\bf W}^{*}}=\frac{\sum_{t,s}\rho_{t,s}[(u_{t,s}-\check{u}_{t,s})^{*}\frac{\partial u_{t,s}}{\partial{\bf W}^{*}}+(u_{t,s}-\check{u}_{t,s})\frac{\partial u^{*}_{t,s}}{\partial{\bf W}^{*}}]}{\sum_{t,s}\rho_{t,s}}. (47) We further define u_{t,s}=p_{t,s}/q_{t} with p_{t,s}=\gamma_{t}^{*}{\bf a}_{t}^{\sf H}{\bf W}{\bf y}_{s} and q_{t}=|\gamma_{t}|\|{\bf W}^{\sf H}{\bf a}_{t}\| . Using the quotient rule yields \displaystyle\frac{\partial u_{t,s}}{\partial{\bf W}^{*}} \displaystyle=\frac{q_{t}\frac{\partial p_{t,s}}{\partial{\bf W}^{*}}-p_{t,s}\frac{\partial q_{t}}{\partial{\bf W}^{*}}}{q_{t}^{2}}, (48) \displaystyle\frac{\partial u_{t,s}^{*}}{\partial{\bf W}^{*}} \displaystyle=\frac{q_{t}\frac{\partial p_{t,s}^{*}}{\partial{\bf W}^{*}}-p_{t,s}^{*}\frac{\partial q_{t}}{\partial{\bf W}^{*}}}{q_{t}^{2}} (49) where \displaystyle\frac{\partial p_{t,s}}{\partial{\bf W}^{*}}=0,\ \ \frac{\partial p_{t,s}^{*}}{\partial{\bf W}^{*}}=\gamma_{t}{\bf a}_{t}{\bf y}_{s}^{\sf H},\ \ \frac{\partial q_{t}}{\partial{\bf W}^{*}}=\frac{|\gamma_{t}|^{2}{\bf a}_{t}{\bf a}_{t}^{\sf H}{\bf W}}{2q_{t}}. (50) And the final expression is given by \begin{split}\frac{\partial L_{\mathrm{A}}}{\partial{\bf W}^{*}}&=\frac{\sum_{t,s}\rho_{t,s}(u_{t,s}-\check{u}_{t,s})^{*}\left(-\frac{u_{t,s}|\gamma_{t}|^{2}{\bf a}_{t}{\bf a}_{t}^{\sf H}{\bf W}}{2q_{t}^{2}}\right)}{\sum_{t,s}\rho_{t,s}}\\ &\!\!\!+\frac{\sum_{t,s}\rho_{t,s}(u_{t,s}-\check{u}_{t,s})\left(\frac{\gamma_{t}{\bf a}_{t}{\bf y}_{s}^{\sf H}}{q_{t}}-\frac{u_{t,s}^{*}|\gamma_{t}|^{2}{\bf a}_{t}{\bf a}_{t}^{\sf H}{\bf W}}{2q_{t}^{2}}\right)}{\sum_{t,s}\rho_{t,s}}\\ &\!\!\!=\frac{\sum_{t,s}\rho_{t,s}\!\left[\frac{\gamma_{t}}{q_{t}}\,e_{t,s}\,{\bf a}_{t}{\bf y}_{s}^{{\sf H}}-\frac{|\gamma_{t}|^{2}}{q_{t}^{2}}\,\Re\{e_{t,s}u_{t,s}^{*}\}\,{\bf a}_{t}{\bf a}_{t}^{{\sf H}}{\bf W}\right]}{\sum_{t,s}\rho_{t,s}}.\end{split} (51) For the scalar variable \gamma_{t}^{*} , we compute the derivative as \frac{\partial L_{\mathrm{A}}}{\partial\gamma_{t}^{*}}=\frac{\sum_{s=1}^{S}\rho_{t,s}(e_{t,s}^{*}\frac{\partial u_{t,s}}{\partial\gamma_{t}^{*}}+e_{t,s}\frac{\partial u_{t,s}^{*}}{\partial\gamma_{t}^{*}})}{\sum_{t,s}\rho_{t,s}}. (52) Based on \frac{\partial p_{t,s}}{\gamma_{t}^{*}}=\frac{p_{t,s}}{\gamma_{t}^{*}} , \frac{\partial p_{t,s}^{*}}{\gamma_{t}^{*}}=0 and \frac{\partial q_{t}}{\gamma_{t}^{*}}=\frac{q_{t}}{2\gamma_{t}^{*}} , we can have \displaystyle\frac{\partial u_{t,s}}{\partial\gamma_{t}^{*}} \displaystyle=\frac{q_{t}\,\frac{\partial p_{t,s}}{\partial\gamma_{t}^{*}}-p_{t,s}\,\frac{\partial q_{t}}{\partial\gamma_{t}^{*}}}{q_{t}^{2}}=\frac{p_{t,s}}{2\gamma_{t}^{*}q_{t}}=\frac{1}{2}\,\frac{u_{t,s}}{\gamma_{t}^{*}}, (53) \displaystyle\frac{\partial u_{t,s}^{*}}{\partial\gamma_{t}^{*}} \displaystyle=-\,\frac{p_{t,s}^{*}}{2\gamma_{t}^{*}q_{t}}=-\,\frac{1}{2}\,\frac{u_{t,s}^{*}}{\gamma_{t}^{*}}. (54) Hence, the gradient with respect to \gamma_{t}^{*} is given as \displaystyle\frac{\partial L_{\mathrm{A}}}{\partial\gamma_{t}^{*}} \displaystyle=\frac{\sum_{s}\rho_{t,s}\,\big(e_{t,s}^{*}u_{t,s}-e_{t,s}u_{t,s}^{*}\big)}{2\gamma_{t}^{*}\sum_{t,s}\rho_{t,s}} (55) \displaystyle=\frac{j\sum_{s}\rho_{t,s}\,\Im\{e_{t,s}^{*}u_{t,s}\}}{\gamma_{t}^{*}\sum_{t,s}\rho_{t,s}}. (56)