By applying the locally optimal rotation method to deal with the lowest eigenvalue of a Hessian matrix, we have efficiently incorporated the hyperdynamics method into the ab initio scheme. In the present method, we only need to calculate the first derivative of the potential and several more force calls in each molecular dynamics (MD) step, which makes hyperdynamics simulation applicable in ab initio MD simulations. With this implementation, we are able to simulate defect diffusion in silicon with boost factors up to 105. We utilized both direct MD and the hyperdynamics method to investigate diffusion of lithium atoms and silicon vacancies in silicon. We identified the complex diffusion process. The obtained diffusion coefficients of Li atoms and Si vacancies are in good agreement with the direct MD results.