Creation of a computational space with model-free metasurface neural network Authors: Mingfei Song, Chao Qian, Gaoang Wang, Cheng Li, Fang Yuan, Ali Momeni, Romain Fleury, Hongsheng Chen Published: 2026 ABSTRACT Physical neural networks (PNNs) are neural-like computational frameworks that exploit the intrinsic dynamics of physical media to achieve ultrafast and energy-efficient information processing. However, the complex and strongly-coupled physical nature of PNNs in disordered environments makes them resistant to accurate differentiable modeling. Here, we propose a concept of computational space that empowers the chaotic environment itself with computational capabilities. This space constitutes a large-scale, model-agnostic PNN through distributed intelligent metasurfaces. To enable effective training, we develop a fully-forward learning framework that estimates zeroth-order gradients from in-situ measurable electromagnetic feedback, thereby circumventing the rigorous modeling requirements of conventional backpropagation. In experiments, we construct such computational space that achieves recognition accuracies of 97% for alphabetic characters and 99% for numeric patterns. Furthermore, the space exhibits the functionalities of enhanced focusing under disordered scattering conditions and reliable human position localization. This emerging paradigm of self-evolving physical intelligence holds potential for advancing embodied intelligence, autonomous cyber–physical systems, and next-generation human–machine interaction, marking a fundamental transition from computing the physics to computing with physics. Introduction Driven by the growing hardware demands from pervasive intelligence, physical neural networks (PNNs) have recently attracted considerable attention as a novel computational paradigm in which computation and learning emerge directly from the dynamics of physical substrates1,2. PNNs leverage intrinsic physical phenomena, such as wave propagation, interference, multipath coupling, and nonlinear material responses3–7, to construct computational isomorphs of artificial neural networks (ANNs) in optical, electromagnetic, acoustic, and mechanical media8–13. By outsourcing information processing to the underlying physics, PNNs inherently provide massive parallelism, ultrafast throughput, and exceptional energy efficiency, surpassing the limitations of conventional digital processors that must discretize and simulate these dynamics14–16. In recent years, remarkable versatility of PNNs—ranging from diffractive optical networks17,18 and neuromorphic metasurfaces19–21 to analog electromagnetic computing systems22,23—have demonstrated impressive capabilities in real-time imaging24,25, wavefront control26–28, adaptive sensing29, and spatiotemporal pattern recognition30. More broadly, PNNs perform computation directly through the evolution of physical parameters, offering unique advantages in specialized, physics-intensive scenarios. For example, PNNs could enhance satellite imaging by extracting critical boundary information31, serve as analog front-ends for quantum or weak-signal detection where digital interference must be minimized under strict noise constraints32,33, and strengthen geophysical and seismic sensing through continuous-field processing that exposes hidden structural signatures from complex subsurface reflections34. Furthermore, PNN-enabled environments could advance next-generation radar perception35, electromagnetic interference mitigation36, and astronomical radio observation37 through dynamic beam shaping and real-time physical reconfiguration38,39. With these attributes, PNNs establish a promising pathway toward fast, efficient, and physically embedded intelligence capable of interacting seamlessly with complex analog environments. Despite these considerable advances, the practical implementation of large-scale, trainable PNNs remains fundamentally constrained by the difficulty of establishing accurate, differentiable models for analog physical systems in situ. Unlike digital neural networks, where neuron activations, weights, and gradients are explicitly defined, PNNs rely on complex wave-mediated interactions that, especially in complex environments, lack a stable, one-to-one correspondence between physical parameters and computational behavior. This inherent broken-isomorphism makes it extremely challenging to construct accurate differentiable models or digital twins that faithfully capture the underlying physics40,41. As a consequence, most existing PNN implementations depend on digital backpropagation, external optimization loops, or pre-characterized system responses, which preclude autonomous learning in real-world settings42–45. Furthermore, physical nonlinearities, environmental perturbations, multipath scattering, and hardware imperfections introduce systematic discrepancies between modeled predictions and actual system outputs, making simulated gradients deviate significantly from physical gradients. This challenge becomes particularly severe in spatially distributed environments, where high-order scattering, environmental uncertainty, and continuously evolving boundary conditions further obscure the relationship between controllable parameters and computational outcomes. In light of these, these limitations impede the scalability, robustness, and adaptability of state-of-the-art PNNs, underscoring the necessity for a new paradigm that supports in situ, model-free learning based on direct physical measurements rather than analytical computations. In this work, we endow the physical environment itself with computational intelligence by introducing a concept of computational space, a physical neural network in which an open environment is deliberately engineered to perform computation and learning through its intrinsic electromagnetic dynamics. We instantiate a highly entangled, wave-based computational space using multiple computational metasurfaces (comp-metas). To enable autonomous adaptation, we develop a model-free, fully-forward learning framework that extracts zeroth-order gradients directly from physical perturbations and measurable responses, without invoking analytical gradients or digital twins. We experimentally implement this framework in free space by deploying four comp-metas around the region of interest, and demonstrate its versatility across diverse tasks. The system adaptively focuses electromagnetic energy in complex scattering scenarios, recognizes alphabetic and numeric patterns with accuracies of 97% and 99%, respectively, and robustly localizes human positions across subdivided spatial grids. Unlike conventional PNN implementations confined to isolated devices or predefined architectures, computational space distributes learning and inference across the environment itself, enabling computation to emerge collectively from spatially coupled physical interactions. These results establish the computational space as a scalable and self-evolving platform for physical intelligence, pointing toward a new computing paradigm in which computation emerges directly from the environment’s intrinsic physical dynamics rather than from externally imposed digital processing. Results Conceptual illustration of computational space Building upon the concept of a self-contained PNN introduced above, we realize a computational space that is a physical environment deliberately engineered to perform complex computational tasks through electromagnetic interactions, as illustrated in Fig. 1. Ambient electromagnetic waves act simultaneously as both information carriers and agents of computation. Their interaction with objects or human bodies generates scattering fields that sensitively encode detailed geometric, positional, and postural information. The resultant information-rich scattering fields permeate the environment, creating a dynamic data layer that continuously reflects and communicates the physical context of the scene. In this framework, the scattering field is not merely a passive carrier of information, but an active computational medium whose distributed interactions continuously transform environmental inputs into task-relevant physical representations. To exploit the rich information encoded in the scattering field, we distribute comp-metas throughout the environment, creating a large population of physically coupled “neurons” that mimic the distributed-node philosophy of ANNs46. Each unit cell of a comp-meta operates as a tunable scattering node, electromagnetically coupled with all others through electromagnetic wave propagation, giving rise to a densely interconnected PNN in which computation emerges from multipath transformations and wave interference.Fig. 1Schematic illustration of the computational space.The environment is endowed with the ability to perform in situ learning and adaptive optimization through its intrinsic physical wave dynamics. Ambient electromagnetic waves interact with surrounding objects and human subjects, generating information-rich scattering fields that encode both physical and semantic information. Multiple computational metasurfaces (comp-metas) are distributed throughout the space, each acting as a tunable “neuron” to form a PNN through mutual electromagnetic interactions. By adaptively shaping and interpreting the scattered fields, the computational space executes diverse electromagnetic functions, including object recognition, spatial localization, and signal enhancement, directly in the wave domain without converting signals into electronic signals. This intelligent, wave-driven environment is therefore termed a computational space. Schematic illustration of the computational space. The environment is endowed with the ability to perform in situ learning and adaptive optimization through its intrinsic physical wave dynamics. Ambient electromagnetic waves interact with surrounding objects and human subjects, generating information-rich scattering fields that encode both physical and semantic information. Multiple computational metasurfaces (comp-metas) are distributed throughout the space, each acting as a tunable “neuron” to form a PNN through mutual electromagnetic interactions. By adaptively shaping and interpreting the scattered fields, the computational space executes diverse electromagnetic functions, including object recognition, spatial localization, and signal enhancement, directly in the wave domain without converting signals into electronic signals. This intelligent, wave-driven environment is therefore termed a computational space. By reconfiguring comp-metas configurations, the computational space can shape and interpret the embedded scattering field to accomplish a variety of in-situ functions, such as object recognition, localization of individuals within the environment, and adaptive reshaping of electromagnetic fields to enhance wireless communication performance. All processing occurs directly in the wave domain without converting electromagnetic signals into slower electronic forms, allowing real-time, low-latency, and energy-efficient physical computation. In this way, an ordinary space becomes an intelligent wave-driven system capable of sensing, processing, and adapting to its surroundings through the physics of electromagnetic interactions. Beyond these demonstrated applications, such computational spaces hold profound potential for scenarios in which digital processors struggle with bandwidth and latency constraints, including autonomous driving47,48, and integrated sensing-and-communication systems49,50, where joint beamforming and inference must operate at microsecond timescales. As a general-purpose physical computing substrate, computational spaces pave the way for a new generation of intelligent environments that seamlessly integrate sensing, computation, and actuation. Model-free fully-forward training framework To physically implement adaptive training within the computational space, we develop a model-free fully-forward training framework based on the discrete simultaneous perturbation stochastic approximation (DSPSA) algorithm51, as illustrated in Fig. 2a. The scattering field generated by an object serves as the input signal to the computational space, where the trainable physical parameters correspond to the discrete phase states of each unit cell on the comp-metas. To optimize these parameters, the framework performs end-to-end physical training without analytical gradients or backpropagation, relying solely on experimentally measured feedback. In each iteration, the algorithm applies a pair of positive and negative perturbations to the parameter vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\boldsymbol{\Theta }}}}_{k}$$\end{document}Θk. The corresponding loss functions \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${L}({{\boldsymbol{\Theta }}}_{k}^{+})$$\end{document}L(Θk+) and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${L}({{\boldsymbol{\Theta }}}_{k}^{-})$$\end{document}L(Θk−) are then directly measured from the physical system through two independent forward propagations. A zeroth-order gradient is then inferred directly from the measured loss differences, providing a physically grounded estimate of the optimization direction without requiring analytical derivatives. This zeroth-order gradient \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{g}\left({{{\boldsymbol{\Theta }}}}_{k}\right)$$\end{document}g^Θk effectively captures how discrete perturbations of the metasurface phase states influence the global electromagnetic response. The parameters are subsequently updated via a gradient-descent-like rule, guiding the computational space toward a configuration that minimizes the loss. The entire training process occurs fully in the forward domain, within the native electromagnetic environment, without any digital simulation or differentiable modeling.Fig. 2Model-free fully-forward training framework.a Schematic of the training process. The scattering field of an object acts as the input to the computational space. The programmable physical parameters correspond to the discrete phase states of the metasurface unit cells, which are optimized using the discrete simultaneous perturbation stochastic approximation (DSPSA) algorithm. b Illustration of the DSPSA training process for a one-dimensional parameter, where gradient information is derived from paired physical perturbations rather than analytical derivatives. c Extension of the DSPSA training to an N-dimensional discrete parameter space. Each unit cell supports four discrete phase states (0, π/2, π, 3π/2), mapped to the integer set {0, 1, 2, 3}. The fully-forward training framework enables in situ optimization directly through measurable feedback, allowing the system to efficiently train in a high-dimensional, non-differentiable physical system. Model-free fully-forward training framework. a Schematic of the training process. The scattering field of an object acts as the input to the computational space. The programmable physical parameters correspond to the discrete phase states of the metasurface unit cells, which are optimized using the discrete simultaneous perturbation stochastic approximation (DSPSA) algorithm. b Illustration of the DSPSA training process for a one-dimensional parameter, where gradient information is derived from paired physical perturbations rather than analytical derivatives. c Extension of the DSPSA training to an N-dimensional discrete parameter space. Each unit cell supports four discrete phase states (0, π/2, π, 3π/2), mapped to the integer set {0, 1, 2, 3}. The fully-forward training framework enables in situ optimization directly through measurable feedback, allowing the system to efficiently train in a high-dimensional, non-differentiable physical system. Figure 2b illustrates the DSPSA procedure using a one-dimensional example of a unit cell phase parameter θθ. The goal is to minimize a discrete loss function \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$L:{\mathbb{Z}}\to {\mathbb{R}}$$\end{document}L:Z→R defined over integer-valued parameters. Since the gradient is undefined on discrete domains, conventional continuous optimization fails here. To address this, DSPSA introduces a continuous extension of the discrete function by connecting adjacent integer points with straight line segments to form a piecewise-linear approximation \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\bar{L}$$\end{document}L¯. The zeroth-order gradient at any non-integer point \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\theta }_{1}^{k}$$\end{document}θ1k is estimated by the symmetric finite-difference formula:1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{g}\left({\theta }_{1}^{k}\right) =\left(L\left({{{\rm O}}}\left({\theta }_{1}^{k}\right)+\Delta \right)-L\left({{{\rm O}}}\left({\theta }_{1}^{k}\right)-\Delta \right)\right)/2\Delta \\ =\left(L\left({\theta }_{1}^{{k}^{+}}\right)-L\left({\theta }_{1}^{{k}^{-}}\right)\right)/2\Delta$$\end{document}g^θ1k=LOθ1k+Δ−LOθ1k−Δ/2Δ=Lθ1k+−Lθ1k−/2Δwhere \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\rm O}}}\left({\theta }_{1}^{k}\right)=\left\lfloor {\theta }_{1}^{k}\right\rfloor+1/2$$\end{document}Oθ1k=θ1k+1/2 represents the midpoint between two adjacent integers, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\left\lfloor \cdot \right\rfloor$$\end{document}⋅ denote the floor operator, and ΔΔ is a small random perturbation modeled as a Bernoulli variable taking values ± 1/2±1/2. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\theta }_{1}^{{k}^{+}}$$\end{document}θ1k+ and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\theta }_{1}^{{k}^{-}}$$\end{document}θ1k− denote the positively and negatively perturbed parameter values at iteration kk, generated by adding and subtracting a small random perturbation ΔΔ, respectively, i.e. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\theta }_{1}^{{k}^{+}}={{{\rm O}}}\left({\theta }_{1}^{k}\right)+\Delta$$\end{document}θ1k+=Oθ1k+Δ, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\theta }_{1}^{{k}^{-}}={{{\rm O}}}\left({\theta }_{1}^{k}\right)-\Delta$$\end{document}θ1k−=Oθ1k−Δ. Importantly, although the perturbation is performed in a continuous surrogate domain, the resulting parameters are always mapped back to the physically realizable discrete domain. Therefore, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\theta }_{1}^{{k}^{+}}$$\end{document}θ1k+ and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\theta }_{1}^{{k}^{-}}$$\end{document}θ1k− ultimately correspond to integer-valued phase states that can be implemented by the programmable metasurface. The parameter is then updated as:2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\theta }_{1}^{k+1}={\theta }_{1}^{k}-{a}_{k}\hat{g}\left({\theta }_{1}^{k}\right)$$\end{document}θ1k+1=θ1k−akg^θ1kwhere \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${a}_{k}$$\end{document}ak is the learning rate; see “Methods” for details. Figure 2c generalizes this mechanism to an N-dimensional parameter space, where N corresponds to the number of independently tunable unit cells. Each cell in the 2-bit programmable metasurface can realize four discrete phase states, 0, π/2, π, and 3π/2, mapped onto the integer set \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\{{\mathrm{0,1,2,3}}\}$$\end{document}{0, 1, 2, 3}. The metasurface parameter at iteration kk is represented by the vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\boldsymbol{\Theta }}}}_{k}=[{\theta }_{1}^{k},{\theta }_{2}^{k},\ldots,{\theta }_{N}^{k}]$$\end{document}Θk=[θ1k,θ2k,…,θNk]. To ensure physical realizability, a projection operator \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Psi (\cdot )$$\end{document}Ψ(⋅) maps any out-of-range component back to the continuous feasible region \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$[{\mathrm{0,3}}]$$\end{document}[0, 3] before each iteration (details in “Methods”). From \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Psi ({{{\boldsymbol{\Theta }}}}_{k})$$\end{document}Ψ(Θk), the midpoint vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\rm O}}}({{{\boldsymbol{\Theta }}}}_{k})$$\end{document}O(Θk) is computed, followed by the application of positive and negative perturbations to form \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\boldsymbol{\Theta }}}}_{k}^{+}=[{\theta }_{1}^{{k}^{+}},{\theta }_{2}^{{k}^{+}},\ldots,{\theta }_{N}^{{k}^{+}}]$$\end{document}Θk+=[θ1k+,θ2k+,…,θNk+] and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\boldsymbol{\Theta }}}}_{k}^{-}=[{\theta }_{1}^{{k}^{-}},{\theta }_{2}^{{k}^{-}},\ldots,{\theta }_{N}^{{k}^{-}}]$$\end{document}Θk−=[θ1k−,θ2k−,…,θNk−]. Each of these perturbed parameters is transformed to the discrete phase domain, and their corresponding loss values (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$L\left({{{\boldsymbol{\Theta }}}}_{k}^{+}\right)$$\end{document}LΘk+ and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$L\left({{{\boldsymbol{\Theta }}}}_{k}^{-}\right)$$\end{document}LΘk−) are measured experimentally through two forward propagations. Using these two measured losses, the zeroth-order gradient is estimated, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\boldsymbol{\Theta }}}}_{k}$$\end{document}Θk is updated accordingly. The training continues until the maximum iteration number MM is reached, after which the parameters are rounded to the nearest integers to produce the final optimized metasurface phase distribution \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\left[\Psi \left({{{\boldsymbol{\Theta }}}}_{M}\right)\right]$$\end{document}ΨΘM. Although increasing the number of parameters enlarges the optimization dimensionality, the convergence cost of DSPSA does not grow exponentially because each iteration requires only two loss evaluations independent of parameter dimension. Detailed results are provided in Supplementary Note 11. This multidimensional extension enables the framework to efficiently explore large, high-dimensional, and discrete parameter spaces, supporting rapid convergence even under strong multipath scattering and environmental uncertainty. Numerical simulations of object recognition To validate the feasibility of the proposed model-free fully-forward training framework, full-wave electromagnetic simulations were performed within a modeled computational space. As illustrated in Fig. 3a, the system consists of four independently controlled comp-metas positioned in free space. Each metasurface comprises a 7 × 7 array of unit cells, with each cell measuring 30 × 30 mm² and operating at 5.0 GHz. As shown in Fig. 3b, each unit cell integrates two voltage-controlled PIN diodes on its front and back surfaces, allowing precise manipulation of its reflection phase. The combination of the two PIN diodes produces four programmable phase states corresponding to four distinct biasing modes, which are mapped one-to-one to the integer set {0, 1, 2, 3}, as shown in Fig. 3c.Fig. 3Metasurface design and numerical simulation of computational space.a Configuration of the computational space consisting of four comp-metas positioned in free space. The scattered waves are focused onto different pre-defined probes, each corresponding to a distinct target object. b Schematic of the unit cell. The detailed geometrical parameters are: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${w}_{m}=12{mm}$$\end{document}wm=12mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${w}_{s}=30{mm}$$\end{document}ws=30mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${s}_{1}=0.7{mm}$$\end{document}s1=0.7mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${s}_{2}=5{mm}$$\end{document}s2=5mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$d=8{mm}$$\end{document}d=8mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${p}_{1}=3.2{mm}$$\end{document}p1=3.2mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${p}_{2}=0.12{mm}$$\end{document}p2=0.12mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${p}_{3}=1.6{mm}$$\end{document}p3=1.6mm. The substrate layers are composed of three dielectric materials: F4B (labeled as 1, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\varepsilon }_{r}=2.65$$\end{document}εr=2.65), Polypropylene (labeled as 2, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\varepsilon }_{r}=4.1$$\end{document}εr=4.1)), and FR4 (labeled as 3, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\varepsilon }_{r}=4.3$$\end{document}εr=4.3)). Here, two diodes are adopted to tune the reflection response. c Phase distributions at different frequencies. d, e Accuracy is quantified by the ratio of the power received by each probe to the total received power, defined as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Delta P/{P}_{0}$$\end{document}ΔP/P0. f, h Time-varying results of recognition accuracy. g, i Confusion matrices of the alphabetic and numeric recognition tasks. Metasurface design and numerical simulation of computational space. a Configuration of the computational space consisting of four comp-metas positioned in free space. The scattered waves are focused onto different pre-defined probes, each corresponding to a distinct target object. b Schematic of the unit cell. The detailed geometrical parameters are: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${w}_{m}=12{mm}$$\end{document}wm=12mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${w}_{s}=30{mm}$$\end{document}ws=30mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${s}_{1}=0.7{mm}$$\end{document}s1=0.7mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${s}_{2}=5{mm}$$\end{document}s2=5mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$d=8{mm}$$\end{document}d=8mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${p}_{1}=3.2{mm}$$\end{document}p1=3.2mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${p}_{2}=0.12{mm}$$\end{document}p2=0.12mm, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${p}_{3}=1.6{mm}$$\end{document}p3=1.6mm. The substrate layers are composed of three dielectric materials: F4B (labeled as 1, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\varepsilon }_{r}=2.65$$\end{document}εr=2.65), Polypropylene (labeled as 2, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\varepsilon }_{r}=4.1$$\end{document}εr=4.1)), and FR4 (labeled as 3, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\varepsilon }_{r}=4.3$$\end{document}εr=4.3)). Here, two diodes are adopted to tune the reflection response. c Phase distributions at different frequencies. d, e Accuracy is quantified by the ratio of the power received by each probe to the total received power, defined as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Delta P/{P}_{0}$$\end{document}ΔP/P0. f, h Time-varying results of recognition accuracy. g, i Confusion matrices of the alphabetic and numeric recognition tasks. Two groups of pattern-recognition tasks were designed to assess learning performance, numeric patterns (“1”, “2”, “3”) and alphabetic patterns (“A”, “B”, “C”), each represented as a 7 × 7 binary matrix. Standard MNIST and EMNIST datasets were used for training; see Supplementary Note 8 for more information. A plane electromagnetic wave was emitted toward the recognition object placed in the computational space. The scattered waves repeatedly interact with the surrounding metasurfaces, giving rise to rich multipath interference patterns that are sampled by three spatially distributed probes. The signals measured by these probes provide real-time feedback for training. The training objective was to maximize the received field intensity at the probe corresponding to the correct recognition label. Accordingly, a cross-entropy loss function was employed:3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$L=-\mathop{\sum}\limits_{j}{y}_{j}log \left(\frac{exp \left({x}_{j}-\max \left(x\right)\right)}{{\sum }_{i}exp \left({x}_{i}-\max \left(x\right)\right)}\right)$$\end{document}L=−∑jyjlogexpxj−maxx∑iexpxi−maxxwhere \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$x=\left[{x}_{1},{x}_{2},{x}_{3}\right]$$\end{document}x=x1,x2,x3 denotes the electric field intensities measured by the three probes. To quantitatively evaluate recognition performance, we defined a normalized metric \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Delta P/{P}_{0}$$\end{document}ΔP/P0, representing the power ratio received by each probe relative to the total received power. The classification criterion of the object is determined by the probe exhibiting the maximum power ratio. As shown in Fig. 3d, e, the measured results align accurately with the labels, confirming that the strongest signals consistently appear at the correct probe positions after training. The recognition accuracies of both tasks increase rapidly during early epochs and exceed 90% within approximately ten epochs (Fig. 3f, h). Ultimately, the computational space achieves recognition accuracies of 97% for alphabetic patterns and 99% for numeric patterns (Fig. 3g, i). These results demonstrate that the proposed computational space can achieve in situ, model-free training entirely within a purely physical neural network, bridging the gap between electromagnetic interaction and intelligent computation. To further evaluate scalability, we conducted numerical simulations on the full MNIST dataset (60,000 training and 10,000 test samples) using a 2-bit neural representation. The computational space achieves stable convergence and reaches 75% accuracy after 30 epochs, providing a demonstration of its capability to handle more complex classification tasks beyond the experimental setting. Detailed results are provided in Supplementary Note 9. Furthermore, we conducted additional experiments to evaluate the influence of key parameters, including computational space size, probe configuration, and metasurface number. Detailed results are provided in Supplementary Note 10. Experimental focusing in the computational space To further demonstrate the generality of the proposed computational space, we experimentally evaluated its electromagnetic focusing capability. The experiments were performed in an anechoic chamber to emulate a controlled yet physically realistic environment. As illustrated in Fig. 4a, b, two representative scenarios were constructed. Scene 1 contains two cylindrical dielectric scatterers placed inside the computational space, whereas Scene 2 emulates a realistic indoor environment populated with multiple objects—including a sofa, bookshelf, and dining table—which collectively generate strong multipath scattering, complex electromagnetic coupling, and partial line-of-sight (LoS) obstruction. The resulting focusing effect arises primarily from coordinated wavefront shaping of multiply scattered fields mediated by the computational metasurfaces. The experimental setup comprises four independently controlled comp-metas, a transmitting antenna, and a probe antenna positioned at the target focal point. A transverse electric (TE) plane wave is incident into the computational space, with its electric field polarized along the z-axis. The probe, oriented perpendicular to the x-y plane, is connected to port 2 of a vector network analyzer (VNA), while the transmitting antenna is connected to port 1; see “Methods” for details. During optimization, the training framework iteratively updates the discrete phase states of all metasurface elements based on the measured \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{21}$$\end{document}S21, aiming to maximize the received field amplitude at the probe. The evolution of the measured \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{21}$$\end{document}S21 and the corresponding training gradient as functions of the training epoch are presented in Fig. 4d, e. Following typical gradient-descent dynamics, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{21}$$\end{document}S21 steadily increases while the training gradient decreases, indicating stable convergence of the physical optimization process. Specifically, in Scene 1, the measured \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{21}$$\end{document}S21 improves from –52.85 dB to –40.33 dB, corresponding to an enhancement of 12.52 dB. In Scene 2, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{21}$$\end{document}S21 increases from –49.99 dB to –35.77 dB, achieving a gain of 14.22 dB. The final optimized phase distributions of the four metasurfaces for both scenarios are shown in Fig. 4c. These results confirm that the proposed computational space enables robust and adaptive electromagnetic focusing within highly scattering environments. By optimizing purely through measurable physical feedback without digital backpropagation, the computational space showcases its potential for real-world applications such as smart wireless environments and adaptive beamforming.Fig. 4Experimental demonstration of adaptive electromagnetic focusing in complex scattering environments.a, b Experimental setups for Scene 1 (two cylindrical scatterers) and Scene 2 (a scaled-down indoor model with a sofa, bookshelf, and dining table) to introduce rich and unpredictable scattering. In both cases, the setup includes four comp-metas, a transmitting antenna, and a probe positioned at the target focal point. c Final optimized phase distributions of the four comp-metas for the two scenes. d, e Evolution of the measured \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{21}$$\end{document}S21 parameter and the corresponding training gradient as functions of training epoch in two scenes. The computational space enhances the received field strength by 12.52 dB in Scene 1 (from –52.85 dB to –40.33 dB) and by 14.22 dB in Scene 2 (from –49.99 dB to –35.77 dB). Experimental demonstration of adaptive electromagnetic focusing in complex scattering environments. a, b Experimental setups for Scene 1 (two cylindrical scatterers) and Scene 2 (a scaled-down indoor model with a sofa, bookshelf, and dining table) to introduce rich and unpredictable scattering. In both cases, the setup includes four comp-metas, a transmitting antenna, and a probe positioned at the target focal point. c Final optimized phase distributions of the four comp-metas for the two scenes. d, e Evolution of the measured \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{21}$$\end{document}S21 parameter and the corresponding training gradient as functions of training epoch in two scenes. The computational space enhances the received field strength by 12.52 dB in Scene 1 (from –52.85 dB to –40.33 dB) and by 14.22 dB in Scene 2 (from –49.99 dB to –35.77 dB). Experimental localization using the computational space Beyond electromagnetic focusing, we further explored the capability of computational space for in situ localization, where spatial information is inferred directly from wave-mediated physical interactions. As illustrated in Fig. 5a, the sensing region was divided into eight grids, each assigned a unique three-bit binary label ABC, as shown in Fig. 5c. Three probes—corresponding respectively to bits A, B, and C—were fixed at distinct positions to measure the transmitted electromagnetic signals. The transmission coefficients detected by the probes, denoted as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{I}(I=A,B,C)$$\end{document}SI(I=A,B,C), were compared against predefined thresholds S’A = −50 dB, S’B = −53 dB, and S’C = −41.5 dB; see “Methods” for details. For each bit, if \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{S}_{I}-{S{'}}_{I} < 0}$$\end{document}SI−S′I<0, the bit is assigned as “0”; otherwise, “1”. The resulting three-bit binary code represents the predicted spatial label of the target, as illustrated in Fig. 5c. The computational space was trained using the sum of three cross-entropy losses corresponding to the three binary outputs; see “Methods” for details. As shown in Fig. 5b, the total loss decreases steadily over training epochs. The localization performance for different target positions is presented in Fig. 5d, where the predicted position labels match perfectly with the ground-truth grid indices. These results confirm that the trained computational space can effectively distinguish spatial locations based solely on electromagnetic field distributions.Fig. 5Object localization in the computational space.a Experimental setup for human localization within the trained computational space. b Evolution of the loss as a function of training epoch. c The sensing area is divided into eight grids, each labeled by a 3-bit binary code ABC. Thresholds are set to S’A = -50 dB, S’B = −53 dB, S’C = −41.5 dB; for each probe II, if \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{I}-{S{'} }_{I} < 0(I=A,B,C)$$\end{document}SI−S′I<0(I=A,B,C), the corresponding bit is recognized as “0”; otherwise “1.” d Comparison between predicted and actual grid indices. e Localization recognition under different human orientations (−30°, 0°, +30° rotation). f Movement within a fixed grid but with different random positions (left, center, right). g Localization robustness across different human subjects. Object localization in the computational space. a Experimental setup for human localization within the trained computational space. b Evolution of the loss as a function of training epoch. c The sensing area is divided into eight grids, each labeled by a 3-bit binary code ABC. Thresholds are set to S’A = -50 dB, S’B = −53 dB, S’C = −41.5 dB; for each probe II, if \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S}_{I}-{S{'} }_{I} < 0(I=A,B,C)$$\end{document}SI−S′I<0(I=A,B,C), the corresponding bit is recognized as “0”; otherwise “1.” d Comparison between predicted and actual grid indices. e Localization recognition under different human orientations (−30°, 0°, +30° rotation). f Movement within a fixed grid but with different random positions (left, center, right). g Localization robustness across different human subjects. To further examine the robustness and generalization of the learned localization function, we introduced variations in the target’s orientation, movement, and body configuration. Figure 5e shows the results for different rotation angles: the central panel corresponds to the non-rotated orientation, while the left and right figures correspond to ±30° rotations (viewed from the +z axis). Figure 5f examines displacements within a single grid, where the subject is shifted leftward or rightward relative to the grid center. Figure 5g further evaluates the effect of variations in human subjects. In all cases, the predicted grid labels remain consistent with the true positions, demonstrating that the computational space retains high localization accuracy and robustness. These findings highlight the potential of wave-driven physical intelligence for real-world applications such as indoor positioning, human-environment interaction, and intelligent wireless perception. To further evaluate dynamic scenarios, additional localization experiments are performed with moving targets and environmental perturbations. Detailed results are provided in Supplementary Note 6. Discussion In conclusion, we have demonstrated a physical computational space that supports end-to-end learning entirely within the electromagnetic environment. In contrast to conventional inverse-design or simulation-driven approaches that rely on analytical gradients or differentiable digital twins, our system implements a fully physical, closed-loop optimization process through a model-free, forward-only training framework. By extracting optimization cues directly from measured scattering responses, the computational space autonomously adjusts its physical degrees of freedom without prior modeling, thereby overcoming long-standing challenges in scalability, modeling fidelity, and in situ adaptability. Experimental demonstrations, including wave focusing under multipath scattering, high-accuracy recognition of alphanumeric patterns, and robust human-position localization, confirm that the computational space operates as an active learning medium. It can sense, interpret, and sculpt electromagnetic fields to perform functional computation purely through intrinsic physical interactions. This work also represents a significant advance beyond our recent invisible space termed as MetaSeeker52, evolving it into an actively trainable, large-scale computational platform. Looking ahead, our work opens a promising avenue toward general physical intelligence in disordered environments. By incorporating a broader set of programmable physical parameters and extending the learning mechanism across multiple wave domains, future computational spaces may achieve multi-task, multi-frequency, and even multi-physics learning, thus enabling unified perception and adaptive control across electromagnetic, acoustic, and mechanical media. Our work establishes a new paradigm for physical intelligence by transforming the ambient environment into an active computational space, offering new possibilities for future smart-home devices, adaptive sensing, and embodied intelligent systems. Methods Learning rate The learning rate sequence is \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${a}_{k}=a/{(1+k+A)}^{\alpha }$$\end{document}ak=a/(1+k+A)α.In accordance with standard SPSA theory, we set the decay exponent to α=0.501α=0.501, which satisfies the convergence conditions while providing a sufficiently slow decay rate for noisy zeroth-order gradients. α exhibits strong robustness; the same value (α=0.501α=0.501) is consistently used across all three experimental scenarios without re-tuning. The stability parameter AA is typically chosen as approximately 10% (or less) of the maximum number of expected iterations so as to moderate the initial learning rate; here we set A=400A=400. The constant aa governs the overall update magnitude and is calibrated empirically from early-stage gradient statistics. Specifically, we estimate the mean absolute zeroth-order gradient \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\bar{G}$$\end{document}Ḡ over the first 20 iterations and choose \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${a}$$\end{document}a such that \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\bar{G}\times a/{(1+A)}^{\alpha }$$\end{document}Ḡ×a/(1+A)α matches the desired parameter-update amplitude during initial training53. For example, if an early-stage update of 0.01 is targeted and the measured mean gradient is \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\bar{G}=\,$$\end{document}Ḡ=2, then \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$2\times a/{(1+400)}^{0.501}=0.01$$\end{document}2×a/(1+400)0.501=0.01, which yields a=1a=1. This procedure ensures that the learning-rate schedule is neither overly aggressive nor prematurely damped, thereby promoting smooth and reliable convergence throughout the fully forward training process. Projection operator The comp-metas in the computational space accept only a finite set of phase states due to hardware constraints, making it necessary to map the parameters \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${{{\boldsymbol{\Theta }}}}_{k}=[{\theta }_{1}^{k},{\theta }_{2}^{k},\ldots,{\theta }_{N}^{k}]$$\end{document}Θk=[θ1k,θ2k,…,θNk] onto a physically feasible domain. To ensure that each element remains within the allowable interval, we define a projection operator \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Psi ({\theta }_{i}^{k})$$\end{document}Ψ(θik) as4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Psi ({\theta }_{i}^{k})=\left\{\begin{array}{c}0,\hfill \quad \;\; {if}\; {\theta }_{i}^{k} < 0\hfill \\ {\theta }_{i}^{k},\hfill \quad\quad \;\;{if}\; 0\le {\theta }_{i}^{k} < 3\hfill \\ 3-\tau,\hfill{if}\; {\theta }_{i}^{k}\ge 3\,\hfill \end{array}\right.$$\end{document}Ψ(θik)=0,ifθik<0θik,if0≤θik<33−τ,ifθik≥3where ττ is a small positive constant (typically \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\tau={10}^{-10}$$\end{document}τ=10−10)51. The introduction of ττ is to ensure the correctness of the midpoint computation after the parameter is projected back into the feasible domain. Threshold determination for the localization experiment The predefined thresholds used for the three bits were determined from measurements taken at the initial stage of the experiment. Specifically, we recorded the transmission coefficients at probes A, B, and C while the object was positioned sequentially at all eight predefined grid locations. We compute the median of the eight measurements for each probe. These median values are then adopted as the fixed predefined thresholds S’A, S’B, S’C. Loss function for object localization For each bit, the classification objective is defined using a two-class cross-entropy loss. Taking bit A as an example, the inputs are denoted as x = {S’A, SA}, where S’A = −50 dB denotes the predefined threshold, and SA is the measured transmission coefficient obtained from the probe A. The bit-wise loss is formulated as5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${L}_{A}=-\mathop{\sum}\limits_{j}{\,y}_{j}log \left(\frac{exp \left(\alpha \left({x}_{j}-\max \left(x\right)\right)\right)}{{\sum }_{i}exp \left(\alpha \left({x}_{i}-\max \left(x\right)\right)\right)}\right)$$\end{document}LA=−∑jyjlogexpαxj−maxx∑iexpαxi−maxxwhere αα is a correction factor which is set as 2.6. The losses for the remaining bits B and C follow the same formulation, yielding \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$L={L}_{A}+{L}_{B}+{L}_{C}$$\end{document}L=LA+LB+LC. This composite loss allows the system to jointly learn all three binary components of the spatial label. Supplementary information Supplementary Information Transparent Peer Review file Supplementary Information Transparent Peer Review file