## Introduction

Non-Hermiticity naturally emerges in a broad range of scenarios1,2,3,4, and has been extensively studied in open quantum systems5,6,7,8, photonics systems with loss and gain9,10,11,12,13, and quasiparticles with finite lifetimes14,15,16,17,18, etc. Recently, the interplay between the non-Hermiticity and topological phases has attracted considerable attentions17,18,19,20,21,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,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62, giving rise to an emergent research frontier of non-Hermitian topological phases of matter in both theory and experiment. Non-Hermitian topological phases bear a number of unique features without Hermitian analogs, including the non-Hermitian skin effect38,40,42, unconventional bulk-boundary correspondence40, and funneling of light62. To establish the theory of non-Hermitian topological phase classification, previous works have adopted the typical homotopy-based approach akin to the Hermitian tenfold way, and classified the non-Hermitian topological phases into 38 classes60. It was later recognized that the non-Hermitian topological phases can be further classified based on the knot or link structures of the complex energy bands, which gave rise to the knotted topological phases57,58,59. More recently, the braiding of such complex band structure has been implemented in experiment56. Yet, hitherto it remains an ongoing challenge to completely classify the non-Hermitian topological phases from both theoretical and experimental aspects58,59,60,61,62,63,64,65.

Machine learning methods provide an alternative and promising approach to classify phases of matter66. Within the vein of learning topological phases, considerable strides have been made from both theoretical67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82 and experimental83,84,85,86,87,88 aspects, despite the fact that learning topological phases are more intricate than learning the symmetry-breaking ones due to the lack of local order parameters89. However, the above learning methods may not be straightforwardly extended to the non-Hermitian scenario owing to the skin effect90. This makes the machine learning non-Hermitian topological phases an intriguing task and a number of theoretical works, including both supervised and unsupervised methods, have been proposed recently90,91,92,93. The supervised learning methods require prior labeled samples, hence ruling out the capability of learning unknown phases. While the unsupervised learning can classify different topological phases from unlabeled raw data, without any prior knowledge about the underlying topological mechanism. Consequently, the unsupervised learning methods are more powerful in detecting unknown topological phases. One appealing unsupervised approach is based on the diffusion map94,95,96, which has been theoretically demonstrated effective in clustering both Hermitian72 and non-Hermitian90 topological phases. However, to date the capability of machine learning methods in classifying non-Hermitian topological phases has not been demonstrated in experiment.

Here, we report the experimental demonstration of unsupervised learning of non-Hermitian knotted phases with a NV center in diamond. Specifically, we utilize the dilation method65,97 to implement the desired non-Hermitian twister Hamiltonian with the NV center platform, where the electron spin constitutes the target system and a nearby 13C nuclear spin serves as an ancilla (Fig. 1a). Based on the non-unitary dynamics of the Hamiltonian with different parameters, we prepare an unlabeled data set (including 37 samples) with high fidelity by carrying out 3552 non-unitary evolutions. Then we exploit the diffusion map method to cluster these experimental samples into different knotted topological phases in an unsupervised manner. The learning result matches precisely with the theoretical predictions, which clearly showcases the the robustness of the diffusion map method against the experimental imperfections. Besides, with the implemented set of samples, we experimentally realize different knot structures of the twister model, which can serve as the indices for different non-Hermitian topological phases.

## Results

### The model

We consider the one dimensional (1D) non-Hermitian twister model under the periodic boundary condition, with the Hamiltonian taking the form57,

$$H(k)={{{\bf{d}}}}(k)\cdot {{{\boldsymbol{\sigma }}}}={{{\rm{i}}}}{m}_{1}{\sigma }_{z}+{m}_{2}{T}_{1}+{T}_{2},$$
(1)

