Quantifying perturbation impacts for large language models