Manuscript Offprint
arXiv:2610.11549-Equivariant Flow Matching on Anisotropic Power-Diagram Graphs for Microstructure Generation
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Acquiring realistic microstructure data through Electron Backscatter Diffraction (EBSD) is costly and time consuming, often relying on specialised equipment. As microstructures strongly influence material properties, generating realistic samples is essential for modelling the behaviour of polycrystalline materials. We introduce a generative model for synthesising realistic polycrystalline microstructures using flow matching and graph neural networks. By representing microstructures as anisotropic power diagrams, our model learns a compact geometric parametrisation and can render generated samples at arbitrary pixel resolution. A -equivariant architecture incorporates rotational symmetry directly into the model, ensuring that rotations of the input noise produce corresponding rotations of the generated microstructure. We also demonstrate how training-free guidance can be used to generate complex microstructures, based on user defined objective function. In particular, we generate microstructures resembling a copper weld, cast metal slab, 3D-printed stainless steel and heterogeneous lamella titanium.
1 Introduction
The properties of polycrystalline materials depend strongly on the geometry and spatial arrangement of their grains. Representative microstructures are therefore essential for modelling material behaviour and studying structure–property relationships. Although Electron Backscatter Diffraction (EBSD) [11] provides detailed experimental measurements, acquiring large and diverse datasets is costly and time-consuming. Synthetic microstructures are consequently widely used in computational materials science, with approaches ranging from tessellation-based methods to learned generative models [4, 2, 5, 12]. Learning directly from EBSD-derived images remains challenging because the available data are often limited, noisy, and too large to process as complete samples. Moreover, many existing approaches offer limited control over global characteristics of the synthesised samples, such as collective grain alignment or spatial patterns extending across the entire microstructure [2, 5].
Voronoi and power diagrams provide compact geometric representations of polycrystalline microstructures, but their ability to represent anisotropic grains and curved boundaries is limited [4]. Anisotropic power diagrams (APDs) augment ordinary power diagrams with grain-specific anisotropy, allowing directionally dependent grain geometries while retaining a compact parametric representation, while recent GPU-accelerated methods enable them to be fitted and generated efficiently [2]. Existing APD generation methods prescribe selected grain statistics but do not learn a generative distribution over complete grain configurations or directly model spatial dependencies [2]. Furthermore, control over global characteristics is typically limited to statistics specified a priori by the sampling procedure.
40th Conference on Neural Information Processing Systems (NeurIPS 2026). Workshop: Representations for the Physical Sciences.

