In-Context Algebra
- URL: http://arxiv.org/abs/2512.16902v1
- Date: Thu, 18 Dec 2025 18:56:50 GMT
- Title: In-Context Algebra
- Abstract summary: We investigate the mechanisms that arise when transformers are trained to solve arithmetic on sequences where tokens are variables whose meaning is determined only through their interactions.<n>We devise a new task in which the assignment of symbols to specific algebraic group elements varies from one sequence to another.
- Score: 25.99258547745488
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: We investigate the mechanisms that arise when transformers are trained to solve arithmetic on sequences where tokens are variables whose meaning is determined only through their interactions. While prior work has found that transformers develop geometric embeddings that mirror algebraic structure, those previous findings emerge from settings where arithmetic-valued tokens have fixed meanings. We devise a new task in which the assignment of symbols to specific algebraic group elements varies from one sequence to another. Despite this challenging setup, transformers achieve near-perfect accuracy on the task and even generalize to unseen algebraic groups. We develop targeted data distributions to create causal tests of a set of hypothesized mechanisms, and we isolate three mechanisms models consistently learn: commutative copying where a dedicated head copies answers, identity element recognition that distinguishes identity-containing facts, and closure-based cancellation that tracks group membership to constrain valid answers. Complementary to the geometric representations found in fixed-symbol settings, our findings show that models develop symbolic reasoning mechanisms when trained to reason in-context with variables whose meanings are not fixed.
Related papers
- A train--prune--readout--rewrite workflow for interpretable quantum learning [5.641464469724376]
AI for Science aims not only to predict complex physical systems from data, but also to extract mathematical structure and physically testable representations from learned models.<n>Here, a train--prune--readout--rewrite workflow is developed that separates physical-domain grounding from three increasingly stringent analysis claims.<n>The workflow is implemented with complex-valued networks, whose explicit edge functions enable post-pruning analytic readout of the retained computation.
arXiv Detail & Related papers (2026-09-14T07:12:21Z) - A Mechanistic Study of Tabular Foundation Models [12.26738662548555]
Tabular foundation models converge in accuracy across a range of classification and regression tasks.<n>This raises questions a leaderboard cannot answer.<n>We characterize all three: (i) whether the models execute the same in-context algorithm, (ii) where row, column, and class-permutation invariances originate, and (iii) how robust they are under perturbations engineered against the inferred mechanism.
arXiv Detail & Related papers (2026-05-20T15:23:16Z) - Geometric Factual Recall in Transformers [57.48371649045765]
A common view casts internal weight matrices as associative memories over pairs of embeddings, requiring memorization counts that scale linearly with the number of facts.<n>We develop a theoretical and empirical account of an alternative, emphgeometric form of memorization in which learned embeddings encode structure directly.<n>In a controlled setting where a single-layer transformer must memorize random vectors from subjects to a shared attribute set, we prove that a logarithmic embedding dimension suffices.<n>We extend these results to the multi-hop setting, providing constructions with and without chain-of-thought that exhibit a provable
arXiv Detail & Related papers (2026-05-12T17:22:22Z) - To See the Unseen: on the Generalization Ability of Transformers in Symbolic Reasoning [34.300040798165774]
We investigate the ability of decoder-only transformer models to perform abstract symbolic reasoning.<n>We show that a particular representational collapse also has a crucial role: the unembeddings of unseen tokens collapse to nearly the same vector during training.
arXiv Detail & Related papers (2026-04-23T12:51:10Z) - Identifiable Equivariant Networks are Layerwise Equivariant [12.83273311392079]
We investigate the relation between end-to-end equivariance and layerwise equivariance in deep neural networks.<n>Our results provide a mathematical explanation for the emergence of equivariant structures in the weights of neural networks during training.
arXiv Detail & Related papers (2026-01-29T12:47:51Z) - Provable In-Context Learning of Nonlinear Regression with Transformers [66.99048542127768]
In-context learning (ICL) is the ability to perform unseen tasks using task specific prompts without updating parameters.<n>Recent research has actively explored the training dynamics behind ICL, with much of the focus on relatively simple tasks.<n>This paper investigates more complex nonlinear regression tasks, aiming to uncover how transformers acquire in-context learning capabilities.
arXiv Detail & Related papers (2025-07-28T00:09:28Z) - Machines and Mathematical Mutations: Using GNNs to Characterize Quiver Mutation Classes [4.229995708813431]
We use graph neural networks to investigate emphquiver mutation -- an operation that transforms one quiver into another.<n>In the study of cluster algebras, the question of emphmutation equivalence is of fundamental concern.<n>We show that our model captures structure within its hidden representation that allows us to reconstruct known criteria from type $D$.
arXiv Detail & Related papers (2024-11-12T01:09:41Z) - Initialization is Critical to Whether Transformers Fit Composite Functions by Reasoning or Memorizing [10.206921909332006]
Transformers have shown impressive capabilities across various tasks, but their performance on compositional problems remains a topic of debate.<n>We discover that the parameter initialization scale plays a critical role in determining whether the model learns inferential (reasoning-based) solutions.<n>We further find that inferential (reasoning-based) solutions exhibit low complexity bias, which we hypothesize is a key factor enabling them to learn individual mappings for single anchors.
arXiv Detail & Related papers (2024-05-08T20:23:24Z) - Nonparametric Partial Disentanglement via Mechanism Sparsity: Sparse
Actions, Interventions and Sparse Temporal Dependencies [58.179981892921056]
This work introduces a novel principle for disentanglement we call mechanism sparsity regularization.
We propose a representation learning method that induces disentanglement by simultaneously learning the latent factors.
We show that the latent factors can be recovered by regularizing the learned causal graph to be sparse.
arXiv Detail & Related papers (2024-01-10T02:38:21Z) - From Bricks to Bridges: Product of Invariances to Enhance Latent Space Communication [19.336940758147442]
It has been observed that representations learned by distinct neural networks conceal structural similarities when the models are trained under similar inductive biases.
We introduce a versatile method to directly incorporate a set of invariances into the representations, constructing a product space of invariant components on top of the latent representations.
We validate our solution on classification and reconstruction tasks, observing consistent latent similarity and downstream performance improvements in a zero-shot stitching setting.
arXiv Detail & Related papers (2023-10-02T13:55:38Z) - Self-Supervised Learning for Group Equivariant Neural Networks [75.62232699377877]
Group equivariant neural networks are the models whose structure is restricted to commute with the transformations on the input.
We propose two concepts for self-supervised tasks: equivariant pretext labels and invariant contrastive loss.
Experiments on standard image recognition benchmarks demonstrate that the equivariant neural networks exploit the proposed self-supervised tasks.
arXiv Detail & Related papers (2023-03-08T08:11:26Z) - How Do Transformers Learn Topic Structure: Towards a Mechanistic
Understanding [56.222097640468306]
We provide mechanistic understanding of how transformers learn "semantic structure"
We show, through a combination of mathematical analysis and experiments on Wikipedia data, that the embedding layer and the self-attention layer encode the topical structure.
arXiv Detail & Related papers (2023-03-07T21:42:17Z) - Equivariant Disentangled Transformation for Domain Generalization under
Combination Shift [91.38796390449504]
Combinations of domains and labels are not observed during training but appear in the test environment.
We provide a unique formulation of the combination shift problem based on the concepts of homomorphism, equivariance, and a refined definition of disentanglement.
arXiv Detail & Related papers (2022-08-03T12:31:31Z) - Homomorphism Autoencoder -- Learning Group Structured Representations from Observed Transitions [51.71245032890532]
We propose methods enabling an agent acting upon the world to learn internal representations of sensory information consistent with actions that modify it.
In contrast to existing work, our approach does not require prior knowledge of the group and does not restrict the set of actions the agent can perform.
arXiv Detail & Related papers (2022-07-25T11:22:48Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.