In-situ physical adjoint computing in multiple-scattering electromagnetic environments for wave control

Domain: physics
Published: 2025-12-13
Editorial outcome: minor_revision

Abstract
Controlling electromagnetic wave propagation in multiple scattering systems is a challenging endeavor due to the extraordinary sensitivity generated by strong multi-path contributions at any given location. Overcoming such complexity has emerged as a central research theme in recent years, motivated both by a wide range of applications – from wireless communications and imaging to optical micromanipulations – and by the fundamental principles underlying these efforts. Here, we show that an in-situ manipulation of the myriad scattering events, achieved through time- and energy-efficient adjoint optimization (AO) methodologies, enables real-time wave-driven functionalities such as targeted channel emission, coherent perfect absorption, and camouflage. Our paradigm shift exploits the highly multi-path nature of these complex environments, where repeated wave-scattering dramatically amplifies small local AO-informed system variations. Our approach can be immediately applied to in-door wireless technologies and incorporated into diverse wave-based frameworks including imaging, power electronic and optical neural networks.

Introduction
Controlling electromagnetic wave propagation in naturally occurring or engineered multi-mode complex media is a core challenge for RF/microwave, modern optical, and photonic systems1–17. The origin of this difficulty lies in multiple scattering and the consequent interference of many photon paths, leading to extraordinary complexity and sensitivity in these media. Yet, controlling these wave-scattering events and their associated interference phenomena is essential for a wide range of applications, including satellite and in-door wireless communications, fiber-based communications and endoscopy, deep-tissue imaging, and optogenetic control of neurons. At first glance, the complete scrambling of a wavefront as it propagates through a complex medium appears to conflict with the objective of precision wave-control—such as focusing electromagnetic radiation on a diffraction-limited spot inside or through a multi-scattering/opaque medium. Indeed, for many years, the presence of random secondary sources (scatterers or reflectors) was considered detrimental. However, novel techniques such as time-reversal18,19 and wavefront shaping (WS)1,2,19 disrupted this paradigm by recognizing that these secondary sources offer additional degrees of freedom. Wavefront shaping protocols have relied on recent technological developments with spatial light/microwave modulators19–22; these allow phase and/or amplitude modulation to each segment of an incident monochromatic wavefront in order to achieve desired functionalities after propagation through the complex medium. On the other hand, time-reversal provides a broadband approach that yields spatiotemporal focusing of waves. Although both of these methodologies guarantee optimal efficiency, they require a complete knowledge of the scattering domain, limiting their practicality for a variety of applications. A pivotal example is indoor wireless communications4,23,24, where small temporal variations in the enclosure can drastically alter the scattering process. An entirely different approach relying on smart electromagnetic environments has emerged with the advent of reconfigurable intelligent metasurfaces (RISs)23–29. This approach foresees a fully programmable wave propagation to harness the wave-scattering complexity and achieve optimized transmission of both information and power. A bottleneck for the practical implementation of this proposal is the development of smart, low-cost/high-efficiency, optimization schemes that will be able to identify in real-time, with low latency, optimal RIS configurations for achieving specific modalities.

Meanwhile, there has been widespread attention towards physical (optical) analog computing for low-latency deep learning applications30–38. Pioneering works such as 36,37 showed that it is possible to perform in-situ backpropagation through a photonic implementation of an artificial neural network. However, these platforms typically consist of feed-forward waveguides, couplers and interferometers, in contrast to complex multi-scattering multi-resonant electromagnetic environments, in which real-time optimizations of on-demand wave-control functionalities are needed. Obviously, the development of such real-time, on-hardware optimization schemes will benefit not only indoor wireless communications (see Fig. 1a) but also a broad class of physical systems. Representative wave settings include control of closed-loop tabletop experiments, seismic wave control, as well as applications in adaptive optics (atmospheric imaging, endoscopy, free-space optical links) and related remote-sensing tasks–including geo-satellite imaging and adaptive ranging (optical or RF), see Fig. 1b, c.

Here, we experimentally demonstrate an in-situ Physical Adjoint Computing (iPAC) optimization protocol that leverages adjoint sensitivity analysis39–42 to control and harness complex wave dynamics. The protocol is built around three components: in-situ measurements, targeted perturbations, and an external control mechanism, which collectively enables the real-time optimization of wave systems through two sequential field propagations–forward and adjoint. First, local probes are employed to measure both the forward and adjoint wavefields at specific elements within the system. Forward propagation is utilized to compute a desired merit (or cost) function and to determine the excitation profile required for the subsequent adjoint propagation. The adjoint field, in turn, provides a comprehensive and simultaneous measurement of all targeted sensitivities. An external control mechanism evaluates these sensitivities to identify the potential perturbations that could enhance (or diminish) the merit (cost) function. These adjustments are then delivered by local actuators to the targeted components (i.e., the tunable degrees). The cycle is repeated as many times as necessary to maximize (minimize) the merit (cost) function. The proposed methodology typically achieves the fastest local convergence among competing strategies, which constitutes it attractive for a variety of wave-control applications, see Fig. 1a–c. While the ultimate gain is context-dependent, iPAC is most effective in controlled, quasi-static or slowly varying, multiply scattering environments where forward and adjoint excitations can be launched. Provided adequate sensing-actuation bandwidth, signal-to-noise ratio, and tolerable local model mismatch, iPAC provides a scalable path to on-platform optimization. To demonstrate the versatility of our protocol we showcase three different modalities, namely, targeted channel emission, coherent perfect absorption, and camouflaging, using a microwave experimental platform, see Fig. 1d. The latter consists of a network of coupled coaxial microwave cables whose wave transport demonstrates features characterizing wave chaotic systems43–45. These networks are frequently used as models for mesoscopic quantum transport, sound propagation, and electromagnetic wave behavior in complex interconnected structures such as buildings, ships, and aircrafts46–50 and therefore constitute a versatile platform for experimentally implementing our in-situ optimization protocol.

Results
Principles of in-situ adjoint optimization
Formally, the steady-state propagation of a time-harmonic wave field Φ is governed by a linear system: M(p)Φ = b(p). Here, M is the system matrix, b is the driving source, and p is a vector of N-controllable optimization parameters. An optimization objective g is typically expressed as an explicit function of Φ, Φ*, and p, i.e., g = g(Φ, Φ*, p). Using the chain rule, the gradient sensitivities of g with respect to p are given by:

dg/dp = ∂g/∂p + 2R[∂gT/∂Φ * M^-1 * ∂b/∂p - ∂gT/∂Φ * M^-1 * ∂M/∂p * Φ] (1)

Here, ∂b/∂p - ∂M/∂p * Φ physically represents a collection of induced excitations resulting from perturbing the system via one parameter p at a time for each i = 1, 2, 3, ⋯, N. Consequently, U = M^-1 * (∂b/∂p - ∂M/∂p * Φ) denotes a collection of several wave fields in response to each and everyone of these perturbations (the ith column, U_i, corresponds to the wave field generated by perturbing the single p_i). However, finding the entire U becomes excessive especially when the number of controllable parameters, N, is large.

The adjoint method addresses this challenge by reformulating the problem as:
(∂g/∂Φ)T * M^-1 = ΨT => MT * Ψ = ∂g/∂Φ (2)

