Scalable physical source-to-field inference with hypernetworks
Authors: Berian James
Stefan Pollok
Ignacio Peis
Elizabeth Louise Baker
Jes Frellsen
Rasmus Bjørk
Venue: Accepted by TMLR ()

Abstract: We present a generative model that amortises computation for the field and potential around e.g.~gravitational or electromagnetic sources. Exact numerical calculation has either computational complexity $\mathcal{O}(M\times{}N)$ in the number of sources $M$ and evaluation points $N$, or requires a fixed evaluation grid to exploit fast Fourier transforms. Using an architecture where a hypernetwork produces an implicit representation of the field or potential around a source collection, our model instead performs as $\mathcal{O}(M + N)$, achieves relative error of $\sim\!4\%-6\%$, and allows evaluation at arbitrary locations for arbitrary numbers of sources, greatly increasing the speed of e.g.~physics simulations. We compare with existing models and develop two-dimensional examples, including cases where sources overlap or have more complex geometries, to demonstrate its application.

Published in Transactions on Machine Learning Research (02/2026)
Scalable physical source-to-field inference with hypernetworks
Berian James*
berian&tem.ente
Technical University of Denmark & Pioneer Centre for Al
Stefan Pollok" Technical University of Denmark
stefanpollok94 @ggmail.
Ignacio Peis
ipea= dk
Technical University of Denmark & Pioneer Centre for
Elizabeth Louise Baker
eloba@dtu.c dk
Technical University of Denmark & Pioneer Centre for
Jes Frellsen
jefr dk
Technical University of Denmark & Pioneer Centre for AT
Rasmus Bjørk
rabjödtu. dk
Technical University of Denmark
Reviewed on OpenReview: https: // openreview. net/ forum? id= Eufu@po
Abstract
We present generative model that amortises computation for the field and potential around e.g. gravitational or electromagnetic sources. Exact numerical calculation has either com- putational complexity O(M x N) in the number of sources M and evaluation points N, or requires fixed evaluation grid to exploit fast Fourier transforms. Using an architecture where a hypernetwork produces an implicit reprosentation of the field or potential around a source collection, our model instead performs as O(M + N), achieves relative error of arbitrary locations for arbitrary numbers of sources,
4% 66,, and allows evaluation greatly increasing the speed of e.g. physies simulations. We compare with existing models and develop two-dimensional examples, including cases where sources overlap have more complex geometries, to demonstrrte its application.
1 Introduction
Physics-informn machine learning has proven to be a useful tool for modelling functions. In this work, we apply it to the problem of learning fields. This poses extra methodological challenges, since not only do we ncod incorporate physical constraints, but we also require that we can compose the output functions linearly corresponding the superposition of fields. Fields are the critical observable in most disciplines of physics. The gravitational field, magnetic and electric fields, well as various quantum mechanical fields, have provided fundamental advances in the description of the physical world. Evaluating fields numerically is also crucial to the development of real-world technologics, c.g. in renewable or fusion energy systems. However, current. simulation approaches are bounded by their scaling when faced with a high number of field sources (i.e. non-pointlike objects) or fine fine-grained field resolution, for which seminal numerical methods the Fast Multipole Method (FMM) and Fast Fourier Transform (FFT) algorithms (Greengard Rokhlin 1987
"Equal contribution

---

Published in Transactions on Machine Learning Research (02/2026)
Models
Baseline models
Property
FOURIER
FC+ILR
FC+INR
Lincar
Exact
O(M + N) scaling
X
Principle of superposition
V
v
Admits physical interpretation
v
Table 1: Comparison of desiderata across different explored models within the template architecture. The specification of models and baseline models is given in Section 5.2 FC+ILR is fully-connected network with a hypernetwork-trriin connected implicit neural representation hypernetwork.
final layer (an 'implicit linear representation)) FC+INR is a standard fully-
Engheta et al. 1992 either impose restrictive assumptions or fail to efficiently handle arbitrary source configurations.
We propose to tackle source-tofieeld inference-iee generating the field at any point around inside extended physical source, given its properties using statistical learning, and in doing so, uncover set of distinct challenges that require innovative solutions. First, the model must exhibit exceptional flexibility, being capable of learning a function space that accurately represents fields generated by an arbitrary number of sources with varying properties. This demands a framework that goes beyond traditional grid-based learning approaches and that adapts to arbitrary source configurations. Second, we must rigorously maintain this context, this means ensuring that each source contributes to the field in manner that is both independent and linear. This requirement is not just mathematical convenience but physical necessity, reflecting the fundamental linear nature of how fields interact and combine. Lastly, the model must be informed by established principles of physics, for example Maxwell's equalions, which for magnetic fields guarantee divergence field.
the principle of superposition.
To address these challenges, we propose a general architecture encompassing two models and two bascline variants (cf. Table 11, designed to:
generate continuous field functions at arbitrary locations using hypernetworks
Ha et al. 2017
achieve linear scaling with the number of sources and evaluation points by designing hypernetworks whose outputs are combined linearly; and
incorporate relevant physical properties, such as enforcing conservative fields by modelling the field as the gradient of its scalar potential.
By satisfying these criteria, our models significantly alleviate the computational cost of high-fidelity field simulations and open new directions for physical modelling through statistical learning. This approach advances the intersection of machine learning and physics, enhancing the applicability of generative models to real-world physical systems.
2 Background
2.1
Source-to-Field Inference
Our focus on classical physical fields: the magnetic field generated by any electrical current or source with magnetisation vector M, or similarly an eloctrical field generated by electric charges; and the gravitational field generated by any object with a mass. In this work, we take an example the magnetic field, but the results generalise directly to other fields.
2

---

Published in Transactions on Machine Learning Research (02/2026)
It can be shown that the magnetic field H at position generated by object with magnetisation
position r' is given by (Jackson 1999)
H( = 4m |r r 1
r V. M(r') dv'
(1)
D((r-r')
where ||-|I denotes the Euclidean norm and the term in parentheses acts like operator ID taking the divergence (V.) of the source magnetisation M, and where the integral is evaluated over the source (with volume V*). The mathematical action of the operator is to take the magnetisation vector at cach location r' within the source and yield a rotated and scaled version of it at r. The above equation is a consequence of satisfying Maxwell's equations for the magnetic flux density, Gauss's law for magnetism V B = 0 and
Ampère Maxwell law for magnetism V B Po(V x M) in the absence of currents and the definition of the magnetic field H
B M.
Mia
In three dimonsions, D is a real, symmetric x 3 tensor with components Smith et al. 2010a. Eqs. A5-6)
3(r r');(r (') (r - r r
6ij
|| - r'
where the indices i run pairwise over the Cartesian coordinates x; y, z and dig is the Kronecker delta, which is equal to 1 if the indices equal and 0 otherwise. The matrix 1B is purely geometric object. The total field at is then the superimposed contribution integrated over the spatial extent of the source.
For a uniformly magnetised source, like a permanent magnet or a magnetic domain, the magnetisation Mo is constant across the object, and so the magnetic field vector at (a single) r given by
M V') = - (- D(r D(r-r')dv") Mo = -N(r, V') Mo.
-
where by linearity N remains real, symmetric 3 3 object known as the demagnetisstion tensor, the mathematical operator (+) is matrix multiplication and V is the geometry of the source (i.e. location r', volume, and shape). There exist closed-form expressions for the tensor N for ellipsoids (Joseph & Schlömann 1964), prisms [Aharoni 1998), tetrahedra (Nielsen et al. 2019), and cylinders (Nielsen & Bjork [020 Slanove et al. 2022) among others. The same principles apply for the gravitational field, with the divergence of the magnetisation replaced by the density of the object.
Since most objects consist of uniformly magnetised domains, for calculations it advantageous to consider the magnetic field a point r, as being generated by collection of M sources that obeys the principle of superposition, contributing independently and linearly to the field at all locations,
M H(r. V') = Σ
N(r., Von) Mm with {ra)
where m is indexing the individual magnetic sources, the index n specifies the evaluation point, and Mn indicates the magnetisation vector of the m-th source. the field must be computed at N points, the overall cost scales as O(M N), since each of the N evaluations requires summing over the M sources with a distinct demagnetisation tensor termed Nmn- This bocomes particularly problematic dynamical systems, where sources evolve over time, and the field must be recomputed repeatedly. While the demagnetisation tensor N only has to be computed once if the geometry remains constant, the calculation of this magnetic field is numerically the most time consuming task in simulations of c.g. the time evolution of a collection of magnetic spins (Abert et al.) 2013 and various computational frameworks have been developed for evaluating the
aggregate field from many sources at many points by geometric decomposition BBoork et. al. 2021 Ortner &
Coliado Bandeira 2020 Liang et al. 2023
An additional property for fields can be exploited to case training. Because the gravitational field, as well the magnetic field in the absence of currents, is conservative, it can be derived from scalar-valued functions
3

---

Published in Transactions on Machine Learning Research (02/2026)
& called potentials, where H Vá. It should also be noted that because the magnetic flux density is divergence-five, the scalar potential satisfies Laplace's s equation, i.e.
0 = v - (~VØ) = 22
(5)
everywhere except the boundary of the source, where V2Φ = V M (rrifftts 2013
Eq. 6.23).
2.2 Hypernetworks
The computational cost of evaluating Eq. 4 motivates the use of ficxible machine-learning surrogates that can represent the field function directly, allowing field values to be queried anywhere without recompuling each demagnetisation tensor.
Hypernetworks provide preciscly such a mechanism. Originally introduced as ncural networks that generate the weights of another network (Ha al. 2017). they enable model parameters to be predicted dynami- cally rather than stored as fixed quantities. This allows us model entire functions suchhssuhhhhh as magnetic field conditioned on physical context like magnetisation. Hypernet have powered advances in few-shot learning [Bertinetto al. 2016), meta-learning (Munkhdalai & Yu 2017), generative modelling (Dupont et a.. 2022 Koyuncu et al. 2023 Peis et al. 2025). neural architecture search (Brock et al. 2018 and
continuous scene representations, as in Hyper (Park et al. 2021], where weights are conditioned on
scene deformations.
Recent works have also demonstrated the potential of hypernetworks for modelling physical systems, where they can serve fast surrogates for time-evolving or spatially distributed processes (Wan et al., 2023).
In this work, leverage hypernetworks to generate continuous field representations conditioned on a set of physical sources, enabling scalable and flexible source-to-field inference. Unlike traditional applications focused on discrete outputs or network weights, our approach produces entire continuous functions, making it well-suited to physical domains where evaluation at arbitrary spatial locations required.
3 Method
The computational bottlenecks in classical field evaluation motivate the use of learned surrogate model that can simultaneously i) encode an arbitrary number of sources into an efficient representation; and ii) query the field at any т, for parameterised shapes, and ultimately from a learned embedding of sources. To address this, we propose a hypernetwork- based surrogate that maps source properties to continuous field functions, allowing evaluation at arbitrary locations and aggregation across sources. In the following, we consider static configurations of sources, i.c. configurations where the locations of the source points do not change in time, but where the magnetisation of the source points can change in time.
For magnetic fields, the functions N and H are continuous and differentiable, and so are likely candidates for approximation by a network trained on data examples generated from the analytically known forms for (r,,, M, V').
The challenge, therefore, lies in breaking the quadratic coupling between sources and evaluation points: instead of explicitly computing the demagnetisation tensor at every point for every source m, as in Eq. 4 seek approximations for H V') that condition sources, such that the field can be inferred in O(M + N). To this end, we propose the approximation
aggregation of arbitrary
M
H(r,
Fn
Σ m=1
9(Mm V'n.) aM, V') (Tw)) with (ra
(6)
where tb and (cf. Fig 1b are functions to be specified, and the basis weights a(M, V') MM (M,, Vin) have to be evaluated only once for a source configuration as they are independent of ru. In our architecture, g implemented as a hypernetwork that outputs the weights or parameters for a field representation model f, which evaluates the field at query locations. We interpret g as a representation for the sources, and it should be constructed that single representation of the source collection, i.e. the of the individual
4

---

Published in Transactions on Machine Learning Research (02/2026)
Spatial coordinate
(r,))
(Unit) Basis Func- tion Generator
In
y
f(xn)
f(Fn)
M V or - Vo(r|M, V'
Σ/ Σ/ ((v(()) + b
with (ra)
Features for m-th source Mm, V
SM mm=
basis weights a (M, V*)
Figure 1: In the template architecture, a basis function generator ab R + R expands the d-dimensional spatial coordinate rn E Rd a (fixed or learnable) basis to specified order I. The coefficients a1.L RR4 of the expansion, with ag = b representing the bias term, are learned as a hypernctwork g R R+ of the o-dimensional features of the source geometry V and magnetisation Mm, which additive across the sources, giving the cumulative magnetic field or scalar potential at ry. It follows that once the basis weights a are accumulated for all M sources, only (b(r,. has to be rocalculated in f for any other evaluation point.
source embeddings, can accurately condition the approximating model f for the field. These arbitrary collections of magnetic sources, with each source input with features like source position, volume, shape, and magnctisation, generate a single additive fixed-length vector from an arbitrary number sources, rather than applying the nelwork many limes in parallel to the features of each input source. Especially note that т, becomes independent of the summation index in Eq. G
Given access to set of source configurations and their corresponding field observations, train model by minimising the Huber loss via stochastic gradient descent.
LH Ls LaMa V') ((r)) H(r.)) with d=
where the loss is averaged over all observation locations {r, J and across mini-batches source configura- tions. The Huber loss used handle the large dynamic range of field values arising from distance-dependent physical interactions. Compared to the mean squared error, reduces the influence of large near-field errors while preserving sensitivity to small residuals, leading to more stable training across near-field and far-field regimes.
In the following sections, we explore different instantiations of this general framework. We begin by in- troducing a formulation that leverages the conservative nature of certain physical fields, enabling indirect field evaluation scalar potentials. Nexi, we present additive hypernetworks, which enforce the principle of superposition by requiring f be linear in the aggregated source representation g. We then propose a physically motivated variant of f based on Fourier expansions, before turning to fully connected alternatives that relax these inductive biases to achieve greater expressivily.
3.1 Direct and indirect evaluation the field
As mentioned previously, the physics is equally well described by the magnetic scalar potential Ø. This observation allows us model the field indirectly: instead of parameterising H itself, we can parameterise scalar potential & with underlying functions â and 2 and recover the field via automatic differentiation
M
f Fm Σ MMM, Vin)
V Fn Σ
MM,,
Vinh --a(M, a(M, V') V.H(T.).
(8)
This ensures that the resulting field approximation is strictly conservative by construction, and may present a superior target for learning. Additionally, since training data are generated using MagTense (Bjørk et al.
5

---

Published in Transactions on Machine Learning Research (02/2026)
2021), which provides both the true field and its associated potential, we can incorporate this additional supervision into the loss function when the field is indirectly derived via the potential
== THE LH + Lo.
(9)
where LH and Ls Lô(Ø- -x) Φ) are Huber losses with 8 1 applicd to the field and potential predictions, respectively, and 7H, Th E RR+, are scaling weights that balance their contribution.
Additional physical constraints could influence our choices for the loss function. As mentioned previously, the magnetic scalar potential satisfies Laplace's 's equation, which could be incorporated via the loss (c.g., as in Pollok et al.) 2023). However, in this work, we employ a loss function solely based on the known field / potential values the provided data.
3.2 Additive hypernetworks for field inference
There are reasons to suppose that a representation like this might be possible. As mentioned previously, the physical sources obey the principle of superposition, contributing independently and lincarly to the field at all locations. In the language of equivariance, this is to say linear additivity implies the sources will be permutation-invariant] We provide additional discussion of this structure in Appendix B.2
To guarantee the principle of superposition, then, we must require that f be linear in MM 9M,. V..).
which is a significant constraint on possible architectures. This constraint ensures that the contribution of each source remains independent and additive in the latent space, faithfully mirroring the underlying physical laws. Geometrically, this implies that the space of source collections a vector space, and that any 9m is coordinate in the space, weighting an abstract basis function representation sb of the field around source collections. The architecture set out in Fig. implements this construction.
We implement g as fully-connected hypernetwork that outputs the parameters of the basis functions to represent f. We leave open the specific parameterisation of J, and consider both physically motivated choice and more expressive, data-driven alternative to compare their performance.
3.3 Fourier Hypernetworks
An additive hypernetwork architecture guarantees the principle of superposition. In our initial sctup, we focus further on the physical desirability of (orthogonal) decomposition of the potential, choos- ing a fixed set of basis functions vp = [cos(k)rn)) sin(k,r,)]]" in ID or (k, = (kp)()) cos(kanny); sin(kipnnz) cos(kyrny); (ookkrr=))sin(te sin sin(kpr mny)) in 2D, corre- sponding to Fourier expansion of the scalar potential e,
(ID(F.) Σ
Ap (k, rn,
(10)
P- P-1
(20(r.)
Σ
A pq Uy (k, rx).
(11)
In this model, 2/ is fixed and corresponds to the Fourier basis evaluated at query locations, while EM= g(Mm: V produces the corresponding coefficients A, = [Ap, Bpl, A E Px2 in 1D and accord- ingly Apg (Apq Bpg: Cpq. Dpyl", A E rxx4 in 2D for wavenumbers ko- and kpPp-1 E Rf-1 up order (P- PP-11 1) that modulate this basis. As ko already represents constant component, we omit the bias term in ʃ for this model, and outputs here the basis weights E RR,, where L = 2P in ID and L = 4 in 2D to represent Ap and A pg. respectively.
To understand why this reduces the complexity, note that the terms in &b depend only on where the potential is to be evaluated, while all dependence on the configuration the sources generating the potential, i.e. their
Indeed Eq. follows the form of DeepSets architecture Zaheer al. 2017). however, use g for the functions because di needed for the scalar potential.

---

Published in Transactions on Machine Learning Research (02/2026)
geometry and magnetisation, is enclosed in the Fourier coefficients A. As potentials are additive, and as the evaluation points stay constant in static problems, the Fourier coefficients A must be sums of the Fourier coefficients of each source. This means that if we compute these for every source, an operation of order M, and after adding them, we then only need to use these coefficients to evaluate the potential in the desired points, an operalion of order N.
Rather than computing these coefficients via a Fourier integral, we amortise them through the hypernetwork, conditioned on the source configuration. We provide concrete examples of this construction in both 1D and 2D in Sec. 5
Note that, while this is a non-linear function in the field location Fxi it is linear in the weights as required to make the source collections a vector space. Unlike in a discrete Fourier transform, the wavenumbers k need not be tied to the resolution or domain window where the field is evaluated, and there is no requirement that they form an integer sequence- tthy could c.g. be set as learnable parameters- spaced wavenumbers makes the basis functions orthogonal, which can help eliminate degeneracies in the training landscape. There is geometric correspondence to the use of random Fourier features in fully- connected networks (Rahimi & Recht 2007); the use of (P-1) 1) random Fourier features projects the input coordinates into a high-dimensional random superspace spanned by dæ S P-1 independent basis functions, while an explicit choice of (P-1) integrally-spaced wavenumbers projects to an orthogonal superspace of dimension dø = P 1. Nevertheless, we found from initial testing that our FOURIER model performs better when set to a logarithmicalll-spacee sequence, where the upper and lower bounds are set empirically. Practical tuning considerations for this model are provided in Appendix C.2
choosing integrally
3.4 Networks without inductive biases
As an alternative, we relax the architectural constraints and allow the basis itself to be learned implicitly through a fully-connected network. In this setting, no longer outputs coefficients for a fixed basis, but instead generates parameters that directly shape the representation capacity of ő. To preserve the principle of superposition, we constrain Σ Im to produce only the weights a and bias to the output of vb In this formulation, the activations of the final layer, of dimension L, serve as learned basis functions (r,,,, and the potential can be expressed as
L
((rm) = Σ a (h +
(12)
We refer to this construction as an implicil linear representation (FC+ILR), which preserves superposition while gaining expressivity through learnable basis functions. If we further relax this constraint, Σ 9m may generate the full parameter set of the network, resulting in a highly expressive model akin to implicit neural representations (INRs; Sitzmann al. 2020). where a hypernetwork (Ha et al. 2017) outputs all weights and biases.
We compare three instantiations of the general hypernetwork architecture, each defined by different choice of f: FOURIER, Eq. 11 where f is constructed from outputs the corresponding Fourier coefficients; FC+IIR, Fq. 12 where f is a fully-connected network and the hypernetwork modulates only its final linear layer; and FC+INR, where the hypernetwork generates the full parameter set of f, albeit at the cost of losing superposition. Table [ summarises the properties of these models, and in the experiments, we investigate their behaviour and performance.
basis functions and the hypernetwork
4 Related Work
Fast field evaluation and surrogate modelling. A key contribution of our work is the scaling behaviour of our generative model, which operates with a computational complexity of O(M + N), compared to the standard (M x N) in exact numerical simulation of fields such as the MagTense framework (Bjork et al., 2021), or FFT-basod methods requiring fixed evaluation grids. Unlike these methods, our model adopts amortised evaluation, significantly improving computational efficiency with only a small sacrifice in accuracy. This scaling perspective is also explored in the linearly constrained neural networks by Hendriks et al. (0200)
7

---

Published in Transactions on Machine Learning Research (02/2026)
for the problem of magnetic fields. Our work focuses learning representations for physical sources, which can be used in a generative model, and this presents different set of challenges and opportunities.
Physics-informed machine learning and basis representations. Our work differs from general physics-informet neural networks (PINNs; Raissi et al.) 2019 Karniadakis et al. 2021 ; which embed PDE constraints into the loss but typically require retraining for each new source configuration. While related work, c.g. Schaffer ct al. (2023), has explored neural surrogates for demagnctising ficlds, our method gener- alises across source geometries without retraining and enables continuous-ppace evaluation. We further depart from standard PINNs by explicitly embedding the principle of superposition for a collection of sources and optimising the linear coefficients of fixed (FOURIER) learned (FC+ILR) basis functions. This makes approach closer in spirit to classical Galerkin methods, while remaining end-to-end trainable.
Neural operators. Similar in spirit to this work is that of neural operators (Kovachki et al. 2023 Neural operators work by learning an operator from an input function to output function. For example, the Fourier neural operator framework {Li ct al.) 2021) uses a Fourier transform in the network architecture, effectively learning truncated Fourier representation of a global convolution kernel corresponding to an integral operator, before inverse Fourier transforming to physical space. We instead keep the logic of the basis elements and coefficients separate, outputting the coefficients of the function directly. Doing so means we can get an additive structure simply by adding together learned coefficients. Moreover, since the hypernetwork architecture is not built specific transform, it allows for choice in basis functions, for the basis to be learned (sec Fig. D. Our setup is more in line with DeepONets (Lu et al., 2021). which is another popular variant of neural operators that weights high-dimensional embeddings of the query location with coelficients given by the embedded input function. However, instead of relying on fixed sensor locations for the input function, we obtain our coefficients from the features of single magnetic sources that fully describe the specific input function. This parametric description of the input makes our approach invariant to discretisation. Further, as we follow the principle of superposition, we can sum the coefficients of multiple single-source input function embeddings to directly infer the coefficients of molti-source input function embeddings. Hence, our training simplifies to learning from single-source samples while being capable of predicting multi-source samples with similar zero-shot performance.
Conscrvative fields and architectural inductive biases. Recent efforts to enforce physical laws through nelwork design include divergence-freee networks and conservation-drrven approaches (Riehler-Powell et al. 2022 Müller 2023). These methods use differential forms or specialised architectural components to enforce symmetrics. Our approach takes a complementary route: by constructing the magnetic field as the negative gradient of the scalar potential, we ensure a conservative field by design, which holds true in the absence of free currents, as the present case of permanent magnets. Ghosh et al. (2023) similarly leverage harmonic representations in quantum systems; however, we focus on classical fields and emphasise linear additivity of sources rather than equivariant gaugo-theoretic formulations.
Hypernetworks and physical models. Our contribution extends the idea of hypernetworks (Ha et al. 2017), which have been incrcasingly applied in physical modelling (Pfaff et al., 2020 Cho et al. 2023 de Avila Belbute-Peres et al., 2021). We exlend this direction by showing how additive hypernetworks can be designed to enforce superposition and enable scalable source-to-fid to-fel inference. Unlike prior work using hypernetworks to model dynamical systems or PDE evolution, we target static field representations and develop a novel parametrisation (FOURIER, FC+ILR) that yields physically interpretable outputs with linear source aggregation.
5 Experiments
We implement experiments using finite magnetic sources, with fields and potentials derived from exact forms, either through the computational franework MagTense (Bjork et al., (2021) or via direct implementation. Full details of the analytical expressions for spherical sources are given in Appendix B.1
8

---

Published in Transactions on Machine Learning Research (02/2020)
a
Turgel polential
Target field
b
Predicsed potential
Prodicted field
meter wearo mathos
12
in madea scurce tucias
unio of sourcc radina
in unita source radiin
la mnits of source tHAlIi
Figure 2: Magnetic potential and field for three finite circular sources (a) and their approximation by a small fully-connected network (b). Sources with locations r' and direction and magnitude of the magnel is ion M shown by the red arrows, are randomly positioned within a [-3,3] x [-3,3] domain, in units of the source radius, with the potential and field generated a regular 1002 grid.
b
a
100
1.0
Training
Evo
norualised potential (ix) ())
Validation
0.8
Model
Eo
Residual E (%)
10
0.6
0.4
0.2
0.0
50
100
150
200
kEpoch (-)
spatial location Ø (-)
Figure 3: (a) Validation curves for predicting magnetic potential (red) and field (blue), either directly (solid) indirectly via the potential (dashed), shown relative error percentages. (b) Output of a 1D FOURIER wore trained on single-source potentials (dotted black), successfully generalising to the combined potential of six randomly placed sources.
We express the performance of the model prediction ( or H) as a relative error
Ō(r,) Φ(T,) Φ(ra)
((rx) -((r)) Hr.,))
6 medianneN
<н median
(13)
We report the median instead of the mean because relative errors diverge as the true field value approaches zero; the median offers a more robust and representative summary of model performance across the domain.
Our code is available at
5.1 Direct and indirect evaluation the field
We first evaluate how well the architecture can represent the field around single collection of sources, without requiring the model to learn source-conditioned representations-ian we represent & fully- connected network and and the input from souree features. When training models to amortise numerical computation, one can either learn to predict the field directly or predict the scalar potential and compute the field via numerical differentiation. It is therefore worth comparing both approaches. To demonstrate the ability of f to represent the potential and field, we use single sample consisting of three sources as shown Fig. 2 Here, the 2D sources are represented as disks of equal radius d,, 0.5 and are randomly placed within [-3, 3] x [-3,3 domain (in source-radius units). The input to sb the 2D evaluation points r, (Tna,Tny)) )² The field
learnable final linear layer to constitute f, similar to FC+ILR while omitting

---

Published in Transactions on Machine Learning Research (02/2020)
and potential of the source configuration are evaluated a regular 1002 grid, with N 100 random points reserved for validation. Two ensembles of fully-connected networks (width 32, depth 3) are trained with La and La respectively for 10a epochs using the Adam optimiser (Kingma & Ba 2014) with learning rate of 10-5. Each ensemble consists of 5 runs of different parameter initialisations, whose outputs are then averaged. The mean and variance of the ensemble validation errors during training are shown in Fig. 3h.
A model directly inferring the scalar potential (es) performs with 0.31% error. The same model can be used to infer the field by taking the numerical gradient of the potential (cve), defined in the same way EØ but notated differently to express that the field evaluation is indirect; this reaches error of 3.70%, and notably its validation curve follows the same shape during training. A separate model with the same hidden layer size that directly outputs the magnetic field from the fully-comnected network (efr performs comparably to the indirect field method, reaching 4.70%, though with an apparently slower convergence. This clearly demonstrates generalisation to arbitrary field locations- but not to arbitrary source collections, as the souree configuration was fixed here.
It is unsurprising that, for fixed network size, field pre- diction is less accurate than potential prediction due to the instability of numerical differentiation. Moreover, training scalar outputs is typically easier than training vector out- puts. Given that direct field prediction does not offer accu- racy advantages, we adopt the potential based strategy in the remainder of our experiments, which implies a simpler net- work architecture, results in conservative fields, and simul- taneously enables direct evaluation of the potential, which is itself of practical interest.
Model
M =
M > 1
FOURIER
4.74 (= 0.38)
5.73 (= 0.45)
FC+ILR
4.38 (= 0.32)
4.76 (= 0.39)
FC+INR LINEAR
3.68
70.0
71.2
Table 2: Out-of-sample relative error cs (%) for predicting the potential generated by mag- netised 2D disks of equal radius.
5.2 Evaluation of arbitrary source configurations
While the previous experiment demonstrated generalisation across spatial locations, achieving the desired
O(M+ + N) scaling requires that the model also generalise across arbitrary source configurations. To evaluate this, we generate a dataset of up to 10 source collections, each with random positions within a [-3,3] x 3,33] 3] domain and magnetisations sampled from a scaled normal distribution with scaling factor c = 1/T. As sources are 2D disks of fixed radius (dm = =), V fully defined with the location of the source (F'mz: m'y 0)" and its magnetisation Mm (Mmas Mmy. 0)". Hence, the input to g four-dimensional [Mmes Mmys P'nz: I' r'my"" (v = 4). To leverage the lincarity of superposition, we train only on single-source examples, i.c. M 1. Each training example is evaluated at N 322 randomly sampled potential points across the domain. At inference time, multiple source embeddings are aggregated before computing the field. For visualisation purposes, we use fixed 128² grid in this section.
All models share common hypernetwork g, implemented as a fully-connected network of depth 3 and width defined as a multiple of its output size, which is the number of paramcters in the last layer of ab. The networks are trained with a slepwise learning rate schedule using Adam (Kingma & Ba 2014) for 5,000 epochs per step at learning rates 10 (3.4,,655 To ensure fair comparison, model sizes are kept similar- generalll around 20M parameters-so that the overall number of parameter-opochs remains approximately constant. Detailed configurations are sunmarised in Table 4 in the Appendix.
5.2.1 The FOURIER network
For the FOURIER model, the ability to generalise to an arbitrary mumber of sources follows directly from the lincarity of the hypernetwork outputs in the inference network. This illustrated in Fig. Bb, where a 1D version of the model with 32 modes is trained solely on singlo-source examples. At inference time, weights from multiple sources are aggregated before evaluating the potential, demonstrating the use of superposition.
10

---

Published in Transactions on Machine Learning Research (02/2026)
In unite of source radhie
4. of
(a) Target
(b) FOURIER
9: watte of somtr codius
2. unics SUIDCe Todlute
2. In units SUIEOO radius
units scurce radios
Units SCUDOO Todite
(c) ILR
(d) LINEAR
Figure 4: Multiplo-source inference. (a) Ground-truth potential and field from four randomly placed circular magnets. (b-d) Predictions from models trained only on single-source examples, evaluated by first aggre- gating source representations before computing spatial values.
In two dimensions, the FOURIER model lakes the form
P-1P-1
((r.) = Σ Σ
Apg cos( (or())) (on + Byg sin (kprr)) cos(k,rT
p=0 Q=0
+ppg Cks sin(ky (ny) + Dpg sin sin Tnx)) sin (kgrng))
(14)
where kp and ky denote the wavenumbers with ko = and kp = 10-20012000000 2p-+3.65 while P controls the expansion order. We set ky kp to ensure square basis, so the total number of Fourier coefficients and hence hypernetwork outputs-is is L ~ P2, comparable in size to the weights of single linear layer of width P. Empirically, the expansion performs well with as few as 16 modes per dimension. For results in Table 2 and Fig. we use P = 32 modes.
5.2.2 The FC+ILR model
For the 2D sctting, Fig, 4 iillustrates the ability of the FC+ILR model to infer the potential and field around finite multiple sources. We emphasise both that i) the model is trained exclusively single-source examples, and that ii) at inference time, the source representations are computed individually and aggregated before evaluating the field at any location.
5.2.3 LINEAR and FC+INR baselines
The FC+INR model lacks architectural constraints enforcing superposition, and thus fails to generalise to multi-source configurations when trained only on single-source examples. Table summarises out-of-sample relative errors eg across all models. While FC+INR performs best on single-source inputs (3.68% error), it cannot. be evaluated on multi-source data.
As further baseline, we implement a minimal LINEAR model, where both sp and g are single lincar layers (depth 1) without any non-linear activation function, scaled match parameter count. The spatial co- ordinate and source features undergo only linear transformations before being concatenated in f. Despite
11

---

Published in Transactions on Machine Learning Research (02/2026)
b
a
1000
10:
Tagee
Sequential (N > 0)
FC
Parallelised
Runtime for N M (s)
FMM
Relative error E (%)
10
0.1
0.1
Inside
Far-Seli potential
2
10-3
FC+ILR
FMM
Pure FMM
10-3
10.5
10
500
1000
1500
0.1
10
Number of sources M (-)
Normalised distance source center (-)
Figure 5: (a) Runtime function of the number of sources M and keeping N = M, e.g. evaluation of Φ in the centre of each source. The blue coloured lines show the sequential evaluation time to make the underlying computational complexity of each method apparent. The green lines show the runtimes when parallelising the workload on the GPU (NVIDIA GeForce RIX 5090) with FC+ILR and on 96 threads of the CPU (Intel Xeon Gold 6248R) in the case of FMM. The increased runtime visualised by the orange line originates from the additional correction required for evaluation points lying inside other sources in case sources overlap or Φ is evaluated on a regular grid, which is denoted by Nm. > 0. Notice that this only affects the evaluation time of FMM. (b) Relative error for single evaluation points cs., from single-source configurations (M = 1) grouped by distance to the source centre normalised by the side length 8, of the source. Here, the data consists of 103 2D polentials generated by single prism-shaped source configurations with varying side lengths (s, = 8y E [0.12, 0.48)) in a [-1.2, 1.2] x [-1.2, 1.2) domain. Fach validation sample is evaluated at 32 randomly sampled potential points across the domain. The FMM method used as a benchmark is shown in yellow, while we depict in brown the 'pure' FMM without any corrections for the physical extension of the magnetic source. FC+IIR, depicted in purple, outperforms FMM close to the edges of the sources.
satisfying superposition and O(M N) scaling, lacks sufficient expressiveness, yielding relative median errors around 70%.
6 Experiments using a larger collection of sources and scaling behaviour
To test the model's applicability more complex geometries, we extend our setup to prism-shaped sources, for which the magnetic scalar potential is known analytically (James et al.) 2025 We use the FC+ILR model for this section, as it achieved the best overall trade-off in earlier experiments (see Table 2 The model is trained on 2 x 10 2D potentials generated by single sources shaped as prisms with varying side lengths (sg = Sy E [0.05, 0.5) with random positions in the ry-plane in a [-1.25, 1.25] x 1-22,, 1.25] domain. The 2D magnetisations are sampled from a scaled normal distribution with scaling factor = 10. In contrast to Sec. 5.1 the input to is now five-dimensional (M Mmy: r'me I'y $mz)² to fully describe the source configuration (v = 5). Each training example is evaluated at 322 randomly sampled potential points across the domain. Similar Sec. 5.2 we train our model in this section with stepwise learning rate schedule using Adam [Kngmma & Ba 2014 for {50, 100, 25, 25) epochs at learning rates 10 (2.3,455) We use the loss function defined in Eq. with 7H 0.25 and % = 1. The hypernetwork is implemented as fully- connected network of depth and width 800, while &b is a fully-connected network of depth 3 and width 400. Once the model is trained, it can be used in a versatile manner, as shown in the following experiments in Sec. 6.1 and in Sec. 6.2
To benchmark our model, we compare against the Fast Multipole Method (FMM), in the open-source
implementation by the Flatiron Institute (Cheng et al. 1999 Greengard et. al. 2002 Greengard & Rokhlin
12

---

Published in Transactions on Machine Learning Research (02/2020)
Greengard et al. 2002g. The FMM method, which here is utilised in its 2D version, computes N-body interactions by compressing the interactions between clusters of source and target points at a hierarchy of scales. This means that the field can be computed as order O((M + (N))og(1/)) where is the desired relative precision, which we set to 10-5 for all experiments.
1997
However, it remains necessary to correct the potential computed by FMM within each source, as the FMM method assumes point dipoles or collections of these, which within each source provides an incorrect potential shown with the "Pure FMM" method in Fig. 5p. This correction cannot be applied in manner that produces an overall correct potential, as the far-field dipole potential cannot be matched with an internally correct potential computed using the known analytical formulas for the potential generated by rectangular prism. However, ignoring this, we apply the correction to FMM to get the correct potential within each source. This can be done in two ways: i) If the field is evaluated, and this is done in the centre of each source (i.c. Tn = ) the field can easily be computed from the magnetometric demagnetization factor Nmn; which for the field in 2D for symmetric objects is simply 1/2 and the field is derived to H, = -1/2Mm, and in 3D this factor is 1/3 for symmetric objects. When evaluating the polential only in the centre, then FMM outputs the correct value (Ø,, = 0) for symmetric objects, and no correction is required. ii) However, when the field or potential is evaluated across a grid including points within each tile, this simple magnctometric correction is not applicable. We denote the number of evaluation points inside a source m with Nm. which evaluates to Nm > O in this case. It follows that the field or potential must be calculated analytically using the known expressions (Smith et al. 2010b James et al. 2025) within each point in the tile, which will add another Em=1- Nm operations to the runtime of FMM as shown with the orange line of Fig. 5a.
When comparing the runtimes in Fig. 5p, we can see the expected quadratic complexity O(M x N) for the classical evaluation method done using MagTense and a scaling of O(Am M + N) for the other meth- ods, however with different scaling factors: Am,FM FMM log(1/T) + Em Nmm and FM. log(1/7), and Am,FC+ILR = L and An,FC+IRR = + 1. When parallelising the workload for FC+ILR, we obtain flat runtime which becomes beneficial for around M + N > 2* 750, as long as the problem fits on GPU memory. For larger-scale problems, expect the runtime to follow the theoretical O(M+N) profile. Similarly, FMM exhibits a flat runtime for parallelisation across the CPU.
In Fig. 5p, we compare the performance of the method proposed here to FMM in configurations of prism- shaped magnetic sources. The relative errors of each evaluation point 6d., are grouped by the normalised distance to the source centre to highlight the peculiarities of each method. FC+ILR relative error rates are centred between 1% and 10% for the whole distance range. The best performance can be seen for distances between 1.5sg and 68g from the source centre, while the relative error goes up to 6% for the far-field patential. Interostingly, the error rates approach high error rates of 10% when reaching the centre of the sources. This is arguably due to the potential approaching 0 close to the source centre, hence small errors become relatively large. FMM, corrected by MagTense inside the sources, reaches relative error rates of around 10% close to the edges of the magnetic source, when higher order poles come into play. For the far-field potential, when the potential from a dipole becomes a better approximation, 6o grouped by the normalisod distance stays below 2%. Nevertheless, the relative error becomes larger when increasing the normalised distance beyond 3, which is because absolute error diminishes at slower rate than the ||||- scaling of the 2D potential values.
Further, we consider two different scenarios for comparing the overall performance of our model to FMM, namely one with overlapping sources and one with quadtree structures. Additionally, a scall-scale compar- ison to Fourier neural operators and how this framework can be applied to these experiments is provided in Appendix B
6.1 Overlapping sources
It is of great interest to be able to model overlapping sources, as this is often the only way of modelling complex geometries without resorting to discretising the geometry to a large degree. Because fields and potentials are additive, geometry with e.g. a hollow cylinder can be realised by starting with a cylinder and then on this overlapping a smaller cylinder with an opposite magnetisation compared to the larger cylinder. This will result in cancellation where the cylinders overlap, and this produces the correct field
13

---

Published in Transactions on Machine Learning Research (02/2026)
Target
FMM
FC+ILR
b
Target
FMM
I0-ILR
10f
Menu:: 58%
Mediam: 1.80%
Mediaa:: 5.34%
M.
(96) CC-ILR
(96) PCHILR
Figure 6: Scalar potential from sampled configurations of magnetic sources used in experiments, com- paring ground truth & with the predictions from FMM, ΦFMM, and our FC+ILR model, ØFC+ILR. The prism-shaped sources are depicted in red with the arrows indicating their magnetisation M. At the bottom, a histogram of the relative error of ØFCH is shown along with es spatially resolved for ΦFMM and ΦrC+ The spatial extensions are normalised and hence dimensionless. (a) Normalised scalar potential 10 over- lapping sources. (b) Normalised scalar potential of quadtree structure with 37 sources.
with only two sources. The alternative strategy of discretising the hollow cylinder with e.g. prisms or tetrahedra, which would have resulted in a much larger number of sources. Therefore, it is computationally desirable to be able to correctly model overlapping sources.
In this experiment, we calculate the magnetic scalar potential from varying number of sources (M 10, 50, 250, 1000) to (vs. the exact solution computed using MagTense) is presented in Table 3 An example with M = 10 sources is depicted in Fig- Ch. Note that here the evaluation points are a regular grid of 128 values, which is chosen for visualisation purposes. Each entry in the table represents an average over 10 different test samples, with its standard deviation in brackets. Notably, the potential error remains below 5% for this scenario with FC+ILR, regardless of the number of sources-in in line with the small-scale experiments with spherical sources in Table 2 The reason for the slightly larger error of the FMM method is exactly that the dipole approximation is not applicable in the proximity of a physical magnetic source, which means that error accumulates when multiple sources overlap, exemplified at the bottom of Fig. Gh.
regular grid of 32 evaluation points. The median relative error in the scalar potential
6.2 Quadtree structures
It also of interest to consider the sources arranged a way such that they span a volume of space in a non-overlapping way, and with more sources located volumes where a high resolution is desired. Such a structure could be quadtree structure, which we term a structure where space subdivided into increasingly smaller prisms by splitting each prism into four smaller prisms, with the same aspect ratio, depicted in Fig. DD for M = 37. Such a configuration is important in e.g. micromagnetic simulations where simulation domain can be meshed using rectangular prisms, with the smaller prismns resolving finer features such as grain boundary layers (Bjork & Insinga 2023).
In this experiment, we calculate the magnetic potential similarly from a varying number of sources (M 10, 50) and evaluate it on a regular grid of 322 points. When increasing the number of sources further, i.c. M > 50, the side lengths of some prism-shaped sources 82, Sy < 0.1, and the scenario cannot be evaluated in fair comparison, clearly show that FMM outperforms our model for this scenario with 6gPPMM < 3%. All evaluation points lie within a source and, as shown in Fig. 5p, FMM greatly benefits from the applied correction in this area. However, as Nm. > 0, the runtime of FMM is around one order of magnitude larger than FC+ILR
the range is outside what FC+ILR has been trained for. The results in Table 3
Our trained model stays below 10% relative error. The increased error compared to the scenario of over- lapping sources arises from the prevalence of small sources with 8, < 0.2 as can be seen in Fig. Gp. This is further emphasised in Fig. N in the Appendix, where the relative error of single-source configurations is
14

---

Published in Transactions on Machine Learning Research (02/2026)
Overlapping sources / Sec. 6.1
Quadtree / Sec. 6.2
Metric Model
M =
10
50
250
1000
10
50
EΦ (%) FMM
1.14 (# 0.28)
2.21 (#: 0.78)
4.00 (# 0.84)
6.14 (# 2.12)
5.32 (# 2.30)
2.75 (# 0.49)
2.69 (#: 0.47)
FC+ILR
2:21 (+ 1.49)
2.43 (+ 0.54)
3.05 (t 0.86)
4.40 (+ 1.58)
4.21 (+ 1.61)
6.40 (# 2.79)
5.70 (+ 1.14)
M
FMM 2.89 (+ 6.62 (+ 11.12)
8.76
8.82)
12. 12 (+ 11.72)
12.91
10.71)
7.89 (+ 10.74)
9.96 (+ 16.28)
(x10 B)
FC+ILR 2.86 (# 5.93)
5.76 (#: 7.48) 6.20 (#: 5.59) 8.32 (#: 6.88) 10.00 (#: 7.84) 13.50 (#: 15.83) 17.28 (#: 21.31)
Table 3: Mean and standard deviation of the relative error Es and the mean absolute error (MAE, o max En= 1d,, ænl)) across 10 different vest samples for increasing number M of prism-shaped sources inside one sample. 9max is the absolute maximum value of the potentials in the respective experiment. The best performing method is marked in bold. The experiment with M = 1 refers to the singlo-source configurations used in Fig. 5p.
plotted using the FC+ILR model. The reason for the large error of the method proposed here is that it is hard for the neural network to learn the potential far from source, where the potential is close to zero. The dynamic range of potential values for small prisms is simply too large for the model to learn them properly, which means that the predictions for sources with small side lengths become incorrect. As can be seen from Fig. 8,, it is the smallest sources that result. in a large error in the prediction over the whole domain.
7 Limitations & Discussion
We finish by delineating what this architecture should be capable of in principle, against what have concretely demonstrated through these experiments. This work develops models that provide inference from arbitrary collections of sources, but our experiments demonstrate this only in a limited range of evaluation domains, source volumes, and magnelisstionss For practical results in (e.g.) magnetostalics, it is necessary to develop models in the same architecture trained with the maximum expected parameter range in such applications, while overcoming the difficulties to learn a large dynamic range of magnetic field values as discussed in the Appendix D As it is known physically that the 2D far field, i.e the field measured far away from its source, falls off with |||||-2 and the 2D far-field potential follows |||||_ scaling, this could be explicitly incorporated into the learning process in future work.
When replacing the magnetisation with the mass as input to g, the same architecture can perform inference for the field and potential around gravitational sources. Further, developing these models as amortising re- placements for infcasible numerical simulation requires extension to three dimensions. All models developed in this paper can be extended this way; the FOURIER computation will then contain (2I)) terms, which makes the parameter requirements for the FC+ILR model seem more scalable, where only the input layers of sp and g necessarily have to grow in size to incorporate additional geometric information and the magneti- sation in 3D. From a learning perspective, for modelling 3D quantities properly, we also expect intermediate layer sizes and the output layer size I, to grow to have access to an increased number of basis functions. Moreover, we have not explicitly treated equivariance beyond noting a connection between the principle of superposition and the permutation invariance of sources.
As previously mentioned, this work develops models for static configurations. This architecture could be integrated iteratively into a time-varying problem, using the model output update properties of the sources and then re-evaluating the field. However, it would be more natural to consider training neural operator(s) to evolve the system. As demonstrated, this model is most effectively used with collections of sources with spatial extent; for particlo-like sources, FMM is a proven non-statistical algorithm with OMM + N) scaling (Greengard & Rokhlin, 1987). Additionally, because the magnelic field depends on the geometry of the source, the network will have to be retrained for different source geometries, such as cylinders or tetrahodra. However, it possible to envision that, as only the field near a source depends strongly on geometry, but further away all sources tend the dipolar field Bjork & d' d'Aquino (2023), a single network could be trained on different source geometries, but this is beyond the scope of this work.
15

---

Published in Transactions on Machine Learning Research (02/2026)
Lastly, our particular choice of decomposition in trigonometric basis functions (Eq. 11 while physically motivated, may be improved by explicit weighting so that limy-so & O; more physical information known from Maxwell's equation, i.e. () = 0, may further improve training the proposed architecture; with defining g (m,: V = MM] ([m: Vn), where In is the unit vector pointing in the direction of Mm as we know from Eq. 3 that the field linear in the strength of the magnetisation or directly applying rolations and translations in the vector space spanned by the abstract basis representation sb, may be another viable route to improve the proposed method. These limitations and ideas can be addressed with future work, which will be of interest to both the statistics and physics communities.
8 Conclusions
In this work, we addressed the problem of amortising field computation around physical sources by in- troducing general hypernetwork-based architecture and three model variants, cach balancing scalability, accuracy, and physical fidelity. Modelling via the scalar potential improves training efficiency and simplifies network design. Among the proposed approaches, the FOURIER and FC+ILR models achieve ~ 5% error while enabling field or potential inference for arbitrary source collections through the principle of superpo- sition. While the physically motivated FOURIER model offers interpretability through its decomposition in trigonometric basis functions, it does not outperform the more flexible FC+ILR model and incurs greater architectural complexity and tuning overhead.
References
Claas Abert, Lukas Exl, Florian Bruckner, et al. magnum.fe: micromagnetic finite-element simulation code based on fenics. Journal of Magnelism and Magnelic Mulerials, 345:29 35, 2013.
Amikam Aharoni. Demagnetizing factors for rectangular ferromagnetic prisms. Journal of Applied Physics, 33(6):3432 -43443332344, 1998.
Luca Bertinetto, João Henriques, Jack Valmadre, Philip Torr, and Andrea Vedaldi. Learning feed-forward one-shot learners. Advances in neural information processing systems, 29, 2016.
R Bjørk and M d' d'Aquino. Accuracy of the analytical demagnetization tensor for various geometries. Journal of Magnetism and Magnetic Materials, 587:171245, 2023.
R. Bjork, E. B. Poulsen, K. K. Nielsen, et al. MagTenss: A micromagnetic framework using the analytical demagnetization tensor. Journal of Magnetism and Magnetic Materials, 535:168057, 2021.
Rasmus Bjørk and Andrea Roberto Insinga. Explaining Browns paradox in NdFcB magncts from micromag- netic simulations. Journal of Magnelism and Magnelic Materials, 571:170510, 2023.
James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: compos- able transformations of Python-NumPy programs, 2024. URL http:://gthhii
com/ com/ com/google/jax
Andrew Brock, Theo Lim, JM Ritchic, and Nick Weston. Smash: Ono-shot model architecture scarch through hypernetworks. In International Conference on Leurning Representations, 2018.
Hongwei Cheng, Leslie Greengard, and Vladimir Rokhlin. A fast adaptive multipole algorithm in three dimensions. Journal of Computational Physics, (55()))468-499) 1999.
Woojin Cho, Kookjin Lee, Donsub Rim, and Noseong Park. woreereewwrk-baasee meta-learning for low-rank physics-inffrman neural networks. Advances in Neural Information Processing Systems, 36:11219 11231, 2023.
Filipe de Avila Belbuto-Peres, Yi-fan Chen, and Fei Sha. Hyperpinn: Learning parameterized differential equations with physics physics-informen informed hypernetworks. The symbiosis of deep learning and differential equations, 690, 2021.
16

---

Published in Transactions on Machine Learning Research (02/2026)
Emilien Dupont, Yee Whye Tch, and Arnaud Doucet. Generative models distributions of functions. In International Conference on Artificial Intelligence and Stalistics, pp. 2989-3015 PMT.R, 2022.
N. Engheta, W.D. Murphy, V. Rokhlin, el al. The fast. multipole method (fmm) for electromagnetic scattering problems. IEEE Transoctions on Antennas and Propagation, 40(6):634 641, 1992.
Atiyo Ghosh, Antonio A. Gentile, Mario Dagrada, et al. Harmonic neural networks. In Proceedings of the 40th International Conference on Machine Learning, Icml'23. JMLR.org. 2023.
L Greengard and V Rokhlin. A fast algorithm for particle simulations. Journal of Computational Physics, 73(2):325 348, 1987.
Leslic Greengard and Vladimir Rokhlin. A new version of the fast multipole method for the laplace equation in three dimensions. Acla numerica, 6:229 269, 1997.
Leslie Greengard, Jinglang Huang, Vladimir Rokhlin, and Stephen Wandzura. Accelerating fast multipole methods for the helmholtz equation at low frequencies. IEEE Computational Science and Engineering. 5 (3):32-36 2002.
D.J. Griffiths. Introduction to Electrodynamics. Pearson, 2013.
David Ha, Andrew M. Dai, and Quoe V. Le. Hypernetworks. Tn International Conference on Learning Representations, 2017.
Johannes Hendriks, Carl Jidling, Adrian Wills, and Thomas Schön. Linearly constrained neural networks. arXiv preprint ar Xiv:2000 01600, 2020.
J. D. Jackson. Classical Electrodynamics, 3rd ed. Hoboken, NJ, USA: Wiley, 1999.
Berian James, Stefan Pollok, Jes Frellsen, and Rasmus Bjørk. The magnetic scalar potential and demagne- tization vector for a prism. arXiv preprint arXiv:2501.18604 2025.
I. Joseph and E. Schlömann. Demagnetizing Field Nonellipsoidal Bodies. Journal of Applied Physics, 36(5):1579-15)) 1593, 1964.
George Em Karniadakis, Toannis G. Kevrekidis, Lu Lu, et al. Physies-informed machine learning. Nature Reviews Physics, 3(6):222 440, 2021.
Patrick Kidger and Cristian Garcia. Equinox: neural networks in JAX via callable PyTrees and filtered transformations. Differentiable Programming workshop at Neural Information Processing Systems 2021, 2021.
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412. 12.66988, 2014.
Jean Kossaifi, Nikola Kovachki, Zongyi Li, David Pitt, Miguel Liu-Schiafinni, Robert Joseph George, Boris Bonev, Kamyar Azizzadenesheli, Julius Berner, Valentin Duruisseaux, and Anima Anandkumar. library for learning neural operators. ar preprint 1...:2212.10388 2026.
Nikola Kovachki, Zongyi Li, Burigede Liu, Kamyar Azizzadeneshelli Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Neural operator: Learning maps between function spaces with applications to pdes. Journal of Machine Learning Research, 24(89):1-9 97, 2023.
Batuhan Koyuncu, Pablo Sanchez Martin, Ignacio Peis, Pablo M Olmos, and Isabel Valera. Variational mixture of hypergenerators for learning distributions over functions. In International Conference Machine Learning, pp. 17660-17683. PMLR, 2023.
Zongyi Li, Nikola Borislavov Kovachki, Kamyar Azizzadencsheii, Burigode liu, Kaushik Bhattacharya, An- drew Stuart, and Anima Anandkumar. Fourier neural operator for parametric partial differential equations. Tn International Conference on Learning Representations, 2021.
17

---

Published in Transactions on Machine Learning Research (02/2026)
Ting-Ou Ou Liang, Yan Hao Koh, Tie Qiu, et al. Magtetris: A simulator for fast magnetic field and force calculation for permanent magnet array designs. Journal of Magnelic Resonance, 352:107463, 2023.
Iya Loshchilov and Frank Hutter. Decoupled weight decay regularization. ar preprint arXiv:1711.000 2017.
Lu Lu, Pengzhan Jin, Guofei Pang, Zhongqiang Zhang, and George Em Karniadakis. Learning nonlinear operators via deeponet based on the universal approximation theorem of operators. Nature machine intelligence, 3(3):218-22) 229, 2021.
Tsendsuren Munkhdalai and Hong Yu. Meta networks. In International conference on machine learning, pp. 2554 2563. PMLR, 2017.
Eike Hermann Müller. Exact conservation laws for neural network integrators of dynamical systems. Journal of Compulational Physics, 488:1122; 2023.
K. Nielsen and R. Bjørk. The magnetic field from a homogeneously magnetized cylindrical tile. Journal of Magnetism and Magnetic Materials, 507:166799, 2020.
Kaspar Kirstein Nielsen, Andrea Roberto Insinga, and Rasmus Bjørk. The Stray and Demagnetizing Field of Homogencously Magnetized Tetrahedron. IEEE Magnetics Letters, 10:1-5, 2019.
Michael Ortner and Lucas Gabriel Coliado Bandeira. Magpylib: A free python package for magnetic field computation. SoftwareX, 2020.
Keunhong Park, Utkarsh Sinha, Peter Hedman, Jonathan T Barron, Sofien Bouaziz, Dan Goldman, Ricardo Martin-Brualla, and Steven M Seitz. Hypernerf: higher-dinennional representation for topolog- ically varying neural radiance fields. ACM Transactions Graphics (TOG), 40(6):1-12, 2021.
Ignacio Peis, Batuhan Koyuncu, Isabel Valera, and Jes Frellsen. Hyper-transforming latent diffusion models. In International Conference on Machine Learning, 2025.
Tobias Pfaff, Meire Fortunato, Alvaro Sanchez- Sanchez-Gonzaler Gonzalez, and Peter Battaglia. Learning mesh-bass based simula- tion with graph networks. In International conference on learning representations, 2020.
Stefan Pollok, Nataniel Olden-Jorgensen, Peter Stanley Jørgensen, et al. Magnetic Field Prediction Using Generative Adversarial Networks. Journal of Magnetism and Magnetic Materials, 571:170556, 2023.
Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In J. Platt, D. Koller, Y. Singer, and S. Roweis (eds.), Advances in Neural Information Processing Systems, volume 20. Curran Associates, Inc., 2007.
M. Raissi, P. Perdikaris, and G. E. Karniadakis. Physics-informed neural networks: A deep learning frame- work for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378:686-707, 2019.
Jack Richter-Powell Yaron Lipman, and Ricky TQ Chen. Neural conservation laws: A divergence-free perspective. Advances in Neural Information Processing Systems, 35:38075-38088 2022.
Scbastian Schaffer, Thomas Schrefl, Harald Oczelt, et al. Physics-informed machine learning and stray field computation with application to micronagnetic energy mininization. Journal of Magnelism and Magnelic Materials, 576:170761, 2023.
Vincent Sitzmann, Julien Martel, Alexander Bergman, David Lindell, and Gordon Wetzstein. Implicit neural representations with periodic activation functions. Advances in neural information processing systems, 33: 7462 7473, 2020.
Florian Slanove, Michael Ortner, Mohssen Moridi, Claas Abert, and Dieter Sucss. Full analytical solution for the magnetic field of uniformly magnetized cylinder tiles. Journal of Magnetism and Magnetic Materials, 559:169482, 2022.
18

---

Published in Transactions on Machine Learning Research (02/2026)
A. Smith, K. K. Nielsen, D. V. Christensen, al. The demagnetizing field of nonuniform rectangular prism. Journal of Applied Physics, 107(10):103910, 2010a.
Anders Smith, Kaspar Kirstein Nielsen, DV Christensen, Christian Robert Haffenden Bahl, Rasmus Bjørk, and J Hattel. The demagnetizing field of nonuniform rectangular prism. Journal of Applied Physics, 107 (10), 2010b.
Zhong Yi Wan, Leonardo Zepeda-Nunez, Anudhyan Boral, and Fei Sha. Evolve smoothly, fit consistently: Learning smooth latent dynamics for advection-dominated systems. In The Eleventh International Con- ference on Learning Representations, 2023.
Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, et al. Deep sets. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017.
A Broader Impact Statement
Magnets are a critical energy and infrastructure technology because they convert between motion and elec- tricity. The goal is to create permanent magnets that are as strong and as stable as possible: the stronger the field, the more efficient the conversion of energy; the more stable the magnet, the more versatile its appli- cations across a range of temperatures and environments, Despite a sound analytical basis for atomic-scale physics, it is not possible to derive the magnetic properties of new materials or solve an inverse problem to design material with desired field. Our rosearch could be used to provide much more rapid exploration of magnetic material and configuration possibilities, accelerating the development of these much-needed energy technologies.
The scaling improvements from our architocture enable compute savings for numerical work with data that satisly the general physical principle of superposition. We hope that our research will enable highly accurate modelling with vastly less energy expenditure inference time. Additionally, our research supports the goal of explainable inference for physical systems by pursuing amortising models grounded in physical theory. This should be seen desirable contingency against purely empirical model, which may exhibit hidden performance biases resulting in poor unpredictable performance for physical systems.
Nevertheless, there are risks from unintentional inaccuracy or imprecision in model output: at a mini- mum, the resource and opportunity cost of pursuing experimental and manufacturing effort in materials and configurations that cannot exhibit the performance the model claims. More seriously, successful model performance accelerating the development of energy technologies can lead to negative societal outcomes if those new technologies are not used responsibly with appropriate safeguards. Certainly, this has been the case for energy technologies in the past, and in general, social and regulatory structures have emerged that can mitigate against such disasters.
B Theoretical Foundations and Extensions
B.1 Details of Analytical Field Computation
For spherically-syymeetric sources, the dipole field at r from a collection of point-like sources of radii dm with magnetic moments m., 1 Mn, at positions r'm is computed via the scalar potential [Jackson
1999 p. 196)
Surface of 3D ball dipole term
(r r
Mm (r r'm)
(r M. =
or
(15)
4m r'
r'ml
m=1
scalar potential o(r, (...
corresponding to outside and inside the source, respectively. The distinguishing feature of the dipole term is the 1/r dependence; higher multipole terms (1/r2, 1/r2) will be present for specific shapes of sources, but
19

---

Published in Transactions on Machine Learning Research (02/2026)
FOURIER
FC+ILR (Sec.
FC+ILR (Sec.
FC+INR
Width of
4x32x32
400
400
20
Depth of vb
3
3
3
Width of g
0.25
1.5
2
1.0
Depth of g
3
3
2
Total Parameters
6.3M
1.5M
2.1M
1.7M
Optimiser
Adam
Average Learning Rate
5E
1E-4
7.5E
1E 5
7H
0.25
1
Steps (thousands)
20
25
20
20
GPUs
NVIDIA A100-SXM4-40GB (o)
Time (hours)
12
6
40
Table 4: Collation of model parameters used for the experiments in Sec. and Sec. 6 with the architecture developed in this work. If not specified otherwise, the same value is used for all experiments. A single entry in a row means the same value for all models. The Gaussian error linear unit (GELU) used as the activation function all fully-connected neural networks. The weights the linear layers are randomly initialised from uniform distribution over the interval [ |-1/ 11//ffnn in, 1/yfan input fras (*) The (hidden layer) width of the hypernetwork g is expressed size, which is the total number of learned parameters in the inference network vb. (o) For experiments in Sec. G we have instead used NVIDIA GeForce RTX 5090-32GB as the GPU.
where 'ann in descríbes the number of
multiple of its output
the dipole term will dominate at larger roquired near the source.
Bjørk & d' d'Aquino 2023). although higher multipole terms are
B.2 On the principle of superposition
The principle of superposition implies that the field generated by a collection of sources can be obtained by summing the individual contributions each source. In our architecture, this property is realised through a latent representation that additive across sources. Specifically, each source embedding produced by the hypernetwork g contributes lincarly to the field representation f, such that the aggregation of emboddings corresponds to the aggregation of fields.
Set Set(H, V
H, V')
H.()
H,
VmEM
(M, V') Set SeM((MMa Vin))
U(Mm: Vin
U
Figure 7: Commutative diagram for the construction of the field around a source collection via a fixed-length vector encoding. H, describes here the evaluation of the magnetic field at point r.
This structure is naturally expressed using the commutative diagram of Fig. 7 where the field produced by aggregating source embeddings is equivalent to aggregating the fields of individual sources.
20

---

Published in Transactions on Machine Learning Research (02/2026)
C Experimental and Implementation Details
C.1 Hyperparameters
We have implemented our models using JAX 0.4.25 (Bradbury et al., 2024 and Equinox (Kidger Garcia 2021), with training performed the EuroHPC Karolina GPU cluster. Table 4 collates the model parameters used for the experiments in Sec. and Sec. P
The output size of hypernetwork is the number of parameters consumed by the main (inference) network, and this varies across the models as follows:
The FOURIER model is parameterised by the order of the expansion, and in two dimensions its inference 'network' requires 4L2 parameters:
In the FC+ILR model, only the final layer of size I of the inference network is set by the hypernet- work, so the total number of learnable parameters is the remaining layers of the inference network plus the hypernetwork size;
In the FC+INR model, the total learnable parameters are those of the hypernetwork, which will quickly have a large output size as the inference network grows. However, because this model does not have the properly of linear additivity that allows inference to generalise to multi-source examples, we have not tried train large network of this kind.
Consequently, we have found it easiest express the hypernetwork width in units of its output size. The total number of parameters across both networks is then listed separately.
C.2 Tuning tactics for the FOURIER model
To coax strong performance from the FOURIER architecture, we use the following tactics, which run contrary to intuitions about Fourier series for sampled data:
Selection of modes. Our intuition for reconstructing signal from sampled data would follow the con- straints on wavelengths for the FFT-the shortest mode is set by the Nyquist sampling frequency, and the longest mode is set by the domain window size. In fact, the domain size irrelevant here because the underlying function is not periodic, and the modes should be significantly longer. In prac- tice, we let the upper and lower bounds for the modes be free parameters, and use a logarithmically- spaced sequence (of length the order of the expansion). affixing the zero-frequency mode to auto- matically include the Fourier bias terms.
Irregularity data sampling. The periodic Fourier modes mean that training on regular grid encour- ages overfitting: the reconstruction oscillates wildly even a short distance from the node points. Good practice would in any event suggest that training with data that are irregularly sampled over the domain would be more reliable, and this is the case.
Joint fitting of potential and field. Given the practical interest in the field resulting from the model output, we find improved performance using a loss with term for the target potential and an equglty- term fit to the target field, evaluated via the gradient of the potential.
C.3 Influence of the training objective
We encountered difficulties learning the large dynamic range the 2D potential in Sec. 6 which arises primarily from variations source size. Additionally, the 1/||r|] scaling for 2D potentials complicates learning for our method. To guide practitioners, we have collected our approaches cope with this challenge in the following:
21

---

Published in Transactions on Machine Learning Research (02/2026)
Modelling the log-potential. It is tempting to train on the logarithm the 2D potential. However, the polential is defined in R, we then need to differentiate between positive and negative values. Further, as our method relies on the superposition principle in the outputted scalar potential, any non- linear output normalisation scheme is prohibited. This also holds for other specialised normalisation schemes.
Learning correction to dipolar field. As we can fairly quickly (see blue dotted line Fig. 5a) derive the 2D potential from point-like dipole, we tried to learn only the corrections to it for the prism-shaped sources in Sec. 0 to climinate the 1/||r|| scaling of the far-field potential. However, preliminary experiments did not show any improvement in our metrics.
Overpopulating data with large error. We skewed our training data to comprise more data with small- sized magnetic sources, It had no major effect on the performance of our method.
Larger strength of the magnetisation. While comparing the different models with 2D disks of fixed radius in Sec. 5.2 magnetisation components M, and My were drawn from scaled normal distri- bution with scaling factor 1//T. As magnetic fields and scalar potential are relative quantities, it is possible to multiply the magnetisations by constant and remove it afterwards by dividing model predictions by the same factor. To partly compensate for the smaller-sized magnets introduced in Sec. 5 we increase the scaling factor to c = 10, which leads to an improved performance of the trained model. This points towards the fact that our method for the currently chosen hyperparameters has a preferred field range.
High error rates from small sources in FC+ILR
The source size has a substantial influence on the metric e used in our experiments in Sec. 0 To analyse the root cause of this, we plot c against the prism-shaped source side longths $z Sy in Fig. Sh. The data points correspond to the median relative error of 10 2D potentials generated by single prism-shaped source configurations (M 1) with varying side lengths (s Sy [0.12, in [-1.2, 1.2] x- 1.2] domain. Each validation sample is evaluated at 32 randomly sampled potential points across the domain. It can be clearly seen that when < 0.2, then Es > 10%, while we obtain consistently low relative error for larger source sizes. To further investigate where this behaviour originates, we plot the relative error for single evaluation points Eo,, from single-source configurations (M = 1) grouped by distance to the source centre normalised by the side length s of the source in Fig. Dp. Across the whole range of the normalised distance, the relative error 6q. of sources with 8 < 0.2 is almost an order of magnitude larger compared to the error of sources with 8, > 0.4.
When we look at four random samples with side lengths s < 0.2 from this dataset in Fig, 9 we spot two mechanisms responsible for large error rates: i) For small sources lying at the edge or corner of the sampling domain, the normalised distance to their source centre bocomes large and the dynamic range becomes considerably larger than in other samples in the dataset, which is apparently difficult for the neural network to learn, and ii) the relative errors become generally large in the axis perpendicular to the magnetisation, where the potential approaches values close to 0. The latter effect is also apparent for samples with larger source sizes, but far less pronounced.
E Comparison with Fourier neural operator
In machine learning, the current state-of-the-art for approximating the solution of family of parametric PDEs is neural operator learning (Kovachki et al. 2023). which maps function of the PDE parameters at the imput to the solution function at the output. An efficient and scalable variant of this approach, with strong empirical performance, is the Fourier neural operator (FNO) framework (Li et al. 2021), which we compare to our experiments in Sec. 0 in the following. In contrast to MagTense (Bjork et al. 2021), FMM [Greengard & Rokhlin 1987), and our method, where the input function fully defined by source features (M, V'), FNO requires spatial map of the magnctisation to learn a truncated Fourier representation of global convolution kernel. To make FNO efficient, the input and output maps further have to be discretised
22

---

Published in Transactions on Machine Learning Research (02/2026)
0.15
0.25
0.35
0.45
b
a
Relative error aстоss it single-souree sample E
Point error Eg.
Side length 6z
Small
Large
35
30
100
25
10
Relotive error C.
20
Relative
15
10
All Small Lorge
0.2
Side length 8g (-)
Normslised distance from source center (-)
Figure 8: (a) Relative error co as function of prism-shappa source side lengths. The 2D potentials generated by these configurations (M = 1) are the same data as used in Fig. 5... (b) Relative error for single evaluation points co., from single-source configurations (M = 1) grouped by distance to the source centre normalised by the side length 89 of the source. The overall performance of FC+ILR depicted in purple. The dotted lines show the grouped median relative error for small, i.e. 8₂ 0.2, and large, i. @ Sy 0.4, source sizes in black and yellow, respectively.
uniform, fixed grid so that FFT can be applied. As depicted in Fig, 10 the five-dimensional source features to a 2D spatial map of the magnetisation is straightforward. However, this representation faces challenges in preciscly capturing the geometry of the magnetic source and high resolutions at the input are required.
preprocessing step to represent
We use the FNO implementation from NeuralOperator (Kossaifi et al. 2026), where we adjust the size of the FNO model have 1.2 million total parameters, which is in the order of trainable parameters available for our method (see Table 4 This is achieved by setting the number of modes to keep in the Fourier layer to 16 in each dimension, the number of Fourier layers to 4, and the number of channels to 32. The default parameters are used otherwise. Following one of the examples in the documentation of NeuralOperator, we train FNO with a stepwise learning rate scheduler using AdamW (Loshchilov & Hutter 2017) for 30 epochs per step at learning rates 5 x (3,53,,,,,) As the loss function, we use the mean squared crror between predicted and ground-truth scalar potential values.
The dataset with 2 10t samples is taken from Sec. 6 However, we need adjust the input and output data, which need to be 2D spatial maps of equidistant sample points, to enable FFT. Therefore, represent the source features (M, V') magnetic scalar potential & is then evaluated at regular grid of resolution 32 x 32. As the input resolution can be scaled with respect to the output resolution, we train two versions of FNO, namely FNO and FNO128, where we choose the magnetisation map to be represented as a regular grid of resolution 32 x 32 and 128 x 128, respectively. For FNO we have to change the resolution scaling factor from [1, 1, 1, 10.5, 0.5, 1, 1] inside the FNO framework match the resolution of the potential the output. By doing this, we want to investigate how much FNO depends on the input function resolution to capture the exact shape of the source geometry.
regular grid for each magnetisation component,
shown in Fig. 10 The
The performance of FNO compared to FMM and FC+ILR on selected sccnarios is presented in Table 5 It can be seen that both FNO models perform slightly worse than the other two methods on the single-source test samples (M = 1), and that FNO outperforms FNOs2 here. For multi-source samples (M > 1), FNO shows much higher errors compared the other methods, which not surprising, as the FNO models have only seen single-source samples during training and have no inherent mechanism allow for zero-shot multi-source predictions.
23

---

Published in Transactions on Machine Learning Research (02/2026)
Overlapping sources
Sec. 6.1
Quadtree / Sec. 6.2
Metric
Model
M 1
M 10
M 50
co (%)
FNO
9.53 (# 6.99)
46.7 (#: 21.4)
66.5 (+ 14.1)
FNO 128
4.44 (# 2.26)
45.5 (# 10.4)
63.8 (# 20.3)
FMM
1.14 (= 0.28)
2.21 (# 0.78)
2.69 (# 0.47)
FC+ILR
2.21 (# 1.48)
2.43 (# 0.54)
5.70 (# 1.14)
MAEs (x10-3)
FNO
6.25
(# 9.99)
82.3 (#: 67.6)
165 (# 128)
FNO 128
4.08
(+ 7.84)
88.9 (+ 85.0)
159 (+ 131
FMM
2.89
(# 9.19)
6.62 (# 11.1)
9.96 (# 16.3)
FC+ILR
2.86 (= 5.93)
5.76 (= 7.48)
17.28 (# 21.3)
Table 5: Mean and standard deviation of the relative error Es and the mean absolute error (MAEs N max En=1 I0n Φn1) across 10 different test samples for selected scenarios of prism-shaped sources inside one sample. Omax is the absolute maximum value of the potentials in the respective experiment. The best performing method is marked in bold. The experiment with M 1 refers the single-source configurations used in Fig. 5p.
we have depicted a sample with M = 10 overlapping sources from the experiment described in Sec. 6.1 and & quadtree structure with M = 50 from Sec. 6.2 along with the predictions from FNO
In Fig.
1
24

---

Published in Transactions on Machine Learning Research (02/2026)
a
Target
FC+ILR
b
Target
FC+ILR
-0.5
0..5
-21
27 (+)
25
22 (c)
25
E
14.27%
C 8.41%
8 20
8y
0.12
(-)
8 x.
8 y
0.12
(
10
10
Target
FC+ILR
d
Target
TC++LL
y (-)
0.0
0.0
-0.5
-0.5
-1
(-)
25
6
6.64%
20
E 5.58%
20
y
16
y
16
2 8y 0.14
e
8 z.
8 y
0.15
(
Target
FC+ILR
f
Target
FC+ILR
(-)
0.0
0.0
-0.5
40.5
10
E 0.84%
E 1.39%
y
y
8 8, 0.44
8 S 0.48
(
Figure 9: (a-d) Four samples of single prism-shaped souree configurations (M 1) with side lengths 82 < 0.2. (e-f) Two samples of single prism-shaped sources with a side length of 8, > 0.4. Along with the target and source configuration, the prediction from FC+ILR, the respective spatially- relative error Cs presented on a regular grid with 322 evaluation points. The spatial extensions are normalised and hence dimensionless.
25

---

Published in Transactions on Machine Learning Research (02/2026)
32X32
128 X 128
1.0
0.5
0.5
M (norm))
0.0
(-)
-0.5
-0.5
1.0
1.0
0.5
0.5
(mzon)
0.0
0.0
(-)
M
-0.5
-1
1.0
0.5
0.0
0.5
1.0
1.0
0.5
0.0
0.5
1.0
x (-)
@ (-)
Figure 10: The input map of a single-source source sample of the experiments in Sec. with five-dimensional input vector (M(nrrm) MM (norm) r'mas Pmys Smz) ) = (0.50, -0887, 0.33, 0.64, 0.36) is preprocessod to the 2D spatial input map of the isgnetisation required for FNO. On the left-hand side, we present low-resolution map, i.e. 32 x 32 equidistant points, and high-resolution map, i.e. 128 128, for the r- and y- component of the normalised magnetisation M(norm) = Mr | || [ done for visualisation purposes only, while
the maximum magnetisation strength
in the respective experiment. Note that this normalisation unnormalised magnetisation values are required for training. For the task of approximating the corresponding magnetic scalar potential at the output, it is essential to know precisely where the magnetic source is located, which becomes less prominent for lower resolutions.
26

---

Published in Transactions on Machine Learning Research (02/2026)
Input (64x64)
Target (16x 16)
FNO (16x16)
a
0.5
-0.5
M (-)
0.5
1.0
y
0.5
0.0
y
-03
-0.5
-12-
M (-)
2 (-)
250
Mean: 243%
200
Median: 39%
20
150
COURt
(-)
10
100
50
100
200
300
-10
Eg (%) FNO
1.0
2 (-)
Ø (-)
b
Input (128 x 128)
Target (32x
FNO (32x32)
0.5
0.0
-0.5
(-)
0.5
y
0.0
-05
-0.5
-1
x (-)
250
M
100
Mean: 327% Median: 46%
200
80
count (-)
150
(%)
60
40
(-)
100
20
0.5
-05
0
100
200
300
-1.0
E (%) FNO
2 (-)
Figure 11: Scalar potential prediction from FNO (28 in zero-shot multi-source experiments. (a) Normalised scalar potential of 10 overlapping sources. As FNO128 downsamples the resolution from the input to the output by a factor of 4, we can also infer a 16 x 16 scalar potential from two 64 x 64 magnetisation maps. (b) Normalised scalar potential of a quadtree structure with 50 sources. The 2D spatial maps of the two components of the magnetisation are shown on the left-hand side. The two remaining plots on top depict the ground-truth potential o (Target), where the outline of the prism-shaped sources along with their mag- netisations M are marked in red, next to the prediction & of FNO At the bottom, a histogram of the relative error of âeno is shown along with es spatially resolved for òeno.
27


Reviews:
[{"review_id": "amwJ3o0RXl", "reviewer": "Reviewer_6Gx1", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "No", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "This manuscript introduces a hypernetwork-based generative model for source-to-field inference in physical system such as magnetostatics and gravitation. It amortizes the evaluation of classical fields form complex source geometries and achieves O(M+N) scaling rather than traditional O(M*N). The paper propose two main model variants: Fourier hypernetworks and FC+ILR, and benchmark them against classical and machine learning baselines. The proposed method claims to maintain the principle of superposition and provide continuous field approximations across arbitrary source configurations.", "claims_and_evidence_yn": "No", "claims_explanation": "Supported Claims：\nClaim 1: The model achieves O(M + N) scaling. Training cost and model size increase with Fourier mode count or network width, which is not fully addressed.\nClaim 2: The model respects the superposition principle. Additive architecture explicitly aggregates source contributions.\n\nWeakly or Unsubstantiated Claims：\nClaim 3: The model generalizes to arbitrary source geometries and configurations. But the training is limited to simple 2D shapes. There are no experiments in 3D.\nClaim 4: Accuracy is competitive with Fast Multipole Methods (FMM). FC+ILR outperforms FMM near source centers (Fig. 5b) but underperforms in quadtree structures (Table 3).", "audience_yn": "Yes", "audience_explanation": "The proposed use of hypernetworks to achieve O(M + N) inference for physical fields is novel and practically relevant for surrogate modeling. The idea of treating fields as continuous generative functions are of interest to a broad segment of the TMLR audience.", "requested_changes": "Major concern\n\n1.\tAll experiments are restricted to 2D fields and simplified source geometries. Despite author claims that 3D extension is straightforward, this no cases to support it. It would be better to show at least one 3D case to make the method more practical.\n2.\tThere is no online code to verify.\n3.\tPlease address the limitation of the generalization across source scales which is shown in Table 3.\n4.\tThe model is trained on paired analytical expression. While there are models that are lack of analytic solutions in physics. I recommend test model on data where only noise, partial, or simulated data are available.\n5.\tThe formulas for f in Figure 1 include Eq(10) and Eq(11), there the expression in Figure 1 should be more generalized. Also the dimensions of tensor in Figure 1 should be more clear. Please use same symbols for the same quantities. And explain clearly which variable is a special form of which variable, such as Eq(10) and Eq(11).\n6.\tIt is not clear how the networks are trained for all cases. Please clarify this for each cases, including the evaluation points for training and validation, number of pairs for training and validation, how to generate these pairs (for exact solution please show the ground truth). \n7.\tIs the same evaluation points used in training and validation? To verify the successful learning model need to use different evaluation points in training and validation.\n8.\tThere is no visualizations of residuals, spatial error maps, or confidence intervals. Present worst-case examples and qualitative degradation in high-error regions.\n9.\tHave you ever tried non-uniform evaluation points, please try some to verify the successful training of continuous model or explain the reason why fails.\n10.\tWhen explain the computation expense, please also consider the computation of networks.\n11.\tHave you ever tried low resolution in training and high resolution in validation? This is a normal test for claimed continuous model learning.\n\nMinor concern\n\n1.\tSection 3, Line3: “impute” -> “compute” \n2.\tEq (5)(10)(13) are described too informally. Include full derivations in appendix.\n3.\tFigure 1 is central to understanding but contains cramped notation. Consider separating components (ψ, g, f) into distinct blocks with clearer labeling.\n4.\tSection 5.1: What is the g as you said “we train f while keeping g fixed”\n5.\tExplain the initialization of the networks when training.", "broader_impact_concerns": "No.", "additional_comments": "", "extra_scores": {}, "extra_text": {}}, {"review_id": "MzbafikpHY", "reviewer": "Reviewer_oYMD", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "Yes", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "The authors present a generative model designed to infer physical fields, specifically magnetic scalar potentials, from collections of physical sources. The core contribution is an architecture that enforces the physical principle of superposition through a hypernetwork design. A hypernetwork takes source features such as geometry and magnetization and outputs weights for a target network, which may be either a Fourier basis or a fully connected network. The weights from multiple sources are summed before the target network evaluates the field, allowing the model to scale linearly as O(M+N) in the number of sources and evaluation points. This effectively amortizes the cost of computing interaction matrices. The authors model the scalar potential φ and derive the magnetic field H via automatic differentiation to ensure the field is conservative. The method is compared against the Fast Multipole Method, and the authors demonstrate that their FC+ILR model generalizes to arbitrary numbers of sources despite being trained on single-source data.", "claims_and_evidence_yn": "Yes", "claims_explanation": "The authors provide clear empirical evidence for their scaling claims and generalization capabilities. Figures 3b and 4 demonstrate that the model, trained on single sources, successfully predicts fields for multiple sources, validating the central claim that summing hypernetwork weights preserves physical superposition. Figure 5a provides runtime comparisons confirming the O(M+N) behavior compared to the classical O(M×N) scaling of direct summation, showing competitive crossover points with FMM. The authors are transparent about the method’s accuracy limitations, explicitly analyzing high error rates exceeding 10% for small sources in Section 6.2 and Appendix D, attributing this to dynamic range issues.", "audience_yn": "Yes", "audience_explanation": "The specific technique of using hypernetworks to output linear layer weights that enforce an additive inductive bias is a generalizable architectural pattern that could be relevant to researchers working on other linear physical systems such as acoustics and electrostatics.", "requested_changes": "I recommend several changes to strengthen the submission, none of which are strictly critical for correctness but would significantly improve the context and quality of the paper. I don’t think any change is strictly necessary.\n\n1) I strongly recommend a comparison to neural operators. The paper compares the proposed method primarily to FMM, a classical numerical method. I recommend adding other deep learning approaches for solving PDEs and fields, such as DeepONet and Fourier Neural Operators. These architectures also aim to learn resolution-invariant operators. The authors should discuss how their hypernetwork plus summation approach differs from these methods. If feasible, a small empirical comparison on the single-source task would be valuable; if not, a qualitative comparison in the Related Work section is necessary to contextualize the contribution within modern machine learning.\n\n2) the paper notes that the model struggles with small sources due to the large dynamic range of the potential. The authors should discuss whether they considered training on the log-potential or using a specialized normalization scheme to compress this dynamic range. A brief explanation of why this approach was not pursued, or whether it was tried and failed, would be helpful for practitioners facing similar multiscale issues.\n\n3) Ezperiments are conducted in 2D, and while the mathematics generalizes to 3D, the computational cost of the grid grows cubically. The authors should expand the discussion in the Limitations section regarding the memory bottleneck of the proposed FC+ILR method in 3D, addressing whether the hypernetwork size would need to grow significantly to capture 3D geometries such as tetrahedra or meshes.\n\n4) In Eq. 5, the notation for the summation inside the function f should be verified and made explicit, showing clearly that the parameters of f are the sum of the outputs of g.", "broader_impact_concerns": "I don’t have any concerns.", "additional_comments": "", "extra_scores": {}, "extra_text": {}}, {"review_id": "U2IoLt398A", "reviewer": "Reviewer_2oVn", "summary": "", "questions": "", "limitations": "", "rating": null, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "No", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "paper_topic_and_main_contributions": "", "excitement": null, "reproducibility": null, "ethical_concerns": "", "main_review": "", "summary_of_the_paper": "", "summary_of_the_review": "", "strength_and_weaknesses": "", "limitations_and_societal_impact": "", "review_text": "", "summary_of_contributions": "The authors propose a data-driven, machine-learning approach to approximating physical fields induced by the presence of one of more sources. While the primary focus is on magnetic fields, the approach is likely to generalize to other settings. The primary benefit of the method is in its scaling properties with respect to the number of sources, $M$, and evaluation points, $N$, compared to existing numerical algorithms. In general, experiments demonstrate that the method produces reasonably small error rates compared to existing approaches, including the Fast Multipole Method, while improving efficiency.\n\nStrengths:\n\n* The approach appears to perform fairly well in the settings considered and the authors investigate several methodological variations, which is informative.\n\n* The incorporation of the principle of superposition into the network design is both interesting and an important contribution. In addition to its modeling advantages, it allows for elements such as hypernetwork inference parallelization.\n\n* The theoretical ability to model various kind of source geometries and seamlessly accumulate disparate source impacts on the resulting field is important.\n\nWeaknesses:\n\n* In the paper, the claim that the method \"incorporate[s] relevant physical properties, such as enforcing divergence-free fields through novel Fourier hypernetworks.\" does not appear to be supported. It is possible that I am missing something, but I do not see why any of the proposed approaches guarantee satisfaction of Gauss's law for magnetism. The use of a potential does ensure satisfaction of the Ampère–Maxwell law for the static setting, but this is also never clearly discussed.\n\n* There are a number of areas where clarity could be improved. \n\n* Several interesting experiments are performed, but there are a few important areas that are under-explored that would better support the claims of the paper. Two pertinent examples include whether the network can generalise across source geometries without retraining, as claimed in the paper, and the impact that items such as network size, basis dimension, and training steps, among others have on performance.\n\n* The choice of median relative error as the primary evaluation metric is a bit odd. Perhaps this is the standard measure for this field. However, having several error perspectives, including something as simple as total or average non-relative error would be helpful.", "claims_and_evidence_yn": "No", "claims_explanation": "To be more specific, I think the current experiments are a good start, but the clarity of the presentation needs to be improved and there are opportunities to strengthen the results to fully support the claims of the paper. See Requested Changes for more details.", "audience_yn": "Yes", "audience_explanation": "I think the approach proposed in this paper is both interesting and important. I am confident that this paper will be of interest to some TMLR readers. However, the presentation and experiments need work to better support the authors' claims.", "requested_changes": "1) There is no concrete discussion around how $\\mathbf{M}_m$ and $\\mathbf{V'}_m$ are represented as inputs to the hypernetwork $g$. This is also true for the spacial coordinates, $\\mathbf{r}_n$, as input to $f$. While $\\mathbf{M}_m$ and $\\mathbf{r}_n$ may be straightforward, they should still be discussed. However, specifying the source geometry is not trivial.\n\n2) This work exclusively considers static field representations, but this is not made explicit until Page 4, well after the derivation of several relevant equations.\n\n3) I am not an expert on Maxwell's equations. However, in the static setting I believe that a magnetic field needs to satisfy both Gauss's law for magnetism and the Ampère–Maxwell law. The latter, however, is never discussed concretely, nor is it considered in the method construction. This needs to be more clearly presented.\n\n4) It's possible I have missed it, but I don't see where we get divergence-free fields from the constructions suggested in this work, Fourier or otherwise.\n\n5) Based on the presentation (for example in Equation 1), it appears some non-dimensionalization has been applied such that the permeability of free space is 1. If so, this should be mentioned in some capacity.\n\n6) The notation $\\vert \\cdot \\vert$ in Equation (1) and others is never defined for vectors. I think this is the Euclidean norm, but am not sure. This notation also potentially clashes with $\\Vert \\cdot \\Vert$ in Equation (12) if that notation is also the standard Euclidean norm. Both should clearly state what is meant by the notation and be unified if they represent the same thing.\n\n7) The notation $\\delta_{ij}$ is never defined.\n\n8) There is disonance between the form of the Fourier expansion of the scalar potential \"in $d$-dimensions\" in Equation (10) and that presented in (13). A better unification and discussion of these is important.\n\n9) At the end of Section 3.3, the discussion of $\\mathbf{k}_l$ is not very clear. For example, it mentions that \"integrally spaced wavenumbers makes the basis functions orthogonal\", which seems to suggest that the $\\mathbf{k}_l$ are integers, but this is not the case in a standard Fourier basis. Nor is it the case in the experiments (see Section 5.2.1). Appendix C.2 is also quite vauge in terms of what these values end up being in practice. It also states \"In practice, we let the upper and lower bounds for the modes be free parameters\" Does this mean they are learned during the training process or something else? \n\n10) Neural operators and their relationship to this work should be discussed, at least briefly, in the Related Work section.\n\n11) The errors presented in Equation (12) are useful. However, it is unclear whether these are the standard way to measure error for these problems. If so, a reference would be helpful. If not, some justification for why these formulations are used here should be given. Regardless, it would also be useful to present other views of error, such as total or average non-relative error.\n\n12) The training setup of Section 5.1 is not very clear. Is $g$ being randomly initialized and fixed while training $f$? Is the Fourier or FC+ILR approach being applied or is $f$ operating completely alone with no input from $g$. If the latter, why is $g$ ever mentioned? This should be more clear.\n\n13) In the second paragraph of Section 5.1, the statement \"This clearly demonstrates generalisation to arbitrary field locations—but not to arbitrary source collections.\" appears. However, this is only comparing training curves in Figure 3a. Do the authors mean to say that these are validation errors as training proceeds (i.e. validation curves)? If so, this needs to be clarified, as training curves typically represent training loss.\n\n14) In Section 5.2.3, the presentation of the setup for the \"Linear model\" is unclear. Is this simply the FC + ILR setup, but where the networks for $f$ and $g$ are restricted to linear transformations, as opposed to deep networks with non-linear activations? If so, this should be stated explicitly.\n\n15) For the prism-shaped source setup at the beginning of Section 6, if we're doing a 2D simulation, why is the height of the prism ($s_z$) relevant? If it has specific implications for the experiments, this should be stated, otherwise its inclusion is confusing.\n\n16) The notation of $N_{\\text{tile}}$ and $N_{\\text{tile}}^{(m)}$ are introduced without explanation on Page 11. This makes interpreting and understanding the results in this section difficult.\n\n17) The training setups for Overlapping Sources and Quadtrees are never described. That is, are the models trained only on single source setups, as in previous experiments? Are the remainder of training parameters also the same?\n\n18) In Section 6.2, in discussing the failures associated with $M=250$, the authors state that the model \"can not be evaluated for the scenarios with $M = 250$ as the side lengths of some prism-shaped sources $s_x,s_y < 0.1$, which is simply outside the range FC+ILR has been trained for.\" This leaves the question of whether the model could simply be trained on prisms in this size range to overcome this issue unresolved.\n\n19) In addition to the above, in Section 6.2, the authors state that \"the dynamic range of potential values for small prisms is simply too large for the model to learn them properly.\" This statement is not well supported by the experiments. That is, it may just be that the size of the prisms is outside of the training range rather than the model being unable to learn them at all. There are no experiments showing that the model couldn't learn to represent them. Would a larger model suffer the same fate, do you need finer Fourier modes, etc.?\n\n20) There are no experiments showing generalization across source geometries (cylinders to prisms, for example) without retraining. Nor are there any experiments showing that one can mix different kinds of source geometries during, for example, training.\n\n21) In Appendix C.2, the importance of training on irregularly sampled points is stated, but in the experiments, it appears that all training data was sampled on a uniform grid. If this is not the case it should be made clear. Otherwise, the statements of this appendix need to be amended.", "broader_impact_concerns": "I have no broader impact or ethical concerns with this work.", "additional_comments": "Clarifications and Minor Comments\n\n1) A bit of motivation for why the Huber loss is used over something like standard MSE would be useful.\n\n2) When using a Fourier representation for the electric potential, could you use derivatives of the Fourier representation to derive the field, rather than relying on numerical differentiation?\n\n3) There are typos \"supoerposition\", \"bracktes\", and \"because his model\" in the body and appendix.\n\n4) Table 1 appears quite far from it's first refence on Page 6.\n\n5) Other parameters, beyond learning rate, for the Adam optimizer are not specified anywhere.\n\n6) In Section 5.1, it is stated that an \"ensemble of fully-connected networks\" is trained. However, it is never concretely stated how the networks are ensembled. That is, are they summed, uniformly averaged, or something else?\n\n7) The activation functions for the dense networks are never stated anywhere.\n\n8) Equation 13 has extra white space after the $\\Sigma$s that should be fixed.\n\n9) It would be helpful to know how the plots for the field and potential are created. That is, what kind of interpolation (or other approach) is used between the evaluation points?\n\n10) Are the \"10 runs\" referred to in Section 6.1 ten separate training runs? It would be helpful to be specific.\n\n11) In Appendix B.1, the notation $\\mathbf{m}_m$ clashes with $\\phi(\\mathbf{r}, \\mathbf{M}_m, \\mathbf{V}'_m)$.\n\n12) Table 4 does not do a good job specifying what \"Width\" and \"Depth\" refer to. I think they are for $f$? Moreover, \"Hnet\" is not used anywhere in the body. Is this $g$?", "extra_scores": {}, "extra_text": {}}]

Author rebuttal:

Decision: Accept (poster)