English

Provably Learning Attention with Queries

Machine Learning 2026-05-05 v2

Abstract

We study the problem of learning Transformer-based sequence models with black-box access to their outputs. In this setting, a learner may adaptively query the oracle with any sequence of vectors and observe the output of the target function. We begin with studying the learnability of the simplest formulation, that is, learning a single-head attention-based regressor with queries. We show that for a model with width dd, there is an elementary algorithm to learn the parameters of single-head attention with O(d2)O(d^2) queries. Further, we show that if there exists an algorithm to learn ReLU feedforward networks (FFNs), then the single-head algorithm can be easily adapted to learn one-layer Transformers with single-head attention. Next, we show that, in the common regime where the head dimension rdr \ll d, single-head attention-based models can be learned with O(rd)O(rd) queries via compressed sensing arguments. We also study robustness to noisy oracle access, proving that under mild norm and margin conditions, the parameters can be estimated to ε\varepsilon accuracy with a polynomial number of queries even when outputs are only provided up to additive tolerance. Finally, we consider the learnability of multi-head attention and show that they are not identifiable from queries, and hence, learnability in the same sense is not feasible without additional assumptions. We discuss potential approaches to learn multi-head attention-based models under certain structural assumptions.

Keywords

Cite

@article{arxiv.2601.16873,
  title  = {Provably Learning Attention with Queries},
  author = {Satwik Bhattamishra and Kulin Shah and Michael Hahn and Varun Kanade},
  journal= {arXiv preprint arXiv:2601.16873},
  year   = {2026}
}

Comments

ICML 2026

R2 v1 2026-07-01T09:17:35.091Z