Similar Items: Task Vector Geometry Underlies Dual Modes of Task Inference in Transformers