<p>The localized states in the band gap of amorphous phase change alloys like Ge2Sb2Te5 control the electrical conduction via the Poole-Frenkel mechanism. Understanding the origin of in-gap states and their evolution in time during aging of the glass is therefore important for the control of the resistance drift in phase change memory devices. Here, we use a machine learning interatomic potential to generate several models of Ge2Sb2Te5 whose electronic structure is then analyzed within density functional theory with a hybrid functional. A detailed statistical analysis of the structural motifs on which the in-gap states are localized, reveals that the vast majority of in-gap states involve wrong bonds (homopolar or Ge-Sb bonds) often accompanied by Ge in tetrahedral configurations or overcoordinated Ge and Sb atoms. Metadynamics simulations mimicking glass aging support the picture that structural relaxations lead to the depletion of in-gap states and then to an increase of resistance. The simulations thus provide important insights for the mitigation of the resistance drift in phase change memory devices.</p>