Counting and Algorithmic Generalization with Transformers

Simon Ouellette, Rolf Pfister, Hansueli Jud
10/12/2023
cs.LG

No confident code implementation found for this paper.

Abstract

Algorithmic generalization in machine learning refers to the ability to learn the underlying algorithm that generates data in a way that generalizes out-of-distribution. This is generally considered a difficult task for most machine learning algorithms. Here, we analyze algorithmic generalization when counting is required, either implicitly or explicitly. We show that standard Transformers are based on architectural decisions that hinder out-of-distribution performance for such tasks. In particular, we discuss the consequences of using layer normalization and of normalizing the attention weights via softmax. With ablation of the problematic operations, we demonstrate that a modified transformer can exhibit a good algorithmic generalization performance on counting while using a very lightweight architecture.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{ouellette2023counting,
  title  = {Counting and Algorithmic Generalization with Transformers},
  author = {Simon Ouellette and Rolf Pfister and Hansueli Jud},
  year   = {2023},
  eprint = {2310.08661},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2310.08661v2}
}

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/2310.08661.svg)](https://codeofpaper.com/paper/2310.08661)

Discussion