Figure 1: Unguided (left) and guided (right) samples generated by our model from the same initial noise. Each panel shows the ellipse representation on the left and the corresponding APD tessellation on the right. Guidance encourages four horizontal bands with alternating grain orientations of and , resembling a microstructure pattern in 3D-printed stainless steel.
Our main contributions are:
-
We formulate polycrystalline microstructure generation as flow matching over the compact geometric parameters of an anisotropic power diagram. Each grain is represented by its position in and an ellipse-based parametrisation of its anisotropy; see Figure 1 for illustration. This resolution-independent representation supports variable grain counts and allows generated microstructures to be rendered at arbitrary pixel resolution.
-
We introduce a graph-based, -equivariant architecture that models dependencies between grains and ensures consistent generative behaviour under rotations by multiples of .
-
We introduce a training-free guidance framework for controlling generated microstructures through user-defined differentiable objectives. Without retraining, the framework can impose complex, spatially varying global structure, enabling the generation of diverse morphologies, including examples qualitatively inspired by copper welds, cast metal slabs, 3D-printed stainless steel and heterogeneous lamella titanium; see Figure 2. The code can be found at: https://github.com/DawidLipin/Flow_APDs
The regions form a tessellation of , which we refer to as an anisotropic power diagram (APD). See Figure 1 for an illustration. Intuitively, each triple determines one region of the tessellation. The seed specifies its location, while determines the associated anisotropic distance. In particular, the unit ball of is an ellipse centred at . The weight controls the relative influence of the seed and therefore affects the size of the resulting region.
We associate each region with a target area , where . An APD is optimal with respect to the target areas if for all , where denotes the area of region . For fixed seed positions , anisotropy matrices , and target areas , the weights can be obtained by solving an optimal transport problem [2] so that the regions satisfy the prescribed areas. This construction allows arbitrary target tessellations to be approximated by optimising the APD parameters such that the induced regions match the target regions.
Flow matching. Flow matching trains a continuous normalising flow to transport samples from a simple source distribution , typically Gaussian noise, to a target data distribution [6]. The transformation is defined by the ordinary differential equation
where is a vector field constructed using a neural network. For the linear conditional path with and the corresponding target velocity given by , this gives the simulation-free training objective
Samples are generated by numerically integrating the learned vector field from to . In our setting, contains the APD parameters of all grains and is parametrised by a graph neural network.
Training-free guidance. Following gradient-based guidance methods for diffusion and flow models [3, 14], we bias generation toward a differentiable objective by instead sampling
where controls the guidance strength. At time , we estimate the terminal state by and modify the velocity as
where is a time-dependent schedule. The model parameters remain fixed, enabling training-free control through arbitrary differentiable APD objectives.
3 Equivariant flow matching on APDs
Directly modelling EBSD images is computationally expensive, as individual samples may contain millions of pixels, while generating realistic microstructures requires preserving their underlying geometric structure. We address these challenges by representing microstructures compactly as APDs and using an equivariant graph architecture that enforces consistent behaviour under rotations.
Microstructure representation. We represent a microstructure with grains by , where is the seed position, its power weight, and parametrises its anisotropy. This compact APD representation is independent of raster resolution and regularises small pixel-level segmentation artefacts. Details of the reparametrisation are given in Appendix B.
Equivariant graph architecture. We represent each APD as a graph whose nodes are , and whose directed edges connect each source node to its nearest neighbours . The invariant edge features supplied to the message-passing network are
where and, for and , we define , , and encodes position relative to the square boundary while remaining -invariant. These features are processed by message-passing layers conditioned on the flow time , with aggregation ensuring permutation equivariance. The output head predicts -invariant scalar coefficients multiplying geometric bases that transform equivariantly under rotations; see Appendix C for details. Hence, for any rotation , we have , so rotating the initial state produces the correspondingly rotated generated APD.
4 Experiments
Experimental setup. We trained a model with three message-passing layers, a latent dimension of 256, and nearest neighbours. The training set contained 12,000 synthetic APDs with between 100 and 500 grains, generated using PyAPD [2]. The model was trained for 100 epochs, using the AdamW optimiser [7]. The code is available at: https://github.com/DawidLipin/Flow_APDs
Training-free guidance. Following the convention in Section 2, for each APD channel , we use

