In this article, we evidence the lower formation energy and improved stability of the conductive filament (CF) formed in TiN\Ta 2 O 5 \Ta resistive-switching memory cells treated in NH 3 atmosphere at 400 C. This annealing treatment results in (i) lower forming voltage, (ii) lower CF resistance, and (iii) longer retention lifetime of the oxygen-vacancy (V o ) chain constituting the CF. Atomistic insights into these processes are provided by ab initio calculations performed for hydrogen (H) species incorporated in non-stoichiometric Ta 2 O 5 supercells: (i) V o formation energy is reduced by the presence of H, (ii) V o -chain CF conductivity is increased by V o þ OH complex formation, and (iii) V o -chain retention is strengthened by the stable V o þ OH complex. As a result, efficient CF formation and excellent state stability are obtained after 15 days at 250 C. V C 2015 AIP Publishing LLC.