<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: afa-lizhao001</title>
    <description>The latest articles on DEV Community by afa-lizhao001 (@lizhao888).</description>
    <link>https://dev.to/lizhao888</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4189803%2Faaa4ffef-1ce3-495b-a9a0-8ed869116bbd.png</url>
      <title>DEV Community: afa-lizhao001</title>
      <link>https://dev.to/lizhao888</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lizhao888"/>
    <language>en</language>
    <item>
      <title>How LLMs are actually built — and why most "how it works" threads stop too early</title>
      <dc:creator>afa-lizhao001</dc:creator>
      <pubDate>Sat, 17 Oct 2026 04:25:39 +0000</pubDate>
      <link>https://dev.to/lizhao888/how-llms-are-actually-built-and-why-most-how-it-works-threads-stop-too-early-pm</link>
      <guid>https://dev.to/lizhao888/how-llms-are-actually-built-and-why-most-how-it-works-threads-stop-too-early-pm</guid>
      <description>&lt;p&gt;Most "how LLMs work" explainers end at transformers and attention.&lt;/p&gt;

&lt;p&gt;The parts that decide whether a model is actually good — the data pipeline, the post-training recipe, the evaluation setup, the systems work — usually get one sentence. Having watched a lot of talks on this, I wanted a version I could check rather than trust, so I turned Yann Dubois' Stanford CS229 guest lecture (&lt;em&gt;Building Large Language Models&lt;/em&gt;, Summer 2024) into a small, timestamped reference.&lt;/p&gt;

&lt;p&gt;It's now an installable agent skill, but the map is useful on its own. Here it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five components, and who actually optimizes which
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;What it decides&lt;/th&gt;
&lt;th&gt;Who pushes it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Architecture&lt;/td&gt;
&lt;td&gt;capacity and shape&lt;/td&gt;
&lt;td&gt;academia&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Training objective&lt;/td&gt;
&lt;td&gt;what "good" means during training&lt;/td&gt;
&lt;td&gt;academia&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Data&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;what the model has seen&lt;/td&gt;
&lt;td&gt;industry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Evaluation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;whether you can tell it improved&lt;/td&gt;
&lt;td&gt;industry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Systems&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;whether training finishes at all&lt;/td&gt;
&lt;td&gt;industry&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The uncomfortable conclusion from the lecture: architecture is where academic attention goes, and it's &lt;em&gt;not&lt;/em&gt; where the practical leverage is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pretraining: compressing the internet
&lt;/h2&gt;

&lt;p&gt;"Just train on the internet" hides the actual work. A real pipeline looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Crawl&lt;/strong&gt; — Common Crawl: ~250B pages, ~1 PB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extract&lt;/strong&gt; — HTML to text. Random pages are menus, footers, and truncated sentences.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filter&lt;/strong&gt; — NSFW, harmful content, PII. Blacklists plus small classifiers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dedupe&lt;/strong&gt; — boilerplate, the same page under many URLs, paragraphs repeated thousands of times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heuristics&lt;/strong&gt; — odd token distributions, strange word lengths, too short, too long.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model-based filtering&lt;/strong&gt; — train a classifier on sites linked from Wikipedia vs random web; prefer the former.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mix&lt;/strong&gt; — up-weight code and books, down-weight entertainment. More code measurably helps reasoning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Final phase&lt;/strong&gt; — high-quality data with a decaying learning rate; effectively overfitting on Wikipedia-grade text.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Team shape is worth noting: roughly 15 people on data in the Llama team, more people than on modelling, and more CPUs than GPUs.&lt;/p&gt;

&lt;p&gt;On scale: loss falls as a power law in parameters, data and compute, which is why small runs can predict large ones. Chinchilla's takeaway is &lt;strong&gt;about 20 tokens per parameter&lt;/strong&gt; — earlier models were typically data-starved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Post-training: from autocomplete to assistant
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;SFT&lt;/strong&gt; is next-token training on human-written ideal answers. The key insight: it teaches &lt;em&gt;format and persona&lt;/em&gt;, not knowledge. LIMA scaled from 2,000 to 32,000 examples and quality barely moved. It also teaches the model to produce a plausible-looking answer instead of admitting ignorance — part of where hallucination comes from.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RLHF&lt;/strong&gt; replaces demonstrations with preferences: show two answers, ask a human which is better, train a reward model (Bradley–Terry), then optimize the policy with PPO plus a penalty against over-optimizing the reward. Binary rewards are too sparse — you learn &lt;em&gt;which&lt;/em&gt; answer won, not &lt;em&gt;by how much&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DPO&lt;/strong&gt; skips the RL loop: raise the likelihood of the preferred answer, lower the dispreferred one. Under standard assumptions the optimum matches PPO's, with a far simpler implementation, which is why it's now a default in open source.&lt;/p&gt;

&lt;p&gt;The economics matter more than people think: humans agree with themselves only ~66% of the time on a binary preference task, human labels cost roughly $300 per 1,000 examples, and LLM labellers are about 50× cheaper with higher agreement with the human majority. The bias to watch: labellers prefer longer answers, so models trained on their preferences get verbose. That's why ChatGPT rambles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evaluation is where claims quietly break
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Validation loss isn't comparable&lt;/strong&gt; across PPO and DPO — different objectives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Perplexity stops being meaningful&lt;/strong&gt; after PPO: the model is a policy, not a distribution over text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chatbot Arena&lt;/strong&gt; is the most trusted signal, and it's slow, expensive, and skewed toward technical users.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM-as-judge&lt;/strong&gt; gets ~98% correlation with Arena for &lt;strong&gt;under $10 and under 3 minutes&lt;/strong&gt; — with known biases toward length and its own family's style.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So before believing any benchmark number, ask three questions: &lt;strong&gt;which benchmark, against whom, judged by what.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Systems: the part nobody tweets about
&lt;/h2&gt;

&lt;p&gt;Mixed precision (store weights in 32-bit, compute in 16-bit, update in 32-bit) and operator fusion (&lt;code&gt;torch.compile&lt;/code&gt; gets roughly 2× faster training by moving data through GPU memory once instead of per op). Unglamorous, and often the difference between a training run finishing or not.&lt;/p&gt;




&lt;p&gt;I packaged all of this as a skill file with a per-claim timestamp index, so you can verify instead of trusting my summary: &lt;strong&gt;&lt;a href="https://github.com/lizhao888/llm-building-map" rel="noopener noreferrer"&gt;github.com/lizhao888/llm-building-map&lt;/a&gt;&lt;/strong&gt; (MIT).&lt;/p&gt;

&lt;p&gt;Caveats, stated plainly: these are unofficial notes from a 2024 lecture, the speaker's hedges are preserved rather than upgraded to facts, and newer methods (long context, reasoning models, synthetic-data pipelines) are explicitly out of scope. Corrections welcome — especially where the field has moved on.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
