Skip to content

Menu

WorksPhysics and Astronomy

Soft Contrastive Learning for Unsupervised Discovery of Phases of Matter

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_dbgetj7e. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

A machine learning (ML) framework for phase-diagram construction in condensed matter systems with unknown phase structure is presented. The method combines physically motivated descriptors with contrastive representation learning and a two-stage data-generation workflow. First, a sparse set of configurations is generated by Monte Carlo simulated annealing in order to train a contrastive neural network that produces a low-dimensional embedding. Consequently, representative phase configurations are used as initial conditions for gradient-based optimization on a dense parameter grid, enabling efficient generation of refined datasets for high-resolution phase-diagram construction. In order to optimize the workflow, a variant of the method, in which derived descriptors are used as soft labels in the contrastive objective, is examined as well. The framework is demonstrated on a PbZrO3-inspired model potential formulated in terms of coupled order-parameter fields and used as a physically motivated testbed for exploring configuration diversity and phase behavior. The proposed approach provides a physically informed route to ML-assisted phase-diagram construction that integrates data analysis with adaptive dataset refinement.

Introduction

In condensed matter and statistical physics, many-body systems produce complex configuration spaces where relevant collective behavior is not always captured by simple predefined observables. Traditional analysis of phase transitions relies on identifying suitable order parameters or symmetry-breaking mechanisms. However, in complex or topological systems, such quantities may not be known a priori, or may be difficult to define. Machine learning (ML) has been explored as a practical way forward. Its flexibility allows it to extract salient information from high-dimensional datasets that are difficult to analyze using conventional approaches which require explicit model of the transition. It has consequently become a powerful tool for analyzing phases of matter [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].

ML methods for phase classification have largely followed two strategies: supervised classification using predefined phase labels [4, 6], or unsupervised learning that requires no labels at all [3, 5, 11, 12]. Supervised strategies presuppose knowledge of the phases that may appear in the data. This assumption is often violated when studying a new physical system, where we usually do not know how many phases exist or what they look like. Unsupervised methods avoid this requirement, learning features that characterize distinct regimes and producing low-dimensional representations that can be clustered into physical phases. Typically, an effective low-dimensional representation can be constructed using principal components analysis (PCA) [3] or autoencoders [11]. However, if unsupervised methods are applied directly to raw microscopic configurations the learned representation may be dominated by microscopic fluctuations rather than by the collective features relevant for phase identification [1, 11, 12].

In many physical systems, one can compute a set of generic descriptors, such as structure factors or correlations, that capture essential collective features without being tailored to a specific phase transition. Although these quantities do not necessarily constitute universal order parameters, they provide a physically informed and compact representation of the system, and they induce a notion of similarity between configurations that requires no prior knowledge of the phases. Their direct use as a feature space is nonetheless restrictive: the descriptor space is constructed by hand, and distances within it need not reflect the grouping of configurations into phases. This motivates treating the descriptors as a training signal rather than as the final representation, and learning an embedding in which the induced similarity is enforced. Contrastive objectives are designed for precisely this setting, as they are formulated directly in terms of pairwise similarity between samples.

Contrastive learning has been widely successful in vision [13, 14, 15], speech [16, 17], and natural language processing [18], and has recently been adopted for phase recognition in statistical physics by Han et al. [19], who employed a contrastive strategy on Monte Carlo configurations by defining positives as configurations obtained at identical control parameters, thereby injecting physical information through the pairing rule rather than through explicit data augmentations. Here we instead inject physical information through the descriptors themselves, which allows similarity to be defined between configurations at different control parameters.

Building on this idea, we make three contributions. First, we combine physically informed descriptors with raw microscopic configurations to improve the quality and robustness of representation learning. Second, we train a neural network that produces a meaningful low-dimensional embedding of system states, capturing phase-relevant similarity beyond what is explicitly encoded in the descriptor space. Third, we integrate this learned representation into a two-stage data-generation workflow that exploits the complementary strengths of two sampling strategies; Monte Carlo (MC) simulated annealing and a deterministic relaxation. MC simulated annealing requires no prior knowledge of the target state and can start from a random configuration, but it is computationally expensive and, because the energy landscape hosts multiple nearly degenerate minima, may terminate in a higher-energy state. Deterministic gradient relaxation is by contrast fast but inherently local and requires a sufficiently good initial ansatz to avoid converging to an undesired metastable minimum. By using representative configurations identified in the first stage as initial conditions for the second, our framework couples analysis with adaptive dataset refinement, enabling the construction of phase diagrams at high resolution while reducing the overall computational cost.

We demonstrate the proposed framework on a model potential inspired by the antiferroelectric perovskite PbZrO3_3 (PZO) [20, 21, 22, 23]. Rather than aiming at a faithful description of the material, we use this potential as a physically motivated testbed to explore the range of possible configurations and the associated phase behavior across the relevant parameter space. This setting provides a controlled environment for assessing the ability of our descriptor-enhanced contrastive approach to discover phases and construct phase diagrams, while leaving material-specific refinements of the model potential for future work.

The paper is organized as follows. In Sec. II we introduce the PZO-motivated potential and describe the data generation and the descriptors used. Section III describes the workflow and the ML model, including the contrastive-learning method. Section IV presents the results of our analysis and the phase-diagram construction, which are discussed in detail in Sec. V. We conclude with a summary in Sec. VI.

PZO-motivated Potential

To test our model, we have chosen a physically relevant example of an effective interatomic potential motivated by the structure of PbZrO3_3 (PZO) – a perovskite oxide of the ABO3_3 type. It is widely regarded as the prototypical antiferroelectric (AFE) material [24, 25]. On cooling, bulk PZO undergoes a first-order transition at Tc∼500 KT_c \sim500\,\mathrm{K} from the cubic paraelectric perovskite phase (space group Pm3ˉmPm\bar{3}m) into an orthorhombic antiferroelectric phase (PbamPbam), characterized by antipolar Pb displacements accompanied by oxygen-octahedra rotations [22]. Classic x-ray and neutron diffraction work established the low-temperature antiferroelectric structure [26]. Lattice-dynamical studies using x-ray scattering and Brillouin light scattering suggest that the AFE state originates from a single ferroelectric instability with an important role of flexoelectric coupling [22]. On the other hand, IR and Raman spectroscopy study demonstrate the existence of a multiple soft modes [23]. It also suggests that AFE states is stabilized by a trilinear term, that connects the AFE lead displacements to oxygen octahedra tilts. An effective 1-dimensional model of PZO potential including a soft branch part related to Pb ions displacement and term associated with oxygen octahedra tilting including the trilinear coupling leads to a phase diagram demonstrating existence of paraelectric (PE), ferroelectric (FE), and antiferroelectric (AFE) phase [23].

2D effective potential

Here, we extend the previously suggested 1D potential [23] to study phase transitions in more realistic case of 2-dimensional PZO lattice. In analogy to the 1-dimensional case, the potential contains soft (lead ions) and hard (oxygen ions) potential branches and their mutual coupling. The model described two coupled vector fields on a regular 2D square lattice

Pm,n=(um,n,vm,n)pc,(1)P_{m,n} = (u_{m,n},v_{m,n})_{\mathrm{pc}}, \tag*{(1)}
Am,n=(ηm,n,ξm,n)pc,(2)A_{m,n} = (\eta_{m,n},\xi_{m,n})_{\mathrm{pc}}, \tag*{(2)}

where pc stands for conventional pseudocubic cartesian system and pair of integers (m,n)(m,n) label the lattice sites. Pm,nP_{m,n} is the in-plane polarization vector (lead ions) while Am,nA_{m,n} stands for a hidden field of in-plane vectors related to oxygen octahedra tilting. We denote the pair of fields over the whole lattice as X=(P,A)X=(P,A). For convenience, the potential is described using auxiliary field coordinates rm,nr_{m,n}, sm,ns_{m,n}, ϕm,n\phi_{m,n}, ψm,n\psi_{m,n} referring to a rotated cartesian system with axes along [11][11] and [11ˉ][1\bar{1}] as follows

vm,n=sm,n+rm,n2,um,n=sm,n−rm,n2,v_{m,n} = \frac{s_{m,n}+r_{m,n}}{\sqrt{2}}, \qquad u_{m,n} = \frac{s_{m,n}-r_{m,n}}{\sqrt{2}},
ξm,n=ψm,n+ϕm,n2,ηm,n=ψm,n−ϕm,n2.\xi_{m,n} = \frac{\psi_{m,n}+\phi_{m,n}}{\sqrt{2}}, \qquad\eta_{m,n} = \frac{\psi_{m,n}-\phi_{m,n}}{\sqrt{2}}.

