Inverted perovskite solar cells (PSCs) possess great potential for improving efficiency and operating stability, but parasitic charge recombination at the interfaces still limits their performance. As additives and surface treatment agents, ammonium ligands have been reported to form either two/three-dimensional (2D/3D) heterojunctions or passivation layers. In this work, we first conduct a comprehensive, large language model (LLM)-enabled literature mining to systematically enumerate ligand molecules reported over the past decade, through which we identify a pronounced knowledge gap concerning thiazole-based ligands. Then, in a comparative case study, perovskite films are treated with two thiazole- and thiophen-based ligands, which are small rigid aromatic heterocycles with similar molecular conformation. Thiophen-2-ylmethanamine hydrochloride (TPMA) induces 2D phase formation within 3D perovskite films. In comparison, 1,3-thiazol-2-ylmethanamine hydrochloride (TMA), with enhanced charge-transfer interactions associated with the S ions on the aromatic rings, demonstrates a stronger defect passivation capability. Overall, the TMA-based counterpart exhibits lower defect density, extended carrier lifetime, and a more favorable band offset. With the thiazole-based ligand, the resulting inverted PSC achieves an efficiency of 26.81% (certified 26.43%) and retains 96.4% of its initial performance after 1000 h tracking under continuous illumination at the maximum power point.