Detection of Berezinskii--Kosterlitz--Thouless transitions for the
  two-dimensional $q$-state clock models with neural networks
Using the technique of supervised neural networks (NN), we study the phase
transitions of two-dimensional (2D) 6- and 8-state clock models on the square
lattice. The employed NN has only one input layer, one hidden layer of 2
neurons, and one output layer. In addition, the NN is trained without any prior
information about the considered models. Interestingly, despite its simple
architecture, the built supervised NN not only detects both the two
Berezinskii--Kosterlitz--Thouless (BKT) transitions but also determines the
transition temperatures with reasonable high accuracy. It is remarkable that a
NN, which has an extremely simple structure and is trained without any input
from the studied models, can be employed to study topological phase
transitions. The outcomes shown here as well as those previously demonstrated
in the literature suggest the feasibility of constructing a universal NN that
is applicable to investigate the phase transitions of many systems.
Yaun-Heng Tseng, Fu-Jiun Jiang
Detection of Berezinskii-Kosterlitz-Thouless transitions for the two-dimensional \(q\)-state clock models with neural networks

###### Abstract

Using the technique of supervised neural networks (NN), we study the phase transitions of two-dimensional (2D) 6- and 8-state clock models on the square lattice. The employed NN has only one input layer, one hidden layer of 2 neurons, and one output layer. In addition, the NN is trained without any prior information of the considered models. Interestingly, despite its simple architecture, the built supervised NN not only detects both the two Berezinskii-Kosterlitz-Thouless (BKT) transitions, but also determines the transition temperatures with reasonable high accuracy. It is remarkable that a NN, which has extremely simple structure and is trained without any input of the studied models, can be employed to study topological phase transitions. The outcomes shown here as well as those previously demonstrated in the literature suggest the feasibility of constructing a universal NN that is applicable to investigate the phase transitions of many systems.

## I Introduction

When phase transitions are concerned, apart from the well-known first- and second-order phase transitions which are related to spontaneous symmetry breaking, there is a novel type of phase transitions associated with topological defects [1; 2; 3; 4; 5]. Unlike the first- and second order phase transitions which are characterized by the behavior of the so-called order parameters, this kind of novel phase transitions, namely the Berezinskii-Kosterlitz-Thouless (BKT) transitions, cannot be understood quantitatively by any order parameter. Two-dimensional (2D) \(XY\) model on the square lattice is a typical model exhibiting the BKT transition.

The 2D \(q\)-state clock models are simplified version of the 2D \(XY\) model, Instead of continuous spin values like those of the \(XY\) spin, the clock spins are discrete. These models have very rich phase structures, hence have been studied extensively in the literature [6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21]. For \(q\leq 4\), the \(q\)-state clock models exhibit one second-order (Ising-type) phase transition from the ferromagnetic phase to the disordered phase. For \(q\geq 5\), the models have two BKT-type transitions: one from the long-range order phase (LRO) to the pseudo-long-range order phase (PLRO, and the related transition temperature has a symbol of \(T_{c}^{2}\)) and the other from PLRO to the paramagnetic phase (The associated critical temperature is denoted as \(T_{c}^{1}\)). The 2D \(XY\) model is recovered from the \(q\)-state clock model when \(q\rightarrow\infty\). It is well-established that the values of \(T_{c}^{1}\sim 0.892\) do not change appreciably with \(q\).

Recently, techniques of Machine learning (ML) have been applied to many fields of physics [22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36; 37; 38; 39; 40; 41; 42; 43; 44; 45; 46]. In particular, neural networks (NN) are considered to classify various phases of many-body systems. Both supervised and unsupervised NN have been demonstrated to be able to determine the critical points of phase transitions accurately for numerous models [28; 29; 32; 45].

The conventional NNs known in the literature have very complicated architectures. Typically these NNs have various layers and each layer has many independent nodes (neurons). Moreover, the associated trainings use real physical quantities, such as the spin configurations or the correlation functions, as the training sets. As a result, conducting studies with these conventional NNs demands huge amount of computer memory and is very time consuming. In particular, the investigations are limited to small to intermediate system sizes. Because of this, the detection of topological phase transitions with the methods of NN is more challenging when compared with the phase transitions related to spontaneous symmetry breaking.

