<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>单卡道场 - 分类 - 华华的小站</title><link>http://blog.zyhector.com/categories/%E5%8D%95%E5%8D%A1%E9%81%93%E5%9C%BA/</link><description>单卡道场 - 分类 - 华华的小站</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><lastBuildDate>Thu, 16 Apr 2026 12:13:00 -0700</lastBuildDate><atom:link href="http://blog.zyhector.com/categories/%E5%8D%95%E5%8D%A1%E9%81%93%E5%9C%BA/" rel="self" type="application/rss+xml"/><item><title>「从零开始学大模型」TRL GRPOTrainer 源码导读</title><link>http://blog.zyhector.com/2026/04/08-trl.grpotrainer/</link><pubDate>Thu, 16 Apr 2026 12:13:00 -0700</pubDate><author>Hector</author><guid>http://blog.zyhector.com/2026/04/08-trl.grpotrainer/</guid><description>&lt;p>这是在 Hugging Face 的 TRL &lt;a href="https://huggingface.co/docs/trl/quickstart" target="_blank" rel="noopener noreffer ">Quickstart&lt;/a> 界面里，GRPO 训练的示例。今天从这里开始，探索一下 HF 的 GRPOTrainer 是怎样实现的，涵盖普通 Training loop 与 RL/GRPO 中的 Rollout、Training 环节，为之后我们手搓 GRPO Training Loop 打下基础！&lt;/p></description></item><item><title>「从零开始学大模型」TurboQuant</title><link>http://blog.zyhector.com/2026/03/07-turboquant/</link><pubDate>Mon, 30 Mar 2026 17:48:36 -0700</pubDate><author>Hector</author><guid>http://blog.zyhector.com/2026/03/07-turboquant/</guid><description>&lt;p>TurboQuant 是最近的热门，Google 一将它发出来，各种自媒体都在疯传说这个技术将内存占用率压缩了 6 倍，内存价格闪崩。出于兴趣以及正好在学大模型，就看了一下，发现其实也没有想象的那么复杂。&lt;/p></description></item><item><title>「从零开始学大模型」Continuous Batching</title><link>http://blog.zyhector.com/2026/03/06-continuousbatching/</link><pubDate>Tue, 24 Mar 2026 15:05:00 -0700</pubDate><author>Hector</author><guid>http://blog.zyhector.com/2026/03/06-continuousbatching/</guid><description><![CDATA[<p>简单来说就是 Batch 的方式不只有平凡地把 <code>[T, D]</code> 的 Token 向量 “叠起来” 拼，形成 <code>[B, T, D]</code> 的矩阵。在最底层矩阵计算的时候，它被 pytorch 给展平成 <code>[B * T, D]</code> 这样一个大矩阵，去做矩阵乘法。</p>]]></description></item><item><title>「从零开始学大模型」PagedAttention</title><link>http://blog.zyhector.com/2026/03/05-pagedattention/</link><pubDate>Tue, 24 Mar 2026 14:55:00 -0700</pubDate><author>Hector</author><guid>http://blog.zyhector.com/2026/03/05-pagedattention/</guid><description><![CDATA[<h2 id="概述">概述</h2>
<p>Paged Attention 要解决的，是 KV Cache 显存浪费的问题。</p>
<p>一般来说，为了放下 KV Cache，会预先 alloc 出一大块显存，但是 KV Cache 大学又是随着推理进行不断增长，是一个动态的逐渐增大的存储需求。此外，在多个序列同时进行推理时，各个序列的长度不同，对应的 KV Cache 也不一样，此时也不方便为不同序列配置不一样大小的显存。</p>]]></description></item><item><title>「从零开始学大模型」Flash Attention</title><link>http://blog.zyhector.com/2026/03/04-flashattention/</link><pubDate>Wed, 18 Mar 2026 17:01:19 -0700</pubDate><author>Hector</author><guid>http://blog.zyhector.com/2026/03/04-flashattention/</guid><description><![CDATA[<p>Flash Attention针对的痛点是传统 Transformer 在 decode 阶段，计算 attention 时的巨大内存瓶颈。</p>
<p>因为 Attention Block 需要 <code>MatMul -&gt; Mask -&gt; Softmax -&gt; Dropout -&gt; Matmul</code> 这么多步骤，会反复的将大矩阵从 HBM 里搬入 SRAM，计算，再搬出，造成了内存瓶颈。</p>]]></description></item><item><title>「从零开始学大模型」KV Cache</title><link>http://blog.zyhector.com/2026/03/03-kv_cache/</link><pubDate>Tue, 03 Mar 2026 16:26:06 -0800</pubDate><author>Hector</author><guid>http://blog.zyhector.com/2026/03/03-kv_cache/</guid><description>&lt;p>接着上一篇的 NanoGPT 博客内容，笔者继续学习了 不少模型推理的优化手段，会在接下来的几篇里逐一叙述。在上一篇《「从零开始学大模型」手搓GPT》中，我跟着 Andrej Karpathy 写了一个 NanoGPT，这一篇文章也将会是在这个 NanoGPT 的代码上实现优化。&lt;/p></description></item><item><title>「从零开始学大模型」手搓GPT</title><link>http://blog.zyhector.com/2026/02/02-nanogpt/</link><pubDate>Thu, 19 Feb 2026 23:17:25 -0800</pubDate><author>Hector</author><guid>http://blog.zyhector.com/2026/02/02-nanogpt/</guid><description><![CDATA[<p>主要参考：<a href="https://www.youtube.com/watch?v=kCc8FmEb1nY" target="_blank" rel="noopener noreffer ">Andrej Karpathy - Let&rsquo;s build GPT: from scratch, in code, spelled out.</a></p>
<p>为了能更加深入理解 Transformer 和 GPT，笔者选择了跟着教程搭一个 GPT 出来。当然只是跟着教程做还是不够，于是就打算写一篇 blog，从自己的角度讲一下到底是怎么个事儿。</p>]]></description></item><item><title>「从零开始学大模型」Transformer</title><link>http://blog.zyhector.com/2025/05/01-transformer/</link><pubDate>Fri, 09 May 2025 17:46:21 +0800</pubDate><author>Hector</author><guid>http://blog.zyhector.com/2025/05/01-transformer/</guid><description>&lt;h2 id="transformer是做什么的">Transformer是做什么的&lt;/h2>
&lt;p>在GPT等模型中，Transformer模型输入文字、音频、图像等数据，并对文本中下一词出现的概率做预测。选择概率最高的词，追加到输入文本的后面，再将补全后的文本重新作为输入，如此往复，实现文本的补全。&lt;/p></description></item><item><title>使用ncnn对RIFE模型进行int8量化加速</title><link>http://blog.zyhector.com/2025/04/ncnn-rife-int8-quantization/</link><pubDate>Wed, 23 Apr 2025 18:04:17 +0800</pubDate><author>Hector</author><guid>http://blog.zyhector.com/2025/04/ncnn-rife-int8-quantization/</guid><description><![CDATA[<h2 id="目的">目的</h2>
<p>笔者欲将rife模型在手机上完成部署，进行视频插帧推理。</p>
<p>项目：<a href="https://github.com/zyhector/rife-ncnn-android" target="_blank" rel="noopener noreffer ">https://github.com/zyhector/rife-ncnn-android</a></p>
<p>使用的rife-v4.6模型，优化了视频输入输出，解决磁盘IO的瓶颈后，在8Gen3手机上，720p下达到了5.5fps的推理速度。但还是挺慢，就试图借助量化来进行加速。</p>]]></description></item></channel></rss>