  Solid-state devices used for quantum computation and quantum sensing
applications are adversely affected by loss and noise caused by spurious,
charged two-level systems (TLS) and stray paramagnetic spins. These two sources
of noise are interconnected, exacerbating the impact on circuit performance. We
use an on-chip electron spin resonance (ESR) technique, with niobium nitride
(NbN) superconducting resonators, to study surface spins on silicon and the
effect of post-fabrication surface treatments. We identify two distinct spin
species that are characterized by different spin-relaxation times and respond
selectively to various surface treatments (annealing and hydrofluoric acid).
Only one of the two spin species has a significant impact on the TLS-limited
resonator quality factor at low-power (near single-photon) excitation. We
observe a 3-to-5-fold reduction in the total density of spins after surface
treatments, and demonstrate the efficacy of ESR spectroscopy in developing
strategies to mitigate loss and decoherence in quantum systems.
