Si and Mg-doped AlN epilayers were grown by metal-organic chemical vapor deposition (MOCVD) on sapphire substrates. Deep ultraviolet (UV) picosecond time-resolved photoluminescence (PL) spectroscopy has been employed to study the optical transitions in the grown epilayers. The donor bound exciton (or I2) transition was found to be the dominant recombination line in Si-doped AlN epilayers at 10 K and its emission intensity decreases with increasing Si dopant concentration. Doping induced band-gap renormalization effect has also been observed. Time-resolved PL results on Si-doped AlN revealed a linear decrease of PL decay lifetime with increasing Si dopant concentration, which was believed to be a direct consequence of the doping enhanced nonradiative recombination rates and corroborated the PL intensity results. For Mg-doped AlN epilayers, two emission lines at 4.70 and 5.54 eV have been observed at 10 K, which were assigned to donor-acceptor pair transitions involving Mg acceptor and two different donors (one deep and one shallow). From PL emission spectra and the temperature dependence of the PL emission intensity, a binding energy of 0.51 eV for Mg acceptor in AlN was determined. Together with previous experimental results, the Mg acceptor activation energy in AlGaN as a function of the Al content for the entire AlN composition range was obtained. The average hole effective mass in AlN was also deduced to be about 2.7 m0 from the experimental value of Mg binding energy together with the effective mass theory. Although Mg acceptors are an effective mass state in ultra-large bandgap AlN, as a consequence of this large acceptor binding energy of 0.51 eV, only a very small fraction (about 10-9) of Mg dopants can be activated at room temperature in Mg-doped AlN. Decay lifetimes of these emission lines are also measured as functions of emission energy, temperature, and excitation intensity. The implications of our finding on the applications of AlN epilayers for many novel devices will also be discussed.