Catalyzes an early step in riboflavin biosynthesis, the NADPH-dependent reduction of the ribose side chain of 2,5-diamino-6-ribosylamino-4(3H)-pyrimidinone 5'-phosphate, yielding 2,5-diamino-6-ribitylamino-4(3H)-pyrimidinone 5'-phosphate. 2,5-diamino-6-(1-D-ribitylamino)pyrimidin-4(3H)-one 5'-phosphate + NADP(+) = 2,5-diamino-6-(1-D-ribosylamino)pyrimidin-4(3H)-one 5'-phosphate + H(+) + NADPH 2,5-diamino-6-(1-D-ribitylamino)pyrimidin-4(3H)-one 5'-phosphate + NAD(+) = 2,5-diamino-6-(1-D-ribosylamino)pyrimidin-4(3H)-one 5'-phosphate + H(+) + NADH Cofactor biosynthesis; riboflavin biosynthesis. Homodimer. Belongs to the HTP reductase family.