Here, Ψ is the adjoint field generated in response to the source ∂g/∂Φ. For reciprocal wave media, where MT = M, the adjoint field can be found by propagating through the same system. The gradient sensitivities are now given by:

dg/dp = ∂g/∂p + 2R[ΨT * (∂b/∂p - ∂M/∂p * Φ)] (3)

This formulation significantly reduces computational demands, as all sensitivities can be obtained through a single additional field propagation, instead of computing the entire collection U of N wave fields. Moreover, ∂b/∂p and ∂M/∂p are typically very sparse tensors since the effect of each parameter p_i on M and b is localized. Consequently, only the values of Φ and Ψ corresponding to the non-zero entries of ∂b/∂p and ∂M/∂p are needed.

To implement the adjoint method experimentally, we sequentially excite the wave system with the driving sources b and ∂g/∂Φ, measure Φ and Ψ at the strategic positions designated by ∂b/∂p and ∂M/∂p and then compute the gradient using Eq. (3). Importantly, so our in-situ protocol does not require solving MΦ = b and MΨ = ∂g/∂Φ. Instead, we directly measure Φ and Ψ, inherently accounting for all the complexities of the system, including hidden losses and detunings, thereby enabling self-calibration. Having found dg/dp, any gradient-guided optimization algorithm can be applied to advance g51. We set up an external control enclosure to orchestrate the entire process, including the sequential (forward and adjoint) wave-field excitations, in-situ measurements, gradient computations, and optimization updates, ensuring seamless and efficient real-time optimization.

While adjoint analysis shares a conceptual common ground with the celebrated backpropagation algorithm, our goal is not to develop a physical deep-learning platform36. Instead, we aim to optimize a wave system in-situ to achieve specific physical functionalities in real time, such as perfect absorption, signal delivery to targeted channels, or camouflage. Unlike data-driven methods, our protocol does not train any neural network nor rely on extensive datasets. Crucially, our work should be distinguished from physical implementations of feed-forward neural networks36,37, which often avoid back reflections. In contrast, our in-situ optimization holistically exploits the intricate physics of multiple scattering of waves within an arbitrarily complex network topology, where any wave effect, including back reflections and even resonant phenomena, can be utilized as valuable physical degrees of freedom. Furthermore, our implementation at RF and microwave frequencies allows us to easily access both phase and amplitude information of the fields, which ensures that the intricate wave interactions within the system are accurately accounted for, enabling precise and reliable optimization.

Physical platform and implementation of the adjoint protocol
The complex microwave network14,44,52–54 consists of n = 1, ⋯, V vertices, that are connected by one-dimensional coaxial wires (bonds) B = (n, m) of length L_B, which are irrationally related to one another. The position x_B on bond B is x = 0 (l_B) on vertex n (m). The connectivity of the network is encoded in the V × V symmetric adjacency matrix C, with elements C_nm = 1 if vertices n ≠ m are connected via a bond l_B, and C_nm = 0 otherwise. The number of bonds that emanate from a vertex n defines its valency v_n. The electric potential difference (voltage) between the inner and outer conductor surfaces of the coax cables at position x along each bond satisfy the telegraph equation44,52–54

(d^2/dx_B^2 + k^2) ψ_B(x_B) = 0; k = ω/c * n_r (4)

where k is the wavenumber of the propagating wave with angular frequency ω, c is the speed of light in vacuum and n_r is the complex-valued relative index of refraction of the coaxial cable whose imaginary part describes Ohmic losses in the cables. To emulate realistic conditions, we have considered that all cables suffer Ohmic losses which are modeled by a complex refractive index with imaginary part Im(n_r) = 0.0085. The boundary conditions at each vertex n are defined by the voltage continuity and current conservation:

[H(k) + iW^T W] Φ = b; H_nm = { Σ_l≠n C_nl cot(kL_nl), n=m; -C_nm csc(kL_nm), n≠m } (5)

Above, b = 2iW^T I is the N-dimensional vector that describes the driving source, and I_α = A_α e^{iθ_α} are the components of an L-dimensional vector I that describes the amplitudes A_α and the phases θ_α of the input fields I_α from the α-lead. Consequently, the system matrix for the microwave network is M = H(k) + iW^T W = M^T.

The gradient sensitivities are evaluated using Eq. (3). The implementation of this equation requires the knowledge of the adjoint field Ψ which is the solution of the adjoint Eq. (2). In our case, it takes the same form as the equations that dictate the forward field with the only difference being the driving source vector, i.e., MΨ = 2iW^T * (∂g/∂Φ)^T. The latter is determined from the specific form of the optimization objective function g(Φ, Φ*, p).

The other elements required for the evaluation of Eq. (3) are the gradients ∂M/∂p and ∂b/∂p. The optimization parameter vector p is partitioned into two parts: the first one involves cavity-shaping optimization parameters (e.g., the electrical lengths L_nm of the bonds that are part of the network) and the second one involves wavefront-shaping parameters (the amplitudes A_α and phases θ_α of the incident waves injected into the system from the α-th TL). The gradient vector results in:

dg/dp = [dg/dL_nm, dg/dA_α, dg/dθ_α] = [2R(Ψ^T * ∂M/∂L_nm * Φ), 2R(Ψ^T * ∂b/∂A_α), 2R(Ψ^T * ∂b/∂θ_α)] (6)

It is important to emphasize that Eq. (6) does not require measuring the entire Φ or Ψ but only those voltages that correspond to the non-zero entries of ∂M/∂p and ∂b/∂p associated with the controllable parameters. In other words, the sparsity of ∂M/∂p and ∂b/∂p further reduces measurement complexities.

Examples of modalities and optimization objective functions
Below we provide some examples of optimization objective functions associated with various modalities.

Targeted Mode Transfer—In many practical scenarios, particularly in-door wireless communications, one requires energy/information transfer from specific input channels to designated output channels—distinct from the injected ones. Such targeted mode transfer (TMT) can be achieved by an appropriate cavity-shaping and/or wavefront-shaping process whose success is quantified by the objective function

g_TMT = Σ_{f_T} |Φ_f|^2 / Σ_{f_I} |A_β|^2 (7)

where {T_α} (≠ {I_β}) denotes the set of targeted (injected) channels. In case of lossless structures g_TMT = 1 (0) indicates perfect (poor) TMT performance.

Coherent Perfect Absorption—Coherent perfect absorption (CPA)14,55,56 requires that the incident radiation has a particular frequency and spatial field distribution (coherent illumination) such that the (weakly) absorbing cavity acts as a perfect constructive interference trap that eventually absorbs completely the incident radiation. The adjoint optimization methodology can be utilized for the management of the multi-path constructive interference via cavity shaping and/or wavefront shaping. In this case, the optimization objective function is

g_CPA = 1 - [Σ_{f_I} |Φ_f|^2] / [Σ_{f_I} |A_α|^2] (8)

where the second term describes the reflected waves from the injected channels {I_α} and the third term describes the transmitted waves from the remaining {T_α} ≠ {I_β} channels. Perfect absorption corresponds to g_CPA = 1.

Invisibility – Evading the detectability of a scattering object requires the elimination of any imprints in the phase and amplitude of the scattered interrogating waves due to their interaction with a target. This is achieved by appropriate manipulation of the many-path interference phenomena occurring inside the scattering domain via cavity shaping and/or tailoring control signals that counter phase and amplitude scattering imprints (including absorption) caused by interactions with the target. The objective function that ensures such optimal cancellations take the form

