[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"sanity-76_lkCXhYi1z11u2VHa5RmxVi6lgdDFK3QpuTH3fwF8":3,"sanity-qfZlcKC9nYxJ0YZr0jbC7cQwGZlBT78fvI1g-E554mc":342},{"data":4,"sourceMap":-1},{"latestPodcast":5,"latestReleases":14,"post":39,"recent":317},[6],{"_id":7,"publishedAt":8,"slug":9,"sponsored":12,"title":13},"4d0175f4-40a8-47eb-9bb3-a453b326aa7d","2026-07-03T07:40:00.000Z",{"_type":10,"current":11},"slug","the-good-the-bad-and-the-ai-apps",null,"The good, the bad, and the AI apps",[15,21,27,33],{"_id":16,"publishedAt":17,"slug":18,"title":20},"eb5b66eb-9410-4329-83bb-22bbff39402a","2026-04-28T13:00:00.000Z",{"_type":10,"current":19},"turn-scattered-knowledge-into-trusted-intelligence","Turning scattered knowledge into trusted intelligence: Stack Internal 2026.3",{"_id":22,"publishedAt":23,"slug":24,"title":26},"369c2401-b62e-4a37-8ff8-bf603023ecad","2026-03-02T15:03:00.988Z",{"_type":10,"current":25},"what-s-new-at-stack-overflow-march-2026","What’s new at Stack Overflow: March 2026",{"_id":28,"publishedAt":29,"slug":30,"title":32},"5e9053a4-07ea-447c-91ea-29e0b6228537","2026-02-02T15:00:00.000Z",{"_type":10,"current":31},"what-s-new-at-stack-overflow-february-2026","What’s new at Stack Overflow: February 2026",{"_id":34,"publishedAt":35,"slug":36,"title":38},"a1b538eb-a8a6-46d0-80a1-ac70ec9bb935","2026-01-05T10:00:00.000-05:00",{"_type":10,"current":37},"what-s-new-at-stack-overflow-january-2026","What’s new at Stack Overflow: January 2026",{"_createdAt":40,"_id":41,"_rev":42,"_system":43,"_type":46,"_updatedAt":47,"author":48,"body":65,"comments":279,"dateUrl":280,"excerpt":281,"image":282,"product":12,"publishedAt":286,"slug":287,"sponsored":12,"tags":289,"title":316,"visible":279},"2024-08-20T18:23:29Z","3e42d4a4-c110-4467-97b1-fc2e8578baa6","OuLxq6F1ZwNJHk6WTQXD24",{"base":44},{"id":41,"rev":45},"8y8N0FZhvd5mVuRpOn2zN9","blogPost","2026-05-11T17:06:45Z",[49],{"_createdAt":50,"_id":51,"_rev":52,"_type":53,"_updatedAt":50,"avatar":54,"bio":59,"employee":60,"name":61,"role":62,"slug":63},"2024-04-04T14:34:48Z","12169ed9-78d5-4f82-adb4-e956348db389","l85YFb2NNiT2L5SEvOgP0n","blogAuthor",{"_type":55,"asset":56},"image",{"_ref":57,"_type":58},"image-7c75ba835850e53201ea979015e8b8f449e126da-400x400-png","reference","I’m currently the Director of AI at Rebuy, a personalized search and recommendations platform for D2C e-commerce brands. Prior to Rebuy, I was a Research Scientist at Alegion. Additionally, I worked for Salesforce Commerce Cloud for two years. ","none","Cameron R. Wolfe, PhD","Director of AI at Rebuy",{"_type":10,"current":64},"cameron-r-wolfe-phd",[66,82,90,98,105,113,120,137,144,160,167,183,190,206,213,229,236,244,252,259,267,275],{"_key":67,"_type":68,"children":69,"markDefs":80,"style":81},"5e08a0326633","block",[70,75],{"_key":71,"_type":72,"marks":73,"text":74},"45c9b7f9068c0","span",[],"New language models get released every day (Gemini-1.5, Gemma, Claude 3, potentially GPT-5 etc. etc.), but one component of LLMs has remained constant over the last few years—",{"_key":76,"_type":72,"marks":77,"text":79},"45c9b7f9068c1",[78],"em","the decoder-only transformer architecture.",[],"normal",{"_key":83,"_type":68,"children":84,"markDefs":89,"style":81},"ad303379fa2e",[85],{"_key":86,"_type":72,"marks":87,"text":88},"807d736d8bdc0",[],"",[],{"_key":91,"_type":68,"children":92,"markDefs":97,"style":81},"763546cd0f3e",[93],{"_key":94,"_type":72,"marks":95,"text":96},"ae4ae5e8bb020",[],"Why should we care? Research on LLMs moves fast. Shockingly, however, the architecture used by most modern LLMs is pretty similar to that of the original GPT model. We just make the model much larger, modify it slightly, and use a more extensive training (and alignment) process. For this reason, the decoder-only transformer architecture is one of the most fundamental\u002Fimportant ideas in AI research, so investing into understanding it deeply is a wise idea.",[],{"_key":99,"_type":68,"children":100,"markDefs":104,"style":81},"b5e74eb10bcc",[101],{"_key":102,"_type":72,"marks":103,"text":88},"1a86cddda0ad0",[],[],{"_key":106,"_type":68,"children":107,"markDefs":112,"style":81},"c12d9baad9a1",[108],{"_key":109,"_type":72,"marks":110,"text":111},"a628f66813ee0",[],"This architecture has five components:",[],{"_key":114,"_type":68,"children":115,"markDefs":119,"style":81},"a07a8b1a5a2e",[116],{"_key":117,"_type":72,"marks":118,"text":88},"d25b1465a7230",[],[],{"_key":121,"_type":68,"children":122,"markDefs":136,"style":81},"3f2810538a91",[123,127,132],{"_key":124,"_type":72,"marks":125,"text":126},"b81cfca4c9960",[],"(1)",{"_key":128,"_type":72,"marks":129,"text":131},"b81cfca4c9961",[130],"strong"," Input layer: ",{"_key":133,"_type":72,"marks":134,"text":135},"b81cfca4c9962",[],"Decoder-only transformers receive a textual prompt as input. We use a tokenizer—based upon an algorithm like Byte-Pair Encoding (BPE)—to break this text into discrete tokens (i.e., words or sub-words). Then, we map each of these tokens to a corresponding vector stored in an embedding layer. This process forms a sequence of token vectors that are passed to the model as input. Optionally, we can augment these token vectors with additive positional embeddings.",[],{"_key":138,"_type":68,"children":139,"markDefs":143,"style":81},"fe09c3d4a29b",[140],{"_key":141,"_type":72,"marks":142,"text":88},"b0f8fcd1f46f0",[],[],{"_key":145,"_type":68,"children":146,"markDefs":159,"style":81},"a1690347ad3b",[147,151,155],{"_key":148,"_type":72,"marks":149,"text":150},"17ed92bfcada0",[],"(2) ",{"_key":152,"_type":72,"marks":153,"text":154},"17ed92bfcada1",[130],"Causal self-attention",{"_key":156,"_type":72,"marks":157,"text":158},"17ed92bfcada2",[]," is the core of the decoder-only transformer and allows the model to learn from relationships between tokens in the input. The vanilla self-attention operation transforms each token’s representation by taking a weighted combination of other token representations, where weights are given by pairwise attention\u002Fimportance scores between tokens. Causal self-attention follows a similar strategy but only computes attention scores for preceding tokens in the sequence. Attention is performed in parallel across several heads (i.e., multi-head attention), each of which can focus upon different parts of the input sequence.",[],{"_key":161,"_type":68,"children":162,"markDefs":166,"style":81},"d8275a94af98",[163],{"_key":164,"_type":72,"marks":165,"text":88},"a192eb2e24be0",[],[],{"_key":168,"_type":68,"children":169,"markDefs":182,"style":81},"c5c0c2b6ef7e",[170,174,178],{"_key":171,"_type":72,"marks":172,"text":173},"68f7df6cf5030",[],"(3) ",{"_key":175,"_type":72,"marks":176,"text":177},"68f7df6cf5031",[130],"Feed-forward transformations",{"_key":179,"_type":72,"marks":180,"text":181},"68f7df6cf5032",[]," are performed within each block of the decoder-only transformer, allowing us to individually transform each token’s representation. This feed-forward component is a small neural network that is applied in a pointwise manner to each token vector. Given a token vector as input, we pass this vector through a linear projection that increases its size by ~4X, apply a non-linear activation function (e.g., SwiGLU or GeLU), then perform another linear projection that restores the original size of the token vector.",[],{"_key":184,"_type":68,"children":185,"markDefs":189,"style":81},"4beb76a0deae",[186],{"_key":187,"_type":72,"marks":188,"text":88},"ea51eef14b230",[],[],{"_key":191,"_type":68,"children":192,"markDefs":205,"style":81},"ea5de6b3cab4",[193,197,201],{"_key":194,"_type":72,"marks":195,"text":196},"cf385c06aa560",[],"(4) ",{"_key":198,"_type":72,"marks":199,"text":200},"cf385c06aa561",[130],"Classification head: ",{"_key":202,"_type":72,"marks":203,"text":204},"cf385c06aa562",[],"The decoder-only transformer has one final classification head that takes token vectors from the transformer’s final output layer as input and outputs a vector with the same size as the vocabulary of the model’s tokenizer. This vector can be used to either train the LLM via next token prediction or generate text at inference time via sampling strategies like nucleus sampling and beam search.",[],{"_key":207,"_type":68,"children":208,"markDefs":212,"style":81},"05e4b9348853",[209],{"_key":210,"_type":72,"marks":211,"text":88},"73f2573c45710",[],[],{"_key":214,"_type":68,"children":215,"markDefs":228,"style":81},"c69cb49e65eb",[216,220,224],{"_key":217,"_type":72,"marks":218,"text":219},"0864ad1a99f00",[],"(5) ",{"_key":221,"_type":72,"marks":222,"text":223},"0864ad1a99f01",[130],"Transformer blocks",{"_key":225,"_type":72,"marks":226,"text":227},"0864ad1a99f02",[]," form the body of the decoder-only transformer architecture. The exact layout of the decoder-only transformer block may change depending upon the implementation, but two primary sub-layers are always present:",[],{"_key":230,"_type":68,"children":231,"markDefs":235,"style":81},"505661d60dc5",[232],{"_key":233,"_type":72,"marks":234,"text":88},"446b014d140a0",[],[],{"_key":237,"_type":68,"children":238,"markDefs":243,"style":81},"30c4b7d4df29",[239],{"_key":240,"_type":72,"marks":241,"text":242},"a16e51a96bbe0",[],"1. Causal self-attention",[],{"_key":245,"_type":68,"children":246,"markDefs":251,"style":81},"e7ffa8d43d9f",[247],{"_key":248,"_type":72,"marks":249,"text":250},"65d5627c0ef40",[],"2. Feed-forward transformation",[],{"_key":253,"_type":68,"children":254,"markDefs":258,"style":81},"a809596c084e",[255],{"_key":256,"_type":72,"marks":257,"text":88},"1bbd2f5fea300",[],[],{"_key":260,"_type":68,"children":261,"markDefs":266,"style":81},"b29625aef5d8",[262],{"_key":263,"_type":72,"marks":264,"text":265},"9b838277b8710",[],"Additionally, these sub-layers are surrounded by a layer normalization module—either before or after the sub-layer (or both!)—as well as a residual connection.",[],{"_key":268,"_type":68,"children":269,"markDefs":274,"style":81},"4e611b0a069e",[270],{"_key":271,"_type":72,"marks":272,"text":273},"20895f10b58a0",[],"\n",[],{"_key":276,"_type":55,"asset":277,"markDefs":12},"ea6e798bf18f",{"_ref":278,"_type":58},"image-114309af7b279ae3f85e2502f29d7c0ab3109797-2400x1348-jpg",true,"2024\u002F08\u002F22","The decoder-only transformer architecture is one of the most fundamental ideas in AI research.",{"_type":55,"asset":283,"attribution":285},{"_ref":284,"_type":58},"image-a88b67b632d885d9634ccc284b8924dd01f9b4ef-6000x3150-jpg","Alexandra Francis","2024-08-22T16:25:00.000Z",{"_type":10,"current":288},"llms-evolve-quickly-their-underlying-architecture-not-so-much",[290,297,301,305,309],{"_createdAt":291,"_id":292,"_rev":293,"_type":294,"_updatedAt":291,"slug":295,"title":296},"2023-05-23T16:43:21Z","wp-tagcat-se-tech","9HpbCsT2tq0xwozQfkc4ih","blogTag",{"current":296},"se-tech",{"_createdAt":291,"_id":298,"_rev":293,"_type":294,"_updatedAt":291,"slug":299,"title":300},"wp-tagcat-se-stackoverflow",{"current":300},"se-stackoverflow",{"_createdAt":291,"_id":302,"_rev":293,"_type":294,"_updatedAt":291,"slug":303,"title":304},"wp-tagcat-llm",{"current":304},"llm",{"_createdAt":291,"_id":306,"_rev":293,"_type":294,"_updatedAt":291,"slug":307,"title":308},"wp-tagcat-architecture",{"current":308},"architecture",{"_createdAt":291,"_id":310,"_rev":311,"_type":294,"_updatedAt":312,"slug":313,"title":315},"wp-tagcat-ai","fpDTFQqIDjNJIbHDKPBGpV","2025-01-30T16:19:01Z",{"current":314},"ai","AI","LLMs evolve quickly. Their underlying architecture, not so much.",[318,324,330,336],{"_id":319,"publishedAt":320,"slug":321,"sponsored":12,"title":323},"28e560af-f0aa-4d46-bd90-f435ad604aa7","2026-06-26T14:00:27.102Z",{"_type":10,"current":322},"paging-charity-how-can-engineering-leaders-avoid-becoming-bond-villains","Paging Charity! How can engineering leaders avoid becoming Bond villains?",{"_id":325,"publishedAt":326,"slug":327,"sponsored":12,"title":329},"4b22c2a3-3779-4966-93eb-5230391dbdce","2026-06-23T14:08:58.595Z",{"_type":10,"current":328},"your-ai-shipped-a-backend-that-boots-that-is-the-whole-problem","Your AI shipped a backend that boots. That is the whole problem.",{"_id":331,"publishedAt":332,"slug":333,"sponsored":12,"title":335},"5cf362e1-fe7b-45af-b69c-914731c6a052","2026-06-23T14:00:00.000Z",{"_type":10,"current":334},"the-2026-developer-survey-is-now-open-for-human-developers-only","The 2026 Developer Survey is now open (for human developers only)!",{"_id":337,"publishedAt":338,"slug":339,"sponsored":12,"title":341},"30b995f7-7cb9-4dd8-bf71-d0685940a32b","2026-06-19T14:00:00.000Z",{"_type":10,"current":340},"dispatches-from-o-reilly-from-capabilities-to-responsibilities","Dispatches from O'Reilly: From capabilities to responsibilities",{"data":343,"sourceMap":-1},{"count":344,"lastTimestamp":12},0]