  Metamaterials open up a new way to manipulate electromagnetic waves and
realize various functional devices. Metamaterials with high-quality (Q)
resonance responses are widely employed in sensing, detection, and other
applications. Traditional design of metamaterials involves laborious
simulation-optimization and limits the efficiency. The high-Q metamaterials
with abrupt spectral change are even harder to reverse design on-demand. In
this paper, we propose novel solutions for designing terahertz high-Q
metamaterials based on deep learning, including the forward prediction of
spectral responses and the inverse design of structural parameters. For the
forward prediction, we develop the Electromagnetic Response Transformer (ERT)
model to establish the complex mapping relations between the highly sensitive
structural parameters and the abrupt spectra, and realize precise prediction of
the high-Q resonance in terahertz spectra from given structural parameters. For
the inverse design, we introduce the Visual Attention Network (VAN) model with
a large model capability to attentively learn the abrupt shifts in spectral
resonances, which can efficiently reduce errors and achieve highly accurate
inverse design of structural parameters according to the expected high-Q
resonance responses. Both models exhibit outstanding performance, and the
accuracy is improved one or two orders higher compared to the traditional
machine learning methods. Besides, our ERT model can be 4000 times faster than
the conventional full wave simulations in computation time. Our work provides
new avenues for the deep learning enabled design of terahertz high-Q
metamaterials, which holds potential applications in various fields, such as
terahertz communication, sensing, imaging, and functional devices.