g_invis = |Φ_α0 - A_β0 e^{iθ_β0}|^2 + |Φ_β0 - A_β0 e^{iθ_β0}|^2 + Σ_{α≠α0, β0} |Φ_α|^2 (9)

where g_invis = 0 indicates optimal invisibility/camouflage performance. Above, the first term on the right-hand-side compares the scattered field from the target to the injected one. The last term evaluates the transmittance to all channels that are different from the ones that are involved in the control of the channel α_0. The objective function g_invis = 0 indicates optimal invisibility/camouflage performance.

In-situ Implementation of iPAC
We proceed with the in-situ implementation of our optimization scheme for the three modalities discussed above. The schematics of the microwave networks for each of the three cases are shown in the upper row of Fig. 2. The TLs (black wiggling lines) are attached to vertices that are indicated with red-filled circles. The amplitude and phase of the injected signals from a two-source VNA, have been used as optimization parameters (wavefront-shaping). In all cases, the signal from the α = 1 TL serves as a reference for the amplitude A and the phase θ of the signal injected from the second TL. Finally, the bond L_opt incorporates a phase-shifter which was digitally controlled for “cavity-shaping” purposes. The selected bond was chosen solely for experimental convenience; it is not special to any of the three modalities (TMT, CPA, invisibility). The only practical requirement is that the bond accommodate a phase shifter and that the fields at its end vertices be accessible for probing. Any bond meeting these conditions would serve equally well. In our prototypes, tuning a single cable length was sufficient to realize the targeted functionalities described in the previous subsection.

Measurement in-situ: First, we inject signals from TLs as follows: (a) Forward: The forward voltages Φ are measured at the vertices n = 1, 2 that are associated with the length optimization parameter L_opt. (b) Adjoint Measurement: The source for the adjoint measurement is then constructed from the previously measured forward voltages and according to the specific objective function. For the TMT case, the adjoint input was delivered from the α = 4 TL that was targeted for maximizing the outgoing signal. For the CPA protocol, the adjoint input was delivered to the two α = 1, 2 TLs. Finally, for the invisibility protocol, the adjoint signal was delivered to α = 1, 2 TLs where the optimization constraints have been imposed. In this case, a control field was also injected from the remaining α = 3 TL. The adjoint voltages Ψ that were needed to measure the gradient were then measured at the vertices n = 1, 2 that are associated with the L_opt parameter for all three protocols; (c) Gradient Calculation: With the local forward Φ and adjoint Ψ measurements obtained, we calculate the gradient of the objective function with respect to the controllable parameters (see Eq. (6)) in real-time. We re-emphasize that the choice of controllable parameters dictate the positions/vertices n where the required forward Φ_n and adjoint Ψ_n of the voltages are performed for the gradient calculation dg/dp; (d) Parameter Update: Once the gradient was computed, we employed a gradient descent algorithm to update the optimization parameters. Specifically, we used the package NLOPT with the Limited-memory Method of Moving Asymptotes (LD_MMA) option57. This algorithm identifies a new set of parameters, which were then implemented by adjusting the phase shifter length and modifying the relative amplitude and phase of the input signals; (e) Iteration and Convergence: The steps (a–d) are repeated until the objective function converges on an optimal value (within some tolerance). A single operating frequency was selected and held constant throughout the optimization process.

In Fig. 2 we report the results of the in-situ optimization (solid black lines with filled circles) for the three modalities discussed above. In all cases, we have achieved a rapid convergence towards an optimal value of the corresponding objective functions occurring after ~20 iterations of the protocol, see Fig. 2b, g, l. The convergence of the three control parameters (L_opt, A, θ) toward their optimal value for each of the three modalities is reported in the third, fourth, and fifth rows of the same figure respectively.

In-silico Implementation of iPAC for large control parameter system
In Fig. 3, we also present the in-silico results (shown as dashed lines with filled squares) obtained from a digital twin implementation of the AO protocol. The close agreement between the digital twin and the in-situ results confirms that our experimental set-up is adequately captured by our network model. This ad hoc validation supports the applicability of the digital twin approach to more complex networks, with a larger number of control parameters. Needless to stress that, in general/typical cases, an in-silico implementation of the AO is subject to a number of drawbacks like developing a highly accurate model of every propagation path, boundary and loss channel in continuous space which can become computationally burdensome and sensitive to modeling errors, especially for complex cavities. These have to be contrasted with the in-situ implementation of iPAC, where the physical system itself computes its own Green’s function in real time, by performing only local measurements.

We considered fully connected networks consisting of N = 20 vertices with a total of 190 bonds. The bond-lengths are initially uniformly distributed in the interval [L_0 - δL, L_0 + δL] where L_0 = 25 cm and δL = 5 cm. At each vertex, we have attached TLs (i.e. N = 20) that have been used for injecting (receiving) the interrogating (scattering) signal. The frequency of the injected waves was chosen to be f = 3.2 GHz for all cases. The optimization process has been achieved via bond-length variations (cavity-shaping approach).

The first column of Fig. 3 reports the results of the TMT modality. A random wavefront has been injected into the network from six TLs coupled to vertices n = 1, 3, 6, 7, 9, and 15. The adjoint optimization scheme aimed to identify the appropriate bond-length variations that resulted in delivering the injected signal ≈ 90% to the targeted channels n = 8, 16, 17. In the main part of subfigure Fig. 3a, we show the convergence of the objective function g_TMT to a total transmittance of approx. 90%. We have checked that for the converged optimal bond-length configuration, the remaining 10% energy loss was associated with the absorption due to Ohmic losses at the wires. Typical bond-length variations δL_opt versus the iteration number are shown in Fig. 3b, while in Fig. 3c, we report the bond-length variations for all bonds of the network at the end of the optimization process.

The second column of Fig. 3 reports the digital twin calculations for the CPA-scenario. We have injected a randomly chosen coherent wavefront from all N = 20 TLs into the lossy network, see inset of Fig. 3d. Using the adjoint optimization protocol we have determined the optimal bond-lengths for which the network acts as a perfect constructive interference trap leading to complete absorption of the incident wave. In Fig. 3d, we show the convergence of the objective function towards a value g_CPA = 0.9998 occurring after 2276 iterations. The evolution of some typical bond variations versus the number of iterations is shown in Fig. 3e, while Fig. 3f reports the final bond-variation for all bonds.

Finally, the last column of Fig. 3 shows the digital twin simulations for cavity camouflage (invisibility), see the inset of Fig. 3g. We have injected a signal from channel β_0 = 1 with an amplitude A_β0 = 0.56 and phase θ_β0 = 69°. To balance the network losses we have also injected a control signal into the system from channel α_c = 3 with amplitude A_αc = 0.85 and phase θ_αc = 333°. The adjoint optimization protocol aimed to identify an appropriate bond-length configuration for which the scattered signal collected at a specified α_0 = 8 TL is identical to the interrogating wave injected from TL β_0 = 1. In Fig. 3g, we show the convergence of the objective function g_invis towards the value g_invis ≈ 6 × 10^-4 after 3351 iterations. Here, in addition to the constraints imposed by the objective function g_invis in Eq. (9) we have also requested zero transmission and reflection from the control channel α_c = 3. This additional constraint introduce the following modification g_invis → g_invis + |Φ_c - A_αc e^{iθ_αc}|^2 / |A_β0|^2. Even with a modest number of iterations ~400 of the adjoint optimization scheme the objective function can be as small as g_trans ≈ 0.01. Figure 3h, i show a representative evolution of bond-length variations versus iteration number and the final bond-lengths at the end of the optimization process (3351 iterations).

