atlas

Research map / Large language models / Language, safety and interpretability

How Do Position Encodings Affect Length Generalization? Case Studies On In-Context Function Learning

AAAI 2025 · Large language models › Language, safety and interpretability · approach: In-context learning analysis · 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 small from-scratch decoder-only Transformers via meta-learning on regression and Boolean in-context function tasks to study how position encodings (NoPE, ALiBi, FIRE, dynamic YaRN) affect length generalization.

Problem

Length generalization of in-context learning in Transformers: ICL performance degrades on inputs longer than those seen in training, and the role of position encodings in this failure is unclear.

Approach

Uses in-context function learning tasks with position-bias-free data (regression and Boolean functions) trained from scratch so that length extrapolation is affected only by the position encoding choice; compares PEs and analyzes recency bias, induction heads, and serial-position effects.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use positional encodings instead of NoPETransformer for in-context function learning · OOD sequence lengthslength generalizationHelped
Use ALiBi or FIRE instead of NoPETransformer for in-context function learning · Linear Regressionsquared errorHelped
Use ALiBi or FIRE instead of NoPETransformer for in-context function learning · Sparse MajorityaccuracyHelped
Use Dynamic YaRNTransformer for in-context function learning · Sparse MajorityaccuracyHurt
Use FIRE at OOD lengthsTransformer for in-context function learning · 0-1 Threshold FunctionsaccuracyHurt
Use positional encodings instead of NoPETransformer for in-context function learning · Conjunction and DisjunctionaccuracyNo clear effect
Use positional encodings instead of NoPETransformer for in-context function learning · ParityaccuracyNo clear effect
Increase model size (ablation)NoPE Transformer · Linear Regressionsquared errorHurt
Use ALiBi instead of NoPETransformer for in-context function learning · Linear Regression and Sparse Majorityattention to recent tokensMixed
Add positional encodingsTransformer for in-context function learning · Repeated in-context examplesinduction-head effectivenessHurt
Repeat non-informative data at inferenceALiBi Transformer · Duplicated data attackerror rateHurt
Repeat non-informative data at inferenceFIRE Transformer · Duplicated data attackerror rateHurt

Surprising findings

Limitations

Experimental setup

Datasets: synthetic in-context regression functions (linear regression, sparse linear regression, decision tree, ReLU networks) synthetic Boolean functions (conjunction, disjunction, sparse majority, 0-1 threshold, integer halfspace, parity)

Benchmarks: in-context linear regression Boolean function tasks (conjunction, disjunction, sparse majority, 0-1 threshold, integer halfspace, parity)

Metrics: squared error accuracy

Baselines: NoPE ALiBi FIRE Dynamic YaRN Null Classifier least squares

Builds on: Garg et al. 2022 in-context function learning Bhattamishra et al. 2024 Boolean function ICL Llama 2 architecture ALiBi FIRE YaRN

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