To probe physical conditions in the atmosphere of the Sun we have to rely on remote sensing, that is, we have to decipher the signatures of various physical processes in the spectra of the Sun. To perform reliable diagnostics we have to model the spectra formation with satisfactory degree of realism, but also to develop inverse methods that allow us to infer model parameters from the observed polarized spectra. The new generation solar telescopes such as DKIST will make this problem especially challenging since the amount of data to be interpreted will increase by an order of magnitude.
In this talk we will discuss spectral line formation in the solar atmosphere and the physical mechanisms responsible for polarization in spectral lines. We will then turn to the inference methods that allow us to fit atmosphere models to the observed polarized spectra and to estimate temperatures, velocities and magnetic fields in the atmosphere of the Sun. Finally, will turn to machine learning methods for spectropolarimetric diagnostics, namely convolutional neural networks and their potential to tackle next-generation data.