Efficiency of adjoint optimization computing
It is instructive to examine how the efficiency of the Adjoint Optimization scheme varies with the number of controlled parameters p and the complexity of the network. The latter can be quantified by the topological entropy h_top = ln ρ58, where ρ is the spectral radius of the non-backtracking (Hashimoto) matrix T indexed by the set of directed bonds of the network (see “Methods”). The number of period-n non-backtracking closed paths (counted up to a cyclic shifts) is 1/n Tr(T^n) ≈ ρ^n/n, where ρ is bounded between the minimum and maximum valency v_n as min(v_n - 1) ≤ ρ ≤ max(v_n - 1). Hence, h_top characterizes the combinatorial branching complexity of the underlying non-backtracking dynamics and thus reflects the connectivity of the network.

In Fig. 4 we report the efficiency of the Adjoint Optimization for each of the three modalities as a function of the number of control parameters, for three representative values of the topological entropy. In all cases, we find that the efficiency increases with the number of control parameters. The convergence rate of the objective function to its optimum, however, depends on the task and on h_top. For CPA, convergence accelerates as h_top increases. This finding is consistent with higher connectivity (more lossy bonds), which strengthens multiple scattering, traps energy, and enhances absorption. In contrast, TMT and invisibility show a non-monotonic dependence on h_top, with fastest convergence near h_top ≈ 2; moderate complexity aids optimization, whereas excessive connectivity slows the approach to the optimal values of the objective functions. Further simulation details are given in Methods.

We stress that gradient-based schemes are far more time-efficient than derivative-free alternatives (e.g., genetic algorithms or particle-swarm methods) once the number of optimization parameters grows large59. In high-dimensional settings, non-gradient approaches typically incur substantially greater computational effort and memory, with scaling that deteriorates as the parameter size increases60,61. Empirically, gradient methods also frequently attain better local optima25,59,62,63. As a representative case, 59 benchmarks Adjoint optimization against a genetic algorithm for photonic inverse design and finds the former markedly less demanding in computational resources.

Other gradient-based methods that approximate the gradients via finite differences involves solving or simulating the problem described by Eqs. (3), (5)) for every combination of the optimization variables p = (p_1, p_2, ⋯)^T leading to too-long computational times. Instead, the Adjoint Optimization bypasses this cost (in term of computational memory and time) bottleneck when number of optimization parameters increases, because all the gradients can be computed at once by solving only two distinct problems associated with the forward and the backward propagation. A detail comparison between finite difference and Adjoint Optimization approaches is given in the Supplementary Information.

Of course, the in-silico implementation of an Adjoint Optimization is naturally limited by the computational complexity of simulating the physical system. On the contrary, the proposed in-situ implementation of the Adjoint Optimization which bypasses all the latencies (memory and time complexity) of digital simulations. All other computational steps have nearly fixed cost that do not scale (or scale very weakly) with the system size.

These unique features of the Physical Adjoint Optimization and its in-situ implementation are very promising for potential applications in RISs, where a large number of tunable elements may need to be reconfigured quickly to achieve predetermined, yet changing, goals.

Methods
Network modeling
The transport properties of the microwave network are modeled using a metric graph consisting of one-dimensional wires (bonds) supporting a single propagating mode. The waves propagating between the inner and the outer conductor along the coax cable, is given in terms of the difference ψ_B(x_B) between the potentials at the conductors’ surfaces, see Eq. (4). The bonds are connected together at vertices (v-port dividers) where Neumann boundary conditions are imposed. In the experimental network we have used 3—port vertices (T-junctions).

The solutions of Eq. (4) at a bond B = (nm) can be expressed as
ψ_B(x_B) = ϕ_n sin(k(L_B - x_B))/sin(kL_B) + ϕ_m sin(kx_B)/sin(kL_B) (10)

which satisfy the wave continuity conditions ψ(x_B = 0) = ϕ_n; ψ(x_B = L_B) = ϕ_m, for each pair of connected vertices n < m. Furthermore, the current is conserved at each vertex, i.e.,
Σ_{m} dψ_B/dx_B |x_B=0 + Σ_{α=1}^N δ_{αα0} dψ_α/dx |x=0 = 0, (11)

where δ_{αα0} is the Kronecker delta, and the second term accounts for the derivatives at the ports connected to TLs. Combining the above vertex boundary conditions, together with Eq. (10) we arrive at Eq. (5) which provides the system matrix that describes transport in the forward direction.

Characterization of network complexity
We quantify the network complexity by the topological entropy h_top = ln ρ where ρ is the spectral radius of the 2B × 2B non-backtracking (Hashimoto) matrix T. The latter is defined in the space of directed edges of the network b = (n → m) with entries

T_{b,b0} = 1, if m(b0) = n(b) and b ≠ b0 (no immediate backtracking)
= 0, otherwise (12)

with b_p = (m → n) being the reverse arc. Notice that for any row b the sum Σ_{b0} T_{bb0} = v_{n(b)} - 1 where v_{n(b)} is the valency of the vertex n. Therefore, min(v_n - 1) ≤ ρ ≤ max(v_n - 1).
Since Tr T^n counts the number of period-n non-backtracking closed paths on the network,

h_top = ln ρ = lim_{n→∞} 1/n ln Tr T^n (13)

More branching and more loops indicate more routes and consequently larger h_top; sparse or weakly looped graphs yield small h_top (for intuition, a v-regular network with v_n = v for all n has topological entropy h_top = ln(v - 1) whereas a single cycle network has h_top = 0). Thus h_top is a pure connectivity metric, which is relabeling-invariant, independent of bond lengths, that captures the combinatorial growth of admissible routes on the network.

In-silico Implementation of the iPAC
We conducted in-silico simulations of a complex scattering network consisting of V = 20 vertices that are fully connected with 190 bonds. Each vertex was attached to a TL, i.e., N = 20. In the digital twin simulations, we considered a cavity-shaping optimization scheme that allows adjustments of all 190 bond-length, i.e., a large number of DoF relevant to operational realities. In fact, under such conditions is expected that the implementation of the adjoint-based gradient descent protocol is more beneficial as compared to other optimization schemes.

The bond lengths were initialized with randomized values uniformly distributed around L_0 = 0.25 m, with variations constrained to δL ± 5 cm (= 0.5λ where λ is the operational wavelength), such that L_nm ∈ [L_0 - δL, L_0 + δL]. For all modalities, the wavefront parameters were fixed, with the amplitude parameters constrained A ∈ [0.001, 3.0], and θ ∈ [-π, π]. An amplitude lower bound was set to prevent trivial solutions with zero input power.