where d(k) = (dx, dy, dz), σ = (σx, σy, σz) are the Pauli matrices, k denotes the 1D momentum in the first Brillouin zone, m1 and m2 are tunable parameters (we set  = 1 for simplicity), and $${T}_{n}=\left[\begin{array}{ll}0&{{{{\rm{e}}}}}^{{{{\rm{i}}}}nk}\\ 1&0\end{array}\right]$$. This model hosts three distinct topological phases with phase boundaries $${m}_{1}^{2}+{m}_{2}^{2}=1$$ and m2 = ± m1 − 1. In contrast to the typical homotopy-based approach for phase classification, these phases can be efficiently classified by the knot (link) structures of the complex-energy bands (braid homotopy), where the knot structure is embedded in the space spanned by $$({{{\rm{Re}}}}(E),{{{\rm{Im}}}}(E),k)$$, with E denoting the complex energy. Concretely, the three non-Hermitian topological phases of the twister model are indexed by the Hopf link, the unlink, and the unknot, respectively. The phase transition occurs when the knot structures of the complex bands change across the exceptional points57. It is worth noting that all of the three phases host the non-Hermitian skin effect since the corresponding bands have the point gaps, which indicate that the phase transition points are boundary condition sensitive. A sketch of the phase diagram of the non-Hermitian twister model is shown in Fig. 1b.

### Experimental implementation

Experimentally simulating the non-Hermitian Hamiltonian is challenging, since the dynamical evolution of closed systems is usually governed by the Hermitian Hamiltonians. One fruitful approach is to dilate the non-Hermitian Hamiltonian into Hermitian ones in a larger Hilbert space. The dilation method was theoretically proposed to simulate the $${{{\mathcal{PT}}}}$$–symmetric non-Hermitian Hamiltonian98. Then it was applied in experiments to study the $${{{\mathcal{PT}}}}$$–symmetry breaking and implement the non-unitary dynamics of photons97,99. More recently, this method is exploited for simulating the dynamics of non-Hermitian Su-Schrieffer-Heeger band model with topological phases65.

Here, we utilize the dilation method (see Methods section and Supplementary Note 1) to implement the twister Hamiltonian H(k). With such a dilation method, the simulation of the non-Hermitian He = H(k) for the electron spin is mapped to the simulation of a Hermitian Hamiltonian He,n for the coupled electron and nuclear spins. Figure 1c illustrates the quantum circuit for our experiment. Through optical pumping, we first polarize the state to be $${\left|0\right\rangle }_{e}{\left|\uparrow \right\rangle }_{n}$$. By rotating along the x- and y-axes, we prepare the initial state $$\left|{{\Psi }}(0)\right\rangle ={\left|-1\right\rangle }_{e}{\left|-\right\rangle }_{n}+\eta (0){\left|-1\right\rangle }_{e}{\left|+\right\rangle }_{n}$$. We then apply two microwave pulses MW1,2 to realize the dilated Hamiltonian He,n. The parameters m1,2 and momentum k are tuned by controlling the frequency, amplitude and phase of MW1,2. To measure the expectation value of σx,y, we apply a unitary transform to the target Hamiltonian65$$:\widetilde{{H}_{e}}={U}_{y,x}^{{\dagger} }{H}_{e,n}{U}_{y,x}$$. The subsequent nuclear spin π/2 rotation transforms the dilated state $$\left|{{\Psi }}(t)\right\rangle ={\left|\psi (t)\right\rangle }_{e}{\left|-\right\rangle }_{n}+\eta (t){\left|\psi (t)\right\rangle }_{e}{\left|+\right\rangle }_{n}$$ into $$\left|{{\Phi }}(t)\right\rangle ={\left|\psi (t)\right\rangle }_{e}{\left|\uparrow \right\rangle }_{n}+\eta (t){\left|\psi (t)\right\rangle }_{e}{\left|\downarrow \right\rangle }_{n}$$. Finally, we project the nuclear spin into its $${\left|\uparrow \right\rangle }_{n}\left\langle \uparrow \right|$$ subspace and obtain the desired electron spin eigenstate of He = H(k) for a given momentum k (see Supplementary Note 1).

Then based on the non-unitary dynamics governed by He in the electron spin subsystem, we explore how the state evolves to the desired eigenstate of H(k) by checking the electron spin population on $${\left|-1\right\rangle }_{e}$$ (see Fig. 2a for a schematic demonstration). Figure 2b displays our experimental results of the electron spin population on the state $${\left|-1\right\rangle }_{e}$$, and shows that the experimental results coincide with the theoretical predictions very well, with almost all of the data points being within the error bars. After long time evolution (~1.2 μs), the electron spin state decays to the targeted eigenstate of H(k). This shows that the dilation method is effective and efficient in simulating the non-Hermitian twister model.

