## 2 Theory of the MZI-Based ONN  
The proposed ONN has a multiple MZI configuration achieving a transmission matrix resembles a fully connected layer in a neural network. Figure 1 shows a typical 2 \(\times\) 2 MZI, which is composed of two 3-dB couplers, a phase shifter \(\theta\) situated on the top arm inside the MZI, and a phase shifter \(\varphi\) situated at the MZI output. The phase shifter \(\theta\) controls the MZI output power, while the phase shifter \(\varphi\) determines the phase of the MZI outputs. This configuration permits adaptable rotation within the unitary matrix, thus contributing to its versatility. Equation (1) shows the transformation matrix of MZI, where \(\theta\) and \(\varphi\) represent the internal and external phase shift values, respectively. \[S_{\text{MZI}}=je^{i(\frac{\theta}{2})} \begin{bmatrix}e^{j\varphi}\text{sin} \left(\frac{\theta}{2}\right)&e^{j\varphi}\text{cos}\left(\frac{\theta}{2} \right)\\ \text{cos}\left(\frac{\theta}{2}\right)&-\text{sin}\left(\frac{\theta}{2} \right)\end{bmatrix}  \tag{1}\]Figure 2 shows the architecture of the ONN utilized for the classification of ISI distorted PAM4 signals. This MZI network architecture is known as Reck mesh architecture [32]. The number of MZIs in a \(N\times N\) Reck mesh is \(\frac{N(N-1)}{2}\), where \(N\) represents the number of input ports and output ports. These MZIs are organized in \((N-1)\) rows, with the count of MZIs in each row decreasing from \((N-1)\) to 1 from top to bottom. The first port is for receiving the PAM4 data, while the second part is for optical pumping. This will be discussed in detail in a later section. The transformation matrix of each MZI in the mesh can be expanded to a \(N\times N\) dimensional Hilbert space. Take the \(4\times 4\) Reck mesh for example, the \(4\times 4\) dimensional Hilbert space of each MZI is shown in Equations (2)-(4). \[D_{n}= \begin{bmatrix}S_{\textbf{MZI}_{n}}&0&0\\ 0&0&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix} n=1,\;3,\;6 \tag{2}\]  
\[D_{n}= \begin{bmatrix}1&0&0&0\\ 0&S_{\textbf{MZI}_{n}}&0\\ 0&0&1\end{bmatrix} n=2,\;5 \tag{3}\]  
\[D_{n}= \begin{bmatrix}1&0&0&0\\ 0&1&0&0\\ 0&0&S_{\textbf{MZI}_{n}}\end{bmatrix} n=4 \tag{4}\]  
The \(S_{\textbf{MZI}_{n}}\) in the equations is the \(n\)th MZI transformation matrix as shown in Equation (1). The entire Hilbert space of the network system is derived from the inner product of \(D_{n}\). Therefore, the entire Hilbert space in the Reck mesh can be written as Equation (5). Hence, the input-output relationship of the MZI network can be expressed as Equation (6), where \(Y\) represents the output optical field matrix, \(X\) is the input optical field matrix, and \(H\) denotes the Hilbert space matrix. This operation is like the fully connected layer shown in Figure 3.  
\[H=D_{6}.D_{5}.D_{4}.D_{3}.D_{2}.D_{1} \tag{5}\]  
Figure 1: A typical \(2\times 2\) MZI used in the ONN. It consists of two 3-dB couplers, a phase shifter \(\theta\)=, and a phase shifter \(\varphi\). Figure 2: The architecture of MZI-based ONN in Reck mesh architecture. In a fully connected layer, each connection line from \(x_{i}\) to \(y_{j}\) can be written as \(x_{i}\ w_{i,j}+b_{i,j}\), where \(w_{i,j}\) and \(b_{i,j}\) are the weight and bias value at connect line, respectively. The relationship between \(x_{i}\) and \(y_{j}\) is illustrated in Equation (7). Using a matrix to express this relationship, we can obtain Equation (8), where \(\mathbf{Y}\) is output matrix, \(\mathbf{X}\) is input matrix, \(\mathbf{W}\) is weight matrix, and \(\mathbf{b}\) is the bias matrix. Comparing Equation (8) with Equation (6), it can be observed that they are very similar.