Skip to content
DraconiticResearch
Search Sources API
197,693 studies31 sourcesUpdated 46 min ago
PreprintCC BY-NC-SA 4.0arXiv

One-Layer Transformer Provably Learns Multiclass One-Nearest Neighbor in Context

Abstract

We extend recent work establishing an equivalence between one-layer transformers and nearest-neighbor classifiers in the binary setting to the multiclass case. By leveraging the simplex encoding, we show that one-layer transformers with an argmax classification head behave identically to a one-nearest-neighbor classifier in the multiclass setting. This closes a gap left by prior work, whose multiclass result relied on a non-standard rounding-based approach rather than the typical argmax head used in practice.

Related

  1. One-Layer Transformers Provably Learn In-Context K-Nearest Neighbor Prediction with Chain-of-Thought
    Lyumin Wu, Yuan Cao
    arXivPreprintCC BY 4.0Full textStatisticsarXiv
  2. Stochastic dominance of first return times for nearest-neighbor random walks on ℤd
    Shoou-Ren Hsiau, Ting-Yi Tsai, Yi-Ching Yao
    arXivPreprintarXiv licenceFull textProbabilityarXiv
  3. The nearest neighbor interchange proximity measure for the tree-basedness of rooted binary phylogenetic networks
    Martin Frohn, Takatora Suzuki
    arXivPreprintarXiv licenceFull textEvolutionary biologyOptimisation & controlarXiv
  4. Vectorized Generalized Nearest Neighbor Decoding for In-block Memory Channel
    Yuhao Liu, Xinwei Li, Shuqin Pang +2
    arXivPreprintCC BY 4.0Full textGeneral mathematicsarXiv
  5. Orthogonal Inference for Conditional Z-Estimation without Cross-Fitting: A Distributional Nearest-Neighbor Approach
    Jakob R. Juergens
    arXivPreprintarXiv licenceFull textStatisticsarXiv
BibTeX
@misc{athreya2026onelayer,
  title = {{One-Layer Transformer Provably Learns Multiclass One-Nearest Neighbor in Context}},
  author = {Skanda Athreya and Yutong Wang},
  howpublished = {arXiv},
  year = {2026},
  month = sep,
  doi = {10.48550/arxiv.2609.01311},
  eprint = {2609.01311},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.01311},
  note = {CC BY-NC-SA 4.0},
}
RIS
TY  - UNPB
TI  - One-Layer Transformer Provably Learns Multiclass One-Nearest Neighbor in Context
AU  - Skanda Athreya
AU  - Yutong Wang
PY  - 2026
DA  - 2026/09/01
PB  - arXiv
DO  - 10.48550/arxiv.2609.01311
UR  - https://arxiv.org/abs/2609.01311
AB  - We extend recent work establishing an equivalence between one-layer transformers and nearest-neighbor classifiers in the binary setting to the multiclass case. By leveraging the simplex encoding, we show that one-layer transformers with an argmax classification head behave identically to a one-nearest-neighbor classifier in the multiclass setting. This closes a gap left by prior work, whose multiclass result relied on a non-standard rounding-based approach rather than the typical argmax head used in practice.
ER  -