Unlike the conventional NNs, extremely simple supervised and unsupervised NNs consisting of one input layer, one hidden layer, and one output layer are constructed in Refs. [45; 46; 47]. In addition, the trainings for these unconventional NNs use no information of the studied systems. Instead, two artificially made one-dimensional (1D) configurations are employed as the training sets. As a result, the associated training procedure is easier to implement and is much more efficient than the conventional approaches. We would like to emphasize the fact that no inputs of the considered systems, such as the vortex configurations, the histograms of spin orientations, the spin correlation functions, and the raw spin configurations, are used for training these unconvetoinal NNs. It is demonstrated that the NNs resulting from these unusual training strategies are very efficient. In other words, it takes much less time to conduct the associated NN calculations. Particularly, these unconventional NNs can be considered to detect the phase transitions of many three-dimensional (3D) and two-dimensional (2D) models. Finally, there is also no system size restriction for these unconventional NNs as well and they can be recycled to study the phase transitions of other systems not considered in Refs. [45; 46; 47].

Between the conventional supervised and unsupervised NNs, unsupervised ones are preferred when the detection of phase transitions are considered. This is because no
prior information of critical point of the studied system is needed when one carries out an unsupervised investigation. In other words, less efforts in preparation is required when an unsupervised study is performed.

For the mentioned unconventional supervised and unsupervised NNs, the trainings are conducted without any prior information or input from the considered models. Consequently, supervised one will be a better choice since it takes less time to complete the associated training and prediction processes. Due to this fact, in this study we directly adopt the supervised NN of Ref. [47] to study the phase transitions of 2D 6- and 8-state clock models.

Interestingly, the simple supervised NN employed here not only detect both the BKT-type transitions of the 6- and 8-state clock models, it also estimates the transition temperatures with reasonable good accuracy. It is remarkable that a NN trained without any input of the considered systems can successfully map out the non-trivial topological phase structures of these studied models. Similar to the unsupervised NN considered in Ref. [46], it is anticipated that the simple supervised NN used here can be directly applied to study the phase transitions of other models, such as the three-dimensional (3D) \(O(3)\) model, the 2D generalized \(XY\) model, the one-dimensional (1D) Bose-Hubbard model, and the 2D \(q\)-state ferromagnetic Potts model, without carrying out any re-training.

The rest of the paper is organized as follows. After the introduction, the considered models and the built supervised NN are described in Secs. II and III, respectively. Then we present the NN outcomes in Sec. IV. In particular, the critical temperatures of the studied phase transitions are determined with good precision. Finally, we conclude our investigation in Sec. V.

## II The considered models

The Hamiltonian of the 2D \(q\)-state clock model on the square lattice considered here has the following expression [20]

\[H=-\sum_{\langle ij\rangle}\vec{\sigma}_{i}\cdot\vec{\sigma}_{j}, \tag{1}\]

where \(\langle ij\rangle\) refers to nearest neighbor sites \(i\) and \(j\), and \(\vec{\sigma}_{i}\) is a vector at site \(i\) with \(\vec{\sigma}_{i}=(\cos\theta_{i},\sin\theta_{i})\). Here \(\theta_{i}=\frac{2\pi k}{q}\) with \(k=1,2,...,q-2,q-1\).

## III The constructed NN

The supervised NN, namely a multilayer perceptron (MLP) is built using the keras and tensorflow [48; 49]. In addition, it has extremely simple architecture. Specifically, the constructed NN has only one input layer, one hidden layer of two neurons, and one output layer. The considered algorithm and optimizer are minibatch and adam (learning rate is set to 0.05), respectively. The activation function ReLU (softmax) is applied in the hidden (output) layer. The definitions of ReLU and softmax are given by

\[\text{ReLU}(x)=\text{max}(0,x), \tag{2}\] \[\left(\text{softmax}(x)\right)_{i}=\frac{e^{x_{i}}}{\sum_{j}e^{x _{j}}}. \tag{3}\]

One-hot encoding, flattening, and \(L_{2}\) regularization are used as well. Finally, the loss function considered is the categorical crossentropy \(C\) which is defined as

\[C=-\frac{1}{n}\sum_{x}\sum_{j}^{2}y_{j}\ln a_{j}, \tag{4}\]

where \(n\) is the number of objects included in each batch and \(a_{j}\) are the outcomes obtained after applying all the layers. Moreover, \(x\) and \(y\) are the training inputs and the corresponding designed labels, respectively.

Figure 1 is adopted from Ref. [47] and is the cartoon representation of the employed supervised NN.

