atlas

Research map / Architectures and efficiency / Attention and transformers

Language Models Need Inductive Biases to Count Inductively

ICLR 2025 · Architectures and efficiency › Attention and transformers · approach: Attention head mechanisms · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Trains RNNs, LSTMs, Transformers with five positional embeddings, SSMs and RWKV from scratch on synthetic counting tasks to test whether they can count inductively to OOD lengths.

Problem

Whether language models can learn to count inductively, i.e., generalize counting to cardinalities and sequence lengths beyond those seen in training, a capability underlying many claimed Transformer primitives.

Approach

Designs counting task formats (helper token, shifted start, modular, selective) that expose the number vocabulary without exposing OOD cardinalities, then compares architectures and positional embeddings, finding RNN/LSTM generalize while Transformers need specific PEs and modern RNNs underperform.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use RoPE with 4 layers for shifted-start counting rather than NoPE with 4 layersTransformer · Shifted Start OODaccuracy: 46.1 -> 98.86Helped
Use SinePE or APE rather than NoPE for modular countingTransformer · Modular (mod10) OODaccuracy: 11.8 -> 100Helped
Use NoPE rather than RoPE for selective countingTransformer · Selective OODaccuracy: 52.5 -> 100Helped
Use LSTM rather than Mamba for modular countingRecurrent models · Modular (mod10) OODaccuracy: 11.5 -> 100Helped
Add shifted start to the helper-token task (ablation)Transformer 2L RoPE · Helper Token + Shifted Start OODaccuracy: 100 -> 78.7Hurt
Add BOS to NoPE (ablation)Transformer NoPE · Modular (mod10) OODaccuracy: 11.8 -> 10.1No clear effect
Add BOS to RoPE (ablation)Transformer RoPE · Modular (mod10) OODaccuracy: 11.8 -> 27.8Helped
Remove causal masking (ablation)NoPE 1L Transformer on first-token recognition · first_tok_heterogeneous OODaccuracy: 100 -> 0.0Hurt
Add a helper token to expose larger counts using another token (ablation)Transformer shifted-start counting · Shifted Start OODaccuracyMixed
Replace shifted positional embeddings with randomized positional embeddings (ablation)Transformer · Counting OODaccuracyHurt
Increase the OOD sequence length to four times the training length (ablation)Transformer 4L RoPE shifted-start counting · Shifted Start OODaccuracyHurt

Surprising findings

Limitations

Experimental setup

Datasets: synthetic counting sequences (vanilla+succession, helper token, shifted start, modular, selective, first_tok_homogeneous

Benchmarks: synthetic counting IND/OOD test sets

Metrics: accuracy (IND and OOD, best checkpoint over five seeds) median accuracy over five seeds

Baselines: Transformer NoPE Transformer SinePE Transformer APE Transformer RoPE Transformer SPE RNN LSTM S4 Mamba RWKV-v6

Builds on: RoPE Mamba RWKV shifted position IDs

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy