In the context of atom interferometry, how are $\pi$ and $\frac{\pi}{2}$ pulse generated?
In general, you apply $r\pi$ pulses by turning on an interaction hamiltonian $H_I$, which couples both states, for long enough (or with a strong enough coupling) to achieve the desired effect.
This builds on the standard representation for the propagator operator under that hamiltonian for a time difference $\Delta t$, which reads $U(\Delta t)=\exp(-i H_I\Delta t/\hbar)$, and which is obviously parallel to the expression $U=e^{-ir\pi X/2}$ you quote. In particular, we use pulses of radiation (lasers or microwaves or whatever is convenient) because they have the hamiltonian $$\hat H_I=\mathbf E\cdot e\hat{\mathbf r},$$ in the dipole approximation and in the length gauge (and, also, applying the rotating-wave approximation), with $\mathbf E$ the electric field strength and $e\hat{\mathbf r}$ the atomic electric dipole operator. Typically, both eigenstates $\left|\mathrm{red}\right\rangle$ and $\left|\mathrm{blue}\right\rangle$ will have zero intrinsic dipole moment, which means that only the off-diagonal elements of $H_I$ are nonzero, and it is therefore of the form $$\hat H_I=F\hat X=F\begin{pmatrix}0&1\\1&0\end{pmatrix}.$$
(Note that I'm setting the off-diagonal elements to be real, which I can do (once) by shifting the phase of the basis states. This is what fixes the axis of the $r\pi$ pulse rotation as the $X$ axis, and it can be changed by changing the phase of the laser (which introduces opposite complex phases on the off-diagonal elements, and moves the rotation axis along the $xy$ plane of the Bloch sphere).)
Given the hamiltonian above, you just simply let it run for a set time $\Delta t$, and it gives you a unitary operator $$ e^{-iF\Delta t X/\hbar} = e^{-ir\pi X/2}, $$ which represents an $r\pi$ pulse with rotation amount $$ r\pi = \frac{2}{\hbar} F\,\Delta t. $$ To tune this rotation amount, you can change $\Delta t$ (run the pulse for longer) or $F$ (use a stronger pulse), and depending on experimental conditions you might choose either of them.