## 2 Design of the All-in-One Collimating Splitter
### Design of the Phase Profile  
As shown in Figure 1b, the metasurface consists of silica substrate and silicon nano-cuboids. The laser beam from the single-mode fiber travels for about 500 \(\upmu\)m (\(f=500\)\(\upmu\)m) in the silica substrate and is diffracted by the designed metasurface, forming a collimated 3 \(\times\) 3 spot array in the far field. The core component of the collimating splitter, i.e., the metasurface, is designed by synthesizing the phase (\(\phi(x,y)\)) of a collimating lens (\(\phi_{L}(x,y)\)) and the phase of an optimized Dammann grating (\(\phi_{D}(x,y)\)):  
\[\phi(x,y)=\phi_{L}(x,y)+\phi_{D}(x,y), \tag{1}\]where the collimating lens follows the hyperbolic profile without spherical aberration to collimate the diverging Gaussian beam from the single-mode fiber:  
\[\phi_{L}(x,y)=-k_{0}\cdot n_{sub}\cdot\left(\sqrt{x^{2}+y^{2}+f^{2}}-f\right), \tag{2}\]  
where \(k_{0}\) refers to the wavevector in the vacuum, \(n_{sub}\) refers to the refractive index of the substrate, i.e., \(n_{sub}=n_{SiO_{2}}=1.447\), and the designed focal length \(f\) of the collimating lens equals the thickness of the substrate, i.e., 500 \(\upmu\)m in this case. The designed wavelength is 1.55 \(\upmu\)m. Figure 2a shows the phase profile of the collimating lens (\(\phi_{L}\)). The Dammann grating consists of periodically arranged supercells. One supercell consists of \(5\times 5\) unit cells with the same period and different-sized nanostructures located in the center of each cell. The period of the supercell (\(P\)) is chosen according to the grating equation, so that a diffraction order larger than 2 is eliminated:  
\[P_{x}\sin\theta_{x}=m\lambda,\ P_{y}\sin\theta_{y}=n\lambda, \tag{3}\]  
where \(P_{x}\) and \(P_{y}\) are the period of the supercell in the \(x\) and \(y\) direction, respectively, and \(\theta_{x}\) and \(\theta_{y}\) are the diffraction angles of the \(m\)th and \(n\)th grating order along the \(x\) and \(y\) direction, respectively. In our design, we set \(P_{x}=P_{y}=3\ \upmu\)m; thus, the diffraction angle (\(\theta_{x},\ \theta_{y}\)) of the first order (\(m=n=1\)) is (31.1\({}^{\circ}\), 31.1\({}^{\circ}\)). The period of the unit cell (\(p_{x},\ p_{y}\)) is chosen such that the interaction between the adjacent unit cells is small. The small interaction ensures that we can discretize the supercell and optimize the discrete phase profile of the supercell. Here, we set \(p_{x}=p_{y}=0.6\ \upmu\)m, and \(5\times 5\) unit cells are distributed in one supercell. The  
Figure 1: The concept of the all-in-one collimating splitter based on metasurfaces. (**a**) Schematic of the traditional configuration. (**b**) Schematic of the proposed all-in-one collimating splitter. phase profile of the supercell is designed to have C4 symmetry so that the grating can be polarization-independent. To save the time during the device simulation, mirror symmetry is also introduced in the design. Under the predefined constraints, the phase distribution of the supercell is optimized following an inverse design method. A random phase profile is chosen as the initial value, and the diffraction efficiency of each order is calculated using the angular spectrum propagation theory. The cost function is defined according to Equation (4) to derive a uniform intensity distribution of different diffractive orders in the far field and high efficiency:  
\[cost=\sqrt{\frac{1}{N}\sum_{i=1}^{N}\biggl{(}I_{i}-\frac{1}{N}\biggr{)}^{2}}, \tag{4}\]  
where \(I_{i}\) is the diffraction efficiency of the \(i\)th order, and \(N\) denotes the total number of the diffraction orders. The diffraction efficiency is defined as the fraction of the incident power diffracted to the specific order. (Actually, in angular propagation theory, the metasurface is simplified to a phase profile with unity transmittance during the optimization; thus, the total transmission is assumed to be 1.) A sequential quadratic programming algorithm is used to minimize the cost function above [39].