atlas

Research map / Architectures and efficiency / Attention and transformers

Counting in Small Transformers: The Delicate Interplay between Attention and Feed-Forward Layers

ICML 2025 · Architectures and efficiency › Attention and transformers · approach: Transformer expressivity and learnability · 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.

Analyzes how one-layer transformer blocks (token mixing plus MLP) solve the histogram/counting task, identifying relation-based and inventory-based counting strategies and how embedding size, FFN width, softmax and BOS token shape the learned solutions.

Problem

Understanding which algorithms simple transformer blocks implement for counting (histogram task), and how architectural choices (token mixing type, softmax, BOS token, embedding dimension, feed-forward width) determine the solution space and feasibility.

Approach

Identifies two counting strategies, relation-based counting (pairwise token comparisons via dot-product attention, needs only one FFN neuron) and inventory-based counting (FFN memorizes the alphabet, needs p>=T), gives explicit constructions for each architecture, and bounds embedding dimension for non-orthogonal embeddings via mutual coherence and softmax error reduction.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Increase hidden-layer size from p=1 to p=T (ablation)Learned dot model · Histogram (d≥T)accuracy: 100% -> 99%Hurt
Add softmax to dot-product mixing (ablation)dot attention · Histogram (p=1)accuracyHurt
Add a BOS token to softmax dot-product attentiondot+sftm · Histogram (d≥T, p=1)accuracyHelped
Use softmax in token mixing (ablation)dot-product attention · Histogram (d<T)accuracyHelped
Use relation-based counting with dot-product mixing instead of inventory-based countingHistogram transformer · Histogram (d≥T, p=1)accuracyHelped

Surprising findings

Limitations

Experimental setup

Datasets: synthetic histogram task sequences

Benchmarks: histogram task (T=32, L=10) accuracy counting prompts for Mistral-7B and Llama-3.1-8B

Metrics: accuracy

Baselines: mistral-7B-v0.1 Llama-3.1-8B

Builds on: RASP Welch bound

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