<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Attention on Programmer.ie: Modern AI programming</title>
    <link>http://programmer.ie/tags/attention/</link>
    <description>Recent content in Attention on Programmer.ie: Modern AI programming</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 08 Aug 2026 15:00:00 +0100</lastBuildDate>
    <atom:link href="http://programmer.ie/tags/attention/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Models From First Principles 06: Inside Tiny — Residual Blocks, Attention and Sparse Autoencoders</title>
      <link>http://programmer.ie/post/models-from-first-principles-06/</link>
      <pubDate>Sat, 08 Aug 2026 15:00:00 +0100</pubDate>
      <guid>http://programmer.ie/post/models-from-first-principles-06/</guid>
      <description>&lt;h1 id=&#34;inside-tiny-residual-blocks-attention-and-sparse-autoencoders&#34;&gt;Inside Tiny: Residual Blocks, Attention and Sparse Autoencoders&lt;/h1&gt;&#xA;&lt;p&gt;In the previous post, we built a compact recursive model around one idea:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;context + candidate + latent state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              ↓&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          projection&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              ↓&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;         reusable core&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              ↓&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       proposed update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              ↓&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      z ← z + α · update&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              ↓&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            repeat&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That architecture looked more sophisticated than MR.Q, EBT or SICQL because it introduced recurrence.&lt;/p&gt;&#xA;&lt;p&gt;But the central idea of this series is that a model stops looking mysterious when we keep opening it.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PyTorch Attention Shapes: Q, K, V, Multi-Head Attention Masks and Transformer Dimension Errors</title>
      <link>http://programmer.ie/post/pytorch-zero-to-hero-07/</link>
      <pubDate>Sat, 08 Aug 2026 13:30:00 +0100</pubDate>
      <guid>http://programmer.ie/post/pytorch-zero-to-hero-07/</guid>
      <description>&lt;h2 id=&#34;pytorch-zero-to-hero--step-07&#34;&gt;PyTorch: Zero to Hero — Step 07&lt;/h2&gt;&#xA;&lt;p&gt;Attention code is where tensor-shape mistakes stop being annoying and start becoming architectural.&lt;/p&gt;&#xA;&lt;p&gt;A CNN usually makes its dimensional assumptions fairly obvious. Attention does not.&lt;/p&gt;&#xA;&lt;p&gt;A tensor that starts as:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;(batch, sequence, embedding)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;is projected into Q, K and V, split into heads, transposed, multiplied, masked, normalized, multiplied again, transposed again, concatenated and projected back to the embedding dimension.&lt;/p&gt;&#xA;&lt;p&gt;A single bad &lt;code&gt;view&lt;/code&gt;, &lt;code&gt;transpose&lt;/code&gt;, mask shape or head calculation can produce anything from an immediate runtime error to a model that trains while attending to the wrong tokens.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
