Few-Shot Demonstrations Elicit the Use of In-Context World Representations in LLMs
Kohsei Matsutani, Gouki Minegishi, Core Francisco Park, Takeshi Kojima, Yusuke Iwasawa, Yutaka Matsuo
Abstract
Large language models (LLMs), when acting as agents, are expected to take observed data in context, infer the latent state space underlying the world, and leverage it for downstream prediction. However, prior work demonstrated that LLMs struggle to use representations learned in context on a graph tracking task, where the model needs to construct a representation of the graph governing data generation process and use it for subsequent predictions. In this paper, we show that extending this to few-shot settings, where each demonstration is generated from a different world with either the same or different graph topologies, enhances its prediction on 9 models from 7 model families. To understand this improvement, we linearly probe a low-dimensional world representation that encodes graph information in the hidden states. Notably, we find that few-shot demonstrations relocate the world representation and increase its predictive use. Specifically, for each model, these world representations shift in directions nearly orthogonal to their original subspace, and interventions on these representations selectively impair performance more than interventions on other subspaces. Consistent with this insight, we show that few-shot demonstrations with observations from different worlds improve performance on ARC-AGI-1&2, web agent tasks, and Othello. Our findings elucidate the role and internal mechanisms of few-shot demonstrations in in-context world modeling and provide implications for their further improvement.
Create a lesson
Related papers
Representation-guided in-context learning for medical image interpretation with multimodal large language models
Shared title terminologycs.AIMinda Zhao, Fangyu Hu, Yan Luo et al.
Revisiting LLMs as Context Engineers
Shared title terminologycs.AIJunrui Zhang, Zeyu Xu, Runchuan Zhu et al.
Ascent: An Agentic System over the Model Context Protocol for Real-World Clinical Data Analysis
Shared title terminologycs.AIAngelo Ziletti, Leonardo D'Ambrosi, Melanie Tuchardt et al.
Compressible Representations: Functional Spines in Deep Neural Networks
Shared title terminologycs.AINiranjan Rajesh, Meenakshi Khosla
Monitorable-by-design architectures for a post-Astra world: a compartmentalization-based approach
Shared title terminologycs.AIJake Watts, Joel Sokol
Learning Multimodal Representations from Partially Paired, Small-Scale Data
Shared title terminologycs.AIMerel Kuijs, Till Richter, Rushin H. Gindra et al.