# A Transformer-Derived Iterative Preconditioner

*Patrick Lutz, Themistoklis Haris, Aditya Gangrade, Venkatesh Saligrama*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/153148) · [Open on the map](../papers.html#p153148)

Category: [Causality, Privacy & Learning Theory](../pcat/11.md) › [Neural Network Robustness Verification](../pgroup/56.md) · Type: new method · Keywords: transformer, preconditioning, iterative algorithms, numerical linear algebra, algorithm discovery, Walsh-Hadamard mixing

Areas: [Optimization & Algorithms](../areas/optimization.md) › Optimization Dynamics › Optimization methods

## Summary
The paper shows that a softmax-attention-only transformer trained on in-context linear regression discovers an iterative symmetric preconditioning primitive and introduces RAPID, an explicit anytime preconditioner for SPD systems that accelerates conjugate-gradient solvers.

## Explained to a 5-year-old
A computer program that looks at math problems learned how to make them easier to solve. It found a simple rule that changes the numbers in a special way to improve the problem. This rule was turned into a tool that can be used right away without any learning. The tool helps solve big math problems faster by making them more balanced. It works well on many different kinds of math problems used in science and engineering.

## Explained to a 5-year-old, longer
Scientists wanted computers to solve big math problems more quickly. They built a tiny program that only pays attention to numbers, like how we focus on words. This program was taught using simple math examples where it had to guess the answer. While learning, the program discovered a handy trick that changes the numbers in a balanced way. The trick uses a random mix of numbers and a small correction to keep things simple. The researchers turned this trick into a clear recipe that can be used right away. The recipe works by creating a factor that, when combined with the original numbers, makes the problem easier. Because the problem becomes easier, the solving process finishes faster. Each step of the recipe is quick, taking about the size of the problem squared. In an ideal case, the recipe reaches the goal in a number of steps that grows slowly with the problem’s difficulty. Tests show it speeds up solving real-world scientific problems and works on many different kinds of problems. The approach is versatile and can be applied to many areas where large math problems appear.

## For a technical reader
The work trains a pure-attention transformer on in-context linear regression to uncover algorithmic primitives, then distills these primitives via a symmetry-based intervention into a two-scalar update that performs Gram-matrix congruence. This yields an explicit, anytime preconditioner that constructs factors using Walsh-Hadamard mixing and sparse row-min corrections, achieving widetilde O(d2) dense iterations. Theoretical analysis under a Haar-mixing model guarantees widetilde O(dlogκ(A0)) iterations to reach a target condition number, and experiments confirm rapid conditioning improvement and accelerated conjugate-gradient solves across diverse SPD problems.

## Problem
Improving the conditioning of symmetric positive-definite linear systems to accelerate iterative solvers is a fundamental challenge in numerical linear algebra. Existing preconditioners are often manually designed, and there is a need for automatically discovered, efficient preconditioning strategies.

## Method
The authors train a softmax-attention-only transformer on in-context linear regression to discover algorithmic primitives, then apply a layerwise symmetry intervention to distill a two-scalar update that performs Gram matrix congruence updates. This primitive is formalized into an explicit preconditioner that constructs factors using randomized Walsh-Hadamard mixing and sparse row-min corrections, yielding dense iterations in widetilde O(d2) time.

## Results
The approach reaches useful condition numbers quickly, accelerates end-to-end conjugate-gradient solves, and improves conditioning across all tested spectral families and real-world SPD problems. Under a Haar-mixing idealization, it reaches a target condition number in widetilde O(dlogκ(A0)) expected iterations.

## Contributions
It demonstrates that a transformer can discover an iterative symmetric preconditioning primitive and provides a systematic method to extract this primitive into an explicit, anytime preconditioner for SPD systems. The work also includes theoretical analysis of its convergence and empirical validation on diverse problem classes.

## Limitations and assumptions
The theoretical guarantee assumes a Haar-mixing idealization, and the method was discovered using a specific transformer setup, which may limit direct applicability to other architectures.

## Practical relevance
The approach can accelerate iterative solvers for a wide range of scientific and engineering problems involving symmetric positive-definite systems, offering faster and more robust numerical computations.

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/153148)
