One unique challenging in achieving advanced carbon molecular sieve membranes (CMSMs) is tailoring their gas separation properties from the precursor. To clarify this, we designed two homo-polyimides with a bromine (PI-Br) and a hydroxyl (PI-OH) groups in the ortho position of imide group, and carbonized them into CMSMs at 550 °C (PI-Br-550 and PI-OH-550). There are debromination (510 °C) and carbonization occurred for PI-Br-550 whereas the PI-OH underwent thermally rearrangement (TR, 450 °C) and then pyrolysis to CMSM. After carbonization, both CMSMs showed excellent gas separation properties, with their CO2/CH4 separation performance surpassed the latest 2019 pure-gas and 2018 mixed-gas trade-off curves, additionally, the PI-Br-550 demonstrated a relatively smaller CO2 permeability (12462 vs 14,253 Barrer), lower PCO2 increment ratio (199 vs 1480), and less CO2/CH4 dropping ratio (69.7 to 45.5 vs 87.5 to 36.1) than the PI-OH-550 from their precursors. Their XPS, Raman, and WXRD characterization results indicated that debromination boosts the gas separation performance of CMSM by creating more ultra-micropore "plate" (pyrrolic-N of 36.0 % vs 19.0 %) and smaller d-spacing (3.89 vs 4.15 Å) than the TR precursor, which boosts the permeability of CMSM is due to the high stability of PBO intermediates that retarded the decomposition of the polymer main chian and caused some big pores. The above results provided a good route to get highly efficient CMSM by molecular designing of their precursors.