The training of the supervised NN is conducted using 200 copies of two one-dimensional artificially made configurations (Each of which consists of 200 sites) as the training set. These configurations contain no information from the considered models. Specifically, one (the other) configuration has 1 (0) as the values for all of its elements. Due to the used training set, the labels employed are two-component vectors (0,1) and (1,0). On a server with two opteron 6344 and 96G memory, the training takes only 24 seconds.

## IV Numerical results

### Preparation of configurations for the NN prediction

Using the Wolff algorithm [50], we have generated several thousand configurations for the 6- and 8-state clock models with various temperatures \(T\) and linear system sizes \(L\). For each produced clock configuration, the angles \(\theta\) of 2000 sites, which are randomly chosen, are stored. From these stored variables, two hundred are picked randomly and the resulting \(\theta\) mod \(\pi\) are used to build a 1D configuration consisiting of 200 sites which will then be employed for the NN prediction.

### The NN results associated with 6-state clock model

The magnitude \(R\) of the NN output vectors as functions of \(T\) for various \(L\) for the 6-state clock model are shown in fig. 2. The figure implies that there are possibly
two phase transitions: one before and one after \(T\sim 0.6\). The dashed vertical line is the expected transition temperature \(T_{c}^{2}\) from LRO to PLRO. From the figure, one observes that there is a range of \(T\) where data of various \(L\) collapse to form a single (universal) curve. In addition, such a universal curve seems to end at \(T_{c}^{2}\). This can be considered as a NN method of estimating \(T_{c}^{2}\). Based on such an idea, the NN prediction for \(T_{c}^{2}\) is found to be \(0.67(2)\) (see fig. 3). The obtained \(T_{c}^{2}\) agrees reasonably well with the MC result of \(0.681\) determined in Ref. [20]. It should be pointed out that this NN method of calculating \(T_{c}^{2}\) is not of high precision. Despite this, it leads to a NN prediction of \(T_{c}^{2}\) with acceptable quality.

After establishing a NN method of estimating \(T_{c}^{2}\), we turn to the determination of the transition temperature \(T_{c}^{1}\) from PLRO to paramagnetic phase. This transition is similar to that of the 2D classical \(XY\) model. Hence we will use the standard analysis procedure to calculate \(T_{c}^{1}\). First of all, one notices that \(R\) will take the value of \(1/\sqrt{2}\sim 0.70712\) at extremely high temperatures. As a result, for a given \(L\), we will consider the intersection between the related \(R\) data (as a function of \(T\)) and the curve of \(2T/\pi q+0.70712\) with \(q=6\) to be the estimated \(T_{c}^{1}(L)\). With this approach, \(T_{c}^{1}(L)\) as a function of \(1/L\) is shown in fig. 4.

It is anticipated that the \(T_{c}^{1}(L)\) should fulfill the following ansatz [51; 52]

\[T_{c}^{1}(L)=T_{c}^{1}+\frac{b}{\left(\log\left(L\right)\right)^{2}}, \tag{5}\]

where \(b\) is some constant. A fit using the data of fig. 4 and above ansatz leads to \(T_{c}^{1}=0.890(5)\). The obtained \(T_{c}^{1}=0.890(5)\) agrees quantitatively with the expected \(T_{c}^{1}\sim 0.892\).

We would like to point out that analytically the finite-size scaling ansatz for the transition temperature \(T_{\rm BKT}\)

Figure 1: The MLP employed in this study.

Figure 3: The smooth single (universal) curve formed by data collapse of various \(L\) for the 6-state clock model. The vertical dashed line is the expected \(T_{c}^{2}\).

Figure 2: \(R\) as functions of \(T\) for various \(L\) for the 6-state clock model. The dashed horizontal line is \(0.70712\). The vertical dashed and solid lines are the expected transition temperatures \(T_{c}^{2}\) and \(T_{c}^{3}\). The tilted line is \(2T/(\pi q)+0.70712\) with \(q=6\).
of a BKT phase transition is given by

\[T_{\rm BKT}(L)=T_{\rm BKT}+a\frac{T_{\rm BKT}}{(\log{(L)}+c)^{2}}, \tag{6}\]

where \(a\) and \(c\) are some constants. A fit using this ansatz and the data of fig. 4 leads to \(T_{c}^{1}=0.893(15)\) which also matches well with \(T_{c}^{1}\sim 0.892\).

### The NN results associated with 8-state clock model

