Zeolitic imidazolate frameworks (ZIFs) feature complex phase transitions, including polymorphism, melting, vitrification, and polyamorphism. Experimentally probing their structural evolution during transitions involving amorphous phases is a significant challenge, especially at the medium-range length scale. To overcome this challenge, here we first train a deep learning-based force field to identify the structural characteristics of both crystalline and non-crystalline ZIF phases. This allows us to reproduce the structural evolution trend during the melting of crystals and formation of ZIF glasses at various length scales with an accuracy comparable to that of ab initio molecular dynamics, yet at a much lower computational cost. Based on this approach, we propose a new structural descriptor, namely, the ring orientation index, to capture the propensity for crystallization of ZIF-4 (Zn(Im)2, Im = C3H3N2-) glasses, as well as for the formation of ZIF-zni (Zn(Im)2) out of the high-density amorphous phase. This crystal formation process is a result of the reorientation of imidazole rings by sacrificing the order of the structure around the zinc-centered tetrahedra. The outcomes of this work are useful for studying phase transitions in other metal-organic frameworks (MOFs) and may thus guide the development of MOF glasses.