  In this work, we propose a composite pulses scheme by modulating phases to
achieve high fidelity population transfer in three-level systems. To circumvent
the obstacle that not enough variables are exploited to eliminate the
systematic errors in the transition probability, we put forward a cost function
to find the optimal value. The cost function is independently constructed
either in ensuring an accurate population of the target state, or in
suppressing the population of the leakage state, or both of them. The results
demonstrate that population transfer is implemented with high fidelity even
when existing the deviations in the coupling coefficients. Furthermore, our
composite pulses scheme can be extensible to arbitrarily long pulse sequences.
As an example, we employ the composite pulses sequence for achieving the
three-atom singlet state in an atom-cavity system with ultrahigh fidelity. The
final singlet state shows robustness against deviations and is not seriously
affected by waveform distortions. Also, the singlet state maintains a high
fidelity under the decoherence environment.
