Frames commute with pointwise linear networks
ProvedIntMul.OpenAI.frame_invariantLet be a commutative ring, a finite set of wire roles and an address set. Each wire carries an array in . A gate consists of the following:
- a coefficient matrix , applied pointwise at every address, ;
- the set of wires it touches, with the identity on rows outside and rows in reading only wires in ;
- an invertible -linear frame of .
Fix source frames and sink frames . The physical execution keeps, for each wire, its current frame , starting from on the supplied arrays . Before gate it applies the edge operator to each touched wire, then applies pointwise, and sets on touched wires. After the last gate it applies the sink edge . The logical execution applies the gates pointwise to . Then for every wire ,
so the implemented operator is .
This is the representation principle of §3.2 (equation (5)) of the OpenAI preprint Integer multiplication below . It allows a finite linear network to be run on whole arrays while each wire's array changes representation along the way. Every κ-saving construction (the OpenAI networks, Colkitt's and Jain's rounds) uses it to turn cheap edge operators into a full address interchange or butterfly layer.
Formalization Note A gate is a triple (C, S, D) in a list, applied in order. The physical state is the pair (current frames, stored arrays).
import Mathlib open Finset
namespace IntMul.OpenAI
theorem frame_invariant {Wr Ω R : Type*} [CommRing R] [Fintype Wr] [DecidableEq Wr]
(gates : List (Matrix Wr Wr R × Finset Wr × ((Ω → R) ≃ₗ[R] (Ω → R))))
(hgates : ∀ g ∈ gates, ∀ w w', (w ∉ g.2.1 → g.1 w w' = if w = w' then 1 else 0) ∧
(w ∈ g.2.1 → w' ∉ g.2.1 → g.1 w w' = 0))
(Din Dout : Wr → ((Ω → R) ≃ₗ[R] (Ω → R))) (f : Wr → Ω → R) :
let physical := gates.foldl
(fun (st : (Wr → ((Ω → R) ≃ₗ[R] (Ω → R))) × (Wr → Ω → R)) g =>
(fun w => if w ∈ g.2.1 then g.2.2 else st.1 w,
fun w ω => ∑ w', g.1 w w' *
(if w' ∈ g.2.1 then g.2.2 ((st.1 w').symm (st.2 w')) else st.2 w') ω))
(Din, f)
let logical := gates.foldl (fun (h : Wr → Ω → R) g => fun w ω => ∑ w', g.1 w w' * h w' ω)
(fun w => (Din w).symm (f w))
∀ w, Dout w ((physical.1 w).symm (physical.2 w)) = Dout w (logical w) := by sorry
end IntMul.OpenAI