The magnitude \(R\) of the NN output vectors as functions of \(T\) for various \(L\) for the 8-state clock model are shown in fig. 5. The conventions of the dashed and solid lines in the figure are similar to those used in fig 2. Following the same procedures for determining both the transition temperatures \(T_{c}^{2}\) and \(T_{c}^{1}\) of the 6-state clock model, the values of \(T_{c}^{2}\) and \(T_{c}^{1}\) for the 8-state clock model are calculated to be \(0.40(2)\) and \(0.884(7)\), respectively, sees figs. 6 and 7. We would like to point out that the tilted curve in fig. 5 is given by \(2T/\left(\pi q\right)+0.70712\) with \(q=8\) and \(T_{c}^{1}=0.884(7)\) is obtained with data of \(192\leq L\leq 1024\). The obtained \(T_{c}^{2}=0.40(2)\) is in good agreement with \(T_{c}^{2}=0.418\) found in Ref. [20]. Moreover, the determined \(T_{c}^{1}\) of the 8-state clock model matches nicely with the expected \(T_{c}^{1}\sim 0.892\) as well.

Finally, with a fit using equation (6) and data of fig. 7 (\(64\leq L\leq 1024\)), we arrive at \(T_{c}^{1}=0.890(15)\).

## V Discussions and conclusions

In this study, we calculate the transition temperatures \(T_{c}^{1}\) and \(T_{c}^{2}\) of the 6- and 8-state clock models using the technique of supervised NN. In particular, the employed supervised NN has extremely simple architecture, namely it consists of one input layer, one hidden layer of two neurons, and one output layer. The supervised NN is trained without any input from the considered models.

By considering the magnitude \(R\) of the NN output vectors as functions of \(T\) and \(L\), the values of \(T_{c}^{1}\) and \(T_{c}^{2}\) are estimated using semi-experimental methods. The obtained NN outcomes of the transitions temperatures are in nice agreement with the corresponding results established in the literature.

Typically, one needs to construct a new NN whenever a new model or a different system size is considered. The outcomes shown in Refs. [45; 46] and here demonstrate that a NN with simple infrastructure can be recycled to investigate the phase transitions of many 3D and 2D models.

We would like to emphasize the fact that due to the unique features of the employed supervised NN, there is no system size restriction in our calculations. As a result, outcomes of \(L=1024\) can be reached with ease.

In Refs. [15; 20], two Binder ratios \(U_{4}\) and \(U_{m}\) are built to detect the the phase transitions associated with \(T_{c}^{1}\) and \(T_{c}^{2}\), respectively. It should be noticed that \(U_{4}\) (\(U_{m}\)) cannot be used for studying the phase transition related

Figure 6: The smooth single (universal) curve formed by data collapse of various \(L\) for the 8-state clock model. The vertical dashed line is the expected \(T_{c}^{2}\).

Figure 5: \(R\) as functions of \(T\) for various \(L\) for the 8-state clock model. The dashed horizontal line is \(0.70712\). The vertical dashed and solid lines are the expected transition temperatures \(T_{c}^{2}\) and \(T_{c}^{1}\). The tilted line is \(2T/(\pi q)+0.70712\) with \(q=8\).
to \(T_{c}^{2}\) (\(T_{c}^{1}\)). Particularly, one needs to analytically investigate the model in order to construct the suitable observables to calculate the transition temperatures. For the present study, one single quantity, namely \(R\) can reveal clear signals of both the transitions. The use of \(R\) is natural and does not require any prior investigation of the targeted system(s). This feature can be considered as one advantage of our NN approach.

For the traditional methods, one can directly use the associated analytic predictions to perform the finite-size scaling analysis to extract the relevant physical quantities such as the critical points. For the NN method, such theoretical formulas typically do not exist and one has to rely on semi-experimental ansatzes to conduct the tasks. In particular, to establish these semi-experimental ansatzes requires certain efforts of investigations, and the employed ansatzes may not be applicable to all cases. From this point of view, the NN method is still in the developing phase and there is room for improvement.

Finally, we would like to emphasize the fact that similar to the autoencoder and the generative adversarial network constructed in Ref. [46], it is anticipated that the simple supervised NN employed in this study can be directly applied to study the phase transitions of other models, such as the three-dimensional (3D) \(O(3)\) model, the 2D generalized \(XY\) model, the one-dimensional (1D) Bose-Hubbard model, and the 2D \(q\)-state ferromagnetic Potts model. In other words, it is likely that one can construct a universal NN that is applicable to investigate the phase transitions of many systems.

## Acknowledgement

Partial support from National Science and Technology Council (NSTC) of Taiwan (MOST 110-2112-M-003-015 and MOST 111-2112-M-003-011) is acknowledged.
