Free Energy Mixer
Jiecheng Lu, Shihao Yang
TL;DR
The paper targets the limitation that standard attention stores full KV caches losslessly but reads them through a single per-head convex combination, which hinders per-channel index selection. It introduces the Free Energy Mixer (FEM), a variational read that, for each channel, optimizes a posterior over past indices using a value-driven tilt: F_{t,j}(β) = (1/β) log ∑_{i∈M_t} p_t(i) exp(β v_{i,j}), with posterior q^{(β)}_{t,j}(i) ∝ p_t(i) exp(β v_{i,j}). FEM preserves the base complexity and can smoothly interpolate from averaging to near hard indexing via a learnable per-channel temperature, implemented through a two-level gating scheme (inner temperature λ_t and outer gate g_t) and optional low-rank local conditioning. The approach is compatible with various priors (softmax, linear attention, RNNs, SSMs) and acts as a universal fast-weight programmer by enabling channel-wise, value-aware cross-token competition without altering asymptotic costs. Empirically, FEM variants outperform strong baselines across NLP, vision, and time-series tasks at matched parameter budgets, with key gains arising from the LSE and temperature components; the method also demonstrates favorable latency and memory characteristics in practical settings.
Abstract
Standard attention stores keys/values losslessly but reads them via a per-head convex average, blocking channel-wise selection. We propose the Free Energy Mixer (FEM): a free-energy (log-sum-exp) read that applies a value-driven, per-channel log-linear tilt to a fast prior (e.g., from queries/keys in standard attention) over indices. Unlike methods that attempt to improve and enrich the $(q,k)$ scoring distribution, FEM treats it as a prior and yields a value-aware posterior read at unchanged complexity, smoothly moving from averaging to per-channel selection as the learnable inverse temperature increases, while still preserving parallelism and the original asymptotic complexity ($O(T^2)$ for softmax; $O(T)$ for linearizable variants). We instantiate a two-level gated FEM that is plug-and-play with standard and linear attention, linear RNNs and SSMs. It consistently outperforms strong baselines on NLP, vision, and time-series at matched parameter budgets.
