Multi-layer Cross-Attention is Provably Optimal for Multi-modal In-context Learning

arXiv stat.ML / 4/29/2026

💬 OpinionIdeas & Deep AnalysisModels & Research

Key Points

  • The paper studies in-context learning in transformer-like models for multi-modal data, which has been less theoretically understood than the unimodal case.
  • It introduces a mathematically tractable latent-factor framework to analyze when in-context learning can achieve Bayes-optimal performance.
  • The authors prove a negative result: a single-layer, linear self-attention architecture cannot uniformly recover the Bayes-optimal predictor across the task distribution.
  • To overcome this, they propose a linearized multi-layer cross-attention mechanism and analyze it in a large-depth and large-context-length regime.
  • They further show that, under gradient-flow optimization, the proposed cross-attention mechanism is provably Bayes optimal, highlighting the value of depth and cross-attention for multi-modal learning.

Abstract

Recent progress has rapidly advanced our understanding of the mechanisms underlying in-context learning in modern attention-based neural networks. However, existing results focus exclusively on unimodal data; in contrast, the theoretical underpinnings of in-context learning for multi-modal data remain poorly understood. We introduce a mathematically tractable framework for studying multi-modal learning and explore when transformer-like architectures can recover Bayes-optimal performance in-context. To model multi-modal problems, we assume the observed data arises from a latent factor model. Our first result comprises a negative take on expressibility: we prove that single-layer, linear self-attention fails to recover the Bayes-optimal predictor uniformly over the task distribution. To address this limitation, we introduce a novel, linearized cross-attention mechanism, which we study in the regime where both the number of cross-attention layers and the context length are large. We show that this cross-attention mechanism is provably Bayes optimal when optimized using gradient flow. Our results underscore the benefits of depth for in-context learning and establish the provable utility of cross-attention for multi-modal distributions.