MLPs Learn In-Context on Regression and Classification Tasks

William L. Tong, Cengiz Pehlevan
5/24/2024
cs.LGcs.NE

No official code found. Best implementation: wtong98/mlp-icl (12 stars, MIT, last commit 2024-09-16).

Abstract

In-context learning (ICL), the remarkable ability to solve a task from only input exemplars, is often assumed to be a unique hallmark of Transformer models. By examining commonly employed synthetic ICL tasks, we demonstrate that multi-layer perceptrons (MLPs) can also learn in-context. Moreover, MLPs, and the closely related MLP-Mixer models, learn in-context comparably with Transformers under the same compute budget in this setting. We further show that MLPs outperform Transformers on a series of classical tasks from psychology designed to test relational reasoning, which are closely related to in-context classification. These results underscore a need for studying in-context learning beyond attention-based architectures, while also challenging prior arguments against MLPs' ability to solve relational tasks. Altogether, our results highlight the unexpected competence of MLPs in a synthetic setting, and support the growing interest in all-MLP alternatives to Transformer architectures. It remains unclear how MLPs perform against Transformers at scale on real-world tasks, and where a performance gap may originate. We encourage further exploration of these architectures in more complex settings to better understand the potential comparative advantage of attention-based schemes.

View on arXivView PDF

Code Implementations(1)

wtong98/mlp-iclCommunity100%
MIT
121PythonSep 27, 20232 years agoMIT

Similar Papers

Cite this paper

@article{tong2024mlps,
  title  = {MLPs Learn In-Context on Regression and Classification Tasks},
  author = {William L. Tong and Cengiz Pehlevan},
  year   = {2024},
  eprint = {2405.15618},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.15618v3},
  journal = {ICLR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.15618.svg)](https://codeofpaper.com/paper/2405.15618)

Discussion