<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Embeddings on Programmer.ie: Modern AI programming</title>
    <link>http://programmer.ie/categories/embeddings/</link>
    <description>Recent content in Embeddings on Programmer.ie: Modern AI programming</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 09 Sep 2026 02:00:00 +0000</lastBuildDate>
    <atom:link href="http://programmer.ie/categories/embeddings/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>What Is an Embedding?</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/01-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 09:00:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/01-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part I — A Vector Is Not Meaning&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;three-words-and-a-list-of-numbers&#34;&gt;Three words and a list of numbers&lt;/h2&gt;&#xA;&lt;p&gt;Take three words:&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;cat&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dog&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;airplane&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Turn them into numbers. Any embedding API will do it. You get three arrays, each maybe 384 or 768 or 1,536 floats long:&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;cat       [ 0.021, -0.114,  0.062, ... ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dog       [ 0.019, -0.098,  0.071, ... ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;airplane  [-0.087,  0.203, -0.041, ... ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Compute the angle between &lt;code&gt;cat&lt;/code&gt; and &lt;code&gt;dog&lt;/code&gt;. It is small. Compute the angle between &lt;code&gt;cat&lt;/code&gt; and &lt;code&gt;airplane&lt;/code&gt;. It is larger. Something about &amp;ldquo;cats and dogs are both pets&amp;rdquo; appears to have survived the trip into number-space.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Meaning Becomes Geometry</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/02-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 09:10:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/02-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part I — A Vector Is Not Meaning&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;a-space-you-can-draw&#34;&gt;A space you can draw&lt;/h2&gt;&#xA;&lt;p&gt;Give six words two coordinates each, by hand:&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;              (x = royalty/power,  y = gender: -1 female … +1 male)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;king      ( 0.9,  0.8)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;queen     ( 0.9, -0.8)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;man       ( 0.1,  0.9)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;woman     ( 0.1, -0.9)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apple     (-0.8,  0.0)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;orange    (-0.8,  0.1)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now every semantic question has a geometric form:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Are &lt;code&gt;king&lt;/code&gt; and &lt;code&gt;queen&lt;/code&gt; related?&lt;/em&gt; → they are close (distance 1.6, mostly along &lt;code&gt;y&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;What distinguishes &lt;code&gt;king&lt;/code&gt; from &lt;code&gt;queen&lt;/code&gt;?&lt;/em&gt; → a direction: &lt;code&gt;king − queen ≈ (0, 1.6)&lt;/code&gt;, the &amp;ldquo;gender axis.&amp;rdquo;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Is &lt;code&gt;apple&lt;/code&gt; like &lt;code&gt;king&lt;/code&gt;?&lt;/em&gt; → the angle between them is wide; they point different ways.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Which words form a group?&lt;/em&gt; → &lt;code&gt;{apple, orange}&lt;/code&gt; cluster tightly, far from the royalty cluster.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This is the whole promise of embeddings in one picture:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Learning an Embedding Space</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/03-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 09:20:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/03-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part I — A Vector Is Not Meaning&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;counting-words-in-a-tiny-corpus&#34;&gt;Counting words in a tiny corpus&lt;/h2&gt;&#xA;&lt;p&gt;Six sentences:&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;The cat drinks milk&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The dog drinks water&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The kitten drinks milk&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The puppy drinks water&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The cat chases the mouse&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The dog chases the cat&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Build a co-occurrence matrix: for each word, count how often each other word appears within one step of it.&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;          cat  dog  kitten  puppy  milk  water  drinks  chases  mouse&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cat        -    1     0      0      0     0      1       2       0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dog        1    -     0      0      0     0      1       1       0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;kitten     0    0     -      0      1     0      1       0       0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;puppy      0    0     0      -      0     1      1       0       0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;milk       0    0     1      0      -     0      2       0       0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;water      0    0     0      1      0     -      2       0       0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Each row is already a crude embedding: &lt;code&gt;kitten&lt;/code&gt; and &lt;code&gt;milk&lt;/code&gt; co-occur; &lt;code&gt;puppy&lt;/code&gt; and &lt;code&gt;water&lt;/code&gt; co-occur. The rows for &lt;code&gt;cat&lt;/code&gt; and &lt;code&gt;dog&lt;/code&gt; look alike because both chase and drink.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Similarity Is a Decision</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/04-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 09:30:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/04-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part I — A Vector Is Not Meaning&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;two-vectors-four-answers&#34;&gt;Two vectors, four answers&lt;/h2&gt;&#xA;&lt;p&gt;Here are two document vectors (3D, for legibility):&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;x = ( 2.0, 0.0, 0.0 )      a short doc, one strong topic&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;y = ( 6.0, 0.1, 0.0 )      a long doc, same topic, more of it&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;z = ( 0.0, 2.0, 0.0 )      a short doc, different topic&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ask &amp;ldquo;is &lt;code&gt;x&lt;/code&gt; more similar to &lt;code&gt;y&lt;/code&gt; or to &lt;code&gt;z&lt;/code&gt;?&amp;rdquo; and the metric answers for you:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Dimensions Do Not Mean What You Think</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/05-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 10:00:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/05-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part II — Inside the Space&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-does-dimension-173-mean&#34;&gt;What does dimension 173 mean?&lt;/h2&gt;&#xA;&lt;p&gt;Pull the 173rd coordinate of every vector in your corpus and sort. You get a list of documents ordered by&amp;hellip; something. Occasionally a coordinate is weakly interpretable — &amp;ldquo;this one seems higher for questions&amp;rdquo; — but usually the sorted list has no human-nameable theme. Dimension 173 does not mean &amp;ldquo;formality&amp;rdquo; or &amp;ldquo;sentiment&amp;rdquo; or &amp;ldquo;is about sports.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;And yet the vector works. Similarity search returns sensible results. The structure is there; it is just not living in the individual axes.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Neighborhoods and Manifolds</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/06-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 10:10:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/06-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part II — Inside the Space&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-question-a-vector-cannot-answer-alone&#34;&gt;The question a vector cannot answer alone&lt;/h2&gt;&#xA;&lt;p&gt;Hand someone a single embedding vector and ask what it means. They cannot say. Hand them the vector &lt;em&gt;and&lt;/em&gt; its ten nearest neighbors and they can usually tell you the topic, the register, and roughly what it is.&lt;/p&gt;&#xA;&lt;p&gt;Meaning, operationally, is &lt;em&gt;locality&lt;/em&gt;: a vector is characterized by what it is near. So the honest object of study is not the point — it is the neighborhood.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How Many Dimensions Does Meaning Need?</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/07-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 10:20:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/07-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part II — Inside the Space&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;a-1536-number-vector-that-isnt&#34;&gt;A 1,536-number vector that isn&amp;rsquo;t&lt;/h2&gt;&#xA;&lt;p&gt;Your embedding model outputs 1,536 floats. Take 50,000 of its vectors, stack them, run SVD, and plot the singular values. Typically:&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;first ~20 singular values:     large, falling fast&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;next ~150:                     moderate, gentle slope&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;remaining ~1,350:              tiny, near the noise floor&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Reconstruct every vector from just the top 200 components. Re-run retrieval. Recall@10 barely moves. The other ~1,300 dimensions were carrying almost no variance that mattered for the task.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Shape of an Embedding Space</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/08-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 10:30:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/08-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part II — Inside the Space&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;same-corpus-three-shapes&#34;&gt;Same corpus, three shapes&lt;/h2&gt;&#xA;&lt;p&gt;Embed the same 1,173 RELATE items with five models. Do not look at task scores yet. Look at the shape (measured — Wave 1 row 1.4, &lt;code&gt;experiments/embeddings-from-first-principles/wave1/artifacts/anisotropy.json&lt;/code&gt;):&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;                          MiniLM-L6   mpnet-base   mxbai-large   bge-large   bge-small&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dimension                     384         768         1024          1024        384&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mean random-pair cosine       0.06        0.08         0.34          0.40        0.45&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;top singular-value share      0.07        0.08         0.09          0.09        0.10&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;effective rank                 259         387          425           434         271&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;distance concentration*       0.08        0.09         0.09          0.11        0.10&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;*ratio of standard deviation to mean of pairwise distances — smaller means &amp;ldquo;everything is roughly equidistant.&amp;rdquo;&lt;/p&gt;</description>
    </item>
    <item>
      <title>From Similarity to Search</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/09-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 11:00:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/09-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part III — Retrieval Is an Experiment&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;retrieval-in-four-lines&#34;&gt;Retrieval in four lines&lt;/h2&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-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;query_vec &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; embed(query)                       &lt;span style=&#34;color:#75715e&#34;&gt;# one vector&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scores    &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; corpus_vecs &lt;span style=&#34;color:#f92672&#34;&gt;@&lt;/span&gt; query_vec            &lt;span style=&#34;color:#75715e&#34;&gt;# one dot product per document&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;order     &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; np&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;argsort(&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;scores)                &lt;span style=&#34;color:#75715e&#34;&gt;# sort, descending&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;results   &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; [corpus[i] &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; i &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; order[:k]]     &lt;span style=&#34;color:#75715e&#34;&gt;# take the top k&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That is the entire primitive. Everything a vector database adds — indexes, quantization, sharding, filtering — is an optimization or an operational convenience around these four lines. Understand them completely before adding anything.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;What exactly is a retrieval system deciding, and which of its parameters change the answer rather than just the speed?&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Nearest Neighbor Can Be Wrong</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/10-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 11:10:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/10-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part III — Retrieval Is an Experiment&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-result-that-is-closest-and-wrong&#34;&gt;The result that is closest and wrong&lt;/h2&gt;&#xA;&lt;p&gt;Query:&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;Is Dublin the capital of Ireland?&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Top retrieved passage, cosine 0.91:&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;Dublin is not, and has never been, the capital of Ireland — that&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;distinction belongs to the older seat of government at Tara.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Fluent, on-topic, confidently phrased, geometrically the closest thing in the corpus — and false. A model handed this passage as context may repeat its claim. The retrieval system did its job perfectly: it found the nearest vector. &amp;ldquo;Nearest&amp;rdquo; was not &amp;ldquo;correct.&amp;rdquo;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Hard Negatives</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/11-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 11:20:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/11-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part III — Retrieval Is an Experiment&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;two-benchmarks-same-model-opposite-verdicts&#34;&gt;Two benchmarks, same model, opposite verdicts&lt;/h2&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;Benchmark E (easy negatives):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  positive: the correct answer&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  negatives: 20 passages drawn at random from the corpus&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  → model scores Recall@1 = 0.94&#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;Benchmark H (hard negatives):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  positive: the correct answer&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  negatives: the 20 passages most similar to the query that are NOT correct&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  → same model scores Recall@1 = 0.55&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Nothing changed but the negatives. The easy benchmark asked &amp;ldquo;can the model tell the answer from an unrelated paragraph?&amp;rdquo; The hard benchmark asked &amp;ldquo;can it tell the answer from the 20 things that look most like the answer?&amp;rdquo; Those are different questions, and only the second is the one production faces.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Retrieval Is a Policy</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/12-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 11:30:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/12-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part III — Retrieval Is an Experiment&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;just-retrieve-the-relevant-documents&#34;&gt;&amp;ldquo;Just retrieve the relevant documents&amp;rdquo;&lt;/h2&gt;&#xA;&lt;p&gt;There is no such operation. What actually runs is a pipeline, and every stage has parameters that change the output:&lt;/p&gt;&#xA;&lt;pre class=&#34;mermaid&#34;&gt;&#xA;    flowchart TD&#xA;    Q[query] --&amp;gt; QT[&amp;#34;query transform — raw / rewrite / expand / HyDE / decompose&amp;#34;]&#xA;    QT --&amp;gt; RE[&amp;#34;representation — which model, normalization, chunking&amp;#34;]&#xA;    RE --&amp;gt; CG[&amp;#34;candidate generation — ANN index, nprobe / ef, pre-filters&amp;#34;]&#xA;    CG --&amp;gt; SI[&amp;#34;similarity — metric, hybrid dense+sparse weighting&amp;#34;]&#xA;    SI --&amp;gt; TH[&amp;#34;threshold — minimum score to survive&amp;#34;]&#xA;    TH --&amp;gt; RK[&amp;#34;ranking — rerank top-N with a cross-encoder?&amp;#34;]&#xA;    RK --&amp;gt; DV[&amp;#34;diversity / dedup — MMR, cluster collapse&amp;#34;]&#xA;    DV --&amp;gt; TK[&amp;#34;top-k — how many survive&amp;#34;]&#xA;    TK --&amp;gt; CA[&amp;#34;context assembly — order, dedup, budget, citations&amp;#34;]&#xA;    CA --&amp;gt; M[&amp;#34;what the model actually sees = the system&amp;#39;s memory&amp;#34;]&#xA;  &lt;/pre&gt;&#xA;  &lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Retrieval does not return &amp;ldquo;the relevant documents.&amp;rdquo; It returns whatever this specific chain of decisions produces — and that is the system&amp;rsquo;s memory.&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>How Do You Evaluate an Embedding?</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/13-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 12:00:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/13-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part IV — Measuring the Representation&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-leaderboard-model-that-lost&#34;&gt;The leaderboard model that lost&lt;/h2&gt;&#xA;&lt;p&gt;A team picks the top model on a public embedding leaderboard. It scores well on 50-plus tasks. In their product — retrieval over dense technical documentation with heavy entity and version-number queries — it underperforms a smaller, older model. Nothing was misconfigured. The benchmark measured a population of tasks; the product is one task, and not one the benchmark weighted heavily.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Calibration</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/14-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 12:10:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/14-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part IV — Measuring the Representation&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-is-081&#34;&gt;What is 0.81?&lt;/h2&gt;&#xA;&lt;p&gt;A pipeline decides two documents are &amp;ldquo;duplicates&amp;rdquo; if their cosine exceeds 0.8. Someone picked 0.8 because it looked reasonable. Then:&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;distribution of cosine for KNOWN duplicate pairs:      mean 0.79, sd 0.09&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;distribution of cosine for KNOWN non-duplicate pairs:  mean 0.71, sd 0.11&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The threshold sits inside both distributions. A true duplicate at 0.78 is rejected; an unrelated pair at 0.82 is accepted. The number 0.81 does not carry its own meaning — it is a point on two overlapping bell curves, and without those curves it is noise.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Is Similarity One-Dimensional?</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/15-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 12:20:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/15-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part IV — Measuring the Representation&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;two-pairs-same-cosine-different-situations&#34;&gt;Two pairs, same cosine, different situations&lt;/h2&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;Pair 1:  cos = 0.78&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  the query&amp;#39;s nearest neighbor scores 0.78; the 2nd scores 0.44&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  the region is sparse; the ranking is stable under paraphrase&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  → a confident, isolated match&#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;Pair 2:  cos = 0.78&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  the nearest neighbor scores 0.78; the 2nd, 3rd, 4th score 0.77, 0.76, 0.76&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  the region is a dense hub; re-embedding the query with a typo flips the top result&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  → a coin toss dressed as a match&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The scalar is identical. The situations are not. Everything that distinguishes them is geometric information the cosine threw away.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Change the Model, Change the Universe</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/16-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 13:00:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/16-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part V — Embedding Spaces Are Not Universal&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-same-sentence-three-universes&#34;&gt;The same sentence, three universes&lt;/h2&gt;&#xA;&lt;p&gt;Embed one sentence with three models:&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;model A (384-d):  [ ... ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;model B (768-d):  [ ... ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;model C (768-d):  [ ... ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A and B differ in length, so nobody expects to compare them coordinate-wise. But B and C are both 768-dimensional. Line up their vectors and compute the cosine between B&amp;rsquo;s vector and C&amp;rsquo;s vector for the same sentence:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Versioning the Space</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/17-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 13:10:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/17-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part V — Embedding Spaces Are Not Universal&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-upgrade-that-broke-search-quietly&#34;&gt;The upgrade that broke search quietly&lt;/h2&gt;&#xA;&lt;p&gt;Production runs embedding model v1. A better v2 ships. Someone updates the client library. New documents get v2 vectors; the 10 million existing vectors are still v1. Nothing errors. Queries are embedded with v2 and compared against a mix of v1 and v2 vectors.&lt;/p&gt;&#xA;&lt;p&gt;Recall drops a few points. Nobody notices for a month, because the system still returns ten results and they still look plausible. The v1 and v2 vectors are in different universes (Chapter 16), and half the index is now in the wrong one.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Can One Embedding Space Be Translated Into Another?</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/18-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 14:00:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/18-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part VI — Crossing Embedding Spaces&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-question-stated-carefully&#34;&gt;The question, stated carefully&lt;/h2&gt;&#xA;&lt;p&gt;We have two encoders, &lt;code&gt;E_A&lt;/code&gt; and &lt;code&gt;E_B&lt;/code&gt;, and a set of objects &lt;code&gt;x&lt;/code&gt;. Each object has two representations: &lt;code&gt;E_A(x)&lt;/code&gt; in space A, &lt;code&gt;E_B(x)&lt;/code&gt; in space B. Chapter 16 established these live in unrelated coordinate systems.&lt;/p&gt;&#xA;&lt;p&gt;The question:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;Does there exist a map &lt;code&gt;T&lt;/code&gt; such that &lt;code&gt;T(E_A(x)) ≈ E_B(x)&lt;/code&gt; for objects &lt;code&gt;x&lt;/code&gt; the map was never trained on — and by what standard do we judge &amp;ldquo;≈&amp;rdquo;?&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Alignment</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/19-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 14:10:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/19-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part VI — Crossing Embedding Spaces&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;a-family-of-maps-ordered-by-how-much-they-can-bend-the-space&#34;&gt;A family of maps, ordered by how much they can bend the space&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;The null map (&lt;code&gt;T(x) = x&lt;/code&gt;).&lt;/strong&gt; Do nothing. Always run this first. If it already scores well, your two spaces were nearly the same space to begin with (this happens for models of the same size, backbone, and objective) and any &amp;ldquo;translation&amp;rdquo; you fit is fitting noise. vec2vec&amp;rsquo;s own baseline is exactly this, and for their near-identical model pairs it reaches top-1 ≈ 1.0 — the real work is only on pairs where the null map collapses.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Orthogonal Procrustes.&lt;/strong&gt; &lt;code&gt;T&lt;/code&gt; is constrained to a rotation/reflection: &lt;code&gt;min ‖X_A R − X_B‖²&lt;/code&gt; subject to &lt;code&gt;RᵀR = I&lt;/code&gt;. Solution: &lt;code&gt;R = UVᵀ&lt;/code&gt; from the SVD of &lt;code&gt;X_Aᵀ X_B&lt;/code&gt;. Preserves all distances and angles &lt;em&gt;within&lt;/em&gt; space A — it only re-orients. Cannot fix scale or shear. Best when the two spaces are &amp;ldquo;the same shape, different pose.&amp;rdquo;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Linear regression (least squares).&lt;/strong&gt; Chapter 18. &lt;code&gt;T&lt;/code&gt; is any linear map: rotation + scaling + shear + projection. More expressive; can overfit; does not preserve within-A geometry.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;CCA (Canonical Correlation Analysis).&lt;/strong&gt; Finds paired directions in A and B that are maximally &lt;em&gt;correlated&lt;/em&gt;; aligns in that shared subspace. Naturally handles different dimensions and discards directions with no counterpart. Good when the two spaces share a subspace but also have private structure. Note it maximizes correlation, which is not the same as preserving retrieval &lt;em&gt;rank&lt;/em&gt; — highly correlated shared directions can still reorder near-ties.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Relative representations (&amp;ldquo;re-express, don&amp;rsquo;t map&amp;rdquo;).&lt;/strong&gt; Instead of fitting a map at all, replace every vector by its list of cosine similarities to a fixed set of shared anchor items (&lt;a href=&#34;https://arxiv.org/abs/2209.15430&#34;&gt;Moschella et al., 2023&lt;/a&gt;). That representation is invariant to rotation and rescaling by construction, so two spaces expressed this way become directly comparable — no &lt;code&gt;T&lt;/code&gt; to fit. The cost: it needs a shared anchor set (texts embedded in both spaces — paired data by another name), and the invariance holds &amp;ldquo;under the same data and modeling choices.&amp;rdquo;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Learned nonlinear map (small MLP).&lt;/strong&gt; &lt;code&gt;T&lt;/code&gt; is a 2–3 layer network. Most expressive; needs the most anchors; highest overfitting risk; hardest to reason about. Use only if the linear family measurably plateaus below your target.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Map&lt;/th&gt;&#xA;          &lt;th&gt;What it can do&lt;/th&gt;&#xA;          &lt;th&gt;Overfitting risk&lt;/th&gt;&#xA;          &lt;th&gt;Best when&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Null &lt;code&gt;T(x) = x&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;nothing — run it first&lt;/td&gt;&#xA;          &lt;td&gt;none&lt;/td&gt;&#xA;          &lt;td&gt;the two spaces were already nearly one&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Orthogonal Procrustes&lt;/td&gt;&#xA;          &lt;td&gt;rotation / reflection only; preserves within-A distances and angles&lt;/td&gt;&#xA;          &lt;td&gt;low (closed form)&lt;/td&gt;&#xA;          &lt;td&gt;&amp;ldquo;same shape, different pose&amp;rdquo;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Linear regression&lt;/td&gt;&#xA;          &lt;td&gt;rotation + scale + shear + projection&lt;/td&gt;&#xA;          &lt;td&gt;medium; can overfit&lt;/td&gt;&#xA;          &lt;td&gt;scale or shear differ; anchors plentiful&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;CCA&lt;/td&gt;&#xA;          &lt;td&gt;align a maximally-correlated shared subspace; drop private directions&lt;/td&gt;&#xA;          &lt;td&gt;medium&lt;/td&gt;&#xA;          &lt;td&gt;the spaces share a subspace but also have private structure&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Relative representations&lt;/td&gt;&#xA;          &lt;td&gt;re-express every vector as cosines to shared anchors — no &lt;code&gt;T&lt;/code&gt; fitted&lt;/td&gt;&#xA;          &lt;td&gt;n/a&lt;/td&gt;&#xA;          &lt;td&gt;you have a shared anchor set and want rotation/scale invariance for free&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Nonlinear MLP&lt;/td&gt;&#xA;          &lt;td&gt;an arbitrary map&lt;/td&gt;&#xA;          &lt;td&gt;highest (~10⁶ params)&lt;/td&gt;&#xA;          &lt;td&gt;the linear family measurably plateaus below target (or unpaired optimization needs the flexibility)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The ordering is deliberate: &lt;strong&gt;try the most constrained map that meets your preservation target.&lt;/strong&gt; A rotation that gets you to 0.85 retrieval agreement is better than an MLP that gets you to 0.87, because the rotation has fewer ways to be wrong on data you have not seen. The recent cross-encoder alignment work reinforces this: vec2vec&amp;rsquo;s nonlinear translator and mini-vec2vec&amp;rsquo;s &lt;em&gt;linear&lt;/em&gt; one reach comparable coarse quality, and the linear one is far cheaper and more stable (&lt;a href=&#34;https://arxiv.org/abs/2510.02348&#34;&gt;Dar, 2025&lt;/a&gt;). Where nonlinearity earns its keep is not representational capacity but &lt;em&gt;optimization robustness in the unpaired regime&lt;/em&gt; — when there are no anchors to regress on, the extra flexibility helps the alignment converge, not the final map express more.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Embedding Bridge</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/20-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 14:20:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/20-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part VI — Crossing Embedding Spaces&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;a-map-is-not-a-bridge&#34;&gt;A map is not a bridge&lt;/h2&gt;&#xA;&lt;p&gt;Chapter 19 produced a matrix &lt;code&gt;W&lt;/code&gt; (or an MLP) that translates vectors from space A to space B. Deploying that matrix as &amp;ldquo;space A and space B are now compatible&amp;rdquo; is the mistake this chapter prevents.&lt;/p&gt;&#xA;&lt;p&gt;A map is a function. A &lt;strong&gt;bridge&lt;/strong&gt; is a map plus the record of &lt;em&gt;what it was shown to preserve, for whom, under what conditions&lt;/em&gt; — and, crucially, an explicit scope of what it must not be used for.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Did the Bridge Preserve the Space?</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/21-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 14:30:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/21-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part VI — Crossing Embedding Spaces&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;one-bridge-eight-verdicts&#34;&gt;One bridge, eight verdicts&lt;/h2&gt;&#xA;&lt;p&gt;Take the linear A→B bridge from Chapter 19. Run every preservation metric on the same held-out set:&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;cosine preservation (mean cos to native target)      0.74&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;top-1 preservation (native NN stays NN)               0.61&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;top-10 preservation                                   0.88&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Recall@1  (vs labels, translated query)               0.58   native: 0.63&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Recall@10                                             0.71   native: 0.77&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;MRR                                                   0.64   native: 0.70&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nDCG@10                                               0.75   native: 0.81&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;order preservation (Kendall τ on result lists)        0.66&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cluster preservation (ARI vs native clustering)       0.80&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hard-negative agreement                               0.41&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ten numbers, not one. A stakeholder who asked &amp;ldquo;did the translation work?&amp;rdquo; gets a table, and the table says: &lt;em&gt;coarse structure preserved, fine order degraded, hard distinctions near the source encoder&amp;rsquo;s own native performance.&lt;/em&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Can a Smaller Representation Preserve a Larger One?</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/22-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 15:00:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/22-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part VII — What Survives Transformation&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;two-vectors-for-one-document&#34;&gt;Two vectors for one document&lt;/h2&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;full_doc      →  E(full_doc)        one vector&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;summary(doc)  →  E(summary(doc))    one vector&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both are single vectors of the same dimension. One was produced from 4,000 words; the other from 120. The question:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;&lt;strong&gt;How much of the document&amp;rsquo;s representational geometry survives when the document is compressed — and is the surviving-or-not a signal we can use?&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;If &lt;code&gt;E(summary)&lt;/code&gt; lands where &lt;code&gt;E(full_doc)&lt;/code&gt; lands &lt;em&gt;and&lt;/em&gt; behaves like it under retrieval and clustering, the summary is a faithful compression in the sense the embedding cares about. If it drifts, something was dropped — and &lt;em&gt;which&lt;/em&gt; direction it drifted may tell us what.&lt;/p&gt;</description>
    </item>
    <item>
      <title>From Deltas to Operators</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/23-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 15:10:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/23-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part VII — What Survives Transformation&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-other-thing-a-subtraction-might-mean&#34;&gt;The other thing a subtraction might mean&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;king − man + woman ≈ queen&lt;/code&gt; is the famous demonstration that a &lt;em&gt;direction&lt;/em&gt; in embedding space can correspond to a semantic relation. It is also, as Chapter 2 noted, partly curated and works best locally — and it has a long list of documented problems: the offset method&amp;rsquo;s success is entangled with plain cosine-neighbourhood structure, so a &amp;ldquo;the direction transfers&amp;rdquo; result has to beat the baseline of &lt;em&gt;ignoring the offset and returning the nearest neighbour of the source word&lt;/em&gt; (&lt;a href=&#34;https://aclanthology.org/W16-2503/&#34;&gt;Linzen, 2016&lt;/a&gt;); and performance varies wildly by relation type (&lt;a href=&#34;https://aclanthology.org/S17-1017/&#34;&gt;Rogers, Drozd &amp;amp; Li, 2017&lt;/a&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Building an Embedding Runtime</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/24-chapter/</link>
      <pubDate>Mon, 07 Sep 2026 16:00:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/24-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part VIII — Embeddings Become Infrastructure&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;not-a-rag-chatbot&#34;&gt;Not a RAG chatbot&lt;/h2&gt;&#xA;&lt;p&gt;The obvious capstone would be &amp;ldquo;build a RAG system.&amp;rdquo; It would also be the wrong one — a RAG system exercises maybe a third of this book and hides the rest inside a framework.&lt;/p&gt;&#xA;&lt;p&gt;The capstone is an &lt;strong&gt;Embedding Observatory&lt;/strong&gt;: a runtime whose job is to know things about representations. It ingests text, documents, and queries under one or more embedding models, and it exposes not just vectors but the geometry, neighborhoods, distributions, evaluations, calibrations, versions, and bridges that the book spent 23 chapters building tools for.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Retrieval Is Not Geometry</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/25-chapter/</link>
      <pubDate>Wed, 09 Sep 2026 01:50:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/25-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Research Coda — What Alignment Really Preserves&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-result-that-looks-like-success&#34;&gt;The result that looks like success&lt;/h2&gt;&#xA;&lt;p&gt;Suppose a bridge translates vectors from space A into space B. On a held-out set, the true B-space counterpart appears in the translated vector&amp;rsquo;s top ten &lt;strong&gt;99.7%&lt;/strong&gt; of the time.&lt;/p&gt;&#xA;&lt;p&gt;That sounds finished.&lt;/p&gt;&#xA;&lt;p&gt;Now ask a different question: does the translated vector have the same ten neighbors as the native B-space vector?&lt;/p&gt;&#xA;&lt;p&gt;The answer can be barely &lt;strong&gt;59%&lt;/strong&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>What Should a Translation Preserve?</title>
      <link>http://programmer.ie/books/embeddings-from-first-principles/26-chapter/</link>
      <pubDate>Wed, 09 Sep 2026 02:00:00 +0000</pubDate>
      <guid>http://programmer.ie/books/embeddings-from-first-principles/26-chapter/</guid>
      <description>&lt;p&gt;&lt;em&gt;Research Coda — What Alignment Really Preserves&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;preserve-the-geometry-is-not-a-complete-instruction&#34;&gt;&amp;ldquo;Preserve the geometry&amp;rdquo; is not a complete instruction&lt;/h2&gt;&#xA;&lt;p&gt;A bridge translates vectors from space A into space B.&lt;/p&gt;&#xA;&lt;p&gt;The natural instinct is to say:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Preserve the source geometry while you translate.&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;That sounds obviously correct. If two source points are close, keep them close. If two source points are far apart, keep them far apart. Preserve pairwise cosine, distances, neighborhoods.&lt;/p&gt;&#xA;&lt;p&gt;But Chapter 16 established something uncomfortable: different encoders do not merely rotate the same universe. They can disagree on neighborhoods, density, rank order, hard distinctions, and calibration.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
