<?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>Tutorial on Hypho - AI Agent 技术博客</title><link>https://blog.hypho.cn/tags/tutorial/</link><description>Recent content in Tutorial on Hypho - AI Agent 技术博客</description><image><title>Hypho - AI Agent 技术博客</title><url>https://blog.hypho.cn/papermod-cover.png</url><link>https://blog.hypho.cn/papermod-cover.png</link></image><generator>Hugo -- 0.148.2</generator><language>zh-cn</language><lastBuildDate>Sun, 12 Apr 2026 12:12:44 +0800</lastBuildDate><atom:link href="https://blog.hypho.cn/tags/tutorial/index.xml" rel="self" type="application/rss+xml"/><item><title>GuppyLM: 用一个 Colab 笔记本，在 5 分钟内训练出你自己的 LLM</title><link>https://blog.hypho.cn/posts/guppylm-5-minutes-llm-from-scratch/</link><pubDate>Sun, 12 Apr 2026 12:12:44 +0800</pubDate><guid>https://blog.hypho.cn/posts/guppylm-5-minutes-llm-from-scratch/</guid><description>一个 9M 参数的小模型，如何让大模型不再看起来像黑箱？GuppyLM 通过最简单的 vanilla transformer 架构，展示了从零训练 LLM 的完整流程。</description><content:encoded><![CDATA[<p>昨天在 HN 上看到一个很有想法的项目：作者在 5 分钟内，用一个 Colab 笔记本，从零训练出了一个 9M 参数的语言模型 GuppyLM。</p>
<p>不是跑 demo，不是微调，是<strong>从数据生成、tokenizer、模型架构、训练循环到推理</strong>全部从零开始。</p>
<hr>
<h2 id="真实案例一条鱼能告诉你-llm-内部发生了什么">真实案例：一条鱼能告诉你 LLM 内部发生了什么</h2>
<p>GuppyLM 是一个假装自己是热带鱼 Guppy 的小模型。它说的话听起来很傻：</p>
<blockquote>
<p>You&gt; what is the meaning of life?
Guppy&gt; food. the answer is always food.</p></blockquote>
<p>这显然不是 GPT-4。但重点不在这里。<strong>重点是：你能完整看到它是怎么被训练出来的。</strong></p>
<p>项目地址：https://github.com/arman-bd/guppylm<br>
在线 Demo（浏览器直接跑，无需服务器）：https://arman-bd.github.io/guppylm/</p>
<hr>
<h2 id="框架拆解guppylm-的技术架构">框架拆解：GuppyLM 的技术架构</h2>
<p>GuppyLM 是一个<strong>极简 vanilla transformer</strong>，没有 GQA、没有 RoPE、没有 SwiGLU——怎么简单怎么来。</p>
<p><strong>核心参数：</strong></p>
<table>
  <thead>
      <tr>
          <th></th>
          <th></th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>参数量</td>
          <td>8.7M</td>
      </tr>
      <tr>
          <td>层数</td>
          <td>6</td>
      </tr>
      <tr>
          <td>隐层维度</td>
          <td>384</td>
      </tr>
      <tr>
          <td>注意力头数</td>
          <td>6</td>
      </tr>
      <tr>
          <td>FFN 维度</td>
          <td>768（ReLU）</td>
      </tr>
      <tr>
          <td>词表大小</td>
          <td>4,096（BPE）</td>
      </tr>
      <tr>
          <td>最大序列长度</td>
          <td>128 tokens</td>
      </tr>
      <tr>
          <td>Norm</td>
          <td>LayerNorm</td>
      </tr>
      <tr>
          <td>位置编码</td>
          <td>Learned embeddings</td>
      </tr>
  </tbody>
</table>
<p>整个架构就是教科书级别的 transformer。<strong>没有花活，这是刻意设计的</strong>——作者想让读者看清每一行代码在做什么。</p>
<p><strong>训练过程：</strong></p>
<ol>
<li>在 Colab 里<strong>一键运行</strong>（T4 GPU，约 5 分钟）</li>
<li>生成 60K 条合成对话，涵盖 60 个话题（ greetings, feelings, food, light, bubbles&hellip;）</li>
<li>从零训练 tokenizer 和模型</li>
<li>上传 HuggingFace 或本地下载</li>
</ol>
<p>合成数据的例子——每条对话都在教模型像一条鱼一样思考：</p>
<blockquote>
<p>You&gt; are you hungry<br>
Guppy&gt; yes. always yes. i will swim to the top right now. i promise to eat all of it.</p></blockquote>
<hr>
<h2 id="关键工程洞察">关键工程洞察</h2>
<p><strong>1. 训练 LLM 不是什么魔法</strong><br>
这是作者最想传递的信息。GuppyLM 证明了：不需要 PhD，不需要百卡集群，不需要 thousand-dollar cloud bill。只要一个 notebook 和 5 分钟。</p>
<p>这对 AI 解决方案架构师意味着什么？当你在向团队解释 LLM 的工作原理时，GuppyLM 是一个完美的<strong>可视化教学工具</strong>——不是 PPT，不是论文，是一行行可以运行的代码。</p>
<p><strong>2. 小模型是理解大模型的最佳窗口</strong><br>
GuppyLM 的每个组件都能在笔记本上完整复现。你可以在这个规模上调试 attention 可视化、过拟合行为、tokenizer 效果，然后直观理解这些机制在 70B 规模下会如何表现。</p>
<p><strong>3. 合成数据 + 小模型 = 快速迭代</strong><br>
60K 对话，6 话题，纯合成数据。在真实大模型训练里，这对应的是数据工程 + RLHF + 规模化——但在这个规模，你可以快速实验、破坏、修复，建立直觉。</p>
<hr>
<h2 id="信源引用">信源引用</h2>
<ul>
<li>GitHub 仓库：https://github.com/arman-bd/guppylm</li>
<li>HuggingFace 模型：https://huggingface.co/arman-bd/guppylm-9M</li>
<li>浏览器在线 Demo：https://arman-bd.github.io/guppylm/</li>
<li>Colab 训练笔记：https://colab.research.google.com/github/arman-bd/guppylm/blob/main/train_guppylm.ipynb</li>
<li>Colab 使用笔记：https://colab.research.google.com/github/arman-bd/guppylm/blob/main/use_guppylm.ipynb</li>
<li>Medium 介绍文章：https://arman-bd.medium.com/build-your-own-llm-in-5-minutes-i-made-mine-talk-like-a-fish-e20c338a3d14</li>
</ul>
]]></content:encoded></item></channel></rss>