{"id":6902,"date":"2026-07-11T12:28:45","date_gmt":"2026-07-11T05:28:45","guid":{"rendered":"https:\/\/daiilynews.cu.ma\/?p=6902"},"modified":"2026-07-11T12:28:45","modified_gmt":"2026-07-11T05:28:45","slug":"building-intuition-about-llm-parameter-counts-giles-blog","status":"publish","type":"post","link":"https:\/\/daiilynews.cu.ma\/?p=6902","title":{"rendered":"Building intuition about LLM parameter counts :: Giles&#8217; blog"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<p>                Writing the post that I wished I&#8217;d found when I started learning whatever it was&#8230;<\/p>\n<p>                            Archives <\/p>\n<p>                            Categories <\/p>\n<p>                        Blogroll <\/p>\n<p>        Posted on 10 July 2026<\/p>\n<p>            in<\/p>\n<p>                AI<\/p>\n<p>    When I was building my GPT-2 implementation in JAX,<br \/>\nI started with just token embeddings for the input, and a separate output head (as I was not using<br \/>\nweight tying).  It wasn&#8217;t an<br \/>\nLLM &#8212; no Transformer blocks, no attention, no feed-forward networks.<\/p>\n<p>I was somewhat surprised when I noticed that even that stripped-down model had 77 million parameters<br \/>\nwith the &#8220;small&#8221; settings I was using to train &#8212; specifically, an embedding dimension of 768.<br \/>\nHowever, I realised I shouldn&#8217;t be &#8212; with a vocab size of 50,257, each of those components is essentially<br \/>\na 768\u00d750,257 matrix, and that is indeed over 38 million numbers.<\/p>\n<p>But the finished LLM at the end of the project was only 163 million parameters &#8212; that meant that the<br \/>\ninput and output components alone were almost half of it.  That felt<br \/>\nlike a surprisingly large percentage.<\/p>\n<p>I had a similar shock when I was first looking into the feed-forward network,<br \/>\nand realised that it had roughly twice as many parameters as the attention layers.<\/p>\n<p>When we learn about the internals of LLMs, a lot of the focus is on the attention<br \/>\nmechanism.  This makes sense &#8212; it&#8217;s the hardest part to get your head around.  The<br \/>\nrest of the setup, at least for simple GPT-2 type models, is fairly standard stuff.<\/p>\n<p>But that means that it is easy to overestimate how much of the total<br \/>\nparameter count of the model attention uses up &#8212; especially for smaller models,<br \/>\nwhere the token embeddings and the output head are so large in comparison to<br \/>\nthe Transformer layers that make up the actual body of the LLM.<\/p>\n<p>OpenAI released GPT 5.6 today, so I decided to take its &#8220;Sol&#8221; variant for a ride<br \/>\nin Codex and asked it to write a visualiser.<br \/>\nIt shows<br \/>\nbreakdowns of how the parameters are split between embeddings, attention, the FFNs, and<br \/>\nthe output head<br \/>\nfor different sizes of GPT-2 models (or your own custom settings<br \/>\nwith the same architecture), and you can also add\/remove weight tying and QKV bias.<br \/>\nIt did a really good job &#8212; check it out!  Here&#8217;s a screenshot of what it showed<br \/>\nfor GPT-2 small without weight tying.<\/p>\n<p>It&#8217;s well worth a play.  In particular, it&#8217;s interesting to see what happens<br \/>\nas the number of tokens in the vocab gets very large (many modern models have<br \/>\nhundreds of thousands).  You can very easily create a &#8220;tiny&#8221; model which is<br \/>\nalmost entirely embeddings and the output head.<\/p>\n<p>     {<br \/>\n             const url = new URL(document.querySelector(&#8220;link(rel=\\&#8221;canonical\\&#8221;)&#8221;).href);<br \/>\n             url.host = &#8220;www.gilesthomas.com&#8221;;<br \/>\n             return url.toString();<br \/>\n           })()<br \/>\n         }&#8221;<br \/>\n    ><br \/>\n<br \/><br \/>\n<br \/><a href=\"https:\/\/www.gilesthomas.com\/2026\/07\/llm-parameter-counts\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Writing the post that I wished I&#8217;d found when I started learning whatever it was&#8230; Archives Categories Blogroll Posted on 10 July 2026 in AI When I was building my GPT-2 implementation in JAX, I started with just token embeddings for the input, and a separate output head (as I was not using weight tying). [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6903,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[676],"tags":[],"class_list":["post-6902","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech-ai"],"_links":{"self":[{"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/posts\/6902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6902"}],"version-history":[{"count":0,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/posts\/6902\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/media\/6903"}],"wp:attachment":[{"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}