### Unsupervised clustering

Typically, the success of the diffusion map method relies crucially on the data samples. To learn non-Hermitian topological phases in an unsupervised fashion, one candidate data set is the bulk Hamiltonian unit vectors90: $${{{\bf{X}}}}=\{{{{{\bf{x}}}}}^{(l)}| {{{{\bf{x}}}}}^{(l)}=\{\frac{1}{N}\hat{{{{\bf{d}}}}}({k}_{i}),| {k}_{i}=\frac{2i-N-2}{N}{{{\rm{\pi }}}},\,i\in [1,N]\}\}$$ with $$\hat{{{{\bf{d}}}}}=\frac{{{{\bf{d}}}}}{\sqrt{{d}_{x}^{2}+{d}_{y}^{2}+{d}_{z}^{2}}}$$ and N denotes the number of unit cells of the system. To fit the experimentally prepared data (the right eigenstates $$\left|{R}_{1}\right\rangle$$ and $$\left|{R}_{2}\right\rangle$$) into the diffusion map algorithm, we transform the states $$\left|{R}_{1,2}\right\rangle$$ into the unit Hamiltonian vector:

$${\hat{d}}_{x,y,z}=\frac{1}{2}{{{\rm{Tr}}}}[\left\{(\left|{R}_{1}\right\rangle \left\langle {L}_{1}\right|-\left|{R}_{2}\right\rangle \left\langle {L}_{2}\right|),{\sigma }_{x,y,z}\right\}],$$
(2)

where the curly brackets denote the anti-commutator, the left and right eigenstates of the Hamiltonian obey the biorthogonal relation 〈LαRβ〉 = δαβ with α, β {1, 2}, and δ denoting the Kronecker delta function. Therefore, once we obtain the right eigenvectors $$\left|{R}_{1}\right\rangle$$ and $$\left|{R}_{2}\right\rangle$$ of H(ki) in the experiment, we can derive the other two eigenstates $$\left|{L}_{1}\right\rangle$$ and $$\left|{L}_{2}\right\rangle$$. Then by varying the discrete momentum ki in the first Brillouin zone with step-size π/8 while fixing m1 and m2, we can prepare one experimental data sample. Consequently, we obtain the experimental data set of 37 samples by varying m1, with fixed m2 = 0.6. From Fig. 2c, we see that more than 97.2% of the 1184 prepared states have a fidelity larger than 0.985, which indicates the high quality of our prepared data and the accurate controllability of the system.

One can also probe the topological phase transition of the non-Hermitian twister model by measuring 〈σx〉 and 〈σz〉 with respective to $$\left|{R}_{1}\right\rangle$$ and $$\left|{R}_{2}\right\rangle$$, with k sweeping the first Brillouin zone. Figure 2d displays the experimental results of the trajectories of 〈σx〉 and 〈σz〉 with varying m1. The trajectories of 〈σx〉 and 〈σz〉 form three types of structures, namely the two overlapping closed loops (m1 < 0.8), one closed loop (0.8 < m1 < 1.6), and two separate closed loops (m1 > 1.6), corresponding respectively to the Hopf link, unknot, and unlink topological phases. This coincides exactly with the theoretical prediction. Based on the experimental data, we can also calculate the global biorthogonal Berry phases that are related to the parity of band permutations57 (see Supplementary Table 1).

In Fig. 3, we show the unsupervised learning results for the twister Hamiltonian based on both the numerically simulated and experimental data sets, respectively. Here we generate both the numerical and experimental sets of input samples by orderly varying the parameter m1 of the twister Hamiltonian, for the convenience of comparing the numerical results and the experimental ones. In a more general context, we also carry out the numerical simulation of unsupervised learning with the input of randomly sampled data, and successfully cluster the samples into three categories (see Supplementary Fig. 8).