Controlling and setting up the VNA for coherent wavefront inputs
To precisely control the phase and amplitude of signals injected into the input ports of the scattering system, a Keysight PNA P5023B four-port Vector Network Analyzer (VNA) equipped with the S93089B Differential and I/Q Device Measurements option was utilized. The S93089B option enables accurate phase control of multiple internal sources, facilitating coherent excitation without the need for external hybrid couplers or baluns. Two internal sources were configured to deliver signals to the desired input ports of our microwave graph network. Both sources were set to the same frequency to maintain coherence, while the relative phase between the two sources was precisely adjusted from 0° to 360° using the S93089B’s phase control settings. This allows the phase difference to be fixed at specific values in degrees of one input port relative to a reference port. The output power of each source was individually adjusted in the interval [-40 dBm, 0 dBm] to achieve the desired amplitude difference at each input port. A calibration routine was executed to compensate for any inherent phase and amplitude imbalances introduced by the VNA’s internal signal paths and external cabling. For ensuring the experimental stability of the objective function, we performed ten measurements per iteration, resulting in essentially identical outputs characterized by their mean value.

For forward scattering measurements, both sources were activated and phase-aligned according to a random set of initial values. The S93089B option’s source-phase control ensured that the relative phase between the inputs was maintained with high precision throughout the measurement. The VNA’s receiver frequency, configured to the excitation frequency, captured the effects of coherent excitation on the forward scattering parameters. In adjoint measurement scenarios, these sources provided the excitation signal, and the VNA measured the reflected and transmitted signals accordingly (in case only one excitation signal was needed the other source was deactivated).

Controlling and setting up the mechanical phase shifter
To achieve precise length manipulation in our experimental setup, we integrated a mechanical phase shifter into the system (bond L_opt), a coaxial RF phase shifter, typically operated via a manual knob. To enable automated and repeatable control, we motorized the phase shifter and developed a characterization method to correlate motor movements with the resulting length perturbations.

The mechanical phase shifter used in our experiment was designed to operate over a frequency range of DC to 18 GHz, with an insertion loss of less than 1.0 dB up to 18 GHz and capable of handling up to 100 Watts of average RF power. The device originally featured a manual adjustment knob for phase tuning, however, a stepper motor was mechanically coupled to the phase shifter’s adjustment knob. The motor was securely mounted to maintain alignment and prevent mechanical backlash, ensuring consistent control over the phase adjustment mechanism. The motor was interfaced with a Trinamic motion controller, allowing for precise digital control of the motor’s position, and providing an adjustable phase shifter’s length from 3 mm to 23 mm. The controller was connected to a computer via a USB interface, enabling automated control through custom Python scripts.

To establish a reliable relationship between the motor’s rotational steps and the physical displacement within the phase shifter, we conducted a calibration process using a high-precision digital micrometer (Asimeto IP65 Digital Outside Micrometer). The micrometer was positioned to measure the linear displacement resulting from the motor’s rotation. The micrometer’s spindle was placed in contact with a reference point on the phase shifter that moved in response to the internal adjustment mechanism. The motor was programmed to move in increments of microsteps, and the corresponding displacement was recorded using the micrometer. Movements were performed in both clockwise and counterclockwise directions to account for any mechanical hysteresis. The collected data indicated that 464 micro-steps of the motor corresponded to a linear displacement of 1 mm within the phase shifter. A linear relationship was established between the number of micro-steps (N_steps) and the displacement d = N_steps / 464 mm. Multiple trials were conducted to confirm the repeatability of the calibration. The standard deviation of the displacement measurements was within the micrometer’s specified accuracy, ensuring confidence in the calibration.

Finally, we point out that the accuracy of the phase shifter was depending on the resolution of our micrometer, which is roughly 0.01 mm. However, the optimizer used to update the optimization parameters, treated this length as a continuous, real-valued set-point, with higher precision than it is measured. Despite this “quantization” error, there was no issue with our optimization performance as the gradients pointed in the correct direction. In fact, a degree of stochasticity in the gradients are known to be beneficial for gradient-guided optimization, as our in-situ studies confirmed due to an unavoidable stochasticity whose origin is traced back to various experimental noise sources (temperature variations, technical noise at the equipment etc).

Modeling of the phase shifter
To understand the phase shifter’s impact on the transmitted signals, we modeled it as a variable-length transmission line supporting a Transverse Electromagnetic (TEM) mode. The phase shift introduced by the device is a function of the electrical length, which depends on both the physical length and the dielectric properties of the medium. Using the calibrated Vector Network Analyzer (VNA) setup described previously, we measured the scattering matrix (S-parameters) of the phase shifter over the frequency range of interest. Measurements were taken at various positions of the phase shifter corresponding to different micrometer readings. The phase shifter was modeled as a two-port network with its behavior represented by transmission line equations. The phase shift (ϕ) introduced by the line is given by ϕ = β ⋅ d where β is the phase constant, and d is the physical length of the transmission line. The phase constant is related to the frequency f and the effective permittivity ϵ_eff of the medium by β = 2πf/c * sqrt(ϵ_eff). The effective permittivity was assumed to be complex to account for dielectric losses within the phase shifter. We modeled ϵ_eff as a function of the micrometer-measured length and frequency. To extract the relationship between the effective permittivity, physical displacement, and frequency, we employed surrogate optimization using MATLAB, finding that n = ϵ_eff ≈ 1.004 + 0.0022i and the functional dependence of the length of the phase shifter L on the measured length of the micrometer L_m = 28 mm + 2(d - 7 mm) accounting for the fact that it is a trombone line phase shifter, so the factor of 2 accounts for the doubling of the line when making length adjustments.

Efficiency of adjoint optimization methodology
Efficiency for increasing complexity and optimization parameters. To assess how combinatorial complexity and tunability affect iPAC efficiency, we simulated three modalities (TMT, CPA, invisibility) across three topological-entropy levels h_top = 1, 2, 3 (Fig. 4a–c). For each h_top, we averaged the optimal objective over 100 random networks with identical connectivity (thus the same h_top) but uniformly random bond lengths L ∈ [21.2, 28.8] cm. Each network had V = 75 vertices: a bulk of V_bulk = 50 and V_TL = 25 boundary vertices used to attach transmission lines (TLs). We increased h_top by raising the bulk connectivity (vertex valencies). TL vertices were kept at valency v_TL = 2, fixing the TL-network coupling constant fixed as the bulk connectivity changes (see Methods). In all cases, performance improves as the fraction σ of tunable bulk-bulk bonds (controlled parameters) increases. For h_top ≈ 1, 2, 3 the total number of bulk bonds are 73, 193, 529, respectively.

The networks with h_top = 1, 2, 3, involve 73, 193, and 529, respectively, number of bonds that connect the bulk vertices. In our simulations, we varied the number of control parameters by varying the tunable fraction σ of bulk-bulk bonds (σ = 1 indicates that all bulk bonds are tuned). Tunable bond-lengths were constrained within the range 17.3 ≤ L_b ≤ 33.7 cm. The optimization used NLopt’s MMA (gradient-based) with relative tolerances 10^-7. For each (h, σ) we report the mean optimum over the 100 network realizations. The optimization scenarios used in this analysis were the same ones discussed in the main text. Specifically: (i) for the TMT we have injected a random monochromatic wavefront from 10 TLs and targeted other 5 TLs; (ii) for the CPA, we have injected a random monochromatic wavefront from all 25 TLs; and (iii) for the invisibility we have used one interrogation TL from where the incident signal was injected, and one receiving TL where we have requested the emitted signal to have equal amplitude and phase as the injected one. Finally, we have also employ a separate control TL to balance losses (as in the main text).

