In-context learning exhibits dual operating modes: task learning and task retrieval, explained by a probabilistic model.