Figure 3c shows the kernel value distribution with experimental data samples, where the samples belonging to the same yellow block can diffuse to each other with a sizable probability, and hence can be clustered together based on the connectivity. As a consequence, the experimental data samples are clustered into three categories in the dimension-reduced space, see Fig. 3d. Since the largest eigenvalues λi ≈ 1 are almost degenerate, the outputs of the corresponding right eigenvectors in Fig. 3b, d would be up to a non-singular linear transformation. In addition, we can obtain the two phase boundaries from Fig. 3c, which agree precisely with the theoretical prediction, as well as the boundaries of phases indexed by the experimental trajectory results in Fig. 2d. We note that the 29th sample with m1 = 1.6015 is very close to the phase transition point (m1 = 1.6), which causes a large deviation from its presumed category (see the gray circles in Fig. 3b, d). Besides, by comparing our experimental result with the numerical one in Fig. 3a, b, we obtain that the diffusion map method is sufficiently robust against the experimental noises.

## Discussion

We emphasize that the applicability of the diffusion map method in classifying non-Hermitian topological phases can be explained from a physical perspective. On the one hand, it has been rigorously proved that non-Hermitian samples divided by the band crossing points cannot be clustered together via diffusion maps90. On the other hand, a more general theory for the non-Hermitian topological phase classification only assumes separable bands30. For the twister model, we have experimentally observed that the band crossing leads to a change of the knot structure (Fig. 2d), which indicates the transition between different topological phases. Hence from the perspective of separable bands, the diffusion map method matches naturally with the mathematical protocol for classifying non-Hermitian topological phases in the momentum space. We remark that when using the diffusion map method for unsupervised learning of unknown phase diagrams, one potential limitation is that the input data should be obtained by densely sampling the configuration space of the target model. Here, the diffusion map method provides a point of principle study. A thorough study of the capabilities of diffusion map method in learning unknown phases of matter remains an ongoing task. We leave this interesting and important problem for future studies.

It is worthwhile to note that the non-Hermitian twister model bears unconventional bulk-boundary correspondence, which means that the phase boundaries are sensitive to the boundary conditions. In the future, it would be interesting and important to experimentally demonstrate the unsupervised learning of non-Hermitian topological phases under the open boundary condition. Achieving this requires meticulous and accurate engineering of many spin interactions, which is still a notable challenge with the current NV technologies.

To summarize, we have demonstrated unsupervised learning of non-Hermitian topological phases, based on the non-unitary dynamical evolution of the electron spin with the NV center platform. In particular, we have generated a high-fidelity experimental data set of the non-Hermitian twister model and successfully clustered these experimental samples into different knotted phases in an unsupervised fashion. Our work paves a way to use unsupervised machine learning to identify undiscovered non-Hermitian topological phases with the state-of-the-art experimental platforms.

## Methods

### Diffusion map

The diffusion map95, as an unsupervised machine learning method, provides a non-linear approach to cluster samples based on the diffusion distance, which is related to the continuous deformation of manifold. Thus, it is particularly suitable for classifying topological objects. To measure the local similarity between the two samples x(l) and $${{{{\bf{x}}}}}^{(l^{\prime} )}$$, we introduce the Gaussian kernel function with the variance ϵ(0 < ϵ 1)

$${{{{\mathcal{K}}}}}_{l,l^{\prime} }=\exp \left(-\parallel {{{{\bf{x}}}}}^{(l)}-{{{{\bf{x}}}}}^{(l^{\prime} )}{\parallel }_{{{\mathbb{L}}}_{1}}^{2}/(2\epsilon )\right),$$
(3)

where $${{\parallel} {\cdot} {\parallel }}_{{{\mathbb{L}}}_{1}}$$ denotes the $${{\mathbb{L}}}_{1}$$-norm distance, i.e., $$\parallel \overrightarrow{A}{\parallel }_{{{\mathbb{L}}}_{1}}={\sum }_{i}| {A}_{i}|$$. Then one can define the one-step diffusion probability from the sample x(l) to $${{{{\bf{x}}}}}^{(l^{\prime} )}$$ by $${{{{\mathcal{P}}}}}_{l,l^{\prime} }=\frac{{{{{\mathcal{K}}}}}_{l,l^{\prime} }}{{\sum }_{l^{\prime} }{{{{\mathcal{K}}}}}_{l,l^{\prime} }}$$. After evolving 2t steps, the diffusion distance between two samples x(j) and $${{{{\bf{x}}}}}^{(j^{\prime} )}$$ is $${D}_{t}(j,j^{\prime} )={\sum }_{k}\frac{{({{{{\mathcal{P}}}}}_{j,k}^{t}-{{{{\mathcal{P}}}}}_{j^{\prime} ,k}^{t})}^{2}}{{\sum }_{l}{{{{\mathcal{K}}}}}_{k,l}}={\sum }_{k}{\lambda }_{k}^{2t}{[{({\psi }_{k})}_{j}-{({\psi }_{k})}_{j^{\prime} }]}^{2}$$, with {ψk} denoting the right eigenvectors of $${{{\mathcal{P}}}}$$ and {λk} being their corresponding eigenvalues. Then we clearly obtain from Dt that in the long-time limit t → , only the few eigenvectors with largest λ ≈ 1 will dominate, and these few eigenvectors can be utilized for dimension reduction and classifying different non-Hermitian topological phases90.