Our analysis show that the optimized objective increases monotonically with σ, and high performance shifts toward σ → 1 for all h_top. The convergence behavior depends on the task and on h_top: for CPA, convergence accelerates as h_top increases-consistent with more lossy bonds (from higher connectivity) and stronger multiple scattering that trap energy and enhance absorption. In contrast, TMT and invisibility show a non-monotonic dependence on h_top, with fastest convergence near h_top ≈ 2; moderate complexity aids optimization, whereas excessive connectivity offers diminishing returns. A detailed analysis of this non-monotonicity is left for future work.

Time-performance benchmark. We model four latencies: measurement t_m, interconnect t_l, host compute t_c, and actuation t_o. One adjoint iteration (forward + adjoint measurement, gradient assembly, update) yields

t_adj(p) = 2t_m + 6t_l + (2 + p)t_c + αt_o

where p is the number of tunable parameters and α ≥ 1 is the actuation multiplier per update. The constants conservatively account for round-trip link events in the two measurements and a single actuation block. A central finite-difference (FD) iteration perturbs each parameter p_n by ±δ, measures twice, restore the nominal value, and then updates, giving:

t_FD(p) = t_c + t_m + αt_o + 4t_l + p(t_c + 2t_m + 3t_l + 10t_o)

On our setup (Keysight P5023B VNA; Intel Core i9-14900K; stepper-motor actuators) t_m = 6.7 ms; USB microframe: t_l = 125 μs; host compute: t_c = 3 ns; stepper actuation: t_o = 0.1 s per micro-move with α ≈ 10 resulting in αt_o ≈ 1 s. Thus t_adj(p) ≈ 1.0006 s (for p ≤ 10^3) while FD grows linearly with slope 10t_o + 2t_m + 3t_l - t_c ≈ 0.301 s/parameter, giving t_FD(p = 1000) ≈ 302 s. For further details see Supplementary Information and associated Supplementary Fig. 1.

We, therefore, conclude that since the Adjoint uses two measurements and one update per iteration, it results to a runtime which is essentially independent of p. Instead, FD adds two measurements and ≈ 3 actuations per parameter, making runtime linear in p and dominated by actuation/I/O.

