  Nanodiamonds containing negatively charged nitrogen-vacancy (NV$^-$) centers
are versatile room-temperature quantum sensors in a growing field of research.
Yet, knowledge regarding the NV-formation mechanism in very small particles is
still limited. This study focuses on the formation of the smallest
NV$^-$-containing diamonds, 5 nm detonation nanodiamonds (DNDs). As a reliable
method to quantify NV$^-$ centers in nanodiamonds, half-field signals in
electron paramagnetic resonance (EPR) spectroscopy are recorded. By comparing
the NV$^-$ concentration with a series of nanodiamonds from high-pressure
high-temperature (HPHT) synthesis (10 - 100 nm), it is shown that the formation
process in 5 nm DNDs is unique in several aspects. NV$^-$ centers in DNDs are
already formed at the stage of electron irradiation, without the need for
high-temperature annealing. The effect is explained in terms of
"self-annealing", where size and type dependent effects enable vacancy
migration close to room temperature. Although our experiments show that NV$^-$
concentration generally increases with particle size, remarkably, the NV$^-$
concentration in 5 nm DNDs surpasses that of 20 nm-sized nanodiamonds. Using
Monte Carlo simulations, we show that the ten times higher substitutional
nitrogen concentration in DNDs compensates the vacancy loss induced by the
large relative particle surface. Upon electron irradiation at a fluence of $1.5
\times 10 ^{19}$ e$^-$/cm$^2$, DNDs show a 12.5-fold increment in the NV$^-$
concentration with no sign of saturation. These findings can be of interest for
the creation of defects in other very small semiconductor nanoparticles beyond
NV-nanodiamonds as quantum sensors.