The potential under consideration is defined as

V=∑(m,n)[Vsoft+Vsoft′+Vhard+Vhard′+Vint].(3)V = \sum_{(m,n)} \left[V_{\mathrm{soft}}+V'_{\mathrm{soft}}+V_{\mathrm{hard}}+V'_{\mathrm{hard}}+V_{\mathrm{int}}\right]. \tag*{(3)}

The first term stands for the soft local potential for polarization field

Vsoft=α2(rm,n2+sm,n2)+14(rm,n2+sm,n2)2+12rm,n2sm,n2,(4)V_{\mathrm{soft}} = \frac{\alpha}{2}\left(r_{m,n}^{2}+s_{m,n}^{2}\right) + \frac{1}{4}\left(r_{m,n}^{2}+s_{m,n}^{2}\right)^{2} + \frac{1}{2}r_{m,n}^{2}s_{m,n}^{2}, \tag*{(4)}

where α=a(T−T0)\alpha=a\left(T-T_0\right) with T0T_0 being a critical temperature for the PE – FE phase transition. VsoftV_{\mathrm{soft}} favors the oblique polarization directions, while the hard local potential for hidden field has the opposite anisotropy

Vhard=12(ϕm,n2+ψm,n2)+14(ϕm,n2+ψm,n2)2−12ϕm,n2ψm,n2.(5)V_{\mathrm{hard}}=\frac{1}{2}\left(\phi_{m,n}^{2}+\psi_{m,n}^{2}\right)+\frac{1}{4}\left(\phi_{m,n}^{2}+\psi_{m,n}^{2}\right)^{2}-\frac{1}{2}\phi_{m,n}^{2}\psi_{m,n}^{2}. \tag*{(5)}

The dispersion energy for polarization field is defined by nearest-neighbor (NN) and next-nearest-neighbour (NNN) harmonic interactions

Vsoft′=g12[(vm,n−vm+1,n)2+(um,n−um,n+1)2]+g22[(um,n−um+1,n)2+(vm,n−vm,n+1)2]+g42[(sm,n−sm+1,n+1)2+(rm+1,n−rm,n+1)2],(6)V'_{\mathrm{soft}}=\frac{g_{1}}{2}\left[\left(v_{m,n}-v_{m+1,n}\right)^{2}+\left(u_{m,n}-u_{m,n+1}\right)^{2}\right]+\frac{g_{2}}{2}\left[\left(u_{m,n}-u_{m+1,n}\right)^{2}+\left(v_{m,n}-v_{m,n+1}\right)^{2}\right]+\frac{g_{4}}{2}\left[\left(s_{m,n}-s_{m+1,n+1}\right)^{2}+\left(r_{m+1,n}-r_{m,n+1}\right)^{2}\right], \tag*{(6)}

where the coefficients were fixed to favor off-axis transverse polarization waves g1=1g_{1}=1, g2=5g_{2}=5, and g4=10g_{4}=10.

In case of the hidden field, only the diagonal longitudinal fluctuations are suppressed by the NNN harmonic interaction

Vhard′=λ42[(ψm,n−ψm+1,n+1)2+(ϕm+1,n−ϕm,n+1)2](7)V'_{\mathrm{hard}}=\frac{\lambda_{4}}{2}\left[\left(\psi_{m,n}-\psi_{m+1,n+1}\right)^{2}+\left(\phi_{m+1,n}-\phi_{m,n+1}\right)^{2}\right] \tag*{(7)}

with λ4=10\lambda_{4}=10.

Finally, the trilinear coupling term reads

Vint=κ2(rm,n−rm+1,n+1+sm+1,n−sm,n+1)×ϕm,nψm,n(8)V_{\mathrm{int}}=\frac{\kappa}{2}\left(r_{m,n}-r_{m+1,n+1}+s_{m+1,n}-s_{m,n+1}\right)\times\phi_{m,n}\psi_{m,n} \tag*{(8)}

where κ>0\kappa>0 is the interaction constant.

The potential VV defined by Eqs. (3)–(8) is the model studied in this work. Although the potential depends on several parameters tailoring its shape, we fix most of them and focus on two control parameters, α\alpha and κ\kappa. Thus, the (α,κ)(\alpha,\kappa) plane defines the two-dimensional parameter space in which we construct the phase diagram.

Methods

The whole workflow can be described in four steps which will be followed throughout the Methods section. These steps are depicted in Figure 1: (A) Data generation (Configurations X\mathbf{X} for different α\alpha and κ\kappa parameters of the PZO potential are generated from random initial conditions using the MC simulated annealing algorithm as described in Sec. III A.) (B) Descriptors calculation and clustering (Descriptor vectors χ\boldsymbol{\chi} are calculated from the generated configurations. The descriptor vectors are chosen to carry physical information of the system. Clusters of the descriptor vectors are found using a density-based clustering algorithm as described in Sec. III B.) (C) Representation learning (Neural network (encoder) which maps configurations X\mathbf{X} to vectors (embeddings) z∈RD\mathbf{z}\in\mathbb{R}^{D} for some D∈ND\in\mathbb{N} is trained using a contrastive learning paradigm, using information from both the configurations and the descriptors as described in Sec. III C.) (D) Phase diagram construction ((1) The training configurations are mapped into the embedding space and subsequently clustered, refining the cluster memberships from step B. For each cluster a set of nn representatives is identified. (2) When constructing phase diagram, we find ground state for each pair of (α,κ)(\alpha,\kappa) using gradient descent method with the configurations corresponding to found representatives as initial conditions. The optimized configuration with lowest energy is mapped using the encoder. Finally, the ground state configurations are clustered to obtain the phase diagram as described in Sec. III D.)

Figure 1. Workflow overview. (A) Training data generation: MC simulated annealing generates metastable configurations across the (α,κ)(\alpha,\kappa) of the PZO potential. (B) Descriptors: a descriptor vector χ\chi is computed per configuration. In case of classical contrastive learning χ\chi is used for a preliminary clustering and construction of positive and negative pairs. In case of soft contrastive learning χ\chi is used to define similarity between two samples. (C) Representation learning: an encoder is trained via contrastive learning, using either cluster membership or distance between descriptor vectors as similarity label. (D) Phase diagram construction: clustering the MC embeddings and selecting representatives yields a small set of configurations, which seed a gradient descent on a dense (α,κ)(\alpha,\kappa) grid. Mapping the resulting relaxed configurations through the same encoder and clustering once more gives the final phase diagram.

In the following, we will describe each stage in more detail.

Training data generation

In stage A we generate the training dataset that shall be used to train the unsupervised ML methods. The training dataset consists of low energy configurations of X=(P,A)\mathbf{X}=(P,A) for randomly distributed pairs of (α,κ)(\alpha,\kappa) parameters in the given parameter space. In order to get rid of any assumption of the configuration, we minimize the potential VV [Eq. (3)] use MC simulated annealing. In contrast to local gradient descent minimization, this stochastic procedure is less sensitive to the initial condition and helps to escape from shallow metastable states.

We start from a random initial configuration in which

um,n,vm,n,ηm,n,ξm,n∼U([−1,1]),u_{m,n},v_{m,n},\eta_{m,n},\xi_{m,n}\sim U([-1,1]),
∀m,n∈{1,2,…,N},\forall m,n\in\{1,2,\ldots,N\},

where U([−1,1])U([-1,1]) denotes the uniform probability distribution on the interval [−1,1][-1,1] and NN is the linear size of the 2D lattice. We perform standard Metropolis–Hastings updates while lowering the temperature τ\tau according to a prescribed cooling schedule. We optimize both, polarization as well as hidden field variables. Thus, a configuration of the 2D system consists of 4×N×N4\times N\times N independent variables.

The goal of this procedure is not to sample the finite-temperature equilibrium distribution, but to obtain candidate ground-state configurations by driving the system towards low-energy minima. Note that the physical temperature TT enters the potential only through the coefficient α\alpha, at the mean-field level. The fictitious temperature τ\tau used in the simulated annealing controls the acceptance of trial moves and is an optimization parameter unrelated to TT; since it is lowered to zero at the end of the schedule, the resulting configurations carry no thermal fluctuations.

In our settings, we chose N=8N=8 and we sampled α\alpha and κ\kappa uniformly from respective intervals [−10,10][-10,10] and [0,10][0,10], (α,κ)∼U([−10,10]×[0,10])(\alpha,\kappa)\sim\mathcal{U}([-10,10]\times[0,10]), to inspect the region containing the phase boundaries. In this manner we obtained 6000 (α,κ)(\alpha,\kappa) pairs and their respective configurations X\mathbf{X}. The generated data are available from Zenodo [27].