### The diamond sample and experimental setup

Our experiments are performed on a 〈100〉-oriented single crystal diamond (type IIa) produced by Element Six with a natural abundance of carbon isotopes ([13C]=1.1%). We utilize a single NV center with a neighboring 13C atom of 13.7 MHz hyperfine strength. A solid immersion lens (SIL) is fabricated on top of the preselected NV center to enhance the collection efficiency (Fig. 4b). The photoluminescence rate of the NV center is about 460 kcps under 80 μW laser excitation.

The diamond sample is mounted on a confocal microscopy system (see Fig. 4a). A 532 nm green laser is used for spin state initialization and readout. The laser beam is then modulated by an acoustic optical modulator (AOM, ISOMET 1250C-848) to generate laser pulses. To avoid continuous polarization caused by the laser leakage, the first-order diffracted beam generated by AOM is reflected by a mirror, forming a double-pass structure to enhance the on-off ratio to 105:1. The green laser is coupled to a single-mode fiber, guided out by a collimator, reflected by a dichroic mirror (DM), and then focused on our sample through an oil-immersion objective lens. The fluorescence photons of the NV center are collected via the same objective lens and pass through the DM followed by a 637 nm long-pass filter. Then the photons are coupled to a multi-mode fiber and detected by a single photon detector module (SPDM). A homemade field-programmable gate array (FPGA) board is applied to count the fluorescence photons.

In order to coherently manipulate the electron spin and nearby nuclear spins, we use an arbitrary waveform generator (AWG, Techtronix 5014C) to generate transistor-transistor logic (TTL) signals and low frequency analog signals. One of the TTL signal controls the on/off of AOM, namely the laser pulses. Another two TTL signals provide gate signals for the FPGA board. For the manipulation of the electron spin, the carrier MW signal generated by a MW source (Keysight N5181B) is combined with two of the analog signals of AWG through an IQ-mixer (Marki Microwave IQ1545LMP). For the manipulation of the nuclear spin, another analog signal is used to generate the RF signal. Both MW and RF signals are further amplified by amplifiers (Mini Circuits ZHL-30W-252-S+ for MW and Mini Circuits LZY-22+ for RF). The MW signal is then delivered to the diamond sample via a gold coplanar waveguide (CPW). The RF signal is applied through a homemade copper coil.

All the experiments in this work are implemented at room temperature. To polarize the nuclear spins via excited-state level anticrossing (ESLAC)100, a static magnetic field of Bz ≈ 480 Gauss is applied along the NV axis by a permanent magnet. To ensure that the coherence time is sufficient for the time evolution process (~1 μs) in our experiments, we perform a Ramsey interferometry measurement (Fig. 4c). For the NV center used in this work, the coherence time $${T}_{2}^{* }$$ is measured to be 3.0 μs.

### Implementing the non-Hermitian Hamiltonian