Peer review rounds
[{"round": 1, "reviewer_comments": {"reviewer_1": "In this manuscript, the authors achieved in-situ manipulation of the multiple scattering of electromagnetic waves using time- and energy-efficient adjoint optimization methodologies, and demonstrated real-time wave-driven functionalities such as targeted channel emission, coherent perfect absorption, and camouflage.\n\nOverall, both experimental and numerical results are technically sound and impressive. Three examples of targeted channel emission, coherent perfect absorption, and camouflage illustrate the power of in-situ physical adjoint optimization for real-time control of electromagnetic wave modalities in complex scattering systems. One important advantage of the in-situ adjoint optimization is that the full knowledge of the electromagnetic environment is not needed. This is fundamentally different from the wavefront shaping techniques that require repeated measurement of the scattering matrix when the scattering system is reconfigured.\n\nI have a few questions and comments for the authors.\n1. The complex scattering environment that the authors utilized can amplify small variations in the optimization parameters via multiple interference pathways. This requires controlling these parameters with high accuracy. What accuracy is needed to vary the coaxial cable length using the phase shifter in the microwave experiment? What happens if such accuracy is not reached?\n2. In the experimental results shown in Fig. 2, the authors chose to vary the cable length between vertices 1 and 2. Is there any reason for choosing this particular bond in all three tasks? I wonder what will happen if the authors vary the cable length connecting other vertices? Is it always sufficient to vary only one bond length for different tasks?\n3. The numerical simulations were conducted on fully connected networks, but experimental networks were not fully connected. How does the connectivity of a network affects the outcome of physical adjoint optimization? Is a fully connected network the best for physical adjoint optimization? Experimentally it may be difficult to achieve fully connected networks. Is there a minimum number of bonds needed to achieve specific modalities via physical adjoint optimization?", "reviewer_2": "This manuscript presents an in-situ physical adjoint computing (IPAC) method for wave control in multiple-scattering electromagnetic environment. The proposed IPAC method consists of three components including in-situ measurements, targeted perturbations, and an external control mechanism, to implement a real-time optimization for wave-system. A multi-resonant, multi-scattering complex network is used to mimic the multiple-scattering electromagnetic environment to test the proposed IPAC method. However, there are several concerns in this manuscript as follows.\n1. What is the theoretical computational complexity for the proposed IPAC approach? Please provide more analysis for the computational complexity.\n2. It is unknown what is the performance of the proposed IPAC approach for large-scale multiple-scattering scenarios. The scale of the multi-resonant multi-scattering complex network is limited. For example, for the example of reconfigurable intelligent surface, the number of scattering elements can be up to 1000. How does the proposed IPAC approach work in such large-scale case?\n3. A real example of multiple-scattering electromagnetic environment should be tested to verify the proposed IPAC approach. The multi-resonant multi-scattering complex network is over-simplified. For real multiple-scattering electromagnetic environment, it can be time-varying with a short coherent time. Thus, it is questionable whether the proposed method can work in such real environment.\n4. For the in-situ measurement component in the proposed IPAC approach, the measurement will inevitably have errors. Therefore, what is the impact of the measurement error to the proposed approach? How robust is the proposed IPAC approach?\n5. For some examples of multiple-scattering electromagnetic environment, such as reconfigurable intelligent surface, the objective function cannot be measured locally. For example, the objective of RIS can be optimizing the channel capacity at the receiver which is far-away from the RIS. Therefore, the proposed approach has some limitations. The authors should discuss this problem.\n6. There is no comparison benchmark in the experiment results to verify the benefit of the proposed IPAC method.", "reviewer_3": "In this manuscript, Guillamon et al. experimentally demonstrate adjoint-based optimization of wave networks with examples including targeted mode transmission, coherent perfect absorption, and invisibility. The adjoint derivation for wave networks, as expressed in Eqs. (5) and (6), appears sound and, in my view, constitutes the primary strength and novelty of this work. Accordingly, I am inclined to recommend this manuscript for acceptance, provided the authors address the following points.\nFirst, regarding the invisibility network in Fig. 2: the schematic does not match the caption. It seems there should be an outgoing wave from lead 2 with amplitude A1, while the control signal is injected through lead 3. Additionally, the vertex index for lead 3 should presumably be 3, not 9.\nSecond, I have some reservations about Fig. 3. I agree with the general idea that the advantage of wave networks lies in reducing complex scattering phenomena in continuous media to a discrete, lumped network of vertices and links. Thus, the demonstration in Fig. 2 with small-size examples is fully convincing. However, while the authors discuss scaling the network up to larger sizes (N ~ 20), they fail or do not demonstrate in-situ optimization at this scale, despite claiming in the formalism section (page 3) that their protocol “bypasses” computationally intensive tasks. This ironically raises a question: why not simply optimize in silico if in-situ optimization is even more challenging? I suggest that the authors clarify the practical limitations and potential trade-offs between in-situ and in-silico implementations."}, "author_response": "Point-by-point Response to Reviewers Questions for manuscript NCOMMS-25-20992-T\n----------------------------------------------\nReviewer #1:\n• Overall, both experimental and numerical results are technically sound and impressive. One\nimportant advantage of the in-situ adjoint optimization is that the full knowledge of the\nelectromagnetic environment is not needed. This is fundamentally different from the wavefront\nshaping techniques that require repeated measurement of the scattering matrix when the\nscattering system is reconfigured.\nWe thank the reviewer for their positive evaluation of our work and for their thoughtful comments.\nPlease find below a point-by-point response to reviewer’s questions/ comments.\n• The complex scattering environment that the authors utilized can amplify small variations in\nthe optimization parameters via multiple interference pathways. This requires controlling these\nparameters with high accuracy. What accuracy is needed to vary the coaxial cable length using\nthe phase shifter in the microwave experiment? What happens if such accuracy is not reached?\nThe accuracy of the phase shifter depends on the resolution of our micrometer, which is roughly\n0.01mm. However, the optimizer used to update the parameters treated this length as a continuous,\nreal-valued set-point, with higher precision than it is measured. Despite this “quantization”\nerror, there was no issue with our optimization performance as the gradients will point in the correct\ndirection. In fact, a degree of stochasticity in the gradients are known to be beneficial for gradient-\nguided optimization – we have confirmed that this is the case in our experimental studies where I\ndegree of stochasticity, due to various noise sources, is always present. We have added this\ninformation at the end of the Methods Section “Controlling and setting up the mechanical phase\nshifter”.\n• In the experimental results shown in Fig. 2, the authors chose to vary the cable length between\nvertices 1 and 2. Is there any reason for choosing this particular bond in all three tasks? I\nwonder what will happen if the authors vary the cable length connecting other vertices? Is it\nalways sufficient to vary only one bond length for different tasks?\nThere is no particular reason for choosing this bond over any other for any of the three tasks, other\nthan it was convenient for the experimental networks of all three modalities that we constructed.\nWe could replace one of the fixed coaxial cables with the phase shifter and still be able to achieve\nthe tasks. The only requirement is to be able to probe the fields at the vertices associated with the\ncable that incorporates the phase-shifter. For our examples, it turned out that varying one cable-\nlength is sufficient to achieve the targeted modalities. We have added this information at the end\nof the first paragraph of the Section “In-Situ Implementation of IPAC”.\n• The numerical simulations were conducted on fully connected networks, but experimental\nnetworks were not fully connected. How does the connectivity of a network affects the\noutcome of physical adjoint optimization? Is a fully connected network the best for physical\nadjoint optimization? Experimentally it may be difficult to achieve fully connected networks.\nIs there a minimum number of bonds needed to achieve specific modalities via physical adjoint\noptimization?\nThe gradient-based adjoint optimization becomes more powerful when the number of optimization\nparameters (tunable bond-lengths) is larger. Nevertheless, the methodology is also applicable for\nnetworks with more limited number of tunable (via phase-shifters) coaxial cables (with potential\ndegradation performance). To address this important point, we have introduced a new section in\nthe main text under the title “Efficiency of Adjoint Optimization Computing”. In this section, we\nhave included additional ablation studies where we have varied the complexity of the network\n(directly related to the number of connected bonds) and the number of optimization parameters\nand estimated the performance of the Adjoint Optimization Computing. We have also introduced\nnew Methods sections (“Characterization of Network Complexity” and “Efficiency of\nAdjoint Optimization Methodology”) which further describe the methodology that we have used in order\nto qualify the efficiency of the iPAC in terms of increasing complexity (subsection “Performance\nEfficiency for increasing Complexity and Optimization Parameters” in Methods).\nIn Methods, we have also incorporated a new paragraph “Time-Performance benchmark”\nthat includes a comparison of time-efficiency between finite difference and Adjoint method for the\nevaluation of gradients. Further details are given in the supplementary material.\nIn the Supplementary Material, we have also, incorporated an analysis on the noise-\nsensitivity where it is assumed that the network is dynamically changing. The conclusions of this\nanalysis are summarized in a new paragraph at the end of the “Discussion” section.\nThe question of “what is the minimum parameter space” is modality-dependent and could\nbe potentially answered by recent methodologies on convex relaxations and bounding on inverse\ndesign. This question is beyond the scope of the present paper and might be pursued in a future\nwork.\n----------------------------------------------\nReviewer #2\n• This manuscript presents an in-situ physical adjoint computing (IPAC) method for wave\ncontrol in multiple-scattering electromagnetic environment. The proposed IPAC method\nconsists of three components including in-situ measurements, targeted perturbations, and an\nexternal control mechanism, to implement a real-time optimization for wave-system. A multi-\nresonant, multi-scattering complex network is used to mimic the multiple-scattering electromagnetic environment to test the\nproposed IPAC method. However, there are several concerns in this manuscript as follows.\nWe thank the reviewer for their thoughtful comments on our work. Please find below a point-by-\npoint response to reviewer’s questions/comments and concerns.\n• What is the theoretical computational complexity for the proposed IPAC approach? Please\nprovide more analysis for the computational complexity.\nAn in-silico implementation of an adjoint optimization is naturally limited by the computational\ncomplexity of simulating the physical system. This is in contrast with the proposed in-situ\nimplementation of the adjoint optimization which bypasses all the latencies (memory and time\ncomplexity) of digital simulations. All other computational steps have nearly fixed cost that do not\nscale (or scale very weakly) with the system size. For example, increasing the number of\noptimization parameters do not make the in-situ optimization more costly (in terms of\ncomputational memory and time) because all the gradients can be computed at once via backward\npropagation. We have stressed this point at the end of the new section “Efficiency of\nAdjoint Optimization Computing” that we included in the main text of the revised manuscript.\n• It is unknown what is the performance of the proposed IPAC approach for large-scale multiple-\nscattering scenarios. The scale of the multi-resonant multi-scattering complex network is\nlimited. For example, for the example of reconfigurable intelligent surface, the number of\nscattering elements can be up to 1000. How does the proposed IPAC approach work in such\nlarge-scale case?\nWe appreciate this question which has motivated us to perform additional in-silico simulations of\nlarge scale networks in the revised manuscript, representing even more complex multiple\nscattering scenarios. We have now introduced a new section “Efficiency of Adjoint Optimization\nComputing” which addresses this question (including other elements associated with the efficiency\nof the Adjoint scheme). A new Methods subsection “Time-Performance Benchmark” and\nadditional Supplementary Material are also now included that present comparison of latency of\nAdjoint Optimization Computing with standard finite different methods.\n• A real example of multiple-scattering electromagnetic environment should be tested to verify\nthe proposed IPAC approach. The multi-resonant multi-scattering complex network is over-\nsimplified. For real multiple-scattering electromagnetic environment, it can be time-varying\nwith a short coherent time. Thus, it is questionable whether the proposed method can work in\nsuch real environment.\nIn general, one has to distinguish between three possible time-scales for the environmental change:\n(a) the environmental fluctuations (coherence) time 𝜏 being shorter than the time 𝜏\n𝑒𝑛𝑣 𝑠𝑡𝑒𝑎𝑑𝑦-𝑠𝑡𝑎𝑡𝑒 that takes for the coherent electromagnetic waves to settle into a steady-state i.e. 𝜏 ≤\n𝑒𝑛𝑣 𝜏 ;\n𝑠𝑡𝑒𝑎𝑑𝑦-𝑠𝑡𝑎𝑡𝑒 (b) The environment is changing slower than the time that it takes for the real-time\nin-situ adjoint optimization 𝜏 to converge i.e. 𝜏 ≥ 𝜏 ;\n𝑎𝑑𝑗𝑜𝑖𝑛𝑡 𝑒𝑛𝑣 𝑎𝑑𝑗𝑜𝑖𝑛𝑡 and (c) The environmental\nfluctuations time is of the order of the time 𝜏 that is needed for a few iterations of the real-\n𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛 time in-situ adjoint optimization i.e. 𝜏 ∝ 𝑂(𝜏 ). The first case is atypical while the\n𝑒𝑛𝑣 𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛 second case is the best possible scenario for our scheme. We have focused on the third case and\nperformed additional investigations where we have assumed the worst-case scenario\ncorresponding to 𝜏 = 𝜏 . Specifically, we have assumed variations of the bond of the\n𝑒𝑛𝑣 𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛 network at the time scale of one iteration and analyzed the optimization efficiency in terms of the\nvariation strength of the bonds for each of the three modalities that we exhibit in the main text.\nThe results are task-dependent, showing a varying degree of robustness against the strength of the\nenvironmental variations. In our experiment the iteration time is of the order of 1sec with a\nbottleneck associated to the rather slow mechanical phase-shifters. Obviously, more advanced\nactuation schemes (e.g. semiconductor-based) will allow better scenarios where 𝜏 > 𝜏 ;\n𝑒𝑛𝑣 𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛 thus, leading to even better performance amidst fluctuations. We have included such discussion at\nthe Discussion section of the revised manuscript, while a further analysis is presented in the\nsupplementary material at section “Performance of Adjoint Optimization Method in Time-Varying\nEnvironments”.\nWe want, however, to stress that the main point of our paper is the demonstration of the\nexperimentally feasible concept of real-time gradient based adaptive optimization which typically\nhas the fastest convergence properties among various optimization strategies. Of course, the\nadvantage of the method depending on the circumstances. We envision a variety of controlled\nquasi-static, or slowly-varying yet multi-scattering environments, e.g. real-time control of table-\ntop experiments, real-time earthquake management and energy harvesting, or adaptive ranging and\ngeo-satellite imaging, where the applicability of the method is beneficial. We have reinforced this\npoint at the Introduction (see also the new Fig. 1) and at the Discussion sections of the revised\nmanuscript.\n• For the in-situ measurement component in the proposed IPAC approach, the measurement will\ninevitably have errors. Therefore, what is the impact of the measurement error to the proposed\napproach? How robust is the proposed IPAC approach?\nThe optimizer used to update the parameters treated them as continuous, real-valued set-points –\nmore precise that we can measure. Despite this “quantization” error, there was no issue with our\noptimization performance as the gradients will point in the correct direction. In fact, a degree of\nstochasticity in the gradients are known to be beneficial for gradient-guided optimization –\nwe have confirmed that this is the case in our experimental studies. We have clarified this point at\nthe end of the Section “Controlling and setting up the mechanical phase shifter” at the\nMethods section.\n• For some examples of multiple-scattering electromagnetic environment, such as\nreconfigurable intelligent surface, the objective function cannot be measured locally. For\nexample, the objective of RIS can be optimizing the channel capacity at the receiver which is\nfar-away from the RIS. Therefore, the proposed approach has some limitations. The authors\nshould discuss this problem.\nWe agree that the proposed approach requires the ability to probe the fields at the target/receiver\nand therefore is not applicable to situations where the receiver is far away and cannot be controlled.\nWe have clarified this statement in the revised manuscript. At the same time, we point out that\nwhile majority of current RIS schemes are not designed to perform local measurements (as the\nreviewer points out), there are some recent works that push the boundaries further proposing (and\neven demonstrating proof-of-principle) pixel-level (per-meta-atom) RF magnitude/phase sensing\nfor closed-loop RIS control. We have indicated some of these references (see Refs. [68,69,70,71])\nand discuss this outlook in the Discussion section (see end of first paragraph) as the reviewer\nrequested.\n• There is no comparison benchmark in the experiment results to verify the benefit of the\nproposed IPAC method.\nWe have added extra benchmark studies in the main text (see the new section “Efficiency of\nAdjoint Optimization Computing”) and the Methods (see new section “Time-Performance\nBenchmark”) and Supplementary Material (see Section “S1 Time-Performance Benchmark”)\nwhich now is included in the revised manuscript.\n----------------------------------------------\nReviewer #3\n• In this manuscript, Guillamon et al. experimentally demonstrate adjoint-based optimization of\nwave networks with examples including targeted mode transmission, coherent perfect\nabsorption, and invisibility. The adjoint derivation for wave networks, as expressed in Eqs. (5)\nand (6), appears sound and, in my view, constitutes the primary strength and novelty of this\nwork. Accordingly, I am inclined to recommend this manuscript for acceptance, provided the\nauthors address the following points.\nWe thank the reviewer for their positive evaluation of our work and for their thoughtful comments.\nPlease find below a point-by-point response to reviewer’s questions/ comments.\n• First, regarding the invisibility network in Fig. 2: the schematic does not match the caption. It\nseems there should be an outgoing wave from lead 2 with amplitude A1, while the control\nsignal is injected through lead 3. Additionally, the vertex index for lead 3 should presumably\nbe 3, not 9.\nThank you! We have corrected Fig. 2 and the associated portion of the figure caption accordingly.\n• Second, I have some reservations about Fig. 3. I agree with the general idea that the advantage\nof wave networks lies in reducing complex scattering phenomena in continuous media to a\ndiscrete, lumped network of vertices and links. Thus, the demonstration in Fig. 2 with small-\nsize examples is fully convincing. However, while the authors discuss scaling the network up\nto larger sizes (N ~ 20), they fail or do not demonstrate in-situ optimization at this scale, despite\nclaiming in the formalism section (page 3) that their protocol “bypasses” computationally\nintensive tasks. This ironically raises a question: why not simply optimize in-silico if in-situ\noptimization is even more challenging? I suggest that the authors clarify the practical\nlimitations and potential trade-offs between in-situ and in-silico implementations.\nOur choice to demonstrate iPAC for a smaller scale network was driven by resource constraints\nrather than a fundamental limitation of our protocol for larger networks. An in-silico approach\nrequires building a highly accurate model of every propagation path, boundary and loss channel in\ncontinuous space which can become computationally burdensome and sensitive to modelling\nerrors, especially for complex cavities. Whereas, in-situ, the physical medium computes its own\nGreen’s function in real time, and our protocol only requires local measurements. Furthermore, in\nour largescale simulations we have mimicked the real-world measurement process by adding\nnoise, suggesting that in-situ optimization is scalable to large network size. We have included these\nclarifications at the end of the first paragraph of the section “In-silico Implementation of iPAC for\nlarge control parameter system”."}, {"round": 2, "reviewer_comments": {"reviewer_1": "The authors have addressed all my questions and comments. I recommend the revised manuscript for publication in Nature Communications.", "reviewer_2": "The authors have addressed most of my concerns.", "reviewer_3": "I appreciate the authors' clarification on my previous concern. I have no further comments and recommend acceptance of the revised manuscript."}, "author_response": ""}]

Decision letter