Descriptors

Next, in the stage B, we introduce a set of physically motivated descriptors. The descriptors substantially reduce the dimensionality of the problem and provide an interpretable representation that facilitates the identification of distinct phases.

A straightforward descriptor for a periodic system is structure factor defined as

SF(Q)=1N2∑rFreiQ⋅r,(9)S_F(\mathbf{Q})=\frac{1}{N^2}\sum_{\mathbf{r}}F_{\mathbf{r}}e^{i\mathbf{Q}\cdot\mathbf{r}}, \tag*{(9)}

where FF is the relevant field P\mathbf{P} or A\mathbf{A}, Q\mathbf{Q} is a wave vector,

N2N^2 is the number of the lattice sites, and r\mathbf{r} is a real-space position on the lattice.

In order to quantify relationship between the polarization field P\mathbf{P} and the hidden field A\mathbf{A}, we defined correlations as

C(Q)=SP(Q)⋅SA(Q)∥SP(Q)∥∥SA(Q)∥(10)C(\mathbf{Q})=\frac{S_P(\mathbf{Q})\cdot S_A(\mathbf{Q})}{\lVert S_P(\mathbf{Q})\rVert\lVert S_A(\mathbf{Q})\rVert} \tag*{(10)}

For the intensities and correlations we assume the following set of wave vectors

QΓ=(0,0),QX1=(π,0),QM=(π,π),QX2=(π/2,0),QΣ=(π/2,π/2).(11)\mathbf{Q}^{\Gamma}=(0,0),\mathbf{Q}^{X1}=(\pi,0),\mathbf{Q}^{M}=(\pi,\pi),\\ \mathbf{Q}^{X2}=(\pi/2,0),\mathbf{Q}^{\Sigma}=(\pi/2,\pi/2). \tag*{(11)}

To account for the fourfold rotational symmetry of the PZO potential, the structure factors and correlations were taken as a mean over all π/2\pi/2 rotations of the wave vectors given above

SX‾(Q)=14∑n=14SX(R(nπ2)Q),(12)\overline{S_X}(\mathbf{Q})=\frac{1}{4}\sum_{n=1}^{4}S_X\left(R\left(n\frac{\pi}{2}\right)\mathbf{Q}\right), \tag*{(12)}
C‾(Q)=14∑n=14C(R(nπ2)Q).(13)\overline{C}(\mathbf{Q})=\frac{1}{4}\sum_{n=1}^{4}C\left(R\left(n\frac{\pi}{2}\right)\mathbf{Q}\right). \tag*{(13)}

where R(θ)R(\theta) is the 2D rotation matrix through angle θ\theta about origin. We then consider real-valued intensities I‾F(Q)=∥S‾F(Q)∥2\overline{I}_{\mathrm{F}}(\mathbf{Q}) = \lVert\overline{\mathbf{S}}_{\mathrm{F}}(\mathbf{Q}) \rVert^2 of the complex-valued structure factors. We define a descriptor vector χ∈R15\boldsymbol{\chi} \in\mathbb{R}^{15} for each configuration X\mathbf{X} as

χ=(I‾P(QΓ),I‾P(QX1),I‾P(QM),I‾P(QX2),I‾P(QΣ),I‾A(QΓ),I‾A(QX1),I‾A(QM),I‾A(QX2),I‾A(QΣ),C‾(QΓ),C‾(QX1),C‾(QM),C‾(QX2),C‾(QΣ)).(14)\boldsymbol{\chi} = \left( \overline{I}_{\mathrm{P}}(\mathbf{Q}^{\Gamma}), \overline{I}_{\mathrm{P}}(\mathbf{Q}^{X_1}), \overline{I}_{\mathrm{P}}(\mathbf{Q}^{M}), \overline{I}_{\mathrm{P}}(\mathbf{Q}^{X_2}), \overline{I}_{\mathrm{P}}(\mathbf{Q}^{\Sigma}), \overline{I}_{\mathrm{A}}(\mathbf{Q}^{\Gamma}), \overline{I}_{\mathrm{A}}(\mathbf{Q}^{X_1}), \overline{I}_{\mathrm{A}}(\mathbf{Q}^{M}), \overline{I}_{\mathrm{A}}(\mathbf{Q}^{X_2}), \overline{I}_{\mathrm{A}}(\mathbf{Q}^{\Sigma}), \overline{C}(\mathbf{Q}^{\Gamma}), \overline{C}(\mathbf{Q}^{X_1}), \overline{C}(\mathbf{Q}^{M}), \overline{C}(\mathbf{Q}^{X_2}), \overline{C}(\mathbf{Q}^{\Sigma}) \right). \tag*{(14)}

Using the descriptor vectors χ\boldsymbol{\chi}, we constructed preliminary phase labels, which served both as reference labels for evaluation and as proxy labels for contrastive learning. The labels were obtained by clustering the descriptor vectors with DBSCAN [28] as implemented in scikit-learn 1.8.0 [29]. DBSCAN is density-based algorithm that does not require the number of clusters to be specified in advance. Clustering was performed using the cosine distance, with the neighborhood radius set to ε=0.01\varepsilon= 0.01 and other hyperparameters kept default.

Representation learning

In the main part of the workflow we trained a neural network encoder ff to map the X\mathbf{X} configurations to embedding vectors f(X)=z∈RDf(\mathbf{X}) = \mathbf{z} \in\mathbb{R}^{D}, where D∈ND \in\mathbb{N} is a chosen dimension of the embedding space. We focus on incorporating the physical information (provided by the descriptors) to the information provided by the raw microscopic configurations X=(P,A)\mathbf{X} = (\mathbf{P}, \mathbf{A}).

The encoder was trained using contrastive learning. Contrastive learning aims to learn an embedding space in which similar data points (samples) are mapped to nearby points, while dissimilar samples are pushed apart. In practice, the objective is formulated using pairs or tuples of samples. For a given anchor sample, a positive sample is one that is expected to be close to the anchor in the embedding space, whereas a negative sample is one that should be mapped far from it.

Depending on how positive and negative relations are constructed, two common settings can be distinguished. In a supervised formulation, pairs are explicitly labeled as positive or negative, and the network is optimized to pull positive pairs together in the embedding space while pushing negative pairs above a given margin [30, 31]. In a self-supervised formulation, positive pairs are generated by applying some transformations to the same input (e.g. rotations or cropping), and negatives are provided by other samples (often within the same mini-batch); a representative example is SimCLR [13]. In the present work, we explore two strategies for contrastive learning. Specifically, we employ a semi-supervised, margin-based contrastive loss with two different strategies: (i) we utilize the clustering-based proxy labels from Sec. III B to construct the positive/negative relations [30, 31], and (ii) we use distances in descriptors space directly to define

soft similarity targets (soft contrastive learning) [32]. In both cases, the resulting embeddings are informed by the microscopic fields P\mathbf{P} and A\mathbf{A} as well as by their associated order parameters χ\boldsymbol{\chi}.

Contrastive learning

In the (classical) contrastive learning, the batches are constituted of pairs, where one configuration is the anchor and the other configuration is either negative or positive. To find the encoder weights, a loss function depending on the distance between the embeddings z\mathbf{z} and on a label variable λ\lambda is minimized. The variable λ\lambda carries the information about the type of pair being evaluated and its value is obtained from the inputs so that for two configurations Xi\mathbf{X}_i and Xj\mathbf{X}_j,