Here we implement the twister Hamiltonian H(k) based on the dilation method98,101 using the electron-nuclear spin system, with the electron (nuclear) spin being the target (ancilla) system. Concretely, we consider the quantum state $$\left|\psi (t)\right\rangle$$ in the target system, which evolves under the Hamiltonian He with the Schrödinger equation $${{{\rm{i}}}}\frac{\partial }{\partial t}\left|\psi (t)\right\rangle ={H}_{e}\left|\psi (t)\right\rangle$$. We then dilate the state $$\left|\psi (t)\right\rangle$$ into $$\left|{{\Psi }}(t)\right\rangle =\left|\psi (t)\right\rangle \left|-\right\rangle +\eta (t)\left|\psi (t)\right\rangle \left|+\right\rangle$$ governed by the dilated Hermitian Hamiltonian He,n, where the states $$\left|-\right\rangle =\frac{1}{\sqrt{2}}(\left|\uparrow \right\rangle -{{{\rm{i}}}}\left|\downarrow \right\rangle )$$, $$\left|+\right\rangle =\frac{1}{\sqrt{2}}(\left|\downarrow \right\rangle -{{{\rm{i}}}}\left|\uparrow \right\rangle )$$ and η(t) denotes a proper time-dependent linear operator. With this, the non-unitary time evolution of $$\left|\psi (t)\right\rangle$$ governed by He can be obtained by projecting the nuclear spin onto the $$\left|-\right\rangle$$ state. The quantum circuit for implementing He in our experiment is shown in Fig. 1c. Here, we omit the detailed parametrization of the dilated Hamiltonian He,n for brevity, see Supplementary Fig. 1 for details.

In simulating the Hermitian topological phases in Bloch space, the ground states with different momentums can be prepared with the adiabatic passage approach. However, the adiabatic passage method for the Hermitian models cannot straightforwardly carry over to the non-Hermitian scenario with complex eigenvalues. To prepare the eigenstates of the twister model, here we utilize the feature of non-unitary evolution governed by the non-Hermitian Hamiltonian. Specifically, suppose the target system is initially at the state $$\left|\psi (0)\right\rangle ={c}_{1}\left|{R}_{1}\right\rangle +{c}_{2}\left|{R}_{2}\right\rangle$$, where $$\left|{R}_{1,2}\right\rangle$$ are the right eigenvectors of the twister Hamiltonian with eigenvalues λ1,2. Suppose $${{{\rm{Im}}}}({\lambda }_{1})\, > \,{{{\rm{Im}}}}({\lambda }_{2})$$, then the system would decay to $$\left|{R}_{1}\right\rangle$$ in the long time limit. Hence, one can prepare the eigenstate $$\left|{R}_{1}\right\rangle$$ of the twister Hamiltonian based on the long time evolution of the system. Similarly, one can prepare the other eigenstate $$\left|{R}_{2}\right\rangle$$ by simply changing H into − H. We remark that such progress relies crucially on the imaginary part of the eigenvalues and is suitable for most cases of the parameters (m1, m2, k). For those special cases with real eigenvalues (k = π, 2π for the Hopf link phase; k = 2π for the unknot phase), one can prepare the corresponding eigenstates through the dynamical evolution of ± iH.

### Trajectories of eigenstates on the Bloch sphere

Figure 5 shows the three different trajectories of the eigenvectors on the Bloch sphere, with each trajectory corresponding to one topological phase. In Fig. 5a, the two eigenstates $$\left|{R}_{1,2}(k)\right\rangle$$ with k sweeping the Brillouin zone give rise to two overlapping closed loops, which correspond to the Hopf link phase. In Fig. 5b, the one single closed loop corresponds to the unknot phase. Whereas in Fig. 5c, the two separate closed loops correspond to the unlink phase. The detailed experimental data and the error bars obtained by Monte Carlo simulation are listed in Supplementary Tables 27.

### Experimental knot band structures

With the experimentally prepared eigenstates $$\left|{R}_{1,2}(k)\right\rangle$$, we can calculate the corresponding eigenenergies of the non-Hermitian twister Hamiltonian H(k) based on

$${E}_{n}(k)=\left\langle {L}_{n}\right|H(k)\left|{R}_{n}\right\rangle ,\,(n=1,2).$$

Figure 6 illustrates the braided band structures of the twister Hamiltonian in the first Brillouin zone. Figure 6a–c demonstrates the 3D braiding structures of the complex bands, which are equivalent to the knot (or link) structures by gluing the k = 0 and k = 2π planes, including the Hopf link, the unknot, and the unlink. As mentioned above, each knot (link) structure indexes one non-Hermitian topological phase. Figure 6d–f illustrates the 2D projection of the 3D braiding complex bands. We see from Fig. 6 that the experimental results (colored dots) match precisely with the theoretical trajectories (solid and dashed lines) of the bands.