<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Attention-Encodings on This Might Be Something!</title><link>https://notes.danavery.com/tags/attention-encodings/</link><description>Recent content in Attention-Encodings on This Might Be Something!</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 06 May 2025 12:45:57 -0700</lastBuildDate><atom:link href="https://notes.danavery.com/tags/attention-encodings/index.xml" rel="self" type="application/rss+xml"/><item><title>One Double RoBERTa, with a Side of Strange</title><link>https://notes.danavery.com/posts/2025-05-06-double-roberta/</link><pubDate>Tue, 06 May 2025 12:45:57 -0700</pubDate><guid>https://notes.danavery.com/posts/2025-05-06-double-roberta/</guid><description>Token encoding patterns in roberta-large are harder to spot than in roberta-base. Same architecture, more capacity, very different dynamics.</description></item><item><title>What's Going On at Layer 5?</title><link>https://notes.danavery.com/posts/2025-04-29-layer-5/</link><pubDate>Tue, 29 Apr 2025 13:25:15 -0700</pubDate><guid>https://notes.danavery.com/posts/2025-04-29-layer-5/</guid><description>In layer 5 of the RoBERTa transformer model, there&amp;#39;s a huge jump in token encodings at attention layer 5. Which tokens are affected, and why?</description></item><item><title>More Attention to Attention</title><link>https://notes.danavery.com/posts/2025-04-22-more-attention/</link><pubDate>Tue, 22 Apr 2025 10:51:26 -0700</pubDate><guid>https://notes.danavery.com/posts/2025-04-22-more-attention/</guid><description>How much does a token&amp;#39;s meaning shift across transformer layers? I compared three metrics and found that each one shows a different part of the picture.</description></item><item><title>Paying Attention Part 2</title><link>https://notes.danavery.com/posts/2024-11-08-paying-attention-part-2/</link><pubDate>Fri, 08 Nov 2024 11:59:45 -0700</pubDate><guid>https://notes.danavery.com/posts/2024-11-08-paying-attention-part-2/</guid><description>&lt;p&gt;A greatly-revised attention-encodings project is out and available &lt;a href="http://demo.danavery.com/attention-encodings"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I realized in the previous incarnation of this project I was comparing per-head attention outputs to value-encodings over the entire model vocabulary, which was a clever idea. The problem is that I forgot about the residual connection around the attention mechanism. So the project was essentially comparing the residual &amp;ldquo;deltas&amp;rdquo; against the original encodings, which might make some sense if you were just wondering how &amp;ldquo;far&amp;rdquo; an encoding moves at each layer.&lt;/p&gt;</description></item><item><title>Paying Attention to Attention</title><link>https://notes.danavery.com/posts/2024-10-31-paying-attention/</link><pubDate>Thu, 31 Oct 2024 10:15:13 -0700</pubDate><guid>https://notes.danavery.com/posts/2024-10-31-paying-attention/</guid><description>&lt;p&gt;Fresh off the last experiment, I&amp;rsquo;ve decided to go back to an old experiment and dig a little deeper.&lt;/p&gt;
&lt;p&gt;A while ago I was working on &lt;a href="https://demo.danavery.com/attention-encodings"&gt;an experiment&lt;/a&gt; trying to figure out what attention layers are actually doing in transformers.&lt;/p&gt;
&lt;p&gt;The traditional introduction to transformers goes something like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You turn your text into tokens&lt;/li&gt;
&lt;li&gt;You create embeddings for each of those tokens&lt;/li&gt;
&lt;li&gt;Some additions and projections later, that token encoding goes into an attention layer, at a particular spot in the sequence based on the order of the text. Let&amp;rsquo;s assume our token is at position 3.&lt;/li&gt;
&lt;li&gt;The attention layer compares that token encoding to all the others in the sequence (query and keys, yes yes), and uses the relative weights of their similarities as weights to apply to the original embeddings in the sequence (projected by a value matrix.) (This won&amp;rsquo;t make sense if you don&amp;rsquo;t already know how transformers work, for which I apologize.)&lt;/li&gt;
&lt;li&gt;The output of that attention layer at position 3 is the original token, but with information from closely-related tokens mashed into it. So it&amp;rsquo;s a wider, more conceptually complex representation of the original token at position 3.&lt;/li&gt;
&lt;li&gt;Do this 12 times with some standard fully-connected neural networks in-between, and you end up with a new sequence where each encoding is a representation of that original token, but with &amp;ldquo;meaning&amp;rdquo; infused based on the overall context of every other token in the sequence.&lt;/li&gt;
&lt;li&gt;Use those fancy high-class output encodings to predict the next token, or classify your sequence, or whatever.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But that &amp;ldquo;output of the attention layer is another form of the original token&amp;rdquo; has always been interesting to me. What does an encoding like that look like? Can you do something else with it? Does it relate back to the original token in an interesting way?&lt;/p&gt;</description></item></channel></rss>