<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>schristoph.online</title><link>https://schristoph.online/tags/statespacemodels/</link><description>Personal homepage and blog of Stefan Christoph</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>Stefan Christoph. All rights reserved.</copyright><lastBuildDate>Wed, 22 Jul 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://schristoph.online/tags/statespacemodels/index.xml" rel="self" type="application/rss+xml"/><item><title>The Quadratic Wall: The Algorithmic Race to Beat O(n²) Attention</title><link>https://schristoph.online/blog/beating-quadratic-attention/?utm=rss-feed</link><pubDate>Wed, 22 Jul 2026 00:00:00 +0000</pubDate><guid>https://schristoph.online/blog/beating-quadratic-attention/</guid><description>&lt;div class="tldr" data-pagefind-weight="5" data-pagefind-meta="tldr" style="display:block;font-size:.875em;margin:2rem 0;border-left:4px solid #ccc;padding-left:1rem;line-height:1.5;">&lt;strong>TL;DR:&lt;/strong> Standard self-attention costs on the order of &lt;code>n²&lt;/code> in the sequence length &lt;code>n&lt;/code>, in both arithmetic and the attention-score memory it materialises. Almost every long-context architecture headline of the last few years is an attempt to beat that wall, and the honest way to read them is by which cost axis each one moves. FlashAttention keeps exact &lt;code>O(n²)&lt;/code> &lt;em>arithmetic&lt;/em> but cuts materialised auxiliary memory from &lt;code>O(n²)&lt;/code> to &lt;code>O(n)&lt;/code> and sharply reduces the memory it moves. Sparse attention (when each token attends to a sublinear number of positions), linear attention, and state-space models like Mamba (which its authors report reaching roughly linear time in the sequence length, for a fixed state width) lower the &lt;em>arithmetic&lt;/em> exponent itself by constraining or replacing exact all-pairs attention. Those axes — arithmetic, memory, data movement, latency — do not move together, so no single technique simply &amp;ldquo;wins,&amp;rdquo; and the field has not crowned one. Neither is a free win, and the field has not crowned a winner. The practical takeaway is older than any of these papers: the cheapest quadratic is the one you never trigger, so context discipline and retrieval can beat brute-forcing a longer prompt — when the retrieval earns its keep, which is an end-to-end question to measure.&lt;/div>
&lt;p>Back at university, one exercise showed up in every algorithms course in a slightly different costume: here is the obvious quadratic solution, now can you do better? Sometimes you could drop it to &lt;code>n log n&lt;/code>, sometimes only to a smaller constant, and sometimes the honest answer was that the quadratic was inherent and the interesting work was elsewhere. That instinct, look at an &lt;code>O(n²)&lt;/code> and ask what it would take to beat it, turns out to be the cleanest way I know to read the modern architecture race.&lt;/p></description></item></channel></rss>