Figure 2: Each row shows training-free guidance of synthetic polycrystalline microstructures. The first four columns show independent samples generated by the same pretrained model, while the rightmost column presents representative experimental microstructures for qualitative comparison. The real examples are taken from (top to bottom): Buze et al. [2], Balit et al. [1], Reed-Hill [8], Savolainen et al. [10], Wu et al. [13]
where RMS stands for root mean square, ensures numerical stability, and independently controls the effect of objective on generator positions, anisotropies, and power weights. The gradients are obtained by backpropagating both through the objective and . Normalising each gradient separately prevents its numerical scale from determining its influence. We use a cosine ramp , with no guidance over the first 10% of the trajectory and recompute the neighbourhood graph as the generator positions evolve.
The four columns in Figure 2 are independent samples from the same pretrained model, using various guidance functions. Other objectives can also be used depending on the application. The 3D-printed example imposes elongated grains with alternating layer-wise directions; the cast slab combines spatially varying shape, relative grain weight, and generator-density targets for chill, columnar, and central zones; the weld objective prescribes a smoothly varying inward growth field; and the heterogeneous-lamella objective places a high-weight coarse population in wavy bands while the surrounding smaller grains remain approximately equiaxed. These objectives constrain only selected statistics, leaving the pretrained flow to determine the remaining local geometry. The guidance objectives from top to bottom are
where for compactness, we write , , sg for the stop-gradient, and CMSE and SMSE for the centred and sorted MSE respectively. For the cast objective, , , and prescribe the cast-slab shape, relative-weight, and generator-density profiles. For the heterogeneous-lamella objective, and are the coarse and fine populations, is the band-membership target, is a two-level relative-weight target, and aligns coarse grains with the local band tangent. Components of vector-valued objectives are differentiated and RMS-normalised separately. Their precise definitions and all guidance strengths are given in Appendix A. We selected the target parameters and guidance strengths manually to obtain qualitative agreement with the representative experimental microstructures. These values need not be optimal and, for a given application, may instead be specified using domain knowledge, tuned against an application-specific validation criterion, or estimated from real data.
5 Discussion
The model is currently trained only on synthetic APDs, so fidelity to higher-order experimental statistics remains unvalidated; strong or conflicting guidance may also leave the learned distribution. Future work will aim to evaluate and fine-tune the model on EBSD data, incorporate crystallographic orientation, and extend the representation to three-dimensional microstructures. Exploring alternative guidance objectives, particularly those based on physics-informed loss functions, is also a promising direction for future research.
References
[1] Yanis Balit, Eric Charkaluk, and Andrei Constantinescu. Digital image correlation for microstructural analysis of deformation pattern in additively manufactured 316L thin walls. Additive Manufacturing, 31:100862, January 2020. ISSN 22148604. doi: 10.1016/j.addma.2019.100862. URL https://linkinghub.elsevier.com/retrieve/pii/S2214860419305469.
[2] M. Buze, J. Feydy, S. M. Roper, K. Sedighiani, and D. P. Bourne. Anisotropic power diagrams for polycrystal modelling: Efficient generation of curved grains via optimal transport. Computational Materials Science, 245:113317, October 2024. ISSN 0927-0256. doi:10.1016/j.commatsci.2024.113317. URL https://www.sciencedirect.com/science/article/pii/S092702562400538X.
[3] Hyungjin Chung, Jeongsol Kim, Michael Thompson Mccann, Marc Louis Klasky, and Jong Chul Ye. Diffusion Posterior Sampling for General Noisy Inverse Problems. September 2022. URL https://openreview.net/forum?id=OnD9zGAGT0k.
[4] Karim Hitti. Direct numerical simulation of complex Representative Volume Elements (RVEs): Generation, Resolution and Homogenization. Doctoral thesis / PhD thesis, École Nationale Supérieure des Mines de Paris, 2011. NNT: 2011ENMP0054 HAL ID: pastel-00667428.
[5] Sterley Labady, Youssef Mesri, Daniel Pino Munoz, Baptiste Flipon, and Marc Bernacki. InfinityEBSD : Metrics-Guided Infinite-Size EBSD Map Generation With Diffusion Models, December 2025. URL http://arxiv.org/abs/2512.17859. arXiv:2512.17859 [condmat.mtrl-sci].
[6] Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu, Maximilian Nickel, and Matthew Le. Flow Matching for Generative Modeling. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=PqvMRDCJT9t.
[7] Ilya Loshchilov and Frank Hutter. Decoupled Weight Decay Regularization. September 2018. URL https://openreview.net/forum?id=Bkg6RiCqY7.
[8] Robert E. Reed-Hill. Physical Metallurgy Principles. D. Van Nostrand Company, New York, 2nd edition, 1973.
[9] Victor Garcia Satorras, Emiel Hoogeboom, and Max Welling. E(n) Equivariant Graph Neural Networks, February 2022. URL http://arxiv.org/abs/2102.09844. arXiv:2102.09844 [cs.LG].
[10] Kati Savolainen, Tapio Saukkonen, and Hannu Hänninen. Localization of Plastic Deformation in Copper Canisters for Spent Nuclear Fuel. World Journal of Nuclear Science and Technology, 2(1):16–22, December 2011. doi: 10.4236/wjnst.2012.21003. URL https://www.scirp.net/journal/paperinformation?paperid=16567.
[11] Adam J. Schwartz, Mukul Kumar, Brent L. Adams, and David P. Field, editors. Electron Backscatter Diffraction in Materials Science. Springer US, Boston, MA, 2009. ISBN 978-0-387-88135-5 978-0-387-88136-2. doi: 10.1007/978-0-387-88136-2. URL https://link.springer.com/10.1007/978-0-387-88136-2.
[12] Samwel Sekwao, Jason Iaconis, Claudio Girotto, Martin Roetteler, Minwoo Kang, Donghwi Kim, Seunghyo Noh, Woomin Kyoung, and Kyujin Shin. End-to-End Demonstration of Quantum Generative Adversarial Networks for Steel Microstructure Image Augmentation on a Trapped-Ion Quantum Computer. April 2025.
[13] Xiaolei Wu, Muxin Yang, Fuping Yuan, Guilin Wu, Yujie Wei, Xiaoxu Huang, and Yuntian Zhu. Heterogeneous lamella structure unites ultrafine-grain strength with coarse-grain ductility. Proceedings of the National Academy of Sciences, 112(47):14501–14505, November 2015. doi: 10.1073/pnas.1517193112. URL https://www.pnas.org/doi/abs/10.1073/pnas.1517193112.
[14] Haotian Ye, Haowei Lin, Jiaqi Han, Minkai Xu, Sheng Liu, Yitao Liang, Jianzhu Ma, James Zou, and Stefano Ermon. TFG: Unified Training-Free Guidance for Diffusion Models. November 2024. URL https://openreview.net/forum?id=N8YbGX98vc.
A Guidance objectives and sampling details
This section gives the complete objectives and sampling settings used to produce Figure 2. Experimental reference images are used only for qualitative comparison and do not enter any objective.
Coordinates and common notation. The flow operates in normalised coordinates. To distinguish model and physical coordinates, let denote a normalised generator position and let
be the corresponding position in the physical coordinate system. Data endpoints lie in , but this affine map is applied without clipping to intermediate terminal estimates, which can temporarily leave the domain. In the equations below, all spatial target fields use , whereas and denote the normalised anisotropy and weight channels. The physical log-anisotropy is , where is the scalar anisotropy scale measured on the training set. The normalised spin-2 encoding of a grain whose visible long axis has angle and axis ratio is
Thus and , as required for unoriented grain axes and equiaxed grains, respectively. Angles are in radians unless a degree symbol is shown.
We use
For a non-negative pairwise kernel , we also write
For scalar vectors , define
where , and denotes the ith order statistic. CMSE constrains relative APD weights without fixing their irrelevant additive gauge; SMSE also removes dependence on grain labels. For the two anisotropy components, the implementation uses the componentwise mean-squared error
The factor 1/2 simply averages over the two anisotropy components. Global positive rescalings of an individual objective have no effect after the gradient normalisation described below.
Endpoint guidance and numerical integration. At time t, the model gives the first-order terminal estimate
For objective and state channel , let
where is the number of scalar entries in channel c. Gradients pass through both the objective and in the terminal estimate. The guided velocity is
where denotes componentwise multiplication. A scalar is broadcast over a channel, while permits different horizontal and vertical position strengths. Each objective-channel pair is RMS-normalised separately before the corrections are summed. The scalar strength in Section 2 is therefore absorbed into the experimentally used . Table 1 provides the specific guidance strengths used.
The schedule has a 10% unguided warm-up followed by a cosine ramp,
All samples in the figure use generators, nearest neighbours, and Euler steps with and
Each normalised channel of the base state is sampled independently from a standard Gaussian. The four generated columns use random seeds 117, 237, 377, and 527, respectively; within a column, every row starts from the same base state. The k-nearest-neighbour graph is recomputed after every step as generator positions evolve. The updated state is detached before the next step, so the method differentiates through the current terminal estimate but not through the complete integration history. Neighbour selection is discrete: gradients pass through the network evaluated on the current edge set, but not through the choice of the k nearest neighbours. The unguided row uses an empty objective set, for which .
Layered 3D-printed structure. The smooth layer signal, target direction, and confidence are
where sg denotes stop-gradient. The signal alternates sign across six horizontal layers. The confidence removes the ambiguous orientation at layer interfaces, while detaching it prevents grains from reducing the loss merely by moving towards an interface. The objective is
Cast slab. Let and denote the ends of the chill and columnar regions. Smooth transitions between the chill, columnar, and core zones are constructed from
Writing
the normalised zone memberships are
The chill and core targets are equiaxed. In the columnar region the target is horizontal and its axis ratio increases from 2.2 to 9.2:
The relative-weight target is
Finally, the generator-density target assigns fractions , , and to the three zones. Let
and define the piecewise-uniform quantile function
With the sorted physical horizontal coordinates, the three independently guided cast objectives are
Because and depend on position, their objectives may guide both position and their corresponding APD channel.
Weld structure. The target vector field and its unoriented long-axis angle are
The field points obliquely inward from either side and becomes vertical at the centreline. Only its angle is needed by the objective:
Although makes the construction intuitive, it is used mathematically through .
| Objective | |||
|---|---|---|---|
| Layer orientation | (0, 0.03) | ||
| Cast shape | (0.02, 0) | ||
| Cast relative weight | (0.02, 0) | ||
| Cast generator density | (0.25, 0) | ||
| Weld orientation | |||
| Lamella topology | (0.04, 0.26) | ||
| Lamella shape | |||
| Lamella relative weight |
Table 1: Guidance strengths used for Figure 2. An ordered pair gives horizontal and vertical position strengths; a scalar position strength is applied to both components. Since each gradient is RMS-normalised before scaling, the values specify correction magnitudes in normalised model coordinates.
Heterogeneous-lamella structure. Let
At each endpoint estimate, contains the largest centred weights and . The partition is discrete; gradients are computed conditional on the roles selected at that step.
Four wavy bands are represented by
The threshold makes the high-probability portion of each period approximately match the coarse fraction. For numerical stability the logarithms use .
The zero-mean two-level relative-weight target is
The topology, relative-weight, and shape objectives are
The cross-entropy places the current coarse population in the bands, SMSE maintains separated coarse and fine weight populations without fixing grain labels, and the shape term weakly aligns coarse grains with the local band tangent while driving fine grains towards equiaxed shapes.
These objectives constrain only selected APD statistics. All unconstrained features continue to be determined by the pretrained flow. Consequently, the method provides approximate training-free control rather than exact sampling from a conditional distribution, and sufficiently strong or conflicting objectives may move samples away from the learned data manifold.
B Anisotropy matrix parametrisation
The anisotropy matrix defining each grain must be symmetric positive definite (SPD). Directly predicting the entries of with an unconstrained neural network would not preserve this constraint and could therefore produce parameters that do not define a valid anisotropic norm. We instead construct an unconstrained, reversible parametrisation in which any network output corresponds to a valid anisotropy matrix.
Since is SPD, its matrix logarithm
is real and symmetric, where
is the eigendecomposition of . Conversely, exponentiating any real symmetric matrix produces an SPD matrix.
We additionally separate anisotropic shape from isotropic scale by constraining
The overall size of the corresponding grain is controlled separately through the APD weights, while this constraint allows to represent only anisotropic shape. Using the identity
the unit-determinant constraint implies
Hence is a symmetric trace-free matrix and can be written using only two unconstrained scalars,
The inverse transformation is simply
Since the exponential of a symmetric matrix is SPD and
every corresponds to a valid unit-determinant anisotropy matrix. The network can therefore predict without constraints while validity of the resulting APD parametrisation is preserved by construction.
This representation also gives a simple transformation rule under rotations. If R is a rotation of the spatial domain, then
For a rotation, this gives
while a rotation leaves unchanged. This transformation law is used in the construction of the -equivariant velocity field below.
C -equivariant model updates
Before training, the APD parameters are transformed to numerically convenient coordinates. Seed positions originally defined on are mapped to
Besides placing the positional variables on a scale comparable to the Gaussian source distribution, this centres the square domain at the origin. Consequently, rotations about the centre of the physical domain act linearly in the transformed coordinates,
The scalar APD weights are standardised using statistics computed from the training set,
Since the weights are invariant under spatial rotations, this transformation does not affect their transformation law.
The anisotropy parameters are left centred at the origin so that their transformation law under remains for a rotation. The source state at is sampled from a Gaussian distribution. Generated states are transformed back to the original APD parametrisation before rasterisation. For notational simplicity, we omit tildes for normalised quantities throughout this section.
Our objective is to construct a velocity field satisfying
for every rotation , where contains rotations by multiples of . Here the action of on includes the corresponding transformations of grain positions and anisotropy parameters, while the scalar weights remain invariant.
A standard multilayer perceptron does not in general preserve equivariance when applied directly to orientation-dependent geometric quantities. Drawing inspiration from Satorras et al. [9], we therefore separate the update into two components. First, the message-passing network operates on -invariant scalar features and predicts invariant scalar coefficients. Second, these coefficients multiply fixed geometric basis vectors with known transformation properties. The learned part of the model therefore determines the magnitude of each contribution, while the geometric bases determine how that contribution transforms under rotation.
For each directed edge , connecting sender s to receiver r, define the displacement
and the quadratic map
For a two-dimensional vector , we also define
The message-passing network receives invariant geometric information associated with each edge given by
where for and , we define , and ; while encodes position relative to the square boundary while remaining -invariant.
From the resulting edge representation, the output head predicts eleven invariant scalar coefficients,
An additional invariant attention score is normalised over the incoming edges of each receiver to obtain . The attention weight allows the model to control the relative contribution of neighbouring grains while preserving equivariance.
The contribution of edge e to the positional velocity is
Here are the symmetric trace-free matrices, as in Appendix B. The vectors
transform in the same way as spatial positions under . Since their coefficients and are invariant, transforms equivariantly under rotations.
The contribution to the anisotropy velocity is
These bases transform according to the same representation as the anisotropy parameters. In particular, under a spatial rotation,
and
The perpendicular quantities transform in the same way. Hence has the required transformation law for an anisotropy velocity.
Finally, since the APD weight is rotationally invariant, its edge contribution is simply
The node velocities are obtained by aggregating all incoming edge contributions,
Summation preserves the transformation properties of the individual messages. Since all learned coefficients are functions only of -invariant features, while each geometric basis transforms according to the required representation, the complete vector field satisfies
Consequently, numerical integration of the flow preserves this equivariance: rotating the initial state by any multiple of produces the corresponding rotation of the generated APD.