The streamer-to-filament transition in air at atmospheric pressure, in a nanosecond pin-to-pin discharge, is studied by a 2D model. The main aim is to implement a kinetic scheme providing a sharp electron density increase to the 2D PASSKEy code, to validate the results on the available experimental data, and to investigate the mechanisms responsible for the transition. Results show that after the formation of a conductive channel across the discharge gap, two discharge modes appear during a few nanoseconds: a glow phase, with a relatively homogeneous distribution with the electron density of
1.0
×
10
14
cm−3, and a filamentary phase, with the electron density of
1.0
×
10
18
cm−3. Two filaments appear at the cathode and anode respectively, and propagate towards the middle of the gap with a velocity of about
1.1
⋅
10
7
cm s−1, forming a narrow channel. Simultaneously, the gas temperature increases from 350 to 2800 K. The diameter of the channel at the middle gap decreases from 210 to 90 µm. Dissociation and ionization of the electronically excited states of molecules N2(A
3
∑
u
+
, B
3
Π
g
, a
′
1
∑
u
−
, C
3
Π
u
), and ionization of ground and electronically excited states of O and N atoms are the most important processes for the transition. Numerical results also reveal the influence of the memory effect (pre-heating, pre-ionization, and pre-dissociation) from previous pulses on the streamer-to-filament transition.