Iterated Piecewise Affine (IPA) Approximation for
Language Modeling
An intuitive tour of the core ideas
After Shamsi, Hua, Williams (arXiv:2306.12317)
Motivation: From Craft to Principle
Transformers work extremely well, but their architecture feels engineered rather than derived.
Question: Can we derive a competitive architecture by starting from function approximation?
Idea: Treat a language model core as a function F : Rn×m → Rn×m and approximate F with
simple, interpretable pieces.
IPA Approximation 2/12
One-Slide Summary
IPA (Iterated Piecewise Affine):
Start with first-order Taylor (affine) approximations of F .
Make them piecewise using kernels to blend local affine models.
Iterate column/row operations (layers) to build nonlinearity.
Add causality masks + low-rank factors to be language-model ready.
Result: Principled model that mirrors Transformer behavior and performs comparably on
next-token prediction.
IPA Approximation 3/12
Intuition: Taylor, Then Piecewise
Local affine: F (x ) ≈ F (x0 ) + F ′ (x0 )(x − x0 ) is good only near x0 .
Piecewise: Use multiple centers xp with kernels Kp (x ):
P
X X
F (x ) ≈ Kp (x ) F (xp ) + F ′ (xp )(x − xp ) , Kp (x ) = 1.
p=1 p
Matrix case: Work in columns/rows of X ∈ Rn×m to get efficient structures.
IPA Approximation 4/12
Two Views of F : Columns and Rows
Let X = [x·1 · · · x·m ] and F (X ) = [f·1 · · · f·m ].
Column view (per token):
m
X
f·j (X ) ≈ aj + Sj,l x·l
l=1
Row view (per feature):
n
X
fi· (X ) ≈ bi + Ti,r xr ·
r =1
Stack column and row ops alternately ⇒ expressivity with simple blocks.
IPA Approximation 5/12
Kernels: Blending the Pieces
Column kernels:
(p)
Kj,l (X ) ∝ exp x·l⊤ Wp x·j
Row kernels: Gaussian radial kernels.
Why: Kernels softly select and combine local affine parts.
IPA Approximation 6/12
Language Modeling: Causality + Sharing + Low-Rank
Causality: Only past tokens can influence the next token.
Column op: restrict sums to l ≤ j.
Row op: constrain Ti,r for simplicity.
Parameter sharing: reuse across positions.
Low-rank factors: shrink heavy matrices (Wp = SL SR ).
IPA Approximation 7/12
Relationship to Transformers (Intuition)
Column op ≈ token mixing (attention-like).
Row op ≈ feature mixing (feedforward-like).
But IPA is derived from approximation, not attention heuristics.
IPA Approximation 8/12
Evidence: Snapshot of Results (WikiText103)
Comparable to GPT-style decoders with similar parameter budgets.
Model Train loss Test loss Speed
GPT-100 4.51 4.45 ∼28 ms
IPA-100 4.49 4.38 ∼31 ms
GPT-500 3.90 3.90 ∼149 ms
IPA-500 3.98 3.89 ∼147 ms
IPA Approximation 9/12
Why This Matters
Derivation over design — principled path from Taylor to iteration.
Interpretability — local linear pieces + kernels.
Modularity — clear knobs (pieces, kernels, low-rank).
Practicality — competitive LM performance.
IPA Approximation 10/12
Takeaways
IPA offers a mathematically grounded LM alternative:
1. Columns/rows for sequence vs. feature mixing.
2. Kernels select local affine experts.
3. Iteration yields depth + causality.
IPA Approximation 11/12
Reference
Shamsi, D.; Hua, W.-y.; Williams, B.
Iterated Piecewise Affine (IPA) Approximation for Language Modeling.
arXiv:2306.12317.
IPA Approximation 12/12