Jinheng Wu

Author directory

2026

In-context learning (ICL) enables large language models to adapt from a few demonstrations, yet its sensitivity to context perturbations remains poorly understood. We study the context-conditioned map C ↦ f𝜃(x; C) through Lipschitz analysis. Modeling the Transformer as a composition of attention and feed-forward layers, we derive a worst-case certificate |f(x; C + 𝛿) - f(x; C)| ≤ L|𝛿| and a data-dependent local estimator based on finite-difference Jacobian probes. Across six language models (117M–7B) on controlled arithmetic ICL tasks, we find that: (i) output changes saturate as perturbation magnitude increases; (ii) global spectral bounds are extremely conservative, while local estimates are far closer to empirical sensitivity; (iii) sensitivity concentrates in late attention layers; (iv) additional demonstrations often stabilize predictions through redundancy; and (v) perturbation direction matters: label flips have much larger normalized effect than reorderings. SST-2 validation supports the same local-sensitivity and perturbation-direction trends. Our results position Lipschitz analysis less as a tight global predictor and more as a diagnostic framework for locating and comparing ICL vulnerabilities.