λij={1Xi and Xj are positive0otherwise.(15)\lambda_{ij} = \begin{cases} 1 & \mathbf{X}_i \text{ and } \mathbf{X}_j \text{ are positive} \\ 0 & \text{otherwise.} \end{cases} \tag*{(15)}

The full loss functions sums over all the combinations in a batch and reads

L=12∑i≠j[λijdij2+(1−λij)(max⁡{0,m−dij})2],(16)\mathcal{L} = \frac{1}{2}\sum_{i \ne j}\left[\lambda_{ij}d_{ij}^{2} + (1-\lambda_{ij})\left(\max\{0,m-d_{ij}\}\right)^{2}\right], \tag*{(16)}

where dijd_{ij} is a value of a distance function for the embedding vectors dij:=dist⁡(f(Xi),f(Xj))d_{ij} := \operatorname{dist}(f(X_i), f(X_j)) and m∈Rm \in\mathbb{R}. The parameter mm in (16) controls the minimal distance between the negatively labeled pairs of embeddings and we set m=1m = 1. We label the classical contrastive learning embeddings as vv. We chose a simple euclidean distance on the embedding space dist⁡(vi,vj)=∥vi−vj∥\operatorname{dist}(v_i, v_j) = \lVert v_i-v_j\rVert. The encoder was trained using a Siamese architecture depicted in Figure 2, where each pass is computed in pairs and the encoder in both branches share its weights. The details of the encoder architecture are given in Appendix A. The full implementation, including all hyperparameters and training schedules, is available in Ref. [33].

Siamese neural network architecture used for contrastive learning

Figure 2. Siamese neural network architecture used for contrastive learning. X1≡(P1,A1)\mathbf{X}_1 \equiv(\mathbf{P}_1,\mathbf{A}_1) and X2≡(P2,A2)\mathbf{X}_2 \equiv(\mathbf{P}_2,\mathbf{A}_2) are two independent inputs, and λ∈{0,1}\lambda\in\{0,1\} carries information whether they belong to the same cluster or not. Enc. marks two identical encoder neural networks sharing their internal parameters, which encode the inputs into the embedding space vectors, z1\mathbf{z}_1 and z2\mathbf{z}_2, respectively. Finally, the contrastive loss Lcontr\mathcal{L}_{\mathrm{contr}} is calculated from the distance between the encoded vectors, dist⁡(z1,z2)\operatorname{dist}(\mathbf{z}_1,\mathbf{z}_2) and the values of λ\lambda.

For a contrastive learning model to perform well, especially in a self-supervised setting, the training pairs must be chosen carefully, since the sampling strategy can be just as important as selecting an appropriate loss function [34]. In our case, the type of contrast is determined by the preliminary phase labels obtained from clustering on the space of descriptors outlined in Sec. III B: configurations are taken as a positive pair whenever they belong to the same cluster, and as a negative pair otherwise. Since we already possess these labels, we simply consider batches containing equal numbers of positive and negative pairs, without imposing any additional constraint on which cluster the negative samples are drawn from. This simple strategy is possible mainly due to the simplicity of the dataset and the supervised nature of the task. Furthermore, we have applied data augmentation, implemented as random in-plane rotations of the contrast configurations by an angle kπ/2k\pi/2 with k∈{1,2,3}k \in\{1, 2, 3\}.

Soft contrastive learning

In the case of the soft contrastive learning approach, to compare XiX_i and XjX_j, instead of a hard label λij∈{0,1}\lambda_{ij} \in\{0, 1\} indicating whether the two samples belong to the same class or not, a soft label sij∈[0,1]s_{ij} \in[0, 1] is assigned. The soft label sijs_{ij} expresses continuous degree of similarity between the two samples. For given configurations XiX_i, XjX_j, we calculated the soft label sijs_{ij} from their respective descriptor vectors χi\chi_i, χj\chi_j as the cosine similarity,

sij=χiT⋅χj∥χi∥∥χj∥.(17)s_{ij} = \frac{\chi_i^{T} \cdot\chi_j}{\lVert\chi_i\rVert\lVert\chi_j\rVert}. \tag*{(17)}

Furthermore, the values of sijs_{ij} were min-max scaled with respect to the whole dataset, so that the values of sijs_{ij} span the full [0,1][0, 1].

We then considered a generalized version of the contrastive loss (16):

Lsoft=12∑i≠j[h+(sij)dij2+h−(sij)(max⁡{0,m−dij})2],(18)\mathcal{L}_{\mathrm{soft}} = \frac{1}{2}\sum_{i\ne j}\left[h^{+}(s_{ij})d_{ij}^{2} + h^{-}(s_{ij})\left(\max\{0,m-d_{ij}\}\right)^{2}\right], \tag*{(18)}

where h+h^{+} is a decreasing real-valued function and h−h^{-} is an increasing real-valued function, such that h++h−=1h^{+}+h^{-}=1. Functions h±h^{\pm} and their parameters allow for tuning how

the value of the label sijs_{ij} influences the final loss, effectively controlling the decision boundary between positive and negative samples. The m∈Rm \in\mathbb{R} parameter plays the same role as in the contrastive loss given in (16) and was set as m=1m = 1. We denote the embeddings from soft contrastive learning as ww and similarly choose dij=∥wi−wj∥d_{ij} = \lVert w_i-w_j\rVert. For functions h±h^{\pm}, we used the sigmoid functions

h±(sij)=11+exp⁡[∓a(sij−b)],(19)h^{\pm}(s_{ij}) = \frac{1}{1+\exp\left[\mp a(s_{ij}-b)\right]}, \tag*{(19)}

where a,b∈R+a,b \in\mathbb{R}_{+}. We set a=8a=8 and b=0.5b=0.5, where the bb choice reflects corresponds to the fact that the soft label sijs_{ij} takes value in the interval [0,1][0,1]. The functions are depicted in Figure 3. The soft contrastive learning approach therefore allows us to skip the unsupervised preliminary label generation and directly obtain the vectorial representation of the data.

Figure 3. Graph of functions h±h^{\pm} on the interval [0,1][0,1] for parameters a=8a=8 and b=0.5b=0.5. The functions h±h^{\pm} and their parameters control how the sijs_{ij} similarity influences the final loss Lsoft\mathcal{L}_{\mathrm{soft}} values.

As for the encoder architecture, it was identical to the contrastive learning encoder and the details are specified in Appendix A. Training relied on a shared-weight encoder. Shared-weight encoder is a generalization of the Siamese encoder in which a single forward pass is applied to the entire batch rather than to a pair of inputs. The implementation and sample training is available at Ref. [33].

Phase diagram construction

In the final part of the workflow, we use the trained encoder (Sec. III C 1) to identify distinct phases in the training dataset. We first obtained the embeddings zz for all MC configurations XX. Clusters in the embedding space were identified using HDBSCAN, a hierarchical extension of the DBSCAN algorithm [35], as implemented in the scikit-learn library, with the Euclidean distance as the metric, min_cluster_size = 30, cluster_selection_epsilon = 0.1 (classical) and cluster_selection_epsilon = 0.02 (soft contrastive). Other hyperparameters of the HDBSCAN were set to default. For each cluster, we selected as representatives the n=3n = 3 configurations whose embeddings have the smallest average distance to all other members of the same cluster.

We then sampled the region [−10,10]×[0,10][-10, 10] \times[0, 10] on uniform 200×100200 \times100 grid, which is considerably denser than the grid used for the MC simulated annealing. At each grid point, we ran a Broyden–Fletcher–Goldfarb–Shanno algorithm (BFGS) optimization, as implemented in the SciPy library [36], starting from every cluster representative found. We identified the ground state as the relaxed configuration with the lowest energy. Testing all cluster representatives at every point is affordable due to the low computational cost of BFGS.

This procedure yields a dense grid in the (α,κ)(\alpha, \kappa) space with a well-relaxed configuration X\mathbf{X} at every point. To obtain the phase diagram, we mapped the configurations into the embedding space using the encoder trained on the MC configurations. The embeddings were then clustered with HDBSCAN to obtain the phase diagram, using the same hyperparameters as for the MC embeddings except for min_cluster_size = 50 and cluster_selection_epsilon = 0.015.

Results

In this section, we first examine the results obtained from the encoders in the case of the Monte–Carlo generated configurations for both the classical and the soft contrastive learning. Next, we show how the method handled the gradient-optimized ground-state configurations, leading to the final phase diagram. We briefly recall the notation. Embedding coordinates are denoted by lowercase symbols: v=(v1,v2)\mathbf{v} = (v_1, v_2) (classical contrastive), and w=(w1,w2,w3)\mathbf{w} = (w_1, w_2, w_3) (soft contrastive). Cluster labels use uppercase identifiers ViV_i, and WiW_i for the respective methods and UiU_i for the preliminary clusters obtained by direct clustering of the χ\boldsymbol{\chi} vectors.

The results for the classical contrastive learning are given in Figure 4. Panel (a) shows the preliminary cluster labels plotted against the model parameters α\alpha and κ\kappa, giving overview of the phase diagram. Panel (b) shows the embeddings obtained from the contrastive learning encoder, while panel (c) plots the clusters from panel (b) against (α,κ)(\alpha,\kappa), giving comparison to the preliminary labels given in (a). Finally, panel (d) reports the mean values of the individual (normalized) descriptor vector components χi\chi_i inside each cluster.

Classical contrastive learning results for configurations obtained from MC simulated annealing

Figure 4. Classical contrastive learning results for configurations obtained from MC simulated annealing. (a) Preliminary clusters found by clustering directly on the space of descriptor vectors χ\boldsymbol{\chi} shown across the parameters plane (α,κ)(\alpha,\kappa). (b) The embeddings and clusters obtained from the contrastive learning encoder. (c) The cluster assignments of embeddings from (b) shown across the (α,κ)(\alpha,\kappa) plane. (d) Mean values of the descriptors for found clusters. Prior to the mean calculation, the individual descriptor components χi\chi_i were scaled so that χi∈[0,1]\chi_i \in[0,1].

Compared to preliminary labels, the contrastive learning encoder was able to reduce number of labels from 11 to 5, however few points were assigned to a noise class. The noise class groups samples that did not satisfy the criteria to be assigned to any cluster with respect to the hyperparameters of the used clustering algorithm. From the mean values of the order parameters shown in Figure 4(d) and by inspection of the configurations, it is evident that the V2 cluster is composed of FE configurations and the V3 cluster consists of PE configurations. The remaining clusters V1, V4 and V5 feature different forms of stable or metastable AFE configurations. We note, that the contrastive clusters V1, V2 and V3 were mostly identical to the respective preliminary clusters U1, U6 and U2. The difference was a multitude of smaller clusters of perturbed configurations inside the AFE region, which were redistributed across 3 contrastive learning AFE clusters (V1, V4 and V5). Furthermore, Figure 4(b) reveals geometric structure of the embedding space: the PE and FE phases occupy adjacent regions of the space, while the AFE-related embeddings are located in different arcs of the circle.

The soft contrastive learning algorithm yielded similar results to the classical contrastive learning and these results are depicted in Figure 5. We chose embedding dimension D=3D = 3 as is discussed in § 1.4 and more in detail in Appendix B. The embeddings are shown in panels (a) and (b) as projections to (w1,w2)(w_1,w_2) and (w2,w3)(w_2,w_3) planes with found cluster labels. Panel (c) depicts heatmap with mean values of the descriptors χi\chi_i for the individual clusters, using the same scaling of χi\chi_i as in Figure 4(d). The results are consistent with the clusters obtained in the classical contrastive learning method, apart from one additional cluster being found in the soft contrastive variant. Specifically, clusters W1 and W2 correspond to PE and FE phases respectively and the rest of the clusters group various forms of AFE configurations. The dependency on the parameters κ\kappa and α\alpha is similar as shown for the case of classical contrastive learning given in Figure 4(c), and is therefore omitted. One important difference between the results is the smooth variation of the embedding vectors between PE and FE regions (clusters W1 and W2), which can be attributed to the continuous variation in relevant structure factor IP(QΓ)I_P(Q^\Gamma) between these two regions.

Soft contrastive learning results for configurations obtained from simulated annealing

Figure 5. Soft contrastive learning results for configurations obtained from simulated annealing (a-b) Three-dimensional embedding obtained from the soft contrastive learning encoder, shown as projections onto the (w1,w2)(w_1,w_2) and (w2,w3)(w_2,w_3) planes and annotated with cluster assignment. (c) Mean values of the descriptors for found clusters. Prior to the mean calculation, the individual descriptors χi\chi_i were scaled so that χi∈[0,1]\chi_i \in[0,1].

As for the deterministic optimization, we observed that the important clusters representing the PE, FE, AFE A and AFE B phases were found and preserved by both encoders. Initial configurations from both methods therefore lead to the correct ground state configurations after the BFGS optimization. The embeddings of the ground states from both methods are given in Figure 6 and the finalized phase diagram is given in Figure 7. The results for both methods are equivalent, except for noise points at the region boundaries in the soft-contrastive case, Figure 6(a-Figure 6b). In agreement with the results obtained from the MC configurations, we observed the four aforementioned phases. Furthermore we found that the model allowed for two different configurations in the AFE A domain which we call AFE A and AFE A’. Chosen representatives of the

Classical and soft label contrastive learning results for BFGS-optimized ground-state configurations

Figure 6. Classical and soft label contrastive learning results for BFGS-optimized ground-state configurations. (a) Embeddings and clusters obtained for classical contrastive encoder. (b-c) Embeddings and clusters obtained from the soft contrastive learning encoder, shown as projections onto the (w1,w2)(w_1,w_2) and (w2,w3)(w_2,w_3) planes. (c) Mean values of the descriptors for found clusters. Prior to the mean calculation, the individual descriptors χi\chi_i were scaled so that χi∈[0,1]\chi_i \in[0,1].

Phase diagram in the $(\alpha,\kappa)$ parameter plane

Figure 7. Phase diagram in the (α,κ)(\alpha,\kappa) parameter plane obtained from the BFGS-optimized ground-state configurations, annotated by found phase (cluster) label.

3 different AFE configurations are visualized in Figure 8.

Representatives of the relaxed AFE A, AFE A’ and AFE B phase configurations

Figure 8. Representatives of the relaxed AFE A, AFE A’ and AFE B phase configurations. The left column shows the polarization field P(u,v)P(u,v) and the right column the hidden field A(η,ξ)A(\eta,\xi). The arrows represent field directions only, as their lengths are not drawn to scale.

Discussion

In § 1.3 we have presented all parts of our workflow, described in Figure 1, which results in construction of the final phase diagram shown in Figure 7. Let us now analyze the crucial parts of the pipeline.

Use of descriptors

First, a supporting physical information enters the workflow through the training signal in a form of a vector of physics-motivated descriptors χ\chi defined in Sec. III B, consisting of structure-factor intensities and correlations at a small set of high-symmetry wave vectors, symmetrized over the point group of the lattice. These descriptors are used solely to define the notion of similarity between two configurations: in the classical branch they generate the positive and negative pairs, and in the soft-label branch they enter directly as a continuous target similarity. The encoder therefore retains access to the full configuration, while the geometry it is asked to reproduce in the embedding space is the one expressed by χ\chi. Since the descriptors are invariant under lattice translations and symmetrized over its point group, the target similarity inherits these invariances, and the encoder is driven towards a representation that respects them.

For simplicity, the descriptor set used here is not complete. Two states whose modulations are carried by wave vectors outside the chosen set would be assigned the same target similarity as a pair of identical states, and the contrastive objective would map them onto the same region of the embedding space even though the underlying configurations differ. Here this is not a limitation, since the wave vectors are dictated by the symmetry and the interaction range of the potential. When the underlying model is not known in advance, the same workflow should be run with a denser sampling of wave vectors, or with descriptors learned directly from the configurations under an imposed equivariance constraint [37].

Second, to construct positive and negative pairs for the classical contrastive method, we used DBSCAN clustering in the space of descriptors making use of cosine metrics. The resulting clusters for the MC configurations are shown in Figure 4(a). The four dominant ones, U1, U2, U3 and U6, correspond to the AFE B, PE, AFE A and FE phases, respectively, so that the main phases of the model are already recovered at this stage. That a coarse phase diagram can be retrieved from the χ\chi vectors alone indicates that the descriptors already capture the distinctions between the main phases.

This intermediate clustering is, however, not the final result. It partitions the configurations into considerably more clusters than the model has distinct states, so that the correspondence between clusters and phases has to be established by hand, and assigning a new configuration requires evaluating the full descriptor vector and matching it against the existing partition. More fundamentally, the partition rests on a fixed, prescribed metric in χ\chi, in which every descriptor component contributes on an equal footing regardless of whether it is relevant to the ordering. This is acceptable here, where the wave vectors entering χ\chi were chosen with the symmetry and the interaction range of this particular potential in mind and nearly every component is informative, but it does not carry over to a general setting: with a larger and predominantly uninformative descriptor set, the distance between two configurations would be governed by components unrelated to the ordering. The contrastive step provides representation in which the relative importance of the descriptors is determined by the data rather than imposed.

Contrastive learning methods

Third, we used the contrastive learning to create embeddings that allow us to identify distinct phases in our data. The classical contrastive encoder trained stably and produced comparable results across independent runs of the optimization, and the HDBSCAN clusters obtained from its embeddings were stable over a wide range of hyperparameters. We also observed that data augmentation, based on symmetry operations applied to training dataset, did not improve the results. We attribute this robustness primarily to the simplicity of the input data, the choice of descriptors, and the effectively supervised nature of the contrastive task, in which the proxy labels are fixed before training.

All five states were already resolved in a two-dimensional embedding space. For D=3D = 3 we observed a dimensional collapse: the embedding vectors clearly spanned a two-dimensional hyperplane and the result was equivalent to the D=2D = 2 case. In self-supervised contrastive learning this effect is usually attributed to implicit regularization or to strong augmentation [38]. Even in the absence of collapse, however, the higher embedding dimension did not carry any additional information about the system. We refer to Appendix B for further analysis of the descriptors for varying values of DD.

In contrast to the classical variant, the soft-contrastive method requires no clustering prior to training: the positive and negative pairs are replaced by a graded target similarity computed directly from the descriptor vectors, so that the clustering step in the descriptor space is dropped entirely. Clustering is still performed after training, in the learned embedding space, in order to identify the final phase regions.

Note, at the FE–PE boundary the configurations were mapped onto an arc terminating in the PE points with vanishing IP(QΓ)I_{\mathrm{P}}(Q^{\Gamma}), as seen in Figure 6(b-Figure 6c); the separation of the two regions was more subtle than in the classical case and required careful tuning of the HDBSCAN hyperparameters. Moreover, with suitably tuned HDBSCAN parameters all four regions were always identified, but AFE A and AFE A’ were separated more consistently in the final phase diagram for D≥3D \ge3 than for D=2D = 2. Furthermore, we found that the soft contrastive learning encoder was more likely to utilize the third dimension for D≥3D \ge3 than the classical contrastive learning encoder.

Overall, both approaches successfully recovered the phase diagram. Classical contrastive learning refined the proxy-label information and reduced the number of clusters, but consequently remained dependent on the quality of the proxy-label construction step. The soft-label variant removed that step altogether by incorporating the structure-factor relationships directly, and reflected the more nuanced distinctions between the PE/FE and AFE A/AFE A’ regions, at the cost of a greater sensitivity to the hyperparameters of the final clustering.

Interpretability and identified phases

Finally, let us analyze the main results of our workflow, which are the identified physical phases. The use of physically motivated descriptors makes the workflow interpretable at the level at which the phases are identified. The learned embedding itself remains opaque, but every cluster in it can be characterized by its averaged descriptors Xˉ\bar{X}, which have a direct physical meaning. Besides assigning labels to regions of the parameter space, the clustering provides the order parameters that distinguish them, as summarized in Figure 6(d). The interpretation is confined to the chosen set of descriptors: in addition to the restriction to a finite set of wave vectors discussed above, the use of intensities discards the relative phase between P\boldsymbol{P} and A\boldsymbol{A}, so that states differing by a rigid shift of the hidden field with respect to the polarization are not distinguished.

It should be emphasized that the machine-learning step does not itself decide which phase is realized. The configurations sampled by Monte Carlo are compressed into a small set of representatives by the contrastive encoder, and these representatives are then used as initial conditions for a gradient-descent relaxation performed independently at each point of the (α,k)(\alpha,k) grid; the phase is assigned as the relaxed state of lowest energy. The selection criterion is thus energetic and deterministic, and the workflow cannot produce a spurious phase. The contrastive step replaces either a manual choice of candidate ansatzes or a large number of random initial conditions by a small set of physically distinct candidates. On the other hand, a phase that is never visited during the Monte Carlo sampling cannot enter the set of representatives and will not be tested in the relaxation, so the procedure is exposed to false negatives rather than false positives. A related concern arises for phases that are sampled only rarely, since a cluster supported by very few samples may be absorbed into a neighboring one. In such cases an analysis of the descriptor vectors prior to training, targeting outliers in the Monte Carlo data, could be used to flag weakly represented states before the contrastive step.

Our workflow identified distinct configurations present in diagram 7. Based on the values of descriptors in each cluster we identified following phases. The paraelectric (PE) phase is the reference state, with all descriptors vanishing. The configuration is given by

rm,n=sm,n=ϕm,n=ψm,n=0(20)r_{m,n}=s_{m,n}=\phi_{m,n}=\psi_{m,n}=0 \tag*{(20)}

The ferroelectric (FE) phase is characterized by a nonzero IP(QΓ)I_{\mathrm{P}}(Q^{\Gamma}) and no modulation at any finite wave vector. FE configuration satisfies one of the orderings

rm,n=P, sm,n=ϕm,n=ψm,n=0,(21)r_{m,n}=P,\ s_{m,n}=\phi_{m,n}=\psi_{m,n}=0, \tag*{(21)}
sm,n=P, rm,n=ϕm,n=ψm,n=0,(22)s_{m,n}=P,\ r_{m,n}=\phi_{m,n}=\psi_{m,n}=0, \tag*{(22)}

where PP is the magnitude of local polarization, which can be obtained by minimization of the total potential (2) for given (α,κ)(\alpha, \kappa). The transition of FE towards PE proceeds through a continuous decrease of PP, which is reflected in the arc-like structure of the corresponding region in the embedding space shown in Figure 6.

The two states AFE A and AFE A’ share the same antipolar pattern of the polarization field, with the dipoles modulated along one of the two diagonals of the lattice and a vanishing total polarization, but differ in the arrangement of the hidden field. In both states the hidden field carries a component at QΣQ^{\Sigma}, commensurate with the modulation of the polarization. They differ in the additional component that accompanies it: in AFE A the hidden field has a further contribution at QMQ^{M}, corresponding to a checkerboard alternation, whereas in AFE A’ the additional contribution is uniform, at QΓQ^{\Gamma}. The AFE A phase configuration can be expressed as

rm,n=0,sm,n=P2cos⁡(π2(n−m+3/2)),ϕm,n=A(−1)n+m,ψm,n=A(−1)⌊(n−m)/2⌋,(23)\begin{aligned} r_{m,n} &= 0,\\ s_{m,n} &= P\sqrt{2}\cos\left(\frac{\pi}{2}(n-m+3/2)\right),\\ \phi_{m,n} &= A(-1)^{n+m},\\ \psi_{m,n} &= A(-1)^{\lfloor(n-m)/2\rfloor}, \tag*{(23)} \end{aligned}

where AA is the size of the hidden field vectors computable by the minimization of potential (2). States AFE A and AFE A’ are stable over the same region of the (α,κ)(\alpha,\kappa) plane and are degenerate in energy. This degeneracy arises from a symmetry operation that preserves the energy by flipping the hidden field vectors according to the following transformation,

ϕm,n′=(−1)n+m+1ϕm,n,ψm,n′=(−1)n+m+1ψm,n(24)\begin{aligned} \phi'_{m,n} &= (-1)^{n+m+1}\phi_{m,n},\\ \psi'_{m,n} &= (-1)^{n+m+1}\psi_{m,n} \tag*{(24)} \end{aligned}

Thus, AFE A and AFE A’ represent two realizations of a single phase rather than two distinct regions of the phase diagram. They are nevertheless resolved as separate clusters by the descriptors, which distinguish them through the modulation of the hidden field, a distinction that is by construction invisible to a classification based on energy alone.

The remaining phase, AFE B, has both diagonal components of the polarization present simultaneously, so that neighboring dipoles are mutually perpendicular while the total polarization still vanishes. The configuration is given by

rm,n=P2(−(−1)n+(−1)m),sm,n=P2((−1)n+(−1)m),ϕm,n=Acos⁡(π2(n+m+1)),ψm,n=Acos⁡(π2(n−m−1)).\begin{aligned} r_{m,n} &= \frac{P}{2}\left(-(-1)^n+(-1)^m\right),\\ s_{m,n} &= \frac{P}{2}\left((-1)^n+(-1)^m\right),\\ \phi_{m,n} &= A\cos\left(\frac{\pi}{2}(n+m+1)\right),\\ \psi_{m,n} &= A\cos\left(\frac{\pi}{2}(n-m-1)\right). \end{aligned}

Two of these phases, AFE A and AFE A’, correspond to the ↑↑↓↓ antipolar pattern of the Pbam structure commonly associated with PbZrO3_3 [23, 39, 40, 41]. On the other hand, in AFE B the polarization direction rotates from site to site, so that the field lines close into a periodic array of loops. Flux-closure configurations of this kind have been reported in PbZrO3_3 around antivortex cores at ferroelastic twin boundaries [42], although there they occur as a local structure bound to a domain wall rather than as a bulk periodic state.

Summary

In this work, we proposed a data-driven workflow for unsupervised construction of a phase diagram, which we successfully applied to obtain a phase diagram of the suggested 2D PZO model. The workflow utilized contrastive learning, incorporating both the microscopic field configurations and the relationships of physically motivated descriptors.

The two explored contrastive learning objectives were classical contrastive learning and soft-label contrastive learning. In the classical method, preliminary labels were found from dimensional reduction and clustering of descriptor vectors χ\chi and they were used to generate negative and positive pairs of samples. In the soft contrastive learning, the algorithm used χ\chi vectors directly and the soft label was calculated as their cosine distance.

We have shown that both contrastive learning objectives were able to retrieve structure from the metastable configurations and suggest good initial data for the gradient-descent based optimization algorithm. After final configuration optimization, both obtained encoders provided latent space representations of the ground state configurations that formed a well-structured clusters corresponding to the paraelectric, ferroelectric and few antiferroelectric configurations. Notably, the workflow resolved AFE A and AFE A’ as separate clusters although the two states are degenerate in energy and occupy the same region of the (α,κ)(\alpha,\kappa) plane.

The workflow itself is not tied to the particular potential studied here. It requires only a sampling procedure for the configurations and a set of symmetry-adapted descriptors, and can therefore be applied to other lattice models whose order parameters are not known in advance. The main limitation lies in the descriptor set, which has to be chosen beforehand; replacing it by descriptors learned directly from the configurations, subject to the symmetry of the lattice, is a natural direction for further work.

Finally, a natural extension concerns the final step of the workflow, which at present still relies on human input: the analytical ansatz for each phase is inferred by inspection of the relaxed configurations. When the potential is known explicitly, this step could be automated by applying symbolic regression to the configurations belonging to each cluster, and the resulting candidate expressions could then be verified directly by substituting them into the potential and testing their stability under given conditions. The phase diagram would thus be constructed together with closed-form descriptions of the phases it contains.

Data and code availability

The configurations obtained from simulated annealing, together with the precomputed descriptors, are available at Ref. [27]. The implementations of the descriptor calculation and of the contrastive and soft contrastive training pipelines are openly available at Ref. [33].

Acknowledgement

We acknowledge the assistance provided by the Operational Programme Johannes Amos Comenius of the Ministry of Education, Youth and Sport of the Czech Republic, within the frame of project Ferroic Multifunctionalities (FerrMion) [project No. CZ.02.01.01/00/22.008/0004591], co-funded by the European Union.

Encoder architecture

The input configurations are sampled on a 8×88 \times8 grid with 4 channels corresponding to the 4 joint components of fields P\mathbf{P} and A\mathbf{A}. Due to the image-like qualities of the input data, we naturally opted for a convolutional neural network as the encoder.

A diagram of the used architecture can be seen in Figure 10. We used two convolutional layers followed by averaged pooling and finally applying three fully connected layers. The convolutions were performed using 3×33 \times3 kernels with stride 1. The circular padding in the first layer respects the periodic boundary conditions. Each layer except the final one is followed by a batch normalization (BN) and SiLU activation. The fully connected layers are also regularized using dropouts. After the final layer, the embedding vectors are normalized. The dimensions of the layers are specified in the figure.

Encoder architecture diagram

Figure 10. Encoder architecture diagram. Each box specifies a layer of neurons including the signal processing. The numbers in the brackets correspond to the output dimension of given layer. Abbreviations are explained in the main text.

Dimension of embeddings

We analyzed the dimensions of embeddings across both the classical and soft contrastive branches of our workflow. The main motivation was an apparent dimensional collapse in the classical contrastive learning case for embedding dimension D=3D = 3, where the embeddings almost perfectly spanned a 2-dimensional hyperplane.

The main tool in this case was the principal component analysis (PCA), which performs a change of basis, so that the resulting axes align with the directions of greatest variance in the data. The transformed data is known as the principal components (PC). The variances associated with each PC are denoted λi\lambda_i, where i∈Ni \in\mathbb{N},

so that the numbers are ordered in descending order, λ1≥λ2≥⋯≥λN\lambda_1 \ge\lambda_2 \ge\cdots\ge\lambda_N. We performed a parameter sweep by letting both encoders train with different initial conditions. We changed the target embedding dimension D∈{3,4,6,8,12}D \in\{3,4,6,8,12\}, while keeping other hyperparameters identical to the parameters of the runs used to obtain the results in § 1.3. For each of the dimensions, we repeated the training ten times.

The results are given in Figure 9. Panel (a) shows value of the explained variance ratio, λ3/∑kλk\lambda_3/\sum_k \lambda_k, in logarithmic scale for each embedding dimension across both methods. The highlighted points are median values and transparent points display individual runs across different seeds. We can observe a gap between the values of soft and classical contrastive methods, with the soft method having higher values of λ3/∑kλk\lambda_3/\sum_k \lambda_k by about two orders of magnitude for D≤8D \le8. For the soft contrastive branch, the values plateau above D≥4D \ge4 at about 7.43×10−27.43 \times10^{-2}. Panel (b) shows general λi/∑kλk\lambda_i/\sum_k \lambda_k, where i∈{1,2,…,12}i \in\{1,2,\ldots,12\}, for D=12D = 12. For both methods, most of the variance is carried by the first two principal components PC1 and PC2, more precisely 99.96% for classical contrastive and 99.278% for soft contrastive.

Results of PCA showing the explained variance ratios for both encoders

Figure 9. Results of PCA showing the explained variance ratios λi/∑kλk\lambda_i/\sum_k \lambda_k. Tests were performed across 10 independent training runs for both encoders. (a) Explained variance ratio of the third largest PC, λ3/∑kλk\lambda_3/\sum_k \lambda_k, for varying embedding dimension DD. (b) Explained variance ratios λi/∑kλk\lambda_i/\sum_k \lambda_k, where i∈{1,2,…,12}i \in\{1,2,\ldots,12\} for D=12D = 12.

As for our choice of embedding dimensions, we opted for D=3D = 3 in the case of soft contrastive learning due to increased ability to show difference between the AFE A and AFE A’ configurations. When we set the embedding dimension to D=2D = 2, the embeddings of the two AFE configurations overlapped, rendering the clustering algorithm unable to reliably distinguish them. On the other hand, the classical contrastive algorithm accurately found all the expected phases for D=2D = 2. For D=3D = 3, the classical embedding remained effectively two-dimensional, whereas the soft-contrastive one retained a small but consistently non-zero third direction, e.g. Figure 5. However, the PCA results show that at D=3D = 3 both sets of embeddings carry little variance in the third principal component, even in the seemingly non-degenerate result obtained in the soft-contrastive learning case.

References

References

  1. [1]G. Carleo, I. Cirac, K. Cranmer, L. Daudet, M. Schuld, N. Tishby, L. Vogt-Maranto, and L. Zdeborová, Machine learning and the physical sciences, Reviews of Modern Physics 91, 045002 (2019).DOI
  2. [2]A. Dawid, J. Arnold, B. Requena, A. Gresch, M. Płodzień, K. Donatella, K. A. Nicoli, P. Stornati, R. Koch, M. Büttner, R. Okula, G. Muñoz-Gil, R. A. Vargas-Hernández, A. Cervera-Lierta, J. Carrasquilla, V. Dunjko, M. Gabrié, P. Huembeli, E. van Nieuwenburg, F. Vicentini, L. Wang, S. J. Wetzel, G. Carleo, E. Greplová, R. Krems, F. Marquardt, M. Tomza, M. Lewenstein, and A. Dauphin, Machine Learning in Quantum Sciences (Cambridge University Press, 2025).DOI
  3. [3]L. Wang, Discovering phase transitions with unsupervised learning, Physical Review B 94, 195105 (2016).DOI
  4. [4]I. A. Iakovlev, O. M. Sotnikov, and V. V. Mazurenko, Supervised learning approach for recognizing magnetic skyrmion phases, Physical Review B 98, 174411 (2018).DOI
  5. [5]L. Frk, P. Baláž, E. Archęmaśvili, and M. Žonda, Unsupervised machine learning phase classification for the Falicov-Kimball model, Physical Review B 111, 205116 (2025).DOI
  6. [6]M. Mezera, J. Menšíková, P. Baláž, and M. Žonda, Neural network quantum states analysis of the Shastry-Sutherland model, SciPost Physics Core 6, 088 (2023).DOI
  7. [7]E. P. L. van Nieuwenburg, Y.-H. Liu, and S. D. Huber, Learning phase transitions by confusion, Nature Physics 13, 435 (2017), arXiv:1610.02048 [cond-mat.dis-nn].DOI
  8. [8]M. Richter-Laskowska, M. Kurpas, and M. M. Maśka, Learning by confusion approach to identification of discontinuous phase transitions, Physical Review E 108, 024113 (2023).
  9. [9]J. Arnold, F. Schäfer, M. Žonda, and A. U. J. Lode, Interpretable and unsupervised phase classification, Physical Review Research 3, 033052 (2021).DOI
  10. [10]J. Arnold and F. Schäfer, Replacing Neural Networks by Optimal Analytical Predictors for the Detection of Phase Transitions, Physical Review X 12, 031044 (2022).DOI
  11. [11]W. Hu, R. R. P. Singh, and R. T. Scalettar, Discovering phases, phase transitions, and crossovers through unsupervised machine learning: A critical examination, Phys. Rev. E 95, 062122 (2017).DOI
  12. [12]S. J. Wetzel, Unsupervised learning of phase transitions: From principal component analysis to variational autoencoders, Phys. Rev. E 96, 022140 (2017).DOI
  13. [13]T. Chen, S. Kornblith, M. Norouzi, and G. Hinton, A Simple Framework for Contrastive Learning of Visual Representations (2020), arXiv:2002.05709 [cs] version: 3.arxiv.org/abs/2002.05709
  14. [14]K. He, H. Fan, Y. Wu, S. Xie, and R. Girshick, Momentum contrast for unsupervised visual representation learning (2020), arXiv:1911.05722 [cs.CV].
  15. [15]A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, G. Krueger, and I. Sutskever, Learning transferable visual models from natural language supervision (2021), arXiv:2103.00020 [cs.CV].arxiv.org/abs/2103.00020
  16. [16]A. van den Oord, Y. Li, and O. Vinyals, Representation learning with contrastive predictive coding (2019), arXiv:1807.03748 [cs.LG].arxiv.org/abs/1807.03748
  17. [17]A. Baevski, H. Zhou, A. Mohamed, and M. Auli, wav2vec 2.0: A framework for self-supervised learning of speech representations (2020), arXiv:2006.11477 [cs.CL].arxiv.org/abs/2006.11477
  18. [18]T. Gao, X. Yao, and D. Chen, SimCSE: Simple contrastive learning of sentence embeddings (2022), arXiv:2104.08821 [cs.CL].arxiv.org/abs/2104.08821
  19. [19]X.-Q. Han, S.-S. Xu, Z. Feng, R.-Q. He, and Z.-Y. Lu, Framework for Contrastive Learning Phases of Matter Based on Visual Representations, Chinese Physics Letters 40, 10.1088/0256-307X/40/2/027501 (2023).DOI
  20. [20]H. Liu and B. Dkhil, A brief review on the model antiferroelectric pbzro3 perovskite-like material, Zeitschrift für Kristallographie - Crystalline Materials 226, 163 (2011).DOI
  21. [21]S. E. Reyes-Lillo and K. M. Rabe, Antiferroelectricity and ferroelectricity in epitaxially strained pbzro3 from first principles, Phys. Rev. B 88, 180102 (2013).
  22. [22]A. K. Tagantsev, K. Vaideeswaran, S. B. Vakhrushev, A. V. Filimonov, R. G. Burkovsky, A. A. Shaganov, D. Andronikova, A. I. Rudskoy, A. Q. R. Baron, H. Uchiyama, D. Chernyshov, A. Bosak, Z. Ujma, K. Roleder, A. Majchrowski, J.-H. Ko, and N. Setter, The origin of antiferroelectricity in PbZrO3, Nature Communications 4, 2229 (2013).DOI
  23. [23]J. Hlinka, T. Oštapchuk, E. Buixaderas, C. Kadlec, P. Kuzel, I. Gregora, J. Kroupa, M. Savinov, A. Klic, J. Drahokoupil, I. Etxebarria, and J. Dec, Multiple Soft-Mode Vibrations of Lead Zirconate, Phys. Rev. Lett. 112, 197601 (2014).DOI
  24. [24]G. Shirane, E. Sawaguchi, and Y. Takagi, Dielectric Properties of Lead Zirconate, Physical Review 84, 476 (1951).
  25. [25]C. A. Randall, Z. Fan, I. Reaney, L.-Q. Chen, and S. Trolier-McKinstry, Antiferroelectrics: History, fundamentals, crystal chemistry, crystal structures, size effects, and applications, Journal of the American Ceramic Society 104, 3775 (2021), _eprint: https://ceramics.onlinelibrary.wiley.com/doi/pdf/10.1111/jace.17899.DOI
  26. [26]F. Jona, G. Shirane, F. Mazzi, and R. Pepinsky, X-Ray and Neutron Diffraction Study of Antiferroelectric Lead Zirconate, PbZrS{\mathrm{O}}_{3}, Physical Review 105, 489 (1957).
  27. [27]V. Beneš, P. Baláž, and J. Hlinka, Soft contrastive learning for unsupervised discovery of phases of matter: Dataset, 10.5281/zenodo.19681601 (2026).arxiv.org/abs/2610.08116
  28. [28]M. Ester, H.-P. Kriegel, J. Sander, and X. Xu, A density-based algorithm for discovering clusters in large spatial databases with noise, in Proceedings of the Second International Conference on Knowledge Discovery and Data Mining (KDD-96) (AAAI Press, 1996).
  29. [29]F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay, Scikit-learn: Machine learning in Python, Journal of Machine Learning Research 12, 2825 (2011).arxiv.org/abs/1201.0490
  30. [30]R. Hadsell, S. Chopra, and Y. LeCun, Dimensionality reduction by learning an invariant mapping, in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR) (2006).DOI
  31. [31]S. Chopra, R. Hadsell, and Y. LeCun, Learning a similarity metric discriminatively, with application to face verification, in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR) (2005).DOI
  32. [32]J. Thoma, D. P. Paudel, and L. Van Gool, Soft contrastive learning for visual localization, in Proceedings of the 34th International Conference on Neural Information Processing Systems (NeurIPS 2020) (2020) vancouver, Canada.
  33. [33]V. Beneš and P. Baláž, contrastive-phase-discovery: contrastive and soft contrastive learning for unsupervised phase-diagram construction, https://github.com/benesvit/contrastive-phase-discovery (2026).
  34. [34]C.-Y. Wu, R. Manmatha, A. J. Smola, and P. Krähenbühl, Sampling matters in deep embedding learning, in Proceedings of the IEEE International Conference on Computer Vision (ICCV) (2017).arxiv.org/abs/1706.07567
  35. [35]R. J. G. B. Campello, D. Moulavi, and J. Sander, Density-Based Clustering Based on Hierarchical Density Estimates, in Advances in Knowledge Discovery and Data Mining, edited by J. Pei, V. S. Tseng, L. Cao, H. Motoda, and G. Xu (Springer, Berlin, Heidelberg, 2013).DOI
  36. [36]P. Virtanen, R. Gommers, T. E. Oliphant, M. Haberland, T. Reddy, D. Cournapeau, E. Burovski, P. Peterson, W. Weckesser, J. Bright, S. J. van der Walt, M. Brett, J. Wilson, K. J. Millman, N. Mayorov, A. R. J. Nelson, E. Jones, R. Kern, E. Larson, C. J. Carey, Í. Polat, Y. Feng, E. W. Moore, J. VanderPlas, D. Laxalde, J. Perktold, R. Cimrman, J. Henriksen, E. A. Quintero, C. R. Harris, A. M. Archibald, A. H. Ribeiro, F. Pedregosa, P. van Mulbregt, and SciPy 1.0 Contributors, SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python, Nature Methods 17, 261 (2020).
  37. [37]T. S. Cohen and M. Welling, Group equivariant convolutional networks, in Proceedings of the 33rd International Conference on Machine Learning, Proceedings of Machine Learning Research, Vol. 48 (PMLR, New York, USA, 2016) arXiv:1602.07576 [cs.LG].arxiv.org/abs/1602.07576
  38. [38]L. Jing, P. Vincent, Y. LeCun, and Y. Tian, Understanding dimensional collapse in contrastive self-supervised learning, in International Conference on Learning Representations (2022).arxiv.org/abs/2110.09348
  39. [39]E. Sawaguchi, H. Maniwa, and S. Hoshino, Antiferroelectric structure of lead zirconate, Physical Review 83, 1078 (1951).DOI
  40. [40]D. L. Corker, A. M. Glazer, J. Dec, K. Roleder, and R. W. Whatmore, A re-investigation of the crystal structure of the perovskite pbzro₃ by x-ray and neutron diffraction, Acta Crystallographica Section B 53, 135 (1997).DOI
  41. [41]J. Íñiguez, M. Stengel, S. Prosandeev, and L. Bellaiche, First-principles study of the multimode antiferroelectric transition in pbzro₃, Phys. Rev. B 90, 220103(R) (2014).DOI
  42. [42]Y. Liu, H. Zhang, K. Shapovalov, R. Niu, J. M. Cairney, X. Liao, K. Roleder, A. Majchrowski, J. Arbiol, P. Ghosez, and G. Catalan, Vortices and antivortices in antiferroelectric pbzro₃, Nature Materials 24, 1359 (2025).arxiv.org/abs/2502.05852

AI tools statement

No AI-use declaration is available for this version in Valency.

The available record does not establish whether AI systems or models contributed to this work.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

Code, data, proofs and workflows the authors linked for testing, review and reproduction. These links are part of this work’s metadata and are released under the same license as the rest of that metadata. Valency doesn’t host the files; each keeps the license set where it’s hosted.

Pick where to look, or just type