Zhipeng Zheng, Yifan Lv, Xunlin Zhang, Wen Cai, Shichen Zhang, Jiabao Wu, Zhiyong Tan, Xuguang Guo, Yiming Zhu
The thickness and refractive index of thin films are crucial parameters for precise fabrication processes. While conventional iterative optimization algorithms for spectral fitting have achieved high precision, they often rely on a priori initial estimations to avoid local minima during the complex spectral fitting process. Here, we propose a prior-free regression model based on the transformer encoder architecture to map terahertz transmission spectra to the thickness and refractive index of thin-film structures. A scattering-matrix algorithm was implemented to generate the training dataset. Leveraging the multi-head-attention mechanism, the model adaptively captures the long-range dependencies of highly entangled Fabry-Pérot interference fringes. This enables autonomous inversion with zero initialization and reduces the need for empirical starting parameters or manual search bounds. Consequently, the model achieves a rapid parameter extraction time on the millisecond scale. Validated on a designed two-layer film structure, we demonstrate that the proposed transformer encoder model delivers rapid and reliable parameter extraction performance from the experimental terahertz transmission spectra. Additionally, this methodology offers a potential approach for non-destructive and non-contact thin-film characterization, which may facilitate quality control in future semiconductor and optoelectronic device fabrication.