Filter Equivariant Functions: A symmetric account of length-general extrapolation on lists

Owen Lewis, Neil Ghani, Andrew Dudzik, Christos Perivolaropoulos, Razvan Pascanu, Petar Veličković

TL;DR

This paper introduces filter equivariant functions, a new mathematical class of list-processing functions that commute with filtering operations. By formalizing this symmetry, the authors show that a function's behavior on arbitrarily long lists can be perfectly extrapolated from how it behaves on tiny sublists containing just two unique elements.

What Problem Does This Paper Address?

While modern neural networks excel at many tasks, length-based generalization remains a major blind spot. A model trained to process or sort lists of length 20 will routinely fail when faced with lists of length 20,000.

From a foundational perspective, this is an instance of the philosophical "rule-following" paradox popularized by Saul Kripke: given a finite set of examples (e.g., sorting short lists), there are infinitely many ways to extrapolate that behavior to longer lists. To force a model to extrapolate "correctly," we need mathematical constraints—symmetries—that dictate how a function must behave across different lengths.

While map equivariance (commuting with element-wise transformations) ensures a function doesn't depend on specific element values, it does nothing to constrain behavior across different lengths. This paper fills that gap by introducing symmetries based on element removal.

Methods

The authors propose Filter Equivariance (FE). A list function $f$ is filter-equivariant if applying a filter predicate $\phi$ before or after $f$ yields the exact same result.

Figure 1: We leverage filter equivariance as a way to express functions which are length-invariant through removing items by value. Generally, a filter-equivariant (FE) function f may be composed with filter in any order, yielding the same results at the end.

When a function is both map-equivariant and filter-equivariant, it is called a Natural Filter Equivariant (NFE).

To analyze these functions, the authors leverage simplicial algebra and category theory. They model list lengths using the semi-simplicial category $\Delta$ and introduce a category called Bag to handle multisets (lists with repeated elements).

Their crowning methodological contribution is the Amalgamation Algorithm. This algorithm takes the outputs of a filter-equivariant function on all sublists containing only two unique elements and deterministically "glues" them back together using a majority-voting scheme to reconstruct the correct, perfectly extrapolated output for a list of any length.

Datasets

Not discussed in the paper. This is a purely theoretical paper focused on establishing mathematical foundations and algorithms; no empirical machine learning datasets or benchmarks were evaluated.

Key Insights and Ideas

  • The Power of Two: For an NFE (like reverse), its global behavior across all possible list lengths is completely determined by how it behaves on a single example of length two (e.g., knowing reverse [2, 3] = [3, 2] is mathematically sufficient to deduce reverse for any list). For general FEs (like sort), the behavior is determined by its behavior on all sublists with two unique elements.
  • Relative vs. Absolute Position: Filter equivariance naturally prevents functions from relying on absolute indices (e.g., "duplicate the 3rd element"), because filtering shifts absolute positions. Instead, FE forces functions to rely only on relative positions or value relationships, which is exactly what enables robust length generalization.
  • Monoids over Groups: Unlike standard Geometric Deep Learning (GDL), which relies on invertible group transformations (like rotations), filtering is lossy and non-invertible. This means FE operates over monoids, pushing the boundaries of GDL into the realm of categorical deep learning.

Key Results

  • The Amalgamation Theorem: The authors prove that any FE function can be perfectly reconstructed from its behavior on two-element sublists. They provide a concrete pseudocode implementation of this algorithm.
  • Counting NFEs: The paper proves that the number of distinct $k$-NFEs (NFEs that map singletons to lists of length $k$) is exactly $2 \times 3^{k-1}$ for $k \ge 1$. For example, there are only six possible 2-NFEs in existence (including inflate 2 and identity ++ identity).
  • Inductive Characterization: The authors successfully define NFEs as an inductive data type in Haskell, proving a bijection between NFEs and List(Nat + Nat).

Limitations and Future Work

  • Integration with Neural Networks: Because filter operations form a monoid rather than a group, standard geometric deep learning layers cannot easily incorporate filter equivariance. Translating these theoretical constraints into practical neural network layers remains an open challenge.
  • Context-Dependent Functions: The framework cannot currently accommodate functions like ripple-carry addition. In addition, adjacent digits must communicate via carries, meaning local subproblems are not independent.
  • Higher-Order Extensions: The authors limit their base case to sublists of two unique elements. They note that future work should explore extending this to sublists of $n$ unique elements to capture more complex classes of functions.

Summary updated

BibTeX
@misc{lewis2025filter,
  author = {Owen Lewis and Neil Ghani and Andrew Dudzik and Christos Perivolaropoulos and Razvan Pascanu and Petar Veličković},
  title = {{Filter Equivariant Functions: A symmetric account of length-general extrapolation on lists}},
  year = {2025},
  eprint = {2507.08796},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.08796},
}

Loading related content...

Figure